StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
dighistograms.cxx
1 // //
3 // DIGHistograms //
4 // //
5 // histograms list stored in TObjArray //
6 // //
7 // //
8 // //
9 // //
10 // //
11 // //
13 #include <dighistograms.h>
14 
15 
16 #include <TROOT.h> // for gROOT object
17 #include <TMath.h>
18 #include <TMatrixD.h>
19 #include <TCanvas.h>
20 #include <TGraph.h>
21 #include <TAxis.h>
22 #include <TRandom3.h>
23 #include <TFile.h>
24 #include <TTree.h>
25 #include <TBranch.h>
26 #include <TClonesArray.h>
27 
28 //include other classes.h:
29 
30 
31 using namespace std;
32 
33 //==============================================================================
34 ClassImp(DIGHistograms)
35 //______________________________________________________________________________
36 //
38 {
39  //
40  // default constructor
41  //
42 }
43 //______________________________________________________________________________
44 //
45 DIGHistograms::DIGHistograms(Int_t myNumberOfConfigurations)
46 {
47  fNumberOfConfigs = myNumberOfConfigurations;
48 }
49 //______________________________________________________________________________
50 //
51 DIGHistograms::~DIGHistograms() {
52  //
53  // virtual destructor
54  //
55 }
56 //______________________________________________________________________________
57 //
58 DIGHistograms::DIGHistograms(DIGHistograms & adighisto)
59 {
60  fNumberOfConfigs = adighisto.GetNumberOfConfigurations();
61 
62 }
63 //______________________________________________________________________________
64 //
65 void DIGHistograms::Clear(const Option_t *)
66 {
67  // delete pointers. fDIGParticleArray->Clear("C");
68 
69 }
70 //______________________________________________________________________________
71 //
72 void DIGHistograms::PrintInfo() {
73  std::cout<<"---------DIGHistograms properties------------- "<<endl;
74  //std::cout<<"fEntryX fEntryY fExitX fExitY fEnergy_deposited"<<endl;
75  // std::cout<<fEntryX<<" "<< fEntryY<<" "<<fExitX <<" "<<fExitY <<" "<<fEnergy_deposited <<endl;
76 }
77 //______________________________________________________________________________
78 //
79 void DIGHistograms::SetNumberOfConfigurations(Int_t myNumberOfConfigurations){
80  fNumberOfConfigs=myNumberOfConfigurations;
81 }
82 //______________________________________________________________________________
83 //
84 void DIGHistograms::BookHistograms(Int_t myNumberOfConfigurations){
85 
86  SetNumberOfConfigurations(myNumberOfConfigurations);
87  //-----------multiplicity
88  Ar_h1_multiplicity_with_threshold_01 = new TObjArray(fNumberOfConfigs);
89  Ar_h1_multiplicity_with_threshold_02 = new TObjArray(fNumberOfConfigs);
90  Ar_h1_multiplicity_with_threshold_03 = new TObjArray(fNumberOfConfigs);
91  Ar_h1_multiplicity_with_threshold_04 = new TObjArray(fNumberOfConfigs);
92  Ar_h1_multiplicity_with_threshold_05 = new TObjArray(fNumberOfConfigs);
93  Ar_h1_multiplicity_with_threshold_06 = new TObjArray(fNumberOfConfigs);
94  Ar_h1_multiplicity_with_threshold_07 = new TObjArray(fNumberOfConfigs);
95  Ar_h1_multiplicity_with_threshold_08 = new TObjArray(fNumberOfConfigs);
96  Ar_h1_multiplicity_with_threshold_09 = new TObjArray(fNumberOfConfigs);
97  Ar_h1_multiplicity_with_threshold_10 = new TObjArray(fNumberOfConfigs);
98 
99  Ar_h1_multiplicity_with_threshold_15 = new TObjArray(fNumberOfConfigs);
100  Ar_h1_multiplicity_with_threshold_20 = new TObjArray(fNumberOfConfigs);
101  Ar_h1_multiplicity_with_threshold_25 = new TObjArray(fNumberOfConfigs);
102  Ar_h1_multiplicity_with_threshold_30 = new TObjArray(fNumberOfConfigs);
103  Ar_h1_multiplicity_with_threshold_40 = new TObjArray(fNumberOfConfigs);
104 
105 
106 
107 
108  //-----------cluster
109  Ar_h1_Cluster_SeedDigitalCharge = new TObjArray(fNumberOfConfigs);
110  Ar_h1_Cluster_TotalDigitalCharge = new TObjArray(fNumberOfConfigs);
111  Ar_h1_Cluster_9x9DigitalCharge = new TObjArray(fNumberOfConfigs);
112  Ar_h1_Cluster_1stCrownDigitalCharge = new TObjArray(fNumberOfConfigs);
113  Ar_h1_Cluster_2ndCrownDigitalCharge = new TObjArray(fNumberOfConfigs);
114  Ar_h1_Cluster_4NeighboursDigitalCharge = new TObjArray(fNumberOfConfigs);
115  Ar_h1_Cluster_SeedOverTotalDigitalCharge = new TObjArray(fNumberOfConfigs);
116  Ar_h1_Cluster_1stCrownOverTotalDigitalCharge = new TObjArray(fNumberOfConfigs);
117  Ar_h1_Cluster_2ndCrownOverTotalDigitalCharge = new TObjArray(fNumberOfConfigs);
118  Ar_h1_Cluster_4NeighboursOverTotalDigitalCharge = new TObjArray(fNumberOfConfigs);
119 
120  Ar_h1_test = new TObjArray(fNumberOfConfigs);
121 
122  //-----------particle
123  Ar_h1_Particle_TotalAnalogCharge = new TObjArray(fNumberOfConfigs);
124  Ar_h1_Particle_TotalDigitalCharge = new TObjArray(fNumberOfConfigs);
125  Ar_h1_Particle_Energy_deposited = new TObjArray(fNumberOfConfigs);
126  Ar_h2_Particle_EnergyDeposited_vs_TotalAnalogCharge = new TObjArray(fNumberOfConfigs);
127  Ar_h2_Particle_TotalDigitalCharge_vs_TotalAnalogCharge = new TObjArray(fNumberOfConfigs);
128 
129  //-----------Resolution
130  Ar_h1_Resolution_ResidualX_CoG_true = new TObjArray(fNumberOfConfigs);
131  Ar_h1_Resolution_ResidualY_CoG_true = new TObjArray(fNumberOfConfigs);
132  Ar_h1_Resolution_Residualdist_CoG_true = new TObjArray(fNumberOfConfigs);
133  Ar_h2_Resolution_TruePosition = new TObjArray(fNumberOfConfigs);
134  Ar_h2_Resolution_TruePosition_modulo = new TObjArray(fNumberOfConfigs);
135  Ar_h2_Resolution_CoG = new TObjArray(fNumberOfConfigs);
136  Ar_h2_Resolution_CoG_modulo = new TObjArray(fNumberOfConfigs);
137 
138 
139  Ar_Pr_Charge_Q_over_Qtot_vs_distance = new TObjArray(fNumberOfConfigs);
140  Ar_h2_Charge_Q_over_Qtot_vs_distance = new TObjArray(fNumberOfConfigs);
141 
142  Ar_h1_ADC_LSB = new TObjArray(fNumberOfConfigs);
143  Ar_h1_Efficiency_ideal = new TObjArray(fNumberOfConfigs);
144 
145 
146 
147 
148  TProfile *prtemp = 0;
149  TH1F *h1temp = 0;
150  TH2F *h2temp = 0;
151  Char_t titre[150] ;
152  // sprintf(titre," Charge in %d pixels",i+1);
153  Int_t Nbin_mult = 27;
154 
155  for (Int_t i = 0; i < fNumberOfConfigs ; i++){
156 
157  //-----------multiplicity
158  sprintf(titre,"multiplicity_with_threshold_01_conf%d",i);
159  h1temp= new TH1F(titre,titre,Nbin_mult,0,Nbin_mult);
160  Ar_h1_multiplicity_with_threshold_01->Add(h1temp);
161  sprintf(titre,"multiplicity_with_threshold_02_conf%d",i);
162  h1temp= new TH1F(titre,titre,Nbin_mult,0,Nbin_mult);
163  Ar_h1_multiplicity_with_threshold_02->Add(h1temp);
164  sprintf(titre,"multiplicity_with_threshold_03_conf%d",i);
165  h1temp= new TH1F(titre,titre,Nbin_mult,0,Nbin_mult);
166  Ar_h1_multiplicity_with_threshold_03->Add(h1temp);
167  sprintf(titre,"multiplicity_with_threshold_04_conf%d",i);
168  h1temp= new TH1F(titre,titre,Nbin_mult,0,Nbin_mult);
169  Ar_h1_multiplicity_with_threshold_04->Add(h1temp);
170  sprintf(titre,"multiplicity_with_threshold_05_conf%d",i);
171  h1temp= new TH1F(titre,titre,Nbin_mult,0,Nbin_mult);
172  Ar_h1_multiplicity_with_threshold_05->Add(h1temp);
173  sprintf(titre,"multiplicity_with_threshold_06_conf%d",i);
174  h1temp= new TH1F(titre,titre,Nbin_mult,0,Nbin_mult);
175  Ar_h1_multiplicity_with_threshold_06->Add(h1temp);
176  sprintf(titre,"multiplicity_with_threshold_07_conf%d",i);
177  h1temp= new TH1F(titre,titre,Nbin_mult,0,Nbin_mult);
178  Ar_h1_multiplicity_with_threshold_07->Add(h1temp);
179  sprintf(titre,"multiplicity_with_threshold_08_conf%d",i);
180  h1temp= new TH1F(titre,titre,Nbin_mult,0,Nbin_mult);
181  Ar_h1_multiplicity_with_threshold_08->Add(h1temp);
182  sprintf(titre,"multiplicity_with_threshold_09_conf%d",i);
183  h1temp= new TH1F(titre,titre,Nbin_mult,0,Nbin_mult);
184  Ar_h1_multiplicity_with_threshold_09->Add(h1temp);
185  sprintf(titre,"multiplicity_with_threshold_10_conf%d",i);
186  h1temp= new TH1F(titre,titre,Nbin_mult,0,Nbin_mult);
187  Ar_h1_multiplicity_with_threshold_10->Add(h1temp);
188 
189  sprintf(titre,"multiplicity_with_threshold_15_conf%d",i);
190  h1temp= new TH1F(titre,titre,Nbin_mult,0,Nbin_mult);
191  Ar_h1_multiplicity_with_threshold_15->Add(h1temp);
192  sprintf(titre,"multiplicity_with_threshold_20_conf%d",i);
193  h1temp= new TH1F(titre,titre,Nbin_mult,0,Nbin_mult);
194  Ar_h1_multiplicity_with_threshold_20->Add(h1temp);
195  sprintf(titre,"multiplicity_with_threshold_25_conf%d",i);
196  h1temp= new TH1F(titre,titre,Nbin_mult,0,Nbin_mult);
197  Ar_h1_multiplicity_with_threshold_25->Add(h1temp);
198  sprintf(titre,"multiplicity_with_threshold_30_conf%d",i);
199  h1temp= new TH1F(titre,titre,Nbin_mult,0,Nbin_mult);
200  Ar_h1_multiplicity_with_threshold_30->Add(h1temp);
201  sprintf(titre,"multiplicity_with_threshold_40_conf%d",i);
202  h1temp= new TH1F(titre,titre,Nbin_mult,0,Nbin_mult);
203  Ar_h1_multiplicity_with_threshold_40->Add(h1temp);
204 
205 
206 
207  //-----------cluster
208  sprintf(titre,"Cluster_SeedDigitalCharge_conf%d",i);
209  h1temp= new TH1F(titre,titre,1000,0,2000);
210  Ar_h1_Cluster_SeedDigitalCharge->Add(h1temp);
211  sprintf(titre,"Cluster_TotalDigitalCharge_conf%d",i);
212  h1temp= new TH1F(titre,titre,1000,0,2000);
213  Ar_h1_Cluster_TotalDigitalCharge->Add(h1temp);
214  sprintf(titre,"Ar_h1_Cluster_9x9DigitalCharge_conf%d",i);
215  h1temp= new TH1F(titre,titre,1000,0,2000);
216  Ar_h1_Cluster_9x9DigitalCharge->Add(h1temp);
217  sprintf(titre,"Ar_h1_Cluster_1stCrownDigitalCharge_conf%d",i);
218  h1temp= new TH1F(titre,titre,1000,0,2000);
219  Ar_h1_Cluster_1stCrownDigitalCharge->Add(h1temp);
220  sprintf(titre," Ar_h1_Cluster_2ndCrownDigitalCharge_conf%d",i);
221  h1temp= new TH1F(titre,titre,1000,0,2000);
222  Ar_h1_Cluster_2ndCrownDigitalCharge->Add(h1temp);
223  sprintf(titre,"Ar_h1_Cluster_4NeighboursDigitalCharge_conf%d",i);
224  h1temp= new TH1F(titre,titre,1000,0,2000);
225  Ar_h1_Cluster_4NeighboursDigitalCharge->Add(h1temp);
226  sprintf(titre," Ar_h1_Cluster_SeedOverTotalDigitalCharge_conf%d",i);
227  h1temp= new TH1F(titre,titre,110,0.0,1.1);
228  Ar_h1_Cluster_SeedOverTotalDigitalCharge->Add(h1temp);
229  sprintf(titre,"Ar_h1_Cluster_1stCrownOverTotalDigitalCharge_conf%d",i);
230  h1temp= new TH1F(titre,titre,110,0.0,1.1);
231  Ar_h1_Cluster_1stCrownOverTotalDigitalCharge->Add(h1temp);
232  sprintf(titre," Ar_h1_Cluster_2ndCrownOverTotalDigitalCharge_conf%d",i);
233  h1temp= new TH1F(titre,titre,110,0.0,1.1);
234  Ar_h1_Cluster_2ndCrownOverTotalDigitalCharge->Add(h1temp);
235  sprintf(titre,"Ar_h1_Cluster_4NeighboursOverTotalDigitalCharge_conf%d",i);
236  h1temp= new TH1F(titre,titre,110,0.0,1.1);
237  Ar_h1_Cluster_4NeighboursOverTotalDigitalCharge->Add(h1temp);
238  sprintf(titre,"Ar_h1_test%d",i);
239  h1temp= new TH1F(titre,titre,1000,0,2000);
240  Ar_h1_test->Add(h1temp);
241 
242  sprintf(titre,"Ar_Pr_Charge_Q_over_Qtot_vs_distance%d",i);
243  prtemp= new TProfile(titre,titre,100,0,200,0.0,1.1);
244  Ar_Pr_Charge_Q_over_Qtot_vs_distance->Add(prtemp);
245  sprintf(titre,"Ar_h2_Charge_Q_over_Qtot_vs_distance%d",i);
246  h2temp= new TH2F(titre,titre,400,0,200,110,0.0,1.1);
247  Ar_h2_Charge_Q_over_Qtot_vs_distance->Add(h2temp);
248 
249 
250  //-----------particle
251  sprintf(titre,"Particle_TotalAnalogCharge_conf%d",i);
252  h1temp= new TH1F(titre,titre,600,0,6000);
253  Ar_h1_Particle_TotalAnalogCharge->Add(h1temp);
254  sprintf(titre,"Particle_TotalDigitalCharge_conf%d",i);
255  h1temp= new TH1F(titre,titre,1000,0,2000);
256  Ar_h1_Particle_TotalDigitalCharge->Add(h1temp);
257  sprintf(titre,"Particle_Energy_deposited_conf%d",i);
258  h1temp= new TH1F(titre,titre,600,0,6000);
259  Ar_h1_Particle_Energy_deposited->Add(h1temp);
260 
261  sprintf(titre,"Particle_EnergyDeposited_vs_TotalAnalogCharge_conf%d",i);
262  h2temp= new TH2F(titre,titre,150,0,3000,150,0,3000);
263  Ar_h2_Particle_EnergyDeposited_vs_TotalAnalogCharge->Add(h2temp);
264  sprintf(titre,"Particle_TotalDigitalCharge_vs_TotalAnalogCharge_conf%d",i);
265  h2temp= new TH2F(titre,titre,300,0,3000,500,0,1000);
266  Ar_h2_Particle_TotalDigitalCharge_vs_TotalAnalogCharge->Add(h2temp);
267 
268  //-----------Resolution
269  sprintf(titre,"Ar_h1_Resolution_ResidualX_CoG_true_conf%d",i);
270  h1temp= new TH1F(titre,titre,400,-40,40);
271  Ar_h1_Resolution_ResidualX_CoG_true->Add(h1temp);
272  sprintf(titre,"Ar_h1_Resolution_ResidualY_CoG_true_conf%d",i);
273  h1temp= new TH1F(titre,titre,400,-40,40);
274  Ar_h1_Resolution_ResidualY_CoG_true->Add(h1temp);
275  sprintf(titre,"Ar_h1_Resolution_Residualdist_CoG_true_conf%d",i);
276  h1temp= new TH1F(titre,titre,400,0,80);
277  Ar_h1_Resolution_Residualdist_CoG_true->Add(h1temp);
278  sprintf(titre,"Ar_h2_Resolution_TruePosition_conf%d",i);
279  h2temp= new TH2F(titre,titre,400,0,2000,400,0,2000);
280  Ar_h2_Resolution_TruePosition->Add(h2temp);
281  sprintf(titre,"Ar_h2_Resolution_TruePosition_modulo_conf%d",i);
282  h2temp= new TH2F(titre,titre,200,0,200,200,0,200);
283  Ar_h2_Resolution_TruePosition_modulo->Add(h2temp);
284  sprintf(titre,"Ar_h2_Resolution_CoG_conf%d",i);
285  h2temp= new TH2F(titre,titre,400,0,2000,400,0,2000);
286  Ar_h2_Resolution_CoG->Add(h2temp);
287  sprintf(titre,"Ar_h2_Resolution_CoG_modulo_conf%d",i);
288  h2temp= new TH2F(titre,titre,200,0,200,200,0,200);
289  Ar_h2_Resolution_CoG_modulo->Add(h2temp);
290 
291  //-----------ADC
292  sprintf(titre,"Ar_h1_ADC_LSB_conf%d",i);
293  h1temp= new TH1F(titre,titre,200,0,20);
294  Ar_h1_ADC_LSB->Add(h1temp);
295 
296  //----------Efficiency
297  sprintf(titre,"Ar_h1_Efficiency_ideal_conf%d",i);
298  h1temp= new TH1F(titre,titre,10001,0,1.0001);
299  Ar_h1_Efficiency_ideal->Add(h1temp);
300 
301 
302 
303  }
304 
305  sprintf(titre,"NumberOfEventsPerConfiguration");
306  h1_NumberOfEventsPerConfiguration= new TH1F(titre,titre,100,0,100000);
307  sprintf(titre,"NumberOfConfigurations");
308  h1_NumberOfConfigurations= new TH1F(titre,titre,10000,0,10000);;
309 
310 
311 
312 
313 
314 
315 }
316 
317 //______________________________________________________________________________
318 //
319 void DIGHistograms::PlotHistograms(Int_t myNumberOfConfigurations){
320  cout<<" number of configurations "<<myNumberOfConfigurations<<endl;
321 
322 }
323 //______________________________________________________________________________
324 //
325 TH1F* DIGHistograms::AutoZoom(TH1F* H,Option_t* aType, Int_t EntryMin/*=0*/)
326 {
327  Int_t shift = (Int_t)(H->GetNbinsX()/50.);
328 
329  TString opt = aType;
330  opt.ToLower();
331 
332  int min =0;
333  int max = H->GetNbinsX();
334  int New_min = min;
335  int New_max = max;
336 
337  if (opt.Contains("all")) opt = TString("min,max");
338  if (opt.Contains("sym")) opt = TString("min,sym");
339 
340  if (opt.Contains("min"))
341  {
342  for (New_min=min; New_min<=max;New_min++)
343  {Stat_t c = H->GetBinContent(New_min); if (c>EntryMin) break;}
344  }
345 
346  else if (opt.Contains("max"))
347  {
348  for (New_max=max;New_max>=min;New_max--)
349  {Stat_t c = H->GetBinContent(New_max); if (c>EntryMin) break;}
350  }
351 
352  else if (opt.Contains("calib"))
353  {
354  Stat_t t = 0;
355  for (New_max=max;New_max>=min;New_max--)
356  {Stat_t c = H->GetBinContent(New_max); if (c>EntryMin) break;}
357 
358  Stat_t EntryMax=H->GetEntries()-H->GetEntries()/100;
359 
360  for (New_min=min; New_min<=max;New_min++)
361  {t+=H->GetBinContent(New_min); if (t>EntryMax) break;}
362  }
363 
364  if (opt.Contains("sym"))New_max = H->FindBin(-1*H->GetXaxis()->GetBinCenter(New_min));
365 
366  H->GetXaxis()->SetRange(New_min - shift , New_max + shift);
367  return H;
368 }
369 
370 
371 //_______________________________________________________________________________________
372 //
373 TH2F* DIGHistograms::AutoZoom(TH2F* H,Option_t* aType/*="all"*/, Int_t EntryMin/*=0*/)
374 {
375 
376  Int_t shiftX = (Int_t)(H->GetNbinsX()/30.);
377  Int_t shiftY = (Int_t)(H->GetNbinsY()/30.);
378 
379  TString opt = aType;
380  opt.ToLower();
381 
382  int minX =0;
383  int maxX = H->GetNbinsX();
384  int New_minX = minX;
385  int New_maxX = maxX;
386 
387  int minY =0;
388  int maxY = H->GetNbinsY();
389  int New_minY = minY;
390  int New_maxY = maxY;
391 
392  if (opt.Contains("all")) opt = TString("minx,maxx,miny,maxy");
393 
394  if (opt.Contains("maxx"))
395  {
396  for (New_maxX = maxX;New_maxX >=minX; New_maxX--)
397  { Stat_t c = 0;
398  for (int i_y = maxY; i_y >= minY;i_y--)
399  { c = H->GetBinContent(New_maxX,i_y); if (c>EntryMin) break;}
400  if (c>EntryMin) break;
401  }
402  }
403 
404  if (opt.Contains("maxy"))
405  {
406 
407  for (New_maxY = maxY;New_maxY >=minY;New_maxY--)
408  { Stat_t c = 0;
409  for (int i_x=maxX; i_x>=minX;i_x--)
410  { c = H->GetBinContent(i_x, New_maxY ); if (c>EntryMin) break;}
411  if (c>EntryMin) break;
412  }
413 
414  }
415 
416  if (opt.Contains("minx"))
417  {
418 
419  for (New_minX = minX;New_minX <=maxX; New_minX++)
420  { Stat_t c = 0;
421  for (int i_y = minY; i_y <= maxY;i_y++)
422  { c = H->GetBinContent(New_minX,i_y); if (c>EntryMin) break;}
423  if (c>EntryMin) break;
424  }
425  }
426 
427 
428 
429 if (opt.Contains("miny"))
430  {
431  for (New_minY = minY;New_minY <=maxY;New_minY++)
432  { Stat_t c = 0;
433  for (int i_x=minX; i_x<=maxX;i_x++)
434  { c = H->GetBinContent(i_x, New_minY ); if (c>EntryMin) break;}
435  if (c>EntryMin) break;
436  }
437  }
438 
439 
440  H->GetXaxis()->SetRange(New_minX - shiftX , New_maxX + shiftX);
441  H->GetYaxis()->SetRange(New_minY - shiftY , New_maxY + shiftY);
442 
443  return H;
444 }
445 //______________________________________________________________________________
446 //
447 //______________________________________________________________________________
448 //