2   gROOT->LoadMacro(
"$VMCWORKDIR/macro/mvd/Tools.C");
 
    3   gROOT->Macro(
"$VMCWORKDIR/gconfig/rootlogon.C");
 
    5   TFile* 
fsim = 
new TFile(
"../../emc_complete_1GeVphoton_FwEndCap.root");
 
    7   TTree *
tsim=(TTree *) fsim->Get(
"pndsim") ;
 
    9   tsim->SetBranchAddress(
"MCTrack",&mctrack_array);
 
   13   tsim->SetBranchAddress(
"EmcPoint",&point_array);
 
   16   TClonesArray* 
hit_array=
new TClonesArray(
"PndEmcHit");
 
   17   tsim->SetBranchAddress(
"EmcHit",&hit_array);
 
   28   TH2F *
hypad_xpad_p = 
new TH2F(
"ypad_xpad",
"crystal row vs col number (derived from POINT)",74,-37,37,74,-37,37);
 
   29   TH2F *
hx_y_p = 
new TH2F(
"x_y_p",
"x vs y (derived from POINT)",1000,-100,100,1000,-100,100);
 
   30   TH1F *
hid_p = 
new TH1F(
"id_p",
"id (derived from POINT)",140000000,300000000,340000000);
 
   31   TH1F *
hx_p = 
new TH1F(
"x_p",
"X (derived from POINT)",200,-100,100);
 
   32   TH1F *
hy_p = 
new TH1F(
"y_p",
"Y (derived from POINT)",200,-100,100);
 
   33   TH1F *
hz_p = 
new TH1F(
"z_p",
"Z (derived from POINT)",100,200,300);
 
   34   TH1F *
hmodule_p = 
new TH1F(
"module_p",
"Module (derived from POINT)",5,0.5,5.5);
 
   36   TH2F *
hxpad_x_p = 
new TH2F(
"xpad_x_p",
"x vs xpad (derived from POINT)",2*37.5,-37.5,37.5,211,-105,105);
 
   37   TH2F *
hypad_y_p = 
new TH2F(
"ypad_y_p",
"y vs ypad (derived from POINT)",2*37.5,-37.5,37.5,211,-105,105);
 
   40   TH1F *
hene_mc= 
new TH1F(
"hene_mc",
"MC energy (GeV)",100,0.0,1.05);
 
   41   TH1F *
hene_p= 
new TH1F(
"hene_p",
"DATA energy (GeV)",1000,0.0,0.1);
 
   43   TH1F *
hpoi_ene= 
new TH1F(
"hpoi_ene",
"SUM of Point energies (GeV)",100,0.0,1.05);
 
   44   TH1F *
hpoi_ene11_12= 
new TH1F(
"hpoi_ene11_12",
"crystal [11,12] dep. energy (GeV)",100,0.0001,0.2);
 
   45   TH1F *
hpoi_ene12_12= 
new TH1F(
"hpoi_ene12_12",
"crystal [12,12] dep. energy (GeV)",100,0.0001,0.2);
 
   46   TH1F *
hpoi_ene13_12= 
new TH1F(
"hpoi_ene13_12",
"crystal [13,12] dep. energy (GeV)",100,0.0001,0.2);
 
   47   TH1F *
hpoi_ene14_12= 
new TH1F(
"hpoi_ene14_12",
"crystal [14,12] dep. energy (GeV)",100,0.0001,0.2);
 
   51   TH1F *
h10= 
new TH1F(
"h10",
"POINT Theta (MC)",180,0.,180.);
 
   52   TH1F *
h20= 
new TH1F(
"h20",
"POINT Phi (MC)",360,0.,360.);
 
   53   TH1F *
h10d= 
new TH1F(
"h10d",
"POINT Theta (data)",180,0.,180.);
 
   54   TH1F *
h20d= 
new TH1F(
"h20d",
"POINT Phi (data)",360,0.,360.);
 
   56   TH1F *
h1= 
new TH1F(
"h1",
"POINT Theta difference",100,-2.,2.);
 
   57   TH1F *
