CMS 3D CMS Logo

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