10 int analysis_hit_digi_cluster_fwendcap()
12 gROOT->LoadMacro("$VMCWORKDIR/macro/mvd/
Tools.C
");
13 gROOT->Macro("$VMCWORKDIR/gconfig/
rootlogon.C
");
15 TFile* fsim = new TFile("/home/moini/myPandaRoot/myCodes/ROOTfiles/FwEndCapResolution_vacuum_noMagField/assuming150photonsperMeV/emc_complete_5GeVphotons.root
");
17 TTree *tsim=(TTree *) fsim->Get("pndsim
") ;
18 TClonesArray* mctrack_array=new TClonesArray("PndMCTrack");
19 tsim->SetBranchAddress("MCTrack
",&mctrack_array);
21 TClonesArray* hit_array=new TClonesArray("PndEmcHit");
22 tsim->SetBranchAddress("EmcHit
",&hit_array);
24 TClonesArray* digi_array=new TClonesArray("PndEmcDigi");
25 tsim->SetBranchAddress("EmcDigi
",&digi_array);
27 TClonesArray* cluster_array=new TClonesArray("PndEmcCluster");
28 tsim->SetBranchAddress("EmcCluster
",&cluster_array);
30 TClonesArray* bump_array=new TClonesArray("PndEmcBump");
31 tsim->SetBranchAddress("EmcBump
",&bump_array);
33 Double_t theta_mc, phi_mc, ene_mc,
34 hit_ene, hit_theta, hit_phi, hit_id, hit_x, hit_y,
35 digi_ene, digi_theta, digi_phi;
36 TVector3 photon_momentum;
38 Double_t clusterThresholdEnergy=0;
40 TH1F *hene_mc= new TH1F("hene_mc","MC
energy (GeV)
",100,0.0,1.05);
41 TH1F *h10= new TH1F("h10"," Theta (MC)
",180,0.,180.);
42 TH1F *h20= new TH1F("h20"," Phi (MC)
",360,0.,360.);
43 TH1F *h10d= new TH1F("h10d"," Theta (data)
",180,0.,180.);
44 TH1F *h20d= new TH1F("h20d"," Phi (data)
",360,0.,360.);
45 TH1F *h1= new TH1F("h1"," Theta difference
",100,-2.,2.);
46 TH1F *h2= new TH1F("h2"," Phi difference
",100,-2.,2.);
48 Int_t ncounts = tsim->GetEntriesFast();
49 cout << "Number of events =
" << ncounts<< endl;
50 //ncounts=100; //in case you want to analyse specific number of events
53 Int_t module_h, id_h, crystal_hid, row_hid;
54 TH1F *HISTene_h= new TH1F("HISTene_h
","energy (
hit)
",1000,0.0,1.01); // deposited energy per hit in the whole FwEndCap
55 TH1F *HISThit_ene= new TH1F("HISThit_ene
","FwEndCap
energy (
hit)
",2010,0.0,2.01); // deposited energy per event in the whole FwEndCap (1 MeV/bin precision)
56 TH1F *HISThit_ene_10by6crystalPack= new TH1F("HISThit_ene_10by6crystalPack
","",2010,0.0,2.01);//(1 MeV/bin precision)
57 TH1F *HISThit_ene_3by3crystalPack= new TH1F("HISThit_ene_3by3crystalPack
","",2010,0.0,2.01);//(1 MeV/bin precision)
58 TH1F *HISTz_h = new TH1F("HISTz_h
","z (
hit)
",100,200,300);
59 TH2F *HISTxpad_x_h = new TH2F("HISTxpad_x_h
","xpad vs
x (
hit)
",211,-105,105,2*38.5,-38.5,38.5);
60 TH2F *HISTypad_y_h = new TH2F("HISTypad_y_h
","ypad vs
y (
hit)
",211,-105,105,2*38.5,-38.5,38.5);
61 TH2F *HISTrow_x_h = new TH2F("HISTrow_x_h
","row vs
x (
hit)
",200,-100,100,2*38.5,-38.5,38.5);
62 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);
63 TH2F *HISTy_x_h = new TH2F("HISTy_x_h
","y vs
x (
hit)
",211,-105,105,211,-105,105); // y- versus x-position of the center of the hit crystal
64 TH1F *HISTtheta_h = new TH1F("HISTtheta_h
","theta (
hit)
",180,0,180); // theta of the
65 TH1I *HISTmultiplicity_5MeVtrigThresh_h = new TH1I("HISTmultiplicity_5MeVtrigThresh_h
","Crystal
hit multiplicity (3 MeV detection
threshold and considering 5 MeV trigger
threshold)
",40,0.5,40.5);
66 TH1I *HISTmultiplicity_10MeVtrigThresh_h = new TH1I("HISTmultiplicity_10MeVtrigThresh_h
","Crystal
hit multiplicity (3 MeV detection
threshold and 10 MeV trigger
threshold)
",40,0.5,40.5);
67 TH1I *HISTmultiplicity_10MeVtrigThresh_5MeVdetectionThresh_h = new TH1I("HISTmultiplicity_10MeVtrigThresh_5MeVdetectionThresh_h
","FwEndCap crystal
hit multiplicity (5 MeV detection
threshold and 10 MeV trigger
threshold)
",40,0.5,40.5);
68 TH1I *HISTmultiplicity_10MeVtrigThresh_10MeVdetectionThresh_h = new TH1I("HISTmultiplicity_10MeVtrigThresh_10MeVdetectionThresh_h
","FwEndCap crystal
hit multiplicity (10 MeV trigger
threshold) -- sensitivity to detection
threshold",40,0.5,40.5);
69 TH1I *HISTmultiplicity_10MeVtrigThresh_NOdetectionThresh_h = new TH1I("HISTmultiplicity_10MeVtrigThresh_NOdetectionThresh_h
","FwEndCap crystal
hit multiplicity (no detection
threshold and 10 MeV trigger
threshold)
",40,0.5,40.5);
70 TH1I *HISTmultiplicity_1MeVtrigThresh_100keV_h = new TH1I("HISTmultiplicity_1MeVtrigThresh_100keV_h
","",40,0.5,40.5);
71 TH1I *HISTmultiplicity_1MeVtrigThresh_300keV_h = new TH1I("HISTmultiplicity_1MeVtrigThresh_300keV_h
","",40,0.5,40.5);
73 //TH1F *HISTid_h = new TH1F("HISTid_h
","id (HIT)
",140000000,300000000,340000000);
74 TH1F *HISTOhit_ene19_1= new TH1F("HISTOhit_ene19_1
","crystal [19,1] dep.
energy (GeV)
",2010,0.0,2.01);
75 TH1F *HISTOhit_ene19_2= new TH1F("HISTOhit_ene19_2
","crystal [19,2] dep.
energy (GeV)
",2010,0.0,2.01);
76 TH1F *HISTOhit_ene19_3= new TH1F("HISTOhit_ene19_3
","crystal [19,3] dep.
energy (GeV)
",2010,0.0,2.01);
77 TH1F *HISTOhit_ene19_4= new TH1F("HISTOhit_ene19_4
","crystal [19,4] dep.
energy (GeV)
",2010,0.0,2.01);
78 TH1F *HISTOhit_ene19_5= new TH1F("HISTOhit_ene19_5
","crystal [19,5] dep.
energy (GeV)
",2010,0.0,2.01);
80 Int_t module_d, id_d, crystal_did, row_did;
81 TH1F *HISTdigi_ene= new TH1F("HISTdigi_ene
","FwEndCap
energy (
digi)
",2010,0.0,2.01); // deposited energy per event in the whole FwEndCap (1 MeV/bin precision)
82 TH1F *HISTene_d= new TH1F("HISTene_d
","energy (
digi)
",1000,0.0001,1.01); // deposited energy per digi in the whole FwEndCap
83 TH2F *HISTxpad_x_d = new TH2F("HISTxpad_x_d
","xpad vs
x (
digi)
",200,200,300,2*38.5,-38.5,38.5); // here x means: map of the x-position of the hit crystal
84 TH2F *HISTypad_y_d = new TH2F("HISTypad_y_d
","ypad vs
y (
digi)
",200,200,300,2*38.5,-38.5,38.5); // here y means: map of the y-position of the hit crystal
85 TH2F *HISTrow_x_d = new TH2F("HISTrow_x_d
","row vs
x (
digi)
",200,200,300,2*38.5,-38.5,38.5); // here x means: map of the x-position of the hit crystal
86 TH2F *HISTrow_crystal_d = new TH2F("HISTrow_crystal_d
","row vs column (
digi)
",2*38.5,-38.5,38.5,2*38.5,-38.5,38.5);
87 TH2F *HISTy_x_d = new TH2F("HISTy_x_d
","y vs
x (
digi map)
",200,200,300,200,200,300); // here x and y mean: map of the y- and x-position of the hit crystal
88 TH1F *HISTtotdigis_fromClusterAnalysis = new TH1F("HISTtotdigis_fromClusterAnalysis
","total number of digis per
event",100,0,25);
89 TH1I *HISTmultiplicity_5MeVtrigThresh_d = new TH1I("HISTmultiplicity_5MeVtrigThresh_d
","Crystal
digi multiplicity per event (3 MeV detection
threshold and considering 5 MeV trigger
threshold)
",40,0.5,40.5);
90 TH1I *HISTmultiplicity_10MeVtrigThresh_d = new TH1I("HISTmultiplicity_10MeVtrigThresh_d
","Crystal
digi multiplicity per event (3 MeV detection
threshold and considering 10 MeV trigger
threshold)
",40,0.5,40.5);
91 TH1F *HISTOdigi_ene19_1= new TH1F("HISTOdigi_ene19_1
","crystal [19,1] dep.
energy (GeV)
",2010,0.0,2.01);
92 TH1F *HISTOdigi_ene19_2= new TH1F("HISTOdigi_ene19_2
","crystal [19,2] dep.
energy (GeV)
",2010,0.0,2.01);
93 TH1F *HISTOdigi_ene19_3= new TH1F("HISTOdigi_ene19_3
","crystal [19,3] dep.
energy (GeV)
",2010,0.0,2.01);
94 TH1F *HISTOdigi_ene19_4= new TH1F("HISTOdigi_ene19_4
","crystal [19,4] dep.
energy (GeV)
",2010,0.0,2.01);
95 TH1F *HISTOdigi_ene19_5= new TH1F("HISTOdigi_ene19_5
","crystal [19,5] dep.
energy (GeV)
",2010,0.0,2.01);
96 TH1F *HISTdigi_ene_10by6crystalPack= new TH1F("HISTdigi_ene_10by6crystalPack
","",2010,0.0,2.01);//(1 MeV/bin precision)
97 TH1F *HISTdigi_ene_3by3crystalPack= new TH1F("HISTdigi_ene_3by3crystalPack
","",2010,0.0,2.01);//(1 MeV/bin precision)
99 TH1I *HISTnumberOfClusters = new TH1I("HISTnumberOfClusters
","Total number of clusters per event, having more than or equal to one
digi per cluster
",100,0,20);
100 TH1I *HISTclustNo = new TH1I("HISTclustNo
","Total number of clusters per event, having more than one
digi per cluster and satisfying the cluster
threshold energy",1000,0,20);
101 TH1I *HISTndigisOfHighestEnergyCluster = new TH1I("HISTndigisOfHighestEnergyCluster
","Number of digis per
event for clusters with highest
energy deposition
",1000,0,30);
102 TH1F *HISTmax_cluster_energy= new TH1F("HISTOmax_cluster_energy
","Maximum cluster
energy deposition per
event",500,0.,1.05);
103 TH1F *HISTmax_cluster_theta = new TH1F("HISTmax_cluster_theta
","#
theta per
event of the cluster with maximum deposition
energy",100,0,30);
104 TH1F *HISTmax_cluster_phi = new TH1F("HISTmax_cluster_phi
","#
phi per
event of the cluster with maximum deposition
energy",370,-185,185);
105 TH1F *HISTmax_cluster_x = new TH1F("HISTmax_cluster_x
","x per
event of the cluster with maximum deposition
energy",220,-110,110);
106 TH1F *HISTmax_cluster_y = new TH1F("HISTmax_cluster_y
","y per
event of the cluster with maximum deposition
energy",220,-110,110);
107 TH1F *HISTmax_cluster_z = new TH1F("HISTmax_cluster_z
","z per
event of the cluster with maximum deposition
energy",80,208,216);
108 TH2F *HISTmax_cluster_y_x = new TH2F("HISTmax_cluster_y_x
","y vs
x per
event of the cluster with maximum deposition
energy",220,-110,110,220,-110,110);
109 TH1F *HISTtheta_MonteCarlo = new TH1F("HISTtheta_MonteCarlo
","Monte Carlo #
theta per
event of the cluster with maximum deposition
energy",100,0,30);
110 TH1F *HISTphi_MonteCarlo = new TH1F("HISTphi_MonteCarlo
","Monte Carlo #
phi per
event of the cluster with maximum deposition
energy",370,-185,185);
111 TH1F *HISTmax_cluster_theta_diff = new TH1F("HISTmax_cluster_theta_diff
","Difference between Monte Carlo and reconstructed #
theta per
event of the cluster with maximum deposition
energy",100,-5,5);
112 TH1F *HISTmax_cluster_phi_diff = new TH1F("HISTmax_cluster_phi_diff
","Difference between Monte Carlo and reconstructed #
phi per
event of the cluster with maximum deposition
energy",360,-5,5);
113 TH2F *HISTtheta_MonteCarlo_cluster = new TH2F("HISTtheta_MonteCarlo_cluster
","Monte Carlo versus cluster #
theta of the cluster with maximum deposition
energy",100,0,30,100,0,30);
114 TH2F *HISTphi_MonteCarlo_cluster = new TH2F("HISTphi_MonteCarlo_cluster
","Monte Carlo versus cluster #
phi of the cluster with maximum deposition
energy",370,-185,185,370,-185,185);
115 TH1F *HISTmax_cluster_x_diff = new TH1F("HISTmax_cluster_x_diff
","Difference between Monte Carlo and reconstructed
x per
event of the cluster with maximum deposition
energy",100,-5,5);
116 TH1F *HISTmax_cluster_y_diff = new TH1F("HISTmax_cluster_y_diff
","Difference between Monte Carlo and reconstructed
y per
event of the cluster with maximum deposition
energy",100,-5,5);
117 TH2F *HISTclusterSize_clusterPhi = new TH2F("HISTclusterSize_clusterPhi
","number of digis vs cluster #
phi for clusters with highest
energy deposition
",370,-185,185,100,0,25);
118 TH2F *HISTclusterEnergy_clusterPhi = new TH2F("HISTclusterEnergy_clusterPhi
","cluster
energy deposition vs cluster #
phi for clusters with highest
energy deposition
",370,-185,185,500,0.,1.05);
119 TH2F *HISTnumberOfclusters_clusterPhi = new TH2F("HISTnumberOfclusters_clusterPhi
","number of clusters vs cluster #
phi for clusters with highest
energy deposition
",370,-185,185,100,0,20);
120 TH2F *HISTtotdigis_clusterPhi = new TH2F("HISTtotdigis_clusterPhi
","total number of digis vs cluster #
phi (#
phi of clusters with highest
energy deposition)
",370,-185,185,100,0,25);
123 Int_t totalhits=0; //counter on the total number of hits (fired detectors) in all events
124 Int_t efficiencyCounter_h=0;
125 Int_t atLeastOneHitPerEventCounter_h=0;
127 Int_t totaldigis=0; //counter on the total number of digis (fired detectors) in all events
128 Int_t efficiencyCounter_d=0;
129 Int_t atLeastOneHitPerEventCounter_d=0;
131 for (int j = 0; j < ncounts; j++) {
132 Int_t efficiencyFlag10MeV_h=0;
133 Int_t efficiencyFlag5MeV_h=0;
134 Int_t efficiencyFlag1MeV_h=0;
135 Int_t atLeastOneHitPerEventFlag_h=0;
136 Double_t sum_hit_ene=0;
137 Double_t sum_hit_ene_10by6crystalPack=0;
138 Double_t sum_hit_ene_3by3crystalPack=0;
140 Int_t efficiencyFlag10MeV_d=0;
141 Int_t efficiencyFlag5MeV_d=0;
142 Int_t atLeastOneHitPerEventFlag_d=0;
143 Double_t sum_digi_ene=0;
144 Double_t sum_digi_ene_10by6crystalPack=0;
145 Double_t sum_digi_ene_3by3crystalPack=0;
149 PndMCTrack *mctrack=(PndMCTrack *) mctrack_array->At(0);
150 photon_momentum=mctrack->GetMomentum();
151 theta_mc=photon_momentum.Theta()*(180./TMath::Pi());
152 phi_mc=photon_momentum.Phi()*(180./TMath::Pi());
153 //p4mom=mctrack->Get4Momentum();
156 Int_t nhits = hit_array->GetEntries();
159 atLeastOneHitPerEventFlag_h = 1;
160 Int_t firedCrystals_h=0;
161 Int_t firedCrystals5MeV_h=0;
162 Int_t firedCrystals10MeV_h=0;
163 Int_t firedCrystals100keV_h=0;
164 Int_t firedCrystals300keV_h=0;
166 for (Int_t i=0; i<nhits; i++)
168 PndEmcHit *hit=(PndEmcHit*)hit_array->At(i); // get the i-th hit (detector) of the event
169 module_h = hit->GetModule();
172 //hene_mc->Fill(p4mom.E());
173 hit_ene=hit->GetEnergy();
174 HISTene_h->Fill(hit_ene);
175 if (hit_ene >= 0.010) // 10 MeV trigger threshold used (here only) to calculate the efficiency of the FwEndCap geometry
176 efficiencyFlag10MeV_h = 1;
177 if (hit_ene >= 0.005)
178 efficiencyFlag5MeV_h = 1;
179 if (hit_ene >= 0.001)
180 efficiencyFlag1MeV_h = 1;
182 if (hit_ene >= 0.003)
183 firedCrystals_h++; //for 3 MeV detection threshold
184 if (hit_ene >= 0.005)
185 firedCrystals5MeV_h++; //for 5 MeV detection threshold
186 if (hit_ene >= 0.010)
187 firedCrystals10MeV_h++; //for 10 MeV detection threshold
188 if (hit_ene >= 0.0001)
189 firedCrystals100keV_h++; //for 100 keV detection threshold
190 if (hit_ene >= 0.0003)
191 firedCrystals300keV_h++; //for 300 keV detection threshold
194 //filling some histograms for a few crystals
195 if (hit_ene >= 0.003 && hit->GetXPad()==19 && hit->GetYPad()==1)
196 HISTOhit_ene19_1->Fill(hit_ene);
197 else if (hit_ene >= 0.003 && hit->GetXPad()==19 && hit->GetYPad()==2)
198 HISTOhit_ene19_2->Fill(hit_ene);
199 else if (hit_ene >= 0.003 && hit->GetXPad()==19 && hit->GetYPad()==3)
200 HISTOhit_ene19_3->Fill(hit_ene);
201 else if (hit_ene >= 0.003 && hit->GetXPad()==19 && hit->GetYPad()==4)
202 HISTOhit_ene19_4->Fill(hit_ene);
203 else if (hit_ene >= 0.003 && hit->GetXPad()==19 && hit->GetYPad()==5)
204 HISTOhit_ene19_5->Fill(hit_ene);
206 if (hit_ene >= 0.003 && hit->GetXPad()>=15 && hit->GetXPad()<=24 && hit->GetYPad()>=-1 && hit->GetYPad()<=5)//pack of 6x10 crystals
207 sum_hit_ene_10by6crystalPack+=hit_ene;
208 if (hit_ene >= 0.003 && hit->GetXPad()>=18 && hit->GetXPad()<=20 && hit->GetYPad()>=1 && hit->GetYPad()<=3)//pack of 3x3 crystals around crystal of col=19 and row=2
209 sum_hit_ene_3by3crystalPack+=hit_ene;
211 if (hit_ene >= 0.003)
212 sum_hit_ene+=hit_ene;
214 TVector3 hit_pos(hit->GetX(),hit->GetY(),hit->GetZ()); // position of the center of the hit crystal
215 hit_theta=hit_pos.Theta()*(180./TMath::Pi());
216 hit_phi=hit_pos.Phi()*(180./TMath::Pi());
219 h10d->Fill(hit_theta);
221 h1->Fill(hit_theta-theta_mc);
222 h2->Fill(hit_phi-phi_mc);
224 id_h = hit->GetDetectorID();
225 crystal_hid = -(id_h%10000 -36); //crystal column number (the same as GetXPad())
226 row_hid = (id_h/1000000)%100 - 37; //crystal row number (the same as GetYPad())
228 HISTz_h->Fill(hit->GetZ());
229 HISTxpad_x_h->Fill(hit->GetX(),hit->GetXPad());
230 HISTypad_y_h->Fill(hit->GetY(),hit->GetYPad());
231 HISTrow_x_h->Fill(hit->GetX(),hit->GetYPad());
233 //HISTid_h->Fill(id_h);
234 HISTrow_crystal_h->Fill(hit->GetXPad(),hit->GetYPad());
235 HISTy_x_h->Fill(hit->GetX(),hit->GetY());
240 if (efficiencyFlag10MeV_h==1) //if the trigger threshold is satisfied
242 HISThit_ene->Fill(sum_hit_ene); // deposited energy per event in all hits (whole FwEndCap)
243 HISThit_ene_10by6crystalPack->Fill(sum_hit_ene_10by6crystalPack);// deposited energy per event in the pack of 6x10 crystals
244 HISThit_ene_3by3crystalPack->Fill(sum_hit_ene_3by3crystalPack);// deposited energy per event in the pack of 3x3 crystals
247 if (efficiencyFlag10MeV_h==1)
249 efficiencyCounter_h+=1;
250 HISTmultiplicity_10MeVtrigThresh_h->Fill(firedCrystals_h); //10 MEV trigger threshold and 3 MeV detection threshold (in the level of hit)
251 HISTmultiplicity_10MeVtrigThresh_5MeVdetectionThresh_h->Fill(firedCrystals5MeV_h); //10 MEV trigger threshold and 5 MeV detection threshold (in the level of hit)
252 HISTmultiplicity_10MeVtrigThresh_10MeVdetectionThresh_h->Fill(firedCrystals10MeV_h); //10 MEV trigger threshold and 10 MeV detection threshold (in the level of hit)
253 HISTmultiplicity_10MeVtrigThresh_NOdetectionThresh_h->Fill(nhits); //10 MEV trigger threshold and no detection threshold (in the level of hit)
255 if (efficiencyFlag5MeV_h==1)
256 HISTmultiplicity_5MeVtrigThresh_h->Fill(firedCrystals_h); //5 MEV trigger threshold and 3 MeV detection threshold (in the level of hit)
258 if (efficiencyFlag1MeV_h==1)
260 HISTmultiplicity_1MeVtrigThresh_100keV_h->Fill(firedCrystals100keV_h); //1 MEV trigger threshold and 100 keV detection threshold (in the level of hit)
261 HISTmultiplicity_1MeVtrigThresh_300keV_h->Fill(firedCrystals300keV_h); //1 MEV trigger threshold and 300 keV detection threshold (in the level of hit)
264 if (atLeastOneHitPerEventFlag_h==1)
265 atLeastOneHitPerEventCounter_h+=1;
268 Int_t ndigis = digi_array->GetEntries();
271 atLeastOneHitPerEventFlag_d = 1;
273 for (Int_t i=0; i<ndigis; i++)
275 PndEmcDigi *digi=(PndEmcDigi*)digi_array->At(i);
276 TVector3 digi_pos=digi->where();
277 module_d = digi->GetModule();
279 //dene_mc->Fill(p4mom.E());
281 digi_ene=digi->GetEnergy();
282 HISTene_d->Fill(digi_ene);
283 if (digi_ene >= 0.010) // 10 MeV trigger threshold used (here only) to calculate the efficiency of the FwEndCap geometry
284 efficiencyFlag10MeV_d = 1;
285 if (digi_ene >= 0.005) // 5 MeV trigger threshold used (here only) to calculate the efficiency of the FwEndCap geometry
286 efficiencyFlag5MeV_d = 1;
288 //filling some histograms for a few crystals
289 if (digi_ene >= 0.003 && digi->GetXPad()==19 && digi->GetYPad()==1)
290 HISTOdigi_ene19_1->Fill(digi_ene);
291 else if (digi_ene >= 0.003 && digi->GetXPad()==19 && digi->GetYPad()==2)
292 HISTOdigi_ene19_2->Fill(digi_ene);
293 else if (digi_ene >= 0.003 && digi->GetXPad()==19 && digi->GetYPad()==3)
294 HISTOdigi_ene19_3->Fill(digi_ene);
295 else if (digi_ene >= 0.003 && digi->GetXPad()==19 && digi->GetYPad()==4)
296 HISTOdigi_ene19_4->Fill(digi_ene);
297 else if (digi_ene >= 0.003 && digi->GetXPad()==19 && digi->GetYPad()==5)
298 HISTOdigi_ene19_5->Fill(digi_ene);
300 if (digi_ene >= 0.003 && digi->GetXPad()>=15 && digi->GetXPad()<=24 && digi->GetYPad()>=-1 && digi->GetYPad()<=5)//pack of 6x10 crystals
301 sum_digi_ene_10by6crystalPack+=digi_ene;
302 if (digi_ene >= 0.003 && digi->GetXPad()>=18 && digi->GetXPad()<=20 && digi->GetYPad()>=1 && digi->GetYPad()<=3)//pack of 3x3 crystals around crystal of col=19 and row=2
303 sum_digi_ene_3by3crystalPack+=digi_ene;
305 if (digi_ene >= 0.003)
306 sum_digi_ene+=digi_ene;
308 //Double_t digi_z=digi_pos.Z();
309 //hz_d->Fill(digi_z);
311 digi_theta=(digi->GetTheta())*(180./TMath::Pi());
312 digi_phi=(digi->GetPhi())*(180./TMath::Pi());
313 //h10digi->Fill(theta_mc);
314 //h20digi->Fill(phi_mc);
315 //h10ddigi->Fill(digi_theta);
316 //h20ddigi->Fill(digi_phi);
317 //h1d->Fill(digi_theta-theta_mc);
318 //h2d->Fill(digi_phi-phi_mc);
320 id_d = digi->GetDetectorId();
321 crystal_did = -(id_d%10000 - 36); //crystal column number (the same as GetXPad())
322 row_did = (id_d/1000000)%100 - 37; //crystal row number (the same as GetYPad())
324 HISTxpad_x_d->Fill(digi->GetThetaInt(),digi->GetXPad());
325 HISTypad_y_d->Fill(digi->GetPhiInt(),digi->GetYPad());
326 HISTrow_x_d->Fill(digi->GetThetaInt(),digi->GetYPad());
329 //hmodule_d->Fill(module_d);
330 HISTrow_crystal_d->Fill(digi->GetXPad(),digi->GetYPad());
331 HISTy_x_d->Fill(digi->GetThetaInt(),digi->GetPhiInt());
335 if (efficiencyFlag10MeV_d==1) //if the trigger threshold is satisfied
337 HISTdigi_ene->Fill(sum_digi_ene); // deposited energy per event in all digis (whole FwEndCap)
338 HISTdigi_ene_10by6crystalPack->Fill(sum_digi_ene_10by6crystalPack);// deposited energy per event in the pack of 6x10 crystals
339 HISTdigi_ene_3by3crystalPack->Fill(sum_digi_ene_3by3crystalPack);// deposited energy per event in the pack of 3x3 crystals
342 if (efficiencyFlag10MeV_d==1)
344 efficiencyCounter_d+=1;
345 HISTmultiplicity_10MeVtrigThresh_d->Fill(ndigis); //10 MEV trigger threshold and 3 MeV detection threshold (in the level of digi this 3 MeV is already implemented)
347 if (efficiencyFlag5MeV_d==1)
348 HISTmultiplicity_5MeVtrigThresh_d->Fill(ndigis); //5 MEV trigger threshold and 3 MeV detection threshold (in the level of digi this 3 MeV is already implemented)
350 if (atLeastOneHitPerEventFlag_d==1)
351 atLeastOneHitPerEventCounter_d+=1;
355 Int_t NumberOfClusters, ClustNo, idClusterSatisfiedThresholdEnergy, ndigisOfHighestEnergyCluster, totdigis_fromClusterAnalysis;
356 idClusterSatisfiedThresholdEnergy = -1; //set per event
357 NumberOfClusters=ClustNo=ndigisOfHighestEnergyCluster=totdigis_fromClusterAnalysis=0; //set per event
358 Double_t highestenergy = 0; //set per event
360 if (cluster_array->GetEntriesFast() > 0 && module_d==3)
362 // find the cluster with the highest energy
364 NumberOfClusters=cluster_array->GetEntriesFast();
365 for (Int_t i=0; i<NumberOfClusters; i++) //loop over all clusters of the present event under analysis
367 PndEmcCluster *cluster=(PndEmcCluster*)cluster_array->At(i);
368 Double_t cluster_energy=cluster->energy();
370 Int_t ndigi=cluster->NumberOfDigis(); // number of fired detectors inside the cluster
371 totdigis_fromClusterAnalysis += ndigi;
372 if (ndigi > 1 && cluster_energy >= clusterThresholdEnergy) //by definition for a cluster ndigi should be more than 1
375 if (cluster_energy > highestenergy) //finding the cluster with highest deposited energy
377 idClusterSatisfiedThresholdEnergy = i;
378 highestenergy = cluster_energy;
379 ndigisOfHighestEnergyCluster = ndigi;
383 // Per-event analysis of this cluster with highest deposited energy
384 if (idClusterSatisfiedThresholdEnergy != -1) {
385 PndEmcCluster *cluster=(PndEmcCluster*)cluster_array->At(idClusterSatisfiedThresholdEnergy);
386 TVector3 cluster_pos=cluster->where();
387 Double_t cluster_theta=cluster->theta()*(180./TMath::Pi()); //cluster_theta=cluster_pos.Theta()*(180./TMath::Pi());
388 Double_t cluster_phi=cluster->phi()*(180./TMath::Pi()); //cluster_phi=cluster_pos.Phi()*(180./TMath::Pi());
389 Double_t cluster_x=cluster->x();
390 Double_t cluster_y=cluster->y();
391 Double_t cluster_z=cluster->z();
392 cluster_energy=cluster->energy();
393 //sum_clus_ene+=cluster_energy; //sum up the highest deposited cluster energy of all events
394 HISTmax_cluster_energy->Fill(cluster_energy); //fill the highest deposited cluster energy per event
395 HISTmax_cluster_theta->Fill(cluster_theta); // reconstructed
396 HISTmax_cluster_theta_diff->Fill(cluster_theta-theta_mc);
397 //if (cluster_theta>10)
399 HISTmax_cluster_phi->Fill(cluster_phi); // reconstructed
400 HISTmax_cluster_phi_diff->Fill(cluster_phi-phi_mc);
401 HISTmax_cluster_x->Fill(cluster_x); // reconstructed
402 HISTmax_cluster_y->Fill(cluster_y); // reconstructed
403 HISTmax_cluster_y_x->Fill(cluster_x,cluster_y);
404 HISTmax_cluster_z->Fill(cluster_z); // reconstructed
405 Double_t x_mc = cluster_z*TMath::Tan(theta_mc/180.*TMath::Pi())*TMath::Cos(phi_mc/180.*TMath::Pi());
406 Double_t y_mc = cluster_z*TMath::Tan(theta_mc/180.*TMath::Pi())*TMath::Sin(phi_mc/180.*TMath::Pi());
407 HISTmax_cluster_x_diff->Fill(cluster_x-x_mc);
408 HISTmax_cluster_y_diff->Fill(cluster_y-y_mc);
410 HISTtheta_MonteCarlo->Fill(theta_mc);
411 HISTphi_MonteCarlo->Fill(phi_mc);
412 HISTtheta_MonteCarlo_cluster->Fill(cluster_theta,theta_mc);
413 HISTphi_MonteCarlo_cluster->Fill(cluster_phi,phi_mc);
414 HISTclusterSize_clusterPhi->Fill(cluster_phi,ndigisOfHighestEnergyCluster);
415 HISTclusterEnergy_clusterPhi->Fill(cluster_phi,cluster_energy);
416 HISTnumberOfclusters_clusterPhi->Fill(cluster_phi,NumberOfClusters);
417 HISTtotdigis_clusterPhi->Fill(cluster_phi,totdigis_fromClusterAnalysis);
421 //hz_clust->Fill(cluster->z());
423 if (NumberOfClusters>0)
424 HISTnumberOfClusters->Fill(NumberOfClusters); //number of clusters per event, having more than or equal to one digi per cluster
426 HISTclustNo->Fill(ClustNo); //number of clusters per event, having more than one digi per cluster and satisfying the cluster threshold energy
427 if (ndigisOfHighestEnergyCluster>0)
428 HISTndigisOfHighestEnergyCluster->Fill(ndigisOfHighestEnergyCluster); //number of digis per event for clusters with highest energy deposition
430 HISTtotdigis_fromClusterAnalysis->Fill(totdigis_fromClusterAnalysis);
434 cout<<"Evt. No.
"<< j<<endl;
437 //cout<<"efficiencyCounter_h =
"<<efficiencyCounter_h<<" , atLeastOneHitPerEventCounter_h =
"<<atLeastOneHitPerEventCounter_h<<"\n";
438 //cout<<"FwEndCap efficiency (more than 10 MeV deposition in at least one crystal) =
"<< (double)efficiencyCounter_h/atLeastOneHitPerEventCounter_h<<"\n";
440 //cout<<"totaldigis =
"<<totaldigis<<"\n";
441 //cout<<"efficiencyCounter_d =
"<<efficiencyCounter_d<<" , atLeastOneHitPerEventCounter_d =
"<<atLeastOneHitPerEventCounter_d<<"\n";
442 //cout<<"FwEndCap efficiency (more than 10 MeV deposition in at least one crystal) =
"<< (double)efficiencyCounter_d/atLeastOneHitPerEventCounter_d<<"\n";
446 /* TH2I *HISTnhitsVSndigis = new TH2I("HISTnhitsVSndigis
","HISTnhitsVSndigis
",90,-1,44,90,-1,44);
447 TH2F *HISThitENE_digiENE = new TH2F("HISThitENE_digiENE
","HISThitENE_digiENE
",1000,0,1.,1000,0,1.);
448 TH2F *HISThitVSdigi_phi_3MeVhitEnergyThreshold = new TH2F("HISThitVSdigi_phi_3MeVhitEnergyThreshold
","hit vs
digi #
phi (3 MeV
hit threshold energy)
",370,-185,185,370,-185,185);
449 TH2F *HISThitVSdigi_phi_3MeVhitEnergyThreshold_zoomed = new TH2F("HISThitVSdigi_phi_3MeVhitEnergyThreshold_zoomed
","hit vs
digi #
phi (3 MeV
hit threshold energy)
",30,100,130,30,100,130);
450 TH1F *HISThit_phi = new TH1F("HISThit_phi
","#
phi of
hit",370,-185,185);
451 TH1F *HISTdigi_phi = new TH1F("HISTdigi_phi
","#
phi of
digi",370,-185,185);
452 TH1F *HISThit_x = new TH1F("HISThit_x
","x of
hit",220,-110,110);
453 TH1F *HISThit_y = new TH1F("HISThit_y
","y of
hit",220,-110,110);
454 TH1F *HISTdigi_x = new TH1F("HISTdigi_x
","x of
digi",220,-110,110);
455 TH1F *HISTdigi_y = new TH1F("HISTdigi_y
","y of
digi",220,-110,110);
456 TH2F *HISTdigi_phi_x = new TH2F("HISTdigi_phi_x
","#
phi vs
x of
digi",220,-110,110,370,-185,185);
457 TH2F *HISTdigi_phi_y = new TH2F("HISTdigi_phi_y
","#
phi vs
y of
digi",220,-110,110,370,-185,185);
459 for (int j = 0; j < ncounts; j++)
462 Int_t ndigis = digi_array->GetEntries();
463 Int_t nhits = hit_array->GetEntries();
465 for (Int_t ii=0; ii<nhits; ii++)
467 PndEmcHit *hit=(PndEmcHit*)hit_array->At(ii);
468 Double_t hitENE = hit->GetEnergy();
469 TVector3 hit_pos(hit->GetX(),hit->GetY(),hit->GetZ()); // position of the center of the hit crystal
470 Double_t hitPHI=hit_pos.Phi()*(180./TMath::Pi()); //wrong answer if using-----> hit->GetPhi()*180./TMath::Pi();
471 Int_t hitXPad = hit->GetXPad();
472 Int_t hitYPad = hit->GetYPad();
473 Double_t hitX = hit->GetX();
474 Double_t hitY = hit->GetY();
476 for (Int_t jj=0; jj<ndigis; jj++)
478 PndEmcDigi *digi=(PndEmcDigi*)digi_array->At(jj);
480 Double_t digiENE = digi->GetEnergy();
481 Double_t digiPHI = digi->GetPhi()*180./TMath::Pi();
482 Int_t digiXPad = digi->GetXPad();
483 Int_t digiYPad = digi->GetYPad();
484 Double_t digiX = (digi->where()).X();
485 Double_t digiY = (digi->where()).Y();
487 if (hitXPad==digiXPad && hitYPad==digiYPad && hitENE >= 0.003)//the detection threshold condition of 3 MeV doesn't show much effect on the pattern of the 2D histogram
489 HISThitENE_digiENE->Fill(digiENE,hitENE);
490 HISThitVSdigi_phi_3MeVhitEnergyThreshold->Fill(digiPHI,hitPHI);
491 HISThitVSdigi_phi_3MeVhitEnergyThreshold_zoomed->Fill(digiPHI,hitPHI);
493 if (hitXPad==digiXPad && hitYPad==digiYPad)
495 HISThit_phi->Fill(hitPHI);
496 HISTdigi_phi->Fill(digiPHI);
498 HISThit_x->Fill(hitX);
499 HISThit_y->Fill(hitY);
500 HISTdigi_x->Fill(digiX);
501 HISTdigi_y->Fill(digiY);
502 HISTdigi_phi_x->Fill(digiX,digiPHI);
503 HISTdigi_phi_y->Fill(digiY,digiPHI);
509 for (Int_t ii=0; ii<nhits; ii++)
511 PndEmcHit *hit=(PndEmcHit*)hit_array->At(ii);
512 if (hit->GetEnergy() > 0)
516 HISTnhitsVSndigis->Fill(ndigis,nhits);//fill the histogram if there a hit registers (hitEne > 0)
520 gStyle->SetPalette(1);
522 TString outfile= "./hitdigiEne.root
";
523 TFile* file_out = new TFile(outfile,"RECREATE
");
524 HISThit_ene->Write();
525 HISThit_ene_10by6crystalPack->Write();
526 HISThit_ene_3by3crystalPack->Write();
527 HISTdigi_ene->Write();
528 HISTdigi_ene_10by6crystalPack->Write();
529 HISTdigi_ene_3by3crystalPack->Write();
534 TCanvas* c1 = new TCanvas("c1","", 100, 100, 800, 800);
537 HISTOhit_ene19_1->Draw();
539 HISTOhit_ene19_2->Draw();
540 HISTOhit_ene19_2->GetXaxis()->SetTitle("central crystal Deposited Energy per event (
hit analysis)
");
542 HISTOhit_ene19_3->Draw();
544 HISTOhit_ene19_4->Draw();
546 HISTOhit_ene19_5->Draw();
548 HISThit_ene_3by3crystalPack->Draw();
549 HISThit_ene_3by3crystalPack->GetXaxis()->SetTitle("3x3 pack of crystals in FwEndCap Deposited Energy per event (
hit analysis)
");
551 HISThit_ene_10by6crystalPack->Draw();
552 HISThit_ene_10by6crystalPack->GetXaxis()->SetTitle("10x6 pack of crystals in FwEndCap Deposited Energy per event (
hit analysis)
");
555 HISThit_ene->GetXaxis()->SetTitle("FwEndCap Deposited Energy per event (
hit analysis)
");
557 TCanvas* c2 = new TCanvas("c2","", 100, 100, 800, 800);
560 HISTOdigi_ene19_1->Draw();
562 HISTOdigi_ene19_2->Draw();
563 HISTOdigi_ene19_2->GetXaxis()->SetTitle("central crystal Deposited Energy per event (
digi analysis)
");
565 HISTOdigi_ene19_3->Draw();
567 HISTOdigi_ene19_4->Draw();
569 HISTOdigi_ene19_5->Draw();
571 HISTdigi_ene_3by3crystalPack->Draw();
572 HISTdigi_ene_3by3crystalPack->GetXaxis()->SetTitle("3x3 pack of crystals in FwEndCap Deposited Energy per event (
digi analysis)
");
574 HISTdigi_ene_10by6crystalPack->Draw();
575 HISTdigi_ene_10by6crystalPack->GetXaxis()->SetTitle("10x6 pack of crystals in FwEndCap Deposited Energy per event (
digi analysis)
");
577 HISTdigi_ene->Draw();
578 HISTdigi_ene->GetXaxis()->SetTitle("FwEndCap Deposited Energy per event (
digi analysis)
");
581 TCanvas* c3 = new TCanvas("c3","", 100, 100, 800, 800);
584 HISTy_x_h->Draw("colz
");
586 HISTrow_crystal_h->Draw("colz
");
588 HISTxpad_x_h->Draw("colz
");
590 HISTypad_y_h->Draw("colz
");
592 HISTrow_x_h->Draw("colz
");
596 TCanvas* c4 = new TCanvas("c4","", 100, 100, 800, 800);
599 HISTy_x_d->Draw("colz
");
601 HISTrow_crystal_d->Draw("colz
");
603 HISTxpad_x_d->Draw("colz
");
605 HISTypad_y_d->Draw("colz
");
607 HISTrow_x_d->Draw("colz
");
611 TCanvas* c5 = new TCanvas("c5","", 100, 100, 800, 800);
614 HISTnumberOfClusters->Draw("");
616 HISTclustNo->Draw("");
618 HISTndigisOfHighestEnergyCluster->Draw("");
620 HISTmax_cluster_energy->Draw("");
622 HISTtheta_MonteCarlo->Draw("");
624 HISTphi_MonteCarlo->Draw("");
626 HISTtheta_MonteCarlo_cluster->Draw("colz
");
628 HISTphi_MonteCarlo_cluster->Draw("colz
");
630 HISTmax_cluster_theta->Draw("");
632 HISTmax_cluster_phi->Draw("");
634 HISTmax_cluster_theta_diff->Draw("");
636 HISTmax_cluster_phi_diff->Draw("");
638 HISTmax_cluster_x->Draw("");
640 HISTmax_cluster_y->Draw("");
642 //HISTmax_cluster_z->Draw("");
643 HISTmax_cluster_x_diff->Draw("");
645 HISTmax_cluster_y_diff->Draw("");
647 TCanvas* c55 = new TCanvas("c55
","", 100, 100, 800, 800);
648 HISTmax_cluster_y_x->Draw("colz
");
651 /* TCanvas* c6 = new TCanvas("c6","", 100, 100, 800, 800);
654 HISTclusterSize_clusterPhi->Draw("colz
");
656 HISTclusterEnergy_clusterPhi->Draw("colz
");
658 HISTnumberOfclusters_clusterPhi->Draw("colz
");
660 HISTtotdigis_clusterPhi->Draw("colz
");
661 //HISTtotdigis_fromClusterAnalysis->Draw();
665 TCanvas* c7 = new TCanvas("c7","", 100, 100, 800, 800);
668 HISTnhitsVSndigis->Draw("colz
");
670 HISThitENE_digiENE->Draw("colz
");
671 c7->cd(2)->Divide(2,1);
675 HISTdigi_phi->Draw();
676 c7->cd(4)->Divide(2,1);
678 HISThitVSdigi_phi_3MeVhitEnergyThreshold->Draw("colz
");
680 HISThitVSdigi_phi_3MeVhitEnergyThreshold_zoomed->Draw("colz
");
682 TCanvas* c77 = new TCanvas("c77
","", 100, 100, 800, 1000);
693 HISTdigi_phi_x->Draw("colz
");
695 HISTdigi_phi_y->Draw("colz
");
699 TCanvas* c8 = new TCanvas("c8","", 100, 100, 1200, 800);
702 HISTmultiplicity_5MeVtrigThresh_d->Draw();
704 HISTmultiplicity_10MeVtrigThresh_d->Draw();
706 HISTmultiplicity_5MeVtrigThresh_h->Draw();//3 MeV detection threshold
708 HISTmultiplicity_10MeVtrigThresh_h->Draw();//3 MeV detection threshold
711 TCanvas* c9 = new TCanvas("c9","", 100, 100, 1000, 800);
712 HISTmultiplicity_10MeVtrigThresh_10MeVdetectionThresh_h->Draw();
713 HISTmultiplicity_10MeVtrigThresh_10MeVdetectionThresh_h->SetLineWidth(3);
715 HISTmultiplicity_10MeVtrigThresh_NOdetectionThresh_h->Draw("same
");
716 HISTmultiplicity_10MeVtrigThresh_NOdetectionThresh_h->SetLineStyle(2);
718 HISTmultiplicity_10MeVtrigThresh_h->Draw("same
");//3 MeV detection threshold
720 HISTmultiplicity_10MeVtrigThresh_5MeVdetectionThresh_h->Draw("same
");
721 HISTmultiplicity_10MeVtrigThresh_5MeVdetectionThresh_h->SetLineWidth(2);
724 TCanvas* c99 = new TCanvas("c99
","", 100, 100, 1000, 800);
725 HISTmultiplicity_1MeVtrigThresh_300keV_h->Draw();
726 HISTmultiplicity_1MeVtrigThresh_300keV_h->SetLineWidth(1);
728 HISTmultiplicity_1MeVtrigThresh_100keV_h->Draw("same
");
729 HISTmultiplicity_1MeVtrigThresh_100keV_h->SetLineStyle(2);
represents the reconstructed hit of one emc crystal
a cluster (group of neighboring crystals) of hit emc crystals
represents the deposited energy of one emc crystal from simulation
represents a reconstructed (splitted) emc cluster