h2= 
new TH1F(
"h2",
"POINT Phi difference",100,-2.,2.);
 
   60   cout << 
"Number of events = " << ncounts<< endl;
 
  223    TH1F *HISTene_h= 
new TH1F(
"HISTene_h",
"energy (hit)",1000,0.0001,1.01);  
 
  224    TH1F *HISThit_ene= 
new TH1F(
"HISThit_ene",
"FwEndCap energy (hit)",1000,0.0,1.05); 
 
  225    TH1F *HISTz_h = 
new TH1F(
"HISTz_h",
"z (hit)",100,200,300);
 
  226    TH2F *HISTrow_x_h = 
new TH2F(
"HISTrow_x_h",
"row vs x (hit)",200,-100,100,2*38.5,-38.5,38.5);
 
  227    TH2F *HISTrow_crystal_h = 
new TH2F(
"HISTrow_crystal_h",
"row vs column (hit)",2*38.5,-38.5,38.5,2*38.5,-38.5,38.5);
 
  228    TH2F *HISTy_x_h = 
new TH2F(
"HISTy_x_h",
"y vs x (hit)",211,-105,105,211,-105,105);  
 
  229    TH1F *HISTtheta_h = 
new TH1F(
"HISTtheta_h",
"theta (hit)",180,0,180);  
 
  230    TH2I *HISTxpad_x_h = 
new TH2I(
"HISTxpad_x_h",
"",10500,-105,105,100*38.5,-38.5,38.5);
 
  231    TH2I *HISTypad_y_h = 
new TH2I(
"HISTypad_y_h",
"",10500,-105,105,100*38.5,-38.5,38.5);
 
  234   TH1F *HISTOhit_ene11_12= 
new TH1F(
"HISTOhit_ene11_12",
"crystal [11,12] dep. energy (GeV)",100,0.0001,1.01);
 
  235   TH1F *HISTOhit_ene12_12= 
new TH1F(
"HISTOhit_ene12_12",
"crystal [12,12] dep. energy (GeV)",100,0.0001,1.01);
 
  236   TH1F *HISTOhit_ene13_12= 
new TH1F(
"HISTOhit_ene13_12",
"crystal [13,12] dep. energy (GeV)",100,0.0001,1.01);
 
  237   TH1F *HISTOhit_ene14_12= 
