17 FairRunAna *
fRun=
new FairRunAna();
18 fRun->SetInputFile(
"sim_emc.root");
19 fRun->SetOutputFile(
"dummy_out.root");
21 FairRuntimeDb*
rtdb = fRun->GetRuntimeDb();
22 FairParRootFileIo*
parInput1 =
new FairParRootFileIo();
23 parInput1->open(
"simparams.root");
25 TString emcAsciiPar = gSystem->Getenv(
"VMCWORKDIR");
26 emcAsciiPar +=
"/macro/params/";
27 emcAsciiPar +=
"emc.par";
29 FairParAsciiFileIo*
parInput2 =
new FairParAsciiFileIo();
30 parInput2->open(emcAsciiPar.Data(),
"in");
32 rtdb->setFirstInput(parInput1);
33 rtdb->setSecondInput(parInput2);
41 TFile*
f =
new TFile(
"full_emc.root");
42 TTree *
t=(TTree *) f->Get(
"pndsim") ;
44 TClonesArray*
hit_array=
new TClonesArray(
"PndEmcHit");
45 t->SetBranchAddress(
"EmcHit",&hit_array);
47 TFile*
fsim =
new TFile(
"sim_emc.root");
48 TTree *
tsim=(TTree *) fsim->Get(
"pndsim") ;
50 TClonesArray*
point_array=
new TClonesArray(
"PndEmcPoint");
51 tsim->SetBranchAddress(
"EmcPoint",&point_array);
53 TH1F *
h1=
new TH1F(
"h1",
"Energy deposit, sum points",500,0,2);
54 TH1F *
h2=
new TH1F(
"h2",
"Energy deposit, hits",500,0,2);
61 for (Int_t j=0; j< t->GetEntriesFast(); j++)
70 for (Int_t
i=0;
i<hit_array->GetEntriesFast();
i++)
78 total_energy_from_hits += hit->
GetEnergy();
80 Int_t detID = hit->GetDetectorID();
82 for (Int_t k=0; k<point_array->GetEntriesFast(); k++)
85 if (point->GetDetectorID()==detID) energy_from_points+=point->GetEnergyLoss();
89 cout <<
"<E> Energy of det=" << detID<<
" does not match between points and digis: " << hit->
GetEnergy() <<
"/" << energy_from_points << endl;
94 if (module==5)
continue;
96 h2->Fill(total_energy_from_hits);
100 Double_t total_energy_from_points=0;
102 for (Int_t
i=0;
i<point_array->GetEntriesFast();
i++)
105 total_energy_from_points += point->GetEnergyLoss();
108 h1->Fill(total_energy_from_points);
110 if (
fabs(total_energy_from_points-total_energy_from_hits)>tolerance)
112 cout <<
"<E> Total energy values do not match: " << total_energy_from_points <<
"/" << total_energy_from_hits << endl;
118 cout <<
" Test passed" << endl;
119 cout <<
" All ok " << endl;
121 cout <<
" Test Failed" << endl;
122 cout <<
" Not Ok " << endl;
represents a mc hit in an emc crystal
TClonesArray * point_array
virtual Double_t GetEnergy() const
FairParAsciiFileIo * parInput2
friend F32vec4 fabs(const F32vec4 &a)
FairParRootFileIo * parInput1
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