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