CMS 3D CMS Logo

TEcnaWrite.cc
Go to the documentation of this file.
1 //----------Author's Name: B.Fabbro DSM/IRFU/SPP CEA-Saclay
2 //----------Copyright: Those valid for CEA sofware
3 //----------Modified: 30/01/2014
4 
6 
7 //--------------------------------------
8 // TEcnaWrite.cc
9 // Class creation: 19 May 2005
10 // Documentation: see TEcnaWrite.h
11 //--------------------------------------
12 
14 //______________________________________________________________________________
15 //
16 
18 {
19  //destructor
20 
21  //if (fEcal != 0){delete fEcal; fCdelete++;}
22  //if (fEcalNumbering != 0){delete fEcalNumbering; fCdelete++;}
23  //if (fCnaParPaths != 0){delete fCnaParPaths; fCdelete++;}
24  //if (fCnaParCout != 0){delete fCnaParCout; fCdelete++;}
25 
26  // std::cout << "[Info Management] CLASS: TEcnaWrite. DESTROY OBJECT: this = " << this << std::endl;
27 }
28 
29 //===================================================================
30 //
31 // Constructors
32 //
33 //===================================================================
35 {
36 
37  // std::cout << "[Info Management] CLASS: TEcnaWrite. CREATE OBJECT: this = " << this << std::endl;
38 
39  Init();
40 }
41 
42 TEcnaWrite::TEcnaWrite(TEcnaObject* pObjectManager, const TString& SubDet)
43 {
44  // std::cout << "[Info Management] CLASS: TEcnaWrite. CREATE OBJECT: this = " << this << std::endl;
45 
46  Init();
47  Long_t i_this = (Long_t)this;
48  pObjectManager->RegisterPointer("TEcnaWrite", i_this);
49 
50  //............................ fCnaParCout
51  fCnaParCout = nullptr;
52  Long_t iCnaParCout = pObjectManager->GetPointerValue("TEcnaParCout");
53  if( iCnaParCout == 0 )
54  {fCnaParCout = new TEcnaParCout(pObjectManager); /*fCnew++*/}
55  else
56  {fCnaParCout = (TEcnaParCout*)iCnaParCout;}
57 
58  //............................ fCnaParPaths
59  fCnaParPaths = nullptr;
60  Long_t iCnaParPaths = pObjectManager->GetPointerValue("TEcnaParPaths");
61  if( iCnaParPaths == 0 )
62  {fCnaParPaths = new TEcnaParPaths(pObjectManager); /*fCnew++*/}
63  else
64  {fCnaParPaths = (TEcnaParPaths*)iCnaParPaths;}
65 
66  //fCfgResultsRootFilePath = fCnaParPaths->ResultsRootFilePath();
67  //fCfgHistoryRunListFilePath = fCnaParPaths->HistoryRunListFilePath();
68 
71 
72  //............................ fEcal => should be changed in fParEcal
73  fEcal = nullptr;
74  Long_t iParEcal = pObjectManager->GetPointerValue("TEcnaParEcal");
75  if( iParEcal == 0 )
76  {fEcal = new TEcnaParEcal(pObjectManager, SubDet.Data()); /*fCnew++*/}
77  else
78  {fEcal = (TEcnaParEcal*)iParEcal;}
79 
80  //............................ fEcalNumbering
81  fEcalNumbering = nullptr;
82  Long_t iEcalNumbering = pObjectManager->GetPointerValue("TEcnaNumbering");
83  if( iEcalNumbering == 0 )
84  {fEcalNumbering = new TEcnaNumbering(pObjectManager, SubDet.Data()); /*fCnew++*/}
85  else
86  {fEcalNumbering = (TEcnaNumbering*)iEcalNumbering;}
87 
88  SetEcalSubDetector(SubDet.Data());
89 }
90 
92  const TEcnaParPaths* pCnaParPaths,
93  const TEcnaParCout* pCnaParCout,
94  const TEcnaParEcal* pEcal,
95  const TEcnaNumbering* pEcalNumbering)
96 {
97 
98  // std::cout << "[Info Management] CLASS: TEcnaWrite. CREATE OBJECT: this = " << this << std::endl;
99 
100  Init();
101 
102  //----------------------------- Object management
103  fCnaParPaths = nullptr;
104  if( pCnaParPaths == nullptr )
105  {fCnaParPaths = new TEcnaParPaths(); /*fCnew++*/ ;}
106  else
107  {fCnaParPaths = (TEcnaParPaths*)pCnaParPaths;}
108 
109  //................. Get paths from ECNA directory
110 
113 
114  fCnaParCout = nullptr;
115  if( pCnaParCout == nullptr )
116  {fCnaParCout = new TEcnaParCout(); /*fCnew++*/;}
117  else
118  {fCnaParCout = (TEcnaParCout*)pCnaParCout;}
119 
120  fEcal = nullptr;
121  if( pEcal == nullptr )
122  {fEcal = new TEcnaParEcal(SubDet.Data()); /*fCnew++*/;}
123  else
124  {fEcal = (TEcnaParEcal*)pEcal;}
125 
126  fEcalNumbering = nullptr;
127  if( pEcalNumbering == nullptr )
128  {fEcalNumbering = new TEcnaNumbering(SubDet.Data(), fEcal); /*fCnew++*/;}
129  else
130  {fEcalNumbering = (TEcnaNumbering*)pEcalNumbering;}
131 
132  SetEcalSubDetector(SubDet.Data(), fEcal, fEcalNumbering);
133 }
134 
136 {
137  //----------------------------- Parameters values
138  fTTBELL = '\007';
139 
140  fgMaxCar = (Int_t)512; // max number of characters in TStrings
141  fCodeHeaderAscii = 0;
142  fCodeRoot = 1;
143 
144  //------------------------------------------- Codes
145  //................. presently used codes
146  fCodeNbOfEvts = 101;
147  fCodePed = 102;
148  fCodeTno = 103;
149  fCodeLfn = 104;
150  fCodeHfn = 105;
151  fCodeMeanCorss = 106;
152  fCodeSigCorss = 107;
153 
154  fCodeCovCss = 201;
155  fCodeCorCss = 202;
156 
157  //................. not yet used codes
158  //fCodeAdcEvt = 3;
159  //fCodeMSp = 4;
160  //fCodeSSp = 5;
161 
162  //fCodeAvPed = 17;
163  //fCodeAvTno = 6;
164  //fCodeAvMeanCorss = 18;
165  //fCodeAvSigCorss = 19;
166 
167  //fCodeLfCov = 11;
168  //fCodeLfCor = 12;
169  //fCodeHfCov = 9;
170  //fCodeHfCor = 10;
171 
172  //fCodeLFccMoStins = 13;
173  //fCodeHFccMoStins = 14;
174 
175  //----------------------------------------
176 
177  fUserSamp = 0;
178  fStexStinUser = 0;
179  fStinEchaUser = 0;
180 
181  fjustap_2d_ev = nullptr;
182  fjustap_1d_ev = nullptr;
183 
184  fjustap_2d_var = nullptr;
185  fjustap_1d_var = nullptr;
186 
187  fjustap_2d_cc = nullptr;
188  fjustap_1d_cc = nullptr;
189 
190  fjustap_2d_ss = nullptr;
191  fjustap_1d_ss = nullptr;
192 
194 
195 }
196 // end of Init()
197 
198 //===================================================================
199 //
200 // Methods
201 //
202 //===================================================================
203 
205 {
206  // Set Subdetector (EB or EE)
207 
208  Int_t MaxCar = fgMaxCar;
209  fFlagSubDet.Resize(MaxCar);
211 
212  //........................................................................
213  //
214  // (for ASCII files writing methods only) ...
215  //
216  // DEFINITION OF THE SECTOR SIZES
217  // FOR THE CORRELATION AND COVARIANCE MATRICES DISPLAY
218  //
219  // MUST BE A DIVISOR OF THE TOTAL NUMBER.
220  // ======================================
221  //
222  // Examples:
223  //
224  // (1) 25 channels => size = 25 or 5 (divisors of 25)
225  //
226  // 25 => matrix = 1 x 1 sector of size (25 x 25)
227  // = (1 x 1) x (25 x 25) = 1 x 625 = 625
228  // 5 => matrix = 5 x 5 sectors of size (5 x 5)
229  // = (5 x 5) x ( 5 x 5) = 25 x 25 = 625
230  //
231  // (2) 10 samples => size = 10, 5 or 2 (divisors of 10)
232  //
233  // 10 => matrix = 1 X 1 sectors of size (10 x 10)
234  // = (1 x 1) x (10 x 10) = 1 x 100 = 100
235  // 5 => matrix = 2 x 2 sectors of size (5 x 5)
236  // = (2 x 2) x ( 5 x 5) = 4 x 25 = 100
237  // 2 => matrix = 5 x 5 sectors of size (2 x 2)
238  // = (5 x 5) x ( 2 x 2) = 25 x 4 = 100
239  //
240  //........................................................................
245 
246  //........................................................................
247  //
248  // DEFINITION OF THE NUMBER OF VALUES BY LINE
249  // for the Expectation Values, Variances and.
250  // Event distributions by (channel,sample)
251  //
252  // MUST BE A DIVISOR OF THE TOTAL NUMBER.
253  // ======================================
254  //
255  // Examples:
256  // 1) For expectation values and variances:
257  //
258  // 25 channels => size = 5
259  // => sample sector = 5 lines of 5 values
260  // = 5 x 5 = 25 values
261  //
262  // 10 samples => size = 10
263  // => channel sector = 1 lines of 10 values
264  // = 1 x 10 = 10 values
265  //
266  // 2) For event distributions:
267  //
268  // 100 bins => size = 10
269  // => sample sector = 10 lines of 10 values
270  // = 10 x 10 = 100 values
271  //
272  //........................................................................
275 }//---------- (end of SetEcalSubDetector) ------------------
276 
277 
279  const TEcnaParEcal* pEcal,
280  const TEcnaNumbering* pEcalNumbering)
281 {
282  // Set Subdetector (EB or EE)
283 
284 
285  fEcal = nullptr;
286  if( pEcal == nullptr )
287  {fEcal = new TEcnaParEcal(SubDet.Data()); fCnew++;}
288  else
289  {fEcal = (TEcnaParEcal*)pEcal;}
290 
291  Int_t MaxCar = fgMaxCar;
292  fFlagSubDet.Resize(MaxCar);
294 
295  fEcalNumbering = nullptr;
296  if( pEcalNumbering == nullptr )
297  {fEcalNumbering = new TEcnaNumbering(SubDet.Data(), fEcal); fCnew++;}
298  else
299  {fEcalNumbering = (TEcnaNumbering*)pEcalNumbering;}
300 
301  //........................................................................
302  //
303  // (for ASCII files writing methods only) ...
304  //
305  // DEFINITION OF THE SECTOR SIZES
306  // FOR THE CORRELATION AND COVARIANCE MATRICES DISPLAY
307  //
308  // MUST BE A DIVISOR OF THE TOTAL NUMBER.
309  // ======================================
310  //
311  // Examples:
312  //
313  // (1) 25 channels => size = 25 or 5 (divisors of 25)
314  //
315  // 25 => matrix = 1 x 1 sector of size (25 x 25)
316  // = (1 x 1) x (25 x 25) = 1 x 625 = 625
317  // 5 => matrix = 5 x 5 sectors of size (5 x 5)
318  // = (5 x 5) x ( 5 x 5) = 25 x 25 = 625
319  //
320  // (2) 10 samples => size = 10, 5 or 2 (divisors of 10)
321  //
322  // 10 => matrix = 1 X 1 sectors of size (10 x 10)
323  // = (1 x 1) x (10 x 10) = 1 x 100 = 100
324  // 5 => matrix = 2 x 2 sectors of size (5 x 5)
325  // = (2 x 2) x ( 5 x 5) = 4 x 25 = 100
326  // 2 => matrix = 5 x 5 sectors of size (2 x 2)
327  // = (5 x 5) x ( 2 x 2) = 25 x 4 = 100
328  //
329  //........................................................................
334 
335  //........................................................................
336  //
337  // DEFINITION OF THE NUMBER OF VALUES BY LINE
338  // for the Expectation Values, Variances and.
339  // Event distributions by (channel,sample)
340  //
341  // MUST BE A DIVISOR OF THE TOTAL NUMBER.
342  // ======================================
343  //
344  // Examples:
345  // 1) For expectation values and variances:
346  //
347  // 25 channels => size = 5
348  // => sample sector = 5 lines of 5 values
349  // = 5 x 5 = 25 values
350  //
351  // 10 samples => size = 10
352  // => channel sector = 1 lines of 10 values
353  // = 1 x 10 = 10 values
354  //
355  // 2) For event distributions:
356  //
357  // 100 bins => size = 10
358  // => sample sector = 10 lines of 10 values
359  // = 10 x 10 = 100 values
360  //
361  //........................................................................
364 }//---------- (end of SetEcalSubDetector) ------------------
365 
366 
367 //-------------------------------------------------------------------------
368 //
369 // Get methods for different run or file parameters
370 //
371 // W A R N I N G : some of these methods are called by external code
372 //
373 // D O N ' T S U P P R E S S !
374 //
375 //
376 // TString fRootFileNameShort
377 // TString fAnaType = typ_ana
378 // Int_t fRunNumber = run_number
379 // Int_t fFirstReqEvtNumber = nfirst
380 // Int_t fReqNbOfEvts = nevents
381 // Int_t fStexNumber = super_module
382 //
383 //-------------------------------------------------------------------------
393 
394 //---------------------------------------------------------------------------------------------------
395 //
396 // NumberOfEventsAnalysis(...) : Analyses the number of events found in data
397 // channel by channel OR sample by sample
398 // an output ERROR message is delivered if differences are detected
399 //
400 // channel by channel: called by TEcnaRead object (3 arguments)
401 // sample by sample : called by TEcnaRun object (4 arguments)
402 //
403 // This method must be a TEcnaWrite method since it can be called by objects
404 // of class TEcnaRead OR TEcnaRun
405 //
406 //---------------------------------------------------------------------------------------------------
407 //.............................................................................................
408 Int_t TEcnaWrite::NumberOfEventsAnalysis(Int_t* ArrayNbOfEvts, const Int_t& MaxArray,
409  const Int_t& NbOfReqEvts, const Int_t& StexNumber)
410 {
411  // CHECK THE NUMBER OF FOUND EVENTS, return rNumberOfEvents (NumberOfEvents())
412  // (number used to compute the average values over the events)
413  //
414  // 1D array: called by TEcnaRead object
415 
416  Int_t rNumberOfEvents = 0;
417  Int_t PresentNumber = 0;
418  Int_t EmptyChannel = 0;
419  Int_t DifferentMinusValue = 0;
420  Int_t DifferentPlusValue = 0;
421 
422  //........................................................ i_SSoSE = StexStin or StinEcha
423  for(Int_t i_SSoSE=0; i_SSoSE<MaxArray; i_SSoSE++)
424  {
425  Int_t NbOfEvts = ArrayNbOfEvts[i_SSoSE];
426 
427  if( NbOfEvts > 0 )
428  {
429  if( PresentNumber == 0 ) // first channel
430  {
431  PresentNumber = NbOfEvts;
432  }
433  else // current channel
434  {
435  if( NbOfEvts > PresentNumber ) // warning
436  {
437  PresentNumber = NbOfEvts;
438  DifferentPlusValue++;
439  }
440  if( NbOfEvts < PresentNumber ) // warning
441  {
442  DifferentMinusValue++;
443  }
444  }
445  }
446  else
447  {
448  EmptyChannel++;
449  }
450  }
451 
452  rNumberOfEvents = PresentNumber;
453 
454  if( EmptyChannel > 0 )
455  {
456  if( MaxArray == fEcal->MaxCrysInSM() ) // (EB)
457  {
458  std::cout << "!TEcnaWrite::NumberOfEventsAnalysis()> *** WARNING *** "
459  << EmptyChannel << " empty channels detected in SM " << StexNumber
460  << " (EB " << fEcalNumbering->PlusMinusSMNumber(StexNumber) << ")" << std::endl;
461  }
462  if( MaxArray == fEcal->MaxCrysEcnaInDee() ) // (EE)
463  {
465  if( EmptyChannel > 0 )
466  {
467  std::cout << "!TEcnaWrite::NumberOfEventsAnalysis()> *** WARNING *** "
468  << EmptyChannel << " empty channels detected in Dee " << StexNumber << std::endl;
469  }
470  }
471  }
472 
473  if( DifferentMinusValue > 0 || DifferentPlusValue > 0 )
474  {
475  std::cout << "!TEcnaWrite::NumberOfEventsAnalysis()> " << std::endl;
476 
477  if( MaxArray == fEcal->MaxCrysInSM() ) // (EB)
478  {
479  std::cout << "************** W A R N I N G : NUMBER OF EVENTS NOT CONSTANT FOR SM " << StexNumber
480  << " (EB " << fEcalNumbering->PlusMinusSMNumber(StexNumber) << ") *********************";
481  }
482 
483  if( MaxArray == fEcal->MaxCrysEcnaInDee() ) // (EE)
484  {
485  std::cout << "****************** W A R N I N G : NUMBER OF EVENTS NOT CONSTANT FOR Dee " << StexNumber
486  << " **************************";
487  }
488 
489  std::cout << std::endl
490  << " Result ROOT file: " << fRootFileName << std::endl
491  << " The number of events is not the same for all the non-empty channels." << std::endl
492  << " The maximum number (" << rNumberOfEvents << ") is considered as the number of events for calculations "
493  << std::endl
494  << " of pedestals, noises and correlations." << std::endl
495  << " Number of channels with 0 < nb of evts < " << rNumberOfEvents << " : " << DifferentMinusValue
496  << std::endl
497  // << " Number of channels with nb of evts > " << rNumberOfEvents << " = " << DifferentPlusValue << std::endl
498  << " Number of empty channels : " << EmptyChannel << std::endl
499  << " Some values of pedestals, noises and correlations may be wrong for channels" << std::endl
500  << " with number of events different from " << rNumberOfEvents << "." << std::endl
501  << " Please, check the histogram 'Numbers of events'." << std::endl
502  << "*******************************************************************************************************"
503  << std::endl;
504  }
505  else
506  {
508  {
509  if( rNumberOfEvents < NbOfReqEvts )
510  {
511  std::cout << "*TEcnaWrite::NumberOfEventsAnalysis()> *** INFO *** Number of events found in data = "
512  << rNumberOfEvents << ": less than number of requested events ( = " << NbOfReqEvts << ")" << std::endl;
513  }
514  }
515  }
516  return rNumberOfEvents;
517 }
518 
519 //.............................................................................................
520 Int_t TEcnaWrite::NumberOfEventsAnalysis(Int_t** T2d_NbOfEvts, const Int_t& MaxCrysEcnaInStex,
521  const Int_t& MaxNbOfSamples, const Int_t& NbOfReqEvts)
522 {
523  // CHECK OF THE NUMBER OF FOUND EVENTS, return rNumberOfEvents (NumberOfEvents())
524  // (number used to compute the average values over the events)
525  //
526  // 2D array: called by TEcnaRun object
527 
528  Int_t rNumberOfEvents = 0;
529  Int_t PresentNumber = 0;
530  Int_t DifferentMinusValue = 0;
531  Int_t DifferentPlusValue = 0;
532 
533  for(Int_t i0StexEcha = 0 ; i0StexEcha < MaxCrysEcnaInStex ; i0StexEcha++)
534  {
535  for(Int_t i_samp = 0 ; i_samp < MaxNbOfSamples ; i_samp++)
536  {
537  Int_t NbOfEvts = T2d_NbOfEvts[i0StexEcha][i_samp];
538 
539  if( NbOfEvts > 0 )
540  {
541  if( PresentNumber == 0 )
542  {
543  PresentNumber = NbOfEvts;
544  }
545  else
546  {
547  if( NbOfEvts > PresentNumber )
548  {
549  PresentNumber = NbOfEvts;
550  DifferentPlusValue++;
551  }
552  if( NbOfEvts < PresentNumber )
553  {
554  DifferentMinusValue++;
555  }
556  }
557  }
558  }
559  }
560  //............................................................. (NumberOfEvents())
561  rNumberOfEvents = PresentNumber;
562 
563  if( DifferentMinusValue > 0 || DifferentPlusValue > 0 )
564  {
565  std::cout << "!TEcnaWrite::NumberOfEventsAnalysis()> " << std::endl
566  << "****************** W A R N I N G : NUMBER OF EVENTS NOT CONSTANT ! *********************************"
567  << std::endl
568  << " Result ROOT file: " << fRootFileName << std::endl
569  << " The number of events is not the same for all the non-empty channels" << std::endl
570  << " The maximum number (" << rNumberOfEvents << ") is considered as the number of events " << std::endl
571  << " for calculations of pedestals, noises and correlations." << std::endl
572  << " Number of channels with 0 < nb of evts < " << rNumberOfEvents << " : " << DifferentMinusValue << std::endl
573  // << " Number of channels with nb of evts > " << rNumberOfEvents << " : " << DifferentPlusValue << std::endl
574  // << " Number of empty channels : " << EmptyChannel << std::endl
575  << " Some values of pedestals, noises and correlations may be wrong for channels" << std::endl
576  << " with number of events different from " << rNumberOfEvents << "." << std::endl
577  << " Please, check the histogram 'Numbers of events'." << std::endl
578  << "*******************************************************************************************************"
579  << std::endl;
580  }
581  else
582  {
584  {
585  if( rNumberOfEvents < NbOfReqEvts )
586  {
587  std::cout << "*TEcnaWrite::NumberOfEventsAnalysis()> *** INFO *** Number of events found in data = "
588  << rNumberOfEvents << ": less than number of requested events ( = " << NbOfReqEvts << ")" << std::endl;
589  }
590  }
591  }
592  return rNumberOfEvents;
593 
594 }//----- ( end of NumberOfEvents(...) ) ----------------
595 
596 void TEcnaWrite::RegisterFileParameters(const TString& ArgAnaType,
597  const Int_t& ArgNbOfSamples, const Int_t& ArgRunNumber,
598  const Int_t& ArgFirstReqEvtNumber, const Int_t& ArgLastReqEvtNumber,
599  const Int_t& ArgReqNbOfEvts, const Int_t& ArgStexNumber)
600 {
601  fAnaType = ArgAnaType;
602  fNbOfSamples = ArgNbOfSamples;
603  fRunNumber = ArgRunNumber;
604  fFirstReqEvtNumber = ArgFirstReqEvtNumber;
605  fLastReqEvtNumber = ArgLastReqEvtNumber;
606  fReqNbOfEvts = ArgReqNbOfEvts;
607  fStexNumber = ArgStexNumber;
608 }
609 
610 void TEcnaWrite::RegisterFileParameters(const TString& ArgAnaType,
611  const Int_t& ArgNbOfSamples, const Int_t& ArgRunNumber,
612  const Int_t& ArgFirstReqEvtNumber, const Int_t& ArgLastReqEvtNumber,
613  const Int_t& ArgReqNbOfEvts, const Int_t& ArgStexNumber,
614  const TString& ArgStartDate, const TString& ArgStopDate,
615  const time_t ArgStartTime, const time_t ArgStopTime)
616 {
617  fAnaType = ArgAnaType;
618  fNbOfSamples = ArgNbOfSamples;
619  fRunNumber = ArgRunNumber;
620  fFirstReqEvtNumber = ArgFirstReqEvtNumber;
621  fLastReqEvtNumber = ArgLastReqEvtNumber;
622  fReqNbOfEvts = ArgReqNbOfEvts;
623  fStexNumber = ArgStexNumber;
624  fStartDate = ArgStartDate;
625 
626  fStopDate = ArgStopDate;
627  fStartTime = ArgStartTime;
628  fStopTime = ArgStopTime;
629 }
630 //=======================================================================
631 //
632 // FILE NAMES MANAGEMENT
633 //
634 //=======================================================================
635 //==============================================================================
636 //
637 // Results Filename Making (private)
638 //
639 //==============================================================================
641 void TEcnaWrite::fMakeResultsFileName(const Int_t& i_code)
642 {
643 //Results filename making (private)
644 
645  //----------------------------------------------------------------------
646  //
647  // Making of the name of the result file from the parameters set
648  // by call to RegisterFileParameters(...)
649  //
650  // Put the names in the following class attributes:
651  //
652  // fRootFileName, fRootFileNameShort,
653  // fAsciiFileName, fAsciiFileNameShort
654  //
655  // (Short means: without the directory path)
656  //
657  // set indications (run number, type of quantity, ...)
658  // and add the extension ".ascii" or ".root"
659  //
660  // ROOT: only one ROOT file: i_code = fCodeRoot.
661  // All the types of quantities
662  //
663  // ASCII: several ASCII files: i_code = code for one type of quantity
664  // each i_code which is not equal to fCodeRoot is also implicitly
665  // a code "fCodeAscii" (this last attribute is not in the class)
666  //
667  //----------------------------------------------------------------------
668 
669  char* f_in = new char[fgMaxCar]; fCnew++;
670  char* f_in_short = new char[fgMaxCar]; fCnew++;
671 
672  Int_t MaxCar = fgMaxCar;
673  fStexName.Resize(MaxCar);
674  fStexName = "SM or Dee?";
675 
676  MaxCar = fgMaxCar;
677  fStinName.Resize(MaxCar);
678  fStinName = "tower or SC?";
679 
680  if( fFlagSubDet == "EB" ){fStexName = "SM"; fStinName = "tower";}
681  if( fFlagSubDet == "EE" ){fStexName = "Dee"; fStinName = "SC";}
682 
683  // switch (i_code){
684 
685  //=================================== R O O T ========================= (fMakeResultsFileName)
686  TString sPointInterrog = "?";
687  TString sDollarHome = "$HOME";
688 
689  if (i_code == fCodeRoot)
690  {
691  if( fCnaParPaths->ResultsRootFilePath().Data() == sPointInterrog.Data() )
692  {
693  std::cout << "!TEcnaWrite::fMakeResultsFileName> * * * W A R N I N G * * * " << std::endl << std::endl
694  << " Path for results .root file not defined. Default option will be used here:" << std::endl
695  << " your results files will be written in your HOME directory." << std::endl << std::endl
696  << " In order to write the .root results file in a specific directory," << std::endl
697  << " you have to create a file named path_results_root in a subdirectory named ECNA" << std::endl
698  << " previously created in your home directory." << std::endl
699  << " This file must have only one line containing the path of the directory" << std::endl
700  << " where must be the .root result files." << std::endl
701  << std::endl;
702 
703  TString home_path = gSystem->Getenv("HOME");
704  fCnaParPaths->SetResultsRootFilePath(home_path.Data());
705  }
706 
707  if( fCnaParPaths->BeginningOfResultsRootFilePath().Data() == sDollarHome.Data() )
708  {
710  const Text_t *t_file_nohome = (const Text_t *)fCnaParPaths->ResultsRootFilePath().Data(); // /scratch0/cna/...
711 
712  TString home_path = gSystem->Getenv("HOME");
713  fCnaParPaths->SetResultsRootFilePath(home_path.Data()); // /afs/cern.ch/u/USER
714  fCnaParPaths->AppendResultsRootFilePath(t_file_nohome); // /afs/cern.ch/u/USER/scratch0/cna/...
715  }
716 
717  sprintf(f_in, "%s/%s_S1_%d_R%d_%d_%d_%d_%s%d",
720  sprintf(f_in_short, "%s_S1_%d_R%d_%d_%d_%d_%s%d",
721  fAnaType.Data(), fNbOfSamples,
723  }
724 
725  //=================================== A S C I I ==================== (fMakeResultsFileName)
726  //fCnaParPaths->GetPathForResultsAsciiFiles();
727  if (i_code != fCodeRoot)
728  {
729  if (i_code == fCodeHeaderAscii)
730  {
731  if( fCnaParPaths->ResultsAsciiFilePath().Data() == sPointInterrog.Data() )
732  {
733  std::cout << "!TEcnaWrite::fMakeResultsFileName> * * * W A R N I N G * * * " << std::endl << std::endl
734  << " Path for results .ascii file not defined. Default option will be used here:" << std::endl
735  << " your results files will be written in your HOME directory." << std::endl << std::endl
736  << " In order to write the .ascii results file in a specific directory," << std::endl
737  << " you have to create a file named path_results_ascii in a subdirectory named ECNA" << std::endl
738  << " previously created in your home directory." << std::endl
739  << " This file must have only one line containing the path of the directory" << std::endl
740  << " where must be the .ascii result files." << std::endl
741  << std::endl;
742 
743  TString home_path = gSystem->Getenv("HOME");
744  fCnaParPaths->SetResultsAsciiFilePath(home_path.Data());
745  }
746 
747  if( fCnaParPaths->BeginningOfResultsAsciiFilePath().Data() == sDollarHome.Data() )
748  {
750  const Text_t *t_file_nohome = (const Text_t *)fCnaParPaths->ResultsAsciiFilePath().Data(); // /scratch0/cna/...
751 
752  TString home_path = gSystem->Getenv("HOME");
753  fCnaParPaths->SetResultsAsciiFilePath(home_path.Data()); // /afs/cern.ch/u/USER
754  fCnaParPaths->AppendResultsAsciiFilePath(t_file_nohome); // /afs/cern.ch/u/USER/scratch0/cna/...
755  }
756  }
757 
758  sprintf(f_in, "%s/%s_S1_%d_R%d_%d_%d_%d_%s%d_header",
761  sprintf(f_in_short, "%s_S1_%d_R%d_%d_%d_%d_%s%d_header",
764  }
765 
766  //-------------------------------------------------------------- (fMakeResultsFileName)
767  if (i_code == fCodeNbOfEvts)
768  {
769  sprintf(f_in, "%s/%s_S1_%d_R%d_%d_%d_%d_%s%d_NbOfEvents",
772  sprintf(f_in_short, "%s_S1_%d_R%d_%d_%d_%d_%s%d_NbOfEvents",
775  }
776 
777  if (i_code == fCodePed)
778  {
779  sprintf(f_in, "%s/%s_S1_%d_R%d_%d_%d_%d_%s%d_Pedestals",
782  sprintf(f_in_short, "%s_S1_%d_R%d_%d_%d_%d_%s%d_Pedestals",
785  }
786 
787  if (i_code == fCodeTno)
788  {
789  sprintf(f_in, "%s/%s_S1_%d_R%d_%d_%d_%d_%s%d_TotalNoise",
792  sprintf(f_in_short, "%s_S1_%d_R%d_%d_%d_%d_%s%d_TotalNoise",
795  }
796 
797  if (i_code == fCodeLfn)
798  {
799  sprintf(f_in, "%s/%s_S1_%d_R%d_%d_%d_%d_%s%d_LFNoise",
802  sprintf(f_in_short, "%s_S1_%d_R%d_%d_%d_%d_%s%d_LFNoise",
805  }
806 
807  if (i_code == fCodeHfn)
808  {
809  sprintf(f_in, "%s/%s_S1_%d_R%d_%d_%d_%d_%s%d_HFNoise",
812  sprintf(f_in_short, "%s_S1_%d_R%d_%d_%d_%d_%s%d_HFNoise",
815  }
816 
817  if (i_code == fCodeMeanCorss)
818  {
819  sprintf(f_in, "%s/%s_S1_%d_R%d_%d_%d_%d_%s%d_MeanCorss",
822  sprintf(f_in_short, "%s_S1_%d_R%d_%d_%d_%d_%s%d_MeanCorss",
825  }
826 
827  if (i_code == fCodeSigCorss)
828  {
829  sprintf(f_in, "%s/%s_S1_%d_R%d_%d_%d_%d_%s%d_SigmaCorss",
832  sprintf(f_in_short, "%s_S1_%d_R%d_%d_%d_%d_%s%d_SigmaCorss",
835  }
836 
837  if (i_code == fCodeCovCss)
838  {
839  sprintf(f_in, "%s/%s_S1_%d_R%d_%d_%d_%d_%s%d_Covss_%s%d_Channel_%d",
843  sprintf(f_in_short, "%s_S1_%d_R%d_%d_%d_%d_%s%d_Covss_%s%d_Channel_%d",
847  }
848 
849  if (i_code == fCodeCorCss)
850  {
851  sprintf(f_in, "%s/%s_S1_%d_R%d_%d_%d_%d_%s%d_Corss_%s%d_Channel_%d",
855  sprintf(f_in_short, "%s_S1_%d_R%d_%d_%d_%d_%s%d_Corss_%s%d_Channel_%d",
859  }
860 
861  //------- (not used yet)
862 #define OCOD
863 #ifndef OCOD
864  if (i_code == fCodeMSp)
865  {
866  sprintf(f_in, "%s/%s_S1_%d_R%d_%d_%d_%d_%s%d_SampleMeans",
869  sprintf(f_in_short, "%s_S1_%d_R%d_%d_%d_%d_%s%d_SampleMeans",
872  }
873 
874  if (i_code == fCodeSSp)
875  {
876  sprintf(f_in, "%s/%s_S1_%d_R%d_%d_%d_%d_%s%d_SampleSigmas",
879  sprintf(f_in_short, "%s_S1_%d_R%d_%d_%d_%d_%s%d_SampleSigmas",
882  }
883 
884  if( i_code == fCodeAvTno)
885  {
886  sprintf(f_in, "%s/%s_S1_%d_R%d_%d_%d_%d_%s%d_AverageTotalNoise_c%d",
889  sprintf(f_in_short, "%s_S1_%d_R%d_%d_%d_%d_%s%d_AverageTotalNoise_c%d",
892  }
893 
894  if( i_code == fCodeLfCov)
895  {
896  sprintf(f_in, "%s/%s_S1_%d_R%d_%d_%d_%d_%s%d_LF_cov",
899  sprintf(f_in_short, "%s_S1_%d_R%d_%d_%d_%d_%s%d_LF_cov",
902  }
903 
904  if ( i_code == fCodeLfCor)
905  {
906  sprintf(f_in, "%s/%s_S1_%d_R%d_%d_%d_%d_%s%d_LF_cor",
909  sprintf(f_in_short, "%s_S1_%d_R%d_%d_%d_%d_%s%d_LF_cor",
912  }
913 
914  if (i_code == fCodeAvPed)
915  {
916  sprintf(f_in, "%s/%s_S1_%d_R%d_%d_%d_%d_%s%d_AveragePedestals",
919  sprintf(f_in_short, "%s_S1_%d_R%d_%d_%d_%d_%s%d_AveragePedestals",
922  }
923 
924  if (i_code == fCodeAvMeanCorss)
925  {
926  sprintf(f_in, "%s/%s_S1_%d_R%d_%d_%d_%d_%s%d_AverageMeanCorss%d",
929  sprintf(f_in_short, "%s_S1_%d_R%d_%d_%d_%d_%s%d_AverageMeanCorss%d",
932  }
933 
934  if (i_code == fCodeAvSigCorss)
935  {
936  sprintf(f_in, "%s/%s_S1_%d_R%d_%d_%d_%d_%s%d_AverageSigmaCorss%d",
939  sprintf(f_in_short, "%s_S1_%d_R%d_%d_%d_%d_%s%d_AverageSigmaCorss%d",
942  }
943 #endif // OCOD
944 
945  //----------------------------------------------------------- (fMakeResultsFileName)
946 
947  // default:
948  // std::cout << "*TEcnaWrite::fMakeResultsFileName(const Int_t& i_code)> "
949  // << "wrong header code , i_code = " << i_code << std::endl;
950  // }
951 
952  //======================================= f_name
953 
954  char* f_name = new char[fgMaxCar]; fCnew++;
955 
956  for (Int_t i = 0 ; i < fgMaxCar ; i++){f_name[i] = '\0';}
957 
958  Int_t ii = 0;
959  for (Int_t i = 0 ; i < fgMaxCar ; i++)
960  {
961  if ( f_in[i] != '\0' ){f_name[i] = f_in[i]; ii++;}
962  else {break;} // va directement a if ( ii+5 < fgMaxCar ) puis... f_name[ii] = '.';
963  }
964 
965  if ( ii+5 < fgMaxCar )
966  {
967  //.......... writing of the file extension (.root or .ascii) (fMakeResultsFileName)
968 
969  //------------------------------------------- extension .ascii
970  if ( i_code != fCodeRoot || i_code == fCodeNbOfEvts )
971  {
972  f_name[ii] = '.'; f_name[ii+1] = 'a';
973  f_name[ii+2] = 's'; f_name[ii+3] = 'c';
974  f_name[ii+4] = 'i'; f_name[ii+5] = 'i';
975 
976  fAsciiFileName = f_name;
977  }
978  //------------------------------------------- extension .root
979  if ( i_code == fCodeRoot )
980  {
981  f_name[ii] = '.'; f_name[ii+1] = 'r';
982  f_name[ii+2] = 'o'; f_name[ii+3] = 'o'; f_name[ii+4] = 't';
983 
984  fRootFileName = f_name;
985  }
986  }
987  else
988  {
989  std::cout << "*TEcnaWrite::fMakeResultsFileName(...)> Name too long (for f_name)."
990  << " No room enough for the extension. (ii = " << ii << ")"
991  << fTTBELL << std::endl;
992  }
993 
994 
995  //====================================== f_name_short (fMakeResultsFileName)
996 
997  char* f_name_short = new char[fgMaxCar]; fCnew++;
998 
999  for (Int_t i = 0 ; i < fgMaxCar ; i++){f_name_short[i] = '\0';}
1000 
1001  ii = 0;
1002  for (Int_t i = 0 ; i < fgMaxCar ; i++)
1003  {
1004  if ( f_in_short[i] != '\0' ){f_name_short[i] = f_in_short[i]; ii++;}
1005  else {break;} // va directement a f_name_short[ii] = '.';
1006  }
1007 
1008  if ( ii+5 < fgMaxCar )
1009  {
1010  //.......... writing of the file extension (.root or .ascii)
1011 
1012  //-------------------------------------------extension .ascii
1013  if ( i_code != fCodeRoot || i_code == fCodeNbOfEvts )
1014  {
1015  f_name_short[ii] = '.'; f_name_short[ii+1] = 'a';
1016  f_name_short[ii+2] = 's'; f_name_short[ii+3] = 'c';
1017  f_name_short[ii+4] = 'i'; f_name_short[ii+5] = 'i';
1018 
1019  fAsciiFileNameShort = f_name_short;
1020  }
1021 
1022  //-------------------------------------------- extension .root
1023  if ( i_code == fCodeRoot )
1024  {
1025  f_name_short[ii] = '.'; f_name_short[ii+1] = 'r';
1026  f_name_short[ii+2] = 'o'; f_name_short[ii+3] = 'o'; f_name_short[ii+4] = 't';
1027 
1028  fRootFileNameShort = f_name_short;
1029  }
1030  }
1031  else
1032  {
1033  std::cout << "*TEcnaWrite::fMakeResultsFileName(...)> Name too long (for f_name_short)."
1034  << " No room enough for the extension. (ii = " << ii << ")"
1035  << fTTBELL << std::endl;
1036  }
1037  delete [] f_name; f_name = nullptr; fCdelete++;
1038  delete [] f_name_short; f_name_short = nullptr; fCdelete++;
1039 
1040  delete [] f_in; f_in = nullptr; fCdelete++;
1041  delete [] f_in_short; f_in_short = nullptr; fCdelete++;
1042 
1043 } // end of fMakeResultsFileName
1044 
1045 //==========================================================================================
1046 //
1047 //
1048 //
1049 //==========================================================================================
1050 
1051 void TEcnaWrite::fAsciiFileWriteHeader(const Int_t& i_code)
1052 {
1053 //Ascii results file header writing (private). Called by the WriteAscii...() methods
1054 
1055  //-----------------------------------------------
1056  //
1057  // opening of the ASCII results file
1058  // and writing of its header
1059  //
1060  //-----------------------------------------------
1061 
1062  if(fAsciiFileName.BeginsWith("$HOME"))
1063  {
1064  fAsciiFileName.Remove(0,5);
1065  TString EndOfAsciiFileName = fAsciiFileName;
1066  const Text_t *t_file_nohome = (const Text_t *)EndOfAsciiFileName.Data(); // const Text_t* -> EndOfAsciiFileName
1067  // ( /scratch0/cna/... )
1068  TString home_path = gSystem->Getenv("HOME");
1069  fAsciiFileName = home_path; // fAsciiFileName = absolute HOME path ( /afs/cern.ch/u/USER )
1070  fAsciiFileName.Append(t_file_nohome); // Append (const Text_t* -> EndOfAsciiFileName) to fAsciiFileName
1071  // ( /afs/cern.ch/u/USER/scratch0/cna/... )
1072  }
1073 
1074  fFcout_f.open(fAsciiFileName.Data());
1075 
1076  fFcout_f << "*** File: " << fAsciiFileName
1077  << " *** " << std::endl << std::endl;
1078  fFcout_f << "*Analysis name : " << fAnaType << std::endl;
1079  fFcout_f << "*First-Last samples : 1 - " << fNbOfSamples << std::endl;
1080  fFcout_f << "*Run number : " << fRunNumber << std::endl;
1081  fFcout_f << "*First requested event number : " << fFirstReqEvtNumber << std::endl;
1082  fFcout_f << "*Last requested event number : " << fLastReqEvtNumber << std::endl;
1083  fFcout_f << "*Requested number of events : " << fReqNbOfEvts << std::endl;
1084  if( fFlagSubDet == "EB" )
1085  {fFcout_f << "*SuperModule number : " << fStexNumber << std::endl;}
1086  if( fFlagSubDet == "EE" )
1087  {fFcout_f << "*Dee number : " << fStexNumber << std::endl;}
1088  fFcout_f << "*Date first requested event : " << fStartDate;
1089  fFcout_f << "*Date last requested event : " << fStopDate << std::endl;
1090  fFcout_f << std::endl;
1091 
1092  //=========================================================================
1093  // closing of the results file if i_code = fCodeHeaderAscii only.
1094  // closing is done in the fT1dWriteAscii() and fT2dWriteAscii() methods
1095  // except for i_code = fCodeHeaderAscii
1096  //=========================================================================
1097  if(i_code == fCodeHeaderAscii){fFcout_f.close();}
1098 }
1099 
1100 //=========================================================================
1101 //
1102 // W R I T I N G M E T H O D S : R O O T F I L E S
1103 //
1104 // The root files are written by TEcnaRun since the arrays are computed
1105 // by this class (arrays fT2d_..., fT1d_..) and are private attributes.
1106 // No writing method in ROOT file here.
1107 // Just the making of the file name
1108 //
1109 //=========================================================================
1110 
1111 //=========================================================================
1112 //
1113 // W R I T I N G M E T H O D S : A S C I I F I L E S
1114 //
1115 // Ascii file are treated on the same footing as plots in the
1116 // TEcnaHistos methods.
1117 // The arrays are TVectorD or TMatrixD and are arguments of the
1118 // writting methods (WriteAsciiHisto, fT2dWriteAscii)
1119 //
1120 //=========================================================================
1121 //
1122 // In the following, we describe:
1123 //
1124 // (1) The method which gets the path for the results ASCII files
1125 // from a "cna-configuration" file
1126 // (2) The codification for the names of the ASCII files
1127 // (3) The methods which writes the results in the ASCII files
1128 //
1129 //
1130 //
1131 // (1)-----------> Method to set the path for the results ASCII files
1132 //
1133 // void MyCnaRun->GetPathForResultsAsciiFiles(pathname);
1134 //
1135 // TString pathname = name of a "cna-config" file located
1136 // in the user's HOME directory and containing one line which
1137 // specifies the path where must be written the .ascii result files.
1138 // (no slash at the end of the string)
1139 //
1140 // DEFAULT:
1141 // void MyCnaRun->GetPathForResultsAsciiFiles();
1142 // If there is no argument, the "cna-config" file must be named
1143 // "path_results_ascii.ecna" and must be located in the user's HOME
1144 // directory
1145 //
1146 //
1147 // (2)-----------> Codification for the names of the ASCII files (examples):
1148 //
1149 // aaa_nnnS_Rrrr_fff_ttt_SMnnn_pedestals.ascii OR aaa_nnnS_Rrrr_fff_ttt_Deennn_pedestals.ascii
1150 // aaa_nnnS_Rrrr_fff_ttt_SMnnn_HF_noise.ascii OR aaa_nnnS_Rrrr_fff_ttt_Deennn_HF_noise.ascii
1151 // aaa_nnnS_Rrrr_fff_ttt_SMnnn_corss_cCCC.ascii OR aaa_nnnS_Rrrr_fff_ttt_Deennn_corss_cCCC.ascii
1152 // etc...
1153 //
1154 // with:
1155 // aaa = Analysis name
1156 // rrr = Run number
1157 // fff = First requested event number
1158 // ttt = Number of requested events
1159 // CCC = Electronic Channel number in Stex
1160 // nnn = SM number or Dee number
1161 //
1162 // Examples:
1163 // StdPed12_10S_R66689_1_50_SM1_pedestals.ascii
1164 // StdPed6_10S_R66689_1_50_Dee3_cor_ss_c2234.ascii
1165 //
1166 //
1167 // (3)-----------> Methods which write the ASCII files:
1168 //
1169 // The methods which write the ASCII files are the following:
1170 //
1171 // void WriteAsciiCovariancesBetweenSamples(Channel, MatrixSize, TMatrixD matrix);
1172 // void WriteAsciiCorrelationsBetweenSamples(Channel, MatrixSize, TMatrixD matrix);
1173 // void fT2dWriteAscii(code, px, py, MatrixSize, TMatrixD matrix) [private]
1174 // void WriteAsciiHisto(CodeHisto, HistoSize, TVectorD histo)
1175 //
1176 // Each of these methods corresponds to a "calculation method" of TEcnaRun.
1177 // The calculation method of TEcnaRun must have been been called before
1178 // using the writing method of TEcnaWrite.
1179 //==========================================================================================
1180 
1181 //-------------------------------------------------------------------------------------------
1182 //
1183 // WriteAsciiHisto()
1184 //
1185 // Stex = SM or Dee , Stin = Tower or SC
1186 //
1187 //-------------------------------------------------------------------------------------------
1188 void TEcnaWrite::WriteAsciiHisto(const TString& HistoCode, const Int_t& HisSize,
1189  const TVectorD& read_histo)
1190 {
1191 //Write histo with correspondance CNA-channel <-> xtal number in SM or Dee
1192 
1193  // BuildCrysTable() is called in the method Init() which is called by the constructor
1194 
1195  Int_t i_code = fCodeNbOfEvts;
1196 
1197  //--------------------------------------------------------------------------------
1198  if( HistoCode == "D_NOE_ChNb" ){i_code = fCodeNbOfEvts;}
1199  if( HistoCode == "D_Ped_ChNb" ){i_code = fCodePed;}
1200  if( HistoCode == "D_TNo_ChNb" ){i_code = fCodeTno;}
1201  if( HistoCode == "D_LFN_ChNb" ){i_code = fCodeLfn;}
1202  if( HistoCode == "D_HFN_ChNb" ){i_code = fCodeHfn;}
1203  if( HistoCode == "D_MCs_ChNb" ){i_code = fCodeMeanCorss;}
1204  if( HistoCode == "D_SCs_ChNb" ){i_code = fCodeSigCorss;}
1205 
1206  fMakeResultsFileName(i_code); // => Making of the results .ascii file name
1207  fAsciiFileWriteHeader(i_code); // => Open of the file associated with stream fFcout_f
1208 
1209  //..................................... format numerical values
1210  fFcout_f << std::setiosflags(std::ios::showpoint | std::ios::uppercase);
1211  fFcout_f << std::setprecision(3) << std::setw(6);
1212  fFcout_f.setf(std::ios::dec, std::ios::basefield);
1213  fFcout_f.setf(std::ios::fixed, std::ios::floatfield);
1214  fFcout_f.setf(std::ios::left, std::ios::adjustfield);
1215  fFcout_f.setf(std::ios::right, std::ios::adjustfield);
1216 
1217  std::cout << std::setiosflags(std::ios::showpoint | std::ios::uppercase);
1218  std::cout << std::setprecision(3) << std::setw(6);
1219  std::cout.setf(std::ios::dec, std::ios::basefield);
1220  std::cout.setf(std::ios::fixed, std::ios::floatfield);
1221  std::cout.setf(std::ios::left, std::ios::adjustfield);
1222  std::cout.setf(std::ios::right, std::ios::adjustfield);
1223 
1224  //........................................................ WriteAsciiHisto
1225  TString aStexName;
1226  Int_t MaxCar = fgMaxCar;
1227  aStexName.Resize(MaxCar);
1228  aStexName = "SM or Dee?";
1229 
1230  TString aStinName;
1231  MaxCar = fgMaxCar;
1232  aStinName.Resize(MaxCar);
1233  aStinName = "Tower or SC?";
1234 
1235  TString aHoco;
1236  MaxCar = fgMaxCar;
1237  aHoco.Resize(MaxCar);
1238  aHoco = "Eta or IX?";
1239 
1240  TString aVeco;
1241  MaxCar = fgMaxCar;
1242  aVeco.Resize(MaxCar);
1243  aVeco = "Phi or IY?";
1244 
1245  TString aSpecifa;
1246  MaxCar = fgMaxCar;
1247  aSpecifa.Resize(MaxCar);
1248  aSpecifa = " ";
1249 
1250  TString aSpecifc;
1251  MaxCar = fgMaxCar;
1252  aSpecifc.Resize(MaxCar);
1253  aSpecifc = " ";
1254 
1255  TString aSpecifd;
1256  MaxCar = fgMaxCar;
1257  aSpecifd.Resize(MaxCar);
1258  aSpecifd = " ";
1259 
1260  TString aSpecife;
1261  MaxCar = fgMaxCar;
1262  aSpecife.Resize(MaxCar);
1263  aSpecife = " ";
1264 
1265  TString aSpecif1;
1266  MaxCar = fgMaxCar;
1267  aSpecif1.Resize(MaxCar);
1268  aSpecif1 = " ";
1269 
1270  TString aSpecif2;
1271  MaxCar = fgMaxCar;
1272  aSpecif2.Resize(MaxCar);
1273  aSpecif2 = " ";
1274 
1275  if( fFlagSubDet == "EB" )
1276  {
1277  aStexName = "SM " ; aStinName = "tower" ; aSpecifa = " channel# ";
1278  aHoco = " Eta "; aVeco = " Phi "; aSpecifc = " channel# ";
1279  aSpecifd = " crystal# "; aSpecife = "SM ";
1280  }
1281  if( fFlagSubDet == "EE" )
1282  {
1283  aStexName = "Dee " ; aStinName = " SC " ; aSpecifa = " Sector# ";
1284  aHoco = " IX "; aVeco = " IY "; aSpecifc = " crystal# ";
1285  aSpecifd = " SC # "; aSpecife = "Sector";
1286  }
1287 
1288  //.............................................................. WriteAsciiHisto
1289  for (Int_t i0StexEcha=0; i0StexEcha<HisSize; i0StexEcha++)
1290  {
1291  Int_t n1StexStin = 0;
1292  Int_t StexStinEcna = 0;
1293  Int_t i0StinEcha = 0;
1294  Int_t n1StinEcha = 0;
1295  Int_t n1StexCrys = 0;
1296  Int_t n1DataSector = 0;
1297  Int_t n1SCinDS = 0;
1298 
1299  if( fFlagSubDet == "EB")
1300  {
1301  n1StexStin = fEcalNumbering->Get1SMTowFrom0SMEcha(i0StexEcha);
1302  StexStinEcna = n1StexStin;
1303  i0StinEcha = fEcalNumbering->Get0TowEchaFrom0SMEcha(i0StexEcha);
1304  n1StexCrys = fEcalNumbering->Get1SMCrysFrom1SMTowAnd0TowEcha(n1StexStin, i0StinEcha);
1305  }
1306  if( fFlagSubDet == "EE")
1307  {
1308  StexStinEcna = fEcalNumbering->Get1DeeSCEcnaFrom0DeeEcha(i0StexEcha);
1309  n1DataSector = fEcalNumbering->GetDSFrom1DeeSCEcna(fStexNumber, StexStinEcna);
1310  n1SCinDS = fEcalNumbering->GetDSSCFrom1DeeSCEcna(fStexNumber, StexStinEcna);
1311  n1StexStin = fEcalNumbering->GetDeeSCConsFrom1DeeSCEcna(fStexNumber, StexStinEcna);
1312  n1StinEcha = fEcalNumbering->Get1SCEchaFrom0DeeEcha(i0StexEcha);
1313  }
1314 
1315  if( n1StexStin > 0 )
1316  {
1317  if( (fFlagSubDet == "EB" && i0StinEcha == 0) || (fFlagSubDet == "EE" && n1StinEcha == 1) )
1318  {
1319  if( HistoCode == "D_NOE_ChNb" ){aSpecif1 = "Number of"; aSpecif2 = " events (requested)";}
1320  if( HistoCode == "D_Ped_ChNb" ){aSpecif1 = "Pedestals"; aSpecif2 = " ";}
1321  if( HistoCode == "D_TNo_ChNb" ){aSpecif1 = " Total "; aSpecif2 = " noise ";}
1322  if( HistoCode == "D_MCs_ChNb" ){aSpecif1 = " Mean "; aSpecif2 = " cor(s,s) ";}
1323  if( HistoCode == "D_LFN_ChNb" ){aSpecif1 = " Low Fq"; aSpecif2 = " noise ";}
1324  if( HistoCode == "D_HFN_ChNb" ){aSpecif1 = " High Fq"; aSpecif2 = " noise ";}
1325  if( HistoCode == "D_SCs_ChNb" ){aSpecif1 = " Sigma of"; aSpecif2 = " cor(s,s) ";}
1326 
1327  fFcout_f << std::endl;
1328 
1329  fFcout_f << aSpecifa.Data()
1330  << " " << aStinName.Data() << "# "
1331  << aSpecifc.Data()
1332  << aSpecifd.Data()
1333  << aHoco.Data()
1334  << aVeco.Data()
1335  << aSpecif1.Data() << std::endl;
1336 
1337  fFcout_f << " in " << aStexName.Data()
1338  << " in " << aStexName.Data()
1339  << " in " << aStinName.Data()
1340  << " in " << aSpecife.Data()
1341  << " in " << aStexName.Data()
1342  << " in " << aStexName.Data()
1343  << aSpecif2.Data() << std::endl << std::endl;
1344  }
1345 
1346  Double_t value = read_histo(i0StexEcha);
1347 
1348  if( fFlagSubDet == "EB" )
1349  {
1350  fFcout_f << std::setw(7) << i0StexEcha
1351  << std::setw(8) << n1StexStin
1352  << std::setw(11) << i0StinEcha // (Electronic channel number in tower)
1353  << std::setw(10) << n1StexCrys
1354  << std::setw(10) << (Int_t)fEcalNumbering->GetEta(fStexNumber, StexStinEcna, i0StinEcha)
1355  << std::setw(10) << (Int_t)fEcalNumbering->GetPhiInSM(fStexNumber, StexStinEcna, i0StinEcha);
1356  }
1357  if( fFlagSubDet == "EE" )
1358  {
1359  Int_t n1StinEcha_m = n1StinEcha-1;
1360  fFcout_f << std::setw(7) << n1DataSector
1361  << std::setw(8) << n1StexStin
1362  << std::setw(11) << n1StinEcha // (Xtal number for construction in SC)
1363  << std::setw(10) << n1SCinDS
1364  << std::setw(10) << fEcalNumbering->GetIXCrysInDee(fStexNumber, StexStinEcna, n1StinEcha_m)
1365  << std::setw(10) << fEcalNumbering->GetJYCrysInDee(fStexNumber, StexStinEcna, n1StinEcha_m);
1366  }
1367 
1368  if( HistoCode == "D_NOE_ChNb")
1369  {
1370  Int_t ivalue = (Int_t)value;
1371  fFcout_f << std::setw(13) << ivalue;
1372  fFcout_f << std::setw(4) << "(" << std::setw(6) << fReqNbOfEvts << ")";
1373  }
1374  else
1375  {
1376  fFcout_f << std::setw(13) << value;
1377  }
1378 
1379  fFcout_f << std::endl;
1380  }
1381  } // end of loop: for (Int_t i0StexEcha=0; i0StexEcha<HisSize; i0StexEcha++)
1382 
1383  fFcout_f.close();
1384 
1385  // if(fFlagPrint != fCodePrintNoComment)
1386  // {
1387  std::cout << "*TEcnaWrite::WriteAsciiHisto(...)> INFO: "
1388  << "histo has been written in file: " << std::endl
1389  << " " << fAsciiFileName.Data() << std::endl;
1390  // }
1391 } // end of TEcnaWrite::WriteAsciiHisto
1392 
1393 //================================================================================
1394 //
1395 // W R I T I N G O F T H E C O V A N D C O R M A T R I C E S
1396 //
1397 //================================================================================
1398 
1399 //--------------------------------------------------------------------------------
1400 //
1401 // Writing of the covariances between samples
1402 // for a given StexEcha in an ASCII file
1403 //
1404 //--------------------------------------------------------------------------------
1405 void TEcnaWrite::WriteAsciiCovariancesBetweenSamples(const Int_t& user_StexStin,
1406  const Int_t& user_StinEcha,
1407  const Int_t& MatSize,
1408  const TMatrixD& read_matrix)
1409 {
1410 //Writing of the covariances between samples for a given StexEcha in an ASCII file
1411 
1412  if( fFlagSubDet == "EB" ){fStexStinUser = user_StexStin;}
1413  if( fFlagSubDet == "EE" ){fStexStinUser =
1415 
1416  if( fFlagSubDet == "EB" ){fStinEchaUser = user_StinEcha;}
1417  if( fFlagSubDet == "EE" ){fStinEchaUser = user_StinEcha+1;}
1418 
1419  Int_t i_code = fCodeCovCss; // code for covariances between samples
1420  fMakeResultsFileName(i_code);
1421  fAsciiFileWriteHeader(i_code);
1422 
1423  Int_t i_pasx = fSectSampSizeX;
1424  Int_t i_pasy = fSectSampSizeY;
1425 
1426  fT2dWriteAscii(i_code, i_pasx, i_pasy, MatSize, read_matrix);
1427 }
1428 
1429 //---------------------------------------------------------------------------------
1430 //
1431 // Writing of the correlations between samples
1432 // for a given StexEcha in an ASCII file
1433 //
1434 //---------------------------------------------------------------------------------
1436  const Int_t& user_StinEcha,
1437  const Int_t& MatSize,
1438  const TMatrixD& read_matrix)
1439 {
1440 //Writing of the correlations between samples for a given StexEcha in an ASCII file
1441 
1442 
1443  if( fFlagSubDet == "EB" ){fStexStinUser = user_StexStin;}
1444  if( fFlagSubDet == "EE" ){fStexStinUser =
1446 
1447  if( fFlagSubDet == "EB" ){fStinEchaUser = user_StinEcha;}
1448  if( fFlagSubDet == "EE" ){fStinEchaUser = user_StinEcha+1;}
1449 
1450  Int_t i_code = fCodeCorCss; // code for correlations between samples
1451  fMakeResultsFileName(i_code);
1452  fAsciiFileWriteHeader(i_code);
1453 
1454  Int_t i_pasx = fSectSampSizeX;
1455  Int_t i_pasy = fSectSampSizeY;
1456 
1457  fT2dWriteAscii(i_code, i_pasx, i_pasy, MatSize, read_matrix);
1458 }
1459 
1460 //----------------------------------------------------------------------
1461 //
1462 // fT2dWriteAscii: Array 2D of (n_sctx , n_scty) sectors
1463 // of size: i_pasx_arg * i_pasy_arg
1464 //
1465 // (private)
1466 //
1467 //----------------------------------------------------------------------
1468 
1469 void TEcnaWrite::fT2dWriteAscii(const Int_t& i_code,
1470  const Int_t& i_pasx_arg,
1471  const Int_t& i_pasy_arg,
1472  const Int_t& MatSize,
1473  const TMatrixD& read_matrix)
1474 {
1475 //Writing of a matrix by sectors (private)
1476 
1477  Int_t i_pasx = i_pasx_arg; // taille secteur en x
1478  Int_t i_pasy = i_pasy_arg; // taille secteur en y
1479 
1480  //------------ formatage des nombres en faisant appel a la classe ios
1481 
1482  fFcout_f << std::setiosflags(std::ios::showpoint | std::ios::uppercase);
1483  fFcout_f.setf(std::ios::dec, std::ios::basefield);
1484  fFcout_f.setf(std::ios::fixed, std::ios::floatfield);
1485  fFcout_f.setf(std::ios::left, std::ios::adjustfield);
1486  fFcout_f.setf(std::ios::right, std::ios::adjustfield);
1487  fFcout_f << std::setprecision(3) << std::setw(6);
1488 
1489  std::cout << std::setiosflags(std::ios::showpoint | std::ios::uppercase);
1490  std::cout.setf(std::ios::dec, std::ios::basefield);
1491  std::cout.setf(std::ios::fixed, std::ios::floatfield);
1492  std::cout.setf(std::ios::left, std::ios::adjustfield);
1493  std::cout.setf(std::ios::right, std::ios::adjustfield);
1494  std::cout << std::setprecision(3) << std::setw(6);
1495 
1496  //--------------------- fin du formatage standard C++ -------------------
1497 
1498  //-----------------------------------------------------------------------
1499  // Reservation dynamique d'un array Double_t** de dimensions
1500  // les multiples de 5 juste au-dessus des dimensions de l'array 2D
1501  // a ecrire ( array de dimensions
1502  // (fEcal->MaxSampADC(),fEcal->MaxSampADC())
1503  // (fEcal->MaxCrysEcnaInStex(),fEcal->MaxCrysEcnaInStex()) )
1504  //-----------------------------------------------------------------------
1505  // Determination des tailles multiples de fSectChanSizeX ou fSectSampSizeX
1506 
1507 #define NOUC
1508 #ifndef NOUC
1509 
1510  //*************** channels *************
1511  Int_t justap_chan = 0;
1512 
1513  if( fEcal->MaxCrysEcnaInStex()%fSectChanSizeX == 0 )
1514  {justap_chan = fEcal->MaxCrysEcnaInStex();}
1515  else
1516  {justap_chan=((fEcal->MaxCrysEcnaInStex()/fSectChanSizeX)+1)*fSectChanSizeX;}
1517 
1518  //....................... Allocation fjustap_2d_cc
1519 
1520  if ( i_code == fCodeHfCov || i_code == fCodeHfCor||
1521  i_code == fCodeLfCov || i_code == fCodeLfCor ){
1522  if(fjustap_2d_cc == 0)
1523  {
1524  //................... Allocation
1525  fjustap_2d_cc = new Double_t*[justap_chan]; fCnew++;
1526  fjustap_1d_cc = new Double_t[justap_chan*justap_chan]; fCnew++;
1527  for(Int_t i = 0 ; i < justap_chan ; i++){
1528  fjustap_2d_cc[i] = &fjustap_1d_cc[0] + i*justap_chan;}
1529  }
1530 
1531  //............................... Transfert des valeurs dans fjustap_2d_cc (=init)
1532  for(Int_t i = 0; i < fEcal->MaxCrysEcnaInStex(); i++){
1533  for(Int_t j = 0; j < fEcal->MaxCrysEcnaInStex(); j++){
1534  if ( i_code == fCodeHfCov ){
1535  fjustap_2d_cc[i][j] = read_matrix(i,j);}
1536  if ( i_code == fCodeHfCor ){
1537  fjustap_2d_cc[i][j] = read_matrix(i,j);}
1538  if ( i_code == fCodeLfCov ){
1539  fjustap_2d_cc[i][j] = read_matrix(i,j);}
1540  if ( i_code == fCodeLfCor ){
1541  fjustap_2d_cc[i][j] = read_matrix(i,j);}
1542  }
1543  }
1544 
1545  //.......................... mise a zero du reste de la matrice (=init)
1546  for(Int_t i = fEcal->MaxCrysEcnaInStex(); i < justap_chan; i++){
1547  for(Int_t j = fEcal->MaxCrysEcnaInStex(); j < justap_chan; j++){
1548  fjustap_2d_cc[i][j] = (Double_t)0.;}}
1549  }
1550 
1551 #endif //NOUC
1552 
1553  //************************************ Samples ***************************
1554  Int_t justap_samp = 0;
1555 
1556  if ( fEcal->MaxSampADC()%fSectSampSizeX == 0 ){
1557  justap_samp = fEcal->MaxSampADC();}
1558  else{
1559  justap_samp=((fEcal->MaxSampADC()/fSectSampSizeX)+1)*fSectSampSizeX;}
1560 
1561  //....................... allocation fjustap_2d_ss
1562 
1563  if (i_code == fCodeCovCss || i_code == fCodeCorCss ||
1564  i_code == fCodeAvMeanCorss || i_code == fCodeAvSigCorss){
1565  if(fjustap_2d_ss == nullptr)
1566  {
1567  //................... Allocation
1568  fjustap_2d_ss = new Double_t*[justap_samp]; fCnew++;
1569  fjustap_1d_ss = new Double_t[justap_samp*justap_samp]; fCnew++;
1570  for(Int_t i = 0 ; i < justap_samp ; i++){
1571  fjustap_2d_ss[i] = &fjustap_1d_ss[0] + i*justap_samp;}
1572  }
1573 
1574  //.............................. Transfert des valeurs dans fjustap_2d_ss (=init)
1575  for(Int_t i = 0; i < fEcal->MaxSampADC(); i++){
1576  for(Int_t j = 0; j < fEcal->MaxSampADC(); j++){
1577  if( i_code == fCodeCovCss ){
1578  fjustap_2d_ss[i][j] = read_matrix(i,j);}
1579  if( i_code == fCodeCorCss ){
1580  fjustap_2d_ss[i][j] = read_matrix(i,j);}
1581  if( i_code == fCodeAvMeanCorss ){
1582  fjustap_2d_ss[i][j] = read_matrix(i,j);}
1583  if( i_code == fCodeAvSigCorss ){
1584  fjustap_2d_ss[i][j] = read_matrix(i,j);}
1585  }
1586  }
1587 
1588  //.......................... mise a zero du reste de la matrice (=init)
1589  for(Int_t i = fEcal->MaxSampADC(); i < justap_samp; i++){
1590  for(Int_t j = fEcal->MaxSampADC(); j < justap_samp; j++){
1591  fjustap_2d_ss[i][j] = (Double_t)0.;}}
1592  }
1593 
1594  //..................... impressions + initialisations selon i_code
1595 
1596  Int_t isx_max = 0;
1597  Int_t isy_max = 0;
1598 
1599 #define COCC
1600 #ifndef COCC
1601  if(i_code == fCodeHfCov)
1602  {
1603  fFcout_f << "Covariance matrix between channels "
1604  << "for sample number " << fUserSamp;
1605  isx_max = justap_chan;
1606  isy_max = justap_chan;
1607  }
1608  if(i_code == fCodeHfCor)
1609  {
1610  fFcout_f << "*Correlation matrix between channels "
1611  << "for sample number " << fUserSamp;
1612  isx_max = justap_chan;
1613  isy_max = justap_chan;
1614  }
1615 
1616  if(i_code == fCodeLfCov)
1617  {
1618  fFcout_f << "Covariance matrix between channels "
1619  << "averaged on the samples ";
1620  isx_max = justap_chan;
1621  isy_max = justap_chan;
1622  }
1623  if(i_code == fCodeLfCor)
1624  {
1625  fFcout_f << "Correlation matrix between channels "
1626  << "averaged on the samples ";
1627  isx_max = justap_chan;
1628  isy_max = justap_chan;
1629  }
1630 #endif // COCC
1631 
1632  Int_t n1StexStin = 0;
1633  Int_t i0StinEcha = 0;
1634  Int_t n1StinEcha = 0;
1635 
1636  if( fFlagSubDet == "EB")
1637  {
1638  n1StexStin = fStexStinUser;
1640  }
1641  if( fFlagSubDet == "EE")
1642  {
1643  n1StexStin = fStexStinUser;
1644  Int_t fStinEchaUser_m = fStinEchaUser-1;
1645  n1StinEcha = fEcalNumbering->Get1SCEchaFrom0DeeEcha(fStinEchaUser_m);
1646 
1647  TString sDeeDir = fEcalNumbering->GetDeeDirViewedFromIP(fStexNumber);
1648  }
1649 
1650  if(i_code == fCodeCovCss)
1651  {
1652  if( fFlagSubDet == "EB")
1653  {
1654  fFcout_f << "Covariance matrix between samples "
1655  << "for channel number " << fStinEchaUser
1656  << " (" << fStinName << ": " << n1StexStin
1657  << " , channel in " << fStinName << ": " << i0StinEcha << ")";
1658  }
1659  if( fFlagSubDet == "EE")
1660  {
1661  fFcout_f << "Covariance matrix between samples "
1662  << "for channel number " << fStinEchaUser
1663  << " (" << fStinName << ": " << n1StexStin
1664  << " , channel in " << fStinName << ": " << n1StinEcha << ")";
1665  }
1666  isx_max = justap_samp;
1667  isy_max = justap_samp;
1668  }
1669  if(i_code == fCodeCorCss)
1670  {
1671  if( fFlagSubDet == "EB")
1672  {
1673  fFcout_f << "Correlation matrix between samples "
1674  << "for channel number " << fStinEchaUser
1675  << " (" << fStinName << ": " << n1StexStin
1676  << " , channel in " << fStinName << ": " << i0StinEcha << ")";
1677  }
1678  if( fFlagSubDet == "EE")
1679  {
1680  fFcout_f << "Correlation matrix between samples "
1681  << "for channel number " << fStinEchaUser
1682  << " (" << fStinName << ": " << n1StexStin
1683  << " , channel in " << fStinName << ": " << n1StinEcha << ")";
1684  }
1685  isx_max = justap_samp;
1686  isy_max = justap_samp;
1687  }
1688 
1689  if(i_code == fCodeAvMeanCorss)
1690  {
1691  if( fFlagSubDet == "EB")
1692  {
1693  fFcout_f << "Correction factors to the covariances "
1694  << "between samples for channel number " << fStinEchaUser
1695  << " (" << fStinName << ": " << n1StexStin
1696  << " , channel in " << fStinName << ": " << i0StinEcha << ")";
1697  }
1698  if( fFlagSubDet == "EE")
1699  {
1700  fFcout_f << "Correction factors to the covariances "
1701  << "between samples for channel number " << fStinEchaUser
1702  << " (" << fStinName << ": " << n1StexStin
1703  << " , channel in " << fStinName << ": " << n1StinEcha << ")";
1704  }
1705  isx_max = justap_samp;
1706  isy_max = justap_samp;
1707  }
1708 
1709  if(i_code == fCodeAvSigCorss)
1710  {
1711  if( fFlagSubDet == "EB")
1712  {
1713  fFcout_f << "Correction factors to the correlations "
1714  << "between samples for channel number " << fStinEchaUser
1715  << " ( " << fStinName << ": " << n1StexStin
1716  << " , channel in " << fStinName << ": " << i0StinEcha << ")";
1717  }
1718  if( fFlagSubDet == "EE")
1719  {
1720  fFcout_f << "Correction factors to the correlations "
1721  << "between samples for channel number " << fStinEchaUser
1722  << " ( " << fStinName << ": " << n1StexStin
1723  << " , channel in " << fStinName << ": " << n1StinEcha << ")";
1724  }
1725  isx_max = justap_samp;
1726  isy_max = justap_samp;
1727  }
1728 
1729  fFcout_f << std::endl;
1730 
1731  //............... Calcul des nombres de secteurs selon x
1732  // i_pasx = taille secteur en x
1733  // isx_max = taille de la matrice en x
1734  // n_sctx = nombre de secteurs en x
1735  //
1736  if(i_pasx > isx_max){i_pasx = isx_max;}
1737  Int_t n_sctx;
1738  Int_t max_verix;
1739  n_sctx = isx_max/i_pasx;
1740  max_verix = n_sctx*i_pasx;
1741  if(max_verix < isx_max){ n_sctx++;}
1742 
1743  //............... Calcul des nombres de secteurs selon y
1744  // i_pasy = taille secteur en y
1745  // isy_max = taille de la matrice en y
1746  // n_scty = nombre de secteurs en x
1747  //
1748  if(i_pasy > isy_max){i_pasy = isy_max;}
1749  Int_t n_scty;
1750  Int_t max_veriy;
1751  n_scty = isy_max/i_pasy;
1752  max_veriy = n_scty*i_pasy;
1753  if(max_veriy < isy_max){ n_scty++;}
1754 
1755 #define NBSC
1756 #ifndef NBSC
1757  //................ Ecriture de la taille et du nombre des secteurs
1758  if( i_code == fCodeCovCss || i_code == fCodeCorCss ||
1759  i_code == fCodeAvMeanCorss || i_code == fCodeAvSigCorss)
1760  {
1761  fFcout_f << "sector size = " << fSectSampSizeX
1762  << " , number of sectors = " << n_sctx << " x " << n_scty
1763  <<endl;
1764  }
1765  if( i_code == fCodeHfCov || i_code == fCodeHfCor ||
1766  i_code == fCodeLfCov || i_code == fCodeLfCor )
1767  {
1768  fFcout_f << "sector size = " << fSectChanSizeX
1769  << " , number of sectors = " << n_sctx << " x " << n_scty
1770  << std::endl;
1771  }
1772 #endif // NBSC
1773 
1774  fFcout_f << std::endl;
1775 
1776  //............... impression matrice par secteurs i_pas x i_pas
1777  //........................... boucles pour display des secteurs
1778  Int_t ix_inf = -i_pasx;
1779 
1780  for(Int_t nsx = 0 ; nsx < n_sctx ; nsx++)
1781  {
1782  //......................... calcul limites secteur
1783  ix_inf = ix_inf + i_pasx;
1784  Int_t ix_sup = ix_inf + i_pasx;
1785 
1786  Int_t iy_inf = -i_pasy;
1787 
1788  for(Int_t nsy = 0 ; nsy < n_scty ; nsy++)
1789  {
1790  iy_inf = iy_inf + i_pasy;
1791  Int_t iy_sup = iy_inf + i_pasy;
1792 
1793  //......................... display du secteur (nsx,nsy)
1794 
1795  if(i_code == fCodeHfCov || i_code == fCodeCovCss ||
1796  i_code == fCodeAvMeanCorss || i_code == fCodeAvSigCorss )
1797  {fFcout_f << " ";}
1798  if(i_code == fCodeHfCor || i_code == fCodeCorCss)
1799  {fFcout_f << " ";}
1800 
1801  for (Int_t iy_c = iy_inf ; iy_c < iy_sup ; iy_c++)
1802  {
1803  if(i_code == fCodeHfCov || i_code == fCodeLfCov || i_code == fCodeCovCss ||
1804  i_code == fCodeAvMeanCorss ||
1805  i_code == fCodeAvSigCorss)
1806  {fFcout_f.width(8);}
1807  if(i_code == fCodeHfCor || i_code == fCodeLfCor || i_code == fCodeCorCss)
1808  {fFcout_f.width(6);}
1809  fFcout_f << iy_c << " ";
1810  }
1811  fFcout_f << std::endl << std::endl;
1812 
1813  for (Int_t ix_c = ix_inf ; ix_c < ix_sup ; ix_c++)
1814  {
1815  if(i_code == fCodeHfCov|| i_code == fCodeLfCov || i_code == fCodeCovCss ||
1816  i_code == fCodeAvMeanCorss ||
1817  i_code == fCodeAvSigCorss)
1818  {fFcout_f.width(8);}
1819  if(i_code == fCodeHfCor || i_code == fCodeLfCor || i_code == fCodeCorCss)
1820  {fFcout_f.width(6);}
1821  fFcout_f << ix_c << " ";
1822 
1823  for (Int_t iy_c = iy_inf ; iy_c < iy_sup ; iy_c++)
1824  {
1825  if(i_code == fCodeHfCov ||
1826  i_code == fCodeLfCov ||
1827  i_code == fCodeCovCss ||
1828  i_code == fCodeAvMeanCorss ||
1829  i_code == fCodeAvSigCorss ){
1830  fFcout_f.width(8);}
1831 
1832  if(i_code == fCodeHfCor || i_code == fCodeLfCor || i_code == fCodeCorCss){
1833  fFcout_f.width(6);}
1834 
1835  if( i_code == fCodeHfCov || i_code == fCodeLfCov || i_code == fCodeHfCor){
1836  fFcout_f << fjustap_2d_cc[ix_c][iy_c] << " ";}
1837 
1838  if ( i_code == fCodeCovCss ||
1839  i_code == fCodeCorCss ||
1840  i_code == fCodeAvMeanCorss ||
1841  i_code == fCodeAvSigCorss )
1842  {
1843  fFcout_f << fjustap_2d_ss[ix_c][iy_c] << " ";
1844  }
1845  }
1846  fFcout_f << std::endl;
1847  }
1848  fFcout_f << std::endl;
1849  }
1850  }
1851 
1852  //........... closing of the results file
1853 
1854  fFcout_f.close();
1855 
1857  {
1858  std::cout << "*TEcnaWrite::fT2dWriteAscii(....)> INFO: "
1859  << "matrix has been written in file: " << std::endl
1860  << " " << fAsciiFileName.Data() << std::endl;
1861  }
1862 
1863 }// end of TEcnaWrite::fT2dWriteAscii
1864 
1865 
1866 //=========================================================================
1867 //
1868 // ci-dessous: ===> methodes a implementer plus tard?
1869 //
1870 //=========================================================================
1871 #define WASC
1872 #ifndef WASC
1873 //------------------------------------------------------------
1874 //
1875 // Writing of the expectation values in an ASCII file
1876 //
1877 //------------------------------------------------------------
1878 
1879 void TEcnaWrite::WriteAsciiSampleMeans()
1880 {
1881 //Writing of the expectation values in an ASCII file
1882 
1883  Int_t i_code = fCodeMSp;
1884  fMakeResultsFileName(i_code);
1885  fAsciiFileWriteHeader(i_code);
1886 
1887  Int_t i_lic1 = fNbChanByLine;
1888  Int_t i_lic2 = fNbSampByLine;
1889 
1890  fT1dWriteAscii(i_code, i_lic1, i_lic2);
1891 }
1892 
1893 //-------------------------------------------------------
1894 //
1895 // Writing of the sigmas in an ASCII file
1896 //
1897 //-------------------------------------------------------
1898 
1899 void TEcnaWrite::WriteAsciiSampleSigmas()
1900 {
1901 //Writing of the variances in an ASCII file
1902 
1903  Int_t i_code = fCodeVar; // code for variance
1904  fMakeResultsFileName(i_code);
1905  fAsciiFileWriteHeader(i_code);
1906 
1907  Int_t i_lic1 = fNbChanByLine;
1908  Int_t i_lic2 = fNbSampByLine;
1909 
1910  fT1dWriteAscii(i_code, i_lic1, i_lic2);
1911 }
1912 #endif // WASC
void fAsciiFileWriteHeader(const Int_t &)
Definition: TEcnaWrite.cc:1051
Int_t fCodeHfn
Definition: TEcnaWrite.h:71
Double_t ** fjustap_2d_cc
Definition: TEcnaWrite.h:113
Int_t MaxCrysInSM()
Int_t NumberOfEventsAnalysis(Int_t **, const Int_t &, const Int_t &, const Int_t &)
Definition: TEcnaWrite.cc:520
ClassImp(TEcnaWrite)
Int_t fSectSampSizeY
Definition: TEcnaWrite.h:97
Int_t fCodeAvPed
Definition: TEcnaWrite.h:82
Int_t fStinEchaUser
Definition: TEcnaWrite.h:103
Int_t MaxCrysEcnaInDee()
void Init()
Definition: TEcnaWrite.cc:135
Int_t GetStexNumber()
Definition: TEcnaWrite.cc:392
Int_t fgMaxCar
Definition: TEcnaWrite.h:43
void WriteAsciiCovariancesBetweenSamples(const Int_t &, const Int_t &, const Int_t &, const TMatrixD &)
Definition: TEcnaWrite.cc:1405
Int_t MaxCrysVecoInStin()
void RegisterFileParameters(const TString &, const Int_t &, const Int_t &, const Int_t &, const Int_t &, const Int_t &, const Int_t &, const TString &, const TString &, const time_t, const time_t)
Definition: TEcnaWrite.cc:610
Int_t fNbSampByLine
Definition: TEcnaWrite.h:100
Double_t * fjustap_1d_ev
Definition: TEcnaWrite.h:108
TString GetDeeDirViewedFromIP(const Int_t &)
Int_t fCodePrintNoComment
Definition: TEcnaWrite.h:52
Int_t Get1DeeSCEcnaFrom0DeeEcha(const Int_t &)
TString fFlagSubDet
Definition: TEcnaWrite.h:55
Int_t fCodeHfCov
Definition: TEcnaWrite.h:89
Int_t Get1SCEchaFrom0DeeEcha(const Int_t &)
TString fStexName
Definition: TEcnaWrite.h:135
Double_t ** fjustap_2d_ev
Definition: TEcnaWrite.h:107
TString BeginningOfResultsRootFilePath()
Double_t ** fjustap_2d_var
Definition: TEcnaWrite.h:110
Double_t ** fjustap_2d_ss
Definition: TEcnaWrite.h:116
Int_t fNbChanByLine
Definition: TEcnaWrite.h:99
TEcnaParPaths * fCnaParPaths
Definition: TEcnaWrite.h:58
TString fAnaType
Definition: TEcnaWrite.h:128
Int_t fStexNumber
Definition: TEcnaWrite.h:134
void AppendResultsAsciiFilePath(const Text_t *)
TString fAsciiFileNameShort
Definition: TEcnaWrite.h:146
Int_t fStexStinUser
Definition: TEcnaWrite.h:102
TEcnaParEcal * fEcal
Definition: TEcnaWrite.h:54
Bool_t RegisterPointer(const TString &, const Long_t &)
Definition: TEcnaObject.cc:105
Int_t fRunNumber
Definition: TEcnaWrite.h:130
TString fRootFileNameShort
Definition: TEcnaWrite.h:142
TString GetAsciiFileName()
Definition: TEcnaWrite.cc:384
Int_t Get0TowEchaFrom0SMEcha(const Int_t &)
Int_t GetFirstReqEvtNumber()
Definition: TEcnaWrite.cc:390
Int_t fCdelete
Definition: TEcnaWrite.h:40
Int_t fCnew
Definition: TEcnaWrite.h:40
Int_t fUserSamp
Definition: TEcnaWrite.h:101
Int_t GetJYCrysInDee(const Int_t &, const Int_t &, const Int_t &)
Int_t fCodePed
Definition: TEcnaWrite.h:68
Int_t fCodeAvTno
Definition: TEcnaWrite.h:83
TString fRootFileName
Definition: TEcnaWrite.h:143
Int_t fCodeAvMeanCorss
Definition: TEcnaWrite.h:84
TString fTTBELL
Definition: TEcnaWrite.h:45
void SetResultsRootFilePath(const TString &)
Int_t fCodePrintAllComments
Definition: TEcnaWrite.h:52
TString BeginningOfResultsAsciiFilePath()
Int_t fCodeSigCorss
Definition: TEcnaWrite.h:73
Int_t Get1SMTowFrom0SMEcha(const Int_t &)
Int_t GetDSSCFrom1DeeSCEcna(const Int_t &, const Int_t &, const Int_t &)
Definition: value.py:1
void fT2dWriteAscii(const Int_t &, const Int_t &, const Int_t &, const Int_t &, const TMatrixD &)
Definition: TEcnaWrite.cc:1469
Int_t fFlagPrint
Definition: TEcnaWrite.h:51
Double_t * fjustap_1d_cc
Definition: TEcnaWrite.h:114
Int_t GetRunNumber()
Definition: TEcnaWrite.cc:389
Int_t fCodeRoot
Definition: TEcnaWrite.h:65
Int_t fCodeMSp
Definition: TEcnaWrite.h:79
Int_t fNbOfSamples
Definition: TEcnaWrite.h:129
Bool_t GetPathForResultsRootFiles()
Int_t GetDSFrom1DeeSCEcna(const Int_t &, const Int_t &)
TString fStopDate
Definition: TEcnaWrite.h:139
ii
Definition: cuy.py:590
Int_t GetDeeSCConsFrom1DeeSCEcna(const Int_t &, const Int_t &)
Double_t * fjustap_1d_ss
Definition: TEcnaWrite.h:117
Int_t fCodeHeaderAscii
Definition: TEcnaWrite.h:64
void WriteAsciiHisto(const TString &, const Int_t &, const TVectorD &)
Definition: TEcnaWrite.cc:1188
Int_t fFirstReqEvtNumber
Definition: TEcnaWrite.h:131
Double_t GetEta(const Int_t &, const Int_t &, const Int_t &)
Int_t Get1SMCrysFrom1SMTowAnd0TowEcha(const Int_t &, const Int_t &)
Int_t fSectChanSizeX
Definition: TEcnaWrite.h:96
Int_t GetReqNbOfEvts()
Definition: TEcnaWrite.cc:391
std::ofstream fFcout_f
Definition: TEcnaWrite.h:61
Int_t fCodeMeanCorss
Definition: TEcnaWrite.h:72
void SetEcalSubDetector(const TString &)
Definition: TEcnaWrite.cc:204
TString fStinName
Definition: TEcnaWrite.h:136
Double_t GetPhiInSM(const Int_t &, const Int_t &, const Int_t &)
void TruncateResultsRootFilePath(const Int_t &, const Int_t &)
Int_t fCodeLfCov
Definition: TEcnaWrite.h:87
Int_t fCodeTno
Definition: TEcnaWrite.h:69
Double_t * fjustap_1d_var
Definition: TEcnaWrite.h:111
TString ResultsRootFilePath()
Int_t GetCodePrint(const TString &)
Definition: TEcnaParCout.cc:70
Int_t MaxCrysEcnaInStex()
Int_t fCodeLfn
Definition: TEcnaWrite.h:70
Int_t MaxCrysHocoInStin()
Int_t fCodeAvSigCorss
Definition: TEcnaWrite.h:85
Int_t GetNbOfSamples()
Definition: TEcnaWrite.cc:388
Int_t MaxSampADC()
Int_t GetIXCrysInDee(const Int_t &, const Int_t &, const Int_t &)
TEcnaParCout * fCnaParCout
Definition: TEcnaWrite.h:59
TString fAsciiFileName
Definition: TEcnaWrite.h:145
Int_t fSectChanSizeY
Definition: TEcnaWrite.h:96
void WriteAsciiCorrelationsBetweenSamples(const Int_t &, const Int_t &, const Int_t &, const TMatrixD &)
Definition: TEcnaWrite.cc:1435
Int_t PlusMinusSMNumber(const Int_t &)
Int_t fCodeCovCss
Definition: TEcnaWrite.h:75
Int_t fCodeNbOfEvts
Definition: TEcnaWrite.h:67
time_t fStopTime
Definition: TEcnaWrite.h:140
Int_t fCodeCorCss
Definition: TEcnaWrite.h:76
TString GetRootFileNameShort()
Definition: TEcnaWrite.cc:386
Int_t fLastReqEvtNumber
Definition: TEcnaWrite.h:132
Int_t fSectSampSizeX
Definition: TEcnaWrite.h:97
Int_t fCodeLfCor
Definition: TEcnaWrite.h:88
TString GetEcalSubDetector()
TString fStartDate
Definition: TEcnaWrite.h:139
void fMakeResultsFileName()
Definition: TEcnaWrite.cc:640
void TruncateResultsAsciiFilePath(const Int_t &, const Int_t &)
TString GetRootFileName()
Definition: TEcnaWrite.cc:385
void AppendResultsRootFilePath(const Text_t *)
Int_t fCodeHfCor
Definition: TEcnaWrite.h:90
Bool_t GetPathForResultsAsciiFiles()
TString GetAnalysisName()
Definition: TEcnaWrite.cc:387
Long_t GetPointerValue(const TString &)
Definition: TEcnaObject.cc:232
Int_t fReqNbOfEvts
Definition: TEcnaWrite.h:133
TEcnaNumbering * fEcalNumbering
Definition: TEcnaWrite.h:57
~TEcnaWrite() override
Definition: TEcnaWrite.cc:17
Int_t EmptyChannelsInDeeMatrixIncompleteSCIncluded()
Int_t fCodeSSp
Definition: TEcnaWrite.h:80
time_t fStartTime
Definition: TEcnaWrite.h:140
TString ResultsAsciiFilePath()
void SetResultsAsciiFilePath(const TString &)