CMS 3D CMS Logo

TEcnaRun.cc
Go to the documentation of this file.
1 //----------Author's Names: B.Fabbro, FX Gentit DSM/IRFU/SPP CEA-Saclay
2 //----------Copyright: Those valid for CEA sofware
3 //----------Modified: 30/01/2014
4 
6 
7 //--------------------------------------
8 // TEcnaRun.cc
9 // Class creation: 03 Dec 2002
10 // Documentation: see TEcnaRun.h
11 //--------------------------------------
12 
14 
16 //___________________________________________________________________________
17 //
18 
20  //Constructor without argument: nothing special done
21 
22  // std::cout << "[Info Management] CLASS: TEcnaRun. CREATE OBJECT: this = " << this << std::endl;
23 }
24 
25 TEcnaRun::TEcnaRun(TEcnaObject* pObjectManager, const TString& SubDet) {
26  //Constructor with argument: call to Init() and declare fEcal according to SubDet value ("EB" or "EE")
27 
28  // std::cout << "[Info Management] CLASS: TEcnaRun. CREATE OBJECT: this = " << this << std::endl;
29 
30  Init();
31  fObjectManager = (TEcnaObject*)pObjectManager;
32  Long_t i_this = (Long_t)this;
33  pObjectManager->RegisterPointer("TEcnaRun", i_this);
34 
35  //............................ fCnaParCout
36  fCnaParCout = nullptr;
37  Long_t iCnaParCout = pObjectManager->GetPointerValue("TEcnaParCout");
38  if (iCnaParCout == 0) {
39  fCnaParCout = new TEcnaParCout(pObjectManager); /*fCnew++*/
40  } else {
41  fCnaParCout = (TEcnaParCout*)iCnaParCout;
42  }
43 
44  //............................ fCnaParPaths
45  fCnaParPaths = nullptr;
46  Long_t iCnaParPaths = pObjectManager->GetPointerValue("TEcnaParPaths");
47  if (iCnaParPaths == 0) {
48  fCnaParPaths = new TEcnaParPaths(pObjectManager); /*fCnew++*/
49  } else {
50  fCnaParPaths = (TEcnaParPaths*)iCnaParPaths;
51  }
52 
53  //fCfgResultsRootFilePath = fCnaParPaths->ResultsRootFilePath();
54  //fCfgHistoryRunListFilePath = fCnaParPaths->HistoryRunListFilePath();
55 
56  //ffFileHeader = 0;
57  //fconst Text_t *h_name = "CnaHeader"; //==> voir cette question avec FXG
58  //fconst Text_t *h_title = "CnaHeader"; //==> voir cette question avec FXG
59  //ffFileHeader = new TEcnaHeader(h_name, h_title); //fCnew++;
60 
61  //............................ fFileHeader
62  const Text_t* h_name = "CnaHeader"; //==> voir cette question avec FXG
63  const Text_t* h_title = "CnaHeader"; //==> voir cette question avec FXG
64 
65  fFileHeader = nullptr;
66  //Int_t iFileHeader = pObjectManager->GetPointerValue("TEcnaHeader");
67  Long_t iFileHeader = 0; // one TEcnaHeader object for each file since they can be open simultaneously
68  if (iFileHeader == 0) {
69  fFileHeader = new TEcnaHeader(pObjectManager, h_name, h_title); /*fCnew++*/
70  } else {
71  fFileHeader = (TEcnaHeader*)iFileHeader;
72  }
73 
74  SetEcalSubDetector(SubDet.Data());
75  fNbSampForFic = fEcal->MaxSampADC(); // DEFAULT Number of samples for ROOT file
76 }
77 
78 TEcnaRun::TEcnaRun(TEcnaObject* pObjectManager, const TString& SubDet, const Int_t& NbOfSamples) {
79  //fCnaParPaths = 0; fCnaParPaths = new TEcnaParPaths(); //fCnew++;
80  //fCnaParCout = 0; fCnaParCout = new TEcnaParCout(); //fCnew++;
81 
82  Init();
83  fObjectManager = (TEcnaObject*)pObjectManager;
84  Long_t i_this = (Long_t)this;
85  pObjectManager->RegisterPointer("TEcnaRun", i_this);
86 
87  //............................ fCnaParCout
88  fCnaParCout = nullptr;
89  Long_t iCnaParCout = pObjectManager->GetPointerValue("TEcnaParCout");
90  if (iCnaParCout == 0) {
91  fCnaParCout = new TEcnaParCout(pObjectManager); /*fCnew++*/
92  } else {
93  fCnaParCout = (TEcnaParCout*)iCnaParCout;
94  }
95 
96  //............................ fCnaParPaths
97  fCnaParPaths = nullptr;
98  Long_t iCnaParPaths = pObjectManager->GetPointerValue("TEcnaParPaths");
99  if (iCnaParPaths == 0) {
100  fCnaParPaths = new TEcnaParPaths(pObjectManager); /*fCnew++*/
101  } else {
102  fCnaParPaths = (TEcnaParPaths*)iCnaParPaths;
103  }
104 
105  //fCfgResultsRootFilePath = fCnaParPaths->ResultsRootFilePath();
106  //fCfgHistoryRunListFilePath = fCnaParPaths->HistoryRunListFilePath();
107 
108  //............................ fFileHeader
109  const Text_t* h_name = "CnaHeader"; //==> voir cette question avec FXG
110  const Text_t* h_title = "CnaHeader"; //==> voir cette question avec FXG
111 
112  fFileHeader = nullptr;
113  //Long_t iFileHeader = pObjectManager->GetPointerValue("TEcnaHeader");
114  Long_t iFileHeader = 0; // one TEcnaHeader object for each file since they can be open simultaneously
115  if (iFileHeader == 0) {
116  fFileHeader = new TEcnaHeader(pObjectManager, h_name, h_title); /*fCnew++*/
117  } else {
118  fFileHeader = (TEcnaHeader*)iFileHeader;
119  }
120 
121  SetEcalSubDetector(SubDet.Data());
122  if (NbOfSamples > 0 && NbOfSamples <= fEcal->MaxSampADC()) {
123  fNbSampForFic = NbOfSamples;
124  } else {
125  std::cout << "TEcnaRun/CONSTRUCTOR> Number of required samples = " << NbOfSamples
126  << ": OUT OF RANGE. Set to the default value (= " << fEcal->MaxSampADC() << ")." << fTTBELL << std::endl;
127  fNbSampForFic = fEcal->MaxSampADC(); // DEFAULT Number of samples for file reading
128  }
129 }
130 
131 //.... return true or false according to the existence of the path. The path itself is in an attribute of fCnaParPaths.
133 
135  //Initialisation
136 
137  fCnew = 0;
138  fCdelete = 0;
139  fCnaCommand = 0;
140  fCnaError = 0;
141 
142  fTTBELL = '\007';
143 
144  //........................... TString file names init
145  fgMaxCar = (Int_t)512;
146 
147  //................ MiscDiag counters .................
148  fMaxMsgIndexForMiscDiag = (Int_t)10;
149  fNbOfMiscDiagCounters = (Int_t)50;
150  fMiscDiag = nullptr;
151 
152  fNumberOfEvents = 0;
153  //............................. init pointers ( Init() )
154  fT3d_AdcValues = nullptr;
155  fT3d2_AdcValues = nullptr;
156  fT3d1_AdcValues = nullptr;
157 
158  fT1d_StexStinFromIndex = nullptr;
159 
160  fT2d_NbOfEvts = nullptr;
161  fT1d_NbOfEvts = nullptr;
162 
163  fT2d_ev = nullptr;
164  fT1d_ev = nullptr;
165  fT2d_sig = nullptr;
166  fT1d_sig = nullptr;
167 
168  fT3d_cov_ss = nullptr;
169  fT3d2_cov_ss = nullptr;
170  fT3d1_cov_ss = nullptr;
171 
172  fT3d_cor_ss = nullptr;
173  fT3d2_cor_ss = nullptr;
174  fT3d1_cor_ss = nullptr;
175 
176  fT2d_lf_cov = nullptr;
177  fT2d1_lf_cov = nullptr;
178 
179  fT2d_lf_cor = nullptr;
180  fT2d1_lf_cor = nullptr;
181 
182  fT2d_hf_cov = nullptr;
183  fT2d1_hf_cov = nullptr;
184 
185  fT2d_hf_cor = nullptr;
186  fT2d1_hf_cor = nullptr;
187 
188  fT2d_lfcc_mostins = nullptr;
189  fT2d1_lfcc_mostins = nullptr;
190 
191  fT2d_hfcc_mostins = nullptr;
192  fT2d1_hfcc_mostins = nullptr;
193 
194  fT1d_ev_ev = nullptr;
195  fT1d_evsamp_of_sigevt = nullptr;
196  fT1d_ev_cor_ss = nullptr;
197  fT1d_av_mped = nullptr;
198  fT1d_av_totn = nullptr;
199  fT1d_av_lofn = nullptr;
200  fT1d_av_hifn = nullptr;
201  fT1d_av_ev_corss = nullptr;
202  fT1d_av_sig_corss = nullptr;
203 
204  fT1d_sigevt_of_evsamp = nullptr;
205  fT1d_evevt_of_sigsamp = nullptr;
206  fT1d_sig_cor_ss = nullptr;
207 
208  fT2dCrysNumbersTable = nullptr;
209  fT1dCrysNumbersTable = nullptr;
210 
211  //................................ tags ( Init() )
212  fTagStinNumbers = nullptr;
213 
214  fTagNbOfEvts = nullptr;
215 
216  fTagAdcEvt = nullptr;
217 
218  fTagMSp = nullptr;
219  fTagSSp = nullptr;
220 
221  fTagCovCss = nullptr;
222  fTagCorCss = nullptr;
223 
224  fTagHfCov = nullptr;
225  fTagHfCor = nullptr;
226  fTagLfCov = nullptr;
227  fTagLfCor = nullptr;
228 
229  fTagLFccMoStins = nullptr;
230  fTagHFccMoStins = nullptr;
231 
232  fTagPed = nullptr;
233  fTagTno = nullptr;
234  fTagMeanCorss = nullptr;
235 
236  fTagLfn = nullptr;
237  fTagHfn = nullptr;
238  fTagSigCorss = nullptr;
239 
240  fTagAvPed = nullptr;
241  fTagAvTno = nullptr;
242  fTagAvLfn = nullptr;
243  fTagAvHfn = nullptr;
244 
245  fTagAvMeanCorss = nullptr;
246  fTagAvSigCorss = nullptr;
247 
248  //................................................... Code Print ( Init() )
250  fCodePrintWarnings = fCnaParCout->GetCodePrint("Warnings "); // => default value
253 
255 
256  //...................................................
257  gCnaRootFile = nullptr;
258  fOpenRootFile = kFALSE;
259  fReadyToReadData = 0;
260 
261  //.............................................. Miscellaneous
263 
264  fStinIndexBuilt = 0;
266 
268 
269 } // end of Init()
270 
271 //========================================================================
272 void TEcnaRun::SetEcalSubDetector(const TString& SubDet) {
273  // Set Subdetector (EB or EE)
274 
275  Int_t MaxCar = fgMaxCar;
276  fFlagSubDet.Resize(MaxCar);
277  fFlagSubDet = SubDet.Data();
278 
279  fEcal = nullptr;
280  fEcal = new TEcnaParEcal(fFlagSubDet.Data()); //fCnew++;
281  fEcalNumbering = nullptr;
282  fEcalNumbering = new TEcnaNumbering(fFlagSubDet.Data(), fEcal); //fCnew++;
283  fCnaWrite = nullptr;
284 
286 
287  if (fFlagSubDet == "EB") {
288  fStexName = "SM ";
289  fStinName = "tower";
290  }
291  if (fFlagSubDet == "EE") {
292  fStexName = "Dee";
293  fStinName = " SC ";
294  }
295 }
296 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
297 //
298 // copy constructor
299 //
300 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
301 
302 TEcnaRun::TEcnaRun(const TEcnaRun& dcop) : TObject::TObject(dcop) {
303  std::cout << "*TEcnaRun::TEcnaRun(const TEcnaRun& dcop)> "
304  << " Now is the time to write a copy constructor" << std::endl;
305 
306  //{ Int_t cintoto; cin >> cintoto; }
307 }
308 
309 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
310 //
311 // overloading of the operator=
312 //
313 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
314 
315 //TEcnaRun& TEcnaRun::operator=(const TEcnaRun& dcop)
316 //{
317 //Overloading of the operator=
318 //
319 // fCopy(dcop);
320 // return *this;
321 //}
322 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
323 //
324 // destructor
325 //
326 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
327 
329  //Destructor
330 
332  std::cout << "*TEcnaRun::~TEcnaRun()> Entering destructor." << std::endl;
333  }
334 
336  if (fBuildEvtNotSkipped > 0) {
337  std::cout << "************************************************************************************* "
338  << std::endl;
339  std::cout << "*TEcnaRun::~TEcnaRun()> Nb of calls to GetSampleAdcValues by cmsRun: " << fBuildEvtNotSkipped
340  << std::endl;
341  std::cout << "************************************************************************************* "
342  << std::endl;
343  }
344  }
345 
347  Int_t misc_czero = 0;
348  for (Int_t i = 0; i < fNbOfMiscDiagCounters; i++) {
349  if (fMiscDiag[i] != 0) {
350  std::cout << " fMiscDiag Counter " << std::setw(3) << i << " = " << std::setw(9)
351  << fMiscDiag[i] << " (INFO: alloc on non zero freed zone) " << std::endl;
352  } else {
353  misc_czero++;
354  }
355  }
356  std::cout << " Nb of fMiscDiag counters at zero: " << misc_czero
357  << " (total nb of counters: " << fNbOfMiscDiagCounters << ")" << std::endl;
358  }
359 
360  if (fMiscDiag != nullptr) {
361  delete[] fMiscDiag;
362  fCdelete++;
363  }
364 
365  //if (fFileHeader != 0){delete fFileHeader; fCdelete++;}
366  //if (fEcal != 0){delete fEcal; fCdelete++;}
367  //if (fEcalNumbering != 0){delete fEcalNumbering; fCdelete++;}
368  //if (fCnaParCout != 0){delete fCnaParCout; fCdelete++;}
369  //if (fCnaParPaths != 0){delete fCnaParPaths; fCdelete++;}
370  //if (fCnaWrite != 0){delete fCnaWrite; fCdelete++;}
371 
372  if (fT1d_StexStinFromIndex != nullptr) {
373  delete[] fT1d_StexStinFromIndex;
374  fCdelete++;
375  }
376 
377  if (fT2d_NbOfEvts != nullptr) {
378  delete[] fT2d_NbOfEvts;
379  fCdelete++;
380  }
381  if (fT1d_NbOfEvts != nullptr) {
382  delete[] fT1d_NbOfEvts;
383  fCdelete++;
384  }
385 
386  if (fT3d_AdcValues != nullptr) {
387  delete[] fT3d_AdcValues;
388  fCdelete++;
389  }
390  if (fT3d2_AdcValues != nullptr) {
391  delete[] fT3d2_AdcValues;
392  fCdelete++;
393  }
394  if (fT3d1_AdcValues != nullptr) {
395  delete[] fT3d1_AdcValues;
396  fCdelete++;
397  }
398 
399  if (fT2d_ev != nullptr) {
400  delete[] fT2d_ev;
401  fCdelete++;
402  }
403  if (fT1d_ev != nullptr) {
404  delete[] fT1d_ev;
405  fCdelete++;
406  }
407 
408  if (fT2d_sig != nullptr) {
409  delete[] fT2d_sig;
410  fCdelete++;
411  }
412  if (fT1d_sig != nullptr) {
413  delete[] fT1d_sig;
414  fCdelete++;
415  }
416 
417  if (fT3d_cov_ss != nullptr) {
418  delete[] fT3d_cov_ss;
419  fCdelete++;
420  }
421  if (fT3d2_cov_ss != nullptr) {
422  delete[] fT3d2_cov_ss;
423  fCdelete++;
424  }
425  if (fT3d1_cov_ss != nullptr) {
426  delete[] fT3d1_cov_ss;
427  fCdelete++;
428  }
429 
430  if (fT3d_cor_ss != nullptr) {
431  delete[] fT3d_cor_ss;
432  fCdelete++;
433  }
434  if (fT3d2_cor_ss != nullptr) {
435  delete[] fT3d2_cor_ss;
436  fCdelete++;
437  }
438  if (fT3d1_cor_ss != nullptr) {
439  delete[] fT3d1_cor_ss;
440  fCdelete++;
441  }
442 
443  if (fT2d_lf_cov != nullptr) {
444  delete[] fT2d_lf_cov;
445  fCdelete++;
446  }
447  if (fT2d1_lf_cov != nullptr) {
448  delete[] fT2d1_lf_cov;
449  fCdelete++;
450  }
451 
452  if (fT2d_lf_cor != nullptr) {
453  delete[] fT2d_lf_cor;
454  fCdelete++;
455  }
456  if (fT2d1_lf_cor != nullptr) {
457  delete[] fT2d1_lf_cor;
458  fCdelete++;
459  }
460 
461  if (fT2d_hf_cov != nullptr) {
462  delete[] fT2d_hf_cov;
463  fCdelete++;
464  }
465  if (fT2d1_hf_cov != nullptr) {
466  delete[] fT2d1_hf_cov;
467  fCdelete++;
468  }
469 
470  if (fT2d_hf_cor != nullptr) {
471  delete[] fT2d_hf_cor;
472  fCdelete++;
473  }
474  if (fT2d1_hf_cor != nullptr) {
475  delete[] fT2d1_hf_cor;
476  fCdelete++;
477  }
478 
479  if (fT2d_lfcc_mostins != nullptr) {
480  delete[] fT2d_lfcc_mostins;
481  fCdelete++;
482  }
483  if (fT2d1_lfcc_mostins != nullptr) {
484  delete[] fT2d1_lfcc_mostins;
485  fCdelete++;
486  }
487 
488  if (fT2d_hfcc_mostins != nullptr) {
489  delete[] fT2d_hfcc_mostins;
490  fCdelete++;
491  }
492  if (fT2d1_hfcc_mostins != nullptr) {
493  delete[] fT2d1_hfcc_mostins;
494  fCdelete++;
495  }
496 
497  if (fT1d_ev_ev != nullptr) {
498  delete[] fT1d_ev_ev;
499  fCdelete++;
500  }
501  if (fT1d_evsamp_of_sigevt != nullptr) {
502  delete[] fT1d_evsamp_of_sigevt;
503  fCdelete++;
504  }
505  if (fT1d_ev_cor_ss != nullptr) {
506  delete[] fT1d_ev_cor_ss;
507  fCdelete++;
508  }
509  if (fT1d_av_mped != nullptr) {
510  delete[] fT1d_av_mped;
511  fCdelete++;
512  }
513  if (fT1d_av_totn != nullptr) {
514  delete[] fT1d_av_totn;
515  fCdelete++;
516  }
517  if (fT1d_av_lofn != nullptr) {
518  delete[] fT1d_av_lofn;
519  fCdelete++;
520  }
521  if (fT1d_av_hifn != nullptr) {
522  delete[] fT1d_av_hifn;
523  fCdelete++;
524  }
525  if (fT1d_av_ev_corss != nullptr) {
526  delete[] fT1d_av_ev_corss;
527  fCdelete++;
528  }
529  if (fT1d_av_sig_corss != nullptr) {
530  delete[] fT1d_av_sig_corss;
531  fCdelete++;
532  }
533 
534  if (fT1d_sigevt_of_evsamp != nullptr) {
535  delete[] fT1d_sigevt_of_evsamp;
536  fCdelete++;
537  }
538  if (fT1d_evevt_of_sigsamp != nullptr) {
539  delete[] fT1d_evevt_of_sigsamp;
540  fCdelete++;
541  }
542  if (fT1d_sig_cor_ss != nullptr) {
543  delete[] fT1d_sig_cor_ss;
544  fCdelete++;
545  }
546 
547  if (fT2dCrysNumbersTable != nullptr) {
548  delete[] fT2dCrysNumbersTable;
549  fCdelete++;
550  }
551  if (fT1dCrysNumbersTable != nullptr) {
552  delete[] fT1dCrysNumbersTable;
553  fCdelete++;
554  }
555 
556  if (fTagStinNumbers != nullptr) {
557  delete[] fTagStinNumbers;
558  fCdelete++;
559  }
560  if (fTagNbOfEvts != nullptr) {
561  delete[] fTagNbOfEvts;
562  fCdelete++;
563  }
564  if (fTagAdcEvt != nullptr) {
565  delete[] fTagAdcEvt;
566  fCdelete++;
567  }
568  if (fTagMSp != nullptr) {
569  delete[] fTagMSp;
570  fCdelete++;
571  }
572  if (fTagSSp != nullptr) {
573  delete[] fTagSSp;
574  fCdelete++;
575  }
576 
577  if (fTagCovCss != nullptr) {
578  delete[] fTagCovCss;
579  fCdelete++;
580  }
581  if (fTagCorCss != nullptr) {
582  delete[] fTagCorCss;
583  fCdelete++;
584  }
585 
586  if (fTagHfCov != nullptr) {
587  delete[] fTagHfCov;
588  fCdelete++;
589  }
590  if (fTagHfCor != nullptr) {
591  delete[] fTagHfCor;
592  fCdelete++;
593  }
594  if (fTagLfCov != nullptr) {
595  delete[] fTagLfCov;
596  fCdelete++;
597  }
598  if (fTagLfCor != nullptr) {
599  delete[] fTagLfCor;
600  fCdelete++;
601  }
602 
603  if (fTagLFccMoStins != nullptr) {
604  delete[] fTagLFccMoStins;
605  fCdelete++;
606  }
607  if (fTagHFccMoStins != nullptr) {
608  delete[] fTagHFccMoStins;
609  fCdelete++;
610  }
611 
612  if (fTagPed != nullptr) {
613  delete[] fTagPed;
614  fCdelete++;
615  }
616  if (fTagTno != nullptr) {
617  delete[] fTagTno;
618  fCdelete++;
619  }
620  if (fTagMeanCorss != nullptr) {
621  delete[] fTagMeanCorss;
622  fCdelete++;
623  }
624 
625  if (fTagLfn != nullptr) {
626  delete[] fTagLfn;
627  fCdelete++;
628  }
629  if (fTagHfn != nullptr) {
630  delete[] fTagHfn;
631  fCdelete++;
632  }
633  if (fTagSigCorss != nullptr) {
634  delete[] fTagSigCorss;
635  fCdelete++;
636  }
637 
638  if (fTagAvPed != nullptr) {
639  delete[] fTagAvPed;
640  fCdelete++;
641  }
642  if (fTagAvTno != nullptr) {
643  delete[] fTagAvTno;
644  fCdelete++;
645  }
646  if (fTagAvLfn != nullptr) {
647  delete[] fTagAvLfn;
648  fCdelete++;
649  }
650  if (fTagAvHfn != nullptr) {
651  delete[] fTagAvHfn;
652  fCdelete++;
653  }
654  if (fTagAvMeanCorss != nullptr) {
655  delete[] fTagAvMeanCorss;
656  fCdelete++;
657  }
658  if (fTagAvSigCorss != nullptr) {
659  delete[] fTagAvSigCorss;
660  fCdelete++;
661  }
662 
663  if (fCnew != fCdelete) {
664  std::cout << "!TEcnaRun::~TEcnaRun()> WRONG MANAGEMENT OF MEMORY ALLOCATIONS: fCnew = " << fCnew
665  << ", fCdelete = " << fCdelete << fTTBELL << std::endl;
666  } else {
667  // std::cout << "*TEcnaRun::~TEcnaRun()> Management of memory allocations: OK. fCnew = "
668  // << fCnew << ", fCdelete = " << fCdelete << std::endl;
669  }
670 
672  std::cout << "*TEcnaRun::~TEcnaRun()> Exiting destructor (this = " << this << ")." << std::endl
673  << "~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#"
674  << std::endl;
675  }
676 
677  // std::cout << "[Info Management] CLASS: TEcnaRun. DESTROY OBJECT: this = " << this << std::endl;
678 }
679 
680 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
681 //
682 // M E T H O D S
683 //
684 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
685 
686 //============================================================================
687 //
688 // GetReadyToReadData(...)
689 //
690 // Preparation of the result file name + tags allocations
691 // + ADC event distribution array allocation + nb of events array allocation
692 //
693 //============================================================================
694 
695 void TEcnaRun::GetReadyToReadData(const TString& typ_ana,
696  const Int_t& run_number,
697  const Int_t& nfirst,
698  const Int_t& nlast,
699  const Int_t& nbevts,
700  const Int_t& Stex) {
701  //Preparation of the data reading. Set part of the header. No RunType as argument.
702  //Use default value = 99999999 and call method with all the arguments (see below)
703 
704  Int_t RunType = 99999999;
705  GetReadyToReadData(typ_ana, run_number, nfirst, nlast, nbevts, Stex, RunType);
706 }
707 //--------------------------------------------------------------------------------
708 void TEcnaRun::GetReadyToReadData(const TString& typ_ana,
709  const Int_t& run_number,
710  const Int_t& nfirst,
711  const Int_t& nlast,
712  const Int_t& nbevts,
713  const Int_t& Stex,
714  const Int_t& run_type) {
715  //Preparation of the data reading. Set part of the header
716  //
717  // [nfirst, nlast] = [1,50] (50 events) or [151,300] (150 events) or etc...
718 
719  Int_t nrangeevts = nlast - nfirst + 1; // number of events in range
720 
721  if (nrangeevts < nbevts) {
722  if (nlast >= nfirst) {
723  std::cout << "*TEcnaRun::GetReadyToReadData(...)> --- WARNING ---> number of events = " << nbevts
724  << ", out of range (range = " << nfirst << "," << nlast << ")" << std::endl
725  << " The number of found events will be less " << std::endl
726  << " than the number of requested events." << std::endl;
727  }
728  if (nlast < nfirst) {
729  std::cout << "*TEcnaRun::GetReadyToReadData(...)> --- INFO ---> last requested event number = " << nlast
730  << ", less than first requested event number (= " << nfirst << ")" << std::endl
731  << " File will be read until EOF if the number of found events"
732  << std::endl
733  << " remains less than the number of requested events." << std::endl;
734  }
735  }
736 
737  //............. allocation for counters
738  fMiscDiag = new Int_t[fNbOfMiscDiagCounters];
739  fCnew++;
740  for (Int_t iz = 0; iz < fNbOfMiscDiagCounters; iz++) {
741  fMiscDiag[iz] = (Int_t)0;
742  }
743 
744  //************** CHECK OF ARGUMENTS: nfirst_arg and nbevts_arg
745  Int_t nentries = 99999999; // => to be reintroduced as argument (like run_type) (?)
746  if (nfirst <= nentries) {
747  //--------------------- test positivity of nfirst_arg (GetReadyToReadData)
748  if (nfirst > 0) {
749  //-------- test compatibility between the last requested event number
750  // and the number of entries
751  if (nlast <= nentries) {
752  const Text_t* h_name = "CnaHeader"; //==> voir cette question avec FXG
753  const Text_t* h_title = "CnaHeader"; //==> voir cette question avec FXG
754  //fFileHeader->HeaderParameters(h_name, h_title ,
755  // typ_ana, fNbSampForFic,
756  // run_number, nfirst, nlast, nbevts,
757  // Stex, nentries); fCnew++;
758 
759  if (fEcal->MaxStinEcnaInStex() > 0 && fEcal->MaxCrysInStin() > 0 && fNbSampForFic > 0) {
760  if (fFileHeader == nullptr) {
761  fFileHeader = new TEcnaHeader(fObjectManager, h_name, h_title);
762  } // fCnew++;
763 
764  fFileHeader->HeaderParameters(typ_ana, fNbSampForFic, run_number, nfirst, nlast, nbevts, Stex, run_type);
765 
766  // After this call to TEcnaHeader, we have: (GetReadyToReadData)
767  // fFileHeader->fTypAna = typ_ana
768  // fFileHeader->fNbOfSamples = fNbSampForFic
769  // fFileHeader->fRunNumber = run_number
770  // fFileHeader->fFirstReqEvtNumber = nfirst
771  // fFileHeader->fLastReqEvtNumber = nlast
772  // fFileHeader->fReqNbOfEvts = nbevts
773  // fFileHeader->fStex = Stex number
774  // fFileHeader->fRunType = run_type
775 
776  // fFileHeader->Print();
777 
778  // {Int_t cintoto; std::cout << "taper 0 pour continuer" << std::endl; cin >> cintoto;}
779 
780  // fFileHeader->SetName("CnaHeader"); *======> voir FXG
781  // fFileHeader->SetTitle("CnaHeader");
782 
783  //......................................... allocation tags + init of them (GetReadyToReadData)
784 
785  fTagStinNumbers = new Int_t[1];
786  fCnew++;
787  fTagStinNumbers[0] = (Int_t)0;
788  fTagNbOfEvts = new Int_t[1];
789  fCnew++;
790  fTagNbOfEvts[0] = (Int_t)0;
791 
792  fTagAdcEvt = new Int_t[fEcal->MaxCrysEcnaInStex()];
793  fCnew++;
794  for (Int_t iz = 0; iz < fEcal->MaxCrysEcnaInStex(); iz++) {
795  fTagAdcEvt[iz] = (Int_t)0;
796  }
797 
798  fTagMSp = new Int_t[1];
799  fCnew++;
800  fTagMSp[0] = (Int_t)0;
801  fTagSSp = new Int_t[1];
802  fCnew++;
803  fTagSSp[0] = (Int_t)0;
804 
805  fTagCovCss = new Int_t[fEcal->MaxCrysEcnaInStex()];
806  fCnew++;
807  for (Int_t iz = 0; iz < fEcal->MaxCrysEcnaInStex(); iz++) {
808  fTagCovCss[iz] = (Int_t)0;
809  }
810 
811  fTagCorCss = new Int_t[fEcal->MaxCrysEcnaInStex()];
812  fCnew++;
813  for (Int_t iz = 0; iz < fEcal->MaxCrysEcnaInStex(); iz++) {
814  fTagCorCss[iz] = (Int_t)0;
815  }
816 
817  fTagLfCov = new Int_t[1];
818  fCnew++;
819  fTagLfCov[0] = (Int_t)0;
820  fTagLfCor = new Int_t[1];
821  fCnew++;
822  fTagLfCor[0] = (Int_t)0;
823 
824  fTagHfCov = new Int_t[1];
825  fCnew++;
826  fTagHfCov[0] = (Int_t)0;
827  fTagHfCor = new Int_t[1];
828  fCnew++;
829  fTagHfCor[0] = (Int_t)0;
830 
831  fTagLFccMoStins = new Int_t[1];
832  fCnew++;
833  fTagLFccMoStins[0] = (Int_t)0;
834  fTagHFccMoStins = new Int_t[1];
835  fCnew++;
836  fTagHFccMoStins[0] = (Int_t)0;
837 
838  fTagPed = new Int_t[1];
839  fCnew++;
840  fTagPed[0] = (Int_t)0;
841  fTagTno = new Int_t[1];
842  fCnew++;
843  fTagTno[0] = (Int_t)0;
844  fTagMeanCorss = new Int_t[1];
845  fCnew++;
846  fTagMeanCorss[0] = (Int_t)0;
847 
848  fTagLfn = new Int_t[1];
849  fCnew++;
850  fTagLfn[0] = (Int_t)0;
851  fTagHfn = new Int_t[1];
852  fCnew++;
853  fTagHfn[0] = (Int_t)0;
854  fTagSigCorss = new Int_t[1];
855  fCnew++;
856  fTagSigCorss[0] = (Int_t)0;
857 
858  fTagAvPed = new Int_t[1];
859  fCnew++;
860  fTagAvPed[0] = (Int_t)0;
861  fTagAvTno = new Int_t[1];
862  fCnew++;
863  fTagAvTno[0] = (Int_t)0;
864  fTagAvLfn = new Int_t[1];
865  fCnew++;
866  fTagAvLfn[0] = (Int_t)0;
867  fTagAvHfn = new Int_t[1];
868  fCnew++;
869  fTagAvHfn[0] = (Int_t)0;
870  fTagAvMeanCorss = new Int_t[1];
871  fCnew++;
872  fTagAvMeanCorss[0] = (Int_t)0;
873  fTagAvSigCorss = new Int_t[1];
874  fCnew++;
875  fTagAvSigCorss[0] = (Int_t)0;
876 
877  //====================================================================================
878  //
879  // allocation for fT1d_StexStinFromIndex[] and init to fSpecialStexStinNotIndexed
880  //
881  //====================================================================================
882 
883  if (fT1d_StexStinFromIndex == nullptr) {
885  fCnew++;
886  }
887  for (Int_t i0_Stin = 0; i0_Stin < fEcal->MaxStinEcnaInStex(); i0_Stin++) {
889  }
890 
891  //------------------------------------------------------------- (GetReadyToReadData)
892 
893  //====================================================================================
894  //
895  // allocation of the 3D array fT3d_AdcValues[channel][sample][events] (ADC values)
896  //
897  // This array is filled in the GetSampleAdcValues(...) method
898  //
899  //====================================================================================
900 
901  if (fT3d_AdcValues == nullptr) {
902  //............ Allocation for the 3d array
903  std::cout << "*TEcnaRun::GetReadyToReadData(...)> Allocation of 3D array for ADC distributions."
904  << " Nb of requested evts = " << fFileHeader->fReqNbOfEvts << std::endl
905  << " This number must not be too large"
906  << " (no failure after this message means alloc OK)." << std::endl;
907 
908  fT3d_AdcValues = new Double_t**[fEcal->MaxCrysEcnaInStex()];
909  fCnew++;
910 
912  fCnew++;
913 
915  fCnew++;
916 
917  for (Int_t i0StexEcha = 0; i0StexEcha < fEcal->MaxCrysEcnaInStex(); i0StexEcha++) {
918  fT3d_AdcValues[i0StexEcha] = &fT3d2_AdcValues[0] + i0StexEcha * fNbSampForFic;
919  for (Int_t j0Sample = 0; j0Sample < fNbSampForFic; j0Sample++) {
920  fT3d2_AdcValues[fNbSampForFic * i0StexEcha + j0Sample] =
921  &fT3d1_AdcValues[0] + fFileHeader->fReqNbOfEvts * (fNbSampForFic * i0StexEcha + j0Sample);
922  }
923  }
924  }
925  //................................. Init to zero
926  for (Int_t iza = 0; iza < fEcal->MaxCrysEcnaInStex(); iza++) {
927  for (Int_t izb = 0; izb < fNbSampForFic; izb++) {
928  for (Int_t izc = 0; izc < fFileHeader->fReqNbOfEvts; izc++) {
929  if (fT3d_AdcValues[iza][izb][izc] != (Double_t)0) {
930  fMiscDiag[0]++;
931  fT3d_AdcValues[iza][izb][izc] = (Double_t)0;
932  }
933  }
934  }
935  }
936 
937  //--------------------------------------------------------- (GetReadyToReadData)
938  //====================================================================================
939  //
940  // allocation of the 2D array fT2d_NbOfEvts[channel][sample] (Max nb of evts)
941  //
942  //====================================================================================
943 
944  if (fT2d_NbOfEvts == nullptr) {
945  fT2d_NbOfEvts = new Int_t*[fEcal->MaxCrysEcnaInStex()];
946  fCnew++;
948  fCnew++;
949 
950  for (Int_t i0StexEcha = 0; i0StexEcha < fEcal->MaxCrysEcnaInStex(); i0StexEcha++) {
951  fT2d_NbOfEvts[i0StexEcha] = &fT1d_NbOfEvts[0] + i0StexEcha * fNbSampForFic;
952  }
953 
954  //................ Init the array to 0
955  for (Int_t i0StexEcha = 0; i0StexEcha < fEcal->MaxCrysEcnaInStex(); i0StexEcha++) {
956  for (Int_t i0Sample = 0; i0Sample < fNbSampForFic; i0Sample++) {
957  fT2d_NbOfEvts[i0StexEcha][i0Sample] = 0;
958  }
959  }
960  } else {
961  std::cerr << "!TEcnaRun::GetReadyToReadData(...)> *** ERROR *** No allocation for fT2d_NbOfEvts!"
962  << " Pointer already not NULL " << fTTBELL << std::endl;
963  // {Int_t cintoto; std::cout << "Enter: 0 and RETURN to continue or: CTRL C to exit"
964  // << std::endl; std::cin >> cintoto;}
965  }
966  } else {
967  std::cerr << std::endl
968  << "!TEcnaRun::GetReadyToReadData(...)> "
969  << " *** ERROR *** " << std::endl
970  << " --------------------------------------------------" << std::endl
971  << " NULL or NEGATIVE values for arguments" << std::endl
972  << " with expected positive values:" << std::endl
973  << " Number of Stins in Stex = " << fEcal->MaxStinEcnaInStex() << std::endl
974  << " Number of crystals in Stin = " << fEcal->MaxCrysInStin() << std::endl
975  << " Number of samples by channel = " << fNbSampForFic << std::endl
976  << std::endl
977  << std::endl
978  << " hence, no memory allocation for array member has been performed." << std::endl;
979 
980  std::cout << "Enter: 0 and RETURN to continue or: CTRL C to exit";
981  Int_t toto;
982  std::cin >> toto;
983  }
984  //----------------------------------------------------------- (GetReadyToReadData)
986  std::cout << std::endl;
987  std::cout << "*TEcnaRun::GetReadyToReadData(...)>" << std::endl
988  << " The method has been called with the following argument values:" << std::endl
989  << " Analysis name = " << fFileHeader->fTypAna << std::endl
990  << " Run number = " << fFileHeader->fRunNumber << std::endl
991  << " Run type = " << fFileHeader->fRunType << std::endl
992  << " First requested event number = " << fFileHeader->fFirstReqEvtNumber << std::endl
993  << " Last requested event number = " << fFileHeader->fLastReqEvtNumber << std::endl
994  << " " << fStexName.Data() << " number = " << fFileHeader->fStex
995  << std::endl
996  << " Number of " << fStinName.Data() << " in " << fStexName.Data() << " = "
997  << fEcal->MaxStinEcnaInStex() << std::endl
998  << " Number of crystals in " << fStinName.Data() << " = " << fEcal->MaxCrysInStin()
999  << std::endl
1000  << " Number of samples by channel = " << fNbSampForFic << std::endl
1001  << std::endl;
1002  }
1003 
1004  fReadyToReadData = 1; // set flag
1005  } else {
1007  std::cout << "!TEcnaRun::GetReadyToReadData(...) > WARNING/CORRECTION:" << std::endl
1008  << "! The fisrt requested event number is not positive (nfirst = " << nfirst << ") " << fTTBELL
1009  << std::endl;
1010  }
1011  }
1012  } else {
1014  std::cout << std::endl
1015  << "!TEcnaRun::GetReadyToReadData(...)> WARNING/CORRECTION:" << std::endl
1016  << "! The number of requested events (nbevts = " << nbevts << ") is too large." << std::endl
1017  << "! Last event number = " << nlast << " > number of entries = " << nentries << ". " << fTTBELL
1018  << std::endl
1019  << std::endl;
1020  }
1021  }
1022  } else {
1023  std::cout << "!TEcnaRun::GetReadyToReadData(...) *** ERROR ***> "
1024  << " The first requested event number is greater than the number of entries." << fTTBELL << std::endl;
1025  }
1027  std::cout << "*TEcnaRun::GetReadyToReadData(...)> Leaving the method. fReadyToReadData = " << fReadyToReadData
1028  << std::endl;
1029  }
1030 
1031 } // end of GetReadyToReadData
1032 
1033 //====================================================================================================
1034 //
1035 // GetSampleAdcValues: method called by the CMSSW analyzer (cmsRun)
1036 //
1037 // At each event, put the Sample ADC value in the 3D array: fT3d_AdcValues[i0StexEcha][i0Sample][i0EventIndex]
1038 //
1039 // |============================================================|
1040 // | |
1041 // | (Stex,Stin) means: (SM,tower) for EB and: (Dee,SC) for EE |
1042 // | |
1043 // |============================================================|
1044 //
1045 // (Stin number <-> Stin index correspondance, ADC sample values)
1046 //
1047 // THIS METHOD IS CALLED INSIDE THE LOOPS OVER:
1048 // ( EVENTS (tower or SC (CRYSTAL in tower or SC (SAMPLES))))
1049 //
1050 // Arguments: Event = event number. Range = [ 1, fFileHeader->fReqNbOfEvts ]
1051 // n1StexStin = Stin number in Stex. Range = [ 1, fEcal->MaxStinEcnaInStex() ]
1052 // i0StinEcha = channel number in Stin. Range = [ 0, fEcal->MaxCrysInStin() - 1 ]
1053 // sample = ADC sample number. Range = [ 0, fNbSampForFic - 1 ]
1054 // adcvalue = ADC sample value.
1055 //
1056 //====================================================================================================
1057 Bool_t TEcnaRun::GetSampleAdcValues(const Int_t& n1EventNumber,
1058  const Int_t& n1StexStin,
1059  const Int_t& i0StinEcha,
1060  const Int_t& i0Sample,
1061  const Double_t& adcvalue) {
1062  //Building of the arrays fT1d_StexStinFromIndex[] and fT3d_AdcValues[][][]
1063 
1064  fBuildEvtNotSkipped++; // event not skipped by cmsRun
1065 
1066  Bool_t ret_code = kFALSE;
1067 
1068  Int_t i0EventIndex = n1EventNumber - 1; // INDEX FOR Event number
1069  Int_t i0StexStinEcna = n1StexStin - 1; // INDEX FOR StexStin = Number_of_the_Stin_in_Stex - 1
1070 
1071  Int_t i_trouve = 0;
1072  //.................................................................. (GetSampleAdcValues)
1073  if (fReadyToReadData == 1) {
1074  if (n1StexStin >= 1 && n1StexStin <= fEcal->MaxStinEcnaInStex()) {
1075  if (i0StinEcha >= 0 && i0StinEcha < fEcal->MaxCrysInStin()) {
1076  if (i0Sample >= 0 && i0Sample < fEcal->MaxSampADC()) {
1077  //..... Put the StexStin number in 1D array fT1d_StexStinFromIndex[] = Stin index + 1
1078  if (fT1d_StexStinFromIndex != nullptr) // table fT1d_StexStinFromIndex[index] already allocated
1079  {
1080  ret_code = kTRUE;
1081 
1082  // StexStin already indexed
1083  if (n1StexStin == fT1d_StexStinFromIndex[i0StexStinEcna]) {
1084  i_trouve = 1;
1085  }
1086 
1087  // StexStin index not found: set index for new StexStin
1088  if (i_trouve != 1) {
1089  if (fT1d_StexStinFromIndex[i0StexStinEcna] == fSpecialStexStinNotIndexed) {
1090  fT1d_StexStinFromIndex[i0StexStinEcna] = n1StexStin;
1092  fTagStinNumbers[0] = 1;
1093  fStinIndexBuilt++; // number of found Stins
1094 
1096  if (fStinIndexBuilt == 1) {
1097  std::cout << std::endl
1098  << "*TEcnaRun::GetSampleAdcValues(...)> event " << n1EventNumber << " : first event for "
1099  << fStexName.Data() << " " << fFileHeader->fStex << "; " << fStinName.Data() << "s : ";
1100  }
1101  if (fFlagSubDet == "EB") {
1102  std::cout << fT1d_StexStinFromIndex[i0StexStinEcna] << ", ";
1103  }
1104  if (fFlagSubDet == "EE") {
1106  fT1d_StexStinFromIndex[i0StexStinEcna])
1107  << ", ";
1108  }
1109  }
1110  //.................................................... (GetSampleAdcValues)
1112  std::cout << " (" << fStinIndexBuilt << " " << fStinName.Data() << " found), channel " << i0StinEcha
1113  << ", i0Sample " << i0Sample << std::endl;
1114  }
1115  ret_code = kTRUE;
1116  } // if ( fT1d_StexStinFromIndex[i0StexStinEcna] == fSpecialStexStinNotIndexed )
1117  else {
1118  std::cout << "!TEcnaRun::GetSampleAdcValues(...)> *** ERROR ***> NOT ALLOWED if RESULT. "
1119  << " n1StexStin = " << n1StexStin << ", fT1d_StexStinFromIndex[" << i0StexStinEcna
1120  << "] = " << fT1d_StexStinFromIndex[i0StexStinEcna]
1121  << ", fStinIndexBuilt = " << fStinIndexBuilt << fTTBELL << std::endl;
1122  ret_code = kFALSE;
1123  }
1124  } // if (i_trouve != 1 )
1125 
1126  } // if( fT1d_StexStinFromIndex != 0 )
1127  else {
1128  std::cout << "!TEcnaRun, GetSampleAdcValues *** ERROR ***> "
1129  << " fT1d_StexStinFromIndex = " << fT1d_StexStinFromIndex
1130  << " fT1d_StexStinFromIndex[] ALLOCATION NOT DONE" << fTTBELL << std::endl;
1131  ret_code = kFALSE;
1132  } //.................................................................. (GetSampleAdcValues)
1133  } // end of if( i0Sample >= 0 && i0Sample < fNbSampForFic )
1134  else {
1135  //.......Reading data => Message and error only if sample >= fEcal->MaxSampADC()
1136  // (not fNbSampForFic, the later is used only for calculations)
1137  if (i0Sample >= fEcal->MaxSampADC()) {
1138  std::cout << "!TEcnaRun::GetSampleAdcValues(...) *** ERROR ***> "
1139  << " sample number = " << i0Sample << ". OUT OF BOUNDS"
1140  << " (max = " << fNbSampForFic << ")" << fTTBELL << std::endl;
1141  ret_code = kFALSE;
1142  } else {
1143  ret_code = kTRUE;
1144  }
1145  } // else of if( i0Sample >= 0 && i0Sample < fNbSampForFic )
1146  } // end of if( i0StinEcha >= 0 && i0StinEcha < fEcal->MaxCrysInStin() )
1147  else {
1148  std::cout << "!TEcnaRun::GetSampleAdcValues(...) *** ERROR ***> "
1149  << " channel number in " << fStinName.Data() << " = " << i0StinEcha << ". OUT OF BOUNDS"
1150  << " (max = " << fEcal->MaxCrysInStin() << ")" << fTTBELL << std::endl;
1151  ret_code = kFALSE;
1152  } // else of if( i0StinEcha >= 0 && i0StinEcha < fEcal->MaxCrysInStin() )
1153  } else {
1154  std::cout << "!TEcnaRun::GetSampleAdcValues(...) *** ERROR ***> " << fStinName.Data() << " number in "
1155  << fStexName.Data() << " = " << n1StexStin << ". OUT OF BOUNDS"
1156  << " (max = " << fEcal->MaxStinEcnaInStex() << ")" << fTTBELL << std::endl;
1157  ret_code = kFALSE;
1158  }
1159 
1160  //.................................................................. (GetSampleAdcValues)
1161  //........ Filling of the 2D array of the event numbers in the data reading loop and
1162  // filling of the 3D array of the ADC sample values
1163  //
1164  // ONLY if ret_code == kTRUE
1165 
1166  if (ret_code == kTRUE) {
1167  //............ 1) Conversion (Stin,i0StinEcha) -> i0StexEcha (same numbering for EB and EE)
1168  //==========================================================================================
1169  // n1StexStin (Tower or SC): 1 2 3
1170  // iStexStin 0 1 2
1171  //
1172  // i0StinEcha: 0......24 0......24 0......24
1173  //
1174  // i0StexEcha : 0......24 25......49 50......74 grouped by StexStin's
1175  // i0StexEcha+1 (Xtal): 1......25 26......50 51......75
1176  //
1177  //==========================================================================================
1178 
1179  Int_t i0StexEcha = i0StexStinEcna * fEcal->MaxCrysInStin() + i0StinEcha;
1180 
1181  //--------------------------------------------------------- (GetSampleAdcValues)
1182  if (i0StexEcha >= 0 && i0StexEcha < fEcal->MaxCrysEcnaInStex()) {
1183  //............ 2) Increase of the nb of evts for (StexEcha,sample) (events found in the data)
1184  (fT2d_NbOfEvts[i0StexEcha][i0Sample])++; // value after first incrementation = 1
1185  fTagNbOfEvts[0] = 1;
1187 
1188  //............ 3) Filling of the 3D array of the ADC values
1189  if (i0EventIndex >= 0 && i0EventIndex < fFileHeader->fReqNbOfEvts) {
1190  if (i0Sample >= 0 && i0Sample < fNbSampForFic) {
1191  fT3d_AdcValues[i0StexEcha][i0Sample][i0EventIndex] = adcvalue;
1192  } else {
1193  std::cout << "!TEcnaRun::GetSampleAdcValues(...) *** ERROR ***> "
1194  << " sample index = " << i0Sample << ". OUT OF BOUNDS"
1195  << " (max = " << fNbSampForFic << ")" << fTTBELL << std::endl;
1196  }
1197  } else {
1198  std::cout << "!TEcnaRun::GetSampleAdcValues(...) *** ERROR ***> "
1199  << " event number = " << n1EventNumber << ". OUT OF BOUNDS"
1200  << " (max = " << fFileHeader->fReqNbOfEvts << ")" << fTTBELL << std::endl;
1201  ret_code = kFALSE;
1202  }
1203  } else {
1204  std::cout << "!TEcnaRun::GetSampleAdcValues(...) *** ERROR ***> "
1205  << " CHANNEL NUMBER OUT OF BOUNDS" << std::endl
1206  << " i0StexEcha number = " << i0StexEcha << " , n1StexStin = " << n1StexStin
1207  << " , i0StinEcha = " << i0StinEcha
1208  << " , fEcal->MaxCrysEcnaInStex() = " << fEcal->MaxCrysEcnaInStex() << fTTBELL << std::endl;
1209  ret_code = kFALSE;
1210  // {Int_t cintoto; std::cout << "TAPER 0 POUR CONTINUER" << std::endl; cin >> cintoto;}
1211  }
1212  } // end of if( ret_code == kTRUE )
1213  else {
1214  std::cout << "!TEcnaRun::GetSampleAdcValues(...) *** ERROR ***> ret_code = kFALSE " << fTTBELL << std::endl;
1215  }
1216  } // end of if(fReadyToReadData == 1)
1217  else {
1218  std::cout << "!TEcnaRun::GetSampleAdcValues(...) *** ERROR ***> GetReadyToReadData(...) not called." << fTTBELL
1219  << std::endl;
1220  ret_code = kFALSE;
1221  }
1222  //.................................................................. (GetSampleAdcValues)
1223  if (ret_code == kFALSE) {
1224  std::cout << "!TEcnaRun::GetSampleAdcValues(...)> *** ERROR ***> ret_code = " << ret_code
1225  << " (FALSE). Event: " << n1EventNumber << ", " << fStexName.Data() << ": " << fFileHeader->fStex << ", "
1226  << fStinName.Data() << ": " << n1StexStin << ", channel: " << i0StinEcha << ", Sample: " << i0Sample
1227  << ", ADC value: " << adcvalue << std::endl;
1228  }
1229  return ret_code;
1230 }
1231 //------------- ( end of GetSampleAdcValues ) -----------------------
1232 //====================================================================================================
1233 //
1234 // ReadSampleAdcValues: Get the Sample ADC values from file by using TEcnaRead.
1235 //
1236 //====================================================================================================
1238 
1239 Bool_t TEcnaRun::ReadSampleAdcValues(const Int_t& nb_samp_for_calc) {
1240  // read the Sample ADC values from "ADC" result root files (ReadSampleAdcValues)
1241 
1242  // put the number of sample for calculations in attribute fNbSampForCalc
1243  // and call the method without arguments
1244  // We must have: nb_samp_for_calc <= fFileHeader->fNbOfSamples (= nb of samples in ROOT file)
1245 
1246  fNbSampForCalc = nb_samp_for_calc;
1247 
1248  // TEcnaRead* MyRootFile = new TEcnaRead(fFlagSubDet.Data(), fCnaParPaths, fCnaParCout,
1249  // fFileHeader, fEcalNumbering, fCnaWrite); // fCnew++;
1250 
1251  TEcnaRead* MyRootFile = new TEcnaRead(fObjectManager, fFlagSubDet.Data()); // fCnew++;
1252 
1253  MyRootFile->PrintNoComment();
1254 
1255  MyRootFile->FileParameters(fFileHeader->fTypAna,
1261  fFileHeader->fStex,
1262  fCnaParPaths->ResultsRootFilePath().Data());
1263 
1264  Bool_t ok_read = MyRootFile->LookAtRootFile();
1265 
1266  fFileHeader->fStartTime = MyRootFile->GetStartTime();
1267  fFileHeader->fStopTime = MyRootFile->GetStopTime();
1268  fFileHeader->fStartDate = MyRootFile->GetStartDate();
1269  fFileHeader->fStopDate = MyRootFile->GetStopDate();
1270 
1271  if (ok_read == kTRUE) {
1272  fRootFileName = MyRootFile->GetRootFileName();
1273  fRootFileNameShort = MyRootFile->GetRootFileNameShort();
1274  std::cout << "*TEcnaRun::ReadSampleAdcValues> Reading sample ADC values from file: " << std::endl
1275  << " " << fRootFileName << std::endl;
1276 
1277  size_t i_no_data = 0;
1278 
1279  //.......... Read the StinNumbers in the old file (ReadSampleAdcValues)
1280  TVectorD vec(fEcal->MaxStinEcnaInStex());
1281  for (Int_t i = 0; i < fEcal->MaxStinEcnaInStex(); i++) {
1282  vec(i) = (Double_t)0.;
1283  }
1284  vec = MyRootFile->ReadStinNumbers(fEcal->MaxStinEcnaInStex());
1285  if (MyRootFile->DataExist() == kTRUE) {
1286  fTagStinNumbers[0] = 1;
1288  for (Int_t i0StexStinEcna = 0; i0StexStinEcna < fEcal->MaxStinEcnaInStex(); i0StexStinEcna++) {
1289  fT1d_StexStinFromIndex[i0StexStinEcna] = (Int_t)vec(i0StexStinEcna);
1290  }
1291  } else {
1292  i_no_data++;
1293  }
1294  //.......... Read the Numbers of Events in the old file (ReadSampleAdcValues)
1295  TMatrixD partial_matrix(fEcal->MaxCrysInStin(), fFileHeader->fNbOfSamples);
1296  for (Int_t i = 0; i < fEcal->MaxCrysInStin(); i++) {
1297  for (Int_t j = 0; j < fFileHeader->fNbOfSamples; j++) {
1298  partial_matrix(i, j) = (Double_t)0.;
1299  }
1300  }
1301 
1302  for (Int_t i0StexStinEcna = 0; i0StexStinEcna < fEcal->MaxStinEcnaInStex(); i0StexStinEcna++) {
1303  Int_t n1StexStin = MyRootFile->GetStexStinFromIndex(i0StexStinEcna);
1304  if (n1StexStin != -1) {
1305  partial_matrix =
1307 
1308  if (MyRootFile->DataExist() == kTRUE) {
1309  fTagNbOfEvts[0] = 1;
1311  for (Int_t i0StinCrys = 0; i0StinCrys < fEcal->MaxCrysInStin(); i0StinCrys++) {
1312  Int_t i0StexEcha = (n1StexStin - 1) * fEcal->MaxCrysInStin() + i0StinCrys;
1313  for (Int_t i0Sample = 0; i0Sample < fFileHeader->fNbOfSamples; i0Sample++) {
1314  fT2d_NbOfEvts[i0StexEcha][i0Sample] = (Int_t)partial_matrix(i0StinCrys, i0Sample);
1315  }
1316  }
1317  } else {
1318  i_no_data++;
1319  }
1320  }
1321  }
1322 
1323  //.......... Read the Sample ADC values in the old file (ReadSampleAdcValues)
1324  Double_t*** fT3d_read_AdcValues = MyRootFile->ReadSampleAdcValuesSameFile(
1326 
1327  if (MyRootFile->DataExist() == kTRUE) {
1328  for (Int_t i0StexEcha = 0; i0StexEcha < fEcal->MaxCrysEcnaInStex(); i0StexEcha++) {
1329  for (Int_t i0Sample = 0; i0Sample < fFileHeader->fNbOfSamples; i0Sample++) {
1330  for (Int_t i_event = 0; i_event < fFileHeader->fReqNbOfEvts; i_event++) {
1331  fT3d_AdcValues[i0StexEcha][i0Sample][i_event] = fT3d_read_AdcValues[i0StexEcha][i0Sample][i_event];
1332  }
1333  }
1334  }
1335  } else {
1336  i_no_data++;
1337  }
1338  if (i_no_data) {
1339  std::cout << "!TEcnaRun::ReadSampleAdcValues(...)> *ERROR* =====> "
1340  << " Read failure. i_no_data = " << i_no_data << fTTBELL << std::endl;
1341  }
1342  } else {
1343  std::cout << "!TEcnaRun::ReadSampleAdcValues(...)> *ERROR* =====> "
1344  << " ROOT file not found" << fTTBELL << std::endl;
1345  }
1346  delete MyRootFile; // fCdelete++;
1347  return ok_read;
1348 }
1349 //------------- ( end of ReadSampleAdcValues ) -----------------------
1350 //-------------------------------------------------------------------------
1351 //
1352 // Get the ROOT file name (long and short)
1353 //
1354 //-------------------------------------------------------------------------
1357 
1358 //###################################################################################################
1359 //
1360 // THE FOLLOWING METHODS ARE CALLED AFTER THE LOOPS OVER EVENTS, STINS, CRYSTALS AND SAMPLES
1361 //
1362 //###################################################################################################
1363 //=========================================================================
1364 //
1365 // Set start time, stop time, StartDate, StopDate
1366 //
1367 //=========================================================================
1368 void TEcnaRun::StartStopTime(time_t t_startime, time_t t_stoptime) {
1369  // Put the start an stop time (if they exist) in fFileHeader class attributes.
1370 
1371  fFileHeader->fStartTime = t_startime;
1372  fFileHeader->fStopTime = t_stoptime;
1373 }
1374 
1375 void TEcnaRun::StartStopDate(const TString& c_startdate, const TString& c_stopdate) {
1376  // Put the start an stop date (if they exist) in fFileHeader class attributes.
1377 
1378  fFileHeader->fStartDate = c_startdate;
1379  fFileHeader->fStopDate = c_stopdate;
1380 }
1381 
1382 //=========================================================================
1383 //
1384 // GetReadyToCompute() (technical)
1385 //
1386 //=========================================================================
1388  //
1389  // MAKE THE RESULTS FILE NAME and
1390  // CHECK OF THE NUMBER OF FOUND EVENTS AND init fNumberOfEvents
1391  // (number used to compute the average values over the events)
1392  // The number of events fNumberOfEvents is extracted from the array fT2d_NbOfEvts[]
1393  // which has been filled by the GetSampleAdcValues(...) method
1394 
1395  //..................... Making of the Root File name that will be written
1402  fFileHeader->fStex);
1403 
1404  fCnaWrite->fMakeResultsFileName(); // set fRootFileName, fRootFileNameShort
1405 
1406  //..................... Checking numbers of found events channel by channel
1407  if (fT2d_NbOfEvts != nullptr) {
1410  } else {
1411  std::cout << "*TEcnaRun::GetReadyToCompute()> no data? fT2d_NbOfEvts = " << fT2d_NbOfEvts << std::endl;
1412  }
1413 }
1414 // end of GetReadyToCompute()
1415 
1416 //-------------------------------------------------------------------
1417 //
1418 // SampleValues() (technical)
1419 //
1420 // Written in .root file corresponding to analysis name
1421 // beginning with: "Adc" (see EcnaAnalyzer.cc in package "Modules")
1422 //
1423 //-------------------------------------------------------------------
1425  //3D histo of the sample ADC values for all the triples (StexEcha, sample, event)
1426 
1427  // The histo is already in fT3d_AdcValues[][][]
1428  // this method sets the "Tag", increment the "f...Calc" (and must be kept for that)
1429  // f...Calc > 0 => allow writing on file.
1430 
1431  if (fFileHeader->fAdcEvtCalc > 0) {
1432  fFileHeader->fAdcEvtCalc = 0;
1433  }
1434  for (Int_t i0StexEcha = 0; i0StexEcha < fEcal->MaxCrysEcnaInStex(); i0StexEcha++) {
1435  fTagAdcEvt[i0StexEcha] = 1;
1437  }
1438 }
1439 
1440 //=========================================================================
1441 //
1442 // C A L C U L A T I O N M E T H O D S
1443 //
1444 // fTag... = 1 => Calculation done. OK for writing on result file
1445 // ...Calc++ => Incrementation for result file size.
1446 //
1447 //=========================================================================
1449  SampleMeans();
1450  SampleSigmas();
1452 
1453  Pedestals(); // => mean over Xtal's
1454  TotalNoise();
1459 
1460  AveragePedestals(); // Average => mean over Stin's (Tower if EB, SC if EE)
1466 }
1467 
1469  // long time, big file
1470 
1473 }
1474 
1476  // long time, no big file
1477  // expert 1 is called (if not called before) without writing in file.
1478  // Results are used only in memory to compute expert2 calculations
1479 
1482 }
1483 //====================================================================
1484 //
1485 // E X P E C T A T I O N V A L U E S , V A R I A N C E S
1486 //
1487 //====================================================================
1488 //----------------------------------------------------------------
1489 // Calculation of the expectation values of the samples
1490 // for all the StexEchas
1491 //
1492 // SMean(c,s) = E_e[A(c,s,e*)]
1493 // A(c,s,e) : ADC value for channel c, sample s, event e
1494 // E_e : average over the events
1495 //----------------------------------------------------------------
1497  // Calculation of the expectation values over events
1498  // for the samples 0 to fNbSampForCalc and for all the StexEchas
1499 
1501  std::cout << "*TEcnaRun::SampleMeans() " << std::endl;
1502  }
1504  std::cout << " Calculation: sample expectation values over the events"
1505  << " for each channel." << std::endl;
1506  }
1507 
1508  //................... Allocation fT2d_ev
1509  if (fT2d_ev == nullptr) {
1510  Int_t n_samp = fNbSampForCalc;
1511  Int_t n_StexEcha = fEcal->MaxCrysEcnaInStex();
1512  fT2d_ev = new Double_t*[n_StexEcha];
1513  fCnew++;
1514  fT1d_ev = new Double_t[n_StexEcha * n_samp];
1515  fCnew++;
1516  for (Int_t i = 0; i < n_StexEcha; i++) {
1517  fT2d_ev[i] = &fT1d_ev[0] + i * n_samp;
1518  }
1519  }
1520  //................... init fT2d_ev to zero
1521  for (Int_t i0StexEcha = 0; i0StexEcha < fEcal->MaxCrysEcnaInStex(); i0StexEcha++) {
1522  for (Int_t i0Sample = 0; i0Sample < fNbSampForCalc; i0Sample++) {
1523  if (fT2d_ev[i0StexEcha][i0Sample] != (Double_t)0) {
1524  fMiscDiag[1]++;
1525  fT2d_ev[i0StexEcha][i0Sample] = (Double_t)0;
1526  }
1527  }
1528  }
1529 
1530  //................... Calculation
1531  for (Int_t i0StexEcha = 0; i0StexEcha < fEcal->MaxCrysEcnaInStex(); i0StexEcha++) {
1532  for (Int_t i0Sample = 0; i0Sample < fNbSampForCalc; i0Sample++) {
1533  for (Int_t i_event = 0; i_event < fNumberOfEvents; i_event++) {
1534  fT2d_ev[i0StexEcha][i0Sample] += fT3d_AdcValues[i0StexEcha][i0Sample][i_event];
1535  }
1536  fT2d_ev[i0StexEcha][i0Sample] /= fNumberOfEvents;
1537  }
1538  }
1539  fTagMSp[0] = 1;
1540  fFileHeader->fMSpCalc++;
1541 }
1542 
1543 //--------------------------------------------------------
1544 // Calculation of the sigmas of the samples
1545 // for all the StexEchas
1546 //
1547 // SSigma(c,s) = sqrt{ Cov_e[A(c,s,e*),A(c,s,e*)] }
1548 // A(c,s,e) : ADC value for channel c, sample s, event e
1549 // Cov_e : covariance over the events
1550 //--------------------------------------------------------
1552  //Calculation of the sigmas of the samples for all the StexEchas
1553 
1555  std::cout << "*TEcnaRun::SampleSigmas()" << std::endl;
1556  }
1558  std::cout << " Calculation: sample ADC sigmas over the events "
1559  << " for each channel." << std::endl;
1560  }
1561 
1562  //... preliminary calculation of the expectation values if not done yet.
1563  // The tag is set to 1 after call to the method. It is reset to 0
1564  // because the expectation values must not be written in the result ROOT file
1565  // (since the tag was equal to 0)
1566  if (fTagMSp[0] != 1) {
1567  SampleMeans();
1568  fTagMSp[0] = 0;
1569  }
1570 
1571  //................... Allocation fT2d_sig
1572  if (fT2d_sig == nullptr) {
1573  Int_t n_StexEcha = fEcal->MaxCrysEcnaInStex();
1574  Int_t n_samp = fNbSampForCalc;
1575  fT2d_sig = new Double_t*[n_StexEcha];
1576  fCnew++;
1577  fT1d_sig = new Double_t[n_StexEcha * n_samp];
1578  fCnew++;
1579  for (Int_t i0StexEcha = 0; i0StexEcha < n_StexEcha; i0StexEcha++) {
1580  fT2d_sig[i0StexEcha] = &fT1d_sig[0] + i0StexEcha * n_samp;
1581  }
1582  }
1583  // ................... init fT2d_sig to zero
1584  for (Int_t i0StexEcha = 0; i0StexEcha < fEcal->MaxCrysEcnaInStex(); i0StexEcha++) {
1585  for (Int_t i0Sample = 0; i0Sample < fNbSampForCalc; i0Sample++) {
1586  if (fT2d_sig[i0StexEcha][i0Sample] != (Double_t)0) {
1587  fMiscDiag[2]++;
1588  fT2d_sig[i0StexEcha][i0Sample] = (Double_t)0;
1589  }
1590  }
1591  }
1592 
1593  //................... Calculation
1594  for (Int_t i0StexEcha = 0; i0StexEcha < fEcal->MaxCrysEcnaInStex(); i0StexEcha++) {
1595  for (Int_t i0Sample = 0; i0Sample < fNbSampForCalc; i0Sample++) {
1596  Double_t variance = (Double_t)0.;
1597  for (Int_t i_event = 0; i_event < fNumberOfEvents; i_event++) {
1598  Double_t ecart = fT3d_AdcValues[i0StexEcha][i0Sample][i_event] - fT2d_ev[i0StexEcha][i0Sample];
1599  variance += ecart * ecart;
1600  }
1601  variance /= fNumberOfEvents;
1602  fT2d_sig[i0StexEcha][i0Sample] = sqrt(variance);
1603  }
1604  }
1605  fTagSSp[0] = 1;
1606  fFileHeader->fSSpCalc++;
1607 }
1608 
1609 //====================================================================
1610 //
1611 // C O V A R I A N C E S & C O R R E L A T I O N S
1612 //
1613 // B E T W E E N S A M P L E S
1614 //
1615 //====================================================================
1616 //-----------------------------------------------------------
1617 // Calculation of the covariances between samples
1618 // for all the StexEchas
1619 // Cov(c;s,s') = Cov_e[ A(c,s,e*) , A(c,s',e*) ]
1620 // = E_e[ ( A(c,s,e*) - E_e[A(c,s,e*)] )*
1621 // ( A(c,s',e*) - E_e[A(c,s',e*)] ) ]
1622 // A(c,s,e) : ADC value for channel c, sample s, event e
1623 // E_e , Cov_e : average, covariance over the events
1624 //-----------------------------------------------------------
1626  //Calculation of the covariances between samples for all the StexEchas
1627 
1629  std::cout << "*TEcnaRun::CovariancesBetweenSamples()" << std::endl;
1630  }
1632  std::cout << " Calculation: covariances between samples"
1633  << " for each channel." << std::endl;
1634  }
1635 
1636  //................... Allocations cov_ss
1637  if (fT3d_cov_ss == nullptr) {
1638  const Int_t n_samp = fNbSampForCalc;
1639  const Int_t n_StexEcha = fEcal->MaxCrysEcnaInStex();
1640  fT3d_cov_ss = new Double_t**[n_StexEcha];
1641  fCnew++;
1642  fT3d2_cov_ss = new Double_t*[n_StexEcha * n_samp];
1643  fCnew++;
1644  fT3d1_cov_ss = new Double_t[n_StexEcha * n_samp * n_samp];
1645  fCnew++;
1646  for (Int_t i = 0; i < n_StexEcha; i++) {
1647  fT3d_cov_ss[i] = &fT3d2_cov_ss[0] + i * n_samp;
1648  for (Int_t j = 0; j < n_samp; j++) {
1649  fT3d2_cov_ss[n_samp * i + j] = &fT3d1_cov_ss[0] + n_samp * (n_samp * i + j);
1650  }
1651  }
1652  }
1653 
1654  //.................. Calculation (= init)
1655  //.................. computation of half of the matrix, diagonal included)
1656 
1657  //... preliminary calculation of the expectation values if not done yet.
1658  // The tag is set to 1 after call to the method. It is reset to 0
1659  // because the expectation values must not be written in the result ROOT file
1660  // (since the tag was equal to 0)
1661  // Results in array fT2d_ev[j0StexEcha][i0Sample]
1662  if (fTagMSp[0] != 1) {
1663  SampleMeans();
1664  fTagMSp[0] = 0;
1665  }
1666 
1667  for (Int_t j0StexEcha = 0; j0StexEcha < fEcal->MaxCrysEcnaInStex(); j0StexEcha++) {
1668  for (Int_t i0Sample = 0; i0Sample < fNbSampForCalc; i0Sample++) {
1669  for (Int_t j0Sample = 0; j0Sample <= i0Sample; j0Sample++) {
1670  fT3d_cov_ss[j0StexEcha][i0Sample][j0Sample] = (Double_t)0;
1671  for (Int_t i_event = 0; i_event < fNumberOfEvents; i_event++) {
1672  fT3d_cov_ss[j0StexEcha][i0Sample][j0Sample] +=
1673  (fT3d_AdcValues[j0StexEcha][i0Sample][i_event] - fT2d_ev[j0StexEcha][i0Sample]) *
1674  (fT3d_AdcValues[j0StexEcha][j0Sample][i_event] - fT2d_ev[j0StexEcha][j0Sample]);
1675  }
1676  fT3d_cov_ss[j0StexEcha][i0Sample][j0Sample] /= (Double_t)fNumberOfEvents;
1677  fT3d_cov_ss[j0StexEcha][j0Sample][i0Sample] = fT3d_cov_ss[j0StexEcha][i0Sample][j0Sample];
1678  }
1679  }
1680  fTagCovCss[j0StexEcha] = 1;
1682  }
1683 }
1684 
1685 //-----------------------------------------------------------
1686 //
1687 // Calculation of the correlations between samples
1688 // for all the StexEchas
1689 // Cor(c;s,s') = Cov(c;s,s')/sqrt{ Cov(c;s,s)*Cov(c;s',s') }
1690 //-----------------------------------------------------------
1692  //Calculation of the correlations between samples for all the StexEchas
1693 
1694  //... preliminary calculation of the covariances if not done yet.
1695  // Test only the first tag since the cov are computed globaly
1696  // but set all the tags to 0 because we don't want to write
1697  // the covariances in the result ROOT file
1698  if (fTagCovCss[0] != 1) {
1700  for (Int_t j0StexEcha = 0; j0StexEcha < fEcal->MaxCrysEcnaInStex(); j0StexEcha++) {
1701  fTagCovCss[j0StexEcha] = 0;
1702  }
1703  }
1704 
1706  std::cout << "*TEcnaRun::CorrelationsBetweenSamples()" << std::endl;
1707  }
1709  std::cout << " Calculation: correlations between samples"
1710  << " for each channel." << std::endl;
1711  }
1712 
1713  //................... Allocations cor_ss
1714  if (fT3d_cor_ss == nullptr) {
1715  const Int_t n_samp = fNbSampForCalc;
1716  const Int_t n_StexEcha = fEcal->MaxCrysEcnaInStex();
1717  fT3d_cor_ss = new Double_t**[n_StexEcha];
1718  fCnew++;
1719  fT3d2_cor_ss = new Double_t*[n_StexEcha * n_samp];
1720  fCnew++;
1721  fT3d1_cor_ss = new Double_t[n_StexEcha * n_samp * n_samp];
1722  fCnew++;
1723  for (Int_t i = 0; i < n_StexEcha; i++) {
1724  fT3d_cor_ss[i] = &fT3d2_cor_ss[0] + i * n_samp;
1725  for (Int_t j = 0; j < n_samp; j++) {
1726  fT3d2_cor_ss[n_samp * i + j] = &fT3d1_cor_ss[0] + n_samp * (n_samp * i + j);
1727  }
1728  }
1729  }
1730 
1731  //..................... calculation of the correlations (=init)
1732  //......................computation of half of the matrix, diagonal included (verif = 1)
1733 
1734  for (Int_t j0StexEcha = 0; j0StexEcha < fEcal->MaxCrysEcnaInStex(); j0StexEcha++) {
1735  for (Int_t i0Sample = 0; i0Sample < fNbSampForCalc; i0Sample++) {
1736  for (Int_t j0Sample = 0; j0Sample <= i0Sample; j0Sample++) {
1737  if ((fT3d_cov_ss[j0StexEcha][i0Sample][i0Sample] > 0) && (fT3d_cov_ss[j0StexEcha][j0Sample][j0Sample] > 0)) {
1738  fT3d_cor_ss[j0StexEcha][i0Sample][j0Sample] =
1739  fT3d_cov_ss[j0StexEcha][i0Sample][j0Sample] /
1740  (sqrt(fT3d_cov_ss[j0StexEcha][i0Sample][i0Sample]) * sqrt(fT3d_cov_ss[j0StexEcha][j0Sample][j0Sample]));
1741  } else {
1742  (fT3d_cor_ss)[j0StexEcha][i0Sample][j0Sample] = (Double_t)0; // prevoir compteur + fTTBELL
1743  }
1744  fT3d_cor_ss[j0StexEcha][j0Sample][i0Sample] = fT3d_cor_ss[j0StexEcha][i0Sample][j0Sample];
1745  }
1746  }
1747  fTagCorCss[j0StexEcha] = 1;
1749  }
1750 }
1751 
1752 //===========================================================================
1753 //
1754 // M E A N P E D E S T A L S , T O T A L N O I S E ,
1755 // L O W F R E Q U E N C Y N O I S E ,
1756 // H I G H F R E Q U E N C Y N O I S E
1757 // M E A N O F C O R ( S , S ), S I G M A O F C O R ( S , S )
1758 //
1759 //===========================================================================
1760 //-------------------------------------------------------------------------
1761 //
1762 // Calculation of the Pedestals for each channel in Stex
1763 // tag: Ped
1764 // Pedestal(c ) = E_e[ E_s[A(c ,s*,e*)] ]
1765 // A(c,s,e) : ADC value for channel c, sample s, event e
1766 // E_e : average over the events
1767 // E_s : average over the samples
1768 //
1769 //-------------------------------------------------------------------------
1771  // Calculation, for each channel, of the expectation values
1772  // (over the samples 0 to fNbSampForCalc-1) of the ADC expectation values
1773  // (over the events)
1774 
1775  //... preliminary calculation of the expectation values if not done yet
1776  if (fTagMSp[0] != 1) {
1777  SampleMeans();
1778  fTagMSp[0] = 0;
1779  }
1780 
1781  //................... Allocation ev_ev + init to zero (mandatory)
1782  if (fT1d_ev_ev == nullptr) {
1783  fT1d_ev_ev = new Double_t[fEcal->MaxCrysEcnaInStex()];
1784  fCnew++;
1785  }
1786  for (Int_t i0StexEcha = 0; i0StexEcha < fEcal->MaxCrysEcnaInStex(); i0StexEcha++) {
1787  if (fT1d_ev_ev[i0StexEcha] != (Double_t)0) {
1788  fMiscDiag[11]++;
1789  fT1d_ev_ev[i0StexEcha] = (Double_t)0;
1790  }
1791  }
1792 
1793  //..................... Calculation
1795  std::cout << "*TEcnaRun::Pedestals()" << std::endl;
1796  }
1798  std::cout << " Calculation, for all the channels, of the expectation values (over the samples 1 to "
1799  << fNbSampForCalc << ")" << std::endl
1800  << " of the ADC expectation values (over the events)." << std::endl;
1801  }
1802 
1803  for (Int_t i0StexEcha = 0; i0StexEcha < fEcal->MaxCrysEcnaInStex(); i0StexEcha++) {
1804  for (Int_t i0Sample = 0; i0Sample < fNbSampForCalc; i0Sample++) {
1805  fT1d_ev_ev[i0StexEcha] += fT2d_ev[i0StexEcha][i0Sample];
1806  }
1807  fT1d_ev_ev[i0StexEcha] /= fNbSampForCalc;
1808  }
1809  fTagPed[0] = 1;
1810  fFileHeader->fPedCalc++;
1811 }
1812 //------------------------ (end of Pedestals) ----------------------------
1813 
1814 //------------------------------------------------------------------------------
1815 //
1816 // Calculation of the TN (Total Noise)
1817 // tag: Tno
1818 //
1819 // TotalNoise(c) = E_s[ sqrt{ E_e[ ( A(c ,s*,e*) - E_e[A(c ,s*,e*)] )^2 ] } ]
1820 // A(c,s,e) : ADC value for channel c, sample s, event e
1821 // E_e : average over the events
1822 // E_s : average over the samples
1823 //
1824 //------------------------------------------------------------------------------
1826  // Calculation, for each channel, of the expectation values
1827  // (over the samples 0 to fNbSampForCalc-1) of the sigmas
1828  // (over the events)
1829 
1830  //... preliminary calculation of the sigmas if not done yet
1831  if (fTagSSp[0] != 1) {
1832  SampleSigmas();
1833  fTagSSp[0] = 0;
1834  }
1835 
1836  //................... Allocation ev_ev + init to zero (mandatory)
1837  if (fT1d_evsamp_of_sigevt == nullptr) {
1838  fT1d_evsamp_of_sigevt = new Double_t[fEcal->MaxCrysEcnaInStex()];
1839  fCnew++;
1840  }
1841  for (Int_t i0StexEcha = 0; i0StexEcha < fEcal->MaxCrysEcnaInStex(); i0StexEcha++) {
1842  if (fT1d_evsamp_of_sigevt[i0StexEcha] != (Double_t)0) {
1843  fMiscDiag[12]++;
1844  fT1d_evsamp_of_sigevt[i0StexEcha] = (Double_t)0;
1845  }
1846  }
1847 
1848  //..................... Calculation
1850  std::cout << "*TEcnaRun::TotalNoise()" << std::endl;
1851  }
1853  std::cout << " Calculation, for all the channels, of the expectation values (over the samples 1 to "
1854  << fNbSampForCalc << ")" << std::endl
1855  << " of the ADC expectation values (over the events)." << std::endl;
1856  }
1857 
1858  for (Int_t i0StexEcha = 0; i0StexEcha < fEcal->MaxCrysEcnaInStex(); i0StexEcha++) {
1859  for (Int_t i0Sample = 0; i0Sample < fNbSampForCalc; i0Sample++) {
1860  if (fT2d_sig[i0StexEcha][i0Sample] < 0) {
1861  std::cout << "!TEcnaRun::TotalNoise() *** ERROR ***> Negative sigma!" << fTTBELL << std::endl;
1862  } else {
1863  fT1d_evsamp_of_sigevt[i0StexEcha] += fT2d_sig[i0StexEcha][i0Sample];
1864  }
1865  }
1866  fT1d_evsamp_of_sigevt[i0StexEcha] /= fNbSampForCalc;
1867  }
1868  fTagTno[0] = 1;
1869  fFileHeader->fTnoCalc++;
1870 }
1871 //------------------------ (end of TotalNoise) ----------------------------
1872 
1873 //---------------------------------------------------------------------------------
1874 //
1875 // Calculation of the LFN (Low Frequency Noise)
1876 // tag: Lfn
1877 //
1878 // LowFqNoise(c) = sqrt{ E_e[ ( E_s[A(c ,s*,e*)] - E_e[ E_s[A(c ,s*,e*)] ] )^2 ] }
1879 // A(c,s,e) : ADC value for channel c, sample s, event e
1880 // E_e : average over the events
1881 // E_s : average over the samples
1882 //
1883 //---------------------------------------------------------------------------------
1885  // Calculation, for each channel, of the sigma (over the events)
1886  // of the ADC expectation values (over the samples 0 to fNbSampForCalc-1)
1887 
1888  //................... Allocation fT1d_sigevt_of_evsamp + init to zero (mandatory)
1889  if (fT1d_sigevt_of_evsamp == nullptr) {
1890  fT1d_sigevt_of_evsamp = new Double_t[fEcal->MaxCrysEcnaInStex()];
1891  fCnew++;
1892  }
1893  for (Int_t i0StexEcha = 0; i0StexEcha < fEcal->MaxCrysEcnaInStex(); i0StexEcha++) {
1894  if (fT1d_sigevt_of_evsamp[i0StexEcha] != (Double_t)0) {
1895  fMiscDiag[13]++;
1896  fT1d_sigevt_of_evsamp[i0StexEcha] = (Double_t)0;
1897  }
1898  }
1899 
1900  //................... Allocation mean_over_samples
1901  TVectorD mean_over_samples(fNumberOfEvents);
1902  for (Int_t i = 0; i < fNumberOfEvents; i++) {
1903  mean_over_samples(i) = (Double_t)0.;
1904  }
1905 
1906  //..................... Calculation
1908  std::cout << "*TEcnaRun::LowFrequencyNoise()" << std::endl;
1909  }
1911  std::cout << " Calculation, for each channel, of the sigma (over the events)" << std::endl
1912  << " of the ADC expectation values (over the samples 1 to " << fNbSampForCalc << ")."
1913  << std::endl;
1914  }
1915 
1916  for (Int_t i0StexEcha = 0; i0StexEcha < fEcal->MaxCrysEcnaInStex(); i0StexEcha++) {
1917  // Calculation of the mean over the events of the mean over the samples
1918  Double_t mean_over_events = (Double_t)0;
1919  for (Int_t n_event = 0; n_event < fNumberOfEvents; n_event++) {
1920  // Calculation, for each event, of the mean over the samples
1921  mean_over_samples(n_event) = (Double_t)0.;
1922  for (Int_t i0Sample = 0; i0Sample < fNbSampForCalc; i0Sample++) {
1923  mean_over_samples(n_event) += fT3d_AdcValues[i0StexEcha][i0Sample][n_event];
1924  }
1925  mean_over_samples(n_event) /= (Double_t)fNbSampForCalc;
1926 
1927  mean_over_events += mean_over_samples(n_event);
1928  }
1929  mean_over_events /= (Double_t)fNumberOfEvents;
1930 
1931  // Calculation of the sigma over the events of the mean over the samples
1932  Double_t var = (Double_t)0;
1933  for (Int_t n_event = 0; n_event < fNumberOfEvents; n_event++) {
1934  Double_t ecart = mean_over_samples(n_event) - mean_over_events;
1935  var += ecart * ecart;
1936  }
1937  var /= (Double_t)fNumberOfEvents;
1938 
1939  fT1d_sigevt_of_evsamp[i0StexEcha] = sqrt(var);
1940  }
1941  fTagLfn[0] = 1;
1942  fFileHeader->fLfnCalc++;
1943 }
1944 //------------------------ (end of LowFrequencyNoise) ----------------------------
1945 
1946 //---------------------------------------------------------------------------------
1947 //
1948 // Calculation of the HFN (High Frequency Noise)
1949 // tag: Hfn
1950 //
1951 // HighFqNoise(c) = E_e[ sqrt{ E_s[ (A(c ,s*,e*) - E_s[A(c ,s*,e*)] )^2 ] } ]
1952 // A(c,s,e) : ADC value for channel c, sample s, event e
1953 // E_e : average over the events
1954 // E_s : average over the samples
1955 //
1956 //---------------------------------------------------------------------------------
1958  // Calculation, for each channel, of the mean (over the events)
1959  // of the ADC sigmas (over the samples 0 to fNbSampForCalc-1)
1960 
1961  //................... Allocation fT1d_evevt_of_sigsamp + init to zero (mandatory)
1962  if (fT1d_evevt_of_sigsamp == nullptr) {
1963  fT1d_evevt_of_sigsamp = new Double_t[fEcal->MaxCrysEcnaInStex()];
1964  fCnew++;
1965  }
1966  for (Int_t i0StexEcha = 0; i0StexEcha < fEcal->MaxCrysEcnaInStex(); i0StexEcha++) {
1967  if (fT1d_evevt_of_sigsamp[i0StexEcha] != (Double_t)0) {
1968  fMiscDiag[14]++;
1969  fT1d_evevt_of_sigsamp[i0StexEcha] = (Double_t)0;
1970  }
1971  }
1972 
1973  //................... Allocations mean_over_samples, sigma_over_sample
1974  TVectorD mean_over_samples(fNumberOfEvents);
1975  for (Int_t i = 0; i < fNumberOfEvents; i++) {
1976  mean_over_samples(i) = (Double_t)0.;
1977  }
1978  TVectorD sigma_over_samples(fNumberOfEvents);
1979  for (Int_t i = 0; i < fNumberOfEvents; i++) {
1980  sigma_over_samples(i) = (Double_t)0.;
1981  }
1982 
1983  //..................... Calculation
1985  std::cout << "*TEcnaRun::HighFrequencyNoise()" << std::endl;
1986  }
1988  std::cout << " Calculation, for each channel, of the sigma (over the events)" << std::endl
1989  << " of the ADC expectation values (over the samples 1 to " << fNbSampForCalc << ")."
1990  << std::endl;
1991  }
1992 
1993  for (Int_t i0StexEcha = 0; i0StexEcha < fEcal->MaxCrysEcnaInStex(); i0StexEcha++) {
1994  //..................... Calculation of the sigma over samples
1995  for (Int_t n_event = 0; n_event < fNumberOfEvents; n_event++) {
1996  // Calculation, for each event, of the mean over the samples
1997  mean_over_samples(n_event) = (Double_t)0.;
1998  for (Int_t i0Sample = 0; i0Sample < fNbSampForCalc; i0Sample++) {
1999  mean_over_samples(n_event) += fT3d_AdcValues[i0StexEcha][i0Sample][n_event];
2000  }
2001  mean_over_samples(n_event) /= (Double_t)fNbSampForCalc;
2002 
2003  // Calculation, for each event, of the sigma over the samples
2004  Double_t var_over_samples = (Double_t)0;
2005  for (Int_t i0Sample = 0; i0Sample < fNbSampForCalc; i0Sample++) {
2006  Double_t deviation = fT3d_AdcValues[i0StexEcha][i0Sample][n_event] - mean_over_samples(n_event);
2007  var_over_samples += deviation * deviation;
2008  }
2009  var_over_samples /= (Double_t)fNbSampForCalc;
2010 
2011  if (var_over_samples < 0) {
2012  std::cout << "!TEcnaRun::HighFrequencyNoise() *** ERROR ***> Negative variance! " << fTTBELL << std::endl;
2013  } else {
2014  sigma_over_samples(n_event) = sqrt(var_over_samples);
2015  }
2016  }
2017 
2018  //....... Calculation of the mean over the events of the sigma over samples
2019  for (Int_t n_event = 0; n_event < fNumberOfEvents; n_event++) {
2020  fT1d_evevt_of_sigsamp[i0StexEcha] += sigma_over_samples(n_event);
2021  }
2022 
2023  fT1d_evevt_of_sigsamp[i0StexEcha] /= (Double_t)fNumberOfEvents;
2024  }
2025  fTagHfn[0] = 1;
2026  fFileHeader->fHfnCalc++;
2027 }
2028 //------------------------ (end of HighFrequencyNoise) ----------------------------
2029 
2030 //-------------------------------------------------------------------------
2031 //
2032 // Calculation of the expectation values of (sample,sample)
2033 // correlations for all the channels (mean cor(s,s))
2034 // tag: MeanCorss
2035 //
2036 // MeanCorss(c) = E_s,s'[ Cor(c;s,s') ]
2037 // E_s,s': average over couples of samples (half correlation matrix)
2038 //
2039 //-------------------------------------------------------------------------
2041  // Calculation, for all the channels, of the expectation values
2042  // of the correlations between the first fNbSampForCalc samples
2043 
2044  //... preliminary calculation of the correlations if not done yet
2045  // (test only the first element since the cor are computed globaly)
2046  if (fTagCorCss[0] != 1) {
2048  fTagCorCss[0] = 0;
2049  }
2050 
2051  //................... Allocations ev_cor_ss + init to zero (mandatory)
2052  if (fT1d_ev_cor_ss == nullptr) {
2053  Int_t n_StexEcha = fEcal->MaxCrysEcnaInStex();
2054  fT1d_ev_cor_ss = new Double_t[n_StexEcha];
2055  fCnew++;
2056  }
2057  for (Int_t i0StexEcha = 0; i0StexEcha < fEcal->MaxCrysEcnaInStex(); i0StexEcha++) {
2058  if (fT1d_ev_cor_ss[i0StexEcha] != (Double_t)0) {
2059  fMiscDiag[15]++;
2060  fT1d_ev_cor_ss[i0StexEcha] = (Double_t)0;
2061  }
2062  }
2063 
2064  //.......... 1D array half_cor_ss[N(N-1)/2] to put the N (sample,sample) correlations
2065  // ( half of (them minus the diagonal) )
2066  Int_t ndim = (Int_t)(fNbSampForCalc * (fNbSampForCalc - 1) / 2);
2067 
2068  TVectorD half_cor_ss(ndim);
2069  for (Int_t i = 0; i < ndim; i++) {
2070  half_cor_ss(i) = (Double_t)0.;
2071  }
2072 
2073  //..................... Calculation
2075  std::cout << "*TEcnaRun::MeanCorrelationsBetweenSamples()" << std::endl;
2076  }
2078  std::cout << " Calculation, for all the channels, of the expectation values of the" << std::endl
2079  << " correlations between the first " << fNbSampForCalc << " samples." << std::endl;
2080  }
2081 
2082  for (Int_t i0StexEcha = 0; i0StexEcha < fEcal->MaxCrysEcnaInStex(); i0StexEcha++) {
2083  //..................... half_cor_ss() array filling
2084  Int_t i_count = 0;
2085  for (Int_t i0Sample = 0; i0Sample < fNbSampForCalc; i0Sample++) {
2086  for (Int_t j0Sample = 0; j0Sample < i0Sample; j0Sample++) {
2087  half_cor_ss(i_count) = fT3d_cor_ss[i0StexEcha][i0Sample][j0Sample];
2088  i_count++;
2089  }
2090  }
2091  //...................... mean cor(s,s') calculation
2092  fT1d_ev_cor_ss[i0StexEcha] = (Double_t)0;
2093  for (Int_t i_rcor = 0; i_rcor < ndim; i_rcor++) {
2094  fT1d_ev_cor_ss[i0StexEcha] += half_cor_ss(i_rcor);
2095  }
2096  fT1d_ev_cor_ss[i0StexEcha] /= (Double_t)ndim;
2097  }
2098  fTagMeanCorss[0] = 1;
2100 }
2101 //--------------- (end of MeanCorrelationsBetweenSamples) -----------
2102 
2103 //-------------------------------------------------------------------------
2104 //
2105 // Calculation of the sigmas of the (sample,sample) correlations
2106 // for all the channels (sigma of cor(s,s))
2107 // tag: SigCorss
2108 //
2109 // SigmaCorss(c) = E_s,s'[ Cor(c;s,s') - E_s,s'[ Cor(c;s,s') ] ]
2110 // E_s,s': average over couples of samples (half correlation matrix)
2111 //
2112 //--------------------------------------------------------------------------
2114  //Calculation of the sigmas of the (sample,sample) correlations for all the StexEchas
2115 
2116  //... preliminary calculation of the mean cor(s,s') if not done yet
2117  // (test only the first element since the cor are computed globaly)
2118  // Results available in array fT1d_ev_cor_ss[i0StexEcha]
2119  if (fTagMeanCorss[0] != 1) {
2121  fTagMeanCorss[0] = 0;
2122  }
2123 
2124  //................... Allocations sig_cor_ss + init to zero
2125  if (fT1d_sig_cor_ss == nullptr) {
2126  Int_t n_StexEcha = fEcal->MaxCrysEcnaInStex();
2127  fT1d_sig_cor_ss = new Double_t[n_StexEcha];
2128  fCnew++;
2129  }
2130  for (Int_t i0StexEcha = 0; i0StexEcha < fEcal->MaxCrysEcnaInStex(); i0StexEcha++) {
2131  if (fT1d_sig_cor_ss[i0StexEcha] != (Double_t)0) {
2132  fMiscDiag[16]++;
2133  fT1d_sig_cor_ss[i0StexEcha] = (Double_t)0;
2134  }
2135  }
2136 
2138  std::cout << "*TEcnaRun::SigmasOfCorrelationsBetweenSamples()" << std::endl;
2139  }
2141  std::cout << " Calculation of the sigmas of the (sample,sample)" << std::endl
2142  << " correlations for all the channels." << std::endl;
2143  }
2144 
2145  //.......... 1D array half_cor_ss[N(N-1)/2] to put the N (sample,sample) correlations
2146  // (half of them minus the diagonal)
2147  Int_t ndim = (Int_t)(fNbSampForCalc * (fNbSampForCalc - 1) / 2);
2148 
2149  TVectorD half_cor_ss(ndim);
2150  for (Int_t i = 0; i < ndim; i++) {
2151  half_cor_ss(i) = (Double_t)0.;
2152  }
2153 
2154  //.................. Calculation
2155  for (Int_t i0StexEcha = 0; i0StexEcha < fEcal->MaxCrysEcnaInStex(); i0StexEcha++) {
2156  //..................... half_cor_ss() array filling
2157  Int_t i_count = 0;
2158  for (Int_t i0Sample = 0; i0Sample < fNbSampForCalc; i0Sample++) {
2159  for (Int_t j0Sample = 0; j0Sample < i0Sample; j0Sample++) {
2160  half_cor_ss(i_count) = fT3d_cor_ss[i0StexEcha][i0Sample][j0Sample];
2161  i_count++;
2162  }
2163  }
2164 
2165  //...................... sigma of cor(s,s') calculation
2166  Double_t var = (Double_t)0;
2167  for (Int_t i_rcor = 0; i_rcor < ndim; i_rcor++) {
2168  Double_t ecart = half_cor_ss(i_rcor) - fT1d_ev_cor_ss[i0StexEcha];
2169  var += ecart * ecart;
2170  }
2171  var /= (Double_t)ndim;
2172  fT1d_sig_cor_ss[i0StexEcha] = sqrt(var);
2173  }
2174  fTagSigCorss[0] = 1;
2176 }
2177 //--------------- (end of SigmaOfCorrelationsBetweenSamples) -----------
2178 
2179 //-----------------------------------------------------------------------------
2180 //
2181 // Calculation of the average Pedestals for each Stin in Stex
2182 // tag: AvPed
2183 //
2184 //-----------------------------------------------------------------------------
2186  // Calculation of the average
2187  // (over the Stin's 0 to fEcal->MaxStinInStex()) of the Pedestals
2188 
2189  //... preliminary calculation of the Pedestals if not done yet
2190  if (fTagPed[0] != 1) {
2191  Pedestals();
2192  fTagPed[0] = 0;
2193  }
2194  //................... Allocation av_mped + init to zero (mandatory)
2195  if (fT1d_av_mped == nullptr) {
2196  fT1d_av_mped = new Double_t[fEcal->MaxStinEcnaInStex()];
2197  fCnew++;
2198  }
2199  for (Int_t i0StexStinEcna = 0; i0StexStinEcna < fEcal->MaxStinEcnaInStex(); i0StexStinEcna++) {
2200  if (fT1d_av_mped[i0StexStinEcna] != (Double_t)0) {
2201  fMiscDiag[41]++;
2202  fT1d_av_mped[i0StexStinEcna] = (Double_t)0;
2203  }
2204  }
2205 
2207  std::cout << "*TEcnaRun::AveragePedestals()" << std::endl;
2208  }
2210  std::cout << " Calculation, for all the " << fStinName.Data() << "s, of the average Pedestals"
2211  << std::endl;
2212  }
2213 
2214  //................... Calculation
2215  for (Int_t i0StexStinEcna = 0; i0StexStinEcna < fEcal->MaxStinEcnaInStex(); i0StexStinEcna++) {
2216  Int_t n1StexStinEcna = i0StexStinEcna + 1;
2217  fT1d_av_mped[i0StexStinEcna] = (Double_t)0;
2218  for (Int_t i0StinEcha = 0; i0StinEcha < fEcal->MaxCrysInStin(); i0StinEcha++) {
2219  Int_t i0StexEcha = fEcalNumbering->Get0StexEchaFrom1StexStinAnd0StinEcha(n1StexStinEcna, i0StinEcha);
2220 
2221  if (fStexName == "SM ") {
2222  fT1d_av_mped[i0StexStinEcna] += fT1d_ev_ev[i0StexEcha];
2223  }
2224 
2225  if (fStexName == "Dee") {
2226  //---------------- Special translation for mixed SCEcna (29 and 32)
2227  // Xtal 11 of SCEcna 29 -> Xtal 11 of SCEcna 10
2228  // Xtal 11 of SCEcna 32 -> Xtal 11 of SCEcna 11
2229  Int_t n1StinEcha = i0StinEcha + 1;
2230  if (n1StexStinEcna == 10 && n1StinEcha == 11) {
2231  i0StexEcha = fEcalNumbering->Get0StexEchaFrom1StexStinAnd0StinEcha(29, i0StinEcha);
2232  }
2233  if (n1StexStinEcna == 11 && n1StinEcha == 11) {
2234  i0StexEcha = fEcalNumbering->Get0StexEchaFrom1StexStinAnd0StinEcha(32, i0StinEcha);
2235  }
2236  if (!((n1StexStinEcna == 29 || n1StexStinEcna == 32) && n1StinEcha == 11)) {
2237  fT1d_av_mped[i0StexStinEcna] += fT1d_ev_ev[i0StexEcha];
2238  }
2239  }
2240  }
2241  Double_t xdivis = (Double_t)0.;
2242  if (fStexName == "SM ") {
2243  xdivis = (Double_t)fEcal->MaxCrysInStin();
2244  }
2245  if (fStexName == "Dee") {
2246  xdivis = (Double_t)fEcalNumbering->MaxCrysInStinEcna(fFileHeader->fStex, n1StexStinEcna, "TEcnaRun");
2247  }
2248 
2249  fT1d_av_mped[i0StexStinEcna] = fT1d_av_mped[i0StexStinEcna] / xdivis;
2250  }
2251 
2252  fTagAvPed[0] = 1;
2254 }
2255 //-----------------------------------------------------------------------------
2256 //
2257 // Calculation of the average total noise for each Stin in Stex
2258 // tag: AvTno
2259 //
2260 //-----------------------------------------------------------------------------
2262  // Calculation of the average
2263  // (over the Stin's 0 to fEcal->MaxStinInStex()) of the Total Noise
2264 
2265  //... preliminary calculation of the averaged Total Noise if not done yet
2266  if (fTagTno[0] != 1) {
2267  TotalNoise();
2268  fTagTno[0] = 0;
2269  }
2270  //................... Allocation av_totn + init to zero (mandatory)
2271  if (fT1d_av_totn == nullptr) {
2272  fT1d_av_totn = new Double_t[fEcal->MaxStinEcnaInStex()];
2273  fCnew++;
2274  }
2275  for (Int_t i0StexStinEcna = 0; i0StexStinEcna < fEcal->MaxStinEcnaInStex(); i0StexStinEcna++) {
2276  if (fT1d_av_totn[i0StexStinEcna] != (Double_t)0) {
2277  fMiscDiag[42]++;
2278  fT1d_av_totn[i0StexStinEcna] = (Double_t)0;
2279  }
2280  }
2281 
2283  std::cout << "*TEcnaRun::AverageTotalNoise()" << std::endl;
2284  }
2286  std::cout << " Calculation, for all the " << fStinName.Data() << "s, of the average total Noise"
2287  << std::endl;
2288  }
2289 
2290  //................... Calculation
2291  for (Int_t i0StexStinEcna = 0; i0StexStinEcna < fEcal->MaxStinEcnaInStex(); i0StexStinEcna++) {
2292  Int_t n1StexStinEcna = i0StexStinEcna + 1;
2293  fT1d_av_totn[i0StexStinEcna] = (Double_t)0;
2294  for (Int_t i0StinEcha = 0; i0StinEcha < fEcal->MaxCrysInStin(); i0StinEcha++) {
2295  Int_t i0StexEcha = fEcalNumbering->Get0StexEchaFrom1StexStinAnd0StinEcha(n1StexStinEcna, i0StinEcha);
2296 
2297  if (fStexName == "SM ") {
2298  fT1d_av_totn[i0StexStinEcna] += fT1d_evsamp_of_sigevt[i0StexEcha];
2299  }
2300 
2301  if (fStexName == "Dee") {
2302  //---------------- Special translation for mixed SCEcna (29 and 32)
2303  // Xtal 11 of SCEcna 29 -> Xtal 11 of SCEcna 10
2304  // Xtal 11 of SCEcna 32 -> Xtal 11 of SCEcna 11
2305  Int_t n1StinEcha = i0StinEcha + 1;
2306  if (n1StexStinEcna == 10 && n1StinEcha == 11) {
2307  i0StexEcha = fEcalNumbering->Get0StexEchaFrom1StexStinAnd0StinEcha(29, i0StinEcha);
2308  }
2309  if (n1StexStinEcna == 11 && n1StinEcha == 11) {
2310  i0StexEcha = fEcalNumbering->Get0StexEchaFrom1StexStinAnd0StinEcha(32, i0StinEcha);
2311  }
2312  if (!((n1StexStinEcna == 29 || n1StexStinEcna == 32) && n1StinEcha == 11)) {
2313  fT1d_av_totn[i0StexStinEcna] += fT1d_evsamp_of_sigevt[i0StexEcha];
2314  }
2315  }
2316  }
2317  Double_t xdivis = (Double_t)0.;
2318  if (fStexName == "SM ") {
2319  xdivis = (Double_t)fEcal->MaxCrysInStin();
2320  }
2321  if (fStexName == "Dee") {
2322  xdivis = (Double_t)fEcalNumbering->MaxCrysInStinEcna(fFileHeader->fStex, n1StexStinEcna, "TEcnaRun");
2323  }
2324 
2325  fT1d_av_totn[i0StexStinEcna] = fT1d_av_totn[i0StexStinEcna] / xdivis;
2326  }
2327  fTagAvTno[0] = 1;
2329 }
2330 //-----------------------------------------------------------------------------
2331 //
2332 // Calculation of the average Low Frequency noise for each Stin in Stex
2333 // tag: AvLfn
2334 //
2335 //-----------------------------------------------------------------------------
2337  // Calculation of the average
2338  // (over the Stin's 0 to fEcal->MaxStinInStex()) of the Low Frequency Noise
2339 
2340  //... preliminary calculation of the Low Frequency Noise if not done yet
2341  if (fTagLfn[0] != 1) {
2343  fTagLfn[0] = 0;
2344  }
2345  //................... Allocation av_lofn + init to zero (mandatory)
2346  if (fT1d_av_lofn == nullptr) {
2347  fT1d_av_lofn = new Double_t[fEcal->MaxStinEcnaInStex()];
2348  fCnew++;
2349  }
2350  for (Int_t i0StexStinEcna = 0; i0StexStinEcna < fEcal->MaxStinEcnaInStex(); i0StexStinEcna++) {
2351  if (fT1d_av_lofn[i0StexStinEcna] != (Double_t)0) {
2352  fMiscDiag[43]++;
2353  fT1d_av_lofn[i0StexStinEcna] = (Double_t)0;
2354  }
2355  }
2356 
2358  std::cout << "*TEcnaRun::AverageLowFrequencyNoise()" << std::endl;
2359  }
2361  std::cout << " Calculation, for all the " << fStinName.Data() << "s, of the average Low Frequency Noise"
2362  << std::endl;
2363  }
2364 
2365  //................... Calculation
2366  for (Int_t i0StexStinEcna = 0; i0StexStinEcna < fEcal->MaxStinEcnaInStex(); i0StexStinEcna++) {
2367  Int_t n1StexStinEcna = i0StexStinEcna + 1;
2368  fT1d_av_lofn[i0StexStinEcna] = (Double_t)0;
2369  for (Int_t i0StinEcha = 0; i0StinEcha < fEcal->MaxCrysInStin(); i0StinEcha++) {
2370  Int_t i0StexEcha = fEcalNumbering->Get0StexEchaFrom1StexStinAnd0StinEcha(n1StexStinEcna, i0StinEcha);
2371 
2372  if (fStexName == "SM ") {
2373  fT1d_av_lofn[i0StexStinEcna] += fT1d_sigevt_of_evsamp[i0StexEcha];
2374  }
2375 
2376  if (fStexName == "Dee") {
2377  //---------------- Special translation for mixed SCEcna (29 and 32)
2378  // Xtal 11 of SCEcna 29 -> Xtal 11 of SCEcna 10
2379  // Xtal 11 of SCEcna 32 -> Xtal 11 of SCEcna 11
2380  Int_t n1StinEcha = i0StinEcha + 1;
2381  if (n1StexStinEcna == 10 && n1StinEcha == 11) {
2382  i0StexEcha = fEcalNumbering->Get0StexEchaFrom1StexStinAnd0StinEcha(29, i0StinEcha);
2383  }
2384  if (n1StexStinEcna == 11 && n1StinEcha == 11) {
2385  i0StexEcha = fEcalNumbering->Get0StexEchaFrom1StexStinAnd0StinEcha(32, i0StinEcha);
2386  }
2387  if (!((n1StexStinEcna == 29 || n1StexStinEcna == 32) && n1StinEcha == 11)) {
2388  fT1d_av_lofn[i0StexStinEcna] += fT1d_sigevt_of_evsamp[i0StexEcha];
2389  }
2390  }
2391  }
2392  Double_t xdivis = (Double_t)0.;
2393  if (fStexName == "SM ") {
2394  xdivis = (Double_t)fEcal->MaxCrysInStin();
2395  }
2396  if (fStexName == "Dee") {
2397  xdivis = (Double_t)fEcalNumbering->MaxCrysInStinEcna(fFileHeader->fStex, n1StexStinEcna, "TEcnaRun");
2398  }
2399 
2400  fT1d_av_lofn[i0StexStinEcna] = fT1d_av_lofn[i0StexStinEcna] / xdivis;
2401  }
2402  fTagAvLfn[0] = 1;
2404 }
2405 //-----------------------------------------------------------------------------
2406 //
2407 // Calculation of the average high frequency noise for each Stin in Stex
2408 // tag: AvHfn
2409 //
2410 //-----------------------------------------------------------------------------
2412  // Calculation of the average
2413  // (over the Stin's 0 to fEcal->MaxStinInStex()) of the High Frequency Noise
2414 
2415  //... preliminary calculation of the High Frequency Noise if not done yet
2416  if (fTagHfn[0] != 1) {
2418  fTagHfn[0] = 0;
2419  }
2420  //................... Allocation av_hifn + init to zero (mandatory)
2421  if (fT1d_av_hifn == nullptr) {
2422  fT1d_av_hifn = new Double_t[fEcal->MaxStinEcnaInStex()];
2423  fCnew++;
2424  }
2425  for (Int_t i0StexStinEcna = 0; i0StexStinEcna < fEcal->MaxStinEcnaInStex(); i0StexStinEcna++) {
2426  if (fT1d_av_hifn[i0StexStinEcna] != (Double_t)0) {
2427  fMiscDiag[44]++;
2428  fT1d_av_hifn[i0StexStinEcna] = (Double_t)0;
2429  }
2430  }
2431 
2433  std::cout << "*TEcnaRun::AverageHighFrequencyNoise()" << std::endl;
2434  }
2436  std::cout << " Calculation, for all the " << fStinName.Data() << "s, of the average High Frequency Noise"
2437  << std::endl;
2438  }
2439 
2440  //................... Calculation
2441  for (Int_t i0StexStinEcna = 0; i0StexStinEcna < fEcal->MaxStinEcnaInStex(); i0StexStinEcna++) {
2442  Int_t n1StexStinEcna = i0StexStinEcna + 1;
2443  fT1d_av_hifn[i0StexStinEcna] = (Double_t)0;
2444  for (Int_t i0StinEcha = 0; i0StinEcha < fEcal->MaxCrysInStin(); i0StinEcha++) {
2445  Int_t i0StexEcha = fEcalNumbering->Get0StexEchaFrom1StexStinAnd0StinEcha(n1StexStinEcna, i0StinEcha);
2446 
2447  if (fStexName == "SM ") {
2448  fT1d_av_hifn[i0StexStinEcna] += fT1d_evevt_of_sigsamp[i0StexEcha];
2449  }
2450 
2451  if (fStexName == "Dee") {
2452  //---------------- Special translation for mixed SCEcna (29 and 32)
2453  // Xtal 11 of SCEcna 29 -> Xtal 11 of SCEcna 10
2454  // Xtal 11 of SCEcna 32 -> Xtal 11 of SCEcna 11
2455  Int_t n1StinEcha = i0StinEcha + 1;
2456  if (n1StexStinEcna == 10 && n1StinEcha == 11) {
2457  i0StexEcha = fEcalNumbering->Get0StexEchaFrom1StexStinAnd0StinEcha(29, i0StinEcha);
2458  }
2459  if (n1StexStinEcna == 11 && n1StinEcha == 11) {
2460  i0StexEcha = fEcalNumbering->Get0StexEchaFrom1StexStinAnd0StinEcha(32, i0StinEcha);
2461  }
2462  if (!((n1StexStinEcna == 29 || n1StexStinEcna == 32) && n1StinEcha == 11)) {
2463  fT1d_av_hifn[i0StexStinEcna] += fT1d_evevt_of_sigsamp[i0StexEcha];
2464  }
2465  }
2466  }
2467  Double_t xdivis = (Double_t)0.;
2468  if (fStexName == "SM ") {
2469  xdivis = (Double_t)fEcal->MaxCrysInStin();
2470  }
2471  if (fStexName == "Dee") {
2472  xdivis = (Double_t)fEcalNumbering->MaxCrysInStinEcna(fFileHeader->fStex, n1StexStinEcna, "TEcnaRun");
2473  }
2474 
2475  fT1d_av_hifn[i0StexStinEcna] = fT1d_av_hifn[i0StexStinEcna] / xdivis;
2476  }
2477  fTagAvHfn[0] = 1;
2479 }
2480 //-----------------------------------------------------------------------------
2481 //
2482 // Calculation of the average mean cor(s,s) for each Stin in Stex
2483 // tag: AvMeanCorss
2484 //
2485 //-----------------------------------------------------------------------------
2487  // Calculation of the average
2488  // (over the Stin's 0 to fEcal->MaxStinInStex()) of the mean cor(s,s)
2489 
2490  //... preliminary calculation of the mean cor(s,s) if not done yet
2491  if (fTagMeanCorss[0] != 1) {
2493  fTagMeanCorss[0] = 0;
2494  }
2495  //................... Allocation av_ev_corss + init to zero (mandatory)
2496  if (fT1d_av_ev_corss == nullptr) {
2497  fT1d_av_ev_corss = new Double_t[fEcal->MaxStinEcnaInStex()];
2498  fCnew++;
2499  }
2500  for (Int_t i0StexStinEcna = 0; i0StexStinEcna < fEcal->MaxStinEcnaInStex(); i0StexStinEcna++) {
2501  if (fT1d_av_ev_corss[i0StexStinEcna] != (Double_t)0) {
2502  fMiscDiag[45]++;
2503  fT1d_av_ev_corss[i0StexStinEcna] = (Double_t)0;
2504  }
2505  }
2506 
2508  std::cout << "*TEcnaRun::AverageMeanCorrelationsBetweenSamples()" << std::endl;
2509  }
2511  std::cout << " Calculation, for all the " << fStinName.Data() << "s, of the average mean cor(s,s)"
2512  << std::endl;
2513  }
2514 
2515  //................... Calculation
2516  for (Int_t i0StexStinEcna = 0; i0StexStinEcna < fEcal->MaxStinEcnaInStex(); i0StexStinEcna++) {
2517  Int_t n1StexStinEcna = i0StexStinEcna + 1;
2518  fT1d_av_ev_corss[i0StexStinEcna] = (Double_t)0;
2519  for (Int_t i0StinEcha = 0; i0StinEcha < fEcal->MaxCrysInStin(); i0StinEcha++) {
2520  Int_t i0StexEcha = fEcalNumbering->Get0StexEchaFrom1StexStinAnd0StinEcha(n1StexStinEcna, i0StinEcha);
2521 
2522  if (fStexName == "SM ") {
2523  fT1d_av_ev_corss[i0StexStinEcna] += fT1d_ev_cor_ss[i0StexEcha];
2524  }
2525 
2526  if (fStexName == "Dee") {
2527  //---------------- Special translation for mixed SCEcna (29 and 32)
2528  // Xtal 11 of SCEcna 29 -> Xtal 11 of SCEcna 10
2529  // Xtal 11 of SCEcna 32 -> Xtal 11 of SCEcna 11
2530  Int_t n1StinEcha = i0StinEcha + 1;
2531  if (n1StexStinEcna == 10 && n1StinEcha == 11) {
2532  i0StexEcha = fEcalNumbering->Get0StexEchaFrom1StexStinAnd0StinEcha(29, i0StinEcha);
2533  }
2534  if (n1StexStinEcna == 11 && n1StinEcha == 11) {
2535  i0StexEcha = fEcalNumbering->Get0StexEchaFrom1StexStinAnd0StinEcha(32, i0StinEcha);
2536  }
2537  if (!((n1StexStinEcna == 29 || n1StexStinEcna == 32) && n1StinEcha == 11)) {
2538  fT1d_av_ev_corss[i0StexStinEcna] += fT1d_ev_cor_ss[i0StexEcha];
2539  }
2540  }
2541  }
2542  Double_t xdivis = (Double_t)0.;
2543  if (fStexName == "SM ") {
2544  xdivis = (Double_t)fEcal->MaxCrysInStin();
2545  }
2546  if (fStexName == "Dee") {
2547  xdivis = (Double_t)fEcalNumbering->MaxCrysInStinEcna(fFileHeader->fStex, n1StexStinEcna, "TEcnaRun");
2548  }
2549 
2550  fT1d_av_ev_corss[i0StexStinEcna] = fT1d_av_ev_corss[i0StexStinEcna] / xdivis;
2551  }
2552  fTagAvMeanCorss[0] = 1;
2554 }
2555 //-----------------------------------------------------------------------------
2556 //
2557 // Calculation of the average sigma of cor(s,s) for each Stin in Stex
2558 // tag: AvSigCorss
2559 //
2560 //-----------------------------------------------------------------------------
2562  // Calculation of the average
2563  // (over the Stin's 0 to fEcal->MaxStinInStex()) of the sigma of cor(s,s)
2564 
2565  //... preliminary calculation of the sigma of cor(s,s) if not done yet
2566  if (fTagSigCorss[0] != 1) {
2568  fTagSigCorss[0] = 0;
2569  }
2570  //................... Allocation av_sig_corss + init to zero (mandatory)
2571  if (fT1d_av_sig_corss == nullptr) {
2572  fT1d_av_sig_corss = new Double_t[fEcal->MaxStinEcnaInStex()];
2573  fCnew++;
2574  }
2575  for (Int_t i0StexStinEcna = 0; i0StexStinEcna < fEcal->MaxStinEcnaInStex(); i0StexStinEcna++) {
2576  if (fT1d_av_sig_corss[i0StexStinEcna] != (Double_t)0) {
2577  fMiscDiag[46]++;
2578  fT1d_av_sig_corss[i0StexStinEcna] = (Double_t)0;
2579  }
2580  }
2581 
2583  std::cout << "*TEcnaRun::AverageSigmaOfCorrelationsBetweenSamples()" << std::endl;
2584  }
2586  std::cout << " Calculation, for all the " << fStinName.Data() << "s, of the average sigma of cor(s,s)"
2587  << std::endl;
2588  }
2589 
2590  //................... Calculation
2591  for (Int_t i0StexStinEcna = 0; i0StexStinEcna < fEcal->MaxStinEcnaInStex(); i0StexStinEcna++) {
2592  Int_t n1StexStinEcna = i0StexStinEcna + 1;
2593  fT1d_av_sig_corss[i0StexStinEcna] = (Double_t)0;
2594  for (Int_t i0StinEcha = 0; i0StinEcha < fEcal->MaxCrysInStin(); i0StinEcha++) {
2595  Int_t i0StexEcha = fEcalNumbering->Get0StexEchaFrom1StexStinAnd0StinEcha(n1StexStinEcna, i0StinEcha);
2596 
2597  if (fStexName == "SM ") {
2598  fT1d_av_sig_corss[i0StexStinEcna] += fT1d_sig_cor_ss[i0StexEcha];
2599  }
2600 
2601  if (fStexName == "Dee") {
2602  //---------------- Special translation for mixed SCEcna (29 and 32)
2603  // Xtal 11 of SCEcna 29 -> Xtal 11 of SCEcna 10
2604  // Xtal 11 of SCEcna 32 -> Xtal 11 of SCEcna 11
2605  Int_t n1StinEcha = i0StinEcha + 1;
2606  if (n1StexStinEcna == 10 && n1StinEcha == 11) {
2607  i0StexEcha = fEcalNumbering->Get0StexEchaFrom1StexStinAnd0StinEcha(29, i0StinEcha);
2608  }
2609  if (n1StexStinEcna == 11 && n1StinEcha == 11) {
2610  i0StexEcha = fEcalNumbering->Get0StexEchaFrom1StexStinAnd0StinEcha(32, i0StinEcha);
2611  }
2612  if (!((n1StexStinEcna == 29 || n1StexStinEcna == 32) && n1StinEcha == 11)) {
2613  fT1d_av_sig_corss[i0StexStinEcna] += fT1d_sig_cor_ss[i0StexEcha];
2614  }
2615  }
2616  }
2617  Double_t xdivis = (Double_t)0.;
2618  if (fStexName == "SM ") {
2619  xdivis = (Double_t)fEcal->MaxCrysInStin();
2620  }
2621  if (fStexName == "Dee") {
2622  xdivis = (Double_t)fEcalNumbering->MaxCrysInStinEcna(fFileHeader->fStex, n1StexStinEcna, "TEcnaRun");
2623  }
2624 
2625  fT1d_av_sig_corss[i0StexStinEcna] = fT1d_av_sig_corss[i0StexStinEcna] / xdivis;
2626  }
2627  fTagAvSigCorss[0] = 1;
2629 }
2630 
2631 //======================================================================
2632 //
2633 // C O V A R I A N C E S & C O R R E L A T I O N S
2634 //
2635 // B E T W E E N C H A N N E L S
2636 //
2637 //======================================================================
2638 //----------------------------------------------------------------------
2639 //
2640 // Calculation of the Low Frequency Covariances between channels
2641 //
2642 // LFCov(Ci,Cj) = Cov_e[ E_s[A(Ci,s*,e*)] , E_s[A(Cj,s*,e*) ]
2643 //
2644 // = E_e[ ( E_s[A(Ci,s*,e*)] - E_e[ E_s[A(Ci,s*,e*)] ] )*
2645 // ( E_s[A(Cj,s*,e*)] - E_e[ E_s[A(Cj,s*,e*)] ] ) ]
2646 //
2647 // A(Ci,s,e) : ADC value for channel Ci, sample s, event e
2648 //
2649 // E_e , Cov_e : average, covariance over the events
2650 // E_s : average over the samples
2651 //
2652 // e* : random variable associated to events
2653 // s* : random variable associated to samples
2654 //
2655 //----------------------------------------------------------------------
2657  //Calculation of the Low Frequency Covariances between channels
2658 
2660  std::cout << "*TEcnaRun::LowFrequencyCovariancesBetweenChannels()" << std::endl;
2661  }
2663  std::cout << " Calculation of the Low Frequency Covariances between channels" << std::endl;
2664  }
2665 
2666  //................. allocation fT2d_lf_cov + init to zero (mandatory)
2667  if (fT2d_lf_cov == nullptr) {
2668  const Int_t n_StexEcha = fEcal->MaxCrysEcnaInStex();
2669  fT2d_lf_cov = new Double_t*[n_StexEcha];
2670  fCnew++;
2671  fT2d1_lf_cov = new Double_t[n_StexEcha * n_StexEcha];
2672  fCnew++;
2673  for (Int_t i0StexEcha = 0; i0StexEcha < n_StexEcha; i0StexEcha++) {
2674  fT2d_lf_cov[i0StexEcha] = &fT2d1_lf_cov[0] + i0StexEcha * n_StexEcha;
2675  }
2676  }
2677 
2678  for (Int_t i0StexEcha = 0; i0StexEcha < fEcal->MaxCrysEcnaInStex(); i0StexEcha++) {
2679  for (Int_t j0StexEcha = 0; j0StexEcha < fEcal->MaxCrysEcnaInStex(); j0StexEcha++) {
2680  if (fT2d_lf_cov[i0StexEcha][j0StexEcha] != (Double_t)0) {
2681  fMiscDiag[21]++;
2682  fT2d_lf_cov[i0StexEcha][j0StexEcha] = (Double_t)0;
2683  }
2684  }
2685  }
2686  //........................................... Calculation (LowFrequencyCovariancesBetweenChannels)
2687  //................... Allocation mean_over_samples(i0StexEcha, n_event)
2688  TMatrixD mean_over_samples(fEcal->MaxCrysEcnaInStex(), fNumberOfEvents);
2689  for (Int_t i0StexEcha = 0; i0StexEcha < fEcal->MaxCrysEcnaInStex(); i0StexEcha++) {
2690  for (Int_t n_event = 0; n_event < fNumberOfEvents; n_event++) {
2691  mean_over_samples(i0StexEcha, n_event) = (Double_t)0.;
2692  }
2693  }
2694  //................... Allocation MoeOfMos(i0StexEcha)
2695  TVectorD MoeOfMos(fEcal->MaxCrysEcnaInStex());
2696  for (Int_t i0StexEcha = 0; i0StexEcha < fEcal->MaxCrysEcnaInStex(); i0StexEcha++) {
2697  MoeOfMos(i0StexEcha) = (Double_t)0.;
2698  }
2699 
2700  //................... Calculation
2702  std::cout << " Calculation, for each pair of channels, of the covariance (over the events)" << std::endl
2703  << " between the ADC expectation values (over the samples 1 to " << fNbSampForCalc << ")."
2704  << std::endl;
2705  }
2706 
2707  std::cout << " Please, wait (end at i= " << fEcal->MaxCrysEcnaInStex() << "): " << std::endl;
2708 
2709  for (Int_t i0StexEcha = 0; i0StexEcha < fEcal->MaxCrysEcnaInStex(); i0StexEcha++) {
2710  MoeOfMos(i0StexEcha) = (Double_t)0;
2711 
2712  if ((fFlagSubDet == "EE" && fEcalNumbering->StexEchaForCons(fFileHeader->fStex, i0StexEcha) > 0) ||
2713  (fFlagSubDet == "EB")) {
2714  for (Int_t n_event = 0; n_event < fNumberOfEvents; n_event++) {
2715  // Calculation, for each event, of the mean over the samples ( = E_s[A(c_i,s*,e_n] )
2716  mean_over_samples(i0StexEcha, n_event) = (Double_t)0.;
2717  for (Int_t i0Sample = 0; i0Sample < fNbSampForCalc; i0Sample++) {
2718  mean_over_samples(i0StexEcha, n_event) += fT3d_AdcValues[i0StexEcha][i0Sample][n_event];
2719  }
2720  mean_over_samples(i0StexEcha, n_event) /= (Double_t)fNbSampForCalc;
2721  }
2722  //Calculation of the mean over the events of E_s[A(c_i,s*,e_n] ( = E_e[E_s[A(c_i,s*,e*]] )
2723  for (Int_t n_event = 0; n_event < fNumberOfEvents; n_event++) {
2724  MoeOfMos(i0StexEcha) += mean_over_samples(i0StexEcha, n_event);
2725  }
2726  MoeOfMos(i0StexEcha) /= (Double_t)fNumberOfEvents;
2727  }
2728  }
2729 
2730  //... Calculation of half of the matrix, diagonal included (LowFrequencyCovariancesBetweenChannels)
2731  for (Int_t i0StexEcha = 0; i0StexEcha < fEcal->MaxCrysEcnaInStex(); i0StexEcha++) {
2732  if ((fFlagSubDet == "EE" && fEcalNumbering->StexEchaForCons(fFileHeader->fStex, i0StexEcha) > 0) ||
2733  (fFlagSubDet == "EB")) {
2734  for (Int_t j0StexEcha = 0; j0StexEcha <= i0StexEcha; j0StexEcha++) {
2735  if ((fFlagSubDet == "EE" && fEcalNumbering->StexEchaForCons(fFileHeader->fStex, j0StexEcha) > 0) ||
2736  (fFlagSubDet == "EB")) {
2737  fT2d_lf_cov[i0StexEcha][j0StexEcha] = (Double_t)0;
2738  for (Int_t n_event = 0; n_event < fNumberOfEvents; n_event++) {
2739  fT2d_lf_cov[i0StexEcha][j0StexEcha] += (mean_over_samples(i0StexEcha, n_event) - MoeOfMos(i0StexEcha)) *
2740  (mean_over_samples(j0StexEcha, n_event) - MoeOfMos(j0StexEcha));
2741  }
2742  fT2d_lf_cov[i0StexEcha][j0StexEcha] /= (Double_t)fNumberOfEvents;
2743 
2744  fT2d_lf_cov[j0StexEcha][i0StexEcha] = fT2d_lf_cov[i0StexEcha][j0StexEcha];
2745  }
2746  }
2747  if (i0StexEcha % 100 == 0) {
2748  std::cout << i0StexEcha << "[LFN Cov], ";
2749  }
2750  }
2751  }
2752  std::cout << std::endl;
2753  fTagLfCov[0] = 1;
2755 }
2756 //---------- (end of LowFrequencyCovariancesBetweenChannels ) --------------------
2757 
2758 //------------------------------------------------------------------
2759 //
2760 // Calculation of the Low Frequency Correlations between channels
2761 //
2762 // LFCor(Ci,Cj) = LFCov(Ci,Cj)/sqrt(LFCov(Ci,Ci)*LFCov(Cj,Cj))
2763 //
2764 //------------------------------------------------------------------
2766  //Calculation of the Low Frequency Correlations between channels
2767 
2768  //... preliminary calculation of the covariances if not done yet.
2769  if (fTagLfCov[0] != 1) {
2771  fTagLfCov[0] = 0;
2772  }
2773 
2775  std::cout << "*TEcnaRun::LowFrequencyCorrelationsBetweenChannels()" << std::endl;
2776  }
2778  std::cout << " Calculation of the Low Frequency Correlations between channels" << std::endl
2779  << " Starting allocation. " << std::endl;
2780  }
2781 
2782  //................. allocation fT2d_lf_cor + init to zero (mandatory)
2783  if (fT2d_lf_cor == nullptr) {
2784  const Int_t n_StexEcha = fEcal->MaxCrysEcnaInStex();
2785  fT2d_lf_cor = new Double_t*[n_StexEcha];
2786  fCnew++;
2787  fT2d1_lf_cor = new Double_t[n_StexEcha * n_StexEcha];
2788  fCnew++;
2789  for (Int_t i0StexEcha = 0; i0StexEcha < n_StexEcha; i0StexEcha++) {
2790  fT2d_lf_cor[i0StexEcha] = &fT2d1_lf_cor[0] + i0StexEcha * n_StexEcha;
2791  }
2792  }
2793 
2794  for (Int_t i0StexEcha = 0; i0StexEcha < fEcal->MaxCrysEcnaInStex(); i0StexEcha++) {
2795  for (Int_t j0StexEcha = 0; j0StexEcha < fEcal->MaxCrysEcnaInStex(); j0StexEcha++) {
2796  if (fT2d_lf_cor[i0StexEcha][j0StexEcha] != (Double_t)0) {
2797  fMiscDiag[22]++;
2798  fT2d_lf_cor[i0StexEcha][j0StexEcha] = (Double_t)0;
2799  }
2800  }
2801  }
2802 
2803  //................. calculation
2804  //........................... computation of half of the matrix, diagonal included
2805  for (Int_t i0StexEcha = 0; i0StexEcha < fEcal->MaxCrysEcnaInStex(); i0StexEcha++) {
2806  if ((fFlagSubDet == "EE" && fEcalNumbering->StexEchaForCons(fFileHeader->fStex, i0StexEcha) > 0) ||
2807  (fFlagSubDet == "EB")) {
2808  for (Int_t j0StexEcha = 0; j0StexEcha <= i0StexEcha; j0StexEcha++) {
2809  if ((fFlagSubDet == "EE" && fEcalNumbering->StexEchaForCons(fFileHeader->fStex, j0StexEcha) > 0) ||
2810  (fFlagSubDet == "EB")) {
2811  if (fT2d_lf_cov[i0StexEcha][i0StexEcha] > 0 && fT2d_lf_cov[j0StexEcha][j0StexEcha] > 0) {
2812  fT2d_lf_cor[i0StexEcha][j0StexEcha] =
2813  fT2d_lf_cov[i0StexEcha][j0StexEcha] /
2814  ((Double_t)sqrt(fT2d_lf_cov[i0StexEcha][i0StexEcha] * fT2d_lf_cov[j0StexEcha][j0StexEcha]));
2815  } else {
2816  fT2d_lf_cor[i0StexEcha][j0StexEcha] = (Double_t)0.;
2817  }
2818  fT2d_lf_cor[j0StexEcha][i0StexEcha] = fT2d_lf_cor[i0StexEcha][j0StexEcha];
2819  }
2820  }
2821  }
2822  if (i0StexEcha % 100 == 0) {
2823  std::cout << i0StexEcha << "[LFN Cor], ";
2824  }
2825  }
2826  std::cout << std::endl;
2827 
2828  fTagLfCor[0] = 1;
2830 }
2831 //--------------- (end of LowFrequencyCorrelationsBetweenChannels) --------------------
2832 
2833 //------------------------------------------------------------------
2834 //
2835 // Calculation of the High Frequency Covariances between channels
2836 //
2837 // HFCov(Ci,Cj) = E_e[ Cov_s[ A(Ci,s*,e*) , A(Cj,s*,e*) ] ]
2838 //
2839 // = E_e[ E_s[ ( A(Ci,s*,e*) - E_s[A(Ci,s*,e*)] )*
2840 // ( A(Cj,s*,e*) - E_s[A(Cj,s*,e*)] ) ] ]
2841 //
2842 // A(Ci,s,e) : ADC value for channel Ci, sample s, event e
2843 //
2844 // E_e : average over the events
2845 // E_s , Cov_s : average, covariance over the samples
2846 //
2847 //------------------------------------------------------------------
2849  //Calculation of the High Frequency Covariances between channels
2850 
2852  std::cout << "*TEcnaRun::HighFrequencyCovariancesBetweenChannels()" << std::endl;
2853  }
2855  std::cout << " Calculation of the High Frequency Covariances between channels" << std::endl;
2856  }
2857 
2858  //................. allocation fT2d_hf_cov + init to zero (mandatory)
2859  if (fT2d_hf_cov == nullptr) {
2860  const Int_t n_StexEcha = fEcal->MaxCrysEcnaInStex();
2861  fT2d_hf_cov = new Double_t*[n_StexEcha];
2862  fCnew++;
2863  fT2d1_hf_cov = new Double_t[n_StexEcha * n_StexEcha];
2864  fCnew++;
2865  for (Int_t i0StexEcha = 0; i0StexEcha < n_StexEcha; i0StexEcha++) {
2866  fT2d_hf_cov[i0StexEcha] = &fT2d1_hf_cov[0] + i0StexEcha * n_StexEcha;
2867  }
2868  }
2869 
2870  for (Int_t i0StexEcha = 0; i0StexEcha < fEcal->MaxCrysEcnaInStex(); i0StexEcha++) {
2871  for (Int_t j0StexEcha = 0; j0StexEcha < fEcal->MaxCrysEcnaInStex(); j0StexEcha++) {
2872  if (fT2d_hf_cov[i0StexEcha][j0StexEcha] != (Double_t)0) {
2873  fMiscDiag[23]++;
2874  fT2d_hf_cov[i0StexEcha][j0StexEcha] = (Double_t)0;
2875  }
2876  }
2877  }
2878 
2879  //................... Allocation mean_over_samples(i0StexEcha, n_event)
2880  TMatrixD mean_over_samples(fEcal->MaxCrysEcnaInStex(), fNumberOfEvents);
2881  for (Int_t i0StexEcha = 0; i0StexEcha < fEcal->MaxCrysEcnaInStex(); i0StexEcha++) {
2882  for (Int_t n_event = 0; n_event < fNumberOfEvents; n_event++) {
2883  mean_over_samples(i0StexEcha, n_event) = (Double_t)0.;
2884  }
2885  }
2886  //................... Allocation cov_over_samp(i0StexEcha,j0StexEcha)
2887  TMatrixD cov_over_samp(fEcal->MaxCrysEcnaInStex(), fEcal->MaxCrysEcnaInStex());
2888  for (Int_t i0StexEcha = 0; i0StexEcha < fEcal->MaxCrysEcnaInStex(); i0StexEcha++) {
2889  for (Int_t j0StexEcha = 0; j0StexEcha < fEcal->MaxCrysEcnaInStex(); j0StexEcha++) {
2890  cov_over_samp(i0StexEcha, j0StexEcha) = (Double_t)0.;
2891  }
2892  }
2893 
2894  //........................................... Calculation (HighFrequencyCovariancesBetweenChannels)
2896  std::cout << " Calculation of the mean (over the events)" << std::endl
2897  << " of the covariances between the channels (over the samples 1 to " << fNbSampForCalc << ")."
2898  << std::endl;
2899  }
2900 
2901  std::cout << " Please, wait (end at i= " << fEcal->MaxCrysEcnaInStex() << "): " << std::endl;
2902 
2903  for (Int_t i0StexEcha = 0; i0StexEcha < fEcal->MaxCrysEcnaInStex(); i0StexEcha++) {
2904  if ((fFlagSubDet == "EE" && fEcalNumbering->StexEchaForCons(fFileHeader->fStex, i0StexEcha) > 0) ||
2905  (fFlagSubDet == "EB")) {
2906  for (Int_t n_event = 0; n_event < fNumberOfEvents; n_event++) {
2907  // Calculation, for each event, of the mean over the samples ( = E_s[A(c_i,s*,e_n] )
2908  mean_over_samples(i0StexEcha, n_event) = (Double_t)0.;
2909  for (Int_t i0Sample = 0; i0Sample < fNbSampForCalc; i0Sample++) {
2910  mean_over_samples(i0StexEcha, n_event) += fT3d_AdcValues[i0StexEcha][i0Sample][n_event];
2911  }
2912  mean_over_samples(i0StexEcha, n_event) /= (Double_t)fNbSampForCalc;
2913  }
2914  }
2915  if (i0StexEcha % 100 == 0) {
2916  std::cout << i0StexEcha << "[HFNa Cov], ";
2917  }
2918  }
2919  std::cout << std::endl;
2920 
2921  std::cout << " Please, wait (end at i= " << fEcal->MaxCrysEcnaInStex() << "): " << std::endl;
2922 
2923  //... Calculation of half of the matrix, diagonal included (HighFrequencyCovariancesBetweenChannels)
2924  for (Int_t i0StexEcha = 0; i0StexEcha < fEcal->MaxCrysEcnaInStex(); i0StexEcha++) {
2925  if ((fFlagSubDet == "EE" && fEcalNumbering->StexEchaForCons(fFileHeader->fStex, i0StexEcha) > 0) ||
2926  (fFlagSubDet == "EB")) {
2927  for (Int_t j0StexEcha = 0; j0StexEcha <= i0StexEcha; j0StexEcha++) {
2928  if ((fFlagSubDet == "EE" && fEcalNumbering->StexEchaForCons(fFileHeader->fStex, j0StexEcha) > 0) ||
2929  (fFlagSubDet == "EB")) {
2930  for (Int_t n_event = 0; n_event < fNumberOfEvents; n_event++) {
2931  // Calculation, for each event, of the covariance over the samples
2932  cov_over_samp(i0StexEcha, j0StexEcha) = (Double_t)0;
2933  for (Int_t i0Sample = 0; i0Sample < fNbSampForCalc; i0Sample++) {
2934  cov_over_samp(i0StexEcha, j0StexEcha) +=
2935  (fT3d_AdcValues[i0StexEcha][i0Sample][n_event] - mean_over_samples(i0StexEcha, n_event)) *
2936  (fT3d_AdcValues[j0StexEcha][i0Sample][n_event] - mean_over_samples(j0StexEcha, n_event));
2937  }
2938  cov_over_samp(i0StexEcha, j0StexEcha) /= (Double_t)fNbSampForCalc;
2939  }
2940  //....... Calculation of the mean over the events of Cov_s[A(c_i,s*,e*),A(c_j,s*,e*)]
2941  //......... Calculation of half of the matrix, diagonal included
2942  fT2d_hf_cov[i0StexEcha][j0StexEcha] = (Double_t)0;
2943  for (Int_t n_event = 0; n_event < fNumberOfEvents; n_event++) {
2944  fT2d_hf_cov[i0StexEcha][j0StexEcha] += cov_over_samp(i0StexEcha, j0StexEcha);
2945  }
2946  fT2d_hf_cov[i0StexEcha][j0StexEcha] /= (Double_t)fNumberOfEvents;
2947 
2948  fT2d_hf_cov[j0StexEcha][i0StexEcha] = fT2d_hf_cov[i0StexEcha][j0StexEcha];
2949  }
2950  }
2951  }
2952  if (i0StexEcha % 100 == 0) {
2953  std::cout << i0StexEcha << "[HFNb Cov], ";
2954  }
2955  }
2956  std::cout << std::endl;
2957 
2958  fTagHfCov[0] = 1;
2960 }
2961 //---------- (end of HighFrequencyCovariancesBetweenChannels ) --------------------
2962 
2963 //------------------------------------------------------------------
2964 //
2965 // Calculation of the High Frequency Correlations between channels
2966 //
2967 // HFCor(Ci,Cj) = HFCov(Ci,Cj)/sqrt(HFCov(Ci,Ci)*HFCov(Cj,Cj))
2968 //
2969 //------------------------------------------------------------------
2971  //Calculation of the High Frequency Correlations between channels
2972 
2973  //... preliminary calculation of the covariances if not done yet.
2974  if (fTagHfCov[0] != 1) {
2976  fTagHfCov[0] = 0;
2977  }
2978 
2980  std::cout << "*TEcnaRun::HighFrequencyCorrelationsBetweenChannels()" << std::endl;
2981  }
2983  std::cout << " Calculation of the High Frequency Correlations between channels" << std::endl
2984  << " Starting allocation. " << std::endl;
2985  }
2986 
2987  //................. allocation fT2d_hf_cor + init to zero (mandatory)
2988  if (fT2d_hf_cor == nullptr) {
2989  const Int_t n_StexEcha = fEcal->MaxCrysEcnaInStex();
2990  fT2d_hf_cor = new Double_t*[n_StexEcha];
2991  fCnew++;
2992  fT2d1_hf_cor = new Double_t[n_StexEcha * n_StexEcha];
2993  fCnew++;
2994  for (Int_t i0StexEcha = 0; i0StexEcha < n_StexEcha; i0StexEcha++) {
2995  fT2d_hf_cor[i0StexEcha] = &fT2d1_hf_cor[0] + i0StexEcha * n_StexEcha;
2996  }
2997  }
2998 
2999  for (Int_t i0StexEcha = 0; i0StexEcha < fEcal->MaxCrysEcnaInStex(); i0StexEcha++) {
3000  for (Int_t j0StexEcha = 0; j0StexEcha < fEcal->MaxCrysEcnaInStex(); j0StexEcha++) {
3001  if (fT2d_hf_cor[i0StexEcha][j0StexEcha] != (Double_t)0) {
3002  fMiscDiag[24]++;
3003  fT2d_hf_cor[i0StexEcha][j0StexEcha] = (Double_t)0;
3004  }
3005  }
3006  }
3007 
3008  //................. calculation
3009  //........................... computation of half of the matrix, diagonal included
3010 
3011  for (Int_t i0StexEcha = 0; i0StexEcha < fEcal->MaxCrysEcnaInStex(); i0StexEcha++) {
3012  if ((fFlagSubDet == "EE" && fEcalNumbering->StexEchaForCons(fFileHeader->fStex, i0StexEcha) > 0) ||
3013  (fFlagSubDet == "EB")) {
3014  for (Int_t j0StexEcha = 0; j0StexEcha <= i0StexEcha; j0StexEcha++) {
3015  if ((fFlagSubDet == "EE" && fEcalNumbering->StexEchaForCons(fFileHeader->fStex, j0StexEcha) > 0) ||
3016  (fFlagSubDet == "EB")) {
3017  if (fT2d_hf_cov[i0StexEcha][i0StexEcha] > 0 && fT2d_hf_cov[j0StexEcha][j0StexEcha] > 0) {
3018  fT2d_hf_cor[i0StexEcha][j0StexEcha] =
3019  fT2d_hf_cov[i0StexEcha][j0StexEcha] / ((Double_t)sqrt(fT2d_hf_cov[i0StexEcha][i0StexEcha]) *
3020  (Double_t)sqrt(fT2d_hf_cov[j0StexEcha][j0StexEcha]));
3021  } else {
3022  fT2d_hf_cor[i0StexEcha][j0StexEcha] = (Double_t)0.;
3023  }
3024 
3025  fT2d_hf_cor[j0StexEcha][i0StexEcha] = fT2d_hf_cor[i0StexEcha][j0StexEcha];
3026  }
3027  }
3028  }
3029  if (i0StexEcha % 100 == 0) {
3030  std::cout << i0StexEcha << "[HFN Cor], ";
3031  }
3032  }
3033  std::cout << std::endl;
3034 
3035  fTagHfCor[0] = 1;
3037 }
3038 //------- (end of HighFrequencyCorrelationsBetweenChannels) ----------
3039 
3040 //=================================================================================
3041 //
3042 // L O W & H I G H F R E Q U E N C Y C O R R E L A T I O N S
3043 //
3044 // B E T W E E N T O W E R S ( E B ) O R S C s ( E E )
3045 //
3046 //=================================================================================
3047 //-----------------------------------------------------------------------------
3048 // Calculation of the mean Low Frequency Correlations
3049 // between channels for each Stin
3050 //-----------------------------------------------------------------------------
3053 
3055  //Calculation of the mean Low Frequency Correlations
3056  //between channels for each Stin
3057 
3058  //... preliminary calculation of the Low Frequency Cor(c,c) if not done yet
3059  // Only one tag (dim=1) to set to 0 (no write in the result ROOT file)
3060  if (fTagLfCor[0] != 1) {
3062  fTagLfCor[0] = 0;
3063  }
3064 
3065  //..... mean fT2d_lfcc_mostins for each pair (Stin_X,Stin_Y)
3067  std::cout << "*TEcnaRun::LowFrequencyMeanCorrelationsBetweenStins()" << std::endl;
3068  }
3070  std::cout << " Calculation of the mean, for each " << fStinName.Data() << ", of the" << std::endl
3071  << " Low Frequency Correlations between channels." << std::endl;
3072  }
3073 
3074  //................. allocation fT2d_lfcc_mostins + init to zero (mandatory)
3075  if (fT2d_lfcc_mostins == nullptr) {
3076  const Int_t n_Stin = fEcal->MaxStinEcnaInStex();
3077  fT2d_lfcc_mostins = new Double_t*[n_Stin];
3078  fCnew++;
3079  fT2d1_lfcc_mostins = new Double_t[n_Stin * n_Stin];
3080  fCnew++;
3081  for (Int_t i0StexStinEcna = 0; i0StexStinEcna < n_Stin; i0StexStinEcna++) {
3082  fT2d_lfcc_mostins[i0StexStinEcna] = &fT2d1_lfcc_mostins[0] + i0StexStinEcna * n_Stin;
3083  }
3084  }
3085 
3086  for (Int_t i0StexStinEcna = 0; i0StexStinEcna < fEcal->MaxStinEcnaInStex(); i0StexStinEcna++) {
3087  for (Int_t j0StexStinEcna = 0; j0StexStinEcna < fEcal->MaxStinEcnaInStex(); j0StexStinEcna++) {
3088  if (fT2d_lfcc_mostins[i0StexStinEcna][j0StexStinEcna] != (Double_t)0) {
3089  fMiscDiag[31]++;
3090  fT2d_lfcc_mostins[i0StexStinEcna][j0StexStinEcna] = (Double_t)0;
3091  }
3092  }
3093  }
3094 
3095  //..... Calculation of the mean LF Cor(c,c) for each pair (Stin_X,Stin_Y)
3096  //
3097  // ! => Warning: this matrix is NOT symmetric => take N*N elements
3098  // Only (Stin,Stin) matrix is symmetric.
3099  // (StinEcha,StinEcha) matrix inside a (Stin,Stin) element is NOT symmetric
3100  // (except for the (Stin,Stin) DIAGONAL elements)
3101  // Then:
3102  // 1D array half_LFccMos[N*N] to put the (channel,channel) correlations
3103 
3104  Int_t ndim = (Int_t)(fEcal->MaxCrysInStin() * fEcal->MaxCrysInStin());
3105 
3106  TVectorD half_LFccMos(ndim);
3107  for (Int_t i = 0; i < ndim; i++) {
3108  half_LFccMos(i) = (Double_t)0.;
3109  }
3110 
3111  //..................... Calculation
3113  std::cout << "*TEcnaRun::LowFrequencyMeanCorrelationsBetweenStins()" << std::endl;
3114  }
3116  std::cout << " Calculation, for each " << fStinName.Data() << ", of the mean " << std::endl
3117  << " Low Frequency cor(c,c)." << std::endl;
3118  }
3119 
3120  for (Int_t i0StexStinEcna = 0; i0StexStinEcna < fEcal->MaxStinEcnaInStex(); i0StexStinEcna++) {
3121  for (Int_t j0StexStinEcna = 0; j0StexStinEcna < fEcal->MaxStinEcnaInStex(); j0StexStinEcna++) {
3122  //................... .Copy the Mean Correlations(c,c') in 1D vector half_LFccMos()
3123  Int_t i_count = 0;
3124  for (Int_t i0StinCrys = 0; i0StinCrys < fEcal->MaxCrysInStin(); i0StinCrys++) {
3125  Int_t i0StexEcha = i0StexStinEcna * fEcal->MaxCrysInStin() + i0StinCrys;
3126  for (Int_t j0StinCrys = 0; j0StinCrys < fEcal->MaxCrysInStin(); j0StinCrys++) {
3127  Int_t j0StexEcha = j0StexStinEcna * fEcal->MaxCrysInStin() + j0StinCrys;
3128  if ((i0StexEcha >= 0 && i0StexEcha < fEcal->MaxCrysEcnaInStex()) &&
3129  (j0StexEcha >= 0 && j0StexEcha < fEcal->MaxCrysEcnaInStex())) {
3130  half_LFccMos(i_count) = fT2d_lf_cor[i0StexEcha][j0StexEcha];
3131  i_count++;
3132  } else {
3133  std::cout << "!TEcnaRun::LowFrequencyMeanCorrelationsBetweenStins()> Channel number out of range."
3134  << "i0StexEcha = " << i0StexEcha << ", j0StexEcha = " << j0StexEcha << fTTBELL << std::endl;
3135  }
3136  }
3137  }
3138  //...... Calculation of the mean absolute values of the LF mean Correlations(c,c')
3139  fT2d_lfcc_mostins[i0StexStinEcna][j0StexStinEcna] = (Double_t)0;
3140  for (Int_t i_rcor = 0; i_rcor < ndim; i_rcor++) {
3141  fT2d_lfcc_mostins[i0StexStinEcna][j0StexStinEcna] += fabs(half_LFccMos(i_rcor));
3142  }
3143  fT2d_lfcc_mostins[i0StexStinEcna][j0StexStinEcna] /= (Double_t)ndim;
3144  }
3145  if (i0StexStinEcna % 10 == 0) {
3146  std::cout << i0StexStinEcna << "[LFN MCtt], ";
3147  }
3148  }
3149  std::cout << std::endl;
3150 
3151  fTagLFccMoStins[0] = 1;
3153 } // ------- end of LowFrequencyMeanCorrelationsBetweenStins() -------
3154 
3155 //-----------------------------------------------------------------------------
3156 // Calculation of the mean High Frequency Correlations
3157 // between channels for each Stin
3158 //-----------------------------------------------------------------------------
3161 
3163  //Calculation of the mean High Frequency Correlations
3164  //between channels for each Stin
3165 
3166  //... preliminary calculation of the High Frequency Cor(c,c) if not done yet
3167  // Only one tag (dim=1) to set to 0 (no write in the result ROOT file)
3168  if (fTagHfCor[0] != 1) {
3170  fTagHfCor[0] = 0;
3171  }
3172 
3173  //..... mean fT2d_hfcc_mostins for each pair (Stin_X,Stin_Y)
3175  std::cout << "*TEcnaRun::HighFrequencyMeanCorrelationsBetweenStins()" << std::endl;
3176  }
3178  std::cout << " Calculation of the mean, for each " << fFlagSubDet.Data() << ", of the" << std::endl
3179  << " High Frequency Correlations between channels." << std::endl;
3180  }
3181 
3182  //................. allocation fT2d_hfcc_mostins + init to zero (mandatory)
3183  if (fT2d_hfcc_mostins == nullptr) {
3184  const Int_t n_Stin = fEcal->MaxStinEcnaInStex();
3185  fT2d_hfcc_mostins = new Double_t*[n_Stin];
3186  fCnew++;
3187  fT2d1_hfcc_mostins = new Double_t[n_Stin * n_Stin];
3188  fCnew++;
3189  for (Int_t i0StexStinEcna = 0; i0StexStinEcna < n_Stin; i0StexStinEcna++) {
3190  fT2d_hfcc_mostins[i0StexStinEcna] = &fT2d1_hfcc_mostins[0] + i0StexStinEcna * n_Stin;
3191  }
3192  }
3193 
3194  for (Int_t i0StexStinEcna = 0; i0StexStinEcna < fEcal->MaxStinEcnaInStex(); i0StexStinEcna++) {
3195  for (Int_t j0StexStinEcna = 0; j0StexStinEcna < fEcal->MaxStinEcnaInStex(); j0StexStinEcna++) {
3196  if (fT2d_hfcc_mostins[i0StexStinEcna][j0StexStinEcna] != (Double_t)0) {
3197  fMiscDiag[32]++;
3198  fT2d_hfcc_mostins[i0StexStinEcna][j0StexStinEcna] = (Double_t)0;
3199  }
3200  }
3201  }
3202 
3203  //..... Calculation of the mean HF Cor(c,c) for each pair (Stin_X,Stin_Y)
3204  //
3205  // ! => Warning: this matrix is NOT symmetric => take N*N elements
3206  // Only (Stin,Stin) matrix is symmetric.
3207  // (StinEcha,StinEcha) matrix inside a (Stin,Stin) element is NOT symmetric
3208  // (except for the (Stin,Stin) DIAGONAL elements)
3209  // Then:
3210  // 1D array half_LFccMos[N*N] to put the (channel,channel) correlations
3211 
3212  Int_t ndim = (Int_t)(fEcal->MaxCrysInStin() * fEcal->MaxCrysInStin());
3213 
3214  TVectorD half_HFccMos(ndim);
3215  for (Int_t i = 0; i < ndim; i++) {
3216  half_HFccMos(i) = (Double_t)0.;
3217  }
3218 
3220  std::cout << "*TEcnaRun::HighFrequencyMeanCorrelationsBetweenStins()" << std::endl;
3221  }
3223  std::cout << " Calculation, for each " << fFlagSubDet.Data() << ", of the mean " << std::endl
3224  << " High Frequency cor(c,c)." << std::endl;
3225  }
3226 
3227  //..................... Calculation
3228  for (Int_t i0StexStinEcna = 0; i0StexStinEcna < fEcal->MaxStinEcnaInStex(); i0StexStinEcna++) {
3229  for (Int_t j0StexStinEcna = 0; j0StexStinEcna < fEcal->MaxStinEcnaInStex(); j0StexStinEcna++) {
3230  //.................... Copy the relevant Mean Correlations(c,c') in 1D vector half_HFccMos()
3231  Int_t i_count = 0;
3232  for (Int_t i0StinCrys = 0; i0StinCrys < fEcal->MaxCrysInStin(); i0StinCrys++) {
3233  Int_t i0StexEcha = i0StexStinEcna * fEcal->MaxCrysInStin() + i0StinCrys;
3234  for (Int_t j0StinCrys = 0; j0StinCrys < fEcal->MaxCrysInStin(); j0StinCrys++) {
3235  Int_t j0StexEcha = j0StexStinEcna * fEcal->MaxCrysInStin() + j0StinCrys;
3236  if ((i0StexEcha >= 0 && i0StexEcha < fEcal->MaxCrysEcnaInStex()) &&
3237  (j0StexEcha >= 0 && j0StexEcha < fEcal->MaxCrysEcnaInStex())) {
3238  half_HFccMos(i_count) = fT2d_hf_cor[i0StexEcha][j0StexEcha];
3239  i_count++;
3240  } else {
3241  std::cout << "!TEcnaRun::HighFrequencyMeanCorrelationsBetweenStins()> Channel number out of range."
3242  << "i0StexEcha = " << i0StexEcha << ", j0StexEcha = " << j0StexEcha << fTTBELL << std::endl;
3243  }
3244  }
3245  }
3246  //..... Calculation of the mean absolute values of the HF mean Correlations(c,c')
3247  fT2d_hfcc_mostins[i0StexStinEcna][j0StexStinEcna] = (Double_t)0;
3248  for (Int_t i_rcor = 0; i_rcor < ndim; i_rcor++) {
3249  fT2d_hfcc_mostins[i0StexStinEcna][j0StexStinEcna] += fabs(half_HFccMos(i_rcor));
3250  }
3251  fT2d_hfcc_mostins[i0StexStinEcna][j0StexStinEcna] /= (Double_t)ndim;
3252  }
3253  if (i0StexStinEcna % 10 == 0) {
3254  std::cout << i0StexStinEcna << "[HFN MCtt], ";
3255  }
3256  }
3257  std::cout << std::endl;
3258 
3259  fTagHFccMoStins[0] = 1;
3261 } // ------- end of HighFrequencyMeanCorrelationsBetweenStins() -------
3262 
3263 //=========================================================================
3264 //
3265 // W R I T I N G M E T H O D S
3266 //
3267 //=========================================================================
3268 
3269 //=========================================================================
3270 //
3271 // W R I T I N G M E T H O D S : R O O T F I L E S
3272 //
3273 //=========================================================================
3274 //-------------------------------------------------------------
3275 //
3276 // OpenRootFile
3277 //
3278 //-------------------------------------------------------------
3279 Bool_t TEcnaRun::OpenRootFile(const Text_t* name, const TString& status) {
3280  //Open the Root file
3281 
3282  Bool_t ok_open = kFALSE;
3283 
3284  TString s_name;
3285  s_name = fCnaParPaths->ResultsRootFilePath();
3286  s_name.Append('/');
3287  s_name.Append(name);
3288 
3289  //gCnaRootFile = new TEcnaRootFile(fObjectManager, s_name.Data(), status); fCnew++;
3290 
3291  Long_t iCnaRootFile = fObjectManager->GetPointerValue("TEcnaRootFile");
3292  if (iCnaRootFile == 0) {
3293  gCnaRootFile = new TEcnaRootFile(fObjectManager, s_name.Data(), status); /* Anew("gCnaRootFile");*/
3294  } else {
3295  gCnaRootFile = (TEcnaRootFile*)iCnaRootFile;
3296  gCnaRootFile->ReStart(s_name.Data(), status);
3297  }
3298 
3299  if (gCnaRootFile->fRootFileStatus == "RECREATE") {
3300  ok_open = gCnaRootFile->OpenW();
3301  }
3302  if (gCnaRootFile->fRootFileStatus == "READ") {
3303  ok_open = gCnaRootFile->OpenR();
3304  }
3305 
3306  if (!ok_open) // unable to open file
3307  {
3308  std::cout << "TEcnaRun::OpenRootFile> Cannot open file " << s_name.Data() << std::endl;
3309  } else {
3311  std::cout << "*TEcnaRun::OpenRootFile> Open ROOT file OK for file " << s_name.Data() << std::endl;
3312  }
3313  fOpenRootFile = kTRUE;
3314  }
3315  return ok_open;
3316 }
3317 //-------------------------------------------------------------
3318 //
3319 // CloseRootFile
3320 //
3321 //-------------------------------------------------------------
3322 Bool_t TEcnaRun::CloseRootFile(const Text_t* name) {
3323  //Close the Root file
3324 
3325  TString s_name;
3326  s_name = fCnaParPaths->ResultsRootFilePath();
3327  s_name.Append('/');
3328  s_name.Append(name);
3329 
3330  Bool_t ok_close = kFALSE;
3331 
3332  if (fOpenRootFile == kTRUE) {
3334 
3336  std::cout << "*TEcnaRun::CloseRootFile> ROOT file " << s_name.Data() << " closed." << std::endl;
3337  }
3338 
3339  // delete gCnaRootFile; gCnaRootFile = 0; fCdelete++;
3340 
3341  fOpenRootFile = kFALSE;
3342  ok_close = kTRUE;
3343  } else {
3344  std::cout << "*TEcnaRun::CloseRootFile(...)> No close since no file is open." << fTTBELL << std::endl;
3345  }
3346  return ok_close;
3347 }
3348 //-------------------------------------------------------------
3349 //
3350 // WriteRootFile without arguments.
3351 // Call WriteRootFile WITH argument (file name)
3352 // after an automatic generation of the file name.
3353 //
3354 // Codification for the file name:
3355 // see comment at the beginning of this file
3356 //
3357 //-------------------------------------------------------------
3358 
3359 //=================================================================================
3360 //
3361 // WriteRootFile() ====> D O N ' T S U P P R E S S ! ! !
3362 // Called by the analyzer in package: "Modules"
3363 //
3364 //=================================================================================
3366  //Write the Root file.
3367  //File name automatically generated by fCnaWrite->fMakeResultsFileName()
3368  //previously called in GetReadyToCompute().
3369 
3370  Bool_t ok_write = kFALSE;
3371 
3372  //============================= check number of found events
3373  Int_t nCountEvts = 0;
3374 
3375  for (Int_t i0StexEcha = 0; i0StexEcha < fEcal->MaxCrysEcnaInStex(); i0StexEcha++) {
3376  for (Int_t i0Sample = 0; i0Sample < fFileHeader->fNbOfSamples; i0Sample++) {
3377  nCountEvts += fT2d_NbOfEvts[i0StexEcha][i0Sample];
3378  }
3379  }
3380 
3381  if (nCountEvts <= 0) {
3382  //============== no write if no event found
3383  std::cout << "!TEcnaRun::WriteRootFile()> No event found for file " << fCnaWrite->GetRootFileNameShort().Data()
3384  << ". File will not be written." << std::endl;
3385  ok_write = kTRUE;
3386  } else {
3388  std::cout << "*TEcnaRun::WriteRootFile()> Results are going to be written in the ROOT file: " << std::endl
3389  << " " << fCnaWrite->GetRootFileName().Data() << std::endl;
3390  }
3391 
3392  const Text_t* FileShortName = (const Text_t*)fCnaWrite->GetRootFileNameShort().Data();
3393  ok_write = WriteRootFile(FileShortName, fFileHeader->fNbOfSamples);
3394 
3395  if (ok_write == kTRUE) {
3397  std::cout << "*TEcnaRun::WriteRootFile()> Writing OK for file " << fCnaWrite->GetRootFileName().Data()
3398  << std::endl;
3399  }
3400  } else {
3401  std::cout << "!TEcnaRun::WriteRootFile()> Writing FAILLED for file " << fCnaWrite->GetRootFileName().Data()
3402  << fTTBELL << std::endl;
3403  }
3404  }
3405  return ok_write;
3406 } // end of WriteRootFile()
3407 
3408 //--------------------------------------------------------------------
3409 //
3410 // WriteNewRootFile with argument
3411 // Called by TEcnaGui for results file of the Calculations method
3412 // analysis type and nb of samples changed, other arguments kept
3413 //
3414 //--------------------------------------------------------------------
3415 Bool_t TEcnaRun::WriteNewRootFile(const TString& TypAna) {
3416  //Write a new Root file. File name automatically generated by fCnaWrite->fMakeResultsFileName()
3417  //called here.
3418 
3419  Bool_t ok_write = kFALSE;
3420 
3421  fCnaWrite->RegisterFileParameters(TypAna.Data(),
3427  fFileHeader->fStex,
3432 
3433  fCnaWrite->fMakeResultsFileName(); // set fRootFileName, fRootFileNameShort
3436 
3437  const Text_t* FileShortName = (const Text_t*)fNewRootFileNameShort.Data();
3438 
3440  std::cout << "*TEcnaRun::WriteNewRootFile()> Results are going to be written in the ROOT file: " << std::endl
3441  << " " << fNewRootFileNameShort.Data() << std::endl;
3442  }
3443 
3444  ok_write = WriteRootFile(FileShortName, fNbSampForCalc);
3445 
3446  return ok_write;
3447 }
3448 
3449 //-------------------------------------------------------------------------
3450 //
3451 // Get the new ROOT file name (long and short)
3452 // (called by TEcnaGui in Calculations method)
3453 //
3454 //-------------------------------------------------------------------------
3457 
3458 //--------------------------------------------------------------------
3459 //
3460 // WriteRootFile with argument
3461 //
3462 //--------------------------------------------------------------------
3463 Bool_t TEcnaRun::WriteRootFile(const Text_t* name, Int_t& argNbSampWrite) {
3464  //Write the Root file
3465 
3466  const Text_t* file_name = name;
3467 
3468  Bool_t ok_write = kFALSE;
3469 
3470  if (fOpenRootFile) {
3471  std::cout << "!TEcnaRun::WriteRootFile(...) *** ERROR ***> Writing on file already open." << fTTBELL << std::endl;
3472  } else {
3473  // List of the different element types and associated parameters as ordered in the ROOT file (smaller -> larger)
3474  // ==========
3475  //
3476  // WARNING *** HERE SIZES ARE THESE FOR THE BARREL (1700 Xtals) and for 10 samples ***
3477  //
3478  // Nb of Type of element Type Type Size Comment
3479  // elements Number Name
3480  //
3481  // 1 fMatHis(1,StexStin) ( 0) cTypNumbers 1*( 1, 68) = 68
3482 
3483  // 1 fMatHis(1,StexStin) (12) cTypAvPed 1*( 1, 68) = 68
3484  // 1 fMatHis(1,StexStin) ( 3) cTypAvTno 1*( 1, 68) = 68
3485  // 1 fMatHis(1,StexStin) ( 4) cTypAvLfn 1*( 1, 68) = 68
3486  // 1 fMatHis(1,StexStin) ( 5) cTypAvHfn 1*( 1, 68) = 68
3487  // 1 fMatHis(1,StexStin) (13) cTypAvMeanCorss 1*( 1, 68) = 68
3488  // 1 fMatHis(1,StexStin) (14) cTypAvSigCorss 1*( 1, 68) = 68
3489 
3490  // 1 fMatHis(1,StexEcha) (16) cTypPed 1*( 1,1700) = 1 700
3491  // 1 fMatHis(1,StexEcha) (17) cTypTno 1*( 1,1700) = 1 700
3492  // 1 fMatHis(1,StexEcha) (10) cTypMeanCorss 1*( 1,1700) = 1 700
3493  // 1 fMatHis(1,StexEcha) (18) cTypLfn 1*( 1,1700) = 1 700
3494  // 1 fMatHis(1,StexEcha) (19) cTypHfn 1*( 1,1700) = 1 700
3495  // 1 fMatHis(1,StexEcha) (11) cTypSigCorss 1*( 1,1700) = 1 700
3496 
3497  // 1 fMatMat(Stin,Stin) (23) cTypLFccMoStins 1*( 68, 68) = 4 624
3498  // 1 fMatMat(Stin,Stin) (24) cTypHFccMoStins 1*( 68, 68) = 4 624
3499 
3500  // 1 fMatHis(StexEcha, sample) (15) cTypNbOfEvts 1*(1700, 10) = 17 000
3501  // 1 fMatHis(StexEcha, sample) ( 1) cTypMSp 1*(1700, 10) = 17 000
3502  // 1 fMatHis(StexEcha, sample) ( 2) cTypSSp 1*(1700, 10) = 17 000
3503 
3504  // StexEcha fMatMat(sample, sample) ( 8) cTypCovCss 1700*( 10, 10) = 170 000
3505  // StexEcha fMatMat(sample, sample ( 9) cTypCorCss 1700*( 10, 10) = 170 000
3506 
3507  // StexEcha fMatHis(sample, bin_evt) (20) cTypAdcEvt, 1700*( 10, 150) = 2 550 000
3508 
3509  // 1 fMatMat(StexEcha, StexEcha) (21) cTypLfCov 1*(1700,1700) = 2 890 000
3510  // 1 fMatMat(StexEcha, StexEcha) (22) cTypLfCor 1*(1700,1700) = 2 890 000
3511 
3512  // 1 fMatMat(StexEcha, StexEcha) ( 6) cTypHfCov 1*(1700,1700) = 2 890 000 // (06/05/08)
3513  // 1 fMatMat(StexEcha, StexEcha) ( 7) cTypHfCor 1*(1700,1700) = 2 890 000 // (06/05/08)
3514 
3515  //......................................................................................................
3516 
3517  OpenRootFile(file_name, "RECREATE");
3518 
3519  TString typ_name = "?";
3520  Int_t v_nb_times = 0;
3521  Int_t v_dim_one = 0;
3522  Int_t v_dim_two = 0;
3523  Int_t v_size = 0;
3524  Int_t v_tot = 0;
3525  Int_t v_tot_writ = 0;
3526 
3527  //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3528  //
3529  // ===> no general method and no translation to TEcnaWrite
3530  // because the fT1d.. and fT2d... arrays
3531  // are attributes of TEcnaRun (calls to the "TRootXXXX" methods)
3532  //
3533  //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3534 
3535  //-------------------------- Stin numbers
3536  // 1 fMatHis(1,Stin) ( 0) cTypNumbers 1*( 1, 68) = 68
3537 
3538  Int_t MaxCar = fgMaxCar;
3539  typ_name.Resize(MaxCar);
3540  typ_name = "StinNumbers";
3541  v_nb_times = fFileHeader->fStinNumbersCalc;
3542  v_dim_one = 1;
3543  v_dim_two = fEcal->MaxStinEcnaInStex();
3544  v_size = v_nb_times * v_dim_one * v_dim_two;
3545  v_tot += v_size;
3546 
3548  std::cout << "*TEcnaRun::WriteRootFile(...)> " << std::setw(18) << typ_name << ": " << std::setw(4) << v_nb_times
3549  << " * (" << std::setw(4) << v_dim_one << "," << std::setw(4) << v_dim_two << ") = " << std::setw(9)
3550  << v_size;
3551  }
3552 
3553  for (Int_t i = 0; i < v_nb_times; i++) {
3554  if (fTagStinNumbers[0] == 1) {
3557  gCnaRootFile->fCnaIndivResult->SetSizeHis(v_dim_one, v_dim_two);
3559  TRootStinNumbers();
3560  gCnaRootFile->fCnaResultsTree->Fill();
3561  if (i == 0 && fFlagPrint == fCodePrintAllComments) {
3562  std::cout << " => WRITTEN ON FILE ";
3563  v_tot_writ += v_size;
3564  }
3565  }
3566  }
3568  std::cout << std::endl;
3569  }
3570 
3571  //-------------------------- Average Pedestals (1 value per Stin)
3572  // 1 fMatHis(1, StexStin) (12) cTypAvPed 1*(1, 68) = 68
3573 
3574  MaxCar = fgMaxCar;
3575  typ_name.Resize(MaxCar);
3576  typ_name = "AvPed";
3577  v_nb_times = fFileHeader->fAvPedCalc;
3578  v_dim_one = 1;
3579  v_dim_two = fEcal->MaxStinEcnaInStex();
3580  v_size = v_nb_times * v_dim_one * v_dim_two;
3581  v_tot += v_size;
3582 
3584  std::cout << "*TEcnaRun::WriteRootFile(...)> " << std::setw(18) << typ_name << ": " << std::setw(4) << v_nb_times
3585  << " * (" << std::setw(4) << v_dim_one << "," << std::setw(4) << v_dim_two << ") = " << std::setw(9)
3586  << v_size;
3587  }
3588 
3589  for (Int_t i = 0; i < v_nb_times; i++) {
3590  if (fTagAvPed[0] == 1) {
3593  gCnaRootFile->fCnaIndivResult->SetSizeHis(v_dim_one, v_dim_two);
3595  TRootAvPed();
3596  gCnaRootFile->fCnaResultsTree->Fill();
3597  if (i == 0 && fFlagPrint == fCodePrintAllComments) {
3598  std::cout << " => WRITTEN ON FILE ";
3599  v_tot_writ += v_size;
3600  }
3601  }
3602  }
3604  std::cout << std::endl;
3605  }
3606 
3607  //-------------------------- Average Total noise
3608  // StexEcha fMatHis(1, StexStin) ( 3) cTypAvTno 1*(1, 68) = 68
3609 
3610  MaxCar = fgMaxCar;
3611  typ_name.Resize(MaxCar);
3612  typ_name = "AvTno";
3613  v_nb_times = fFileHeader->fAvTnoCalc;
3614  v_dim_one = 1;
3615  v_dim_two = fEcal->MaxStinEcnaInStex();
3616  v_size = v_nb_times * v_dim_one * v_dim_two;
3617  v_tot += v_size;
3618 
3620  std::cout << "*TEcnaRun::WriteRootFile(...)> " << std::setw(18) << typ_name << ": " << std::setw(4) << v_nb_times
3621  << " * (" << std::setw(4) << v_dim_one << "," << std::setw(4) << v_dim_two << ") = " << std::setw(9)
3622  << v_size;
3623  }
3624 
3625  for (Int_t i = 0; i < v_nb_times; i++) {
3626  if (fTagAvTno[0] == 1) {
3629  gCnaRootFile->fCnaIndivResult->SetSizeHis(v_dim_one, v_dim_two);
3631  TRootAvTno();
3632  gCnaRootFile->fCnaResultsTree->Fill();
3633  if (i == 0 && fFlagPrint == fCodePrintAllComments) {
3634  std::cout << " => WRITTEN ON FILE ";
3635  v_tot_writ += v_size;
3636  }
3637  }
3638  }
3640  std::cout << std::endl;
3641  }
3642 
3643  //-------------------------- Average Low frequency noise
3644  // 1 fMatHis(1, StexStin) ( 4) cTypAvLfn 1*(1, 68) = 68
3645 
3646  MaxCar = fgMaxCar;
3647  typ_name.Resize(MaxCar);
3648  typ_name = "AvLfn";
3649  v_nb_times = fFileHeader->fAvLfnCalc;
3650  v_dim_one = 1;
3651  v_dim_two = fEcal->MaxStinEcnaInStex();
3652  v_size = v_nb_times * v_dim_one * v_dim_two;
3653  v_tot += v_size;
3654 
3656  std::cout << "*TEcnaRun::WriteRootFile(...)> " << std::setw(18) << typ_name << ": " << std::setw(4) << v_nb_times
3657  << " * (" << std::setw(4) << v_dim_one << "," << std::setw(4) << v_dim_two << ") = " << std::setw(9)
3658  << v_size;
3659  }
3660 
3661  for (Int_t i = 0; i < v_nb_times; i++) {
3662  if (fTagAvLfn[0] == 1) {
3665  gCnaRootFile->fCnaIndivResult->SetSizeHis(v_dim_one, v_dim_two);
3667  TRootAvLfn();
3668  gCnaRootFile->fCnaResultsTree->Fill();
3669  if (i == 0 && fFlagPrint == fCodePrintAllComments) {
3670  std::cout << " => WRITTEN ON FILE ";
3671  v_tot_writ += v_size;
3672  }
3673  }
3674  }
3676  std::cout << std::endl;
3677  }
3678 
3679  //-------------------------- Average High frequency noise
3680  // 1 fMatHis(1, StexStin) ( 5) cTypAvHfn 1*(1, 68) = 68
3681 
3682  MaxCar = fgMaxCar;
3683  typ_name.Resize(MaxCar);
3684  typ_name = "AvHfn";
3685  v_nb_times = fFileHeader->fAvHfnCalc;
3686  v_dim_one = 1;
3687  v_dim_two = fEcal->MaxStinEcnaInStex();
3688  v_size = v_nb_times * v_dim_one * v_dim_two;
3689  v_tot += v_size;
3690 
3692  std::cout << "*TEcnaRun::WriteRootFile(...)> " << std::setw(18) << typ_name << ": " << std::setw(4) << v_nb_times
3693  << " * (" << std::setw(4) << v_dim_one << "," << std::setw(4) << v_dim_two << ") = " << std::setw(9)
3694  << v_size;
3695  }
3696 
3697  for (Int_t i = 0; i < v_nb_times; i++) {
3698  if (fTagAvHfn[0] == 1) {
3701  gCnaRootFile->fCnaIndivResult->SetSizeHis(v_dim_one, v_dim_two);
3703  TRootAvHfn();
3704  gCnaRootFile->fCnaResultsTree->Fill();
3705  if (i == 0 && fFlagPrint == fCodePrintAllComments) {
3706  std::cout << " => WRITTEN ON FILE ";
3707  v_tot_writ += v_size;
3708  }
3709  }
3710  }
3712  std::cout << std::endl;
3713  }
3714 
3715  //-------------------------- Average mean cor(s,s)
3716  // 1 fMatHis(1, StexStin) (13) cTypAvMeanCorss 1*(1, 68) = 68
3717 
3718  MaxCar = fgMaxCar;
3719  typ_name.Resize(MaxCar);
3720  typ_name = "AvMeanCorss";
3721  v_nb_times = fFileHeader->fAvMeanCorssCalc;
3722  v_dim_one = 1;
3723  v_dim_two = fEcal->MaxStinEcnaInStex();
3724  v_size = v_nb_times * v_dim_one * v_dim_two;
3725  v_tot += v_size;
3726 
3728  std::cout << "*TEcnaRun::WriteRootFile(...)> " << std::setw(18) << typ_name << ": " << std::setw(4) << v_nb_times
3729  << " * (" << std::setw(4) << v_dim_one << "," << std::setw(4) << v_dim_two << ") = " << std::setw(9)
3730  << v_size;
3731  }
3732 
3733  for (Int_t i = 0; i < v_nb_times; i++) {
3734  if (fTagAvMeanCorss[0] == 1) {
3737  gCnaRootFile->fCnaIndivResult->SetSizeHis(v_dim_one, v_dim_two);
3739  TRootAvEvCorss();
3740  gCnaRootFile->fCnaResultsTree->Fill();
3741  if (i == 0 && fFlagPrint == fCodePrintAllComments) {
3742  std::cout << " => WRITTEN ON FILE ";
3743  v_tot_writ += v_size;
3744  }
3745  }
3746  }
3748  std::cout << std::endl;
3749  }
3750 
3751  //-------------------------- Average sigma of cor(s,s)
3752  // 1 fMatHis(1, StexStin) (14) cTypAvSigCorss 1*(1, 68) = 68
3753 
3754  MaxCar = fgMaxCar;
3755  typ_name.Resize(MaxCar);
3756  typ_name = "AvSigCorss";
3757  v_nb_times = fFileHeader->fAvSigCorssCalc;
3758  v_dim_one = 1;
3759  v_dim_two = fEcal->MaxStinEcnaInStex();
3760  v_size = v_nb_times * v_dim_one * v_dim_two;
3761  v_tot += v_size;
3762 
3764  std::cout << "*TEcnaRun::WriteRootFile(...)> " << std::setw(18) << typ_name << ": " << std::setw(4) << v_nb_times
3765  << " * (" << std::setw(4) << v_dim_one << "," << std::setw(4) << v_dim_two << ") = " << std::setw(9)
3766  << v_size;
3767  }
3768 
3769  for (Int_t i = 0; i < v_nb_times; i++) {
3770  if (fTagAvSigCorss[0] == 1) {
3773  gCnaRootFile->fCnaIndivResult->SetSizeHis(v_dim_one, v_dim_two);
3775  TRootAvSigCorss();
3776  gCnaRootFile->fCnaResultsTree->Fill();
3777  if (i == 0 && fFlagPrint == fCodePrintAllComments) {
3778  std::cout << " => WRITTEN ON FILE ";
3779  v_tot_writ += v_size;
3780  }
3781  }
3782  }
3784  std::cout << std::endl;
3785  }
3786 
3787  //-------------------------- Expectation values of the expectation values of the samples (pedestals)
3788  // 1 fMatHis(1,StexEcha) (16) cTypPed 1*( 1,1700) = 1 700
3789 
3790  MaxCar = fgMaxCar;
3791  typ_name.Resize(MaxCar);
3792  typ_name = "Ped";
3793  v_nb_times = fFileHeader->fPedCalc;
3794  v_dim_one = 1;
3795  v_dim_two = fEcal->MaxCrysEcnaInStex();
3796  v_size = v_nb_times * v_dim_one * v_dim_two;
3797  v_tot += v_size;
3798 
3800  std::cout << "*TEcnaRun::WriteRootFile(...)> " << std::setw(18) << typ_name << ": " << std::setw(4) << v_nb_times
3801  << " * (" << std::setw(4) << v_dim_one << "," << std::setw(4) << v_dim_two << ") = " << std::setw(9)
3802  << v_size;
3803  }
3804 
3805  for (Int_t i = 0; i < v_nb_times; i++) {
3806  if (fTagPed[0] == 1) {
3809  gCnaRootFile->fCnaIndivResult->SetSizeHis(v_dim_one, v_dim_two);
3811  TRootPed();
3812  gCnaRootFile->fCnaResultsTree->Fill();
3813  if (i == 0 && fFlagPrint == fCodePrintAllComments) {
3814  std::cout << " => WRITTEN ON FILE ";
3815  v_tot_writ += v_size;
3816  }
3817  }
3818  }
3820  std::cout << std::endl;
3821  }
3822 
3823  //-------------------------- Expectation values of the sigmas the samples
3824  // 1 fMatHis(1,StexEcha) (17) cTypTno 1*( 1,1700) = 1 700
3825 
3826  MaxCar = fgMaxCar;
3827  typ_name.Resize(MaxCar);
3828  typ_name = "Tno";
3829  v_nb_times = fFileHeader->fTnoCalc;
3830  v_dim_one = 1;
3831  v_dim_two = fEcal->MaxCrysEcnaInStex();
3832  v_size = v_nb_times * v_dim_one * v_dim_two;
3833  v_tot += v_size;
3834 
3836  std::cout << "*TEcnaRun::WriteRootFile(...)> " << std::setw(18) << typ_name << ": " << std::setw(4) << v_nb_times
3837  << " * (" << std::setw(4) << v_dim_one << "," << std::setw(4) << v_dim_two << ") = " << std::setw(9)
3838  << v_size;
3839  }
3840 
3841  for (Int_t i = 0; i < v_nb_times; i++) {
3842  if (fTagTno[0] == 1) {
3845  gCnaRootFile->fCnaIndivResult->SetSizeHis(v_dim_one, v_dim_two);
3847  TRootTno();
3848  gCnaRootFile->fCnaResultsTree->Fill();
3849  if (i == 0 && fFlagPrint == fCodePrintAllComments) {
3850  std::cout << " => WRITTEN ON FILE ";
3851  v_tot_writ += v_size;
3852  }
3853  }
3854  }
3856  std::cout << std::endl;
3857  }
3858 
3859  //-------------------------- Expectation values of the correlations between the samples
3860  // 1 fMatHis(1,StexEcha) (10) cTypMeanCorss 1*( 1,1700) = 1 700
3861 
3862  MaxCar = fgMaxCar;
3863  typ_name.Resize(MaxCar);
3864  typ_name = "MeanCorss";
3865  v_nb_times = fFileHeader->fMeanCorssCalc;
3866  v_dim_one = 1;
3867  v_dim_two = fEcal->MaxCrysEcnaInStex();
3868  v_size = v_nb_times * v_dim_one * v_dim_two;
3869  v_tot += v_size;
3870 
3872  std::cout << "*TEcnaRun::WriteRootFile(...)> " << std::setw(18) << typ_name << ": " << std::setw(4) << v_nb_times
3873  << " * (" << std::setw(4) << v_dim_one << "," << std::setw(4) << v_dim_two << ") = " << std::setw(9)
3874  << v_size;
3875  }
3876 
3877  for (Int_t i = 0; i < v_nb_times; i++) {
3878  if (fTagMeanCorss[0] == 1) {
3881  gCnaRootFile->fCnaIndivResult->SetSizeHis(v_dim_one, v_dim_two);
3883  TRootMeanCorss();
3884  gCnaRootFile->fCnaResultsTree->Fill();
3885  if (i == 0 && fFlagPrint == fCodePrintAllComments) {
3886  std::cout << " => WRITTEN ON FILE ";
3887  v_tot_writ += v_size;
3888  }
3889  }
3890  }
3892  std::cout << std::endl;
3893  }
3894 
3895  //-------------------------- Sigmas of the expectation values of the samples
3896  // 1 fMatHis(1,StexEcha) (18) cTypLfn 1*( 1,1700) = 1 700
3897 
3898  MaxCar = fgMaxCar;
3899  typ_name.Resize(MaxCar);
3900  typ_name = "Lfn";
3901  v_nb_times = fFileHeader->fLfnCalc;
3902  v_dim_one = 1;
3903  v_dim_two = fEcal->MaxCrysEcnaInStex();
3904  v_size = v_nb_times * v_dim_one * v_dim_two;
3905  v_tot += v_size;
3906 
3908  std::cout << "*TEcnaRun::WriteRootFile(...)> " << std::setw(18) << typ_name << ": " << std::setw(4) << v_nb_times
3909  << " * (" << std::setw(4) << v_dim_one << "," << std::setw(4) << v_dim_two << ") = " << std::setw(9)
3910  << v_size;
3911  }
3912 
3913  for (Int_t i = 0; i < v_nb_times; i++) {
3914  if (fTagLfn[0] == 1) {
3917  gCnaRootFile->fCnaIndivResult->SetSizeHis(v_dim_one, v_dim_two);
3919  TRootLfn();
3920  gCnaRootFile->fCnaResultsTree->Fill();
3921  if (i == 0 && fFlagPrint == fCodePrintAllComments) {
3922  std::cout << " => WRITTEN ON FILE ";
3923  v_tot_writ += v_size;
3924  }
3925  }
3926  }
3928  std::cout << std::endl;
3929  }
3930 
3931  //-------------------------- Sigmas of the sigmas of the samples
3932  // 1 fMatHis(1,StexEcha) (19) cTypHfn 1*( 1,1700) = 1 700
3933 
3934  MaxCar = fgMaxCar;
3935  typ_name.Resize(MaxCar);
3936  typ_name = "Hfn";
3937  v_nb_times = fFileHeader->fHfnCalc;
3938  v_dim_one = 1;
3939  v_dim_two = fEcal->MaxCrysEcnaInStex();
3940  v_size = v_nb_times * v_dim_one * v_dim_two;
3941  v_tot += v_size;
3942 
3944  std::cout << "*TEcnaRun::WriteRootFile(...)> " << std::setw(18) << typ_name << ": " << std::setw(4) << v_nb_times
3945  << " * (" << std::setw(4) << v_dim_one << "," << std::setw(4) << v_dim_two << ") = " << std::setw(9)
3946  << v_size;
3947  }
3948 
3949  for (Int_t i = 0; i < v_nb_times; i++) {
3950  if (fTagHfn[0] == 1) {
3953  gCnaRootFile->fCnaIndivResult->SetSizeHis(v_dim_one, v_dim_two);
3955  TRootHfn();
3956  gCnaRootFile->fCnaResultsTree->Fill();
3957  if (i == 0 && fFlagPrint == fCodePrintAllComments) {
3958  std::cout << " => WRITTEN ON FILE ";
3959  v_tot_writ += v_size;
3960  }
3961  }
3962  }
3964  std::cout << std::endl;
3965  }
3966 
3967  //-------------------------- Sigmas of the correlations between the samples
3968  // 1 fMatHis(1,StexEcha) (11) cTypSigCorss 1*( 1,1700) = 1 700
3969 
3970  MaxCar = fgMaxCar;
3971  typ_name.Resize(MaxCar);
3972  typ_name = "SigCorss";
3973  v_nb_times = fFileHeader->fSigCorssCalc;
3974  v_dim_one = 1;
3975  v_dim_two = fEcal->MaxCrysEcnaInStex();
3976  v_size = v_nb_times * v_dim_one * v_dim_two;
3977  v_tot += v_size;
3978 
3980  std::cout << "*TEcnaRun::WriteRootFile(...)> " << std::setw(18) << typ_name << ": " << std::setw(4) << v_nb_times
3981  << " * (" << std::setw(4) << v_dim_one << "," << std::setw(4) << v_dim_two << ") = " << std::setw(9)
3982  << v_size;
3983  }
3984 
3985  for (Int_t i = 0; i < v_nb_times; i++) {
3986  if (fTagSigCorss[0] == 1) {
3989  gCnaRootFile->fCnaIndivResult->SetSizeHis(v_dim_one, v_dim_two);
3991  TRootSigCorss();
3992  gCnaRootFile->fCnaResultsTree->Fill();
3993  if (i == 0 && fFlagPrint == fCodePrintAllComments) {
3994  std::cout << " => WRITTEN ON FILE ";
3995  v_tot_writ += v_size;
3996  }
3997  }
3998  }
4000  std::cout << std::endl;
4001  }
4002 
4003  //----- Mean Covariances between StexEchas (averaged over samples) for all (Stin_X,Stin_Y)
4004  // 1 fMatMat(Stin,Stin) (23) cTypLFccMoStins 1*( 68, 68) = 4 624
4005 
4006  MaxCar = fgMaxCar;
4007  typ_name.Resize(MaxCar);
4008  typ_name = "LFccMoStins";
4009  v_nb_times = fFileHeader->fLFccMoStinsCalc;
4010  v_dim_one = fEcal->MaxStinEcnaInStex();
4011  v_dim_two = fEcal->MaxStinEcnaInStex();
4012  v_size = v_nb_times * v_dim_one * v_dim_two;
4013  v_tot += v_size;
4014 
4016  std::cout << "*TEcnaRun::WriteRootFile(...)> " << std::setw(18) << typ_name << ": " << std::setw(4) << v_nb_times
4017  << " * (" << std::setw(4) << v_dim_one << "," << std::setw(4) << v_dim_two << ") = " << std::setw(9)
4018  << v_size;
4019  }
4020 
4021  for (Int_t i = 0; i < v_nb_times; i++) {
4022  if (fTagLFccMoStins[0] == 1) {
4025  gCnaRootFile->fCnaIndivResult->SetSizeMat(v_dim_one, v_dim_two);
4027  TRootLFccMoStins();
4028  gCnaRootFile->fCnaResultsTree->Fill();
4029  if (i == 0 && fFlagPrint == fCodePrintAllComments) {
4030  std::cout << " => WRITTEN ON FILE ";
4031  v_tot_writ += v_size;
4032  }
4033  }
4034  }
4036  std::cout << std::endl;
4037  }
4038 
4039  //----- Mean Correlations between StexEchas (averaged over samples) for all (Stin_X,Stin_Y)
4040  // 1 fMatMat(Stin,Stin) (24) cTypHFccMoStins 1*( 68, 68) = 4 624
4041 
4042  MaxCar = fgMaxCar;
4043  typ_name.Resize(MaxCar);
4044  typ_name = "HFccMoStins";
4045  v_nb_times = fFileHeader->fHFccMoStinsCalc;
4046  v_dim_one = fEcal->MaxStinEcnaInStex();
4047  v_dim_two = fEcal->MaxStinEcnaInStex();
4048  v_size = v_nb_times * v_dim_one * v_dim_two;
4049  v_tot += v_size;
4050 
4052  std::cout << "*TEcnaRun::WriteRootFile(...)> " << std::setw(18) << typ_name << ": " << std::setw(4) << v_nb_times
4053  << " * (" << std::setw(4) << v_dim_one << "," << std::setw(4) << v_dim_two << ") = " << std::setw(9)
4054  << v_size;
4055  }
4056 
4057  for (Int_t i = 0; i < v_nb_times; i++) {
4058  if (fTagHFccMoStins[0] == 1) {
4061  gCnaRootFile->fCnaIndivResult->SetSizeMat(v_dim_one, v_dim_two);
4063  TRootHFccMoStins();
4064  gCnaRootFile->fCnaResultsTree->Fill();
4065  if (i == 0 && fFlagPrint == fCodePrintAllComments) {
4066  std::cout << " => WRITTEN ON FILE ";
4067  v_tot_writ += v_size;
4068  }
4069  }
4070  }
4072  std::cout << std::endl;
4073  }
4074 
4075  //-------------------------- Numbers of found events (NbOfEvts)
4076  // 1 fMatHis(StexEcha, sample) (15) cTypNbOfEvts 1*(1700, 10) = 17 000
4077 
4078  MaxCar = fgMaxCar;
4079  typ_name.Resize(MaxCar);
4080  typ_name = "NbOfEvts";
4081  v_nb_times = fFileHeader->fNbOfEvtsCalc;
4082  v_dim_one = fEcal->MaxCrysEcnaInStex();
4083  v_dim_two = argNbSampWrite;
4084  v_size = v_nb_times * v_dim_one * v_dim_two;
4085  v_tot += v_size;
4086 
4088  std::cout << "*TEcnaRun::WriteRootFile(...)> " << std::setw(18) << typ_name << ": " << std::setw(4) << v_nb_times
4089  << " * (" << std::setw(4) << v_dim_one << "," << std::setw(4) << v_dim_two << ") = " << std::setw(9)
4090  << v_size;
4091  }
4092 
4093  for (Int_t i = 0; i < v_nb_times; i++) {
4094  if (fTagNbOfEvts[0] == 1) {
4097  gCnaRootFile->fCnaIndivResult->SetSizeHis(v_dim_one, v_dim_two);
4099  TRootNbOfEvts(argNbSampWrite);
4100  gCnaRootFile->fCnaResultsTree->Fill();
4101  if (i == 0 && fFlagPrint == fCodePrintAllComments) {
4102  std::cout << " => WRITTEN ON FILE ";
4103  v_tot_writ += v_size;
4104  }
4105  }
4106  }
4108  std::cout << std::endl;
4109  }
4110 
4111  //-------------------------- Expectation values of the samples
4112  // 1 fMatHis(StexEcha, sample) ( 1) cTypMSp 1*(1700, 10) = 17 000
4113 
4114  MaxCar = fgMaxCar;
4115  typ_name.Resize(MaxCar);
4116  typ_name = "MSp";
4117  v_nb_times = fFileHeader->fMSpCalc;
4118  v_dim_one = fEcal->MaxCrysEcnaInStex();
4119  v_dim_two = argNbSampWrite;
4120  v_size = v_nb_times * v_dim_one * v_dim_two;
4121  v_tot += v_size;
4122 
4124  std::cout << "*TEcnaRun::WriteRootFile(...)> " << std::setw(18) << typ_name << ": " << std::setw(4) << v_nb_times
4125  << " * (" << std::setw(4) << v_dim_one << "," << std::setw(4) << v_dim_two << ") = " << std::setw(9)
4126  << v_size;
4127  }
4128 
4129  for (Int_t i = 0; i < v_nb_times; i++) {
4130  if (fTagMSp[0] == 1) {
4133  gCnaRootFile->fCnaIndivResult->SetSizeHis(v_dim_one, v_dim_two);
4135  TRootMSp(argNbSampWrite);
4136  gCnaRootFile->fCnaResultsTree->Fill();
4137  if (i == 0 && fFlagPrint == fCodePrintAllComments) {
4138  std::cout << " => WRITTEN ON FILE ";
4139  v_tot_writ += v_size;
4140  }
4141  }
4142  }
4144  std::cout << std::endl;
4145  }
4146 
4147  //-------------------------- Sigmas of the samples
4148  // 1 fMatHis(StexEcha, sample) ( 2) cTypSSp 1*(1700, 10) = 17 000
4149 
4150  MaxCar = fgMaxCar;
4151  typ_name.Resize(MaxCar);
4152  typ_name = "SSp";
4153  v_nb_times = fFileHeader->fSSpCalc;
4154  v_dim_one = fEcal->MaxCrysEcnaInStex();
4155  v_dim_two = argNbSampWrite;
4156  v_size = v_nb_times * v_dim_one * v_dim_two;
4157  v_tot += v_size;
4158 
4160  std::cout << "*TEcnaRun::WriteRootFile(...)> " << std::setw(18) << typ_name << ": " << std::setw(4) << v_nb_times
4161  << " * (" << std::setw(4) << v_dim_one << "," << std::setw(4) << v_dim_two << ") = " << std::setw(9)
4162  << v_size;
4163  }
4164 
4165  for (Int_t i = 0; i < v_nb_times; i++) {
4166  if (fTagSSp[0] == 1) {
4169  gCnaRootFile->fCnaIndivResult->SetSizeHis(v_dim_one, v_dim_two);
4171  TRootSSp(argNbSampWrite);
4172  gCnaRootFile->fCnaResultsTree->Fill();
4173  if (i == 0 && fFlagPrint == fCodePrintAllComments) {
4174  std::cout << " => WRITTEN ON FILE ";
4175  v_tot_writ += v_size;
4176  }
4177  }
4178  }
4180  std::cout << std::endl;
4181  }
4182 
4183  //-------------------------- Covariances between samples
4184 
4185  // StexEcha fMatMat(sample, sample) ( 8) cTypCovCss 1700*( 10, 10) = 170 000
4186 
4187  MaxCar = fgMaxCar;
4188  typ_name.Resize(MaxCar);
4189  typ_name = "CovCss";
4190  v_nb_times = fFileHeader->fCovCssCalc;
4191  v_dim_one = argNbSampWrite;
4192  v_dim_two = argNbSampWrite;
4193  v_size = v_nb_times * v_dim_one * v_dim_two;
4194  v_tot += v_size;
4195 
4197  std::cout << "*TEcnaRun::WriteRootFile(...)> " << std::setw(18) << typ_name << ": " << std::setw(4) << v_nb_times
4198  << " * (" << std::setw(4) << v_dim_one << "," << std::setw(4) << v_dim_two << ") = " << std::setw(9)
4199  << v_size;
4200  }
4201 
4202  for (Int_t i0StexEcha = 0; i0StexEcha < v_nb_times; i0StexEcha++) {
4203  if (fTagCovCss[i0StexEcha] == 1) {
4205  gCnaRootFile->fCnaIndivResult->fIthElement = i0StexEcha;
4206  gCnaRootFile->fCnaIndivResult->SetSizeMat(v_dim_one, v_dim_two);
4208  TRootCovCss(i0StexEcha, argNbSampWrite);
4209  gCnaRootFile->fCnaResultsTree->Fill();
4210  if (i0StexEcha == 0 && fFlagPrint == fCodePrintAllComments) {
4211  std::cout << " => WRITTEN ON FILE ";
4212  v_tot_writ += v_size;
4213  }
4214  }
4215  }
4217  std::cout << std::endl;
4218  }
4219 
4220  //-------------------------- Correlations between samples
4221  // StexEcha fMatMat(sample, sample) ( 9) cTypCorCss 1700*( 10, 10) = 170 000
4222 
4223  MaxCar = fgMaxCar;
4224  typ_name.Resize(MaxCar);
4225  typ_name = "CorCss";
4226  v_nb_times = fFileHeader->fCorCssCalc;
4227  v_dim_one = argNbSampWrite;
4228  v_dim_two = argNbSampWrite;
4229  v_size = v_nb_times * v_dim_one * v_dim_two;
4230  v_tot += v_size;
4231 
4233  std::cout << "*TEcnaRun::WriteRootFile(...)> " << std::setw(18) << typ_name << ": " << std::setw(4) << v_nb_times
4234  << " * (" << std::setw(4) << v_dim_one << "," << std::setw(4) << v_dim_two << ") = " << std::setw(9)
4235  << v_size;
4236  }
4237 
4238  for (Int_t i0StexEcha = 0; i0StexEcha < v_nb_times; i0StexEcha++) {
4239  if (fTagCorCss[i0StexEcha] == 1) {
4241  gCnaRootFile->fCnaIndivResult->fIthElement = i0StexEcha;
4242  gCnaRootFile->fCnaIndivResult->SetSizeMat(v_dim_one, v_dim_two);
4244  TRootCorCss(i0StexEcha, argNbSampWrite);
4245  gCnaRootFile->fCnaResultsTree->Fill();
4246  if (i0StexEcha == 0 && fFlagPrint == fCodePrintAllComments) {
4247  std::cout << " => WRITTEN ON FILE ";
4248  v_tot_writ += v_size;
4249  }
4250  }
4251  }
4253  std::cout << std::endl;
4254  }
4255 
4256  //-------------------------- Samples as a function of event = events distributions
4257  // StexEcha fMatHis(sample, bins) (20) cTypAdcEvt, 1700*( 10, 150) = 2 550 000
4258 
4259  MaxCar = fgMaxCar;
4260  typ_name.Resize(MaxCar);
4261  typ_name = "AdcEvt";
4262  v_nb_times = fFileHeader->fAdcEvtCalc;
4263  v_dim_one = argNbSampWrite;
4264  v_dim_two = fFileHeader->fReqNbOfEvts;
4265  v_size = v_nb_times * v_dim_one * v_dim_two;
4266  v_tot += v_size;
4267 
4269  std::cout << "*TEcnaRun::WriteRootFile(...)> " << std::setw(18) << typ_name << ": " << std::setw(4) << v_nb_times
4270  << " * (" << std::setw(4) << v_dim_one << "," << std::setw(4) << v_dim_two << ") = " << std::setw(9)
4271  << v_size;
4272  }
4273 
4274  for (Int_t i0StexEcha = 0; i0StexEcha < v_nb_times; i0StexEcha++) {
4275  if (fTagAdcEvt[i0StexEcha] == 1) {
4277  gCnaRootFile->fCnaIndivResult->fIthElement = i0StexEcha;
4278  gCnaRootFile->fCnaIndivResult->SetSizeHis(v_dim_one, v_dim_two);
4280  TRootAdcEvt(i0StexEcha, argNbSampWrite);
4281  gCnaRootFile->fCnaResultsTree->Fill();
4282  if (i0StexEcha == 0 && fFlagPrint == fCodePrintAllComments) {
4283  std::cout << " => WRITTEN ON FILE ";
4284  v_tot_writ += v_size;
4285  }
4286  }
4287  }
4289  std::cout << std::endl;
4290  }
4291 
4292  //-------------------------- Low Frequency Covariances between StexEchas
4293  // sample fMatMat(StexEcha, StexEcha) (21) cTypLfCov 1*(1700,1700) = 2 890 000
4294 
4295  MaxCar = fgMaxCar;
4296  typ_name.Resize(MaxCar);
4297  typ_name = "LfCov";
4298  v_nb_times = fFileHeader->fLfCovCalc;
4299  v_dim_one = fEcal->MaxCrysEcnaInStex();
4300  v_dim_two = fEcal->MaxCrysEcnaInStex();
4301  v_size = v_nb_times * v_dim_one * v_dim_two;
4302  v_tot += v_size;
4303 
4305  std::cout << "*TEcnaRun::WriteRootFile(...)> " << std::setw(18) << typ_name << ": " << std::setw(4) << v_nb_times
4306  << " * (" << std::setw(4) << v_dim_one << "," << std::setw(4) << v_dim_two << ") = " << std::setw(9)
4307  << v_size;
4308  }
4309 
4310  for (Int_t i = 0; i < v_nb_times; i++) { //=================================== Record type EB
4311  if (fTagLfCov[0] == 1) {
4314  gCnaRootFile->fCnaIndivResult->SetSizeMat(v_dim_one, v_dim_two);
4316  TRootLfCov();
4317  gCnaRootFile->fCnaResultsTree->Fill();
4318  if (i == 0 && fFlagPrint == fCodePrintAllComments) {
4319  std::cout << " => WRITTEN ON FILE ";
4320  v_tot_writ += v_size;
4321  }
4322  }
4323  }
4325  std::cout << std::endl;
4326  }
4327 
4328  //-------------------------- Low Frequency Correlations between StexEchas
4329  // sample fMatMat(StexEcha, StexEcha) (22) cTypLfCor 1*(1700,1700) = 2 890 000
4330 
4331  MaxCar = fgMaxCar;
4332  typ_name.Resize(MaxCar);
4333  typ_name = "LfCor";
4334  v_nb_times = fFileHeader->fLfCorCalc;
4335  v_dim_one = fEcal->MaxCrysEcnaInStex();
4336  v_dim_two = fEcal->MaxCrysEcnaInStex();
4337  v_size = v_nb_times * v_dim_one * v_dim_two;
4338  v_tot += v_size;
4339 
4341  std::cout << "*TEcnaRun::WriteRootFile(...)> " << std::setw(18) << typ_name << ": " << std::setw(4) << v_nb_times
4342  << " * (" << std::setw(4) << v_dim_one << "," << std::setw(4) << v_dim_two << ") = " << std::setw(9)
4343  << v_size;
4344  }
4345 
4346  for (Int_t i = 0; i < v_nb_times; i++) {
4347  if (fTagLfCor[0] == 1) {
4350  gCnaRootFile->fCnaIndivResult->SetSizeMat(v_dim_one, v_dim_two);
4352  TRootLfCor();
4353  gCnaRootFile->fCnaResultsTree->Fill();
4354  if (i == 0 && fFlagPrint == fCodePrintAllComments) {
4355  std::cout << " => WRITTEN ON FILE ";
4356  v_tot_writ += v_size;
4357  }
4358  }
4359  }
4361  std::cout << std::endl;
4362  }
4363 
4364  //-------------------------- High Frequency Covariances between StexEchas
4365  // sample fMatMat(StexEcha, StexEcha) (6) cTypHfCov 1*(1700,1700) = 2 890 000
4366 
4367  MaxCar = fgMaxCar;
4368  typ_name.Resize(MaxCar);
4369  typ_name = "HfCov";
4370  v_nb_times = fFileHeader->fHfCovCalc;
4371  v_dim_one = fEcal->MaxCrysEcnaInStex();
4372  v_dim_two = fEcal->MaxCrysEcnaInStex();
4373  v_size = v_nb_times * v_dim_one * v_dim_two;
4374  v_tot += v_size;
4375 
4377  std::cout << "*TEcnaRun::WriteRootFile(...)> " << std::setw(18) << typ_name << ": " << std::setw(4) << v_nb_times
4378  << " * (" << std::setw(4) << v_dim_one << "," << std::setw(4) << v_dim_two << ") = " << std::setw(9)
4379  << v_size;
4380  }
4381 
4382  for (Int_t i = 0; i < v_nb_times; i++) {
4383  if (fTagHfCov[0] == 1) {
4386  gCnaRootFile->fCnaIndivResult->SetSizeMat(v_dim_one, v_dim_two);
4388  TRootHfCov();
4389  gCnaRootFile->fCnaResultsTree->Fill();
4390  if (i == 0 && fFlagPrint == fCodePrintAllComments) {
4391  std::cout << " => WRITTEN ON FILE ";
4392  v_tot_writ += v_size;
4393  }
4394  }
4395  }
4397  std::cout << std::endl;
4398  }
4399 
4400  //-------------------------- High Frequency Correlations between StexEchas
4401  // sample fMatMat(StexEcha, StexEcha) (7) cTypHfCor 1*(1700,1700) = 2 890 000
4402 
4403  MaxCar = fgMaxCar;
4404  typ_name.Resize(MaxCar);
4405  typ_name = "HfCor";
4406  v_nb_times = fFileHeader->fHfCorCalc;
4407  v_dim_one = fEcal->MaxCrysEcnaInStex();
4408  v_dim_two = fEcal->MaxCrysEcnaInStex();
4409  v_size = v_nb_times * v_dim_one * v_dim_two;
4410  v_tot += v_size;
4411 
4413  std::cout << "*TEcnaRun::WriteRootFile(...)> " << std::setw(18) << typ_name << ": " << std::setw(4) << v_nb_times
4414  << " * (" << std::setw(4) << v_dim_one << "," << std::setw(4) << v_dim_two << ") = " << std::setw(9)
4415  << v_size;
4416  }
4417 
4418  for (Int_t i = 0; i < v_nb_times; i++) {
4419  if (fTagHfCor[0] == 1) {
4422  gCnaRootFile->fCnaIndivResult->SetSizeMat(v_dim_one, v_dim_two);
4424  TRootHfCor();
4425  gCnaRootFile->fCnaResultsTree->Fill();
4426  if (i == 0 && fFlagPrint == fCodePrintAllComments) {
4427  std::cout << " => WRITTEN ON FILE ";
4428  v_tot_writ += v_size;
4429  }
4430  }
4431  }
4433  std::cout << std::endl;
4434  }
4435 
4436  //---------------------------------------------- WRITING
4437  //...................................... file
4438  gCnaRootFile->fRootFile->Write();
4439  //...................................... header
4440  fFileHeader->Write();
4441 
4442  //...................................... status message
4444  std::cout << "*TEcnaRun::WriteRootFile(...)> " << std::setw(20) << "TOTAL: " << std::setw(21)
4445  << "CALCULATED = " << std::setw(9) << v_tot << " => WRITTEN ON FILE = " << std::setw(9) << v_tot_writ
4446  << std::endl;
4447  }
4448 
4450  std::cout << "*TEcnaRun::WriteRootFile(...)> Write OK in file " << file_name << " in directory:" << std::endl
4451  << " " << fCnaParPaths->ResultsRootFilePath().Data() << std::endl;
4452  }
4453 
4454  ok_write = kTRUE;
4455 
4456  //...................................... close
4458  }
4459  return ok_write;
4460 } //-------------- End of WriteRootFile(...) -----------------------
4461 
4462 //======================== "PREPA FILL" METHODS ===========================
4463 
4464 //-------------------------------------------------------------------------
4465 //
4466 // Prepa Fill Stin numbers as a function of the Stin index
4467 // (for writing in the ROOT file)
4468 //
4469 //-------------------------------------------------------------------------
4471  if (fTagStinNumbers[0] == 1) {
4472  for (Int_t j0StexStinEcna = 0; j0StexStinEcna < fEcal->MaxStinEcnaInStex(); j0StexStinEcna++) {
4473  gCnaRootFile->fCnaIndivResult->fMatHis(0, j0StexStinEcna) = fT1d_StexStinFromIndex[j0StexStinEcna];
4474  }
4475  }
4476 }
4477 
4478 //-------------------------------------------------------------------------
4479 //
4480 // Prepa Fill last evt numbers for all the (StexEcha,sample)
4481 // (for writing in the ROOT file)
4482 //
4483 //-------------------------------------------------------------------------
4484 void TEcnaRun::TRootNbOfEvts(const Int_t& argNbSampWrite) {
4485  if (fTagNbOfEvts[0] == 1) {
4486  for (Int_t j0StexEcha = 0; j0StexEcha < fEcal->MaxCrysEcnaInStex(); j0StexEcha++) {
4487  for (Int_t i0Sample = 0; i0Sample < argNbSampWrite; i0Sample++) {
4488  gCnaRootFile->fCnaIndivResult->fMatHis(j0StexEcha, i0Sample) = fT2d_NbOfEvts[j0StexEcha][i0Sample];
4489  }
4490  }
4491  }
4492 }
4493 
4494 //-------------------------------------------------------------------------
4495 //
4496 // Prepa Fill histogram of samples as a function of event
4497 // (for writing in the ROOT file)
4498 //
4499 //-------------------------------------------------------------------------
4500 void TEcnaRun::TRootAdcEvt(const Int_t& user_StexEcha, const Int_t& argNbSampWrite) {
4501  if (fTagAdcEvt[user_StexEcha] == 1) {
4502  for (Int_t i0Sample = 0; i0Sample < argNbSampWrite; i0Sample++) {
4503  //...................... all the bins set to zero
4504  for (Int_t j_bin = 0; j_bin < fFileHeader->fReqNbOfEvts; j_bin++) {
4505  gCnaRootFile->fCnaIndivResult->fMatHis(i0Sample, j_bin) = (Double_t)0.;
4506  }
4507  //...................... fill the non-zero bins
4508  for (Int_t j_bin = 0; j_bin < fFileHeader->fReqNbOfEvts; j_bin++) {
4509  gCnaRootFile->fCnaIndivResult->fMatHis(i0Sample, j_bin) = fT3d_AdcValues[user_StexEcha][i0Sample][j_bin];
4510  }
4511  }
4512  }
4513 }
4514 
4515 //-------------------------------------------------------------------------
4516 //
4517 // Prepa Fill expectation values of the samples for all the StexEchas
4518 // (for writing in the ROOT file)
4519 //
4520 //-------------------------------------------------------------------------
4521 void TEcnaRun::TRootMSp(const Int_t& argNbSampWrite) {
4522  if (fTagMSp[0] == 1) {
4523  for (Int_t j0StexEcha = 0; j0StexEcha < fEcal->MaxCrysEcnaInStex(); j0StexEcha++) {
4524  for (Int_t i0Sample = 0; i0Sample < argNbSampWrite; i0Sample++) {
4525  gCnaRootFile->fCnaIndivResult->fMatHis(j0StexEcha, i0Sample) = fT2d_ev[j0StexEcha][i0Sample];
4526  }
4527  }
4528  }
4529 }
4530 
4531 //-------------------------------------------------------------------------
4532 //
4533 // Prepa Fill sigmas of the samples for all the StexEchas
4534 // (for writing in the ROOT file)
4535 //
4536 //-------------------------------------------------------------------------
4537 void TEcnaRun::TRootSSp(const Int_t& argNbSampWrite) {
4538  if (fTagSSp[0] == 1) {
4539  for (Int_t j0StexEcha = 0; j0StexEcha < fEcal->MaxCrysEcnaInStex(); j0StexEcha++) {
4540  for (Int_t i0Sample = 0; i0Sample < argNbSampWrite; i0Sample++) {
4541  gCnaRootFile->fCnaIndivResult->fMatHis(j0StexEcha, i0Sample) = fT2d_sig[j0StexEcha][i0Sample];
4542  }
4543  }
4544  }
4545 }
4546 
4547 //-------------------------------------------------------------------------
4548 //
4549 // Prepa Fill mean covariances between StexEchas, mean over samples
4550 // for all (Stin_X, Stin_Y)
4551 // (for writing in ROOT file)
4552 //
4553 //-------------------------------------------------------------------------
4555  if (fTagLFccMoStins[0] == 1) {
4556  for (Int_t i0StexStinEcna = 0; i0StexStinEcna < fEcal->MaxStinEcnaInStex(); i0StexStinEcna++) {
4557  for (Int_t j0StexStinEcna = 0; j0StexStinEcna < fEcal->MaxStinEcnaInStex(); j0StexStinEcna++) {
4558  gCnaRootFile->fCnaIndivResult->fMatMat(i0StexStinEcna, j0StexStinEcna) =
4559  fT2d_lfcc_mostins[i0StexStinEcna][j0StexStinEcna];
4560  }
4561  }
4562  }
4563 }
4564 
4565 //-------------------------------------------------------------------------
4566 //
4567 // Prepa Fill mean correlations between StexEchas, mean over samples
4568 // for all (Stin_X, Stin_Y)
4569 // (for writing in ROOT file)
4570 //
4571 //-------------------------------------------------------------------------
4573  if (fTagHFccMoStins[0] == 1) {
4574  for (Int_t i0StexStinEcna = 0; i0StexStinEcna < fEcal->MaxStinEcnaInStex(); i0StexStinEcna++) {
4575  for (Int_t j0StexStinEcna = 0; j0StexStinEcna < fEcal->MaxStinEcnaInStex(); j0StexStinEcna++) {
4576  gCnaRootFile->fCnaIndivResult->fMatMat(i0StexStinEcna, j0StexStinEcna) =
4577  fT2d_hfcc_mostins[i0StexStinEcna][j0StexStinEcna];
4578  }
4579  }
4580  }
4581 }
4582 
4583 //-------------------------------------------------------------------------
4584 //
4585 // Prepa Fill ADC distributions of the samples for all the StexEchas
4586 // (for writing in the ROOT file)
4587 //
4588 //-------------------------------------------------------------------------
4590  if (fTagAvTno[0] == 1) {
4591  for (Int_t j0StexStinEcna = 0; j0StexStinEcna < fEcal->MaxStinEcnaInStex(); j0StexStinEcna++) {
4592  gCnaRootFile->fCnaIndivResult->fMatHis(0, j0StexStinEcna) = fT1d_av_totn[j0StexStinEcna];
4593  }
4594  }
4595 }
4596 //-------------------------------------------------------------------------
4597 //
4598 // Prepa Fill ADC distributions xmin of the samples for all the StexEchas
4599 // (for writing in the ROOT file)
4600 //
4601 //-------------------------------------------------------------------------
4603  if (fTagAvLfn[0] == 1) {
4604  for (Int_t j0StexStinEcna = 0; j0StexStinEcna < fEcal->MaxStinEcnaInStex(); j0StexStinEcna++) {
4605  gCnaRootFile->fCnaIndivResult->fMatHis(0, j0StexStinEcna) = fT1d_av_lofn[j0StexStinEcna];
4606  }
4607  }
4608 }
4609 
4610 //-------------------------------------------------------------------------
4611 //
4612 // Prepa Fill ADC distributions xmax of the samples for all the StexEchas
4613 // (for writing in the ROOT file)
4614 //
4615 //-------------------------------------------------------------------------
4617  if (fTagAvHfn[0] == 1) {
4618  for (Int_t j0StexStinEcna = 0; j0StexStinEcna < fEcal->MaxStinEcnaInStex(); j0StexStinEcna++) {
4619  gCnaRootFile->fCnaIndivResult->fMatHis(0, j0StexStinEcna) = fT1d_av_hifn[j0StexStinEcna];
4620  }
4621  }
4622 }
4623 
4624 //-------------------------------------------------------------------------
4625 //
4626 // Prepa Fill Low Frequency covariances between StexEchas
4627 // (for writing in ROOT file)
4628 //
4629 //-------------------------------------------------------------------------
4631  if (fTagLfCov[0] == 1) {
4632  for (Int_t i0StexEcha = 0; i0StexEcha < fEcal->MaxCrysEcnaInStex(); i0StexEcha++) {
4633  for (Int_t j0StexEcha = 0; j0StexEcha < fEcal->MaxCrysEcnaInStex(); j0StexEcha++) {
4634  gCnaRootFile->fCnaIndivResult->fMatMat(i0StexEcha, j0StexEcha) = fT2d_lf_cov[i0StexEcha][j0StexEcha];
4635  }
4636  }
4637  }
4638 }
4639 
4640 //-------------------------------------------------------------------------
4641 //
4642 // Prepa Fill Low Frequency correlations between StexEchas
4643 // (for writing in ROOT file)
4644 //
4645 //-------------------------------------------------------------------------
4647  if (fTagLfCor[0] == 1) {
4648  for (Int_t i0StexEcha = 0; i0StexEcha < fEcal->MaxCrysEcnaInStex(); i0StexEcha++) {
4649  for (Int_t j0StexEcha = 0; j0StexEcha < fEcal->MaxCrysEcnaInStex(); j0StexEcha++) {
4650  gCnaRootFile->fCnaIndivResult->fMatMat(i0StexEcha, j0StexEcha) = fT2d_lf_cor[i0StexEcha][j0StexEcha];
4651  }
4652  }
4653  }
4654 }
4655 
4656 //-------------------------------------------------------------------------
4657 //
4658 // Prepa Fill High Frequency covariances between StexEchas
4659 // (for writing in ROOT file)
4660 //
4661 //-------------------------------------------------------------------------
4663  if (fTagHfCov[0] == 1) {
4664  for (Int_t i0StexEcha = 0; i0StexEcha < fEcal->MaxCrysEcnaInStex(); i0StexEcha++) {
4665  for (Int_t j0StexEcha = 0; j0StexEcha < fEcal->MaxCrysEcnaInStex(); j0StexEcha++) {
4666  gCnaRootFile->fCnaIndivResult->fMatMat(i0StexEcha, j0StexEcha) = fT2d_hf_cov[i0StexEcha][j0StexEcha];
4667  }
4668  }
4669  }
4670 }
4671 
4672 //-------------------------------------------------------------------------
4673 //
4674 // Prepa Fill High Frequency correlations between StexEchas
4675 // (for writing in ROOT file)
4676 //
4677 //-------------------------------------------------------------------------
4679  if (fTagHfCor[0] == 1) {
4680  for (Int_t i0StexEcha = 0; i0StexEcha < fEcal->MaxCrysEcnaInStex(); i0StexEcha++) {
4681  for (Int_t j0StexEcha = 0; j0StexEcha < fEcal->MaxCrysEcnaInStex(); j0StexEcha++) {
4682  gCnaRootFile->fCnaIndivResult->fMatMat(i0StexEcha, j0StexEcha) = fT2d_hf_cor[i0StexEcha][j0StexEcha];
4683  }
4684  }
4685  }
4686 }
4687 
4688 //-------------------------------------------------------------------------
4689 //
4690 // Prepa Fill covariances between samples for a given StexEcha
4691 // (for writing in ROOT file)
4692 //
4693 //-------------------------------------------------------------------------
4694 void TEcnaRun::TRootCovCss(const Int_t& user_StexEcha, const Int_t& argNbSampWrite) {
4695  if (fTagCovCss[user_StexEcha] == 1) {
4696  for (Int_t i0Sample = 0; i0Sample < argNbSampWrite; i0Sample++) {
4697  for (Int_t j0Sample = 0; j0Sample < argNbSampWrite; j0Sample++) {
4698  gCnaRootFile->fCnaIndivResult->fMatMat(i0Sample, j0Sample) = fT3d_cov_ss[user_StexEcha][i0Sample][j0Sample];
4699  }
4700  }
4701  }
4702 }
4703 
4704 //-------------------------------------------------------------------------
4705 //
4706 // Prepa Fill correlations between samples for a given StexEcha
4707 // (for writing in ROOT file)
4708 //
4709 //-------------------------------------------------------------------------
4710 void TEcnaRun::TRootCorCss(const Int_t& user_StexEcha, const Int_t& argNbSampWrite) {
4711  if (fTagCorCss[user_StexEcha] == 1) {
4712  for (Int_t i0Sample = 0; i0Sample < argNbSampWrite; i0Sample++) {
4713  for (Int_t j0Sample = 0; j0Sample < argNbSampWrite; j0Sample++) {
4714  gCnaRootFile->fCnaIndivResult->fMatMat(i0Sample, j0Sample) = fT3d_cor_ss[user_StexEcha][i0Sample][j0Sample];
4715  }
4716  }
4717  }
4718 }
4719 
4720 //-------------------------------------------------------------------------
4721 //
4722 // Prepa Fill expectation values of the expectation values of the samples
4723 // for all the StexEchas
4724 // (for writing in ROOT file)
4725 //
4726 //-------------------------------------------------------------------------
4728  if (fTagPed[0] == 1) {
4729  for (Int_t j0StexEcha = 0; j0StexEcha < fEcal->MaxCrysEcnaInStex(); j0StexEcha++) {
4730  gCnaRootFile->fCnaIndivResult->fMatHis(0, j0StexEcha) = fT1d_ev_ev[j0StexEcha];
4731  }
4732  }
4733 }
4734 //-------------------------------------------------------------------------
4735 //
4736 // Prepa Fill expectation values of the sigmas of the samples
4737 // for all the StexEchas
4738 // (for writing in ROOT file)
4739 //
4740 //-------------------------------------------------------------------------
4742  if (fTagTno[0] == 1) {
4743  for (Int_t j0StexEcha = 0; j0StexEcha < fEcal->MaxCrysEcnaInStex(); j0StexEcha++) {
4744  gCnaRootFile->fCnaIndivResult->fMatHis(0, j0StexEcha) = fT1d_evsamp_of_sigevt[j0StexEcha];
4745  }
4746  }
4747 }
4748 
4749 //-------------------------------------------------------------------------
4750 //
4751 // Prepa Fill expectation values of the (sample,sample) correlations
4752 // for all the StexEchas
4753 // (for writing in ROOT file)
4754 //
4755 //-------------------------------------------------------------------------
4757  if (fTagMeanCorss[0] == 1) {
4758  for (Int_t j0StexEcha = 0; j0StexEcha < fEcal->MaxCrysEcnaInStex(); j0StexEcha++) {
4759  gCnaRootFile->fCnaIndivResult->fMatHis(0, j0StexEcha) = fT1d_ev_cor_ss[j0StexEcha];
4760  }
4761  }
4762 }
4763 
4764 //-------------------------------------------------------------------------
4765 //
4766 // Prepa Fill sigmas of the expectation values of the samples
4767 // for all the StexEchas
4768 // (for writing in ROOT file)
4769 //
4770 //-------------------------------------------------------------------------
4772  if (fTagLfn[0] == 1) {
4773  for (Int_t j0StexEcha = 0; j0StexEcha < fEcal->MaxCrysEcnaInStex(); j0StexEcha++) {
4774  gCnaRootFile->fCnaIndivResult->fMatHis(0, j0StexEcha) = fT1d_sigevt_of_evsamp[j0StexEcha];
4775  }
4776  }
4777 }
4778 
4779 //-------------------------------------------------------------------------
4780 //
4781 // Prepa Fill sigmas of the expectation values of the sigmas
4782 // for all the StexEchas
4783 // (for writing in ROOT file)
4784 //
4785 //-------------------------------------------------------------------------
4787  if (fTagHfn[0] == 1) {
4788  for (Int_t j0StexEcha = 0; j0StexEcha < fEcal->MaxCrysEcnaInStex(); j0StexEcha++) {
4789  gCnaRootFile->fCnaIndivResult->fMatHis(0, j0StexEcha) = fT1d_evevt_of_sigsamp[j0StexEcha];
4790  }
4791  }
4792 }
4793 
4794 //-------------------------------------------------------------------------
4795 //
4796 // Prepa Fill sigmas of the (sample,sample) correlations
4797 // for all the StexEchas
4798 // (for writing in ROOT file)
4799 //
4800 //-------------------------------------------------------------------------
4802  if (fTagSigCorss[0] == 1) {
4803  for (Int_t j0StexEcha = 0; j0StexEcha < fEcal->MaxCrysEcnaInStex(); j0StexEcha++) {
4804  gCnaRootFile->fCnaIndivResult->fMatHis(0, j0StexEcha) = fT1d_sig_cor_ss[j0StexEcha];
4805  }
4806  }
4807 }
4808 
4809 //-------------------------------------------------------------------------
4810 //
4811 // Prepa Fill Average Pedestals
4812 // for all the StexStins
4813 // (for writing in ROOT file)
4814 //
4815 //-------------------------------------------------------------------------
4817  if (fTagAvPed[0] == 1) {
4818  for (Int_t j0StexStinEcna = 0; j0StexStinEcna < fEcal->MaxStinEcnaInStex(); j0StexStinEcna++) {
4819  gCnaRootFile->fCnaIndivResult->fMatHis(0, j0StexStinEcna) = fT1d_av_mped[j0StexStinEcna];
4820  }
4821  }
4822 }
4823 
4824 //-------------------------------------------------------------------------
4825 //
4826 // Prepa Fill
4827 //
4828 // (for writing in ROOT file)
4829 //
4830 //-------------------------------------------------------------------------
4832  if (fTagAvMeanCorss[0] == 1) // test 1st elt only since global calc
4833  {
4834  for (Int_t j0StexStinEcna = 0; j0StexStinEcna < fEcal->MaxStinEcnaInStex(); j0StexStinEcna++) {
4835  gCnaRootFile->fCnaIndivResult->fMatHis(0, j0StexStinEcna) = fT1d_av_ev_corss[j0StexStinEcna];
4836  }
4837  }
4838 }
4839 
4840 //-------------------------------------------------------------------------
4841 //
4842 // Prepa Fill
4843 //
4844 // (for writing in ROOT file)
4845 //
4846 //-------------------------------------------------------------------------
4848  if (fTagAvSigCorss[0] == 1) // test 1st elt only since global calc
4849  {
4850  for (Int_t j0StexStinEcna = 0; j0StexStinEcna < fEcal->MaxStinEcnaInStex(); j0StexStinEcna++) {
4851  gCnaRootFile->fCnaIndivResult->fMatHis(0, j0StexStinEcna) = fT1d_av_sig_corss[j0StexStinEcna];
4852  }
4853  }
4854 }
4855 
4856 //=========================================================================
4857 //
4858 // METHODS TO SET FLAGS TO PRINT (OR NOT) COMMENTS (DEBUG)
4859 //
4860 //=========================================================================
4861 
4863  // Set flags to authorize printing of some comments concerning initialisations (default)
4864 
4866  std::cout << "*TEcnaRun::PrintComments()> Warnings and some comments on init will be printed" << std::endl;
4867 }
4868 
4870  // Set flags to authorize printing of warnings
4871 
4873  std::cout << "*TEcnaRun::PrintWarnings()> Warnings will be printed" << std::endl;
4874 }
4875 
4877  // Set flags to authorize printing of the comments of all the methods
4878 
4880  std::cout << "*TEcnaRun::PrintAllComments()> All the comments will be printed" << std::endl;
4881 }
4882 
4884  // Set flags to forbid the printing of all the comments
4885 
4887 }
4888 //=========================== E N D ======================================
TEcnaRun::fStexName
TString fStexName
Definition: TEcnaRun.h:391
TEcnaRun::fTagAvPed
Int_t * fTagAvPed
Definition: TEcnaRun.h:446
TEcnaRun::GetNewRootFileNameShort
TString GetNewRootFileNameShort()
Definition: TEcnaRun.cc:3456
TEcnaHeader::fAvSigCorssCalc
Int_t fAvSigCorssCalc
Definition: TEcnaHeader.h:90
TEcnaRun::HighFrequencyMeanCorrelationsBetweenTowers
void HighFrequencyMeanCorrelationsBetweenTowers()
Definition: TEcnaRun.cc:3159
TEcnaRead::GetStopTime
time_t GetStopTime()
Definition: TEcnaRead.cc:834
TEcnaRun::SampleMeans
void SampleMeans()
Definition: TEcnaRun.cc:1496
TEcnaRun::PrintWarnings
void PrintWarnings()
Definition: TEcnaRun.cc:4869
TEcnaRead::FileParameters
void FileParameters(const TString &, const Int_t &, const Int_t &, const Int_t &, const Int_t &, const Int_t &, const Int_t &, const TString &)
Definition: TEcnaRead.cc:732
TEcnaRead::GetRootFileNameShort
TString GetRootFileNameShort()
Definition: TEcnaRead.cc:4247
TEcnaHeader::fAvLfnCalc
Int_t fAvLfnCalc
Definition: TEcnaHeader.h:70
TEcnaHeader::fAvMeanCorssCalc
Int_t fAvMeanCorssCalc
Definition: TEcnaHeader.h:89
TEcnaRun::fTagAvSigCorss
Int_t * fTagAvSigCorss
Definition: TEcnaRun.h:471
TEcnaRead::ReadSampleAdcValuesSameFile
Double_t *** ReadSampleAdcValuesSameFile(const Int_t &, const Int_t &, const Int_t &)
Definition: TEcnaRead.cc:4009
TEcnaRun::TRootCorCss
void TRootCorCss(const Int_t &, const Int_t &)
Definition: TEcnaRun.cc:4710
mps_fire.i
i
Definition: mps_fire.py:355
TEcnaRun::LowFrequencyCovariancesBetweenChannels
void LowFrequencyCovariancesBetweenChannels()
Definition: TEcnaRun.cc:2656
TEcnaRead::GetStopDate
TString GetStopDate()
Definition: TEcnaRead.cc:836
cTypAvHfn
Definition: TEcnaResultType.h:30
cTypMSp
Definition: TEcnaResultType.h:26
TEcnaRun::CovariancesBetweenSamples
void CovariancesBetweenSamples()
Definition: TEcnaRun.cc:1625
TEcnaHeader::fHfCorCalc
Int_t fHfCorCalc
Definition: TEcnaHeader.h:76
TEcnaRun::fT2d_hfcc_mostins
Double_t ** fT2d_hfcc_mostins
Definition: TEcnaRun.h:496
TEcnaParEcal::MaxSampADC
Int_t MaxSampADC()
Definition: TEcnaParEcal.cc:364
TEcnaRun::fTagAdcEvt
Int_t * fTagAdcEvt
Definition: TEcnaRun.h:415
TEcnaRun::fCodePrintWarnings
Int_t fCodePrintWarnings
Definition: TEcnaRun.h:508
TEcnaRun::fT3d1_cor_ss
Double_t * fT3d1_cor_ss
Definition: TEcnaRun.h:439
TEcnaRun::TRootSigCorss
void TRootSigCorss()
Definition: TEcnaRun.cc:4801
TEcnaRun::fTagMSp
Int_t * fTagMSp
Definition: TEcnaRun.h:426
TEcnaHeader::fReqNbOfEvts
Int_t fReqNbOfEvts
Definition: TEcnaHeader.h:52
TEcnaRun::fTagCorCss
Int_t * fTagCorCss
Definition: TEcnaRun.h:440
TEcnaRun::fNumberOfEvents
Int_t fNumberOfEvents
Definition: TEcnaRun.h:408
TEcnaHeader::fRunType
Int_t fRunType
Definition: TEcnaHeader.h:60
TEcnaRun::fT2d_hf_cov
Double_t ** fT2d_hf_cov
Definition: TEcnaRun.h:483
TEcnaHeader::fCovCssCalc
Int_t fCovCssCalc
Definition: TEcnaHeader.h:73
TEcnaRun::SigmaOfCorrelationsBetweenSamples
void SigmaOfCorrelationsBetweenSamples()
Definition: TEcnaRun.cc:2113
TEcnaRun::SampleValues
void SampleValues()
Definition: TEcnaRun.cc:1424
TEcnaRun::fT1d_sig_cor_ss
Double_t * fT1d_sig_cor_ss
Definition: TEcnaRun.h:468
TEcnaResultType::fTypOfCnaResult
CnaResultTyp fTypOfCnaResult
Definition: TEcnaResultType.h:56
mps_update.status
status
Definition: mps_update.py:69
TEcnaHeader::fHFccMoStinsCalc
Int_t fHFccMoStinsCalc
Definition: TEcnaHeader.h:80
TEcnaResultType::fMatMat
TEcnaNArrayD fMatMat
Definition: TEcnaResultType.h:59
TEcnaRun::HighFrequencyNoise
void HighFrequencyNoise()
Definition: TEcnaRun.cc:1957
cTypHfCov
Definition: TEcnaResultType.h:31
TEcnaHeader::fMSpCalc
Int_t fMSpCalc
Definition: TEcnaHeader.h:67
TEcnaRun::fT1d_ev_ev
Double_t * fT1d_ev_ev
Definition: TEcnaRun.h:443
TEcnaRun::LowFrequencyNoise
void LowFrequencyNoise()
Definition: TEcnaRun.cc:1884
TEcnaRun::AverageSigmaOfCorrelationsBetweenSamples
void AverageSigmaOfCorrelationsBetweenSamples()
Definition: TEcnaRun.cc:2561
TEcnaRun::fCodePrintComments
Int_t fCodePrintComments
Definition: TEcnaRun.h:508
TEcnaRun::LowFrequencyMeanCorrelationsBetweenTowers
void LowFrequencyMeanCorrelationsBetweenTowers()
Definition: TEcnaRun.cc:3051
TEcnaRun::fMemoReadNumberOfEventsforSamples
Int_t fMemoReadNumberOfEventsforSamples
Definition: TEcnaRun.h:410
TEcnaRun::fTTBELL
TString fTTBELL
Definition: TEcnaRun.h:374
TEcnaRead::LookAtRootFile
Bool_t LookAtRootFile()
Definition: TEcnaRead.cc:1043
TEcnaRun::LowFrequencyMeanCorrelationsBetweenStins
void LowFrequencyMeanCorrelationsBetweenStins()
Definition: TEcnaRun.cc:3054
TEcnaRun::fStinName
TString fStinName
Definition: TEcnaRun.h:391
TEcnaParEcal
Definition: TEcnaParEcal.h:24
gather_cfg.cout
cout
Definition: gather_cfg.py:144
TEcnaRun::fT1d_av_hifn
Double_t * fT1d_av_hifn
Definition: TEcnaRun.h:465
TEcnaRun::fT3d2_cov_ss
Double_t ** fT3d2_cov_ss
Definition: TEcnaRun.h:433
TEcnaRun::fSpecialStexStinNotIndexed
Int_t fSpecialStexStinNotIndexed
Definition: TEcnaRun.h:401
TEcnaRun::fT2d_lf_cov
Double_t ** fT2d_lf_cov
Definition: TEcnaRun.h:474
cTypHfn
Definition: TEcnaResultType.h:44
TEcnaRun::fT3d1_cov_ss
Double_t * fT3d1_cov_ss
Definition: TEcnaRun.h:434
TEcnaRun::fT1d_av_ev_corss
Double_t * fT1d_av_ev_corss
Definition: TEcnaRun.h:455
TEcnaParCout::GetCodePrint
Int_t GetCodePrint(const TString &)
Definition: TEcnaParCout.cc:66
TEcnaRun::LowFrequencyCorrelationsBetweenChannels
void LowFrequencyCorrelationsBetweenChannels()
Definition: TEcnaRun.cc:2765
TEcnaRun::SampleSigmas
void SampleSigmas()
Definition: TEcnaRun.cc:1551
TEcnaRootFile
Definition: TEcnaRootFile.h:25
TEcnaRun::fT2dCrysNumbersTable
Int_t ** fT2dCrysNumbersTable
Definition: TEcnaRun.h:502
cTypAvPed
Definition: TEcnaResultType.h:37
TEcnaHeader::fHfnCalc
Int_t fHfnCalc
Definition: TEcnaHeader.h:85
TEcnaRun::fT3d2_cor_ss
Double_t ** fT3d2_cor_ss
Definition: TEcnaRun.h:438
TEcnaRun::fTagHfn
Int_t * fTagHfn
Definition: TEcnaRun.h:464
TEcnaRun::TRootLfn
void TRootLfn()
Definition: TEcnaRun.cc:4771
TEcnaRun::TRootLfCov
void TRootLfCov()
Definition: TEcnaRun.cc:4630
TEcnaRun::fT2d1_hf_cor
Double_t * fT2d1_hf_cor
Definition: TEcnaRun.h:488
cTypCovCss
Definition: TEcnaResultType.h:33
TEcnaRun::fNewRootFileNameShort
TString fNewRootFileNameShort
Definition: TEcnaRun.h:399
contentValuesCheck.run_number
run_number
Definition: contentValuesCheck.py:38
TEcnaRun::fT1d_av_totn
Double_t * fT1d_av_totn
Definition: TEcnaRun.h:450
ClassImp
ClassImp(TEcnaRun)
TEcnaRun::fT2d_NbOfEvts
Int_t ** fT2d_NbOfEvts
Definition: TEcnaRun.h:417
TEcnaRun::fT2d1_lf_cov
Double_t * fT2d1_lf_cov
Definition: TEcnaRun.h:475
TEcnaRun::TRootCovCss
void TRootCovCss(const Int_t &, const Int_t &)
Definition: TEcnaRun.cc:4694
TEcnaHeader::fNbOfSamples
Int_t fNbOfSamples
Definition: TEcnaHeader.h:48
sistrip::RunType
RunType
Definition: ConstantsForRunType.h:70
cTypAvLfn
Definition: TEcnaResultType.h:29
TEcnaRun::AverageTotalNoise
void AverageTotalNoise()
Definition: TEcnaRun.cc:2261
cTypLfn
Definition: TEcnaResultType.h:43
TEcnaRun::fMiscDiag
Int_t * fMiscDiag
Definition: TEcnaRun.h:376
TEcnaRun::fT1d_NbOfEvts
Int_t * fT1d_NbOfEvts
Definition: TEcnaRun.h:418
TEcnaRun::CorrelationsBetweenSamples
void CorrelationsBetweenSamples()
Definition: TEcnaRun.cc:1691
TEcnaWrite::GetRootFileName
TString GetRootFileName()
Definition: TEcnaWrite.cc:388
TEcnaRootFile::fRootFileStatus
TString fRootFileStatus
Definition: TEcnaRootFile.h:31
TEcnaRun::StartStopTime
void StartStopTime(time_t, time_t)
Definition: TEcnaRun.cc:1368
cTypHfCor
Definition: TEcnaResultType.h:32
TEcnaHeader::fStopDate
TString fStopDate
Definition: TEcnaHeader.h:58
cTypAvSigCorss
Definition: TEcnaResultType.h:39
TEcnaRun::fCnaCommand
Int_t fCnaCommand
Definition: TEcnaRun.h:369
TEcnaRun::AverageMeanCorrelationsBetweenSamples
void AverageMeanCorrelationsBetweenSamples()
Definition: TEcnaRun.cc:2486
TEcnaParCout
Definition: TEcnaParCout.h:25
TEcnaRun::CloseRootFile
Bool_t CloseRootFile(const Text_t *)
Definition: TEcnaRun.cc:3322
cTypNumbers
Definition: TEcnaResultType.h:25
contentValuesCheck.file_name
file_name
Definition: contentValuesCheck.py:38
TEcnaHeader::fCorCssCalc
Int_t fCorCssCalc
Definition: TEcnaHeader.h:74
TEcnaRun::fCnaError
Int_t fCnaError
Definition: TEcnaRun.h:369
TEcnaRead::GetRootFileName
TString GetRootFileName()
Definition: TEcnaRead.cc:4246
cTypPed
Definition: TEcnaResultType.h:41
TEcnaHeader::fHfCovCalc
Int_t fHfCovCalc
Definition: TEcnaHeader.h:75
TEcnaRootFile::ReStart
void ReStart(const Text_t *)
Definition: TEcnaRootFile.cc:100
trigObjTnPSource_cfi.var
var
Definition: trigObjTnPSource_cfi.py:21
TEcnaRun::TRootHfCov
void TRootHfCov()
Definition: TEcnaRun.cc:4662
TEcnaRun::TRootHFccMoStins
void TRootHFccMoStins()
Definition: TEcnaRun.cc:4572
TEcnaRun::PrintNoComment
void PrintNoComment()
Definition: TEcnaRun.cc:4883
TEcnaRun::TRootLfCor
void TRootLfCor()
Definition: TEcnaRun.cc:4646
TEcnaRun::TRootLFccMoStins
void TRootLFccMoStins()
Definition: TEcnaRun.cc:4554
TEcnaRun::MeanCorrelationsBetweenSamples
void MeanCorrelationsBetweenSamples()
Definition: TEcnaRun.cc:2040
TEcnaHeader::fNbOfEvtsCalc
Int_t fNbOfEvtsCalc
Definition: TEcnaHeader.h:64
TEcnaRun::fBuildEvtNotSkipped
Int_t fBuildEvtNotSkipped
Definition: TEcnaRun.h:403
TEcnaRun::TRootAvSigCorss
void TRootAvSigCorss()
Definition: TEcnaRun.cc:4847
gCnaRootFile
R__EXTERN TEcnaRootFile * gCnaRootFile
Definition: TEcnaRun.cc:13
TEcnaRun::fNbOfMiscDiagCounters
Int_t fNbOfMiscDiagCounters
Definition: TEcnaRun.h:377
TEcnaObject::RegisterPointer
Bool_t RegisterPointer(const TString &, const Long_t &)
Definition: TEcnaObject.cc:100
TEcnaRun::Pedestals
void Pedestals()
Definition: TEcnaRun.cc:1770
TEcnaRun::HighFrequencyMeanCorrelationsBetweenSCs
void HighFrequencyMeanCorrelationsBetweenSCs()
Definition: TEcnaRun.cc:3160
TEcnaRun::fgMaxCar
Int_t fgMaxCar
Definition: TEcnaRun.h:367
TEcnaWrite::RegisterFileParameters
void RegisterFileParameters(const TString &, const Int_t &, const Int_t &, const Int_t &, const Int_t &, const Int_t &, const Int_t &, const TString &, const TString &, const time_t, const time_t)
Definition: TEcnaWrite.cc:597
TEcnaRun::WriteNewRootFile
Bool_t WriteNewRootFile(const TString &)
Definition: TEcnaRun.cc:3415
TEcnaRun::fEcalNumbering
TEcnaNumbering * fEcalNumbering
Definition: TEcnaRun.h:383
TEcnaRun::OpenRootFile
Bool_t OpenRootFile(const Text_t *, const TString &)
Definition: TEcnaRun.cc:3279
TEcnaRun::Init
void Init()
Definition: TEcnaRun.cc:134
ntupleEnum.SubDet
SubDet
Definition: ntupleEnum.py:15
TEcnaRun::fTagAvMeanCorss
Int_t * fTagAvMeanCorss
Definition: TEcnaRun.h:456
TEcnaRun::fT1dCrysNumbersTable
Int_t * fT1dCrysNumbersTable
Definition: TEcnaRun.h:503
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
cTypTno
Definition: TEcnaResultType.h:42
TEcnaRun::fT1d_sig
Double_t * fT1d_sig
Definition: TEcnaRun.h:429
TEcnaRun::TEcnaRun
TEcnaRun()
Definition: TEcnaRun.cc:19
TEcnaRun::TRootAvPed
void TRootAvPed()
Definition: TEcnaRun.cc:4816
cTypSigCorss
Definition: TEcnaResultType.h:36
TEcnaRun::HighFrequencyCovariancesBetweenChannels
void HighFrequencyCovariancesBetweenChannels()
Definition: TEcnaRun.cc:2848
TEcnaRun::AverageLowFrequencyNoise
void AverageLowFrequencyNoise()
Definition: TEcnaRun.cc:2336
TEcnaResultType::SetSizeMat
void SetSizeMat(Int_t, Int_t)
Definition: TEcnaResultType.cc:75
TEcnaRun::fOpenRootFile
Bool_t fOpenRootFile
Definition: TEcnaRun.h:393
TEcnaRun::fReadyToReadData
Int_t fReadyToReadData
Definition: TEcnaRun.h:394
TEcnaRead::GetStartTime
time_t GetStartTime()
Definition: TEcnaRead.cc:833
TEcnaRun
Definition: TEcnaRun.h:363
cTypAvTno
Definition: TEcnaResultType.h:28
TEcnaRun::Expert2Calculations
void Expert2Calculations()
Definition: TEcnaRun.cc:1475
TEcnaRun::fTagLfCor
Int_t * fTagLfCor
Definition: TEcnaRun.h:480
TEcnaRun::TRootAvLfn
void TRootAvLfn()
Definition: TEcnaRun.cc:4602
TEcnaRun::fFileHeader
TEcnaHeader * fFileHeader
Definition: TEcnaRun.h:381
TEcnaRun::fCnaParPaths
TEcnaParPaths * fCnaParPaths
Definition: TEcnaRun.h:385
TEcnaParPaths
Definition: TEcnaParPaths.h:24
cTypAvMeanCorss
Definition: TEcnaResultType.h:38
TEcnaRun::fT1d_av_sig_corss
Double_t * fT1d_av_sig_corss
Definition: TEcnaRun.h:470
TEcnaRun::fTagHFccMoStins
Int_t * fTagHFccMoStins
Definition: TEcnaRun.h:498
TEcnaRun::TRootAdcEvt
void TRootAdcEvt(const Int_t &, const Int_t &)
Definition: TEcnaRun.cc:4500
TEcnaRun::LowFrequencyMeanCorrelationsBetweenSCs
void LowFrequencyMeanCorrelationsBetweenSCs()
Definition: TEcnaRun.cc:3052
TEcnaRun::fTagMeanCorss
Int_t * fTagMeanCorss
Definition: TEcnaRun.h:454
TEcnaRun::TRootSSp
void TRootSSp(const Int_t &)
Definition: TEcnaRun.cc:4537
TEcnaHeader::fMeanCorssCalc
Int_t fMeanCorssCalc
Definition: TEcnaHeader.h:83
TEcnaRootFile::OpenR
Bool_t OpenR(const Text_t *="")
Definition: TEcnaRootFile.cc:128
TEcnaRead
Definition: TEcnaRead.h:352
TEcnaRun::fT3d_cor_ss
Double_t *** fT3d_cor_ss
Definition: TEcnaRun.h:437
TEcnaRun::fRootFileName
TString fRootFileName
Definition: TEcnaRun.h:396
TEcnaHeader::fStartDate
TString fStartDate
Definition: TEcnaHeader.h:57
TEcnaObject
Definition: TEcnaObject.h:25
cTypLfCov
Definition: TEcnaResultType.h:46
TEcnaRun::fTagSigCorss
Int_t * fTagSigCorss
Definition: TEcnaRun.h:469
TEcnaRun::fTagLfCov
Int_t * fTagLfCov
Definition: TEcnaRun.h:476
TEcnaRun::fTagAvHfn
Int_t * fTagAvHfn
Definition: TEcnaRun.h:466
TEcnaHeader::fPedCalc
Int_t fPedCalc
Definition: TEcnaHeader.h:81
TEcnaRun::fTagNbOfEvts
Int_t * fTagNbOfEvts
Definition: TEcnaRun.h:419
cTypLfCor
Definition: TEcnaResultType.h:47
TEcnaRun::fNewRootFileName
TString fNewRootFileName
Definition: TEcnaRun.h:398
TEcnaRun.h
TEcnaRead::GetStexStinFromIndex
Int_t GetStexStinFromIndex(const Int_t &)
Definition: TEcnaRead.cc:4255
beam_dqm_sourceclient-live_cfg.cerr
cerr
Definition: beam_dqm_sourceclient-live_cfg.py:17
TEcnaRun::TRootAvEvCorss
void TRootAvEvCorss()
Definition: TEcnaRun.cc:4831
TEcnaRun::fStinIndexBuilt
Int_t fStinIndexBuilt
Definition: TEcnaRun.h:402
TEcnaRun::fRootFileNameShort
TString fRootFileNameShort
Definition: TEcnaRun.h:397
TEcnaRun::TRootHfCor
void TRootHfCor()
Definition: TEcnaRun.cc:4678
TEcnaRun::fTagTno
Int_t * fTagTno
Definition: TEcnaRun.h:449
TEcnaRun::TRootNbOfEvts
void TRootNbOfEvts(const Int_t &)
Definition: TEcnaRun.cc:4484
TEcnaRun::fMaxMsgIndexForMiscDiag
Int_t fMaxMsgIndexForMiscDiag
Definition: TEcnaRun.h:378
TEcnaRun::fT1d_StexStinFromIndex
Int_t * fT1d_StexStinFromIndex
Definition: TEcnaRun.h:421
TEcnaRun::fT1d_evevt_of_sigsamp
Double_t * fT1d_evevt_of_sigsamp
Definition: TEcnaRun.h:463
cTypLFccMoStins
Definition: TEcnaResultType.h:48
TEcnaRun::AveragePedestals
void AveragePedestals()
Definition: TEcnaRun.cc:2185
TEcnaHeader::fAvHfnCalc
Int_t fAvHfnCalc
Definition: TEcnaHeader.h:71
TEcnaParEcal::MaxCrysInStin
Int_t MaxCrysInStin()
Definition: TEcnaParEcal.cc:387
cTypHFccMoStins
Definition: TEcnaResultType.h:49
TEcnaHeader::fLfCovCalc
Int_t fLfCovCalc
Definition: TEcnaHeader.h:77
TEcnaRun::fTagCovCss
Int_t * fTagCovCss
Definition: TEcnaRun.h:435
TEcnaRun::fT1d_ev_cor_ss
Double_t * fT1d_ev_cor_ss
Definition: TEcnaRun.h:453
TEcnaRun::HighFrequencyMeanCorrelationsBetweenStins
void HighFrequencyMeanCorrelationsBetweenStins()
Definition: TEcnaRun.cc:3162
TEcnaRootFile::fRootFile
TFile * fRootFile
Definition: TEcnaRootFile.h:33
TEcnaRun::fT1d_av_mped
Double_t * fT1d_av_mped
Definition: TEcnaRun.h:445
TEcnaHeader::fAvTnoCalc
Int_t fAvTnoCalc
Definition: TEcnaHeader.h:69
TEcnaHeader
Definition: TEcnaHeader.h:36
TEcnaRun::GetRootFileNameShort
TString GetRootFileNameShort()
Definition: TEcnaRun.cc:1356
TEcnaRun::fEcal
TEcnaParEcal * fEcal
Definition: TEcnaRun.h:382
TEcnaRun::GetPathForResults
Bool_t GetPathForResults()
Definition: TEcnaRun.cc:132
TEcnaRun::fTagLfn
Int_t * fTagLfn
Definition: TEcnaRun.h:459
TEcnaRun::TRootAvTno
void TRootAvTno()
Definition: TEcnaRun.cc:4589
TEcnaRun::fTagStinNumbers
Int_t * fTagStinNumbers
Definition: TEcnaRun.h:422
TEcnaHeader::fFirstReqEvtNumber
Int_t fFirstReqEvtNumber
Definition: TEcnaHeader.h:50
TEcnaRun::PrintAllComments
void PrintAllComments()
Definition: TEcnaRun.cc:4876
TEcnaNumbering
Definition: TEcnaNumbering.h:23
TEcnaNumbering::GetDeeSCConsFrom1DeeSCEcna
Int_t GetDeeSCConsFrom1DeeSCEcna(const Int_t &, const Int_t &)
Definition: TEcnaNumbering.cc:2464
TEcnaRun::fT3d2_AdcValues
Double_t ** fT3d2_AdcValues
Definition: TEcnaRun.h:413
TEcnaParEcal::MaxStinEcnaInStex
Int_t MaxStinEcnaInStex()
Definition: TEcnaParEcal.cc:381
TEcnaRun::GetReadyToReadData
void GetReadyToReadData(const TString &, const Int_t &, const Int_t &, const Int_t &, const Int_t &, const Int_t &)
Definition: TEcnaRun.cc:695
TEcnaHeader::fRunNumber
Int_t fRunNumber
Definition: TEcnaHeader.h:49
TEcnaRun::TotalNoise
void TotalNoise()
Definition: TEcnaRun.cc:1825
TEcnaRun::fCnew
Int_t fCnew
Definition: TEcnaRun.h:371
TEcnaHeader::fAdcEvtCalc
Int_t fAdcEvtCalc
Definition: TEcnaHeader.h:66
nlast
int nlast
Definition: AMPTWrapper.h:57
TEcnaResultType::fIthElement
Int_t fIthElement
Definition: TEcnaResultType.h:57
TEcnaRun::AverageHighFrequencyNoise
void AverageHighFrequencyNoise()
Definition: TEcnaRun.cc:2411
cTypAdcEvt
Definition: TEcnaResultType.h:45
TEcnaRun::fTagAvLfn
Int_t * fTagAvLfn
Definition: TEcnaRun.h:461
TEcnaRun::fT1d_evsamp_of_sigevt
Double_t * fT1d_evsamp_of_sigevt
Definition: TEcnaRun.h:448
TEcnaRun::fObjectManager
TEcnaObject * fObjectManager
Definition: TEcnaRun.h:380
TEcnaHeader::fLastReqEvtNumber
Int_t fLastReqEvtNumber
Definition: TEcnaHeader.h:51
TEcnaRun::fTagLFccMoStins
Int_t * fTagLFccMoStins
Definition: TEcnaRun.h:494
TEcnaRun::WriteRootFile
Bool_t WriteRootFile()
Definition: TEcnaRun.cc:3365
TEcnaRun::StandardCalculations
void StandardCalculations()
Definition: TEcnaRun.cc:1448
TEcnaRun::GetReadyToCompute
void GetReadyToCompute()
Definition: TEcnaRun.cc:1387
TEcnaRootFile::fCnaIndivResult
TEcnaResultType * fCnaIndivResult
Definition: TEcnaRootFile.h:42
TEcnaHeader::fAvPedCalc
Int_t fAvPedCalc
Definition: TEcnaHeader.h:88
TEcnaRun::fCdelete
Int_t fCdelete
Definition: TEcnaRun.h:372
TEcnaNumbering::StexEchaForCons
Int_t StexEchaForCons(const Int_t &, const Int_t &)
Definition: TEcnaNumbering.cc:2594
TEcnaWrite::NumberOfEventsAnalysis
Int_t NumberOfEventsAnalysis(Int_t **, const Int_t &, const Int_t &, const Int_t &)
Definition: TEcnaWrite.cc:514
TEcnaRun::fTagHfCov
Int_t * fTagHfCov
Definition: TEcnaRun.h:485
TEcnaRun::fT2d1_lfcc_mostins
Double_t * fT2d1_lfcc_mostins
Definition: TEcnaRun.h:493
TEcnaRun::TRootAvHfn
void TRootAvHfn()
Definition: TEcnaRun.cc:4616
cTypSSp
Definition: TEcnaResultType.h:27
TEcnaRun::fT2d_hf_cor
Double_t ** fT2d_hf_cor
Definition: TEcnaRun.h:487
TEcnaHeader::HeaderParameters
void HeaderParameters(const TString &, const Int_t &, const Int_t &, const Int_t &, const Int_t &, const Int_t &, const Int_t &)
Definition: TEcnaHeader.cc:126
TEcnaRun::TRootHfn
void TRootHfn()
Definition: TEcnaRun.cc:4786
TEcnaRun::TRootStinNumbers
void TRootStinNumbers()
Definition: TEcnaRun.cc:4470
TEcnaResultType::SetSizeHis
void SetSizeHis(Int_t, Int_t)
Definition: TEcnaResultType.cc:85
TEcnaRun::fTagAvTno
Int_t * fTagAvTno
Definition: TEcnaRun.h:451
TEcnaRun::fT2d_ev
Double_t ** fT2d_ev
Definition: TEcnaRun.h:424
TEcnaRun::fNbSampForCalc
Int_t fNbSampForCalc
Definition: TEcnaRun.h:406
TEcnaRun::fCnaParCout
TEcnaParCout * fCnaParCout
Definition: TEcnaRun.h:384
TEcnaRun::fT3d_AdcValues
Double_t *** fT3d_AdcValues
Definition: TEcnaRun.h:412
TEcnaHeader::fTnoCalc
Int_t fTnoCalc
Definition: TEcnaHeader.h:82
TEcnaHeader::fLfnCalc
Int_t fLfnCalc
Definition: TEcnaHeader.h:84
TEcnaHeader::fStartTime
time_t fStartTime
Definition: TEcnaHeader.h:55
TEcnaRun::fT1d_ev
Double_t * fT1d_ev
Definition: TEcnaRun.h:425
TEcnaRun::GetRootFileName
TString GetRootFileName()
Definition: TEcnaRun.cc:1355
TEcnaRun::GetSampleAdcValues
Bool_t GetSampleAdcValues(const Int_t &, const Int_t &, const Int_t &, const Int_t &, const Double_t &)
Definition: TEcnaRun.cc:1057
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
TEcnaRun::fFlagSubDet
TString fFlagSubDet
Definition: TEcnaRun.h:390
TEcnaRun::fT1d_av_lofn
Double_t * fT1d_av_lofn
Definition: TEcnaRun.h:460
TEcnaRun::GetNewRootFileName
TString GetNewRootFileName()
Definition: TEcnaRun.cc:3455
TEcnaRun::fT2d_lfcc_mostins
Double_t ** fT2d_lfcc_mostins
Definition: TEcnaRun.h:492
TEcnaParPaths::ResultsRootFilePath
TString ResultsRootFilePath()
Definition: TEcnaParPaths.cc:352
TEcnaRun::PrintComments
void PrintComments()
Definition: TEcnaRun.cc:4862
TEcnaHeader::fLFccMoStinsCalc
Int_t fLFccMoStinsCalc
Definition: TEcnaHeader.h:79
TEcnaRead::DataExist
Bool_t DataExist()
Definition: TEcnaRead.cc:1100
TEcnaNumbering::MaxCrysInStinEcna
Int_t MaxCrysInStinEcna(const Int_t &, const Int_t &, const TString &)
Definition: TEcnaNumbering.cc:3118
TEcnaHeader::fTypAna
TString fTypAna
Definition: TEcnaHeader.h:47
TEcnaRun::fT2d1_lf_cor
Double_t * fT2d1_lf_cor
Definition: TEcnaRun.h:479
TEcnaRun::fCodePrintAllComments
Int_t fCodePrintAllComments
Definition: TEcnaRun.h:508
TEcnaHeader::fStinNumbersCalc
Int_t fStinNumbersCalc
Definition: TEcnaHeader.h:63
TEcnaRead::ReadNumberOfEventsForSamples
TMatrixD ReadNumberOfEventsForSamples(const Int_t &, const Int_t &, const Int_t &)
Definition: TEcnaRead.cc:1765
TEcnaRun::fT2d_sig
Double_t ** fT2d_sig
Definition: TEcnaRun.h:428
TEcnaNArrayD::ReSet
void ReSet(Int_t)
Definition: TEcnaNArrayD.cc:258
TEcnaWrite::fMakeResultsFileName
void fMakeResultsFileName()
Definition: TEcnaWrite.cc:631
TEcnaParPaths::GetPathForResultsRootFiles
Bool_t GetPathForResultsRootFiles()
Definition: TEcnaParPaths.cc:83
TEcnaRootFile::fCnaResultsTree
TTree * fCnaResultsTree
Definition: TEcnaRootFile.h:37
TEcnaRead::PrintNoComment
void PrintNoComment()
Definition: TEcnaRead.cc:4353
TEcnaRun::fCnaWrite
TEcnaWrite * fCnaWrite
Definition: TEcnaRun.h:386
TEcnaResultType::fMatHis
TEcnaNArrayD fMatHis
Definition: TEcnaResultType.h:60
TEcnaRun::fCodePrintNoComment
Int_t fCodePrintNoComment
Definition: TEcnaRun.h:508
TEcnaRun::fT2d1_hf_cov
Double_t * fT2d1_hf_cov
Definition: TEcnaRun.h:484
cTypNbOfEvts
Definition: TEcnaResultType.h:40
TEcnaRun::fFlagPrint
Int_t fFlagPrint
Definition: TEcnaRun.h:507
TEcnaWrite::GetRootFileNameShort
TString GetRootFileNameShort()
Definition: TEcnaWrite.cc:389
TEcnaRun::~TEcnaRun
~TEcnaRun() override
Definition: TEcnaRun.cc:328
cTypMeanCorss
Definition: TEcnaResultType.h:35
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
TEcnaRun::fT1d_sigevt_of_evsamp
Double_t * fT1d_sigevt_of_evsamp
Definition: TEcnaRun.h:458
TEcnaNumbering::Get0StexEchaFrom1StexStinAnd0StinEcha
Int_t Get0StexEchaFrom1StexStinAnd0StinEcha(const Int_t &, const Int_t &)
Definition: TEcnaNumbering.cc:2970
TEcnaHeader::fLfCorCalc
Int_t fLfCorCalc
Definition: TEcnaHeader.h:78
TEcnaHeader::fSigCorssCalc
Int_t fSigCorssCalc
Definition: TEcnaHeader.h:86
TEcnaHeader::fStex
Int_t fStex
Definition: TEcnaHeader.h:53
TEcnaRun::fT3d1_AdcValues
Double_t * fT3d1_AdcValues
Definition: TEcnaRun.h:414
TEcnaRun::StartStopDate
void StartStopDate(const TString &, const TString &)
Definition: TEcnaRun.cc:1375
TEcnaHeader::fStopTime
time_t fStopTime
Definition: TEcnaHeader.h:56
TEcnaRun::TRootPed
void TRootPed()
Definition: TEcnaRun.cc:4727
TEcnaRootFile::OpenW
Bool_t OpenW(const Text_t *="")
Definition: TEcnaRootFile.cc:156
TEcnaRun::HighFrequencyCorrelationsBetweenChannels
void HighFrequencyCorrelationsBetweenChannels()
Definition: TEcnaRun.cc:2970
TEcnaHeader::fSSpCalc
Int_t fSSpCalc
Definition: TEcnaHeader.h:68
TEcnaParEcal::MaxCrysEcnaInStex
Int_t MaxCrysEcnaInStex()
Definition: TEcnaParEcal.cc:391
TEcnaRootFile::CloseFile
void CloseFile()
Definition: TEcnaRootFile.cc:116
TEcnaWrite
Definition: TEcnaWrite.h:34
TEcnaRun::ReadSampleAdcValues
Bool_t ReadSampleAdcValues()
Definition: TEcnaRun.cc:1237
TEcnaRun::fTagPed
Int_t * fTagPed
Definition: TEcnaRun.h:444
TEcnaRun::fT2d_lf_cor
Double_t ** fT2d_lf_cor
Definition: TEcnaRun.h:478
TEcnaRun::fTagHfCor
Int_t * fTagHfCor
Definition: TEcnaRun.h:489
TEcnaRun::TRootMeanCorss
void TRootMeanCorss()
Definition: TEcnaRun.cc:4756
TEcnaRead::ReadStinNumbers
TVectorD ReadStinNumbers(const Int_t &)
Definition: TEcnaRead.cc:1243
TEcnaRun::fT3d_cov_ss
Double_t *** fT3d_cov_ss
Definition: TEcnaRun.h:432
cTypCorCss
Definition: TEcnaResultType.h:34
TEcnaRun::fT2d1_hfcc_mostins
Double_t * fT2d1_hfcc_mostins
Definition: TEcnaRun.h:497
TEcnaObject::GetPointerValue
Long_t GetPointerValue(const TString &)
Definition: TEcnaObject.cc:209
TEcnaRun::SetEcalSubDetector
void SetEcalSubDetector(const TString &)
Definition: TEcnaRun.cc:272
TEcnaRead::GetStartDate
TString GetStartDate()
Definition: TEcnaRead.cc:835
TEcnaRun::TRootMSp
void TRootMSp(const Int_t &)
Definition: TEcnaRun.cc:4521
TEcnaRun::fTagSSp
Int_t * fTagSSp
Definition: TEcnaRun.h:430
TEcnaRun::Expert1Calculations
void Expert1Calculations()
Definition: TEcnaRun.cc:1468
TEcnaRun::TRootTno
void TRootTno()
Definition: TEcnaRun.cc:4741
TEcnaRun::fNbSampForFic
Int_t fNbSampForFic
Definition: TEcnaRun.h:405