CMS 3D CMS Logo

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