CMS 3D CMS Logo

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