CMS 3D CMS Logo

TEcnaRead.cc
Go to the documentation of this file.
1 //----------Author's Name: B.Fabbro, FX Gentit DSM/IRFU/SPP CEA-Saclay
2 //----------Copyright: Those valid for CEA sofware
3 //----------Modified: 04/07/2011
4 
6 
7 //--------------------------------------
8 // TEcnaRead.cc
9 // Class creation: 03 Dec 2002
10 // Documentation: see TEcnaRead.h
11 //--------------------------------------
12 
14 
16 //___________________________________________________________________________
17 //
18 
20  Init();
21  // std::cout << "[Info Management] CLASS: TEcnaRead. CREATE OBJECT: this = " << this << std::endl;
22 }
23 //Constructor without argument
24 
25 TEcnaRead::TEcnaRead(TEcnaObject *pObjectManager, const TString &SubDet) {
26  fObjectManager = (TEcnaObject *)pObjectManager;
27  Long_t i_this = (Long_t)this;
28  pObjectManager->RegisterPointer("TEcnaRead", i_this);
29 
30  //----------------------- Object management
31  //............................ fCnaParCout
32  fCnaParCout = nullptr;
33  Long_t iCnaParCout = pObjectManager->GetPointerValue("TEcnaParCout");
34  if (iCnaParCout == 0) {
35  fCnaParCout = new TEcnaParCout(pObjectManager); /*fCnew++*/
36  } else {
37  fCnaParCout = (TEcnaParCout *)iCnaParCout;
38  }
39 
40  //............................ fCnaParPaths
41  fCnaParPaths = nullptr;
42  Long_t iCnaParPaths = pObjectManager->GetPointerValue("TEcnaParPaths");
43  if (iCnaParPaths == 0) {
44  fCnaParPaths = new TEcnaParPaths(pObjectManager); /*fCnew++*/
45  } else {
46  fCnaParPaths = (TEcnaParPaths *)iCnaParPaths;
47  }
48 
49  //............................ fEcalNumbering
50  fEcalNumbering = nullptr;
51  Long_t iEcalNumbering = pObjectManager->GetPointerValue("TEcnaNumbering");
52  if (iEcalNumbering == 0) {
53  fEcalNumbering = new TEcnaNumbering(pObjectManager, SubDet.Data()); /*fCnew++*/
54  } else {
55  fEcalNumbering = (TEcnaNumbering *)iEcalNumbering;
56  }
57 
58  //............................ fCnaParHistos
59  fCnaParHistos = nullptr;
60  Long_t iCnaParHistos = pObjectManager->GetPointerValue("TEcnaParHistos");
61  if (iCnaParHistos == 0) {
62  fCnaParHistos = new TEcnaParHistos(pObjectManager, SubDet.Data()); /*fCnew++*/
63  } else {
64  fCnaParHistos = (TEcnaParHistos *)iCnaParHistos;
65  }
66 
67  //............................ fCnaWrite
68  fCnaWrite = nullptr;
69  Long_t iCnaWrite = pObjectManager->GetPointerValue("TEcnaWrite");
70  if (iCnaWrite == 0) {
71  fCnaWrite = new TEcnaWrite(pObjectManager, SubDet.Data()); /*fCnew++*/
72  } else {
73  fCnaWrite = (TEcnaWrite *)iCnaWrite;
74  }
75 
76  // fEcal = 0; fEcal = new TEcnaParEcal(SubDet.Data()); // Anew("fEcal");
77  //............................ fEcal => to be changed in fParEcal
78  fEcal = nullptr;
79  Long_t iParEcal = pObjectManager->GetPointerValue("TEcnaParEcal");
80  if (iParEcal == 0) {
81  fEcal = new TEcnaParEcal(pObjectManager, SubDet.Data()); /*fCnew++*/
82  } else {
83  fEcal = (TEcnaParEcal *)iParEcal;
84  }
85 
86  //fFileHeader = 0;
87  //const Text_t *h_name = "CnaHeader"; //==> voir cette question avec FXG
88  //const Text_t *h_title = "CnaHeader"; //==> voir cette question avec FXG
89  //fFileHeader = new TEcnaHeader(h_name, h_title); // Anew("fFileHeader");
90 
91  //............................ fFileHeader
92  const Text_t *h_name = "CnaHeader"; //==> voir cette question avec FXG
93  const Text_t *h_title = "CnaHeader"; //==> voir cette question avec FXG
94 
95  // "CnaHeader" est le nom du fichier utilisé dans ReadRootFileHeader(...) sous la forme:
96  //
97  // TEcnaHeader *h;
98  // h =(TEcnaHeader*)gCnaRootFile->fRootFile->Get("CnaHeader");
99  //
100 
101  fFileHeader = nullptr;
102  Long_t iFileHeader = pObjectManager->GetPointerValue("TEcnaHeader");
103  if (iFileHeader == 0) {
104  fFileHeader = new TEcnaHeader(pObjectManager, h_name, h_title); /*fCnew++*/
105  } else {
106  fFileHeader = (TEcnaHeader *)iFileHeader;
107  }
108 
109  Init();
110  SetEcalSubDetector(SubDet.Data());
111 
112  // std::cout << "[Info Management] CLASS: TEcnaRead. CREATE OBJECT: this = " << this << std::endl;
113 }
114 
116  //Initialisation concerning the ROOT file
117 
118  fCnew = 0;
119  fCdelete = 0;
120 
121  fTTBELL = '\007';
122 
123  fgMaxCar = (Int_t)512;
124 
129 
130  //.................................. Set flag print to "Warnings" (Init)
132 
133  //................................ tags and array Stin numbers
134  fTagStinNumbers = nullptr;
135  fMemoStinNumbers = 0;
136  fT1d_StexStinFromIndex = nullptr;
137 
138  //................................
139  // fMemoReadNumberOfEventsforSamples = 0;
140 
141  //.......................... flag data exist (utile ici?)
142  fDataExist = kFALSE;
143 
144  //......................... transfert Sample ADC Values 3D array (Init)
145  fT3d_AdcValues = nullptr;
146  fT3d2_AdcValues = nullptr;
147  fT3d1_AdcValues = nullptr;
148 
149  //................................. path for .root files
150  Int_t MaxCar = fgMaxCar;
151  MaxCar = fgMaxCar;
152  fPathRoot.Resize(MaxCar);
153  fPathRoot = "fPathRoot not defined";
154 
155  //.................................. Pointer and Flags for Root File (Init)
156  gCnaRootFile = nullptr;
157 
158  fOpenRootFile = kFALSE;
160  fLookAtRootFile = 0;
161 
162  //................................. currently open file
163  MaxCar = fgMaxCar;
164  fFlagNoFileOpen.Resize(MaxCar);
165  fFlagNoFileOpen = "No file is open";
166 
167  MaxCar = fgMaxCar;
168  fCurrentlyOpenFileName.Resize(MaxCar);
170 
171 } // end of Init()
172 
173 //============================================================================================================
174 
175 void TEcnaRead::SetEcalSubDetector(const TString &SubDet) {
176  // Set Subdetector (EB or EE)
177 
178  Int_t MaxCar = fgMaxCar;
179  fFlagSubDet.Resize(MaxCar);
181 
182  if (fFlagSubDet == "EB") {
183  fStexName = "SM";
184  fStinName = "tower";
185  }
186  if (fFlagSubDet == "EE") {
187  fStexName = "Dee";
188  fStinName = "SC";
189  }
190 }
191 
192 //============================================================================================================
193 void TEcnaRead::Anew(const TString &VarName) {
194  // allocation survey for new
195 
196  fCnew++;
197  // std::cout << "TEcnaRead::Anew---> new " << std::setw(4) << fCnew << " --------------> " << std::setw(25)
198  // << VarName.Data() << " / object(this): " << this << std::endl;
199 }
200 
201 void TEcnaRead::Adelete(const TString &VarName) {
202  // allocation survey for delete
203 
204  fCdelete++;
205  // std::cout << "TEcnaRead::Adelete> ========== delete" << std::setw(4) << fCdelete << " -> " << std::setw(25)
206  // << VarName.Data() << " / object(this): " << this << std::endl;
207 }
208 
209 //=========================================== private copy ==========
210 
211 void TEcnaRead::fCopy(const TEcnaRead &rund) {
212  //Private copy
213 
214  fFileHeader = rund.fFileHeader;
216 
217  //........................................ Codes
218 
223 
224  //.................................................. Tags
226 
227  fFlagPrint = rund.fFlagPrint;
228  fPathRoot = rund.fPathRoot;
229 
230  fCnew = rund.fCnew;
231  fCdelete = rund.fCdelete;
232 }
233 
234 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
235 //
236 // copy constructor
237 //
238 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
239 
240 TEcnaRead::TEcnaRead(const TEcnaRead &dcop) : TObject::TObject(dcop) {
241  std::cout << "*TEcnaRead::TEcnaRead(const TEcnaRead& dcop)> "
242  << " It is time to write a copy constructor" << std::endl;
243 
244  // { Int_t cintoto; cin >> cintoto; }
245 }
246 
247 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
248 //
249 // overloading of the operator=
250 //
251 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
252 
254  //Overloading of the operator=
255 
256  fCopy(dcop);
257  return *this;
258 }
259 
260 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
261 //
262 // destructor
263 //
264 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
265 
267  //Destructor
268 
269  // std::cout << "[Info Management] CLASS: TEcnaRead. DESTROY OBJECT: this = " << this << std::endl;
270 
272  std::cout << "*TEcnaRead::~TEcnaRead()> Entering destructor" << std::endl;
273  }
274 
275  //if (fFileHeader != 0){delete fFileHeader; Adelete("fFileHeader");}
276  //if (fEcal != 0){delete fEcal; Adelete("fEcal");}
277  //if (fCnaParCout != 0){delete fCnaParCout; Adelete("fCnaParCout");}
278  //if (fCnaParPaths != 0){delete fCnaParPaths; Adelete("fCnaParPaths");}
279  //if (fCnaWrite != 0){delete fCnaWrite; Adelete("fCnaWrite");}
280  //if (fEcalNumbering != 0){delete fEcalNumbering; Adelete("fEcalNumbering");}
281 
282  if (fT1d_StexStinFromIndex != nullptr) {
283  delete[] fT1d_StexStinFromIndex;
284  Adelete("fT1d_StexStinFromIndex");
285  }
286  if (fTagStinNumbers != nullptr) {
287  delete[] fTagStinNumbers;
288  Adelete("fTagStinNumbers");
289  }
290 
291  if (fT3d_AdcValues != nullptr) {
292  delete[] fT3d_AdcValues;
293  Adelete("fT3d_AdcValues");
294  }
295  if (fT3d2_AdcValues != nullptr) {
296  delete[] fT3d2_AdcValues;
297  Adelete("fT3d2_AdcValues");
298  }
299  if (fT3d1_AdcValues != nullptr) {
300  delete[] fT3d1_AdcValues;
301  Adelete("fT3d1_AdcValues");
302  }
303 
304  if (fCnew != fCdelete) {
305  std::cout << "!TEcnaRead/destructor> WRONG MANAGEMENT OF ALLOCATIONS: fCnew = " << fCnew
306  << ", fCdelete = " << fCdelete << fTTBELL << std::endl;
307  } else {
308  // std::cout << "*TEcnaRead/destructor> BRAVO! GOOD MANAGEMENT OF ALLOCATIONS: fCnew = "
309  // << fCnew << ", fCdelete = " << fCdelete << std::endl;
310  }
311 
313  std::cout << "*TEcnaRead::~TEcnaRead()> End of destructor " << std::endl;
314  }
315 }
316 
317 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
318 //
319 // M E T H O D S
320 //
321 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
322 
323 //============================================================================
324 //
325 // 1 D H I S T O S
326 //
327 //============================================================================
328 TVectorD TEcnaRead::Read1DHisto(const Int_t &VecDim,
329  const TString &UserQuantity,
330  const Int_t &n1StexStin,
331  const Int_t &i0StinEcha,
332  const Int_t &n1Sample) {
333  Int_t VecDimTest = fFileHeader->fReqNbOfEvts;
334 
335  if (VecDim == VecDimTest) {
336  TVectorD vec(VecDim);
337 
338  TString CallingMethod = "1D";
339  TString StandardQuantity = fCnaParHistos->BuildStandard1DHistoCodeY(CallingMethod, UserQuantity);
340 
341  if (StandardQuantity == "Adc") {
342  Int_t i0Sample = n1Sample - 1;
343  vec = ReadSampleAdcValues(n1StexStin, i0StinEcha, i0Sample, VecDim);
344  } else {
345  for (Int_t i = 0; i < VecDim; i++) {
346  vec(i) = (double_t)0.;
347  }
348  std::cout << "!TEcnaRead::Read1DHisto(...)> UserQuantity = " << UserQuantity
349  << "(StandardQuantity = " << StandardQuantity << "). Wrong code, no file reading." << fTTBELL
350  << std::endl;
351  }
352  return vec;
353  } else {
354  TVectorD vec(VecDim);
355  for (Int_t i = 0; i < VecDim; i++) {
356  vec(i) = (double_t)0.;
357  }
358  std::cout << "!TEcnaRead::Read1DHisto(...)> UserQuantity = " << UserQuantity << ", VecDim = " << VecDim
359  << "(VecDimTest = " << VecDimTest << ")"
360  << ". Wrong code or array dimension. No file reading." << fTTBELL << std::endl;
361  return vec;
362  }
363 } // end of Read1DHisto / ReadSampleAdcValues
364 
365 TVectorD TEcnaRead::Read1DHisto(const Int_t &VecDim, const TString &UserQuantity, const Int_t &n1StexStin) {
366  Int_t VecDimTest = fEcal->MaxCrysInStin() * fEcal->MaxSampADC();
367  if (VecDim == VecDimTest) {
368  TVectorD vec(VecDim);
369 
370  TString CallingMethod = "1D";
371  TString StandardQuantity = fCnaParHistos->BuildStandard1DHistoCodeY(CallingMethod, UserQuantity);
372 
373  if (StandardQuantity == "MSp" || StandardQuantity == "SSp") {
374  if (StandardQuantity == "MSp") {
375  vec = ReadSampleMeans(n1StexStin, VecDim);
376  }
377  if (StandardQuantity == "SSp") {
378  vec = ReadSampleSigmas(n1StexStin, VecDim);
379  }
380  } else {
381  for (Int_t i = 0; i < VecDim; i++) {
382  vec(i) = (double_t)0.;
383  }
384  std::cout << "!TEcnaRead::Read1DHisto(...)> UserQuantity = " << UserQuantity
385  << ", StandardQuantity = " << StandardQuantity << ". Wrong code, no file reading." << fTTBELL
386  << std::endl;
387  }
388  return vec;
389  } else {
390  TVectorD vec(VecDim);
391  for (Int_t i = 0; i < VecDim; i++) {
392  vec(i) = (double_t)0.;
393  }
394  std::cout << "!TEcnaRead::Read1DHisto(...)> UserQuantity = " << UserQuantity << ", VecDim = " << VecDim
395  << "(VecDimTest = " << VecDimTest << ")"
396  << ". Wrong code or array dimension. No file reading." << fTTBELL << std::endl;
397  return vec;
398  }
399 } // end of Read1DHisto / ReadSampleMeans , ReadSampleSigmas
400 
401 TVectorD TEcnaRead::Read1DHisto(const Int_t &VecDim, const TString &UserQuantity, const TString &UserDetector) {
402  // VecDim = fEcal->MaxCrysEcnaInStex if StandardDetector = "SM" or "Dee"
403  // VecDim = fEcal->MaxStinEcnaInStas if StandardDetector = "EB" or "EE"
404 
405  Int_t VecDimTest = 1;
406  TString StandardDetector = fCnaParHistos->BuildStandardDetectorCode(UserDetector);
407  if (StandardDetector == "SM" || StandardDetector == "Dee") {
408  VecDimTest = fEcal->MaxCrysEcnaInStex();
409  }
410  if (StandardDetector == "EB" || StandardDetector == "EE") {
411  VecDimTest = fEcal->MaxStinEcnaInStas();
412  }
413 
414  if (VecDim == VecDimTest) {
415  TVectorD vec(VecDim);
416 
417  TString CallingMethod = "1D";
418  TString StandardQuantity = "?";
419  StandardQuantity = fCnaParHistos->BuildStandard1DHistoCodeY(CallingMethod, UserQuantity);
420  TString rTechReadCode = GetTechReadCode(StandardQuantity, StandardDetector);
421 
422  if (rTechReadCode != "?") {
423  if (StandardDetector == "SM" || StandardDetector == "Dee") {
424  if (rTechReadCode == "NOEStex") {
426  }
427  if (rTechReadCode == "PedStex") {
429  }
430  if (rTechReadCode == "TNoStex") {
432  }
433  if (rTechReadCode == "LFNStex") {
435  }
436  if (rTechReadCode == "HFNStex") {
438  }
439  if (rTechReadCode == "MCsStex") {
441  }
442  if (rTechReadCode == "SCsStex") {
444  }
445  }
446 
447  if (StandardDetector == "EB" || StandardDetector == "EE") {
448  TVectorD vecStex(fEcal->MaxStinEcnaInStex());
449  for (Int_t i = 0; i < fEcal->MaxStinEcnaInStex(); i++) {
450  vecStex(i) = (Double_t)0.;
451  }
452 
453  time_t xStartTime = GetStartTime();
454  time_t xStopTime = GetStopTime();
455  TString xStartDate = "sStartDate";
456  TString xStopDate = "sStopDate";
457 
458  for (Int_t i0Stex = 0; i0Stex < fEcal->MaxStexInStas(); i0Stex++) {
459  Int_t n1Stex = i0Stex + 1;
466  n1Stex,
467  fPathRoot);
468 
469  if (LookAtRootFile() == kTRUE) {
470  if (rTechReadCode == "NOEStas") {
472  }
473  if (rTechReadCode == "PedStas") {
475  }
476  if (rTechReadCode == "TNoStas") {
478  }
479  if (rTechReadCode == "LFNStas") {
481  }
482  if (rTechReadCode == "HFNStas") {
484  }
485  if (rTechReadCode == "MCsStas") {
487  }
488  if (rTechReadCode == "SCsStas") {
490  }
491 
492  for (Int_t i0Stin = 0; i0Stin < fEcal->MaxStinEcnaInStex(); i0Stin++) {
493  vec(fEcal->MaxStinEcnaInStex() * i0Stex + i0Stin) = vecStex(i0Stin);
494  }
495 
496  //............ Get start and stop date for the Stas (Stas = EB or EE)
497  if (i0Stex == 0) {
498  xStartTime = GetStartTime();
499  xStopTime = GetStopTime();
500  xStartDate = GetStartDate();
501  xStopDate = GetStopDate();
502  }
503  time_t cStartTime = GetStartTime();
504  time_t cStopTime = GetStopTime();
505  TString cStartDate = GetStartDate();
506  TString cStopDate = GetStopDate();
507 
508  if (cStartTime < xStartTime) {
509  xStartTime = cStartTime;
510  xStartDate = cStartDate;
511  }
512  if (cStopTime > xStopTime) {
513  xStopTime = cStopTime;
514  xStopDate = cStopDate;
515  }
516 
517  fFileHeader->fStartDate = xStartDate;
518  fFileHeader->fStopDate = xStopDate;
519  } else {
520  std::cout << "!TEcnaRead::Read1DHisto(const TString&, const TString&)> *ERROR* =====> "
521  << " ROOT file not found" << fTTBELL << std::endl;
522  }
523  }
524  }
525  } else {
526  for (Int_t i = 0; i < VecDim; i++) {
527  vec(i) = (double_t)0.;
528  }
529  std::cout << "!TEcnaRead::Read1DHisto(...)> UserQuantity = " << UserQuantity
530  << ", UserDetector = " << UserDetector << ". Wrong code(s). No file reading." << fTTBELL << std::endl;
531  }
532  return vec;
533  } else {
534  TVectorD vec(VecDim);
535  for (Int_t i = 0; i < VecDim; i++) {
536  vec(i) = (double_t)0.;
537  }
538  std::cout << "!TEcnaRead::Read1DHisto(...)> UserQuantity = " << UserQuantity << ", UserDetector = " << UserDetector
539  << ", VecDim = " << VecDim << ". Wrong code(s) or array dimension. No file reading." << fTTBELL
540  << std::endl;
541  return vec;
542  }
543 } // end of Read1DHisto / Stex and Stas histos
544 
545 //============================================================================
546 //
547 // 2 D H I S T O S
548 //
549 //============================================================================
550 TMatrixD TEcnaRead::ReadMatrix(const Int_t &MatDim,
551  const TString &UserCorOrCov,
552  const TString &UserBetweenWhat,
553  const Int_t &nb_arg_1,
554  const Int_t &nb_arg_2) {
555  TMatrixD mat(MatDim, MatDim);
556  TString CallingMethod = "2D";
557  TString StandardMatrixType = "?";
558  TString StandardBetweenWhat = "?";
559 
560  StandardMatrixType = fCnaParHistos->BuildStandardCovOrCorCode(CallingMethod, UserCorOrCov);
561  StandardBetweenWhat = fCnaParHistos->BuildStandardBetweenWhatCode(CallingMethod, UserBetweenWhat);
562 
563  if (StandardMatrixType != "?" && StandardBetweenWhat != "?") {
564  if (StandardBetweenWhat == "Mss") {
565  Int_t n1StexStin = nb_arg_1;
566  Int_t i0StinEcha = nb_arg_2;
567 
568  if (StandardMatrixType == "Cov") {
569  mat = ReadCovariancesBetweenSamples(n1StexStin, i0StinEcha, MatDim);
570  }
571 
572  if (StandardMatrixType == "Cor") {
573  mat = ReadCorrelationsBetweenSamples(n1StexStin, i0StinEcha, MatDim);
574  }
575  }
576 
577  if (StandardBetweenWhat != "Mss") {
578  Int_t n1StexStin_a = nb_arg_1;
579  Int_t n1StexStin_b = nb_arg_2;
580 
581  if (StandardMatrixType == "Cov" && StandardBetweenWhat == "MccLF") {
582  mat = ReadLowFrequencyCovariancesBetweenChannels(n1StexStin_a, n1StexStin_b, MatDim);
583  }
584 
585  if (StandardMatrixType == "Cor" && StandardBetweenWhat == "MccLF") {
586  mat = ReadLowFrequencyCorrelationsBetweenChannels(n1StexStin_a, n1StexStin_b, MatDim);
587  }
588 
589  if (StandardMatrixType == "Cov" && StandardBetweenWhat == "MccHF") {
590  mat = ReadHighFrequencyCovariancesBetweenChannels(n1StexStin_a, n1StexStin_b, MatDim);
591  }
592 
593  if (StandardMatrixType == "Cor" && StandardBetweenWhat == "MccHF") {
594  mat = ReadHighFrequencyCorrelationsBetweenChannels(n1StexStin_a, n1StexStin_b, MatDim);
595  }
596  }
597  } else {
598  for (Int_t i = 0; i - MatDim < 0; i++) {
599  for (Int_t j = 0; j - MatDim < 0; j++) {
600  mat(i, j) = (double_t)0.;
601  }
602  }
603  std::cout << "!TEcnaRead::ReadMatrix(...)> UserCorOrCov = " << UserCorOrCov
604  << ", UserBetweenWhat = " << UserBetweenWhat << ". Wrong code(s), no file reading." << fTTBELL
605  << std::endl;
606  }
607  return mat;
608 }
609 
610 TMatrixD TEcnaRead::ReadMatrix(const Int_t &MatDim, const TString &UserCorOrCov, const TString &UserBetweenWhat) {
611  //------------------- (BIG MATRIX 1700x1700 for barrel, 5000x5000 for endcap) ------------------
612  TMatrixD mat(MatDim, MatDim);
613  TString CallingMethod = "2D";
614  TString StandardMatrixType = "?";
615  TString StandardBetweenWhat = "?";
616 
617  StandardMatrixType = fCnaParHistos->BuildStandardCovOrCorCode(CallingMethod, UserCorOrCov);
618  StandardBetweenWhat = fCnaParHistos->BuildStandardBetweenWhatCode(CallingMethod, UserBetweenWhat);
619 
620  if (StandardMatrixType != "?" && StandardBetweenWhat != "?") {
621  //......................... between channels (covariances, correlations)
622  if (StandardMatrixType == "Cov" && StandardBetweenWhat == "MccLF") {
624  }
625 
626  if (StandardMatrixType == "Cor" && StandardBetweenWhat == "MccLF") {
628  }
629 
630  if (StandardMatrixType == "Cov" && StandardBetweenWhat == "MccHF") {
632  }
633 
634  if (StandardMatrixType == "Cor" && StandardBetweenWhat == "MccHF") {
636  }
637 
638  //......................... between Stins (mean correlations)
639  if (StandardMatrixType == "Cor" && StandardBetweenWhat == "MttLF") {
641  }
642 
643  if (StandardMatrixType == "Cor" && StandardBetweenWhat == "MttHF") {
645  }
646  } else {
647  for (Int_t i = 0; i - MatDim < 0; i++) {
648  for (Int_t j = 0; j - MatDim < 0; j++) {
649  mat(i, j) = (double_t)0.;
650  }
651  }
652  std::cout << "!TEcnaRead::ReadMatrix(...)> UserCorOrCov = " << UserCorOrCov
653  << ", UserBetweenWhat = " << UserBetweenWhat << ". Wrong code(s), no file reading." << fTTBELL
654  << std::endl;
655  }
656  return mat;
657 }
658 
659 //============================================================================
660 TString TEcnaRead::GetTechReadCode(const TString &StandardQuantity, const TString &StandardDetector) {
661  TString rTechReadCode = "?";
662  TString dTechDetector = "?";
663 
664  if (StandardDetector == "SM" || StandardDetector == "Dee") {
665  dTechDetector = "Stex";
666  }
667  if (StandardDetector == "EB" || StandardDetector == "EE") {
668  dTechDetector = "Stas";
669  }
670 
671  if (dTechDetector == "?") {
672  std::cout << "!TEcnaRead::GetTechReadCode(...)> *** ERROR: wrong standard code *** dTechDetector = "
673  << dTechDetector << ", StandardDetector = " << StandardDetector << fTTBELL << std::endl;
674  } else {
675  if (StandardQuantity == "NOE" && dTechDetector == "Stex") {
676  rTechReadCode = "NOEStex";
677  }
678  if (StandardQuantity == "NOE" && dTechDetector == "Stas") {
679  rTechReadCode = "NOEStas";
680  }
681  if (StandardQuantity == "Ped" && dTechDetector == "Stex") {
682  rTechReadCode = "PedStex";
683  }
684  if (StandardQuantity == "Ped" && dTechDetector == "Stas") {
685  rTechReadCode = "PedStas";
686  }
687  if (StandardQuantity == "TNo" && dTechDetector == "Stex") {
688  rTechReadCode = "TNoStex";
689  }
690  if (StandardQuantity == "TNo" && dTechDetector == "Stas") {
691  rTechReadCode = "TNoStas";
692  }
693  if (StandardQuantity == "LFN" && dTechDetector == "Stex") {
694  rTechReadCode = "LFNStex";
695  }
696  if (StandardQuantity == "LFN" && dTechDetector == "Stas") {
697  rTechReadCode = "LFNStas";
698  }
699  if (StandardQuantity == "HFN" && dTechDetector == "Stex") {
700  rTechReadCode = "HFNStex";
701  }
702  if (StandardQuantity == "HFN" && dTechDetector == "Stas") {
703  rTechReadCode = "HFNStas";
704  }
705  if (StandardQuantity == "MCs" && dTechDetector == "Stex") {
706  rTechReadCode = "MCsStex";
707  }
708  if (StandardQuantity == "MCs" && dTechDetector == "Stas") {
709  rTechReadCode = "MCsStas";
710  }
711  if (StandardQuantity == "SCs" && dTechDetector == "Stex") {
712  rTechReadCode = "SCsStex";
713  }
714  if (StandardQuantity == "SCs" && dTechDetector == "Stas") {
715  rTechReadCode = "SCsStas";
716  }
717  }
718 
719  if (rTechReadCode == "?") {
720  std::cout << "!TEcnaRead::GetTechReadCode(...)> *** ERROR: wrong standard code *** rTechReadCode = "
721  << rTechReadCode << ", StandardQuantity = " << StandardQuantity << fTTBELL << std::endl;
722  }
723 
724  return rTechReadCode;
725 }
726 
727 //==========================================================================================
728 //
729 // FileParameters(...)
730 //
731 //==========================================================================================
732 void TEcnaRead::FileParameters(const TString &typ_ana,
733  const Int_t &nb_of_samples,
734  const Int_t &run_number,
735  const Int_t &nfirst,
736  const Int_t &nlast,
737  const Int_t &nreqevts,
738  const Int_t &Stex,
739  const TString &path_root) {
740  // Preparation for reading the ROOT file
741  // Preliminary save of the arguments values because they can be of the form: fFileHeader->...
742  // and because fFileHeader can be deleted and re-created in this method
743 
744  const TString &sTypAna = typ_ana;
745  Int_t nNbOfSamples = nb_of_samples;
746  Int_t nRunNumber = run_number;
747  Int_t nFirstEvt = nfirst;
748  Int_t nLastEvt = nlast;
749  Int_t nReqNbOfEvts = nreqevts;
750  Int_t nStexNumber = Stex;
751 
752  //................................................................................................
753  const Text_t *h_name = "CnaHeader"; //==> voir cette question avec FXG
754  const Text_t *h_title = "CnaHeader"; //==> voir cette question avec FXG
755 
756  // "CnaHeader" est le nom du fichier utilisé dans ReadRootFileHeader(...) sous la forme:
757  //
758  // TEcnaHeader *h;
759  // h =(TEcnaHeader*)gCnaRootFile->fRootFile->Get("CnaHeader");
760  //
761 
762  //----------- old version, with arguments h_name, h_title, (FXG) ----------
763  //
764  // fFileHeader->HeaderParameters(h_name, h_title,
765  // sTypAna, nNbOfSamples, nRunNumber,
766  // nFirstEvt, nLastEvt, nReqNbOfEvts, nStexNumber);
767  //
768  //-------------------------------------------------------------------------
769 
770  //---------- new version
771  if (fFileHeader == nullptr) {
772  fFileHeader = new TEcnaHeader(fObjectManager, h_name, h_title); /* Anew("fFileHeader") */
773  ;
774  }
775  fFileHeader->HeaderParameters(sTypAna, nNbOfSamples, nRunNumber, nFirstEvt, nLastEvt, nReqNbOfEvts, nStexNumber);
776 
777  // After this call to TEcnaHeader, we have:
778  // fFileHeader->fTypAna = sTypAna
779  // fFileHeader->fNbOfSamples = nNbOfSamples
780  // fFileHeader->fRunNumber = nRunNumber
781  // fFileHeader->fFirstReqEvtNumber = nFirstEvt
782  // fFileHeader->fLastReqEvtNumber = nLastEvt
783  // fFileHeader->fReqNbOfEvts = nReqNbOfEvts
784  // fFileHeader->fStex = nStexNumber ( FileParameters(...) )
785  //.......................... path_root
786  fPathRoot = path_root;
787 
788  //-------- gets the arguments for the file names (long and short) and makes these names
789  fCnaWrite->RegisterFileParameters(typ_ana, nb_of_samples, run_number, nfirst, nlast, nreqevts, Stex);
791  // names can be now recovered by call to TEcnaWrite methods: GetRootFileName() and GetRootFileNameShort()
792 
793  //------------------------- init Stin numbers memo flags
794  fMemoStinNumbers = 0;
795 
797  std::cout << std::endl;
798  std::cout << "*TEcnaRead::FileParameters(...)>" << std::endl
799  << " The method has been called with the following argument values:" << std::endl
800  << " Analysis name = " << fFileHeader->fTypAna << std::endl
801  << " Nb of required samples = " << fFileHeader->fNbOfSamples << std::endl
802  << " Run number = " << fFileHeader->fRunNumber << std::endl
803  << " First requested event number = " << fFileHeader->fFirstReqEvtNumber << std::endl
804  << " Last requested event number = " << fFileHeader->fLastReqEvtNumber << std::endl
805  << " Requested number of events = " << fFileHeader->fReqNbOfEvts << std::endl
806  << " Stex number = " << fFileHeader->fStex << std::endl
807  << " Path for the ROOT file = " << fPathRoot << std::endl
808  << std::endl;
809  }
810 
811  fReadyToReadRootFile = 1; // set flag
812 
813 } //----------------- end of FileParameters(...)
814 
815 //=========================================================================
816 //
817 // GetAnalysisName, GetNbOfSamples, GetRunNumber, GetFirstReqEvtNumber
818 // GetLastReqEvtNumber, GetReqNbOfEvts, GetStexNumber
819 //
820 //=========================================================================
828 //=========================================================================
829 //
830 // GetStartDate, GetStopDate, GetRunType
831 //
832 //=========================================================================
838  TString cType = "run type not defined";
839  Int_t numtype = fFileHeader->fRunType;
840  //----------------------------------------- run types
841 
842  if (numtype == 0) {
843  cType = "COSMICS";
844  }
845  if (numtype == 1) {
846  cType = "BEAMH4";
847  }
848  if (numtype == 2) {
849  cType = "BEAMH2";
850  }
851  if (numtype == 3) {
852  cType = "MTCC";
853  }
854  if (numtype == 4) {
855  cType = "LASER_STD";
856  }
857  if (numtype == 5) {
858  cType = "LASER_POWER_SCAN";
859  }
860  if (numtype == 6) {
861  cType = "LASER_DELAY_SCAN";
862  }
863  if (numtype == 7) {
864  cType = "TESTPULSE_SCAN_MEM";
865  }
866  if (numtype == 8) {
867  cType = "TESTPULSE_MGPA";
868  }
869  if (numtype == 9) {
870  cType = "PEDESTAL_STD";
871  }
872  if (numtype == 10) {
873  cType = "PEDESTAL_OFFSET_SCAN";
874  }
875  if (numtype == 11) {
876  cType = "PEDESTAL_25NS_SCAN";
877  }
878  if (numtype == 12) {
879  cType = "LED_STD";
880  }
881 
882  if (numtype == 13) {
883  cType = "PHYSICS_GLOBAL";
884  }
885  if (numtype == 14) {
886  cType = "COSMICS_GLOBAL";
887  }
888  if (numtype == 15) {
889  cType = "HALO_GLOBAL";
890  }
891 
892  if (numtype == 16) {
893  cType = "LASER_GAP";
894  }
895  if (numtype == 17) {
896  cType = "TESTPULSE_GAP";
897  }
898  if (numtype == 18) {
899  cType = "PEDESTAL_GAP";
900  }
901  if (numtype == 19) {
902  cType = "LED_GAP";
903  }
904 
905  if (numtype == 20) {
906  cType = "PHYSICS_LOCAL";
907  }
908  if (numtype == 21) {
909  cType = "COSMICS_LOCAL";
910  }
911  if (numtype == 22) {
912  cType = "HALO_LOCAL";
913  }
914  if (numtype == 23) {
915  cType = "CALIB_LOCAL";
916  }
917 
918  if (numtype == 24) {
919  cType = "PEDSIM";
920  }
921 
922  return cType;
923 }
924 //==========================================================================
925 //
926 // R E A D M E T H O D S
927 // ( R O O T F I L E )
928 //
929 //==========================================================================
930 //-------------------------------------------------------------
931 //
932 // OpenRootFile
933 //
934 //-------------------------------------------------------------
935 Bool_t TEcnaRead::OpenRootFile(const Text_t *name, const TString &status) {
936  //Open the Root file
937 
938  Bool_t ok_open = kFALSE;
939 
940  TString s_name;
941  s_name = fPathRoot;
942  s_name.Append('/');
943  s_name.Append(name);
944 
945  // if( gCnaRootFile != 0 )
946  // {
947  // Int_t iPointer = (Int_t)gCnaRootFile;
948  // std::cout << "*TEcnaRead::OpenRootFile(...)> RootFile pointer not (re)initialized to 0. gCnaRootFile = "
949  // << gCnaRootFile << ", pointer = " << iPointer << fTTBELL << std::endl;
950  //
951  // delete gCnaRootFile; gCnaRootFile = 0; Adelete("gCnaRootFile");
952  // }
953 
954  //if( gCnaRootFile != 0 ){gCnaRootFile->ReStart(s_name.Data(), status);}
955  //if( gCnaRootFile == 0 )
956  // {
957  // gCnaRootFile = new TEcnaRootFile(fObjectManager, s_name.Data(), status); Anew("gCnaRootFile");
958 
959  Long_t iCnaRootFile = fObjectManager->GetPointerValue("TEcnaRootFile");
960  if (iCnaRootFile == 0) {
961  gCnaRootFile = new TEcnaRootFile(fObjectManager, s_name.Data(), status); /* Anew("gCnaRootFile");*/
962  } else {
963  gCnaRootFile = (TEcnaRootFile *)iCnaRootFile;
964  gCnaRootFile->ReStart(s_name.Data(), status);
965  }
966  // }
967 
968  if (gCnaRootFile->fRootFileStatus == "RECREATE") {
969  ok_open = gCnaRootFile->OpenW();
970  }
971  if (gCnaRootFile->fRootFileStatus == "READ") {
972  ok_open = gCnaRootFile->OpenR();
973  }
974 
975  if (ok_open == kFALSE) {
976  std::cout << "!TEcnaRead::OpenRootFile> " << s_name.Data() << ": file not found." << std::endl;
977  //if( gCnaRootFile != 0 )
978  // {delete gCnaRootFile; gCnaRootFile = 0; Adelete("gCnaRootFile");}
979  } else {
981  std::cout << "*TEcnaRead::OpenRootFile> Open ROOT file " << s_name.Data() << " OK "
982  << ", gCnaRootFile = " << gCnaRootFile << std::endl;
983  }
984  fOpenRootFile = kTRUE;
985  fCurrentlyOpenFileName = s_name;
987  std::cout << "*TEcnaRead::OpenRootFile> Open ROOT file: " << fCurrentlyOpenFileName.Data() << " => OK "
988  << ", gCnaRootFile = " << gCnaRootFile << std::endl
989  << std::endl;
990  }
991  }
992  return ok_open;
993 } // end of OpenRootFile()
994 
995 //-------------------------------------------------------------
996 //
997 // CloseRootFile
998 //
999 //-------------------------------------------------------------
1000 Bool_t TEcnaRead::CloseRootFile(const Text_t *name) {
1001  //Close the Root file
1002 
1003  Bool_t ok_close = kFALSE;
1004 
1005  if (fOpenRootFile == kTRUE) {
1006  if (gCnaRootFile != nullptr) {
1008 
1010  TString e_path;
1011  e_path.Append(name);
1012  std::cout << "*TEcnaRead::CloseRootFile> Close ROOT file " << e_path.Data() << " OK " << std::endl;
1013  }
1015  Long_t pointer_value = (Long_t)gCnaRootFile;
1016  std::cout << "*TEcnaRead::CloseRootFile(...)> going to delete gCnaRootFile, gCnaRootFile = " << gCnaRootFile
1017  << ", pointer = " << pointer_value << std::endl;
1018  }
1019 
1020  //delete gCnaRootFile; gCnaRootFile = 0; Adelete("gCnaRootFile");
1021 
1022  ok_close = kTRUE;
1023  fOpenRootFile = kFALSE;
1026  } else {
1027  std::cout << "*TEcnaRead::CloseRootFile(...)> RootFile pointer equal to zero. Close not possible. gCnaRootFile = "
1028  << gCnaRootFile << fTTBELL << std::endl;
1029  }
1030  } else {
1031  std::cout << "*TEcnaRead::CloseRootFile(...)> no close since no file is open. fOpenRootFile = " << fOpenRootFile
1032  << std::endl;
1033  }
1034  return ok_close;
1035 }
1036 
1037 //============================================================================
1038 //
1039 // LookAtRootFile()
1040 // Called by TEcnaHistos
1041 //
1042 //============================================================================
1044  //---------- Reads the ROOT file header and makes allocations and some other things
1045 
1046  fLookAtRootFile = 0; // set flag to zero before looking for the file
1047 
1048  if (fReadyToReadRootFile == 1) {
1049  //------------ Call to ReadRootFileHeader
1050  Int_t iprint = 0;
1051  if (ReadRootFileHeader(iprint) == kTRUE) // (1) = print, (0) = no print
1052  {
1053  //........................................ allocation tags
1054  if (fTagStinNumbers == nullptr) {
1055  fTagStinNumbers = new Int_t[1];
1056  Anew("fTagStinNumbers");
1057  }
1058 
1059  //...................... allocation for fT1d_StexStinFromIndex[]
1060  if (fT1d_StexStinFromIndex == nullptr) {
1062  Anew("fT1d_StexStinFromIndex");
1063  }
1064 
1065  //.. recover of the Stin numbers from the ROOT file (= init fT1d_StexStinFromIndex+init TagStin)
1066  TVectorD vec(fEcal->MaxStinEcnaInStex());
1067  for (Int_t i = 0; i < fEcal->MaxStinEcnaInStex(); i++) {
1068  vec(i) = (Double_t)0.;
1069  }
1071 
1072  for (Int_t i = 0; i < fEcal->MaxStinEcnaInStex(); i++) {
1073  fT1d_StexStinFromIndex[i] = (Int_t)vec(i);
1074  }
1075 
1076  fTagStinNumbers[0] = 1;
1078 
1079  fLookAtRootFile = 1; // set flag
1080  return kTRUE;
1081  } else {
1082  std::cout << "!TEcnaRead::LookAtRootFile()> *** ERROR ***>"
1083  << " ROOT file not found " << fTTBELL << std::endl;
1084  return kFALSE;
1085  }
1086  } else {
1087  std::cout << "!TEcnaRead::LookAtRootFile()> *** ERROR ***>"
1088  << " FileParameters not called " << fTTBELL << std::endl;
1089  return kFALSE;
1090  }
1091  return kFALSE;
1092 } //----------------- end of LookAtRootFile()
1093 //-------------------------------------------------------------------------
1094 //
1095 // DataExist()
1096 //
1097 // DON'T SUPPRESS: CALLED BY ANOTHER CLASSES
1098 //
1099 //-------------------------------------------------------------------------
1101  // return kTRUE if the data are present in the ROOT file, kFALSE if not.
1102  // fDataExist is set in the read methods
1103 
1104  return fDataExist;
1105 }
1106 //-------------------------------------------------------------------------
1107 //
1108 // ReadRootFileHeader
1109 //
1110 //-------------------------------------------------------------------------
1111 Bool_t TEcnaRead::ReadRootFileHeader(const Int_t &i_print) {
1112  //Read the header of the Root file => test the file existence
1113 
1114  const Text_t *file_name = (const Text_t *)fCnaWrite->fRootFileNameShort.Data();
1115  const Text_t *current_file_name = (const Text_t *)fCurrentlyOpenFileName.Data();
1116 
1117  if (i_print == 1) {
1118  std::cout << "*TEcnaRead::ReadRootFileHeader> file_name = " << fCnaWrite->fRootFileNameShort.Data() << std::endl;
1119  }
1120 
1121  Bool_t ok_open = kFALSE;
1122 
1123  TString FileNameLong = fCnaWrite->GetRootFileName();
1124  Bool_t allowed_to_read = kFALSE;
1125 
1126  // if( fOpenRootFile )
1127  // {
1128  // std::cout << "!TEcnaRead::ReadRootFileHeader(...)*** ERROR ***> "
1129  // << "Reading header on file already open." << std::endl;
1130  // }
1131 
1132  if (FileNameLong == fCurrentlyOpenFileName) {
1133  allowed_to_read = kTRUE;
1134  } else {
1136  CloseRootFile(current_file_name);
1137  }
1138  ok_open = OpenRootFile(file_name, "READ");
1139  if (ok_open) {
1140  allowed_to_read = kTRUE;
1141  } else {
1142  std::cout << "!TEcnaRead::ReadRootFileHeader(...) *** ERROR ***> Open .root file failed for file: " << file_name
1143  << fTTBELL << std::endl;
1144  allowed_to_read = kFALSE;
1145  }
1146  }
1147 
1148  if (allowed_to_read == kTRUE) {
1149  TEcnaHeader *headerFile;
1150  headerFile = (TEcnaHeader *)gCnaRootFile->fRootFile->Get("CnaHeader");
1151 
1152  //..... get the attributes which are not already set by the call to TEcnaHeader
1153  // in FileParameters(...) and are only available in the ROOT file
1154 
1155  fFileHeader->fStartTime = headerFile->fStartTime;
1156  fFileHeader->fStopTime = headerFile->fStopTime;
1157  fFileHeader->fStartDate = headerFile->fStartDate;
1158  fFileHeader->fStopDate = headerFile->fStopDate;
1159 
1160  fFileHeader->fRunType = headerFile->fRunType;
1161 
1162  //....... Les f..Calc dans le header: pour acces direct a la taille des differentes data du fichier
1164  fFileHeader->fAdcEvtCalc = headerFile->fAdcEvtCalc;
1165  fFileHeader->fMSpCalc = headerFile->fMSpCalc;
1166  fFileHeader->fSSpCalc = headerFile->fSSpCalc;
1167  fFileHeader->fAvTnoCalc = headerFile->fAvTnoCalc;
1168  fFileHeader->fAvLfnCalc = headerFile->fAvLfnCalc;
1169  fFileHeader->fAvHfnCalc = headerFile->fAvHfnCalc;
1170 
1171  fFileHeader->fCovCssCalc = headerFile->fCovCssCalc;
1172  fFileHeader->fCorCssCalc = headerFile->fCorCssCalc;
1173  fFileHeader->fHfCovCalc = headerFile->fHfCovCalc;
1174  fFileHeader->fHfCorCalc = headerFile->fHfCorCalc;
1175  fFileHeader->fLfCovCalc = headerFile->fLfCovCalc;
1176  fFileHeader->fLfCorCalc = headerFile->fLfCorCalc;
1179  fFileHeader->fMeanCorssCalc = headerFile->fMeanCorssCalc;
1180  fFileHeader->fSigCorssCalc = headerFile->fSigCorssCalc;
1181 
1182  fFileHeader->fAvPedCalc = headerFile->fAvPedCalc;
1185 
1186  if (i_print == 1) {
1187  fFileHeader->Print();
1188  }
1189 
1190  CloseRootFile(file_name);
1191  return kTRUE;
1192  }
1193  return kFALSE;
1194 }
1195 //-------------------------------------------------------------------------
1196 void TEcnaRead::TestArrayDimH1(const TString &CallingMethod,
1197  const TString &MaxName,
1198  const Int_t &MaxValue,
1199  const Int_t &VecDim) {
1200  // array dim test
1201 
1202  if (MaxValue != VecDim) {
1203  std::cout << "!TEcnaRead::TestArrayDimH1(...)> No matching for array dimension: CallingMethod: "
1204  << CallingMethod.Data() << ", MaxName: " << MaxName.Data() << ", Maxvalue = " << MaxValue
1205  << ", VecDim = " << VecDim << fTTBELL << std::endl;
1206  }
1207 #define NOPM
1208 #ifndef NOPM
1209  else {
1210  std::cout << "!TEcnaRead::TestArrayDimH1(...)> matching array dimension: OK. CallingMethod: "
1211  << CallingMethod.Data() << ", MaxName: " << MaxName.Data() << ", Maxvalue = " << MaxValue
1212  << ", VecDim = " << VecDim << std::endl;
1213  }
1214 #endif // NOPM
1215 }
1216 //-------------------------------------------------------------------------
1217 void TEcnaRead::TestArrayDimH2(const TString &CallingMethod,
1218  const TString &MaxName,
1219  const Int_t &MaxValue,
1220  const Int_t &MatDim) {
1221  // array dim test
1222 
1223  if (MaxValue != MatDim) {
1224  std::cout << "!TEcnaRead::TestArrayDimH2(...)> No matching for array dimension: CallingMethod: "
1225  << CallingMethod.Data() << ", MaxName: " << MaxName.Data() << ", Maxvalue = " << MaxValue
1226  << ", MatDim = " << MatDim << fTTBELL << std::endl;
1227  }
1228 #define NOPN
1229 #ifndef NOPN
1230  else {
1231  std::cout << "!TEcnaRead::TestArrayDimH2(...)> matching array dimension: OK. CallingMethod: "
1232  << CallingMethod.Data() << ", MaxName: " << MaxName.Data() << ", Maxvalue = " << MaxValue
1233  << ", MatDim = " << MatDim << std::endl;
1234  }
1235 #endif // NOPN
1236 }
1237 
1238 //-------------------------------------------------------------------------
1239 //
1240 // ReadStinNumbers(...)
1241 //
1242 //-------------------------------------------------------------------------
1243 TVectorD TEcnaRead::ReadStinNumbers(const Int_t &VecDim) {
1244  //Get the Stin numbers and put them in a TVectorD
1245  //Read the ROOT file at first call and load in a TVectorD attribute
1246  //Get directly the TVectorD attribute at other times
1247  //
1248  // Possible values for VecDim:
1249  // (1) VecDim = fEcal->MaxStinEcnaInStex()
1250 
1251  TVectorD vec(VecDim);
1252 
1253  TestArrayDimH1("ReadStinNumbers", "fEcal->MaxStinEcnaInStex()", fEcal->MaxStinEcnaInStex(), VecDim);
1254 
1255  for (Int_t i = 0; i < VecDim; i++) {
1256  vec(i) = (Double_t)0.;
1257  }
1258 
1259  if (fMemoStinNumbers == 0) {
1260  CnaResultTyp typ = cTypNumbers;
1261  const Text_t *file_name = (const Text_t *)fCnaWrite->fRootFileNameShort.Data();
1262  const Text_t *current_file_name = (const Text_t *)fCurrentlyOpenFileName.Data();
1263 
1264  //.............. reading of the ROOT file data type TResultTyp = cTypStinsNumbers
1265  // to get the conversion: Stin index -> Stin number (n1StexStin)
1266 
1267  Bool_t ok_open = kFALSE;
1268  Bool_t ok_read = kFALSE;
1269 
1270  TString FileNameLong = fCnaWrite->GetRootFileName();
1271  Bool_t allowed_to_read = kFALSE;
1272 
1273  // if ( fOpenRootFile )
1274  // {
1275  // std::cout << "!TEcnaRead::ReadStinNumbers(...) *** ERROR ***> Reading on file already open."
1276  // << fTTBELL << std::endl;
1277  // }
1278 
1279  if (FileNameLong == fCurrentlyOpenFileName) {
1280  allowed_to_read = kTRUE;
1281  } else {
1283  CloseRootFile(current_file_name);
1284  }
1285  ok_open = OpenRootFile(file_name, "READ");
1286 
1287  if (ok_open) {
1288  allowed_to_read = kTRUE;
1289  } else {
1290  std::cout << "!TEcnaRead::ReadStinNumbers(...) *** ERROR ***> Open .root file failed for file: " << file_name
1291  << fTTBELL << std::endl;
1292  allowed_to_read = kFALSE;
1293  ok_read = kFALSE;
1294  }
1295  }
1296 
1297  if (allowed_to_read == kTRUE) {
1298  Int_t i_zero = 0;
1299  ok_read = gCnaRootFile->ReadElement(typ, i_zero);
1300 
1301  if (ok_read == kTRUE) {
1302  fDataExist = kTRUE;
1303  //......... Get the Stin numbers and put them in TVectorD vec()
1304  for (Int_t i_Stin = 0; i_Stin < VecDim; i_Stin++) {
1305  vec(i_Stin) = gCnaRootFile->fCnaIndivResult->fMatHis(0, i_Stin);
1306  fT1d_StexStinFromIndex[i_Stin] = (Int_t)vec(i_Stin);
1307  }
1308  fMemoStinNumbers++;
1309  } else {
1310  fDataExist = kFALSE;
1311  std::cout << "!TEcnaRead::ReadStinNumbers(...) *** ERROR ***> " << fCnaWrite->fRootFileNameShort.Data()
1312  << ": .root file failed" << std::endl
1313  << " -> quantity: <" << GetTypeOfQuantity(typ)
1314  << "> not available in file." << fTTBELL << std::endl;
1315  }
1316  CloseRootFile(file_name);
1317  }
1318 
1319  if (ok_read == kTRUE) {
1320  //........................... Print the Stin numbers
1322  for (Int_t i = 0; i < VecDim; i++) {
1323  std::cout << "*TEcnaRead::ReadStinNumbers(...)> StinNumber[" << i << "] = " << vec[i] << std::endl;
1324  }
1325  }
1326  }
1327  } else {
1328  fDataExist = kTRUE;
1329  for (Int_t i_Stin = 0; i_Stin < VecDim; i_Stin++) {
1330  vec(i_Stin) = fT1d_StexStinFromIndex[i_Stin];
1331  }
1332  }
1333  return vec;
1334 } // ----------------- ( end of ReadStinNumbers(...) ) -----------------
1335 
1336 //============================================================================
1337 //
1338 // 1 D H I S T O S (TECHNICAL METHODS)
1339 //
1340 //============================================================================
1341 
1342 //--------------------------------------------------------------------------------------
1343 //
1344 // ReadSampleAdcValues(i0StexEcha,sample,fFileHeader->fReqNbOfEvts)
1345 //
1346 //--------------------------------------------------------------------------------------
1347 TVectorD TEcnaRead::ReadSampleAdcValues(const Int_t &n1StexStin,
1348  const Int_t &i0StinEcha,
1349  const Int_t &sample,
1350  const Int_t &VecDim) {
1351  //Read the sample ADC values for each event for a given i0StexEcha and a given sample
1352  //in the results ROOT file and return it in a TVectorD(requested nb of events)
1353  //
1354  //Possible values for VecDim: (1) VecDim = fFileHeader->fReqNbOfEvts
1355 
1356  TestArrayDimH1("ReadSampleAdcValues", "fFileHeader->fReqNbOfEvts", fFileHeader->fReqNbOfEvts, VecDim);
1357 
1358  Int_t i0StexEcha = fEcalNumbering->Get0StexEchaFrom1StexStinAnd0StinEcha(n1StexStin, i0StinEcha);
1359 
1360  TVectorD vec(VecDim);
1361  for (Int_t i = 0; i < VecDim; i++) {
1362  vec(i) = (Double_t)0.;
1363  }
1364 
1365  CnaResultTyp typ = cTypAdcEvt; // sample as a function of time type
1366 
1367  const Text_t *file_name = (const Text_t *)fCnaWrite->fRootFileNameShort.Data();
1368  const Text_t *current_file_name = (const Text_t *)fCurrentlyOpenFileName.Data();
1369 
1370  Bool_t ok_open = kFALSE;
1371  Bool_t ok_read = kFALSE;
1372 
1373  TString FileNameLong = fCnaWrite->GetRootFileName();
1374  Bool_t allowed_to_read = kFALSE;
1375 
1376  // if ( fOpenRootFile )
1377  // {
1378  // std::cout << "!TEcnaRead::ReadSampleAdcValues(...) *** ERROR ***> "
1379  // << "Reading on file already open." << fTTBELL << std::endl;
1380  // }
1381 
1382  if (FileNameLong == fCurrentlyOpenFileName) {
1383  allowed_to_read = kTRUE;
1384  } else {
1386  CloseRootFile(current_file_name);
1387  }
1388  ok_open = OpenRootFile(file_name, "READ");
1389 
1390  if (ok_open) {
1391  allowed_to_read = kTRUE;
1392  } else {
1393  std::cout << "!TEcnaRead::ReadSampleAdcValues(...) *** ERROR ***> Open .root file failed for file: " << file_name
1394  << fTTBELL << std::endl;
1395  allowed_to_read = kFALSE;
1396  ok_read = kFALSE;
1397  }
1398  }
1399 
1400  if (allowed_to_read == kTRUE) {
1401  ok_read = gCnaRootFile->ReadElement(typ, i0StexEcha);
1402 
1403  if (ok_read == kTRUE) {
1404  fDataExist = kTRUE;
1405  for (Int_t i_bin = 0; i_bin < VecDim; i_bin++) {
1406  vec(i_bin) = gCnaRootFile->fCnaIndivResult->fMatHis(sample, i_bin);
1407  }
1408  } else {
1409  fDataExist = kFALSE;
1410  std::cout << "!TEcnaRead::ReadSampleAdcValues(...) *** ERROR ***> " << fCnaWrite->fRootFileNameShort.Data()
1411  << ": .root file failed" << std::endl
1412  << " -> quantity: <" << GetTypeOfQuantity(typ)
1413  << "> not available in file." << fTTBELL << std::endl;
1414  }
1415  CloseRootFile(file_name);
1416  }
1417  return vec;
1418 }
1419 //--- (end of ReadSampleAdcValues) ----------
1420 
1421 //-------------------------------------------------------------------------
1422 //
1423 // ReadSampleMeans
1424 //
1425 //-------------------------------------------------------------------------
1426 TVectorD TEcnaRead::ReadSampleMeans(const Int_t &n1StexStin, const Int_t &i0StinEcha, const Int_t &VecDim) {
1427  //Read the expectation values of the samples
1428  //for a given Stin and a given channel
1429  //in the ROOT file and return them in a TVectorD
1430  //
1431  //Possible values for VecDim : (1) VecDim = fFileHeader->fNbOfSamples
1432 
1433  TestArrayDimH1("ReadSampleMeans", "fFileHeader->fNbOfSamples", fFileHeader->fNbOfSamples, VecDim);
1434 
1435  Int_t i0StexEcha = fEcalNumbering->Get0StexEchaFrom1StexStinAnd0StinEcha(n1StexStin, i0StinEcha);
1436 
1437  TVectorD vec(VecDim);
1438  for (Int_t i = 0; i < VecDim; i++) {
1439  vec(i) = (Double_t)0.;
1440  }
1441 
1442  CnaResultTyp typ = cTypMSp;
1443 
1444  const Text_t *file_name = (const Text_t *)fCnaWrite->fRootFileNameShort.Data();
1445  const Text_t *current_file_name = (const Text_t *)fCurrentlyOpenFileName.Data();
1446 
1447  Bool_t ok_open = kFALSE;
1448  Bool_t ok_read = kFALSE;
1449 
1450  TString FileNameLong = fCnaWrite->GetRootFileName();
1451  Bool_t allowed_to_read = kFALSE;
1452 
1453  // if ( fOpenRootFile )
1454  // {
1455  // std::cout << "!TEcnaRead::ReadSampleMeans(...) *** ERROR ***> "
1456  // << " Reading on file already open." << fTTBELL << std::endl;
1457  // }
1458 
1459  if (FileNameLong == fCurrentlyOpenFileName) {
1460  allowed_to_read = kTRUE;
1461  } else {
1463  CloseRootFile(current_file_name);
1464  }
1465  ok_open = OpenRootFile(file_name, "READ");
1466  if (ok_open) {
1467  allowed_to_read = kTRUE;
1468  } else {
1469  std::cout << "!TEcnaRead::ReadSampleMeans(...) *** ERROR ***> Open .root file failed for file: " << file_name
1470  << fTTBELL << std::endl;
1471  allowed_to_read = kFALSE;
1472  ok_read = kFALSE;
1473  }
1474  }
1475 
1476  if (allowed_to_read == kTRUE) {
1477  Int_t i_zero = 0;
1478  ok_read = gCnaRootFile->ReadElement(typ, i_zero);
1479 
1480  if (ok_read == kTRUE) {
1481  fDataExist = kTRUE;
1482  for (Int_t i_samp = 0; i_samp < VecDim; i_samp++) {
1483  vec(i_samp) = gCnaRootFile->fCnaIndivResult->fMatHis(i0StexEcha, i_samp);
1484  }
1485  } else {
1486  fDataExist = kFALSE;
1487  std::cout << "!TEcnaRead::ReadSampleMeans(...) *** ERROR ***> " << fCnaWrite->fRootFileNameShort.Data()
1488  << ": .root file failed" << std::endl
1489  << " quantity: <" << GetTypeOfQuantity(typ)
1490  << "> not available in file." << fTTBELL << std::endl;
1491  }
1492  CloseRootFile(file_name);
1493  }
1494  return vec;
1495 }
1496 //------------------------------------------------------------------------------------------------
1497 TVectorD TEcnaRead::ReadSampleMeans(const Int_t &n1StexStin, const Int_t &VecDim) {
1498  //Read the expectation values of the samples
1499  //for all the channel of a given Stin
1500  //in the ROOT file and return them in a TVectorD
1501  //
1502  //Possible values for VecDim : (1) VecDim = fFileHeader->fNbOfSamples*fEcal->MaxCrysInStin()
1503 
1504  TestArrayDimH1("ReadSampleMeans",
1505  "fFileHeader->fNbOfSamples*fEcal->MaxCrysInStin()",
1507  VecDim);
1508 
1509  TVectorD vec(VecDim);
1510  for (Int_t i = 0; i < VecDim; i++) {
1511  vec(i) = (Double_t)0.;
1512  }
1513 
1514  CnaResultTyp typ = cTypMSp;
1515 
1516  const Text_t *file_name = (const Text_t *)fCnaWrite->fRootFileNameShort.Data();
1517  const Text_t *current_file_name = (const Text_t *)fCurrentlyOpenFileName.Data();
1518 
1519  Bool_t ok_open = kFALSE;
1520  Bool_t ok_read = kFALSE;
1521 
1522  TString FileNameLong = fCnaWrite->GetRootFileName();
1523  Bool_t allowed_to_read = kFALSE;
1524 
1525  //if ( fOpenRootFile )
1526  // {
1527  // std::cout << "!TEcnaRead::ReadSampleMeans(...) *** ERROR ***> "
1528  // << " Reading on file already open." << fTTBELL << std::endl;
1529  // }
1530 
1531  if (FileNameLong == fCurrentlyOpenFileName) {
1532  allowed_to_read = kTRUE;
1533  } else {
1535  CloseRootFile(current_file_name);
1536  }
1537  ok_open = OpenRootFile(file_name, "READ");
1538 
1539  if (ok_open) {
1540  allowed_to_read = kTRUE;
1541  } else {
1542  std::cout << "!TEcnaRead::ReadSampleMeans(...) *** ERROR ***> Open .root file failed for file: " << file_name
1543  << fTTBELL << std::endl;
1544  allowed_to_read = kFALSE;
1545  ok_read = kFALSE;
1546  }
1547  }
1548 
1549  if (allowed_to_read == kTRUE) {
1550  Int_t i_zero = 0;
1551  ok_read = gCnaRootFile->ReadElement(typ, i_zero);
1552 
1553  if (ok_read == kTRUE) {
1554  fDataExist = kTRUE;
1555 
1556  for (Int_t i0StinEcha = 0; i0StinEcha < fEcal->MaxCrysInStin(); i0StinEcha++) {
1557  Int_t i0StexEcha = fEcalNumbering->Get0StexEchaFrom1StexStinAnd0StinEcha(n1StexStin, i0StinEcha);
1558  for (Int_t i_samp = 0; i_samp < fFileHeader->fNbOfSamples; i_samp++) {
1559  vec(i0StinEcha * fFileHeader->fNbOfSamples + i_samp) =
1560  gCnaRootFile->fCnaIndivResult->fMatHis(i0StexEcha, i_samp);
1561  }
1562  }
1563  } else {
1564  fDataExist = kFALSE;
1565  std::cout << "!TEcnaRead::ReadSampleMeans(...) *** ERROR ***> " << fCnaWrite->fRootFileNameShort.Data()
1566  << ": .root file failed" << std::endl
1567  << " -> quantity: <" << GetTypeOfQuantity(typ)
1568  << "> not available in file." << fTTBELL << std::endl;
1569  }
1570  CloseRootFile(file_name);
1571  }
1572  return vec;
1573 }
1574 
1575 //-------------------------------------------------------------------------
1576 //
1577 // ReadSampleSigmas
1578 //
1579 //-------------------------------------------------------------------------
1580 TVectorD TEcnaRead::ReadSampleSigmas(const Int_t &n1StexStin, const Int_t &i0StinEcha, const Int_t &VecDim) {
1581  //Read the expectation values of the samples
1582  //for a given Stin and a given channel
1583  //in the ROOT file and return them in a TVectorD
1584  //
1585  //Possible values for VecDim : (1) VecDim = fFileHeader->fNbOfSamples
1586 
1587  TestArrayDimH1("ReadSampleSigmas", "fFileHeader->fNbOfSamples", fFileHeader->fNbOfSamples, VecDim);
1588 
1589  Int_t i0StexEcha = fEcalNumbering->Get0StexEchaFrom1StexStinAnd0StinEcha(n1StexStin, i0StinEcha);
1590 
1591  TVectorD vec(VecDim);
1592  vec.Zero();
1593 
1594  CnaResultTyp typ = cTypSSp;
1595 
1596  const Text_t *file_name = (const Text_t *)fCnaWrite->fRootFileNameShort.Data();
1597  const Text_t *current_file_name = (const Text_t *)fCurrentlyOpenFileName.Data();
1598 
1599  TString FileNameLong = fCnaWrite->GetRootFileName();
1600 
1601  //if ( fOpenRootFile )
1602  // {
1603  // std::cout << "!TEcnaRead::ReadSampleSigmas(...) *** ERROR ***> "
1604  // << "Reading on file already open." << fTTBELL << std::endl;
1605  // }
1606 
1607  if (FileNameLong != fCurrentlyOpenFileName) {
1609  CloseRootFile(current_file_name);
1610 
1611  if (!(OpenRootFile(file_name, "READ"))) {
1612  std::cout << "!TEcnaRead::ReadSampleSigmas(...) *** ERROR ***> Open .root file failed for file: " << file_name
1613  << fTTBELL << std::endl;
1614  return vec;
1615  }
1616  }
1617 
1618  Int_t i_zero = 0;
1619 
1620  if (gCnaRootFile->ReadElement(typ, i_zero)) {
1621  fDataExist = kTRUE;
1622  for (Int_t i_samp = 0; i_samp < VecDim; i_samp++) {
1623  vec(i_samp) = gCnaRootFile->fCnaIndivResult->fMatHis(i0StexEcha, i_samp);
1624  }
1625  } else {
1626  fDataExist = kFALSE;
1627  std::cout << "!TEcnaRead::ReadSampleSigmas(...) *** ERROR ***> " << fCnaWrite->fRootFileNameShort.Data()
1628  << ": .root file failed" << std::endl
1629  << " -> quantity: <" << GetTypeOfQuantity(typ)
1630  << "> not available in file." << fTTBELL << std::endl;
1631  }
1632  CloseRootFile(file_name);
1633  return vec;
1634 }
1635 //------------------------------------------------------------------------------------------------
1636 TVectorD TEcnaRead::ReadSampleSigmas(const Int_t &n1StexStin, const Int_t &VecDim) {
1637  //Read the expectation values of the samples
1638  //for all the channel of a given Stin
1639  //in the ROOT file and return them in a TVectorD
1640  //
1641  //Possible values for VecDim : (1) VecDim = fFileHeader->fNbOfSamples*fEcal->MaxCrysInStin()
1642 
1643  TestArrayDimH1("ReadSampleSigmas",
1644  "fFileHeader->fNbOfSamples*fEcal->MaxCrysInStin()",
1646  VecDim);
1647 
1648  TVectorD vec(VecDim);
1649  for (Int_t i = 0; i < VecDim; i++) {
1650  vec(i) = (Double_t)0.;
1651  }
1652 
1653  CnaResultTyp typ = cTypSSp;
1654 
1655  const Text_t *file_name = (const Text_t *)fCnaWrite->fRootFileNameShort.Data();
1656  const Text_t *current_file_name = (const Text_t *)fCurrentlyOpenFileName.Data();
1657 
1658  Bool_t ok_open = kFALSE;
1659  Bool_t ok_read = kFALSE;
1660 
1661  TString FileNameLong = fCnaWrite->GetRootFileName();
1662  Bool_t allowed_to_read = kFALSE;
1663 
1664  //if ( fOpenRootFile )
1665  // {
1666  // std::cout << "!TEcnaRead::ReadSampleSigmas(...) *** ERROR ***> "
1667  // << "Reading on file already open." << fTTBELL << std::endl;
1668  // }
1669 
1670  if (FileNameLong == fCurrentlyOpenFileName) {
1671  allowed_to_read = kTRUE;
1672  } else {
1674  CloseRootFile(current_file_name);
1675  }
1676  ok_open = OpenRootFile(file_name, "READ");
1677 
1678  if (ok_open) {
1679  allowed_to_read = kTRUE;
1680  } else {
1681  std::cout << "!TEcnaRead::ReadSampleSigmas(...) *** ERROR ***> Open .root file failed for file: " << file_name
1682  << fTTBELL << std::endl;
1683  allowed_to_read = kFALSE;
1684  ok_read = kFALSE;
1685  }
1686  }
1687 
1688  if (allowed_to_read == kTRUE) {
1689  Int_t i_zero = 0;
1690  ok_read = gCnaRootFile->ReadElement(typ, i_zero);
1691 
1692  if (ok_read == kTRUE) {
1693  fDataExist = kTRUE;
1694 
1695  for (Int_t i0StinEcha = 0; i0StinEcha < fEcal->MaxCrysInStin(); i0StinEcha++) {
1696  Int_t i0StexEcha = fEcalNumbering->Get0StexEchaFrom1StexStinAnd0StinEcha(n1StexStin, i0StinEcha);
1697  for (Int_t i_samp = 0; i_samp < fFileHeader->fNbOfSamples; i_samp++) {
1698  vec(i0StinEcha * fFileHeader->fNbOfSamples + i_samp) =
1699  gCnaRootFile->fCnaIndivResult->fMatHis(i0StexEcha, i_samp);
1700  }
1701  }
1702  } else {
1703  fDataExist = kFALSE;
1704  std::cout << "!TEcnaRead::ReadSampleSigmas(...) *** ERROR ***> " << fCnaWrite->fRootFileNameShort.Data()
1705  << ": .root file failed" << std::endl
1706  << " -> quantity: <" << GetTypeOfQuantity(typ)
1707  << "> not available in file." << fTTBELL << std::endl;
1708  }
1709  CloseRootFile(file_name);
1710  }
1711  return vec;
1712 }
1713 
1714 //-----------------------------------------------------------------------------
1715 //
1716 // ReadNumberOfEvents(...)
1717 //
1718 //-----------------------------------------------------------------------------
1719 TVectorD TEcnaRead::ReadNumberOfEvents(const Int_t &VecDim) {
1720  //Read the numbers of found events in the data
1721  //for the crystals and for the samples for all the Stin's in the Stex
1722  //in the ROOT file, compute the average on the samples
1723  //and return them in a TVectorD(MaxCrysEcnaInStex)
1724  //
1725  //Possible values for VecDim: (1) MatDim = fEcal->MaxCrysEcnaInStex()
1726 
1727  TestArrayDimH1("ReadNumberOfEvents", "fEcal->MaxCrysEcnaInStex()", fEcal->MaxCrysEcnaInStex(), VecDim);
1728 
1729  TVectorD vec(VecDim);
1730  for (Int_t i = 0; i < VecDim; i++) {
1731  vec(i) = (Double_t)0.;
1732  }
1733 
1734  TMatrixD mat(fEcal->MaxCrysInStin(), fFileHeader->fNbOfSamples);
1735 
1736  for (Int_t iStexStin = 0; iStexStin < fEcal->MaxStinEcnaInStex(); iStexStin++) {
1737  //............. set mat(,) to zero before reading it
1738  for (Int_t i = 0; i < fEcal->MaxCrysInStin(); i++) {
1739  for (Int_t j = 0; j < fFileHeader->fNbOfSamples; j++) {
1740  mat(i, j) = (Double_t)0.;
1741  }
1742  }
1743  //............. read mat(,)
1744  Int_t n1StexStin = iStexStin + 1;
1746 
1747  for (Int_t i0StinEcha = 0; i0StinEcha < fEcal->MaxCrysInStin(); i0StinEcha++) {
1748  Int_t i0StexEcha = fEcalNumbering->Get0StexEchaFrom1StexStinAnd0StinEcha(n1StexStin, i0StinEcha);
1749  vec(i0StexEcha) = 0;
1750  //.... average value over the samples
1751  for (Int_t i_samp = 0; i_samp < fFileHeader->fNbOfSamples; i_samp++) {
1752  vec(i0StexEcha) += mat(i0StinEcha, i_samp);
1753  }
1754  vec(i0StexEcha) = vec(i0StexEcha) / fFileHeader->fNbOfSamples;
1755  }
1756  }
1757  return vec;
1758 }
1759 
1760 //-----------------------------------------------------------------------------
1761 //
1762 // ReadNumberOfEventsForSamples
1763 //
1764 //-----------------------------------------------------------------------------
1765 TMatrixD TEcnaRead::ReadNumberOfEventsForSamples(const Int_t &n1StexStin, const Int_t &MatDimX, const Int_t &MatDimY) {
1766  //Read the numbers of found events in the data
1767  //for the crystals and for the samples, for a given Stin in the Stex
1768  //in the ROOT file and return them in a TMatrixD(MaxCrysInStin,NbOfSamples)
1769  //
1770  //Possible values for MatDimX and MatDimY:
1771  // (1) MatDimX = fEcal->MaxCrysInStin(), MatDimY = fFileHeader->fNbOfSamples
1772 
1773  TMatrixD mat(MatDimX, MatDimY);
1774  for (Int_t i = 0; i - MatDimX < 0; i++) {
1775  for (Int_t j = 0; j - MatDimY < 0; j++) {
1776  mat(i, j) = (Double_t)0.;
1777  }
1778  }
1779 
1780  Int_t Stin_index = GetStinIndex(n1StexStin);
1781  if (Stin_index >= 0) {
1782  if (fLookAtRootFile == 1) {
1783  CnaResultTyp typ = cTypNbOfEvts;
1784  const Text_t *file_name = (const Text_t *)fCnaWrite->fRootFileNameShort.Data();
1785  const Text_t *current_file_name = (const Text_t *)fCurrentlyOpenFileName.Data();
1786 
1787  Bool_t ok_open = kFALSE;
1788  Bool_t ok_read = kFALSE;
1789 
1790  TString FileNameLong = fCnaWrite->GetRootFileName();
1791  Bool_t allowed_to_read = kFALSE;
1792 
1793  // if ( fOpenRootFile )
1794  // {
1795  // std::cout << "!TEcnaRead::ReadNumberOfEventsForSamples(...) *** ERROR ***> "
1796  // << " Reading on file already open." << fTTBELL << std::endl;
1797  // }
1798 
1799  if (FileNameLong == fCurrentlyOpenFileName) {
1800  allowed_to_read = kTRUE;
1801  } else {
1803  CloseRootFile(current_file_name);
1804  }
1805  ok_open = OpenRootFile(file_name, "READ"); // set fOpenRootFile to kTRUE
1806  if (ok_open) {
1807  allowed_to_read = kTRUE;
1808  } else {
1809  std::cout << "!TEcnaRead::ReadNumberOfEventsForSamples(...) *** ERROR ***> Open .root file failed for file: "
1810  << file_name << fTTBELL << std::endl;
1811  allowed_to_read = kFALSE;
1812  ok_read = kFALSE;
1813  }
1814  }
1815 
1816  if (allowed_to_read == kTRUE) {
1817  Int_t i_zero = 0;
1818  ok_read = gCnaRootFile->ReadElement(typ, i_zero);
1819 
1820  if (ok_read == kTRUE) {
1821  fDataExist = kTRUE;
1822  for (Int_t i_crys = 0; i_crys - MatDimX < 0; i_crys++) {
1823  Int_t j_cna_chan = Stin_index * MatDimX + i_crys;
1824  for (Int_t i_samp = 0; i_samp - MatDimY < 0; i_samp++) {
1825  mat(i_crys, i_samp) = gCnaRootFile->fCnaIndivResult->fMatHis(j_cna_chan, i_samp);
1826  }
1827  }
1828  } else {
1829  fDataExist = kFALSE;
1830  std::cout << "!TEcnaRead::ReadNumberOfEventsForSamples(...) *** ERROR ***> "
1831  << fCnaWrite->fRootFileNameShort.Data() << ": .root file failed" << std::endl
1832  << " -> quantity: <"
1833  << GetTypeOfQuantity(typ) << "> not available in file." << fTTBELL << std::endl;
1834  }
1835  }
1836  CloseRootFile(file_name);
1837  } // end of if (fLookAtRootFile == 1)
1838  else {
1839  std::cout << "!TEcnaRead::ReadNumberOfEventsForSamples(...) *** ERROR ***> "
1840  << "It is not possible to access the number of found events: the ROOT file has not been read."
1841  << fTTBELL << std::endl;
1842  }
1843  } // end of if (Stin_index >= 0)
1844  return mat;
1845 } // ----------------- end of ReadNumberOfEventsForSamples(...)
1846 
1847 //-------------------------------------------------------------------------
1848 //
1849 // ReadPedestals(...)
1850 //
1851 //-------------------------------------------------------------------------
1852 TVectorD TEcnaRead::ReadPedestals(const Int_t &VecDim) {
1853  //Read the expectation values of the expectation values of the samples
1854  //for all the channels of a given Stin
1855  //in the ROOT file and return them in a TVectorD
1856  //
1857  //Possible values for VecDim: (1) MatDim = fEcal->MaxCrysEcnaInStex()
1858 
1859  TestArrayDimH1("ReadPedestals", "fEcal->MaxCrysEcnaInStex()", fEcal->MaxCrysEcnaInStex(), VecDim);
1860 
1861  TVectorD vec(VecDim);
1862  for (Int_t i = 0; i < VecDim; i++) {
1863  vec(i) = (Double_t)0.;
1864  }
1865 
1866  CnaResultTyp typ = cTypPed; // pedestals type
1867  const Text_t *file_name = (const Text_t *)fCnaWrite->fRootFileNameShort.Data();
1868  const Text_t *current_file_name = (const Text_t *)fCurrentlyOpenFileName.Data();
1869 
1870  Bool_t ok_open = kFALSE;
1871  Bool_t ok_read = kFALSE;
1872 
1873  TString FileNameLong = fCnaWrite->GetRootFileName();
1874  Bool_t allowed_to_read = kFALSE;
1875 
1876  // if ( fOpenRootFile )
1877  // {
1878  // std::cout << "!TEcnaRead::ReadPedestals(...) *** ERROR ***> "
1879  // << "Reading on file already open." << fTTBELL << std::endl;
1880  // }
1881 
1882  if (FileNameLong == fCurrentlyOpenFileName) {
1883  allowed_to_read = kTRUE;
1884  } else {
1886  CloseRootFile(current_file_name);
1887  }
1888  ok_open = OpenRootFile(file_name, "READ");
1889  if (ok_open) {
1890  allowed_to_read = kTRUE;
1891  } else {
1892  std::cout << "!TEcnaRead::ReadPedestals(...) *** ERROR ***> Open .root file failed for file: " << file_name
1893  << fTTBELL << std::endl;
1894  allowed_to_read = kFALSE;
1895  ok_read = kFALSE;
1896  }
1897  }
1898 
1899  if (allowed_to_read == kTRUE) {
1900  Int_t i_zero = 0;
1901  ok_read = gCnaRootFile->ReadElement(typ, i_zero);
1902 
1903  if (ok_read == kTRUE) {
1904  fDataExist = kTRUE;
1905  for (Int_t i_StexCrys = 0; i_StexCrys < VecDim; i_StexCrys++) {
1906  vec(i_StexCrys) = gCnaRootFile->fCnaIndivResult->fMatHis(i_zero, i_StexCrys);
1907  }
1908  } else {
1909  fDataExist = kFALSE;
1910  std::cout << "!TEcnaRead::ReadPedestals(...) *** ERROR ***> " << fCnaWrite->fRootFileNameShort.Data()
1911  << ": .root file failed" << std::endl
1912  << " -> quantity: <" << GetTypeOfQuantity(typ)
1913  << "> not available in file." << fTTBELL << std::endl;
1914  }
1915  CloseRootFile(file_name);
1916  }
1917  return vec;
1918 }
1919 
1920 //-------------------------------------------------------------------------
1921 //
1922 // ReadTotalNoise(...)
1923 //
1924 //-------------------------------------------------------------------------
1925 TVectorD TEcnaRead::ReadTotalNoise(const Int_t &VecDim) {
1926  //Read the expectation values of the sigmas of the samples
1927  //for all the channels of a given Stin
1928  //in the ROOT file and return them in a TVectorD
1929  //
1930  //Possible values for VecDim: (1) MatDim = fEcal->MaxCrysEcnaInStex()
1931 
1932  TestArrayDimH1("ReadTotalNoise", "fEcal->MaxCrysEcnaInStex()", fEcal->MaxCrysEcnaInStex(), VecDim);
1933 
1934  TVectorD vec(VecDim);
1935  for (Int_t i = 0; i < VecDim; i++) {
1936  vec(i) = (Double_t)0.;
1937  }
1938  CnaResultTyp typ = cTypTno; // Total noise type
1939  const Text_t *file_name = (const Text_t *)fCnaWrite->fRootFileNameShort.Data();
1940  const Text_t *current_file_name = (const Text_t *)fCurrentlyOpenFileName.Data();
1941 
1942  Bool_t ok_open = kFALSE;
1943  Bool_t ok_read = kFALSE;
1944 
1945  TString FileNameLong = fCnaWrite->GetRootFileName();
1946  Bool_t allowed_to_read = kFALSE;
1947 
1948  // if ( fOpenRootFile )
1949  // {
1950  // std::cout << "!TEcnaRead::ReadTotalNoise(...) *** ERROR ***> "
1951  // << "Reading on file already open." << fTTBELL << std::endl;
1952  // }
1953 
1954  if (FileNameLong == fCurrentlyOpenFileName) {
1955  allowed_to_read = kTRUE;
1956  } else {
1958  CloseRootFile(current_file_name);
1959  }
1960  ok_open = OpenRootFile(file_name, "READ");
1961  if (ok_open) {
1962  allowed_to_read = kTRUE;
1963  } else {
1964  std::cout << "!TEcnaRead::ReadTotalNoise(...) *** ERROR ***> Open .root file failed for file: " << file_name
1965  << fTTBELL << std::endl;
1966  allowed_to_read = kFALSE;
1967  ok_read = kFALSE;
1968  }
1969  }
1970 
1971  if (allowed_to_read == kTRUE) {
1972  Int_t i_zero = 0;
1973  ok_read = gCnaRootFile->ReadElement(typ, i_zero);
1974 
1975  if (ok_read == kTRUE) {
1976  fDataExist = kTRUE;
1977  for (Int_t i_StexCrys = 0; i_StexCrys < VecDim; i_StexCrys++) {
1978  vec(i_StexCrys) = gCnaRootFile->fCnaIndivResult->fMatHis(i_zero, i_StexCrys);
1979  }
1980  } else {
1981  fDataExist = kFALSE;
1982  std::cout << "!TEcnaRead::ReadTotalNoise(...) *** ERROR ***> " << fCnaWrite->fRootFileNameShort.Data()
1983  << ": .root file failed" << std::endl
1984  << " -> quantity: <" << GetTypeOfQuantity(typ)
1985  << "> not available in file." << fTTBELL << std::endl;
1986  }
1987  CloseRootFile(file_name);
1988  }
1989  return vec;
1990 }
1991 //-------------------------------------------------------------------------
1992 //
1993 // ReadMeanCorrelationsBetweenSamples(...)
1994 //
1995 //-------------------------------------------------------------------------
1996 TVectorD TEcnaRead::ReadMeanCorrelationsBetweenSamples(const Int_t &VecDim) {
1997  //Read the Expectation values of the (sample,sample) correlations
1998  //for all the channels of a given Stin
1999  //in the ROOT file and return them in a TVectorD
2000  //
2001  //Possible values for VecDim: (1) VecDim = fEcal->MaxCrysEcnaInStex()
2002 
2004  "ReadMeanCorrelationsBetweenSamples", "fEcal->MaxCrysEcnaInStex()", fEcal->MaxCrysEcnaInStex(), VecDim);
2005 
2006  TVectorD vec(VecDim);
2007  for (Int_t i = 0; i < VecDim; i++) {
2008  vec(i) = (Double_t)0.;
2009  }
2010  CnaResultTyp typ = cTypMeanCorss; // mean corss type
2011  const Text_t *file_name = (const Text_t *)fCnaWrite->fRootFileNameShort.Data();
2012  const Text_t *current_file_name = (const Text_t *)fCurrentlyOpenFileName.Data();
2013 
2014  Bool_t ok_open = kFALSE;
2015  Bool_t ok_read = kFALSE;
2016 
2017  TString FileNameLong = fCnaWrite->GetRootFileName();
2018  Bool_t allowed_to_read = kFALSE;
2019 
2020  //if ( fOpenRootFile )
2021  // {
2022  // std::cout << "!TEcnaRead::ReadMeanCorrelationsBetweenSamples(...) *** ERROR ***> "
2023  // << "Reading on file already open." << fTTBELL << std::endl;
2024  // }
2025 
2026  if (FileNameLong == fCurrentlyOpenFileName) {
2027  allowed_to_read = kTRUE;
2028  } else {
2030  CloseRootFile(current_file_name);
2031  }
2032  ok_open = OpenRootFile(file_name, "READ");
2033  if (ok_open) {
2034  allowed_to_read = kTRUE;
2035  } else {
2036  std::cout
2037  << "!TEcnaRead::ReadMeanCorrelationsBetweenSamples(...) *** ERROR ***> Open .root file failed for file: "
2038  << file_name << fTTBELL << std::endl;
2039  allowed_to_read = kFALSE;
2040  ok_read = kFALSE;
2041  }
2042  }
2043 
2044  if (allowed_to_read == kTRUE) {
2045  Int_t i_zero = 0;
2046  ok_read = gCnaRootFile->ReadElement(typ, i_zero);
2047 
2048  if (ok_read == kTRUE) {
2049  fDataExist = kTRUE;
2050  for (Int_t i_StexCrys = 0; i_StexCrys < VecDim; i_StexCrys++) {
2051  vec(i_StexCrys) = gCnaRootFile->fCnaIndivResult->fMatHis(i_zero, i_StexCrys);
2052  }
2053  } else {
2054  fDataExist = kFALSE;
2055  std::cout << "!TEcnaRead::ReadMeanCorrelationsBetweenSamples(...) *** ERROR ***> "
2056  << fCnaWrite->fRootFileNameShort.Data() << ": .root file failed" << std::endl
2057  << " -> quantity: <"
2058  << GetTypeOfQuantity(typ) << "> not available in file." << fTTBELL << std::endl;
2059  }
2060  CloseRootFile(file_name);
2061  }
2062  return vec;
2063 }
2064 
2065 //-------------------------------------------------------------------------
2066 //
2067 // ReadLowFrequencyNoise(...)
2068 //
2069 //-------------------------------------------------------------------------
2070 TVectorD TEcnaRead::ReadLowFrequencyNoise(const Int_t &VecDim) {
2071  //Read the sigmas of the expectation values of the samples
2072  //for all the channels of a given Stin
2073  //in the ROOT file and return them in a TVectorD
2074  //
2075  //Possible values for VecDim: (1) MatDim = fEcal->MaxCrysEcnaInStex()
2076 
2077  TestArrayDimH1("ReadLowFrequencyNoise", "fEcal->MaxCrysEcnaInStex()", fEcal->MaxCrysEcnaInStex(), VecDim);
2078 
2079  TVectorD vec(VecDim);
2080  for (Int_t i = 0; i < VecDim; i++) {
2081  vec(i) = (Double_t)0.;
2082  }
2083  CnaResultTyp typ = cTypLfn; // low frequency noise type
2084  const Text_t *file_name = (const Text_t *)fCnaWrite->fRootFileNameShort.Data();
2085  const Text_t *current_file_name = (const Text_t *)fCurrentlyOpenFileName.Data();
2086 
2087  Bool_t ok_open = kFALSE;
2088  Bool_t ok_read = kFALSE;
2089 
2090  TString FileNameLong = fCnaWrite->GetRootFileName();
2091  Bool_t allowed_to_read = kFALSE;
2092 
2093  // if ( fOpenRootFile )
2094  // {
2095  // std::cout << "!TEcnaRead::ReadLowFrequencyNoise(...) *** ERROR ***> "
2096  // << "Reading on file already open." << fTTBELL << std::endl;
2097  // }
2098 
2099  if (FileNameLong == fCurrentlyOpenFileName) {
2100  allowed_to_read = kTRUE;
2101  } else {
2103  CloseRootFile(current_file_name);
2104  }
2105  ok_open = OpenRootFile(file_name, "READ");
2106 
2107  if (ok_open) {
2108  allowed_to_read = kTRUE;
2109  } else {
2110  std::cout << "!TEcnaRead::ReadLowFrequencyNoise(...) *** ERROR ***> Open .root file failed for file: "
2111  << file_name << fTTBELL << std::endl;
2112  allowed_to_read = kFALSE;
2113  ok_read = kFALSE;
2114  }
2115  }
2116 
2117  if (allowed_to_read == kTRUE) {
2118  Int_t i_zero = 0;
2119  ok_read = gCnaRootFile->ReadElement(typ, i_zero);
2120 
2121  if (ok_read == kTRUE) {
2122  fDataExist = kTRUE;
2123  for (Int_t i_StexCrys = 0; i_StexCrys < VecDim; i_StexCrys++) {
2124  vec(i_StexCrys) = gCnaRootFile->fCnaIndivResult->fMatHis(i_zero, i_StexCrys);
2125  }
2126  } else {
2127  fDataExist = kFALSE;
2128  std::cout << "!TEcnaRead::ReadLowFrequencyNoise(...) *** ERROR ***> " << fCnaWrite->fRootFileNameShort.Data()
2129  << ": .root file failed" << std::endl
2130  << " -> quantity: <" << GetTypeOfQuantity(typ)
2131  << "> not available in file." << fTTBELL << std::endl;
2132  }
2133  CloseRootFile(file_name);
2134  }
2135  return vec;
2136 }
2137 
2138 //-------------------------------------------------------------------------
2139 //
2140 // ReadHighFrequencyNoise(...)
2141 //
2142 //-------------------------------------------------------------------------
2143 TVectorD TEcnaRead::ReadHighFrequencyNoise(const Int_t &VecDim) {
2144  //Read the sigmas of the sigmas of the samples
2145  //for all the channels of a given Stin
2146  //in the ROOT file and return them in a TVectorD
2147  //
2148  //Possible values for VecDim: (1) MatDim = fEcal->MaxCrysEcnaInStex()
2149 
2150  TestArrayDimH1("ReadHighFrequencyNoise", "fEcal->MaxCrysEcnaInStex()", fEcal->MaxCrysEcnaInStex(), VecDim);
2151 
2152  TVectorD vec(VecDim);
2153  for (Int_t i = 0; i < VecDim; i++) {
2154  vec(i) = (Double_t)0.;
2155  }
2156  CnaResultTyp typ = cTypHfn; // high frequency noise type
2157  const Text_t *file_name = (const Text_t *)fCnaWrite->fRootFileNameShort.Data();
2158  const Text_t *current_file_name = (const Text_t *)fCurrentlyOpenFileName.Data();
2159 
2160  Bool_t ok_open = kFALSE;
2161  Bool_t ok_read = kFALSE;
2162 
2163  TString FileNameLong = fCnaWrite->GetRootFileName();
2164  Bool_t allowed_to_read = kFALSE;
2165 
2166  // if ( fOpenRootFile )
2167  // {
2168  // std::cout << "!TEcnaRead::ReadHighFrequencyNoise(...) *** ERROR ***> "
2169  // << "Reading on file already open." << fTTBELL << std::endl;
2170  // }
2171 
2172  if (FileNameLong == fCurrentlyOpenFileName) {
2173  allowed_to_read = kTRUE;
2174  } else {
2176  CloseRootFile(current_file_name);
2177  }
2178  ok_open = OpenRootFile(file_name, "READ");
2179 
2180  if (ok_open) {
2181  allowed_to_read = kTRUE;
2182  } else {
2183  std::cout << "!TEcnaRead::ReadHighFrequencyNoise(...) *** ERROR ***> Open .root file failed for file: "
2184  << file_name << fTTBELL << std::endl;
2185  allowed_to_read = kFALSE;
2186  ok_read = kFALSE;
2187  }
2188  }
2189 
2190  if (allowed_to_read == kTRUE) {
2191  Int_t i_zero = 0;
2192  ok_read = gCnaRootFile->ReadElement(typ, i_zero);
2193 
2194  if (ok_read == kTRUE) {
2195  fDataExist = kTRUE;
2196  for (Int_t i_StexCrys = 0; i_StexCrys < VecDim; i_StexCrys++) {
2197  vec(i_StexCrys) = gCnaRootFile->fCnaIndivResult->fMatHis(i_zero, i_StexCrys);
2198  }
2199  } else {
2200  fDataExist = kFALSE;
2201  std::cout << "!TEcnaRead::ReadHighFrequencyNoise(...) *** ERROR ***> " << fCnaWrite->fRootFileNameShort.Data()
2202  << ": .root file failed" << std::endl
2203  << " -> quantity: <" << GetTypeOfQuantity(typ)
2204  << "> not available in file." << fTTBELL << std::endl;
2205  }
2206  CloseRootFile(file_name);
2207  }
2208  return vec;
2209 }
2210 
2211 //-------------------------------------------------------------------------
2212 //
2213 // ReadSigmaOfCorrelationsBetweenSamples(...)
2214 //
2215 //-------------------------------------------------------------------------
2217  //Read the Expectation values of the (sample,sample) correlations
2218  //for all the channels of a given Stin
2219  //in the ROOT file and return them in a TVectorD
2220  //
2221  //Possible values for VecDim: (1) MatDim = fEcal->MaxCrysEcnaInStex()
2222 
2224  "ReadSigmaOfCorrelationsBetweenSamples", "fEcal->MaxCrysEcnaInStex()", fEcal->MaxCrysEcnaInStex(), VecDim);
2225 
2226  TVectorD vec(VecDim);
2227  for (Int_t i = 0; i < VecDim; i++) {
2228  vec(i) = (Double_t)0.;
2229  }
2230  CnaResultTyp typ = cTypSigCorss; // sigma of corss type
2231  const Text_t *file_name = (const Text_t *)fCnaWrite->fRootFileNameShort.Data();
2232  const Text_t *current_file_name = (const Text_t *)fCurrentlyOpenFileName.Data();
2233 
2234  Bool_t ok_open = kFALSE;
2235  Bool_t ok_read = kFALSE;
2236 
2237  TString FileNameLong = fCnaWrite->GetRootFileName();
2238  Bool_t allowed_to_read = kFALSE;
2239 
2240  // if ( fOpenRootFile )
2241  // {
2242  // std::cout << "!TEcnaRead::ReadSigmaOfCorrelationsBetweenSamples(...) *** ERROR ***> "
2243  // << "Reading on file already open." << fTTBELL << std::endl;
2244  // }
2245 
2246  if (FileNameLong == fCurrentlyOpenFileName) {
2247  allowed_to_read = kTRUE;
2248  } else {
2250  CloseRootFile(current_file_name);
2251  }
2252  ok_open = OpenRootFile(file_name, "READ");
2253 
2254  if (ok_open) {
2255  allowed_to_read = kTRUE;
2256  } else {
2257  std::cout
2258  << "!TEcnaRead::ReadSigmaOfCorrelationsBetweenSamples(...) *** ERROR ***> Open .root file failed for file: "
2259  << file_name << fTTBELL << std::endl;
2260  allowed_to_read = kFALSE;
2261  ok_read = kFALSE;
2262  }
2263  }
2264 
2265  if (allowed_to_read == kTRUE) {
2266  Int_t i_zero = 0;
2267  ok_read = gCnaRootFile->ReadElement(typ, i_zero);
2268 
2269  if (ok_read == kTRUE) {
2270  fDataExist = kTRUE;
2271  for (Int_t i_StexCrys = 0; i_StexCrys < VecDim; i_StexCrys++) {
2272  vec(i_StexCrys) = gCnaRootFile->fCnaIndivResult->fMatHis(i_zero, i_StexCrys);
2273  }
2274  } else {
2275  fDataExist = kFALSE;
2276  std::cout << "!TEcnaRead::ReadSigmaOfCorrelationsBetweenSamples(...) *** ERROR ***> "
2277  << fCnaWrite->fRootFileNameShort.Data() << ": .root file failed" << std::endl
2278  << " -> quantity: <"
2279  << GetTypeOfQuantity(typ) << "> not available in file." << fTTBELL << std::endl;
2280  }
2281  CloseRootFile(file_name);
2282  }
2283  return vec;
2284 }
2285 //==================================================================================================
2286 //-----------------------------------------------------------------------------
2287 //
2288 // ReadAverageNumberOfEvents(...)
2289 //
2290 // NB: read "direct" numbers of evts and compute the average HERE
2291 // (different from ReadAveragePedestals, Noises, etc...)
2292 //
2293 //-----------------------------------------------------------------------------
2294 TVectorD TEcnaRead::ReadAverageNumberOfEvents(const Int_t &VecDim) {
2295  //Read the numbers of found events in the data
2296  //for the crystals and for the samples for all the Stin's in the Stex
2297  //in the ROOT file, compute the average on the samples and on the crystals
2298  //and return them in a TVectorD(MaxStinEcnaInStex)
2299  //
2300  //Possible values for VecDim: (1) VecDim = fEcal->MaxStinEcnaInStex()
2301 
2302  TestArrayDimH1("ReadAverageNumberOfEvents", "fEcal->MaxStinEcnaInStex()", fEcal->MaxStinEcnaInStex(), VecDim);
2303 
2304  TVectorD vecAverage(VecDim);
2305  for (Int_t i = 0; i < VecDim; i++) {
2306  vecAverage(i) = (Double_t)0.;
2307  }
2308 
2309  TVectorD vecMean(fEcal->MaxCrysEcnaInStex());
2310  for (Int_t i = 0; i < fEcal->MaxCrysEcnaInStex(); i++) {
2311  vecMean(i) = (Double_t)0.;
2312  }
2313 
2315 
2316  for (Int_t i0StexStin = 0; i0StexStin < VecDim; i0StexStin++) {
2317  vecAverage(i0StexStin) = 0;
2318  //.... average value over the crystals
2319  for (Int_t i0StinEcha = 0; i0StinEcha < fEcal->MaxCrysInStin(); i0StinEcha++) {
2320  Int_t n1StexStin = i0StexStin + 1;
2321  Int_t i0StexEcha = fEcalNumbering->Get0StexEchaFrom1StexStinAnd0StinEcha(n1StexStin, i0StinEcha);
2322 
2323  if (fStexName == "SM") {
2324  vecAverage(i0StexStin) += vecMean(i0StexEcha);
2325  }
2326 
2327  if (fStexName == "Dee") {
2328  //--------- EE --> Special translation for mixed SCEcna (29 and 32)
2329  // Xtal 11 of SCEcna 29 -> Xtal 11 of SCEcna 10
2330  // Xtal 11 of SCEcna 32 -> Xtal 11 of SCEcna 11
2331  Int_t n1StinEcha = i0StinEcha + 1;
2332  if (n1StexStin == 10 && n1StinEcha == 11) {
2333  i0StexEcha = fEcalNumbering->Get0StexEchaFrom1StexStinAnd0StinEcha(29, i0StinEcha);
2334  }
2335  if (n1StexStin == 11 && n1StinEcha == 11) {
2336  i0StexEcha = fEcalNumbering->Get0StexEchaFrom1StexStinAnd0StinEcha(32, i0StinEcha);
2337  }
2338  if (!((n1StexStin == 29 || n1StexStin == 32) && n1StinEcha == 11)) {
2339  vecAverage(i0StexStin) += vecMean(i0StexEcha);
2340  }
2341  }
2342  }
2343 
2344  Double_t xdivis = (Double_t)0.;
2345  if (fStexName == "SM") {
2346  xdivis = (Double_t)fEcal->MaxCrysInStin();
2347  }
2348  if (fStexName == "Dee") {
2349  Int_t n1StexStin = i0StexStin + 1;
2350  xdivis = (Double_t)fEcalNumbering->MaxCrysInStinEcna(fFileHeader->fStex, n1StexStin, "TEcnaRead");
2351  }
2352 
2353  vecAverage(i0StexStin) = vecAverage(i0StexStin) / xdivis;
2354  }
2355  return vecAverage;
2356 }
2357 
2358 //-------------------------------------------------------------------------
2359 //
2360 // ReadAveragePedestals(...)
2361 //
2362 //-------------------------------------------------------------------------
2363 TVectorD TEcnaRead::ReadAveragePedestals(const Int_t &VecDim) {
2364  //Read the expectation values of the Pedestals
2365  //for all the Stins of a given Stex
2366  //in the ROOT file and return them in a TVectorD
2367  //
2368  //Possible values for VecDim: (1) VecDim = fEcal->MaxStinEcnaInStex()
2369 
2370  TestArrayDimH1("ReadAveragePedestals", "fEcal->MaxStinEcnaInStex()", fEcal->MaxStinEcnaInStex(), VecDim);
2371 
2372  TVectorD vec(VecDim);
2373  for (Int_t i = 0; i < VecDim; i++) {
2374  vec(i) = (Double_t)0.;
2375  }
2376 
2377  CnaResultTyp typ = cTypAvPed; // averaged pedestals type
2378  const Text_t *file_name = (const Text_t *)fCnaWrite->fRootFileNameShort.Data();
2379  const Text_t *current_file_name = (const Text_t *)fCurrentlyOpenFileName.Data();
2380 
2381  Bool_t ok_open = kFALSE;
2382  Bool_t ok_read = kFALSE;
2383 
2384  TString FileNameLong = fCnaWrite->GetRootFileName();
2385  Bool_t allowed_to_read = kFALSE;
2386 
2387  // if ( fOpenRootFile )
2388  // {
2389  // std::cout << "!TEcnaRead::ReadAveragePedestals(...) *** ERROR ***> "
2390  // << "Reading on file already open." << fTTBELL << std::endl;
2391  // }
2392 
2393  if (FileNameLong == fCurrentlyOpenFileName) {
2394  allowed_to_read = kTRUE;
2395  } else {
2397  CloseRootFile(current_file_name);
2398  }
2399  ok_open = OpenRootFile(file_name, "READ");
2400 
2401  if (ok_open) {
2402  allowed_to_read = kTRUE;
2403  } else {
2404  std::cout << "!TEcnaRead::ReadAveragePedestals(...) *** ERROR ***> Open .root file failed for file: " << file_name
2405  << fTTBELL << std::endl;
2406  allowed_to_read = kFALSE;
2407  ok_read = kFALSE;
2408  }
2409  }
2410 
2411  if (allowed_to_read == kTRUE) {
2412  Int_t i_zero = 0;
2413  ok_read = gCnaRootFile->ReadElement(typ, i_zero);
2414 
2415  if (ok_read == kTRUE) {
2416  fDataExist = kTRUE;
2417  for (Int_t i0StexStin = 0; i0StexStin < VecDim; i0StexStin++) {
2418  vec(i0StexStin) = gCnaRootFile->fCnaIndivResult->fMatHis(i_zero, i0StexStin);
2419  }
2420  } else {
2421  fDataExist = kFALSE;
2422  std::cout << "!TEcnaRead::ReadAveragePedestals(...) *** ERROR ***> " << fCnaWrite->fRootFileNameShort.Data()
2423  << ": .root file failed" << std::endl
2424  << " -> quantity: <" << GetTypeOfQuantity(typ)
2425  << "> not available in file." << fTTBELL << std::endl;
2426  }
2427  CloseRootFile(file_name);
2428  }
2429  return vec;
2430 } // end of ReadAveragePedestals
2431 
2432 //-------------------------------------------------------------------------
2433 //
2434 // ReadAverageTotalNoise(...)
2435 //
2436 //-------------------------------------------------------------------------
2437 TVectorD TEcnaRead::ReadAverageTotalNoise(const Int_t &VecDim) {
2438  //Read the expectation values of the Total Noise
2439  //for all the Stins of a given Stex
2440  //in the ROOT file and return them in a TVectorD
2441  //
2442  //Possible values for VecDim: (1) VecDim = fEcal->MaxStinEcnaInStex()
2443 
2444  TestArrayDimH1("ReadAverageTotalNoise", "fEcal->MaxStinEcnaInStex()", fEcal->MaxStinEcnaInStex(), VecDim);
2445 
2446  TVectorD vec(VecDim);
2447  for (Int_t i = 0; i < VecDim; i++) {
2448  vec(i) = (Double_t)0.;
2449  }
2450 
2451  CnaResultTyp typ = cTypAvTno; // averaged Total Noise type
2452  const Text_t *file_name = (const Text_t *)fCnaWrite->fRootFileNameShort.Data();
2453  const Text_t *current_file_name = (const Text_t *)fCurrentlyOpenFileName.Data();
2454 
2455  Bool_t ok_open = kFALSE;
2456  Bool_t ok_read = kFALSE;
2457 
2458  TString FileNameLong = fCnaWrite->GetRootFileName();
2459  Bool_t allowed_to_read = kFALSE;
2460 
2461  // if ( fOpenRootFile )
2462  // {
2463  // std::cout << "!TEcnaRead::ReadAverageTotalNoise(...) *** ERROR ***> "
2464  // << "Reading on file already open." << fTTBELL << std::endl;
2465  // }
2466 
2467  if (FileNameLong == fCurrentlyOpenFileName) {
2468  allowed_to_read = kTRUE;
2469  } else {
2471  CloseRootFile(current_file_name);
2472  }
2473  ok_open = OpenRootFile(file_name, "READ");
2474 
2475  if (ok_open) {
2476  allowed_to_read = kTRUE;
2477  } else {
2478  std::cout << "!TEcnaRead::ReadAverageTotalNoise(...) *** ERROR ***> Open .root file failed for file: "
2479  << file_name << fTTBELL << std::endl;
2480  allowed_to_read = kFALSE;
2481  ok_read = kFALSE;
2482  }
2483  }
2484 
2485  if (allowed_to_read == kTRUE) {
2486  Int_t i_zero = 0;
2487  ok_read = gCnaRootFile->ReadElement(typ, i_zero);
2488 
2489  if (ok_read == kTRUE) {
2490  fDataExist = kTRUE;
2491  for (Int_t i0StexStin = 0; i0StexStin < VecDim; i0StexStin++) {
2492  vec(i0StexStin) = gCnaRootFile->fCnaIndivResult->fMatHis(i_zero, i0StexStin);
2493  }
2494  } else {
2495  fDataExist = kFALSE;
2496  std::cout << "!TEcnaRead::ReadAverageTotalNoise(...) *** ERROR ***> " << fCnaWrite->fRootFileNameShort.Data()
2497  << ": .root file failed" << std::endl
2498  << " -> quantity: <" << GetTypeOfQuantity(typ)
2499  << "> not available in file." << fTTBELL << std::endl;
2500  }
2501  CloseRootFile(file_name);
2502  }
2503  return vec;
2504 }
2505 
2506 //-------------------------------------------------------------------------
2507 //
2508 // ReadAverageLowFrequencyNoise(...)
2509 //
2510 //-------------------------------------------------------------------------
2511 TVectorD TEcnaRead::ReadAverageLowFrequencyNoise(const Int_t &VecDim) {
2512  //Read the expectation values of the Pedestals
2513  //for all the Stins of a given Stex
2514  //in the ROOT file and return them in a TVectorD
2515  //
2516  //Possible values for VecDim: (1) VecDim = fEcal->MaxStinEcnaInStex()
2517 
2518  TestArrayDimH1("ReadAverageLowFrequencyNoise", "fEcal->MaxStinEcnaInStex()", fEcal->MaxStinEcnaInStex(), VecDim);
2519 
2520  TVectorD vec(VecDim);
2521  for (Int_t i = 0; i < VecDim; i++) {
2522  vec(i) = (Double_t)0.;
2523  }
2524 
2525  CnaResultTyp typ = cTypAvLfn; // averaged Low FrequencyNoise type
2526  const Text_t *file_name = (const Text_t *)fCnaWrite->fRootFileNameShort.Data();
2527  const Text_t *current_file_name = (const Text_t *)fCurrentlyOpenFileName.Data();
2528 
2529  Bool_t ok_open = kFALSE;
2530  Bool_t ok_read = kFALSE;
2531 
2532  TString FileNameLong = fCnaWrite->GetRootFileName();
2533  Bool_t allowed_to_read = kFALSE;
2534 
2535  // if ( fOpenRootFile )
2536  // {
2537  // std::cout << "!TEcnaRead::ReadAverageLowFrequencyNoise(...) *** ERROR ***> "
2538  // << "Reading on file already open." << fTTBELL << std::endl;
2539  // }
2540 
2541  if (FileNameLong == fCurrentlyOpenFileName) {
2542  allowed_to_read = kTRUE;
2543  } else {
2545  CloseRootFile(current_file_name);
2546  }
2547  ok_open = OpenRootFile(file_name, "READ");
2548 
2549  if (ok_open) {
2550  allowed_to_read = kTRUE;
2551  } else {
2552  std::cout << "!TEcnaRead::ReadAverageLowFrequencyNoise(...) *** ERROR ***> Open .root file failed for file: "
2553  << file_name << fTTBELL << std::endl;
2554  allowed_to_read = kFALSE;
2555  ok_read = kFALSE;
2556  }
2557  }
2558 
2559  if (allowed_to_read == kTRUE) {
2560  Int_t i_zero = 0;
2561  ok_read = gCnaRootFile->ReadElement(typ, i_zero);
2562 
2563  if (ok_read == kTRUE) {
2564  fDataExist = kTRUE;
2565  for (Int_t i0StexStin = 0; i0StexStin < VecDim; i0StexStin++) {
2566  vec(i0StexStin) = gCnaRootFile->fCnaIndivResult->fMatHis(i_zero, i0StexStin);
2567  }
2568  } else {
2569  fDataExist = kFALSE;
2570  std::cout << "!TEcnaRead::ReadAverageLowFrequencyNoise(...) *** ERROR ***> "
2571  << fCnaWrite->fRootFileNameShort.Data() << ": .root file failed" << std::endl
2572  << " -> quantity: <"
2573  << GetTypeOfQuantity(typ) << "> not available in file." << fTTBELL << std::endl;
2574  }
2575  CloseRootFile(file_name);
2576  }
2577  return vec;
2578 } // end of ReadAverageLowFrequencyNoise
2579 
2580 //-------------------------------------------------------------------------
2581 //
2582 // ReadAverageHighFrequencyNoise(...)
2583 //
2584 //-------------------------------------------------------------------------
2585 TVectorD TEcnaRead::ReadAverageHighFrequencyNoise(const Int_t &VecDim) {
2586  //Read the expectation values of the Pedestals
2587  //for all the Stins of a given Stex
2588  //in the ROOT file and return them in a TVectorD
2589  //
2590  //Possible values for VecDim: (1) VecDim = fEcal->MaxStinEcnaInStex()
2591 
2592  TestArrayDimH1("ReadAverageHighFrequencyNoise", "fEcal->MaxStinEcnaInStex()", fEcal->MaxStinEcnaInStex(), VecDim);
2593 
2594  TVectorD vec(VecDim);
2595  for (Int_t i = 0; i < VecDim; i++) {
2596  vec(i) = (Double_t)0.;
2597  }
2598 
2599  CnaResultTyp typ = cTypAvHfn; // averaged High FrequencyNoise type
2600  const Text_t *file_name = (const Text_t *)fCnaWrite->fRootFileNameShort.Data();
2601  const Text_t *current_file_name = (const Text_t *)fCurrentlyOpenFileName.Data();
2602 
2603  Bool_t ok_open = kFALSE;
2604  Bool_t ok_read = kFALSE;
2605 
2606  TString FileNameLong = fCnaWrite->GetRootFileName();
2607  Bool_t allowed_to_read = kFALSE;
2608 
2609  // if ( fOpenRootFile )
2610  // {
2611  // std::cout << "!TEcnaRead::ReadAverageHighFrequencyNoise(...) *** ERROR ***> "
2612  // << "Reading on file already open." << fTTBELL << std::endl;
2613  // }
2614 
2615  if (FileNameLong == fCurrentlyOpenFileName) {
2616  allowed_to_read = kTRUE;
2617  } else {
2619  CloseRootFile(current_file_name);
2620  }
2621  ok_open = OpenRootFile(file_name, "READ");
2622 
2623  if (ok_open) {
2624  allowed_to_read = kTRUE;
2625  } else {
2626  std::cout << "!TEcnaRead::ReadAverageHighFrequencyNoise(...) *** ERROR ***> Open .root file failed for file: "
2627  << file_name << fTTBELL << std::endl;
2628  allowed_to_read = kFALSE;
2629  ok_read = kFALSE;
2630  }
2631  }
2632 
2633  if (allowed_to_read == kTRUE) {
2634  Int_t i_zero = 0;
2635  ok_read = gCnaRootFile->ReadElement(typ, i_zero);
2636 
2637  if (ok_read == kTRUE) {
2638  fDataExist = kTRUE;
2639  for (Int_t i0StexStin = 0; i0StexStin < VecDim; i0StexStin++) {
2640  vec(i0StexStin) = gCnaRootFile->fCnaIndivResult->fMatHis(i_zero, i0StexStin);
2641  }
2642  } else {
2643  fDataExist = kFALSE;
2644  std::cout << "!TEcnaRead::ReadAverageHighFrequencyNoise(...) *** ERROR ***> "
2645  << fCnaWrite->fRootFileNameShort.Data() << ": .root file failed" << std::endl
2646  << " -> quantity: <"
2647  << GetTypeOfQuantity(typ) << "> not available in file." << fTTBELL << std::endl;
2648  }
2649  CloseRootFile(file_name);
2650  }
2651  return vec;
2652 } // end of ReadAverageHighFrequencyNoise
2653 
2654 //-------------------------------------------------------------------------
2655 //
2656 // ReadAverageMeanCorrelationsBetweenSamples(...)
2657 //
2658 //-------------------------------------------------------------------------
2660  //Read the expectation values of the Pedestals
2661  //for all the Stins of a given Stex
2662  //in the ROOT file and return them in a TVectorD
2663  //
2664  //Possible values for VecDim: (1) VecDim = fEcal->MaxStinEcnaInStex()
2665 
2667  "ReadAverageMeanCorrelationsBetweenSamples", "fEcal->MaxStinEcnaInStex()", fEcal->MaxStinEcnaInStex(), VecDim);
2668 
2669  TVectorD vec(VecDim);
2670  for (Int_t i = 0; i < VecDim; i++) {
2671  vec(i) = (Double_t)0.;
2672  }
2673 
2674  CnaResultTyp typ = cTypAvMeanCorss; // averaged MeanCorrelationsBetweenSamples type
2675  const Text_t *file_name = (const Text_t *)fCnaWrite->fRootFileNameShort.Data();
2676  const Text_t *current_file_name = (const Text_t *)fCurrentlyOpenFileName.Data();
2677 
2678  Bool_t ok_open = kFALSE;
2679  Bool_t ok_read = kFALSE;
2680 
2681  TString FileNameLong = fCnaWrite->GetRootFileName();
2682  Bool_t allowed_to_read = kFALSE;
2683 
2684  // if ( fOpenRootFile )
2685  // {
2686  // std::cout << "!TEcnaRead::ReadAverageMeanCorrelationsBetweenSamples(...) *** ERROR ***> "
2687  // << "Reading on file already open." << fTTBELL << std::endl;
2688  // }
2689 
2690  if (FileNameLong == fCurrentlyOpenFileName) {
2691  allowed_to_read = kTRUE;
2692  } else {
2694  CloseRootFile(current_file_name);
2695  }
2696  ok_open = OpenRootFile(file_name, "READ");
2697 
2698  if (ok_open) {
2699  allowed_to_read = kTRUE;
2700  } else {
2701  std::cout << "!TEcnaRead::ReadAverageMeanCorrelationsBetweenSamples(...) *** ERROR ***> Open .root file failed "
2702  "for file: "
2703  << file_name << fTTBELL << std::endl;
2704  allowed_to_read = kFALSE;
2705  ok_read = kFALSE;
2706  }
2707  }
2708 
2709  if (allowed_to_read == kTRUE) {
2710  Int_t i_zero = 0;
2711  ok_read = gCnaRootFile->ReadElement(typ, i_zero);
2712 
2713  if (ok_read == kTRUE) {
2714  fDataExist = kTRUE;
2715  for (Int_t i0StexStin = 0; i0StexStin < VecDim; i0StexStin++) {
2716  vec(i0StexStin) = gCnaRootFile->fCnaIndivResult->fMatHis(i_zero, i0StexStin);
2717  }
2718  } else {
2719  fDataExist = kFALSE;
2720  std::cout << "!TEcnaRead::ReadAverageMeanCorrelationsBetweenSamples(...) *** ERROR ***> "
2721  << fCnaWrite->fRootFileNameShort.Data() << ": .root file failed" << std::endl
2722  << " -> quantity: <"
2723  << GetTypeOfQuantity(typ) << "> not available in file." << fTTBELL << std::endl;
2724  }
2725  CloseRootFile(file_name);
2726  }
2727  return vec;
2728 } // end of ReadAverageMeanCorrelationsBetweenSamples
2729 
2730 //-------------------------------------------------------------------------
2731 //
2732 // ReadAverageSigmaOfCorrelationsBetweenSamples(...)
2733 //
2734 //-------------------------------------------------------------------------
2736  //Read the expectation values of the Pedestals
2737  //for all the Stins of a given Stex
2738  //in the ROOT file and return them in a TVectorD
2739  //
2740  //Possible values for VecDim: (1) VecDim = fEcal->MaxStinEcnaInStex()
2741 
2743  "ReadAverageSigmaOfCorrelationsBetweenSamples", "fEcal->MaxStinEcnaInStex()", fEcal->MaxStinEcnaInStex(), VecDim);
2744 
2745  TVectorD vec(VecDim);
2746  for (Int_t i = 0; i < VecDim; i++) {
2747  vec(i) = (Double_t)0.;
2748  }
2749 
2750  CnaResultTyp typ = cTypAvSigCorss; // averaged SigmaOfCorrelationsBetweenSamples type
2751  const Text_t *file_name = (const Text_t *)fCnaWrite->fRootFileNameShort.Data();
2752  const Text_t *current_file_name = (const Text_t *)fCurrentlyOpenFileName.Data();
2753 
2754  Bool_t ok_open = kFALSE;
2755  Bool_t ok_read = kFALSE;
2756 
2757  TString FileNameLong = fCnaWrite->GetRootFileName();
2758  Bool_t allowed_to_read = kFALSE;
2759 
2760  // if ( fOpenRootFile )
2761  // {
2762  // std::cout << "!TEcnaRead::ReadAverageSigmaOfCorrelationsBetweenSamples(...) *** ERROR ***> "
2763  // << "Reading on file already open." << fTTBELL << std::endl;
2764  // }
2765 
2766  if (FileNameLong == fCurrentlyOpenFileName) {
2767  allowed_to_read = kTRUE;
2768  } else {
2770  CloseRootFile(current_file_name);
2771  }
2772  ok_open = OpenRootFile(file_name, "READ");
2773 
2774  if (ok_open) {
2775  allowed_to_read = kTRUE;
2776  } else {
2777  std::cout << "!TEcnaRead::ReadAverageSigmaOfCorrelationsBetweenSamples(...) *** ERROR ***> Open .root file "
2778  "failed for file: "
2779  << file_name << fTTBELL << std::endl;
2780  allowed_to_read = kFALSE;
2781  ok_read = kFALSE;
2782  }
2783  }
2784 
2785  if (allowed_to_read == kTRUE) {
2786  Int_t i_zero = 0;
2787  ok_read = gCnaRootFile->ReadElement(typ, i_zero);
2788 
2789  if (ok_read == kTRUE) {
2790  fDataExist = kTRUE;
2791  for (Int_t i0StexStin = 0; i0StexStin < VecDim; i0StexStin++) {
2792  vec(i0StexStin) = gCnaRootFile->fCnaIndivResult->fMatHis(i_zero, i0StexStin);
2793  }
2794  } else {
2795  fDataExist = kFALSE;
2796  std::cout << "!TEcnaRead::ReadAverageSigmaOfCorrelationsBetweenSamples(...) *** ERROR ***> "
2797  << fCnaWrite->fRootFileNameShort.Data() << ": .root file failed" << std::endl
2798  << " -> quantity: <"
2799  << GetTypeOfQuantity(typ) << "> not available in file." << fTTBELL << std::endl;
2800  }
2801  CloseRootFile(file_name);
2802  }
2803  return vec;
2804 } // end of ReadAverageSigmaOfCorrelationsBetweenSamples
2805 
2806 //============================================================================
2807 //
2808 // 2 D H I S T O S (TECHNICAL METHODS)
2809 //
2810 //============================================================================
2811 //-------------------------------------------------------------------------
2812 //
2813 // ReadCovariancesBetweenSamples(n1StexStin,StinEcha,fFileHeader->fNbOfSamples)
2814 //
2815 //-------------------------------------------------------------------------
2816 TMatrixD TEcnaRead::ReadCovariancesBetweenSamples(const Int_t &n1StexStin,
2817  const Int_t &i0StinEcha,
2818  const Int_t &MatDim) {
2819  //Read the (sample,sample) covariances for a given channel
2820  //in ROOT file and return them in a TMatrixD
2821  //
2822  //Possible values for MatDim: (1) MatDim = fFileHeader->fNbOfSamples
2823 
2824  TestArrayDimH2("ReadCovariancesBetweenSamples", "fFileHeader->fNbOfSamples", fFileHeader->fNbOfSamples, MatDim);
2825 
2826  Int_t i0StexEcha = fEcalNumbering->Get0StexEchaFrom1StexStinAnd0StinEcha(n1StexStin, i0StinEcha);
2827 
2828  TMatrixD mat(MatDim, MatDim);
2829  for (Int_t i = 0; i - MatDim < 0; i++) {
2830  for (Int_t j = 0; j - MatDim < 0; j++) {
2831  mat(i, j) = (Double_t)0.;
2832  }
2833  }
2834 
2835  CnaResultTyp typ = cTypCovCss;
2836 
2837  const Text_t *file_name = (const Text_t *)fCnaWrite->fRootFileNameShort.Data();
2838  const Text_t *current_file_name = (const Text_t *)fCurrentlyOpenFileName.Data();
2839 
2840  Bool_t ok_open = kFALSE;
2841  Bool_t ok_read = kFALSE;
2842 
2843  TString FileNameLong = fCnaWrite->GetRootFileName();
2844  Bool_t allowed_to_read = kFALSE;
2845 
2846  // if ( fOpenRootFile )
2847  // {
2848  // std::cout << "!TEcnaRead::ReadCovariancesBetweenSamples(...) *** ERROR ***> "
2849  // << "Reading on file already open." << fTTBELL << std::endl;
2850  // }
2851 
2852  if (FileNameLong == fCurrentlyOpenFileName) {
2853  allowed_to_read = kTRUE;
2854  } else {
2856  CloseRootFile(current_file_name);
2857  }
2858  ok_open = OpenRootFile(file_name, "READ");
2859 
2860  if (ok_open) {
2861  allowed_to_read = kTRUE;
2862  } else {
2863  std::cout << "!TEcnaRead::ReadCovariancesBetweenSamples(...) *** ERROR ***> Open .root file failed for file: "
2864  << file_name << fTTBELL << std::endl;
2865  allowed_to_read = kFALSE;
2866  ok_read = kFALSE;
2867  }
2868  }
2869 
2870  if (allowed_to_read == kTRUE) {
2871  ok_read = gCnaRootFile->ReadElement(typ, i0StexEcha);
2872 
2873  if (ok_read == kTRUE) {
2874  fDataExist = kTRUE;
2875  for (Int_t i_samp = 0; i_samp - MatDim < 0; i_samp++) {
2876  for (Int_t j_samp = 0; j_samp - MatDim < 0; j_samp++) {
2877  mat(i_samp, j_samp) = gCnaRootFile->fCnaIndivResult->fMatMat(i_samp, j_samp);
2878  }
2879  }
2880  } else {
2881  fDataExist = kFALSE;
2882  std::cout << "!TEcnaRead::ReadCovariancesBetweenSamples() *** ERROR ***> " << fCnaWrite->fRootFileNameShort.Data()
2883  << ": .root file failed" << std::endl
2884  << " -> quantity: <" << GetTypeOfQuantity(typ)
2885  << "> not available in file." << fTTBELL << std::endl;
2886  }
2887  CloseRootFile(file_name);
2888  }
2889  return mat;
2890 }
2891 
2892 //-------------------------------------------------------------------------
2893 //
2894 // ReadCorrelationsBetweenSamples(n1StexStin,StinEcha,fFileHeader->fNbOfSamples)
2895 //
2896 //-------------------------------------------------------------------------
2897 TMatrixD TEcnaRead::ReadCorrelationsBetweenSamples(const Int_t &n1StexStin,
2898  const Int_t &i0StinEcha,
2899  const Int_t &MatDim) {
2900  //Read the (sample,sample) correlations for a given channel
2901  //in ROOT file and return them in a TMatrixD
2902  //
2903  //Possible values for MatDim: (1) MatDim = fFileHeader->fNbOfSamples
2904 
2905  TestArrayDimH2("ReadCorrelationsBetweenSamples", "fFileHeader->fNbOfSamples", fFileHeader->fNbOfSamples, MatDim);
2906 
2907  Int_t i0StexEcha = fEcalNumbering->Get0StexEchaFrom1StexStinAnd0StinEcha(n1StexStin, i0StinEcha);
2908  TMatrixD mat(MatDim, MatDim);
2909  for (Int_t i = 0; i - MatDim < 0; i++) {
2910  for (Int_t j = 0; j - MatDim < 0; j++) {
2911  mat(i, j) = (Double_t)0.;
2912  }
2913  }
2914 
2915  CnaResultTyp typ = cTypCorCss;
2916  const Text_t *file_name = (const Text_t *)fCnaWrite->fRootFileNameShort.Data();
2917  const Text_t *current_file_name = (const Text_t *)fCurrentlyOpenFileName.Data();
2918 
2919  Bool_t ok_open = kFALSE;
2920  Bool_t ok_read = kFALSE;
2921 
2922  TString FileNameLong = fCnaWrite->GetRootFileName();
2923  Bool_t allowed_to_read = kFALSE;
2924 
2925  // if ( fOpenRootFile )
2926  // {
2927  // std::cout << "!TEcnaRead::ReadCorrelationsBetweenSamples(...) *** ERROR ***> "
2928  // << "Reading on file already open." << fTTBELL << std::endl;
2929  // }
2930 
2931  if (FileNameLong == fCurrentlyOpenFileName) {
2932  allowed_to_read = kTRUE;
2933  } else {
2935  CloseRootFile(current_file_name);
2936  }
2937  ok_open = OpenRootFile(file_name, "READ");
2938 
2939  if (ok_open) {
2940  allowed_to_read = kTRUE;
2941  } else {
2942  std::cout << "!TEcnaRead::ReadCorrelationsBetweenSamples(...) *** ERROR ***> Open .root file failed for file: "
2943  << file_name << fTTBELL << std::endl;
2944  allowed_to_read = kFALSE;
2945  ok_read = kFALSE;
2946  }
2947  }
2948 
2949  if (allowed_to_read == kTRUE) {
2950  ok_read = gCnaRootFile->ReadElement(typ, i0StexEcha);
2951 
2952  if (ok_read == kTRUE) {
2953  fDataExist = kTRUE;
2954  for (Int_t i_samp = 0; i_samp - MatDim < 0; i_samp++) {
2955  for (Int_t j_samp = 0; j_samp - MatDim < 0; j_samp++) {
2956  mat(i_samp, j_samp) = gCnaRootFile->fCnaIndivResult->fMatMat(i_samp, j_samp);
2957  }
2958  }
2959  } else {
2960  fDataExist = kFALSE;
2961  std::cout << "!TEcnaRead::ReadCorrelationsBetweenSamples() *** ERROR ***> "
2962  << fCnaWrite->fRootFileNameShort.Data() << ": .root file failed" << std::endl
2963  << " -> quantity: <"
2964  << GetTypeOfQuantity(typ) << "> not available in file." << fTTBELL << std::endl;
2965  }
2966  CloseRootFile(file_name);
2967  }
2968  return mat;
2969 }
2970 //-------------------------------------------------------------------------
2971 //
2972 // ReadRelevantCorrelationsBetweenSamples(n1StexStin,i0StinEcha)
2973 // (NOT USED)
2974 //-------------------------------------------------------------------------
2975 TVectorD TEcnaRead::ReadRelevantCorrelationsBetweenSamples(const Int_t &n1StexStin,
2976  const Int_t &i0StinEcha,
2977  const Int_t &InPutMatDim) {
2978  //Read the (sample,sample) correlations for a given channel
2979  //in ROOT file and return the relevant correlations in a TVectorD
2980  //
2981  //Possible values for InPutMatDim: (1) InPutMatDim = fFileHeader->fNbOfSamples
2982  //
2983  // *===> OutPut TVectorD dimension value = InPutMatDim*(InPutMatDim-1)/2
2984 
2986  "ReadRelevantCorrelationsBetweenSamples", "fFileHeader->fNbOfSamples", fFileHeader->fNbOfSamples, InPutMatDim);
2987 
2988  Int_t i0StexEcha = fEcalNumbering->Get0StexEchaFrom1StexStinAnd0StinEcha(n1StexStin, i0StinEcha);
2989  Int_t nb_of_relevant = InPutMatDim * (InPutMatDim - 1) / 2;
2990  TVectorD vec_rel(nb_of_relevant);
2991  for (Int_t i = 0; i < nb_of_relevant; i++) {
2992  vec_rel(i) = (Double_t)0.;
2993  }
2994  CnaResultTyp typ = cTypCorCss;
2995  const Text_t *file_name = (const Text_t *)fCnaWrite->fRootFileNameShort.Data();
2996  const Text_t *current_file_name = (const Text_t *)fCurrentlyOpenFileName.Data();
2997 
2998  Bool_t ok_open = kFALSE;
2999  Bool_t ok_read = kFALSE;
3000 
3001  TString FileNameLong = fCnaWrite->GetRootFileName();
3002  Bool_t allowed_to_read = kFALSE;
3003 
3004  // if ( fOpenRootFile )
3005  // {
3006  // std::cout << "!TEcnaRead::ReadRelevantCorrelationsBetweenSamples(...) *** ERROR ***> "
3007  // << "Reading on file already open." << fTTBELL << std::endl;
3008  // }
3009 
3010  if (FileNameLong == fCurrentlyOpenFileName) {
3011  allowed_to_read = kTRUE;
3012  } else {
3014  CloseRootFile(current_file_name);
3015  }
3016  ok_open = OpenRootFile(file_name, "READ");
3017 
3018  if (ok_open) {
3019  allowed_to_read = kTRUE;
3020  } else {
3021  std::cout
3022  << "!TEcnaRead::ReadRelevantCorrelationsBetweenSamples(...) *** ERROR ***> Open .root file failed for file: "
3023  << file_name << fTTBELL << std::endl;
3024  allowed_to_read = kFALSE;
3025  ok_read = kFALSE;
3026  }
3027  }
3028 
3029  if (allowed_to_read == kTRUE) {
3030  ok_read = gCnaRootFile->ReadElement(typ, i0StexEcha);
3031 
3032  if (ok_read == kTRUE) {
3033  fDataExist = kTRUE;
3034  Int_t k_cor = 0;
3035  for (Int_t i_samp = 0; i_samp < InPutMatDim; i_samp++) {
3036  for (Int_t j_samp = 0; j_samp < i_samp; j_samp++) {
3037  vec_rel(k_cor) = gCnaRootFile->fCnaIndivResult->fMatMat(i_samp, j_samp);
3038  k_cor++;
3039  }
3040  }
3041  } else {
3042  fDataExist = kFALSE;
3043  std::cout << "!TEcnaRead::ReadRelevantCorrelationsBetweenSamples() *** ERROR ***> "
3044  << fCnaWrite->fRootFileNameShort.Data() << ": .root file failed" << std::endl
3045  << " -> quantity: <"
3046  << GetTypeOfQuantity(typ) << "> not available in file." << fTTBELL << std::endl;
3047  }
3048  CloseRootFile(file_name);
3049  }
3050  return vec_rel;
3051 }
3052 //----- end of (ReadRelevantCorrelationsBetweenSamples ) -------
3053 
3054 //-----------------------------------------------------------------------------------------
3055 //
3056 // ReadLowFrequencyCovariancesBetweenChannels(Stin_a, Stin_b)
3057 //
3058 //-----------------------------------------------------------------------------------------
3060  const Int_t &n1StexStin_b,
3061  const Int_t &MatDim) {
3062  //Read the Low Frequency cov(i0StinEcha of Stin_a, i0StinEcha of Stin b)
3063  //in ROOT file and return them in a TMatrixD
3064  //
3065  //Possible values for MatDim: (1) MatDim = fEcal->MaxCrysInStin()
3066 
3068  "ReadLowFrequencyCovariancesBetweenChannels", "fEcal->MaxCrysInStin()", fEcal->MaxCrysInStin(), MatDim);
3069 
3070  Int_t index_Stin_a = GetStinIndex(n1StexStin_a);
3071  Int_t index_Stin_b = GetStinIndex(n1StexStin_b);
3072 
3073  TMatrixD mat(MatDim, MatDim);
3074  for (Int_t i = 0; i - MatDim < 0; i++) {
3075  for (Int_t j = 0; j - MatDim < 0; j++) {
3076  mat(i, j) = (Double_t)0.;
3077  }
3078  }
3079 
3080  CnaResultTyp typ = cTypLfCov;
3081 
3082  const Text_t *file_name = (const Text_t *)fCnaWrite->fRootFileNameShort.Data();
3083  const Text_t *current_file_name = (const Text_t *)fCurrentlyOpenFileName.Data();
3084 
3085  Bool_t ok_open = kFALSE;
3086  Bool_t ok_read = kFALSE;
3087 
3088  TString FileNameLong = fCnaWrite->GetRootFileName();
3089  Bool_t allowed_to_read = kFALSE;
3090 
3091  // if ( fOpenRootFile )
3092  // {
3093  // std::cout << "!TEcnaRead::ReadLowFrequencyCovariancesBetweenChannels(...) *** ERROR ***>"
3094  // << " Reading on file already open." << fTTBELL << std::endl;
3095  // }
3096 
3097  if (FileNameLong == fCurrentlyOpenFileName) {
3098  allowed_to_read = kTRUE;
3099  } else {
3101  CloseRootFile(current_file_name);
3102  }
3103  ok_open = OpenRootFile(file_name, "READ");
3104 
3105  if (ok_open) {
3106  allowed_to_read = kTRUE;
3107  } else {
3108  std::cout << "!TEcnaRead::ReadLowFrequencyCovariancesBetweenChannels(...) *** ERROR ***> Open .root file failed "
3109  "for file: "
3110  << file_name << fTTBELL << std::endl;
3111  allowed_to_read = kFALSE;
3112  ok_read = kFALSE;
3113  }
3114  }
3115 
3116  if (allowed_to_read == kTRUE) {
3117  Int_t i_zero = 0;
3118  ok_read = gCnaRootFile->ReadElement(typ, i_zero);
3119 
3120  if (ok_read == kTRUE) {
3121  fDataExist = kTRUE;
3122  for (Int_t i_crys = 0; i_crys - MatDim < 0; i_crys++) {
3123  Int_t i_cna_chan = index_Stin_a * MatDim + i_crys;
3124  for (Int_t j_crys = 0; j_crys - MatDim < 0; j_crys++) {
3125  Int_t j_cna_chan = index_Stin_b * MatDim + j_crys;
3126  mat(i_crys, j_crys) = gCnaRootFile->fCnaIndivResult->fMatMat(i_cna_chan, j_cna_chan);
3127  }
3128  }
3129  } else {
3130  fDataExist = kFALSE;
3131  std::cout << "!TEcnaRead::ReadLowFrequencyCovariancesBetweenChannels(...) *** ERROR ***> "
3132  << fCnaWrite->fRootFileNameShort.Data() << ": .root file failed" << std::endl
3133  << " -> quantity: <"
3134  << GetTypeOfQuantity(typ) << "> not available in file." << fTTBELL << std::endl;
3135  }
3136  CloseRootFile(file_name);
3137  }
3138  return mat;
3139 }
3140 //----- end of ( ReadLowFrequencyCovariancesBetweenChannels(...) ) -------
3141 
3142 //-------------------------------------------------------------------------------------------
3143 //
3144 // ReadLowFrequencyCorrelationsBetweenChannels(Stin_a, Stin_b)
3145 //
3146 //-------------------------------------------------------------------------------------------
3148  const Int_t &n1StexStin_b,
3149  const Int_t &MatDim) {
3150  //Read the Low Frequency cor(i0StinEcha of Stin_a, i0StinEcha of Stin b)
3151  //in ROOT file and return them in a TMatrixD
3152  //
3153  //Possible values for MatDim: (1) MatDim = fEcal->MaxCrysInStin()
3154 
3156  "ReadLowFrequencyCorrelationsBetweenChannels", "fEcal->MaxCrysInStin()", fEcal->MaxCrysInStin(), MatDim);
3157 
3158  Int_t index_Stin_a = GetStinIndex(n1StexStin_a);
3159  Int_t index_Stin_b = GetStinIndex(n1StexStin_b);
3160 
3161  TMatrixD mat(MatDim, MatDim);
3162  for (Int_t i = 0; i - MatDim < 0; i++) {
3163  for (Int_t j = 0; j - MatDim < 0; j++) {
3164  mat(i, j) = (Double_t)0.;
3165  }
3166  }
3167 
3168  CnaResultTyp typ = cTypLfCor;
3169 
3170  const Text_t *file_name = (const Text_t *)fCnaWrite->fRootFileNameShort.Data();
3171  const Text_t *current_file_name = (const Text_t *)fCurrentlyOpenFileName.Data();
3172 
3173  Bool_t ok_open = kFALSE;
3174  Bool_t ok_read = kFALSE;
3175 
3176  TString FileNameLong = fCnaWrite->GetRootFileName();
3177  Bool_t allowed_to_read = kFALSE;
3178 
3179  // if ( fOpenRootFile )
3180  // {
3181  // std::cout << "!TEcnaRead::ReadLowFrequencyCorrelationsBetweenChannels(...) *** ERROR ***>"
3182  // << " Reading on file already open." << fTTBELL << std::endl;
3183  // }
3184 
3185  if (FileNameLong == fCurrentlyOpenFileName) {
3186  allowed_to_read = kTRUE;
3187  } else {
3189  CloseRootFile(current_file_name);
3190  }
3191  ok_open = OpenRootFile(file_name, "READ");
3192 
3193  if (ok_open) {
3194  allowed_to_read = kTRUE;
3195  } else {
3196  std::cout << "!TEcnaRead::ReadLowFrequencyCorrelationsBetweenChannels(...) *** ERROR ***> Open .root file failed "
3197  "for file: "
3198  << file_name << fTTBELL << std::endl;
3199  allowed_to_read = kFALSE;
3200  ok_read = kFALSE;
3201  }
3202  }
3203 
3204  if (allowed_to_read == kTRUE) {
3205  Int_t i_zero = 0;
3206 
3207  ok_read = gCnaRootFile->ReadElement(typ, i_zero);
3208 
3209  if (ok_read == kTRUE) {
3210  fDataExist = kTRUE;
3211  for (Int_t i_crys = 0; i_crys - MatDim < 0; i_crys++) {
3212  Int_t i_cna_chan = index_Stin_a * MatDim + i_crys;
3213  for (Int_t j_crys = 0; j_crys - MatDim < 0; j_crys++) {
3214  Int_t j_cna_chan = index_Stin_b * MatDim + j_crys;
3215  mat(i_crys, j_crys) = gCnaRootFile->fCnaIndivResult->fMatMat(i_cna_chan, j_cna_chan);
3216  }
3217  }
3218  } else {
3219  fDataExist = kFALSE;
3220  std::cout << "!TEcnaRead::ReadLowFrequencyCorrelationsBetweenChannels(...) *** ERROR ***> "
3221  << fCnaWrite->fRootFileNameShort.Data() << ": .root file failed" << std::endl
3222  << " -> quantity: <"
3223  << GetTypeOfQuantity(typ) << "> not available in file." << fTTBELL << std::endl;
3224  }
3225  CloseRootFile(file_name);
3226  }
3227  return mat;
3228 }
3229 //----- end of ( ReadLowFrequencyCorrelationsBetweenChannels(...) ) -------
3230 
3231 //-----------------------------------------------------------------------------------------
3232 //
3233 // ReadHighFrequencyCovariancesBetweenChannels(Stin_a, Stin_b)
3234 //
3235 //-----------------------------------------------------------------------------------------
3237  const Int_t &n1StexStin_b,
3238  const Int_t &MatDim) {
3239  //Read the High Frequency cov(i0StinEcha of Stin_a, i0StinEcha of Stin b)
3240  //in ROOT file and return them in a TMatrixD
3241  //
3242  //Possible values for MatDim: (1) MatDim = fEcal->MaxCrysInStin()
3243 
3245  "ReadHighFrequencyCovariancesBetweenChannels", "fEcal->MaxCrysInStin()", fEcal->MaxCrysInStin(), MatDim);
3246 
3247  Int_t index_Stin_a = GetStinIndex(n1StexStin_a);
3248  Int_t index_Stin_b = GetStinIndex(n1StexStin_b);
3249 
3250  TMatrixD mat(MatDim, MatDim);
3251  for (Int_t i = 0; i - MatDim < 0; i++) {
3252  for (Int_t j = 0; j - MatDim < 0; j++) {
3253  mat(i, j) = (Double_t)0.;
3254  }
3255  }
3256 
3257  CnaResultTyp typ = cTypHfCov;
3258 
3259  const Text_t *file_name = (const Text_t *)fCnaWrite->fRootFileNameShort.Data();
3260  const Text_t *current_file_name = (const Text_t *)fCurrentlyOpenFileName.Data();
3261 
3262  Bool_t ok_open = kFALSE;
3263  Bool_t ok_read = kFALSE;
3264 
3265  TString FileNameLong = fCnaWrite->GetRootFileName();
3266  Bool_t allowed_to_read = kFALSE;
3267 
3268  // if ( fOpenRootFile )
3269  // {
3270  // std::cout << "!TEcnaRead::ReadHighFrequencyCovariancesBetweenChannels(...) *** ERROR ***>"
3271  // << " Reading on file already open." << fTTBELL << std::endl;
3272  // }
3273 
3274  if (FileNameLong == fCurrentlyOpenFileName) {
3275  allowed_to_read = kTRUE;
3276  } else {
3278  CloseRootFile(current_file_name);
3279  }
3280  ok_open = OpenRootFile(file_name, "READ");
3281 
3282  if (ok_open) {
3283  allowed_to_read = kTRUE;
3284  } else {
3285  std::cout << "!TEcnaRead::ReadHighFrequencyCovariancesBetweenChannels(...) *** ERROR ***> Open .root file failed "
3286  "for file: "
3287  << file_name << fTTBELL << std::endl;
3288  allowed_to_read = kFALSE;
3289  ok_read = kFALSE;
3290  }
3291  }
3292 
3293  if (allowed_to_read == kTRUE) {
3294  Int_t i_zero = 0;
3295  ok_read = gCnaRootFile->ReadElement(typ, i_zero);
3296 
3297  if (ok_read == kTRUE) {
3298  fDataExist = kTRUE;
3299  for (Int_t i_crys = 0; i_crys - MatDim < 0; i_crys++) {
3300  Int_t i_cna_chan = index_Stin_a * MatDim + i_crys;
3301  for (Int_t j_crys = 0; j_crys - MatDim < 0; j_crys++) {
3302  Int_t j_cna_chan = index_Stin_b * MatDim + j_crys;
3303  mat(i_crys, j_crys) = gCnaRootFile->fCnaIndivResult->fMatMat(i_cna_chan, j_cna_chan);
3304  }
3305  }
3306  } else {
3307  fDataExist = kFALSE;
3308  std::cout << "!TEcnaRead::ReadHighFrequencyCovariancesBetweenChannels(...) *** ERROR ***> "
3309  << fCnaWrite->fRootFileNameShort.Data() << ": .root file failed" << std::endl
3310  << " -> quantity: <"
3311  << GetTypeOfQuantity(typ) << "> not available in file." << fTTBELL << std::endl;
3312  }
3313  CloseRootFile(file_name);
3314  }
3315  return mat;
3316 }
3317 //----- end of ( ReadHighFrequencyCovariancesBetweenChannels(...) ) -------
3318 
3319 //-------------------------------------------------------------------------------------------
3320 //
3321 // ReadHighFrequencyCorrelationsBetweenChannels(Stin_a, Stin_b)
3322 //
3323 //-------------------------------------------------------------------------------------------
3325  const Int_t &n1StexStin_b,
3326  const Int_t &MatDim) {
3327  //Read the High Frequency Cor(i0StinEcha of Stin_a, i0StinEcha of Stin b)
3328  //in ROOT file and return them in a TMatrixD
3329  //
3330  //Possible values for MatDim: (1) MatDim = fEcal->MaxCrysInStin()
3331 
3333  "ReadHighFrequencyCorrelationsBetweenChannels", "fEcal->MaxCrysInStin()", fEcal->MaxCrysInStin(), MatDim);
3334 
3335  Int_t index_Stin_a = GetStinIndex(n1StexStin_a);
3336  Int_t index_Stin_b = GetStinIndex(n1StexStin_b);
3337 
3338  TMatrixD mat(MatDim, MatDim);
3339  for (Int_t i = 0; i - MatDim < 0; i++) {
3340  for (Int_t j = 0; j - MatDim < 0; j++) {
3341  mat(i, j) = (Double_t)0.;
3342  }
3343  }
3344 
3345  CnaResultTyp typ = cTypHfCor;
3346 
3347  const Text_t *file_name = (const Text_t *)fCnaWrite->fRootFileNameShort.Data();
3348  const Text_t *current_file_name = (const Text_t *)fCurrentlyOpenFileName.Data();
3349 
3350  Bool_t ok_open = kFALSE;
3351  Bool_t ok_read = kFALSE;
3352 
3353  TString FileNameLong = fCnaWrite->GetRootFileName();
3354  Bool_t allowed_to_read = kFALSE;
3355 
3356  // if ( fOpenRootFile )
3357  // {
3358  // std::cout << "!TEcnaRead::ReadHighFrequencyCorrelationsBetweenChannels(...) *** ERROR ***>"
3359  // << " Reading on file already open." << fTTBELL << std::endl;
3360  // }
3361 
3362  if (FileNameLong == fCurrentlyOpenFileName) {
3363  allowed_to_read = kTRUE;
3364  } else {
3366  CloseRootFile(current_file_name);
3367  }
3368  ok_open = OpenRootFile(file_name, "READ");
3369 
3370  if (ok_open) {
3371  allowed_to_read = kTRUE;
3372  } else {
3373  std::cout << "!TEcnaRead::ReadHighFrequencyCorrelationsBetweenChannels(...) *** ERROR ***> Open .root file "
3374  "failed for file: "
3375  << file_name << fTTBELL << std::endl;
3376  allowed_to_read = kFALSE;
3377  ok_read = kFALSE;
3378  }
3379  }
3380 
3381  if (allowed_to_read == kTRUE) {
3382  Int_t i_zero = 0;
3383 
3384  ok_read = gCnaRootFile->ReadElement(typ, i_zero);
3385 
3386  if (ok_read == kTRUE) {
3387  fDataExist = kTRUE;
3388  for (Int_t i_crys = 0; i_crys - MatDim < 0; i_crys++) {
3389  Int_t i_cna_chan = index_Stin_a * MatDim + i_crys;
3390  for (Int_t j_crys = 0; j_crys - MatDim < 0; j_crys++) {
3391  Int_t j_cna_chan = index_Stin_b * MatDim + j_crys;
3392  mat(i_crys, j_crys) = gCnaRootFile->fCnaIndivResult->fMatMat(i_cna_chan, j_cna_chan);
3393  }
3394  }
3395  } else {
3396  fDataExist = kFALSE;
3397  std::cout << "!TEcnaRead::ReadHighFrequencyCorrelationsBetweenChannels(...) *** ERROR ***> "
3398  << fCnaWrite->fRootFileNameShort.Data() << ": .root file failed" << std::endl
3399  << " -> quantity: <"
3400  << GetTypeOfQuantity(typ) << "> not available in file." << fTTBELL << std::endl;
3401  }
3402  CloseRootFile(file_name);
3403  }
3404  return mat;
3405 }
3406 //----- end of ( ReadHighFrequencyCorrelationsBetweenChannels(...) ) -------
3407 
3408 //-------------------------------------------------------------------------
3409 //
3410 // ReadLowFrequencyCovariancesBetweenChannels(...)
3411 // (NOT USED)
3412 //-------------------------------------------------------------------------
3414  //Read all the Low Frequency covariances
3415  //in ROOT file and return them in a TMatrixD
3416  //
3417  //Possible values for MatDim: (1) MatDim = fEcal->MaxCrysEcnaInStex()
3418 
3420  "ReadLowFrequencyCovariancesBetweenChannels", "fEcal->MaxCrysEcnaInStex()", fEcal->MaxCrysEcnaInStex(), MatDim);
3421 
3422  //=====> WARNING: BIG MATRIX (1700x1700)
3423  TMatrixD mat(MatDim, MatDim);
3424  for (Int_t i = 0; i - MatDim < 0; i++) {
3425  for (Int_t j = 0; j - MatDim < 0; j++) {
3426  mat(i, j) = (Double_t)0.;
3427  }
3428  }
3429 
3430  TVectorD vec(fEcal->MaxStinEcnaInStex());
3431  for (Int_t i = 0; i < fEcal->MaxStinEcnaInStex(); i++) {
3432  vec(i) = (Double_t)0.;
3433  }
3435 
3436  CnaResultTyp typ = cTypLfCov;
3437 
3438  const Text_t *file_name = (const Text_t *)fCnaWrite->fRootFileNameShort.Data();
3439  const Text_t *current_file_name = (const Text_t *)fCurrentlyOpenFileName.Data();
3440 
3441  Bool_t ok_open = kFALSE;
3442  Bool_t ok_read = kFALSE;
3443 
3444  TString FileNameLong = fCnaWrite->GetRootFileName();
3445  Bool_t allowed_to_read = kFALSE;
3446 
3447  // if ( fOpenRootFile )
3448  // {
3449  // std::cout << "!TEcnaRead::ReadLowFrequencyCovariancesBetweenChannels() *** ERROR ***>"
3450  // << " Reading on file already open." << fTTBELL << std::endl;
3451  // }
3452 
3453  if (FileNameLong == fCurrentlyOpenFileName) {
3454  allowed_to_read = kTRUE;
3455  } else {
3457  CloseRootFile(current_file_name);
3458  }
3459  ok_open = OpenRootFile(file_name, "READ");
3460 
3461  if (ok_open) {
3462  allowed_to_read = kTRUE;
3463  } else {
3464  std::cout << "!TEcnaRead::ReadLowFrequencyCovariancesBetweenChannels(...) *** ERROR ***> Open .root file failed "
3465  "for file: "
3466  << file_name << fTTBELL << std::endl;
3467  allowed_to_read = kFALSE;
3468  ok_read = kFALSE;
3469  }
3470  }
3471 
3472  if (allowed_to_read == kTRUE) {
3473  Int_t i_zero = 0;
3474  ok_read = gCnaRootFile->ReadElement(typ, i_zero);
3475 
3476  if (ok_read == kTRUE) {
3477  fDataExist = kTRUE;
3478  for (Int_t index_Stin_a = 0; index_Stin_a < fEcal->MaxStinEcnaInStex(); index_Stin_a++) {
3479  if (vec(index_Stin_a) > 0 && vec(index_Stin_a) <= fEcal->MaxStinEcnaInStex()) {
3480  for (Int_t index_Stin_b = 0; index_Stin_b < fEcal->MaxStinEcnaInStex(); index_Stin_b++) {
3481  if (vec(index_Stin_b) > 0 && vec(index_Stin_b) <= fEcal->MaxStinEcnaInStex()) {
3482  for (Int_t i_crys = 0; i_crys < fEcal->MaxCrysInStin(); i_crys++) {
3483  Int_t i_cna_chan = index_Stin_a * fEcal->MaxCrysInStin() + i_crys;
3484  Int_t i_chan_sm = (Int_t)(vec(index_Stin_a) - 1) * fEcal->MaxCrysInStin() + i_crys;
3485  for (Int_t j_crys = 0; j_crys < fEcal->MaxCrysInStin(); j_crys++) {
3486  Int_t j_cna_chan = index_Stin_b * fEcal->MaxCrysInStin() + j_crys;
3487  Int_t j_chan_sm = (Int_t)(vec(index_Stin_b) - 1) * fEcal->MaxCrysInStin() + j_crys;
3488  mat(i_chan_sm, j_chan_sm) = gCnaRootFile->fCnaIndivResult->fMatMat(i_cna_chan, j_cna_chan);
3489  }
3490  }
3491  }
3492  }
3493  }
3494  }
3495  } else {
3496  fDataExist = kFALSE;
3497  std::cout << "!TEcnaRead::ReadLowFrequencyCovariancesBetweenChannels() *** ERROR ***> "
3498  << fCnaWrite->fRootFileNameShort.Data() << ": .root file failed" << std::endl
3499  << " -> quantity: <"
3500  << GetTypeOfQuantity(typ) << "> not available in file." << fTTBELL << std::endl;
3501  }
3502  CloseRootFile(file_name);
3503  }
3504  return mat;
3505 }
3506 //----- end of ( ReadLowFrequencyCovariancesBetweenChannels(...) ) -------
3507 
3508 //-------------------------------------------------------------------------
3509 //
3510 // ReadLowFrequencyCorrelationsBetweenChannels(...)
3511 //
3512 //-------------------------------------------------------------------------
3514  //Read all the Low Frequency correlations
3515  //in ROOT file and return them in a TMatrixD
3516  //
3517  //Possible values for MatDim: (1) MatDim = fEcal->MaxCrysEcnaInStex()
3518 
3520  "ReadLowFrequencyCorrelationsBetweenChannels", "fEcal->MaxCrysEcnaInStex()", fEcal->MaxCrysEcnaInStex(), MatDim);
3521 
3522  //=====> WARNING: BIG MATRIX (1700x1700)
3523  TMatrixD mat(MatDim, MatDim);
3524  for (Int_t i = 0; i - MatDim < 0; i++) {
3525  for (Int_t j = 0; j - MatDim < 0; j++) {
3526  mat(i, j) = (Double_t)0.;
3527  }
3528  }
3529 
3530  TVectorD vec(fEcal->MaxStinEcnaInStex());
3531  for (Int_t i = 0; i < fEcal->MaxStinEcnaInStex(); i++) {
3532  vec(i) = (Double_t)0.;
3533  }
3535 
3536  CnaResultTyp typ = cTypLfCor;
3537 
3538  const Text_t *file_name = (const Text_t *)fCnaWrite->fRootFileNameShort.Data();
3539  const Text_t *current_file_name = (const Text_t *)fCurrentlyOpenFileName.Data();
3540 
3541  Bool_t ok_open = kFALSE;
3542  Bool_t ok_read = kFALSE;
3543 
3544  TString FileNameLong = fCnaWrite->GetRootFileName();
3545  Bool_t allowed_to_read = kFALSE;
3546 
3547  // if ( fOpenRootFile )
3548  // {
3549  // std::cout << "!TEcnaRead::ReadLowFrequencyCorrelationsBetweenChannels() *** ERROR ***>"
3550  // << " Reading on file already open." << fTTBELL << std::endl;
3551  // }
3552 
3553  if (FileNameLong == fCurrentlyOpenFileName) {
3554  allowed_to_read = kTRUE;
3555  } else {
3557  CloseRootFile(current_file_name);
3558  }
3559  ok_open = OpenRootFile(file_name, "READ");
3560 
3561  if (ok_open) {
3562  allowed_to_read = kTRUE;
3563  } else {
3564  std::cout << "!TEcnaRead::ReadLowFrequencyCorrelationsBetweenChannels(...) *** ERROR ***> Open .root file failed "
3565  "for file: "
3566  << file_name << fTTBELL << std::endl;
3567  allowed_to_read = kFALSE;
3568  ok_read = kFALSE;
3569  }
3570  }
3571 
3572  if (allowed_to_read == kTRUE) {
3573  Int_t i_zero = 0;
3574  ok_read = gCnaRootFile->ReadElement(typ, i_zero);
3575 
3576  if (ok_read == kTRUE) {
3577  fDataExist = kTRUE;
3578  for (Int_t index_Stin_a = 0; index_Stin_a < fEcal->MaxStinEcnaInStex(); index_Stin_a++) {
3579  if (vec(index_Stin_a) > 0 && vec(index_Stin_a) <= fEcal->MaxStinEcnaInStex()) {
3580  for (Int_t index_Stin_b = 0; index_Stin_b < fEcal->MaxStinEcnaInStex(); index_Stin_b++) {
3581  if (vec(index_Stin_b) > 0 && vec(index_Stin_b) <= fEcal->MaxStinEcnaInStex()) {
3582  for (Int_t i_crys = 0; i_crys < fEcal->MaxCrysInStin(); i_crys++) {
3583  Int_t i_cna_chan = index_Stin_a * fEcal->MaxCrysInStin() + i_crys;
3584  Int_t i_chan_sm = (Int_t)(vec(index_Stin_a) - 1) * fEcal->MaxCrysInStin() + i_crys;
3585  for (Int_t j_crys = 0; j_crys < fEcal->MaxCrysInStin(); j_crys++) {
3586  Int_t j_cna_chan = index_Stin_b * fEcal->MaxCrysInStin() + j_crys;
3587  Int_t j_chan_sm = (Int_t)(vec(index_Stin_b) - 1) * fEcal->MaxCrysInStin() + j_crys;
3588  mat(i_chan_sm, j_chan_sm) = gCnaRootFile->fCnaIndivResult->fMatMat(i_cna_chan, j_cna_chan);
3589  }
3590  }
3591  }
3592  }
3593  }
3594  }
3595  } else {
3596  fDataExist = kFALSE;
3597  std::cout << "!TEcnaRead::ReadLowFrequencyCorrelationsBetweenChannels() *** ERROR ***> "
3598  << fCnaWrite->fRootFileNameShort.Data() << ": .root file failed" << std::endl
3599  << " -> quantity: <"
3600  << GetTypeOfQuantity(typ) << "> not available in file." << fTTBELL << std::endl;
3601  }
3602  CloseRootFile(file_name);
3603  }
3604  return mat;
3605 }
3606 //----- end of (ReadLowFrequencyCorrelationsBetweenChannels(...) ) -------
3607 
3608 //-------------------------------------------------------------------------
3609 //
3610 // ReadHighFrequencyCovariancesBetweenChannels(...)
3611 // (NOT USED)
3612 //-------------------------------------------------------------------------
3614  //Read all the High Frequency covariances
3615  //in ROOT file and return them in a TMatrixD
3616  //
3617  //Possible values for MatDim: (1) MatDim = fEcal->MaxCrysEcnaInStex()
3618 
3620  "ReadHighFrequencyCovariancesBetweenChannels", "fEcal->MaxCrysEcnaInStex()", fEcal->MaxCrysEcnaInStex(), MatDim);
3621 
3622  //=====> WARNING: BIG MATRIX (1700x1700)
3623  TMatrixD mat(MatDim, MatDim);
3624  for (Int_t i = 0; i - MatDim < 0; i++) {
3625  for (Int_t j = 0; j - MatDim < 0; j++) {
3626  mat(i, j) = (Double_t)0.;
3627  }
3628  }
3629 
3630  TVectorD vec(fEcal->MaxStinEcnaInStex());
3631  for (Int_t i = 0; i < fEcal->MaxStinEcnaInStex(); i++) {
3632  vec(i) = (Double_t)0.;
3633  }
3635 
3636  CnaResultTyp typ = cTypHfCov;
3637 
3638  const Text_t *file_name = (const Text_t *)fCnaWrite->fRootFileNameShort.Data();
3639  const Text_t *current_file_name = (const Text_t *)fCurrentlyOpenFileName.Data();
3640 
3641  Bool_t ok_open = kFALSE;
3642  Bool_t ok_read = kFALSE;
3643 
3644  TString FileNameLong = fCnaWrite->GetRootFileName();
3645  Bool_t allowed_to_read = kFALSE;
3646 
3647  // if ( fOpenRootFile )
3648  // {
3649  // std::cout << "!TEcnaRead::ReadHighFrequencyCovariancesBetweenChannels() *** ERROR ***>"
3650  // << " Reading on file already open." << fTTBELL << std::endl;
3651  // }
3652 
3653  if (FileNameLong == fCurrentlyOpenFileName) {
3654  allowed_to_read = kTRUE;
3655  } else {
3657  CloseRootFile(current_file_name);
3658  }
3659  ok_open = OpenRootFile(file_name, "READ");
3660 
3661  if (ok_open) {
3662  allowed_to_read = kTRUE;
3663  } else {
3664  std::cout << "!TEcnaRead::ReadHighFrequencyCovariancesBetweenChannels(...) *** ERROR ***> Open .root file failed "
3665  "for file: "
3666  << file_name << fTTBELL << std::endl;
3667  allowed_to_read = kFALSE;
3668  ok_read = kFALSE;
3669  }
3670  }
3671 
3672  if (allowed_to_read == kTRUE) {
3673  Int_t i_zero = 0;
3674  ok_read = gCnaRootFile->ReadElement(typ, i_zero);
3675 
3676  if (ok_read == kTRUE) {
3677  fDataExist = kTRUE;
3678  for (Int_t index_Stin_a = 0; index_Stin_a < fEcal->MaxStinEcnaInStex(); index_Stin_a++) {
3679  if (vec(index_Stin_a) > 0 && vec(index_Stin_a) <= fEcal->MaxStinEcnaInStex()) {
3680  for (Int_t index_Stin_b = 0; index_Stin_b < fEcal->MaxStinEcnaInStex(); index_Stin_b++) {
3681  if (vec(index_Stin_b) > 0 && vec(index_Stin_b) <= fEcal->MaxStinEcnaInStex()) {
3682  for (Int_t i_crys = 0; i_crys < fEcal->MaxCrysInStin(); i_crys++) {
3683  Int_t i_cna_chan = index_Stin_a * fEcal->MaxCrysInStin() + i_crys;
3684  Int_t i_chan_sm = (Int_t)(vec(index_Stin_a) - 1) * fEcal->MaxCrysInStin() + i_crys;
3685  for (Int_t j_crys = 0; j_crys < fEcal->MaxCrysInStin(); j_crys++) {
3686  Int_t j_cna_chan = index_Stin_b * fEcal->MaxCrysInStin() + j_crys;
3687  Int_t j_chan_sm = (Int_t)(vec(index_Stin_b) - 1) * fEcal->MaxCrysInStin() + j_crys;
3688  mat(i_chan_sm, j_chan_sm) = gCnaRootFile->fCnaIndivResult->fMatMat(i_cna_chan, j_cna_chan);
3689  }
3690  }
3691  }
3692  }
3693  }
3694  }
3695  } else {
3696  fDataExist = kFALSE;
3697  std::cout << "!TEcnaRead::ReadHighFrequencyCovariancesBetweenChannels() *** ERROR ***> "
3698  << fCnaWrite->fRootFileNameShort.Data() << ": .root file failed" << std::endl
3699  << " -> quantity: <"
3700  << GetTypeOfQuantity(typ) << "> not available in file." << fTTBELL << std::endl;
3701  }
3702  CloseRootFile(file_name);
3703  }
3704  return mat;
3705 }
3706 //----- end of ( ReadHighFrequencyCovariancesBetweenChannels(...) ) -------
3707 
3708 //-------------------------------------------------------------------------
3709 //
3710 // ReadHighFrequencyCorrelationsBetweenChannels(...)
3711 //
3712 //-------------------------------------------------------------------------
3714  //Read all the High Frequency correlations
3715  //in ROOT file and return them in a TMatrixD
3716  //
3717  //Possible values for MatDim: (1) MatDim = fEcal->MaxCrysEcnaInStex()
3718 
3720  "ReadHighFrequencyCorrelationsBetweenChannels", "fEcal->MaxCrysEcnaInStex()", fEcal->MaxCrysEcnaInStex(), MatDim);
3721 
3722  //=====> WARNING: BIG MATRIX (1700x1700)
3723  TMatrixD mat(MatDim, MatDim);
3724  for (Int_t i = 0; i - MatDim < 0; i++) {
3725  for (Int_t j = 0; j - MatDim < 0; j++) {
3726  mat(i, j) = (Double_t)0.;
3727  }
3728  }
3729 
3730  TVectorD vec(fEcal->MaxStinEcnaInStex());
3731  for (Int_t i = 0; i < fEcal->MaxStinEcnaInStex(); i++) {
3732  vec(i) = (Double_t)0.;
3733  }
3735 
3736  CnaResultTyp typ = cTypHfCor;
3737 
3738  const Text_t *file_name = (const Text_t *)fCnaWrite->fRootFileNameShort.Data();
3739  const Text_t *current_file_name = (const Text_t *)fCurrentlyOpenFileName.Data();
3740 
3741  Bool_t ok_open = kFALSE;
3742  Bool_t ok_read = kFALSE;
3743 
3744  TString FileNameLong = fCnaWrite->GetRootFileName();
3745  Bool_t allowed_to_read = kFALSE;
3746 
3747  // if ( fOpenRootFile )
3748  // {
3749  // std::cout << "!TEcnaRead::ReadHighFrequencyCorrelationsBetweenChannels() *** ERROR ***>"
3750  // << " Reading on file already open." << fTTBELL << std::endl;
3751  // }
3752 
3753  if (FileNameLong == fCurrentlyOpenFileName) {
3754  allowed_to_read = kTRUE;
3755  } else {
3757  CloseRootFile(current_file_name);
3758  }
3759  ok_open = OpenRootFile(file_name, "READ");
3760 
3761  if (ok_open) {
3762  allowed_to_read = kTRUE;
3763  } else {
3764  std::cout << "!TEcnaRead::ReadHighFrequencyCorrelationsBetweenChannels(...) *** ERROR ***> Open .root file "
3765  "failed for file: "
3766  << file_name << fTTBELL << std::endl;
3767  allowed_to_read = kFALSE;
3768  ok_read = kFALSE;
3769  }
3770  }
3771 
3772  if (allowed_to_read == kTRUE) {
3773  Int_t i_zero = 0;
3774  ok_read = gCnaRootFile->ReadElement(typ, i_zero);
3775 
3776  if (ok_read == kTRUE) {
3777  fDataExist = kTRUE;
3778  for (Int_t index_Stin_a = 0; index_Stin_a < fEcal->MaxStinEcnaInStex(); index_Stin_a++) {
3779  if (vec(index_Stin_a) > 0 && vec(index_Stin_a) <= fEcal->MaxStinEcnaInStex()) {
3780  for (Int_t index_Stin_b = 0; index_Stin_b < fEcal->MaxStinEcnaInStex(); index_Stin_b++) {
3781  if (vec(index_Stin_b) > 0 && vec(index_Stin_b) <= fEcal->MaxStinEcnaInStex()) {
3782  for (Int_t i_crys = 0; i_crys < fEcal->MaxCrysInStin(); i_crys++) {
3783  Int_t i_cna_chan = index_Stin_a * fEcal->MaxCrysInStin() + i_crys;
3784  Int_t i_chan_sm = (Int_t)(vec(index_Stin_a) - 1) * fEcal->MaxCrysInStin() + i_crys;
3785  for (Int_t j_crys = 0; j_crys < fEcal->MaxCrysInStin(); j_crys++) {
3786  Int_t j_cna_chan = index_Stin_b * fEcal->MaxCrysInStin() + j_crys;
3787  Int_t j_chan_sm = (Int_t)(vec(index_Stin_b) - 1) * fEcal->MaxCrysInStin() + j_crys;
3788  mat(i_chan_sm, j_chan_sm) = gCnaRootFile->fCnaIndivResult->fMatMat(i_cna_chan, j_cna_chan);
3789  }
3790  }
3791  }
3792  }
3793  }
3794  }
3795  } else {
3796  fDataExist = kFALSE;
3797  std::cout << "!TEcnaRead::ReadHighFrequencyCorrelationsBetweenChannels() *** ERROR ***> "
3798  << fCnaWrite->fRootFileNameShort.Data() << ": .root file failed" << std::endl
3799  << " -> quantity: <"
3800  << GetTypeOfQuantity(typ) << "> not available in file." << fTTBELL << std::endl;
3801  }
3802  CloseRootFile(file_name);
3803  }
3804  return mat;
3805 }
3806 //-------------- ( end of ReadHighFrequencyCorrelationsBetweenChannels(...) ) ---------
3807 
3808 //-------------------------------------------------------------------------
3809 //
3810 // ReadLowFrequencyMeanCorrelationsBetweenStins(...)
3811 //
3812 //-------------------------------------------------------------------------
3814  //Read all the Low Frequency Mean Correlations Between Stins the for all (Stin_X, Stin_Y)
3815  //in ROOT file and return them in a TMatrixD
3816  //
3817  //Possible values for MatDim: (1) MatDim = fEcal->MaxStinEcnaInStex()
3818 
3820  "ReadLowFrequencyMeanCorrelationsBetweenStins", "fEcal->MaxStinEcnaInStex()", fEcal->MaxStinEcnaInStex(), MatDim);
3821 
3822  TMatrixD mat(MatDim, MatDim);
3823  for (Int_t i = 0; i - MatDim < 0; i++) {
3824  for (Int_t j = 0; j - MatDim < 0; j++) {
3825  mat(i, j) = (Double_t)0.;
3826  }
3827  }
3828 
3829  TVectorD vec(fEcal->MaxStinEcnaInStex());
3830  for (Int_t i = 0; i < fEcal->MaxStinEcnaInStex(); i++) {
3831  vec(i) = (Double_t)0.;
3832  }
3834 
3836 
3837  const Text_t *file_name = (const Text_t *)fCnaWrite->fRootFileNameShort.Data();
3838  const Text_t *current_file_name = (const Text_t *)fCurrentlyOpenFileName.Data();
3839 
3840  Bool_t ok_open = kFALSE;
3841  Bool_t ok_read = kFALSE;
3842 
3843  TString FileNameLong = fCnaWrite->GetRootFileName();
3844  Bool_t allowed_to_read = kFALSE;
3845 
3846  // if ( fOpenRootFile )
3847  // {
3848  // std::cout << "!TEcnaRead::ReadLowFrequencyMeanCorrelationsBetweenStins() *** ERROR ***>"
3849  // << " Reading on file already open." << fTTBELL << std::endl;
3850  // }
3851 
3852  if (FileNameLong == fCurrentlyOpenFileName) {
3853  allowed_to_read = kTRUE;
3854  } else {
3856  CloseRootFile(current_file_name);
3857  }
3858  ok_open = OpenRootFile(file_name, "READ");
3859 
3860  if (ok_open) {
3861  allowed_to_read = kTRUE;
3862  } else {
3863  std::cout << "!TEcnaRead::ReadLowFrequencyMeanCorrelationsBetweenStins(...) *** ERROR ***> Open .root file "
3864  "failed for file: "
3865  << file_name << fTTBELL << std::endl;
3866  allowed_to_read = kFALSE;
3867  ok_read = kFALSE;
3868  }
3869  }
3870 
3871  if (allowed_to_read == kTRUE) {
3872  Int_t i_zero = 0;
3873  ok_read = gCnaRootFile->ReadElement(typ, i_zero);
3874 
3875  if (ok_read == kTRUE) {
3876  fDataExist = kTRUE;
3877  for (Int_t index_Stin_a = 0; index_Stin_a - MatDim < 0; index_Stin_a++) {
3878  for (Int_t index_Stin_b = 0; index_Stin_b - MatDim < 0; index_Stin_b++) {
3879  if (vec(index_Stin_a) > 0 && vec(index_Stin_a) <= MatDim) {
3880  if (vec(index_Stin_b) > 0 && vec(index_Stin_b) <= MatDim) {
3881  Int_t vec_ia_m = (Int_t)vec(index_Stin_a) - 1;
3882  Int_t vec_ib_m = (Int_t)vec(index_Stin_b) - 1;
3883  mat((Int_t)vec_ia_m, vec_ib_m) = gCnaRootFile->fCnaIndivResult->fMatMat(index_Stin_a, index_Stin_b);
3884  }
3885  }
3886  }
3887  }
3888  } else {
3889  fDataExist = kFALSE;
3890  std::cout << "!TEcnaRead::ReadLowFrequencyMeanCorrelationsBetweenStins() *** ERROR ***> "
3891  << fCnaWrite->fRootFileNameShort.Data() << ": .root file failed" << std::endl
3892  << " -> quantity: <"
3893  << GetTypeOfQuantity(typ) << "> not available in file." << fTTBELL << std::endl;
3894  }
3895  CloseRootFile(file_name);
3896  }
3897  return mat;
3898 }
3899 //-------- ( end of ReadLowFrequencyMeanCorrelationsBetweenStins) --------
3900 
3901 //-------------------------------------------------------------------------
3902 //
3903 // ReadHighFrequencyMeanCorrelationsBetweenStins(...)
3904 //
3905 //-------------------------------------------------------------------------
3907  //Read all the High Frequency Mean Correlations Between Stins the for all (Stin_X, Stin_Y)
3908  //in ROOT file and return them in a TMatrixD
3909  //
3910  //Possible values for MatDim: (1) MatDim = fEcal->MaxStinEcnaInStex()
3911 
3912  TestArrayDimH2("ReadHighFrequencyMeanCorrelationsBetweenStins",
3913  "fEcal->MaxStinEcnaInStex()",
3915  MatDim);
3916 
3917  TMatrixD mat(MatDim, MatDim);
3918  for (Int_t i = 0; i - MatDim < 0; i++) {
3919  for (Int_t j = 0; j - MatDim < 0; j++) {
3920  mat(i, j) = (Double_t)0.;
3921  }
3922  }
3923 
3924  TVectorD vec(fEcal->MaxStinEcnaInStex());
3925  for (Int_t i = 0; i < fEcal->MaxStinEcnaInStex(); i++) {
3926  vec(i) = (Double_t)0.;
3927  }
3929 
3931 
3932  const Text_t *file_name = (const Text_t *)fCnaWrite->fRootFileNameShort.Data();
3933  const Text_t *current_file_name = (const Text_t *)fCurrentlyOpenFileName.Data();
3934 
3935  Bool_t ok_open = kFALSE;
3936  Bool_t ok_read = kFALSE;
3937 
3938  TString FileNameLong = fCnaWrite->GetRootFileName();
3939  Bool_t allowed_to_read = kFALSE;
3940 
3941  // if ( fOpenRootFile )
3942  // {
3943  // std::cout << "!TEcnaRead::ReadHighFrequencyMeanCorrelationsBetweenStins() *** ERROR ***>"
3944  // << " Reading on file already open." << fTTBELL << std::endl;
3945  // }
3946 
3947  if (FileNameLong == fCurrentlyOpenFileName) {
3948  allowed_to_read = kTRUE;
3949  } else {
3951  CloseRootFile(current_file_name);
3952  }
3953  ok_open = OpenRootFile(file_name, "READ");
3954 
3955  if (ok_open) {
3956  allowed_to_read = kTRUE;
3957  } else {
3958  std::cout << "!TEcnaRead::ReadHighFrequencyMeanCorrelationsBetweenStins(...) *** ERROR ***> Open .root file "
3959  "failed for file: "
3960  << file_name << fTTBELL << std::endl;
3961  allowed_to_read = kFALSE;
3962  ok_read = kFALSE;
3963  }
3964  }
3965 
3966  if (allowed_to_read == kTRUE) {
3967  Int_t i_zero = 0;
3968  ok_read = gCnaRootFile->ReadElement(typ, i_zero);
3969 
3970  if (ok_read == kTRUE) {
3971  fDataExist = kTRUE;
3972  for (Int_t index_Stin_a = 0; index_Stin_a - MatDim < 0; index_Stin_a++) {
3973  for (Int_t index_Stin_b = 0; index_Stin_b - MatDim < 0; index_Stin_b++) {
3974  if (vec(index_Stin_a) > 0 && vec(index_Stin_a) <= MatDim) {
3975  if (vec(index_Stin_b) > 0 && vec(index_Stin_b) <= MatDim) {
3976  Int_t vec_ia_m = (Int_t)vec(index_Stin_a) - 1;
3977  Int_t vec_ib_m = (Int_t)vec(index_Stin_b) - 1;
3978  mat((Int_t)vec_ia_m, (Int_t)vec_ib_m) =
3979  gCnaRootFile->fCnaIndivResult->fMatMat(index_Stin_a, index_Stin_b);
3980  }
3981  }
3982  }
3983  }
3984  } else {
3985  fDataExist = kFALSE;
3986  std::cout << "!TEcnaRead::ReadHighFrequencyMeanCorrelationsBetweenStins() *** ERROR ***> "
3987  << fCnaWrite->fRootFileNameShort.Data() << ": .root file failed" << std::endl
3988  << " -> quantity: <"
3989  << GetTypeOfQuantity(typ) << "> not available in file." << fTTBELL << std::endl;
3990  }
3991  CloseRootFile(file_name);
3992  }
3993  return mat;
3994 }
3995 //-------- ( end of ReadHighFrequencyMeanCorrelationsBetweenStins) --------
3996 
3997 //=============================================================================
3998 //
3999 // M I S C E L L A N E O U S R E A D M E T H O D S
4000 //
4001 //=============================================================================
4002 
4003 //--------------------------------------------------------------------------------------
4004 //
4005 // ReadSampleAdcValuesSameFile(fEcal->MaxCrysEcnaInStex(),
4006 // fFileHeader->fNbOfSamples, fFileHeader->fReqNbOfEvts)
4007 //
4008 //--------------------------------------------------------------------------------------
4009 Double_t ***TEcnaRead::ReadSampleAdcValuesSameFile(const Int_t &DimX, const Int_t &DimY, const Int_t &DimZ) {
4010  //Possible values for DimX, DimY, DimZ : (1) DimX = fEcal->MaxCrysEcnaInStex()
4011  // DimY = fFileHeader->fNbOfSamples
4012  // DimZ = fFileHeader->fReqNbOfEvts
4013 
4014  if (fT3d_AdcValues == nullptr) {
4015  //............ Allocation for the 3d array
4016  fT3d_AdcValues = new Double_t **[DimX];
4017  fCnew++;
4018  fT3d2_AdcValues = new Double_t *[DimX * DimY];
4019  fCnew++;
4020  fT3d1_AdcValues = new Double_t[DimX * DimY * DimZ];
4021  fCnew++;
4022 
4023  for (Int_t i0StexEcha = 0; i0StexEcha < DimX; i0StexEcha++) {
4024  fT3d_AdcValues[i0StexEcha] = &fT3d2_AdcValues[0] + i0StexEcha * DimY;
4025  for (Int_t j_samp = 0; j_samp < DimY; j_samp++) {
4026  fT3d2_AdcValues[DimY * i0StexEcha + j_samp] = &fT3d1_AdcValues[0] + DimZ * (DimY * i0StexEcha + j_samp);
4027  }
4028  }
4029  }
4030 
4031  //................................. Init to zero (ReadSampleAdcValuesSameFile)
4032  for (Int_t iza = 0; iza < DimX; iza++) {
4033  for (Int_t izb = 0; izb < DimY; izb++) {
4034  for (Int_t izc = 0; izc < DimZ; izc++) {
4035  if (fT3d_AdcValues[iza][izb][izc] != (Double_t)0) {
4036  fT3d_AdcValues[iza][izb][izc] = (Double_t)0;
4037  }
4038  }
4039  }
4040  }
4041 
4042  //-------------------------------------------------------------------------- (ReadSampleAdcValuesSameFile)
4043  CnaResultTyp typ = cTypAdcEvt; // sample as a function of time type
4044 
4045  const Text_t *file_name = (const Text_t *)fCnaWrite->fRootFileNameShort.Data();
4046 
4047  Bool_t ok_open = kFALSE;
4048  Bool_t ok_read = kFALSE;
4049 
4050  Int_t i_entry = 0;
4051  Int_t i_entry_fail = 0;
4052 
4053  ok_open = OpenRootFile(file_name, "READ");
4054 
4055  if (ok_open == kTRUE) {
4056  for (Int_t i0StexEcha = 0; i0StexEcha < DimX; i0StexEcha++) {
4057  if (i0StexEcha == 0) {
4058  i_entry = gCnaRootFile->ReadElementNextEntryNumber(typ, i0StexEcha);
4059  if (i_entry >= 0) {
4060  ok_read = kTRUE;
4061  }
4062  }
4063  if (i_entry >= 0) // (ReadSampleAdcValuesSameFile)
4064  {
4065  if (i0StexEcha > 0) {
4066  ok_read = gCnaRootFile->ReadElement(i_entry);
4067  i_entry++;
4068  }
4069 
4070  if (ok_read == kTRUE) {
4071  fDataExist = kTRUE;
4072  for (Int_t sample = 0; sample < DimY; sample++) {
4073  for (Int_t i_bin = 0; i_bin < DimZ; i_bin++) {
4074  fT3d_AdcValues[i0StexEcha][sample][i_bin] = gCnaRootFile->fCnaIndivResult->fMatHis(sample, i_bin);
4075  }
4076  }
4077  } else // (ReadSampleAdcValuesSameFile)
4078  {
4079  fDataExist = kFALSE;
4080  std::cout << "!TEcnaRead::ReadSampleAdcValuesSameFile(...) *** ERROR ***> "
4081  << fCnaWrite->fRootFileNameShort.Data() << ": .root file failed" << std::endl
4082  << " -> quantity: <"
4083  << GetTypeOfQuantity(typ) << "> not available in file." << fTTBELL << std::endl;
4084  }
4085  } else {
4086  i_entry_fail++;
4087  }
4088  }
4089  CloseRootFile(file_name);
4090  } else {
4091  std::cout << "*TEcnaRead::ReadSampleAdcValuesSameFile(...)> *ERROR* =====> "
4092  << " ROOT file not found" << fTTBELL << std::endl;
4093  }
4094 
4095  if (i_entry_fail > 0) {
4096  std::cout << "*TEcnaRead::ReadSampleAdcValuesSameFile(...)> *ERROR* =====> "
4097  << " Entry reading failure(s). i_entry_fail = " << i_entry_fail << fTTBELL << std::endl;
4098  }
4099  return fT3d_AdcValues;
4100 }
4101 //--- (end of ReadSampleAdcValuesSameFile) ----------
4102 
4103 //=========================================================================
4104 //
4105 // M I S C E L L A N E O U S G E T M E T H O D S
4106 //
4107 //=========================================================================
4108 Int_t TEcnaRead::GetNumberOfEvents(const Int_t &xFapNbOfReqEvts, const Int_t &xStexNumber) {
4109  //...... Calculate the number of found events (file existence already tested in calling method)
4110  Int_t xFapNbOfEvts = 0;
4111 
4112  TVectorD NOFE_histp(fEcal->MaxCrysEcnaInStex());
4113  for (Int_t i = 0; i < fEcal->MaxCrysEcnaInStex(); i++) {
4114  NOFE_histp(i) = (Double_t)0.;
4115  }
4116  NOFE_histp = ReadNumberOfEvents(fEcal->MaxCrysEcnaInStex());
4117 
4118  //... Call to fCnaWrite->NumberOfEventsAnalysis(...) 1rst argument must be Int_t, not TVectorD,
4119  // duplicate NOFE_histp to NOFE_int to obtain fFapNbOfEvts from fCnaWrite->NumberOfEventsAnalysis(...)
4120  Int_t *NOFE_int = new Int_t[fEcal->MaxCrysEcnaInStex()];
4121  fCnew++;
4122  for (Int_t i = 0; i < fEcal->MaxCrysEcnaInStex(); i++) {
4123  NOFE_int[i] = (Int_t)NOFE_histp(i);
4124  }
4125 
4126  xFapNbOfEvts = fCnaWrite->NumberOfEventsAnalysis(NOFE_int, fEcal->MaxCrysEcnaInStex(), xFapNbOfReqEvts, xStexNumber);
4127 
4128  delete[] NOFE_int;
4129  NOFE_int = nullptr;
4130  fCdelete++;
4131 
4132  return xFapNbOfEvts;
4133 }
4134 
4135 //-------------------------------------------------------------------------
4136 //
4137 // Get the name of the quantity from its "CnaResultTyp" type
4138 //
4139 //-------------------------------------------------------------------------
4141  TString quantity_name = "?";
4142 
4143  if (arg_typ == cTypNumbers) {
4144  if (fFlagSubDet == "EB") {
4145  quantity_name = "SM numbers";
4146  }
4147  if (fFlagSubDet == "EE") {
4148  quantity_name = "Dee numbers";
4149  }
4150  }
4151  if (arg_typ == cTypMSp) {
4152  quantity_name = "Mean samples";
4153  }
4154  if (arg_typ == cTypSSp) {
4155  quantity_name = "Sigma of samples";
4156  }
4157 
4158  if (arg_typ == cTypNbOfEvts) {
4159  quantity_name = "Number of events";
4160  }
4161  if (arg_typ == cTypPed) {
4162  quantity_name = "Pedestals";
4163  }
4164  if (arg_typ == cTypTno) {
4165  quantity_name = "Total noise";
4166  }
4167  if (arg_typ == cTypLfn) {
4168  quantity_name = "LF noise";
4169  }
4170  if (arg_typ == cTypHfn) {
4171  quantity_name = "HF noise";
4172  }
4173  if (arg_typ == cTypMeanCorss) {
4174  quantity_name = "Mean cor(s,s')";
4175  }
4176  if (arg_typ == cTypSigCorss) {
4177  quantity_name = "Sigma of cor(s,s')";
4178  }
4179 
4180  if (arg_typ == cTypAvPed) {
4181  quantity_name = "Average pedestals";
4182  }
4183  if (arg_typ == cTypAvTno) {
4184  quantity_name = "Average total noise";
4185  }
4186  if (arg_typ == cTypAvLfn) {
4187  quantity_name = "Average LF noise";
4188  }
4189  if (arg_typ == cTypAvHfn) {
4190  quantity_name = "Average HF noise";
4191  }
4192  if (arg_typ == cTypAvMeanCorss) {
4193  quantity_name = "Average mean cor(s,s')";
4194  }
4195  if (arg_typ == cTypAvSigCorss) {
4196  quantity_name = "Average sigma of cor(s,s')";
4197  }
4198 
4199  if (arg_typ == cTypAdcEvt) {
4200  quantity_name = "Sample ADC a.f.o event number";
4201  }
4202 
4203  if (arg_typ == cTypCovCss) {
4204  quantity_name = "Cov(s,s')";
4205  }
4206  if (arg_typ == cTypCorCss) {
4207  quantity_name = "Cor(s,s')";
4208  }
4209  if (arg_typ == cTypLfCov) {
4210  quantity_name = "LF Cov(c,c')";
4211  }
4212  if (arg_typ == cTypLfCor) {
4213  quantity_name = "LF Cor(c,c')";
4214  }
4215  if (arg_typ == cTypHfCov) {
4216  quantity_name = "HF Cov(c,c')";
4217  }
4218  if (arg_typ == cTypHfCor) {
4219  quantity_name = "HF Cor(c,c')";
4220  }
4221 
4222  if (fFlagSubDet == "EB") {
4223  if (arg_typ == cTypLFccMoStins) {
4224  quantity_name = "Mean LF |Cor(c,c')| in (tow,tow')";
4225  }
4226  if (arg_typ == cTypHFccMoStins) {
4227  quantity_name = "Mean HF |Cor(c,c')| in (tow,tow')";
4228  }
4229  }
4230  if (fFlagSubDet == "EE") {
4231  if (arg_typ == cTypLFccMoStins) {
4232  quantity_name = "Mean LF |Cor(c,c')| in (SC,SC')";
4233  }
4234  if (arg_typ == cTypHFccMoStins) {
4235  quantity_name = "Mean HF |Cor(c,c')| in (SC,SC')";
4236  }
4237  }
4238  return quantity_name;
4239 }
4240 
4241 //-------------------------------------------------------------------------
4242 //
4243 // Get the ROOT file name (long and short)
4244 //
4245 //-------------------------------------------------------------------------
4248 //-------------------------------------------------------------------------
4249 //
4250 // GetStexStinFromIndex
4251 //
4252 // *==> DON'T SUPPRESS: this method is called by TEcnaRun and TEcnaHistos
4253 //
4254 //-------------------------------------------------------------------------
4255 Int_t TEcnaRead::GetStexStinFromIndex(const Int_t &i0StexStinEcna) {
4256  // Get the Stin number in Stex from the Stin index
4257 
4258  Int_t number = -1;
4259  TVectorD vec(fEcal->MaxStinEcnaInStex());
4260  for (Int_t i = 0; i < fEcal->MaxStinEcnaInStex(); i++) {
4261  vec(i) = (Double_t)0.;
4262  }
4264  number = (Int_t)vec(i0StexStinEcna);
4265  return number;
4266 }
4267 
4268 //------------------------------------------------------------------------
4269 
4271 //-------------------------------------------------------------------------
4272 //
4273 // GetStinIndex(n1StexStin)
4274 //
4275 //-------------------------------------------------------------------------
4276 Int_t TEcnaRead::GetStinIndex(const Int_t &n1StexStin) {
4277  //Get the index of the Stin from its number in Stex
4278 
4280  std::cout << "*TEcnaRead::GetStinIndex(...)> fEcal->MaxStinEcnaInStex() = " << fEcal->MaxStinEcnaInStex()
4281  << std::endl
4282  << " n1StexStin = " << n1StexStin << std::endl
4283  << std::endl;
4284  }
4285 
4286  Int_t Stin_index = n1StexStin - 1; // suppose les 68 tours
4287 
4288 #define NOGT
4289 #ifndef NOGT
4290  Int_t Stin_index = -1;
4291  TVectorD vec(fEcal->MaxStinEcnaInStex());
4292  for (Int_t i = 0; i < fEcal->MaxStinEcnaInStex(); i++) {
4293  vec(i) = (Double_t)0.;
4294  }
4296 
4297  //........................... Get the Stin index
4298 
4299  for (Int_t i = 0; i < fEcal->MaxStinEcnaInStex(); i++) {
4301  std::cout << "*TEcnaRead::GetStinIndex(...)> StinNumber[" << i << "] = " << vec[i] << std::endl;
4302  }
4303  if (vec[i] == n1StexStin) {
4304  Stin_index = i;
4305  }
4306  }
4307 
4309  std::cout << "~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-" << std::endl;
4310  std::cout << "*TEcnaRead::GetStinIndex> Stin number: " << n1StexStin << std::endl
4311  << " Stin index : " << Stin_index << std::endl;
4312  std::cout << "~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-" << std::endl;
4313  }
4314 
4315  if (Stin_index < 0) {
4317  std::cout << "!TEcnaRead::GetStinIndex *** WARNING ***> n1StexStin" << n1StexStin << " : "
4318  << "index Stin not found" << fTTBELL << std::endl;
4319  }
4320  }
4321 #endif // NOGT
4322 
4323  return Stin_index;
4324 }
4325 
4326 //=========================================================================
4327 //
4328 // METHODS TO SET FLAGS TO PRINT (OR NOT) COMMENTS (DEBUG)
4329 //
4330 //=========================================================================
4331 
4333  // Set flags to authorize printing of some comments concerning initialisations (default)
4334 
4336  std::cout << "*TEcnaRead::PrintComments()> Warnings and some comments on init will be printed" << std::endl;
4337 }
4338 
4340  // Set flags to authorize printing of warnings
4341 
4343  std::cout << "*TEcnaRead::PrintWarnings()> Warnings will be printed" << std::endl;
4344 }
4345 
4347  // Set flags to authorize printing of the comments of all the methods
4348 
4350  std::cout << "*TEcnaRead::PrintAllComments()> All the comments will be printed" << std::endl;
4351 }
4352 
4354  // Set flags to forbid the printing of all the comments
4355 
4357 }
TEcnaResultType * fCnaIndivResult
Definition: TEcnaRootFile.h:42
TEcnaNArrayD fMatMat
Bool_t OpenR(const Text_t *="")
void TestArrayDimH1(const TString &, const TString &, const Int_t &, const Int_t &)
Definition: TEcnaRead.cc:1196
Int_t NumberOfEventsAnalysis(Int_t **, const Int_t &, const Int_t &, const Int_t &)
Definition: TEcnaWrite.cc:514
TVectorD ReadLowFrequencyNoise(const Int_t &)
Definition: TEcnaRead.cc:2070
Int_t GetRunNumber()
Definition: TEcnaRead.cc:823
TVectorD ReadAverageHighFrequencyNoise(const Int_t &)
Definition: TEcnaRead.cc:2585
Int_t fCnew
Definition: TEcnaRead.h:360
Int_t GetLastReqEvtNumber()
Definition: TEcnaRead.cc:825
Int_t fStex
Definition: TEcnaHeader.h:53
Int_t fHFccMoStinsCalc
Definition: TEcnaHeader.h:80
Int_t fAvLfnCalc
Definition: TEcnaHeader.h:70
Int_t fSSpCalc
Definition: TEcnaHeader.h:68
void Print()
Definition: TEcnaHeader.cc:146
Int_t fMemoStinNumbers
Definition: TEcnaRead.h:390
TEcnaRead & operator=(const TEcnaRead &)
Definition: TEcnaRead.cc:253
CnaResultTyp
TString BuildStandard1DHistoCodeY(const TString &, const TString &)
TMatrixD ReadCovariancesBetweenSamples(const Int_t &, const Int_t &, const Int_t &)
Definition: TEcnaRead.cc:2816
void RegisterFileParameters(const TString &, const Int_t &, const Int_t &, const Int_t &, const Int_t &, const Int_t &, const Int_t &, const TString &, const TString &, const time_t, const time_t)
Definition: TEcnaWrite.cc:597
TString fPathRoot
Definition: TEcnaRead.h:394
TVectorD Read1DHisto(const Int_t &, const TString &, const Int_t &, const Int_t &, const Int_t &)
Definition: TEcnaRead.cc:328
TVectorD ReadSampleAdcValues(const Int_t &, const Int_t &, const Int_t &, const Int_t &)
Definition: TEcnaRead.cc:1347
Int_t fRunType
Definition: TEcnaHeader.h:60
Int_t GetNumberOfEvents(const Int_t &, const Int_t &)
Definition: TEcnaRead.cc:4108
TString GetStartDate()
Definition: TEcnaRead.cc:835
TMatrixD ReadLowFrequencyCorrelationsBetweenChannels(const Int_t &, const Int_t &, const Int_t &)
Definition: TEcnaRead.cc:3147
Int_t fAvMeanCorssCalc
Definition: TEcnaHeader.h:89
Int_t GetStinIndex(const Int_t &)
Definition: TEcnaRead.cc:4276
TVectorD ReadSigmaOfCorrelationsBetweenSamples(const Int_t &)
Definition: TEcnaRead.cc:2216
TEcnaWrite * fCnaWrite
Definition: TEcnaRead.h:374
Int_t fgMaxCar
Definition: TEcnaRead.h:358
Int_t fHfCorCalc
Definition: TEcnaHeader.h:76
TString GetRootFileNameShort()
Definition: TEcnaRead.cc:4247
void PrintComments()
Definition: TEcnaRead.cc:4332
TVectorD ReadAverageNumberOfEvents(const Int_t &)
Definition: TEcnaRead.cc:2294
time_t GetStopTime()
Definition: TEcnaRead.cc:834
Int_t fReadyToReadRootFile
Definition: TEcnaRead.h:385
Int_t fReqNbOfEvts
Definition: TEcnaHeader.h:52
TEcnaParHistos * fCnaParHistos
Definition: TEcnaRead.h:373
Int_t fCodePrintAllComments
Definition: TEcnaRead.h:400
Int_t fMSpCalc
Definition: TEcnaHeader.h:67
TMatrixD ReadHighFrequencyMeanCorrelationsBetweenStins(const Int_t &)
Definition: TEcnaRead.cc:3906
Int_t fNbOfSamples
Definition: TEcnaHeader.h:48
TMatrixD ReadMatrix(const Int_t &, const TString &, const TString &, const Int_t &, const Int_t &)
Definition: TEcnaRead.cc:550
void Adelete(const TString &)
Definition: TEcnaRead.cc:201
TString BuildStandardBetweenWhatCode(const TString &, const TString &)
Int_t GetNumberOfBinsSampleAsFunctionOfTime()
Definition: TEcnaRead.cc:4270
TVectorD ReadRelevantCorrelationsBetweenSamples(const Int_t &, const Int_t &, const Int_t &)
Definition: TEcnaRead.cc:2975
Bool_t RegisterPointer(const TString &, const Long_t &)
Definition: TEcnaObject.cc:100
TString fStopDate
Definition: TEcnaHeader.h:58
TMatrixD ReadLowFrequencyMeanCorrelationsBetweenStins(const Int_t &)
Definition: TEcnaRead.cc:3813
TVectorD ReadAverageTotalNoise(const Int_t &)
Definition: TEcnaRead.cc:2437
TString GetTypeOfQuantity(const CnaResultTyp)
Definition: TEcnaRead.cc:4140
Int_t fCodePrintWarnings
Definition: TEcnaRead.h:400
Int_t fMeanCorssCalc
Definition: TEcnaHeader.h:83
TString fRootFileNameShort
Definition: TEcnaWrite.h:138
Int_t GetFirstReqEvtNumber()
Definition: TEcnaRead.cc:824
Bool_t ReadRootFileHeader(const Int_t &)
Definition: TEcnaRead.cc:1111
Int_t fHfCovCalc
Definition: TEcnaHeader.h:75
R__EXTERN TEcnaRootFile * gCnaRootFile
Definition: TEcnaRead.cc:13
TString BuildStandardDetectorCode(const TString &)
Int_t fCodePrintNoComment
Definition: TEcnaRead.h:400
TEcnaNArrayD fMatHis
void SetEcalSubDetector(const TString &)
Definition: TEcnaRead.cc:175
Int_t * fT1d_StexStinFromIndex
Definition: TEcnaRead.h:388
Int_t fCorCssCalc
Definition: TEcnaHeader.h:74
TVectorD ReadStinNumbers(const Int_t &)
Definition: TEcnaRead.cc:1243
TVectorD ReadSampleSigmas(const Int_t &, const Int_t &, const Int_t &)
Definition: TEcnaRead.cc:1580
Int_t GetStexStinFromIndex(const Int_t &)
Definition: TEcnaRead.cc:4255
TString fStexName
Definition: TEcnaRead.h:379
Int_t fAvTnoCalc
Definition: TEcnaHeader.h:69
TString fTTBELL
Definition: TEcnaRead.h:363
TVectorD ReadTotalNoise(const Int_t &)
Definition: TEcnaRead.cc:1925
~TEcnaRead() override
Definition: TEcnaRead.cc:266
TVectorD ReadAveragePedestals(const Int_t &)
Definition: TEcnaRead.cc:2363
TString GetStopDate()
Definition: TEcnaRead.cc:836
Int_t fAvHfnCalc
Definition: TEcnaHeader.h:71
TEcnaParCout * fCnaParCout
Definition: TEcnaRead.h:367
TString fFlagNoFileOpen
Definition: TEcnaRead.h:383
void PrintNoComment()
Definition: TEcnaRead.cc:4353
Int_t MaxCrysInStin()
TVectorD ReadPedestals(const Int_t &)
Definition: TEcnaRead.cc:1852
TString GetRootFileName()
Definition: TEcnaRead.cc:4246
TMatrixD ReadLowFrequencyCovariancesBetweenChannels(const Int_t &, const Int_t &, const Int_t &)
Definition: TEcnaRead.cc:3059
TString fStartDate
Definition: TEcnaHeader.h:57
Double_t ** fT3d2_AdcValues
Definition: TEcnaRead.h:408
TString fRootFileStatus
Definition: TEcnaRootFile.h:31
Double_t * fT3d1_AdcValues
Definition: TEcnaRead.h:409
Bool_t DataExist()
Definition: TEcnaRead.cc:1100
TEcnaParPaths * fCnaParPaths
Definition: TEcnaRead.h:368
Int_t GetNbOfSamples()
Definition: TEcnaRead.cc:822
Int_t fCdelete
Definition: TEcnaRead.h:361
void fCopy(const TEcnaRead &)
Definition: TEcnaRead.cc:211
TString GetAnalysisName()
Definition: TEcnaRead.cc:821
TEcnaHeader * fFileHeader
Definition: TEcnaRead.h:370
TMatrixD ReadHighFrequencyCorrelationsBetweenChannels(const Int_t &, const Int_t &, const Int_t &)
Definition: TEcnaRead.cc:3324
Int_t MaxCrysInStinEcna(const Int_t &, const Int_t &, const TString &)
void Init()
Definition: TEcnaRead.cc:115
void Anew(const TString &)
Definition: TEcnaRead.cc:193
TVectorD ReadHighFrequencyNoise(const Int_t &)
Definition: TEcnaRead.cc:2143
TString fTypAna
Definition: TEcnaHeader.h:47
TString BuildStandardCovOrCorCode(const TString &, const TString &)
Int_t MaxStexInStas()
TMatrixD ReadNumberOfEventsForSamples(const Int_t &, const Int_t &, const Int_t &)
Definition: TEcnaRead.cc:1765
Int_t fAvPedCalc
Definition: TEcnaHeader.h:88
Double_t *** ReadSampleAdcValuesSameFile(const Int_t &, const Int_t &, const Int_t &)
Definition: TEcnaRead.cc:4009
Int_t fFirstReqEvtNumber
Definition: TEcnaHeader.h:50
TVectorD ReadAverageLowFrequencyNoise(const Int_t &)
Definition: TEcnaRead.cc:2511
void FileParameters(const TString &, const Int_t &, const Int_t &, const Int_t &, const Int_t &, const Int_t &, const Int_t &, const TString &)
Definition: TEcnaRead.cc:732
TString GetTechReadCode(const TString &, const TString &)
Definition: TEcnaRead.cc:660
Int_t GetReqNbOfEvts()
Definition: TEcnaRead.cc:826
TEcnaParEcal * fEcal
Definition: TEcnaRead.h:371
Int_t fLfCorCalc
Definition: TEcnaHeader.h:78
Int_t fAdcEvtCalc
Definition: TEcnaHeader.h:66
Int_t GetCodePrint(const TString &)
Definition: TEcnaParCout.cc:66
Bool_t OpenRootFile(const Text_t *, const TString &)
Definition: TEcnaRead.cc:935
Int_t MaxCrysEcnaInStex()
time_t fStartTime
Definition: TEcnaHeader.h:55
time_t fStopTime
Definition: TEcnaHeader.h:56
Int_t fLfCovCalc
Definition: TEcnaHeader.h:77
Int_t fFlagPrint
Definition: TEcnaRead.h:399
TEcnaObject * fObjectManager
Definition: TEcnaRead.h:365
TEcnaNumbering * fEcalNumbering
Definition: TEcnaRead.h:372
TString GetRunType()
Definition: TEcnaRead.cc:837
Int_t fLFccMoStinsCalc
Definition: TEcnaHeader.h:79
Int_t ReadElementNextEntryNumber(CnaResultTyp, Int_t)
Int_t fLastReqEvtNumber
Definition: TEcnaHeader.h:51
Bool_t fDataExist
Definition: TEcnaRead.h:404
int nlast
Definition: AMPTWrapper.h:57
TString fFlagSubDet
Definition: TEcnaRead.h:378
Int_t MaxSampADC()
Int_t MaxStinEcnaInStas()
TMatrixD ReadCorrelationsBetweenSamples(const Int_t &, const Int_t &, const Int_t &)
Definition: TEcnaRead.cc:2897
void HeaderParameters(const TString &, const Int_t &, const Int_t &, const Int_t &, const Int_t &, const Int_t &, const Int_t &)
Definition: TEcnaHeader.cc:126
Int_t Get0StexEchaFrom1StexStinAnd0StinEcha(const Int_t &, const Int_t &)
TVectorD ReadMeanCorrelationsBetweenSamples(const Int_t &)
Definition: TEcnaRead.cc:1996
Bool_t LookAtRootFile()
Definition: TEcnaRead.cc:1043
void ReStart(const Text_t *)
Int_t MaxStinEcnaInStex()
Int_t fRunNumber
Definition: TEcnaHeader.h:49
TString GetRootFileNameShort()
Definition: TEcnaWrite.cc:389
Int_t fSigCorssCalc
Definition: TEcnaHeader.h:86
TMatrixD ReadHighFrequencyCovariancesBetweenChannels(const Int_t &, const Int_t &, const Int_t &)
Definition: TEcnaRead.cc:3236
Double_t *** fT3d_AdcValues
Definition: TEcnaRead.h:407
Bool_t ReadElement(Int_t)
Bool_t CloseRootFile(const Text_t *)
Definition: TEcnaRead.cc:1000
TString GetEcalSubDetector()
Bool_t OpenW(const Text_t *="")
void fMakeResultsFileName()
Definition: TEcnaWrite.cc:631
Bool_t fOpenRootFile
Definition: TEcnaRead.h:381
Int_t GetStexNumber()
Definition: TEcnaRead.cc:827
Int_t * fTagStinNumbers
Definition: TEcnaRead.h:389
Int_t fStinNumbersCalc
Definition: TEcnaHeader.h:63
TString GetRootFileName()
Definition: TEcnaWrite.cc:388
void PrintAllComments()
Definition: TEcnaRead.cc:4346
ClassImp(TEcnaRead)
Int_t fCodePrintComments
Definition: TEcnaRead.h:400
void TestArrayDimH2(const TString &, const TString &, const Int_t &, const Int_t &)
Definition: TEcnaRead.cc:1217
Long_t GetPointerValue(const TString &)
Definition: TEcnaObject.cc:209
TVectorD ReadSampleMeans(const Int_t &, const Int_t &, const Int_t &)
Definition: TEcnaRead.cc:1426
TVectorD ReadAverageMeanCorrelationsBetweenSamples(const Int_t &)
Definition: TEcnaRead.cc:2659
TString fStinName
Definition: TEcnaRead.h:379
TString fCurrentlyOpenFileName
Definition: TEcnaRead.h:382
Int_t fAvSigCorssCalc
Definition: TEcnaHeader.h:90
TVectorD ReadAverageSigmaOfCorrelationsBetweenSamples(const Int_t &)
Definition: TEcnaRead.cc:2735
Int_t fLookAtRootFile
Definition: TEcnaRead.h:386
Int_t fCovCssCalc
Definition: TEcnaHeader.h:73
TFile * fRootFile
Definition: TEcnaRootFile.h:33
void PrintWarnings()
Definition: TEcnaRead.cc:4339
time_t GetStartTime()
Definition: TEcnaRead.cc:833
TVectorD ReadNumberOfEvents(const Int_t &)
Definition: TEcnaRead.cc:1719