new TH1F(
"HISTOhit_ene14_12",
"crystal [14,12] dep. energy (GeV)",100,0.0001,1.01);
 
  241    Int_t efficiencyCounter=0;
 
  242    Int_t atLeastOneHitPerEventCounter=0;
 
  243    for(
int j = 0; j < 
ncounts; j++){
 
  244      Int_t efficiencyFlag=0;
 
  245      Int_t atLeastOneHitPerEventFlag=0;
 
  252         theta_mc=photon_momentum.Theta()*(180./
TMath::Pi());
 
  253         phi_mc=photon_momentum.Phi()*(180./
TMath::Pi());
 
  256         Int_t 
nhits = hit_array->GetEntries();
 
  259           atLeastOneHitPerEventFlag = 1;
 
  269               HISTene_h->Fill(hit_ene);
 
  270               if (hit_ene >= 0.010) 
 
  276                 HISTOhit_ene11_12->Fill(hit_ene);
 
  278                 HISTOhit_ene12_12->Fill(hit_ene);
 
  280                 HISTOhit_ene13_12->Fill(hit_ene);
 
  282                 HISTOhit_ene14_12->Fill(hit_ene);
 
  286               TVector3 hit_pos(hit->GetX(),hit->GetY(),hit->GetZ()); 
 
  287               hit_theta=hit_pos.Theta()*(180./
TMath::Pi());
 
  288               hit_phi=hit_pos.Phi()*(180./
TMath::Pi());
 
  292               h10d->Fill(hit_theta);
 
  294               h1->Fill(hit_theta-theta_mc);
 
  295               h2->Fill(hit_phi-phi_mc);
 
  297               HISTz_h->Fill(hit->GetZ());
 
  299                 HISTxpad_x_h->Fill(hit->GetX(),hit->
GetXPad()-1);
 
  301                 HISTxpad_x_h->Fill(hit->GetX(),hit->
GetXPad());
 
  304                 HISTypad_y_h->Fill(hit->GetY(),hit->
GetYPad()-1);
 
  306                 HISTypad_y_h->Fill(hit->GetY(),hit->
GetYPad());
 
  309                 HISTrow_x_h->Fill(hit->GetX(),hit->
GetYPad()-1);
 
  311                 HISTrow_x_h->Fill(hit->GetX(),hit->
GetYPad());
 
  313               id_h = hit->GetDetectorID();
 
  314               crystal_hid = -(id_h%10000 -36);     
 
  315               row_hid = (id_h/1000000)%100 - 37;   
 
  326               HISTy_x_h->Fill(hit->GetX(),hit->GetY());
 
  329         HISThit_ene->Fill(sum_hit_ene);     
 
  330         if (efficiencyFlag==1)
 
  331           efficiencyCounter+=1;
 
  332         if (atLeastOneHitPerEventFlag==1)
 
  333           atLeastOneHitPerEventCounter+=1;
 
  336           cout<<
"Evt. No. "<< j<<endl;
 
  338    cout<<
"totalhits = "<<totalhits<<
"\n";
 
  339    cout<<
"efficiencyCounter = "<<efficiencyCounter<<
" , atLeastOneHitPerEventCounter = "<<atLeastOneHitPerEventCounter<<
"\n";
 
  340    cout<<
"FwEndCap efficiency (more than 10 MeV deposition in at least one crystal) = "<< (double)efficiencyCounter/atLeastOneHitPerEventCounter<<
"\n";
 
  343   gStyle->SetPalette(1);
 
  522  TCanvas* 
c7 = 
new TCanvas(
"c7",
"", 100, 100, 1000, 700);
 
  523  c7->SetFillColor(10);
 
  524  gStyle->SetOptStat(0);
 
  526  c7->cd(1)->SetRightMargin(0.02);
 
  527  HISTxpad_x_h->Draw(
"box");
 
  528  HISTxpad_x_h->GetYaxis()->SetTitle(
"crystal column number");
 
  529  HISTxpad_x_h->GetYaxis()->SetTitleSize(0.05);
 
  530  HISTxpad_x_h->GetYaxis()->CenterTitle();
 
  531  HISTxpad_x_h->GetYaxis()->SetTitleOffset(1.);
 
  532  HISTxpad_x_h->GetXaxis()->SetTitle(
"x [cm]");
 
  533  HISTxpad_x_h->GetXaxis()->SetTitleSize(0.07);
 
  534  HISTxpad_x_h->GetXaxis()->SetTitleOffset(0.6);
 
  535  HISTxpad_x_h->GetXaxis()->CenterTitle();
 
  536  c7->cd(2)->SetRightMargin(0.02);
 
  537  HISTypad_y_h->Draw(
"box");
 
  538  HISTypad_y_h->GetYaxis()->SetTitle(
"crystal row number");
 
  539  HISTypad_y_h->GetYaxis()->SetTitleSize(0.05);
 
  540  HISTypad_y_h->GetYaxis()->CenterTitle();
 
  541  HISTypad_y_h->GetYaxis()->SetTitleOffset(1.);
 
  542  HISTypad_y_h->GetXaxis()->SetTitle(
"y [cm]");
 
  543  HISTypad_y_h->GetXaxis()->SetTitleSize(0.07);
 
  544  HISTypad_y_h->GetXaxis()->SetTitleOffset(0.6);
 
  545  HISTypad_y_h->GetXaxis()->CenterTitle();
 
TVector3 GetMomentum() const 
TClonesArray * point_array
virtual Double_t GetEnergy() const 
TClonesArray * mctrack_array
represents the deposited energy of one emc crystal from simulation 
int hit(Int_t nEvents=0, TString inFile="sim.root", TString parFile="par.root", TString inDigi="digi.root", TString outFile="hit.root", Int_t timeBased=0)
Short_t GetModule() const