Functions
TransverseEff.C File Reference
#include <cmath>
#include <iostream>
#include <iomanip>
#include <vector>
#include <TF1.h>
#include <TH1D.h>
#include <TH2D.h>
#include <TFile.h>
#include <TProfile.h>
#include <TCanvas.h>
#include <TRandom2.h>
#include <TVector3.h>
#include <TString.h>
#include <TLatex.h>
#include <TLine.h>
#include <TROOT.h>
#include <TMath.h>
#include "include/RootUtils.hh"
#include "include/PhotonTracer.hh"

Go to the source code of this file.

Functions

void TransverseEff ()
 

Function Documentation

void TransverseEff ( )

Definition at line 26 of file TransverseEff.C.

References om::cout, msf_helper::generator, MECModelEnuComparisons::i, iterations, iX, art::left(), nbins, submit_syst::x, submit_syst::y, and test::z.

27 {
28  double z = 750.0;
29  TRandom2 generator(0);
30 
31  //fiberSeparation = 6.15 cm at the retaining ring
32  //PhotonTracer tracer(6.15);
33  PhotonTracer tracer(5.0);
34 
35  TH2D* hTransverseEff = new TH2D("hTransverseEff", ";X (cm);Y (cm)", 100, -0.5, 4.1, 100, -0.5, 6.14);
36  int nbins = hTransverseEff->GetXaxis()->GetNbins()*hTransverseEff->GetYaxis()->GetNbins();
37 
38  Long64_t iterations = 1e4;
39  Long64_t totalIter(0);
40  cout.setf(ios::left);
41  for (int iX = 1; iX <= hTransverseEff->GetXaxis()->GetNbins(); ++iX)
42  {
43  for (int iY = 1; iY <= hTransverseEff->GetYaxis()->GetNbins(); ++iY)
44  {
45  //cout << "Bin (" << iX << ", " << iY << ")" << endl;
46  //cout << endl;
47  double x = hTransverseEff->GetXaxis()->GetBinCenter(iX);
48  double y = hTransverseEff->GetYaxis()->GetBinCenter(iY);
49 
50  Long64_t successes(0);
51  for (Long64_t i = 0; i < iterations; ++i)
52  {
53  totalIter += 1;
54  if (i%2000 == 0)
55  {
56  double percent_done = 100.0*((double)totalIter/(double)(iterations*nbins));
57  cout << "percent done: " << setprecision(2) << fixed << percent_done << "%\r" << flush;
58  }
59  if ( tracer.TraceOnePhoton( z, x, y, false ) ) successes += 1.0;
60  }
61  hTransverseEff->SetBinContent(iX, iY, successes/(double)iterations);
62  }
63  //cout << endl;
64  }
65 
66  hTransverseEff->Draw("colz");
67 }
const int nbins
Definition: cellShifts.C:15
z
Definition: test.py:28
OStream cout
Definition: OStream.cxx:6
constexpr auto const & left(const_AssnsIter< L, R, D, Dir > const &a, const_AssnsIter< L, R, D, Dir > const &b)
Definition: AssnsIter.h:104
Float_t iX
Long64_t iterations[nThreads]
Definition: PhotonSim_mp.C:71