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