CMS 3D CMS Logo

TEcnaHistos.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 // TEcnaHistos.cc
9 // Class creation: 18 April 2005
10 // Documentation: see TEcnaHistos.h
11 //--------------------------------------
12 
14 //______________________________________________________________________________
15 //
16 
17 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
18 //
19 // (attributes) ===> TEcnaParPaths --->|
20 // TEcnaParEcal --->|
21 // TEcnaWrite ---> TEcnaParPaths --->|
22 // TEcnaParCout --->|
23 // TEcnaParEcal --->|
24 // TEcnaNumbering ---> TEcnaParEcal --->|
25 // TEcnaParHistos ---> TEcnaParEcal --->|
26 // TEcnaNumbering ---> TEcnaParEcal --->|
27 // TEcnaNumbering ---> TEcnaParEcal --->|
28 //
29 // TEcnaRead ---> TEcnaParCout --->|
30 // TEcnaParPaths --->|
31 // TEcnaHeader --->|
32 // TEcnaParEcal --->|
33 // TEcnaWrite ---> TEcnaParPaths --->|
34 // TEcnaParCout --->|
35 // TEcnaParEcal --->|
36 // TEcnaNumbering ---> TEcnaParEcal --->|
37 // TEcnaNumbering ---> TEcnaParEcal --->|
38 //
39 //
40 // Terminal classes: TEcnaParPaths, TEcnaParEcal, TEcnaParCout, TEcnaHeader, TEcnaNArrayD,
41 // TEcnaObject, TEcnaResultType, TEcnaRootFile
42 // Non terminal classes: TEcnaGui, TEcnaHistos, TEcnaParHistos, TEcnaNumbering, TEcnaRead,
43 // TEcnaRun, TEcnaWrite
44 //
45 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
46 
48 {
49  //destructor
50 
51  if (fT1DRunNumber != nullptr){delete [] fT1DRunNumber; fCdelete++;}
52 
53  //if (fCnaParHistos != 0){delete fCnaParHistos; fCdelete++;}
54  //if (fCnaParPaths != 0){delete fCnaParPaths; fCdelete++;}
55  //if (fCnaParCout != 0){delete fCnaParCout; fCdelete++;}
56  //if (fCnaWrite != 0){delete fCnaWrite; fCdelete++;}
57  //if (fEcal != 0){delete fEcal; fCdelete++;}
58  //if (fEcalNumbering != 0){delete fEcalNumbering; fCdelete++;}
59 
60  //if (fMyRootFile != 0){delete fMyRootFile; fCdelete++;}
61  //if (fReadHistoDummy != 0){delete fReadHistoDummy; fCdelete++;}
62 
63 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
64 
65  if ( fCnew != fCdelete )
66  {
67  std::cout << "*TEcnaHistos> WRONG MANAGEMENT OF ALLOCATIONS: fCnew = "
68  << fCnew << ", fCdelete = " << fCdelete << fTTBELL << std::endl;
69  }
70  else
71  {
72  // std::cout << "*TEcnaHistos> BRAVO! GOOD MANAGEMENT OF ALLOCATIONS: fCnew = "
73  // << fCnew << ", fCdelete = " << fCdelete << std::endl;
74  }
75 
76 #define MGRA
77 #ifndef MGRA
78  if ( fCnewRoot != fCdeleteRoot )
79  {
80  std::cout << "*TEcnaHistos> WRONG MANAGEMENT OF ROOT ALLOCATIONS: fCnewRoot = "
81  << fCnewRoot << ", fCdeleteRoot = " << fCdeleteRoot << std::endl;
82  }
83  else
84  {
85  std::cout << "*TEcnaHistos> BRAVO! GOOD MANAGEMENT OF ROOT ALLOCATIONS:"
86  << " fCnewRoot = " << fCnewRoot <<", fCdeleteRoot = "
87  << fCdeleteRoot << std::endl;
88  }
89 #endif // MGRA
90 
91  // std::cout << "TEcnaHistos> Leaving destructor" << std::endl;
92  // std::cout << " fCnew = " << fCnew << ", fCdelete = " << fCdelete << std::endl;
93 
94  // std::cout << "[Info Management] CLASS: TEcnaHistos. DESTROY OBJECT: this = " << this << std::endl;
95 
96 }
97 
98 //===================================================================
99 //
100 // Constructors
101 //
102 //===================================================================
104 // Constructor without argument. Call to Init()
105 
106  // std::cout << "[Info Management] CLASS: TEcnaHistos. CREATE OBJECT: this = " << this << std::endl;
107 
108  Init();
109 }
110 
111 TEcnaHistos::TEcnaHistos(TEcnaObject* pObjectManager, const TString& SubDet)
112 {
113  // std::cout << "[Info Management] CLASS: TEcnaHistos. CREATE OBJECT: this = " << this << std::endl;
114 
115 
116  Long_t i_this = (Long_t)this;
117  pObjectManager->RegisterPointer("TEcnaHistos", i_this);
118 
119  Init();
120 
121  //----------------------- Object management
122 
123  //............................ fCnaParCout
124  fCnaParCout = nullptr;
125  Long_t iCnaParCout = pObjectManager->GetPointerValue("TEcnaParCout");
126  if( iCnaParCout == 0 )
127  {fCnaParCout = new TEcnaParCout(pObjectManager); /*fCnew++*/}
128  else
129  {fCnaParCout = (TEcnaParCout*)iCnaParCout;}
130 
131  //............................ fCnaParPaths
132  fCnaParPaths = nullptr;
133  Long_t iCnaParPaths = pObjectManager->GetPointerValue("TEcnaParPaths");
134  if( iCnaParPaths == 0 )
135  {fCnaParPaths = new TEcnaParPaths(pObjectManager); /*fCnew++*/}
136  else
137  {fCnaParPaths = (TEcnaParPaths*)iCnaParPaths;}
138 
141 
142  //............................ fEcal => to be changed in fParEcal
143  fEcal = nullptr;
144  Long_t iParEcal = pObjectManager->GetPointerValue("TEcnaParEcal");
145  if( iParEcal == 0 )
146  {fEcal = new TEcnaParEcal(pObjectManager, SubDet.Data()); /*fCnew++*/}
147  else
148  {fEcal = (TEcnaParEcal*)iParEcal;}
149 
150  //............................ fEcalNumbering
151  fEcalNumbering = nullptr;
152  Long_t iEcalNumbering = pObjectManager->GetPointerValue("TEcnaNumbering");
153  if( iEcalNumbering == 0 )
154  {fEcalNumbering = new TEcnaNumbering(pObjectManager, SubDet.Data()); /*fCnew++*/}
155  else
156  {fEcalNumbering = (TEcnaNumbering*)iEcalNumbering;}
157 
158  //............................ fCnaParHistos
159  fCnaParHistos = nullptr;
160  Long_t iCnaParHistos = pObjectManager->GetPointerValue("TEcnaParHistos");
161  if( iCnaParHistos == 0 )
162  {fCnaParHistos = new TEcnaParHistos(pObjectManager, SubDet.Data()); /*fCnew++*/}
163  else
164  {fCnaParHistos = (TEcnaParHistos*)iCnaParHistos;}
165 
166  //............................ fCnaWrite
167  fCnaWrite = nullptr;
168  Long_t iCnaWrite = pObjectManager->GetPointerValue("TEcnaWrite");
169  if( iCnaWrite == 0 )
170  {fCnaWrite = new TEcnaWrite(pObjectManager, SubDet.Data()); /*fCnew++*/}
171  else
172  {fCnaWrite = (TEcnaWrite*)iCnaWrite;}
173 
174  //............................ fMyRootFile
175  fMyRootFile = nullptr;
176  Long_t iMyRootFile = pObjectManager->GetPointerValue("TEcnaRead");
177  if( iMyRootFile == 0 )
178  {fMyRootFile = new TEcnaRead(pObjectManager, SubDet.Data()); /*fCnew++*/}
179  else
180  {fMyRootFile = (TEcnaRead*)iMyRootFile;}
181 
183 
184  //------------------- creation objet TEcnaRead fMyRootFile (a reprendre plus clairement)
185  //fFileHeader = 0;
186  //fMyRootFile = new TEcnaRead(fFlagSubDet.Data(), fCnaParPaths, fCnaParCout,
187  // fFileHeader, fEcalNumbering, fCnaWrite); fCnew++;
188  //fMyRootFile->PrintNoComment();
189 
190 
191  SetEcalSubDetector(SubDet.Data());
192  //......... init ymin,ymax histos -> Default values for Ymin and Ymax
194 }
195 
196 
198 {
199 //========================= GENERAL INITIALISATION
200  fCnew = 0;
201  fCdelete = 0;
202  fCnewRoot = 0;
203  fCdeleteRoot = 0;
204 
205  fCnaCommand = 0;
206  fCnaError = 0;
207 
208  //------------------------------ initialisations ----------------------
209  fTTBELL = '\007';
210 
211  fT1DRunNumber = nullptr;
212 
213  //.......... init flags Same plot
231  //.......... init flags colors (Init)
249 
250  //.......... init counter Same canvas
268  //................. Flag Scale X anf Y set to "LIN" and flag color palete set to "Black/Red/Blue"
269 
270  fFlagScaleX.Resize(charArrLen);
271  fFlagScaleX = "LIN";
272 
273  fFlagScaleY.Resize(charArrLen);
274  fFlagScaleY = "LIN";
275 
276  fFlagColPal.Resize(charArrLen);
277  fFlagColPal = "Black/Red/Blue";
278 
279  //................. Flag General Title set to empty string
281  fFlagGeneralTitle = "";
282 
283  //................. Init codes Options
284  fOptScaleLinx = 31400;
285  fOptScaleLogx = 31401;
286  fOptScaleLiny = 31402;
287  fOptScaleLogy = 31403;
288 
289  fOptVisLine = 1101;
290  fOptVisPolm = 1102;
291 
292  //............................ (Init)
294  fCovarianceMatrix = "Cov";
296  fCorrelationMatrix = "Cor";
297 
298  fLFBetweenStins.Resize(charArrLen);
299  fLFBetweenStins = "MttLF";
300  fHFBetweenStins.Resize(charArrLen);
301  fHFBetweenStins = "MttHF";
302 
304  fLFBetweenChannels = "MccLF";
306  fHFBetweenChannels = "MccHF";
307 
308  fBetweenSamples.Resize(charArrLen);
309  fBetweenSamples = "Mss";
310 
311  //.................................. text pave alignement for pave "SeveralChanging" (HistimePlot)
312  fTextPaveAlign = 12; // 1 = left adjusted, 2 = vertically centered
313  fTextPaveFont = 100; // 10*10 = 10*(ID10 = Courier New)
314  fTextPaveSize = (Float_t)0.025; // 0.0xxx = xxx% of the pave size
315  fTextBorderSize = 1; // Pave Border (=>Shadow)
316 
317  //................................. Init Xvar, Yvar, NbBins management for options SAME and SAME n
318  fXMemoH1SamePlus = "";
319  fXMemoD_NOE_ChNb = "";
320  fXMemoD_NOE_ChDs = "";
321  fXMemoD_Ped_ChNb = "";
322  fXMemoD_Ped_ChDs = "";
323  fXMemoD_TNo_ChNb = "";
324  fXMemoD_TNo_ChDs = "";
325  fXMemoD_MCs_ChNb = "";
326  fXMemoD_MCs_ChDs = "";
327  fXMemoD_LFN_ChNb = "";
328  fXMemoD_LFN_ChDs = "";
329  fXMemoD_HFN_ChNb = "";
330  fXMemoD_HFN_ChDs = "";
331  fXMemoD_SCs_ChNb = "";
332  fXMemoD_SCs_ChDs = "";
333  fXMemoD_MSp_SpNb = "";
334  fXMemoD_MSp_SpDs = "";
335  fXMemoD_SSp_SpNb = "";
336  fXMemoD_SSp_SpDs = "";
337  fXMemoD_Adc_EvDs = "";
338  fXMemoD_Adc_EvNb = "";
339  fXMemoH_Ped_Date = "";
340  fXMemoH_TNo_Date = "";
341  fXMemoH_MCs_Date = "";
342  fXMemoH_LFN_Date = "";
343  fXMemoH_HFN_Date = "";
344  fXMemoH_SCs_Date = "";
345  fXMemoH_Ped_RuDs = "";
346  fXMemoH_TNo_RuDs = "";
347  fXMemoH_MCs_RuDs = "";
348  fXMemoH_LFN_RuDs = "";
349  fXMemoH_HFN_RuDs = "";
350  fXMemoH_SCs_RuDs = "";
351 
352  fYMemoH1SamePlus = "";
353  fYMemoD_NOE_ChNb = "";
354  fYMemoD_NOE_ChDs = "";
355  fYMemoD_Ped_ChNb = "";
356  fYMemoD_Ped_ChDs = "";
357  fYMemoD_TNo_ChNb = "";
358  fYMemoD_TNo_ChDs = "";
359  fYMemoD_MCs_ChNb = "";
360  fYMemoD_MCs_ChDs = "";
361  fYMemoD_LFN_ChNb = "";
362  fYMemoD_LFN_ChDs = "";
363  fYMemoD_HFN_ChNb = "";
364  fYMemoD_HFN_ChDs = "";
365  fYMemoD_SCs_ChNb = "";
366  fYMemoD_SCs_ChDs = "";
367  fYMemoD_MSp_SpNb = "";
368  fYMemoD_MSp_SpDs = "";
369  fYMemoD_SSp_SpNb = "";
370  fYMemoD_SSp_SpDs = "";
371  fYMemoD_Adc_EvDs = "";
372  fYMemoD_Adc_EvNb = "";
373  fYMemoH_Ped_Date = "";
374  fYMemoH_TNo_Date = "";
375  fYMemoH_MCs_Date = "";
376  fYMemoH_LFN_Date = "";
377  fYMemoH_HFN_Date = "";
378  fYMemoH_SCs_Date = "";
379  fYMemoH_Ped_RuDs = "";
380  fYMemoH_TNo_RuDs = "";
381  fYMemoH_MCs_RuDs = "";
382  fYMemoH_LFN_RuDs = "";
383  fYMemoH_HFN_RuDs = "";
384  fYMemoH_SCs_RuDs = "";
385 
419 
420  //.................................. Init canvas/pad pointers (Init)
421  fCurrentCanvas = nullptr;
422 
423  fCurrentCanvasName = "?";
424 
425  fCanvH1SamePlus = nullptr;
426  fCanvD_NOE_ChNb = nullptr;
427  fCanvD_NOE_ChDs = nullptr;
428  fCanvD_Ped_ChNb = nullptr;
429  fCanvD_Ped_ChDs = nullptr;
430  fCanvD_TNo_ChNb = nullptr;
431  fCanvD_TNo_ChDs = nullptr;
432  fCanvD_MCs_ChNb = nullptr;
433  fCanvD_MCs_ChDs = nullptr;
434  fCanvD_LFN_ChNb = nullptr;
435  fCanvD_LFN_ChDs = nullptr;
436  fCanvD_HFN_ChNb = nullptr;
437  fCanvD_HFN_ChDs = nullptr;
438  fCanvD_SCs_ChNb = nullptr;
439  fCanvD_SCs_ChDs = nullptr;
440  fCanvD_MSp_SpNb = nullptr;
441  fCanvD_MSp_SpDs = nullptr;
442  fCanvD_SSp_SpNb = nullptr;
443  fCanvD_SSp_SpDs = nullptr;
444  fCanvD_Adc_EvDs = nullptr;
445  fCanvD_Adc_EvNb = nullptr;
446  fCanvH_Ped_Date = nullptr;
447  fCanvH_TNo_Date = nullptr;
448  fCanvH_MCs_Date = nullptr;
449  fCanvH_LFN_Date = nullptr;
450  fCanvH_HFN_Date = nullptr;
451  fCanvH_SCs_Date = nullptr;
452  fCanvH_Ped_RuDs = nullptr;
453  fCanvH_TNo_RuDs = nullptr;
454  fCanvH_MCs_RuDs = nullptr;
455  fCanvH_LFN_RuDs = nullptr;
456  fCanvH_HFN_RuDs = nullptr;
457  fCanvH_SCs_RuDs = nullptr;
458 
459 
460  fClosedH1SamePlus = kFALSE; // (Canvas Closed SIGNAL)
461  fClosedD_NOE_ChNb = kFALSE;
462  fClosedD_NOE_ChDs = kFALSE;
463  fClosedD_Ped_ChNb = kFALSE;
464  fClosedD_Ped_ChDs = kFALSE;
465  fClosedD_TNo_ChNb = kFALSE;
466  fClosedD_TNo_ChDs = kFALSE;
467  fClosedD_MCs_ChNb = kFALSE;
468  fClosedD_MCs_ChDs = kFALSE;
469  fClosedD_LFN_ChNb = kFALSE;
470  fClosedD_LFN_ChDs = kFALSE;
471  fClosedD_HFN_ChNb = kFALSE;
472  fClosedD_HFN_ChDs = kFALSE;
473  fClosedD_SCs_ChNb = kFALSE;
474  fClosedD_SCs_ChDs = kFALSE;
475  fClosedD_MSp_SpNb = kFALSE;
476  fClosedD_MSp_SpDs = kFALSE;
477  fClosedD_SSp_SpNb = kFALSE;
478  fClosedD_SSp_SpDs = kFALSE;
479  fClosedD_Adc_EvDs = kFALSE;
480  fClosedD_Adc_EvNb = kFALSE;
481  fClosedH_Ped_Date = kFALSE;
482  fClosedH_TNo_Date = kFALSE;
483  fClosedH_MCs_Date = kFALSE;
484  fClosedH_LFN_Date = kFALSE;
485  fClosedH_HFN_Date = kFALSE;
486  fClosedH_SCs_Date = kFALSE;
487  fClosedH_Ped_RuDs = kFALSE;
488  fClosedH_TNo_RuDs = kFALSE;
489  fClosedH_MCs_RuDs = kFALSE;
490  fClosedH_LFN_RuDs = kFALSE;
491  fClosedH_HFN_RuDs = kFALSE;
492  fClosedH_SCs_RuDs = kFALSE;
493 
494  fCurrentPad = nullptr; // (Init)
495 
496  fPadH1SamePlus = nullptr;
497  fPadD_NOE_ChNb = nullptr;
498  fPadD_NOE_ChDs = nullptr;
499  fPadD_Ped_ChNb = nullptr;
500  fPadD_Ped_ChDs = nullptr;
501  fPadD_TNo_ChNb = nullptr;
502  fPadD_TNo_ChDs = nullptr;
503  fPadD_MCs_ChNb = nullptr;
504  fPadD_MCs_ChDs = nullptr;
505  fPadD_LFN_ChNb = nullptr;
506  fPadD_LFN_ChDs = nullptr;
507  fPadD_HFN_ChNb = nullptr;
508  fPadD_HFN_ChDs = nullptr;
509  fPadD_SCs_ChNb = nullptr;
510  fPadD_SCs_ChDs = nullptr;
511  fPadD_MSp_SpNb = nullptr;
512  fPadD_MSp_SpDs = nullptr;
513  fPadD_SSp_SpNb = nullptr;
514  fPadD_SSp_SpDs = nullptr;
515  fPadD_Adc_EvDs = nullptr;
516  fPadD_Adc_EvNb = nullptr;
517  fPadH_Ped_Date = nullptr;
518  fPadH_TNo_Date = nullptr;
519  fPadH_MCs_Date = nullptr;
520  fPadH_LFN_Date = nullptr;
521  fPadH_HFN_Date = nullptr;
522  fPadH_SCs_Date = nullptr;
523  fPadH_Ped_RuDs = nullptr;
524  fPadH_TNo_RuDs = nullptr;
525  fPadH_MCs_RuDs = nullptr;
526  fPadH_LFN_RuDs = nullptr;
527  fPadH_HFN_RuDs = nullptr;
528  fPadH_SCs_RuDs = nullptr;
529 
530  fPavTxtH1SamePlus = nullptr; // (Init)
531  fPavTxtD_NOE_ChNb = nullptr;
532  fPavTxtD_NOE_ChDs = nullptr;
533  fPavTxtD_Ped_ChNb = nullptr;
534  fPavTxtD_Ped_ChDs = nullptr;
535  fPavTxtD_TNo_ChNb = nullptr;
536  fPavTxtD_TNo_ChDs = nullptr;
537  fPavTxtD_MCs_ChNb = nullptr;
538  fPavTxtD_MCs_ChDs = nullptr;
539  fPavTxtD_LFN_ChNb = nullptr;
540  fPavTxtD_LFN_ChDs = nullptr;
541  fPavTxtD_HFN_ChNb = nullptr;
542  fPavTxtD_HFN_ChDs = nullptr;
543  fPavTxtD_SCs_ChNb = nullptr;
544  fPavTxtD_SCs_ChDs = nullptr;
545  fPavTxtD_MSp_SpNb = nullptr;
546  fPavTxtD_MSp_SpDs = nullptr;
547  fPavTxtD_SSp_SpNb = nullptr;
548  fPavTxtD_SSp_SpDs = nullptr;
549  fPavTxtD_Adc_EvDs = nullptr;
550  fPavTxtD_Adc_EvNb = nullptr;
551  fPavTxtH_Ped_Date = nullptr;
552  fPavTxtH_TNo_Date = nullptr;
553  fPavTxtH_MCs_Date = nullptr;
554  fPavTxtH_LFN_Date = nullptr;
555  fPavTxtH_HFN_Date = nullptr;
556  fPavTxtH_SCs_Date = nullptr;
557  fPavTxtH_Ped_RuDs = nullptr;
558  fPavTxtH_TNo_RuDs = nullptr;
559  fPavTxtH_MCs_RuDs = nullptr;
560  fPavTxtH_LFN_RuDs = nullptr;
561  fPavTxtH_HFN_RuDs = nullptr;
562  fPavTxtH_SCs_RuDs = nullptr;
563 
564  fImpH1SamePlus = nullptr; // (Init)
565  fImpD_NOE_ChNb = nullptr;
566  fImpD_NOE_ChDs = nullptr;
567  fImpD_Ped_ChNb = nullptr;
568  fImpD_Ped_ChDs = nullptr;
569  fImpD_TNo_ChNb = nullptr;
570  fImpD_TNo_ChDs = nullptr;
571  fImpD_MCs_ChNb = nullptr;
572  fImpD_MCs_ChDs = nullptr;
573  fImpD_LFN_ChNb = nullptr;
574  fImpD_LFN_ChDs = nullptr;
575  fImpD_HFN_ChNb = nullptr;
576  fImpD_HFN_ChDs = nullptr;
577  fImpD_SCs_ChNb = nullptr;
578  fImpD_SCs_ChDs = nullptr;
579  fImpD_MSp_SpNb = nullptr;
580  fImpD_MSp_SpDs = nullptr;
581  fImpD_SSp_SpNb = nullptr;
582  fImpD_SSp_SpDs = nullptr;
583  fImpD_Adc_EvDs = nullptr;
584  fImpD_Adc_EvNb = nullptr;
585  fImpH_Ped_Date = nullptr;
586  fImpH_TNo_Date = nullptr;
587  fImpH_MCs_Date = nullptr;
588  fImpH_LFN_Date = nullptr;
589  fImpH_HFN_Date = nullptr;
590  fImpH_SCs_Date = nullptr;
591  fImpH_Ped_RuDs = nullptr;
592  fImpH_TNo_RuDs = nullptr;
593  fImpH_MCs_RuDs = nullptr;
594  fImpH_LFN_RuDs = nullptr;
595  fImpH_HFN_RuDs = nullptr;
596  fImpH_SCs_RuDs = nullptr;
597 
598  fNbBinsProj = 100; // number of bins for histos in option Projection
599 
600  //.................................... Miscellaneous parameters (Init)
601 
608 
615 
616  fNbOfExistingRuns = 0;
617 
618  fFapNbOfRuns = -1; // INIT NUMBER OF RUNS: set to -1
619  fFapMaxNbOfRuns = -1; // INIT MAXIMUM NUMBER OF RUNS: set to -1
620 
621  fFapFileRuns.Resize(charArrLen);
622  fFapFileRuns = "(file with list of runs parameters: no info)";
623 
624  fStartEvolTime = 0;
625  fStopEvolTime = 0;
626  fStartEvolDate = "Start date: not known";
627  fStopEvolDate = "Stop date: not known";
628 
629  fStartEvolRun = 0;
630  fStopEvolRun = 0;
631 
632  fRunType = "Run type: not known";
633 
634  fFapNbOfEvts = 0;
635 
636  fMyRootFileName.Resize(charArrLen);
637  fMyRootFileName = "No ROOT file name available (fMyRootFileName).";
638 
639  fFapAnaType = "Analysis name: not known"; // Init Type of analysis
640  fFapNbOfSamples = 0; // Init Nb of required samples
641  fFapRunNumber = 0; // Init Run number
642  fFapFirstReqEvtNumber = 0; // Init First requested event number
643  fFapLastReqEvtNumber = 0; // Init Last requested event number
644  fFapReqNbOfEvts = 0; // Init Requested number of events
645  fFapStexNumber = 0; // Init Stex number
646 
647  //------------------ Init read file flags
648  fAlreadyRead = 1;
649  fMemoAlreadyRead = 0;
650  fTobeRead = 0;
651  fZerv = 0;
652  fUnev = 1;
653  TVectorD fReadHistoDummy(fUnev);
654  TMatrixD fReadMatrixDummy(fUnev, fUnev);
655 
656  //------------------ Init fAsciiFileName
657  fAsciiFileName = "?";
658 
659 } // end of Init()
660 
661 //----------------------------------------------------------------------------------------
663 {
664  // Set Subdetector (EB or EE)
665 
666  fFlagSubDet.Resize(charArrLen);
667  fFlagSubDet = fEcal->GetEcalSubDetector(); // fFlagSubDet = "EB" or "EE"
668 
669  //.................................. Init specific EB/EE parameters ( SetEcalSubDetector(...) )
670  fFapStexName.Resize(charArrLen);
671  fFapStexName = "no info for Stex";
672  fFapStinName.Resize(charArrLen);
673  fFapStinName = "no info for Stin";
674  fFapXtalName.Resize(charArrLen);
675  fFapXtalName = "no info for Xtal";
676  fFapEchaName.Resize(charArrLen);
677  fFapEchaName = "no info for Echa";
678 
679  if( fFlagSubDet == "EB" )
680  {
681  fFapStexName = "SM";
682  fFapStinName = "Tower";
683  fFapXtalName = "Xtal";
684  fFapEchaName = "Chan";
686  }
687 
688  if( fFlagSubDet == "EE" )
689  {
690  fFapStexName = "Dee";
691  fFapStinName = "SC";
692  fFapXtalName = "Xtal";
693  fFapEchaName = "Chan";
695  fFapStexDir = "right";
696  fFapStinQuadType = "top";
697  }
698 
699  //........................ init code plot type (SetEcalSubDetector)
700  fOnlyOnePlot.Resize(charArrLen);
702 
703  fSeveralPlot.Resize(charArrLen);
705 
706  fSameOnePlot.Resize(charArrLen);
708 
711 
713 
714 } // ---------------- end of SetEcalSubDetector(...) ----------------
715 
716 //--------------------------------------------------------------------------------------------
717 //
718 // FileParameters(s)(...)
719 //
720 //--------------------------------------------------------------------------------------------
721 
722 //===> DON'T SUPPRESS: THESE METHODS ARE CALLED BY TEcnaGui and can be called by any other program
723 void TEcnaHistos::FileParameters(const TString& xArgAnaType, const Int_t& xArgNbOfSamples,
724  const Int_t& xArgRunNumber, const Int_t& xArgFirstReqEvtNumber,
725  const Int_t& xArgLastReqEvtNumber, const Int_t& xArgReqNbOfEvts,
726  const Int_t& xArgStexNumber)
727 {
728 // Set parameters for reading the right ECNA results file
729 
730  fFapAnaType = xArgAnaType;
731  fFapNbOfSamples = xArgNbOfSamples;
732  fFapRunNumber = xArgRunNumber;
733  fFapFirstReqEvtNumber = xArgFirstReqEvtNumber;
734  fFapLastReqEvtNumber = xArgLastReqEvtNumber;
735  fFapReqNbOfEvts = xArgReqNbOfEvts;
736  fFapStexNumber = xArgStexNumber;
737 
738  InitSpecParBeforeFileReading(); // SpecPar = Special Parameters (dates, times, run types)
739 }
740 
742 {
743 // Set parameters for reading the right ECNA results file
744 
745  InitSpecParBeforeFileReading(); // SpecPar = Special Parameters (dates, times, run types)
746 
747  //............... Filename parameter values
748  fFapAnaType = MyRootFile->GetAnalysisName();
749  fFapNbOfSamples = MyRootFile->GetNbOfSamples();
750  fFapRunNumber = MyRootFile->GetRunNumber();
753  fFapReqNbOfEvts = MyRootFile->GetReqNbOfEvts();
754  fFapStexNumber = MyRootFile->GetStexNumber();
755 
756  //............... parameter values from file contents
757  fStartDate = MyRootFile->GetStartDate();
758  fStopDate = MyRootFile->GetStopDate();
759  fRunType = MyRootFile->GetRunType();
760 
762 }
763 
764 //=============================================================================================
765 // Set general title
766 // Set lin or log scale on X or Y axis
767 // Set color palette
768 // Set start and stop date
769 // Set run type
770 //=============================================================================================
771 //............................................................................................
772 void TEcnaHistos::GeneralTitle(const TString& title)
773 {
774  fFlagGeneralTitle = title.Data();
775 }
776 void TEcnaHistos::SetHistoScaleX(const TString& option_scale)
777 {
778  fFlagScaleX = "LIN";
779  if ( option_scale == "LOG" ){fFlagScaleX = "LOG";}
780 }
781 void TEcnaHistos::SetHistoScaleY(const TString& option_scale)
782 {
783  fFlagScaleY = "LIN";
784  if ( option_scale == "LOG" ){fFlagScaleY = "LOG";}
785 }
786 void TEcnaHistos::SetHistoColorPalette (const TString& option_palette)
787 {
788  fFlagColPal = "Black/Red/Blue";
789  if ( !(option_palette == "Rainbow" || option_palette == "rainbow") ){fFlagColPal = "Black/Red/Blue";}
790  if ( option_palette == "Rainbow" || option_palette == "rainbow" ){fFlagColPal = "Rainbow";}
791 }
792 void TEcnaHistos::StartStopDate(const TString& start_date, const TString& stop_date)
793 {
794  fStartDate = start_date.Data();
795  fStopDate = stop_date.Data();
796 }
797 void TEcnaHistos::RunType(const TString& run_type)
798 {
799  fRunType = run_type.Data();
800 }
801 void TEcnaHistos::NumberOfEvents(const Int_t& nb_of_evts)
802 {
803  fFapNbOfEvts = nb_of_evts;
804 }
805 //====================== return status for root file and data existence
808 
809 //=======================================================================================
810 //
811 // ( R e a d A n d ) P l o t (1D , 2D , History)
812 //
813 //=======================================================================================
814 //---------------------------------------------------------------------------------------------
815 // TechHistoCode list modification (06/10/09)
816 //
817 // D = Detector Plot ChNb = Channel Number
818 // ChDs = Channel Distribution (Y projection)
819 //
820 // H = History Plot Date = date in format YYMMJJ hhmmss
821 // RuDs = Run distribution
822 //
823 // old code new code std code X std code Y (std = standard)
824 //
825 // * 1 H1NbOfEvtsGlobal D_NOE_ChNb Xtal NOE NOE = Number Of Events
826 // * 2 H1NbOfEvtsProj D_NOE_ChDs NOE NOX NOX = Number Of Xtals
827 // * 3 H1EvEvGlobal D_Ped_ChNb Xtal Ped Ped = Pedestal
828 // * 4 H1EvEvProj D_Ped_ChDs Ped NOX
829 // * 5 H1EvSigGlobal D_TNo_ChNb Xtal TNo TNo = Total Noise
830 // * 6 H1EvSigProj D_TNo_ChDs TNo NOX
831 // * 7 H1SigEvGlobal D_LFN_ChNb Xtal LFN LFN = Low Frequency noise
832 // * 8 H1SigEvProj D_LFN_ChDs LFN NOX
833 // * 9 H1SigSigGlobal D_HFN_ChNb Xtal HFN HFN = High Frequency noise
834 // * 10 H1SigSigProj D_HFN_ChDs HFN NOX
835 // * 11 H1EvCorssGlobal D_MCs_ChNb Xtal MCs MCs = Mean correlations between samples
836 // * 12 H1EvCorssProj D_MCs_ChDs MCs NOX
837 // * 13 H1SigCorssGlobal D_SCs_ChNb Xtal SCs SCs = Sigma of the correlations between samples
838 // * 14 H1SigCorssProj D_SCs_ChDs SCs NOX
839 // * 15 Ev D_MSp_SpNb Sample MSp MSp = Means of the samples
840 // * 16 EvProj D_MSp_SpDs MSp NOS NOS = Number of samples
841 // * 17 Sigma D_SSp_SpNb Sample SSp SSp = Sigmas of the samples
842 // * 18 SigmaProj D_SSp_SpDs SSp NOS
843 // * 19 SampTime D_Adc_EvNb Event Adc Adc = ADC count as a function of Event number
844 // * 20 AdcProj D_Adc_EvDs Adc NOE EvDs = Event distribution
845 // * 21 EvolEvEv H_Ped_Date Time Ped Time = date YY/MM/DD hh:mm:ss
846 // * 22 EvolEvEvProj H_Ped_RuDs Ped NOR NOR = Number Of Runs
847 // * 23 EvolEvSig H_TNo_Date Time TNo
848 // * 24 EvolEvSigProj H_TNo_RuDs TNo NOR
849 // * 25 EvolSigEv H_LFN_Date Time LFN
850 // * 26 EvolSigEvProj H_LFN_RuDs LFN NOR
851 // * 27 EvolSigSig H_HFN_Date Time HFN
852 // * 28 EvolSigSigProj H_HFN_RuDs HFN NOR
853 // * 29 EvolEvCorss H_MCs_Date Time MCs
854 // * 30 EvolEvCorssProj H_MCs_RuDs MCs NOR
855 // * 31 EvolSigCorss H_SCs_Date Time SCs
856 // * 32 EvolSigCorssProj H_SCs_RuDs SCs NOR
857 //
858 //---------------------------------------------------------------------------------------------
859 
860 //---------------------------------------------------------------------------------------
861 //
862 // (ReadAnd)PlotMatrix
863 //
864 //---------------------------------------------------------------------------------------
865 //................................ Corcc[for 1 Stex] (big matrix), Cortt[for 1 Stex]
866 void TEcnaHistos::PlotMatrix(const TMatrixD& read_matrix_corcc,
867  const TString& UserCorOrCov, const TString& UserBetweenWhat)
868 {PlotMatrix(read_matrix_corcc, UserCorOrCov, UserBetweenWhat, "");}
869 
870 void TEcnaHistos::PlotMatrix(const TMatrixD& read_matrix_corcc,
871  const TString& UserCorOrCov, const TString& UserBetweenWhat,
872  const TString& UserPlotOption)
873 {
874  TString CallingMethod = "2D";
875 
876  TString StandardPlotOption = fCnaParHistos->BuildStandardPlotOption(CallingMethod, UserPlotOption);
877 
878  TString BetweenWhat = fCnaParHistos->BuildStandardBetweenWhatCode(CallingMethod, UserBetweenWhat);
879  TString CorOrCov = fCnaParHistos->BuildStandardCovOrCorCode(CallingMethod, UserCorOrCov);
880 
881  if( BetweenWhat != "?" && CorOrCov != "?" )
882  {
883  if( BetweenWhat == "MttLF" || BetweenWhat == "MttHF" )
884  {
885  fAlreadyRead = 1;
886  ViewMatrix(read_matrix_corcc, fAlreadyRead,
887  fZerv, fZerv, fZerv, CorOrCov, BetweenWhat, StandardPlotOption);
888  }
889  if( BetweenWhat == "MccLF" ){StexHocoVecoLHFCorcc("LF");} // forced to Read file and Plot
890  if( BetweenWhat == "MccHF" ){StexHocoVecoLHFCorcc("HF");} // forced to Read file and Plot
891  }
892  else
893  {fFlagUserHistoMin = "OFF"; fFlagUserHistoMax = "OFF";
894  std::cout << "!TEcnaHistos::PlotMatrix(...)> Histo cannot be reached." << fTTBELL << std::endl;}
895 }
896 
897 void TEcnaHistos::PlotMatrix(const TString& UserCorOrCov, const TString& UserBetweenWhat)
898 {PlotMatrix(UserCorOrCov, UserBetweenWhat, "");}
899 
900 void TEcnaHistos::PlotMatrix(const TString& UserCorOrCov, const TString& UserBetweenWhat,
901  const TString& UserPlotOption)
902 {
903  TString CallingMethod = "2D";
904 
905  TString StandardPlotOption = fCnaParHistos->BuildStandardPlotOption(CallingMethod, UserPlotOption);
906 
907  TString BetweenWhat = fCnaParHistos->BuildStandardBetweenWhatCode(CallingMethod, UserBetweenWhat);
908  TString CorOrCov = fCnaParHistos->BuildStandardCovOrCorCode(CallingMethod, UserCorOrCov);
909 
910  if( BetweenWhat != "?" && CorOrCov != "?" )
911  {
912  if( BetweenWhat == "MttLF" || BetweenWhat == "MttHF" )
913  {
915  fZerv, fZerv, fZerv, CorOrCov, BetweenWhat, StandardPlotOption);
916  }
917  if( BetweenWhat == "MccLF" ){StexHocoVecoLHFCorcc("LF");} // Plot only
918  if( BetweenWhat == "MccHF" ){StexHocoVecoLHFCorcc("HF");} // Plot only
919  }
920  else
921  {fFlagUserHistoMin = "OFF"; fFlagUserHistoMax = "OFF";
922  std::cout << "!TEcnaHistos::PlotMatrix(...)> Histo cannot be reached." << fTTBELL << std::endl;}
923 }
924 
925 //....................................... Corcc for channels (cStexStin_A, cStexStin_B)
926 // Corss, Covss for one channel (-> i0StinEcha)
927 void TEcnaHistos::PlotMatrix(const TMatrixD& read_matrix,
928  const TString& UserCorOrCov, const TString& UserBetweenWhat,
929  const Int_t& arg_n1, const Int_t& arg_n2)
930 {PlotMatrix(read_matrix, UserCorOrCov, UserBetweenWhat, arg_n1, arg_n2, "");}
931 
932 void TEcnaHistos::PlotMatrix(const TMatrixD& read_matrix,
933  const TString& UserCorOrCov, const TString& UserBetweenWhat,
934  const Int_t& arg_n1, const Int_t& arg_n2,
935  const TString& UserPlotOption)
936 {
937  TString CallingMethod = "2D";
938 
939  TString StandardPlotOption = fCnaParHistos->BuildStandardPlotOption(CallingMethod, UserPlotOption);
940 
941  TString BetweenWhat = fCnaParHistos->BuildStandardBetweenWhatCode(CallingMethod, UserBetweenWhat);
942  TString CorOrCov = fCnaParHistos->BuildStandardCovOrCorCode(CallingMethod, UserCorOrCov);
943 
944  if( BetweenWhat != "?" && CorOrCov != "?" )
945  {
946  if( BetweenWhat == "MccLF" || BetweenWhat == "MccHF" )
947  {
948  Int_t cStexStin_A = arg_n1;
949  Int_t cStexStin_B = arg_n2;
950  fAlreadyRead = 1;
951  ViewMatrix(read_matrix, fAlreadyRead,
952  cStexStin_A, cStexStin_B, fZerv, CorOrCov, BetweenWhat, StandardPlotOption);
953  }
954 
955  if( BetweenWhat == "Mss" )
956  {
957  Int_t n1StexStin = arg_n1;
958  Int_t i0StinEcha = arg_n2;
959  if( fFlagSubDet == "EE" ){n1StexStin = fEcalNumbering->Get1DeeSCEcnaFromDeeSCCons(fFapStexNumber, arg_n1);}
960  fAlreadyRead = 1;
961  ViewMatrix(read_matrix, fAlreadyRead,
962  n1StexStin, fZerv, i0StinEcha, CorOrCov, BetweenWhat, StandardPlotOption);
963  }
964  }
965  else
966  {fFlagUserHistoMin = "OFF"; fFlagUserHistoMax = "OFF";
967  std::cout << "!TEcnaHistos::PlotMatrix(...)> Histo cannot be reached." << fTTBELL << std::endl;}
968 }
969 
970 void TEcnaHistos::PlotMatrix(const TString& UserCorOrCov, const TString& UserBetweenWhat,
971  const Int_t& arg_n1, const Int_t& arg_n2)
972 {PlotMatrix(UserCorOrCov, UserBetweenWhat, arg_n1, arg_n2, "");}
973 
974 void TEcnaHistos::PlotMatrix(const TString& UserCorOrCov, const TString& UserBetweenWhat,
975  const Int_t& arg_n1, const Int_t& arg_n2,
976  const TString& UserPlotOption)
977 {
978  TString CallingMethod = "2D";
979 
980  TString StandardPlotOption = fCnaParHistos->BuildStandardPlotOption(CallingMethod, UserPlotOption);
981 
982  TString StandardBetweenWhat = fCnaParHistos->BuildStandardBetweenWhatCode(CallingMethod, UserBetweenWhat);
983  TString StandardCorOrCov = fCnaParHistos->BuildStandardCovOrCorCode(CallingMethod, UserCorOrCov);
984 
985  if( StandardBetweenWhat != "?" && StandardCorOrCov != "?" )
986  {
987  if( StandardBetweenWhat == "MccLF" || StandardBetweenWhat == "MccHF" )
988  {
989  Int_t cStexStin_A = arg_n1;
990  Int_t cStexStin_B = arg_n2;
992  cStexStin_A, cStexStin_B, fZerv, StandardCorOrCov, StandardBetweenWhat, StandardPlotOption);
993  }
994 
995  if( StandardBetweenWhat == "Mss" )
996  {
997  Int_t n1StexStin = arg_n1;
998  Int_t i0StinEcha = arg_n2;
999  if( fFlagSubDet == "EE" ){n1StexStin = fEcalNumbering->Get1DeeSCEcnaFromDeeSCCons(fFapStexNumber, arg_n1);}
1000 
1002  n1StexStin, fZerv, i0StinEcha, StandardCorOrCov, StandardBetweenWhat, StandardPlotOption);
1003  }
1004  }
1005  else
1006  {fFlagUserHistoMin = "OFF"; fFlagUserHistoMax = "OFF";
1007  std::cout << "!TEcnaHistos::PlotMatrix(...)> Histo cannot be reached." << fTTBELL << std::endl;}
1008 }
1009 
1010 //---------------------------------------------------------------------------------------
1011 //
1012 // (ReadAnd)PlotDetector
1013 //
1014 //---------------------------------------------------------------------------------------
1015 //.................................... 2D plots for Stex OR Stas
1016 void TEcnaHistos::PlotDetector(const TString& UserHistoCode, const TString& UserDetector)
1017 {
1018  TString CallingMethod = "2DS";
1019 
1020  TString StandardHistoCode = fCnaParHistos->BuildStandard1DHistoCodeY(CallingMethod, UserHistoCode);
1021  if( StandardHistoCode != "?" )
1022  {
1023  TString TechHistoCode = fCnaParHistos->GetTechHistoCode(StandardHistoCode);
1024  TString StandardDetectorCode = fCnaParHistos->BuildStandardDetectorCode(UserDetector);
1025  if( StandardDetectorCode != "?" )
1026  {
1027  //if( StandardDetectorCode == "SM" || StandardDetectorCode == "EB" )
1028  // {fEcal->SetEcalSubDetector("EB");}
1029  //if( StandardDetectorCode == "Dee" || StandardDetectorCode == "EE" )
1030  // {fEcal->SetEcalSubDetector("EE");}
1031 
1032  if( StandardDetectorCode == "SM" || StandardDetectorCode == "Dee" )
1033  {ViewStex(fReadHistoDummy, fTobeRead, TechHistoCode);}
1034  if( StandardDetectorCode == "EB" || StandardDetectorCode == "EE" )
1035  {ViewStas(fReadHistoDummy, fTobeRead, TechHistoCode);}
1036  }
1037  else
1038  {fFlagUserHistoMin = "OFF"; fFlagUserHistoMax = "OFF";
1039  std::cout << "!TEcnaHistos::PlotDetector(...)> Histo cannot be reached." << fTTBELL << std::endl;}
1040  }
1041  else
1042  {fFlagUserHistoMin = "OFF"; fFlagUserHistoMax = "OFF";
1043  std::cout << "!TEcnaHistos::PlotDetector(...)> Histo cannot be reached." << fTTBELL << std::endl;}
1044 }
1045 
1046 void TEcnaHistos::PlotDetector(const TVectorD& read_histo, const TString& UserHistoCode, const TString& UserDetector)
1047 {
1048  TString CallingMethod = "2DS";
1049 
1050  TString StandardHistoCode = fCnaParHistos->BuildStandard1DHistoCodeY(CallingMethod, UserHistoCode);
1051  if( StandardHistoCode != "?" )
1052  {
1053  TString TechHistoCode = fCnaParHistos->GetTechHistoCode(StandardHistoCode);
1054  TString StandardDetectorCode = fCnaParHistos->BuildStandardDetectorCode(UserDetector);
1055  if( StandardDetectorCode != "?" )
1056  {
1057  fAlreadyRead = 1;
1058 
1059  //if( StandardDetectorCode == "SM" || StandardDetectorCode == "EB" )
1060  // {fEcal->SetEcalSubDetector("EB");}
1061  //if( StandardDetectorCode == "Dee" || StandardDetectorCode == "EE" )
1062  // {fEcal->SetEcalSubDetector("EE");}
1063 
1064  if( StandardDetectorCode == "SM" || StandardDetectorCode == "Dee" )
1065  {ViewStex(read_histo, fAlreadyRead, TechHistoCode);}
1066  if( StandardDetectorCode == "EB" || StandardDetectorCode == "EE" )
1067  {ViewStas(read_histo, fAlreadyRead, TechHistoCode);}
1068  }
1069  else
1070  {fFlagUserHistoMin = "OFF"; fFlagUserHistoMax = "OFF";
1071  std::cout << "!TEcnaHistos::PlotDetector(...)> Histo cannot be reached." << fTTBELL << std::endl;}
1072  }
1073  else
1074  {fFlagUserHistoMin = "OFF"; fFlagUserHistoMax = "OFF";
1075  std::cout << "!TEcnaHistos::PlotDetector(...)> Histo cannot be reached." << fTTBELL << std::endl;}
1076 }
1077 
1078 //---------------------------------------------------------------------------------------
1079 //
1080 // (ReadAnd)Plot1DHisto
1081 //
1082 //---------------------------------------------------------------------------------------
1083 void TEcnaHistos::Plot1DHisto(const TVectorD& InputHisto,
1084  const TString& User_X_Quantity, const TString& User_Y_Quantity,
1085  const TString& UserDetector)
1086 {Plot1DHisto(InputHisto, User_X_Quantity, User_Y_Quantity, UserDetector, "");}
1087 
1088 void TEcnaHistos::Plot1DHisto(const TVectorD& InputHisto,
1089  const TString& User_X_Quantity, const TString& User_Y_Quantity,
1090  const TString& UserDetector,
1091  const TString& UserPlotOption)
1092 {
1093  TString CallingMethod = "1D";
1094 
1095  TString StandardPlotOption = fCnaParHistos->BuildStandardPlotOption(CallingMethod, UserPlotOption);
1096 
1097  TString Standard_X_Quantity = fCnaParHistos->BuildStandard1DHistoCodeX(CallingMethod, User_X_Quantity);
1098  TString Standard_Y_Quantity = fCnaParHistos->BuildStandard1DHistoCodeY(CallingMethod, User_Y_Quantity);
1099 
1100  if( Standard_X_Quantity != "?" && Standard_Y_Quantity != "?" )
1101  {
1102  TString TechHistoCode = fCnaParHistos->GetTechHistoCode(Standard_X_Quantity, Standard_Y_Quantity);
1103  if( fAlreadyRead > 1 ){fAlreadyRead = 1;}
1104  TString StandardDetectorCode = fCnaParHistos->BuildStandardDetectorCode(UserDetector);
1105  if( StandardDetectorCode != "?" )
1106  {
1107  if( StandardDetectorCode == "EB" || StandardDetectorCode == "EE" ){fFapStexNumber = 0;}
1108  ViewHisto(InputHisto, fAlreadyRead, fZerv, fZerv, fZerv, TechHistoCode, StandardPlotOption);
1109  }
1110  else
1111  {fFlagUserHistoMin = "OFF"; fFlagUserHistoMax = "OFF";
1112  std::cout << "!TEcnaHistos::Plot1DHisto(...)> Histo cannot be reached." << fTTBELL << std::endl;}
1113  }
1114  else
1115  {fFlagUserHistoMin = "OFF"; fFlagUserHistoMax = "OFF";
1116  std::cout << "!TEcnaHistos::Plot1DHisto(...)> Histo cannot be reached." << fTTBELL << std::endl;}
1117 }
1118 
1119 void TEcnaHistos::Plot1DHisto(const TString& User_X_Quantity, const TString& User_Y_Quantity,
1120  const TString& UserDetector)
1121 {Plot1DHisto(User_X_Quantity, User_Y_Quantity, UserDetector, "");}
1122 
1123 void TEcnaHistos::Plot1DHisto(const TString& User_X_Quantity, const TString& User_Y_Quantity,
1124  const TString& UserDetector, const TString& UserPlotOption)
1125 {
1126  TString CallingMethod = "1D";
1127 
1128  TString StandardPlotOption = fCnaParHistos->BuildStandardPlotOption(CallingMethod, UserPlotOption);
1129 
1130  TString Standard_X_Quantity = fCnaParHistos->BuildStandard1DHistoCodeX(CallingMethod, User_X_Quantity);
1131  TString Standard_Y_Quantity = fCnaParHistos->BuildStandard1DHistoCodeY(CallingMethod, User_Y_Quantity);
1132 
1133  if( Standard_X_Quantity != "?" && Standard_Y_Quantity != "?" )
1134  {
1135  TString TechHistoCode = fCnaParHistos->GetTechHistoCode(Standard_X_Quantity, Standard_Y_Quantity);
1136  TString StandardDetectorCode = fCnaParHistos->BuildStandardDetectorCode(UserDetector);
1137  if( StandardDetectorCode != "?" )
1138  {
1139  if( StandardDetectorCode == "EB" || StandardDetectorCode == "EE" ){fFapStexNumber = 0;}
1140  ViewHisto(fReadHistoDummy, fTobeRead, fZerv, fZerv, fZerv, TechHistoCode, StandardPlotOption);
1141  }
1142  else
1143  {fFlagUserHistoMin = "OFF"; fFlagUserHistoMax = "OFF";
1144  std::cout << "!TEcnaHistos::Plot1DHisto(...)> Histo cannot be reached." << fTTBELL << std::endl;}
1145  }
1146  else
1147  {fFlagUserHistoMin = "OFF"; fFlagUserHistoMax = "OFF";
1148  std::cout << "!TEcnaHistos::Plot1DHisto(...)> Histo cannot be reached." << fTTBELL << std::endl;}
1149 }
1150 
1151 
1152 
1153 //=> BUG SCRAM? Si on enleve la methode ci-dessous, ca passe a la compilation de test/EcnaHistosExample2.cc
1154 // (qui appelle cette methode) et ca se plante a l'execution (voir test/TEcnaHistosExample2.cc).
1155 #define PLUD
1156 #ifdef PLUD
1157 void TEcnaHistos::Plot1DHisto(const TVectorD& InputHisto,
1158  const TString& User_X_Quantity, const TString& User_Y_Quantity,
1159  const Int_t& n1StexStin)
1160 {Plot1DHisto(InputHisto, User_X_Quantity, User_Y_Quantity, n1StexStin, "");}
1161 
1162 void TEcnaHistos::Plot1DHisto(const TVectorD& InputHisto,
1163  const TString& User_X_Quantity, const TString& User_Y_Quantity,
1164  const Int_t& n1StexStin,
1165  const TString& UserPlotOption)
1166 {
1167  TString CallingMethod = "1DX";
1168  TString StandardPlotOption = fCnaParHistos->BuildStandardPlotOption(CallingMethod, UserPlotOption);
1169  Int_t i0StinEcha = 0;
1170  Plot1DHisto(InputHisto, User_X_Quantity, User_Y_Quantity, n1StexStin, i0StinEcha, StandardPlotOption);
1171 }
1172 #endif // PLUD
1173 
1174 void TEcnaHistos::Plot1DHisto(const TVectorD& InputHisto,
1175  const TString& User_X_Quantity, const TString& User_Y_Quantity,
1176  const Int_t& n1StexStin, const Int_t& i0StinEcha)
1177 {Plot1DHisto(InputHisto, User_X_Quantity, User_Y_Quantity, n1StexStin, i0StinEcha, "");}
1178 
1179 void TEcnaHistos::Plot1DHisto(const TVectorD& InputHisto,
1180  const TString& User_X_Quantity, const TString& User_Y_Quantity,
1181  const Int_t& n1StexStin, const Int_t& i0StinEcha,
1182  const TString& UserPlotOption)
1183 {
1184  TString CallingMethod = "1D";
1185  TString StandardPlotOption = fCnaParHistos->BuildStandardPlotOption(CallingMethod, UserPlotOption);
1186  TString Standard_X_Quantity = fCnaParHistos->BuildStandard1DHistoCodeX(CallingMethod, User_X_Quantity);
1187  TString Standard_Y_Quantity = fCnaParHistos->BuildStandard1DHistoCodeY(CallingMethod, User_Y_Quantity);
1188 
1189  TString TechHistoCode = fCnaParHistos->GetTechHistoCode(Standard_X_Quantity, Standard_Y_Quantity);
1190 
1191  if( Standard_X_Quantity != "?" && Standard_Y_Quantity != "?" )
1192  {
1193  fAlreadyRead = 1;
1194  if( StandardPlotOption != fAllXtalsInStinPlot )
1195  {
1196  ViewHisto(InputHisto, fAlreadyRead, n1StexStin, i0StinEcha, fZerv, TechHistoCode, StandardPlotOption);
1197  }
1198 
1199  if( StandardPlotOption == fAllXtalsInStinPlot && fAlreadyRead >= 1 && fAlreadyRead <= fEcal->MaxCrysInStin() )
1200  {
1201  if( Standard_X_Quantity == "Smp" && Standard_Y_Quantity == "MSp" )
1202  {XtalSamplesEv(InputHisto, fAlreadyRead, n1StexStin, i0StinEcha, StandardPlotOption);}
1203  if( Standard_X_Quantity == "MSp" && Standard_Y_Quantity == "NOS" )
1204  {EvSamplesXtals(InputHisto, fAlreadyRead, n1StexStin, i0StinEcha, StandardPlotOption);}
1205  if( Standard_X_Quantity == "Smp" && Standard_Y_Quantity == "SSp" )
1206  {XtalSamplesSigma(InputHisto, fAlreadyRead, n1StexStin, i0StinEcha, StandardPlotOption);}
1207  if( Standard_X_Quantity == "SSp" && Standard_Y_Quantity == "NOS" )
1208  {SigmaSamplesXtals(InputHisto, fAlreadyRead, n1StexStin, i0StinEcha, StandardPlotOption);}
1209  }
1210  }
1211  else
1212  {fFlagUserHistoMin = "OFF"; fFlagUserHistoMax = "OFF";
1213  std::cout << "!TEcnaHistos::Plot1DHisto(...)> Histo cannot be reached." << fTTBELL << std::endl;}
1214 }
1215 
1216 void TEcnaHistos::Plot1DHisto(const TString& User_X_Quantity, const TString& User_Y_Quantity,
1217  const Int_t& n1StexStin, const Int_t& i0StinEcha)
1218 {Plot1DHisto(User_X_Quantity, User_Y_Quantity, n1StexStin, i0StinEcha, "");}
1219 
1220 void TEcnaHistos::Plot1DHisto(const TString& User_X_Quantity, const TString& User_Y_Quantity,
1221  const Int_t& n1StexStin, const Int_t& i0StinEcha,
1222  const TString& UserPlotOption)
1223 {
1224  TString CallingMethod = "1D";
1225 
1226  TString StandardPlotOption = fCnaParHistos->BuildStandardPlotOption(CallingMethod, UserPlotOption);
1227 
1228  TString Standard_X_Quantity = fCnaParHistos->BuildStandard1DHistoCodeX(CallingMethod, User_X_Quantity);
1229  TString Standard_Y_Quantity = fCnaParHistos->BuildStandard1DHistoCodeY(CallingMethod, User_Y_Quantity);
1230 
1231  if( Standard_X_Quantity != "?" && Standard_Y_Quantity != "?" )
1232  {
1233  if( StandardPlotOption != fAllXtalsInStinPlot )
1234  {
1235  TString TechHistoCode = fCnaParHistos->GetTechHistoCode(Standard_X_Quantity, Standard_Y_Quantity);
1236  ViewHisto(fReadHistoDummy, fTobeRead, n1StexStin, i0StinEcha, fZerv, TechHistoCode, StandardPlotOption);
1237  }
1238  if( StandardPlotOption == fAllXtalsInStinPlot && fAlreadyRead >= 1 && fAlreadyRead <= fEcal->MaxCrysInStin() )
1239  {
1240  if( Standard_X_Quantity == "Smp" && Standard_Y_Quantity == "MSp" )
1241  {XtalSamplesEv(fReadHistoDummy, fTobeRead, n1StexStin, i0StinEcha, StandardPlotOption);}
1242  if( Standard_X_Quantity == "MSp" && Standard_Y_Quantity == "NOS" )
1243  {EvSamplesXtals(fReadHistoDummy, fTobeRead, n1StexStin, i0StinEcha, StandardPlotOption);}
1244  if( Standard_X_Quantity == "Smp" && Standard_Y_Quantity == "SSp" )
1245  {XtalSamplesSigma(fReadHistoDummy, fTobeRead, n1StexStin, i0StinEcha, StandardPlotOption);}
1246  if( Standard_X_Quantity == "SSp" && Standard_Y_Quantity == "NOS" )
1247  {SigmaSamplesXtals(fReadHistoDummy, fTobeRead, n1StexStin, i0StinEcha, StandardPlotOption);}
1248  }
1249  }
1250  else
1251  {fFlagUserHistoMin = "OFF"; fFlagUserHistoMax = "OFF";
1252  std::cout << "!TEcnaHistos::Plot1DHisto(...)> Histo cannot be reached." << fTTBELL << std::endl;}
1253 }
1254 
1255 void TEcnaHistos::Plot1DHisto(const TVectorD& InputHisto,
1256  const TString& User_X_Quantity, const TString& User_Y_Quantity,
1257  const Int_t& n1StexStin, const Int_t& i0StinEcha, const Int_t& n1Sample)
1258 {Plot1DHisto(InputHisto, User_X_Quantity, User_Y_Quantity, n1StexStin, i0StinEcha, n1Sample, "");}
1259 
1260 void TEcnaHistos::Plot1DHisto(const TVectorD& InputHisto,
1261  const TString& User_X_Quantity, const TString& User_Y_Quantity,
1262  const Int_t& n1StexStin, const Int_t& i0StinEcha, const Int_t& n1Sample,
1263  const TString& UserPlotOption)
1264 {
1265  TString CallingMethod = "1D";
1266 
1267  TString StandardPlotOption = fCnaParHistos->BuildStandardPlotOption(CallingMethod, UserPlotOption);
1268 
1269  TString Standard_X_Quantity = fCnaParHistos->BuildStandard1DHistoCodeX(CallingMethod, User_X_Quantity);
1270  TString Standard_Y_Quantity = fCnaParHistos->BuildStandard1DHistoCodeY(CallingMethod, User_Y_Quantity);
1271 
1272  TString TechHistoCode = fCnaParHistos->GetTechHistoCode(Standard_X_Quantity, Standard_Y_Quantity);
1273 
1274  if( Standard_X_Quantity != "?" && Standard_Y_Quantity != "?" )
1275  {
1276  Int_t i0Sample = n1Sample-1;
1277  fAlreadyRead = 1;
1278  ViewHisto(InputHisto, fAlreadyRead, n1StexStin, i0StinEcha, i0Sample, TechHistoCode, StandardPlotOption);
1279  }
1280  else
1281  {fFlagUserHistoMin = "OFF"; fFlagUserHistoMax = "OFF";
1282  std::cout << "!TEcnaHistos::Plot1DHisto(...)> Histo cannot be reached." << fTTBELL << std::endl;}
1283 }
1284 
1285 void TEcnaHistos::Plot1DHisto(const TString& User_X_Quantity, const TString& User_Y_Quantity,
1286  const Int_t& n1StexStin, const Int_t& i0StinEcha, const Int_t& n1Sample)
1287 {Plot1DHisto(User_X_Quantity, User_Y_Quantity, n1StexStin, i0StinEcha, n1Sample, "");}
1288 
1289 void TEcnaHistos::Plot1DHisto(const TString& User_X_Quantity, const TString& User_Y_Quantity,
1290  const Int_t& n1StexStin, const Int_t& i0StinEcha, const Int_t& n1Sample,
1291  const TString& UserPlotOption)
1292 {
1293  TString CallingMethod = "1D";
1294 
1295  TString StandardPlotOption = fCnaParHistos->BuildStandardPlotOption(CallingMethod, UserPlotOption);
1296 
1297  TString Standard_X_Quantity = fCnaParHistos->BuildStandard1DHistoCodeX(CallingMethod, User_X_Quantity);
1298  TString Standard_Y_Quantity = fCnaParHistos->BuildStandard1DHistoCodeY(CallingMethod, User_Y_Quantity);
1299 
1300  Int_t i0Sample = n1Sample-1;
1301 
1302  if( Standard_X_Quantity != "?" && Standard_Y_Quantity != "?" )
1303  {
1304  TString TechHistoCode = fCnaParHistos->GetTechHistoCode(Standard_X_Quantity, Standard_Y_Quantity);
1305  ViewHisto(fReadHistoDummy, fTobeRead, n1StexStin, i0StinEcha, i0Sample, TechHistoCode, StandardPlotOption);
1306  }
1307  else
1308  {fFlagUserHistoMin = "OFF"; fFlagUserHistoMax = "OFF";
1309  std::cout << "!TEcnaHistos::Plot1DHisto(...)> Histo cannot be reached." << fTTBELL << std::endl;}
1310 }
1311 
1312 //---------------------------------------------------------------------------------------
1313 //
1314 // (ReadAnd)PlotHistory
1315 //
1316 //---------------------------------------------------------------------------------------
1317 void TEcnaHistos::PlotHistory(const TString& User_X_Quantity, const TString& User_Y_Quantity,
1318  const TString& list_of_run_file_name,
1319  const Int_t& StexStin_A, const Int_t& i0StinEcha)
1320 {PlotHistory(User_X_Quantity, User_Y_Quantity, list_of_run_file_name, StexStin_A, i0StinEcha, "");}
1321 
1322 void TEcnaHistos::PlotHistory(const TString& User_X_Quantity, const TString& User_Y_Quantity,
1323  const TString& list_of_run_file_name,
1324  const Int_t& StexStin_A, const Int_t& i0StinEcha,
1325  const TString& UserPlotOption)
1326 {
1327  TString CallingMethod = "Time";
1328 
1329  TString StandardPlotOption = fCnaParHistos->BuildStandardPlotOption(CallingMethod, UserPlotOption);
1330 
1331  TString Standard_X_Quantity = fCnaParHistos->BuildStandard1DHistoCodeX(CallingMethod, User_X_Quantity);
1332  TString Standard_Y_Quantity = fCnaParHistos->BuildStandard1DHistoCodeY(CallingMethod, User_Y_Quantity);
1333 
1334  if( Standard_X_Quantity != "?" && Standard_Y_Quantity != "?" )
1335  {
1336  TString TechHistoCode = fCnaParHistos->GetTechHistoCode(Standard_X_Quantity, Standard_Y_Quantity);
1337  ViewHistime(list_of_run_file_name, StexStin_A, i0StinEcha, TechHistoCode, StandardPlotOption);
1338  }
1339  else
1340  {fFlagUserHistoMin = "OFF"; fFlagUserHistoMax = "OFF";
1341  std::cout << "!TEcnaHistos::PlotHistory(...)> Histo cannot be reached." << fTTBELL << std::endl;}
1342 }
1343 
1344 //=============================================================================================
1345 //
1346 // " V I E W " M E T H O D S
1347 //
1348 //=============================================================================================
1349 
1350 //=============================================================================================================
1351 //
1352 // ViewMatrix(***)
1353 //
1354 // arg_read_matrix: 2D array
1355 // arg_AlreadyRead: =1 <=> use arg_read_matrix
1356 // =0 <=> read the 2D array in this method with TEcnaRead
1357 // StexStin_A: tower number in SM (if EB) OR SC "ECNA" number in Dee (if EE)
1358 // StexStin_B: tower' number in SM (if EB) OR SC' "ECNA" number in Dee (if EE)
1359 // MatrixBinIndex: channel number in tower (if EB) OR in SC (if EE)
1360 // CorOrCov: flag CORRELATION/COVARIANCE
1361 // BetweenWhat: flag BETWEEN SAMPLES / BETWEEN CHANNELS / BETWEEN TOWERS / BETWEEN SCs / LF, HF, ...
1362 // PlotOption: ROOT 2D histos draw options (COLZ, LEGO, ...) + additional (ASCII)
1363 //
1364 // MatrixBinIndex: = i0StinEcha if cov(s,s'), cor(s,s')
1365 // = 0 if cov(c,c'), cor(c,c'), cov(Stin,Stin'), cor(Stin,Stin')
1366 //
1367 // ViewMatrix(StexStin_A, StexStin_B, MatrixBinIndex, CorOrCov, BetweenWhat, PlotOption)
1368 // ViewMatrix(StexStin_A, 0, i0StinEcha, CorOrCov, "Mss", PlotOption)
1369 // Output:
1370 // Plot of cov(s,s') or cor(s,s') matrix for i0StinEcha of StexStin_A
1371 //
1372 // ViewMatrix(StexStin_A, StexStin_B, MatrixBinIndex, CorOrCov, BetweenWhat, PlotOption)
1373 // ViewMatrix(StexStin_A, StexStin_B, 0, CorOrCov, "Mcc", PlotOption)
1374 // Output:
1375 // Plot LF-HF Corcc matrix for Stins: (StexStin_A, StexStin_B)
1376 //
1377 // ViewMatrix(StexStin_A, StexStin_B, MatrixBinIndex, CorOrCov, BetweenWhat, PlotOption)
1378 // ViewMatrix( 0, 0, 0, CorOrCov, "Mcc", PlotOption)
1379 // Output:
1380 // Plot of LF-HF Corcc matrix for Stex (big matrix)
1381 //
1382 // ViewMatrix(StexStin_A, StexStin_B, MatrixBinIndex, CorOrCov, BetweenWhat, PlotOption)
1383 // ViewMatrix( 0, 0, 0, CorOrCov, "Mtt", PlotOption)
1384 // Output:
1385 // Plot of LF-HF Cortt matrix
1386 //
1387 //=============================================================================================================
1388 void TEcnaHistos::ViewMatrix(const TMatrixD& arg_read_matrix, const Int_t& arg_AlreadyRead,
1389  const Int_t& StexStin_A, const Int_t& StexStin_B,
1390  const Int_t& MatrixBinIndex, const TString& CorOrCov,
1391  const TString& BetweenWhat, const TString& PlotOption)
1392 {
1393  //Plot correlation or covariance matrix between samples or channels or Stins
1394 
1395  if( (fFapStexNumber > 0) && (fFapStexNumber <= fEcal->MaxStexInStas()) )
1396  {
1397  Bool_t OKArray = kFALSE;
1398  Bool_t OKData = kFALSE;
1399  TVectorD vStin(fEcal->MaxStinEcnaInStex());
1400 
1401  if( arg_AlreadyRead == fTobeRead )
1402  {
1408  OKArray = fMyRootFile->LookAtRootFile();
1409  if( OKArray == kTRUE )
1410  {
1412  TString fp_name_short = fMyRootFile->GetRootFileNameShort();
1413  // std::cout << "*TEcnaHistos::ViewMatrix(...)> Data are analyzed from file ----> "
1414  // << fp_name_short << std::endl;
1415  //...................................................................... (ViewMatrix)
1416  for(Int_t i=0; i<fEcal->MaxStinEcnaInStex(); i++){vStin(i)=(Double_t)0.;}
1418 
1422 
1423  if( fMyRootFile->DataExist() == kTRUE ){OKData = kTRUE;}
1424  }
1425 
1426  }
1427  if( arg_AlreadyRead >= 1 )
1428  {
1429  OKArray = kTRUE;
1430  OKData = kTRUE;
1431  if( fFlagSubDet == "EB")
1432  {
1433  for(Int_t i=0; i<fEcal->MaxStinEcnaInStex(); i++){vStin(i)=i;}
1434  }
1435  if( fFlagSubDet == "EE")
1436  {
1437  for(Int_t i=0; i<fEcal->MaxStinEcnaInStex(); i++)
1438  {vStin(i)= fEcalNumbering->GetDeeSCConsFrom1DeeSCEcna(fFapStexNumber, (Int_t)vStin(i));}
1439  }
1440  }
1441 
1442  if ( OKArray == kTRUE ) // (ViewMatrix)
1443  {
1444  fStatusFileFound = kTRUE;
1445 
1446  if( OKData == kTRUE )
1447  {
1448  fStatusDataExist = kTRUE;
1449 
1450  Int_t Stin_X_ok = 0;
1451  Int_t Stin_Y_ok = 0;
1452 
1453  if( (BetweenWhat == fLFBetweenStins) || (BetweenWhat == fHFBetweenStins) )
1454  {Stin_X_ok = 1; Stin_Y_ok = 1;}
1455  if( BetweenWhat == fBetweenSamples )
1456  {Stin_Y_ok = 1;}
1457 
1458  for (Int_t index_Stin = 0; index_Stin < fEcal->MaxStinEcnaInStex(); index_Stin++)
1459  {
1460  if ( vStin(index_Stin) == StexStin_A ){Stin_X_ok = 1;}
1461  if ( vStin(index_Stin) == StexStin_B ){Stin_Y_ok = 1;}
1462  }
1463  //................................................................. (ViewMatrix)
1464  if( Stin_X_ok == 1 && Stin_Y_ok == 1 )
1465  {
1466  Int_t MatSize = -1;
1467  Int_t ReadMatSize = -1;
1468  Int_t i0StinEcha = -1;
1469 
1470  //-------------------------- Set values of ReadMatSize, MatSize, i0StinEcha
1471  if( BetweenWhat == fBetweenSamples )
1472  {ReadMatSize = fFapNbOfSamples; MatSize = fEcal->MaxSampADC(); i0StinEcha=(Int_t)MatrixBinIndex;}
1473 
1474  if( BetweenWhat == fLFBetweenChannels || BetweenWhat == fHFBetweenChannels )
1475  {ReadMatSize = fEcal->MaxCrysInStin(); MatSize = fEcal->MaxCrysInStin(); /*i0Sample=MatrixBinIndex;*/}
1476 
1477  if( (BetweenWhat == fLFBetweenStins) || (BetweenWhat == fHFBetweenStins) )
1478  {ReadMatSize = fEcal->MaxStinEcnaInStex(); MatSize = fEcal->MaxStinInStex();}
1479 
1480  //------------------------------------------------------------------------------------- (ViewMatrix)
1481  if( ( BetweenWhat == fLFBetweenStins || BetweenWhat == fHFBetweenStins ) ||
1482  ( BetweenWhat == fLFBetweenChannels || BetweenWhat == fHFBetweenChannels
1483  /* && (i0Sample >= 0) && (i0Sample < fFapNbOfSamples ) */ ) ||
1484  ( (BetweenWhat == fBetweenSamples) && (i0StinEcha >= 0) && (i0StinEcha < fEcal->MaxCrysInStin()) ) )
1485  {
1486  TMatrixD read_matrix(ReadMatSize, ReadMatSize);
1487  for(Int_t i=0; i-ReadMatSize<0; i++)
1488  {for(Int_t j=0; j-ReadMatSize<0; j++){read_matrix(i,j)=(Double_t)0.;}}
1489 
1490  Bool_t OKData = kFALSE;
1491  if( arg_AlreadyRead == fTobeRead )
1492  {
1493  if( BetweenWhat == fBetweenSamples && CorOrCov == fCovarianceMatrix )
1494  {read_matrix =
1495  fMyRootFile->ReadCovariancesBetweenSamples(StexStin_A, i0StinEcha, ReadMatSize);}
1496 
1497  if( BetweenWhat == fBetweenSamples && CorOrCov == fCorrelationMatrix )
1498  {read_matrix =
1499  fMyRootFile->ReadCorrelationsBetweenSamples(StexStin_A, i0StinEcha, ReadMatSize);}
1500 
1501  if( BetweenWhat == fLFBetweenChannels && CorOrCov == fCovarianceMatrix )
1502  {read_matrix =
1503  fMyRootFile->ReadLowFrequencyCovariancesBetweenChannels(StexStin_A, StexStin_B, ReadMatSize);}
1504 
1505  if( BetweenWhat == fLFBetweenChannels && CorOrCov == fCorrelationMatrix )
1506  {read_matrix =
1507  fMyRootFile->ReadLowFrequencyCorrelationsBetweenChannels(StexStin_A, StexStin_B, ReadMatSize);}
1508 
1509  if( BetweenWhat == fHFBetweenChannels && CorOrCov == fCovarianceMatrix )
1510  {read_matrix =
1511  fMyRootFile->ReadHighFrequencyCovariancesBetweenChannels(StexStin_A, StexStin_B, ReadMatSize);}
1512 
1513  if( BetweenWhat == fHFBetweenChannels && CorOrCov == fCorrelationMatrix )
1514  {read_matrix =
1515  fMyRootFile->ReadHighFrequencyCorrelationsBetweenChannels(StexStin_A, StexStin_B, ReadMatSize);}
1516 
1517  if( BetweenWhat == fLFBetweenStins && CorOrCov == fCorrelationMatrix )
1518  {read_matrix =
1520 
1521  if( BetweenWhat == fHFBetweenStins && CorOrCov == fCorrelationMatrix )
1522  {read_matrix =
1524  }
1525 
1526  OKData = fMyRootFile->DataExist();
1527  }
1528  else
1529  {
1530  read_matrix = arg_read_matrix;
1531  OKData = kTRUE;
1532  }
1533  //.......................................................... (ViewMatrix)
1534  if( OKData == kTRUE )
1535  {
1536  fStatusDataExist = kTRUE;
1537 
1538  if( PlotOption == "ASCII" )
1539  {
1540  WriteMatrixAscii(BetweenWhat, CorOrCov,
1541  StexStin_A, MatrixBinIndex, ReadMatSize, read_matrix);
1542  }
1543  else
1544  {
1545  //......................... matrix title (ViewMatrix)
1546  char f_in_mat_tit[charArrLen];
1547 
1548  if( BetweenWhat == fBetweenSamples && CorOrCov == fCovarianceMatrix )
1549  {sprintf(f_in_mat_tit, "Covariance(Sample, Sample')");}
1550  if( BetweenWhat == fBetweenSamples && CorOrCov == fCorrelationMatrix )
1551  {sprintf(f_in_mat_tit, "Correlation(Sample, Sample')");}
1552 
1553  if(fFlagSubDet == "EB" )
1554  {
1555  if( BetweenWhat == fLFBetweenStins && CorOrCov == fCorrelationMatrix )
1556  {sprintf(f_in_mat_tit,
1557  "Mean LF |Cor(Xtal,Xtal')| for each (Tower,Tower')");}
1558  if( BetweenWhat == fHFBetweenStins && CorOrCov == fCorrelationMatrix )
1559  {sprintf(f_in_mat_tit,
1560  "Mean HF |Cor(Xtal,Xtal')| for each (Tower,Tower')");}
1561  }
1562  if(fFlagSubDet == "EE" )
1563  {
1564  if( BetweenWhat == fLFBetweenStins && CorOrCov == fCorrelationMatrix )
1565  {sprintf(f_in_mat_tit,
1566  "Mean LF |Cor(Xtal,Xtal')| for each (SC,SC')");}
1567  if( BetweenWhat == fHFBetweenStins && CorOrCov == fCorrelationMatrix )
1568  {sprintf(f_in_mat_tit,
1569  "Mean HF |Cor(Xtal,Xtal')| for each (SC,SC')");}
1570  }
1571 
1572  if( BetweenWhat == fLFBetweenChannels && CorOrCov == fCorrelationMatrix )
1573  {
1574  if( fFlagSubDet == "EB" )
1575  {sprintf(f_in_mat_tit, "LF Cor(Xtal,Xtal') matrix elts for (Tow,Tow')");}
1576  if( fFlagSubDet == "EE" )
1577  {sprintf(f_in_mat_tit, "LF Cor(Xtal,Xtal') matrix elts for (SC,SC')");}
1578  }
1579  if( BetweenWhat == fHFBetweenChannels && CorOrCov == fCorrelationMatrix )
1580  {
1581  if( fFlagSubDet == "EB" )
1582  {sprintf(f_in_mat_tit, "HF Cor(Xtal,Xtal') matrix elts for (Tow,Tow')");}
1583  if( fFlagSubDet == "EE" )
1584  {sprintf(f_in_mat_tit, "LF Cor(Xtal,Xtal') matrix elts for (SC,SC')");}
1585  }
1586 
1587  //................................. Axis parameters (ViewMatrix)
1588  TString axis_x_var_name;
1589  TString axis_y_var_name;
1590 
1591  char f_in_axis_x[charArrLen];
1592  char f_in_axis_y[charArrLen];
1593 
1594  if( BetweenWhat == fLFBetweenStins || BetweenWhat == fHFBetweenStins )
1595  {
1596  if( fFlagSubDet == "EB" )
1597  {sprintf(f_in_axis_x, " %s number ", fFapStinName.Data());}
1598  if( fFlagSubDet == "EE" )
1599  {sprintf(f_in_axis_x, " %s number for construction ", fFapStinName.Data());}
1600 
1601  axis_x_var_name = f_in_axis_x; axis_y_var_name = f_in_axis_x;
1602  }
1603  if( BetweenWhat == fBetweenSamples)
1604  {
1605  axis_x_var_name = " Sample "; axis_y_var_name = " Sample ";
1606  }
1607  if( BetweenWhat == fLFBetweenChannels || BetweenWhat == fHFBetweenChannels ){
1608  sprintf(f_in_axis_x, " Crystal %s %d ", fFapStinName.Data(), StexStin_A);
1609  sprintf(f_in_axis_y, " Crystal %s %d ", fFapStinName.Data(),StexStin_B);
1610  axis_x_var_name = f_in_axis_x; axis_y_var_name = f_in_axis_y;}
1611 
1612  Int_t nb_binx = MatSize;
1613  Int_t nb_biny = MatSize;
1614  Axis_t xinf_bid = (Axis_t)0.;
1615  Axis_t xsup_bid = (Axis_t)MatSize;
1616  Axis_t yinf_bid = (Axis_t)0.;
1617  Axis_t ysup_bid = (Axis_t)MatSize;
1618 
1619  if( (fFlagSubDet == "EE") &&
1620  (BetweenWhat == fLFBetweenStins || BetweenWhat == fHFBetweenStins) )
1621  {
1622  if( fFapStexNumber == 1 || fFapStexNumber == 3 )
1623  {
1624  xinf_bid += fEcal->MaxStinInStex();
1625  xsup_bid += fEcal->MaxStinInStex();
1626  yinf_bid += fEcal->MaxStinInStex();
1627  ysup_bid += fEcal->MaxStinInStex();
1628  }
1629  }
1630  //................................................... histogram booking (ViewMatrix)
1631  TH2D* h_fbid0 = new TH2D("bidim", f_in_mat_tit,
1632  nb_binx, xinf_bid, xsup_bid,
1633  nb_biny, yinf_bid, ysup_bid); fCnewRoot++;
1634  h_fbid0->Reset();
1635 
1636  h_fbid0->GetXaxis()->SetTitle(axis_x_var_name);
1637  h_fbid0->GetYaxis()->SetTitle(axis_y_var_name);
1638 
1639  //------------------------------------------------ F I L L H I S T O (ViewMatrix)
1640  if( (fFlagSubDet == "EE") &&
1641  (BetweenWhat == fLFBetweenStins || BetweenWhat == fHFBetweenStins) )
1642  {
1643  for(Int_t i = 0 ; i < ReadMatSize ; i++)
1644  {
1645  for(Int_t j = 0 ; j < ReadMatSize ; j++)
1646  {
1647  Int_t ip = i+1;
1648  Double_t xi_bid =
1650  Int_t jp = j+1;
1651  Double_t xj_bid =
1653  if( xi_bid > 0 && xj_bid > 0 )
1654  {
1655  Int_t xi_bid_m = xi_bid-1;
1656  Int_t xj_bid_m = xj_bid-1;
1657  h_fbid0->Fill(xi_bid_m, xj_bid_m, read_matrix(i,j));
1658  }
1659  }
1660  }
1661  }
1662  else
1663  {
1664  for(Int_t i = 0 ; i - ReadMatSize < 0 ; i++)
1665  {
1666  Double_t xi = (Double_t)i;
1667  for(Int_t j = 0 ; j < ReadMatSize ; j++)
1668  {
1669  Double_t xj = (Double_t)j;
1670  Double_t mat_val = (Double_t)read_matrix(i,j);
1671  h_fbid0->Fill(xi, xj, (Double_t)mat_val);
1672  }
1673  }
1674  }
1675  //--------------- H I S T O M I N / M A X M A N A G E M E N T (ViewMatrix)
1676 
1677  //................................ Put histo min max values
1678  TString quantity_code = "D_MCs_ChNb";
1679  if ( CorOrCov == fCorrelationMatrix )
1680  {
1681  if( BetweenWhat == fBetweenSamples ){quantity_code = "D_MCs_ChNb";}
1682 
1683  if( BetweenWhat == fLFBetweenChannels ){quantity_code = "H2LFccMosMatrix";}
1684  if( BetweenWhat == fHFBetweenChannels ){quantity_code = "H2HFccMosMatrix";}
1685 
1686  if( BetweenWhat == fLFBetweenStins ){quantity_code = "H2LFccMosMatrix";}
1687  if( BetweenWhat == fHFBetweenStins ){quantity_code = "H2HFccMosMatrix";}
1688  }
1689  if( CorOrCov == fCovarianceMatrix ){quantity_code = "H2HFccMosMatrix";}
1690  //.......... default if flag not set to "ON"
1691  SetYminMemoFromValue(quantity_code, fCnaParHistos->GetYminDefaultValue(quantity_code));
1692  SetYmaxMemoFromValue(quantity_code, fCnaParHistos->GetYmaxDefaultValue(quantity_code));
1693 
1694  if( fUserHistoMin == fUserHistoMax ){fFlagUserHistoMin = "AUTO"; fFlagUserHistoMax = "AUTO";}
1695  //................................. User's min and/or max (ViewMatrix)
1696  if( fFlagUserHistoMin == "ON" )
1697  {SetYminMemoFromValue(quantity_code, fUserHistoMin); fFlagUserHistoMin = "OFF";}
1698  if( fFlagUserHistoMax == "ON" )
1699  {SetYmaxMemoFromValue(quantity_code, fUserHistoMax); fFlagUserHistoMax = "OFF";}
1700  //................................. automatic min and/or max
1701  if( fFlagUserHistoMin == "AUTO" )
1702  {SetYminMemoFromValue(quantity_code, h_fbid0->GetMinimum()); fFlagUserHistoMin = "OFF";}
1703  if( fFlagUserHistoMax == "AUTO" )
1704  {SetYmaxMemoFromValue(quantity_code, h_fbid0->GetMaximum()); fFlagUserHistoMax = "OFF";}
1705  //...................................... histo set ymin and ymax (ViewMatrix)
1706  if( CorOrCov == fCorrelationMatrix )
1707  {
1708  if(BetweenWhat == fBetweenSamples)
1709  {SetHistoFrameYminYmaxFromMemo((TH1D*)h_fbid0, "D_MCs_ChNb");}
1710  if( BetweenWhat == fLFBetweenStins || BetweenWhat == fLFBetweenChannels )
1711  {SetHistoFrameYminYmaxFromMemo((TH1D*)h_fbid0, "H2LFccMosMatrix");}
1712  if( BetweenWhat == fHFBetweenStins || BetweenWhat == fHFBetweenChannels )
1713  {SetHistoFrameYminYmaxFromMemo((TH1D*)h_fbid0, "H2HFccMosMatrix");}
1714  //************************** A GARDER EN RESERVE ******************************
1715  //............. special contour level for correlations (square root wise scale)
1716  // Int_t nb_niv = 9;
1717  // Double_t* cont_niv = new Double_t[nb_niv]; fCnew++;
1718  // SqrtContourLevels(nb_niv, &cont_niv[0]);
1719  // h_fbid0->SetContour(nb_niv, &cont_niv[0]);
1720  // delete [] cont_niv; fCdelete++;
1721  //******************************** (FIN RESERVE) ******************************
1722  }
1723  if( CorOrCov == fCovarianceMatrix )
1724  {
1725  if (BetweenWhat == fBetweenSamples)
1726  {SetYminMemoFromPreviousMemo("D_TNo_ChNb"); // covariance => same level as sigmas
1727  SetYmaxMemoFromPreviousMemo("D_TNo_ChNb");
1728  SetHistoFrameYminYmaxFromMemo((TH1D*)h_fbid0, "D_TNo_ChNb");}
1729  if ( BetweenWhat == fLFBetweenStins || BetweenWhat == fHFBetweenStins ||
1730  BetweenWhat == fLFBetweenChannels || BetweenWhat == fHFBetweenChannels )
1731  {SetHistoFrameYminYmaxFromMemo((TH1D*)h_fbid0, "H2HFccMosMatrix");}
1732  }
1733 
1734  // ----------------------------------------------- P L O T S (ViewMatrix)
1735  char f_in[charArrLen];
1736  //...................... Taille/format canvas
1737  UInt_t canv_w = fCnaParHistos->CanvasFormatW("petit");
1738  UInt_t canv_h = fCnaParHistos->CanvasFormatH("petit");
1739 
1740  //............................. options generales
1741  TString HistoType;
1742  HistoType.Resize(charArrLen);
1743  HistoType = "(no quantity type info)";
1744 
1745  if (PlotOption == "COLZ" ){HistoType = "colz";}
1746  if (PlotOption == "BOX" ){HistoType = "colz";}
1747  if (PlotOption == "TEXT" ){HistoType = "colz";}
1748  if (PlotOption == "CONTZ" ){HistoType = "colz";}
1749  if (PlotOption == "LEGO2Z"){HistoType = "lego";}
1750  if (PlotOption == "SURF1Z"){HistoType = "surf";}
1751  if (PlotOption == "SURF2Z"){HistoType = "surf";}
1752  if (PlotOption == "SURF3Z"){HistoType = "surf";}
1753  if (PlotOption == "SURF4" ){HistoType = "surf";}
1754 
1755  if( fFlagSubDet == "EB" )
1756  {
1758  SetAllPavesViewMatrix(BetweenWhat.Data(), StexStin_A, StexStin_B, i0StinEcha);
1759  }
1760  if( fFlagSubDet == "EE" )
1761  {
1764  SetAllPavesViewMatrix(BetweenWhat.Data(), StexStin_A, StexStin_B, i0StinEcha);
1765  }
1766 
1767  //---------------------------------------- Canvas name (ViewMatrix)
1768  TString name_cov_cor;
1769  name_cov_cor.Resize(charArrLen);
1770  name_cov_cor = "?";
1771  if( CorOrCov == fCovarianceMatrix){name_cov_cor = "Covariance";}
1772  if( CorOrCov == fCorrelationMatrix){name_cov_cor = "Correlation";}
1773 
1774  TString name_chan_samp;
1775  name_chan_samp.Resize(charArrLen);
1776  name_chan_samp = "?";
1777 
1778  if( BetweenWhat == fLFBetweenStins ){name_chan_samp = "LFccMos";}
1779  if( BetweenWhat == fHFBetweenStins ){name_chan_samp = "HFccMos"; }
1780 
1781  if( BetweenWhat == fLFBetweenChannels ){name_chan_samp = "LF_cc";}
1782  if( BetweenWhat == fHFBetweenChannels ){name_chan_samp = "HF_cc";}
1783 
1784  if(BetweenWhat == fBetweenSamples)
1785  {
1786  name_chan_samp = "Between_Samples"; // MatrixBinIndex = i0StinEcha
1787  }
1788 
1789  TString name_visu;
1790  name_visu.Resize(charArrLen);
1791  name_visu = "?";
1792 
1793  name_visu = PlotOption;
1794 
1795  if( (BetweenWhat == fLFBetweenStins) || (BetweenWhat == fHFBetweenStins) ){
1796  sprintf(f_in, "%s_%s_%s_S1_%d_R%d_%d_%d_%s%d_%s",
1797  name_cov_cor.Data(), name_chan_samp.Data(),
1800  fFapStexName.Data(), fFapStexNumber,
1801  name_visu.Data());}
1802 
1803  if( BetweenWhat == fLFBetweenChannels || BetweenWhat == fHFBetweenChannels ){
1804  sprintf(f_in, "%s_%s_%s_S1_%d_R%d_%d_%d_%s%d_%sX%d_%sY%d_%s",
1805  name_cov_cor.Data(), name_chan_samp.Data(),
1808  fFapStexName.Data(), fFapStexNumber,
1809  fFapStexName.Data(), StexStin_A, fFapStexName.Data(), StexStin_B,
1810  name_visu.Data());}
1811 
1812  if( BetweenWhat == fBetweenSamples ){
1813  sprintf(f_in, "%s_%s_%s_S1_%d_R%d_%d_%d_%s%d_%sX%d_%sY%d_ElecChannel_%d_%s",
1814  name_cov_cor.Data(), name_chan_samp.Data(),
1817  fFapStexName.Data(), fFapStexNumber,
1818  fFapStexName.Data(), StexStin_A, fFapStexName.Data(), StexStin_B,
1819  MatrixBinIndex,
1820  name_visu.Data());}
1821 
1822  //---------------------------------------------------------- (ViewMatrix)
1823 
1824  SetHistoPresentation((TH1D*)h_fbid0, HistoType);
1825  TCanvas *MainCanvas = new TCanvas(f_in, f_in, canv_w , canv_h); fCnewRoot++;
1826  fCurrentCanvas = MainCanvas; fCurrentCanvasName = f_in;
1827 
1828  // std::cout << "*TEcnaHistos::ViewMatrix(...)> Plot is displayed on canvas ----> "
1829  // << fCurrentCanvasName << std::endl;
1830  // std::cout << "*TEcnaHistos::ViewMatrix(...)> fCurrentCanvas = " << fCurrentCanvas << std::endl;
1831 
1832  if( fPavComGeneralTitle != nullptr ){fPavComGeneralTitle->Draw();}
1833  fPavComStex->Draw();
1834 
1835  if(BetweenWhat == fLFBetweenChannels || BetweenWhat == fHFBetweenChannels)
1836  {fPavComStin->Draw();}
1837  if(BetweenWhat == fBetweenSamples)
1838  {fPavComStin->Draw(); fPavComXtal->Draw();}
1839 
1840  fPavComAnaRun->Draw();
1841  fPavComNbOfEvts->Draw();
1842 
1843  Double_t x_margin = fCnaParHistos->BoxLeftX("bottom_left_box") - 0.005;
1844  Double_t y_margin = fCnaParHistos->BoxTopY("bottom_right_box") + 0.005;
1845  MainCanvas->Divide(1, 1, x_margin, y_margin);
1846  gPad->cd(1);
1847 
1848  //---------------------------------------------------------- (ViewMatrix)
1849  Int_t logy = 0;
1850  gPad->SetLogy(logy);
1851  if( (BetweenWhat == fLFBetweenStins) ||
1852  (BetweenWhat == fHFBetweenStins) ){gPad->SetGrid(1,1);}
1853  h_fbid0->DrawCopy(PlotOption);
1854  h_fbid0->SetStats(true);
1855  gPad->Update();
1856  h_fbid0->Delete(); h_fbid0 = nullptr; fCdeleteRoot++;
1857 
1858  //MainCanvas->Delete(); fCdeleteRoot++;
1859  }
1860  } // end of if ( OKData == kTRUE )
1861  else
1862  {
1863  fStatusDataExist = kFALSE;
1864  }
1865  } // end of if ((BetweenWhat == fLFBetweenStins) || (BetweenWhat == fHFBetweenStins) ) ||
1866  //( (BetweenWhat == fBetweenSamples) && (i0StinEcha>= 0) && (i0StinEcha<fEcal->MaxCrysInStin())) ||
1867  //( (BetweenWhat == fLFBetweenChannels || BetweenWhat == fHFBetweenChannels)
1868  // /* && (i0Sample >= 0) && (i0Sample < fFapNbOfSamples ) */ ) )
1869  else
1870  {
1871  if(BetweenWhat == fBetweenSamples)
1872  {
1873  std::cout << "*TEcnaHistos::ViewMatrix(...)> *ERROR* ==> Wrong channel number in "
1874  << fFapStinName.Data() << ". Value = "
1875  << i0StinEcha << " (required range: [0, "
1876  << fEcal->MaxCrysInStin()-1 << "] )"
1877  << fTTBELL << std::endl;
1878  }
1879 
1880  // if( BetweenWhat == fLFBetweenChannels || BetweenWhat == fHFBetweenChannels )
1881  // {
1882  // std::cout << "*TEcnaHistos::ViewMatrix(...)> *ERROR* ==> Wrong sample index. Value = "
1883  // << i0Sample << " (required range: [0, "
1884  // << fFapNbOfSamples-1 << "] )"
1885  // << fTTBELL << std::endl;
1886  //}
1887  }
1888  }
1889  else // else of the if ( Stin_X_ok ==1 && Stin_Y_ok ==1 )
1890  {
1891  //---------------------------------------------------------- (ViewMatrix)
1892  if ( Stin_X_ok != 1 )
1893  {
1894  if( fFlagSubDet == "EB")
1895  {
1896  std::cout << "*TEcnaHistos::ViewMatrix(...)> *ERROR* =====> "
1897  << fFapStinName.Data() << " "
1898  << StexStin_A << ", "
1899  << fFapStinName.Data() << " not found. Available numbers = ";
1900  for(Int_t i = 0; i < fEcal->MaxStinEcnaInStex(); i++)
1901  {
1902  if( vStin(i) > 0 )
1903  {
1904  std::cout << vStin(i) << ", ";
1905  }
1906  }
1907  }
1908 
1909  if( fFlagSubDet == "EE")
1910  {
1911  std::cout << "*TEcnaHistos::ViewMatrix(...)> *ERROR* =====> "
1912  << fFapStinName.Data() << " "
1914  << fFapStinName.Data() << " not found. Available numbers = ";
1915  for(Int_t i = 0; i < fEcal->MaxStinEcnaInStex(); i++)
1916  {
1917  if( vStin(i) > 0 )
1918  {
1920  }
1921  }
1922  }
1923  std::cout << fTTBELL << std::endl;
1924  }
1925  if ( Stin_Y_ok != 1 )
1926  {
1927 
1928  if( fFlagSubDet == "EB")
1929  {
1930  std::cout << "*TEcnaHistos::ViewMatrix(...)> *ERROR* =====> "
1931  << fFapStinName.Data() << " "
1932  << StexStin_B << ", "
1933  << fFapStinName.Data() << " not found. Available numbers = ";
1934  for(Int_t i = 0; i < fEcal->MaxStinEcnaInStex(); i++)
1935  {
1936  if( vStin(i) > 0 )
1937  {
1938  std::cout << vStin(i) << ", ";
1939  }
1940  }
1941  }
1942 
1943  if( fFlagSubDet == "EE")
1944  {
1945  std::cout << "*TEcnaHistos::ViewMatrix(...)> *ERROR* =====> "
1946  << fFapStinName.Data() << " "
1948  << fFapStinName.Data() << " not found. Available numbers = ";
1949  for(Int_t i = 0; i < fEcal->MaxStinEcnaInStex(); i++)
1950  {
1951  if( vStin(i) > 0 )
1952  {
1954  }
1955  }
1956  }
1957  std::cout << fTTBELL << std::endl;
1958  }
1959  }
1960  } // end of if ( fMyRootFile->DataExist() == kTRUE )
1961  else
1962  {
1963  fStatusDataExist = kFALSE;
1964  std::cout << "!TEcnaHistos::ViewMatrix(...)> *ERROR* =====> "
1965  << " Histo not available." << fTTBELL << std::endl;
1966  fFlagUserHistoMin = "OFF";
1967  fFlagUserHistoMax = "OFF";
1968  }
1969  } // end of if ( fMyRootFile->LookAtRootFile() == kTRUE )
1970  else
1971  {
1972  fStatusFileFound = kFALSE;
1973  std::cout << "!TEcnaHistos::ViewMatrix(...)> *ERROR* =====> "
1974  << " ROOT file not found" << fTTBELL << std::endl;
1975  }
1976  } // ---- end of if( (fFapStexNumber > 0) && (fFapStexNumber <= fEcal->MaxStexInStas()) ) -----
1977  else
1978  {
1979  std::cout << "!TEcnaHistos::ViewMatrix(...)> " << fFapStexName.Data()
1980  << " = " << fFapStexNumber << ". Out of range (range = [1,"
1981  << fEcal->MaxStexInStas() << "]) " << fTTBELL << std::endl;
1982  }
1983 } // end of ViewMatrix(...)
1984 
1985 //==========================================================================
1986 //
1987 // ViewStin ( => option COLZ )
1988 //
1989 //==========================================================================
1990 
1991 void TEcnaHistos::CorrelationsBetweenSamples(const Int_t& StinNumber)
1992 {
1993  TString CorOrCov = fCorrelationMatrix;
1994  ViewStin(StinNumber, CorOrCov);
1995 }
1996 
1997 void TEcnaHistos::CovariancesBetweenSamples(const Int_t& StinNumber)
1998 {
1999  TString CorOrCov = fCovarianceMatrix;
2000  ViewStin(StinNumber, CorOrCov);
2001 }
2002 
2003 //==========================================================================
2004 //
2005 // ViewStin ( => option COLZ )
2006 //
2007 // StexStin ==>
2008 // (sample,sample) cor or cov matrices for all the crystal of StexStin
2009 //
2010 //
2011 //==========================================================================
2012 void TEcnaHistos::ViewStin(const Int_t& cStexStin, const TString& CorOrCov)
2013 {
2014  //cor(s,s') or cov(s,s') matrices for all the crystals of one given Stin. Option COLZ mandatory.
2015 
2016  // cStexStin = number for cons (in case of EE)
2017  // StexStin = ECNA number
2018 
2019  if( (fFapStexNumber > 0) && fFapStexNumber <= fEcal->MaxStexInStas() )
2020  {
2021  Int_t StexStin = cStexStin;
2022  if(fFlagSubDet == "EE" )
2023  {StexStin = fEcalNumbering->Get1DeeSCEcnaFromDeeSCCons(fFapStexNumber, cStexStin);}
2024 
2030 
2031  if ( fMyRootFile->LookAtRootFile() == kTRUE ) // (ViewStin)
2032  {
2033  fStatusFileFound = kTRUE;
2034 
2036  TString fp_name_short = fMyRootFile->GetRootFileNameShort();
2037  // std::cout << "*TEcnaHistos::ViewStin(...)> Data are analyzed from file ----> "
2038  // << fp_name_short << std::endl;
2039 
2040  TVectorD vStin(fEcal->MaxStinEcnaInStex());
2041  for(Int_t i=0; i<fEcal->MaxStinEcnaInStex(); i++){vStin(i)=(Double_t)0.;}
2043 
2044  if ( fMyRootFile->DataExist() == kTRUE )
2045  {
2046  fStatusDataExist = kTRUE;
2047 
2048  Int_t Stin_ok = 0;
2049  for (Int_t index_Stin = 0; index_Stin < fEcal->MaxStinEcnaInStex(); index_Stin++)
2050  {
2051  if ( vStin(index_Stin) == StexStin ){Stin_ok++;}
2052  }
2053 
2054  if( Stin_ok == 1)
2055  {
2059 
2060  //......................... matrix title (ViewStin)
2061  char f_in_mat_tit[charArrLen];
2062 
2063  if ( CorOrCov == fCovarianceMatrix )
2064  {sprintf(f_in_mat_tit, "Xtal's Cov(s,s') matrices in %s.",
2065  fFapStinName.Data());}
2066  if ( CorOrCov == fCorrelationMatrix )
2067  {sprintf(f_in_mat_tit, "Xtal's Cor(s,s') matrices in %s.",
2068  fFapStinName.Data());}
2069 
2070  //................................. Bidim parameters
2071  Int_t GeoBidSize = fEcal->MaxSampADC()*fEcal->MaxCrysHocoInStin();
2072  Int_t nb_binx = GeoBidSize;
2073  Int_t nb_biny = GeoBidSize;
2074  Axis_t xinf_bid = (Axis_t)0.;
2075  Axis_t xsup_bid = (Axis_t)GeoBidSize;
2076  Axis_t yinf_bid = (Axis_t)0.;
2077  Axis_t ysup_bid = (Axis_t)GeoBidSize;
2078 
2079  //--------------------------------------------------------- (ViewStin)
2080  //............. matrices reading and histogram filling
2081 
2082  TH2D* h_geo_bid = new TH2D("geobidim_ViewStin", f_in_mat_tit,
2083  nb_binx, xinf_bid, xsup_bid,
2084  nb_biny, yinf_bid, ysup_bid); fCnewRoot++;
2085 
2086  h_geo_bid->Reset();
2087 
2088  //======================================================== (ViewStin)
2089 
2090  //----------------------------------------------- Geographical bidim filling
2091  Int_t ReadMatSize = fFapNbOfSamples;
2092  Int_t MatSize = fEcal->MaxSampADC();
2093  TMatrixD read_matrix(ReadMatSize, ReadMatSize);
2094  for(Int_t i=0; i-ReadMatSize < 0; i++){for(Int_t j=0; j-ReadMatSize < 0; j++)
2095  {read_matrix(i,j)=(Double_t)0.;}}
2096 
2097  Int_t i_data_exist = 0;
2098 
2099  for(Int_t n_crys = 0; n_crys < fEcal->MaxCrysInStin(); n_crys++)
2100  {
2101  if( CorOrCov == fCovarianceMatrix )
2102  {read_matrix = fMyRootFile->ReadCovariancesBetweenSamples(StexStin, n_crys, ReadMatSize);}
2103  if ( CorOrCov == fCorrelationMatrix )
2104  {read_matrix = fMyRootFile->ReadCorrelationsBetweenSamples(StexStin, n_crys, ReadMatSize);}
2105 
2106  if( fMyRootFile->DataExist() == kFALSE )
2107  {
2108  fStatusDataExist = kFALSE;
2109  break; // <= if no data: exiting loop over the channels
2110  }
2111  else
2112  {
2113  fStatusDataExist = kTRUE;
2114  i_data_exist++;
2115 
2116  for(Int_t i_samp = 0 ; i_samp < ReadMatSize ; i_samp++)
2117  {
2118  Int_t i_xgeo = GetXSampInStin(fFapStexNumber, StexStin, n_crys, i_samp);
2119  for(Int_t j_samp = 0; j_samp < ReadMatSize ; j_samp++)
2120  {
2121  Int_t j_ygeo = GetYSampInStin(fFapStexNumber,
2122  StexStin, n_crys, j_samp);
2123  h_geo_bid->Fill((Double_t)i_xgeo, (Double_t)j_ygeo,
2124  (Double_t)read_matrix(i_samp, j_samp));
2125  }
2126  }
2127  }
2128  }
2129 
2130  //=========== H I S T O M I N / M A X M A N A G E M E N T ======== (ViewStin)
2131  //................................ Put histo min max values
2132  TString quantity_code = "D_MCs_ChNb";
2133  if( CorOrCov == fCorrelationMatrix ){quantity_code = "D_MCs_ChNb";}
2134  if( CorOrCov == fCovarianceMatrix ){quantity_code = "H2HFccMosMatrix";}
2135 
2136  //.......... default if flag not set to "ON"
2137  SetYminMemoFromValue(quantity_code, fCnaParHistos->GetYminDefaultValue(quantity_code));
2138  SetYmaxMemoFromValue(quantity_code, fCnaParHistos->GetYmaxDefaultValue(quantity_code));
2139 
2140  if( fUserHistoMin == fUserHistoMax ){fFlagUserHistoMin = "AUTO"; fFlagUserHistoMax = "AUTO";}
2141  //.......... user's min and/or max values
2142  if( fFlagUserHistoMin == "ON" )
2143  {SetYminMemoFromValue(quantity_code, fUserHistoMin); fFlagUserHistoMin = "OFF";}
2144  if( fFlagUserHistoMax == "ON" )
2145  {SetYmaxMemoFromValue(quantity_code, fUserHistoMax); fFlagUserHistoMax = "OFF";}
2146  //................................. automatic min and/or max
2147  if( fFlagUserHistoMin == "AUTO" )
2148  {SetYminMemoFromValue(quantity_code, h_geo_bid->GetMinimum()); fFlagUserHistoMin = "OFF";}
2149  if( fFlagUserHistoMax == "AUTO" )
2150  {SetYmaxMemoFromValue(quantity_code, h_geo_bid->GetMaximum()); fFlagUserHistoMax = "OFF";}
2151  //...................................... histo set ymin and ymax (ViewStin)
2152  if ( CorOrCov == fCorrelationMatrix )
2153  {SetHistoFrameYminYmaxFromMemo((TH1D*)h_geo_bid, "D_MCs_ChNb");
2154 
2155  // ************************** A GARDER EN RESERVE *******************************
2156  //............. special contour level for correlations (square root wise scale)
2157  //Int_t nb_niv = 9;
2158  //Double_t* cont_niv = new Double_t[nb_niv]; fCnew++;
2159  //SqrtContourLevels(nb_niv, &cont_niv[0]);
2160  //h_geo_bid->SetContour(nb_niv, &cont_niv[0]);
2161  //delete [] cont_niv; fCdelete++;
2162  // ******************************** (FIN RESERVE) *******************************
2163  }
2164  if ( CorOrCov == fCovarianceMatrix )
2165  {SetHistoFrameYminYmaxFromMemo((TH1D*)h_geo_bid, "D_TNo_ChNb");}
2166 
2167  // =================================== P L O T S ======================== (ViewStin)
2168  if( i_data_exist > 0 )
2169  {
2170  char f_in[charArrLen];
2171 
2172  //...................... Taille/format canvas
2173  UInt_t canv_w = fCnaParHistos->CanvasFormatW("petit");
2174  UInt_t canv_h = fCnaParHistos->CanvasFormatH("petit");
2175 
2176  //.................................................. paves commentaires (ViewStin)
2177  SetAllPavesViewStin(StexStin);
2178 
2179  //------------------------------------ Canvas name ----------------- (ViewStin)
2180  TString name_cov_cor;
2181  name_cov_cor.Resize(charArrLen);
2182  name_cov_cor = "?";
2183  if( CorOrCov == fCovarianceMatrix ){name_cov_cor = "CovSS_Matrices_in_";}
2184  if( CorOrCov == fCorrelationMatrix){name_cov_cor = "CorSS_Matrices_in_";}
2185 
2186  TString name_visu;
2187  name_visu.Resize(charArrLen);
2188  name_visu = "colz";
2189 
2190  sprintf(f_in, "%s_%s_%s_S1_%d_R%d_%d_%d_%s%d_%s%d_%s",
2191  name_cov_cor.Data(), fFapStinName.Data(),
2194  fFapStexName.Data(), fFapStexNumber,
2195  fFapStinName.Data(), StexStin, name_visu.Data());
2196 
2197  SetHistoPresentation((TH1D*)h_geo_bid, "Stin");
2198 
2199  TCanvas *MainCanvas = new TCanvas(f_in, f_in, canv_w, canv_h); fCnewRoot++;
2200  fCurrentCanvas = MainCanvas; fCurrentCanvasName = f_in;
2201 
2202  // std::cout << "*TEcnaHistos::ViewStin(...)> Plot is displayed on canvas ----> " << f_in << std::endl;
2203 
2204  //------------------------ Canvas draw and update ------------ (ViewStin)
2205  if( fPavComGeneralTitle != nullptr ){fPavComGeneralTitle->Draw();}
2206  fPavComStex->Draw();
2207  fPavComStin->Draw();
2208  fPavComAnaRun->Draw();
2209  fPavComNbOfEvts->Draw();
2210 
2211  Double_t x_margin = fCnaParHistos->BoxLeftX("bottom_left_box") - 0.005;
2212  Double_t y_margin = fCnaParHistos->BoxTopY("bottom_right_box") + 0.005;
2213  MainCanvas->Divide(1, 1, x_margin, y_margin);
2214  gPad->cd(1);
2215 
2216  Int_t logy = 0;
2217  gPad->SetLogy(logy);
2218 
2219  h_geo_bid->DrawCopy("COLZ");
2220 
2221  //--------------------------------------------------------------------------- (ViewStin)
2222  Int_t size_Hoco = fEcal->MaxCrysHocoInStin();
2223  Int_t size_Veco = fEcal->MaxCrysVecoInStin();
2224 
2225  ViewStinGrid(fFapStexNumber, StexStin, MatSize, size_Hoco, size_Veco, " ");
2226 
2227  gPad->Update();
2228 
2229  h_geo_bid->SetStats(true);
2230 
2231  // delete MainCanvas; fCdeleteRoot++;
2232  }
2233 
2234  h_geo_bid->Delete(); h_geo_bid = nullptr; fCdeleteRoot++;
2235  }
2236  else
2237  {
2238  std::cout << "!TEcnaHistos::ViewStin(...)> *ERROR* =====> "
2239  << fFapStinName.Data() << " "
2240  << cStexStin << " not found."
2241  << " Available numbers = ";
2242  for(Int_t i = 0; i < fEcal->MaxStinEcnaInStex(); i++)
2243  {
2244  if( vStin(i) > 0 )
2245  {
2246  if( fFlagSubDet == "EB" ){std::cout << (Int_t)vStin(i) << ", ";}
2247  if( fFlagSubDet == "EE" )
2248  {std::cout << fEcalNumbering->GetDeeSCConsFrom1DeeSCEcna(fFapStexNumber, (Int_t)vStin(i)) << ", ";}
2249  }
2250  }
2251  std::cout << fTTBELL << std::endl;
2252  }
2253  } // end of if ( myRootFile->DataExist() == kTRUE )
2254  else
2255  {
2256  fStatusDataExist = kFALSE;
2257  }
2258  } // end of if ( fMyRootFile->LookAtRootFile() == kTRUE )
2259  else
2260  {
2261  fStatusFileFound = kFALSE;
2262 
2263  std::cout << "!TEcnaHistos::ViewStin(...)> *ERROR* =====> "
2264  << " ROOT file not found" << fTTBELL << std::endl;
2265  }
2266  }
2267  else
2268  {
2269  std::cout << "!TEcnaHistos::ViewStin(...)> " << fFapStexName.Data()
2270  << " = " << fFapStexNumber << ". Out of range (range = [1,"
2271  << fEcal->MaxStexInStas() << "]) " << fTTBELL << std::endl;
2272  }
2273 } // end of ViewStin(...)
2274 
2275 //====================================================================================
2276 //
2277 // StinCrystalNumbering
2278 // independent of the ROOT file => StexNumber as argument
2279 //
2280 //====================================================================================
2281 void TEcnaHistos::StinCrystalNumbering(const Int_t& StexNumber, const Int_t& cStexStin)
2282 {
2283 //display the crystal numbering of one Stin
2284 // cStexStin = Tower number in case of EB or SC number for construction in case of EE
2285 
2286  if( fFlagSubDet == "EB" ){TowerCrystalNumbering(StexNumber, cStexStin);}
2287  if( fFlagSubDet == "EE" ){SCCrystalNumbering(StexNumber, cStexStin);}
2288 }
2289 //----------------> end of StinCrystalNumbering()
2290 
2291 //====================================================================================
2292 //
2293 // TowerCrystalNumbering
2294 // independent of the ROOT file => SMNumber as argument
2295 //
2296 //====================================================================================
2297 void TEcnaHistos::TowerCrystalNumbering(const Int_t& SMNumber, const Int_t& n1SMTow)
2298 {
2299  //display the crystal numbering of one tower
2300 
2301  if( (SMNumber > 0) && (SMNumber <= fEcal->MaxSMInEB()) )
2302  {
2304 
2305  Int_t MatSize = fEcal->MaxSampADC();
2306  Int_t size_eta = fEcal->MaxCrysEtaInTow();
2307  Int_t size_phi = fEcal->MaxCrysPhiInTow();
2308 
2309  //---------------------------------- bidim
2310 
2311  Int_t nb_bins = fEcal->MaxSampADC();
2312  Int_t nx_gbins = nb_bins*size_eta;
2313  Int_t ny_gbins = nb_bins*size_phi;
2314 
2315  Axis_t xinf_gbid = (Axis_t)0.;
2316  Axis_t xsup_gbid = (Axis_t)fEcal->MaxSampADC()*size_eta;
2317  Axis_t yinf_gbid = (Axis_t)0.;
2318  Axis_t ysup_gbid = (Axis_t)fEcal->MaxSampADC()*size_phi;
2319 
2320  TString fg_name = "M0' crystals";
2321  TString fg_tit = "Xtal numbering (chan. in tow, chan. in SM, Xtal in SM, hashed)";
2322 
2323  //----------------------- empty 2D histo for pave coordinates registration
2324  TH2D *h_gbid;
2325  h_gbid = new TH2D(fg_name.Data(), fg_tit.Data(),
2326  nx_gbins, xinf_gbid, xsup_gbid,
2327  ny_gbins, yinf_gbid, ysup_gbid); fCnewRoot++;
2328  h_gbid->Reset();
2329 
2330  //----------------- T R A C E D E S P L O T S ------ (TowerCrystalNumbering)
2331 
2332  char f_in[charArrLen];
2333 
2334  //...................... Taille/format canvas
2335 
2336  UInt_t canv_w = fCnaParHistos->CanvasFormatW("petit");
2337  UInt_t canv_h = fCnaParHistos->CanvasFormatH("petit");
2338 
2339  //........................................ couleurs
2340  Color_t couleur_noir = fCnaParHistos->SetColorsForNumbers("crystal");
2341  Color_t couleur_rouge = fCnaParHistos->SetColorsForNumbers("lvrb_top");
2342  Color_t couleur_bleu_fonce = fCnaParHistos->SetColorsForNumbers("lvrb_bottom");
2343 
2344  gStyle->SetPalette(1,nullptr); // Rainbow spectrum
2345 
2346  //.................................... options generales
2348 
2349  //.................................... paves commentaires (TowerCrystalNumbering)
2350 
2351  SetAllPavesViewStinCrysNb(SMNumber, n1SMTow);
2352 
2353  //---------------------------------------------- (TowerCrystalNumbering)
2354 
2355  //..................... Canvas name
2356  sprintf(f_in, "Crystal_Numbering_for_%s_X_%d_%s%d",
2357  fFapStinName.Data(), n1SMTow, fFapStexName.Data(), SMNumber);
2358 
2359  SetHistoPresentation((TH1D*)h_gbid, "Stin");
2360 
2361  TCanvas *MainCanvas = new TCanvas(f_in, f_in, canv_w , canv_h); fCnewRoot++;
2362  fCurrentCanvas = MainCanvas; fCurrentCanvasName = f_in;
2363 
2364  // std::cout << "*TEcnaHistosEB::TowerCrystalNumbering(...)> Plot is displayed on canvas ----> "
2365  // << f_in << std::endl;
2366 
2367  Double_t x_margin = fCnaParHistos->BoxLeftX("bottom_left_box") - 0.005;
2368  Double_t y_margin = fCnaParHistos->BoxTopY("bottom_right_box") + 0.005;
2369  MainCanvas->Divide(1, 1, x_margin, y_margin);
2370 
2371  fPavComStex->Draw();
2372  fPavComStin->Draw();
2373  fPavComLVRB->Draw();
2374 
2375  Bool_t b_true = true;
2376  Bool_t b_false = false;
2377  gPad->cd(1);
2378 
2379  gStyle->SetMarkerColor(couleur_rouge);
2380 
2381  Int_t logy = 0;
2382  gPad->SetLogy(logy);
2383 
2384  //............................... bidim .......... (TowerCrystalNumbering)
2385 
2386  h_gbid->SetStats(b_false);
2387  h_gbid->DrawCopy("COLZ");
2388 
2389  //..... Ecriture des numeros de channels dans la grille..... (TowerCrystalNumbering)
2390  // et des numeros SM des cristaux
2391 
2392  //............... prepa arguments fixes appels [TText]->DrawText()
2393  char f_in_elec[charArrLen];
2394  TString TowerLvrbType = fEcalNumbering->GetTowerLvrbType(n1SMTow) ;
2395  TText *text_elec_num = new TText(); fCnewRoot++;
2396  if ( TowerLvrbType == "top" ){text_elec_num->SetTextColor(couleur_rouge);}
2397  if ( TowerLvrbType == "bottom" ){text_elec_num->SetTextColor(couleur_bleu_fonce);}
2398  text_elec_num->SetTextSize(0.04);
2399 
2400  char f_in_sme[charArrLen];
2401  TText *text_sme_num = new TText(); fCnewRoot++;
2402  if ( TowerLvrbType == "top" ){text_sme_num->SetTextColor(couleur_rouge);}
2403  if ( TowerLvrbType == "bottom" ){text_sme_num->SetTextColor(couleur_bleu_fonce);}
2404  text_sme_num->SetTextSize(0.03);
2405 
2406  char f_in_sm[charArrLen];
2407  TText *text_sm_num = new TText(); fCnewRoot++;
2408  text_sm_num->SetTextColor(couleur_noir);
2409  text_sm_num->SetTextSize(0.03);
2410 
2411  char f_in_hsd[charArrLen];
2412  TText *text_hsd_num = new TText(); fCnewRoot++;
2413  text_hsd_num->SetTextColor(couleur_noir);
2414  text_hsd_num->SetTextSize(0.03);
2415 
2416  //............... prepa arguments fixes appels GetXGeo(...) et GetYGeo(...)
2417  Int_t i_samp = 0;
2418  //Double_t off_set = (Double_t)(fEcal->MaxSampADC()/4);
2419  Double_t off_set = (Double_t)1.;
2420 
2421  //------------------ LOOP ON THE CRYSTAL ELECTRONIC CHANNEL NUMBER (TowerCrystalNumbering)
2422 
2423  for (Int_t i_chan = 0; i_chan < fEcal->MaxCrysInTow(); i_chan++)
2424  {
2425  Int_t i_xgeo = GetXSampInStin(SMNumber, n1SMTow, i_chan, i_samp);
2426  Int_t i_ygeo = GetYSampInStin(SMNumber, n1SMTow, i_chan, i_samp);
2427 
2428  Double_t xgi = i_xgeo + 3.*off_set;
2429  Double_t ygj = i_ygeo + 7.*off_set;
2430 
2431  Double_t xgi_sme = i_xgeo + 3.*off_set;
2432  Double_t ygj_sme = i_ygeo + 5.*off_set;
2433 
2434  Double_t xgi_sm = i_xgeo + 3.*off_set;
2435  Double_t ygj_sm = i_ygeo + 3.*off_set;
2436 
2437  Double_t xgi_hsd = i_xgeo + 3.*off_set;
2438  Double_t ygj_hsd = i_ygeo + 1.*off_set;
2439 
2440  Int_t i_crys_sme = fEcalNumbering->Get0SMEchaFrom1SMTowAnd0TowEcha(n1SMTow, i_chan);
2441  Int_t i_crys_sm = fEcalNumbering->Get1SMCrysFrom1SMTowAnd0TowEcha(n1SMTow, i_chan);
2442 
2443  Double_t Eta = fEcalNumbering->GetEta(SMNumber, n1SMTow, i_chan);
2444  Double_t Phi = fEcalNumbering->GetPhi(SMNumber, n1SMTow, i_chan);
2445 
2446  Int_t i_crys_hsd = fEcalNumbering->GetHashedNumberFromIEtaAndIPhi((Int_t)Eta, (Int_t)Phi);
2447 
2448  //------------------------------------------------------- TowerCrystalNumbering
2449 
2450  sprintf(f_in_elec, "%d", i_chan);
2451  text_elec_num->DrawText(xgi, ygj, f_in_elec);
2452 
2453  sprintf(f_in_sme, "%d", i_crys_sme);
2454  text_sme_num->DrawText(xgi_sme, ygj_sme, f_in_sme);
2455 
2456  sprintf(f_in_sm, "%d", i_crys_sm);
2457  text_sm_num->DrawText(xgi_sm, ygj_sm, f_in_sm);
2458 
2459  sprintf(f_in_hsd, "%d", i_crys_hsd);
2460  text_sm_num->DrawText(xgi_hsd, ygj_hsd, f_in_hsd);
2461  }
2462  text_sm_num->Delete(); text_sm_num = nullptr; fCdeleteRoot++;
2463  text_sme_num->Delete(); text_sme_num = nullptr; fCdeleteRoot++;
2464  text_elec_num->Delete(); text_elec_num = nullptr; fCdeleteRoot++;
2465  text_hsd_num->Delete(); text_hsd_num = nullptr; fCdeleteRoot++;
2466 
2467  ViewStinGrid(SMNumber, n1SMTow, MatSize, size_eta, size_phi, "CrystalNumbering");
2468 
2469  gPad->Update();
2470  h_gbid->SetStats(b_true);
2471 
2472  h_gbid->Delete(); h_gbid = nullptr; fCdeleteRoot++;
2473 
2474  }
2475  else
2476  {
2477  std::cout << "!TEcnaHistos::TowerCrystalNumbering(...)> SM = " << SMNumber
2478  << ". Out of range ( range = [1," << fEcal->MaxSMInEB() << "] )" << fTTBELL << std::endl;
2479  }
2480 }
2481 //----------------> end of TowerCrystalNumbering()
2482 
2483 //====================================================================================
2484 //
2485 // SCCrystalNumbering
2486 // independent of the ROOT file => DeeNumber and n1DeeSCEcna as argument
2487 //
2488 //====================================================================================
2489 void TEcnaHistos::SCCrystalNumbering(const Int_t& DeeNumber, const Int_t& n1DeeSCCons)
2490 {
2491  //display the crystal numbering of one SC
2492 
2493  if( (DeeNumber > 0) && (DeeNumber <= fEcal->MaxDeeInEE()) )
2494  {
2495  Int_t n1DeeSCEcna = fEcalNumbering->Get1DeeSCEcnaFromDeeSCCons(DeeNumber, n1DeeSCCons);
2498 
2499  //Int_t MatSize = fEcal->MaxSampADC();
2500  Int_t size_IX = fEcal->MaxCrysIXInSC();
2501  Int_t size_IY = fEcal->MaxCrysIYInSC();
2502 
2503  //---------------------------------- bidim
2504 
2505  Int_t nb_bins = fEcal->MaxSampADC();
2506  Int_t nx_gbins = nb_bins*size_IX;
2507  Int_t ny_gbins = nb_bins*size_IY;
2508 
2509  Axis_t xinf_gbid = (Axis_t)0.;
2510  Axis_t xsup_gbid = (Axis_t)fEcal->MaxSampADC()*size_IX;
2511  Axis_t yinf_gbid = (Axis_t)0.;
2512  Axis_t ysup_gbid = (Axis_t)fEcal->MaxSampADC()*size_IY;
2513 
2514  TString fg_name = "crystalnbring";
2515  TString fg_tit = "Xtal numbering for construction";
2516 
2517  TH2D *h_gbid;
2518  h_gbid = new TH2D(fg_name.Data(), fg_tit.Data(),
2519  nx_gbins, xinf_gbid, xsup_gbid,
2520  ny_gbins, yinf_gbid, ysup_gbid); fCnewRoot++;
2521  h_gbid->Reset();
2522 
2523  //----------------- T R A C E D E S P L O T S ------ (SCCrystalNumbering)
2524 
2525  char f_in[charArrLen];
2526 
2527  //...................... Taille/format canvas
2528 
2529  UInt_t canv_w = fCnaParHistos->CanvasFormatW("petit");
2530  UInt_t canv_h = fCnaParHistos->CanvasFormatH("petit");
2531  //........................................ couleurs
2532  // Color_t couleur_noir = fCnaParHistos->ColorDefinition("noir");
2533  Color_t couleur_rouge = fCnaParHistos->ColorDefinition("rouge");
2534  // Color_t couleur_bleu_fonce = fCnaParHistos->ColorDefinition("bleu_fonce");
2535 
2536  gStyle->SetPalette(1,nullptr); // Rainbow spectrum
2537  //.................................... options generales
2539 
2540  //.................................... paves commentaires (SCCrystalNumbering)
2541  SetAllPavesViewStinCrysNb(DeeNumber, n1DeeSCEcna);
2542 
2543  //---------------------------------------------- (SCCrystalNumbering)
2544  //..................... Canvas name
2545  sprintf(f_in, "Crystal_Numbering_for_%s_X_%d_%s%d",
2546  fFapStinName.Data(), n1DeeSCEcna, fFapStexName.Data(), DeeNumber);
2547 
2548  SetHistoPresentation((TH1D*)h_gbid, "Stin");
2549 
2550  TCanvas *MainCanvas = new TCanvas(f_in, f_in, canv_w , canv_h); fCnewRoot++;
2551  fCurrentCanvas = MainCanvas; fCurrentCanvasName = f_in;
2552 
2553  // std::cout << "*TEcnaHistosEE::SCCrystalNumbering(...)> Plot is displayed on canvas ----> "
2554  // << f_in << std::endl;
2555 
2556  Double_t x_margin = fCnaParHistos->BoxLeftX("bottom_left_box") - 0.005;
2557  Double_t y_margin = fCnaParHistos->BoxTopY("bottom_right_box") + 0.005;
2558 
2559  MainCanvas->Divide(1, 1, x_margin, y_margin);
2560 
2561  fPavComStex->Draw();
2562  fPavComStin->Draw();
2563  fPavComCxyz->Draw();
2564 
2565  Bool_t b_true = true;
2566  Bool_t b_false = false;
2567  gPad->cd(1);
2568 
2569  gStyle->SetMarkerColor(couleur_rouge);
2570 
2571  Int_t logy = 0;
2572  gPad->SetLogy(logy);
2573 
2574  //............................... bidim .......... (SCCrystalNumbering)
2575  h_gbid->SetStats(b_false);
2576  fCnaParHistos->SetViewHistoOffsets((TH1D*)h_gbid, "Stin", " ");
2577  h_gbid->DrawCopy("COLZ");
2578 
2579  //..... Ecriture des numeros de channels dans la grille..... (SCCrystalNumbering)
2580  // et des numeros Dee des cristaux
2581  TString SCQuadType = fEcalNumbering->GetSCQuadFrom1DeeSCEcna(n1DeeSCEcna);
2582  TString DeeDir = fEcalNumbering->GetDeeDirViewedFromIP(DeeNumber);
2583  TString DeeEndcap = fEcalNumbering->GetEEDeeEndcap(DeeNumber);
2584  Color_t couleur_SC = GetSCColor(DeeEndcap, DeeDir, SCQuadType);
2585  //............... prepa arguments fixes appels [TText]->DrawText()
2586  char f_in_elec[charArrLen];
2587  TText *text_elec_num = new TText(); fCnewRoot++;
2588  text_elec_num->SetTextColor(couleur_SC);
2589  text_elec_num->SetTextSize(0.06);
2590 
2591  //............... prepa arguments fixes appels GetXGeo(...) et GetYGeo(...)
2592  Int_t i_samp = 0;
2593  Double_t off_set = (Double_t)(fEcal->MaxSampADC()/3);
2594 
2595  //------------------ LOOP ON THE CRYSTAL ELECTRONIC CHANNEL NUMBER (SCCrystalNumbering)
2596 
2597  for (Int_t i_chan = 0; i_chan < fEcal->MaxCrysInSC(); i_chan++)
2598  {
2599  Int_t i_xgeo = GetXSampInStin(DeeNumber, n1DeeSCEcna, i_chan, i_samp);
2600  Int_t i_ygeo = GetYSampInStin(DeeNumber, n1DeeSCEcna, i_chan, i_samp);
2601 
2602  Double_t xgi = i_xgeo + off_set;
2603  Double_t ygj = i_ygeo + 2*off_set;
2604 
2605  //------------------------------------------------------- SCCrystalNumbering
2606  Int_t i_chan_p = i_chan+1;
2607  sprintf(f_in_elec, "%d", i_chan_p); // offset = +1 (Xtal for construction numbering, CMS NOTE 2006/027)
2608  text_elec_num->DrawText(xgi, ygj, f_in_elec);
2609  }
2610  text_elec_num->Delete(); text_elec_num = nullptr; fCdeleteRoot++;
2611 
2612  ViewStinGrid(DeeNumber, n1DeeSCEcna, fEcal->MaxSampADC(), size_IX, size_IY, "CrystalNumbering");
2613 
2614  gPad->Update();
2615  h_gbid->SetStats(b_true);
2616 
2617  h_gbid->Delete(); h_gbid = nullptr; fCdeleteRoot++;
2618 
2619  }
2620  else
2621  {
2622  std::cout << "!TEcnaHistos::SCCrystalNumbering(...)> Dee = " << DeeNumber
2623  << ". Out of range ( range = [1," << fEcal->MaxDeeInEE() << "] )" << fTTBELL << std::endl;
2624  }
2625 }
2626 //----------------> end of SCCrystalNumbering()
2627 
2628 //==================================================================================
2629 //
2630 // GetXSampInStin, GetYSampInStin
2631 //
2632 //==================================================================================
2633 Int_t TEcnaHistos::GetXSampInStin(const Int_t& StexNumber, const Int_t& StexStin,
2634  const Int_t& i0StinEcha, const Int_t& i_samp)
2635 {
2636 //Gives the X coordinate in the geographic view of one Stin
2637 
2638  Int_t ix_geo = -1;
2639 
2640  if( fFlagSubDet == "EB" )
2641  {TString ctype = fEcalNumbering->GetStinLvrbType(StexStin);
2642  TString btype = fEcalNumbering->GetStexHalfStas(StexNumber);
2643  if( (btype == "EB+" && ctype == "bottom") || (btype == "EB-" && ctype == "top") )
2644  {ix_geo = ( (fEcal->MaxCrysHocoInStin()-1)-(i0StinEcha/fEcal->MaxCrysHocoInStin()) )
2645  *fEcal->MaxSampADC() + i_samp;}
2646  if( (btype == "EB+" && ctype == "top") || (btype == "EB-" && ctype == "bottom") )
2647  {ix_geo = ( i0StinEcha/fEcal->MaxCrysHocoInStin() )*fEcal->MaxSampADC() + i_samp;}}
2648 
2649  if( fFlagSubDet == "EE" )
2650  { TString DeeDir = fEcalNumbering->GetDeeDirViewedFromIP(StexNumber);
2651  if( DeeDir == "right" )
2652  {ix_geo = (fEcalNumbering->GetIXCrysInSC(StexNumber, StexStin, i0StinEcha)-1)*fEcal->MaxSampADC() + i_samp;}
2653  if( DeeDir == "left" )
2654  {ix_geo = (fEcal->MaxCrysHocoInStin() - fEcalNumbering->GetIXCrysInSC(StexNumber, StexStin, i0StinEcha))*
2655  fEcal->MaxSampADC() + i_samp;}}
2656 
2657  return ix_geo;
2658 }
2659 //--------------------------------------------------------------------------------------------
2660 Int_t TEcnaHistos::GetYSampInStin(const Int_t& StexNumber, const Int_t& StexStin,
2661  const Int_t& i0StinEcha, const Int_t& j_samp)
2662 {
2663 //Gives the Y coordinate in the geographic view of one Stin
2664 
2665  Int_t jy_geo = -1;
2666 
2667  if( fFlagSubDet == "EB" )
2668  {
2669  TString ctype = fEcalNumbering->GetStinLvrbType(StexStin);
2670  TString btype = fEcalNumbering->GetStexHalfStas(StexNumber);
2671 
2672  //.......................... jy_geo for the EB+ (and beginning for the EB-)
2673 
2674  if( (btype == "EB+" && ctype == "top") || (btype == "EB-" && ctype == "bottom") )
2675  {
2676  if( i0StinEcha >= 0 && i0StinEcha <= 4 ) {jy_geo = (i0StinEcha - 0)*fEcal->MaxSampADC() + j_samp;}
2677  if( i0StinEcha >= 5 && i0StinEcha <= 9 ) {jy_geo = -(i0StinEcha - 9)*fEcal->MaxSampADC() + j_samp;}
2678  if( i0StinEcha >= 10 && i0StinEcha <= 14 ) {jy_geo = (i0StinEcha - 10)*fEcal->MaxSampADC() + j_samp;}
2679  if( i0StinEcha >= 15 && i0StinEcha <= 19 ) {jy_geo = -(i0StinEcha - 19)*fEcal->MaxSampADC() + j_samp;}
2680  if( i0StinEcha >= 20 && i0StinEcha <= 24 ) {jy_geo = (i0StinEcha - 20)*fEcal->MaxSampADC() + j_samp;}
2681  }
2682 
2683  if( (btype == "EB+" && ctype == "bottom") || (btype == "EB-" && ctype == "top") )
2684  {
2685  if( i0StinEcha >= 0 && i0StinEcha <= 4 )
2686  {jy_geo = ( (fEcal->MaxCrysVecoInStin()-1) - (i0StinEcha- 0))*fEcal->MaxSampADC() + j_samp;}
2687  if( i0StinEcha >= 5 && i0StinEcha <= 9 )
2688  {jy_geo = ( (fEcal->MaxCrysVecoInStin()-1) + (i0StinEcha- 9))*fEcal->MaxSampADC() + j_samp;}
2689  if( i0StinEcha >= 10 && i0StinEcha <= 14 )
2690  {jy_geo = ( (fEcal->MaxCrysVecoInStin()-1) - (i0StinEcha-10))*fEcal->MaxSampADC() + j_samp;}
2691  if( i0StinEcha >= 15 && i0StinEcha <= 19 )
2692  {jy_geo = ( (fEcal->MaxCrysVecoInStin()-1) + (i0StinEcha-19))*fEcal->MaxSampADC() + j_samp;}
2693  if( i0StinEcha >= 20 && i0StinEcha <= 24 )
2694  {jy_geo = ( (fEcal->MaxCrysVecoInStin()-1) - (i0StinEcha-20))*fEcal->MaxSampADC() + j_samp;}
2695  }
2696  }
2697 
2698  if( fFlagSubDet == "EE" )
2699  {jy_geo =
2700  (fEcalNumbering->GetJYCrysInSC(StexNumber, StexStin, i0StinEcha) - 1)*fEcal->MaxSampADC() + j_samp;}
2701 
2702  return jy_geo;
2703 }
2704 
2705 //===============================================================================
2706 //
2707 // ViewStinGrid
2708 // independent of the ROOT file => StexNumber as argument
2709 //
2710 //===============================================================================
2711 void TEcnaHistos::ViewStinGrid(const Int_t& StexNumber,
2712  const Int_t& StexStin, const Int_t& MatSize,
2713  const Int_t& size_Hoco, const Int_t& size_Veco,
2714  const TString& chopt)
2715 {
2716  //Grid of one Stin with axis Hoco and Veco
2717 
2718  if( fFlagSubDet == "EB"){ViewTowerGrid(StexNumber, StexStin, MatSize,
2719  size_Hoco, size_Veco, chopt);}
2720  if( fFlagSubDet == "EE"){ViewSCGrid(StexNumber, StexStin, MatSize,
2721  size_Hoco, size_Veco, chopt);}
2722 
2723 } // end of ViewStinGrid
2724 
2725 //===============================================================================
2726 //
2727 // ViewTowerGrid
2728 // independent of the ROOT file => SMNumber as argument
2729 //
2730 //===============================================================================
2731 void TEcnaHistos::ViewTowerGrid(const Int_t& SMNumber,
2732  const Int_t& n1SMTow, const Int_t& MatSize,
2733  const Int_t& size_eta, const Int_t& size_phi,
2734  const TString& chopt)
2735 {
2736  //Grid of one tower with axis eta and phi
2737  //.......................... lignes verticales
2738  Double_t xline = 0.;
2739 
2740  Double_t yline_bot = 0.;
2741  Double_t yline_top = (Double_t)(MatSize*size_eta);
2742 
2743  for( Int_t i = 0 ; i < size_eta ; i++)
2744  {
2745  xline = xline + (Double_t)MatSize;
2746  TLine *lin;
2747  lin = new TLine(xline, yline_bot, xline, yline_top); fCnewRoot++;
2748  lin->Draw();
2749  // delete lin; fCdeleteRoot++;
2750  }
2751  //............................. lignes horizontales
2752  Double_t xline_left = 0;
2753  Double_t xline_right = (Double_t)(MatSize*size_eta);
2754 
2755  Double_t yline = -(Double_t)MatSize;
2756 
2757  for( Int_t j = 0 ; j < size_eta+1 ; j++)
2758  {
2759  yline = yline + (Double_t)MatSize;
2760  TLine *lin;
2761  lin = new TLine(xline_left, yline, xline_right, yline); fCnewRoot++;
2762  lin->Draw();
2763  // delete lin; fCdeleteRoot++;
2764  }
2765 
2766  //------------------ trace axes en eta et phi --------------- ViewTowerGrid
2767 
2768  //...................................................... Axe i(eta) (x bottom) (ViewTowerGrid)
2769 
2770  Double_t eta_min = fEcalNumbering->GetIEtaMin(SMNumber, n1SMTow);
2771  Double_t eta_max = fEcalNumbering->GetIEtaMax(SMNumber, n1SMTow);
2772 
2773  TString x_var_name = GetEtaPhiAxisTitle("ietaTow");
2774  TString x_direction = fEcalNumbering->GetXDirectionEB(SMNumber);
2775 
2776  Float_t tit_siz_x = fCnaParHistos->AxisTitleSize();
2777  Float_t lab_siz_x = fCnaParHistos->AxisLabelSize();
2778  Float_t tic_siz_x = fCnaParHistos->AxisTickSize();
2779  Float_t tit_off_x = fCnaParHistos->AxisTitleOffset("Towx");
2780  Float_t lab_off_x = fCnaParHistos->AxisLabelOffset("Towx");
2781 
2782  new TF1("f1", x_direction.Data(), eta_min, eta_max); fCnewRoot++;
2783 
2784  TGaxis* sup_axis_x = nullptr;
2785 
2786  if ( x_direction == "-x" ) // NEVER IN THIS CASE: xmin->xmax <=> right->left ("-x") direction
2787  {sup_axis_x = new TGaxis( -(Float_t)MatSize, (Float_t)0, (Float_t)(size_eta*MatSize), (Float_t)0.,
2788  "f1", size_eta, "BCS" , 0.); fCnewRoot++;
2789  std::cout << "TEcnaHistosEB::ViewTowerGrid()> non foreseen case. eta with -x direction." << fTTBELL << std::endl;}
2790 
2791  if ( x_direction == "x" ) // ALWAYS IN THIS CASE: xmin->xmax <=> left->right ("x") direction
2792  {sup_axis_x = new TGaxis( (Float_t)0. , (Float_t)0., (Float_t)(size_eta*MatSize), (Float_t)0.,
2793  "f1", size_eta, "CS" , 0.); fCnewRoot++;}
2794 
2795  sup_axis_x->SetTitle(x_var_name);
2796  sup_axis_x->SetTitleSize(tit_siz_x);
2797  sup_axis_x->SetTitleOffset(tit_off_x);
2798  sup_axis_x->SetLabelSize(lab_siz_x);
2799  sup_axis_x->SetLabelOffset(lab_off_x);
2800  sup_axis_x->SetTickSize(tic_siz_x);
2801  sup_axis_x->Draw("SAME");
2802 
2803  //...................................................... Axe phi (y right) (ViewTowerGrid)
2804  Float_t tit_siz_y = fCnaParHistos->AxisTitleSize();
2805  Float_t lab_siz_y = fCnaParHistos->AxisLabelSize();
2806  Float_t tic_siz_y = fCnaParHistos->AxisTickSize();
2807  Float_t tit_off_y = fCnaParHistos->AxisTitleOffset("Towy");
2808  Float_t lab_off_y = fCnaParHistos->AxisLabelOffset("Towy");
2809 
2810  if( chopt == "CrystalNumbering" )
2811  {
2812  Double_t phi_min = fEcalNumbering->GetPhiMin(SMNumber, n1SMTow);
2813  Double_t phi_max = fEcalNumbering->GetPhiMax(SMNumber, n1SMTow);
2814 
2815  TString y_var_name = GetEtaPhiAxisTitle("phi");
2816  TString y_direction = fEcalNumbering->GetYDirectionEB(SMNumber);
2817 
2818  new TF1("f2", y_direction.Data(), phi_min, phi_max); fCnewRoot++;
2819  TGaxis* sup_axis_y = nullptr;
2820 
2821  if ( y_direction == "-x" ) // ALWAYS IN THIS CASE: ymin->ymax <=> top->bottom ("-x") direction
2822  {sup_axis_y = new TGaxis( (Float_t)(size_eta*MatSize), (Float_t)0.,
2823  (Float_t)(size_eta*MatSize), (Float_t)(size_phi*MatSize),
2824  "f2", size_phi, "+CS", 0.); fCnewRoot++;}
2825 
2826  if ( y_direction == "x" ) // NEVER IN THIS CASE: ymin->ymax <=> bottom->top ("x") direction
2827  {sup_axis_y = new TGaxis( (Float_t)0., (Float_t)0., (Float_t) 0., (Float_t)(size_phi*MatSize),
2828  "f2", size_phi, "BCS", 0.); fCnewRoot++;}
2829 
2830  sup_axis_y->SetTitle(y_var_name);
2831  sup_axis_y->SetTitleSize(tit_siz_y);
2832  sup_axis_y->SetTitleOffset(tit_off_y);
2833  sup_axis_y->SetLabelSize(lab_siz_y);
2834  sup_axis_y->SetLabelOffset(lab_off_y);
2835  sup_axis_y->SetTickSize(tic_siz_y);
2836  sup_axis_y->Draw("SAME");
2837  }
2838  //...................................................... Axe j(phi) (y left) (ViewTowerGrid)
2839 
2840  Double_t j_phi_min = fEcalNumbering->GetJPhiMin(SMNumber, n1SMTow);
2841  Double_t j_phi_max = fEcalNumbering->GetJPhiMax(SMNumber, n1SMTow);
2842 
2843  TString jy_var_name = GetEtaPhiAxisTitle("jphiTow");
2844  TString jy_direction = fEcalNumbering->GetJYDirectionEB(SMNumber);
2845 
2846  new TF1("f3", jy_direction.Data(), j_phi_min, j_phi_max); fCnewRoot++;
2847  TGaxis* sup_axis_jy = nullptr;
2848 
2849  sup_axis_jy = new TGaxis( (Float_t)0., (Float_t)0.,
2850  (Float_t)0., (Float_t)(size_phi*MatSize),
2851  "f3", size_phi, "SC", 0.); fCnewRoot++;
2852 
2853  sup_axis_jy->SetTitle(jy_var_name);
2854  sup_axis_jy->SetTitleSize(tit_siz_y);
2855  sup_axis_jy->SetTitleOffset(tit_off_y);
2856  sup_axis_jy->SetLabelSize(lab_siz_y);
2857  sup_axis_jy->SetLabelOffset(lab_off_y);
2858  sup_axis_jy->SetTickSize(tic_siz_y);
2859  sup_axis_jy->Draw("SAME");
2860 } // end of ViewTowerGrid
2861 
2862 //===============================================================================
2863 //
2864 // ViewSCGrid
2865 // independent of the ROOT file => DeeNumber as argument
2866 //
2867 //===============================================================================
2868 void TEcnaHistos::ViewSCGrid(const Int_t& DeeNumber, const Int_t& n1DeeSCEcna,
2869  const Int_t& MatSize, const Int_t& size_IX,
2870  const Int_t& size_IY, const TString& chopt)
2871 {
2872  //Grid of one SC with axis IX and IY
2873  //.......................... lignes verticales
2874  Double_t xline = 0.;
2875 
2876  Double_t yline_bot = 0.;
2877  Double_t yline_top = (Double_t)(MatSize*size_IX);
2878 
2879  for( Int_t i = 0 ; i < size_IX ; i++)
2880  {
2881  xline = xline + (Double_t)MatSize;
2882  TLine *lin;
2883  lin = new TLine(xline, yline_bot, xline, yline_top); fCnewRoot++;
2884  lin->Draw();
2885  // delete lin; fCdeleteRoot++;
2886  }
2887  //............................. lignes horizontales
2888  Double_t xline_left = 0;
2889  Double_t xline_right = (Double_t)(MatSize*size_IX);
2890 
2891  Double_t yline = -(Double_t)MatSize;
2892 
2893  for( Int_t j = 0 ; j < size_IX+1 ; j++)
2894  {
2895  yline = yline + (Double_t)MatSize;
2896  TLine *lin;
2897  lin = new TLine(xline_left, yline, xline_right, yline); fCnewRoot++;
2898  lin->Draw();
2899  // delete lin; fCdeleteRoot++;
2900  }
2901 
2902  //------------------ trace axes en IX et IY --------------- ViewSCGrid
2903 
2904  //...................................................... Axe i(IX) (x bottom) (ViewSCGrid)
2905 
2906  Double_t IX_min = fEcalNumbering->GetIIXMin(n1DeeSCEcna) - 0.5;
2907  Double_t IX_max = fEcalNumbering->GetIIXMax(n1DeeSCEcna) + 0.5;
2908 
2909  Float_t axis_x_inf = 0;
2910  Float_t axis_x_sup = 0;
2911  Float_t axis_y_inf = 0;
2912  Float_t axis_y_sup = 0;
2913  Int_t axis_nb_div = 1;
2914  Double_t IX_values_min = 0;
2915  Double_t IX_values_max = 0;
2916  Option_t* axis_chopt = "CS";
2917 
2918  Float_t tit_siz_x = fCnaParHistos->AxisTitleSize();
2919  Float_t lab_siz_x = fCnaParHistos->AxisLabelSize();
2920  Float_t tic_siz_x = fCnaParHistos->AxisTickSize();
2921  Float_t tit_off_x = fCnaParHistos->AxisTitleOffset("SCx");
2922  Float_t lab_off_x = fCnaParHistos->AxisLabelOffset("SCx");
2923 
2924  TString StrDee = "iIXSC";
2925  if( DeeNumber == 1 ){StrDee = "iIXDee1";}
2926  if( DeeNumber == 2 ){StrDee = "iIXDee2";}
2927  if( DeeNumber == 3 ){StrDee = "iIXDee3";}
2928  if( DeeNumber == 4 ){StrDee = "iIXDee4";}
2929 
2930  TString x_var_name = GetIXIYAxisTitle(StrDee.Data());
2931  TString x_direction = fEcalNumbering->GetXDirectionEE(DeeNumber);
2932 
2933  TGaxis* sup_axis_x = nullptr;
2934 
2935  if( DeeNumber == 1 ) // -xmin -> -xmax <=> left->right
2936  {
2937  axis_x_inf = 0; axis_y_inf = 0; axis_x_sup = size_IX*MatSize; axis_y_sup = 0;
2938  axis_nb_div = size_IX;
2939  IX_values_min = -IX_min ; IX_values_max = -IX_max; axis_chopt = "CS";
2940  }
2941  if( DeeNumber == 2 ) // xmin -> xmax <=> right->left
2942  {
2943  axis_x_inf = 0; axis_y_inf = 0; axis_x_sup = size_IX*MatSize; axis_y_sup = 0;
2944  axis_nb_div = size_IX;
2945  IX_values_min = IX_min ; IX_values_max = IX_max; axis_chopt = "CS";
2946  }
2947  if( DeeNumber == 3 ) // xmin -> xmax <=> left->right
2948  {
2949  axis_x_inf = 0; axis_y_inf = 0; axis_x_sup = size_IX*MatSize; axis_y_sup = 0;
2950  axis_nb_div = size_IX;
2951  IX_values_min = IX_min ; IX_values_max = IX_max; axis_chopt = "CS";
2952  }
2953  if( DeeNumber == 4 ) // -xmin -> -xmax <=> right->left
2954  {
2955  axis_x_inf = 0; axis_y_inf = 0; axis_x_sup = size_IX*MatSize; axis_y_sup = 0;
2956  axis_nb_div = size_IX;
2957  IX_values_min = -IX_min ; IX_values_max = -IX_max; axis_chopt = "CS";
2958  }
2959 
2960  new TF1("f1", x_direction.Data(), IX_values_min, IX_values_max); fCnewRoot++;
2961  sup_axis_x = new TGaxis( axis_x_inf, axis_y_inf, axis_x_sup, axis_y_sup,
2962  "f1", axis_nb_div, axis_chopt , 0.); fCnewRoot++;
2963 
2964  sup_axis_x->SetTitle(x_var_name);
2965  sup_axis_x->SetTitleSize(tit_siz_x);
2966  sup_axis_x->SetTitleOffset(tit_off_x);
2967  sup_axis_x->SetLabelSize(lab_siz_x);
2968  sup_axis_x->SetLabelOffset(lab_off_x);
2969  sup_axis_x->SetTickSize(tic_siz_x); // <===== NE MARCHE QU'AVEC L'OPTION "S"
2970  sup_axis_x->Draw("SAME");
2971 
2972  //...................................................... Axe j(IY) (ViewSCGrid)
2973 
2974  Float_t tit_siz_y = fCnaParHistos->AxisTitleSize();
2975  Float_t lab_siz_y = fCnaParHistos->AxisLabelSize();
2976  Float_t tic_siz_y = fCnaParHistos->AxisTickSize();
2977  Float_t tit_off_y = fCnaParHistos->AxisTitleOffset("SCy");
2978  Float_t lab_off_y = fCnaParHistos->AxisLabelOffset("SCy");
2979 
2980  Double_t j_IY_min = fEcalNumbering->GetJIYMin(DeeNumber, n1DeeSCEcna) - 0.5;
2981  Double_t j_IY_max = fEcalNumbering->GetJIYMax(DeeNumber, n1DeeSCEcna) + 0.5;
2982 
2983  TString jy_var_name = GetIXIYAxisTitle("jIYSC");
2984  TString jy_direction = fEcalNumbering->GetJYDirectionEE(DeeNumber);
2985 
2986  new TF1("f2", jy_direction.Data(), j_IY_min, j_IY_max); fCnewRoot++;
2987 
2988  TGaxis* sup_axis_jy = new TGaxis( (Float_t)0., (Float_t)0.,
2989  (Float_t)0., (Float_t)(size_IY*MatSize),
2990  "f2", size_IY, "CS", 0.); fCnewRoot++;
2991 
2992  sup_axis_jy->SetTitle(jy_var_name);
2993  sup_axis_jy->SetTitleSize(tit_siz_y);
2994  sup_axis_jy->SetTitleOffset(tit_off_y);
2995  sup_axis_jy->SetLabelSize(lab_siz_y);
2996  sup_axis_jy->SetLabelOffset(lab_off_y);
2997  sup_axis_jy->SetTickSize(tic_siz_y); // <===== NE MARCHE QU'AVEC L'OPTION "S"
2998  sup_axis_jy->Draw();
2999 
3000 } // end of ViewSCGrid
3001 
3002 //=======================================================================================
3003 //
3004 // ViewStex(***)
3005 //
3006 // (Hoco,Veco) matrices for all the Stins of a Stex
3007 //
3008 // arg_read_histo: 1D array containing the quantity for each channel in the Stex
3009 // (dim = MaxCrysInStex())
3010 // arg_AlreadyRead: =1 <=> arg_read_histo
3011 // =0 <=> read the 1D array in this method with TEcnaRead
3012 //
3013 // HistoCode: code for the plotted quantity
3014 //
3015 //=======================================================================================
3016 void TEcnaHistos::ViewStex(const TVectorD& arg_read_histo, const Int_t& arg_AlreadyRead,
3017  const TString& HistoCode)
3018 {
3019 // (Hoco, Veco) matrices for all the Stins of a Stex
3020 
3021  Bool_t OKFileExists = kFALSE;
3022  Bool_t OKData = kFALSE;
3023 
3024  Int_t n1StexStin = -1;
3025 
3026  if( arg_AlreadyRead == fTobeRead )
3027  {
3033 
3034  if( fMyRootFile->LookAtRootFile() == kTRUE ){OKFileExists = kTRUE;}
3035 
3036  if( OKFileExists == kTRUE )
3037  {
3039  TString fp_name_short = fMyRootFile->GetRootFileNameShort();
3040  // std::cout << "*TEcnaHistos::ViewStex(...)> Data are analyzed from file ----> "
3041  // << fp_name_short << std::endl;
3042 
3046  }
3047  }
3048  if( arg_AlreadyRead >= 1 )
3049  {
3050  OKFileExists = kTRUE;
3051  }
3052 
3053  if( OKFileExists == kTRUE )
3054  {
3055  fStatusFileFound = kTRUE;
3056 
3057  //......................... matrix title (ViewStex)
3058  char f_in_mat_tit[charArrLen];
3059  sprintf(f_in_mat_tit, "?");
3060 
3061  if (HistoCode == "D_NOE_ChNb") {sprintf(f_in_mat_tit, "Number of events");}
3062  if (HistoCode == "D_Ped_ChNb") {sprintf(f_in_mat_tit, "Pedestals");}
3063  if (HistoCode == "D_TNo_ChNb") {sprintf(f_in_mat_tit, "Total noise");}
3064  if (HistoCode == "D_MCs_ChNb") {sprintf(f_in_mat_tit, "Mean cor(s,s')");}
3065  if (HistoCode == "D_LFN_ChNb") {sprintf(f_in_mat_tit, "Low frequency noise");}
3066  if (HistoCode == "D_HFN_ChNb") {sprintf(f_in_mat_tit, "High frequency noise");}
3067  if (HistoCode == "D_SCs_ChNb") {sprintf(f_in_mat_tit, "Sigma of cor(s,s')");}
3068 
3069  //................................. Axis parameters
3070  Int_t GeoBidSizeHoco = fEcal->MaxStinHocoInStex()*fEcal->MaxCrysHocoInStin();
3071  Int_t GeoBidSizeVeco = fEcal->MaxStinVecoInStex()*fEcal->MaxCrysVecoInStin();
3072 
3073  Int_t nb_binx = GeoBidSizeHoco;
3074  Int_t nb_biny = GeoBidSizeVeco;
3075  Axis_t xinf_bid = (Axis_t)0.;
3076  Axis_t xsup_bid = (Axis_t)GeoBidSizeHoco;
3077  Axis_t yinf_bid = (Axis_t)0.;
3078  Axis_t ysup_bid = (Axis_t)GeoBidSizeVeco;
3079 
3080  TString axis_x_var_name = " #Hoco ";
3081  TString axis_y_var_name = " #Veco ";
3082 
3083  //............. matrices reading and histogram filling (ViewStex)
3084 
3085  TH2D* h_geo_bid = new TH2D("geobidim_ViewStex", f_in_mat_tit,
3086  nb_binx, xinf_bid, xsup_bid,
3087  nb_biny, yinf_bid, ysup_bid); fCnewRoot++;
3088 
3089  h_geo_bid->Reset();
3090 
3091  //............................................... 1D histo reading (ViewStex)
3092  TVectorD partial_histp(fEcal->MaxCrysEcnaInStex());
3093  for(Int_t i=0; i<fEcal->MaxCrysEcnaInStex(); i++){partial_histp(i)=(Double_t)0.;}
3094 
3095  if( arg_AlreadyRead == fTobeRead )
3096  {
3097  if (HistoCode == "D_NOE_ChNb" ){partial_histp = fMyRootFile->ReadNumberOfEvents(fEcal->MaxCrysEcnaInStex());}
3098  if (HistoCode == "D_Ped_ChNb" ){
3099  partial_histp = fMyRootFile->ReadPedestals(fEcal->MaxCrysEcnaInStex());}
3100  if (HistoCode == "D_TNo_ChNb" ){
3101  partial_histp = fMyRootFile->ReadTotalNoise(fEcal->MaxCrysEcnaInStex());}
3102  if (HistoCode == "D_MCs_ChNb" ){
3104  if (HistoCode == "D_LFN_ChNb" ){
3106  if (HistoCode == "D_HFN_ChNb" ){
3108  if (HistoCode == "D_SCs_ChNb" ){
3110 
3111  OKData = fMyRootFile->DataExist();
3112  }
3113 
3114  if( arg_AlreadyRead >= 1 )
3115  {
3116  partial_histp = arg_read_histo;
3117  OKData = kTRUE;
3118  }
3119 
3120  //------------------------------- Build 2D matrix to be ploted from 1D read histo (ViewStex)
3121  TMatrixD read_matrix(nb_binx, nb_biny);
3122  for(Int_t i=0; i<nb_binx; i++)
3123  {for(Int_t j=0; j<nb_biny; j++){read_matrix(i,j)=(Double_t)0.;}}
3124 
3125  if ( OKData == kTRUE )
3126  {
3127  fStatusDataExist = kTRUE;
3128 
3129  for(Int_t i0StexStinEcna=0; i0StexStinEcna<fEcal->MaxStinEcnaInStex(); i0StexStinEcna++)
3130  {
3131  if( arg_AlreadyRead == fTobeRead )
3132  {n1StexStin = fMyRootFile->GetStexStinFromIndex(i0StexStinEcna);}
3133  if( arg_AlreadyRead >= 1 )
3134  {n1StexStin = i0StexStinEcna+1;}
3135 
3136  if (n1StexStin != -1)
3137  {
3138  //------------------ Geographical bidim filling (ViewStex)
3139  for(Int_t i0StinEcha=0; i0StinEcha<fEcal->MaxCrysInStin(); i0StinEcha++)
3140  {
3141  Int_t iStexEcha = (n1StexStin-1)*fEcal->MaxCrysInStin() + i0StinEcha;
3142  Int_t i_xgeo = GetXCrysInStex(fFapStexNumber, n1StexStin, i0StinEcha);
3143  Int_t i_ygeo = GetYCrysInStex(fFapStexNumber, n1StexStin, i0StinEcha);
3144 
3145  if(i_xgeo >=0 && i_xgeo < nb_binx && i_ygeo >=0 && i_ygeo < nb_biny)
3146  {
3147  read_matrix(i_xgeo, i_ygeo) = partial_histp(iStexEcha);
3148  h_geo_bid->Fill((Double_t)i_xgeo, (Double_t)i_ygeo,
3149  (Double_t)read_matrix(i_xgeo, i_ygeo));
3150  }
3151  }
3152  }
3153  }
3154 
3155  //=============== H I S T O M I N / M A X M A N A G E M E N T ============ (ViewStex)
3156 
3157  //................................ Put histo min max values
3158  //.......... default if flag not set to "ON"
3159  SetYminMemoFromValue(HistoCode.Data(), fCnaParHistos->GetYminDefaultValue(HistoCode.Data()));
3160  SetYmaxMemoFromValue(HistoCode.Data(), fCnaParHistos->GetYmaxDefaultValue(HistoCode.Data()));
3161 
3162  if( fUserHistoMin == fUserHistoMax ){fFlagUserHistoMin = "AUTO"; fFlagUserHistoMax = "AUTO";}
3163  //.......... user's value if flag set to "ON"
3164  if( fFlagUserHistoMin == "ON" )
3165  {SetYminMemoFromValue(HistoCode.Data(), fUserHistoMin); fFlagUserHistoMin = "OFF";}
3166  if( fFlagUserHistoMax == "ON" )
3167  {SetYmaxMemoFromValue(HistoCode.Data(), fUserHistoMax); fFlagUserHistoMax = "OFF";}
3168  //................................. automatic min and/or max
3169  if( fFlagUserHistoMin == "AUTO" )
3170  {SetYminMemoFromValue(HistoCode.Data(), h_geo_bid->GetMinimum()); fFlagUserHistoMin = "OFF";}
3171  if( fFlagUserHistoMax == "AUTO" )
3172  {SetYmaxMemoFromValue(HistoCode.Data(), h_geo_bid->GetMaximum()); fFlagUserHistoMax = "OFF";}
3173  //...................................... histo set ymin and ymax
3174  SetHistoFrameYminYmaxFromMemo((TH1D*)h_geo_bid, HistoCode);
3175 
3176  // ************************** A GARDER EN RESERVE *******************************
3177  //............. special contour level for correlations (square root wise scale)
3178  //if ( HistoCode == "D_MCs_ChNb" )
3179  //{
3180  // Int_t nb_niv = 9;
3181  // Double_t* cont_niv = new Double_t[nb_niv]; fCnew++;
3182  // SqrtContourLevels(nb_niv, &cont_niv[0]);
3183  // h_geo_bid->SetContour(nb_niv, &cont_niv[0]);
3184  // delete [] cont_niv; fCdelete++;
3185  //}
3186  // ******************************** (FIN RESERVE) *******************************
3187 
3188  // =================================== P L O T S ======================== (ViewStex)
3189 
3190  char f_in[charArrLen];
3191 
3192  //...................... Taille/format canvas
3193  UInt_t canv_h = fCnaParHistos->CanvasFormatH("petit");
3194  UInt_t canv_w = fCnaParHistos->CanvasFormatW("petit");
3195 
3196  if( fFlagSubDet == "EB")
3197  {canv_h = fCnaParHistos->CanvasFormatH("etaphiSM");
3198  canv_w = fCnaParHistos->CanvasFormatW("etaphiSM");}
3199  if( fFlagSubDet == "EE")
3200  {canv_h = fCnaParHistos->CanvasFormatH("IXIYDee");
3201  canv_w = fCnaParHistos->CanvasFormatW("IXIYDee");}
3202 
3203  //............................................... paves commentaires (ViewStex)
3205 
3206  //------------------------------------ Canvas name ----------------- (ViewStex)
3207  TString name_cov_cor;
3208  name_cov_cor.Resize(charArrLen);
3209  name_cov_cor = "?";
3210 
3211  if( HistoCode == "D_NOE_ChNb"){name_cov_cor = "Nb_Of_D_Adc_EvDs";}
3212  if( HistoCode == "D_Ped_ChNb"){name_cov_cor = "Pedestals";}
3213  if( HistoCode == "D_TNo_ChNb"){name_cov_cor = "Total_noise";}
3214  if( HistoCode == "D_MCs_ChNb"){name_cov_cor = "Mean_Corss";}
3215  if( HistoCode == "D_LFN_ChNb"){name_cov_cor = "Low_Fq_Noise";}
3216  if( HistoCode == "D_HFN_ChNb"){name_cov_cor = "High_Fq_Noise";}
3217  if( HistoCode == "D_SCs_ChNb"){name_cov_cor = "Sigma_Corss";}
3218 
3219  TString name_visu;
3220  name_visu.Resize(charArrLen);
3221  name_visu = "colz";
3222 
3223  TString flag_already_read;
3224  flag_already_read.Resize(charArrLen);
3225  flag_already_read = "?";
3226  sprintf(f_in,"M%d", arg_AlreadyRead); flag_already_read = f_in;
3227 
3228  sprintf(f_in, "%s_%s_S1_%d_R%d_%d_%d_%s%d_%s_HocoVeco_R%s",
3229  name_cov_cor.Data(), fFapAnaType.Data(), fFapNbOfSamples, fFapRunNumber,
3231  name_visu.Data(), flag_already_read.Data());
3232 
3233  if( fFlagSubDet == "EB" ){SetHistoPresentation((TH1D*)h_geo_bid, "Stex2DEB");}
3234  if( fFlagSubDet == "EE" ){SetHistoPresentation((TH1D*)h_geo_bid, "Stex2DEE");}
3235 
3236  TCanvas *MainCanvas = new TCanvas(f_in, f_in, canv_w, canv_h); fCnewRoot++;
3237  fCurrentCanvas = MainCanvas; fCurrentCanvasName = f_in;
3238 
3239  // std::cout << "*TEcnaHistos::ViewStex(...)> Plot is displayed on canvas ----> " << f_in << std::endl;
3240 
3241  //------------------------ Canvas draw and update ------------ (ViewStex)
3242  if( fPavComGeneralTitle != nullptr ){fPavComGeneralTitle->Draw();}
3243  fPavComStex->Draw();
3244  fPavComAnaRun->Draw();
3245  fPavComNbOfEvts->Draw();
3246 
3247  //----------------------------------------------------------- pad margins
3248  Double_t x_low = fCnaParHistos->BoxLeftX("bottom_left_box") - 0.005;
3249  Double_t y_low = fCnaParHistos->BoxTopY("bottom_left_box") + 0.005;
3250  Double_t x_margin = x_low;
3251  Double_t y_margin = y_low;
3252  MainCanvas->Divide( 1, 1, x_margin, y_margin);
3253  // Divide(nx, ny, x_margin, y_margin, color);
3254  gPad->cd(1);
3255  //........................... specific EE
3256  if( fFlagSubDet == "EE" )
3257  {Double_t x_up = fCnaParHistos->BoxRightX("bottom_right_box") + 0.005;
3258  Double_t y_up = fCnaParHistos->BoxBottomY("top_left_box_Dee") - 0.005;
3259  TVirtualPad* main_subpad = gPad;
3260  main_subpad->SetPad(x_low, y_low, x_up, y_up);}
3261 
3262  //------------------------------------------------------------
3263  h_geo_bid->GetXaxis()->SetTitle(axis_x_var_name);
3264  h_geo_bid->GetYaxis()->SetTitle(axis_y_var_name);
3265 
3266  h_geo_bid->DrawCopy("COLZ");
3267 
3268  // trace de la grille: un rectangle = une tour ou un SC ---------------- (ViewStex)
3270  gPad->Draw();
3271  gPad->Update();
3272 
3273  //..................... retour aux options standard
3274  Bool_t b_true = true;
3275  h_geo_bid->SetStats(b_true);
3276  h_geo_bid->Delete(); h_geo_bid = nullptr; fCdeleteRoot++;
3277 
3278  // delete MainCanvas; fCdeleteRoot++;
3279  } // end of if OKData == kTRUE )
3280  } // end of if OKFileExists == kTRUE )
3281  else
3282  {
3283  fStatusFileFound = kFALSE;
3284 
3285  std::cout << "!TEcnaHistos::ViewStex(...)> *ERROR* =====> "
3286  << " ROOT file not found" << fTTBELL << std::endl;
3287  }
3288 } // end of ViewStex(...)
3289 
3290 //===========================================================================
3291 //
3292 // StexHocoVecoLHFCorcc(***)
3293 //
3294 // Geographical view of the cor(c,c) matrices (mean over samples) of
3295 // all (Stin_A,Stin_A) [case A=B only] of a given Stex (BIG MATRIX)
3296 //
3297 //===========================================================================
3298 void TEcnaHistos::StexHocoVecoLHFCorcc(const TString& Freq)
3299 {
3300 // (Hoco, Veco) matrices for all the Stins of a Stex
3301 
3307 
3308  if ( fMyRootFile->LookAtRootFile() == kTRUE ) // (StexHocoVecoLHFCorcc)
3309  {
3310  fStatusFileFound = kTRUE;
3311 
3313  TString fp_name_short = fMyRootFile->GetRootFileNameShort();
3314  //std::cout << "*TEcnaHistos::StexHocoVecoLHFCorcc(...)> Data are analyzed from file ----> "
3315  // << fp_name_short << std::endl;
3316 
3320 
3321  //......................... matrix title
3322  char f_in_mat_tit[charArrLen];
3323 
3324  if( fFlagSubDet == "EB" && Freq == "LF" )
3325  {sprintf(f_in_mat_tit, "LF Cor(Xtal,Xtal') for each tower in SM");}
3326  if( fFlagSubDet == "EB" && Freq == "HF" )
3327  {sprintf(f_in_mat_tit, "HF Cor(Xtal,Xtal') for each tower in SM");}
3328  if( fFlagSubDet == "EE" && Freq == "LF" )
3329  {sprintf(f_in_mat_tit, "LF Cor(Xtal,Xtal') for each SC in Dee");}
3330  if( fFlagSubDet == "EE" && Freq == "HF" )
3331  {sprintf(f_in_mat_tit, "HF Cor(Xtal,Xtal') for each SC in Dee");}
3332 
3333  //................................. Axis parameters
3334  Int_t GeoBidSizeHoco = fEcal->MaxStinHocoInStex()*fEcal->MaxCrysInStin();
3335  Int_t GeoBidSizeVeco = fEcal->MaxStinVecoInStex()*fEcal->MaxCrysInStin();
3336 
3337  Int_t nb_binx = GeoBidSizeHoco;
3338  Int_t nb_biny = GeoBidSizeVeco;
3339  Axis_t xinf_bid = (Axis_t)0.;
3340  Axis_t xsup_bid = (Axis_t)GeoBidSizeHoco;
3341  Axis_t yinf_bid = (Axis_t)0.;
3342  Axis_t ysup_bid = (Axis_t)GeoBidSizeVeco;
3343 
3344  TString axis_x_var_name = " #Hoco ";
3345  TString axis_y_var_name = " #varVeco ";
3346 
3347  //======================================================== (StexHocoVecoLHFCorcc)
3348  TVectorD Stin_numbers(fEcal->MaxStinEcnaInStex());
3349  for(Int_t i=0; i<fEcal->MaxStinEcnaInStex(); i++){Stin_numbers(i)=(Double_t)0.;}
3350  Stin_numbers = fMyRootFile->ReadStinNumbers(fEcal->MaxStinEcnaInStex());
3351 
3352  if ( fMyRootFile->DataExist() == kTRUE )
3353  {
3354  fStatusDataExist = kTRUE;
3355 
3356  //............. matrices reading and histogram filling
3357  TMatrixD partial_matrix(fEcal->MaxCrysEcnaInStex(), fEcal->MaxCrysEcnaInStex());
3358  for(Int_t i=0; i<fEcal->MaxCrysEcnaInStex(); i++)
3359  {for(Int_t j=0; j<fEcal->MaxCrysEcnaInStex(); j++){partial_matrix(i,j)=(Double_t)0.;}}
3360 
3361  if( Freq == "LF")
3362  {
3364  }
3365  if( Freq == "HF")
3366  {
3368  }
3369 
3370  if ( fMyRootFile->DataExist() == kTRUE )
3371  {
3372  fStatusDataExist = kTRUE;
3373 
3374  //............................... 2D histo booking
3375  TH2D* h_geo_bid = new TH2D("geobidim_HocoVecoLHFCorcc", f_in_mat_tit,
3376  nb_binx, xinf_bid, xsup_bid,
3377  nb_biny, yinf_bid, ysup_bid); fCnewRoot++;
3378  h_geo_bid->Reset();
3379 
3381 
3382  for(Int_t i0StexStinEcna=0; i0StexStinEcna<fEcal->MaxStinEcnaInStex(); i0StexStinEcna++)
3383  {
3384  Int_t n1StexStin = (Int_t)Stin_numbers(i0StexStinEcna);
3385  Int_t offset_x = ((n1StexStin-1)/fEcal->MaxStinVecoInStex())*fEcal->MaxCrysInStin();
3386  Int_t offset_y = ((n1StexStin-1)%fEcal->MaxStinVecoInStex())*fEcal->MaxCrysInStin();
3387 
3388  if (n1StexStin != -1)
3389  {
3390  //================================================= (StexHocoVecoLHFCorcc)
3391  //------------------ Geographical bidim filling
3392  for(Int_t i0StinEcha=0; i0StinEcha<fEcal->MaxCrysInStin(); i0StinEcha++)
3393  {
3394  for(Int_t j0StinEcha=0; j0StinEcha<fEcal->MaxCrysInStin(); j0StinEcha++)
3395  {
3396  Int_t i_xgeo = offset_x + i0StinEcha;
3397  Int_t i_ygeo = offset_y + j0StinEcha;
3398 
3399  if(i_xgeo >=0 && i_xgeo < nb_binx && i_ygeo >=0 && i_ygeo < nb_biny)
3400  {
3401  Int_t iEcha = (n1StexStin-1)*fEcal->MaxCrysInStin() + i0StinEcha;
3402  Int_t jEcha = (n1StexStin-1)*fEcal->MaxCrysInStin() + j0StinEcha;
3403 
3404  h_geo_bid->Fill((Double_t)i_xgeo, (Double_t)i_ygeo,
3405  (Double_t)partial_matrix(iEcha, jEcha));
3406  }
3407  }
3408  }
3409  }
3410  }
3411 
3412  //=============== H I S T O M I N / M A X M A N A G E M E N T ============ (StexHocoVecoLHFCorcc)
3413 
3414  TString HistoCode = "H2CorccInStins";
3415 
3416  //................................ Put histo min max values
3417  //.......... default if flag not set to "ON"
3418  SetYminMemoFromValue(HistoCode.Data(), fCnaParHistos->GetYminDefaultValue(HistoCode.Data()));
3419  SetYmaxMemoFromValue(HistoCode.Data(), fCnaParHistos->GetYmaxDefaultValue(HistoCode.Data()));
3420 
3421  if( fUserHistoMin == fUserHistoMax ){fFlagUserHistoMin = "AUTO"; fFlagUserHistoMax = "AUTO";}
3422  //.......... user's value if flag set to "ON"
3423  if( fFlagUserHistoMin == "ON" )
3424  {SetYminMemoFromValue(HistoCode.Data(), fUserHistoMin); fFlagUserHistoMin = "OFF";}
3425  if( fFlagUserHistoMax == "ON" )
3426  {SetYmaxMemoFromValue(HistoCode.Data(), fUserHistoMax); fFlagUserHistoMax = "OFF";}
3427  //................................. automatic min and/or max
3428  if( fFlagUserHistoMin == "AUTO" )
3429  {SetYminMemoFromValue(HistoCode.Data(), h_geo_bid->GetMinimum()); fFlagUserHistoMin = "OFF";}
3430  if( fFlagUserHistoMax == "AUTO" )
3431  {SetYmaxMemoFromValue(HistoCode.Data(), h_geo_bid->GetMaximum()); fFlagUserHistoMax = "OFF";}
3432  //...................................... histo set ymin and ymax
3433  SetHistoFrameYminYmaxFromMemo((TH1D*)h_geo_bid, HistoCode);
3434 
3435  // ----------------------------------- P L O T S (StexHocoVecoLHFCorcc)
3436 
3437  char f_in[charArrLen];
3438 
3439  //...................... Taille/format canvas
3440 
3441  UInt_t canv_h = fCnaParHistos->CanvasFormatH("petit");
3442  UInt_t canv_w = fCnaParHistos->CanvasFormatW("petit");
3443 
3444  if( fFlagSubDet == "EB")
3445  {canv_h = fCnaParHistos->CanvasFormatH("etaphiSM");
3446  canv_w = fCnaParHistos->CanvasFormatW("etaphiSM");}
3447  if( fFlagSubDet == "EE")
3448  {canv_h = fCnaParHistos->CanvasFormatH("IXIYDee");
3449  canv_w = fCnaParHistos->CanvasFormatW("IXIYDee");}
3450 
3451  //..................................... paves commentaires (StexHocoVecoLHFCorcc)
3453 
3454  //----------------- Canvas name ------- (StexHocoVecoLHFCorcc)
3455  TString name_cov_cor;
3456  name_cov_cor.Resize(charArrLen);
3457  if( Freq == "LF" ){name_cov_cor = "StexLFCorcc";}
3458  if( Freq == "HF" ){name_cov_cor = "StexHFCorcc";}
3459 
3460  TString name_visu;
3461  name_visu.Resize(charArrLen);
3462  name_visu = "colz";
3463 
3464  sprintf(f_in, "%s_%s_S1_%d_R%d_%d_%d_Stex%s%d_%s_HocoVeco",
3465  name_cov_cor.Data(), fFapAnaType.Data(), fFapNbOfSamples, fFapRunNumber,
3467  name_visu.Data());
3468 
3469  if( fFlagSubDet == "EB" ){SetHistoPresentation((TH1D*)h_geo_bid, "Stex2DEB");}
3470  if( fFlagSubDet == "EE" ){SetHistoPresentation((TH1D*)h_geo_bid, "Stex2DEE");}
3471 
3472  TCanvas *MainCanvas = new TCanvas(f_in, f_in, canv_w, canv_h); fCnewRoot++;
3473  fCurrentCanvas = MainCanvas; fCurrentCanvasName = f_in;
3474 
3475  // std::cout << "*TEcnaHistos::StexHocoVecoLHFCorcc(...)> Plot is displayed on canvas ----> "
3476  // << f_in << std::endl;
3477 
3478  //------------ Canvas draw and update ------ (StexHocoVecoLHFCorcc)
3479  if( fPavComGeneralTitle != nullptr ){fPavComGeneralTitle->Draw();}
3480  fPavComStex->Draw();
3481  fPavComAnaRun->Draw();
3482  fPavComNbOfEvts->Draw();
3483 
3484  //----------------------------------------------------------- pad margins
3485  Double_t x_low = fCnaParHistos->BoxLeftX("bottom_left_box") - 0.005;
3486  Double_t y_low = fCnaParHistos->BoxTopY("bottom_left_box") + 0.005;
3487  Double_t x_margin = x_low;
3488  Double_t y_margin = y_low;
3489  MainCanvas->Divide( 1, 1, x_margin, y_margin);
3490  // Divide(nx, ny, x_margin, y_margin, color);
3491  gPad->cd(1);
3492  //........................... specific EE
3493  if( fFlagSubDet == "EE" )
3494  {
3495  Double_t x_up = fCnaParHistos->BoxRightX("bottom_right_box") + 0.005;
3496  Double_t y_up = fCnaParHistos->BoxBottomY("top_left_box_Dee") - 0.005;
3497  TVirtualPad* main_subpad = gPad;
3498  main_subpad->SetPad(x_low, y_low, x_up, y_up);
3499  }
3500 
3501  h_geo_bid->GetXaxis()->SetTitle(axis_x_var_name);
3502  h_geo_bid->GetYaxis()->SetTitle(axis_y_var_name);
3503 
3504  h_geo_bid->DrawCopy("COLZ");
3505 
3506  // trace de la grille: un rectangle = une tour (StexHocoVecoLHFCorcc)
3507  ViewStexGrid(fFapStexNumber, "corcc");
3508  gPad->Draw();
3509  gPad->Update();
3510 
3511  //..................... retour aux options standard
3512  Bool_t b_true = true;
3513  h_geo_bid->SetStats(b_true);
3514  h_geo_bid->Delete(); h_geo_bid = nullptr; fCdeleteRoot++;
3515 
3516  // delete MainCanvas; fCdeleteRoot++;
3517  }
3518  }
3519  } // end of if ( fMyRootFile->LookAtRootFile() == kTRUE )
3520  else
3521  {
3522  fStatusFileFound = kFALSE;
3523 
3524  std::cout << "!TEcnaHistos::StexHocoVecoLHFCorcc(...)> *ERROR* =====> "
3525  << " ROOT file not found" << fTTBELL << std::endl;
3526  }
3527 } // end of StexHocoVecoLHFCorcc
3528 
3529 //==================================================================================
3530 //
3531 // GetXCrysInStex, GetYCrysInStex
3532 //
3533 //==================================================================================
3534 Int_t TEcnaHistos::GetXCrysInStex(const Int_t& StexNumber, const Int_t& n1StexStin,
3535  const Int_t& i0StinEcha)
3536 {
3537 //Gives the X crystal coordinate in the geographic view of one Stex
3538 // (X = 0 to MaxStinHocoInStex*NbCrysHocoInStin - 1)
3539 
3540  Int_t ix_geo = 0;
3541 
3542  if( fFlagSubDet == "EB")
3543  {TString ctype = fEcalNumbering->GetStexHalfStas(StexNumber);
3544  Int_t n1StexCrys = fEcalNumbering->Get1StexCrysFrom1StexStinAnd0StinEcha(n1StexStin, i0StinEcha, StexNumber);
3545  ix_geo = (n1StexCrys-1)/fEcal->MaxCrysVecoInStex(); // ix_geo for EB+
3546  if( ctype == "EB-"){ix_geo = fEcal->MaxCrysHocoInStex() - ix_geo - 1;}}
3547 
3548  if( fFlagSubDet == "EE")
3549  {TString DeeDir = fEcalNumbering->GetDeeDirViewedFromIP(StexNumber);
3550  ix_geo = 0;
3551  if( DeeDir == "right" )
3552  {ix_geo = fEcalNumbering->GetIXCrysInDee(StexNumber, n1StexStin, i0StinEcha) - 1;}
3553  if( DeeDir == "left" )
3554  {ix_geo = fEcal->MaxCrysIXInDee() - fEcalNumbering->GetIXCrysInDee(StexNumber, n1StexStin, i0StinEcha);}}
3555 
3556  return ix_geo;
3557 }
3558 
3559 Int_t TEcnaHistos::GetYCrysInStex(const Int_t& StexNumber, const Int_t& n1StexStin,
3560  const Int_t& j0StinEcha)
3561 {
3562 //Gives the Y crystal coordinate in the geographic view of one Stex
3563 // (Y = 0 to MaxStinVecoInStex*NbCrysVecoInStin - 1)
3564 
3565  Int_t iy_geo = 0;
3566 
3567  if( fFlagSubDet == "EB")
3568  {TString ctype = fEcalNumbering->GetStexHalfStas(StexNumber);
3569  Int_t n1StexCrys = fEcalNumbering->Get1StexCrysFrom1StexStinAnd0StinEcha(n1StexStin, j0StinEcha, StexNumber);
3570  Int_t ix_geo = (n1StexCrys-1)/fEcal->MaxCrysVecoInStex(); // ix_geo for EB+
3571  iy_geo = n1StexCrys - 1 - ix_geo*fEcal->MaxCrysVecoInStex(); // iy_geo for EB+
3572  if( ctype == "EB-"){iy_geo = fEcal->MaxCrysVecoInStex() - iy_geo - 1;}}
3573 
3574  if( fFlagSubDet == "EE")
3575  {iy_geo = fEcalNumbering->GetJYCrysInDee(StexNumber, n1StexStin, j0StinEcha) - 1;}
3576 
3577  return iy_geo;
3578 }
3579 
3580 //===========================================================================
3581 //
3582 // StexStinNumbering, ViewStexStinNumberingPad
3583 //
3584 // independent of the ROOT file => StexNumber as argument
3585 //
3586 //===========================================================================
3587 void TEcnaHistos::StexStinNumbering(const Int_t& StexNumber)
3588 {
3589 //display the Stin numbering of the Stex
3590 
3591  if( fFlagSubDet == "EB" ){SMTowerNumbering(StexNumber);}
3592  if( fFlagSubDet == "EE" ){DeeSCNumbering(StexNumber);}
3593 }
3594 // end of StexStinNumbering
3595 
3596 //=============================================================================
3597 //
3598 // ViewStexStinNumberingPad
3599 // independent of the ROOT file => StexNumber as argument
3600 //
3601 //=============================================================================
3602 void TEcnaHistos::ViewStexStinNumberingPad(const Int_t& StexNumber)
3603 {
3604 //display the Stin numbering of the Stex in a Pad
3605 
3606  if( fFlagSubDet == "EB"){ViewSMTowerNumberingPad(StexNumber);}
3607  if( fFlagSubDet == "EE"){ViewDeeSCNumberingPad(StexNumber);}
3608 }
3609 //----------------> end of ViewStexStinNumberingPad()
3610 
3611 //==========================================================================
3612 //
3613 // ViewStexGrid
3614 // independent of the ROOT file => StexNumber as argument
3615 //
3616 //==========================================================================
3617 void TEcnaHistos::ViewStexGrid(const Int_t& StexNumber, const TString& c_option)
3618 {
3619  //Grid of one Stex with axis Hoco and Veco
3620 
3621  if( fFlagSubDet == "EB"){ViewSMGrid(StexNumber, c_option);}
3622  if( fFlagSubDet == "EE"){ViewDeeGrid(StexNumber, c_option);}
3623 
3624 } // end of ViewStexGrid
3625 
3626 //&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& S P E C I F I C &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
3627 
3628 //======================================= BARREL ===============================
3629 void TEcnaHistos::SMTowerNumbering(const Int_t& SMNumber)
3630 {
3631  //display the tower numbering of the super-module
3632 
3633  if( (SMNumber > 0) && (SMNumber <= fEcal->MaxSMInEB()) )
3634  {
3635  Int_t GeoBidSizeEta = fEcal->MaxTowEtaInSM()*fEcal->MaxCrysEtaInTow();
3636  Int_t GeoBidSizePhi = fEcal->MaxTowPhiInSM()*fEcal->MaxCrysPhiInTow();
3637 
3638  Int_t nb_binx = GeoBidSizeEta;
3639  Int_t nb_biny = GeoBidSizePhi;
3640  Axis_t xinf_bid = (Axis_t)0.;
3641  Axis_t xsup_bid = (Axis_t)GeoBidSizeEta;
3642  Axis_t yinf_bid = (Axis_t)0.;
3643  Axis_t ysup_bid = (Axis_t)GeoBidSizePhi;
3644 
3645  TString axis_x_var_name = " #eta ";
3646  TString axis_y_var_name = " #varphi ";
3647 
3648  //------------------------------------------------------------------- SMTowerNumbering
3649 
3650  //............. matrices reading and histogram filling
3651  char f_in_mat_tit[charArrLen];
3652 
3653  if( SMNumber <= fEcal->MaxSMPhiInEB() )
3654  {sprintf(f_in_mat_tit, " SM tower numbering");}
3655  if( SMNumber > fEcal->MaxSMPhiInEB() )
3656  {sprintf(f_in_mat_tit, " SM tower numbering ");}
3657 
3658  // il faut tracer un bidim vide pour pouvoir tracer la grille et les axes
3659 
3660  TH2D* h_empty_bid = new TH2D("grid_bidim_eta_phi", f_in_mat_tit,
3661  nb_binx, xinf_bid, xsup_bid,
3662  nb_biny, yinf_bid, ysup_bid); fCnewRoot++;
3663  h_empty_bid->Reset();
3664 
3665  h_empty_bid->GetXaxis()->SetTitle(axis_x_var_name);
3666  h_empty_bid->GetYaxis()->SetTitle(axis_y_var_name);
3667 
3668  // ------------------------------------------------ P L O T S (SMTowerNumbering)
3669 
3670  char f_in[charArrLen];
3671 
3672  //...................... Taille/format canvas
3673 
3674  UInt_t canv_h = fCnaParHistos->CanvasFormatH("etaphiSM");
3675  UInt_t canv_w = fCnaParHistos->CanvasFormatW("etaphiSM");
3676 
3677  //............................................... options generales
3678 
3680 
3681  //............................................... paves commentaires (SMTowerNumbering)
3682  SetAllPavesViewStex("Numbering", SMNumber);
3683 
3684  //------------------------------------ Canvas name ----------------- (SMTowerNumbering)
3685 
3686  sprintf(f_in, "tower_numbering_for_SuperModule_SM%d", SMNumber);
3687 
3688  SetHistoPresentation((TH1D*)h_empty_bid,"Stex2DEB");
3689 
3690  TCanvas *MainCanvas = new TCanvas(f_in, f_in, canv_w, canv_h); fCnewRoot++;
3691  fCurrentCanvas = MainCanvas; fCurrentCanvasName = f_in;
3692 
3693  // std::cout << "*TEcnaHistosEB::ViewSM(...)> Plot is displayed on canvas ----> " << f_in << std::endl;
3694 
3695  //------------------------ Canvas draw and update ------------ (SMTowerNumbering)
3696  fPavComStex->Draw();
3697 
3698  Double_t x_margin = fCnaParHistos->BoxLeftX("bottom_left_box") - 0.005;
3699  Double_t y_margin = fCnaParHistos->BoxTopY("bottom_right_box") + 0.005;
3700  MainCanvas->Divide(1, 1, x_margin, y_margin);
3701  gPad->cd(1);
3702 
3703  h_empty_bid->DrawCopy("COL"); // il faut tracer un bidim vide pour pouvoir tracer la grille et les axes
3704 
3705  ViewSMTowerNumberingPad(SMNumber);
3706  gPad->Update();
3707 
3708  //..................... retour aux options standard
3709  Bool_t b_true = true;
3710  h_empty_bid->SetStats(b_true);
3711 
3712  h_empty_bid->Delete(); h_empty_bid = nullptr; fCdeleteRoot++;
3713 
3714  // delete MainCanvas; fCdeleteRoot++;
3715 
3716  }
3717  else
3718  {
3719  std::cout << "!TEcnaHistos::SMTowerNumbering(...)> SM = " << SMNumber
3720  << ". Out of range ( range = [1," << fEcal->MaxSMInEB() << "] )" << fTTBELL << std::endl;
3721  }
3722 }
3723 // end of SMTowerNumbering
3724 
3725 void TEcnaHistos::ViewSMTowerNumberingPad(const Int_t& SMNumber)
3726 {
3727  //display the tower numbering of the super-module in a Pad
3728 
3729  gStyle->SetTitleW(0.2); // taille titre histos
3730  gStyle->SetTitleH(0.07);
3731 
3732  ViewSMGrid(SMNumber, " ");
3733 
3734  Color_t couleur_rouge = fCnaParHistos->SetColorsForNumbers("lvrb_top");
3735  Color_t couleur_bleu_fonce = fCnaParHistos->SetColorsForNumbers("lvrb_bottom");
3736 
3737  //..... Ecriture des numeros de tours dans la grille..... (ViewSMTowerNumberingPad)
3738 
3739  char f_in[charArrLen];
3740  gStyle->SetTextSize(0.075);
3741 
3742  // x_channel, y_channel: coordinates of the text "Txx"
3743  Int_t y_channel = 12;
3744  Int_t x_channel = 12;
3745 
3746  Int_t max_tow_phi = fEcal->MaxTowPhiInSM()*fEcal->MaxCrysPhiInTow();
3747 
3748  //------------------ LOOP ON THE SM_TOWER NUMBER (ViewSMTowerNumberingPad)
3749 
3750  TText *text_SMtow_num = new TText(); fCnewRoot++;
3751 
3752  for (Int_t i_SMtow = 1; i_SMtow <= fEcal->MaxTowInSM(); i_SMtow++)
3753  {
3754  if(fEcalNumbering->GetTowerLvrbType(i_SMtow) == "top")
3755  {text_SMtow_num->SetTextColor(couleur_rouge);}
3756  if(fEcalNumbering->GetTowerLvrbType(i_SMtow) == "bottom")
3757  {text_SMtow_num->SetTextColor(couleur_bleu_fonce);}
3758 
3759  //................................ x from eta
3760  Double_t x_from_eta = fEcalNumbering->GetEta(SMNumber, i_SMtow, x_channel) - (Double_t)1;
3761  if(fEcalNumbering->GetSMHalfBarrel(SMNumber) == "EB-")
3762  {x_from_eta = fEcal->MaxTowEtaInSM()*fEcal->MaxCrysEtaInTow() + x_from_eta + (Double_t)1;}
3763 
3764  //................................ y from phi
3765  Double_t y_from_phi = max_tow_phi - 1
3766  - (fEcalNumbering->GetPhi(SMNumber, i_SMtow, y_channel) - fEcalNumbering->GetPhiMin(SMNumber));
3767  if( fEcalNumbering->GetSMHalfBarrel(SMNumber) == "EB-")
3768  {y_from_phi = - y_from_phi + fEcal->MaxTowPhiInSM()*fEcal->MaxCrysPhiInTow() - (Double_t)1;}
3769 
3770  sprintf(f_in, "%d", i_SMtow);
3771  text_SMtow_num->DrawText(x_from_eta, y_from_phi, f_in); // <=== prend du temps si on mets "T%d" dans le sprintf
3772  }
3773 
3774  text_SMtow_num->Delete(); text_SMtow_num = nullptr; fCdeleteRoot++;
3775 
3776  //.................................................... legende (ViewSMTowerNumberingPad)
3777  Double_t offset_tow_tex_eta = (Double_t)8.;
3778  Double_t offset_tow_tex_phi = (Double_t)15.;
3779 
3780  Color_t couleur_noir = fCnaParHistos->ColorDefinition("noir");
3781  Double_t x_legend = (Double_t)0.;
3782  Double_t y_legend = (Double_t)0.;
3783 
3784  Int_t ref_tower = fEcal->MaxTowInSM();
3785 
3786  //................................................. LVRB TOP (ViewSMTowerNumberingPad)
3787  gStyle->SetTextSize(0.075);
3788  gStyle->SetTextColor(couleur_rouge);
3789  x_legend = fEcalNumbering->GetEta(SMNumber, ref_tower, x_channel);
3790  y_legend = fEcalNumbering->GetPhi(SMNumber, ref_tower, y_channel) - fEcalNumbering->GetPhiMin(SMNumber);
3791 
3792  if( fEcalNumbering->GetSMHalfBarrel(SMNumber) == "EB+" )
3793  {
3794  x_legend = x_legend + offset_tow_tex_eta;
3795  y_legend = y_legend + offset_tow_tex_phi;
3796  }
3797  if( fEcalNumbering->GetSMHalfBarrel(SMNumber) == "EB-" )
3798  {
3799  x_legend = -x_legend + offset_tow_tex_eta;
3800  y_legend = y_legend + offset_tow_tex_phi;
3801  }
3802 
3803  sprintf( f_in, "xx");
3804  TText *text_legend_rouge = new TText(x_legend, y_legend, f_in); fCnewRoot++;
3805  text_legend_rouge->Draw();
3806  gStyle->SetTextSize(0.05);
3807  x_legend = x_legend - (Double_t)3.5;
3808  y_legend = y_legend - (Double_t)2.;
3809  sprintf(f_in, " LVRB ");
3810  TText *text_legend_rouge_expl = new TText(x_legend, y_legend, f_in); fCnewRoot++;
3811  text_legend_rouge_expl->Draw();
3812  y_legend = y_legend - (Double_t)1.75;
3813  if( fEcalNumbering->GetSMHalfBarrel(SMNumber) == "EB+" ){sprintf(f_in, " <--- ");}
3814  if( fEcalNumbering->GetSMHalfBarrel(SMNumber) == "EB-" ){sprintf(f_in, " ---> ");}
3815  TText *text_legend_rouge_expm = new TText(x_legend, y_legend, f_in); fCnewRoot++;
3816  text_legend_rouge_expm->Draw();
3817  //text_legend_rouge_expl->Delete(); text_legend_rouge_expl = 0; fCdeleteRoot++;
3818 
3819  //................................................. LVRB BOTTOM (ViewSMTowerNumberingPad)
3820  gStyle->SetTextSize(0.075);
3821  gStyle->SetTextColor(couleur_bleu_fonce);
3822  x_legend = fEcalNumbering->GetEta(SMNumber, ref_tower, x_channel);
3823  y_legend = fEcalNumbering->GetPhi(SMNumber, ref_tower, y_channel) - fEcalNumbering->GetPhiMin(SMNumber);
3824 
3825  if( fEcalNumbering->GetSMHalfBarrel(SMNumber) == "EB+" )
3826  {
3827  x_legend = x_legend + offset_tow_tex_eta;
3828  y_legend = y_legend + offset_tow_tex_phi/3;
3829  }
3830  if( fEcalNumbering->GetSMHalfBarrel(SMNumber) == "EB-" )
3831  {
3832  x_legend = -x_legend + offset_tow_tex_eta;
3833  y_legend = y_legend + offset_tow_tex_phi/3;
3834  }
3835 
3836  sprintf(f_in, "xx");
3837  TText *text_legend_bleu = new TText(x_legend, y_legend, f_in); fCnewRoot++;
3838  text_legend_bleu->Draw();
3839  //text_legend_bleu->Delete(); text_legend_bleu = 0; fCdeleteRoot++;
3840  gStyle->SetTextSize(0.05);
3841  x_legend = x_legend - (Double_t)3.5;
3842  y_legend = y_legend - (Double_t)2.;
3843  sprintf( f_in, " LVRB ");
3844  TText *text_legend_bleu_expl = new TText(x_legend, y_legend, f_in); fCnewRoot++;
3845  text_legend_bleu_expl->Draw();
3846  y_legend = y_legend - (Double_t)1.75;
3847  if( fEcalNumbering->GetSMHalfBarrel(SMNumber) == "EB+" ){sprintf( f_in, " ---> ");}
3848  if( fEcalNumbering->GetSMHalfBarrel(SMNumber) == "EB-" ){sprintf( f_in, " <--- ");}
3849  TText *text_legend_bleu_expm = new TText(x_legend, y_legend, f_in); fCnewRoot++;
3850  text_legend_bleu_expm->Draw();
3851  //text_legend_bleu_expl->Delete(); text_legend_bleu_expl = 0; fCdeleteRoot++;
3852 
3853  gStyle->SetTextColor(couleur_noir);
3854 }
3855 //----------------> end of ViewSMTowerNumberingPad()
3856 
3857 void TEcnaHistos::ViewSMGrid(const Int_t& SMNumber, const TString& c_option)
3858 {
3859  //Grid of one supermodule with axis eta and phi
3860 
3861  Int_t GeoBidSizeEta = fEcal->MaxTowEtaInSM()*fEcal->MaxCrysEtaInTow();
3862  Int_t GeoBidSizePhi = fEcal->MaxTowPhiInSM()*fEcal->MaxCrysPhiInTow();
3863 
3864  if ( c_option == "corcc")
3865  {
3866  GeoBidSizeEta = fEcal->MaxTowEtaInSM()*fEcal->MaxCrysInTow();
3867  GeoBidSizePhi = fEcal->MaxTowPhiInSM()*fEcal->MaxCrysInTow();
3868  }
3869 
3870  Int_t nb_binx = GeoBidSizeEta;
3871  Int_t nb_biny = GeoBidSizePhi;
3872  Axis_t xinf_bid = (Axis_t)0.;
3873  Axis_t xsup_bid = (Axis_t)GeoBidSizeEta;
3874  Axis_t yinf_bid = (Axis_t)0.;
3875  Axis_t ysup_bid = (Axis_t)GeoBidSizePhi;
3876 
3877  //---------------- trace de la grille: un rectangle = une tour
3878 
3879  Int_t size_eta = fEcal->MaxCrysEtaInTow();
3880  Int_t size_phi = fEcal->MaxCrysPhiInTow();
3881  if ( c_option == "corcc")
3882  {
3883  size_eta = fEcal->MaxCrysInTow();
3884  size_phi = fEcal->MaxCrysInTow();
3885  }
3886  Int_t max_x = nb_binx/size_eta;
3887  Int_t max_y = nb_biny/size_phi;
3888 
3889  //............................. lignes horizontales
3890  Double_t yline = (Double_t)yinf_bid;
3891 
3892  Double_t xline_left = (Double_t)xinf_bid;
3893  Double_t xline_right = (Double_t)xsup_bid;
3894 
3895  for( Int_t j = 0 ; j < max_y ; j++)
3896  {
3897  yline = yline + (Double_t)size_phi;
3898  TLine *lin;
3899  lin = new TLine(xline_left, yline, xline_right, yline); fCnewRoot++;
3900  lin->Draw();
3901  // delete lin; fCdeleteRoot++;
3902  }
3903 
3904  //.......................... lignes verticales
3905  Double_t xline = (Double_t)xinf_bid - (Double_t)size_eta;
3906 
3907  Double_t yline_bot = (Double_t)yinf_bid;
3908  Double_t yline_top = (Double_t)ysup_bid;
3909 
3910  Color_t coul_surligne = fCnaParHistos->ColorDefinition("noir");
3911  Color_t coul_textmodu = fCnaParHistos->ColorDefinition("vert36");
3912 
3913  //............................ Mj text
3914  gStyle->SetTextColor(coul_textmodu);
3915  gStyle->SetTextSize(0.075);
3916 
3917  char f_in[charArrLen];
3918 
3919  for( Int_t i = 0 ; i < max_x ; i++)
3920  {
3921  xline = xline + (Double_t)size_eta;
3922  TLine *lin;
3923  lin = new TLine(xline, yline_bot, xline, yline_top); fCnewRoot++;
3924 
3925  //............. Surlignage separateur des modules
3926  if( (fEcalNumbering->GetSMHalfBarrel(SMNumber) == "EB-") && (i == 4 || i == 8 || i == 12) )
3927  {lin->SetLineWidth(2); lin->SetLineColor(coul_surligne);}
3928  if( (fEcalNumbering->GetSMHalfBarrel(SMNumber) == "EB+") && (i == 5 || i == 9 || i == 13) )
3929  {lin->SetLineWidth(2); lin->SetLineColor(coul_surligne);}
3930 
3931  lin->Draw();
3932  // delete lin; fCdeleteRoot++;
3933 
3934  //............. Numeros des modules
3935  if( (fEcalNumbering->GetSMHalfBarrel(SMNumber) == "EB-") && (i == 2 || i == 6 || i == 10 || i == 14) )
3936  {
3937  if( i == 2 ){sprintf( f_in, "M4");}
3938  if( i == 6 ){sprintf( f_in, "M3");}
3939  if( i == 10 ){sprintf( f_in, "M2");}
3940  if( i == 14 ){sprintf( f_in, "M1");}
3941 
3942  TText *text_num_module = new TText(xline + 1, yline_top + 1, f_in); fCnewRoot++;
3943  text_num_module->Draw();
3944  //text_num_module->Delete(); text_num_module = 0; fCdeleteRoot++;
3945  }
3946  if( (fEcalNumbering->GetSMHalfBarrel(SMNumber) == "EB+") && (i == 3 || i == 7 || i == 11 || i == 15) )
3947  {
3948  if( i == 3 ){sprintf( f_in, "M1");}
3949  if( i == 7 ){sprintf( f_in, "M2");}
3950  if( i == 11 ){sprintf( f_in, "M3");}
3951  if( i == 15 ){sprintf( f_in, "M4");}
3952 
3953  TText *text_num_module = new TText(xline, yline_top + 1, f_in); fCnewRoot++;
3954  text_num_module->Draw();
3955  //text_num_module->Delete(); text_num_module = 0; fCdeleteRoot++;
3956  }
3957  }
3958 
3959  //------------------ trace axes en eta et phi --------------- ViewSMGrid
3960 
3961  Int_t MatSize = fEcal->MaxCrysEtaInTow();
3962  if ( c_option == "corcc"){MatSize = fEcal->MaxCrysInTow();}
3963 
3964  Int_t size_eta_sm = fEcal->MaxTowEtaInSM();
3965  Int_t size_phi_sm = fEcal->MaxTowPhiInSM();
3966 
3967  //...................................................... Axe i(eta) (bottom x) ViewSMGrid
3968  Double_t eta_min = fEcalNumbering->GetIEtaMin(SMNumber);
3969  Double_t eta_max = fEcalNumbering->GetIEtaMax(SMNumber);
3970 
3971  TString x_var_name = GetHocoVecoAxisTitle("ietaSM");;
3972  TString x_direction = fEcalNumbering->GetXDirectionEB(SMNumber);
3973 
3974  Float_t tit_siz_x = fCnaParHistos->AxisTitleSize();
3975  Float_t lab_siz_x = fCnaParHistos->AxisLabelSize("SMx");
3976  Float_t tic_siz_x = fCnaParHistos->AxisTickSize("SMx");
3977  Float_t tit_off_x = fCnaParHistos->AxisTitleOffset("SMx");
3978  Float_t lab_off_x = fCnaParHistos->AxisLabelOffset("SMx");
3979 
3980  new TF1("f1", x_direction.Data(), eta_min, eta_max); fCnewRoot++;
3981  TGaxis* sup_axis_x = nullptr;
3982 
3983  if( x_direction == "-x" ) // NEVER IN THIS CASE: xmin->xmax <=> right->left ("-x") direction
3984  {sup_axis_x = new TGaxis( (Float_t)0., (Float_t)0., (Float_t)(size_eta_sm*MatSize), (Float_t)0.,
3985  "f1", size_eta_sm, "SC" , 0.); fCnewRoot++;}
3986 
3987  if( x_direction == "x" ) // ALWAYS IN THIS CASE: xmin->xmax <=> left->right ("x") direction
3988  {sup_axis_x = new TGaxis( (Float_t)0., (Float_t)0., (Float_t)(size_eta_sm*MatSize), (Float_t)0.,
3989  "f1", size_eta_sm, "SC" , 0.); fCnewRoot++;}
3990 
3991  sup_axis_x->SetTitle(x_var_name);
3992  sup_axis_x->SetTitleSize(tit_siz_x);
3993  sup_axis_x->SetTitleOffset(tit_off_x);
3994  sup_axis_x->SetLabelSize(lab_siz_x);
3995  sup_axis_x->SetLabelOffset(lab_off_x);
3996  sup_axis_x->SetTickSize(tic_siz_x);
3997  sup_axis_x->Draw("SAME");
3998 
3999  //...................................................... Axe phi (y) ViewSMGrid
4000  Double_t phi_min = fEcalNumbering->GetPhiMin(SMNumber);
4001  Double_t phi_max = fEcalNumbering->GetPhiMax(SMNumber);
4002 
4003  TString y_var_name = GetHocoVecoAxisTitle("phi");
4004  TString y_direction = fEcalNumbering->GetYDirectionEB(SMNumber);
4005 
4006  Float_t tit_siz_y = fCnaParHistos->AxisTitleSize();
4007  Float_t lab_siz_y = fCnaParHistos->AxisLabelSize("SMy");
4008  Float_t tic_siz_y = fCnaParHistos->AxisTickSize("SMy");
4009  Float_t tit_off_y = fCnaParHistos->AxisTitleOffset("SMy");
4010  Float_t lab_off_y = fCnaParHistos->AxisLabelOffset("SMy");
4011 
4012  new TF1("f2", y_direction.Data(), phi_min, phi_max); fCnewRoot++;
4013  TGaxis* sup_axis_y = nullptr;
4014 
4015  if ( y_direction == "-x" ) // ALWAYS IN THIS CASE: ymin->ymax <=> top->bottom ("-x") direction
4016  {sup_axis_y = new TGaxis(-(Float_t)1.5*(Float_t)size_eta, (Float_t)0.,
4017  -(Float_t)1.5*(Float_t)size_eta, (Float_t)(size_phi_sm*MatSize),
4018  "f2", (Int_t)size_phi_sm, "SC", 0.); fCnewRoot++;}
4019 
4020  if ( y_direction == "x" ) // NEVER IN THIS CASE: ymin->ymax <=> bottom->top ("x") direction
4021  {sup_axis_y = new TGaxis(-(Float_t)1.5*(Float_t)size_eta, (Float_t)0.,
4022  -(Float_t)1.5*(Float_t)size_eta, (Float_t)(size_phi_sm*MatSize),
4023  "f2", (Int_t)size_phi_sm, "SC", 0.); fCnewRoot++;}
4024 
4025  sup_axis_y->SetTitle(y_var_name);
4026  sup_axis_y->SetTitleSize(tit_siz_y);
4027  sup_axis_y->SetTitleOffset(tit_off_y);
4028  sup_axis_y->SetLabelSize(lab_siz_y);
4029  sup_axis_y->SetLabelOffset(lab_off_y);
4030  sup_axis_y->SetTickSize(tic_siz_y);
4031  sup_axis_y->Draw("SAME");
4032 
4033  //...................................................... Axe jphi (jy) ViewSMGrid
4034  Double_t jphi_min = fEcalNumbering->GetJPhiMin(SMNumber);
4035  Double_t jphi_max = fEcalNumbering->GetJPhiMax(SMNumber);
4036 
4037  TString jy_var_name = " ";
4038  TString jy_direction = fEcalNumbering->GetJYDirectionEB(SMNumber);
4039 
4040  new TF1("f3", jy_direction.Data(), jphi_min, jphi_max); fCnewRoot++;
4041  TGaxis* sup_axis_jy = nullptr;
4042 
4043  //............; essai
4044  sup_axis_jy = new TGaxis((Float_t)0., (Float_t)0.,
4045  (Float_t)0., (Float_t)(size_phi_sm*MatSize),
4046  "f3", (Int_t)size_phi_sm, "SC", 0.); fCnewRoot++;
4047 
4048  if ( jy_direction == "-x" ) // IN THIS CASE FOR EB+: ymin->ymax <=> top->bottom ("-x") direction
4049  {jy_var_name = GetEtaPhiAxisTitle("jphiSMB+");}
4050 
4051  if ( jy_direction == "x" ) // IN THIS CASE FOR EB-: ymin->ymax <=> bottom->top ("x") direction
4052  {jy_var_name = GetEtaPhiAxisTitle("jphiSMB-");}
4053 
4054  lab_off_y = fCnaParHistos->AxisLabelOffset("SMyInEB");
4055 
4056  sup_axis_jy->SetTitle(jy_var_name);
4057  sup_axis_jy->SetTitleSize(tit_siz_y);
4058  sup_axis_jy->SetTitleOffset(tit_off_y);
4059  sup_axis_jy->SetLabelSize(lab_siz_y);
4060  sup_axis_jy->SetLabelOffset(lab_off_y);
4061  sup_axis_jy->SetTickSize(tic_siz_y);
4062  sup_axis_jy->Draw("SAME");
4063 
4064  //--------------------------- ViewSMGrid
4065 
4066  gStyle->SetTextColor(fCnaParHistos->ColorDefinition("noir"));
4067 
4068 } // end of ViewSMGrid
4069 
4070 //======================================= ENDCAP ===============================
4071 void TEcnaHistos::DeeSCNumbering(const Int_t& DeeNumber)
4072 {
4073  //display the SC numbering of the Dee
4074 
4075  if( (DeeNumber > 0) && (DeeNumber <= fEcal->MaxDeeInEE()) )
4076  {
4077  Int_t GeoBidSizeIX = fEcal->MaxSCIXInDee()*fEcal->MaxCrysIXInSC();
4078  Int_t GeoBidSizeIY = fEcal->MaxSCIYInDee()*fEcal->MaxCrysIYInSC();
4079 
4080  Int_t nb_binx = GeoBidSizeIX;
4081  Int_t nb_biny = GeoBidSizeIY;
4082  Axis_t xinf_bid = (Axis_t)0.;
4083  Axis_t xsup_bid = (Axis_t)GeoBidSizeIX;
4084  Axis_t yinf_bid = (Axis_t)0.;
4085  Axis_t ysup_bid = (Axis_t)GeoBidSizeIY;
4086 
4087  TString axis_x_var_name = " IX ";
4088  TString axis_y_var_name = " IY ";
4089 
4090  //------------------------------------------------------------------- DeeSCNumbering
4091 
4092  //........................................... empty histogram filling
4093  char f_in_mat_tit[charArrLen];
4094 
4095  sprintf(f_in_mat_tit, " Dee SC numbering ");
4096 
4097  // il faut tracer un bidim vide pour pouvoir tracer la grille et les axes
4098 
4099  TH2D* h_empty_bid = new TH2D("grid_bidim_IX_IY", f_in_mat_tit,
4100  nb_binx, xinf_bid, xsup_bid,
4101  nb_biny, yinf_bid, ysup_bid); fCnewRoot++;
4102 
4103  h_empty_bid->Reset();
4104 
4105  h_empty_bid->GetXaxis()->SetTitle(axis_x_var_name);
4106  h_empty_bid->GetYaxis()->SetTitle(axis_y_var_name);
4107 
4108  // ------------------------------------------------ P L O T S (DeeSCNumbering)
4109 
4110  char f_in[charArrLen];
4111 
4112  //...................... Taille/format canvas
4113 
4114  UInt_t canv_h = fCnaParHistos->CanvasFormatH("IXIYDee");
4115  UInt_t canv_w = fCnaParHistos->CanvasFormatW("IXIYDee");
4116 
4117  //............................................... options generales
4119 
4120  //............................................... paves commentaires (DeeSCNumbering)
4121  SetAllPavesViewStex("Numbering", DeeNumber);
4122 
4123  //------------------------------------ Canvas name ----------------- (DeeSCNumbering)
4124 
4125  sprintf(f_in, "SC_numbering_for_Dee_Dee%d", DeeNumber);
4126  SetHistoPresentation((TH1D*)h_empty_bid,"Stex2DEENb");
4127  TCanvas *MainCanvas = new TCanvas(f_in, f_in, canv_w, canv_h); fCnewRoot++;
4128  fCurrentCanvas = MainCanvas; fCurrentCanvasName = f_in;
4129 
4130  // std::cout << "*TEcnaHistosEE::ViewDee(...)> Plot is displayed on canvas ----> " << f_in << std::endl;
4131 
4132  //------------------------ Canvas draw and update ------------ (DeeSCNumbering)
4133  fPavComStex->Draw();
4134  fPavComCxyz->Draw();
4135 
4136  Double_t x_low = fCnaParHistos->BoxLeftX("bottom_left_box") - 0.005;
4137  Double_t x_up = fCnaParHistos->BoxRightX("bottom_right_box") + 0.005;
4138  Double_t y_low = fCnaParHistos->BoxTopY("bottom_left_box") + 0.005;
4139  Double_t y_up = fCnaParHistos->BoxBottomY("top_left_box_Dee") - 0.005;
4140 
4141  Double_t x_margin = x_low;
4142  Double_t y_margin = y_low;
4143 
4144  MainCanvas->Divide( 1, 1, x_margin, y_margin);
4145  // Divide(nx, ny, x_margin, y_margin, color);
4146 
4147  gPad->cd(1);
4148  TVirtualPad* main_subpad = gPad;
4149  main_subpad->SetPad(x_low, y_low, x_up, y_up);
4150 
4151  h_empty_bid->DrawCopy("COL"); // il faut tracer un bidim vide pour pouvoir tracer la grille et les axes
4152 
4153  ViewDeeSCNumberingPad(DeeNumber);
4154 
4155  gPad->Update(); // prend beaucoup de temps...
4156 
4157  //..................... retour aux options standard
4158  Bool_t b_true = true;
4159  h_empty_bid->SetStats(b_true);
4160 
4161  h_empty_bid->Delete(); h_empty_bid = nullptr; fCdeleteRoot++;
4162 
4163  // delete MainCanvas; fCdeleteRoot++;
4164  }
4165  else
4166  {
4167  std::cout << "!TEcnaHistos::DeeSCNumbering(...)> Dee = " << DeeNumber
4168  << ". Out of range ( range = [1," << fEcal->MaxDeeInEE() << "] )" << fTTBELL << std::endl;
4169  }
4170 }
4171 // end of DeeSCNumbering
4172 
4173 void TEcnaHistos::ViewDeeSCNumberingPad(const Int_t& DeeNumber)
4174 {
4175 //display the SC numbering of the Dee in a Pad
4176 
4177  gStyle->SetTitleW(0.4); // taille titre histos
4178  gStyle->SetTitleH(0.08);
4179 
4180  ViewDeeGrid(DeeNumber, " ");
4181 
4182  //..... SC numbers writing in the grid .... (ViewDeeSCNumberingPad)
4183 
4184  char f_in[charArrLen];
4185  gStyle->SetTextSize(0.0325);
4186 
4187  //------------------ LOOP ON THE Dee_SC NUMBER (ViewDeeSCNumberingPad)
4188  Int_t x_channel = 0; // => defined here after according to DeeDir and SCQuadType
4189  TText *text_DSSC_num = new TText(); fCnewRoot++;
4190  TText *text_DeeSCCons_num = new TText(); fCnewRoot++;
4191 
4192  for (Int_t n1DeeSCEcna = 1; n1DeeSCEcna <= fEcal->MaxSCEcnaInDee(); n1DeeSCEcna++)
4193  {
4194  TString DeeDir = fEcalNumbering->GetDeeDirViewedFromIP(DeeNumber);
4195  TString SCQuadType = fEcalNumbering->GetSCQuadFrom1DeeSCEcna(n1DeeSCEcna);
4196  if( SCQuadType == "top" && DeeDir == "right"){x_channel = 13;}
4197  if( SCQuadType == "top" && DeeDir == "left" ){x_channel = 7;}
4198  if( SCQuadType == "bottom" && DeeDir == "left" ){x_channel = 11;}
4199  if( SCQuadType == "bottom" && DeeDir == "right"){x_channel = 17;}
4200  Int_t i_SCEcha = (Int_t)x_channel;
4201 
4202  Double_t x_from_IX = (Double_t)GetXCrysInStex(DeeNumber, n1DeeSCEcna, i_SCEcha);
4203  Double_t y_from_IY = (Double_t)GetYCrysInStex(DeeNumber, n1DeeSCEcna, i_SCEcha);
4204  Double_t y_from_IYp = y_from_IY + (Double_t)1.;
4205  Double_t y_from_IYm = y_from_IY - (Double_t)1.;
4206 
4207  TString DeeEndcap = fEcalNumbering->GetEEDeeEndcap(DeeNumber);
4208  Color_t couleur_SC = GetSCColor(DeeEndcap, DeeDir, SCQuadType);
4209  text_DSSC_num->SetTextColor(couleur_SC);
4210  text_DeeSCCons_num->SetTextColor((Color_t)1);
4211 
4212  Int_t i_DSSC = fEcalNumbering->GetDSSCFrom1DeeSCEcna(DeeNumber, n1DeeSCEcna);
4213  Int_t i_DeeSCCons = fEcalNumbering->GetDeeSCConsFrom1DeeSCEcna(DeeNumber, n1DeeSCEcna);
4214  if( i_DSSC > 0 )
4215  {
4216  if(
4217  //.................................................... (D2,S9) , (D4,S1)
4218  !(i_DeeSCCons == 33 && n1DeeSCEcna == 60) &&
4219  !(i_DeeSCCons == 33 && n1DeeSCEcna == 119) &&
4220  //................................................... (D2,S8) , (D4,S2)
4221  !(i_DeeSCCons == 29 && n1DeeSCEcna == 32) && // !(29c and 58c)
4222  !(i_DeeSCCons == 29 && n1DeeSCEcna == 138) &&
4223  !(i_DeeSCCons == 29 && n1DeeSCEcna == 157) &&
4224  !(i_DeeSCCons == 58 && n1DeeSCEcna == 176) &&
4225  !(i_DeeSCCons == 58 && n1DeeSCEcna == 193) &&
4226  //.................................................... (D2,S7) , (D4,S3)
4227  !(i_DeeSCCons == 149 && n1DeeSCEcna == 188) &&
4228  //.................................................... (D2,S6) , (D4,S4)
4229  !(i_DeeSCCons == 112 && n1DeeSCEcna == 29) &&
4230  !(i_DeeSCCons == 112 && n1DeeSCEcna == 144) &&
4231  !(i_DeeSCCons == 112 && n1DeeSCEcna == 165) &&
4232  !(i_DeeSCCons == 119 && n1DeeSCEcna == 102) &&
4233  !(i_DeeSCCons == 119 && n1DeeSCEcna == 123) &&
4234  //.................................................... (D2,S5) , (D4,S5)
4235  !(i_DeeSCCons == 132 && n1DeeSCEcna == 41) &&
4236  //----------------------------------------------------------------------
4237  //.................................................... (D1,S1) , (D3,S9)
4238  !(i_DeeSCCons == 182 && n1DeeSCEcna == 60) &&
4239  !(i_DeeSCCons == 182 && n1DeeSCEcna == 119) &&
4240  //.................................................... (D1,S2) , (D3,S8)
4241  !(i_DeeSCCons == 178 && n1DeeSCEcna == 32) && // !(178c and 207c)
4242  !(i_DeeSCCons == 178 && n1DeeSCEcna == 138) &&
4243  !(i_DeeSCCons == 178 && n1DeeSCEcna == 157) &&
4244  !(i_DeeSCCons == 207 && n1DeeSCEcna == 176) &&
4245  !(i_DeeSCCons == 207 && n1DeeSCEcna == 193) &&
4246  //.................................................... (D1,S3) , (D3,S7)
4247  !(i_DeeSCCons == 298 && n1DeeSCEcna == 188) &&
4248  //.................................................... (D1,S4) , (D3,S6)
4249  !(i_DeeSCCons == 261 && n1DeeSCEcna == 29) && // !(261a and 268a)
4250  !(i_DeeSCCons == 261 && n1DeeSCEcna == 144) &&
4251  !(i_DeeSCCons == 261 && n1DeeSCEcna == 165) &&
4252  !(i_DeeSCCons == 268 && n1DeeSCEcna == 102) &&
4253  !(i_DeeSCCons == 268 && n1DeeSCEcna == 123) &&
4254  //.................................................... (D1,S5) , (D3,S5)
4255  !(i_DeeSCCons == 281 && n1DeeSCEcna == 41)
4256  )
4257  {
4258  sprintf(f_in, "%d", i_DSSC);
4259  text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in); // <=== DrawText: prend du temps
4260  sprintf(f_in, "%d", i_DeeSCCons);
4261  text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in); // <=== DrawText: prend du temps
4262  }
4263 
4264  //.................................................... (D2,S9) , (D4,S1)
4265 
4266  if( i_DeeSCCons == 33 && n1DeeSCEcna == 60 )
4267  {
4268  sprintf(f_in, "30a");
4269  text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);
4270  sprintf(f_in, "33a");
4271  text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in);
4272  }
4273  if( i_DeeSCCons == 33 && n1DeeSCEcna == 119 )
4274  {
4275  sprintf(f_in, "30b");
4276  text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);
4277  sprintf(f_in, "33b");
4278  text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in);
4279  }
4280  //.................................................... (D2,S8) , (D4,S2)
4281  if( i_DeeSCCons == 29 && n1DeeSCEcna == 32 )
4282  {
4283  sprintf(f_in, " 3c-25c");
4284  text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);
4285  sprintf(f_in, "29c-58c");
4286  text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in);
4287  }
4288  if( i_DeeSCCons == 29 && n1DeeSCEcna == 138 )
4289  {
4290  sprintf(f_in, "3a");
4291  text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);
4292  sprintf(f_in, "29a");
4293  text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in);
4294  }
4295  if( i_DeeSCCons == 29 && n1DeeSCEcna == 157 )
4296  {
4297  sprintf(f_in, "3b");
4298  text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);
4299  sprintf(f_in, "29b");
4300  text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in);
4301  }
4302 
4303  if( i_DeeSCCons == 58 && n1DeeSCEcna == 176 )
4304  {
4305  sprintf(f_in, "25a");
4306  text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);
4307  sprintf(f_in, "58a");
4308  text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in);
4309  }
4310  if( i_DeeSCCons == 58 && n1DeeSCEcna == 193 )
4311  {
4312  sprintf(f_in, "25b");
4313  text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);
4314  sprintf(f_in, "58b");
4315  text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in);
4316  }
4317  //.................................................... (D2,S7) , (D4,S3)
4318  if( i_DeeSCCons == 149 && n1DeeSCEcna == 188 )
4319  {
4320  sprintf(f_in, "34a");
4321  text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);
4322  sprintf(f_in, "149a");
4323  text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in);
4324  }
4325  //.................................................... (D2,S6) , (D4,S4)
4326  if( i_DeeSCCons == 112 && n1DeeSCEcna == 29 )
4327  {
4328  sprintf(f_in, " 14a-21a");
4329  text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);
4330  sprintf(f_in, "112a-119a");
4331  text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in);
4332  }
4333  if( i_DeeSCCons == 112 && n1DeeSCEcna == 144 )
4334  {
4335  sprintf(f_in, "14c");
4336  text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);
4337  sprintf(f_in, "112c");
4338  text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in);
4339  }
4340  if( i_DeeSCCons == 112 && n1DeeSCEcna == 165 )
4341  {
4342  sprintf(f_in, "14b");
4343  text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);
4344  sprintf(f_in, "112b");
4345  text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in);
4346  }
4347 
4348  if( i_DeeSCCons == 119 && n1DeeSCEcna == 102 )
4349  {
4350  sprintf(f_in, "21c");
4351  text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);
4352  sprintf(f_in, "119c");
4353  text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in);
4354  }
4355  if( i_DeeSCCons == 119 && n1DeeSCEcna == 123 )
4356  {
4357  sprintf(f_in, "21b");
4358  text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);
4359  sprintf(f_in, "119b");
4360  text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in);
4361  }
4362  //.................................................... (D2,S5) , (D4,S5)
4363  if( i_DeeSCCons == 132 && n1DeeSCEcna == 41 )
4364  {
4365  sprintf(f_in, "3a");
4366  text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);
4367  sprintf(f_in, "132a");
4368  text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in);
4369  }
4370 
4371  //.................................................... (D1,S1) , (D3,S9)
4372  if( i_DeeSCCons == 182 && n1DeeSCEcna == 60 )
4373  {
4374  sprintf(f_in, "30a");
4375  text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);
4376  sprintf(f_in, "182a");
4377  text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in);
4378  }
4379  if( i_DeeSCCons == 182 && n1DeeSCEcna == 119 )
4380  {
4381  sprintf(f_in, "30b");
4382  text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);
4383  sprintf(f_in, "182b");
4384  text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in);
4385  }
4386  //.................................................... (D1,S2) , (D3,S8)
4387  if( i_DeeSCCons == 178 && n1DeeSCEcna == 32 )
4388  {
4389  sprintf(f_in, " 3c-25c");
4390  text_DSSC_num->DrawText(x_from_IX-6, y_from_IYp, f_in);
4391  sprintf(f_in, "178c-207c");
4392  text_DeeSCCons_num->DrawText(x_from_IX-6, y_from_IYm, f_in);
4393  }
4394  if( i_DeeSCCons == 178 && n1DeeSCEcna == 138 )
4395  {
4396  sprintf(f_in, "3a");
4397  text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);
4398  sprintf(f_in, "178a");
4399  text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in);
4400  }
4401  if( i_DeeSCCons == 178 && n1DeeSCEcna == 157 )
4402  {
4403  sprintf(f_in, "3b");
4404  text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);
4405  sprintf(f_in, "178b");
4406  text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in);
4407  }
4408 
4409  if( i_DeeSCCons == 207 && n1DeeSCEcna == 176 )
4410  {
4411  sprintf(f_in, "25a");
4412  text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);
4413  sprintf(f_in, "207a");
4414  text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in);
4415  }
4416  if( i_DeeSCCons == 207 && n1DeeSCEcna == 193 )
4417  {
4418  sprintf(f_in, "25b");
4419  text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);
4420  sprintf(f_in, "207b");
4421  text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in);
4422  }
4423  //.................................................... (D1,S3) , (D3,S7)
4424  if( i_DeeSCCons == 298 && n1DeeSCEcna == 188 )
4425  {
4426  sprintf(f_in, "34a");
4427  text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);
4428  sprintf(f_in, "298a");
4429  text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in);
4430  }
4431  //.................................................... (D1,S4) , (D3,S6)
4432  if( i_DeeSCCons == 261 && n1DeeSCEcna == 29 )
4433  {
4434  sprintf(f_in, " 14a-21a");
4435  text_DSSC_num->DrawText(x_from_IX-6, y_from_IYp, f_in);
4436  sprintf(f_in, "261a-268a");
4437  text_DeeSCCons_num->DrawText(x_from_IX-6, y_from_IYm, f_in);
4438  }
4439  if( i_DeeSCCons == 261 && n1DeeSCEcna == 144 )
4440  {
4441  sprintf(f_in, "14c");
4442  text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);
4443  sprintf(f_in, "261c");
4444  text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in);
4445  }
4446  if( i_DeeSCCons == 261 && n1DeeSCEcna == 165 )
4447  {
4448  sprintf(f_in, "14b");
4449  text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);
4450  sprintf(f_in, "261b");
4451  text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in);
4452  }
4453 
4454  if( i_DeeSCCons == 268 && n1DeeSCEcna == 102 )
4455  {
4456  sprintf(f_in, "21c");
4457  text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);
4458  sprintf(f_in, "268c");
4459  text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in);
4460  }
4461  if( i_DeeSCCons == 268 && n1DeeSCEcna == 123 )
4462  {
4463  sprintf(f_in, "21b");
4464  text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);
4465  sprintf(f_in, "268b");
4466  text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in);
4467  }
4468  //.................................................... (D1,S5) , (D3,S5)
4469  if( i_DeeSCCons == 281 && n1DeeSCEcna == 41 )
4470  {
4471  sprintf(f_in, "20a");
4472  text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);
4473  sprintf(f_in, "281a");
4474  text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in);
4475  }
4476  }
4477  }
4478 
4479  // delete text_DSSC_num; fCdeleteRoot++;
4480 
4481  //......................... mention "color, black"
4482  Color_t coul_textcolors = fCnaParHistos->ColorDefinition("noir");
4483  sprintf( f_in, "color: nb in Data Sector, black: nb for construction");
4484  Int_t x_colors = 3;
4485  Int_t y_colors = -14;
4486 
4487  TText *text_colors = new TText(x_colors, y_colors, f_in); fCnewRoot++;
4488  text_colors->SetTextSize(0.03);
4489  text_colors->SetTextColor(coul_textcolors);
4490  text_colors->Draw();
4491 
4492  Color_t couleur_noir = fCnaParHistos->ColorDefinition("noir");
4493  gStyle->SetTextColor(couleur_noir);
4494 }
4495 //----------------> end of ViewDeeSCNumberingPad()
4496 
4497 void TEcnaHistos::ViewDeeGrid(const Int_t& DeeNumber, const TString& c_option)
4498 {
4499  //Grid of one Dee with axis IX and IY
4500 
4501  Int_t GeoBidSizeIX = fEcal->MaxSCIXInDee()*fEcal->MaxCrysIXInSC();
4502  Int_t GeoBidSizeIY = fEcal->MaxSCIYInDee()*fEcal->MaxCrysIYInSC();
4503 
4504  if ( c_option == "corcc")
4505  {
4506  GeoBidSizeIX = fEcal->MaxSCIXInDee()*fEcal->MaxCrysInSC();
4507  GeoBidSizeIY = fEcal->MaxSCIYInDee()*fEcal->MaxCrysInSC();
4508  }
4509 
4510  Int_t nb_binx = GeoBidSizeIX;
4511  Int_t nb_biny = GeoBidSizeIY;
4512  Axis_t xinf_bid = (Axis_t)0.;
4513  Axis_t xsup_bid = (Axis_t)GeoBidSizeIX;
4514 
4515  Axis_t yinf_bid = (Axis_t)0.;
4516  Axis_t ysup_bid = (Axis_t)GeoBidSizeIY;
4517  Double_t ymid_bid = (Double_t)(ysup_bid-yinf_bid)/2.;
4518 
4519  //---------------- trace de la grille: un rectangle = un super-cristal
4520 
4521  Int_t size_IX = fEcal->MaxCrysIXInSC();
4522  Int_t size_IY = fEcal->MaxCrysIYInSC();
4523 
4524  if ( c_option == "corcc"){size_IX = fEcal->MaxCrysInSC(); size_IY = fEcal->MaxCrysInSC();}
4525 
4526  Int_t max_x = nb_binx/size_IX;
4527  Int_t max_y = nb_biny/size_IY;
4528  Int_t max_yd = max_y/2;
4529 
4530  //= SURLIGNAGES (unite de coordonnees: le cristal ou 5 fois le cristal si option corcc)
4531  //........................... multplicative coefficient for corcc option
4532  Int_t coefcc_x = (Int_t)1;
4533  Int_t coefcc_y = (Int_t)1;
4534  if ( c_option == "corcc"){coefcc_x = fEcal->MaxCrysIXInSC(); coefcc_y = fEcal->MaxCrysIYInSC();}
4535 
4536  //............................. lignes horizontales
4537  Double_t yline = (Double_t)yinf_bid - (Double_t)size_IY;
4538 
4539  Double_t xline_beg = (Double_t)xinf_bid;
4540  Double_t xline_end = (Double_t)xsup_bid;
4541 
4542  // k = 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10
4543  Int_t x_min[11] = {11,11, 7, 0, 0, 0, 0, 0, 0, 0, 0};
4544  Int_t x_max[11] = {50,50,47,45,45,42,37,35,30,15,50};
4545  for(Int_t i=0;i<11;i++){x_min[i] = coefcc_x*x_min[i]; x_max[i] = coefcc_x*x_max[i];}
4546 
4547  for( Int_t j = 0 ; j < max_y ; j++)
4548  {
4549  if( j < max_yd ) // j = 0,1,2,3,4,5,6,7,8,9
4550  {
4551  if( DeeNumber == 1 || DeeNumber == 3 )
4552  {
4553  xline_beg = xinf_bid + (Double_t)x_min[10-j];
4554  xline_end = xinf_bid + (Double_t)x_max[10-j];
4555  }
4556  if( DeeNumber == 2 || DeeNumber == 4 )
4557  {
4558  xline_beg = xsup_bid - (Double_t)x_max[10-j];
4559  xline_end = xsup_bid - (Double_t)x_min[10-j];
4560  }
4561  }
4562 
4563  if( j == max_yd ) // j = 10
4564  {
4565  if( DeeNumber == 1 || DeeNumber == 3 )
4566  {
4567  xline_beg = xinf_bid + (Double_t)x_min[0];
4568  xline_end = xinf_bid + (Double_t)x_max[0];
4569  }
4570  if( DeeNumber == 2 || DeeNumber == 4 )
4571  {
4572  xline_beg = xsup_bid - (Double_t)x_max[0];
4573  xline_end = xsup_bid - (Double_t)x_min[0];
4574  }
4575  }
4576 
4577  if( j > max_yd ) // j = 11,12,13,14,15,16,17,18,19,20
4578  {
4579  if( DeeNumber == 1 || DeeNumber == 3 )
4580  {
4581  xline_beg = xinf_bid + (Double_t)x_min[j-10];
4582  xline_end = xinf_bid + (Double_t)x_max[j-10];
4583  }
4584  if( DeeNumber == 2 || DeeNumber == 4 )
4585  {
4586  xline_beg = xsup_bid - (Double_t)x_max[j-10];
4587  xline_end = xsup_bid - (Double_t)x_min[j-10];
4588  }
4589  }
4590 
4591  yline = yline + (Double_t)size_IY;
4592  TLine *lin;
4593  lin = new TLine(xline_beg, yline, xline_end, yline); fCnewRoot++;
4594  lin->Draw();
4595  //lin->Delete(); // => si on delete, pas de trace de la ligne
4596  // delete lin; fCdeleteRoot++;
4597  }
4598 
4599  //.......................... lignes verticales
4600  Double_t xline = (Double_t)xinf_bid - (Double_t)size_IX;
4601 
4602  Double_t yline_haut_bot = (Double_t)ymid_bid;
4603  Double_t yline_haut_top = (Double_t)ysup_bid;
4604 
4605  Double_t yline_bas_bot = (Double_t)yinf_bid;
4606  Double_t yline_bas_top = (Double_t)ymid_bid;
4607 
4608  // coordonnees demi-lignes
4609  // l = 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10
4610  Int_t y_min[11] = { 0,11, 7, 0, 0, 0, 0, 0, 0, 0, 0};
4611  Int_t y_max[11] = {50,50,47,45,45,42,38,35,30,15,10};
4612  for(Int_t i=0;i<11;i++){y_min[i] = coefcc_y*y_min[i]; y_max[i] = coefcc_y*y_max[i];}
4613 
4614  gStyle->SetTextSize(0.075); // ===> pourquoi pas avant?
4615 
4616  for( Int_t i = 0 ; i <= max_x ; i++)
4617  {
4618  if( DeeNumber == 1 || DeeNumber == 3 )
4619  {
4620  yline_haut_bot = ymid_bid + (Double_t)y_min[i];
4621  yline_haut_top = ymid_bid + (Double_t)y_max[i];
4622  }
4623  if( DeeNumber == 2 || DeeNumber == 4 )
4624  {
4625  yline_haut_bot = ymid_bid + (Double_t)y_min[10-i];
4626  yline_haut_top = ymid_bid + (Double_t)y_max[10-i];
4627  }
4628  yline_bas_bot = ysup_bid - yline_haut_top;
4629  yline_bas_top = ysup_bid - yline_haut_bot;
4630 
4631  xline = xline + (Double_t)size_IX;
4632  TLine *lin_haut;
4633  lin_haut = new TLine(xline, yline_haut_bot, xline, yline_haut_top); fCnewRoot++;
4634  lin_haut->Draw();
4635  // delete lin_haut; fCdeleteRoot++;
4636  TLine *lin_bas;
4637  lin_bas = new TLine(xline, yline_bas_bot, xline, yline_bas_top); fCnewRoot++;
4638  lin_bas->Draw();
4639  // delete lin_bas; fCdeleteRoot++;
4640  }
4641 
4642 
4643  Float_t fcoefcc_x = (Float_t)coefcc_x;
4644  Float_t fcoefcc_y = (Float_t)coefcc_y;
4645 
4646  EEDataSectors(fcoefcc_x, fcoefcc_y, DeeNumber, "Dee");
4647  EEGridAxis(DeeNumber, "Dee", c_option);
4648 
4649 } // end of ViewDeeGrid
4650 
4651 //=================================================================================
4652 //
4653 // SqrtContourLevels(const Int_t& nb_niv, Double_t* cont_niv)
4654 //
4655 //=================================================================================
4656 void TEcnaHistos::SqrtContourLevels(const Int_t& nb_niv, Double_t* cont_niv)
4657 {
4658 //Calculation of levels in z coordinate for 3D plots. Square root scale
4659 
4660  Int_t nb_niv2 = (nb_niv+1)/2;
4661 
4662  for (Int_t num_niv = 0; num_niv < nb_niv2; num_niv++)
4663  {
4664  Int_t ind_niv = num_niv + nb_niv2 - 1;
4665  if ( ind_niv < 0 || ind_niv > nb_niv )
4666  {
4667  std::cout << "!TEcnaHistos::ContourLevels(...)> *** ERROR *** "
4668  << "wrong contour levels for correlation matrix"
4669  << fTTBELL << std::endl;
4670  }
4671  else
4672  {
4673  cont_niv[ind_niv] =
4674  (Double_t)(num_niv*num_niv)/
4675  ((Double_t)((nb_niv2-1)*(nb_niv2-1)));
4676  }
4677  }
4678  for (Int_t num_niv = -1; num_niv > -nb_niv2; num_niv--)
4679  {
4680  Int_t ind_niv = num_niv + nb_niv2 - 1;
4681  if ( ind_niv < 0 || ind_niv > nb_niv )
4682  {
4683  std::cout << "!TEcnaHistos::ContourLevels(...)> *** ERROR *** "
4684  << "wrong contour levels for correlation matrix"
4685  << fTTBELL << std::endl;
4686  }
4687  else
4688  {
4689  cont_niv[ind_niv] =
4690  -(Double_t)(num_niv*num_niv)/
4691  ((Double_t)((nb_niv2-1)*(nb_niv2-1)));
4692  }
4693  }
4694 }
4695 
4696 //==========================================================================
4697 //
4698 // GetHocoVecoAxisTitle
4699 //
4700 //==========================================================================
4701 TString TEcnaHistos::GetHocoVecoAxisTitle(const TString& chcode)
4702 {
4703  TString xname = " ";
4704 
4705  if ( fFlagSubDet == "EB" ){xname = GetEtaPhiAxisTitle(chcode);}
4706  if ( fFlagSubDet == "EE" ){xname = GetIXIYAxisTitle(chcode);}
4707 
4708  return xname;
4709 }
4710 
4711 TString TEcnaHistos::GetEtaPhiAxisTitle(const TString& chcode)
4712 {
4713  TString xname = " ";
4714 
4715  if ( chcode == "ietaEB" ){xname = "i#eta Xtal ";}
4716  if ( chcode == "ietaSM" ){xname = "i#eta Xtal ";}
4717  if ( chcode == "ietaTow"){xname = "i#eta Xtal ";}
4718 
4719  if ( chcode == "iphiEB" ){xname = " i#varphi Xtal";}
4720  if ( chcode == "jphiEB+" ){xname = " i#varphi Xtal";}
4721  if ( chcode == "jphiEB-" ){xname = " i#varphi Xtal";}
4722  if ( chcode == "jphiSMB+" ){xname = " i#varphi Xtal";}
4723  if ( chcode == "jphiSMB-" ){xname = "i#varphi Xtal ";}
4724  if ( chcode == "jphiTow" ){xname = "i#varphi Xtal in SM ";}
4725  if ( chcode == "phi" ){xname = "i#varphi Xtal in EB ";}
4726 
4727  return xname;
4728 }
4729 
4730 TString TEcnaHistos::GetIXIYAxisTitle(const TString& chcode)
4731 {
4732  TString xname = " ";
4733 
4734  if ( chcode == "iIXDee" ){xname = "IX(SC)";}
4735 
4736  if ( chcode == "iIXDee1" ){xname = " -IX Xtal";}
4737  if ( chcode == "iIXDee2" ){xname = " IX Xtal ";}
4738  if ( chcode == "iIXDee3" ){xname = " IX Xtal";}
4739  if ( chcode == "iIXDee4" ){xname = "-IX Xtal ";}
4740 
4741  if ( chcode == "iIXEE" ){xname = " IX Xtal";}
4742 
4743  if ( chcode == "iIXSC" ){xname = "IX Xtal";}
4744 
4745  if ( chcode == "jIYDee" ){xname = "IY Xtal";}
4746  if ( chcode == "jIYSC" ){xname = "IY Xtal";}
4747  if ( chcode == "IY" ){xname = "IY";}
4748 
4749  return xname;
4750 }
4751 
4752 //=======================================================================================
4753 //
4754 // ViewStas(***)
4755 //
4756 // (Hoco,Veco) matrices for all the Stex's of a Stas
4757 // Stas = EB or EE
4758 //
4759 //=======================================================================================
4760 void TEcnaHistos::ViewStas(const TVectorD& arg_read_histo, const Int_t& arg_AlreadyRead,
4761  const TString& HistoCode)
4762 {
4763 // (Hoco, Veco) matrices for all the Stex's of a Stas
4764 
4765  //......................... matrix title
4766  char f_in_mat_tit[charArrLen];
4767 
4768  if (HistoCode == "D_NOE_ChNb"){sprintf(f_in_mat_tit, "Number of Events");}
4769  if (HistoCode == "D_Ped_ChNb"){sprintf(f_in_mat_tit, "Pedestals");}
4770  if (HistoCode == "D_TNo_ChNb"){sprintf(f_in_mat_tit, "Total noise");}
4771  if (HistoCode == "D_MCs_ChNb"){sprintf(f_in_mat_tit, "Mean cor(s,s')");}
4772  if (HistoCode == "D_LFN_ChNb"){sprintf(f_in_mat_tit, "Low frequency noise");}
4773  if (HistoCode == "D_HFN_ChNb"){sprintf(f_in_mat_tit, "High frequency noise");}
4774  if (HistoCode == "D_SCs_ChNb"){sprintf(f_in_mat_tit, "Sigma of cor(s,s')");}
4775 
4776  //.... Axis parameters: *** WARNING *** EB ===> x (Bid Hoco) = phi (StinVeco), y (Bid Veco) = eta (StinHoco)
4777  Int_t GeoBidSizeHoco = fEcal->MaxStinVecoInStas();
4778  Int_t GeoBidSizeVeco = fEcal->MaxStinHocoInStas();
4779 
4780  Int_t vertic_empty_strips = 3;
4781  Int_t vertic_empty_strip_1 = 1;
4782 
4783  if ( fFlagSubDet == "EE" )
4784  {
4785  // for empty vertical strips: before EE-, between EE- and EE+, after EE+ on plot
4786  GeoBidSizeHoco = fEcal->MaxStinHocoInStas() + vertic_empty_strips;
4787  GeoBidSizeVeco = fEcal->MaxStinVecoInStas();
4788  }
4789 
4790  Int_t nb_binx = GeoBidSizeHoco;
4791  Int_t nb_biny = GeoBidSizeVeco;
4792  Axis_t xinf_bid = (Axis_t)0.;
4793  Axis_t xsup_bid = (Axis_t)GeoBidSizeHoco;
4794  Axis_t yinf_bid = (Axis_t)0.;
4795  Axis_t ysup_bid = (Axis_t)GeoBidSizeVeco;
4796 
4797  TString axis_x_var_name = " #Hoco ";
4798  TString axis_y_var_name = " #varVeco ";
4799 
4800  //............. matrices reading and histogram filling (ViewStas)
4801 
4802  TH2D* h_geo_bid = new TH2D("geobidim_ViewStas", f_in_mat_tit,
4803  nb_binx, xinf_bid, xsup_bid,
4804  nb_biny, yinf_bid, ysup_bid); fCnewRoot++;
4805  h_geo_bid->Reset();
4806 
4807  Int_t CounterExistingFile = 0;
4808  Int_t CounterDataExist = 0;
4809 
4810  Int_t* xFapNbOfEvts = new Int_t[fEcal->MaxStexInStas()]; fCnew++;
4811  for(Int_t i=0; i<fEcal->MaxStexInStas(); i++){xFapNbOfEvts[i]=0;}
4812 
4813  //Int_t* NOFE_int = new Int_t[fEcal->MaxCrysEcnaInStex()]; fCnew++;
4814 
4815  //......................................................................... (ViewStas)
4816  for(Int_t iStasStex=0; iStasStex<fEcal->MaxStexInStas(); iStasStex++)
4817  {
4818  TVectorD partial_histp(fEcal->MaxStinEcnaInStex());
4819  for(Int_t i=0; i<fEcal->MaxStinEcnaInStex(); i++){partial_histp(i)=(Double_t)0.;}
4820 
4821  Bool_t OKFileExists = kFALSE;
4822  Bool_t OKDataExist = kFALSE;
4823 
4824  if( arg_AlreadyRead == fTobeRead )
4825  {
4827  Int_t n1StasStex = iStasStex+1;
4831  n1StasStex, fCfgResultsRootFilePath.Data());
4832 
4833  if ( fMyRootFile->LookAtRootFile() == kTRUE ){OKFileExists = kTRUE;} // (ViewStas)
4834 
4835  if( OKFileExists == kTRUE )
4836  {
4837  xFapNbOfEvts[iStasStex] = fMyRootFile->GetNumberOfEvents(fFapReqNbOfEvts, n1StasStex);
4838  TString fp_name_short = fMyRootFile->GetRootFileNameShort();
4839  // std::cout << "*TEcnaHistos::ViewStas(...)> Data are analyzed from file ----> "
4840  // << fp_name_short << std::endl;
4841 
4842  //....................... search for first and last dates
4843  if( iStasStex == 0 )
4844  {
4849  }
4850 
4851  time_t xStartTime = fMyRootFile->GetStartTime();
4852  time_t xStopTime = fMyRootFile->GetStopTime();
4853  TString xStartDate = fMyRootFile->GetStartDate();
4854  TString xStopDate = fMyRootFile->GetStopDate();
4855 
4856  if( xStartTime < fStartTime ){fStartTime = xStartTime; fStartDate = xStartDate;}
4857  if( xStopTime > fStopTime ){fStopTime = xStopTime; fStopDate = xStopDate;}
4858 
4860 
4861  //----------------------------------------------------------------------------- file reading (ViewStas)
4862  if( HistoCode == "D_NOE_ChNb" ){
4864  if( HistoCode == "D_Ped_ChNb" ){
4866  if (HistoCode == "D_TNo_ChNb" ){
4868  if( HistoCode == "D_MCs_ChNb" ){
4870  if( HistoCode == "D_LFN_ChNb" ){
4872  if( HistoCode == "D_HFN_ChNb" ){
4874  if( HistoCode == "D_SCs_ChNb" ){
4876 
4877  if ( fMyRootFile->DataExist() == kTRUE ){OKDataExist = kTRUE;}
4878  }
4879  else
4880  {
4881  fStatusFileFound = kFALSE;
4882  std::cout << "!TEcnaHistos::ViewStas(...)> *ERROR* =====> "
4883  << " ROOT file not found" << fTTBELL << std::endl;
4884  }
4885  }
4886 
4887  if( arg_AlreadyRead == 1 )
4888  {
4889  OKDataExist = kTRUE;
4890  for(Int_t i0Stin=0; i0Stin<fEcal->MaxStinEcnaInStex(); i0Stin++)
4891  {
4892  partial_histp(i0Stin) = arg_read_histo(fEcal->MaxStinEcnaInStex()*iStasStex+i0Stin);
4893  }
4894  }
4895 
4896  if( OKDataExist == kTRUE)
4897  {
4898  fStatusFileFound = kTRUE;
4899  CounterExistingFile++;
4900 
4901  //................................................................. (ViewStas)
4902  TMatrixD read_matrix(nb_binx, nb_biny);
4903  for(Int_t i=0; i<nb_binx; i++)
4904  {for(Int_t j=0; j<nb_biny; j++){read_matrix(i,j)=(Double_t)0.;}}
4905 
4906  if ( OKDataExist == kTRUE )
4907  {
4908  fStatusDataExist = kTRUE;
4909  CounterDataExist++;
4910 
4911  for(Int_t i0StexStinEcna=0; i0StexStinEcna<fEcal->MaxStinEcnaInStex(); i0StexStinEcna++)
4912  {
4913  //-------------------------------------- Geographical bidim filling (ViewStas)
4914  Int_t i_xgeo = GetXStinInStas(iStasStex, i0StexStinEcna, vertic_empty_strip_1);
4915  Int_t i_ygeo = GetYStinInStas(iStasStex, i0StexStinEcna);
4916 
4917  if(i_xgeo >=0 && i_xgeo < nb_binx && i_ygeo >=0 && i_ygeo < nb_biny)
4918  {
4919  Int_t n1StexStinEcna = i0StexStinEcna+1;
4920 
4921  if( fFlagSubDet == "EB" )
4922  {
4923  read_matrix(i_xgeo, i_ygeo) = partial_histp(i0StexStinEcna);
4924  h_geo_bid->Fill((Double_t)i_xgeo, (Double_t)i_ygeo,
4925  (Double_t)read_matrix(i_xgeo, i_ygeo));
4926  }
4927 
4928  if( fFlagSubDet == "EE" )
4929  {
4930  //---------------------> do not draw bin for SCEcna = 10 or 11 (ViewStas)
4931  if( !( (n1StexStinEcna == 10 || n1StexStinEcna == 11 ||
4932  n1StexStinEcna == 29 || n1StexStinEcna == 32) ) )
4933  {
4934  read_matrix(i_xgeo, i_ygeo) = partial_histp(i0StexStinEcna);
4935  h_geo_bid->Fill((Double_t)i_xgeo, (Double_t)i_ygeo,
4936  (Double_t)read_matrix(i_xgeo, i_ygeo));
4937  }
4938  if( n1StexStinEcna == 29 )
4939  {
4940  //----------------------------------------------------------------- (ViewStas)
4941  // Average on SCEcna 29 (x1+x2+x3+x6+x7) and SCEcna 10: (x11)
4942  // (x = Xtal# in SC; see CMS NOTE 2006/027, p.10)
4943  //
4944  // (x1+x2+x3+x6+x7)/5 = partial_histp(29-1) ; x11 = partial_histp(10-1)
4945  //
4946  // => (x1+x2+x3+x6+x7+x11)/6 = partial_histp(29-1)*5/6 + partial_histp(10-1)/6
4947  //
4948  // // except for "D_NOE_ChNb" because average done in ReadAverageNumberOfEvents
4949  // // (no averaged NbOfEvts in root file)
4950  //---------------------------------------------------------------------------------
4951  read_matrix(i_xgeo, i_ygeo) =
4952  partial_histp(i0StexStinEcna)*(Double_t)(5./6.) + partial_histp(9)/(Double_t)6.;
4953  h_geo_bid->Fill((Double_t)i_xgeo, (Double_t)i_ygeo,
4954  (Double_t)read_matrix(i_xgeo, i_ygeo));
4955  }
4956  //if( n1StexStinEcna == 32 && HistoCode != "D_NOE_ChNb" ) (ViewStas)
4957  if( n1StexStinEcna == 32 )
4958  {
4959  //---- same as previous case: replace SCEcna 29 by 32 AND SCEcna 10 by 11
4960  //----> (x1+x2+x3+x6+x7+x11)/6 = partial_histp(32-1)*5/6 + partial_histp(11-1)/6
4961  read_matrix(i_xgeo, i_ygeo) =
4962  partial_histp(i0StexStinEcna)*(Double_t)(5./6.) + partial_histp(10)/(Double_t)6.;
4963  h_geo_bid->Fill((Double_t)i_xgeo, (Double_t)i_ygeo,
4964  (Double_t)read_matrix(i_xgeo, i_ygeo));
4965  }
4966  } // end of if( fFlagSubDet == "EE" )
4967  } // end of if(i_xgeo >=0 && i_xgeo < nb_binx && i_ygeo >=0 && i_ygeo < nb_biny)
4968  } // end of for(Int_t i0StexStinEcna=0; i0StexStinEcna<fEcal->MaxStinEcnaInStex(); i0StexStinEcna++)
4969  } // end of if ( fMyRootFile->DataExist() == kTRUE )
4970  else
4971  {
4972  fStatusDataExist = kFALSE;
4973 
4974  std::cout << "!TEcnaHistos::ViewStas(...)> "
4975  << " Data not available for " << fFapStexName << " " << iStasStex+1
4976  << " (Quantity not present in the ROOT file)" << fTTBELL << std::endl;
4977  }
4978  } // end of if( fMyRootFile->LookAtRootFile() == kTRUE ) (ViewStas)
4979  else
4980  {
4981  fStatusFileFound = kFALSE;
4982 
4983  std::cout << "!TEcnaHistos::ViewStas(...)> "
4984  << " Data not available for " << fFapStexName << " " << iStasStex+1
4985  << " (ROOT file not found)" << fTTBELL << std::endl;
4986  }
4987 
4988  if( fFapNbOfEvts <= xFapNbOfEvts[iStasStex] ){fFapNbOfEvts = xFapNbOfEvts[iStasStex];}
4989 
4990  } // end of for(Int_t iStasStex=0; iStasStex<fEcal->MaxStexInStas(); iStasStex++)
4991 
4992  //delete [] NOFE_int; NOFE_int = 0; fCdelete++;
4993  delete [] xFapNbOfEvts; xFapNbOfEvts = nullptr; fCdelete++;
4994 
4995  if( CounterExistingFile > 0 && CounterDataExist > 0 )
4996  {
4997  //=============== H I S T O M I N / M A X M A N A G E M E N T ============ (ViewStas)
4998  //................................ Put histo min max values
4999  //.......... default if flag not set to "ON"
5000  SetYminMemoFromValue(HistoCode.Data(), fCnaParHistos->GetYminDefaultValue(HistoCode.Data()));
5001  SetYmaxMemoFromValue(HistoCode.Data(), fCnaParHistos->GetYmaxDefaultValue(HistoCode.Data()));
5002 
5003  if( fUserHistoMin == fUserHistoMax ){fFlagUserHistoMin = "AUTO"; fFlagUserHistoMax = "AUTO";}
5004  //.......... user's value if flag set to "ON"
5005  if( fFlagUserHistoMin == "ON" )
5006  {SetYminMemoFromValue(HistoCode.Data(), fUserHistoMin); fFlagUserHistoMin = "OFF";}
5007  if( fFlagUserHistoMax == "ON" )
5008  {SetYmaxMemoFromValue(HistoCode.Data(), fUserHistoMax); fFlagUserHistoMax = "OFF";}
5009  //................................. automatic min and/or max
5010  if( fFlagUserHistoMin == "AUTO" )
5011  {SetYminMemoFromValue(HistoCode.Data(), h_geo_bid->GetMinimum()); fFlagUserHistoMin = "OFF";}
5012  if( fFlagUserHistoMax == "AUTO" )
5013  {SetYmaxMemoFromValue(HistoCode.Data(), h_geo_bid->GetMaximum()); fFlagUserHistoMax = "OFF";}
5014  //...................................... histo set ymin and ymax
5015  SetHistoFrameYminYmaxFromMemo((TH1D*)h_geo_bid, HistoCode);
5016 
5017  // ************************** A GARDER EN RESERVE *******************************
5018  //............. special contour level for correlations (square root wise scale)
5019  //if ( HistoCode == "D_MCs_ChNb" )
5020  //{
5021  // Int_t nb_niv = 9;
5022  // Double_t* cont_niv = new Double_t[nb_niv]; fCnew++;
5023  // SqrtContourLevels(nb_niv, &cont_niv[0]);
5024  // h_geo_bid->SetContour(nb_niv, &cont_niv[0]);
5025  // delete [] cont_niv; fCdelete++;
5026  //}
5027  // ******************************** (FIN RESERVE) *******************************
5028 
5029  // =================================== P L O T S ======================== (ViewStas)
5030 
5031  char f_in[charArrLen];
5032 
5033  //...................... Taille/format canvas
5034  UInt_t canv_h = fCnaParHistos->CanvasFormatH("petit");
5035  UInt_t canv_w = fCnaParHistos->CanvasFormatW("petit");
5036 
5037  if( fFlagSubDet == "EB")
5038  {canv_w = fCnaParHistos->CanvasFormatW("phietaEB");
5039  canv_h = fCnaParHistos->CanvasFormatH("phietaEB");}
5040  if( fFlagSubDet == "EE")
5041  {canv_w = fCnaParHistos->CanvasFormatW("IYIXEE");
5042  canv_h = fCnaParHistos->CanvasFormatH("IYIXEE");}
5043 
5044  //............................................... paves commentaires (ViewStas)
5046 
5047  //------------------------------------ Canvas name ----------------- (ViewStas)
5048  TString name_cov_cor;
5049  name_cov_cor.Resize(charArrLen);
5050  name_cov_cor = "?";
5051 
5052  if( HistoCode == "D_NOE_ChNb"){name_cov_cor = "Number_of_Events";}
5053  if( HistoCode == "D_Ped_ChNb"){name_cov_cor = "Pedestals";}
5054  if( HistoCode == "D_TNo_ChNb"){name_cov_cor = "Total_noise";}
5055  if( HistoCode == "D_MCs_ChNb"){name_cov_cor = "Mean_Corss";}
5056  if( HistoCode == "D_LFN_ChNb"){name_cov_cor = "Low_Fq_Noise";}
5057  if( HistoCode == "D_HFN_ChNb"){name_cov_cor = "High_Fq_Noise";}
5058  if( HistoCode == "D_SCs_ChNb"){name_cov_cor = "Sigma_Corss";}
5059 
5060  TString name_visu;
5061  name_visu.Resize(charArrLen);
5062  name_visu = "colz";
5063 
5064  sprintf(f_in, "%s_%s_S1_%d_R%d_%d_%d_%s_%s_HocoVeco_R%d",
5065  name_cov_cor.Data(), fFapAnaType.Data(), fFapNbOfSamples, fFapRunNumber,
5067  name_visu.Data(), arg_AlreadyRead);
5068 
5069  if( fFlagSubDet == "EB" ){SetHistoPresentation((TH1D*)h_geo_bid, "Stas2DEB");}
5070  if( fFlagSubDet == "EE" ){SetHistoPresentation((TH1D*)h_geo_bid, "Stas2DEE");}
5071 
5072  TCanvas *MainCanvas = new TCanvas(f_in, f_in, canv_w, canv_h); fCnewRoot++;
5073  fCurrentCanvas = MainCanvas; fCurrentCanvasName = f_in;
5074 
5075  // std::cout << "*TEcnaHistos::ViewStas(...)> Plot is displayed on canvas ----> " << f_in << std::endl;
5076 
5077  //------------------------ Canvas draw and update ------------ (ViewStas)
5078  if( fPavComGeneralTitle != nullptr ){fPavComGeneralTitle->Draw();}
5079 
5080  fPavComStas->Draw();
5081  fPavComAnaRun->Draw();
5082  fPavComNbOfEvts->Draw();
5083 
5084  //----------------------------------------------------------- pad margins
5085  Double_t x_low = fCnaParHistos->BoxLeftX("bottom_left_box") - 0.005;
5086  Double_t y_low = fCnaParHistos->BoxTopY("bottom_left_box") + 0.005;
5087  Double_t x_margin = x_low;
5088  Double_t y_margin = y_low;
5089  MainCanvas->Divide( 1, 1, x_margin, y_margin);
5090  // Divide(nx, ny, x_margin, y_margin, color);
5091  gPad->cd(1);
5092  //........................... specific EE
5093  if( fFlagSubDet == "EE" ){
5094  Double_t x_up = fCnaParHistos->BoxRightX("bottom_right_box") + 0.005;
5095  Double_t y_up = f