FairRoot/PandaRoot
anal_hit_digi_cluster_fwendcap.C
Go to the documentation of this file.
1 {
2  // Macro loads a file after reconstruction and plots difference between initial direction of particle and angular position of cluster
3  //gROOT->Macro("style.C");
4  gROOT->LoadMacro("$VMCWORKDIR/macro/mvd/Tools.C");
5  gROOT->Macro("$VMCWORKDIR/gconfig/rootlogon.C");
6 
7  //TFile* fsim = new TFile("data/fixed/sim_emc_g3_m3_1000eve_fixed.root"); // (GEANT 3) 1.07.09
8  TFile* fsim = new TFile("data/fixed/sim_emc_g4_m3_1000eve_fixed.root"); // (GEANT 4) 1.07.09
9 
10  TTree *tsim=(TTree *) fsim->Get("pndsim") ;
11  TClonesArray* mctrack_array=new TClonesArray("PndMCTrack");
12  tsim->SetBranchAddress("MCTrack",&mctrack_array);
14 
15 
16  //TFile* fful = new TFile("data/fixed/full_emc_g3_m3_1000eve_fixed.root"); // (GEANT 3) 1.07.09
17  TFile* fful = new TFile("data/fixed/full_emc_g4_m3_1000eve_fixed.root"); // (GEANT 4) 1.07.09
18 
19  TTree *tful =(TTree *) fful->Get("pndsim") ;
20 
21  TClonesArray* hit_array=new TClonesArray("PndEmcHit");
22  tful->SetBranchAddress("EmcHit",&hit_array);
23 
24  TClonesArray* digi_array=new TClonesArray("PndEmcDigi");
25  tful->SetBranchAddress("EmcDigi",&digi_array);
26 
27  TClonesArray* cluster_array=new TClonesArray("PndEmcCluster");
28  tful->SetBranchAddress("EmcCluster",&cluster_array);
29 
30 
36  hit_id, hit_x, hit_y,
38 
42 
43  Int_t id_h,id_d;
44 
45  TVector3 photon_momentum;
46  TLorentzVector p4mom;
47 
48  int ndigi, nhit;
49  double max_energy1=0;
50 
51  //----- x, y, z, id
52  TH2F *hrow_crystal_h = new TH2F("row_crystal","row vs crystal (HIT)",72,-36,36,72,-36,36);
53  TH2F *hrow_crystal_d = new TH2F("row_crystal_digi","row vs crystal (DIGI)",72,-36,36,72,-36,36);
54  TH2F *hrow_crystal_c = new TH2F("row_crystal_c","row vs crystal (CLUSTER)",72,-36,36,72,-36,36);
55 
56  TH2F *hx_y_h = new TH2F("x_y_h","x vs y (HIT)",200,-100,100,200,-100,100);
57  TH2F *hx_y_d = new TH2F("x_y_d","GetThetaInt() vs GetPhiInt() (DIGI)",200,200,300,200,200,300);
58 
59  TH1F *hid_h = new TH1F("id_h","id (HIT)",140000000,300000000,340000000);
60  TH1F *hz_h = new TH1F("z_h","z (HIT)",300,1,300);
61  TH1F *hmodule_h = new TH1F("module_h","Module (HIT)",5,1,6);
62 
63  TH2F *hxpad_x_h = new TH2F("xpad_x_h","xpad vs x (HIT)",200,-100,100,200,-100,100);
64  TH2F *hypad_y_h = new TH2F("ypad_y_h","ypad vs y (HIT)",200,-100,100,200,-100,100);
65 
66  TH2F *hxpad_x_d = new TH2F("xpad_x_d","xpad vs GetThetaInt() (DIGI)",200,-100,100,200,200,300);
67  TH2F *hypad_y_d = new TH2F("ypad_y_d","ypad vs GetPhiInt() (DIGI)",200,-100,100,200,200,300);
68 
69  TH2F *hx_row_h = new TH2F("x_row_h","x vs row (HIT)",200,-100,100,72,-36,36);
70  TH2F *hx_row_d = new TH2F("x_row_d","GetThetaInt() vs row (DIGI)",200,200,300,72,-36,36);
71 
72  TH2F *hcp_z_h = new TH2F("cp_z_h","Copy vs.Z pos (HITS)",4,1,5,80,200,240);
73 
74  TH1F *hz_cp1_h = new TH1F("z_cp1_h","z (HIT)",300,1,300);
75  TH1F *hz_cp2_h = new TH1F("z_cp2_h","z (HIT)",300,1,300);
76  TH1F *hz_cp3_h = new TH1F("z_cp3_h","z (HIT)",300,1,300);
77  TH1F *hz_cp4_h = new TH1F("z_cp4_h","z (HIT)",300,1,300);
78 
79  TH1F *hz_d = new TH1F("z_d","z (DIGI)",300,1,300);
80  TH1F *hz_cp1_d = new TH1F("z_cp1_d","z (DIGI)",300,1,300);
81  TH1F *hz_cp2_d = new TH1F("z_cp2_d","z (DIGI)",300,1,300);
82  TH1F *hz_cp3_d = new TH1F("z_cp3_d","z (DIGI)",300,1,300);
83  TH1F *hz_cp4_d = new TH1F("z_cp4_d","z (DIGI)",300,1,300);
84 
85  TH1F *hz_clust = new TH1F("z_cluster","z (CLUSTER)",300,1,300);
86  TH1F *hz_cp1_c = new TH1F("z_cp1_c","z (CLUSTER)",300,1,300);
87  TH1F *hz_cp2_c = new TH1F("z_cp2_c","z (CLUSTER)",300,1,300);
88  TH1F *hz_cp3_c = new TH1F("z_cp3_c","z (CLUSTER)",300,1,300);
89  TH1F *hz_cp4_c = new TH1F("z_cp4_c","z (CLUSTER)",300,1,300);
90 
91  //--------- Energy: MC, HITs, DIGITs, CLUSTERs---------------------------------------------------
92  TH1F *hene_mc= new TH1F("hene_mc","MC energy HIT (GeV)",100,0.05,1.05);
93  TH1F *dene_mc= new TH1F("dene_mc","MC energy DIGI (GeV)",100,0.05,1.05);
94  TH1F *hclus_ene_sum_mc = new TH1F("hclus_ene_sum_mc","SUM of MC Cluster energy (GeV)",100,0.05,1.05);
95 
96  TH1F *hene_h= new TH1F("hene_h","DATA energy HIT (GeV)",100,0.05,1.05);
97  TH1F *hene_d= new TH1F("hene_d","DATA energy DIGI (GeV)",100,0.05,1.05);
98 
99  TH1F *hhit_ene= new TH1F("hhit_ene","SUM of Hits energy (GeV)",100,0.05,1.05);
100  TH1F *hdigi_ene= new TH1F("hdigi_ene","SUM of Digi energy (GeV)",100,0.05,1.05);
101  TH1F *hclus_ene= new TH1F("hclus_ene","SUM of Cluster energy (GeV)",100,0.05,1.05);
102 
103  TH1F *hclus_ene_mc= new TH1F("hclus_ene_mc","SUM of MC Cluster energy (GeV)",100,0.05,1.05);
104  TH1F *hclus_ene_sum = new TH1F("hclus_ene_sum","SUM of Cluster energy (GeV)",100,0.05,1.05);
105 
106  TH1F *hhit_ene_cp1= new TH1F("hhit_ene_cp1","SUM of Hits energy (GeV) _cp1",100,0.05,1.05);
107  TH1F *hhit_ene_cp2= new TH1F("hhit_ene_cp2","SUM of Hits energy (GeV) _cp2",100,0.05,1.05);
108  TH1F *hhit_ene_cp3= new TH1F("hhit_ene_cp3","SUM of Hits energy (GeV) _cp3",100,0.05,1.05);
109  TH1F *hhit_ene_cp4= new TH1F("hhit_ene_cp4","SUM of Hits energy (GeV) _cp4",100,0.05,1.05);
110 
111  TH1F *hclus_ene_cp1= new TH1F("hclus_ene_cp1","Cluster energy (GeV) _cp1",100,0.05,1.05);
112  TH1F *hclus_ene_cp2= new TH1F("hclus_ene_cp2","Cluster energy (GeV) _cp2",100,0.05,1.05);
113  TH1F *hclus_ene_cp3= new TH1F("hclus_ene_cp3","Cluster energy (GeV) _cp3",100,0.05,1.05);
114  TH1F *hclus_ene_cp4= new TH1F("hclus_ene_cp4","Cluster energy (GeV) _cp4",100,0.05,1.05);
115 
116  //--------- Theta & Phi (reconstructed & truth): HITs, DIGIs, CLUSTERs -------------------------
117  TH1F *h10= new TH1F("h10","HIT Theta (MC)",180,0.,180.);
118  TH1F *h20= new TH1F("h20","HIT Phi (MC)",360,-180.,180.);
119  TH1F *h10d= new TH1F("h10d","HIT Theta (data)",180,0.,180.);
120  TH1F *h20d= new TH1F("h20d","HIT Phi (data)",360,-180.,180.);
121  TH1F *h1= new TH1F("h1","HIT Theta difference",100,-5.,5.);
122  TH1F *h2= new TH1F("h2","HIT Phi difference",100,-5.,5.);
123 
124  TH1F *h10digi= new TH1F("h10digi","DIGI Theta (MC)",180,0.,180.);
125  TH1F *h20digi= new TH1F("h20digi","DIGI Phi (MC)",360,-180.,180.);
126  TH1F *h10ddigi= new TH1F("h10ddigi","DIGI Theta (data)",180,0.,180.);
127  TH1F *h20ddigi= new TH1F("h20ddigi","DIGI Phi (data)",360,-180.,180.);
128  TH1F *h1d= new TH1F("h1d","DIGI Theta difference",100,-5.,5.);
129  TH1F *h2d= new TH1F("h2d","DIGI Phi difference",100,-5.,5.);
130 
131  TH1F *hdigi_ene_cp1= new TH1F("hdigi_ene_cp1","SUM of Digi energy (GeV) _cp1",100,0.05,1.05);
132  TH1F *hdigi_ene_cp2= new TH1F("hdigi_ene_cp2","SUM of Digi energy (GeV) _cp2",100,0.05,1.05);
133  TH1F *hdigi_ene_cp3= new TH1F("hdigi_ene_cp3","SUM of Digi energy (GeV) _cp3",100,0.05,1.05);
134  TH1F *hdigi_ene_cp4= new TH1F("hdigi_ene_cp4","SUM of Digi energy (GeV) _cp4",100,0.05,1.05);
135 
136  TH1F *hthc_mc= new TH1F("hthcmc","CLUSTER Theta (MC)",180,0.,180.);
137  TH1F *hphc_mc= new TH1F("hphcmc","CLUSTER Phi (MC)",360,-180.,180.);
138  TH1F *hthc = new TH1F("hthc","CLUSTER Theta (data)",180,0.,180.);
139  TH1F *hphc = new TH1F("hphc","CLUSTER Phi (data)",360,-180.,180.);
140  TH1F *hthc_diff= new TH1F("hthc_diff","CLUSTER Theta difference",100,-5.,5.);
141  TH1F *hphc_diff= new TH1F("hphc_diff","CLUSTER Phi difference",100,-5.,5.);
142 
143  TH1F *hid_d = new TH1F("id_d","id (DIGI)",140000000,300000000,340000000);
144  TH1F *hmodule_d = new TH1F("module_d","Module (DIGI)",5,1,6);
145 
146  TH1F *hClustNoOrig = new TH1F("hClustNoOrig","hClustNoOrig",10,0,9);
147  TH1F *hClustNo = new TH1F("hClustNo","hClustNo",10,0,9);
148 
149  TH1F *hClNo_cp1 = new TH1F("hClNo_cp1","hClNo_cp1",10,0,9);
150  TH1F *hClNo_cp2 = new TH1F("hClNo_cp2","hClNo_cp2",10,0,9);
151  TH1F *hClNo_cp3 = new TH1F("hClNo_cp3","hClNo_cp3",10,0,9);
152  TH1F *hClNo_cp4 = new TH1F("hClNo_cp4","hClNo_cp4",10,0,9);
153 
154 
155  Int_t ncounts = tsim->GetEntries();
156  for(int j = 0; j < ncounts; j++){
157  //for (Int_t j=1;j< 3; j++){
158  Float_t sum_hit_ene,hit_ene_cp1,hit_ene_cp2,hit_ene_cp3,hit_ene_cp4;
159  Float_t sum_digi_ene,digi_ene_cp1,digi_ene_cp2,digi_ene_cp3,digi_ene_cp4;
160  Float_t sum_clus_ene=0;
161  Float_t cemc_sum=0;
162 
163  sum_hit_ene = hit_ene_cp1 = hit_ene_cp2 = hit_ene_cp3 = hit_ene_cp4 = 0;
164  sum_digi_ene = digi_ene_cp1 = digi_ene_cp2 = digi_ene_cp3 = digi_ene_cp4 =0;
165 
166  tsim->GetEntry(j);
167  tful->GetEntry(j);
168 
169  PndMCTrack *mctrack=(PndMCTrack *) mctrack_array->At(0);
170  photon_momentum=mctrack->GetMomentum();
171  theta_mc=photon_momentum.Theta()*(180./TMath::Pi());
172  phi_mc=photon_momentum.Phi()*(180./TMath::Pi());
173 
174  p4mom=mctrack->Get4Momentum();
175 
176  Int_t nhits = hit_array->GetEntries();
177  for (Int_t i=0; i<nhits; i++)
178  {
179  PndEmcHit *hit=(PndEmcHit*)hit_array->At(i);
180 
181  module_h = hit->GetModule();
182 
183  if (module_h==3){
184 
185  hene_mc->Fill(p4mom.E());
186 
187  hit_ene=hit->GetEnergy();
188 
189  hene_h->Fill(hit_ene);
190 
191  sum_hit_ene+=hit_ene;
192 
193  crystal_h = hit->GetCrystal();
194  row_h = hit->GetRow();
195  copy_h = hit->GetCopy();
196 
197  if (copy_h==1) hit_ene_cp1+=hit->GetEnergy();
198  if (copy_h==2) hit_ene_cp2+=hit->GetEnergy();
199  if (copy_h==3) hit_ene_cp3+=hit->GetEnergy();
200  if (copy_h==4) hit_ene_cp4+=hit->GetEnergy();
201 
202  TVector3 hit_pos(hit->GetX(),hit->GetY(),hit->GetZ());
203  hit_theta=hit_pos.Theta()*(180./TMath::Pi());
204  hit_phi=hit_pos.Phi()*(180./TMath::Pi());
205 
206  //cout << "MC: theta= "<<theta_mc<<", phi= "<<phi_mc<<endl;
207  h10->Fill(theta_mc);
208  h20->Fill(phi_mc);
209 
210  h10d->Fill(hit_theta);
211  h20d->Fill(hit_phi);
212 
213  h1->Fill(hit_theta-theta_mc);
214  h2->Fill(hit_phi-phi_mc);
215 
216  if (copy_h==1) hz_cp1_h->Fill(hit->GetZ());
217  if (copy_h==2) hz_cp2_h->Fill(hit->GetZ());
218  if (copy_h==3) hz_cp3_h->Fill(hit->GetZ());
219  if (copy_h==4) hz_cp4_h->Fill(hit->GetZ());
220 
221  hz_h->Fill(hit->GetZ());
222  hcp_z_h->Fill(copy_h,hit->GetZ());
223 
224  hxpad_x_h->Fill(hit->GetXPad(),hit->GetX());
225  hypad_y_h->Fill(hit->GetYPad(),hit->GetY());
226 
227  hx_row_h->Fill(hit->GetRow(),hit->GetX());
228 
229  id_h = hit->GetDetectorID();
230 
231  crystal_hid = (id_h%10000);
232  row_hid = ((id_h/1000000)%100);
233 
234  hmodule_h->Fill(module_h);
235  hrow_crystal_h->Fill(crystal_hid,row_hid);
236  hx_y_h->Fill(hit->GetX(),hit->GetY());
237 
238  hid_h->Fill(id_h);
239  }
240  }
241  hhit_ene->Fill(sum_hit_ene);
242  hhit_ene_cp1->Fill(hit_ene_cp1);
243  hhit_ene_cp2->Fill(hit_ene_cp2);
244  hhit_ene_cp3->Fill(hit_ene_cp3);
245  hhit_ene_cp4->Fill(hit_ene_cp4);
246 
247  // digits
248  Int_t ndigits = digi_array->GetEntries();
249  //cout << "DIGI array == " << ndigits<< endl;
250  for (Int_t i=0; i<ndigits; i++)
251  {
252  PndEmcDigi *digi=(PndEmcDigi*)digi_array->At(i);
253 
254  TVector3 digi_pos=digi->where();
255 
256  module_d = digi->GetModule();
257 
258  if (module_d==3){
259 
260  dene_mc->Fill(p4mom.E());
261 
262  digi_ene=digi->GetEnergy();
263  hene_d->Fill(digi_ene);
264 
265  sum_digi_ene+=digi_ene;
266 
267  crystal_d = digi->GetCrystal();
268  row_d = digi->GetRow();
269  copy_d = digi->GetCopy();
270 
271  Double_t digi_z=digi_pos.Z();
272  hz_d->Fill(digi_z);
273 
274  if (copy_d==1){
275  digi_ene_cp1+=digi->GetEnergy();
276  hz_cp1_d->Fill(digi_z);
277  }
278  if (copy_d==2){
279  digi_ene_cp2+=digi->GetEnergy();
280  hz_cp2_d->Fill(digi_z);
281  }
282  if (copy_d==3){
283  digi_ene_cp3+=digi->GetEnergy();
284  hz_cp3_d->Fill(digi_z);
285  }
286  if (copy_d==4){
287  digi_ene_cp4+=digi->GetEnergy();
288  hz_cp4_d->Fill(digi_z);
289  }
290 
291  digi_theta=(digi->GetTheta())*(180./TMath::Pi());
292  digi_phi=(digi->GetPhi())*(180./TMath::Pi());
293 
294  h10digi->Fill(theta_mc);
295  h20digi->Fill(phi_mc);
296 
297  h10ddigi->Fill(digi_theta);
298  h20ddigi->Fill(digi_phi);
299 
300  h1d->Fill(digi_theta-theta_mc);
301  h2d->Fill(digi_phi-phi_mc);
302 
303  hxpad_x_d->Fill(digi->GetXPad(),digi->GetThetaInt());
304  hypad_y_d->Fill(digi->GetYPad(),digi->GetPhiInt());
305 
306  hx_row_d->Fill(digi->GetRow(),digi->GetThetaInt());
307 
308  id_d = digi->GetDetectorId();
309 
310  crystal_did = (id_d%10000);
311  row_did = ((id_d/1000000)%100);
312 
313  hmodule_d->Fill(module_d);
314  hrow_crystal_d->Fill(crystal_did,row_did);
315  hx_y_d->Fill(digi->GetThetaInt(),digi->GetPhiInt());
316 
317  hid_d->Fill(id_d);
318  }
319  }
320  hdigi_ene->Fill(sum_digi_ene);
321  hdigi_ene_cp1->Fill(digi_ene_cp1);
322  hdigi_ene_cp2->Fill(digi_ene_cp2);
323  hdigi_ene_cp3->Fill(digi_ene_cp3);
324  hdigi_ene_cp4->Fill(digi_ene_cp4);
325 
326  // reconstructed clusters
327  Int_t ClustNoOrig,ClustNo,ClustNo_cp1,ClustNo_cp2,ClustNo_cp3,ClustNo_cp4;
328  Int_t detectorID, module, mod3;
329  if (cluster_array->GetEntriesFast()>0)
330  {
331  Int_t idWithHighestEnergy = 0;
332  Double_t highestEnergy = -1.;
333 
334  // First find the cluster with the highest energy
335 
336  if (module_h==3){
337 
338  ClustNoOrig=ClustNo=
339  ClustNo_cp1=ClustNo_cp2=ClustNo_cp3=ClustNo_cp4=0;
340 
341  ClustNoOrig=cluster_array->GetEntriesFast();
342  for (Int_t i=0; i<ClustNoOrig; i++)
343  {
344  PndEmcCluster *cluster=(PndEmcCluster*)cluster_array->At(i);
345  cluster_energy=cluster->energy();
346 
347  std::vector<PndEmcDigi*> digiList=cluster->DigiList();
348  ndigi=digiList.size();
349 
350  if(ndigi != 0)
351  {
352  for(int k = 0; k < digiList.size(); k++)
353  {
354  detectorID = digiList[k]->GetDetectorId();
355  module = digiList[k]->GetModule();
356  row_c = digiList[k]->GetRow();
357  crystal_c = digiList[k]->GetCrystal();
358  copy_c = digiList[k]->GetCopy();
359 
360  crystal_cid = (detectorID%10000);
361  row_cid = ((detectorID/1000000)%100);
362 
363  hrow_crystal_c->Fill(crystal_cid,row_cid);
364  //cluster_energy=cluster->energy();
365  }
366  }
367  mod3 = module;
368 
369  if (cluster_energy>highestEnergy)
370  {
371  idWithHighestEnergy = i;
372  highestEnergy = cluster_energy;
373  ClustNo++;
374  }
375  } // number of cluster
376 
377  // Lets analyze that cluster!
378  if (mod3 !=3 )cout << "mod3 = "<< mod3 << endl;
379  PndEmcCluster *cluster=(PndEmcCluster*)cluster_array->At(idWithHighestEnergy);
380 
381  TVector3 cluster_pos=cluster->where();
382  cluster_theta=cluster_pos.Theta()*(180./TMath::Pi());
383  cluster_phi=cluster_pos.Phi()*(180./TMath::Pi());//+360;
384 
385  cluster_energy=cluster->energy();
386  //ClustNo++;
387 
388  if (copy_c==1){
389  hclus_ene_cp1->Fill(cluster->energy());
390  hz_cp1_c->Fill(cluster->z());
391  ClustNo_cp1++;
392  }
393  if (copy_c==2){
394  hclus_ene_cp2->Fill(cluster->energy());
395  hz_cp2_c->Fill(cluster->z());
396  ClustNo_cp2++;
397  }
398  if (copy_c==3){
399  hclus_ene_cp3->Fill(cluster->energy());
400  hz_cp3_c->Fill(cluster->z());
401  ClustNo_cp3++;
402  }
403  if (copy_c==4){
404  hclus_ene_cp4->Fill(cluster->energy());
405  hz_cp4_c->Fill(cluster->z());
406  ClustNo_cp4++;
407  }
408 
409  hz_clust->Fill(cluster->z());
410 
411  //cout<<"CLUSTER: th="<<cluster_theta<<", ph="<<cluster_phi<<", energy="<<cluster_energy<<endl;
412 
413  sum_clus_ene+=cluster_energy;
414 
415  cemc=p4mom.E();
416  cemc_sum+=cemc;
417 
418  hclus_ene_mc->Fill(cemc);
419  hclus_ene->Fill(cluster_energy);
420 
421  hthc_mc->Fill(theta_mc); // Monte Carlo
422  hphc_mc->Fill(phi_mc); // Monte Carlo
423 
424  hthc->Fill(cluster_theta); // reconstructed
425  hphc->Fill(cluster_phi); // reconstructed
426 
427  hthc_diff->Fill(cluster_theta-theta_mc);
428  hphc_diff->Fill(cluster_phi-phi_mc);
429  }
430  }
431  hclus_ene_sum_mc->Fill(cemc_sum);
432 
433  hclus_ene_sum->Fill(sum_clus_ene);
434 
435  hClustNoOrig->Fill(ClustNoOrig);
436  hClustNo->Fill(ClustNo);
437 
438  hClNo_cp1->Fill(ClustNo_cp1);
439  hClNo_cp2->Fill(ClustNo_cp2);
440  hClNo_cp3->Fill(ClustNo_cp3);
441  hClNo_cp4->Fill(ClustNo_cp4);
442  }
443 
444  TCanvas* c1 = new TCanvas("c1", "", 100, 100, 800, 800);
445  c1->Divide(2,3);
446 
447  gStyle->SetPalette(1);
448 
449  c1->cd(1); // Z position in 4 quarters of fwendcap (HITS)
450 
451  TLegend *copies = new TLegend(0.65,0.4,0.85,0.6);
452  copies->SetTextSize(0.05);
453  copies->SetFillColor(0);
454  copies->SetBorderSize(0);
455  //copies->SetMarkerSize(2.0);
456  copies->AddEntry(hz_h, "All copies (G3)","l");
457  copies->AddEntry(hz_cp1_h, "copy_1","l");
458  copies->AddEntry(hz_cp2_h, "copy_2","l");
459  copies->AddEntry(hz_cp3_h, "copy_3","l");
460  copies->AddEntry(hz_cp4_h, "copy_4","l");
461 
462  hz_h->Draw(); // all quarters (copies) together
463 
464  hz_cp1_h->SetLineColor(2);
465  hz_cp1_h->Draw("same");
466 
467  hz_cp2_h->SetLineColor(3);
468  hz_cp2_h->Draw("same");
469 
470  hz_cp3_h->SetLineColor(4);
471  hz_cp3_h->Draw("same");
472 
473  hz_cp4_h->SetLineColor(6);
474  hz_cp4_h->Draw("same");
475 
476  hz_h->GetXaxis()->SetTitle("Z position");
477  hz_h->GetYaxis()->SetTitle("Counts");
478 
479  copies->Draw();
480 
481  c1->Modified();
482 
483 
484  c1->cd(2);// Sum of energy 4 quarters of fwendcap (HITs)
485  TLegend *copies4 = new TLegend(0.20,0.40,0.5,0.6);
486  copies4->SetTextSize(0.05);
487  copies4->SetFillColor(0);
488  copies4->SetBorderSize(0);
489  copies4->AddEntry(hhit_ene, "All copies (G3)","l");
490  copies4->AddEntry(hhit_ene_cp1, "copy_1","l");
491  copies4->AddEntry(hhit_ene_cp2, "copy_2","l");
492  copies4->AddEntry(hhit_ene_cp3, "copy_3","l");
493  copies4->AddEntry(hhit_ene_cp4, "copy_4","l");
494 
495  hhit_ene->Draw(); // all quarters (copies) together
496 
497  hhit_ene_cp1->SetLineColor(2);
498  hhit_ene_cp1->Draw("same");
499 
500  hhit_ene_cp2->SetLineColor(3);
501  hhit_ene_cp2->Draw("same");
502 
503  hhit_ene_cp3->SetLineColor(4);
504  hhit_ene_cp3->Draw("same");
505 
506  hhit_ene_cp4->SetLineColor(6);
507  hhit_ene_cp4->Draw("same");
508 
509  hhit_ene->GetXaxis()->SetTitle("Hit energy (GeV)");
510  hhit_ene->GetYaxis()->SetTitle("Counts");
511 
512  copies4->Draw();
513 
514  c1->Modified();
515 
516 
517  c1->cd(3);// Z position in 4 quarters of fwendcap (DIGITs)
518  TLegend *copies6 = new TLegend(0.65,0.4,0.85,0.6);
519  copies6->SetTextSize(0.05);
520  copies6->SetFillColor(0);
521  copies6->SetBorderSize(0);
522  copies6->AddEntry(hz_d, "All copies (G3)","l");
523  copies6->AddEntry(hz_cp1_d, "copy_1","l");
524  copies6->AddEntry(hz_cp2_d, "copy_2","l");
525  copies6->AddEntry(hz_cp3_d, "copy_3","l");
526  copies6->AddEntry(hz_cp4_d, "copy_4","l");
527 
528  hz_d->Draw(); // all quarters (copies) together
529 
530  hz_cp1_d->SetLineColor(2);
531  hz_cp1_d->Draw("same");
532 
533  hz_cp2_d->SetLineColor(3);
534  hz_cp2_d->Draw("same");
535 
536  hz_cp3_d->SetLineColor(4);
537  hz_cp3_d->Draw("same");
538 
539  hz_cp4_d->SetLineColor(6);
540  hz_cp4_d->Draw("same");
541 
542  hz_d->GetXaxis()->SetTitle("Z position");
543  hz_d->GetYaxis()->SetTitle("Counts");
544 
545  copies6->Draw();
546 
547  c1->Modified();
548 
549 
550  c1->cd(4);// Sum of energy 4 quarters of fwendcap (DIGITs)
551  TLegend *copies5 = new TLegend(0.20,0.40,0.5,0.6);
552  copies5->SetTextSize(0.05);
553  copies5->SetFillColor(0);
554  copies5->SetBorderSize(0);
555  copies5->AddEntry(hdigi_ene, "All copies (G3)","l");
556  copies5->AddEntry(hdigi_ene_cp1, "copy_1","l");
557  copies5->AddEntry(hdigi_ene_cp2, "copy_2","l");
558  copies5->AddEntry(hdigi_ene_cp3, "copy_3","l");
559  copies5->AddEntry(hdigi_ene_cp4, "copy_4","l");
560 
561  hdigi_ene->Draw(); // all quarters (copies) together
562 
563  hdigi_ene_cp1->SetLineColor(2);
564  hdigi_ene_cp1->Draw("same");
565 
566  hdigi_ene_cp2->SetLineColor(3);
567  hdigi_ene_cp2->Draw("same");
568 
569  hdigi_ene_cp3->SetLineColor(4);
570  hdigi_ene_cp3->Draw("same");
571 
572  hdigi_ene_cp4->SetLineColor(6);
573  hdigi_ene_cp4->Draw("same");
574 
575  hdigi_ene->GetXaxis()->SetTitle("Digi energy (GeV)");
576  hdigi_ene->GetYaxis()->SetTitle("Counts");
577 
578  copies5->Draw();
579 
580  c1->Modified();
581 
582  c1->cd(5);// Z position in 4 quarters of fwendcap (CLUSTERs)
583  TLegend *copies3 = new TLegend(0.20,0.30,0.5,0.5);
584  copies3->SetTextSize(0.05);
585  copies3->SetFillColor(0);
586  copies3->SetBorderSize(0);
587  copies3->AddEntry(hz_clust, "All copies (G3)","l");
588  copies3->AddEntry(hz_cp1_c, "copy_1","l");
589  copies3->AddEntry(hz_cp2_c, "copy_2","l");
590  copies3->AddEntry(hz_cp3_c, "copy_3","l");
591  copies3->AddEntry(hz_cp4_c, "copy_4","l");
592 
593  hz_clust->Draw(); // all quarters (copies) together
594 
595  hz_cp1_c->SetLineColor(2);
596  hz_cp1_c->Draw("same");
597 
598  hz_cp2_c->SetLineColor(3);
599  hz_cp2_c->Draw("same");
600 
601  hz_cp3_c->SetLineColor(4);
602  hz_cp3_c->Draw("same");
603 
604  hz_cp4_c->SetLineColor(6);
605  hz_cp4_c->Draw("same");
606 
607  hz_clust->GetXaxis()->SetTitle("Z position (cm)");
608  hz_clust->GetYaxis()->SetTitle("Counts");
609 
610  copies3->Draw();
611 
612  c1->Modified();
613 
614 
615  c1->cd(6); // Energy 4 quarters of fwendcap (CLUSTERs)
616  TLegend *copies2a = new TLegend(0.20,0.4,0.5,0.6);
617  copies2a->SetTextSize(0.05);
618  copies2a->SetFillColor(0);
619  copies2a->SetBorderSize(0);
620  copies2a->AddEntry(hclus_ene, "All copies (G3)","l");
621  copies2a->AddEntry(hclus_ene_cp1, "copy_1","l");
622  copies2a->AddEntry(hclus_ene_cp2, "copy_2","l");
623  copies2a->AddEntry(hclus_ene_cp3, "copy_3","l");
624  copies2a->AddEntry(hclus_ene_cp4, "copy_4","l");
625 
626  hclus_ene->Draw(); // all quarters (copies) together
627 
628  hclus_ene_cp1->SetLineColor(2);
629  hclus_ene_cp1->Draw("same");
630 
631  hclus_ene_cp2->SetLineColor(3);
632  hclus_ene_cp2->Draw("same");
633 
634  hclus_ene_cp3->SetLineColor(4);
635  hclus_ene_cp3->Draw("same");
636 
637  hclus_ene_cp4->SetLineColor(6);
638  hclus_ene_cp4->Draw("same");
639 
640  hclus_ene->GetXaxis()->SetTitle("Cluster energy (GeV)");
641  hclus_ene->GetYaxis()->SetTitle("Counts");
642 
643  copies2a->Draw();
644 
645  c1->Modified();
646 
647 
648  TCanvas* c9 = new TCanvas("c9", "", 100, 100, 800, 800);
649  c9->Divide(2,2);
650 
651  c9->cd(1);
652  hthc_diff->Draw();
653  hthc_diff->GetXaxis()->SetTitle("#theta_{Reconstructed}-#theta_{MC} (#circ)");
654  hthc_diff->GetYaxis()->SetTitle("Counts");
655 
656  c9->cd(2);
657  hphc_diff->Draw();
658  hphc_diff->GetXaxis()->SetTitle("#phi_{Reconstructed}-#phi_{MC} (#circ)");
659  hphc_diff->GetYaxis()->SetTitle("Counts");
660 
661  c9->cd(3);
662  hthc->Draw();
663  hthc_mc->SetLineColor(4);
664  hthc_mc->Draw("same");
665  hthc->GetXaxis()->SetTitle("#theta_{Reconstructed} (black) #theta_{MC} (blue) (#circ)");
666  hthc->GetYaxis()->SetTitle("Counts");
667 
668  c9->cd(4);
669  hphc->Draw();
670  hphc_mc->SetLineColor(4);
671  hphc_mc->Draw("same");
672  hphc->GetXaxis()->SetTitle("#phi_{Reconstructed} (black) #phi_{MC} (blue) (#circ)");
673  hphc->GetYaxis()->SetTitle("Counts");
674 
675  /*TLegend *cops = new TLegend(0.40,0.50,0.6,0.7);
676  cops->SetTextSize(0.05);
677  cops->SetFillColor(0);
678  cops->SetBorderSize(0);
679  cops->AddEntry(hClustNoOrig, "All clusters","l");
680  cops->AddEntry(hClustNo, "Clusters with highest energy","l");
681 
682  hClustNo->Draw(); // all quarters (copies) together
683 
684  hClustNoOrig->SetLineStyle(2);
685  hClustNoOrig->Draw("same");
686 
687  cops->Draw();
688  */
689  c9->Modified();
690 }
PndMCTrack * mctrack
Double_t crystal_cid
Double_t hit_theta
Short_t GetCrystal() const
Definition: PndEmcHit.h:60
Short_t GetXPad() const
Definition: PndEmcHit.cxx:87
TClonesArray * digi
TVector3 hit_pos(hit->GetX(), hit->GetY(), hit->GetZ())
Double_t theta_mc
Double_t crystal_did
TVector3 where() const
virtual Double_t GetEnergy() const
Definition: PndEmcDigi.cxx:296
represents the reconstructed hit of one emc crystal
Definition: PndEmcDigi.h:40
Int_t i
Definition: run_full.C:25
Double_t crystal_c
TVector3 photon_momentum
Int_t GetThetaInt() const
Definition: PndEmcDigi.h:99
Int_t GetDetectorId() const
Definition: PndEmcDigi.h:97
TClonesArray * digi_array
TH2F * hrow_crystal_c
Short_t GetCrystal() const
Definition: PndEmcDigi.h:105
TVector3 GetMomentum() const
Definition: PndMCTrack.h:78
const std::vector< Int_t > & DigiList() const
Definition: PndEmcCluster.h:40
TH2F * hrow_crystal_h
Emc geometry mapper.
Definition: PndEmcMapper.h:22
Double_t crystal_h
Double_t crystal_hid
TLegend * copies4
Short_t GetCopy() const
Definition: PndEmcDigi.h:106
TLorentzVector Get4Momentum() const
Definition: PndMCTrack.cxx:102
Short_t GetModule() const
Definition: PndEmcDigi.h:103
TClonesArray * hit_array
Double_t GetTheta() const
Definition: PndEmcDigi.h:101
TLegend * copies3
Double_t z() const
Double_t module_h
Double_t digi_ene
Double_t cluster_theta
Short_t GetYPad() const
Definition: PndEmcHit.cxx:120
TClonesArray * cluster_array
Double_t
virtual Double_t GetEnergy() const
Definition: PndEmcHit.h:54
PndEmcMapper * emcMap
TLegend * copies
Double_t cluster_energy
TLegend * copies6
Double_t cluster_phi
Double_t row_did
a cluster (group of neighboring crystals) of hit emc crystals
Definition: PndEmcCluster.h:29
c1
Definition: plot_dirc.C:35
Double_t hit_phi
Double_t digi_theta
Double_t row_hid
TH2F * hrow_crystal_d
represents the deposited energy of one emc crystal from simulation
Definition: PndEmcHit.h:26
Double_t row_cid
Short_t GetRow() const
Definition: PndEmcHit.h:59
Double_t GetPhi() const
Definition: PndEmcDigi.h:102
Short_t GetYPad() const
Definition: PndEmcDigi.cxx:261
TLegend * copies5
Short_t GetRow() const
Definition: PndEmcDigi.h:104
virtual Double_t energy() const
const TVector3 & where() const
Definition: PndEmcDigi.h:111
TLegend * copies2a
TH1F * hclus_ene_sum_mc
PndSdsMCPoint * hit
Definition: anasim.C:70
Short_t GetXPad() const
Definition: PndEmcDigi.cxx:223
TClonesArray * mctrack_array
Short_t GetCopy() const
Definition: PndEmcHit.h:61
TLorentzVector p4mom
Double_t Pi
Short_t GetModule() const
Definition: PndEmcHit.h:58
Double_t module_d
static PndEmcMapper * Instance()
Double_t digi_phi
Double_t hit_ene
Int_t GetPhiInt() const
Definition: PndEmcDigi.h:100
Double_t crystal_d