Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 11:57:42

0001 //---------Author's Name: B.Fabbro DSM/IRFU/SPP CEA-Saclay
0002 //---------Copyright: Those valid for CEA sofware
0003 //---------Modified: 30/01/2014
0004 
0005 #include "CalibCalorimetry/EcalCorrelatedNoiseAnalysisAlgos/interface/TEcnaHistos.h"
0006 
0007 //--------------------------------------
0008 //  TEcnaHistos.cc
0009 //  Class creation: 18 April 2005
0010 //  Documentation: see TEcnaHistos.h
0011 //--------------------------------------
0012 
0013 ClassImp(TEcnaHistos);
0014 //______________________________________________________________________________
0015 //
0016 
0017 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
0018 //
0019 //       (attributes) ===> TEcnaParPaths --->|
0020 //                         TEcnaParEcal --->|
0021 //                         TEcnaWrite ---> TEcnaParPaths --->|
0022 //                                         TEcnaParCout  --->|
0023 //                                         TEcnaParEcal --->|
0024 //                                         TEcnaNumbering ---> TEcnaParEcal --->|
0025 //                         TEcnaParHistos ---> TEcnaParEcal --->|
0026 //                                             TEcnaNumbering ---> TEcnaParEcal --->|
0027 //                         TEcnaNumbering ---> TEcnaParEcal --->|
0028 //
0029 //                         TEcnaRead ---> TEcnaParCout --->|
0030 //                                        TEcnaParPaths --->|
0031 //                                        TEcnaHeader --->|
0032 //                                        TEcnaParEcal --->|
0033 //                                        TEcnaWrite ---> TEcnaParPaths --->|
0034 //                                                        TEcnaParCout --->|
0035 //                                                        TEcnaParEcal --->|
0036 //                                                        TEcnaNumbering ---> TEcnaParEcal --->|
0037 //                                        TEcnaNumbering ---> TEcnaParEcal --->|
0038 //
0039 //
0040 //          Terminal classes: TEcnaParPaths, TEcnaParEcal, TEcnaParCout, TEcnaHeader, TEcnaNArrayD,
0041 //                            TEcnaObject, TEcnaResultType, TEcnaRootFile
0042 //      Non terminal classes: TEcnaGui, TEcnaHistos, TEcnaParHistos, TEcnaNumbering, TEcnaRead,
0043 //                            TEcnaRun, TEcnaWrite
0044 //
0045 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
0046 
0047 TEcnaHistos::~TEcnaHistos() {
0048   //destructor
0049 
0050   if (fT1DRunNumber != nullptr) {
0051     delete[] fT1DRunNumber;
0052     fCdelete++;
0053   }
0054 
0055   //if (fCnaParHistos  != 0){delete fCnaParHistos;  fCdelete++;}
0056   //if (fCnaParPaths   != 0){delete fCnaParPaths;   fCdelete++;}
0057   //if (fCnaParCout    != 0){delete fCnaParCout;    fCdelete++;}
0058   //if (fCnaWrite      != 0){delete fCnaWrite;      fCdelete++;}
0059   //if (fEcal          != 0){delete fEcal;          fCdelete++;}
0060   //if (fEcalNumbering != 0){delete fEcalNumbering; fCdelete++;}
0061 
0062   //if (fMyRootFile     != 0){delete fMyRootFile;     fCdelete++;}
0063   //if (fReadHistoDummy != 0){delete fReadHistoDummy; fCdelete++;}
0064 
0065   //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0066 
0067   if (fCnew != fCdelete) {
0068     std::cout << "*TEcnaHistos> WRONG MANAGEMENT OF ALLOCATIONS: fCnew = " << fCnew << ", fCdelete = " << fCdelete
0069               << fTTBELL << std::endl;
0070   } else {
0071     //  std::cout << "*TEcnaHistos> BRAVO! GOOD MANAGEMENT OF ALLOCATIONS: fCnew = "
0072     //        << fCnew << ", fCdelete = " << fCdelete << std::endl;
0073   }
0074 
0075 #define MGRA
0076 #ifndef MGRA
0077   if (fCnewRoot != fCdeleteRoot) {
0078     std::cout << "*TEcnaHistos> WRONG MANAGEMENT OF ROOT ALLOCATIONS: fCnewRoot = " << fCnewRoot
0079               << ", fCdeleteRoot = " << fCdeleteRoot << std::endl;
0080   } else {
0081     std::cout << "*TEcnaHistos> BRAVO! GOOD MANAGEMENT OF ROOT ALLOCATIONS:"
0082               << " fCnewRoot = " << fCnewRoot << ", fCdeleteRoot = " << fCdeleteRoot << std::endl;
0083   }
0084 #endif  // MGRA
0085 
0086   // std::cout << "TEcnaHistos> Leaving destructor" << std::endl;
0087   // std::cout << "            fCnew = " << fCnew << ", fCdelete = " << fCdelete << std::endl;
0088 
0089   // std::cout << "[Info Management] CLASS: TEcnaHistos.        DESTROY OBJECT: this = " << this << std::endl;
0090 }
0091 
0092 //===================================================================
0093 //
0094 //                   Constructors
0095 //
0096 //===================================================================
0097 TEcnaHistos::TEcnaHistos() {
0098   // Constructor without argument. Call to Init()
0099 
0100   // std::cout << "[Info Management] CLASS: TEcnaHistos.        CREATE OBJECT: this = " << this << std::endl;
0101 
0102   Init();
0103 }
0104 
0105 TEcnaHistos::TEcnaHistos(TEcnaObject* pObjectManager, const TString& SubDet) {
0106   // std::cout << "[Info Management] CLASS: TEcnaHistos.        CREATE OBJECT: this = " << this << std::endl;
0107 
0108   Long_t i_this = (Long_t)this;
0109   pObjectManager->RegisterPointer("TEcnaHistos", i_this);
0110 
0111   Init();
0112 
0113   //----------------------- Object management
0114 
0115   //............................ fCnaParCout
0116   fCnaParCout = nullptr;
0117   Long_t iCnaParCout = pObjectManager->GetPointerValue("TEcnaParCout");
0118   if (iCnaParCout == 0) {
0119     fCnaParCout = new TEcnaParCout(pObjectManager); /*fCnew++*/
0120   } else {
0121     fCnaParCout = (TEcnaParCout*)iCnaParCout;
0122   }
0123 
0124   //............................ fCnaParPaths
0125   fCnaParPaths = nullptr;
0126   Long_t iCnaParPaths = pObjectManager->GetPointerValue("TEcnaParPaths");
0127   if (iCnaParPaths == 0) {
0128     fCnaParPaths = new TEcnaParPaths(pObjectManager); /*fCnew++*/
0129   } else {
0130     fCnaParPaths = (TEcnaParPaths*)iCnaParPaths;
0131   }
0132 
0133   fCfgResultsRootFilePath = fCnaParPaths->ResultsRootFilePath();
0134   fCfgHistoryRunListFilePath = fCnaParPaths->HistoryRunListFilePath();
0135 
0136   //............................ fEcal  => to be changed in fParEcal
0137   fEcal = nullptr;
0138   Long_t iParEcal = pObjectManager->GetPointerValue("TEcnaParEcal");
0139   if (iParEcal == 0) {
0140     fEcal = new TEcnaParEcal(pObjectManager, SubDet.Data()); /*fCnew++*/
0141   } else {
0142     fEcal = (TEcnaParEcal*)iParEcal;
0143   }
0144 
0145   //............................ fEcalNumbering
0146   fEcalNumbering = nullptr;
0147   Long_t iEcalNumbering = pObjectManager->GetPointerValue("TEcnaNumbering");
0148   if (iEcalNumbering == 0) {
0149     fEcalNumbering = new TEcnaNumbering(pObjectManager, SubDet.Data()); /*fCnew++*/
0150   } else {
0151     fEcalNumbering = (TEcnaNumbering*)iEcalNumbering;
0152   }
0153 
0154   //............................ fCnaParHistos
0155   fCnaParHistos = nullptr;
0156   Long_t iCnaParHistos = pObjectManager->GetPointerValue("TEcnaParHistos");
0157   if (iCnaParHistos == 0) {
0158     fCnaParHistos = new TEcnaParHistos(pObjectManager, SubDet.Data()); /*fCnew++*/
0159   } else {
0160     fCnaParHistos = (TEcnaParHistos*)iCnaParHistos;
0161   }
0162 
0163   //............................ fCnaWrite
0164   fCnaWrite = nullptr;
0165   Long_t iCnaWrite = pObjectManager->GetPointerValue("TEcnaWrite");
0166   if (iCnaWrite == 0) {
0167     fCnaWrite = new TEcnaWrite(pObjectManager, SubDet.Data()); /*fCnew++*/
0168   } else {
0169     fCnaWrite = (TEcnaWrite*)iCnaWrite;
0170   }
0171 
0172   //............................ fMyRootFile
0173   fMyRootFile = nullptr;
0174   Long_t iMyRootFile = pObjectManager->GetPointerValue("TEcnaRead");
0175   if (iMyRootFile == 0) {
0176     fMyRootFile = new TEcnaRead(pObjectManager, SubDet.Data()); /*fCnew++*/
0177   } else {
0178     fMyRootFile = (TEcnaRead*)iMyRootFile;
0179   }
0180 
0181   fMyRootFile->PrintNoComment();
0182 
0183   //------------------- creation objet TEcnaRead fMyRootFile (a reprendre plus clairement)
0184   //fFileHeader = 0;
0185   //fMyRootFile = new TEcnaRead(fFlagSubDet.Data(), fCnaParPaths, fCnaParCout,
0186   //                  fFileHeader, fEcalNumbering, fCnaWrite);           fCnew++;
0187   //fMyRootFile->PrintNoComment();
0188 
0189   SetEcalSubDetector(SubDet.Data());
0190   //......... init ymin,ymax histos -> Default values for Ymin and Ymax
0191   SetAllYminYmaxMemoFromDefaultValues();
0192 }
0193 
0194 void TEcnaHistos::Init() {
0195   //========================= GENERAL INITIALISATION
0196   fCnew = 0;
0197   fCdelete = 0;
0198   fCnewRoot = 0;
0199   fCdeleteRoot = 0;
0200 
0201   fCnaCommand = 0;
0202   fCnaError = 0;
0203 
0204   //------------------------------ initialisations ----------------------
0205   fTTBELL = '\007';
0206 
0207   fT1DRunNumber = nullptr;
0208 
0209   //.......... init flags Same plot
0210   fMemoPlotH1SamePlus = 0;
0211   fMemoPlotD_NOE_ChNb = 0;
0212   fMemoPlotD_NOE_ChDs = 0;
0213   fMemoPlotD_Ped_ChNb = 0;
0214   fMemoPlotD_Ped_ChDs = 0;
0215   fMemoPlotD_TNo_ChNb = 0;
0216   fMemoPlotD_TNo_ChDs = 0;
0217   fMemoPlotD_MCs_ChNb = 0;
0218   fMemoPlotD_MCs_ChDs = 0;
0219   fMemoPlotD_LFN_ChNb = 0;
0220   fMemoPlotD_LFN_ChDs = 0;
0221   fMemoPlotD_HFN_ChNb = 0;
0222   fMemoPlotD_HFN_ChDs = 0;
0223   fMemoPlotD_SCs_ChNb = 0;
0224   fMemoPlotD_SCs_ChDs = 0;
0225   fMemoPlotD_MSp_SpNb = 0;
0226   fMemoPlotD_SSp_SpNb = 0;
0227   fMemoPlotD_MSp_SpDs = 0;
0228   fMemoPlotD_SSp_SpDs = 0;
0229   fMemoPlotD_Adc_EvDs = 0;
0230   fMemoPlotD_Adc_EvNb = 0;
0231   fMemoPlotH_Ped_Date = 0;
0232   fMemoPlotH_TNo_Date = 0;
0233   fMemoPlotH_MCs_Date = 0;
0234   fMemoPlotH_LFN_Date = 0;
0235   fMemoPlotH_HFN_Date = 0;
0236   fMemoPlotH_SCs_Date = 0;
0237   fMemoPlotH_Ped_RuDs = 0;
0238   fMemoPlotH_TNo_RuDs = 0;
0239   fMemoPlotH_MCs_RuDs = 0;
0240   fMemoPlotH_LFN_RuDs = 0;
0241   fMemoPlotH_HFN_RuDs = 0;
0242   fMemoPlotH_SCs_RuDs = 0;
0243   //.......... init flags colors                                       (Init)
0244   fMemoColorH1SamePlus = 0;
0245   fMemoColorD_NOE_ChNb = 0;
0246   fMemoColorD_NOE_ChDs = 0;
0247   fMemoColorD_Ped_ChNb = 0;
0248   fMemoColorD_Ped_ChDs = 0;
0249   fMemoColorD_TNo_ChNb = 0;
0250   fMemoColorD_TNo_ChDs = 0;
0251   fMemoColorD_MCs_ChNb = 0;
0252   fMemoColorD_MCs_ChDs = 0;
0253   fMemoColorD_LFN_ChNb = 0;
0254   fMemoColorD_LFN_ChDs = 0;
0255   fMemoColorD_HFN_ChNb = 0;
0256   fMemoColorD_HFN_ChDs = 0;
0257   fMemoColorD_SCs_ChNb = 0;
0258   fMemoColorD_SCs_ChDs = 0;
0259   fMemoColorD_MSp_SpNb = 0;
0260   fMemoColorD_SSp_SpNb = 0;
0261   fMemoColorD_MSp_SpDs = 0;
0262   fMemoColorD_SSp_SpDs = 0;
0263   fMemoColorD_Adc_EvDs = 0;
0264   fMemoColorD_Adc_EvNb = 0;
0265   fMemoColorH_Ped_Date = 0;
0266   fMemoColorH_TNo_Date = 0;
0267   fMemoColorH_MCs_Date = 0;
0268   fMemoColorH_LFN_Date = 0;
0269   fMemoColorH_HFN_Date = 0;
0270   fMemoColorH_SCs_Date = 0;
0271   fMemoColorH_Ped_RuDs = 0;
0272   fMemoColorH_TNo_RuDs = 0;
0273   fMemoColorH_MCs_RuDs = 0;
0274   fMemoColorH_LFN_RuDs = 0;
0275   fMemoColorH_HFN_RuDs = 0;
0276   fMemoColorH_SCs_RuDs = 0;
0277 
0278   //.......... init counter Same canvas
0279   fCanvSameH1SamePlus = 0;
0280   fCanvSameD_NOE_ChNb = 0;
0281   fCanvSameD_NOE_ChDs = 0;
0282   fCanvSameD_Ped_ChNb = 0;
0283   fCanvSameD_Ped_ChDs = 0;
0284   fCanvSameD_TNo_ChNb = 0;
0285   fCanvSameD_TNo_ChDs = 0;
0286   fCanvSameD_MCs_ChNb = 0;
0287   fCanvSameD_MCs_ChDs = 0;
0288   fCanvSameD_LFN_ChNb = 0;
0289   fCanvSameD_LFN_ChDs = 0;
0290   fCanvSameD_HFN_ChNb = 0;
0291   fCanvSameD_HFN_ChDs = 0;
0292   fCanvSameD_SCs_ChNb = 0;
0293   fCanvSameD_SCs_ChDs = 0;
0294   fCanvSameD_MSp_SpNb = 0;
0295   fCanvSameD_SSp_SpNb = 0;
0296   fCanvSameD_MSp_SpDs = 0;
0297   fCanvSameD_SSp_SpDs = 0;
0298   fCanvSameD_Adc_EvDs = 0;
0299   fCanvSameD_Adc_EvNb = 0;
0300   fCanvSameH_Ped_Date = 0;
0301   fCanvSameH_TNo_Date = 0;
0302   fCanvSameH_MCs_Date = 0;
0303   fCanvSameH_LFN_Date = 0;
0304   fCanvSameH_HFN_Date = 0;
0305   fCanvSameH_SCs_Date = 0;
0306   fCanvSameH_Ped_RuDs = 0;
0307   fCanvSameH_TNo_RuDs = 0;
0308   fCanvSameH_MCs_RuDs = 0;
0309   fCanvSameH_LFN_RuDs = 0;
0310   fCanvSameH_HFN_RuDs = 0;
0311   fCanvSameH_SCs_RuDs = 0;
0312   //................. Flag Scale X anf Y set to "LIN" and flag color palete set to "Black/Red/Blue"
0313 
0314   fFlagScaleX.Resize(charArrLen);
0315   fFlagScaleX = "LIN";
0316 
0317   fFlagScaleY.Resize(charArrLen);
0318   fFlagScaleY = "LIN";
0319 
0320   fFlagColPal.Resize(charArrLen);
0321   fFlagColPal = "Black/Red/Blue";
0322 
0323   //................. Flag General Title set to empty string
0324   fFlagGeneralTitle.Resize(charArrLen);
0325   fFlagGeneralTitle = "";
0326 
0327   //................. Init codes Options
0328   fOptScaleLinx = 31400;
0329   fOptScaleLogx = 31401;
0330   fOptScaleLiny = 31402;
0331   fOptScaleLogy = 31403;
0332 
0333   fOptVisLine = 1101;
0334   fOptVisPolm = 1102;
0335 
0336   //............................                                       (Init)
0337   fCovarianceMatrix.Resize(charArrLen);
0338   fCovarianceMatrix = "Cov";
0339   fCorrelationMatrix.Resize(charArrLen);
0340   fCorrelationMatrix = "Cor";
0341 
0342   fLFBetweenStins.Resize(charArrLen);
0343   fLFBetweenStins = "MttLF";
0344   fHFBetweenStins.Resize(charArrLen);
0345   fHFBetweenStins = "MttHF";
0346 
0347   fLFBetweenChannels.Resize(charArrLen);
0348   fLFBetweenChannels = "MccLF";
0349   fHFBetweenChannels.Resize(charArrLen);
0350   fHFBetweenChannels = "MccHF";
0351 
0352   fBetweenSamples.Resize(charArrLen);
0353   fBetweenSamples = "Mss";
0354 
0355   //.................................. text pave alignement for pave "SeveralChanging" (HistimePlot)
0356   fTextPaveAlign = 12;             // 1 = left adjusted, 2 = vertically centered
0357   fTextPaveFont = 100;             // 10*10 = 10*(ID10 = Courier New)
0358   fTextPaveSize = (Float_t)0.025;  // 0.0xxx = xxx% of the pave size
0359   fTextBorderSize = 1;             // Pave Border (=>Shadow)
0360 
0361   //................................. Init Xvar, Yvar, NbBins management for options SAME and SAME n
0362   fXMemoH1SamePlus = "";
0363   fXMemoD_NOE_ChNb = "";
0364   fXMemoD_NOE_ChDs = "";
0365   fXMemoD_Ped_ChNb = "";
0366   fXMemoD_Ped_ChDs = "";
0367   fXMemoD_TNo_ChNb = "";
0368   fXMemoD_TNo_ChDs = "";
0369   fXMemoD_MCs_ChNb = "";
0370   fXMemoD_MCs_ChDs = "";
0371   fXMemoD_LFN_ChNb = "";
0372   fXMemoD_LFN_ChDs = "";
0373   fXMemoD_HFN_ChNb = "";
0374   fXMemoD_HFN_ChDs = "";
0375   fXMemoD_SCs_ChNb = "";
0376   fXMemoD_SCs_ChDs = "";
0377   fXMemoD_MSp_SpNb = "";
0378   fXMemoD_MSp_SpDs = "";
0379   fXMemoD_SSp_SpNb = "";
0380   fXMemoD_SSp_SpDs = "";
0381   fXMemoD_Adc_EvDs = "";
0382   fXMemoD_Adc_EvNb = "";
0383   fXMemoH_Ped_Date = "";
0384   fXMemoH_TNo_Date = "";
0385   fXMemoH_MCs_Date = "";
0386   fXMemoH_LFN_Date = "";
0387   fXMemoH_HFN_Date = "";
0388   fXMemoH_SCs_Date = "";
0389   fXMemoH_Ped_RuDs = "";
0390   fXMemoH_TNo_RuDs = "";
0391   fXMemoH_MCs_RuDs = "";
0392   fXMemoH_LFN_RuDs = "";
0393   fXMemoH_HFN_RuDs = "";
0394   fXMemoH_SCs_RuDs = "";
0395 
0396   fYMemoH1SamePlus = "";
0397   fYMemoD_NOE_ChNb = "";
0398   fYMemoD_NOE_ChDs = "";
0399   fYMemoD_Ped_ChNb = "";
0400   fYMemoD_Ped_ChDs = "";
0401   fYMemoD_TNo_ChNb = "";
0402   fYMemoD_TNo_ChDs = "";
0403   fYMemoD_MCs_ChNb = "";
0404   fYMemoD_MCs_ChDs = "";
0405   fYMemoD_LFN_ChNb = "";
0406   fYMemoD_LFN_ChDs = "";
0407   fYMemoD_HFN_ChNb = "";
0408   fYMemoD_HFN_ChDs = "";
0409   fYMemoD_SCs_ChNb = "";
0410   fYMemoD_SCs_ChDs = "";
0411   fYMemoD_MSp_SpNb = "";
0412   fYMemoD_MSp_SpDs = "";
0413   fYMemoD_SSp_SpNb = "";
0414   fYMemoD_SSp_SpDs = "";
0415   fYMemoD_Adc_EvDs = "";
0416   fYMemoD_Adc_EvNb = "";
0417   fYMemoH_Ped_Date = "";
0418   fYMemoH_TNo_Date = "";
0419   fYMemoH_MCs_Date = "";
0420   fYMemoH_LFN_Date = "";
0421   fYMemoH_HFN_Date = "";
0422   fYMemoH_SCs_Date = "";
0423   fYMemoH_Ped_RuDs = "";
0424   fYMemoH_TNo_RuDs = "";
0425   fYMemoH_MCs_RuDs = "";
0426   fYMemoH_LFN_RuDs = "";
0427   fYMemoH_HFN_RuDs = "";
0428   fYMemoH_SCs_RuDs = "";
0429 
0430   fNbBinsMemoH1SamePlus = 0;
0431   fNbBinsMemoD_NOE_ChNb = 0;
0432   fNbBinsMemoD_NOE_ChDs = 0;
0433   fNbBinsMemoD_Ped_ChNb = 0;
0434   fNbBinsMemoD_Ped_ChDs = 0;
0435   fNbBinsMemoD_TNo_ChNb = 0;
0436   fNbBinsMemoD_TNo_ChDs = 0;
0437   fNbBinsMemoD_MCs_ChNb = 0;
0438   fNbBinsMemoD_MCs_ChDs = 0;
0439   fNbBinsMemoD_LFN_ChNb = 0;
0440   fNbBinsMemoD_LFN_ChDs = 0;
0441   fNbBinsMemoD_HFN_ChNb = 0;
0442   fNbBinsMemoD_HFN_ChDs = 0;
0443   fNbBinsMemoD_SCs_ChNb = 0;
0444   fNbBinsMemoD_SCs_ChDs = 0;
0445   fNbBinsMemoD_MSp_SpNb = 0;
0446   fNbBinsMemoD_MSp_SpDs = 0;
0447   fNbBinsMemoD_SSp_SpNb = 0;
0448   fNbBinsMemoD_SSp_SpDs = 0;
0449   fNbBinsMemoD_Adc_EvDs = 0;
0450   fNbBinsMemoD_Adc_EvNb = 0;
0451   fNbBinsMemoH_Ped_Date = 0;
0452   fNbBinsMemoH_TNo_Date = 0;
0453   fNbBinsMemoH_MCs_Date = 0;
0454   fNbBinsMemoH_LFN_Date = 0;
0455   fNbBinsMemoH_HFN_Date = 0;
0456   fNbBinsMemoH_SCs_Date = 0;
0457   fNbBinsMemoH_Ped_RuDs = 0;
0458   fNbBinsMemoH_TNo_RuDs = 0;
0459   fNbBinsMemoH_MCs_RuDs = 0;
0460   fNbBinsMemoH_LFN_RuDs = 0;
0461   fNbBinsMemoH_HFN_RuDs = 0;
0462   fNbBinsMemoH_SCs_RuDs = 0;
0463 
0464   //.................................. Init canvas/pad pointers                (Init)
0465   fCurrentCanvas = nullptr;
0466 
0467   fCurrentCanvasName = "?";
0468 
0469   fCanvH1SamePlus = nullptr;
0470   fCanvD_NOE_ChNb = nullptr;
0471   fCanvD_NOE_ChDs = nullptr;
0472   fCanvD_Ped_ChNb = nullptr;
0473   fCanvD_Ped_ChDs = nullptr;
0474   fCanvD_TNo_ChNb = nullptr;
0475   fCanvD_TNo_ChDs = nullptr;
0476   fCanvD_MCs_ChNb = nullptr;
0477   fCanvD_MCs_ChDs = nullptr;
0478   fCanvD_LFN_ChNb = nullptr;
0479   fCanvD_LFN_ChDs = nullptr;
0480   fCanvD_HFN_ChNb = nullptr;
0481   fCanvD_HFN_ChDs = nullptr;
0482   fCanvD_SCs_ChNb = nullptr;
0483   fCanvD_SCs_ChDs = nullptr;
0484   fCanvD_MSp_SpNb = nullptr;
0485   fCanvD_MSp_SpDs = nullptr;
0486   fCanvD_SSp_SpNb = nullptr;
0487   fCanvD_SSp_SpDs = nullptr;
0488   fCanvD_Adc_EvDs = nullptr;
0489   fCanvD_Adc_EvNb = nullptr;
0490   fCanvH_Ped_Date = nullptr;
0491   fCanvH_TNo_Date = nullptr;
0492   fCanvH_MCs_Date = nullptr;
0493   fCanvH_LFN_Date = nullptr;
0494   fCanvH_HFN_Date = nullptr;
0495   fCanvH_SCs_Date = nullptr;
0496   fCanvH_Ped_RuDs = nullptr;
0497   fCanvH_TNo_RuDs = nullptr;
0498   fCanvH_MCs_RuDs = nullptr;
0499   fCanvH_LFN_RuDs = nullptr;
0500   fCanvH_HFN_RuDs = nullptr;
0501   fCanvH_SCs_RuDs = nullptr;
0502 
0503   fClosedH1SamePlus = kFALSE;  // (Canvas Closed SIGNAL)
0504   fClosedD_NOE_ChNb = kFALSE;
0505   fClosedD_NOE_ChDs = kFALSE;
0506   fClosedD_Ped_ChNb = kFALSE;
0507   fClosedD_Ped_ChDs = kFALSE;
0508   fClosedD_TNo_ChNb = kFALSE;
0509   fClosedD_TNo_ChDs = kFALSE;
0510   fClosedD_MCs_ChNb = kFALSE;
0511   fClosedD_MCs_ChDs = kFALSE;
0512   fClosedD_LFN_ChNb = kFALSE;
0513   fClosedD_LFN_ChDs = kFALSE;
0514   fClosedD_HFN_ChNb = kFALSE;
0515   fClosedD_HFN_ChDs = kFALSE;
0516   fClosedD_SCs_ChNb = kFALSE;
0517   fClosedD_SCs_ChDs = kFALSE;
0518   fClosedD_MSp_SpNb = kFALSE;
0519   fClosedD_MSp_SpDs = kFALSE;
0520   fClosedD_SSp_SpNb = kFALSE;
0521   fClosedD_SSp_SpDs = kFALSE;
0522   fClosedD_Adc_EvDs = kFALSE;
0523   fClosedD_Adc_EvNb = kFALSE;
0524   fClosedH_Ped_Date = kFALSE;
0525   fClosedH_TNo_Date = kFALSE;
0526   fClosedH_MCs_Date = kFALSE;
0527   fClosedH_LFN_Date = kFALSE;
0528   fClosedH_HFN_Date = kFALSE;
0529   fClosedH_SCs_Date = kFALSE;
0530   fClosedH_Ped_RuDs = kFALSE;
0531   fClosedH_TNo_RuDs = kFALSE;
0532   fClosedH_MCs_RuDs = kFALSE;
0533   fClosedH_LFN_RuDs = kFALSE;
0534   fClosedH_HFN_RuDs = kFALSE;
0535   fClosedH_SCs_RuDs = kFALSE;
0536 
0537   fCurrentPad = nullptr;  //   (Init)
0538 
0539   fPadH1SamePlus = nullptr;
0540   fPadD_NOE_ChNb = nullptr;
0541   fPadD_NOE_ChDs = nullptr;
0542   fPadD_Ped_ChNb = nullptr;
0543   fPadD_Ped_ChDs = nullptr;
0544   fPadD_TNo_ChNb = nullptr;
0545   fPadD_TNo_ChDs = nullptr;
0546   fPadD_MCs_ChNb = nullptr;
0547   fPadD_MCs_ChDs = nullptr;
0548   fPadD_LFN_ChNb = nullptr;
0549   fPadD_LFN_ChDs = nullptr;
0550   fPadD_HFN_ChNb = nullptr;
0551   fPadD_HFN_ChDs = nullptr;
0552   fPadD_SCs_ChNb = nullptr;
0553   fPadD_SCs_ChDs = nullptr;
0554   fPadD_MSp_SpNb = nullptr;
0555   fPadD_MSp_SpDs = nullptr;
0556   fPadD_SSp_SpNb = nullptr;
0557   fPadD_SSp_SpDs = nullptr;
0558   fPadD_Adc_EvDs = nullptr;
0559   fPadD_Adc_EvNb = nullptr;
0560   fPadH_Ped_Date = nullptr;
0561   fPadH_TNo_Date = nullptr;
0562   fPadH_MCs_Date = nullptr;
0563   fPadH_LFN_Date = nullptr;
0564   fPadH_HFN_Date = nullptr;
0565   fPadH_SCs_Date = nullptr;
0566   fPadH_Ped_RuDs = nullptr;
0567   fPadH_TNo_RuDs = nullptr;
0568   fPadH_MCs_RuDs = nullptr;
0569   fPadH_LFN_RuDs = nullptr;
0570   fPadH_HFN_RuDs = nullptr;
0571   fPadH_SCs_RuDs = nullptr;
0572 
0573   fPavTxtH1SamePlus = nullptr;  //   (Init)
0574   fPavTxtD_NOE_ChNb = nullptr;
0575   fPavTxtD_NOE_ChDs = nullptr;
0576   fPavTxtD_Ped_ChNb = nullptr;
0577   fPavTxtD_Ped_ChDs = nullptr;
0578   fPavTxtD_TNo_ChNb = nullptr;
0579   fPavTxtD_TNo_ChDs = nullptr;
0580   fPavTxtD_MCs_ChNb = nullptr;
0581   fPavTxtD_MCs_ChDs = nullptr;
0582   fPavTxtD_LFN_ChNb = nullptr;
0583   fPavTxtD_LFN_ChDs = nullptr;
0584   fPavTxtD_HFN_ChNb = nullptr;
0585   fPavTxtD_HFN_ChDs = nullptr;
0586   fPavTxtD_SCs_ChNb = nullptr;
0587   fPavTxtD_SCs_ChDs = nullptr;
0588   fPavTxtD_MSp_SpNb = nullptr;
0589   fPavTxtD_MSp_SpDs = nullptr;
0590   fPavTxtD_SSp_SpNb = nullptr;
0591   fPavTxtD_SSp_SpDs = nullptr;
0592   fPavTxtD_Adc_EvDs = nullptr;
0593   fPavTxtD_Adc_EvNb = nullptr;
0594   fPavTxtH_Ped_Date = nullptr;
0595   fPavTxtH_TNo_Date = nullptr;
0596   fPavTxtH_MCs_Date = nullptr;
0597   fPavTxtH_LFN_Date = nullptr;
0598   fPavTxtH_HFN_Date = nullptr;
0599   fPavTxtH_SCs_Date = nullptr;
0600   fPavTxtH_Ped_RuDs = nullptr;
0601   fPavTxtH_TNo_RuDs = nullptr;
0602   fPavTxtH_MCs_RuDs = nullptr;
0603   fPavTxtH_LFN_RuDs = nullptr;
0604   fPavTxtH_HFN_RuDs = nullptr;
0605   fPavTxtH_SCs_RuDs = nullptr;
0606 
0607   fImpH1SamePlus = nullptr;  //   (Init)
0608   fImpD_NOE_ChNb = nullptr;
0609   fImpD_NOE_ChDs = nullptr;
0610   fImpD_Ped_ChNb = nullptr;
0611   fImpD_Ped_ChDs = nullptr;
0612   fImpD_TNo_ChNb = nullptr;
0613   fImpD_TNo_ChDs = nullptr;
0614   fImpD_MCs_ChNb = nullptr;
0615   fImpD_MCs_ChDs = nullptr;
0616   fImpD_LFN_ChNb = nullptr;
0617   fImpD_LFN_ChDs = nullptr;
0618   fImpD_HFN_ChNb = nullptr;
0619   fImpD_HFN_ChDs = nullptr;
0620   fImpD_SCs_ChNb = nullptr;
0621   fImpD_SCs_ChDs = nullptr;
0622   fImpD_MSp_SpNb = nullptr;
0623   fImpD_MSp_SpDs = nullptr;
0624   fImpD_SSp_SpNb = nullptr;
0625   fImpD_SSp_SpDs = nullptr;
0626   fImpD_Adc_EvDs = nullptr;
0627   fImpD_Adc_EvNb = nullptr;
0628   fImpH_Ped_Date = nullptr;
0629   fImpH_TNo_Date = nullptr;
0630   fImpH_MCs_Date = nullptr;
0631   fImpH_LFN_Date = nullptr;
0632   fImpH_HFN_Date = nullptr;
0633   fImpH_SCs_Date = nullptr;
0634   fImpH_Ped_RuDs = nullptr;
0635   fImpH_TNo_RuDs = nullptr;
0636   fImpH_MCs_RuDs = nullptr;
0637   fImpH_LFN_RuDs = nullptr;
0638   fImpH_HFN_RuDs = nullptr;
0639   fImpH_SCs_RuDs = nullptr;
0640 
0641   fNbBinsProj = 100;  // number of bins for histos in option Projection
0642 
0643   //.................................... Miscellaneous parameters                (Init)
0644 
0645   fNbOfListFileH_Ped_Date = 0;
0646   fNbOfListFileH_TNo_Date = 0;
0647   fNbOfListFileH_MCs_Date = 0;
0648   fNbOfListFileH_LFN_Date = 0;
0649   fNbOfListFileH_HFN_Date = 0;
0650   fNbOfListFileH_SCs_Date = 0;
0651 
0652   fNbOfListFileH_Ped_RuDs = 0;
0653   fNbOfListFileH_TNo_RuDs = 0;
0654   fNbOfListFileH_MCs_RuDs = 0;
0655   fNbOfListFileH_LFN_RuDs = 0;
0656   fNbOfListFileH_HFN_RuDs = 0;
0657   fNbOfListFileH_SCs_RuDs = 0;
0658 
0659   fNbOfExistingRuns = 0;
0660 
0661   fFapNbOfRuns = -1;     // INIT NUMBER OF RUNS: set to -1
0662   fFapMaxNbOfRuns = -1;  // INIT MAXIMUM NUMBER OF RUNS: set to -1
0663 
0664   fFapFileRuns.Resize(charArrLen);
0665   fFapFileRuns = "(file with list of runs parameters: no info)";
0666 
0667   fStartEvolTime = 0;
0668   fStopEvolTime = 0;
0669   fStartEvolDate = "Start date: not known";
0670   fStopEvolDate = "Stop date:  not known";
0671 
0672   fStartEvolRun = 0;
0673   fStopEvolRun = 0;
0674 
0675   fRunType = "Run type: not known";
0676 
0677   fFapNbOfEvts = 0;
0678 
0679   fMyRootFileName.Resize(charArrLen);
0680   fMyRootFileName = "No ROOT file name available (fMyRootFileName).";
0681 
0682   fFapAnaType = "Analysis name: not known";  // Init Type of analysis
0683   fFapNbOfSamples = 0;                       // Init Nb of required samples
0684   fFapRunNumber = 0;                         // Init Run number
0685   fFapFirstReqEvtNumber = 0;                 // Init First requested event number
0686   fFapLastReqEvtNumber = 0;                  // Init Last requested event number
0687   fFapReqNbOfEvts = 0;                       // Init Requested number of events
0688   fFapStexNumber = 0;                        // Init Stex number
0689 
0690   //------------------ Init read file flags
0691   fAlreadyRead = 1;
0692   fMemoAlreadyRead = 0;
0693   fTobeRead = 0;
0694   fZerv = 0;
0695   fUnev = 1;
0696   TVectorD fReadHistoDummy(fUnev);
0697   TMatrixD fReadMatrixDummy(fUnev, fUnev);
0698 
0699   //------------------ Init fAsciiFileName
0700   fAsciiFileName = "?";
0701 
0702 }  // end of Init()
0703 
0704 //----------------------------------------------------------------------------------------
0705 void TEcnaHistos::SetEcalSubDetector(const TString& SubDet) {
0706   // Set Subdetector (EB or EE)
0707 
0708   fFlagSubDet.Resize(charArrLen);
0709   fFlagSubDet = fEcal->GetEcalSubDetector();  // fFlagSubDet = "EB" or "EE"
0710 
0711   //.................................. Init specific EB/EE parameters ( SetEcalSubDetector(...) )
0712   fFapStexName.Resize(charArrLen);
0713   fFapStexName = "no info for Stex";
0714   fFapStinName.Resize(charArrLen);
0715   fFapStinName = "no info for Stin";
0716   fFapXtalName.Resize(charArrLen);
0717   fFapXtalName = "no info for Xtal";
0718   fFapEchaName.Resize(charArrLen);
0719   fFapEchaName = "no info for Echa";
0720 
0721   if (fFlagSubDet == "EB") {
0722     fFapStexName = "SM";
0723     fFapStinName = "Tower";
0724     fFapXtalName = "Xtal";
0725     fFapEchaName = "Chan";
0726     fFapStexBarrel = fEcalNumbering->GetSMHalfBarrel(fFapStexNumber);
0727   }
0728 
0729   if (fFlagSubDet == "EE") {
0730     fFapStexName = "Dee";
0731     fFapStinName = "SC";
0732     fFapXtalName = "Xtal";
0733     fFapEchaName = "Chan";
0734     fFapStexType = fEcalNumbering->GetEEDeeType(fFapStexNumber);
0735     fFapStexDir = "right";
0736     fFapStinQuadType = "top";
0737   }
0738 
0739   //........................ init code plot type                     (SetEcalSubDetector)
0740   fOnlyOnePlot.Resize(charArrLen);
0741   fOnlyOnePlot = fCnaParHistos->GetCodeOnlyOnePlot();  // "ONLYONE"
0742 
0743   fSeveralPlot.Resize(charArrLen);
0744   fSeveralPlot = fCnaParHistos->GetCodeSeveralPlot();  // "SEVERAL"
0745 
0746   fSameOnePlot.Resize(charArrLen);
0747   fSameOnePlot = fCnaParHistos->GetCodeSameOnePlot();  // "SAME n";
0748 
0749   fAllXtalsInStinPlot.Resize(charArrLen);
0750   fAllXtalsInStinPlot = fCnaParHistos->GetCodeAllXtalsInStinPlot();  // "SAME in Stin";
0751 
0752   fPlotAllXtalsInStin = fCnaParHistos->GetCodePlotAllXtalsInStin();  //  0
0753 
0754 }  // ---------------- end of  SetEcalSubDetector(...) ----------------
0755 
0756 //--------------------------------------------------------------------------------------------
0757 //
0758 //          FileParameters(s)(...)
0759 //
0760 //--------------------------------------------------------------------------------------------
0761 
0762 //===> DON'T SUPPRESS: THESE METHODS ARE CALLED BY TEcnaGui and can be called by any other program
0763 void TEcnaHistos::FileParameters(const TString& xArgAnaType,
0764                                  const Int_t& xArgNbOfSamples,
0765                                  const Int_t& xArgRunNumber,
0766                                  const Int_t& xArgFirstReqEvtNumber,
0767                                  const Int_t& xArgLastReqEvtNumber,
0768                                  const Int_t& xArgReqNbOfEvts,
0769                                  const Int_t& xArgStexNumber) {
0770   // Set parameters for reading the right ECNA results file
0771 
0772   fFapAnaType = xArgAnaType;
0773   fFapNbOfSamples = xArgNbOfSamples;
0774   fFapRunNumber = xArgRunNumber;
0775   fFapFirstReqEvtNumber = xArgFirstReqEvtNumber;
0776   fFapLastReqEvtNumber = xArgLastReqEvtNumber;
0777   fFapReqNbOfEvts = xArgReqNbOfEvts;
0778   fFapStexNumber = xArgStexNumber;
0779 
0780   InitSpecParBeforeFileReading();  // SpecPar = Special Parameters (dates, times, run types)
0781 }
0782 
0783 void TEcnaHistos::FileParameters(TEcnaRead* MyRootFile) {
0784   // Set parameters for reading the right ECNA results file
0785 
0786   InitSpecParBeforeFileReading();  // SpecPar = Special Parameters (dates, times, run types)
0787 
0788   //............... Filename parameter values
0789   fFapAnaType = MyRootFile->GetAnalysisName();
0790   fFapNbOfSamples = MyRootFile->GetNbOfSamples();
0791   fFapRunNumber = MyRootFile->GetRunNumber();
0792   fFapFirstReqEvtNumber = MyRootFile->GetFirstReqEvtNumber();
0793   fFapLastReqEvtNumber = MyRootFile->GetLastReqEvtNumber();
0794   fFapReqNbOfEvts = MyRootFile->GetReqNbOfEvts();
0795   fFapStexNumber = MyRootFile->GetStexNumber();
0796 
0797   //............... parameter values from file contents
0798   fStartDate = MyRootFile->GetStartDate();
0799   fStopDate = MyRootFile->GetStopDate();
0800   fRunType = MyRootFile->GetRunType();
0801 
0802   fFapNbOfEvts = MyRootFile->GetNumberOfEvents(fFapReqNbOfEvts, fFapStexNumber);
0803 }
0804 
0805 //=============================================================================================
0806 //                 Set general title
0807 //                 Set lin or log scale on X or Y axis
0808 //                 Set color palette
0809 //                 Set start and stop date
0810 //                 Set run type
0811 //=============================================================================================
0812 //............................................................................................
0813 void TEcnaHistos::GeneralTitle(const TString& title) { fFlagGeneralTitle = title.Data(); }
0814 void TEcnaHistos::SetHistoScaleX(const TString& option_scale) {
0815   fFlagScaleX = "LIN";
0816   if (option_scale == "LOG") {
0817     fFlagScaleX = "LOG";
0818   }
0819 }
0820 void TEcnaHistos::SetHistoScaleY(const TString& option_scale) {
0821   fFlagScaleY = "LIN";
0822   if (option_scale == "LOG") {
0823     fFlagScaleY = "LOG";
0824   }
0825 }
0826 void TEcnaHistos::SetHistoColorPalette(const TString& option_palette) {
0827   fFlagColPal = "Black/Red/Blue";
0828   if (!(option_palette == "Rainbow" || option_palette == "rainbow")) {
0829     fFlagColPal = "Black/Red/Blue";
0830   }
0831   if (option_palette == "Rainbow" || option_palette == "rainbow") {
0832     fFlagColPal = "Rainbow";
0833   }
0834 }
0835 void TEcnaHistos::StartStopDate(const TString& start_date, const TString& stop_date) {
0836   fStartDate = start_date.Data();
0837   fStopDate = stop_date.Data();
0838 }
0839 void TEcnaHistos::RunType(const TString& run_type) { fRunType = run_type.Data(); }
0840 void TEcnaHistos::NumberOfEvents(const Int_t& nb_of_evts) { fFapNbOfEvts = nb_of_evts; }
0841 //====================== return status for root file and data existence
0842 Bool_t TEcnaHistos::StatusFileFound() { return fStatusFileFound; }
0843 Bool_t TEcnaHistos::StatusDataExist() { return fStatusDataExist; }
0844 
0845 //=======================================================================================
0846 //
0847 //                       ( R e a d A n d ) P l o t    (1D , 2D , History)
0848 //
0849 //=======================================================================================
0850 //---------------------------------------------------------------------------------------------
0851 // TechHistoCode list modification (06/10/09)
0852 //
0853 //    D = Detector Plot    ChNb = Channel Number
0854 //                         ChDs = Channel Distribution (Y projection)
0855 //
0856 //    H = History  Plot    Date = date in format YYMMJJ hhmmss
0857 //                         RuDs = Run distribution
0858 //
0859 //      old code             new code    std code X  std code Y   (std = standard)
0860 //
0861 // *  1 H1NbOfEvtsGlobal     D_NOE_ChNb   Xtal        NOE            NOE = Number Of Events
0862 // *  2 H1NbOfEvtsProj       D_NOE_ChDs   NOE         NOX            NOX = Number Of Xtals
0863 // *  3 H1EvEvGlobal         D_Ped_ChNb   Xtal        Ped            Ped = Pedestal
0864 // *  4 H1EvEvProj           D_Ped_ChDs   Ped         NOX
0865 // *  5 H1EvSigGlobal        D_TNo_ChNb   Xtal        TNo            TNo = Total Noise
0866 // *  6 H1EvSigProj          D_TNo_ChDs   TNo         NOX
0867 // *  7 H1SigEvGlobal        D_LFN_ChNb   Xtal        LFN            LFN = Low Frequency noise
0868 // *  8 H1SigEvProj          D_LFN_ChDs   LFN         NOX
0869 // *  9 H1SigSigGlobal       D_HFN_ChNb   Xtal        HFN            HFN = High Frequency noise
0870 // * 10 H1SigSigProj         D_HFN_ChDs   HFN         NOX
0871 // * 11 H1EvCorssGlobal      D_MCs_ChNb   Xtal        MCs            MCs = Mean correlations between samples
0872 // * 12 H1EvCorssProj        D_MCs_ChDs   MCs         NOX
0873 // * 13 H1SigCorssGlobal     D_SCs_ChNb   Xtal        SCs            SCs = Sigma of the correlations between samples
0874 // * 14 H1SigCorssProj       D_SCs_ChDs   SCs         NOX
0875 // * 15 Ev                   D_MSp_SpNb   Sample      MSp            MSp = Means  of the samples
0876 // * 16 EvProj               D_MSp_SpDs   MSp         NOS            NOS = Number of samples
0877 // * 17 Sigma                D_SSp_SpNb   Sample      SSp            SSp = Sigmas of the samples
0878 // * 18 SigmaProj            D_SSp_SpDs   SSp         NOS
0879 // * 19 SampTime             D_Adc_EvNb   Event       Adc            Adc = ADC count as a function of Event number
0880 // * 20 AdcProj              D_Adc_EvDs   Adc         NOE            EvDs = Event distribution
0881 // * 21 EvolEvEv             H_Ped_Date   Time        Ped            Time = date YY/MM/DD hh:mm:ss
0882 // * 22 EvolEvEvProj         H_Ped_RuDs   Ped         NOR            NOR  = Number Of Runs
0883 // * 23 EvolEvSig            H_TNo_Date   Time        TNo
0884 // * 24 EvolEvSigProj        H_TNo_RuDs   TNo         NOR
0885 // * 25 EvolSigEv            H_LFN_Date   Time        LFN
0886 // * 26 EvolSigEvProj        H_LFN_RuDs   LFN         NOR
0887 // * 27 EvolSigSig           H_HFN_Date   Time        HFN
0888 // * 28 EvolSigSigProj       H_HFN_RuDs   HFN         NOR
0889 // * 29 EvolEvCorss          H_MCs_Date   Time        MCs
0890 // * 30 EvolEvCorssProj      H_MCs_RuDs   MCs         NOR
0891 // * 31 EvolSigCorss         H_SCs_Date   Time        SCs
0892 // * 32 EvolSigCorssProj     H_SCs_RuDs   SCs         NOR
0893 //
0894 //---------------------------------------------------------------------------------------------
0895 
0896 //---------------------------------------------------------------------------------------
0897 //
0898 //                              (ReadAnd)PlotMatrix
0899 //
0900 //---------------------------------------------------------------------------------------
0901 //................................ Corcc[for 1 Stex] (big matrix), Cortt[for 1 Stex]
0902 void TEcnaHistos::PlotMatrix(const TMatrixD& read_matrix_corcc,
0903                              const TString& UserCorOrCov,
0904                              const TString& UserBetweenWhat) {
0905   PlotMatrix(read_matrix_corcc, UserCorOrCov, UserBetweenWhat, "");
0906 }
0907 
0908 void TEcnaHistos::PlotMatrix(const TMatrixD& read_matrix_corcc,
0909                              const TString& UserCorOrCov,
0910                              const TString& UserBetweenWhat,
0911                              const TString& UserPlotOption) {
0912   TString CallingMethod = "2D";
0913 
0914   TString StandardPlotOption = fCnaParHistos->BuildStandardPlotOption(CallingMethod, UserPlotOption);
0915 
0916   TString BetweenWhat = fCnaParHistos->BuildStandardBetweenWhatCode(CallingMethod, UserBetweenWhat);
0917   TString CorOrCov = fCnaParHistos->BuildStandardCovOrCorCode(CallingMethod, UserCorOrCov);
0918 
0919   if (BetweenWhat != "?" && CorOrCov != "?") {
0920     if (BetweenWhat == "MttLF" || BetweenWhat == "MttHF") {
0921       fAlreadyRead = 1;
0922       ViewMatrix(read_matrix_corcc, fAlreadyRead, fZerv, fZerv, fZerv, CorOrCov, BetweenWhat, StandardPlotOption);
0923     }
0924     if (BetweenWhat == "MccLF") {
0925       StexHocoVecoLHFCorcc("LF");
0926     }  // forced to Read file and Plot
0927     if (BetweenWhat == "MccHF") {
0928       StexHocoVecoLHFCorcc("HF");
0929     }  // forced to Read file and Plot
0930   } else {
0931     fFlagUserHistoMin = "OFF";
0932     fFlagUserHistoMax = "OFF";
0933     std::cout << "!TEcnaHistos::PlotMatrix(...)> Histo cannot be reached." << fTTBELL << std::endl;
0934   }
0935 }
0936 
0937 void TEcnaHistos::PlotMatrix(const TString& UserCorOrCov, const TString& UserBetweenWhat) {
0938   PlotMatrix(UserCorOrCov, UserBetweenWhat, "");
0939 }
0940 
0941 void TEcnaHistos::PlotMatrix(const TString& UserCorOrCov,
0942                              const TString& UserBetweenWhat,
0943                              const TString& UserPlotOption) {
0944   TString CallingMethod = "2D";
0945 
0946   TString StandardPlotOption = fCnaParHistos->BuildStandardPlotOption(CallingMethod, UserPlotOption);
0947 
0948   TString BetweenWhat = fCnaParHistos->BuildStandardBetweenWhatCode(CallingMethod, UserBetweenWhat);
0949   TString CorOrCov = fCnaParHistos->BuildStandardCovOrCorCode(CallingMethod, UserCorOrCov);
0950 
0951   if (BetweenWhat != "?" && CorOrCov != "?") {
0952     if (BetweenWhat == "MttLF" || BetweenWhat == "MttHF") {
0953       ViewMatrix(fReadMatrixDummy, fTobeRead, fZerv, fZerv, fZerv, CorOrCov, BetweenWhat, StandardPlotOption);
0954     }
0955     if (BetweenWhat == "MccLF") {
0956       StexHocoVecoLHFCorcc("LF");
0957     }  // Plot  only
0958     if (BetweenWhat == "MccHF") {
0959       StexHocoVecoLHFCorcc("HF");
0960     }  // Plot  only
0961   } else {
0962     fFlagUserHistoMin = "OFF";
0963     fFlagUserHistoMax = "OFF";
0964     std::cout << "!TEcnaHistos::PlotMatrix(...)> Histo cannot be reached." << fTTBELL << std::endl;
0965   }
0966 }
0967 
0968 //....................................... Corcc for channels (cStexStin_A, cStexStin_B)
0969 //                                        Corss, Covss for one channel (-> i0StinEcha)
0970 void TEcnaHistos::PlotMatrix(const TMatrixD& read_matrix,
0971                              const TString& UserCorOrCov,
0972                              const TString& UserBetweenWhat,
0973                              const Int_t& arg_n1,
0974                              const Int_t& arg_n2) {
0975   PlotMatrix(read_matrix, UserCorOrCov, UserBetweenWhat, arg_n1, arg_n2, "");
0976 }
0977 
0978 void TEcnaHistos::PlotMatrix(const TMatrixD& read_matrix,
0979                              const TString& UserCorOrCov,
0980                              const TString& UserBetweenWhat,
0981                              const Int_t& arg_n1,
0982                              const Int_t& arg_n2,
0983                              const TString& UserPlotOption) {
0984   TString CallingMethod = "2D";
0985 
0986   TString StandardPlotOption = fCnaParHistos->BuildStandardPlotOption(CallingMethod, UserPlotOption);
0987 
0988   TString BetweenWhat = fCnaParHistos->BuildStandardBetweenWhatCode(CallingMethod, UserBetweenWhat);
0989   TString CorOrCov = fCnaParHistos->BuildStandardCovOrCorCode(CallingMethod, UserCorOrCov);
0990 
0991   if (BetweenWhat != "?" && CorOrCov != "?") {
0992     if (BetweenWhat == "MccLF" || BetweenWhat == "MccHF") {
0993       Int_t cStexStin_A = arg_n1;
0994       Int_t cStexStin_B = arg_n2;
0995       fAlreadyRead = 1;
0996       ViewMatrix(read_matrix, fAlreadyRead, cStexStin_A, cStexStin_B, fZerv, CorOrCov, BetweenWhat, StandardPlotOption);
0997     }
0998 
0999     if (BetweenWhat == "Mss") {
1000       Int_t n1StexStin = arg_n1;
1001       Int_t i0StinEcha = arg_n2;
1002       if (fFlagSubDet == "EE") {
1003         n1StexStin = fEcalNumbering->Get1DeeSCEcnaFromDeeSCCons(fFapStexNumber, arg_n1);
1004       }
1005       fAlreadyRead = 1;
1006       ViewMatrix(read_matrix, fAlreadyRead, n1StexStin, fZerv, i0StinEcha, CorOrCov, BetweenWhat, StandardPlotOption);
1007     }
1008   } else {
1009     fFlagUserHistoMin = "OFF";
1010     fFlagUserHistoMax = "OFF";
1011     std::cout << "!TEcnaHistos::PlotMatrix(...)> Histo cannot be reached." << fTTBELL << std::endl;
1012   }
1013 }
1014 
1015 void TEcnaHistos::PlotMatrix(const TString& UserCorOrCov,
1016                              const TString& UserBetweenWhat,
1017                              const Int_t& arg_n1,
1018                              const Int_t& arg_n2) {
1019   PlotMatrix(UserCorOrCov, UserBetweenWhat, arg_n1, arg_n2, "");
1020 }
1021 
1022 void TEcnaHistos::PlotMatrix(const TString& UserCorOrCov,
1023                              const TString& UserBetweenWhat,
1024                              const Int_t& arg_n1,
1025                              const Int_t& arg_n2,
1026                              const TString& UserPlotOption) {
1027   TString CallingMethod = "2D";
1028 
1029   TString StandardPlotOption = fCnaParHistos->BuildStandardPlotOption(CallingMethod, UserPlotOption);
1030 
1031   TString StandardBetweenWhat = fCnaParHistos->BuildStandardBetweenWhatCode(CallingMethod, UserBetweenWhat);
1032   TString StandardCorOrCov = fCnaParHistos->BuildStandardCovOrCorCode(CallingMethod, UserCorOrCov);
1033 
1034   if (StandardBetweenWhat != "?" && StandardCorOrCov != "?") {
1035     if (StandardBetweenWhat == "MccLF" || StandardBetweenWhat == "MccHF") {
1036       Int_t cStexStin_A = arg_n1;
1037       Int_t cStexStin_B = arg_n2;
1038       ViewMatrix(fReadMatrixDummy,
1039                  fTobeRead,
1040                  cStexStin_A,
1041                  cStexStin_B,
1042                  fZerv,
1043                  StandardCorOrCov,
1044                  StandardBetweenWhat,
1045                  StandardPlotOption);
1046     }
1047 
1048     if (StandardBetweenWhat == "Mss") {
1049       Int_t n1StexStin = arg_n1;
1050       Int_t i0StinEcha = arg_n2;
1051       if (fFlagSubDet == "EE") {
1052         n1StexStin = fEcalNumbering->Get1DeeSCEcnaFromDeeSCCons(fFapStexNumber, arg_n1);
1053       }
1054 
1055       ViewMatrix(fReadMatrixDummy,
1056                  fTobeRead,
1057                  n1StexStin,
1058                  fZerv,
1059                  i0StinEcha,
1060                  StandardCorOrCov,
1061                  StandardBetweenWhat,
1062                  StandardPlotOption);
1063     }
1064   } else {
1065     fFlagUserHistoMin = "OFF";
1066     fFlagUserHistoMax = "OFF";
1067     std::cout << "!TEcnaHistos::PlotMatrix(...)> Histo cannot be reached." << fTTBELL << std::endl;
1068   }
1069 }
1070 
1071 //---------------------------------------------------------------------------------------
1072 //
1073 //                              (ReadAnd)PlotDetector
1074 //
1075 //---------------------------------------------------------------------------------------
1076 //.................................... 2D plots for Stex OR Stas
1077 void TEcnaHistos::PlotDetector(const TString& UserHistoCode, const TString& UserDetector) {
1078   TString CallingMethod = "2DS";
1079 
1080   TString StandardHistoCode = fCnaParHistos->BuildStandard1DHistoCodeY(CallingMethod, UserHistoCode);
1081   if (StandardHistoCode != "?") {
1082     TString TechHistoCode = fCnaParHistos->GetTechHistoCode(StandardHistoCode);
1083     TString StandardDetectorCode = fCnaParHistos->BuildStandardDetectorCode(UserDetector);
1084     if (StandardDetectorCode != "?") {
1085       //if( StandardDetectorCode == "SM" || StandardDetectorCode == "EB" )
1086       //  {fEcal->SetEcalSubDetector("EB");}
1087       //if( StandardDetectorCode == "Dee" || StandardDetectorCode == "EE" )
1088       //  {fEcal->SetEcalSubDetector("EE");}
1089 
1090       if (StandardDetectorCode == "SM" || StandardDetectorCode == "Dee") {
1091         ViewStex(fReadHistoDummy, fTobeRead, TechHistoCode);
1092       }
1093       if (StandardDetectorCode == "EB" || StandardDetectorCode == "EE") {
1094         ViewStas(fReadHistoDummy, fTobeRead, TechHistoCode);
1095       }
1096     } else {
1097       fFlagUserHistoMin = "OFF";
1098       fFlagUserHistoMax = "OFF";
1099       std::cout << "!TEcnaHistos::PlotDetector(...)> Histo cannot be reached." << fTTBELL << std::endl;
1100     }
1101   } else {
1102     fFlagUserHistoMin = "OFF";
1103     fFlagUserHistoMax = "OFF";
1104     std::cout << "!TEcnaHistos::PlotDetector(...)> Histo cannot be reached." << fTTBELL << std::endl;
1105   }
1106 }
1107 
1108 void TEcnaHistos::PlotDetector(const TVectorD& read_histo, const TString& UserHistoCode, const TString& UserDetector) {
1109   TString CallingMethod = "2DS";
1110 
1111   TString StandardHistoCode = fCnaParHistos->BuildStandard1DHistoCodeY(CallingMethod, UserHistoCode);
1112   if (StandardHistoCode != "?") {
1113     TString TechHistoCode = fCnaParHistos->GetTechHistoCode(StandardHistoCode);
1114     TString StandardDetectorCode = fCnaParHistos->BuildStandardDetectorCode(UserDetector);
1115     if (StandardDetectorCode != "?") {
1116       fAlreadyRead = 1;
1117 
1118       //if( StandardDetectorCode == "SM" || StandardDetectorCode == "EB" )
1119       //  {fEcal->SetEcalSubDetector("EB");}
1120       //if( StandardDetectorCode == "Dee" || StandardDetectorCode == "EE" )
1121       //  {fEcal->SetEcalSubDetector("EE");}
1122 
1123       if (StandardDetectorCode == "SM" || StandardDetectorCode == "Dee") {
1124         ViewStex(read_histo, fAlreadyRead, TechHistoCode);
1125       }
1126       if (StandardDetectorCode == "EB" || StandardDetectorCode == "EE") {
1127         ViewStas(read_histo, fAlreadyRead, TechHistoCode);
1128       }
1129     } else {
1130       fFlagUserHistoMin = "OFF";
1131       fFlagUserHistoMax = "OFF";
1132       std::cout << "!TEcnaHistos::PlotDetector(...)> Histo cannot be reached." << fTTBELL << std::endl;
1133     }
1134   } else {
1135     fFlagUserHistoMin = "OFF";
1136     fFlagUserHistoMax = "OFF";
1137     std::cout << "!TEcnaHistos::PlotDetector(...)> Histo cannot be reached." << fTTBELL << std::endl;
1138   }
1139 }
1140 
1141 //---------------------------------------------------------------------------------------
1142 //
1143 //                              (ReadAnd)Plot1DHisto
1144 //
1145 //---------------------------------------------------------------------------------------
1146 void TEcnaHistos::Plot1DHisto(const TVectorD& InputHisto,
1147                               const TString& User_X_Quantity,
1148                               const TString& User_Y_Quantity,
1149                               const TString& UserDetector) {
1150   Plot1DHisto(InputHisto, User_X_Quantity, User_Y_Quantity, UserDetector, "");
1151 }
1152 
1153 void TEcnaHistos::Plot1DHisto(const TVectorD& InputHisto,
1154                               const TString& User_X_Quantity,
1155                               const TString& User_Y_Quantity,
1156                               const TString& UserDetector,
1157                               const TString& UserPlotOption) {
1158   TString CallingMethod = "1D";
1159 
1160   TString StandardPlotOption = fCnaParHistos->BuildStandardPlotOption(CallingMethod, UserPlotOption);
1161 
1162   TString Standard_X_Quantity = fCnaParHistos->BuildStandard1DHistoCodeX(CallingMethod, User_X_Quantity);
1163   TString Standard_Y_Quantity = fCnaParHistos->BuildStandard1DHistoCodeY(CallingMethod, User_Y_Quantity);
1164 
1165   if (Standard_X_Quantity != "?" && Standard_Y_Quantity != "?") {
1166     TString TechHistoCode = fCnaParHistos->GetTechHistoCode(Standard_X_Quantity, Standard_Y_Quantity);
1167     if (fAlreadyRead > 1) {
1168       fAlreadyRead = 1;
1169     }
1170     TString StandardDetectorCode = fCnaParHistos->BuildStandardDetectorCode(UserDetector);
1171     if (StandardDetectorCode != "?") {
1172       if (StandardDetectorCode == "EB" || StandardDetectorCode == "EE") {
1173         fFapStexNumber = 0;
1174       }
1175       ViewHisto(InputHisto, fAlreadyRead, fZerv, fZerv, fZerv, TechHistoCode, StandardPlotOption);
1176     } else {
1177       fFlagUserHistoMin = "OFF";
1178       fFlagUserHistoMax = "OFF";
1179       std::cout << "!TEcnaHistos::Plot1DHisto(...)> Histo cannot be reached." << fTTBELL << std::endl;
1180     }
1181   } else {
1182     fFlagUserHistoMin = "OFF";
1183     fFlagUserHistoMax = "OFF";
1184     std::cout << "!TEcnaHistos::Plot1DHisto(...)> Histo cannot be reached." << fTTBELL << std::endl;
1185   }
1186 }
1187 
1188 void TEcnaHistos::Plot1DHisto(const TString& User_X_Quantity,
1189                               const TString& User_Y_Quantity,
1190                               const TString& UserDetector) {
1191   Plot1DHisto(User_X_Quantity, User_Y_Quantity, UserDetector, "");
1192 }
1193 
1194 void TEcnaHistos::Plot1DHisto(const TString& User_X_Quantity,
1195                               const TString& User_Y_Quantity,
1196                               const TString& UserDetector,
1197                               const TString& UserPlotOption) {
1198   TString CallingMethod = "1D";
1199 
1200   TString StandardPlotOption = fCnaParHistos->BuildStandardPlotOption(CallingMethod, UserPlotOption);
1201 
1202   TString Standard_X_Quantity = fCnaParHistos->BuildStandard1DHistoCodeX(CallingMethod, User_X_Quantity);
1203   TString Standard_Y_Quantity = fCnaParHistos->BuildStandard1DHistoCodeY(CallingMethod, User_Y_Quantity);
1204 
1205   if (Standard_X_Quantity != "?" && Standard_Y_Quantity != "?") {
1206     TString TechHistoCode = fCnaParHistos->GetTechHistoCode(Standard_X_Quantity, Standard_Y_Quantity);
1207     TString StandardDetectorCode = fCnaParHistos->BuildStandardDetectorCode(UserDetector);
1208     if (StandardDetectorCode != "?") {
1209       if (StandardDetectorCode == "EB" || StandardDetectorCode == "EE") {
1210         fFapStexNumber = 0;
1211       }
1212       ViewHisto(fReadHistoDummy, fTobeRead, fZerv, fZerv, fZerv, TechHistoCode, StandardPlotOption);
1213     } else {
1214       fFlagUserHistoMin = "OFF";
1215       fFlagUserHistoMax = "OFF";
1216       std::cout << "!TEcnaHistos::Plot1DHisto(...)> Histo cannot be reached." << fTTBELL << std::endl;
1217     }
1218   } else {
1219     fFlagUserHistoMin = "OFF";
1220     fFlagUserHistoMax = "OFF";
1221     std::cout << "!TEcnaHistos::Plot1DHisto(...)> Histo cannot be reached." << fTTBELL << std::endl;
1222   }
1223 }
1224 
1225 //=> BUG SCRAM? Si on enleve la methode ci-dessous, ca passe a la compilation de test/EcnaHistosExample2.cc
1226 //   (qui appelle cette methode) et ca se plante a l'execution (voir test/TEcnaHistosExample2.cc).
1227 #define PLUD
1228 #ifdef PLUD
1229 void TEcnaHistos::Plot1DHisto(const TVectorD& InputHisto,
1230                               const TString& User_X_Quantity,
1231                               const TString& User_Y_Quantity,
1232                               const Int_t& n1StexStin) {
1233   Plot1DHisto(InputHisto, User_X_Quantity, User_Y_Quantity, n1StexStin, "");
1234 }
1235 
1236 void TEcnaHistos::Plot1DHisto(const TVectorD& InputHisto,
1237                               const TString& User_X_Quantity,
1238                               const TString& User_Y_Quantity,
1239                               const Int_t& n1StexStin,
1240                               const TString& UserPlotOption) {
1241   TString CallingMethod = "1DX";
1242   TString StandardPlotOption = fCnaParHistos->BuildStandardPlotOption(CallingMethod, UserPlotOption);
1243   Int_t i0StinEcha = 0;
1244   Plot1DHisto(InputHisto, User_X_Quantity, User_Y_Quantity, n1StexStin, i0StinEcha, StandardPlotOption);
1245 }
1246 #endif  // PLUD
1247 
1248 void TEcnaHistos::Plot1DHisto(const TVectorD& InputHisto,
1249                               const TString& User_X_Quantity,
1250                               const TString& User_Y_Quantity,
1251                               const Int_t& n1StexStin,
1252                               const Int_t& i0StinEcha) {
1253   Plot1DHisto(InputHisto, User_X_Quantity, User_Y_Quantity, n1StexStin, i0StinEcha, "");
1254 }
1255 
1256 void TEcnaHistos::Plot1DHisto(const TVectorD& InputHisto,
1257                               const TString& User_X_Quantity,
1258                               const TString& User_Y_Quantity,
1259                               const Int_t& n1StexStin,
1260                               const Int_t& i0StinEcha,
1261                               const TString& UserPlotOption) {
1262   TString CallingMethod = "1D";
1263   TString StandardPlotOption = fCnaParHistos->BuildStandardPlotOption(CallingMethod, UserPlotOption);
1264   TString Standard_X_Quantity = fCnaParHistos->BuildStandard1DHistoCodeX(CallingMethod, User_X_Quantity);
1265   TString Standard_Y_Quantity = fCnaParHistos->BuildStandard1DHistoCodeY(CallingMethod, User_Y_Quantity);
1266 
1267   TString TechHistoCode = fCnaParHistos->GetTechHistoCode(Standard_X_Quantity, Standard_Y_Quantity);
1268 
1269   if (Standard_X_Quantity != "?" && Standard_Y_Quantity != "?") {
1270     fAlreadyRead = 1;
1271     if (StandardPlotOption != fAllXtalsInStinPlot) {
1272       ViewHisto(InputHisto, fAlreadyRead, n1StexStin, i0StinEcha, fZerv, TechHistoCode, StandardPlotOption);
1273     }
1274 
1275     if (StandardPlotOption == fAllXtalsInStinPlot && fAlreadyRead >= 1 && fAlreadyRead <= fEcal->MaxCrysInStin()) {
1276       if (Standard_X_Quantity == "Smp" && Standard_Y_Quantity == "MSp") {
1277         XtalSamplesEv(InputHisto, fAlreadyRead, n1StexStin, i0StinEcha, StandardPlotOption);
1278       }
1279       if (Standard_X_Quantity == "MSp" && Standard_Y_Quantity == "NOS") {
1280         EvSamplesXtals(InputHisto, fAlreadyRead, n1StexStin, i0StinEcha, StandardPlotOption);
1281       }
1282       if (Standard_X_Quantity == "Smp" && Standard_Y_Quantity == "SSp") {
1283         XtalSamplesSigma(InputHisto, fAlreadyRead, n1StexStin, i0StinEcha, StandardPlotOption);
1284       }
1285       if (Standard_X_Quantity == "SSp" && Standard_Y_Quantity == "NOS") {
1286         SigmaSamplesXtals(InputHisto, fAlreadyRead, n1StexStin, i0StinEcha, StandardPlotOption);
1287       }
1288     }
1289   } else {
1290     fFlagUserHistoMin = "OFF";
1291     fFlagUserHistoMax = "OFF";
1292     std::cout << "!TEcnaHistos::Plot1DHisto(...)> Histo cannot be reached." << fTTBELL << std::endl;
1293   }
1294 }
1295 
1296 void TEcnaHistos::Plot1DHisto(const TString& User_X_Quantity,
1297                               const TString& User_Y_Quantity,
1298                               const Int_t& n1StexStin,
1299                               const Int_t& i0StinEcha) {
1300   Plot1DHisto(User_X_Quantity, User_Y_Quantity, n1StexStin, i0StinEcha, "");
1301 }
1302 
1303 void TEcnaHistos::Plot1DHisto(const TString& User_X_Quantity,
1304                               const TString& User_Y_Quantity,
1305                               const Int_t& n1StexStin,
1306                               const Int_t& i0StinEcha,
1307                               const TString& UserPlotOption) {
1308   TString CallingMethod = "1D";
1309 
1310   TString StandardPlotOption = fCnaParHistos->BuildStandardPlotOption(CallingMethod, UserPlotOption);
1311 
1312   TString Standard_X_Quantity = fCnaParHistos->BuildStandard1DHistoCodeX(CallingMethod, User_X_Quantity);
1313   TString Standard_Y_Quantity = fCnaParHistos->BuildStandard1DHistoCodeY(CallingMethod, User_Y_Quantity);
1314 
1315   if (Standard_X_Quantity != "?" && Standard_Y_Quantity != "?") {
1316     if (StandardPlotOption != fAllXtalsInStinPlot) {
1317       TString TechHistoCode = fCnaParHistos->GetTechHistoCode(Standard_X_Quantity, Standard_Y_Quantity);
1318       ViewHisto(fReadHistoDummy, fTobeRead, n1StexStin, i0StinEcha, fZerv, TechHistoCode, StandardPlotOption);
1319     }
1320     if (StandardPlotOption == fAllXtalsInStinPlot && fAlreadyRead >= 1 && fAlreadyRead <= fEcal->MaxCrysInStin()) {
1321       if (Standard_X_Quantity == "Smp" && Standard_Y_Quantity == "MSp") {
1322         XtalSamplesEv(fReadHistoDummy, fTobeRead, n1StexStin, i0StinEcha, StandardPlotOption);
1323       }
1324       if (Standard_X_Quantity == "MSp" && Standard_Y_Quantity == "NOS") {
1325         EvSamplesXtals(fReadHistoDummy, fTobeRead, n1StexStin, i0StinEcha, StandardPlotOption);
1326       }
1327       if (Standard_X_Quantity == "Smp" && Standard_Y_Quantity == "SSp") {
1328         XtalSamplesSigma(fReadHistoDummy, fTobeRead, n1StexStin, i0StinEcha, StandardPlotOption);
1329       }
1330       if (Standard_X_Quantity == "SSp" && Standard_Y_Quantity == "NOS") {
1331         SigmaSamplesXtals(fReadHistoDummy, fTobeRead, n1StexStin, i0StinEcha, StandardPlotOption);
1332       }
1333     }
1334   } else {
1335     fFlagUserHistoMin = "OFF";
1336     fFlagUserHistoMax = "OFF";
1337     std::cout << "!TEcnaHistos::Plot1DHisto(...)> Histo cannot be reached." << fTTBELL << std::endl;
1338   }
1339 }
1340 
1341 void TEcnaHistos::Plot1DHisto(const TVectorD& InputHisto,
1342                               const TString& User_X_Quantity,
1343                               const TString& User_Y_Quantity,
1344                               const Int_t& n1StexStin,
1345                               const Int_t& i0StinEcha,
1346                               const Int_t& n1Sample) {
1347   Plot1DHisto(InputHisto, User_X_Quantity, User_Y_Quantity, n1StexStin, i0StinEcha, n1Sample, "");
1348 }
1349 
1350 void TEcnaHistos::Plot1DHisto(const TVectorD& InputHisto,
1351                               const TString& User_X_Quantity,
1352                               const TString& User_Y_Quantity,
1353                               const Int_t& n1StexStin,
1354                               const Int_t& i0StinEcha,
1355                               const Int_t& n1Sample,
1356                               const TString& UserPlotOption) {
1357   TString CallingMethod = "1D";
1358 
1359   TString StandardPlotOption = fCnaParHistos->BuildStandardPlotOption(CallingMethod, UserPlotOption);
1360 
1361   TString Standard_X_Quantity = fCnaParHistos->BuildStandard1DHistoCodeX(CallingMethod, User_X_Quantity);
1362   TString Standard_Y_Quantity = fCnaParHistos->BuildStandard1DHistoCodeY(CallingMethod, User_Y_Quantity);
1363 
1364   TString TechHistoCode = fCnaParHistos->GetTechHistoCode(Standard_X_Quantity, Standard_Y_Quantity);
1365 
1366   if (Standard_X_Quantity != "?" && Standard_Y_Quantity != "?") {
1367     Int_t i0Sample = n1Sample - 1;
1368     fAlreadyRead = 1;
1369     ViewHisto(InputHisto, fAlreadyRead, n1StexStin, i0StinEcha, i0Sample, TechHistoCode, StandardPlotOption);
1370   } else {
1371     fFlagUserHistoMin = "OFF";
1372     fFlagUserHistoMax = "OFF";
1373     std::cout << "!TEcnaHistos::Plot1DHisto(...)> Histo cannot be reached." << fTTBELL << std::endl;
1374   }
1375 }
1376 
1377 void TEcnaHistos::Plot1DHisto(const TString& User_X_Quantity,
1378                               const TString& User_Y_Quantity,
1379                               const Int_t& n1StexStin,
1380                               const Int_t& i0StinEcha,
1381                               const Int_t& n1Sample) {
1382   Plot1DHisto(User_X_Quantity, User_Y_Quantity, n1StexStin, i0StinEcha, n1Sample, "");
1383 }
1384 
1385 void TEcnaHistos::Plot1DHisto(const TString& User_X_Quantity,
1386                               const TString& User_Y_Quantity,
1387                               const Int_t& n1StexStin,
1388                               const Int_t& i0StinEcha,
1389                               const Int_t& n1Sample,
1390                               const TString& UserPlotOption) {
1391   TString CallingMethod = "1D";
1392 
1393   TString StandardPlotOption = fCnaParHistos->BuildStandardPlotOption(CallingMethod, UserPlotOption);
1394 
1395   TString Standard_X_Quantity = fCnaParHistos->BuildStandard1DHistoCodeX(CallingMethod, User_X_Quantity);
1396   TString Standard_Y_Quantity = fCnaParHistos->BuildStandard1DHistoCodeY(CallingMethod, User_Y_Quantity);
1397 
1398   Int_t i0Sample = n1Sample - 1;
1399 
1400   if (Standard_X_Quantity != "?" && Standard_Y_Quantity != "?") {
1401     TString TechHistoCode = fCnaParHistos->GetTechHistoCode(Standard_X_Quantity, Standard_Y_Quantity);
1402     ViewHisto(fReadHistoDummy, fTobeRead, n1StexStin, i0StinEcha, i0Sample, TechHistoCode, StandardPlotOption);
1403   } else {
1404     fFlagUserHistoMin = "OFF";
1405     fFlagUserHistoMax = "OFF";
1406     std::cout << "!TEcnaHistos::Plot1DHisto(...)> Histo cannot be reached." << fTTBELL << std::endl;
1407   }
1408 }
1409 
1410 //---------------------------------------------------------------------------------------
1411 //
1412 //                              (ReadAnd)PlotHistory
1413 //
1414 //---------------------------------------------------------------------------------------
1415 void TEcnaHistos::PlotHistory(const TString& User_X_Quantity,
1416                               const TString& User_Y_Quantity,
1417                               const TString& list_of_run_file_name,
1418                               const Int_t& StexStin_A,
1419                               const Int_t& i0StinEcha) {
1420   PlotHistory(User_X_Quantity, User_Y_Quantity, list_of_run_file_name, StexStin_A, i0StinEcha, "");
1421 }
1422 
1423 void TEcnaHistos::PlotHistory(const TString& User_X_Quantity,
1424                               const TString& User_Y_Quantity,
1425                               const TString& list_of_run_file_name,
1426                               const Int_t& StexStin_A,
1427                               const Int_t& i0StinEcha,
1428                               const TString& UserPlotOption) {
1429   TString CallingMethod = "Time";
1430 
1431   TString StandardPlotOption = fCnaParHistos->BuildStandardPlotOption(CallingMethod, UserPlotOption);
1432 
1433   TString Standard_X_Quantity = fCnaParHistos->BuildStandard1DHistoCodeX(CallingMethod, User_X_Quantity);
1434   TString Standard_Y_Quantity = fCnaParHistos->BuildStandard1DHistoCodeY(CallingMethod, User_Y_Quantity);
1435 
1436   if (Standard_X_Quantity != "?" && Standard_Y_Quantity != "?") {
1437     TString TechHistoCode = fCnaParHistos->GetTechHistoCode(Standard_X_Quantity, Standard_Y_Quantity);
1438     ViewHistime(list_of_run_file_name, StexStin_A, i0StinEcha, TechHistoCode, StandardPlotOption);
1439   } else {
1440     fFlagUserHistoMin = "OFF";
1441     fFlagUserHistoMax = "OFF";
1442     std::cout << "!TEcnaHistos::PlotHistory(...)> Histo cannot be reached." << fTTBELL << std::endl;
1443   }
1444 }
1445 
1446 //=============================================================================================
1447 //
1448 //                            " V I E W "    M E T H O D S
1449 //
1450 //=============================================================================================
1451 
1452 //=============================================================================================================
1453 //
1454 //                                       ViewMatrix(***)
1455 //
1456 //     arg_read_matrix:   2D array
1457 //     arg_AlreadyRead:   =1 <=> use arg_read_matrix
1458 //                        =0 <=> read the 2D array in this method with TEcnaRead
1459 //     StexStin_A:        tower  number in SM (if EB) OR SC  "ECNA" number in Dee (if EE)
1460 //     StexStin_B:        tower' number in SM (if EB) OR SC' "ECNA" number in Dee (if EE)
1461 //     MatrixBinIndex:    channel number in tower (if EB) OR in SC (if EE)
1462 //     CorOrCov:          flag CORRELATION/COVARIANCE
1463 //     BetweenWhat:       flag BETWEEN SAMPLES / BETWEEN CHANNELS / BETWEEN TOWERS / BETWEEN SCs / LF, HF, ...
1464 //     PlotOption:        ROOT 2D histos draw options (COLZ, LEGO, ...) + additional (ASCII)
1465 //
1466 //     MatrixBinIndex:  = i0StinEcha if cov(s,s'), cor(s,s')
1467 //                      = 0          if cov(c,c'), cor(c,c'), cov(Stin,Stin'), cor(Stin,Stin')
1468 //
1469 //     ViewMatrix(StexStin_A, StexStin_B, MatrixBinIndex, CorOrCov, BetweenWhat, PlotOption)
1470 //     ViewMatrix(StexStin_A,          0,     i0StinEcha, CorOrCov,       "Mss", PlotOption)
1471 //     Output:
1472 //     Plot of cov(s,s') or cor(s,s') matrix for i0StinEcha of StexStin_A
1473 //
1474 //     ViewMatrix(StexStin_A, StexStin_B, MatrixBinIndex, CorOrCov, BetweenWhat, PlotOption)
1475 //     ViewMatrix(StexStin_A, StexStin_B,              0, CorOrCov,       "Mcc", PlotOption)
1476 //     Output:
1477 //     Plot LF-HF Corcc matrix for Stins: (StexStin_A, StexStin_B)
1478 //
1479 //     ViewMatrix(StexStin_A, StexStin_B, MatrixBinIndex, CorOrCov, BetweenWhat, PlotOption)
1480 //     ViewMatrix(         0,          0,              0, CorOrCov,       "Mcc", PlotOption)
1481 //     Output:
1482 //     Plot of LF-HF Corcc matrix for Stex (big matrix)
1483 //
1484 //     ViewMatrix(StexStin_A, StexStin_B, MatrixBinIndex, CorOrCov, BetweenWhat, PlotOption)
1485 //     ViewMatrix(         0,          0,              0, CorOrCov,       "Mtt", PlotOption)
1486 //     Output:
1487 //     Plot of LF-HF Cortt matrix
1488 //
1489 //=============================================================================================================
1490 void TEcnaHistos::ViewMatrix(const TMatrixD& arg_read_matrix,
1491                              const Int_t& arg_AlreadyRead,
1492                              const Int_t& StexStin_A,
1493                              const Int_t& StexStin_B,
1494                              const Int_t& MatrixBinIndex,
1495                              const TString& CorOrCov,
1496                              const TString& BetweenWhat,
1497                              const TString& PlotOption) {
1498   //Plot correlation or covariance matrix between samples or channels or Stins
1499 
1500   if ((fFapStexNumber > 0) && (fFapStexNumber <= fEcal->MaxStexInStas())) {
1501     Bool_t OKArray = kFALSE;
1502     Bool_t OKData = kFALSE;
1503     TVectorD vStin(fEcal->MaxStinEcnaInStex());
1504 
1505     if (arg_AlreadyRead == fTobeRead) {
1506       fMyRootFile->PrintNoComment();
1507       fMyRootFile->FileParameters(fFapAnaType,
1508                                   fFapNbOfSamples,
1509                                   fFapRunNumber,
1510                                   fFapFirstReqEvtNumber,
1511                                   fFapLastReqEvtNumber,
1512                                   fFapReqNbOfEvts,
1513                                   fFapStexNumber,
1514                                   fCfgResultsRootFilePath.Data());
1515       OKArray = fMyRootFile->LookAtRootFile();
1516       if (OKArray == kTRUE) {
1517         fFapNbOfEvts = fMyRootFile->GetNumberOfEvents(fFapReqNbOfEvts, fFapStexNumber);
1518         TString fp_name_short = fMyRootFile->GetRootFileNameShort();
1519         // std::cout << "*TEcnaHistos::ViewMatrix(...)> Data are analyzed from file ----> "
1520         //      << fp_name_short << std::endl;
1521         //...................................................................... (ViewMatrix)
1522         for (Int_t i = 0; i < fEcal->MaxStinEcnaInStex(); i++) {
1523           vStin(i) = (Double_t)0.;
1524         }
1525         vStin = fMyRootFile->ReadStinNumbers(fEcal->MaxStinEcnaInStex());
1526 
1527         fStartDate = fMyRootFile->GetStartDate();
1528         fStopDate = fMyRootFile->GetStopDate();
1529         fRunType = fMyRootFile->GetRunType();
1530 
1531         if (fMyRootFile->DataExist() == kTRUE) {
1532           OKData = kTRUE;
1533         }
1534       }
1535     }
1536     if (arg_AlreadyRead >= 1) {
1537       OKArray = kTRUE;
1538       OKData = kTRUE;
1539       if (fFlagSubDet == "EB") {
1540         for (Int_t i = 0; i < fEcal->MaxStinEcnaInStex(); i++) {
1541           vStin(i) = i;
1542         }
1543       }
1544       if (fFlagSubDet == "EE") {
1545         for (Int_t i = 0; i < fEcal->MaxStinEcnaInStex(); i++) {
1546           vStin(i) = fEcalNumbering->GetDeeSCConsFrom1DeeSCEcna(fFapStexNumber, (Int_t)vStin(i));
1547         }
1548       }
1549     }
1550 
1551     if (OKArray == kTRUE)  //  (ViewMatrix)
1552     {
1553       fStatusFileFound = kTRUE;
1554 
1555       if (OKData == kTRUE) {
1556         fStatusDataExist = kTRUE;
1557 
1558         Int_t Stin_X_ok = 0;
1559         Int_t Stin_Y_ok = 0;
1560 
1561         if ((BetweenWhat == fLFBetweenStins) || (BetweenWhat == fHFBetweenStins)) {
1562           Stin_X_ok = 1;
1563           Stin_Y_ok = 1;
1564         }
1565         if (BetweenWhat == fBetweenSamples) {
1566           Stin_Y_ok = 1;
1567         }
1568 
1569         for (Int_t index_Stin = 0; index_Stin < fEcal->MaxStinEcnaInStex(); index_Stin++) {
1570           if (vStin(index_Stin) == StexStin_A) {
1571             Stin_X_ok = 1;
1572           }
1573           if (vStin(index_Stin) == StexStin_B) {
1574             Stin_Y_ok = 1;
1575           }
1576         }
1577         //................................................................. (ViewMatrix)
1578         if (Stin_X_ok == 1 && Stin_Y_ok == 1) {
1579           Int_t MatSize = -1;
1580           Int_t ReadMatSize = -1;
1581           Int_t i0StinEcha = -1;
1582 
1583           //-------------------------- Set values of ReadMatSize, MatSize, i0StinEcha
1584           if (BetweenWhat == fBetweenSamples) {
1585             ReadMatSize = fFapNbOfSamples;
1586             MatSize = fEcal->MaxSampADC();
1587             i0StinEcha = (Int_t)MatrixBinIndex;
1588           }
1589 
1590           if (BetweenWhat == fLFBetweenChannels || BetweenWhat == fHFBetweenChannels) {
1591             ReadMatSize = fEcal->MaxCrysInStin();
1592             MatSize = fEcal->MaxCrysInStin(); /*i0Sample=MatrixBinIndex;*/
1593           }
1594 
1595           if ((BetweenWhat == fLFBetweenStins) || (BetweenWhat == fHFBetweenStins)) {
1596             ReadMatSize = fEcal->MaxStinEcnaInStex();
1597             MatSize = fEcal->MaxStinInStex();
1598           }
1599 
1600           //------------------------------------------------------------------------------------- (ViewMatrix)
1601           if ((BetweenWhat == fLFBetweenStins || BetweenWhat == fHFBetweenStins) ||
1602               (BetweenWhat == fLFBetweenChannels || BetweenWhat == fHFBetweenChannels
1603                /* && (i0Sample  >= 0) && (i0Sample  < fFapNbOfSamples ) */) ||
1604               ((BetweenWhat == fBetweenSamples) && (i0StinEcha >= 0) && (i0StinEcha < fEcal->MaxCrysInStin()))) {
1605             TMatrixD read_matrix(ReadMatSize, ReadMatSize);
1606             for (Int_t i = 0; i - ReadMatSize < 0; i++) {
1607               for (Int_t j = 0; j - ReadMatSize < 0; j++) {
1608                 read_matrix(i, j) = (Double_t)0.;
1609               }
1610             }
1611 
1612             Bool_t OKData = kFALSE;
1613             if (arg_AlreadyRead == fTobeRead) {
1614               if (BetweenWhat == fBetweenSamples && CorOrCov == fCovarianceMatrix) {
1615                 read_matrix = fMyRootFile->ReadCovariancesBetweenSamples(StexStin_A, i0StinEcha, ReadMatSize);
1616               }
1617 
1618               if (BetweenWhat == fBetweenSamples && CorOrCov == fCorrelationMatrix) {
1619                 read_matrix = fMyRootFile->ReadCorrelationsBetweenSamples(StexStin_A, i0StinEcha, ReadMatSize);
1620               }
1621 
1622               if (BetweenWhat == fLFBetweenChannels && CorOrCov == fCovarianceMatrix) {
1623                 read_matrix =
1624                     fMyRootFile->ReadLowFrequencyCovariancesBetweenChannels(StexStin_A, StexStin_B, ReadMatSize);
1625               }
1626 
1627               if (BetweenWhat == fLFBetweenChannels && CorOrCov == fCorrelationMatrix) {
1628                 read_matrix =
1629                     fMyRootFile->ReadLowFrequencyCorrelationsBetweenChannels(StexStin_A, StexStin_B, ReadMatSize);
1630               }
1631 
1632               if (BetweenWhat == fHFBetweenChannels && CorOrCov == fCovarianceMatrix) {
1633                 read_matrix =
1634                     fMyRootFile->ReadHighFrequencyCovariancesBetweenChannels(StexStin_A, StexStin_B, ReadMatSize);
1635               }
1636 
1637               if (BetweenWhat == fHFBetweenChannels && CorOrCov == fCorrelationMatrix) {
1638                 read_matrix =
1639                     fMyRootFile->ReadHighFrequencyCorrelationsBetweenChannels(StexStin_A, StexStin_B, ReadMatSize);
1640               }
1641 
1642               if (BetweenWhat == fLFBetweenStins && CorOrCov == fCorrelationMatrix) {
1643                 read_matrix = fMyRootFile->ReadLowFrequencyMeanCorrelationsBetweenStins(ReadMatSize);
1644               }
1645 
1646               if (BetweenWhat == fHFBetweenStins && CorOrCov == fCorrelationMatrix) {
1647                 read_matrix = fMyRootFile->ReadHighFrequencyMeanCorrelationsBetweenStins(ReadMatSize);
1648               }
1649 
1650               OKData = fMyRootFile->DataExist();
1651             } else {
1652               read_matrix = arg_read_matrix;
1653               OKData = kTRUE;
1654             }
1655             //.......................................................... (ViewMatrix)
1656             if (OKData == kTRUE) {
1657               fStatusDataExist = kTRUE;
1658 
1659               if (PlotOption == "ASCII") {
1660                 WriteMatrixAscii(BetweenWhat, CorOrCov, StexStin_A, MatrixBinIndex, ReadMatSize, read_matrix);
1661               } else {
1662                 //......................... matrix title  (ViewMatrix)
1663                 char f_in_mat_tit[charArrLen];
1664 
1665                 if (BetweenWhat == fBetweenSamples && CorOrCov == fCovarianceMatrix) {
1666                   sprintf(f_in_mat_tit, "Covariance(Sample, Sample')");
1667                 }
1668                 if (BetweenWhat == fBetweenSamples && CorOrCov == fCorrelationMatrix) {
1669                   sprintf(f_in_mat_tit, "Correlation(Sample, Sample')");
1670                 }
1671 
1672                 if (fFlagSubDet == "EB") {
1673                   if (BetweenWhat == fLFBetweenStins && CorOrCov == fCorrelationMatrix) {
1674                     sprintf(f_in_mat_tit, "Mean LF |Cor(Xtal,Xtal')| for each (Tower,Tower')");
1675                   }
1676                   if (BetweenWhat == fHFBetweenStins && CorOrCov == fCorrelationMatrix) {
1677                     sprintf(f_in_mat_tit, "Mean HF |Cor(Xtal,Xtal')| for each (Tower,Tower')");
1678                   }
1679                 }
1680                 if (fFlagSubDet == "EE") {
1681                   if (BetweenWhat == fLFBetweenStins && CorOrCov == fCorrelationMatrix) {
1682                     sprintf(f_in_mat_tit, "Mean LF |Cor(Xtal,Xtal')| for each (SC,SC')");
1683                   }
1684                   if (BetweenWhat == fHFBetweenStins && CorOrCov == fCorrelationMatrix) {
1685                     sprintf(f_in_mat_tit, "Mean HF |Cor(Xtal,Xtal')| for each (SC,SC')");
1686                   }
1687                 }
1688 
1689                 if (BetweenWhat == fLFBetweenChannels && CorOrCov == fCorrelationMatrix) {
1690                   if (fFlagSubDet == "EB") {
1691                     sprintf(f_in_mat_tit, "LF Cor(Xtal,Xtal') matrix elts for (Tow,Tow')");
1692                   }
1693                   if (fFlagSubDet == "EE") {
1694                     sprintf(f_in_mat_tit, "LF Cor(Xtal,Xtal') matrix elts for (SC,SC')");
1695                   }
1696                 }
1697                 if (BetweenWhat == fHFBetweenChannels && CorOrCov == fCorrelationMatrix) {
1698                   if (fFlagSubDet == "EB") {
1699                     sprintf(f_in_mat_tit, "HF Cor(Xtal,Xtal') matrix elts for (Tow,Tow')");
1700                   }
1701                   if (fFlagSubDet == "EE") {
1702                     sprintf(f_in_mat_tit, "LF Cor(Xtal,Xtal') matrix elts for (SC,SC')");
1703                   }
1704                 }
1705 
1706                 //................................. Axis parameters (ViewMatrix)
1707                 TString axis_x_var_name;
1708                 TString axis_y_var_name;
1709 
1710                 char f_in_axis_x[charArrLen];
1711                 char f_in_axis_y[charArrLen];
1712 
1713                 if (BetweenWhat == fLFBetweenStins || BetweenWhat == fHFBetweenStins) {
1714                   if (fFlagSubDet == "EB") {
1715                     sprintf(f_in_axis_x, " %s number  ", fFapStinName.Data());
1716                   }
1717                   if (fFlagSubDet == "EE") {
1718                     sprintf(f_in_axis_x, " %s number for construction ", fFapStinName.Data());
1719                   }
1720 
1721                   axis_x_var_name = f_in_axis_x;
1722                   axis_y_var_name = f_in_axis_x;
1723                 }
1724                 if (BetweenWhat == fBetweenSamples) {
1725                   axis_x_var_name = " Sample      ";
1726                   axis_y_var_name = "    Sample ";
1727                 }
1728                 if (BetweenWhat == fLFBetweenChannels || BetweenWhat == fHFBetweenChannels) {
1729                   sprintf(f_in_axis_x, " Crystal %s %d   ", fFapStinName.Data(), StexStin_A);
1730                   sprintf(f_in_axis_y, " Crystal %s %d   ", fFapStinName.Data(), StexStin_B);
1731                   axis_x_var_name = f_in_axis_x;
1732                   axis_y_var_name = f_in_axis_y;
1733                 }
1734 
1735                 Int_t nb_binx = MatSize;
1736                 Int_t nb_biny = MatSize;
1737                 Axis_t xinf_bid = (Axis_t)0.;
1738                 Axis_t xsup_bid = (Axis_t)MatSize;
1739                 Axis_t yinf_bid = (Axis_t)0.;
1740                 Axis_t ysup_bid = (Axis_t)MatSize;
1741 
1742                 if ((fFlagSubDet == "EE") && (BetweenWhat == fLFBetweenStins || BetweenWhat == fHFBetweenStins)) {
1743                   if (fFapStexNumber == 1 || fFapStexNumber == 3) {
1744                     xinf_bid += fEcal->MaxStinInStex();
1745                     xsup_bid += fEcal->MaxStinInStex();
1746                     yinf_bid += fEcal->MaxStinInStex();
1747                     ysup_bid += fEcal->MaxStinInStex();
1748                   }
1749                 }
1750                 //...................................................  histogram booking (ViewMatrix)
1751                 TH2D* h_fbid0 =
1752                     new TH2D("bidim", f_in_mat_tit, nb_binx, xinf_bid, xsup_bid, nb_biny, yinf_bid, ysup_bid);
1753                 fCnewRoot++;
1754                 h_fbid0->Reset();
1755 
1756                 h_fbid0->GetXaxis()->SetTitle(axis_x_var_name);
1757                 h_fbid0->GetYaxis()->SetTitle(axis_y_var_name);
1758 
1759                 //------------------------------------------------  F I L L    H I S T O  (ViewMatrix)
1760                 if ((fFlagSubDet == "EE") && (BetweenWhat == fLFBetweenStins || BetweenWhat == fHFBetweenStins)) {
1761                   for (Int_t i = 0; i < ReadMatSize; i++) {
1762                     for (Int_t j = 0; j < ReadMatSize; j++) {
1763                       Int_t ip = i + 1;
1764                       Double_t xi_bid = (Double_t)fEcalNumbering->GetDeeSCConsFrom1DeeSCEcna(fFapStexNumber, ip);
1765                       Int_t jp = j + 1;
1766                       Double_t xj_bid = (Double_t)fEcalNumbering->GetDeeSCConsFrom1DeeSCEcna(fFapStexNumber, jp);
1767                       if (xi_bid > 0 && xj_bid > 0) {
1768                         Int_t xi_bid_m = xi_bid - 1;
1769                         Int_t xj_bid_m = xj_bid - 1;
1770                         h_fbid0->Fill(xi_bid_m, xj_bid_m, read_matrix(i, j));
1771                       }
1772                     }
1773                   }
1774                 } else {
1775                   for (Int_t i = 0; i - ReadMatSize < 0; i++) {
1776                     Double_t xi = (Double_t)i;
1777                     for (Int_t j = 0; j < ReadMatSize; j++) {
1778                       Double_t xj = (Double_t)j;
1779                       Double_t mat_val = (Double_t)read_matrix(i, j);
1780                       h_fbid0->Fill(xi, xj, (Double_t)mat_val);
1781                     }
1782                   }
1783                 }
1784                 //--------------- H I S T O   M I N / M A X   M A N A G E M E N T   (ViewMatrix)
1785 
1786                 //................................ Put histo min max values
1787                 TString quantity_code = "D_MCs_ChNb";
1788                 if (CorOrCov == fCorrelationMatrix) {
1789                   if (BetweenWhat == fBetweenSamples) {
1790                     quantity_code = "D_MCs_ChNb";
1791                   }
1792 
1793                   if (BetweenWhat == fLFBetweenChannels) {
1794                     quantity_code = "H2LFccMosMatrix";
1795                   }
1796                   if (BetweenWhat == fHFBetweenChannels) {
1797                     quantity_code = "H2HFccMosMatrix";
1798                   }
1799 
1800                   if (BetweenWhat == fLFBetweenStins) {
1801                     quantity_code = "H2LFccMosMatrix";
1802                   }
1803                   if (BetweenWhat == fHFBetweenStins) {
1804                     quantity_code = "H2HFccMosMatrix";
1805                   }
1806                 }
1807                 if (CorOrCov == fCovarianceMatrix) {
1808                   quantity_code = "H2HFccMosMatrix";
1809                 }
1810                 //.......... default if flag not set to "ON"
1811                 SetYminMemoFromValue(quantity_code, fCnaParHistos->GetYminDefaultValue(quantity_code));
1812                 SetYmaxMemoFromValue(quantity_code, fCnaParHistos->GetYmaxDefaultValue(quantity_code));
1813 
1814                 if (fUserHistoMin == fUserHistoMax) {
1815                   fFlagUserHistoMin = "AUTO";
1816                   fFlagUserHistoMax = "AUTO";
1817                 }
1818                 //................................. User's min and/or max  (ViewMatrix)
1819                 if (fFlagUserHistoMin == "ON") {
1820                   SetYminMemoFromValue(quantity_code, fUserHistoMin);
1821                   fFlagUserHistoMin = "OFF";
1822                 }
1823                 if (fFlagUserHistoMax == "ON") {
1824                   SetYmaxMemoFromValue(quantity_code, fUserHistoMax);
1825                   fFlagUserHistoMax = "OFF";
1826                 }
1827                 //................................. automatic min and/or max
1828                 if (fFlagUserHistoMin == "AUTO") {
1829                   SetYminMemoFromValue(quantity_code, h_fbid0->GetMinimum());
1830                   fFlagUserHistoMin = "OFF";
1831                 }
1832                 if (fFlagUserHistoMax == "AUTO") {
1833                   SetYmaxMemoFromValue(quantity_code, h_fbid0->GetMaximum());
1834                   fFlagUserHistoMax = "OFF";
1835                 }
1836                 //...................................... histo set ymin and ymax  (ViewMatrix)
1837                 if (CorOrCov == fCorrelationMatrix) {
1838                   if (BetweenWhat == fBetweenSamples) {
1839                     SetHistoFrameYminYmaxFromMemo((TH1D*)h_fbid0, "D_MCs_ChNb");
1840                   }
1841                   if (BetweenWhat == fLFBetweenStins || BetweenWhat == fLFBetweenChannels) {
1842                     SetHistoFrameYminYmaxFromMemo((TH1D*)h_fbid0, "H2LFccMosMatrix");
1843                   }
1844                   if (BetweenWhat == fHFBetweenStins || BetweenWhat == fHFBetweenChannels) {
1845                     SetHistoFrameYminYmaxFromMemo((TH1D*)h_fbid0, "H2HFccMosMatrix");
1846                   }
1847                   //************************** A GARDER EN RESERVE ******************************
1848                   //............. special contour level for correlations (square root wise scale)
1849                   // Int_t nb_niv  = 9;
1850                   // Double_t* cont_niv = new Double_t[nb_niv];                  fCnew++;
1851                   // SqrtContourLevels(nb_niv, &cont_niv[0]);
1852                   // h_fbid0->SetContour(nb_niv, &cont_niv[0]);
1853                   // delete [] cont_niv;                                  fCdelete++;
1854                   //******************************** (FIN RESERVE) ******************************
1855                 }
1856                 if (CorOrCov == fCovarianceMatrix) {
1857                   if (BetweenWhat == fBetweenSamples) {
1858                     SetYminMemoFromPreviousMemo("D_TNo_ChNb");  // covariance => same level as sigmas
1859                     SetYmaxMemoFromPreviousMemo("D_TNo_ChNb");
1860                     SetHistoFrameYminYmaxFromMemo((TH1D*)h_fbid0, "D_TNo_ChNb");
1861                   }
1862                   if (BetweenWhat == fLFBetweenStins || BetweenWhat == fHFBetweenStins ||
1863                       BetweenWhat == fLFBetweenChannels || BetweenWhat == fHFBetweenChannels) {
1864                     SetHistoFrameYminYmaxFromMemo((TH1D*)h_fbid0, "H2HFccMosMatrix");
1865                   }
1866                 }
1867 
1868                 // ----------------------------------------------- P L O T S  (ViewMatrix)
1869                 char f_in[charArrLen];
1870                 //...................... Taille/format canvas
1871                 UInt_t canv_w = fCnaParHistos->CanvasFormatW("petit");
1872                 UInt_t canv_h = fCnaParHistos->CanvasFormatH("petit");
1873 
1874                 //............................. options generales
1875                 TString HistoType;
1876                 HistoType.Resize(charArrLen);
1877                 HistoType = "(no quantity type info)";
1878 
1879                 if (PlotOption == "COLZ") {
1880                   HistoType = "colz";
1881                 }
1882                 if (PlotOption == "BOX") {
1883                   HistoType = "colz";
1884                 }
1885                 if (PlotOption == "TEXT") {
1886                   HistoType = "colz";
1887                 }
1888                 if (PlotOption == "CONTZ") {
1889                   HistoType = "colz";
1890                 }
1891                 if (PlotOption == "LEGO2Z") {
1892                   HistoType = "lego";
1893                 }
1894                 if (PlotOption == "SURF1Z") {
1895                   HistoType = "surf";
1896                 }
1897                 if (PlotOption == "SURF2Z") {
1898                   HistoType = "surf";
1899                 }
1900                 if (PlotOption == "SURF3Z") {
1901                   HistoType = "surf";
1902                 }
1903                 if (PlotOption == "SURF4") {
1904                   HistoType = "surf";
1905                 }
1906 
1907                 if (fFlagSubDet == "EB") {
1908                   fFapStexBarrel = fEcalNumbering->GetSMHalfBarrel(fFapStexNumber);
1909                   SetAllPavesViewMatrix(BetweenWhat.Data(), StexStin_A, StexStin_B, i0StinEcha);
1910                 }
1911                 if (fFlagSubDet == "EE") {
1912                   fFapStexType = fEcalNumbering->GetEEDeeType(fFapStexNumber);
1913                   fFapStinQuadType = fEcalNumbering->GetSCQuadFrom1DeeSCEcna(StexStin_A);
1914                   SetAllPavesViewMatrix(BetweenWhat.Data(), StexStin_A, StexStin_B, i0StinEcha);
1915                 }
1916 
1917                 //---------------------------------------- Canvas name (ViewMatrix)
1918                 TString name_cov_cor;
1919                 name_cov_cor.Resize(charArrLen);
1920                 name_cov_cor = "?";
1921                 if (CorOrCov == fCovarianceMatrix) {
1922                   name_cov_cor = "Covariance";
1923                 }
1924                 if (CorOrCov == fCorrelationMatrix) {
1925                   name_cov_cor = "Correlation";
1926                 }
1927 
1928                 TString name_chan_samp;
1929                 name_chan_samp.Resize(charArrLen);
1930                 name_chan_samp = "?";
1931 
1932                 if (BetweenWhat == fLFBetweenStins) {
1933                   name_chan_samp = "LFccMos";
1934                 }
1935                 if (BetweenWhat == fHFBetweenStins) {
1936                   name_chan_samp = "HFccMos";
1937                 }
1938 
1939                 if (BetweenWhat == fLFBetweenChannels) {
1940                   name_chan_samp = "LF_cc";
1941                 }
1942                 if (BetweenWhat == fHFBetweenChannels) {
1943                   name_chan_samp = "HF_cc";
1944                 }
1945 
1946                 if (BetweenWhat == fBetweenSamples) {
1947                   name_chan_samp = "Between_Samples";  // MatrixBinIndex = i0StinEcha
1948                 }
1949 
1950                 TString name_visu;
1951                 name_visu.Resize(charArrLen);
1952                 name_visu = "?";
1953 
1954                 name_visu = PlotOption;
1955 
1956                 if ((BetweenWhat == fLFBetweenStins) || (BetweenWhat == fHFBetweenStins)) {
1957                   sprintf(f_in,
1958                           "%s_%s_%s_S1_%d_R%d_%d_%d_%s%d_%s",
1959                           name_cov_cor.Data(),
1960                           name_chan_samp.Data(),
1961                           fFapAnaType.Data(),
1962                           fFapNbOfSamples,
1963                           fFapRunNumber,
1964                           fFapFirstReqEvtNumber,
1965                           fFapLastReqEvtNumber,
1966                           fFapStexName.Data(),
1967                           fFapStexNumber,
1968                           name_visu.Data());
1969                 }
1970 
1971                 if (BetweenWhat == fLFBetweenChannels || BetweenWhat == fHFBetweenChannels) {
1972                   sprintf(f_in,
1973                           "%s_%s_%s_S1_%d_R%d_%d_%d_%s%d_%sX%d_%sY%d_%s",
1974                           name_cov_cor.Data(),
1975                           name_chan_samp.Data(),
1976                           fFapAnaType.Data(),
1977                           fFapNbOfSamples,
1978                           fFapRunNumber,
1979                           fFapFirstReqEvtNumber,
1980                           fFapLastReqEvtNumber,
1981                           fFapStexName.Data(),
1982                           fFapStexNumber,
1983                           fFapStexName.Data(),
1984                           StexStin_A,
1985                           fFapStexName.Data(),
1986                           StexStin_B,
1987                           name_visu.Data());
1988                 }
1989 
1990                 if (BetweenWhat == fBetweenSamples) {
1991                   sprintf(f_in,
1992                           "%s_%s_%s_S1_%d_R%d_%d_%d_%s%d_%sX%d_%sY%d_ElecChannel_%d_%s",
1993                           name_cov_cor.Data(),
1994                           name_chan_samp.Data(),
1995                           fFapAnaType.Data(),
1996                           fFapNbOfSamples,
1997                           fFapRunNumber,
1998                           fFapFirstReqEvtNumber,
1999                           fFapLastReqEvtNumber,
2000                           fFapStexName.Data(),
2001                           fFapStexNumber,
2002                           fFapStexName.Data(),
2003                           StexStin_A,
2004                           fFapStexName.Data(),
2005                           StexStin_B,
2006                           MatrixBinIndex,
2007                           name_visu.Data());
2008                 }
2009 
2010                 //----------------------------------------------------------    (ViewMatrix)
2011 
2012                 SetHistoPresentation((TH1D*)h_fbid0, HistoType);
2013                 TCanvas* MainCanvas = new TCanvas(f_in, f_in, canv_w, canv_h);
2014                 fCnewRoot++;
2015                 fCurrentCanvas = MainCanvas;
2016                 fCurrentCanvasName = f_in;
2017 
2018                 // std::cout << "*TEcnaHistos::ViewMatrix(...)> Plot is displayed on canvas ----> "
2019                 //      << fCurrentCanvasName << std::endl;
2020                 // std::cout << "*TEcnaHistos::ViewMatrix(...)> fCurrentCanvas = " << fCurrentCanvas << std::endl;
2021 
2022                 if (fPavComGeneralTitle != nullptr) {
2023                   fPavComGeneralTitle->Draw();
2024                 }
2025                 fPavComStex->Draw();
2026 
2027                 if (BetweenWhat == fLFBetweenChannels || BetweenWhat == fHFBetweenChannels) {
2028                   fPavComStin->Draw();
2029                 }
2030                 if (BetweenWhat == fBetweenSamples) {
2031                   fPavComStin->Draw();
2032                   fPavComXtal->Draw();
2033                 }
2034 
2035                 fPavComAnaRun->Draw();
2036                 fPavComNbOfEvts->Draw();
2037 
2038                 Double_t x_margin = fCnaParHistos->BoxLeftX("bottom_left_box") - 0.005;
2039                 Double_t y_margin = fCnaParHistos->BoxTopY("bottom_right_box") + 0.005;
2040                 MainCanvas->Divide(1, 1, x_margin, y_margin);
2041                 gPad->cd(1);
2042 
2043                 //----------------------------------------------------------    (ViewMatrix)
2044                 Int_t logy = 0;
2045                 gPad->SetLogy(logy);
2046                 if ((BetweenWhat == fLFBetweenStins) || (BetweenWhat == fHFBetweenStins)) {
2047                   gPad->SetGrid(1, 1);
2048                 }
2049                 h_fbid0->DrawCopy(PlotOption);
2050                 h_fbid0->SetStats(true);
2051                 gPad->Update();
2052                 h_fbid0->Delete();
2053                 h_fbid0 = nullptr;
2054                 fCdeleteRoot++;
2055 
2056                 //MainCanvas->Delete();                 fCdeleteRoot++;
2057               }
2058             }  // end of if ( OKData == kTRUE )
2059             else {
2060               fStatusDataExist = kFALSE;
2061             }
2062           }  // end of if ((BetweenWhat == fLFBetweenStins) || (BetweenWhat == fHFBetweenStins)  ) ||
2063              //( (BetweenWhat == fBetweenSamples) && (i0StinEcha>= 0) && (i0StinEcha<fEcal->MaxCrysInStin())) ||
2064              //( (BetweenWhat == fLFBetweenChannels || BetweenWhat == fHFBetweenChannels)
2065              // /* && (i0Sample  >= 0) && (i0Sample  < fFapNbOfSamples ) */ ) )
2066           else {
2067             if (BetweenWhat == fBetweenSamples) {
2068               std::cout << "*TEcnaHistos::ViewMatrix(...)> *ERROR* ==> Wrong channel number in " << fFapStinName.Data()
2069                         << ". Value = " << i0StinEcha << " (required range: [0, " << fEcal->MaxCrysInStin() - 1 << "] )"
2070                         << fTTBELL << std::endl;
2071             }
2072 
2073             // if( BetweenWhat == fLFBetweenChannels || BetweenWhat == fHFBetweenChannels )
2074             //  {
2075             // std::cout << "*TEcnaHistos::ViewMatrix(...)> *ERROR* ==> Wrong sample index. Value = "
2076             //      << i0Sample << " (required range: [0, "
2077             //      << fFapNbOfSamples-1 << "] )"
2078             //      << fTTBELL << std::endl;
2079             //}
2080           }
2081         } else  // else of the if ( Stin_X_ok ==1 && Stin_Y_ok ==1 )
2082         {
2083           //----------------------------------------------------------  (ViewMatrix)
2084           if (Stin_X_ok != 1) {
2085             if (fFlagSubDet == "EB") {
2086               std::cout << "*TEcnaHistos::ViewMatrix(...)> *ERROR* =====> " << fFapStinName.Data() << " " << StexStin_A
2087                         << ", " << fFapStinName.Data() << " not found. Available numbers = ";
2088               for (Int_t i = 0; i < fEcal->MaxStinEcnaInStex(); i++) {
2089                 if (vStin(i) > 0) {
2090                   std::cout << vStin(i) << ", ";
2091                 }
2092               }
2093             }
2094 
2095             if (fFlagSubDet == "EE") {
2096               std::cout << "*TEcnaHistos::ViewMatrix(...)> *ERROR* =====> " << fFapStinName.Data() << " "
2097                         << fEcalNumbering->GetDeeSCConsFrom1DeeSCEcna(fFapStexNumber, StexStin_A) << ", "
2098                         << fFapStinName.Data() << " not found. Available numbers = ";
2099               for (Int_t i = 0; i < fEcal->MaxStinEcnaInStex(); i++) {
2100                 if (vStin(i) > 0) {
2101                   std::cout << fEcalNumbering->GetDeeSCConsFrom1DeeSCEcna(fFapStexNumber, (Int_t)vStin(i)) << ", ";
2102                 }
2103               }
2104             }
2105             std::cout << fTTBELL << std::endl;
2106           }
2107           if (Stin_Y_ok != 1) {
2108             if (fFlagSubDet == "EB") {
2109               std::cout << "*TEcnaHistos::ViewMatrix(...)> *ERROR* =====> " << fFapStinName.Data() << " " << StexStin_B
2110                         << ", " << fFapStinName.Data() << " not found. Available numbers = ";
2111               for (Int_t i = 0; i < fEcal->MaxStinEcnaInStex(); i++) {
2112                 if (vStin(i) > 0) {
2113                   std::cout << vStin(i) << ", ";
2114                 }
2115               }
2116             }
2117 
2118             if (fFlagSubDet == "EE") {
2119               std::cout << "*TEcnaHistos::ViewMatrix(...)> *ERROR* =====> " << fFapStinName.Data() << " "
2120                         << fEcalNumbering->GetDeeSCConsFrom1DeeSCEcna(fFapStexNumber, StexStin_B) << ", "
2121                         << fFapStinName.Data() << " not found. Available numbers = ";
2122               for (Int_t i = 0; i < fEcal->MaxStinEcnaInStex(); i++) {
2123                 if (vStin(i) > 0) {
2124                   std::cout << fEcalNumbering->GetDeeSCConsFrom1DeeSCEcna(fFapStexNumber, (Int_t)vStin(i)) << ", ";
2125                 }
2126               }
2127             }
2128             std::cout << fTTBELL << std::endl;
2129           }
2130         }
2131       }  // end of if ( fMyRootFile->DataExist() == kTRUE )
2132       else {
2133         fStatusDataExist = kFALSE;
2134         std::cout << "!TEcnaHistos::ViewMatrix(...)> *ERROR* =====> "
2135                   << " Histo not available." << fTTBELL << std::endl;
2136         fFlagUserHistoMin = "OFF";
2137         fFlagUserHistoMax = "OFF";
2138       }
2139     }  // end of if ( fMyRootFile->LookAtRootFile() == kTRUE )
2140     else {
2141       fStatusFileFound = kFALSE;
2142       std::cout << "!TEcnaHistos::ViewMatrix(...)> *ERROR* =====> "
2143                 << " ROOT file not found" << fTTBELL << std::endl;
2144     }
2145   }  // ---- end of if( (fFapStexNumber > 0) &&  (fFapStexNumber <= fEcal->MaxStexInStas()) ) -----
2146   else {
2147     std::cout << "!TEcnaHistos::ViewMatrix(...)> " << fFapStexName.Data() << " = " << fFapStexNumber
2148               << ". Out of range (range = [1," << fEcal->MaxStexInStas() << "]) " << fTTBELL << std::endl;
2149   }
2150 }  // end of ViewMatrix(...)
2151 
2152 //==========================================================================
2153 //
2154 //                         ViewStin   ( => option COLZ )
2155 //
2156 //==========================================================================
2157 
2158 void TEcnaHistos::CorrelationsBetweenSamples(const Int_t& StinNumber) {
2159   TString CorOrCov = fCorrelationMatrix;
2160   ViewStin(StinNumber, CorOrCov);
2161 }
2162 
2163 void TEcnaHistos::CovariancesBetweenSamples(const Int_t& StinNumber) {
2164   TString CorOrCov = fCovarianceMatrix;
2165   ViewStin(StinNumber, CorOrCov);
2166 }
2167 
2168 //==========================================================================
2169 //
2170 //                         ViewStin   ( => option COLZ )
2171 //
2172 //  StexStin ==>
2173 //  (sample,sample) cor or cov matrices for all the crystal of StexStin
2174 //
2175 //
2176 //==========================================================================
2177 void TEcnaHistos::ViewStin(const Int_t& cStexStin, const TString& CorOrCov) {
2178   //cor(s,s') or cov(s,s') matrices for all the crystals of one given Stin. Option COLZ mandatory.
2179 
2180   // cStexStin = number for cons (in case of EE)
2181   // StexStin   = ECNA number
2182 
2183   if ((fFapStexNumber > 0) && fFapStexNumber <= fEcal->MaxStexInStas()) {
2184     Int_t StexStin = cStexStin;
2185     if (fFlagSubDet == "EE") {
2186       StexStin = fEcalNumbering->Get1DeeSCEcnaFromDeeSCCons(fFapStexNumber, cStexStin);
2187     }
2188 
2189     fMyRootFile->PrintNoComment();
2190     fMyRootFile->FileParameters(fFapAnaType,
2191                                 fFapNbOfSamples,
2192                                 fFapRunNumber,
2193                                 fFapFirstReqEvtNumber,
2194                                 fFapLastReqEvtNumber,
2195                                 fFapReqNbOfEvts,
2196                                 fFapStexNumber,
2197                                 fCfgResultsRootFilePath.Data());
2198 
2199     if (fMyRootFile->LookAtRootFile() == kTRUE)  //  (ViewStin)
2200     {
2201       fStatusFileFound = kTRUE;
2202 
2203       fFapNbOfEvts = fMyRootFile->GetNumberOfEvents(fFapReqNbOfEvts, fFapStexNumber);
2204       TString fp_name_short = fMyRootFile->GetRootFileNameShort();
2205       // std::cout << "*TEcnaHistos::ViewStin(...)> Data are analyzed from file ----> "
2206       //      << fp_name_short << std::endl;
2207 
2208       TVectorD vStin(fEcal->MaxStinEcnaInStex());
2209       for (Int_t i = 0; i < fEcal->MaxStinEcnaInStex(); i++) {
2210         vStin(i) = (Double_t)0.;
2211       }
2212       vStin = fMyRootFile->ReadStinNumbers(fEcal->MaxStinEcnaInStex());
2213 
2214       if (fMyRootFile->DataExist() == kTRUE) {
2215         fStatusDataExist = kTRUE;
2216 
2217         Int_t Stin_ok = 0;
2218         for (Int_t index_Stin = 0; index_Stin < fEcal->MaxStinEcnaInStex(); index_Stin++) {
2219           if (vStin(index_Stin) == StexStin) {
2220             Stin_ok++;
2221           }
2222         }
2223 
2224         if (Stin_ok == 1) {
2225           fStartDate = fMyRootFile->GetStartDate();
2226           fStopDate = fMyRootFile->GetStopDate();
2227           fRunType = fMyRootFile->GetRunType();
2228 
2229           //......................... matrix title                              (ViewStin)
2230           char f_in_mat_tit[charArrLen];
2231 
2232           if (CorOrCov == fCovarianceMatrix) {
2233             sprintf(f_in_mat_tit, "Xtal's Cov(s,s') matrices in %s.", fFapStinName.Data());
2234           }
2235           if (CorOrCov == fCorrelationMatrix) {
2236             sprintf(f_in_mat_tit, "Xtal's Cor(s,s') matrices in %s.", fFapStinName.Data());
2237           }
2238 
2239           //................................. Bidim parameters
2240           Int_t GeoBidSize = fEcal->MaxSampADC() * fEcal->MaxCrysHocoInStin();
2241           Int_t nb_binx = GeoBidSize;
2242           Int_t nb_biny = GeoBidSize;
2243           Axis_t xinf_bid = (Axis_t)0.;
2244           Axis_t xsup_bid = (Axis_t)GeoBidSize;
2245           Axis_t yinf_bid = (Axis_t)0.;
2246           Axis_t ysup_bid = (Axis_t)GeoBidSize;
2247 
2248           //--------------------------------------------------------- (ViewStin)
2249           //............. matrices reading and histogram filling
2250 
2251           TH2D* h_geo_bid =
2252               new TH2D("geobidim_ViewStin", f_in_mat_tit, nb_binx, xinf_bid, xsup_bid, nb_biny, yinf_bid, ysup_bid);
2253           fCnewRoot++;
2254 
2255           h_geo_bid->Reset();
2256 
2257           //======================================================== (ViewStin)
2258 
2259           //----------------------------------------------- Geographical bidim filling
2260           Int_t ReadMatSize = fFapNbOfSamples;
2261           Int_t MatSize = fEcal->MaxSampADC();
2262           TMatrixD read_matrix(ReadMatSize, ReadMatSize);
2263           for (Int_t i = 0; i - ReadMatSize < 0; i++) {
2264             for (Int_t j = 0; j - ReadMatSize < 0; j++) {
2265               read_matrix(i, j) = (Double_t)0.;
2266             }
2267           }
2268 
2269           Int_t i_data_exist = 0;
2270 
2271           for (Int_t n_crys = 0; n_crys < fEcal->MaxCrysInStin(); n_crys++) {
2272             if (CorOrCov == fCovarianceMatrix) {
2273               read_matrix = fMyRootFile->ReadCovariancesBetweenSamples(StexStin, n_crys, ReadMatSize);
2274             }
2275             if (CorOrCov == fCorrelationMatrix) {
2276               read_matrix = fMyRootFile->ReadCorrelationsBetweenSamples(StexStin, n_crys, ReadMatSize);
2277             }
2278 
2279             if (fMyRootFile->DataExist() == kFALSE) {
2280               fStatusDataExist = kFALSE;
2281               break;  // <= if no data: exiting loop over the channels
2282             } else {
2283               fStatusDataExist = kTRUE;
2284               i_data_exist++;
2285 
2286               for (Int_t i_samp = 0; i_samp < ReadMatSize; i_samp++) {
2287                 Int_t i_xgeo = GetXSampInStin(fFapStexNumber, StexStin, n_crys, i_samp);
2288                 for (Int_t j_samp = 0; j_samp < ReadMatSize; j_samp++) {
2289                   Int_t j_ygeo = GetYSampInStin(fFapStexNumber, StexStin, n_crys, j_samp);
2290                   h_geo_bid->Fill((Double_t)i_xgeo, (Double_t)j_ygeo, (Double_t)read_matrix(i_samp, j_samp));
2291                 }
2292               }
2293             }
2294           }
2295 
2296           //===========  H I S T O   M I N / M A X   M A N A G E M E N T  ========  (ViewStin)
2297           //................................ Put histo min max values
2298           TString quantity_code = "D_MCs_ChNb";
2299           if (CorOrCov == fCorrelationMatrix) {
2300             quantity_code = "D_MCs_ChNb";
2301           }
2302           if (CorOrCov == fCovarianceMatrix) {
2303             quantity_code = "H2HFccMosMatrix";
2304           }
2305 
2306           //.......... default if flag not set to "ON"
2307           SetYminMemoFromValue(quantity_code, fCnaParHistos->GetYminDefaultValue(quantity_code));
2308           SetYmaxMemoFromValue(quantity_code, fCnaParHistos->GetYmaxDefaultValue(quantity_code));
2309 
2310           if (fUserHistoMin == fUserHistoMax) {
2311             fFlagUserHistoMin = "AUTO";
2312             fFlagUserHistoMax = "AUTO";
2313           }
2314           //.......... user's min and/or max values
2315           if (fFlagUserHistoMin == "ON") {
2316             SetYminMemoFromValue(quantity_code, fUserHistoMin);
2317             fFlagUserHistoMin = "OFF";
2318           }
2319           if (fFlagUserHistoMax == "ON") {
2320             SetYmaxMemoFromValue(quantity_code, fUserHistoMax);
2321             fFlagUserHistoMax = "OFF";
2322           }
2323           //................................. automatic min and/or max
2324           if (fFlagUserHistoMin == "AUTO") {
2325             SetYminMemoFromValue(quantity_code, h_geo_bid->GetMinimum());
2326             fFlagUserHistoMin = "OFF";
2327           }
2328           if (fFlagUserHistoMax == "AUTO") {
2329             SetYmaxMemoFromValue(quantity_code, h_geo_bid->GetMaximum());
2330             fFlagUserHistoMax = "OFF";
2331           }
2332           //...................................... histo set ymin and ymax   (ViewStin)
2333           if (CorOrCov == fCorrelationMatrix) {
2334             SetHistoFrameYminYmaxFromMemo((TH1D*)h_geo_bid, "D_MCs_ChNb");
2335 
2336             // ************************** A GARDER EN RESERVE *******************************
2337             //............. special  contour level for correlations (square root wise scale)
2338             //Int_t nb_niv  = 9;
2339             //Double_t* cont_niv = new Double_t[nb_niv];                  fCnew++;
2340             //SqrtContourLevels(nb_niv, &cont_niv[0]);
2341             //h_geo_bid->SetContour(nb_niv, &cont_niv[0]);
2342             //delete [] cont_niv;                                  fCdelete++;
2343             // ******************************** (FIN RESERVE) *******************************
2344           }
2345           if (CorOrCov == fCovarianceMatrix) {
2346             SetHistoFrameYminYmaxFromMemo((TH1D*)h_geo_bid, "D_TNo_ChNb");
2347           }
2348 
2349           // =================================== P L O T S ========================  (ViewStin)
2350           if (i_data_exist > 0) {
2351             char f_in[charArrLen];
2352 
2353             //...................... Taille/format canvas
2354             UInt_t canv_w = fCnaParHistos->CanvasFormatW("petit");
2355             UInt_t canv_h = fCnaParHistos->CanvasFormatH("petit");
2356 
2357             //.................................................. paves commentaires (ViewStin)
2358             SetAllPavesViewStin(StexStin);
2359 
2360             //------------------------------------ Canvas name ----------------- (ViewStin)
2361             TString name_cov_cor;
2362             name_cov_cor.Resize(charArrLen);
2363             name_cov_cor = "?";
2364             if (CorOrCov == fCovarianceMatrix) {
2365               name_cov_cor = "CovSS_Matrices_in_";
2366             }
2367             if (CorOrCov == fCorrelationMatrix) {
2368               name_cov_cor = "CorSS_Matrices_in_";
2369             }
2370 
2371             TString name_visu;
2372             name_visu.Resize(charArrLen);
2373             name_visu = "colz";
2374 
2375             sprintf(f_in,
2376                     "%s_%s_%s_S1_%d_R%d_%d_%d_%s%d_%s%d_%s",
2377                     name_cov_cor.Data(),
2378                     fFapStinName.Data(),
2379                     fFapAnaType.Data(),
2380                     fFapNbOfSamples,
2381                     fFapRunNumber,
2382                     fFapFirstReqEvtNumber,
2383                     fFapLastReqEvtNumber,
2384                     fFapStexName.Data(),
2385                     fFapStexNumber,
2386                     fFapStinName.Data(),
2387                     StexStin,
2388                     name_visu.Data());
2389 
2390             SetHistoPresentation((TH1D*)h_geo_bid, "Stin");
2391 
2392             TCanvas* MainCanvas = new TCanvas(f_in, f_in, canv_w, canv_h);
2393             fCnewRoot++;
2394             fCurrentCanvas = MainCanvas;
2395             fCurrentCanvasName = f_in;
2396 
2397             // std::cout << "*TEcnaHistos::ViewStin(...)> Plot is displayed on canvas ----> " << f_in << std::endl;
2398 
2399             //------------------------ Canvas draw and update ------------ (ViewStin)
2400             if (fPavComGeneralTitle != nullptr) {
2401               fPavComGeneralTitle->Draw();
2402             }
2403             fPavComStex->Draw();
2404             fPavComStin->Draw();
2405             fPavComAnaRun->Draw();
2406             fPavComNbOfEvts->Draw();
2407 
2408             Double_t x_margin = fCnaParHistos->BoxLeftX("bottom_left_box") - 0.005;
2409             Double_t y_margin = fCnaParHistos->BoxTopY("bottom_right_box") + 0.005;
2410             MainCanvas->Divide(1, 1, x_margin, y_margin);
2411             gPad->cd(1);
2412 
2413             Int_t logy = 0;
2414             gPad->SetLogy(logy);
2415 
2416             h_geo_bid->DrawCopy("COLZ");
2417 
2418             //--------------------------------------------------------------------------- (ViewStin)
2419             Int_t size_Hoco = fEcal->MaxCrysHocoInStin();
2420             Int_t size_Veco = fEcal->MaxCrysVecoInStin();
2421 
2422             ViewStinGrid(fFapStexNumber, StexStin, MatSize, size_Hoco, size_Veco, " ");
2423 
2424             gPad->Update();
2425 
2426             h_geo_bid->SetStats(true);
2427 
2428             //      delete MainCanvas;              fCdeleteRoot++;
2429           }
2430 
2431           h_geo_bid->Delete();
2432           h_geo_bid = nullptr;
2433           fCdeleteRoot++;
2434         } else {
2435           std::cout << "!TEcnaHistos::ViewStin(...)> *ERROR* =====> " << fFapStinName.Data() << " " << cStexStin
2436                     << " not found."
2437                     << " Available numbers = ";
2438           for (Int_t i = 0; i < fEcal->MaxStinEcnaInStex(); i++) {
2439             if (vStin(i) > 0) {
2440               if (fFlagSubDet == "EB") {
2441                 std::cout << (Int_t)vStin(i) << ", ";
2442               }
2443               if (fFlagSubDet == "EE") {
2444                 std::cout << fEcalNumbering->GetDeeSCConsFrom1DeeSCEcna(fFapStexNumber, (Int_t)vStin(i)) << ", ";
2445               }
2446             }
2447           }
2448           std::cout << fTTBELL << std::endl;
2449         }
2450       }  // end of if ( myRootFile->DataExist() == kTRUE )
2451       else {
2452         fStatusDataExist = kFALSE;
2453       }
2454     }  // end of if ( fMyRootFile->LookAtRootFile() == kTRUE )
2455     else {
2456       fStatusFileFound = kFALSE;
2457 
2458       std::cout << "!TEcnaHistos::ViewStin(...)> *ERROR* =====> "
2459                 << " ROOT file not found" << fTTBELL << std::endl;
2460     }
2461   } else {
2462     std::cout << "!TEcnaHistos::ViewStin(...)> " << fFapStexName.Data() << " = " << fFapStexNumber
2463               << ". Out of range (range = [1," << fEcal->MaxStexInStas() << "]) " << fTTBELL << std::endl;
2464   }
2465 }  // end of ViewStin(...)
2466 
2467 //====================================================================================
2468 //
2469 //                         StinCrystalNumbering
2470 //              independent of the ROOT file => StexNumber as argument
2471 //
2472 //====================================================================================
2473 void TEcnaHistos::StinCrystalNumbering(const Int_t& StexNumber, const Int_t& cStexStin) {
2474   //display the crystal numbering of one Stin
2475   // cStexStin = Tower number in case of EB or SC number for construction in case of EE
2476 
2477   if (fFlagSubDet == "EB") {
2478     TowerCrystalNumbering(StexNumber, cStexStin);
2479   }
2480   if (fFlagSubDet == "EE") {
2481     SCCrystalNumbering(StexNumber, cStexStin);
2482   }
2483 }
2484 //---------------->  end of StinCrystalNumbering()
2485 
2486 //====================================================================================
2487 //
2488 //                         TowerCrystalNumbering
2489 //              independent of the ROOT file => SMNumber as argument
2490 //
2491 //====================================================================================
2492 void TEcnaHistos::TowerCrystalNumbering(const Int_t& SMNumber, const Int_t& n1SMTow) {
2493   //display the crystal numbering of one tower
2494 
2495   if ((SMNumber > 0) && (SMNumber <= fEcal->MaxSMInEB())) {
2496     fFapStexBarrel = fEcalNumbering->GetSMHalfBarrel(SMNumber);
2497 
2498     Int_t MatSize = fEcal->MaxSampADC();
2499     Int_t size_eta = fEcal->MaxCrysEtaInTow();
2500     Int_t size_phi = fEcal->MaxCrysPhiInTow();
2501 
2502     //---------------------------------- bidim
2503 
2504     Int_t nb_bins = fEcal->MaxSampADC();
2505     Int_t nx_gbins = nb_bins * size_eta;
2506     Int_t ny_gbins = nb_bins * size_phi;
2507 
2508     Axis_t xinf_gbid = (Axis_t)0.;
2509     Axis_t xsup_gbid = (Axis_t)fEcal->MaxSampADC() * size_eta;
2510     Axis_t yinf_gbid = (Axis_t)0.;
2511     Axis_t ysup_gbid = (Axis_t)fEcal->MaxSampADC() * size_phi;
2512 
2513     TString fg_name = "M0' crystals";
2514     TString fg_tit = "Xtal numbering (chan. in tow, chan. in SM, Xtal in SM, hashed)";
2515 
2516     //----------------------- empty 2D histo for pave coordinates registration
2517     TH2D* h_gbid;
2518     h_gbid = new TH2D(fg_name.Data(), fg_tit.Data(), nx_gbins, xinf_gbid, xsup_gbid, ny_gbins, yinf_gbid, ysup_gbid);
2519     fCnewRoot++;
2520     h_gbid->Reset();
2521 
2522     //-----------------  T R A C E  D E S   P L O T S ------ (TowerCrystalNumbering)
2523 
2524     char f_in[charArrLen];
2525 
2526     //...................... Taille/format canvas
2527 
2528     UInt_t canv_w = fCnaParHistos->CanvasFormatW("petit");
2529     UInt_t canv_h = fCnaParHistos->CanvasFormatH("petit");
2530 
2531     //........................................ couleurs
2532     Color_t couleur_noir = fCnaParHistos->SetColorsForNumbers("crystal");
2533     Color_t couleur_rouge = fCnaParHistos->SetColorsForNumbers("lvrb_top");
2534     Color_t couleur_bleu_fonce = fCnaParHistos->SetColorsForNumbers("lvrb_bottom");
2535 
2536     gStyle->SetPalette(1, nullptr);  // Rainbow spectrum
2537 
2538     //.................................... options generales
2539     fCnaParHistos->SetViewHistoStyle("Stin");
2540 
2541     //.................................... paves commentaires (TowerCrystalNumbering)
2542 
2543     SetAllPavesViewStinCrysNb(SMNumber, n1SMTow);
2544 
2545     //---------------------------------------------- (TowerCrystalNumbering)
2546 
2547     //..................... Canvas name
2548     sprintf(f_in, "Crystal_Numbering_for_%s_X_%d_%s%d", fFapStinName.Data(), n1SMTow, fFapStexName.Data(), SMNumber);
2549 
2550     SetHistoPresentation((TH1D*)h_gbid, "Stin");
2551 
2552     TCanvas* MainCanvas = new TCanvas(f_in, f_in, canv_w, canv_h);
2553     fCnewRoot++;
2554     fCurrentCanvas = MainCanvas;
2555     fCurrentCanvasName = f_in;
2556 
2557     // std::cout << "*TEcnaHistosEB::TowerCrystalNumbering(...)> Plot is displayed on canvas ----> "
2558     //      << f_in << std::endl;
2559 
2560     Double_t x_margin = fCnaParHistos->BoxLeftX("bottom_left_box") - 0.005;
2561     Double_t y_margin = fCnaParHistos->BoxTopY("bottom_right_box") + 0.005;
2562     MainCanvas->Divide(1, 1, x_margin, y_margin);
2563 
2564     fPavComStex->Draw();
2565     fPavComStin->Draw();
2566     fPavComLVRB->Draw();
2567 
2568     Bool_t b_true = true;
2569     Bool_t b_false = false;
2570     gPad->cd(1);
2571 
2572     gStyle->SetMarkerColor(couleur_rouge);
2573 
2574     Int_t logy = 0;
2575     gPad->SetLogy(logy);
2576 
2577     //............................... bidim .......... (TowerCrystalNumbering)
2578 
2579     h_gbid->SetStats(b_false);
2580     h_gbid->DrawCopy("COLZ");
2581 
2582     //..... Ecriture des numeros de channels dans la grille..... (TowerCrystalNumbering)
2583     //      et des numeros SM des cristaux
2584 
2585     //............... prepa arguments fixes appels [TText]->DrawText()
2586     char f_in_elec[charArrLen];
2587     TString TowerLvrbType = fEcalNumbering->GetTowerLvrbType(n1SMTow);
2588     TText* text_elec_num = new TText();
2589     fCnewRoot++;
2590     if (TowerLvrbType == "top") {
2591       text_elec_num->SetTextColor(couleur_rouge);
2592     }
2593     if (TowerLvrbType == "bottom") {
2594       text_elec_num->SetTextColor(couleur_bleu_fonce);
2595     }
2596     text_elec_num->SetTextSize(0.04);
2597 
2598     char f_in_sme[charArrLen];
2599     TText* text_sme_num = new TText();
2600     fCnewRoot++;
2601     if (TowerLvrbType == "top") {
2602       text_sme_num->SetTextColor(couleur_rouge);
2603     }
2604     if (TowerLvrbType == "bottom") {
2605       text_sme_num->SetTextColor(couleur_bleu_fonce);
2606     }
2607     text_sme_num->SetTextSize(0.03);
2608 
2609     char f_in_sm[charArrLen];
2610     TText* text_sm_num = new TText();
2611     fCnewRoot++;
2612     text_sm_num->SetTextColor(couleur_noir);
2613     text_sm_num->SetTextSize(0.03);
2614 
2615     char f_in_hsd[charArrLen];
2616     TText* text_hsd_num = new TText();
2617     fCnewRoot++;
2618     text_hsd_num->SetTextColor(couleur_noir);
2619     text_hsd_num->SetTextSize(0.03);
2620 
2621     //............... prepa arguments fixes appels GetXGeo(...) et GetYGeo(...)
2622     Int_t i_samp = 0;
2623     //Double_t off_set = (Double_t)(fEcal->MaxSampADC()/4);
2624     Double_t off_set = (Double_t)1.;
2625 
2626     //------------------ LOOP ON THE CRYSTAL ELECTRONIC CHANNEL NUMBER  (TowerCrystalNumbering)
2627 
2628     for (Int_t i_chan = 0; i_chan < fEcal->MaxCrysInTow(); i_chan++) {
2629       Int_t i_xgeo = GetXSampInStin(SMNumber, n1SMTow, i_chan, i_samp);
2630       Int_t i_ygeo = GetYSampInStin(SMNumber, n1SMTow, i_chan, i_samp);
2631 
2632       Double_t xgi = i_xgeo + 3. * off_set;
2633       Double_t ygj = i_ygeo + 7. * off_set;
2634 
2635       Double_t xgi_sme = i_xgeo + 3. * off_set;
2636       Double_t ygj_sme = i_ygeo + 5. * off_set;
2637 
2638       Double_t xgi_sm = i_xgeo + 3. * off_set;
2639       Double_t ygj_sm = i_ygeo + 3. * off_set;
2640 
2641       Double_t xgi_hsd = i_xgeo + 3. * off_set;
2642       Double_t ygj_hsd = i_ygeo + 1. * off_set;
2643 
2644       Int_t i_crys_sme = fEcalNumbering->Get0SMEchaFrom1SMTowAnd0TowEcha(n1SMTow, i_chan);
2645       Int_t i_crys_sm = fEcalNumbering->Get1SMCrysFrom1SMTowAnd0TowEcha(n1SMTow, i_chan);
2646 
2647       Double_t Eta = fEcalNumbering->GetEta(SMNumber, n1SMTow, i_chan);
2648       Double_t Phi = fEcalNumbering->GetPhi(SMNumber, n1SMTow, i_chan);
2649 
2650       Int_t i_crys_hsd = fEcalNumbering->GetHashedNumberFromIEtaAndIPhi((Int_t)Eta, (Int_t)Phi);
2651 
2652       //------------------------------------------------------- TowerCrystalNumbering
2653 
2654       sprintf(f_in_elec, "%d", i_chan);
2655       text_elec_num->DrawText(xgi, ygj, f_in_elec);
2656 
2657       sprintf(f_in_sme, "%d", i_crys_sme);
2658       text_sme_num->DrawText(xgi_sme, ygj_sme, f_in_sme);
2659 
2660       sprintf(f_in_sm, "%d", i_crys_sm);
2661       text_sm_num->DrawText(xgi_sm, ygj_sm, f_in_sm);
2662 
2663       sprintf(f_in_hsd, "%d", i_crys_hsd);
2664       text_sm_num->DrawText(xgi_hsd, ygj_hsd, f_in_hsd);
2665     }
2666     text_sm_num->Delete();
2667     text_sm_num = nullptr;
2668     fCdeleteRoot++;
2669     text_sme_num->Delete();
2670     text_sme_num = nullptr;
2671     fCdeleteRoot++;
2672     text_elec_num->Delete();
2673     text_elec_num = nullptr;
2674     fCdeleteRoot++;
2675     text_hsd_num->Delete();
2676     text_hsd_num = nullptr;
2677     fCdeleteRoot++;
2678 
2679     ViewStinGrid(SMNumber, n1SMTow, MatSize, size_eta, size_phi, "CrystalNumbering");
2680 
2681     gPad->Update();
2682     h_gbid->SetStats(b_true);
2683 
2684     h_gbid->Delete();
2685     h_gbid = nullptr;
2686     fCdeleteRoot++;
2687 
2688   } else {
2689     std::cout << "!TEcnaHistos::TowerCrystalNumbering(...)> SM = " << SMNumber << ". Out of range ( range = [1,"
2690               << fEcal->MaxSMInEB() << "] )" << fTTBELL << std::endl;
2691   }
2692 }
2693 //---------------->  end of TowerCrystalNumbering()
2694 
2695 //====================================================================================
2696 //
2697 //                         SCCrystalNumbering
2698 //              independent of the ROOT file => DeeNumber and n1DeeSCEcna as argument
2699 //
2700 //====================================================================================
2701 void TEcnaHistos::SCCrystalNumbering(const Int_t& DeeNumber, const Int_t& n1DeeSCCons) {
2702   //display the crystal numbering of one SC
2703 
2704   if ((DeeNumber > 0) && (DeeNumber <= fEcal->MaxDeeInEE())) {
2705     Int_t n1DeeSCEcna = fEcalNumbering->Get1DeeSCEcnaFromDeeSCCons(DeeNumber, n1DeeSCCons);
2706     fFapStexType = fEcalNumbering->GetEEDeeType(DeeNumber);
2707     fFapStinQuadType = fEcalNumbering->GetSCQuadFrom1DeeSCEcna(n1DeeSCEcna);
2708 
2709     //Int_t MatSize  = fEcal->MaxSampADC();
2710     Int_t size_IX = fEcal->MaxCrysIXInSC();
2711     Int_t size_IY = fEcal->MaxCrysIYInSC();
2712 
2713     //---------------------------------- bidim
2714 
2715     Int_t nb_bins = fEcal->MaxSampADC();
2716     Int_t nx_gbins = nb_bins * size_IX;
2717     Int_t ny_gbins = nb_bins * size_IY;
2718 
2719     Axis_t xinf_gbid = (Axis_t)0.;
2720     Axis_t xsup_gbid = (Axis_t)fEcal->MaxSampADC() * size_IX;
2721     Axis_t yinf_gbid = (Axis_t)0.;
2722     Axis_t ysup_gbid = (Axis_t)fEcal->MaxSampADC() * size_IY;
2723 
2724     TString fg_name = "crystalnbring";
2725     TString fg_tit = "Xtal numbering for construction";
2726 
2727     TH2D* h_gbid;
2728     h_gbid = new TH2D(fg_name.Data(), fg_tit.Data(), nx_gbins, xinf_gbid, xsup_gbid, ny_gbins, yinf_gbid, ysup_gbid);
2729     fCnewRoot++;
2730     h_gbid->Reset();
2731 
2732     //-----------------  T R A C E  D E S   P L O T S ------ (SCCrystalNumbering)
2733 
2734     char f_in[charArrLen];
2735 
2736     //...................... Taille/format canvas
2737 
2738     UInt_t canv_w = fCnaParHistos->CanvasFormatW("petit");
2739     UInt_t canv_h = fCnaParHistos->CanvasFormatH("petit");
2740     //........................................ couleurs
2741     // Color_t couleur_noir       = fCnaParHistos->ColorDefinition("noir");
2742     Color_t couleur_rouge = fCnaParHistos->ColorDefinition("rouge");
2743     // Color_t couleur_bleu_fonce = fCnaParHistos->ColorDefinition("bleu_fonce");
2744 
2745     gStyle->SetPalette(1, nullptr);  // Rainbow spectrum
2746     //.................................... options generales
2747     fCnaParHistos->SetViewHistoStyle("Stin");
2748 
2749     //.................................... paves commentaires (SCCrystalNumbering)
2750     SetAllPavesViewStinCrysNb(DeeNumber, n1DeeSCEcna);
2751 
2752     //---------------------------------------------- (SCCrystalNumbering)
2753     //..................... Canvas name
2754     sprintf(
2755         f_in, "Crystal_Numbering_for_%s_X_%d_%s%d", fFapStinName.Data(), n1DeeSCEcna, fFapStexName.Data(), DeeNumber);
2756 
2757     SetHistoPresentation((TH1D*)h_gbid, "Stin");
2758 
2759     TCanvas* MainCanvas = new TCanvas(f_in, f_in, canv_w, canv_h);
2760     fCnewRoot++;
2761     fCurrentCanvas = MainCanvas;
2762     fCurrentCanvasName = f_in;
2763 
2764     // std::cout << "*TEcnaHistosEE::SCCrystalNumbering(...)> Plot is displayed on canvas ----> "
2765     //      << f_in << std::endl;
2766 
2767     Double_t x_margin = fCnaParHistos->BoxLeftX("bottom_left_box") - 0.005;
2768     Double_t y_margin = fCnaParHistos->BoxTopY("bottom_right_box") + 0.005;
2769 
2770     MainCanvas->Divide(1, 1, x_margin, y_margin);
2771 
2772     fPavComStex->Draw();
2773     fPavComStin->Draw();
2774     fPavComCxyz->Draw();
2775 
2776     Bool_t b_true = true;
2777     Bool_t b_false = false;
2778     gPad->cd(1);
2779 
2780     gStyle->SetMarkerColor(couleur_rouge);
2781 
2782     Int_t logy = 0;
2783     gPad->SetLogy(logy);
2784 
2785     //............................... bidim .......... (SCCrystalNumbering)
2786     h_gbid->SetStats(b_false);
2787     fCnaParHistos->SetViewHistoOffsets((TH1D*)h_gbid, "Stin", " ");
2788     h_gbid->DrawCopy("COLZ");
2789 
2790     //..... Ecriture des numeros de channels dans la grille..... (SCCrystalNumbering)
2791     //      et des numeros Dee des cristaux
2792     TString SCQuadType = fEcalNumbering->GetSCQuadFrom1DeeSCEcna(n1DeeSCEcna);
2793     TString DeeDir = fEcalNumbering->GetDeeDirViewedFromIP(DeeNumber);
2794     TString DeeEndcap = fEcalNumbering->GetEEDeeEndcap(DeeNumber);
2795     Color_t couleur_SC = GetSCColor(DeeEndcap, DeeDir, SCQuadType);
2796     //............... prepa arguments fixes appels [TText]->DrawText()
2797     char f_in_elec[charArrLen];
2798     TText* text_elec_num = new TText();
2799     fCnewRoot++;
2800     text_elec_num->SetTextColor(couleur_SC);
2801     text_elec_num->SetTextSize(0.06);
2802 
2803     //............... prepa arguments fixes appels GetXGeo(...) et GetYGeo(...)
2804     Int_t i_samp = 0;
2805     Double_t off_set = (Double_t)(fEcal->MaxSampADC() / 3);
2806 
2807     //------------------ LOOP ON THE CRYSTAL ELECTRONIC CHANNEL NUMBER  (SCCrystalNumbering)
2808 
2809     for (Int_t i_chan = 0; i_chan < fEcal->MaxCrysInSC(); i_chan++) {
2810       Int_t i_xgeo = GetXSampInStin(DeeNumber, n1DeeSCEcna, i_chan, i_samp);
2811       Int_t i_ygeo = GetYSampInStin(DeeNumber, n1DeeSCEcna, i_chan, i_samp);
2812 
2813       Double_t xgi = i_xgeo + off_set;
2814       Double_t ygj = i_ygeo + 2 * off_set;
2815 
2816       //------------------------------------------------------- SCCrystalNumbering
2817       Int_t i_chan_p = i_chan + 1;
2818       sprintf(f_in_elec, "%d", i_chan_p);  // offset = +1 (Xtal for construction numbering, CMS NOTE 2006/027)
2819       text_elec_num->DrawText(xgi, ygj, f_in_elec);
2820     }
2821     text_elec_num->Delete();
2822     text_elec_num = nullptr;
2823     fCdeleteRoot++;
2824 
2825     ViewStinGrid(DeeNumber, n1DeeSCEcna, fEcal->MaxSampADC(), size_IX, size_IY, "CrystalNumbering");
2826 
2827     gPad->Update();
2828     h_gbid->SetStats(b_true);
2829 
2830     h_gbid->Delete();
2831     h_gbid = nullptr;
2832     fCdeleteRoot++;
2833 
2834   } else {
2835     std::cout << "!TEcnaHistos::SCCrystalNumbering(...)> Dee = " << DeeNumber << ". Out of range ( range = [1,"
2836               << fEcal->MaxDeeInEE() << "] )" << fTTBELL << std::endl;
2837   }
2838 }
2839 //---------------->  end of SCCrystalNumbering()
2840 
2841 //==================================================================================
2842 //
2843 //                       GetXSampInStin, GetYSampInStin
2844 //
2845 //==================================================================================
2846 Int_t TEcnaHistos::GetXSampInStin(const Int_t& StexNumber,
2847                                   const Int_t& StexStin,
2848                                   const Int_t& i0StinEcha,
2849                                   const Int_t& i_samp) {
2850   //Gives the X coordinate in the geographic view of one Stin
2851 
2852   Int_t ix_geo = -1;
2853 
2854   if (fFlagSubDet == "EB") {
2855     TString ctype = fEcalNumbering->GetStinLvrbType(StexStin);
2856     TString btype = fEcalNumbering->GetStexHalfStas(StexNumber);
2857     if ((btype == "EB+" && ctype == "bottom") || (btype == "EB-" && ctype == "top")) {
2858       ix_geo =
2859           ((fEcal->MaxCrysHocoInStin() - 1) - (i0StinEcha / fEcal->MaxCrysHocoInStin())) * fEcal->MaxSampADC() + i_samp;
2860     }
2861     if ((btype == "EB+" && ctype == "top") || (btype == "EB-" && ctype == "bottom")) {
2862       ix_geo = (i0StinEcha / fEcal->MaxCrysHocoInStin()) * fEcal->MaxSampADC() + i_samp;
2863     }
2864   }
2865 
2866   if (fFlagSubDet == "EE") {
2867     TString DeeDir = fEcalNumbering->GetDeeDirViewedFromIP(StexNumber);
2868     if (DeeDir == "right") {
2869       ix_geo = (fEcalNumbering->GetIXCrysInSC(StexNumber, StexStin, i0StinEcha) - 1) * fEcal->MaxSampADC() + i_samp;
2870     }
2871     if (DeeDir == "left") {
2872       ix_geo = (fEcal->MaxCrysHocoInStin() - fEcalNumbering->GetIXCrysInSC(StexNumber, StexStin, i0StinEcha)) *
2873                    fEcal->MaxSampADC() +
2874                i_samp;
2875     }
2876   }
2877 
2878   return ix_geo;
2879 }
2880 //--------------------------------------------------------------------------------------------
2881 Int_t TEcnaHistos::GetYSampInStin(const Int_t& StexNumber,
2882                                   const Int_t& StexStin,
2883                                   const Int_t& i0StinEcha,
2884                                   const Int_t& j_samp) {
2885   //Gives the Y coordinate in the geographic view of one Stin
2886 
2887   Int_t jy_geo = -1;
2888 
2889   if (fFlagSubDet == "EB") {
2890     TString ctype = fEcalNumbering->GetStinLvrbType(StexStin);
2891     TString btype = fEcalNumbering->GetStexHalfStas(StexNumber);
2892 
2893     //.......................... jy_geo for the EB+ (and beginning for the EB-)
2894 
2895     if ((btype == "EB+" && ctype == "top") || (btype == "EB-" && ctype == "bottom")) {
2896       if (i0StinEcha >= 0 && i0StinEcha <= 4) {
2897         jy_geo = (i0StinEcha - 0) * fEcal->MaxSampADC() + j_samp;
2898       }
2899       if (i0StinEcha >= 5 && i0StinEcha <= 9) {
2900         jy_geo = -(i0StinEcha - 9) * fEcal->MaxSampADC() + j_samp;
2901       }
2902       if (i0StinEcha >= 10 && i0StinEcha <= 14) {
2903         jy_geo = (i0StinEcha - 10) * fEcal->MaxSampADC() + j_samp;
2904       }
2905       if (i0StinEcha >= 15 && i0StinEcha <= 19) {
2906         jy_geo = -(i0StinEcha - 19) * fEcal->MaxSampADC() + j_samp;
2907       }
2908       if (i0StinEcha >= 20 && i0StinEcha <= 24) {
2909         jy_geo = (i0StinEcha - 20) * fEcal->MaxSampADC() + j_samp;
2910       }
2911     }
2912 
2913     if ((btype == "EB+" && ctype == "bottom") || (btype == "EB-" && ctype == "top")) {
2914       if (i0StinEcha >= 0 && i0StinEcha <= 4) {
2915         jy_geo = ((fEcal->MaxCrysVecoInStin() - 1) - (i0StinEcha - 0)) * fEcal->MaxSampADC() + j_samp;
2916       }
2917       if (i0StinEcha >= 5 && i0StinEcha <= 9) {
2918         jy_geo = ((fEcal->MaxCrysVecoInStin() - 1) + (i0StinEcha - 9)) * fEcal->MaxSampADC() + j_samp;
2919       }
2920       if (i0StinEcha >= 10 && i0StinEcha <= 14) {
2921         jy_geo = ((fEcal->MaxCrysVecoInStin() - 1) - (i0StinEcha - 10)) * fEcal->MaxSampADC() + j_samp;
2922       }
2923       if (i0StinEcha >= 15 && i0StinEcha <= 19) {
2924         jy_geo = ((fEcal->MaxCrysVecoInStin() - 1) + (i0StinEcha - 19)) * fEcal->MaxSampADC() + j_samp;
2925       }
2926       if (i0StinEcha >= 20 && i0StinEcha <= 24) {
2927         jy_geo = ((fEcal->MaxCrysVecoInStin() - 1) - (i0StinEcha - 20)) * fEcal->MaxSampADC() + j_samp;
2928       }
2929     }
2930   }
2931 
2932   if (fFlagSubDet == "EE") {
2933     jy_geo = (fEcalNumbering->GetJYCrysInSC(StexNumber, StexStin, i0StinEcha) - 1) * fEcal->MaxSampADC() + j_samp;
2934   }
2935 
2936   return jy_geo;
2937 }
2938 
2939 //===============================================================================
2940 //
2941 //                           ViewStinGrid
2942 //              independent of the ROOT file => StexNumber as argument
2943 //
2944 //===============================================================================
2945 void TEcnaHistos::ViewStinGrid(const Int_t& StexNumber,
2946                                const Int_t& StexStin,
2947                                const Int_t& MatSize,
2948                                const Int_t& size_Hoco,
2949                                const Int_t& size_Veco,
2950                                const TString& chopt) {
2951   //Grid of one Stin with axis Hoco and Veco
2952 
2953   if (fFlagSubDet == "EB") {
2954     ViewTowerGrid(StexNumber, StexStin, MatSize, size_Hoco, size_Veco, chopt);
2955   }
2956   if (fFlagSubDet == "EE") {
2957     ViewSCGrid(StexNumber, StexStin, MatSize, size_Hoco, size_Veco, chopt);
2958   }
2959 
2960 }  // end of ViewStinGrid
2961 
2962 //===============================================================================
2963 //
2964 //                           ViewTowerGrid
2965 //              independent of the ROOT file => SMNumber as argument
2966 //
2967 //===============================================================================
2968 void TEcnaHistos::ViewTowerGrid(const Int_t& SMNumber,
2969                                 const Int_t& n1SMTow,
2970                                 const Int_t& MatSize,
2971                                 const Int_t& size_eta,
2972                                 const Int_t& size_phi,
2973                                 const TString& chopt) {
2974   //Grid of one tower with axis eta and phi
2975   //.......................... lignes verticales
2976   Double_t xline = 0.;
2977 
2978   Double_t yline_bot = 0.;
2979   Double_t yline_top = (Double_t)(MatSize * size_eta);
2980 
2981   for (Int_t i = 0; i < size_eta; i++) {
2982     xline = xline + (Double_t)MatSize;
2983     TLine* lin;
2984     lin = new TLine(xline, yline_bot, xline, yline_top);
2985     fCnewRoot++;
2986     lin->Draw();
2987     // delete lin;             fCdeleteRoot++;
2988   }
2989   //............................. lignes horizontales
2990   Double_t xline_left = 0;
2991   Double_t xline_right = (Double_t)(MatSize * size_eta);
2992 
2993   Double_t yline = -(Double_t)MatSize;
2994 
2995   for (Int_t j = 0; j < size_eta + 1; j++) {
2996     yline = yline + (Double_t)MatSize;
2997     TLine* lin;
2998     lin = new TLine(xline_left, yline, xline_right, yline);
2999     fCnewRoot++;
3000     lin->Draw();
3001     // delete lin;             fCdeleteRoot++;
3002   }
3003 
3004   //------------------ trace axes en eta et phi --------------- ViewTowerGrid
3005 
3006   //...................................................... Axe i(eta) (x bottom)  (ViewTowerGrid)
3007 
3008   Double_t eta_min = fEcalNumbering->GetIEtaMin(SMNumber, n1SMTow);
3009   Double_t eta_max = fEcalNumbering->GetIEtaMax(SMNumber, n1SMTow);
3010 
3011   TString x_var_name = GetEtaPhiAxisTitle("ietaTow");
3012   TString x_direction = fEcalNumbering->GetXDirectionEB(SMNumber);
3013 
3014   Float_t tit_siz_x = fCnaParHistos->AxisTitleSize();
3015   Float_t lab_siz_x = fCnaParHistos->AxisLabelSize();
3016   Float_t tic_siz_x = fCnaParHistos->AxisTickSize();
3017   Float_t tit_off_x = fCnaParHistos->AxisTitleOffset("Towx");
3018   Float_t lab_off_x = fCnaParHistos->AxisLabelOffset("Towx");
3019 
3020   new TF1("f1", x_direction.Data(), eta_min, eta_max);
3021   fCnewRoot++;
3022 
3023   TGaxis* sup_axis_x = nullptr;
3024 
3025   if (x_direction == "-x")  // NEVER  IN THIS CASE: xmin->xmax <=> right->left ("-x") direction
3026   {
3027     sup_axis_x = new TGaxis(
3028         -(Float_t)MatSize, (Float_t)0, (Float_t)(size_eta * MatSize), (Float_t)0., "f1", size_eta, "BCS", 0.);
3029     fCnewRoot++;
3030     std::cout << "TEcnaHistosEB::ViewTowerGrid()> non foreseen case. eta with -x direction." << fTTBELL << std::endl;
3031   }
3032 
3033   if (x_direction == "x")  // ALWAYS IN THIS CASE: xmin->xmax <=> left->right ("x") direction
3034   {
3035     sup_axis_x =
3036         new TGaxis((Float_t)0., (Float_t)0., (Float_t)(size_eta * MatSize), (Float_t)0., "f1", size_eta, "CS", 0.);
3037     fCnewRoot++;
3038   }
3039 
3040   if (sup_axis_x != nullptr) {
3041     sup_axis_x->SetTitle(x_var_name);
3042     sup_axis_x->SetTitleSize(tit_siz_x);
3043     sup_axis_x->SetTitleOffset(tit_off_x);
3044     sup_axis_x->SetLabelSize(lab_siz_x);
3045     sup_axis_x->SetLabelOffset(lab_off_x);
3046     sup_axis_x->SetTickSize(tic_siz_x);
3047     sup_axis_x->Draw("SAME");
3048   }
3049 
3050   //...................................................... Axe phi (y right)  (ViewTowerGrid)
3051   Float_t tit_siz_y = fCnaParHistos->AxisTitleSize();
3052   Float_t lab_siz_y = fCnaParHistos->AxisLabelSize();
3053   Float_t tic_siz_y = fCnaParHistos->AxisTickSize();
3054   Float_t tit_off_y = fCnaParHistos->AxisTitleOffset("Towy");
3055   Float_t lab_off_y = fCnaParHistos->AxisLabelOffset("Towy");
3056 
3057   if (chopt == "CrystalNumbering") {
3058     Double_t phi_min = fEcalNumbering->GetPhiMin(SMNumber, n1SMTow);
3059     Double_t phi_max = fEcalNumbering->GetPhiMax(SMNumber, n1SMTow);
3060 
3061     TString y_var_name = GetEtaPhiAxisTitle("phi");
3062     TString y_direction = fEcalNumbering->GetYDirectionEB(SMNumber);
3063 
3064     new TF1("f2", y_direction.Data(), phi_min, phi_max);
3065     fCnewRoot++;
3066     TGaxis* sup_axis_y = nullptr;
3067 
3068     if (y_direction == "-x")  // ALWAYS IN THIS CASE: ymin->ymax <=> top->bottom ("-x") direction
3069     {
3070       sup_axis_y = new TGaxis((Float_t)(size_eta * MatSize),
3071                               (Float_t)0.,
3072                               (Float_t)(size_eta * MatSize),
3073                               (Float_t)(size_phi * MatSize),
3074                               "f2",
3075                               size_phi,
3076                               "+CS",
3077                               0.);
3078       fCnewRoot++;
3079     }
3080 
3081     if (y_direction == "x")  // NEVER  IN THIS CASE: ymin->ymax <=> bottom->top ("x") direction
3082     {
3083       sup_axis_y =
3084           new TGaxis((Float_t)0., (Float_t)0., (Float_t)0., (Float_t)(size_phi * MatSize), "f2", size_phi, "BCS", 0.);
3085       fCnewRoot++;
3086     }
3087 
3088     if (sup_axis_y != nullptr) {
3089       sup_axis_y->SetTitle(y_var_name);
3090       sup_axis_y->SetTitleSize(tit_siz_y);
3091       sup_axis_y->SetTitleOffset(tit_off_y);
3092       sup_axis_y->SetLabelSize(lab_siz_y);
3093       sup_axis_y->SetLabelOffset(lab_off_y);
3094       sup_axis_y->SetTickSize(tic_siz_y);
3095       sup_axis_y->Draw("SAME");
3096     }
3097   }
3098   //...................................................... Axe j(phi) (y left)  (ViewTowerGrid)
3099 
3100   Double_t j_phi_min = fEcalNumbering->GetJPhiMin(SMNumber, n1SMTow);
3101   Double_t j_phi_max = fEcalNumbering->GetJPhiMax(SMNumber, n1SMTow);
3102 
3103   TString jy_var_name = GetEtaPhiAxisTitle("jphiTow");
3104   TString jy_direction = fEcalNumbering->GetJYDirectionEB(SMNumber);
3105 
3106   new TF1("f3", jy_direction.Data(), j_phi_min, j_phi_max);
3107   fCnewRoot++;
3108   TGaxis* sup_axis_jy = nullptr;
3109 
3110   sup_axis_jy =
3111       new TGaxis((Float_t)0., (Float_t)0., (Float_t)0., (Float_t)(size_phi * MatSize), "f3", size_phi, "SC", 0.);
3112   fCnewRoot++;
3113 
3114   sup_axis_jy->SetTitle(jy_var_name);
3115   sup_axis_jy->SetTitleSize(tit_siz_y);
3116   sup_axis_jy->SetTitleOffset(tit_off_y);
3117   sup_axis_jy->SetLabelSize(lab_siz_y);
3118   sup_axis_jy->SetLabelOffset(lab_off_y);
3119   sup_axis_jy->SetTickSize(tic_siz_y);
3120   sup_axis_jy->Draw("SAME");
3121 }  // end of ViewTowerGrid
3122 
3123 //===============================================================================
3124 //
3125 //                           ViewSCGrid
3126 //              independent of the ROOT file => DeeNumber as argument
3127 //
3128 //===============================================================================
3129 void TEcnaHistos::ViewSCGrid(const Int_t& DeeNumber,
3130                              const Int_t& n1DeeSCEcna,
3131                              const Int_t& MatSize,
3132                              const Int_t& size_IX,
3133                              const Int_t& size_IY,
3134                              const TString& chopt) {
3135   //Grid of one SC with axis IX and IY
3136   //.......................... lignes verticales
3137   Double_t xline = 0.;
3138 
3139   Double_t yline_bot = 0.;
3140   Double_t yline_top = (Double_t)(MatSize * size_IX);
3141 
3142   for (Int_t i = 0; i < size_IX; i++) {
3143     xline = xline + (Double_t)MatSize;
3144     TLine* lin;
3145     lin = new TLine(xline, yline_bot, xline, yline_top);
3146     fCnewRoot++;
3147     lin->Draw();
3148     // delete lin;             fCdeleteRoot++;
3149   }
3150   //............................. lignes horizontales
3151   Double_t xline_left = 0;
3152   Double_t xline_right = (Double_t)(MatSize * size_IX);
3153 
3154   Double_t yline = -(Double_t)MatSize;
3155 
3156   for (Int_t j = 0; j < size_IX + 1; j++) {
3157     yline = yline + (Double_t)MatSize;
3158     TLine* lin;
3159     lin = new TLine(xline_left, yline, xline_right, yline);
3160     fCnewRoot++;
3161     lin->Draw();
3162     // delete lin;             fCdeleteRoot++;
3163   }
3164 
3165   //------------------ trace axes en IX et IY --------------- ViewSCGrid
3166 
3167   //...................................................... Axe i(IX) (x bottom)  (ViewSCGrid)
3168 
3169   Double_t IX_min = fEcalNumbering->GetIIXMin(n1DeeSCEcna) - 0.5;
3170   Double_t IX_max = fEcalNumbering->GetIIXMax(n1DeeSCEcna) + 0.5;
3171 
3172   Float_t axis_x_inf = 0;
3173   Float_t axis_x_sup = 0;
3174   Float_t axis_y_inf = 0;
3175   Float_t axis_y_sup = 0;
3176   Int_t axis_nb_div = 1;
3177   Double_t IX_values_min = 0;
3178   Double_t IX_values_max = 0;
3179   Option_t* axis_chopt = "CS";
3180 
3181   Float_t tit_siz_x = fCnaParHistos->AxisTitleSize();
3182   Float_t lab_siz_x = fCnaParHistos->AxisLabelSize();
3183   Float_t tic_siz_x = fCnaParHistos->AxisTickSize();
3184   Float_t tit_off_x = fCnaParHistos->AxisTitleOffset("SCx");
3185   Float_t lab_off_x = fCnaParHistos->AxisLabelOffset("SCx");
3186 
3187   TString StrDee = "iIXSC";
3188   if (DeeNumber == 1) {
3189     StrDee = "iIXDee1";
3190   }
3191   if (DeeNumber == 2) {
3192     StrDee = "iIXDee2";
3193   }
3194   if (DeeNumber == 3) {
3195     StrDee = "iIXDee3";
3196   }
3197   if (DeeNumber == 4) {
3198     StrDee = "iIXDee4";
3199   }
3200 
3201   TString x_var_name = GetIXIYAxisTitle(StrDee.Data());
3202   TString x_direction = fEcalNumbering->GetXDirectionEE(DeeNumber);
3203 
3204   TGaxis* sup_axis_x = nullptr;
3205 
3206   if (DeeNumber == 1)  //  -xmin -> -xmax <=> left->right
3207   {
3208     axis_x_inf = 0;
3209     axis_y_inf = 0;
3210     axis_x_sup = size_IX * MatSize;
3211     axis_y_sup = 0;
3212     axis_nb_div = size_IX;
3213     IX_values_min = -IX_min;
3214     IX_values_max = -IX_max;
3215     axis_chopt = "CS";
3216   }
3217   if (DeeNumber == 2)  //  xmin -> xmax <=> right->left
3218   {
3219     axis_x_inf = 0;
3220     axis_y_inf = 0;
3221     axis_x_sup = size_IX * MatSize;
3222     axis_y_sup = 0;
3223     axis_nb_div = size_IX;
3224     IX_values_min = IX_min;
3225     IX_values_max = IX_max;
3226     axis_chopt = "CS";
3227   }
3228   if (DeeNumber == 3)  //  xmin -> xmax <=>  left->right
3229   {
3230     axis_x_inf = 0;
3231     axis_y_inf = 0;
3232     axis_x_sup = size_IX * MatSize;
3233     axis_y_sup = 0;
3234     axis_nb_div = size_IX;
3235     IX_values_min = IX_min;
3236     IX_values_max = IX_max;
3237     axis_chopt = "CS";
3238   }
3239   if (DeeNumber == 4)  //  -xmin -> -xmax <=> right->left
3240   {
3241     axis_x_inf = 0;
3242     axis_y_inf = 0;
3243     axis_x_sup = size_IX * MatSize;
3244     axis_y_sup = 0;
3245     axis_nb_div = size_IX;
3246     IX_values_min = -IX_min;
3247     IX_values_max = -IX_max;
3248     axis_chopt = "CS";
3249   }
3250 
3251   new TF1("f1", x_direction.Data(), IX_values_min, IX_values_max);
3252   fCnewRoot++;
3253   sup_axis_x = new TGaxis(axis_x_inf, axis_y_inf, axis_x_sup, axis_y_sup, "f1", axis_nb_div, axis_chopt, 0.);
3254   fCnewRoot++;
3255 
3256   sup_axis_x->SetTitle(x_var_name);
3257   sup_axis_x->SetTitleSize(tit_siz_x);
3258   sup_axis_x->SetTitleOffset(tit_off_x);
3259   sup_axis_x->SetLabelSize(lab_siz_x);
3260   sup_axis_x->SetLabelOffset(lab_off_x);
3261   sup_axis_x->SetTickSize(tic_siz_x);  // <===== NE MARCHE QU'AVEC L'OPTION "S"
3262   sup_axis_x->Draw("SAME");
3263 
3264   //...................................................... Axe j(IY) (ViewSCGrid)
3265 
3266   Float_t tit_siz_y = fCnaParHistos->AxisTitleSize();
3267   Float_t lab_siz_y = fCnaParHistos->AxisLabelSize();
3268   Float_t tic_siz_y = fCnaParHistos->AxisTickSize();
3269   Float_t tit_off_y = fCnaParHistos->AxisTitleOffset("SCy");
3270   Float_t lab_off_y = fCnaParHistos->AxisLabelOffset("SCy");
3271 
3272   Double_t j_IY_min = fEcalNumbering->GetJIYMin(DeeNumber, n1DeeSCEcna) - 0.5;
3273   Double_t j_IY_max = fEcalNumbering->GetJIYMax(DeeNumber, n1DeeSCEcna) + 0.5;
3274 
3275   TString jy_var_name = GetIXIYAxisTitle("jIYSC");
3276   TString jy_direction = fEcalNumbering->GetJYDirectionEE(DeeNumber);
3277 
3278   new TF1("f2", jy_direction.Data(), j_IY_min, j_IY_max);
3279   fCnewRoot++;
3280 
3281   TGaxis* sup_axis_jy =
3282       new TGaxis((Float_t)0., (Float_t)0., (Float_t)0., (Float_t)(size_IY * MatSize), "f2", size_IY, "CS", 0.);
3283   fCnewRoot++;
3284 
3285   sup_axis_jy->SetTitle(jy_var_name);
3286   sup_axis_jy->SetTitleSize(tit_siz_y);
3287   sup_axis_jy->SetTitleOffset(tit_off_y);
3288   sup_axis_jy->SetLabelSize(lab_siz_y);
3289   sup_axis_jy->SetLabelOffset(lab_off_y);
3290   sup_axis_jy->SetTickSize(tic_siz_y);  // <===== NE MARCHE QU'AVEC L'OPTION "S"
3291   sup_axis_jy->Draw();
3292 
3293 }  // end of ViewSCGrid
3294 
3295 //=======================================================================================
3296 //
3297 //                              ViewStex(***)
3298 //
3299 //           (Hoco,Veco) matrices for all the Stins of a Stex
3300 //
3301 //     arg_read_histo:    1D array containing the quantity for each channel in the Stex
3302 //                        (dim = MaxCrysInStex())
3303 //     arg_AlreadyRead:   =1 <=> arg_read_histo
3304 //                        =0 <=> read the 1D array in this method with TEcnaRead
3305 //
3306 //      HistoCode:        code for the plotted quantity
3307 //
3308 //=======================================================================================
3309 void TEcnaHistos::ViewStex(const TVectorD& arg_read_histo, const Int_t& arg_AlreadyRead, const TString& HistoCode) {
3310   // (Hoco, Veco) matrices for all the Stins of a Stex
3311 
3312   Bool_t OKFileExists = kFALSE;
3313   Bool_t OKData = kFALSE;
3314 
3315   Int_t n1StexStin = -1;
3316 
3317   if (arg_AlreadyRead == fTobeRead) {
3318     fMyRootFile->PrintNoComment();
3319     fMyRootFile->FileParameters(fFapAnaType,
3320                                 fFapNbOfSamples,
3321                                 fFapRunNumber,
3322                                 fFapFirstReqEvtNumber,
3323                                 fFapLastReqEvtNumber,
3324                                 fFapReqNbOfEvts,
3325                                 fFapStexNumber,
3326                                 fCfgResultsRootFilePath.Data());
3327 
3328     if (fMyRootFile->LookAtRootFile() == kTRUE) {
3329       OKFileExists = kTRUE;
3330     }
3331 
3332     if (OKFileExists == kTRUE) {
3333       fFapNbOfEvts = fMyRootFile->GetNumberOfEvents(fFapReqNbOfEvts, fFapStexNumber);
3334       TString fp_name_short = fMyRootFile->GetRootFileNameShort();
3335       // std::cout << "*TEcnaHistos::ViewStex(...)> Data are analyzed from file ----> "
3336       //      << fp_name_short << std::endl;
3337 
3338       fStartDate = fMyRootFile->GetStartDate();
3339       fStopDate = fMyRootFile->GetStopDate();
3340       fRunType = fMyRootFile->GetRunType();
3341     }
3342   }
3343   if (arg_AlreadyRead >= 1) {
3344     OKFileExists = kTRUE;
3345   }
3346 
3347   if (OKFileExists == kTRUE) {
3348     fStatusFileFound = kTRUE;
3349 
3350     //......................... matrix title    (ViewStex)
3351     char f_in_mat_tit[charArrLen];
3352     sprintf(f_in_mat_tit, "?");
3353 
3354     if (HistoCode == "D_NOE_ChNb") {
3355       sprintf(f_in_mat_tit, "Number of events");
3356     }
3357     if (HistoCode == "D_Ped_ChNb") {
3358       sprintf(f_in_mat_tit, "Pedestals");
3359     }
3360     if (HistoCode == "D_TNo_ChNb") {
3361       sprintf(f_in_mat_tit, "Total noise");
3362     }
3363     if (HistoCode == "D_MCs_ChNb") {
3364       sprintf(f_in_mat_tit, "Mean cor(s,s')");
3365     }
3366     if (HistoCode == "D_LFN_ChNb") {
3367       sprintf(f_in_mat_tit, "Low frequency noise");
3368     }
3369     if (HistoCode == "D_HFN_ChNb") {
3370       sprintf(f_in_mat_tit, "High frequency noise");
3371     }
3372     if (HistoCode == "D_SCs_ChNb") {
3373       sprintf(f_in_mat_tit, "Sigma of cor(s,s')");
3374     }
3375 
3376     //................................. Axis parameters
3377     Int_t GeoBidSizeHoco = fEcal->MaxStinHocoInStex() * fEcal->MaxCrysHocoInStin();
3378     Int_t GeoBidSizeVeco = fEcal->MaxStinVecoInStex() * fEcal->MaxCrysVecoInStin();
3379 
3380     Int_t nb_binx = GeoBidSizeHoco;
3381     Int_t nb_biny = GeoBidSizeVeco;
3382     Axis_t xinf_bid = (Axis_t)0.;
3383     Axis_t xsup_bid = (Axis_t)GeoBidSizeHoco;
3384     Axis_t yinf_bid = (Axis_t)0.;
3385     Axis_t ysup_bid = (Axis_t)GeoBidSizeVeco;
3386 
3387     TString axis_x_var_name = "  #Hoco  ";
3388     TString axis_y_var_name = "  #Veco  ";
3389 
3390     //............. matrices reading and histogram filling   (ViewStex)
3391 
3392     TH2D* h_geo_bid =
3393         new TH2D("geobidim_ViewStex", f_in_mat_tit, nb_binx, xinf_bid, xsup_bid, nb_biny, yinf_bid, ysup_bid);
3394     fCnewRoot++;
3395 
3396     h_geo_bid->Reset();
3397 
3398     //............................................... 1D histo reading  (ViewStex)
3399     TVectorD partial_histp(fEcal->MaxCrysEcnaInStex());
3400     for (Int_t i = 0; i < fEcal->MaxCrysEcnaInStex(); i++) {
3401       partial_histp(i) = (Double_t)0.;
3402     }
3403 
3404     if (arg_AlreadyRead == fTobeRead) {
3405       if (HistoCode == "D_NOE_ChNb") {
3406         partial_histp = fMyRootFile->ReadNumberOfEvents(fEcal->MaxCrysEcnaInStex());
3407       }
3408       if (HistoCode == "D_Ped_ChNb") {
3409         partial_histp = fMyRootFile->ReadPedestals(fEcal->MaxCrysEcnaInStex());
3410       }
3411       if (HistoCode == "D_TNo_ChNb") {
3412         partial_histp = fMyRootFile->ReadTotalNoise(fEcal->MaxCrysEcnaInStex());
3413       }
3414       if (HistoCode == "D_MCs_ChNb") {
3415         partial_histp = fMyRootFile->ReadMeanCorrelationsBetweenSamples(fEcal->MaxCrysEcnaInStex());
3416       }
3417       if (HistoCode == "D_LFN_ChNb") {
3418         partial_histp = fMyRootFile->ReadLowFrequencyNoise(fEcal->MaxCrysEcnaInStex());
3419       }
3420       if (HistoCode == "D_HFN_ChNb") {
3421         partial_histp = fMyRootFile->ReadHighFrequencyNoise(fEcal->MaxCrysEcnaInStex());
3422       }
3423       if (HistoCode == "D_SCs_ChNb") {
3424         partial_histp = fMyRootFile->ReadSigmaOfCorrelationsBetweenSamples(fEcal->MaxCrysEcnaInStex());
3425       }
3426 
3427       OKData = fMyRootFile->DataExist();
3428     }
3429 
3430     if (arg_AlreadyRead >= 1) {
3431       partial_histp = arg_read_histo;
3432       OKData = kTRUE;
3433     }
3434 
3435     //------------------------------- Build 2D matrix to be ploted from 1D read histo  (ViewStex)
3436     TMatrixD read_matrix(nb_binx, nb_biny);
3437     for (Int_t i = 0; i < nb_binx; i++) {
3438       for (Int_t j = 0; j < nb_biny; j++) {
3439         read_matrix(i, j) = (Double_t)0.;
3440       }
3441     }
3442 
3443     if (OKData == kTRUE) {
3444       fStatusDataExist = kTRUE;
3445 
3446       for (Int_t i0StexStinEcna = 0; i0StexStinEcna < fEcal->MaxStinEcnaInStex(); i0StexStinEcna++) {
3447         if (arg_AlreadyRead == fTobeRead) {
3448           n1StexStin = fMyRootFile->GetStexStinFromIndex(i0StexStinEcna);
3449         }
3450         if (arg_AlreadyRead >= 1) {
3451           n1StexStin = i0StexStinEcna + 1;
3452         }
3453 
3454         if (n1StexStin != -1) {
3455           //------------------ Geographical bidim filling   (ViewStex)
3456           for (Int_t i0StinEcha = 0; i0StinEcha < fEcal->MaxCrysInStin(); i0StinEcha++) {
3457             Int_t iStexEcha = (n1StexStin - 1) * fEcal->MaxCrysInStin() + i0StinEcha;
3458             Int_t i_xgeo = GetXCrysInStex(fFapStexNumber, n1StexStin, i0StinEcha);
3459             Int_t i_ygeo = GetYCrysInStex(fFapStexNumber, n1StexStin, i0StinEcha);
3460 
3461             if (i_xgeo >= 0 && i_xgeo < nb_binx && i_ygeo >= 0 && i_ygeo < nb_biny) {
3462               read_matrix(i_xgeo, i_ygeo) = partial_histp(iStexEcha);
3463               h_geo_bid->Fill((Double_t)i_xgeo, (Double_t)i_ygeo, (Double_t)read_matrix(i_xgeo, i_ygeo));
3464             }
3465           }
3466         }
3467       }
3468 
3469       //===============  H I S T O   M I N / M A X   M A N A G E M E N T ============  (ViewStex)
3470 
3471       //................................ Put histo min max values
3472       //.......... default if flag not set to "ON"
3473       SetYminMemoFromValue(HistoCode.Data(), fCnaParHistos->GetYminDefaultValue(HistoCode.Data()));
3474       SetYmaxMemoFromValue(HistoCode.Data(), fCnaParHistos->GetYmaxDefaultValue(HistoCode.Data()));
3475 
3476       if (fUserHistoMin == fUserHistoMax) {
3477         fFlagUserHistoMin = "AUTO";
3478         fFlagUserHistoMax = "AUTO";
3479       }
3480       //.......... user's value if flag set to "ON"
3481       if (fFlagUserHistoMin == "ON") {
3482         SetYminMemoFromValue(HistoCode.Data(), fUserHistoMin);
3483         fFlagUserHistoMin = "OFF";
3484       }
3485       if (fFlagUserHistoMax == "ON") {
3486         SetYmaxMemoFromValue(HistoCode.Data(), fUserHistoMax);
3487         fFlagUserHistoMax = "OFF";
3488       }
3489       //................................. automatic min and/or max
3490       if (fFlagUserHistoMin == "AUTO") {
3491         SetYminMemoFromValue(HistoCode.Data(), h_geo_bid->GetMinimum());
3492         fFlagUserHistoMin = "OFF";
3493       }
3494       if (fFlagUserHistoMax == "AUTO") {
3495         SetYmaxMemoFromValue(HistoCode.Data(), h_geo_bid->GetMaximum());
3496         fFlagUserHistoMax = "OFF";
3497       }
3498       //...................................... histo set ymin and ymax
3499       SetHistoFrameYminYmaxFromMemo((TH1D*)h_geo_bid, HistoCode);
3500 
3501       // ************************** A GARDER EN RESERVE *******************************
3502       //............. special contour level for correlations (square root wise scale)
3503       //if ( HistoCode == "D_MCs_ChNb" )
3504       //{
3505       //  Int_t nb_niv  = 9;
3506       //  Double_t* cont_niv = new Double_t[nb_niv];           fCnew++;
3507       //  SqrtContourLevels(nb_niv, &cont_niv[0]);
3508       //  h_geo_bid->SetContour(nb_niv, &cont_niv[0]);
3509       //  delete [] cont_niv;                                  fCdelete++;
3510       //}
3511       // ******************************** (FIN RESERVE) *******************************
3512 
3513       // =================================== P L O T S ========================   (ViewStex)
3514 
3515       char f_in[charArrLen];
3516 
3517       //...................... Taille/format canvas
3518       UInt_t canv_h = fCnaParHistos->CanvasFormatH("petit");
3519       UInt_t canv_w = fCnaParHistos->CanvasFormatW("petit");
3520 
3521       if (fFlagSubDet == "EB") {
3522         canv_h = fCnaParHistos->CanvasFormatH("etaphiSM");
3523         canv_w = fCnaParHistos->CanvasFormatW("etaphiSM");
3524       }
3525       if (fFlagSubDet == "EE") {
3526         canv_h = fCnaParHistos->CanvasFormatH("IXIYDee");
3527         canv_w = fCnaParHistos->CanvasFormatW("IXIYDee");
3528       }
3529 
3530       //............................................... paves commentaires (ViewStex)
3531       SetAllPavesViewStex(fFapStexNumber);
3532 
3533       //------------------------------------ Canvas name ----------------- (ViewStex)
3534       TString name_cov_cor;
3535       name_cov_cor.Resize(charArrLen);
3536       name_cov_cor = "?";
3537 
3538       if (HistoCode == "D_NOE_ChNb") {
3539         name_cov_cor = "Nb_Of_D_Adc_EvDs";
3540       }
3541       if (HistoCode == "D_Ped_ChNb") {
3542         name_cov_cor = "Pedestals";
3543       }
3544       if (HistoCode == "D_TNo_ChNb") {
3545         name_cov_cor = "Total_noise";
3546       }
3547       if (HistoCode == "D_MCs_ChNb") {
3548         name_cov_cor = "Mean_Corss";
3549       }
3550       if (HistoCode == "D_LFN_ChNb") {
3551         name_cov_cor = "Low_Fq_Noise";
3552       }
3553       if (HistoCode == "D_HFN_ChNb") {
3554         name_cov_cor = "High_Fq_Noise";
3555       }
3556       if (HistoCode == "D_SCs_ChNb") {
3557         name_cov_cor = "Sigma_Corss";
3558       }
3559 
3560       TString name_visu;
3561       name_visu.Resize(charArrLen);
3562       name_visu = "colz";
3563 
3564       TString flag_already_read;
3565       flag_already_read.Resize(charArrLen);
3566       flag_already_read = "?";
3567       sprintf(f_in, "M%d", arg_AlreadyRead);
3568       flag_already_read = f_in;
3569 
3570       sprintf(f_in,
3571               "%s_%s_S1_%d_R%d_%d_%d_%s%d_%s_HocoVeco_R%s",
3572               name_cov_cor.Data(),
3573               fFapAnaType.Data(),
3574               fFapNbOfSamples,
3575               fFapRunNumber,
3576               fFapFirstReqEvtNumber,
3577               fFapLastReqEvtNumber,
3578               fFapStexName.Data(),
3579               fFapStexNumber,
3580               name_visu.Data(),
3581               flag_already_read.Data());
3582 
3583       if (fFlagSubDet == "EB") {
3584         SetHistoPresentation((TH1D*)h_geo_bid, "Stex2DEB");
3585       }
3586       if (fFlagSubDet == "EE") {
3587         SetHistoPresentation((TH1D*)h_geo_bid, "Stex2DEE");
3588       }
3589 
3590       TCanvas* MainCanvas = new TCanvas(f_in, f_in, canv_w, canv_h);
3591       fCnewRoot++;
3592       fCurrentCanvas = MainCanvas;
3593       fCurrentCanvasName = f_in;
3594 
3595       // std::cout << "*TEcnaHistos::ViewStex(...)> Plot is displayed on canvas ----> " << f_in << std::endl;
3596 
3597       //------------------------ Canvas draw and update ------------ (ViewStex)
3598       if (fPavComGeneralTitle != nullptr) {
3599         fPavComGeneralTitle->Draw();
3600       }
3601       fPavComStex->Draw();
3602       fPavComAnaRun->Draw();
3603       fPavComNbOfEvts->Draw();
3604 
3605       //----------------------------------------------------------- pad margins
3606       Double_t x_low = fCnaParHistos->BoxLeftX("bottom_left_box") - 0.005;
3607       Double_t y_low = fCnaParHistos->BoxTopY("bottom_left_box") + 0.005;
3608       Double_t x_margin = x_low;
3609       Double_t y_margin = y_low;
3610       MainCanvas->Divide(1, 1, x_margin, y_margin);
3611       //           Divide(nx, ny, x_margin, y_margin,    color);
3612       gPad->cd(1);
3613       //........................... specific EE
3614       if (fFlagSubDet == "EE") {
3615         Double_t x_up = fCnaParHistos->BoxRightX("bottom_right_box") + 0.005;
3616         Double_t y_up = fCnaParHistos->BoxBottomY("top_left_box_Dee") - 0.005;
3617         TVirtualPad* main_subpad = gPad;
3618         main_subpad->SetPad(x_low, y_low, x_up, y_up);
3619       }
3620 
3621       //------------------------------------------------------------
3622       h_geo_bid->GetXaxis()->SetTitle(axis_x_var_name);
3623       h_geo_bid->GetYaxis()->SetTitle(axis_y_var_name);
3624 
3625       h_geo_bid->DrawCopy("COLZ");
3626 
3627       // trace de la grille: un rectangle = une tour ou un SC ---------------- (ViewStex)
3628       ViewStexGrid(fFapStexNumber, " ");
3629       gPad->Draw();
3630       gPad->Update();
3631 
3632       //..................... retour aux options standard
3633       Bool_t b_true = true;
3634       h_geo_bid->SetStats(b_true);
3635       h_geo_bid->Delete();
3636       h_geo_bid = nullptr;
3637       fCdeleteRoot++;
3638 
3639       //      delete MainCanvas;              fCdeleteRoot++;
3640     }  // end of if OKData == kTRUE )
3641   }    // end of if OKFileExists == kTRUE )
3642   else {
3643     fStatusFileFound = kFALSE;
3644 
3645     std::cout << "!TEcnaHistos::ViewStex(...)> *ERROR* =====> "
3646               << " ROOT file not found" << fTTBELL << std::endl;
3647   }
3648 }  // end of ViewStex(...)
3649 
3650 //===========================================================================
3651 //
3652 //                       StexHocoVecoLHFCorcc(***)
3653 //
3654 //     Geographical view of the cor(c,c) matrices (mean over samples) of
3655 //     all (Stin_A,Stin_A) [case A=B only] of a given Stex (BIG MATRIX)
3656 //
3657 //===========================================================================
3658 void TEcnaHistos::StexHocoVecoLHFCorcc(const TString& Freq) {
3659   // (Hoco, Veco) matrices for all the Stins of a Stex
3660 
3661   fMyRootFile->PrintNoComment();
3662   fMyRootFile->FileParameters(fFapAnaType,
3663                               fFapNbOfSamples,
3664                               fFapRunNumber,
3665                               fFapFirstReqEvtNumber,
3666                               fFapLastReqEvtNumber,
3667                               fFapReqNbOfEvts,
3668                               fFapStexNumber,
3669                               fCfgResultsRootFilePath.Data());
3670 
3671   if (fMyRootFile->LookAtRootFile() == kTRUE)  // (StexHocoVecoLHFCorcc)
3672   {
3673     fStatusFileFound = kTRUE;
3674 
3675     fFapNbOfEvts = fMyRootFile->GetNumberOfEvents(fFapReqNbOfEvts, fFapStexNumber);
3676     TString fp_name_short = fMyRootFile->GetRootFileNameShort();
3677     //std::cout << "*TEcnaHistos::StexHocoVecoLHFCorcc(...)> Data are analyzed from file ----> "
3678     //     << fp_name_short << std::endl;
3679 
3680     fStartDate = fMyRootFile->GetStartDate();
3681     fStopDate = fMyRootFile->GetStopDate();
3682     fRunType = fMyRootFile->GetRunType();
3683 
3684     //......................... matrix title
3685     char f_in_mat_tit[charArrLen];
3686 
3687     if (fFlagSubDet == "EB" && Freq == "LF") {
3688       sprintf(f_in_mat_tit, "LF Cor(Xtal,Xtal') for each tower in SM");
3689     }
3690     if (fFlagSubDet == "EB" && Freq == "HF") {
3691       sprintf(f_in_mat_tit, "HF Cor(Xtal,Xtal') for each tower in SM");
3692     }
3693     if (fFlagSubDet == "EE" && Freq == "LF") {
3694       sprintf(f_in_mat_tit, "LF Cor(Xtal,Xtal') for each SC in Dee");
3695     }
3696     if (fFlagSubDet == "EE" && Freq == "HF") {
3697       sprintf(f_in_mat_tit, "HF Cor(Xtal,Xtal') for each SC in Dee");
3698     }
3699 
3700     //................................. Axis parameters
3701     Int_t GeoBidSizeHoco = fEcal->MaxStinHocoInStex() * fEcal->MaxCrysInStin();
3702     Int_t GeoBidSizeVeco = fEcal->MaxStinVecoInStex() * fEcal->MaxCrysInStin();
3703 
3704     Int_t nb_binx = GeoBidSizeHoco;
3705     Int_t nb_biny = GeoBidSizeVeco;
3706     Axis_t xinf_bid = (Axis_t)0.;
3707     Axis_t xsup_bid = (Axis_t)GeoBidSizeHoco;
3708     Axis_t yinf_bid = (Axis_t)0.;
3709     Axis_t ysup_bid = (Axis_t)GeoBidSizeVeco;
3710 
3711     TString axis_x_var_name = "  #Hoco  ";
3712     TString axis_y_var_name = "  #varVeco  ";
3713 
3714     //======================================================== (StexHocoVecoLHFCorcc)
3715     TVectorD Stin_numbers(fEcal->MaxStinEcnaInStex());
3716     for (Int_t i = 0; i < fEcal->MaxStinEcnaInStex(); i++) {
3717       Stin_numbers(i) = (Double_t)0.;
3718     }
3719     Stin_numbers = fMyRootFile->ReadStinNumbers(fEcal->MaxStinEcnaInStex());
3720 
3721     if (fMyRootFile->DataExist() == kTRUE) {
3722       fStatusDataExist = kTRUE;
3723 
3724       //............. matrices reading and histogram filling
3725       TMatrixD partial_matrix(fEcal->MaxCrysEcnaInStex(), fEcal->MaxCrysEcnaInStex());
3726       for (Int_t i = 0; i < fEcal->MaxCrysEcnaInStex(); i++) {
3727         for (Int_t j = 0; j < fEcal->MaxCrysEcnaInStex(); j++) {
3728           partial_matrix(i, j) = (Double_t)0.;
3729         }
3730       }
3731 
3732       if (Freq == "LF") {
3733         partial_matrix = fMyRootFile->ReadLowFrequencyCorrelationsBetweenChannels(fEcal->MaxCrysEcnaInStex());
3734       }
3735       if (Freq == "HF") {
3736         partial_matrix = fMyRootFile->ReadHighFrequencyCorrelationsBetweenChannels(fEcal->MaxCrysEcnaInStex());
3737       }
3738 
3739       if (fMyRootFile->DataExist() == kTRUE) {
3740         fStatusDataExist = kTRUE;
3741 
3742         //............................... 2D histo booking
3743         TH2D* h_geo_bid = new TH2D(
3744             "geobidim_HocoVecoLHFCorcc", f_in_mat_tit, nb_binx, xinf_bid, xsup_bid, nb_biny, yinf_bid, ysup_bid);
3745         fCnewRoot++;
3746         h_geo_bid->Reset();
3747 
3748         fFapStexBarrel = fEcalNumbering->GetStexHalfStas(fFapStexNumber);
3749 
3750         for (Int_t i0StexStinEcna = 0; i0StexStinEcna < fEcal->MaxStinEcnaInStex(); i0StexStinEcna++) {
3751           Int_t n1StexStin = (Int_t)Stin_numbers(i0StexStinEcna);
3752           Int_t offset_x = ((n1StexStin - 1) / fEcal->MaxStinVecoInStex()) * fEcal->MaxCrysInStin();
3753           Int_t offset_y = ((n1StexStin - 1) % fEcal->MaxStinVecoInStex()) * fEcal->MaxCrysInStin();
3754 
3755           if (n1StexStin != -1) {
3756             //================================================= (StexHocoVecoLHFCorcc)
3757             //------------------ Geographical bidim filling
3758             for (Int_t i0StinEcha = 0; i0StinEcha < fEcal->MaxCrysInStin(); i0StinEcha++) {
3759               for (Int_t j0StinEcha = 0; j0StinEcha < fEcal->MaxCrysInStin(); j0StinEcha++) {
3760                 Int_t i_xgeo = offset_x + i0StinEcha;
3761                 Int_t i_ygeo = offset_y + j0StinEcha;
3762 
3763                 if (i_xgeo >= 0 && i_xgeo < nb_binx && i_ygeo >= 0 && i_ygeo < nb_biny) {
3764                   Int_t iEcha = (n1StexStin - 1) * fEcal->MaxCrysInStin() + i0StinEcha;
3765                   Int_t jEcha = (n1StexStin - 1) * fEcal->MaxCrysInStin() + j0StinEcha;
3766 
3767                   h_geo_bid->Fill((Double_t)i_xgeo, (Double_t)i_ygeo, (Double_t)partial_matrix(iEcha, jEcha));
3768                 }
3769               }
3770             }
3771           }
3772         }
3773 
3774         //===============  H I S T O   M I N / M A X   M A N A G E M E N T ============  (StexHocoVecoLHFCorcc)
3775 
3776         TString HistoCode = "H2CorccInStins";
3777 
3778         //................................ Put histo min max values
3779         //.......... default if flag not set to "ON"
3780         SetYminMemoFromValue(HistoCode.Data(), fCnaParHistos->GetYminDefaultValue(HistoCode.Data()));
3781         SetYmaxMemoFromValue(HistoCode.Data(), fCnaParHistos->GetYmaxDefaultValue(HistoCode.Data()));
3782 
3783         if (fUserHistoMin == fUserHistoMax) {
3784           fFlagUserHistoMin = "AUTO";
3785           fFlagUserHistoMax = "AUTO";
3786         }
3787         //.......... user's value if flag set to "ON"
3788         if (fFlagUserHistoMin == "ON") {
3789           SetYminMemoFromValue(HistoCode.Data(), fUserHistoMin);
3790           fFlagUserHistoMin = "OFF";
3791         }
3792         if (fFlagUserHistoMax == "ON") {
3793           SetYmaxMemoFromValue(HistoCode.Data(), fUserHistoMax);
3794           fFlagUserHistoMax = "OFF";
3795         }
3796         //................................. automatic min and/or max
3797         if (fFlagUserHistoMin == "AUTO") {
3798           SetYminMemoFromValue(HistoCode.Data(), h_geo_bid->GetMinimum());
3799           fFlagUserHistoMin = "OFF";
3800         }
3801         if (fFlagUserHistoMax == "AUTO") {
3802           SetYmaxMemoFromValue(HistoCode.Data(), h_geo_bid->GetMaximum());
3803           fFlagUserHistoMax = "OFF";
3804         }
3805         //...................................... histo set ymin and ymax
3806         SetHistoFrameYminYmaxFromMemo((TH1D*)h_geo_bid, HistoCode);
3807 
3808         // ----------------------------------- P L O T S   (StexHocoVecoLHFCorcc)
3809 
3810         char f_in[charArrLen];
3811 
3812         //...................... Taille/format canvas
3813 
3814         UInt_t canv_h = fCnaParHistos->CanvasFormatH("petit");
3815         UInt_t canv_w = fCnaParHistos->CanvasFormatW("petit");
3816 
3817         if (fFlagSubDet == "EB") {
3818           canv_h = fCnaParHistos->CanvasFormatH("etaphiSM");
3819           canv_w = fCnaParHistos->CanvasFormatW("etaphiSM");
3820         }
3821         if (fFlagSubDet == "EE") {
3822           canv_h = fCnaParHistos->CanvasFormatH("IXIYDee");
3823           canv_w = fCnaParHistos->CanvasFormatW("IXIYDee");
3824         }
3825 
3826         //..................................... paves commentaires (StexHocoVecoLHFCorcc)
3827         SetAllPavesViewStex(fFapStexNumber);
3828 
3829         //----------------- Canvas name ------- (StexHocoVecoLHFCorcc)
3830         TString name_cov_cor;
3831         name_cov_cor.Resize(charArrLen);
3832         if (Freq == "LF") {
3833           name_cov_cor = "StexLFCorcc";
3834         }
3835         if (Freq == "HF") {
3836           name_cov_cor = "StexHFCorcc";
3837         }
3838 
3839         TString name_visu;
3840         name_visu.Resize(charArrLen);
3841         name_visu = "colz";
3842 
3843         sprintf(f_in,
3844                 "%s_%s_S1_%d_R%d_%d_%d_Stex%s%d_%s_HocoVeco",
3845                 name_cov_cor.Data(),
3846                 fFapAnaType.Data(),
3847                 fFapNbOfSamples,
3848                 fFapRunNumber,
3849                 fFapFirstReqEvtNumber,
3850                 fFapLastReqEvtNumber,
3851                 fFapStexName.Data(),
3852                 fFapStexNumber,
3853                 name_visu.Data());
3854 
3855         if (fFlagSubDet == "EB") {
3856           SetHistoPresentation((TH1D*)h_geo_bid, "Stex2DEB");
3857         }
3858         if (fFlagSubDet == "EE") {
3859           SetHistoPresentation((TH1D*)h_geo_bid, "Stex2DEE");
3860         }
3861 
3862         TCanvas* MainCanvas = new TCanvas(f_in, f_in, canv_w, canv_h);
3863         fCnewRoot++;
3864         fCurrentCanvas = MainCanvas;
3865         fCurrentCanvasName = f_in;
3866 
3867         // std::cout << "*TEcnaHistos::StexHocoVecoLHFCorcc(...)> Plot is displayed on canvas ----> "
3868         //      << f_in << std::endl;
3869 
3870         //------------ Canvas draw and update ------ (StexHocoVecoLHFCorcc)
3871         if (fPavComGeneralTitle != nullptr) {
3872           fPavComGeneralTitle->Draw();
3873         }
3874         fPavComStex->Draw();
3875         fPavComAnaRun->Draw();
3876         fPavComNbOfEvts->Draw();
3877 
3878         //----------------------------------------------------------- pad margins
3879         Double_t x_low = fCnaParHistos->BoxLeftX("bottom_left_box") - 0.005;
3880         Double_t y_low = fCnaParHistos->BoxTopY("bottom_left_box") + 0.005;
3881         Double_t x_margin = x_low;
3882         Double_t y_margin = y_low;
3883         MainCanvas->Divide(1, 1, x_margin, y_margin);
3884         //           Divide(nx, ny, x_margin, y_margin,    color);
3885         gPad->cd(1);
3886         //........................... specific EE
3887         if (fFlagSubDet == "EE") {
3888           Double_t x_up = fCnaParHistos->BoxRightX("bottom_right_box") + 0.005;
3889           Double_t y_up = fCnaParHistos->BoxBottomY("top_left_box_Dee") - 0.005;
3890           TVirtualPad* main_subpad = gPad;
3891           main_subpad->SetPad(x_low, y_low, x_up, y_up);
3892         }
3893 
3894         h_geo_bid->GetXaxis()->SetTitle(axis_x_var_name);
3895         h_geo_bid->GetYaxis()->SetTitle(axis_y_var_name);
3896 
3897         h_geo_bid->DrawCopy("COLZ");
3898 
3899         // trace de la grille: un rectangle = une tour (StexHocoVecoLHFCorcc)
3900         ViewStexGrid(fFapStexNumber, "corcc");
3901         gPad->Draw();
3902         gPad->Update();
3903 
3904         //..................... retour aux options standard
3905         Bool_t b_true = true;
3906         h_geo_bid->SetStats(b_true);
3907         h_geo_bid->Delete();
3908         h_geo_bid = nullptr;
3909         fCdeleteRoot++;
3910 
3911         //      delete MainCanvas;              fCdeleteRoot++;
3912       }
3913     }
3914   }  // end of if ( fMyRootFile->LookAtRootFile() == kTRUE )
3915   else {
3916     fStatusFileFound = kFALSE;
3917 
3918     std::cout << "!TEcnaHistos::StexHocoVecoLHFCorcc(...)> *ERROR* =====> "
3919               << " ROOT file not found" << fTTBELL << std::endl;
3920   }
3921 }  // end of StexHocoVecoLHFCorcc
3922 
3923 //==================================================================================
3924 //
3925 //                          GetXCrysInStex, GetYCrysInStex
3926 //
3927 //==================================================================================
3928 Int_t TEcnaHistos::GetXCrysInStex(const Int_t& StexNumber, const Int_t& n1StexStin, const Int_t& i0StinEcha) {
3929   //Gives the X crystal coordinate in the geographic view of one Stex
3930   // (X = 0 to MaxStinHocoInStex*NbCrysHocoInStin - 1)
3931 
3932   Int_t ix_geo = 0;
3933 
3934   if (fFlagSubDet == "EB") {
3935     TString ctype = fEcalNumbering->GetStexHalfStas(StexNumber);
3936     Int_t n1StexCrys = fEcalNumbering->Get1StexCrysFrom1StexStinAnd0StinEcha(n1StexStin, i0StinEcha, StexNumber);
3937     ix_geo = (n1StexCrys - 1) / fEcal->MaxCrysVecoInStex();  // ix_geo for EB+
3938     if (ctype == "EB-") {
3939       ix_geo = fEcal->MaxCrysHocoInStex() - ix_geo - 1;
3940     }
3941   }
3942 
3943   if (fFlagSubDet == "EE") {
3944     TString DeeDir = fEcalNumbering->GetDeeDirViewedFromIP(StexNumber);
3945     ix_geo = 0;
3946     if (DeeDir == "right") {
3947       ix_geo = fEcalNumbering->GetIXCrysInDee(StexNumber, n1StexStin, i0StinEcha) - 1;
3948     }
3949     if (DeeDir == "left") {
3950       ix_geo = fEcal->MaxCrysIXInDee() - fEcalNumbering->GetIXCrysInDee(StexNumber, n1StexStin, i0StinEcha);
3951     }
3952   }
3953 
3954   return ix_geo;
3955 }
3956 
3957 Int_t TEcnaHistos::GetYCrysInStex(const Int_t& StexNumber, const Int_t& n1StexStin, const Int_t& j0StinEcha) {
3958   //Gives the Y crystal coordinate in the geographic view of one Stex
3959   // (Y = 0 to MaxStinVecoInStex*NbCrysVecoInStin - 1)
3960 
3961   Int_t iy_geo = 0;
3962 
3963   if (fFlagSubDet == "EB") {
3964     TString ctype = fEcalNumbering->GetStexHalfStas(StexNumber);
3965     Int_t n1StexCrys = fEcalNumbering->Get1StexCrysFrom1StexStinAnd0StinEcha(n1StexStin, j0StinEcha, StexNumber);
3966     Int_t ix_geo = (n1StexCrys - 1) / fEcal->MaxCrysVecoInStex();   // ix_geo for EB+
3967     iy_geo = n1StexCrys - 1 - ix_geo * fEcal->MaxCrysVecoInStex();  // iy_geo for EB+
3968     if (ctype == "EB-") {
3969       iy_geo = fEcal->MaxCrysVecoInStex() - iy_geo - 1;
3970     }
3971   }
3972 
3973   if (fFlagSubDet == "EE") {
3974     iy_geo = fEcalNumbering->GetJYCrysInDee(StexNumber, n1StexStin, j0StinEcha) - 1;
3975   }
3976 
3977   return iy_geo;
3978 }
3979 
3980 //===========================================================================
3981 //
3982 //     StexStinNumbering, ViewStexStinNumberingPad
3983 //
3984 //              independent of the ROOT file => StexNumber as argument
3985 //
3986 //===========================================================================
3987 void TEcnaHistos::StexStinNumbering(const Int_t& StexNumber) {
3988   //display the Stin numbering of the Stex
3989 
3990   if (fFlagSubDet == "EB") {
3991     SMTowerNumbering(StexNumber);
3992   }
3993   if (fFlagSubDet == "EE") {
3994     DeeSCNumbering(StexNumber);
3995   }
3996 }
3997 // end of StexStinNumbering
3998 
3999 //=============================================================================
4000 //
4001 //                   ViewStexStinNumberingPad
4002 //            independent of the ROOT file => StexNumber as argument
4003 //
4004 //=============================================================================
4005 void TEcnaHistos::ViewStexStinNumberingPad(const Int_t& StexNumber) {
4006   //display the Stin numbering of the Stex in a Pad
4007 
4008   if (fFlagSubDet == "EB") {
4009     ViewSMTowerNumberingPad(StexNumber);
4010   }
4011   if (fFlagSubDet == "EE") {
4012     ViewDeeSCNumberingPad(StexNumber);
4013   }
4014 }
4015 //---------------->  end of ViewStexStinNumberingPad()
4016 
4017 //==========================================================================
4018 //
4019 //                       ViewStexGrid
4020 //              independent of the ROOT file => StexNumber as argument
4021 //
4022 //==========================================================================
4023 void TEcnaHistos::ViewStexGrid(const Int_t& StexNumber, const TString& c_option) {
4024   //Grid of one Stex with axis Hoco and Veco
4025 
4026   if (fFlagSubDet == "EB") {
4027     ViewSMGrid(StexNumber, c_option);
4028   }
4029   if (fFlagSubDet == "EE") {
4030     ViewDeeGrid(StexNumber, c_option);
4031   }
4032 
4033 }  // end of ViewStexGrid
4034 
4035 //&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&  S P E C I F I C  &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
4036 
4037 //=======================================      BARREL       ===============================
4038 void TEcnaHistos::SMTowerNumbering(const Int_t& SMNumber) {
4039   //display the tower numbering of the super-module
4040 
4041   if ((SMNumber > 0) && (SMNumber <= fEcal->MaxSMInEB())) {
4042     Int_t GeoBidSizeEta = fEcal->MaxTowEtaInSM() * fEcal->MaxCrysEtaInTow();
4043     Int_t GeoBidSizePhi = fEcal->MaxTowPhiInSM() * fEcal->MaxCrysPhiInTow();
4044 
4045     Int_t nb_binx = GeoBidSizeEta;
4046     Int_t nb_biny = GeoBidSizePhi;
4047     Axis_t xinf_bid = (Axis_t)0.;
4048     Axis_t xsup_bid = (Axis_t)GeoBidSizeEta;
4049     Axis_t yinf_bid = (Axis_t)0.;
4050     Axis_t ysup_bid = (Axis_t)GeoBidSizePhi;
4051 
4052     TString axis_x_var_name = "  #eta  ";
4053     TString axis_y_var_name = "  #varphi  ";
4054 
4055     //------------------------------------------------------------------- SMTowerNumbering
4056 
4057     //............. matrices reading and histogram filling
4058     char f_in_mat_tit[charArrLen];
4059 
4060     if (SMNumber <= fEcal->MaxSMPhiInEB()) {
4061       sprintf(f_in_mat_tit, "               SM tower numbering");
4062     }
4063     if (SMNumber > fEcal->MaxSMPhiInEB()) {
4064       sprintf(f_in_mat_tit, "          SM tower numbering     ");
4065     }
4066 
4067     // il faut tracer un bidim vide pour pouvoir tracer la grille et les axes
4068 
4069     TH2D* h_empty_bid =
4070         new TH2D("grid_bidim_eta_phi", f_in_mat_tit, nb_binx, xinf_bid, xsup_bid, nb_biny, yinf_bid, ysup_bid);
4071     fCnewRoot++;
4072     h_empty_bid->Reset();
4073 
4074     h_empty_bid->GetXaxis()->SetTitle(axis_x_var_name);
4075     h_empty_bid->GetYaxis()->SetTitle(axis_y_var_name);
4076 
4077     // ------------------------------------------------ P L O T S   (SMTowerNumbering)
4078 
4079     char f_in[charArrLen];
4080 
4081     //...................... Taille/format canvas
4082 
4083     UInt_t canv_h = fCnaParHistos->CanvasFormatH("etaphiSM");
4084     UInt_t canv_w = fCnaParHistos->CanvasFormatW("etaphiSM");
4085 
4086     //............................................... options generales
4087 
4088     fFapStexBarrel = fEcalNumbering->GetSMHalfBarrel(SMNumber);
4089 
4090     //............................................... paves commentaires (SMTowerNumbering)
4091     SetAllPavesViewStex("Numbering", SMNumber);
4092 
4093     //------------------------------------ Canvas name ----------------- (SMTowerNumbering)
4094 
4095     sprintf(f_in, "tower_numbering_for_SuperModule_SM%d", SMNumber);
4096 
4097     SetHistoPresentation((TH1D*)h_empty_bid, "Stex2DEB");
4098 
4099     TCanvas* MainCanvas = new TCanvas(f_in, f_in, canv_w, canv_h);
4100     fCnewRoot++;
4101     fCurrentCanvas = MainCanvas;
4102     fCurrentCanvasName = f_in;
4103 
4104     // std::cout << "*TEcnaHistosEB::ViewSM(...)> Plot is displayed on canvas ----> " << f_in << std::endl;
4105 
4106     //------------------------ Canvas draw and update ------------ (SMTowerNumbering)
4107     fPavComStex->Draw();
4108 
4109     Double_t x_margin = fCnaParHistos->BoxLeftX("bottom_left_box") - 0.005;
4110     Double_t y_margin = fCnaParHistos->BoxTopY("bottom_right_box") + 0.005;
4111     MainCanvas->Divide(1, 1, x_margin, y_margin);
4112     gPad->cd(1);
4113 
4114     h_empty_bid->DrawCopy("COL");  // il faut tracer un bidim vide pour pouvoir tracer la grille et les axes
4115 
4116     ViewSMTowerNumberingPad(SMNumber);
4117     gPad->Update();
4118 
4119     //..................... retour aux options standard
4120     Bool_t b_true = true;
4121     h_empty_bid->SetStats(b_true);
4122 
4123     h_empty_bid->Delete();
4124     h_empty_bid = nullptr;
4125     fCdeleteRoot++;
4126 
4127     //      delete MainCanvas;              fCdeleteRoot++;
4128 
4129   } else {
4130     std::cout << "!TEcnaHistos::SMTowerNumbering(...)> SM = " << SMNumber << ". Out of range ( range = [1,"
4131               << fEcal->MaxSMInEB() << "] )" << fTTBELL << std::endl;
4132   }
4133 }
4134 // end of SMTowerNumbering
4135 
4136 void TEcnaHistos::ViewSMTowerNumberingPad(const Int_t& SMNumber) {
4137   //display the tower numbering of the super-module in a Pad
4138 
4139   gStyle->SetTitleW(0.2);  // taille titre histos
4140   gStyle->SetTitleH(0.07);
4141 
4142   ViewSMGrid(SMNumber, " ");
4143 
4144   Color_t couleur_rouge = fCnaParHistos->SetColorsForNumbers("lvrb_top");
4145   Color_t couleur_bleu_fonce = fCnaParHistos->SetColorsForNumbers("lvrb_bottom");
4146 
4147   //..... Ecriture des numeros de tours dans la grille..... (ViewSMTowerNumberingPad)
4148 
4149   char f_in[charArrLen];
4150   gStyle->SetTextSize(0.075);
4151 
4152   // x_channel, y_channel: coordinates of the text "Txx"
4153   Int_t y_channel = 12;
4154   Int_t x_channel = 12;
4155 
4156   Int_t max_tow_phi = fEcal->MaxTowPhiInSM() * fEcal->MaxCrysPhiInTow();
4157 
4158   //------------------ LOOP ON THE SM_TOWER NUMBER   (ViewSMTowerNumberingPad)
4159 
4160   TText* text_SMtow_num = new TText();
4161   fCnewRoot++;
4162 
4163   for (Int_t i_SMtow = 1; i_SMtow <= fEcal->MaxTowInSM(); i_SMtow++) {
4164     if (fEcalNumbering->GetTowerLvrbType(i_SMtow) == "top") {
4165       text_SMtow_num->SetTextColor(couleur_rouge);
4166     }
4167     if (fEcalNumbering->GetTowerLvrbType(i_SMtow) == "bottom") {
4168       text_SMtow_num->SetTextColor(couleur_bleu_fonce);
4169     }
4170 
4171     //................................ x from eta
4172     Double_t x_from_eta = fEcalNumbering->GetEta(SMNumber, i_SMtow, x_channel) - (Double_t)1;
4173     if (fEcalNumbering->GetSMHalfBarrel(SMNumber) == "EB-") {
4174       x_from_eta = fEcal->MaxTowEtaInSM() * fEcal->MaxCrysEtaInTow() + x_from_eta + (Double_t)1;
4175     }
4176 
4177     //................................ y from phi
4178     Double_t y_from_phi =
4179         max_tow_phi - 1 - (fEcalNumbering->GetPhi(SMNumber, i_SMtow, y_channel) - fEcalNumbering->GetPhiMin(SMNumber));
4180     if (fEcalNumbering->GetSMHalfBarrel(SMNumber) == "EB-") {
4181       y_from_phi = -y_from_phi + fEcal->MaxTowPhiInSM() * fEcal->MaxCrysPhiInTow() - (Double_t)1;
4182     }
4183 
4184     sprintf(f_in, "%d", i_SMtow);
4185     text_SMtow_num->DrawText(x_from_eta, y_from_phi, f_in);  // <=== prend du temps si on mets "T%d" dans le sprintf
4186   }
4187 
4188   text_SMtow_num->Delete();
4189   text_SMtow_num = nullptr;
4190   fCdeleteRoot++;
4191 
4192   //.................................................... legende (ViewSMTowerNumberingPad)
4193   Double_t offset_tow_tex_eta = (Double_t)8.;
4194   Double_t offset_tow_tex_phi = (Double_t)15.;
4195 
4196   Color_t couleur_noir = fCnaParHistos->ColorDefinition("noir");
4197   Double_t x_legend = (Double_t)0.;
4198   Double_t y_legend = (Double_t)0.;
4199 
4200   Int_t ref_tower = fEcal->MaxTowInSM();
4201 
4202   //.................................................  LVRB TOP (ViewSMTowerNumberingPad)
4203   gStyle->SetTextSize(0.075);
4204   gStyle->SetTextColor(couleur_rouge);
4205   x_legend = fEcalNumbering->GetEta(SMNumber, ref_tower, x_channel);
4206   y_legend = fEcalNumbering->GetPhi(SMNumber, ref_tower, y_channel) - fEcalNumbering->GetPhiMin(SMNumber);
4207 
4208   if (fEcalNumbering->GetSMHalfBarrel(SMNumber) == "EB+") {
4209     x_legend = x_legend + offset_tow_tex_eta;
4210     y_legend = y_legend + offset_tow_tex_phi;
4211   }
4212   if (fEcalNumbering->GetSMHalfBarrel(SMNumber) == "EB-") {
4213     x_legend = -x_legend + offset_tow_tex_eta;
4214     y_legend = y_legend + offset_tow_tex_phi;
4215   }
4216 
4217   sprintf(f_in, "xx");
4218   TText* text_legend_rouge = new TText(x_legend, y_legend, f_in);
4219   fCnewRoot++;
4220   text_legend_rouge->Draw();
4221   gStyle->SetTextSize(0.05);
4222   x_legend = x_legend - (Double_t)3.5;
4223   y_legend = y_legend - (Double_t)2.;
4224   sprintf(f_in, "       LVRB     ");
4225   TText* text_legend_rouge_expl = new TText(x_legend, y_legend, f_in);
4226   fCnewRoot++;
4227   text_legend_rouge_expl->Draw();
4228   y_legend = y_legend - (Double_t)1.75;
4229   if (fEcalNumbering->GetSMHalfBarrel(SMNumber) == "EB+") {
4230     sprintf(f_in, "        <---  ");
4231   }
4232   if (fEcalNumbering->GetSMHalfBarrel(SMNumber) == "EB-") {
4233     sprintf(f_in, "        --->  ");
4234   }
4235   TText* text_legend_rouge_expm = new TText(x_legend, y_legend, f_in);
4236   fCnewRoot++;
4237   text_legend_rouge_expm->Draw();
4238   //text_legend_rouge_expl->Delete();   text_legend_rouge_expl = 0;          fCdeleteRoot++;
4239 
4240   //.................................................  LVRB BOTTOM (ViewSMTowerNumberingPad)
4241   gStyle->SetTextSize(0.075);
4242   gStyle->SetTextColor(couleur_bleu_fonce);
4243   x_legend = fEcalNumbering->GetEta(SMNumber, ref_tower, x_channel);
4244   y_legend = fEcalNumbering->GetPhi(SMNumber, ref_tower, y_channel) - fEcalNumbering->GetPhiMin(SMNumber);
4245 
4246   if (fEcalNumbering->GetSMHalfBarrel(SMNumber) == "EB+") {
4247     x_legend = x_legend + offset_tow_tex_eta;
4248     y_legend = y_legend + offset_tow_tex_phi / 3;
4249   }
4250   if (fEcalNumbering->GetSMHalfBarrel(SMNumber) == "EB-") {
4251     x_legend = -x_legend + offset_tow_tex_eta;
4252     y_legend = y_legend + offset_tow_tex_phi / 3;
4253   }
4254 
4255   sprintf(f_in, "xx");
4256   TText* text_legend_bleu = new TText(x_legend, y_legend, f_in);
4257   fCnewRoot++;
4258   text_legend_bleu->Draw();
4259   //text_legend_bleu->Delete();   text_legend_bleu = 0;          fCdeleteRoot++;
4260   gStyle->SetTextSize(0.05);
4261   x_legend = x_legend - (Double_t)3.5;
4262   y_legend = y_legend - (Double_t)2.;
4263   sprintf(f_in, "       LVRB     ");
4264   TText* text_legend_bleu_expl = new TText(x_legend, y_legend, f_in);
4265   fCnewRoot++;
4266   text_legend_bleu_expl->Draw();
4267   y_legend = y_legend - (Double_t)1.75;
4268   if (fEcalNumbering->GetSMHalfBarrel(SMNumber) == "EB+") {
4269     sprintf(f_in, "        --->  ");
4270   }
4271   if (fEcalNumbering->GetSMHalfBarrel(SMNumber) == "EB-") {
4272     sprintf(f_in, "        <---  ");
4273   }
4274   TText* text_legend_bleu_expm = new TText(x_legend, y_legend, f_in);
4275   fCnewRoot++;
4276   text_legend_bleu_expm->Draw();
4277   //text_legend_bleu_expl->Delete();   text_legend_bleu_expl = 0;          fCdeleteRoot++;
4278 
4279   gStyle->SetTextColor(couleur_noir);
4280 }
4281 //---------------->  end of ViewSMTowerNumberingPad()
4282 
4283 void TEcnaHistos::ViewSMGrid(const Int_t& SMNumber, const TString& c_option) {
4284   //Grid of one supermodule with axis eta and phi
4285 
4286   Int_t GeoBidSizeEta = fEcal->MaxTowEtaInSM() * fEcal->MaxCrysEtaInTow();
4287   Int_t GeoBidSizePhi = fEcal->MaxTowPhiInSM() * fEcal->MaxCrysPhiInTow();
4288 
4289   if (c_option == "corcc") {
4290     GeoBidSizeEta = fEcal->MaxTowEtaInSM() * fEcal->MaxCrysInTow();
4291     GeoBidSizePhi = fEcal->MaxTowPhiInSM() * fEcal->MaxCrysInTow();
4292   }
4293 
4294   Int_t nb_binx = GeoBidSizeEta;
4295   Int_t nb_biny = GeoBidSizePhi;
4296   Axis_t xinf_bid = (Axis_t)0.;
4297   Axis_t xsup_bid = (Axis_t)GeoBidSizeEta;
4298   Axis_t yinf_bid = (Axis_t)0.;
4299   Axis_t ysup_bid = (Axis_t)GeoBidSizePhi;
4300 
4301   //---------------- trace de la grille: un rectangle = une tour
4302 
4303   Int_t size_eta = fEcal->MaxCrysEtaInTow();
4304   Int_t size_phi = fEcal->MaxCrysPhiInTow();
4305   if (c_option == "corcc") {
4306     size_eta = fEcal->MaxCrysInTow();
4307     size_phi = fEcal->MaxCrysInTow();
4308   }
4309   Int_t max_x = nb_binx / size_eta;
4310   Int_t max_y = nb_biny / size_phi;
4311 
4312   //............................. lignes horizontales
4313   Double_t yline = (Double_t)yinf_bid;
4314 
4315   Double_t xline_left = (Double_t)xinf_bid;
4316   Double_t xline_right = (Double_t)xsup_bid;
4317 
4318   for (Int_t j = 0; j < max_y; j++) {
4319     yline = yline + (Double_t)size_phi;
4320     TLine* lin;
4321     lin = new TLine(xline_left, yline, xline_right, yline);
4322     fCnewRoot++;
4323     lin->Draw();
4324     // delete lin;             fCdeleteRoot++;
4325   }
4326 
4327   //.......................... lignes verticales
4328   Double_t xline = (Double_t)xinf_bid - (Double_t)size_eta;
4329 
4330   Double_t yline_bot = (Double_t)yinf_bid;
4331   Double_t yline_top = (Double_t)ysup_bid;
4332 
4333   Color_t coul_surligne = fCnaParHistos->ColorDefinition("noir");
4334   Color_t coul_textmodu = fCnaParHistos->ColorDefinition("vert36");
4335 
4336   //............................ Mj text
4337   gStyle->SetTextColor(coul_textmodu);
4338   gStyle->SetTextSize(0.075);
4339 
4340   char f_in[charArrLen];
4341 
4342   for (Int_t i = 0; i < max_x; i++) {
4343     xline = xline + (Double_t)size_eta;
4344     TLine* lin;
4345     lin = new TLine(xline, yline_bot, xline, yline_top);
4346     fCnewRoot++;
4347 
4348     //............. Surlignage separateur des modules
4349     if ((fEcalNumbering->GetSMHalfBarrel(SMNumber) == "EB-") && (i == 4 || i == 8 || i == 12)) {
4350       lin->SetLineWidth(2);
4351       lin->SetLineColor(coul_surligne);
4352     }
4353     if ((fEcalNumbering->GetSMHalfBarrel(SMNumber) == "EB+") && (i == 5 || i == 9 || i == 13)) {
4354       lin->SetLineWidth(2);
4355       lin->SetLineColor(coul_surligne);
4356     }
4357 
4358     lin->Draw();
4359     // delete lin;             fCdeleteRoot++;
4360 
4361     //............. Numeros des modules
4362     if ((fEcalNumbering->GetSMHalfBarrel(SMNumber) == "EB-") && (i == 2 || i == 6 || i == 10 || i == 14)) {
4363       if (i == 2) {
4364         sprintf(f_in, "M4");
4365       }
4366       if (i == 6) {
4367         sprintf(f_in, "M3");
4368       }
4369       if (i == 10) {
4370         sprintf(f_in, "M2");
4371       }
4372       if (i == 14) {
4373         sprintf(f_in, "M1");
4374       }
4375 
4376       TText* text_num_module = new TText(xline + 1, yline_top + 1, f_in);
4377       fCnewRoot++;
4378       text_num_module->Draw();
4379       //text_num_module->Delete(); text_num_module = 0;      fCdeleteRoot++;
4380     }
4381     if ((fEcalNumbering->GetSMHalfBarrel(SMNumber) == "EB+") && (i == 3 || i == 7 || i == 11 || i == 15)) {
4382       if (i == 3) {
4383         sprintf(f_in, "M1");
4384       }
4385       if (i == 7) {
4386         sprintf(f_in, "M2");
4387       }
4388       if (i == 11) {
4389         sprintf(f_in, "M3");
4390       }
4391       if (i == 15) {
4392         sprintf(f_in, "M4");
4393       }
4394 
4395       TText* text_num_module = new TText(xline, yline_top + 1, f_in);
4396       fCnewRoot++;
4397       text_num_module->Draw();
4398       //text_num_module->Delete();  text_num_module = 0;    fCdeleteRoot++;
4399     }
4400   }
4401 
4402   //------------------ trace axes en eta et phi --------------- ViewSMGrid
4403 
4404   Int_t MatSize = fEcal->MaxCrysEtaInTow();
4405   if (c_option == "corcc") {
4406     MatSize = fEcal->MaxCrysInTow();
4407   }
4408 
4409   Int_t size_eta_sm = fEcal->MaxTowEtaInSM();
4410   Int_t size_phi_sm = fEcal->MaxTowPhiInSM();
4411 
4412   //...................................................... Axe i(eta) (bottom x) ViewSMGrid
4413   Double_t eta_min = fEcalNumbering->GetIEtaMin(SMNumber);
4414   Double_t eta_max = fEcalNumbering->GetIEtaMax(SMNumber);
4415 
4416   TString x_var_name = GetHocoVecoAxisTitle("ietaSM");
4417   ;
4418   TString x_direction = fEcalNumbering->GetXDirectionEB(SMNumber);
4419 
4420   Float_t tit_siz_x = fCnaParHistos->AxisTitleSize();
4421   Float_t lab_siz_x = fCnaParHistos->AxisLabelSize("SMx");
4422   Float_t tic_siz_x = fCnaParHistos->AxisTickSize("SMx");
4423   Float_t tit_off_x = fCnaParHistos->AxisTitleOffset("SMx");
4424   Float_t lab_off_x = fCnaParHistos->AxisLabelOffset("SMx");
4425 
4426   new TF1("f1", x_direction.Data(), eta_min, eta_max);
4427   fCnewRoot++;
4428   TGaxis* sup_axis_x = nullptr;
4429 
4430   if (x_direction == "-x")  // NEVER  IN THIS CASE: xmin->xmax <=> right->left ("-x") direction
4431   {
4432     sup_axis_x = new TGaxis(
4433         (Float_t)0., (Float_t)0., (Float_t)(size_eta_sm * MatSize), (Float_t)0., "f1", size_eta_sm, "SC", 0.);
4434     fCnewRoot++;
4435   }
4436 
4437   if (x_direction == "x")  // ALWAYS IN THIS CASE: xmin->xmax <=> left->right ("x") direction
4438   {
4439     sup_axis_x = new TGaxis(
4440         (Float_t)0., (Float_t)0., (Float_t)(size_eta_sm * MatSize), (Float_t)0., "f1", size_eta_sm, "SC", 0.);
4441     fCnewRoot++;
4442   }
4443 
4444   if (sup_axis_x != nullptr) {
4445     sup_axis_x->SetTitle(x_var_name);
4446     sup_axis_x->SetTitleSize(tit_siz_x);
4447     sup_axis_x->SetTitleOffset(tit_off_x);
4448     sup_axis_x->SetLabelSize(lab_siz_x);
4449     sup_axis_x->SetLabelOffset(lab_off_x);
4450     sup_axis_x->SetTickSize(tic_siz_x);
4451     sup_axis_x->Draw("SAME");
4452   }
4453 
4454   //...................................................... Axe phi (y) ViewSMGrid
4455   Double_t phi_min = fEcalNumbering->GetPhiMin(SMNumber);
4456   Double_t phi_max = fEcalNumbering->GetPhiMax(SMNumber);
4457 
4458   TString y_var_name = GetHocoVecoAxisTitle("phi");
4459   TString y_direction = fEcalNumbering->GetYDirectionEB(SMNumber);
4460 
4461   Float_t tit_siz_y = fCnaParHistos->AxisTitleSize();
4462   Float_t lab_siz_y = fCnaParHistos->AxisLabelSize("SMy");
4463   Float_t tic_siz_y = fCnaParHistos->AxisTickSize("SMy");
4464   Float_t tit_off_y = fCnaParHistos->AxisTitleOffset("SMy");
4465   Float_t lab_off_y = fCnaParHistos->AxisLabelOffset("SMy");
4466 
4467   new TF1("f2", y_direction.Data(), phi_min, phi_max);
4468   fCnewRoot++;
4469   TGaxis* sup_axis_y = nullptr;
4470 
4471   if (y_direction == "-x")  // ALWAYS IN THIS CASE: ymin->ymax <=> top->bottom ("-x") direction
4472   {
4473     sup_axis_y = new TGaxis(-(Float_t)1.5 * (Float_t)size_eta,
4474                             (Float_t)0.,
4475                             -(Float_t)1.5 * (Float_t)size_eta,
4476                             (Float_t)(size_phi_sm * MatSize),
4477                             "f2",
4478                             (Int_t)size_phi_sm,
4479                             "SC",
4480                             0.);
4481     fCnewRoot++;
4482   }
4483 
4484   if (y_direction == "x")  // NEVER  IN THIS CASE: ymin->ymax <=> bottom->top ("x") direction
4485   {
4486     sup_axis_y = new TGaxis(-(Float_t)1.5 * (Float_t)size_eta,
4487                             (Float_t)0.,
4488                             -(Float_t)1.5 * (Float_t)size_eta,
4489                             (Float_t)(size_phi_sm * MatSize),
4490                             "f2",
4491                             (Int_t)size_phi_sm,
4492                             "SC",
4493                             0.);
4494     fCnewRoot++;
4495   }
4496 
4497   if (sup_axis_y != nullptr) {
4498     sup_axis_y->SetTitle(y_var_name);
4499     sup_axis_y->SetTitleSize(tit_siz_y);
4500     sup_axis_y->SetTitleOffset(tit_off_y);
4501     sup_axis_y->SetLabelSize(lab_siz_y);
4502     sup_axis_y->SetLabelOffset(lab_off_y);
4503     sup_axis_y->SetTickSize(tic_siz_y);
4504     sup_axis_y->Draw("SAME");
4505   }
4506 
4507   //...................................................... Axe jphi (jy) ViewSMGrid
4508   Double_t jphi_min = fEcalNumbering->GetJPhiMin(SMNumber);
4509   Double_t jphi_max = fEcalNumbering->GetJPhiMax(SMNumber);
4510 
4511   TString jy_var_name = " ";
4512   TString jy_direction = fEcalNumbering->GetJYDirectionEB(SMNumber);
4513 
4514   new TF1("f3", jy_direction.Data(), jphi_min, jphi_max);
4515   fCnewRoot++;
4516   TGaxis* sup_axis_jy = nullptr;
4517 
4518   //............; essai
4519   sup_axis_jy = new TGaxis(
4520       (Float_t)0., (Float_t)0., (Float_t)0., (Float_t)(size_phi_sm * MatSize), "f3", (Int_t)size_phi_sm, "SC", 0.);
4521   fCnewRoot++;
4522 
4523   if (jy_direction == "-x")  // IN THIS CASE FOR EB+: ymin->ymax <=> top->bottom ("-x") direction
4524   {
4525     jy_var_name = GetEtaPhiAxisTitle("jphiSMB+");
4526   }
4527 
4528   if (jy_direction == "x")  // IN THIS CASE FOR EB-: ymin->ymax <=> bottom->top ("x") direction
4529   {
4530     jy_var_name = GetEtaPhiAxisTitle("jphiSMB-");
4531   }
4532 
4533   lab_off_y = fCnaParHistos->AxisLabelOffset("SMyInEB");
4534 
4535   sup_axis_jy->SetTitle(jy_var_name);
4536   sup_axis_jy->SetTitleSize(tit_siz_y);
4537   sup_axis_jy->SetTitleOffset(tit_off_y);
4538   sup_axis_jy->SetLabelSize(lab_siz_y);
4539   sup_axis_jy->SetLabelOffset(lab_off_y);
4540   sup_axis_jy->SetTickSize(tic_siz_y);
4541   sup_axis_jy->Draw("SAME");
4542 
4543   //--------------------------- ViewSMGrid
4544 
4545   gStyle->SetTextColor(fCnaParHistos->ColorDefinition("noir"));
4546 
4547 }  // end of ViewSMGrid
4548 
4549 //=======================================      ENDCAP       ===============================
4550 void TEcnaHistos::DeeSCNumbering(const Int_t& DeeNumber) {
4551   //display the SC numbering of the Dee
4552 
4553   if ((DeeNumber > 0) && (DeeNumber <= fEcal->MaxDeeInEE())) {
4554     Int_t GeoBidSizeIX = fEcal->MaxSCIXInDee() * fEcal->MaxCrysIXInSC();
4555     Int_t GeoBidSizeIY = fEcal->MaxSCIYInDee() * fEcal->MaxCrysIYInSC();
4556 
4557     Int_t nb_binx = GeoBidSizeIX;
4558     Int_t nb_biny = GeoBidSizeIY;
4559     Axis_t xinf_bid = (Axis_t)0.;
4560     Axis_t xsup_bid = (Axis_t)GeoBidSizeIX;
4561     Axis_t yinf_bid = (Axis_t)0.;
4562     Axis_t ysup_bid = (Axis_t)GeoBidSizeIY;
4563 
4564     TString axis_x_var_name = "  IX  ";
4565     TString axis_y_var_name = "  IY  ";
4566 
4567     //------------------------------------------------------------------- DeeSCNumbering
4568 
4569     //........................................... empty histogram filling
4570     char f_in_mat_tit[charArrLen];
4571 
4572     sprintf(f_in_mat_tit, " Dee SC numbering ");
4573 
4574     // il faut tracer un bidim vide pour pouvoir tracer la grille et les axes
4575 
4576     TH2D* h_empty_bid =
4577         new TH2D("grid_bidim_IX_IY", f_in_mat_tit, nb_binx, xinf_bid, xsup_bid, nb_biny, yinf_bid, ysup_bid);
4578     fCnewRoot++;
4579 
4580     h_empty_bid->Reset();
4581 
4582     h_empty_bid->GetXaxis()->SetTitle(axis_x_var_name);
4583     h_empty_bid->GetYaxis()->SetTitle(axis_y_var_name);
4584 
4585     // ------------------------------------------------ P L O T S   (DeeSCNumbering)
4586 
4587     char f_in[charArrLen];
4588 
4589     //...................... Taille/format canvas
4590 
4591     UInt_t canv_h = fCnaParHistos->CanvasFormatH("IXIYDee");
4592     UInt_t canv_w = fCnaParHistos->CanvasFormatW("IXIYDee");
4593 
4594     //............................................... options generales
4595     fFapStexType = fEcalNumbering->GetEEDeeType(DeeNumber);
4596 
4597     //............................................... paves commentaires (DeeSCNumbering)
4598     SetAllPavesViewStex("Numbering", DeeNumber);
4599 
4600     //------------------------------------ Canvas name ----------------- (DeeSCNumbering)
4601 
4602     sprintf(f_in, "SC_numbering_for_Dee_Dee%d", DeeNumber);
4603     SetHistoPresentation((TH1D*)h_empty_bid, "Stex2DEENb");
4604     TCanvas* MainCanvas = new TCanvas(f_in, f_in, canv_w, canv_h);
4605     fCnewRoot++;
4606     fCurrentCanvas = MainCanvas;
4607     fCurrentCanvasName = f_in;
4608 
4609     // std::cout << "*TEcnaHistosEE::ViewDee(...)> Plot is displayed on canvas ----> " << f_in << std::endl;
4610 
4611     //------------------------ Canvas draw and update ------------ (DeeSCNumbering)
4612     fPavComStex->Draw();
4613     fPavComCxyz->Draw();
4614 
4615     Double_t x_low = fCnaParHistos->BoxLeftX("bottom_left_box") - 0.005;
4616     Double_t x_up = fCnaParHistos->BoxRightX("bottom_right_box") + 0.005;
4617     Double_t y_low = fCnaParHistos->BoxTopY("bottom_left_box") + 0.005;
4618     Double_t y_up = fCnaParHistos->BoxBottomY("top_left_box_Dee") - 0.005;
4619 
4620     Double_t x_margin = x_low;
4621     Double_t y_margin = y_low;
4622 
4623     MainCanvas->Divide(1, 1, x_margin, y_margin);
4624     //           Divide(nx, ny, x_margin, y_margin,    color);
4625 
4626     gPad->cd(1);
4627     TVirtualPad* main_subpad = gPad;
4628     main_subpad->SetPad(x_low, y_low, x_up, y_up);
4629 
4630     h_empty_bid->DrawCopy("COL");  // il faut tracer un bidim vide pour pouvoir tracer la grille et les axes
4631 
4632     ViewDeeSCNumberingPad(DeeNumber);
4633 
4634     gPad->Update();  // prend beaucoup de temps...
4635 
4636     //..................... retour aux options standard
4637     Bool_t b_true = true;
4638     h_empty_bid->SetStats(b_true);
4639 
4640     h_empty_bid->Delete();
4641     h_empty_bid = nullptr;
4642     fCdeleteRoot++;
4643 
4644     //      delete MainCanvas;              fCdeleteRoot++;
4645   } else {
4646     std::cout << "!TEcnaHistos::DeeSCNumbering(...)> Dee = " << DeeNumber << ". Out of range ( range = [1,"
4647               << fEcal->MaxDeeInEE() << "] )" << fTTBELL << std::endl;
4648   }
4649 }
4650 // end of DeeSCNumbering
4651 
4652 void TEcnaHistos::ViewDeeSCNumberingPad(const Int_t& DeeNumber) {
4653   //display the SC numbering of the Dee in a Pad
4654 
4655   gStyle->SetTitleW(0.4);  // taille titre histos
4656   gStyle->SetTitleH(0.08);
4657 
4658   ViewDeeGrid(DeeNumber, " ");
4659 
4660   //..... SC numbers writing in the grid .... (ViewDeeSCNumberingPad)
4661 
4662   char f_in[charArrLen];
4663   gStyle->SetTextSize(0.0325);
4664 
4665   //------------------ LOOP ON THE Dee_SC NUMBER   (ViewDeeSCNumberingPad)
4666   Int_t x_channel = 0;  // => defined here after according to DeeDir and SCQuadType
4667   TText* text_DSSC_num = new TText();
4668   fCnewRoot++;
4669   TText* text_DeeSCCons_num = new TText();
4670   fCnewRoot++;
4671 
4672   for (Int_t n1DeeSCEcna = 1; n1DeeSCEcna <= fEcal->MaxSCEcnaInDee(); n1DeeSCEcna++) {
4673     TString DeeDir = fEcalNumbering->GetDeeDirViewedFromIP(DeeNumber);
4674     TString SCQuadType = fEcalNumbering->GetSCQuadFrom1DeeSCEcna(n1DeeSCEcna);
4675     if (SCQuadType == "top" && DeeDir == "right") {
4676       x_channel = 13;
4677     }
4678     if (SCQuadType == "top" && DeeDir == "left") {
4679       x_channel = 7;
4680     }
4681     if (SCQuadType == "bottom" && DeeDir == "left") {
4682       x_channel = 11;
4683     }
4684     if (SCQuadType == "bottom" && DeeDir == "right") {
4685       x_channel = 17;
4686     }
4687     Int_t i_SCEcha = (Int_t)x_channel;
4688 
4689     Double_t x_from_IX = (Double_t)GetXCrysInStex(DeeNumber, n1DeeSCEcna, i_SCEcha);
4690     Double_t y_from_IY = (Double_t)GetYCrysInStex(DeeNumber, n1DeeSCEcna, i_SCEcha);
4691     Double_t y_from_IYp = y_from_IY + (Double_t)1.;
4692     Double_t y_from_IYm = y_from_IY - (Double_t)1.;
4693 
4694     TString DeeEndcap = fEcalNumbering->GetEEDeeEndcap(DeeNumber);
4695     Color_t couleur_SC = GetSCColor(DeeEndcap, DeeDir, SCQuadType);
4696     text_DSSC_num->SetTextColor(couleur_SC);
4697     text_DeeSCCons_num->SetTextColor((Color_t)1);
4698 
4699     Int_t i_DSSC = fEcalNumbering->GetDSSCFrom1DeeSCEcna(DeeNumber, n1DeeSCEcna);
4700     Int_t i_DeeSCCons = fEcalNumbering->GetDeeSCConsFrom1DeeSCEcna(DeeNumber, n1DeeSCEcna);
4701     if (i_DSSC > 0) {
4702       if (
4703           //.................................................... (D2,S9) , (D4,S1)
4704           !(i_DeeSCCons == 33 && n1DeeSCEcna == 60) && !(i_DeeSCCons == 33 && n1DeeSCEcna == 119) &&
4705           //................................................... (D2,S8) , (D4,S2)
4706           !(i_DeeSCCons == 29 && n1DeeSCEcna == 32) &&  // !(29c and 58c)
4707           !(i_DeeSCCons == 29 && n1DeeSCEcna == 138) && !(i_DeeSCCons == 29 && n1DeeSCEcna == 157) &&
4708           !(i_DeeSCCons == 58 && n1DeeSCEcna == 176) && !(i_DeeSCCons == 58 && n1DeeSCEcna == 193) &&
4709           //.................................................... (D2,S7) , (D4,S3)
4710           !(i_DeeSCCons == 149 && n1DeeSCEcna == 188) &&
4711           //.................................................... (D2,S6) , (D4,S4)
4712           !(i_DeeSCCons == 112 && n1DeeSCEcna == 29) && !(i_DeeSCCons == 112 && n1DeeSCEcna == 144) &&
4713           !(i_DeeSCCons == 112 && n1DeeSCEcna == 165) && !(i_DeeSCCons == 119 && n1DeeSCEcna == 102) &&
4714           !(i_DeeSCCons == 119 && n1DeeSCEcna == 123) &&
4715           //.................................................... (D2,S5) , (D4,S5)
4716           !(i_DeeSCCons == 132 && n1DeeSCEcna == 41) &&
4717           //----------------------------------------------------------------------
4718           //.................................................... (D1,S1) , (D3,S9)
4719           !(i_DeeSCCons == 182 && n1DeeSCEcna == 60) && !(i_DeeSCCons == 182 && n1DeeSCEcna == 119) &&
4720           //.................................................... (D1,S2) , (D3,S8)
4721           !(i_DeeSCCons == 178 && n1DeeSCEcna == 32) &&  // !(178c and 207c)
4722           !(i_DeeSCCons == 178 && n1DeeSCEcna == 138) && !(i_DeeSCCons == 178 && n1DeeSCEcna == 157) &&
4723           !(i_DeeSCCons == 207 && n1DeeSCEcna == 176) && !(i_DeeSCCons == 207 && n1DeeSCEcna == 193) &&
4724           //.................................................... (D1,S3) , (D3,S7)
4725           !(i_DeeSCCons == 298 && n1DeeSCEcna == 188) &&
4726           //.................................................... (D1,S4) , (D3,S6)
4727           !(i_DeeSCCons == 261 && n1DeeSCEcna == 29) &&  // !(261a and 268a)
4728           !(i_DeeSCCons == 261 && n1DeeSCEcna == 144) && !(i_DeeSCCons == 261 && n1DeeSCEcna == 165) &&
4729           !(i_DeeSCCons == 268 && n1DeeSCEcna == 102) && !(i_DeeSCCons == 268 && n1DeeSCEcna == 123) &&
4730           //.................................................... (D1,S5) , (D3,S5)
4731           !(i_DeeSCCons == 281 && n1DeeSCEcna == 41)) {
4732         sprintf(f_in, "%d", i_DSSC);
4733         text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);  // <=== DrawText: prend du temps
4734         sprintf(f_in, "%d", i_DeeSCCons);
4735         text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in);  // <=== DrawText: prend du temps
4736       }
4737 
4738       //.................................................... (D2,S9) , (D4,S1)
4739 
4740       if (i_DeeSCCons == 33 && n1DeeSCEcna == 60) {
4741         sprintf(f_in, "30a");
4742         text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);
4743         sprintf(f_in, "33a");
4744         text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in);
4745       }
4746       if (i_DeeSCCons == 33 && n1DeeSCEcna == 119) {
4747         sprintf(f_in, "30b");
4748         text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);
4749         sprintf(f_in, "33b");
4750         text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in);
4751       }
4752       //.................................................... (D2,S8) , (D4,S2)
4753       if (i_DeeSCCons == 29 && n1DeeSCEcna == 32) {
4754         sprintf(f_in, " 3c-25c");
4755         text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);
4756         sprintf(f_in, "29c-58c");
4757         text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in);
4758       }
4759       if (i_DeeSCCons == 29 && n1DeeSCEcna == 138) {
4760         sprintf(f_in, "3a");
4761         text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);
4762         sprintf(f_in, "29a");
4763         text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in);
4764       }
4765       if (i_DeeSCCons == 29 && n1DeeSCEcna == 157) {
4766         sprintf(f_in, "3b");
4767         text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);
4768         sprintf(f_in, "29b");
4769         text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in);
4770       }
4771 
4772       if (i_DeeSCCons == 58 && n1DeeSCEcna == 176) {
4773         sprintf(f_in, "25a");
4774         text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);
4775         sprintf(f_in, "58a");
4776         text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in);
4777       }
4778       if (i_DeeSCCons == 58 && n1DeeSCEcna == 193) {
4779         sprintf(f_in, "25b");
4780         text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);
4781         sprintf(f_in, "58b");
4782         text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in);
4783       }
4784       //.................................................... (D2,S7) , (D4,S3)
4785       if (i_DeeSCCons == 149 && n1DeeSCEcna == 188) {
4786         sprintf(f_in, "34a");
4787         text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);
4788         sprintf(f_in, "149a");
4789         text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in);
4790       }
4791       //.................................................... (D2,S6) , (D4,S4)
4792       if (i_DeeSCCons == 112 && n1DeeSCEcna == 29) {
4793         sprintf(f_in, " 14a-21a");
4794         text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);
4795         sprintf(f_in, "112a-119a");
4796         text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in);
4797       }
4798       if (i_DeeSCCons == 112 && n1DeeSCEcna == 144) {
4799         sprintf(f_in, "14c");
4800         text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);
4801         sprintf(f_in, "112c");
4802         text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in);
4803       }
4804       if (i_DeeSCCons == 112 && n1DeeSCEcna == 165) {
4805         sprintf(f_in, "14b");
4806         text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);
4807         sprintf(f_in, "112b");
4808         text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in);
4809       }
4810 
4811       if (i_DeeSCCons == 119 && n1DeeSCEcna == 102) {
4812         sprintf(f_in, "21c");
4813         text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);
4814         sprintf(f_in, "119c");
4815         text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in);
4816       }
4817       if (i_DeeSCCons == 119 && n1DeeSCEcna == 123) {
4818         sprintf(f_in, "21b");
4819         text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);
4820         sprintf(f_in, "119b");
4821         text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in);
4822       }
4823       //.................................................... (D2,S5) , (D4,S5)
4824       if (i_DeeSCCons == 132 && n1DeeSCEcna == 41) {
4825         sprintf(f_in, "3a");
4826         text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);
4827         sprintf(f_in, "132a");
4828         text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in);
4829       }
4830 
4831       //.................................................... (D1,S1) , (D3,S9)
4832       if (i_DeeSCCons == 182 && n1DeeSCEcna == 60) {
4833         sprintf(f_in, "30a");
4834         text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);
4835         sprintf(f_in, "182a");
4836         text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in);
4837       }
4838       if (i_DeeSCCons == 182 && n1DeeSCEcna == 119) {
4839         sprintf(f_in, "30b");
4840         text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);
4841         sprintf(f_in, "182b");
4842         text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in);
4843       }
4844       //.................................................... (D1,S2) , (D3,S8)
4845       if (i_DeeSCCons == 178 && n1DeeSCEcna == 32) {
4846         sprintf(f_in, "  3c-25c");
4847         text_DSSC_num->DrawText(x_from_IX - 6, y_from_IYp, f_in);
4848         sprintf(f_in, "178c-207c");
4849         text_DeeSCCons_num->DrawText(x_from_IX - 6, y_from_IYm, f_in);
4850       }
4851       if (i_DeeSCCons == 178 && n1DeeSCEcna == 138) {
4852         sprintf(f_in, "3a");
4853         text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);
4854         sprintf(f_in, "178a");
4855         text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in);
4856       }
4857       if (i_DeeSCCons == 178 && n1DeeSCEcna == 157) {
4858         sprintf(f_in, "3b");
4859         text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);
4860         sprintf(f_in, "178b");
4861         text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in);
4862       }
4863 
4864       if (i_DeeSCCons == 207 && n1DeeSCEcna == 176) {
4865         sprintf(f_in, "25a");
4866         text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);
4867         sprintf(f_in, "207a");
4868         text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in);
4869       }
4870       if (i_DeeSCCons == 207 && n1DeeSCEcna == 193) {
4871         sprintf(f_in, "25b");
4872         text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);
4873         sprintf(f_in, "207b");
4874         text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in);
4875       }
4876       //.................................................... (D1,S3) , (D3,S7)
4877       if (i_DeeSCCons == 298 && n1DeeSCEcna == 188) {
4878         sprintf(f_in, "34a");
4879         text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);
4880         sprintf(f_in, "298a");
4881         text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in);
4882       }
4883       //.................................................... (D1,S4) , (D3,S6)
4884       if (i_DeeSCCons == 261 && n1DeeSCEcna == 29) {
4885         sprintf(f_in, " 14a-21a");
4886         text_DSSC_num->DrawText(x_from_IX - 6, y_from_IYp, f_in);
4887         sprintf(f_in, "261a-268a");
4888         text_DeeSCCons_num->DrawText(x_from_IX - 6, y_from_IYm, f_in);
4889       }
4890       if (i_DeeSCCons == 261 && n1DeeSCEcna == 144) {
4891         sprintf(f_in, "14c");
4892         text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);
4893         sprintf(f_in, "261c");
4894         text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in);
4895       }
4896       if (i_DeeSCCons == 261 && n1DeeSCEcna == 165) {
4897         sprintf(f_in, "14b");
4898         text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);
4899         sprintf(f_in, "261b");
4900         text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in);
4901       }
4902 
4903       if (i_DeeSCCons == 268 && n1DeeSCEcna == 102) {
4904         sprintf(f_in, "21c");
4905         text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);
4906         sprintf(f_in, "268c");
4907         text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in);
4908       }
4909       if (i_DeeSCCons == 268 && n1DeeSCEcna == 123) {
4910         sprintf(f_in, "21b");
4911         text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);
4912         sprintf(f_in, "268b");
4913         text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in);
4914       }
4915       //.................................................... (D1,S5) , (D3,S5)
4916       if (i_DeeSCCons == 281 && n1DeeSCEcna == 41) {
4917         sprintf(f_in, "20a");
4918         text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);
4919         sprintf(f_in, "281a");
4920         text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in);
4921       }
4922     }
4923   }
4924 
4925   // delete text_DSSC_num;             fCdeleteRoot++;
4926 
4927   //......................... mention "color, black"
4928   Color_t coul_textcolors = fCnaParHistos->ColorDefinition("noir");
4929   sprintf(f_in, "color: nb in Data Sector, black: nb for construction");
4930   Int_t x_colors = 3;
4931   Int_t y_colors = -14;
4932 
4933   TText* text_colors = new TText(x_colors, y_colors, f_in);
4934   fCnewRoot++;
4935   text_colors->SetTextSize(0.03);
4936   text_colors->SetTextColor(coul_textcolors);
4937   text_colors->Draw();
4938 
4939   Color_t couleur_noir = fCnaParHistos->ColorDefinition("noir");
4940   gStyle->SetTextColor(couleur_noir);
4941 }
4942 //---------------->  end of ViewDeeSCNumberingPad()
4943 
4944 void TEcnaHistos::ViewDeeGrid(const Int_t& DeeNumber, const TString& c_option) {
4945   //Grid of one Dee with axis IX and IY
4946 
4947   Int_t GeoBidSizeIX = fEcal->MaxSCIXInDee() * fEcal->MaxCrysIXInSC();
4948   Int_t GeoBidSizeIY = fEcal->MaxSCIYInDee() * fEcal->MaxCrysIYInSC();
4949 
4950   if (c_option == "corcc") {
4951     GeoBidSizeIX = fEcal->MaxSCIXInDee() * fEcal->MaxCrysInSC();
4952     GeoBidSizeIY = fEcal->MaxSCIYInDee() * fEcal->MaxCrysInSC();
4953   }
4954 
4955   Int_t nb_binx = GeoBidSizeIX;
4956   Int_t nb_biny = GeoBidSizeIY;
4957   Axis_t xinf_bid = (Axis_t)0.;
4958   Axis_t xsup_bid = (Axis_t)GeoBidSizeIX;
4959 
4960   Axis_t yinf_bid = (Axis_t)0.;
4961   Axis_t ysup_bid = (Axis_t)GeoBidSizeIY;
4962   Double_t ymid_bid = (Double_t)(ysup_bid - yinf_bid) / 2.;
4963 
4964   //---------------- trace de la grille: un rectangle = un super-cristal
4965 
4966   Int_t size_IX = fEcal->MaxCrysIXInSC();
4967   Int_t size_IY = fEcal->MaxCrysIYInSC();
4968 
4969   if (c_option == "corcc") {
4970     size_IX = fEcal->MaxCrysInSC();
4971     size_IY = fEcal->MaxCrysInSC();
4972   }
4973 
4974   Int_t max_x = nb_binx / size_IX;
4975   Int_t max_y = nb_biny / size_IY;
4976   Int_t max_yd = max_y / 2;
4977 
4978   //= SURLIGNAGES (unite de coordonnees: le cristal ou 5 fois le cristal si option corcc)
4979   //........................... multplicative coefficient for corcc option
4980   Int_t coefcc_x = (Int_t)1;
4981   Int_t coefcc_y = (Int_t)1;
4982   if (c_option == "corcc") {
4983     coefcc_x = fEcal->MaxCrysIXInSC();
4984     coefcc_y = fEcal->MaxCrysIYInSC();
4985   }
4986 
4987   //............................. lignes horizontales
4988   Double_t yline = (Double_t)yinf_bid - (Double_t)size_IY;
4989 
4990   Double_t xline_beg = (Double_t)xinf_bid;
4991   Double_t xline_end = (Double_t)xsup_bid;
4992 
4993   //           k  =   0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10
4994   Int_t x_min[11] = {11, 11, 7, 0, 0, 0, 0, 0, 0, 0, 0};
4995   Int_t x_max[11] = {50, 50, 47, 45, 45, 42, 37, 35, 30, 15, 50};
4996   for (Int_t i = 0; i < 11; i++) {
4997     x_min[i] = coefcc_x * x_min[i];
4998     x_max[i] = coefcc_x * x_max[i];
4999   }
5000 
5001   for (Int_t j = 0; j < max_y; j++) {
5002     if (j < max_yd)  // j = 0,1,2,3,4,5,6,7,8,9
5003     {
5004       if (DeeNumber == 1 || DeeNumber == 3) {
5005         xline_beg = xinf_bid + (Double_t)x_min[10 - j];
5006         xline_end = xinf_bid + (Double_t)x_max[10 - j];
5007       }
5008       if (DeeNumber == 2 || DeeNumber == 4) {
5009         xline_beg = xsup_bid - (Double_t)x_max[10 - j];
5010         xline_end = xsup_bid - (Double_t)x_min[10 - j];
5011       }
5012     }
5013 
5014     if (j == max_yd)  // j = 10
5015     {
5016       if (DeeNumber == 1 || DeeNumber == 3) {
5017         xline_beg = xinf_bid + (Double_t)x_min[0];
5018         xline_end = xinf_bid + (Double_t)x_max[0];
5019       }
5020       if (DeeNumber == 2 || DeeNumber == 4) {
5021         xline_beg = xsup_bid - (Double_t)x_max[0];
5022         xline_end = xsup_bid - (Double_t)x_min[0];
5023       }
5024     }
5025 
5026     if (j > max_yd)  // j = 11,12,13,14,15,16,17,18,19,20
5027     {
5028       if (DeeNumber == 1 || DeeNumber == 3) {
5029         xline_beg = xinf_bid + (Double_t)x_min[j - 10];
5030         xline_end = xinf_bid + (Double_t)x_max[j - 10];
5031       }
5032       if (DeeNumber == 2 || DeeNumber == 4) {
5033         xline_beg = xsup_bid - (Double_t)x_max[j - 10];
5034         xline_end = xsup_bid - (Double_t)x_min[j - 10];
5035       }
5036     }
5037 
5038     yline = yline + (Double_t)size_IY;
5039     TLine* lin;
5040     lin = new TLine(xline_beg, yline, xline_end, yline);
5041     fCnewRoot++;
5042     lin->Draw();
5043     //lin->Delete();   // => si on delete, pas de trace de la ligne
5044     // delete lin;             fCdeleteRoot++;
5045   }
5046 
5047   //.......................... lignes verticales
5048   Double_t xline = (Double_t)xinf_bid - (Double_t)size_IX;
5049 
5050   Double_t yline_haut_bot = (Double_t)ymid_bid;
5051   Double_t yline_haut_top = (Double_t)ysup_bid;
5052 
5053   Double_t yline_bas_bot;
5054   Double_t yline_bas_top;
5055 
5056   // coordonnees demi-lignes
5057   //           l  =   0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10
5058   Int_t y_min[11] = {0, 11, 7, 0, 0, 0, 0, 0, 0, 0, 0};
5059   Int_t y_max[11] = {50, 50, 47, 45, 45, 42, 38, 35, 30, 15, 10};
5060   for (Int_t i = 0; i < 11; i++) {
5061     y_min[i] = coefcc_y * y_min[i];
5062     y_max[i] = coefcc_y * y_max[i];
5063   }
5064 
5065   gStyle->SetTextSize(0.075);  //  ===> pourquoi pas avant?
5066 
5067   for (Int_t i = 0; i <= max_x; i++) {
5068     if (DeeNumber == 1 || DeeNumber == 3) {
5069       yline_haut_bot = ymid_bid + (Double_t)y_min[i];
5070       yline_haut_top = ymid_bid + (Double_t)y_max[i];
5071     }
5072     if (DeeNumber == 2 || DeeNumber == 4) {
5073       yline_haut_bot = ymid_bid + (Double_t)y_min[10 - i];
5074       yline_haut_top = ymid_bid + (Double_t)y_max[10 - i];
5075     }
5076     yline_bas_bot = ysup_bid - yline_haut_top;
5077     yline_bas_top = ysup_bid - yline_haut_bot;
5078 
5079     xline = xline + (Double_t)size_IX;
5080     TLine* lin_haut;
5081     lin_haut = new TLine(xline, yline_haut_bot, xline, yline_haut_top);
5082     fCnewRoot++;
5083     lin_haut->Draw();
5084     // delete lin_haut;             fCdeleteRoot++;
5085     TLine* lin_bas;
5086     lin_bas = new TLine(xline, yline_bas_bot, xline, yline_bas_top);
5087     fCnewRoot++;
5088     lin_bas->Draw();
5089     // delete lin_bas;             fCdeleteRoot++;
5090   }
5091 
5092   Float_t fcoefcc_x = (Float_t)coefcc_x;
5093   Float_t fcoefcc_y = (Float_t)coefcc_y;
5094 
5095   EEDataSectors(fcoefcc_x, fcoefcc_y, DeeNumber, "Dee");
5096   EEGridAxis(DeeNumber, "Dee", c_option);
5097 
5098 }  // end of ViewDeeGrid
5099 
5100 //=================================================================================
5101 //
5102 //             SqrtContourLevels(const Int_t& nb_niv, Double_t* cont_niv)
5103 //
5104 //=================================================================================
5105 void TEcnaHistos::SqrtContourLevels(const Int_t& nb_niv, Double_t* cont_niv) {
5106   //Calculation of levels in z coordinate for 3D plots. Square root scale
5107 
5108   Int_t nb_niv2 = (nb_niv + 1) / 2;
5109 
5110   for (Int_t num_niv = 0; num_niv < nb_niv2; num_niv++) {
5111     Int_t ind_niv = num_niv + nb_niv2 - 1;
5112     if (ind_niv < 0 || ind_niv > nb_niv) {
5113       std::cout << "!TEcnaHistos::ContourLevels(...)> *** ERROR *** "
5114                 << "wrong contour levels for correlation matrix" << fTTBELL << std::endl;
5115     } else {
5116       cont_niv[ind_niv] = (Double_t)(num_niv * num_niv) / ((Double_t)((nb_niv2 - 1) * (nb_niv2 - 1)));
5117     }
5118   }
5119   for (Int_t num_niv = -1; num_niv > -nb_niv2; num_niv--) {
5120     Int_t ind_niv = num_niv + nb_niv2 - 1;
5121     if (ind_niv < 0 || ind_niv > nb_niv) {
5122       std::cout << "!TEcnaHistos::ContourLevels(...)> *** ERROR *** "
5123                 << "wrong contour levels for correlation matrix" << fTTBELL << std::endl;
5124     } else {
5125       cont_niv[ind_niv] = -(Double_t)(num_niv * num_niv) / ((Double_t)((nb_niv2 - 1) * (nb_niv2 - 1)));
5126     }
5127   }
5128 }
5129 
5130 //==========================================================================
5131 //
5132 //                    GetHocoVecoAxisTitle
5133 //
5134 //==========================================================================
5135 TString TEcnaHistos::GetHocoVecoAxisTitle(const TString& chcode) {
5136   TString xname = " ";
5137 
5138   if (fFlagSubDet == "EB") {
5139     xname = GetEtaPhiAxisTitle(chcode);
5140   }
5141   if (fFlagSubDet == "EE") {
5142     xname = GetIXIYAxisTitle(chcode);
5143   }
5144 
5145   return xname;
5146 }
5147 
5148 TString TEcnaHistos::GetEtaPhiAxisTitle(const TString& chcode) {
5149   TString xname = " ";
5150 
5151   if (chcode == "ietaEB") {
5152     xname = "i#eta Xtal ";
5153   }
5154   if (chcode == "ietaSM") {
5155     xname = "i#eta Xtal ";
5156   }
5157   if (chcode == "ietaTow") {
5158     xname = "i#eta Xtal        ";
5159   }
5160 
5161   if (chcode == "iphiEB") {
5162     xname = "         i#varphi Xtal";
5163   }
5164   if (chcode == "jphiEB+") {
5165     xname = "         i#varphi Xtal";
5166   }
5167   if (chcode == "jphiEB-") {
5168     xname = "         i#varphi Xtal";
5169   }
5170   if (chcode == "jphiSMB+") {
5171     xname = "         i#varphi Xtal";
5172   }
5173   if (chcode == "jphiSMB-") {
5174     xname = "i#varphi Xtal    ";
5175   }
5176   if (chcode == "jphiTow") {
5177     xname = "i#varphi Xtal in SM        ";
5178   }
5179   if (chcode == "phi") {
5180     xname = "i#varphi Xtal in EB  ";
5181   }
5182 
5183   return xname;
5184 }
5185 
5186 TString TEcnaHistos::GetIXIYAxisTitle(const TString& chcode) {
5187   TString xname = " ";
5188 
5189   if (chcode == "iIXDee") {
5190     xname = "IX(SC)";
5191   }
5192 
5193   if (chcode == "iIXDee1") {
5194     xname = "                                                    -IX Xtal";
5195   }
5196   if (chcode == "iIXDee2") {
5197     xname = " IX Xtal                                                     ";
5198   }
5199   if (chcode == "iIXDee3") {
5200     xname = " IX Xtal";
5201   }
5202   if (chcode == "iIXDee4") {
5203     xname = "-IX Xtal                                                             ";
5204   }
5205 
5206   if (chcode == "iIXEE") {
5207     xname = "                      IX Xtal";
5208   }
5209 
5210   if (chcode == "iIXSC") {
5211     xname = "IX Xtal";
5212   }
5213 
5214   if (chcode == "jIYDee") {
5215     xname = "IY Xtal";
5216   }
5217   if (chcode == "jIYSC") {
5218     xname = "IY Xtal";
5219   }
5220   if (chcode == "IY") {
5221     xname = "IY";
5222   }
5223 
5224   return xname;
5225 }
5226 
5227 //=======================================================================================
5228 //
5229 //                              ViewStas(***)
5230 //
5231 //           (Hoco,Veco) matrices for all the Stex's of a Stas
5232 //                        Stas = EB or EE
5233 //
5234 //=======================================================================================
5235 void TEcnaHistos::ViewStas(const TVectorD& arg_read_histo, const Int_t& arg_AlreadyRead, const TString& HistoCode) {
5236   // (Hoco, Veco) matrices for all the Stex's of a Stas
5237 
5238   //......................... matrix title
5239   char f_in_mat_tit[charArrLen];
5240 
5241   if (HistoCode == "D_NOE_ChNb") {
5242     sprintf(f_in_mat_tit, "Number of Events");
5243   }
5244   if (HistoCode == "D_Ped_ChNb") {
5245     sprintf(f_in_mat_tit, "Pedestals");
5246   }
5247   if (HistoCode == "D_TNo_ChNb") {
5248     sprintf(f_in_mat_tit, "Total noise");
5249   }
5250   if (HistoCode == "D_MCs_ChNb") {
5251     sprintf(f_in_mat_tit, "Mean cor(s,s')");
5252   }
5253   if (HistoCode == "D_LFN_ChNb") {
5254     sprintf(f_in_mat_tit, "Low frequency noise");
5255   }
5256   if (HistoCode == "D_HFN_ChNb") {
5257     sprintf(f_in_mat_tit, "High frequency noise");
5258   }
5259   if (HistoCode == "D_SCs_ChNb") {
5260     sprintf(f_in_mat_tit, "Sigma of cor(s,s')");
5261   }
5262 
5263   //.... Axis parameters: *** WARNING *** EB ===>  x (Bid Hoco) = phi (StinVeco),  y (Bid Veco) = eta (StinHoco)
5264   Int_t GeoBidSizeHoco = fEcal->MaxStinVecoInStas();
5265   Int_t GeoBidSizeVeco = fEcal->MaxStinHocoInStas();
5266 
5267   Int_t vertic_empty_strips = 3;
5268   Int_t vertic_empty_strip_1 = 1;
5269 
5270   if (fFlagSubDet == "EE") {
5271     // for empty vertical strips: before EE-, between EE- and EE+, after EE+ on plot
5272     GeoBidSizeHoco = fEcal->MaxStinHocoInStas() + vertic_empty_strips;
5273     GeoBidSizeVeco = fEcal->MaxStinVecoInStas();
5274   }
5275 
5276   Int_t nb_binx = GeoBidSizeHoco;
5277   Int_t nb_biny = GeoBidSizeVeco;
5278   Axis_t xinf_bid = (Axis_t)0.;
5279   Axis_t xsup_bid = (Axis_t)GeoBidSizeHoco;
5280   Axis_t yinf_bid = (Axis_t)0.;
5281   Axis_t ysup_bid = (Axis_t)GeoBidSizeVeco;
5282 
5283   TString axis_x_var_name = "  #Hoco  ";
5284   TString axis_y_var_name = "  #varVeco  ";
5285 
5286   //............. matrices reading and histogram filling   (ViewStas)
5287 
5288   TH2D* h_geo_bid =
5289       new TH2D("geobidim_ViewStas", f_in_mat_tit, nb_binx, xinf_bid, xsup_bid, nb_biny, yinf_bid, ysup_bid);
5290   fCnewRoot++;
5291   h_geo_bid->Reset();
5292 
5293   Int_t CounterExistingFile = 0;
5294   Int_t CounterDataExist = 0;
5295 
5296   Int_t* xFapNbOfEvts = new Int_t[fEcal->MaxStexInStas()];
5297   fCnew++;
5298   for (Int_t i = 0; i < fEcal->MaxStexInStas(); i++) {
5299     xFapNbOfEvts[i] = 0;
5300   }
5301 
5302   //Int_t* NOFE_int = new Int_t[fEcal->MaxCrysEcnaInStex()];      fCnew++;
5303 
5304   //......................................................................... (ViewStas)
5305   for (Int_t iStasStex = 0; iStasStex < fEcal->MaxStexInStas(); iStasStex++) {
5306     TVectorD partial_histp(fEcal->MaxStinEcnaInStex());
5307     for (Int_t i = 0; i < fEcal->MaxStinEcnaInStex(); i++) {
5308       partial_histp(i) = (Double_t)0.;
5309     }
5310 
5311     Bool_t OKFileExists = kFALSE;
5312     Bool_t OKDataExist = kFALSE;
5313 
5314     if (arg_AlreadyRead == fTobeRead) {
5315       fMyRootFile->PrintNoComment();
5316       Int_t n1StasStex = iStasStex + 1;
5317       fMyRootFile->FileParameters(fFapAnaType,
5318                                   fFapNbOfSamples,
5319                                   fFapRunNumber,
5320                                   fFapFirstReqEvtNumber,
5321                                   fFapLastReqEvtNumber,
5322                                   fFapReqNbOfEvts,
5323                                   n1StasStex,
5324                                   fCfgResultsRootFilePath.Data());
5325 
5326       if (fMyRootFile->LookAtRootFile() == kTRUE) {
5327         OKFileExists = kTRUE;
5328       }  //   (ViewStas)
5329 
5330       if (OKFileExists == kTRUE) {
5331         xFapNbOfEvts[iStasStex] = fMyRootFile->GetNumberOfEvents(fFapReqNbOfEvts, n1StasStex);
5332         TString fp_name_short = fMyRootFile->GetRootFileNameShort();
5333         // std::cout << "*TEcnaHistos::ViewStas(...)> Data are analyzed from file ----> "
5334         //      << fp_name_short << std::endl;
5335 
5336         //....................... search for first and last dates
5337         if (iStasStex == 0) {
5338           fStartTime = fMyRootFile->GetStartTime();
5339           fStopTime = fMyRootFile->GetStopTime();
5340           fStartDate = fMyRootFile->GetStartDate();
5341           fStopDate = fMyRootFile->GetStopDate();
5342         }
5343 
5344         time_t xStartTime = fMyRootFile->GetStartTime();
5345         time_t xStopTime = fMyRootFile->GetStopTime();
5346         TString xStartDate = fMyRootFile->GetStartDate();
5347         TString xStopDate = fMyRootFile->GetStopDate();
5348 
5349         if (xStartTime < fStartTime) {
5350           fStartTime = xStartTime;
5351           fStartDate = xStartDate;
5352         }
5353         if (xStopTime > fStopTime) {
5354           fStopTime = xStopTime;
5355           fStopDate = xStopDate;
5356         }
5357 
5358         fRunType = fMyRootFile->GetRunType();
5359 
5360         //----------------------------------------------------------------------------- file reading   (ViewStas)
5361         if (HistoCode == "D_NOE_ChNb") {
5362           partial_histp = fMyRootFile->ReadAverageNumberOfEvents(fEcal->MaxStinEcnaInStex());
5363         }
5364         if (HistoCode == "D_Ped_ChNb") {
5365           partial_histp = fMyRootFile->ReadAveragePedestals(fEcal->MaxStinEcnaInStex());
5366         }
5367         if (HistoCode == "D_TNo_ChNb") {
5368           partial_histp = fMyRootFile->ReadAverageTotalNoise(fEcal->MaxStinEcnaInStex());
5369         }
5370         if (HistoCode == "D_MCs_ChNb") {
5371           partial_histp = fMyRootFile->ReadAverageMeanCorrelationsBetweenSamples(fEcal->MaxStinEcnaInStex());
5372         }
5373         if (HistoCode == "D_LFN_ChNb") {
5374           partial_histp = fMyRootFile->ReadAverageLowFrequencyNoise(fEcal->MaxStinEcnaInStex());
5375         }
5376         if (HistoCode == "D_HFN_ChNb") {
5377           partial_histp = fMyRootFile->ReadAverageHighFrequencyNoise(fEcal->MaxStinEcnaInStex());
5378         }
5379         if (HistoCode == "D_SCs_ChNb") {
5380           partial_histp = fMyRootFile->ReadAverageSigmaOfCorrelationsBetweenSamples(fEcal->MaxStinEcnaInStex());
5381         }
5382 
5383         if (fMyRootFile->DataExist() == kTRUE) {
5384           OKDataExist = kTRUE;
5385         }
5386       } else {
5387         fStatusFileFound = kFALSE;
5388         std::cout << "!TEcnaHistos::ViewStas(...)> *ERROR* =====> "
5389                   << " ROOT file not found" << fTTBELL << std::endl;
5390       }
5391     }
5392 
5393     if (arg_AlreadyRead == 1) {
5394       OKDataExist = kTRUE;
5395       for (Int_t i0Stin = 0; i0Stin < fEcal->MaxStinEcnaInStex(); i0Stin++) {
5396         partial_histp(i0Stin) = arg_read_histo(fEcal->MaxStinEcnaInStex() * iStasStex + i0Stin);
5397       }
5398     }
5399 
5400     if (OKDataExist == kTRUE) {
5401       fStatusFileFound = kTRUE;
5402       CounterExistingFile++;
5403 
5404       //.................................................................     (ViewStas)
5405       TMatrixD read_matrix(nb_binx, nb_biny);
5406       for (Int_t i = 0; i < nb_binx; i++) {
5407         for (Int_t j = 0; j < nb_biny; j++) {
5408           read_matrix(i, j) = (Double_t)0.;
5409         }
5410       }
5411 
5412       if (OKDataExist == kTRUE) {
5413         fStatusDataExist = kTRUE;
5414         CounterDataExist++;
5415 
5416         for (Int_t i0StexStinEcna = 0; i0StexStinEcna < fEcal->MaxStinEcnaInStex(); i0StexStinEcna++) {
5417           //-------------------------------------- Geographical bidim filling   (ViewStas)
5418           Int_t i_xgeo = GetXStinInStas(iStasStex, i0StexStinEcna, vertic_empty_strip_1);
5419           Int_t i_ygeo = GetYStinInStas(iStasStex, i0StexStinEcna);
5420 
5421           if (i_xgeo >= 0 && i_xgeo < nb_binx && i_ygeo >= 0 && i_ygeo < nb_biny) {
5422             Int_t n1StexStinEcna = i0StexStinEcna + 1;
5423 
5424             if (fFlagSubDet == "EB") {
5425               read_matrix(i_xgeo, i_ygeo) = partial_histp(i0StexStinEcna);
5426               h_geo_bid->Fill((Double_t)i_xgeo, (Double_t)i_ygeo, (Double_t)read_matrix(i_xgeo, i_ygeo));
5427             }
5428 
5429             if (fFlagSubDet == "EE") {
5430               //---------------------> do not draw bin for SCEcna = 10 or 11      (ViewStas)
5431               if (!((n1StexStinEcna == 10 || n1StexStinEcna == 11 || n1StexStinEcna == 29 || n1StexStinEcna == 32))) {
5432                 read_matrix(i_xgeo, i_ygeo) = partial_histp(i0StexStinEcna);
5433                 h_geo_bid->Fill((Double_t)i_xgeo, (Double_t)i_ygeo, (Double_t)read_matrix(i_xgeo, i_ygeo));
5434               }
5435               if (n1StexStinEcna == 29) {
5436                 //----------------------------------------------------------------- (ViewStas)
5437                 //   Average on SCEcna 29 (x1+x2+x3+x6+x7) and SCEcna 10: (x11)
5438                 //   (x = Xtal# in SC; see CMS NOTE 2006/027, p.10)
5439                 //
5440                 //   (x1+x2+x3+x6+x7)/5 = partial_histp(29-1)   ;   x11 = partial_histp(10-1)
5441                 //
5442                 //    => (x1+x2+x3+x6+x7+x11)/6 = partial_histp(29-1)*5/6 + partial_histp(10-1)/6
5443                 //
5444                 //   //  except for "D_NOE_ChNb" because average done in ReadAverageNumberOfEvents
5445                 //   //  (no averaged NbOfEvts in root file)
5446                 //---------------------------------------------------------------------------------
5447                 read_matrix(i_xgeo, i_ygeo) =
5448                     partial_histp(i0StexStinEcna) * (Double_t)(5. / 6.) + partial_histp(9) / (Double_t)6.;
5449                 h_geo_bid->Fill((Double_t)i_xgeo, (Double_t)i_ygeo, (Double_t)read_matrix(i_xgeo, i_ygeo));
5450               }
5451               //if( n1StexStinEcna == 32 && HistoCode != "D_NOE_ChNb" )   (ViewStas)
5452               if (n1StexStinEcna == 32) {
5453                 //---- same as previous case: replace SCEcna 29 by 32 AND SCEcna 10 by 11
5454                 //---->  (x1+x2+x3+x6+x7+x11)/6 = partial_histp(32-1)*5/6 + partial_histp(11-1)/6
5455                 read_matrix(i_xgeo, i_ygeo) =
5456                     partial_histp(i0StexStinEcna) * (Double_t)(5. / 6.) + partial_histp(10) / (Double_t)6.;
5457                 h_geo_bid->Fill((Double_t)i_xgeo, (Double_t)i_ygeo, (Double_t)read_matrix(i_xgeo, i_ygeo));
5458               }
5459             }  // end of if( fFlagSubDet == "EE" )
5460           }    // end of if(i_xgeo >=0 && i_xgeo < nb_binx && i_ygeo >=0 && i_ygeo < nb_biny)
5461         }      // end of for(Int_t i0StexStinEcna=0; i0StexStinEcna<fEcal->MaxStinEcnaInStex(); i0StexStinEcna++)
5462       }        // end of if ( fMyRootFile->DataExist() == kTRUE )
5463       else {
5464         fStatusDataExist = kFALSE;
5465 
5466         std::cout << "!TEcnaHistos::ViewStas(...)>  "
5467                   << " Data not available for " << fFapStexName << " " << iStasStex + 1
5468                   << " (Quantity not present in the ROOT file)" << fTTBELL << std::endl;
5469       }
5470     }  // end of if( fMyRootFile->LookAtRootFile() == kTRUE )     (ViewStas)
5471     else {
5472       fStatusFileFound = kFALSE;
5473 
5474       std::cout << "!TEcnaHistos::ViewStas(...)>  "
5475                 << " Data not available for " << fFapStexName << " " << iStasStex + 1 << " (ROOT file not found)"
5476                 << fTTBELL << std::endl;
5477     }
5478 
5479     if (fFapNbOfEvts <= xFapNbOfEvts[iStasStex]) {
5480       fFapNbOfEvts = xFapNbOfEvts[iStasStex];
5481     }
5482 
5483   }  // end of for(Int_t iStasStex=0; iStasStex<fEcal->MaxStexInStas(); iStasStex++)
5484 
5485   //delete [] NOFE_int;     NOFE_int = 0;       fCdelete++;
5486   delete[] xFapNbOfEvts;
5487   xFapNbOfEvts = nullptr;
5488   fCdelete++;
5489 
5490   if (CounterExistingFile > 0 && CounterDataExist > 0) {
5491     //===============  H I S T O   M I N / M A X   M A N A G E M E N T ============  (ViewStas)
5492     //................................ Put histo min max values
5493     //.......... default if flag not set to "ON"
5494     SetYminMemoFromValue(HistoCode.Data(), fCnaParHistos->GetYminDefaultValue(HistoCode.Data()));
5495     SetYmaxMemoFromValue(HistoCode.Data(), fCnaParHistos->GetYmaxDefaultValue(HistoCode.Data()));
5496 
5497     if (fUserHistoMin == fUserHistoMax) {
5498       fFlagUserHistoMin = "AUTO";
5499       fFlagUserHistoMax = "AUTO";
5500     }
5501     //.......... user's value if flag set to "ON"
5502     if (fFlagUserHistoMin == "ON") {
5503       SetYminMemoFromValue(HistoCode.Data(), fUserHistoMin);
5504       fFlagUserHistoMin = "OFF";
5505     }
5506     if (fFlagUserHistoMax == "ON") {
5507       SetYmaxMemoFromValue(HistoCode.Data(), fUserHistoMax);
5508       fFlagUserHistoMax = "OFF";
5509     }
5510     //................................. automatic min and/or max
5511     if (fFlagUserHistoMin == "AUTO") {
5512       SetYminMemoFromValue(HistoCode.Data(), h_geo_bid->GetMinimum());
5513       fFlagUserHistoMin = "OFF";
5514     }
5515     if (fFlagUserHistoMax == "AUTO") {
5516       SetYmaxMemoFromValue(HistoCode.Data(), h_geo_bid->GetMaximum());
5517       fFlagUserHistoMax = "OFF";
5518     }
5519     //...................................... histo set ymin and ymax
5520     SetHistoFrameYminYmaxFromMemo((TH1D*)h_geo_bid, HistoCode);
5521 
5522     // ************************** A GARDER EN RESERVE *******************************
5523     //............. special contour level for correlations (square root wise scale)
5524     //if ( HistoCode == "D_MCs_ChNb" )
5525     //{
5526     //  Int_t nb_niv  = 9;
5527     //  Double_t* cont_niv = new Double_t[nb_niv];           fCnew++;
5528     //  SqrtContourLevels(nb_niv, &cont_niv[0]);
5529     //  h_geo_bid->SetContour(nb_niv, &cont_niv[0]);
5530     //  delete [] cont_niv;                                  fCdelete++;
5531     //}
5532     // ******************************** (FIN RESERVE) *******************************
5533 
5534     // =================================== P L O T S ========================   (ViewStas)
5535 
5536     char f_in[charArrLen];
5537 
5538     //...................... Taille/format canvas
5539     UInt_t canv_h = fCnaParHistos->CanvasFormatH("petit");
5540     UInt_t canv_w = fCnaParHistos->CanvasFormatW("petit");
5541 
5542     if (fFlagSubDet == "EB") {
5543       canv_w = fCnaParHistos->CanvasFormatW("phietaEB");
5544       canv_h = fCnaParHistos->CanvasFormatH("phietaEB");
5545     }
5546     if (fFlagSubDet == "EE") {
5547       canv_w = fCnaParHistos->CanvasFormatW("IYIXEE");
5548       canv_h = fCnaParHistos->CanvasFormatH("IYIXEE");
5549     }
5550 
5551     //............................................... paves commentaires (ViewStas)
5552     SetAllPavesViewStas();
5553 
5554     //------------------------------------ Canvas name ----------------- (ViewStas)
5555     TString name_cov_cor;
5556     name_cov_cor.Resize(charArrLen);
5557     name_cov_cor = "?";
5558 
5559     if (HistoCode == "D_NOE_ChNb") {
5560       name_cov_cor = "Number_of_Events";
5561     }
5562     if (HistoCode == "D_Ped_ChNb") {
5563       name_cov_cor = "Pedestals";
5564     }
5565     if (HistoCode == "D_TNo_ChNb") {
5566       name_cov_cor = "Total_noise";
5567     }
5568     if (HistoCode == "D_MCs_ChNb") {
5569       name_cov_cor = "Mean_Corss";
5570     }
5571     if (HistoCode == "D_LFN_ChNb") {
5572       name_cov_cor = "Low_Fq_Noise";
5573     }
5574     if (HistoCode == "D_HFN_ChNb") {
5575       name_cov_cor = "High_Fq_Noise";
5576     }
5577     if (HistoCode == "D_SCs_ChNb") {
5578       name_cov_cor = "Sigma_Corss";
5579     }
5580 
5581     TString name_visu;
5582     name_visu.Resize(charArrLen);
5583     name_visu = "colz";
5584 
5585     sprintf(f_in,
5586             "%s_%s_S1_%d_R%d_%d_%d_%s_%s_HocoVeco_R%d",
5587             name_cov_cor.Data(),
5588             fFapAnaType.Data(),
5589             fFapNbOfSamples,
5590             fFapRunNumber,
5591             fFapFirstReqEvtNumber,
5592             fFapLastReqEvtNumber,
5593             fFlagSubDet.Data(),
5594             name_visu.Data(),
5595             arg_AlreadyRead);
5596 
5597     if (fFlagSubDet == "EB") {
5598       SetHistoPresentation((TH1D*)h_geo_bid, "Stas2DEB");
5599     }
5600     if (fFlagSubDet == "EE") {
5601       SetHistoPresentation((TH1D*)h_geo_bid, "Stas2DEE");
5602     }
5603 
5604     TCanvas* MainCanvas = new TCanvas(f_in, f_in, canv_w, canv_h);
5605     fCnewRoot++;
5606     fCurrentCanvas = MainCanvas;
5607     fCurrentCanvasName = f_in;
5608 
5609     // std::cout << "*TEcnaHistos::ViewStas(...)> Plot is displayed on canvas ----> " << f_in << std::endl;
5610 
5611     //------------------------ Canvas draw and update ------------ (ViewStas)
5612     if (fPavComGeneralTitle != nullptr) {
5613       fPavComGeneralTitle->Draw();
5614     }
5615 
5616     fPavComStas->Draw();
5617     fPavComAnaRun->Draw();
5618     fPavComNbOfEvts->Draw();
5619 
5620     //----------------------------------------------------------- pad margins
5621     Double_t x_low = fCnaParHistos->BoxLeftX("bottom_left_box") - 0.005;
5622     Double_t y_low = fCnaParHistos->BoxTopY("bottom_left_box") + 0.005;
5623     Double_t x_margin = x_low;
5624     Double_t y_margin = y_low;
5625     MainCanvas->Divide(1, 1, x_margin, y_margin);
5626     //           Divide(nx, ny, x_margin, y_margin,    color);
5627     gPad->cd(1);
5628     //........................... specific EE
5629     if (fFlagSubDet == "EE") {
5630       Double_t x_up = fCnaParHistos->BoxRightX("bottom_right_box") + 0.005;
5631       Double_t y_up = fCnaParHistos->BoxBottomY("top_left_box_EE") - 0.005;
5632       TVirtualPad* main_subpad = gPad;
5633       main_subpad->SetPad(x_low, y_low, x_up, y_up);
5634     }
5635 
5636     //------------------------------------------------------------
5637     h_geo_bid->GetXaxis()->SetTitle(axis_x_var_name);
5638     h_geo_bid->GetYaxis()->SetTitle(axis_y_var_name);
5639 
5640     h_geo_bid->DrawCopy("COLZ");
5641 
5642     // trace de la grille  ---------------- (ViewStas)
5643     ViewStasGrid(vertic_empty_strips);
5644     gPad->Draw();
5645     gPad->Update();
5646 
5647     //      delete MainCanvas;              fCdeleteRoot++;
5648   }
5649   //..................... retour aux options standard
5650 
5651   Bool_t b_true = true;
5652   h_geo_bid->SetStats(b_true);
5653   h_geo_bid->Delete();
5654   h_geo_bid = nullptr;
5655   fCdeleteRoot++;
5656 
5657 }  // end of ViewStas(...)
5658 
5659 //==================================================================================
5660 //
5661 //                         GetXStinInStas , GetYStinInStas
5662 //
5663 //==================================================================================
5664 Int_t TEcnaHistos::GetXStinInStas(const Int_t& iStasStex,
5665                                   const Int_t& StexStinEcna,
5666                                   const Int_t& vertic_empty_strip_1) {
5667   //Gives the X Stin coordinate in the geographic view of the Stas
5668   // (X = 0 to MaxStexHocoInStas*MaxStinHocoInStex - 1 + vertic_empty_strips(EE only))
5669 
5670   Int_t ix_geo = 0;
5671   Int_t n1StasStex = iStasStex + 1;
5672   TString ctype = fEcalNumbering->GetStexHalfStas(n1StasStex);
5673 
5674   if (fFlagSubDet == "EB") {
5675     if (ctype == "EB-") {
5676       ix_geo = (iStasStex - fEcal->MaxStexInStasMinus()) * fEcal->MaxStinVecoInStex() +
5677                StexStinEcna % fEcal->MaxStinVecoInStex();
5678     }
5679     if (ctype == "EB+") {
5680       ix_geo = iStasStex * fEcal->MaxStinVecoInStex() + fEcal->MaxStinVecoInStex() - 1 -
5681                StexStinEcna % fEcal->MaxStinVecoInStex();
5682     }
5683   }
5684 
5685   if (fFlagSubDet == "EE") {
5686     TString LeftRightFromIP = fEcalNumbering->GetDeeDirViewedFromIP(n1StasStex);
5687 
5688     if (ctype == "EE-" && LeftRightFromIP == "left") {
5689       ix_geo = fEcal->MaxStinHocoInStex() - StexStinEcna / fEcal->MaxStinVecoInStex() - 1 + vertic_empty_strip_1;
5690     }
5691     if (ctype == "EE-" && LeftRightFromIP == "right") {
5692       ix_geo = fEcal->MaxStinHocoInStex() + StexStinEcna / fEcal->MaxStinVecoInStex() + vertic_empty_strip_1;
5693     }
5694     if (ctype == "EE+" && LeftRightFromIP == "left") {
5695       ix_geo = (Int_t)fCnaParHistos->DeeOffsetX(fFlagSubDet, n1StasStex) + fEcal->MaxStinHocoInStex() -
5696                StexStinEcna / fEcal->MaxStinVecoInStex() - 1;
5697     }
5698     if (ctype == "EE+" && LeftRightFromIP == "right") {
5699       ix_geo = (Int_t)fCnaParHistos->DeeOffsetX(fFlagSubDet, n1StasStex) + StexStinEcna / fEcal->MaxStinVecoInStex();
5700     }
5701   }
5702   return ix_geo;
5703 }
5704 
5705 Int_t TEcnaHistos::GetYStinInStas(const Int_t& iStasStex, const Int_t& StexStinEcna) {
5706   //Gives the Y crystal coordinate in the geographic view of one Stex
5707   // (Y = 0 to MaxStexVecoInStas*MaxStinVecoInStex - 1)
5708 
5709   Int_t iy_geo = 0;
5710 
5711   if (fFlagSubDet == "EB") {
5712     Int_t n1StasStex = iStasStex + 1;
5713     TString ctype = fEcalNumbering->GetStexHalfStas(n1StasStex);
5714     if (ctype == "EB+") {
5715       iy_geo = StexStinEcna / fEcal->MaxStinVecoInStex() + fEcal->MaxStinHocoInStex();
5716     }
5717     if (ctype == "EB-") {
5718       iy_geo = fEcal->MaxStinHocoInStex() - 1 - StexStinEcna / fEcal->MaxStinVecoInStex();
5719     }
5720   }
5721 
5722   if (fFlagSubDet == "EE") {
5723     iy_geo = StexStinEcna % fEcal->MaxStinVecoInStex();
5724   }
5725   return iy_geo;
5726 }
5727 
5728 //==========================================================================
5729 //
5730 //                       ViewStasGrid
5731 //              independent of the ROOT file
5732 //
5733 //==========================================================================
5734 void TEcnaHistos::ViewStasGrid(const Int_t& vertic_empty_strips) {
5735   //Grid of Stas with axis Hoco and Veco
5736 
5737   if (fFlagSubDet == "EB") {
5738     ViewEBGrid();
5739   }
5740   if (fFlagSubDet == "EE") {
5741     ViewEEGrid(vertic_empty_strips);
5742   }
5743 
5744 }  // end of ViewStasGrid
5745 
5746 void TEcnaHistos::ViewEBGrid() {
5747   //Grid of EB with axis Hoco and Veco
5748 
5749   Int_t GeoBidSizeEta = fEcal->MaxSMEtaInEB() * fEcal->MaxTowEtaInSM();
5750   Int_t GeoBidSizePhi = fEcal->MaxSMPhiInEB() * fEcal->MaxTowPhiInSM();
5751 
5752   Int_t size_y = fEcal->MaxTowEtaInSM();
5753   Int_t size_x = fEcal->MaxTowPhiInSM();
5754 
5755   Int_t nb_binx = GeoBidSizePhi;
5756   Int_t nb_biny = GeoBidSizeEta;
5757   Axis_t xinf_bid = (Axis_t)0.;
5758   Axis_t xsup_bid = (Axis_t)nb_binx;
5759   Axis_t yinf_bid = (Axis_t)0.;
5760   Axis_t ysup_bid = (Axis_t)nb_biny;
5761 
5762   //---------------- trace de la grille: un rectangle = un SM
5763 
5764   Int_t max_x = nb_binx / size_x;  // = fEcal->MaxSMPhiInEB()
5765   Int_t max_y = nb_biny / size_y;  // = fEcal->MaxSMEtaInEB()
5766 
5767   //............................. lignes horizontales  (ViewEBGrid)
5768   Double_t yline = (Double_t)yinf_bid;
5769 
5770   Double_t xline_left = (Double_t)xinf_bid;
5771   Double_t xline_right = (Double_t)xsup_bid;
5772 
5773   for (Int_t j = 0; j < max_y; j++) {
5774     yline = yline + (Double_t)size_y;
5775     TLine* lin;
5776     lin = new TLine(xline_left, yline, xline_right, yline);
5777     fCnewRoot++;
5778     lin->Draw();
5779     // delete lin;             fCdeleteRoot++;
5780   }
5781 
5782   //-------------------------------- lignes verticales
5783   Double_t xline = (Double_t)xinf_bid - (Double_t)size_x;
5784 
5785   Double_t yline_bot = (Double_t)yinf_bid;
5786   Double_t yline_top = (Double_t)ysup_bid;
5787 
5788   for (Int_t i = 0; i < max_x; i++) {
5789     xline = xline + (Double_t)size_x;
5790     TLine* lin;
5791     lin = new TLine(xline, yline_bot, xline, yline_top);
5792     fCnewRoot++;
5793     lin->Draw();
5794   }
5795 
5796   //-------------------------------- Numeros des SM
5797   Double_t yTextBot = yline_bot - (yline_top - yline_bot) / 25.;
5798   Double_t yTextTop = yline_top + (yline_top - yline_bot) / 120.;
5799   xline = (Double_t)xinf_bid - (Double_t)size_x;
5800 
5801   char f_in[charArrLen];
5802   TText* text_SM = new TText();
5803   fCnewRoot++;
5804   for (Int_t i = 0; i < max_x; i++) {
5805     xline = xline + (Double_t)size_x;
5806     text_SM->SetTextColor(fCnaParHistos->ColorDefinition("bleu_fonce"));
5807     text_SM->SetTextSize((Double_t)0.03);
5808     sprintf(f_in, "  +%d", i + 1);
5809     text_SM->DrawText(xline, yTextTop, f_in);
5810     sprintf(f_in, "  %d", -i - 1);
5811     text_SM->DrawText(xline, yTextBot, f_in);
5812   }
5813 
5814   //------------------ trace axes en eta et phi --------------- ViewEBGrid
5815 
5816   Int_t SMNumber = 1;
5817 
5818   //...................................................... Axe i(phi) (bottom x) ViewEBGrid
5819   Int_t MatSize = fEcal->MaxTowPhiInSM();
5820   Int_t size_x_eb = fEcal->MaxSMPhiInEB();
5821   Double_t phi_min = 0;
5822   Double_t phi_max = 360;
5823 
5824   TString x_var_name = GetHocoVecoAxisTitle("iphiEB");
5825   ;
5826   TString x_direction = fEcalNumbering->GetXDirectionEB(SMNumber);
5827 
5828   new TF1("f1", x_direction.Data(), phi_min, phi_max);
5829   fCnewRoot++;
5830   TGaxis* sup_axis_x = nullptr;
5831 
5832   if (x_direction == "-x")  // NEVER  IN THIS CASE: xmin->xmax <=> right->left ("-x") direction
5833   {
5834     sup_axis_x =
5835         new TGaxis((Float_t)0., (Float_t)0., (Float_t)(size_x_eb * MatSize), (Float_t)0., "f1", size_x_eb, "SC", 0.);
5836     fCnewRoot++;
5837   }
5838 
5839   if (x_direction == "x")  // ALWAYS IN THIS CASE: xmin->xmax <=> left->right ("x") direction
5840   {
5841     sup_axis_x =
5842         new TGaxis((Float_t)0., (Float_t)0., (Float_t)(size_x_eb * MatSize), (Float_t)0., "f1", size_x_eb, "SC", 0.);
5843     fCnewRoot++;
5844   }
5845 
5846   Float_t tit_siz_x = fCnaParHistos->AxisTitleSize();
5847   Float_t lab_siz_x = fCnaParHistos->AxisLabelSize("EBx");
5848   Float_t tic_siz_x = fCnaParHistos->AxisTickSize("SMx");
5849   Float_t tit_off_x = fCnaParHistos->AxisTitleOffset("EBx");
5850   Float_t lab_off_x = fCnaParHistos->AxisLabelOffset("EBx");
5851 
5852   if (sup_axis_x != nullptr) {
5853     sup_axis_x->SetTitle(x_var_name);
5854     sup_axis_x->SetTitleSize(tit_siz_x);
5855     sup_axis_x->SetTitleOffset(tit_off_x);
5856     sup_axis_x->SetLabelSize(lab_siz_x);
5857     sup_axis_x->SetLabelOffset(lab_off_x);
5858     sup_axis_x->SetTickSize(tic_siz_x);
5859     sup_axis_x->Draw("SAME");
5860   }
5861 
5862   //...................................................... Axe eta (y) ViewEBGrid
5863   MatSize = fEcal->MaxTowEtaInSM();
5864   Int_t size_y_eb = fEcal->MaxSMEtaInEB();
5865 
5866   Double_t eta_min = (Double_t)(-85.);
5867   Double_t eta_max = (Double_t)85.;
5868 
5869   TString y_var_name = GetHocoVecoAxisTitle("ietaEB");
5870 
5871   TGaxis* sup_axis_y = nullptr;
5872   sup_axis_y = new TGaxis(
5873       (Float_t)0., (Float_t)0., (Float_t)0., (Float_t)(size_y_eb * MatSize), eta_min, eta_max, MatSize / 2, "SC", 0.);
5874   fCnewRoot++;
5875 
5876   Float_t tit_siz_y = fCnaParHistos->AxisTitleSize();
5877   Float_t lab_siz_y = fCnaParHistos->AxisLabelSize("EBy");
5878   Float_t tic_siz_y = fCnaParHistos->AxisTickSize("SMy");
5879   Float_t tit_off_y = fCnaParHistos->AxisTitleOffset("EBy");
5880   Float_t lab_off_y = fCnaParHistos->AxisLabelOffset("EBy");
5881 
5882   sup_axis_y->SetTitle(y_var_name);
5883   sup_axis_y->SetTitleSize(tit_siz_y);
5884   sup_axis_y->SetTitleOffset(tit_off_y);
5885   sup_axis_y->SetLabelColor(1);
5886   sup_axis_y->SetLabelSize(lab_siz_y);
5887   sup_axis_y->SetLabelOffset(lab_off_y);
5888   sup_axis_y->SetTickSize(tic_siz_y);
5889   sup_axis_y->Draw("SAME");
5890 
5891   //f2 = 0;
5892 
5893   gStyle->SetTextColor(fCnaParHistos->ColorDefinition("noir"));
5894 
5895 }  // end of ViewEBGrid
5896 //---------------------------------------------------------------------
5897 void TEcnaHistos::ViewEEGrid(const Int_t& vertic_empty_strips) {
5898   //Grid of EE with axis Hoco and Veco
5899 
5900   Float_t coefcc_x = (Float_t)1. / (Float_t)5.;
5901   Float_t coefcc_y = (Float_t)1. / (Float_t)5.;
5902 
5903   for (Int_t DeeNumber = 1; DeeNumber <= 4; DeeNumber++) {
5904     EEDataSectors(coefcc_x, coefcc_y, DeeNumber, "EE");
5905     EEGridAxis(DeeNumber, "EE", " ");
5906   }
5907 
5908   // vertical line between the two endcaps
5909   Double_t xline = (Double_t)coefcc_x * ((Double_t)2. * fEcal->MaxCrysIXInDee() +
5910                                          ((Double_t)vertic_empty_strips) / (Double_t)2. * fEcal->MaxCrysIXInSC());
5911 
5912   Double_t yline_bot = (Double_t)coefcc_y * (Double_t)0.;
5913   Double_t yline_top = (Double_t)coefcc_y * (Double_t)fEcal->MaxCrysIYInDee();
5914 
5915   TLine* lin;
5916   lin = new TLine(xline, yline_bot, xline, yline_top);
5917   fCnewRoot++;
5918   lin->Draw();
5919 
5920   // vertical line in the midles of the two endcaps
5921   //  xline = xline + coefcc_x*( fEcal->MaxCrysIXInDee()+ 0.5*fEcal->MaxCrysIXInSC() );
5922   xline = (Double_t)coefcc_x *
5923           (3 * fEcal->MaxCrysIXInDee() + ((Double_t)vertic_empty_strips - 1.) * fEcal->MaxCrysIXInSC());
5924   TLine* lin12;
5925   lin12 = new TLine(xline, yline_bot, xline, yline_top);
5926   fCnewRoot++;
5927   lin12->SetLineStyle(2);
5928   lin12->Draw();
5929 
5930   xline =
5931       (Double_t)coefcc_x * (fEcal->MaxCrysIXInDee() + ((Double_t)vertic_empty_strips) / 3. * fEcal->MaxCrysIXInSC());
5932   TLine* lin34;
5933   lin34 = new TLine(xline, yline_bot, xline, yline_top);
5934   fCnewRoot++;
5935   lin34->SetLineStyle(2);
5936   lin34->Draw();
5937 
5938   // horizontal line at IY = 50
5939   Double_t xline_end =
5940       (Double_t)coefcc_x * (4 * fEcal->MaxCrysIXInDee() + vertic_empty_strips * fEcal->MaxCrysIXInSC());
5941   Double_t yline_mid = (Double_t)coefcc_x * fEcal->MaxCrysIYInDee() / 2;
5942 
5943   TLine* linh;
5944   linh = new TLine(0., yline_mid, xline_end, yline_mid);
5945   fCnewRoot++;
5946   linh->SetLineStyle(2);
5947   linh->Draw();
5948 
5949 }  // end of ViewEEGrid
5950 
5951 //==================================================================================================
5952 void TEcnaHistos::EEDataSectors(const Float_t& coefcc_x,
5953                                 const Float_t& coefcc_y,
5954                                 const Int_t& DeeNumber,
5955                                 const TString& opt_plot) {
5956   //Surlignage des bords du Dee et des Data Sectors. Numeros des secteurs.
5957 
5958   // Epaisseur du trait selon option
5959   Int_t LineWidth = 2;  // DEFAULT => option "EE"
5960   if (opt_plot == "Dee") {
5961     LineWidth = 3;
5962   }
5963 
5964   Int_t ngmax = 0;
5965   // surlignage du bord interne du Dee (unite de coordonnees: le cristal)
5966   ngmax = 13;
5967   Float_t xg_dee_int_bot[13] = {0, 5, 5, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11};
5968   Float_t yg_dee_int_bot[13] = {39, 39, 40, 40, 41, 41, 42, 42, 43, 43, 45, 45, 50};
5969 
5970   for (Int_t i = 0; i < ngmax; i++) {
5971     xg_dee_int_bot[i] = coefcc_x * xg_dee_int_bot[i];
5972     yg_dee_int_bot[i] = coefcc_y * yg_dee_int_bot[i];
5973   }
5974 
5975   Float_t XgDeeIntBotRight[13];
5976   Float_t YgDeeIntBotRight[13];
5977   Float_t XgDeeIntTopRight[13];
5978   Float_t YgDeeIntTopRight[13];
5979 
5980   for (Int_t i = 0; i < ngmax; i++) {
5981     XgDeeIntBotRight[i] = xg_dee_int_bot[i];
5982     YgDeeIntBotRight[i] = yg_dee_int_bot[i];
5983     XgDeeIntTopRight[i] = XgDeeIntBotRight[i];
5984     YgDeeIntTopRight[i] = coefcc_y * fEcal->MaxCrysIYInDee() - YgDeeIntBotRight[i];
5985     if (DeeNumber == 2 || DeeNumber == 4) {
5986       XgDeeIntBotRight[i] = -XgDeeIntBotRight[i] + coefcc_x * fEcal->MaxCrysIXInDee();
5987       XgDeeIntTopRight[i] = -XgDeeIntTopRight[i] + coefcc_x * fEcal->MaxCrysIXInDee();
5988     }
5989     XgDeeIntBotRight[i] += fCnaParHistos->DeeOffsetX(opt_plot, DeeNumber);
5990     XgDeeIntTopRight[i] += fCnaParHistos->DeeOffsetX(opt_plot, DeeNumber);
5991   }
5992 
5993   TGraph* BDeeIntBotRight = new TGraph(ngmax, XgDeeIntBotRight, YgDeeIntBotRight);
5994   BDeeIntBotRight->SetLineWidth(LineWidth);
5995   BDeeIntBotRight->DrawGraph(ngmax, XgDeeIntBotRight, YgDeeIntBotRight);
5996 
5997   TGraph* BDeeIntTopRight = new TGraph(ngmax, XgDeeIntTopRight, YgDeeIntTopRight);
5998   BDeeIntTopRight->SetLineWidth(LineWidth);
5999   BDeeIntTopRight->DrawGraph(ngmax, XgDeeIntTopRight, YgDeeIntTopRight);
6000 
6001   // surlignage du bord externe du Dee  (unite de coordonnees: le cristal)
6002   ngmax = 21;
6003   Float_t xg_dee_ext_bot[21] = {0, 10, 10, 15, 15, 25, 25, 30, 30, 35, 35, 37, 37, 42, 42, 45, 45, 47, 47, 50, 50};
6004   Float_t yg_dee_ext_bot[21] = {0, 0, 3, 3, 5, 5, 8, 8, 13, 13, 15, 15, 20, 20, 25, 25, 35, 35, 40, 40, 50};
6005   for (Int_t i = 0; i < ngmax; i++) {
6006     xg_dee_ext_bot[i] = coefcc_x * xg_dee_ext_bot[i];
6007     yg_dee_ext_bot[i] = coefcc_y * yg_dee_ext_bot[i];
6008   }
6009 
6010   Float_t XgDeeExtBotRight[21];
6011   Float_t YgDeeExtBotRight[21];
6012   Float_t XgDeeExtTopRight[21];
6013   Float_t YgDeeExtTopRight[21];
6014 
6015   for (Int_t i = 0; i < ngmax; i++) {
6016     XgDeeExtBotRight[i] = xg_dee_ext_bot[i];
6017     YgDeeExtBotRight[i] = yg_dee_ext_bot[i];
6018     XgDeeExtTopRight[i] = XgDeeExtBotRight[i];
6019     YgDeeExtTopRight[i] = coefcc_y * fEcal->MaxCrysIYInDee() - YgDeeExtBotRight[i];
6020     if (DeeNumber == 2 || DeeNumber == 4) {
6021       XgDeeExtBotRight[i] = -XgDeeExtBotRight[i] + coefcc_x * fEcal->MaxCrysIXInDee();
6022       XgDeeExtTopRight[i] = -XgDeeExtTopRight[i] + coefcc_x * fEcal->MaxCrysIXInDee();
6023     }
6024     XgDeeExtBotRight[i] += fCnaParHistos->DeeOffsetX(opt_plot, DeeNumber);
6025     XgDeeExtTopRight[i] += fCnaParHistos->DeeOffsetX(opt_plot, DeeNumber);
6026   }
6027 
6028   TGraph* BDeeExtBotRight = new TGraph(ngmax, XgDeeExtBotRight, YgDeeExtBotRight);
6029   BDeeExtBotRight->SetLineWidth(LineWidth);
6030   BDeeExtBotRight->DrawGraph(ngmax, XgDeeExtBotRight, YgDeeExtBotRight);
6031 
6032   TGraph* BDeeExtTopRight = new TGraph(ngmax, XgDeeExtTopRight, YgDeeExtTopRight);
6033   BDeeExtTopRight->SetLineWidth(LineWidth);
6034   BDeeExtTopRight->DrawGraph(ngmax, XgDeeExtTopRight, YgDeeExtTopRight);
6035 
6036   char f_in[charArrLen];
6037 
6038   //............. Surlignage separateurs des secteurs en phi (Data sectors)
6039 
6040   //================== S9 -> S1 (EE-) option "EE" seulement
6041   if (opt_plot == "EE") {
6042     ngmax = 2;
6043     Float_t xg_dee_data_sec9[2] = {0, 0};
6044     Float_t yg_dee_data_sec9[2] = {61, 100};
6045     for (Int_t i = 0; i < ngmax; i++) {
6046       xg_dee_data_sec9[i] = coefcc_x * xg_dee_data_sec9[i];
6047       yg_dee_data_sec9[i] = coefcc_y * yg_dee_data_sec9[i];
6048     }
6049 
6050     Float_t XgDeeDataSec9[11];
6051     Float_t YgDeeDataSec9[11];
6052     for (Int_t i = 0; i < ngmax; i++) {
6053       XgDeeDataSec9[i] = xg_dee_data_sec9[i];
6054       YgDeeDataSec9[i] = yg_dee_data_sec9[i];
6055       if (DeeNumber == 2 || DeeNumber == 4) {
6056         XgDeeDataSec9[i] = -XgDeeDataSec9[i] + coefcc_x * fEcal->MaxCrysIXInDee();
6057       }
6058       XgDeeDataSec9[i] += fCnaParHistos->DeeOffsetX(opt_plot, DeeNumber);
6059     }
6060     TGraph* BDeeDataSec9 = new TGraph(ngmax, XgDeeDataSec9, YgDeeDataSec9);
6061     BDeeDataSec9->SetLineWidth(LineWidth);
6062     BDeeDataSec9->DrawGraph(ngmax, XgDeeDataSec9, YgDeeDataSec9);
6063   }
6064 
6065   //================= S1->S2(EE-)
6066   ngmax = 11;
6067   Float_t xg_dee_data_sec1[11] = {7, 10, 10, 15, 15, 20, 20, 25, 25, 30, 30};
6068   Float_t yg_dee_data_sec1[11] = {60, 60, 65, 65, 70, 70, 75, 75, 85, 85, 87};
6069   for (Int_t i = 0; i < ngmax; i++) {
6070     xg_dee_data_sec1[i] = coefcc_x * xg_dee_data_sec1[i];
6071     yg_dee_data_sec1[i] = coefcc_y * yg_dee_data_sec1[i];
6072   }
6073 
6074   Float_t XgDeeDataSec1[11];
6075   Float_t YgDeeDataSec1[11];
6076   for (Int_t i = 0; i < ngmax; i++) {
6077     XgDeeDataSec1[i] = xg_dee_data_sec1[i];
6078     YgDeeDataSec1[i] = yg_dee_data_sec1[i];
6079     if (DeeNumber == 2 || DeeNumber == 4) {
6080       XgDeeDataSec1[i] = -XgDeeDataSec1[i] + coefcc_x * fEcal->MaxCrysIXInDee();
6081     }
6082     XgDeeDataSec1[i] += fCnaParHistos->DeeOffsetX(opt_plot, DeeNumber);
6083   }
6084 
6085   TGraph* BDeeDataSec1 = new TGraph(ngmax, XgDeeDataSec1, YgDeeDataSec1);
6086   BDeeDataSec1->SetLineWidth(LineWidth);
6087   BDeeDataSec1->DrawGraph(ngmax, XgDeeDataSec1, YgDeeDataSec1);
6088 
6089   //================= S2->S3(EE-)
6090   ngmax = 6;
6091   Float_t xg_dee_data_sec2[6] = {11, 15, 15, 40, 40, 47};
6092   Float_t yg_dee_data_sec2[6] = {50, 50, 55, 55, 60, 60};
6093   for (Int_t i = 0; i < ngmax; i++) {
6094     xg_dee_data_sec2[i] = coefcc_x * xg_dee_data_sec2[i];
6095     yg_dee_data_sec2[i] = coefcc_y * yg_dee_data_sec2[i];
6096   }
6097 
6098   Float_t XgDeeDataSec2[6];
6099   Float_t YgDeeDataSec2[6];
6100   for (Int_t i = 0; i < ngmax; i++) {
6101     XgDeeDataSec2[i] = xg_dee_data_sec2[i];
6102     YgDeeDataSec2[i] = yg_dee_data_sec2[i];
6103     if (DeeNumber == 2 || DeeNumber == 4) {
6104       XgDeeDataSec2[i] = -XgDeeDataSec2[i] + coefcc_x * fEcal->MaxCrysIXInDee();
6105     }
6106     XgDeeDataSec2[i] += fCnaParHistos->DeeOffsetX(opt_plot, DeeNumber);
6107   }
6108   TGraph* BDeeDataSec2 = new TGraph(ngmax, XgDeeDataSec2, YgDeeDataSec2);
6109   BDeeDataSec2->SetLineWidth(LineWidth);
6110   BDeeDataSec2->DrawGraph(ngmax, XgDeeDataSec2, YgDeeDataSec2);
6111 
6112   //================= S3->S4(EE-)
6113   ngmax = 10;
6114   Float_t xg_dee_data_sec3[10] = {10, 15, 15, 20, 20, 30, 30, 40, 40, 42};
6115   Float_t yg_dee_data_sec3[10] = {45, 45, 40, 40, 35, 35, 30, 30, 25, 25};
6116   for (Int_t i = 0; i < ngmax; i++) {
6117     xg_dee_data_sec3[i] = coefcc_x * xg_dee_data_sec3[i];
6118     yg_dee_data_sec3[i] = coefcc_y * yg_dee_data_sec3[i];
6119   }
6120 
6121   Float_t XgDeeDataSec3[10];
6122   Float_t YgDeeDataSec3[10];
6123   for (Int_t i = 0; i < ngmax; i++) {
6124     XgDeeDataSec3[i] = xg_dee_data_sec3[i];
6125     YgDeeDataSec3[i] = yg_dee_data_sec3[i];
6126     if (DeeNumber == 2 || DeeNumber == 4) {
6127       XgDeeDataSec3[i] = -XgDeeDataSec3[i] + coefcc_x * fEcal->MaxCrysIXInDee();
6128     }
6129     XgDeeDataSec3[i] += fCnaParHistos->DeeOffsetX(opt_plot, DeeNumber);
6130   }
6131   TGraph* BDeeDataSec3 = new TGraph(ngmax, XgDeeDataSec3, YgDeeDataSec3);
6132   BDeeDataSec3->SetLineWidth(LineWidth);
6133   BDeeDataSec3->DrawGraph(ngmax, XgDeeDataSec3, YgDeeDataSec3);
6134 
6135   //================= S4->S5(EE-)
6136   ngmax = 6;
6137   Float_t xg_dee_data_sec4[6] = {5, 5, 10, 10, 15, 15};
6138   Float_t yg_dee_data_sec4[6] = {40, 30, 30, 15, 15, 5};
6139   for (Int_t i = 0; i < ngmax; i++) {
6140     xg_dee_data_sec4[i] = coefcc_x * xg_dee_data_sec4[i];
6141     yg_dee_data_sec4[i] = coefcc_y * yg_dee_data_sec4[i];
6142   }
6143 
6144   Float_t XgDeeDataSec4[6];
6145   Float_t YgDeeDataSec4[6];
6146   for (Int_t i = 0; i < ngmax; i++) {
6147     XgDeeDataSec4[i] = xg_dee_data_sec4[i];
6148     YgDeeDataSec4[i] = yg_dee_data_sec4[i];
6149     if (DeeNumber == 2 || DeeNumber == 4) {
6150       XgDeeDataSec4[i] = -XgDeeDataSec4[i] + coefcc_x * fEcal->MaxCrysIXInDee();
6151     }
6152     XgDeeDataSec4[i] += fCnaParHistos->DeeOffsetX(opt_plot, DeeNumber);
6153   }
6154   TGraph* BDeeDataSec4 = new TGraph(ngmax, XgDeeDataSec4, YgDeeDataSec4);
6155   BDeeDataSec4->SetLineWidth(LineWidth);
6156   BDeeDataSec4->DrawGraph(ngmax, XgDeeDataSec4, YgDeeDataSec4);
6157 
6158   //..................................... Numeros des secteurs S_i (option "Dee" seulement)
6159   if (opt_plot == "Dee" || opt_plot == "EE") {
6160     //............. Coordonnees des numeros de secteurs
6161     ngmax = 5;
6162     Float_t xg_coord_sector[5] = {16, 41, 45, 33, -2};
6163     Float_t yg_coord_sector[5] = {96, 83, 30, 5, -8};
6164 
6165     //....... Reprise secteurs 3 et 7
6166     if (opt_plot == "Dee" && (DeeNumber == 1)) {
6167       xg_coord_sector[2] += 0.5;
6168     }
6169     if (opt_plot == "Dee" && (DeeNumber == 2)) {
6170       xg_coord_sector[2] -= 1.;
6171     }
6172     if (opt_plot == "Dee" && (DeeNumber == 3)) {
6173       xg_coord_sector[2] += 0.7;
6174     }
6175     if (opt_plot == "Dee" && (DeeNumber == 4)) {
6176       xg_coord_sector[2] -= 1.2;
6177     }
6178 
6179     if (opt_plot == "EE" && (DeeNumber == 2 || DeeNumber == 3)) {
6180       xg_coord_sector[2] += 0.55;
6181     }
6182     if (opt_plot == "EE" && (DeeNumber == 4)) {
6183       xg_coord_sector[2] -= 0.2;
6184     }
6185 
6186     for (Int_t i = 0; i < ngmax; i++) {
6187       xg_coord_sector[i] = coefcc_x * xg_coord_sector[i];
6188       yg_coord_sector[i] = coefcc_y * yg_coord_sector[i];
6189     }
6190 
6191     Float_t xg_sector[9];
6192     Float_t yg_sector[9];
6193     Int_t ns1 = 1;
6194     Int_t ns2 = 5;
6195     Float_t xinv_d2d4 = coefcc_x * 44;
6196 
6197     if (DeeNumber == 1) {
6198       ns1 = 1;
6199       ns2 = 5;
6200       xg_sector[1 - ns1] = xg_coord_sector[1 - ns1];
6201       yg_sector[1 - ns1] = yg_coord_sector[1 - ns1];
6202       xg_sector[2 - ns1] = xg_coord_sector[2 - ns1];
6203       yg_sector[2 - ns1] = yg_coord_sector[2 - ns1];
6204       xg_sector[3 - ns1] = xg_coord_sector[3 - ns1];
6205       yg_sector[3 - ns1] = yg_coord_sector[3 - ns1];
6206       xg_sector[4 - ns1] = xg_coord_sector[4 - ns1];
6207       yg_sector[4 - ns1] = yg_coord_sector[4 - ns1];
6208       xg_sector[5 - ns1] = xg_coord_sector[5 - ns1];
6209       yg_sector[5 - ns1] = yg_coord_sector[5 - ns1];
6210     }
6211 
6212     if (DeeNumber == 2) {
6213       ns1 = 5;
6214       ns2 = 9;
6215       xg_sector[ns2 - 1] = xinv_d2d4 - xg_coord_sector[1 - 1];
6216       yg_sector[ns2 - 1] = yg_coord_sector[1 - 1];
6217       xg_sector[ns2 - 2] = xinv_d2d4 - xg_coord_sector[2 - 1];
6218       yg_sector[ns2 - 2] = yg_coord_sector[2 - 1];
6219       xg_sector[ns2 - 3] = xinv_d2d4 - xg_coord_sector[3 - 1];
6220       yg_sector[ns2 - 3] = yg_coord_sector[3 - 1];
6221       xg_sector[ns2 - 4] = xinv_d2d4 - xg_coord_sector[4 - 1];
6222       yg_sector[ns2 - 4] = yg_coord_sector[4 - 1];
6223       xg_sector[ns2 - 5] = xinv_d2d4 - xg_coord_sector[5 - 1];
6224       yg_sector[ns2 - 5] = yg_coord_sector[5 - 1];
6225     }
6226     if (DeeNumber == 3) {
6227       ns1 = 5;
6228       ns2 = 9;
6229       xg_sector[ns2 - 1] = xg_coord_sector[1 - 1];
6230       yg_sector[ns2 - 1] = yg_coord_sector[1 - 1];
6231       xg_sector[ns2 - 2] = xg_coord_sector[2 - 1];
6232       yg_sector[ns2 - 2] = yg_coord_sector[2 - 1];
6233       xg_sector[ns2 - 3] = xg_coord_sector[3 - 1];
6234       yg_sector[ns2 - 3] = yg_coord_sector[3 - 1];
6235       xg_sector[ns2 - 4] = xg_coord_sector[4 - 1];
6236       yg_sector[ns2 - 4] = yg_coord_sector[4 - 1];
6237       xg_sector[ns2 - 5] = xg_coord_sector[5 - 1];
6238       yg_sector[ns2 - 5] = yg_coord_sector[5 - 1];
6239     }
6240     if (DeeNumber == 4) {
6241       ns1 = 1;
6242       ns2 = 5;
6243       xg_sector[1 - ns1] = xinv_d2d4 - xg_coord_sector[1 - ns1];
6244       yg_sector[1 - ns1] = yg_coord_sector[1 - ns1];
6245       xg_sector[2 - ns1] = xinv_d2d4 - xg_coord_sector[2 - ns1];
6246       yg_sector[2 - ns1] = yg_coord_sector[2 - ns1];
6247       xg_sector[3 - ns1] = xinv_d2d4 - xg_coord_sector[3 - ns1];
6248       yg_sector[3 - ns1] = yg_coord_sector[3 - ns1];
6249       xg_sector[4 - ns1] = xinv_d2d4 - xg_coord_sector[4 - ns1];
6250       yg_sector[4 - ns1] = yg_coord_sector[4 - ns1];
6251       xg_sector[5 - ns1] = xinv_d2d4 - xg_coord_sector[5 - ns1];
6252       yg_sector[5 - ns1] = yg_coord_sector[5 - ns1];
6253     }
6254 
6255     Color_t coul_textsector = fCnaParHistos->ColorDefinition("vert37");
6256     for (Int_t ns = ns1; ns <= ns2; ns++) {
6257       xg_sector[ns - 1] += fCnaParHistos->DeeOffsetX(opt_plot, DeeNumber);
6258       if (DeeNumber == 1 || DeeNumber == 2) {
6259         sprintf(f_in, "+%d", ns);
6260       }
6261       if (DeeNumber == 3 || DeeNumber == 4) {
6262         sprintf(f_in, "-%d", ns);
6263       }
6264       TText* text_num_module = new TText(xg_sector[ns - 1], yg_sector[ns - 1], f_in);
6265       fCnewRoot++;
6266       if (opt_plot == "Dee") {
6267         text_num_module->SetTextSize(0.065);
6268       }
6269       if (opt_plot == "EE") {
6270         text_num_module->SetTextSize(0.045);
6271       }
6272       text_num_module->SetTextColor(coul_textsector);
6273       if (opt_plot == "Dee" || (opt_plot == "EE" && !((DeeNumber == 3 && ns == 5) || (DeeNumber == 1 && ns == 5)))) {
6274         text_num_module->Draw();
6275       }
6276 
6277       // text_num_module->Delete(); text_num_module = 0;     fCdeleteRoot++;
6278     }
6279 
6280     //............................ numeros des dee's
6281     Float_t xg_coord_dee[4] = {0, 0, 0, 0};
6282     Float_t yg_coord_dee[4] = {48, 48, 48, 48};
6283 
6284     xg_coord_dee[DeeNumber - 1] = coefcc_x * xg_coord_dee[DeeNumber - 1];
6285     yg_coord_dee[DeeNumber - 1] = coefcc_y * yg_coord_dee[DeeNumber - 1];
6286 
6287     Float_t xg_dee = xg_coord_dee[DeeNumber - 1];
6288     Float_t yg_dee = yg_coord_dee[DeeNumber - 1];
6289 
6290     Color_t coul_textdee = fCnaParHistos->ColorDefinition("noir");
6291 
6292     xg_dee += fCnaParHistos->DeeOffsetX(opt_plot, DeeNumber) + fCnaParHistos->DeeNumberOffsetX(opt_plot, DeeNumber);
6293 
6294     if (DeeNumber == 1) {
6295       sprintf(f_in, "D1");
6296     }
6297     if (DeeNumber == 2) {
6298       sprintf(f_in, "D2");
6299     }
6300     if (DeeNumber == 3) {
6301       sprintf(f_in, "D3");
6302     }
6303     if (DeeNumber == 4) {
6304       sprintf(f_in, "D4");
6305     }
6306 
6307     TText* text_num_module = new TText(xg_dee, yg_dee, f_in);
6308     fCnewRoot++;
6309     if (opt_plot == "EE") {
6310       text_num_module->SetTextSize(0.045);
6311     }
6312     if (opt_plot == "Dee") {
6313       text_num_module->SetTextSize(0.085);
6314     }
6315     text_num_module->SetTextColor(coul_textdee);
6316     text_num_module->Draw();
6317   }
6318 
6319   //..................................... Numeros des Dee et indication EE+- (option "EE" seulement)
6320   if (opt_plot == "EE") {
6321     //............................ indication EE+-
6322     Float_t xg_coord_eepm[4] = {0, 0, 0, 0};
6323     Float_t yg_coord_eepm[4] = {95, 95, 95, 95};
6324 
6325     xg_coord_eepm[DeeNumber - 1] = coefcc_x * xg_coord_eepm[DeeNumber - 1];
6326     yg_coord_eepm[DeeNumber - 1] = coefcc_y * yg_coord_eepm[DeeNumber - 1];
6327 
6328     Float_t xg_eepm = xg_coord_eepm[DeeNumber - 1];
6329     Float_t yg_eepm = yg_coord_eepm[DeeNumber - 1];
6330 
6331     Color_t coul_texteepm = fCnaParHistos->ColorDefinition("noir");
6332 
6333     xg_eepm += fCnaParHistos->DeeOffsetX(opt_plot, DeeNumber) + fCnaParHistos->DeeNameOffsetX(DeeNumber);
6334 
6335     if (DeeNumber == 1) {
6336       sprintf(f_in, "EE+F");
6337     }
6338     if (DeeNumber == 2) {
6339       sprintf(f_in, "EE+N");
6340     }
6341     if (DeeNumber == 3) {
6342       sprintf(f_in, "EE-N");
6343     }
6344     if (DeeNumber == 4) {
6345       sprintf(f_in, "EE-F");
6346     }
6347 
6348     TText* text_num_eepm = new TText(xg_eepm, yg_eepm, f_in);
6349     fCnewRoot++;
6350     text_num_eepm->SetTextSize(0.04);
6351     text_num_eepm->SetTextColor(coul_texteepm);
6352     text_num_eepm->Draw();
6353   }
6354 
6355   //......................... mention "viewed from IP"
6356   Color_t coul_textfromIP = fCnaParHistos->ColorDefinition("rouge49");
6357   sprintf(f_in, "viewed from IP");
6358   Float_t x_from_ip = 15.;
6359   Float_t y_from_ip = -10.;
6360   if (opt_plot == "EE") {
6361     y_from_ip = -16.;
6362   }
6363   x_from_ip = coefcc_x * x_from_ip;
6364   y_from_ip = coefcc_x * y_from_ip;
6365   if (opt_plot == "EE" && DeeNumber == 3) {
6366     x_from_ip += 1.4 * fCnaParHistos->DeeOffsetX(opt_plot, DeeNumber);
6367   }
6368   TText* text_from_ip = new TText(x_from_ip, y_from_ip, f_in);
6369   fCnewRoot++;
6370   text_from_ip->SetTextSize(0.045);
6371   if (opt_plot == "EE") {
6372     text_from_ip->SetTextSize(0.035);
6373   }
6374   text_from_ip->SetTextColor(coul_textfromIP);
6375   if (opt_plot == "Dee" || (opt_plot == "EE" && DeeNumber == 3)) {
6376     text_from_ip->Draw();
6377   }
6378 
6379 }  // ------ end of EEDataSectors() ------
6380 
6381 //==========================================================================================
6382 
6383 void TEcnaHistos::EEGridAxis(const Int_t& DeeNumber, const TString& opt_plot, const TString& c_option) {
6384   //------------------ trace axes en IX et IY --------------- EEGridAxis
6385   //=============================================================================== Axe IX
6386   Int_t size_IX_dee = fEcal->MaxSCIXInDee();
6387 
6388   Double_t IX_min = fEcalNumbering->GetIIXMin(1) - 0.5;                          // IX_min = 0.5  pour les 4 dee's
6389   Double_t IX_max = fEcalNumbering->GetIIXMax() * fEcal->MaxCrysIXInSC() + 0.5;  // IX_max = 50.5 pour les 4 dee's
6390 
6391   Int_t MatSize = 1;
6392   if (opt_plot == "Dee" && c_option == "corcc") {
6393     MatSize = fEcal->MaxCrysInSC();
6394     IX_min = fEcalNumbering->GetIIXMin() - 0.5;
6395     IX_max = fEcalNumbering->GetIIXMax() + 0.5;
6396   }
6397   if (opt_plot == "EE" && c_option == "corcc") {
6398     return;
6399   }  // => a voir...
6400 
6401   if (opt_plot == "Dee" && c_option != "corcc") {
6402     MatSize = fEcal->MaxCrysIXInSC();
6403   }
6404   if (opt_plot == "EE" && c_option != "corcc") {
6405     MatSize = 1;
6406   }
6407 
6408   TString x_var_name = " ";
6409 
6410   Float_t axis_x_inf = 0;
6411   Float_t axis_x_sup = 0;
6412   Float_t axis_y_inf = 0;
6413   Float_t axis_y_sup = 0;
6414   Int_t axis_nb_div = 205;  // DEFAULT: option "EE"
6415   Double_t IX_values_min = 0;
6416   Double_t IX_values_max = 0;
6417   Option_t* chopt = "C";
6418 
6419   //........................................................................EEGridAxis
6420   if (DeeNumber == 1)  //  xmin -> xmax <=> right->left
6421   {
6422     //.....axis min->max/left->right: first draw axis with -ticksize and no label
6423     axis_x_inf = size_IX_dee * MatSize;
6424     axis_x_sup = 0;
6425     axis_y_inf = 0;
6426     axis_y_sup = 0;
6427     IX_values_min = -IX_max;  // -50.5 right
6428     IX_values_max = -IX_min;  // - 0.5 left
6429     if (opt_plot == "Dee") {
6430       x_var_name = GetIXIYAxisTitle("iIXDee1");
6431     }
6432     if (opt_plot == "EE") {
6433       x_var_name = GetIXIYAxisTitle("iIXEE");
6434     }
6435     if (opt_plot == "Dee") {
6436       axis_nb_div = size_IX_dee;
6437     }
6438     chopt = "-CSU";
6439   }
6440   if (DeeNumber == 2)  //  xmin -> xmax <=> right->left
6441   {
6442     //.....axis min->max/left->right: first draw axis with -ticksize and no label
6443     axis_x_inf = size_IX_dee * MatSize;
6444     axis_x_sup = 0;
6445     axis_y_inf = 0;
6446     axis_y_sup = 0;
6447     IX_values_min = IX_min;  // + 0.5 right
6448     IX_values_max = IX_max;  // +50.5 left
6449     if (opt_plot == "Dee") {
6450       x_var_name = GetIXIYAxisTitle("iIXDee2");
6451     }
6452     if (opt_plot == "EE") {
6453       x_var_name = " ";
6454     }
6455     if (opt_plot == "Dee") {
6456       axis_nb_div = size_IX_dee;
6457     }
6458     chopt = "-CSU";
6459   }
6460   if (DeeNumber == 3)  //  xmin -> xmax <=> left->right
6461   {
6462     axis_x_inf = 0;
6463     axis_x_sup = size_IX_dee * MatSize;
6464     axis_y_inf = 0;
6465     axis_y_sup = 0;
6466     IX_values_min = IX_min;  // + 0.5 left
6467     IX_values_max = IX_max;  // +50.5 right
6468     if (opt_plot == "Dee") {
6469       x_var_name = GetIXIYAxisTitle("iIXDee3");
6470     }
6471     if (opt_plot == "EE") {
6472       x_var_name = " ";
6473     }
6474     if (opt_plot == "Dee") {
6475       axis_nb_div = size_IX_dee;
6476     }
6477     chopt = "CS";
6478   }
6479   if (DeeNumber == 4)  //  xmin -> xmax <=> left->right
6480   {
6481     axis_x_inf = 0;
6482     axis_x_sup = size_IX_dee * MatSize;
6483     axis_y_inf = 0;
6484     axis_y_sup = 0;
6485     IX_values_min = -IX_max;  // -50.5 left
6486     IX_values_max = -IX_min;  // - 0.5 right
6487     if (opt_plot == "Dee") {
6488       x_var_name = GetIXIYAxisTitle("iIXDee4");
6489     }
6490     if (opt_plot == "EE") {
6491       x_var_name = " ";
6492     }
6493     if (opt_plot == "Dee") {
6494       axis_nb_div = size_IX_dee;
6495     }
6496     chopt = "CS";
6497   }
6498 
6499   //.................................................................... EEGridAxis
6500   axis_x_inf += fCnaParHistos->DeeOffsetX(opt_plot, DeeNumber);
6501   axis_x_sup += fCnaParHistos->DeeOffsetX(opt_plot, DeeNumber);
6502 
6503   TGaxis* sup_axis_x = nullptr;
6504   sup_axis_x =
6505       new TGaxis(axis_x_inf, axis_y_inf, axis_x_sup, axis_y_sup, IX_values_min, IX_values_max, axis_nb_div, chopt, 0.);
6506   fCnewRoot++;
6507 
6508   Float_t tit_siz_x = fCnaParHistos->AxisTitleSize();
6509   Float_t lab_siz_x = fCnaParHistos->AxisLabelSize();
6510 
6511   Float_t tic_siz_x = fCnaParHistos->AxisTickSize("Deex");
6512   if (opt_plot == "EE") {
6513     tic_siz_x = fCnaParHistos->AxisTickSize("EEx");
6514   }
6515 
6516   Float_t tit_off_x = fCnaParHistos->AxisTitleOffset("Deex");
6517   if (opt_plot == "EE") {
6518     tit_off_x = fCnaParHistos->AxisTitleOffset("EEx");
6519   }
6520 
6521   Float_t lab_off_x = fCnaParHistos->AxisLabelOffset("Deex");
6522   if (opt_plot == "EE") {
6523     lab_off_x = fCnaParHistos->AxisLabelOffset("EEx");
6524   }
6525 
6526   sup_axis_x->SetTitle(x_var_name);
6527   sup_axis_x->SetTitleSize(tit_siz_x);
6528   sup_axis_x->SetTitleOffset(tit_off_x);
6529   sup_axis_x->SetLabelSize(lab_siz_x);
6530   sup_axis_x->SetLabelOffset(lab_off_x);
6531   sup_axis_x->SetTickSize(tic_siz_x);
6532   sup_axis_x->Draw("SAME");
6533 
6534   //.....axis min->max/right->left: redraw axis with ticksize = 0 and with -labelOffset
6535   if (DeeNumber == 1 || DeeNumber == 2) {
6536     chopt = "CS";
6537     TGaxis* sup_axis_x_bis = nullptr;
6538     sup_axis_x_bis = new TGaxis(
6539         axis_x_inf, axis_y_inf, axis_x_sup, axis_y_sup, IX_values_min, IX_values_max, axis_nb_div, chopt, 0.);
6540     fCnewRoot++;
6541     sup_axis_x_bis->SetTickSize(0.);
6542     lab_siz_x = sup_axis_x->GetLabelSize();
6543     sup_axis_x_bis->SetLabelSize(lab_siz_x);
6544     lab_off_x = sup_axis_x->GetLabelOffset();
6545     sup_axis_x_bis->SetLabelOffset(-lab_off_x);
6546     sup_axis_x_bis->Draw("SAME");
6547   }
6548 
6549   //================================================================== Axe IY  EEGridAxis
6550 
6551   if (opt_plot == "Dee" || (opt_plot == "EE" && DeeNumber == 4)) {
6552     Int_t size_IY_dee = fEcal->MaxSCIYInDee();
6553     Int_t size_IY_axis = size_IY_dee;
6554 
6555     if (opt_plot == "Dee") {
6556       axis_nb_div = size_IY_axis;
6557     }
6558     if (opt_plot == "EE") {
6559       axis_nb_div = 210;
6560     }
6561 
6562     Double_t jIY_min = fEcalNumbering->GetJIYMin(DeeNumber, 1) - 0.5;
6563     Double_t jIY_max = fEcalNumbering->GetJIYMax(DeeNumber) * fEcal->MaxCrysIYInSC() + 0.5;
6564 
6565     TString jy_var_name = " ";
6566     TString jy_direction = "x";
6567 
6568     Float_t tit_siz_y = fCnaParHistos->AxisTitleSize();
6569     Float_t lab_siz_y = fCnaParHistos->AxisLabelSize();
6570 
6571     Float_t tic_siz_y = fCnaParHistos->AxisTickSize("Deey");
6572     if (opt_plot == "EE") {
6573       tic_siz_y = fCnaParHistos->AxisTickSize("EEy");
6574     }
6575 
6576     Float_t tit_off_y = fCnaParHistos->AxisTitleOffset("Deey");
6577     if (opt_plot == "EE") {
6578       tit_off_y = fCnaParHistos->AxisTitleOffset("EEy");
6579     }
6580 
6581     Float_t lab_off_y = fCnaParHistos->AxisLabelOffset("Deey");
6582     if (opt_plot == "EE") {
6583       lab_off_y = fCnaParHistos->AxisLabelOffset("EEy");
6584     }
6585 
6586     TGaxis* axis_jy_plus = nullptr;
6587     axis_jy_plus = new TGaxis((Float_t)0.,
6588                               (Float_t)0.,
6589                               (Float_t)0.,
6590                               (Float_t)(size_IY_axis * MatSize),
6591                               jIY_min,
6592                               jIY_max,
6593                               axis_nb_div,
6594                               "SC",
6595                               0.);
6596     fCnewRoot++;
6597 
6598     jy_var_name = GetIXIYAxisTitle("jIYDee");
6599     axis_jy_plus->SetTitle(jy_var_name);
6600     axis_jy_plus->SetTitleSize(tit_siz_y);
6601     axis_jy_plus->SetTitleOffset(tit_off_y);
6602     axis_jy_plus->SetLabelSize(lab_siz_y);
6603     axis_jy_plus->SetLabelOffset(lab_off_y);
6604     axis_jy_plus->SetTickSize(tic_siz_y);
6605     axis_jy_plus->Draw("SAME");
6606   }
6607 
6608 //---------------------------------- 2 axes (0,50) et (0,-50)
6609 #define IYAX
6610 #ifndef IYAX
6611   if (opt_plot == "Dee" || (opt_plot == "EE" && DeeNumber == 4)) {
6612     Int_t size_IY_dee = fEcal->MaxSCIYInDee();
6613     Int_t size_IY_axis = size_IY_dee / 2;
6614 
6615     if (opt_plot == "Dee") {
6616       axis_nb_div = (Int_t)size_IY_axis;
6617     }
6618     if (opt_plot == "EE") {
6619       axis_nb_div = 5;
6620     }
6621 
6622     Double_t jIY_min = fEcalNumbering->GetJIYMin(DeeNumber, 1) - 0.5;
6623     Double_t jIY_max = (fEcalNumbering->GetJIYMax(DeeNumber) / 2) * fEcal->MaxCrysIYInSC() + 0.5;
6624 
6625     TString jy_var_name = " ";
6626     TString jy_direction = "x";
6627 
6628     Float_t tit_siz_y = fCnaParHistos->AxisTitleSize();
6629     Float_t lab_siz_y = fCnaParHistos->AxisLabelSize();
6630 
6631     Float_t tic_siz_y = fCnaParHistos->AxisTickSize("Deey");
6632     if (opt_plot == "EE") {
6633       tic_siz_y = fCnaParHistos->AxisTickSize("EEy");
6634     }
6635 
6636     Float_t tit_off_y = fCnaParHistos->AxisTitleOffset("Deey");
6637     if (opt_plot == "EE") {
6638       tit_off_y = fCnaParHistos->AxisTitleOffset("EEy");
6639     }
6640 
6641     Float_t lab_off_y = fCnaParHistos->AxisLabelOffset("Deey");
6642     if (opt_plot == "EE") {
6643       lab_off_y = fCnaParHistos->AxisLabelOffset("EEy");
6644     }
6645 
6646     TGaxis* axis_jy_plus = 0;
6647     axis_jy_plus = new TGaxis((Float_t)0.,
6648                               (Float_t)(size_IY_dee * MatSize / 2),
6649                               (Float_t)0.,
6650                               (Float_t)(2 * size_IY_dee * MatSize / 2),
6651                               jIY_min,
6652                               jIY_max,
6653                               axis_nb_div,
6654                               "SC",
6655                               0.);
6656     fCnewRoot++;
6657 
6658     jy_var_name = GetIXIYAxisTitle("jIYDee");
6659     axis_jy_plus->SetTitle(jy_var_name);
6660     axis_jy_plus->SetTitleSize(tit_siz_y);
6661     axis_jy_plus->SetTitleOffset(tit_off_y);
6662     axis_jy_plus->SetLabelSize(lab_siz_y);
6663     axis_jy_plus->SetLabelOffset(lab_off_y);
6664     axis_jy_plus->SetTickSize(tic_siz_y);
6665     axis_jy_plus->Draw("SAME");
6666 
6667     TGaxis* axis_jy_minus = 0;
6668     axis_jy_minus = new TGaxis((Float_t)0.,
6669                                (Float_t)(size_IY_dee * MatSize / 2),
6670                                (Float_t)0.,
6671                                (Float_t)0.,
6672                                -jIY_min,
6673                                -jIY_max,
6674                                axis_nb_div,
6675                                "-SC",
6676                                0.);
6677     fCnewRoot++;
6678 
6679     jy_var_name = GetIXIYAxisTitle("jIYDee");
6680     axis_jy_minus->SetTitle(jy_var_name);
6681     axis_jy_minus->SetTitleSize(tit_siz_y);
6682     axis_jy_minus->SetTitleOffset(tit_off_y);
6683     axis_jy_minus->SetLabelSize(lab_siz_y);
6684     axis_jy_minus->SetLabelOffset(lab_off_y);
6685     axis_jy_minus->SetTickSize(tic_siz_y);
6686     axis_jy_minus->Draw("SAME");
6687   }
6688 #endif  // IYAX
6689 
6690 }  // ------------- end of EEGridAxis(...) --------------
6691 
6692 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6693 //
6694 //                               ViewHisto(***)
6695 //
6696 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6697 //======================== D_MSp_SpNb
6698 void TEcnaHistos::XtalSamplesEv(const TVectorD& arg_read_histo,
6699                                 const Int_t& arg_AlreadyRead,
6700                                 const Int_t& n1StexStin,
6701                                 const Int_t& i0StinEcha) {
6702   XtalSamplesEv(arg_read_histo, arg_AlreadyRead, n1StexStin, i0StinEcha, "ONLYONE");
6703 }
6704 void TEcnaHistos::XtalSamplesEv(const TVectorD& arg_read_histo,
6705                                 const Int_t& arg_AlreadyRead,
6706                                 const Int_t& n1StexStin,
6707                                 const Int_t& i0StinEcha,
6708                                 const TString& PlotOption) {
6709   if (fFapStexNumber > 0) {
6710     if (PlotOption == fAllXtalsInStinPlot) {
6711       Int_t StexStin_A = n1StexStin;
6712       if (fFlagSubDet == "EE") {
6713         StexStin_A = fEcalNumbering->Get1DeeSCEcnaFromDeeSCCons(fFapStexNumber, n1StexStin);
6714       }
6715 
6716       Bool_t aOKData = kFALSE;
6717       TVectorD read_histo(fEcal->MaxCrysInStin() * fEcal->MaxSampADC());
6718 
6719       if (arg_AlreadyRead == fTobeRead) {
6720         fMyRootFile->PrintNoComment();
6721         fMyRootFile->FileParameters(fFapAnaType,
6722                                     fFapNbOfSamples,
6723                                     fFapRunNumber,
6724                                     fFapFirstReqEvtNumber,
6725                                     fFapLastReqEvtNumber,
6726                                     fFapReqNbOfEvts,
6727                                     fFapStexNumber,
6728                                     fCfgResultsRootFilePath.Data());
6729 
6730         if (fMyRootFile->LookAtRootFile() == kTRUE) {
6731           fStatusFileFound = kTRUE;
6732           read_histo = fMyRootFile->ReadSampleMeans(StexStin_A, fEcal->MaxCrysInStin() * fEcal->MaxSampADC());
6733           if (fMyRootFile->DataExist() == kTRUE) {
6734             fStatusDataExist = kTRUE;
6735           }
6736         } else {
6737           fStatusFileFound = kFALSE;
6738           std::cout << "!TEcnaHistos::XtalSamplesEv(...)> Data not available (ROOT file not found)." << std::endl;
6739         }
6740         if (fStatusFileFound == kTRUE && fStatusDataExist == kTRUE) {
6741           aOKData = kTRUE;
6742         }
6743       }
6744       if (arg_AlreadyRead >= 1) {
6745         for (Int_t i = 0; i < fEcal->MaxCrysInStin() * fEcal->MaxSampADC(); i++) {
6746           read_histo[i] = arg_read_histo[i];
6747         }
6748         fStatusDataExist = kTRUE;
6749         aOKData = kTRUE;
6750       }
6751 
6752       if (aOKData == kTRUE) {
6753         TVectorD read_histo_samps(fFapNbOfSamples);
6754 
6755         Int_t xAlreadyRead = 1;
6756         for (Int_t i0_stin_echa = 0; i0_stin_echa < fEcal->MaxCrysInStin(); i0_stin_echa++) {
6757           if (fFapStexName == "SM") {
6758             std::cout << "*TEcnaHistos::XtalSamplesEv(...)> channel " << std::setw(2) << i0_stin_echa << ": ";
6759           }
6760           if (fFapStexName == "Dee") {
6761             std::cout << "*TEcnaHistos::XtalSamplesEv(...)> Xtal " << std::setw(2) << i0_stin_echa + 1 << ": ";
6762           }
6763 
6764           for (Int_t i0_samp = 0; i0_samp < fFapNbOfSamples; i0_samp++) {
6765             read_histo_samps(i0_samp) = read_histo(i0_stin_echa * fFapNbOfSamples + i0_samp);
6766             std::cout << std::setprecision(4) << std::setw(8) << read_histo_samps(i0_samp) << ", ";
6767           }
6768           std::cout << std::endl;
6769           ViewHisto(read_histo_samps, xAlreadyRead, StexStin_A, i0_stin_echa, fZerv, "D_MSp_SpNb", fAllXtalsInStinPlot);
6770           xAlreadyRead++;
6771         }
6772       } else {
6773         std::cout << "!TEcnaHistos::XtalSamplesEv(...)> Data not available." << std::endl;
6774       }
6775     }
6776 
6777     if (!(PlotOption == fAllXtalsInStinPlot)) {
6778       Int_t StexStin_A = n1StexStin;
6779       if (fFlagSubDet == "EE") {
6780         StexStin_A = fEcalNumbering->Get1DeeSCEcnaFromDeeSCCons(fFapStexNumber, n1StexStin);
6781       }
6782       ViewHisto(fReadHistoDummy, fTobeRead, StexStin_A, i0StinEcha, fZerv, "D_MSp_SpNb", PlotOption);
6783     }
6784   } else {
6785     std::cout << "!TEcnaHistos::XtalSamplesEv(...)> " << fFapStexName.Data() << " number = " << fFapStexNumber
6786               << " out of range (range = [1," << fEcal->MaxStexInStas() << "])" << fTTBELL << std::endl;
6787   }
6788 }
6789 
6790 //======================== D_MSp_SpDs
6791 void TEcnaHistos::EvSamplesXtals(const TVectorD& arg_read_histo,
6792                                  const Int_t& arg_AlreadyRead,
6793                                  const Int_t& n1StexStin,
6794                                  const Int_t& i0StinEcha) {
6795   EvSamplesXtals(arg_read_histo, arg_AlreadyRead, n1StexStin, i0StinEcha, "ONLYONE");
6796 }
6797 void TEcnaHistos::EvSamplesXtals(const TVectorD& arg_read_histo,
6798                                  const Int_t& arg_AlreadyRead,
6799                                  const Int_t& n1StexStin,
6800                                  const Int_t& i0StinEcha,
6801                                  const TString& PlotOption) {
6802   if (fFapStexNumber > 0) {
6803     if (PlotOption == fAllXtalsInStinPlot) {
6804       Int_t StexStin_A = n1StexStin;
6805       if (fFlagSubDet == "EE") {
6806         StexStin_A = fEcalNumbering->Get1DeeSCEcnaFromDeeSCCons(fFapStexNumber, n1StexStin);
6807       }
6808 
6809       Bool_t aOKData = kFALSE;
6810       TVectorD read_histo(fEcal->MaxCrysInStin() * fEcal->MaxSampADC());
6811 
6812       if (arg_AlreadyRead == fTobeRead) {
6813         fMyRootFile->PrintNoComment();
6814         fMyRootFile->FileParameters(fFapAnaType,
6815                                     fFapNbOfSamples,
6816                                     fFapRunNumber,
6817                                     fFapFirstReqEvtNumber,
6818                                     fFapLastReqEvtNumber,
6819                                     fFapReqNbOfEvts,
6820                                     fFapStexNumber,
6821                                     fCfgResultsRootFilePath.Data());
6822 
6823         if (fMyRootFile->LookAtRootFile() == kTRUE) {
6824           fStatusFileFound = kTRUE;
6825           read_histo = fMyRootFile->ReadSampleMeans(StexStin_A, fEcal->MaxCrysInStin() * fEcal->MaxSampADC());
6826           if (fMyRootFile->DataExist() == kTRUE) {
6827             fStatusDataExist = kTRUE;
6828           }
6829         } else {
6830           fStatusFileFound = kFALSE;
6831           std::cout << "!TEcnaHistos::EvSamplesXtals(...)> Data not available (ROOT file not found)." << std::endl;
6832         }
6833         if (fStatusFileFound == kTRUE && fStatusDataExist == kTRUE) {
6834           aOKData = kTRUE;
6835         }
6836       }
6837       if (arg_AlreadyRead >= 1) {
6838         for (Int_t i = 0; i < fEcal->MaxCrysInStin() * fEcal->MaxSampADC(); i++) {
6839           read_histo[i] = arg_read_histo[i];
6840         }
6841         fStatusDataExist = kTRUE;
6842         aOKData = kTRUE;
6843       }
6844       if (aOKData == kTRUE) {
6845         TVectorD read_histo_samps(fFapNbOfSamples);
6846 
6847         Int_t xAlreadyRead = 1;
6848         for (Int_t i0_stin_echa = 0; i0_stin_echa < fEcal->MaxCrysInStin(); i0_stin_echa++) {
6849           if (fFapStexName == "SM") {
6850             std::cout << "*TEcnaHistos::EvSamplesXtals(...)> channel " << std::setw(2) << i0_stin_echa << ": ";
6851           }
6852           if (fFapStexName == "Dee") {
6853             std::cout << "*TEcnaHistos::EvSamplesXtals(...)> Xtal " << std::setw(2) << i0_stin_echa + 1 << ": ";
6854           }
6855 
6856           for (Int_t i0_samp = 0; i0_samp < fFapNbOfSamples; i0_samp++) {
6857             read_histo_samps(i0_samp) = read_histo(i0_stin_echa * fFapNbOfSamples + i0_samp);
6858             std::cout << std::setprecision(4) << std::setw(8) << read_histo_samps(i0_samp) << ", ";
6859           }
6860           std::cout << std::endl;
6861           ViewHisto(read_histo_samps, xAlreadyRead, StexStin_A, i0_stin_echa, fZerv, "D_MSp_SpDs", fAllXtalsInStinPlot);
6862           xAlreadyRead++;
6863         }
6864       } else {
6865         std::cout << "!TEcnaHistos::EvSamplesXtals(...)> Data not available." << std::endl;
6866       }
6867     }
6868 
6869     if (!(PlotOption == fAllXtalsInStinPlot)) {
6870       Int_t StexStin_A = n1StexStin;
6871       if (fFlagSubDet == "EE") {
6872         StexStin_A = fEcalNumbering->Get1DeeSCEcnaFromDeeSCCons(fFapStexNumber, n1StexStin);
6873       }
6874       ViewHisto(fReadHistoDummy, fTobeRead, StexStin_A, i0StinEcha, fZerv, "D_MSp_SpDs", PlotOption);
6875     }
6876   } else {
6877     std::cout << "!TEcnaHistos::EvSamplesXtals(...)> " << fFapStexName.Data() << " number = " << fFapStexNumber
6878               << " out of range (range = [1," << fEcal->MaxStexInStas() << "])" << fTTBELL << std::endl;
6879   }
6880 }  // end of EvSamplesXtals(...)
6881 
6882 //======================== D_SSp_SpNb
6883 void TEcnaHistos::XtalSamplesSigma(const TVectorD& arg_read_histo,
6884                                    const Int_t& arg_AlreadyRead,
6885                                    const Int_t& n1StexStin,
6886                                    const Int_t& i0StinEcha) {
6887   XtalSamplesSigma(arg_read_histo, arg_AlreadyRead, n1StexStin, i0StinEcha, "ONLYONE");
6888 }
6889 void TEcnaHistos::XtalSamplesSigma(const TVectorD& arg_read_histo,
6890                                    const Int_t& arg_AlreadyRead,
6891                                    const Int_t& n1StexStin,
6892                                    const Int_t& i0StinEcha,
6893                                    const TString& PlotOption) {
6894   if (fFapStexNumber > 0) {
6895     if (PlotOption == fAllXtalsInStinPlot) {
6896       Int_t StexStin_A = n1StexStin;
6897       if (fFlagSubDet == "EE") {
6898         StexStin_A = fEcalNumbering->Get1DeeSCEcnaFromDeeSCCons(fFapStexNumber, n1StexStin);
6899       }
6900 
6901       Bool_t aOKData = kFALSE;
6902       TVectorD read_histo(fEcal->MaxCrysInStin() * fEcal->MaxSampADC());
6903 
6904       if (arg_AlreadyRead == fTobeRead) {
6905         fMyRootFile->PrintNoComment();
6906         fMyRootFile->FileParameters(fFapAnaType,
6907                                     fFapNbOfSamples,
6908                                     fFapRunNumber,
6909                                     fFapFirstReqEvtNumber,
6910                                     fFapLastReqEvtNumber,
6911                                     fFapReqNbOfEvts,
6912                                     fFapStexNumber,
6913                                     fCfgResultsRootFilePath.Data());
6914 
6915         if (fMyRootFile->LookAtRootFile() == kTRUE) {
6916           fStatusFileFound = kTRUE;
6917           read_histo = fMyRootFile->ReadSampleSigmas(StexStin_A, fEcal->MaxCrysInStin() * fEcal->MaxSampADC());
6918           if (fMyRootFile->DataExist() == kTRUE) {
6919             fStatusDataExist = kTRUE;
6920           }
6921         } else {
6922           fStatusFileFound = kFALSE;
6923           std::cout << "!TEcnaHistos::XtalSamplesSigma(...)> Data not available (ROOT file not found)." << std::endl;
6924         }
6925         if (fStatusFileFound == kTRUE && fStatusDataExist == kTRUE) {
6926           aOKData = kTRUE;
6927         }
6928       }
6929       if (arg_AlreadyRead >= 1) {
6930         for (Int_t i = 0; i < fEcal->MaxCrysInStin() * fEcal->MaxSampADC(); i++) {
6931           read_histo[i] = arg_read_histo[i];
6932         }
6933         fStatusDataExist = kTRUE;
6934         aOKData = kTRUE;
6935       }
6936       if (aOKData == kTRUE) {
6937         TVectorD read_histo_samps(fFapNbOfSamples);
6938 
6939         Int_t xAlreadyRead = 1;
6940         for (Int_t i0_stin_echa = 0; i0_stin_echa < fEcal->MaxCrysInStin(); i0_stin_echa++) {
6941           if (fFapStexName == "SM") {
6942             std::cout << "*TEcnaHistos::XtalSamplesSigma(...)> channel " << std::setw(2) << i0_stin_echa << ": ";
6943           }
6944           if (fFapStexName == "Dee") {
6945             std::cout << "*TEcnaHistos::XtalSamplesSigma(...)> Xtal " << std::setw(2) << i0_stin_echa + 1 << ": ";
6946           }
6947 
6948           for (Int_t i0_samp = 0; i0_samp < fFapNbOfSamples; i0_samp++) {
6949             read_histo_samps(i0_samp) = read_histo(i0_stin_echa * fFapNbOfSamples + i0_samp);
6950             std::cout << std::setprecision(3) << std::setw(6) << read_histo_samps(i0_samp) << ", ";
6951           }
6952           std::cout << std::endl;
6953           ViewHisto(read_histo_samps, xAlreadyRead, StexStin_A, i0StinEcha, fZerv, "D_SSp_SpNb", fAllXtalsInStinPlot);
6954           xAlreadyRead++;
6955         }
6956       } else {
6957         std::cout << "!TEcnaHistos::XtalSamplesSigma(...)> Data not available." << std::endl;
6958       }
6959     }
6960 
6961     if (!(PlotOption == fAllXtalsInStinPlot)) {
6962       Int_t StexStin_A = n1StexStin;
6963       if (fFlagSubDet == "EE") {
6964         StexStin_A = fEcalNumbering->Get1DeeSCEcnaFromDeeSCCons(fFapStexNumber, n1StexStin);
6965       }
6966       ViewHisto(fReadHistoDummy, fTobeRead, StexStin_A, i0StinEcha, fZerv, "D_SSp_SpNb", PlotOption);
6967     }
6968   } else {
6969     std::cout << "!TEcnaHistos::XtalSamplesSigma(...)> " << fFapStexName.Data() << " number = " << fFapStexNumber
6970               << " out of range (range = [1," << fEcal->MaxStexInStas() << "])" << fTTBELL << std::endl;
6971   }
6972 }
6973 
6974 //======================== D_SSp_SpDs
6975 void TEcnaHistos::SigmaSamplesXtals(const TVectorD& arg_read_histo,
6976                                     const Int_t& arg_AlreadyRead,
6977                                     const Int_t& n1StexStin,
6978                                     const Int_t& i0StinEcha) {
6979   SigmaSamplesXtals(arg_read_histo, arg_AlreadyRead, n1StexStin, i0StinEcha, "ONLYONE");
6980 }
6981 void TEcnaHistos::SigmaSamplesXtals(const TVectorD& arg_read_histo,
6982                                     const Int_t& arg_AlreadyRead,
6983                                     const Int_t& n1StexStin,
6984                                     const Int_t& i0StinEcha,
6985                                     const TString& PlotOption) {
6986   if (fFapStexNumber > 0) {
6987     if (PlotOption == fAllXtalsInStinPlot) {
6988       Int_t StexStin_A = n1StexStin;
6989       if (fFlagSubDet == "EE") {
6990         StexStin_A = fEcalNumbering->Get1DeeSCEcnaFromDeeSCCons(fFapStexNumber, n1StexStin);
6991       }
6992 
6993       Bool_t aOKData = kFALSE;
6994       TVectorD read_histo(fEcal->MaxCrysInStin() * fEcal->MaxSampADC());
6995 
6996       if (arg_AlreadyRead == fTobeRead) {
6997         fMyRootFile->PrintNoComment();
6998         fMyRootFile->FileParameters(fFapAnaType,
6999                                     fFapNbOfSamples,
7000                                     fFapRunNumber,
7001                                     fFapFirstReqEvtNumber,
7002                                     fFapLastReqEvtNumber,
7003                                     fFapReqNbOfEvts,
7004                                     fFapStexNumber,
7005                                     fCfgResultsRootFilePath.Data());
7006         if (fMyRootFile->LookAtRootFile() == kTRUE) {
7007           fStatusFileFound = kTRUE;
7008           read_histo = fMyRootFile->ReadSampleSigmas(StexStin_A, fEcal->MaxCrysInStin() * fEcal->MaxSampADC());
7009           if (fMyRootFile->DataExist() == kTRUE) {
7010             fStatusDataExist = kTRUE;
7011           }
7012         } else {
7013           fStatusFileFound = kFALSE;
7014           std::cout << "!TEcnaHistos::SigmaSamplesXtals(...)> Data not available (ROOT file not found)." << std::endl;
7015         }
7016         if (fStatusFileFound == kTRUE && fStatusDataExist == kTRUE) {
7017           aOKData = kTRUE;
7018         }
7019       }
7020 
7021       if (arg_AlreadyRead >= 1) {
7022         for (Int_t i = 0; i < fEcal->MaxCrysInStin() * fEcal->MaxSampADC(); i++) {
7023           read_histo[i] = arg_read_histo[i];
7024         }
7025         fStatusDataExist = kTRUE;
7026         aOKData = kTRUE;
7027       }
7028       if (aOKData == kTRUE) {
7029         TVectorD read_histo_samps(fFapNbOfSamples);
7030 
7031         Int_t xAlreadyRead = 1;
7032         for (Int_t i0_stin_echa = 0; i0_stin_echa < fEcal->MaxCrysInStin(); i0_stin_echa++) {
7033           if (fFapStexName == "SM") {
7034             std::cout << "*TEcnaHistos::SigmaSamplesXtals(...)> channel " << std::setw(2) << i0_stin_echa << ": ";
7035           }
7036           if (fFapStexName == "Dee") {
7037             std::cout << "*TEcnaHistos::SigmaSamplesXtals(...)> Xtal " << std::setw(2) << i0_stin_echa + 1 << ": ";
7038           }
7039 
7040           for (Int_t i0_samp = 0; i0_samp < fFapNbOfSamples; i0_samp++) {
7041             read_histo_samps(i0_samp) = read_histo(i0_stin_echa * fFapNbOfSamples + i0_samp);
7042             std::cout << std::setprecision(3) << std::setw(6) << read_histo_samps(i0_samp) << ", ";
7043           }
7044           std::cout << std::endl;
7045           ViewHisto(read_histo_samps, xAlreadyRead, StexStin_A, i0StinEcha, fZerv, "D_SSp_SpDs", fAllXtalsInStinPlot);
7046           xAlreadyRead++;
7047         }
7048       } else {
7049         std::cout << "!TEcnaHistos::SigmaSamplesXtals(...)> Data not available." << std::endl;
7050       }
7051     }
7052 
7053     if (!(PlotOption == fAllXtalsInStinPlot)) {
7054       Int_t StexStin_A = n1StexStin;
7055       if (fFlagSubDet == "EE") {
7056         StexStin_A = fEcalNumbering->Get1DeeSCEcnaFromDeeSCCons(fFapStexNumber, n1StexStin);
7057       }
7058       ViewHisto(fReadHistoDummy, fTobeRead, StexStin_A, i0StinEcha, fZerv, "D_SSp_SpDs", PlotOption);
7059     }
7060   } else {
7061     std::cout << "!TEcnaHistos::SigmaSamplesXtals(...)> " << fFapStexName.Data() << " number = " << fFapStexNumber
7062               << " out of range (range = [1," << fEcal->MaxStexInStas() << "])" << fTTBELL << std::endl;
7063   }
7064 }  // end of SigmaSamplesXtals(...)
7065 
7066 //==========================================================================================
7067 //
7068 //                         ViewHisto
7069 //
7070 //    arg_read_histo  = array containing the values
7071 //    arg_AlreadyRead = histo flag: =1 => arg_read_histo exists,
7072 //                                  =0 => values will be read by internal
7073 //                                        call to TEcnaRead inside ViewHisto
7074 //    StexStin_A      = [1,68] or [1,150]  ==> tower# if EB,  SC# if EE
7075 //    i0StinEcha      = [0,24] = Electronic channel# in tower (if EB) or SC (if EE)
7076 //    i0Sample        = [0,9]  = sample#
7077 //    HistoCode       = String for histo type (pedestal, total noise, mean cor(s,s), ...)
7078 //    opt_plot_arg    = String for plot option (SAME or not SAME)
7079 //
7080 //===========================================================================================
7081 void TEcnaHistos::ViewHisto(const TVectorD& arg_read_histo,
7082                             const Int_t& arg_AlreadyRead,
7083                             const Int_t& StexStin_A,
7084                             const Int_t& i0StinEcha,
7085                             const Int_t& i0Sample,
7086                             const TString& HistoCode,
7087                             const TString& opt_plot_arg) {
7088   //Histogram of the quantities (one run)
7089 
7090   TString opt_plot = opt_plot_arg;
7091   fPlotAllXtalsInStin = 0;
7092 
7093   if (opt_plot_arg == fAllXtalsInStinPlot) {
7094     opt_plot = fOnlyOnePlot;
7095     fPlotAllXtalsInStin = 1;
7096   }
7097 
7098   TString HistoType = fCnaParHistos->GetHistoType(HistoCode.Data());
7099 
7100   Int_t OKHisto = 0;
7101 
7102   //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Canvas already closed in option SAME %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7103   Int_t xCanvasExists = 1;  // a priori ==> Canvas exists                                   // (ViewHisto)
7104   if (opt_plot != fOnlyOnePlot && GetMemoFlag(HistoCode, opt_plot) == "Busy") {
7105     TVirtualPad* main_subpad = nullptr;
7106     //---------------- Call to ActivePad
7107     main_subpad = ActivePad(HistoCode.Data(), opt_plot.Data());  // => return 0 if canvas has been closed
7108     if (main_subpad == nullptr) {
7109       std::cout << "*TEcnaHistos::ViewHisto(...)> WARNING ===> Canvas has been closed in option SAME or SAME n."
7110                 << std::endl
7111                 << "                              Please, restart with a new canvas." << fTTBELL << std::endl;
7112 
7113       ReInitCanvas(HistoCode, opt_plot);
7114       xCanvasExists = 0;
7115     }
7116   }
7117   //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7118 
7119   //%%%%%%%%%%%%%%%%%%%%%%%% Change of X variable in option SAME n with no proj %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7120   Int_t SameXVarMemo = 1;  //  a priori ==> SAME n option: X variable OK                     (ViewHisto)
7121   if (!(HistoType == "Proj" || HistoType == "SampProj" || HistoType == "EvolProj") && !(arg_AlreadyRead >= 1)) {
7122     TString XVarHisto = fCnaParHistos->GetXVarHisto(HistoCode.Data(), fFlagSubDet.Data(), fFapStexNumber);
7123     TString YVarHisto = fCnaParHistos->GetYVarHisto(HistoCode.Data(), fFlagSubDet.Data(), fFapStexNumber);
7124     if ((opt_plot == fSameOnePlot) && GetMemoFlag(HistoCode, opt_plot) == "Free") {
7125       SetXVarMemo(HistoCode, opt_plot, XVarHisto);
7126       SetYVarMemo(HistoCode, opt_plot, YVarHisto);
7127       SameXVarMemo = 1;
7128     }
7129     if ((opt_plot == fSameOnePlot) && GetMemoFlag(HistoCode, opt_plot) == "Busy") {
7130       TString XVariableMemo = GetXVarFromMemo(HistoCode, opt_plot);
7131       TString YVariableMemo = GetYVarFromMemo(HistoCode, opt_plot);
7132 
7133       if (XVarHisto != XVariableMemo) {
7134         std::cout << "!TEcnaHistos::ViewHisto(...)> *** ERROR *** ===> X coordinate changed in option SAME n."
7135                   << std::endl
7136                   << "                              Present  X = " << XVarHisto << std::endl
7137                   << "                              Present  Y = " << YVarHisto << std::endl
7138                   << "                              Previous X = " << XVariableMemo << std::endl
7139                   << "                              Previous Y = " << YVariableMemo << fTTBELL << std::endl;
7140         SameXVarMemo = 0;
7141       } else {
7142         SetYVarMemo(HistoCode, opt_plot, YVarHisto);
7143       }
7144     }
7145   }
7146   //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7147 
7148   //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Change of Y variable in option SAME n %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7149   Int_t SameYVarMemo = 1;  //  a priori ==> SAME n option: Y variable OK                     (ViewHisto)
7150   if ((HistoType == "Proj" || HistoType == "SampProj" || HistoType == "EvolProj") && !(arg_AlreadyRead >= 1)) {
7151     TString XVarHisto = fCnaParHistos->GetXVarHisto(HistoCode.Data(), fFlagSubDet.Data(), fFapStexNumber);
7152     TString YVarHisto = fCnaParHistos->GetYVarHisto(HistoCode.Data(), fFlagSubDet.Data(), fFapStexNumber);
7153     if ((opt_plot == fSameOnePlot) && GetMemoFlag(HistoCode, opt_plot) == "Free") {
7154       SetYVarMemo(HistoCode, opt_plot, YVarHisto);
7155       SetYVarMemo(HistoCode, opt_plot, YVarHisto);
7156       SameYVarMemo = 1;
7157     }
7158     if ((opt_plot == fSameOnePlot) && GetMemoFlag(HistoCode, opt_plot) == "Busy") {
7159       TString XVariableMemo = GetXVarFromMemo(HistoCode, opt_plot);
7160       TString YVariableMemo = GetYVarFromMemo(HistoCode, opt_plot);
7161 
7162       if (YVarHisto != YVariableMemo) {
7163         std::cout << "!TEcnaHistos::ViewHisto(...)> *** ERROR *** ===> Y coordinate changed in option SAME n."
7164                   << std::endl
7165                   << "                              Present  X = " << XVarHisto << std::endl
7166                   << "                              Present  Y = " << YVarHisto << std::endl
7167                   << "                              Previous X = " << XVariableMemo << std::endl
7168                   << "                              Previous Y = " << YVariableMemo << fTTBELL << std::endl;
7169         SameYVarMemo = 0;
7170       } else {
7171         SetYVarMemo(HistoCode, opt_plot, YVarHisto);
7172       }
7173     }
7174   }
7175   //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7176 
7177   //%%%%%%%%%%%%%%%%%%%%%%%%%%% Number of bins change in option SAME or SAME n %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7178   Int_t OkBinsMemoSameOne = 1;  //  a priori ==> SAME n option: Nb bins OK                     (ViewHisto)
7179 
7180   Int_t SizeForPlot = GetHistoSize(HistoCode.Data(), "plot");
7181   Int_t xNbBins = GetHistoNumberOfBins(HistoCode.Data(), SizeForPlot);
7182 
7183   if ((opt_plot == fSameOnePlot || opt_plot == fSeveralPlot) && GetMemoFlag(HistoCode, opt_plot) == "Free") {
7184     SetNbBinsMemo(HistoCode, opt_plot, xNbBins);
7185     OkBinsMemoSameOne = 1;
7186   }
7187 
7188   if ((opt_plot == fSameOnePlot || opt_plot == fSeveralPlot) && GetMemoFlag(HistoCode, opt_plot) == "Busy") {
7189     Int_t NbBinsMemo = GetNbBinsFromMemo(HistoCode, opt_plot);
7190     if (xNbBins != NbBinsMemo) {
7191       std::cout << "!TEcnaHistos::ViewHisto(...)> *** ERROR *** ===> Number of bins changed in option SAME or SAME n."
7192                 << " Present number = " << xNbBins << ", requested number = " << NbBinsMemo << fTTBELL << std::endl;
7193       OkBinsMemoSameOne = 0;
7194     }
7195   }
7196 
7197   //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7198 
7199   if (xCanvasExists == 1 && SameXVarMemo == 1 && SameYVarMemo == 1 && OkBinsMemoSameOne == 1) {
7200     OKHisto = 1;
7201   }
7202 
7203   //======================== Histo accepted                                                       (ViewHisto)
7204   if (OKHisto == 1) {
7205     Int_t opt_scale_x = fOptScaleLinx;
7206     if (fFlagScaleX == "LIN") {
7207       opt_scale_x = fOptScaleLinx;
7208     }
7209     if (fFlagScaleX == "LOG") {
7210       opt_scale_x = fOptScaleLogx;
7211     }
7212 
7213     Int_t opt_scale_y = fOptScaleLiny;
7214     if (fFlagScaleY == "LIN") {
7215       opt_scale_y = fOptScaleLiny;
7216     }
7217     if (fFlagScaleY == "LOG") {
7218       opt_scale_y = fOptScaleLogy;
7219     }
7220 
7221     fCnaParHistos->SetColorPalette(fFlagColPal);
7222     TString fp_name_short = " ";
7223 
7224     //-------------------- read_histo size
7225     Int_t SizeForRead = GetHistoSize(HistoCode.Data(), "read");
7226 
7227     //............................................... allocation/init_histo
7228     TVectorD histo_for_plot(SizeForPlot);
7229     for (Int_t i = 0; i < SizeForPlot; i++) {
7230       histo_for_plot[i] = (Double_t)0;
7231     }
7232 
7233     TVectorD histo_for_plot_memo(SizeForPlot);
7234     for (Int_t i = 0; i < SizeForPlot; i++) {
7235       histo_for_plot_memo[i] = (Double_t)0;
7236     }
7237 
7238     Int_t i_data_exist = 0;
7239     Int_t OKPlot = 0;
7240 
7241     //------------------------------------- histos Global, (Global)Proj, SampGlobal and SampProj
7242     if (HistoType == "Global" || HistoType == "Proj" || HistoType == "SampGlobal" || HistoType == "SampProj") {
7243       if (fFapStexNumber == 0) {
7244         Bool_t ok_view_histo = kFALSE;
7245 
7246         //--------------------------------------------------------------------- Stas Histo      (ViewHisto)
7247         Int_t CounterExistingFile = 0;
7248         Int_t CounterDataExist = 0;
7249 
7250         Int_t* xFapNbOfEvts = new Int_t[fEcal->MaxStexInStas()];
7251         fCnew++;
7252         for (Int_t i = 0; i < fEcal->MaxStexInStas(); i++) {
7253           xFapNbOfEvts[i] = 0;
7254         }
7255 
7256         //Int_t* NOFE_int = new Int_t[fEcal->MaxCrysEcnaInStex()];     fCnew++;
7257 
7258         for (Int_t iStasStex = 0; iStasStex < fEcal->MaxStexInStas(); iStasStex++) {
7259           Bool_t OKFileExists = kFALSE;
7260           Bool_t ok_data_exists = kFALSE;
7261 
7262           TVectorD read_histo(fEcal->MaxStinEcnaInStex());
7263           for (Int_t i = 0; i < fEcal->MaxStinEcnaInStex(); i++) {
7264             read_histo(i) = (Double_t)0.;
7265           }
7266 
7267           if (arg_AlreadyRead == 0) {
7268             //----------------------------------------------------------------------------- file reading
7269             fMyRootFile->PrintNoComment();
7270             Int_t n1StasStex = iStasStex + 1;
7271             fMyRootFile->FileParameters(fFapAnaType,
7272                                         fFapNbOfSamples,
7273                                         fFapRunNumber,
7274                                         fFapFirstReqEvtNumber,
7275                                         fFapLastReqEvtNumber,
7276                                         fFapReqNbOfEvts,
7277                                         n1StasStex,
7278                                         fCfgResultsRootFilePath.Data());
7279 
7280             if (fMyRootFile->LookAtRootFile() == kTRUE) {
7281               OKFileExists = kTRUE;
7282             }  //   (ViewHisto, Stas)
7283             if (OKFileExists == kTRUE) {
7284               xFapNbOfEvts[iStasStex] = fMyRootFile->GetNumberOfEvents(fFapReqNbOfEvts, n1StasStex);
7285               fp_name_short = fMyRootFile->GetRootFileNameShort();
7286               // std::cout << "*TEcnaHistos::ViewHisto(...)> Data are analyzed from file ----> "
7287               //      << fp_name_short << std::endl;
7288               //....................... search for first and last dates
7289               if (iStasStex == 0) {
7290                 fStartTime = fMyRootFile->GetStartTime();
7291                 fStopTime = fMyRootFile->GetStopTime();
7292                 fStartDate = fMyRootFile->GetStartDate();
7293                 fStopDate = fMyRootFile->GetStopDate();
7294               }
7295 
7296               time_t xStartTime = fMyRootFile->GetStartTime();
7297               time_t xStopTime = fMyRootFile->GetStopTime();
7298               TString xStartDate = fMyRootFile->GetStartDate();
7299               TString xStopDate = fMyRootFile->GetStopDate();
7300 
7301               if (xStartTime < fStartTime) {
7302                 fStartTime = xStartTime;
7303                 fStartDate = xStartDate;
7304               }
7305               if (xStopTime > fStopTime) {
7306                 fStopTime = xStopTime;
7307                 fStopDate = xStopDate;
7308               }
7309 
7310               fRunType = fMyRootFile->GetRunType();
7311               ok_view_histo = GetOkViewHisto(fMyRootFile, StexStin_A, i0StinEcha, i0Sample, HistoCode.Data());
7312 
7313               if (ok_view_histo == kTRUE) {
7314                 //............................................... histo reading   (ViewHisto, Stas)
7315                 if (HistoCode == "D_NOE_ChNb" || HistoCode == "D_NOE_ChDs") {
7316                   read_histo = fMyRootFile->ReadAverageNumberOfEvents(fEcal->MaxStinEcnaInStex());
7317                 }
7318                 if (HistoCode == "D_Ped_ChNb" || HistoCode == "D_Ped_ChDs") {
7319                   read_histo = fMyRootFile->ReadAveragePedestals(fEcal->MaxStinEcnaInStex());
7320                 }
7321                 if (HistoCode == "D_TNo_ChNb" || HistoCode == "D_TNo_ChDs") {
7322                   read_histo = fMyRootFile->ReadAverageTotalNoise(fEcal->MaxStinEcnaInStex());
7323                 }
7324                 if (HistoCode == "D_MCs_ChNb" || HistoCode == "D_MCs_ChDs") {
7325                   read_histo = fMyRootFile->ReadAverageMeanCorrelationsBetweenSamples(fEcal->MaxStinEcnaInStex());
7326                 }
7327                 if (HistoCode == "D_LFN_ChNb" || HistoCode == "D_LFN_ChDs") {
7328                   read_histo = fMyRootFile->ReadAverageLowFrequencyNoise(fEcal->MaxStinEcnaInStex());
7329                 }
7330                 if (HistoCode == "D_HFN_ChNb" || HistoCode == "D_HFN_ChDs") {
7331                   read_histo = fMyRootFile->ReadAverageHighFrequencyNoise(fEcal->MaxStinEcnaInStex());
7332                 }
7333                 if (HistoCode == "D_SCs_ChNb" || HistoCode == "D_SCs_ChDs") {
7334                   read_histo = fMyRootFile->ReadAverageSigmaOfCorrelationsBetweenSamples(fEcal->MaxStinEcnaInStex());
7335                 }
7336                 if (fMyRootFile->DataExist() == kTRUE) {
7337                   ok_data_exists = kTRUE;
7338                 }
7339               }
7340             }
7341           }
7342 
7343           if (arg_AlreadyRead >= 1) {
7344             ok_data_exists = kTRUE;
7345             for (Int_t i0Stin = 0; i0Stin < fEcal->MaxStinEcnaInStex(); i0Stin++) {
7346               read_histo(i0Stin) = arg_read_histo(fEcal->MaxStinEcnaInStex() * iStasStex + i0Stin);
7347             }
7348           }
7349 
7350           if (ok_data_exists == kTRUE) {
7351             fStatusFileFound = kTRUE;
7352             CounterExistingFile++;
7353 
7354             //...........................................................
7355             if (ok_data_exists == kTRUE) {
7356               fStatusDataExist = kTRUE;
7357               CounterDataExist++;
7358 
7359               for (Int_t i0StexStinEcna = 0; i0StexStinEcna < fEcal->MaxStinEcnaInStex(); i0StexStinEcna++) {
7360                 //Int_t n1StexStinEcna = i0StexStinEcna+1;
7361                 //-------------------------------------- Stas histo filling   (ViewHisto, Stas)
7362                 Int_t i_xgeo = -1;
7363                 //...................................... EB
7364                 if (fFlagSubDet == "EB") {
7365                   i_xgeo = iStasStex * fEcal->MaxStinEcnaInStex() + i0StexStinEcna;
7366                   if (i_xgeo >= 0 && i_xgeo < SizeForPlot) {
7367                     histo_for_plot[i_xgeo] = read_histo[i0StexStinEcna];
7368                   } else {
7369                     std::cout << "!TEcnaHistos::ViewHisto(...)> <EB> i_xgeo = " << i_xgeo
7370                               << ". OUT OF RANGE ( range = [0," << SizeForPlot << "] " << std::endl;
7371                   }
7372                 }
7373                 //...................................... EE    (ViewHisto)
7374                 //-------> Dee order: D4, D3, D2, D1
7375                 if (fFlagSubDet == "EE") {
7376                   Int_t DeeOffset = 0;
7377                   Int_t DSOffset = 0;
7378 
7379                   Int_t DeeNumber = iStasStex + 1;
7380                   Int_t n1DeeSCEcna = i0StexStinEcna + 1;
7381 
7382                   //................................................ Dee offset
7383                   if (DeeNumber == 3) {
7384                     DeeOffset += fEcal->MaxSCForConsInDee();
7385                   }  // 149
7386                   if (DeeNumber == 2) {
7387                     DeeOffset += 3 * fEcal->MaxSCForConsInDee() - 1;
7388                   }  // 446
7389                   if (DeeNumber == 1) {
7390                     DeeOffset += 4 * fEcal->MaxSCForConsInDee() - 1;
7391                   }  // 595
7392 
7393                   //................................................ Data Sector offset   (ViewHisto, Stas)
7394                   Int_t StexDataSector = fEcalNumbering->GetDSFrom1DeeSCEcna(DeeNumber, n1DeeSCEcna);
7395                   //.... returns 0 if n1DeeSCEcna corresponds to an empty "ECNA-SC"
7396 
7397                   //................................................ SC final coordinate   (ViewHisto, Stas)
7398                   Int_t StexDSStin = fEcalNumbering->GetDSSCFrom1DeeSCEcna(DeeNumber, n1DeeSCEcna);
7399                   //--> return StexDSStin = 25 (not  3) for n1DeeSCEcna = 32
7400                   //--> return StexDSStin = 14 (not 21) for n1DeeSCEcna = 29
7401                   //--> return StexDSStin = -1 for n1DeeSCEcna = 10 and n1DeeSCEcna = 11
7402 
7403                   if (StexDataSector >= 1 && StexDataSector <= 9) {
7404                     if (DeeNumber == 4)  // Sectors 1,2,3,4,5a
7405                     {
7406                       for (Int_t is = 2; is <= 5; is++) {
7407                         if (StexDataSector >= is) {
7408                           Int_t ism = is - 1;
7409                           DSOffset += fEcalNumbering->GetMaxSCInDS(ism);
7410                         }
7411                       }
7412                     }
7413 
7414                     if (DeeNumber == 3)  // Sectors 5b,6,7,8,9
7415                     {
7416                       if (StexDataSector >= 6) {
7417                         DSOffset += fEcalNumbering->GetMaxSCInDS(5) / 2;
7418                       }
7419                       for (Int_t is = 7; is <= 9; is++) {
7420                         if (StexDataSector >= is) {
7421                           Int_t ism = is - 1;
7422                           DSOffset += fEcalNumbering->GetMaxSCInDS(ism);
7423                         }
7424                       }
7425                     }
7426 
7427                     if (DeeNumber == 2)  // Sectors 9,8,7,6,5a
7428                     {
7429                       if (StexDataSector >= 6) {
7430                         DSOffset -= fEcalNumbering->GetMaxSCInDS(5) / 2;
7431                       }
7432                       for (Int_t is = 7; is <= 9; is++) {
7433                         if (StexDataSector >= is) {
7434                           Int_t ism = is - 1;
7435                           DSOffset -= fEcalNumbering->GetMaxSCInDS(ism);
7436                         }
7437                       }
7438                     }
7439 
7440                     if (DeeNumber == 1)  // Sectors 5b,4,3,2,1
7441                     {
7442                       for (Int_t is = 2; is <= 5; is++) {
7443                         if (StexDataSector >= is) {
7444                           Int_t ism = is - 1;
7445                           DSOffset -= fEcalNumbering->GetMaxSCInDS(ism);
7446                         }
7447                       }
7448                     }
7449 
7450                     if (StexDSStin >= 1 && StexDSStin <= fEcalNumbering->GetMaxSCInDS(StexDataSector)) {
7451                       if (DeeNumber == 4)  // Sectors 1,2,3,4,5a
7452                       {
7453                         if (StexDataSector != 5) {
7454                           i_xgeo = DeeOffset + DSOffset + (StexDSStin - 1);
7455                         }
7456                         if (StexDataSector == 5) {
7457                           i_xgeo = DeeOffset + DSOffset + (StexDSStin - 1);
7458                         }
7459                       }
7460                       if (DeeNumber == 3)  // Sectors 5b,6,7,8,9
7461                       {
7462                         if (StexDataSector != 5) {
7463                           i_xgeo = DeeOffset + DSOffset + (StexDSStin - 1);
7464                         }
7465                         if (StexDataSector == 5) {
7466                           i_xgeo = DeeOffset + DSOffset + (StexDSStin - 17) - 1;
7467                         }
7468                       }
7469                       if (DeeNumber == 2)  // Sectors 5a,6,7,8,9
7470                       {
7471                         if (StexDataSector != 5) {
7472                           i_xgeo = DeeOffset + DSOffset - fEcalNumbering->GetMaxSCInDS(StexDataSector) + StexDSStin;
7473                         }
7474                         if (StexDataSector == 5) {
7475                           i_xgeo = DeeOffset + DSOffset - fEcalNumbering->GetMaxSCInDS(StexDataSector) / 2 + StexDSStin;
7476                         }
7477                       }
7478                       if (DeeNumber == 1)  // Sectors 1,2,3,4,5b
7479                       {
7480                         if (StexDataSector != 5) {
7481                           i_xgeo = DeeOffset + DSOffset - fEcalNumbering->GetMaxSCInDS(StexDataSector) + StexDSStin;
7482                         }
7483                         if (StexDataSector == 5) {
7484                           i_xgeo = DeeOffset + DSOffset - fEcalNumbering->GetMaxSCInDS(StexDataSector) / 2 +
7485                                    (StexDSStin - 17);
7486                         }
7487                       }
7488 
7489                     }  // end of if(StexDSStin >=1 && StexDSStin <= fEcalNumbering->GetMaxSCInDS(StexDataSector))
7490                     else {
7491                       std::cout << "!TEcnaHistos::ViewHisto(...)> <EE>  StexDSStin = " << StexDSStin
7492                                 << ". OUT OF RANGE ( range = [1," << fEcalNumbering->GetMaxSCInDS(StexDataSector)
7493                                 << "]. DeeNumber =  " << DeeNumber << ", n1DeeSCEcna = " << n1DeeSCEcna
7494                                 << ", StexDataSector = " << StexDataSector << ", i_xgeo = " << i_xgeo << std::endl;
7495                     }
7496                   }  // end of if( StexDataSector >= 1 && StexDataSector <= 9 )
7497                   else {
7498                     //std::cout << "!TEcnaHistos::ViewHisto(...)> <EE>  StexDataSector = " << StexDataSector
7499                     //     << ". OUT OF RANGE ( range = [1,9]. DeeNumber = " << DeeNumber
7500                     //     << ", n1DeeSCEcna = " << n1DeeSCEcna
7501                     //     << ", i_xgeo = "  << i_xgeo << std::endl;
7502                   }
7503                   //......................................... transfert read_histo -> histo_for_plot
7504                   if (i_xgeo >= -1 && i_xgeo < SizeForPlot) {
7505                     // special treatement for not connected & mixed SC's
7506                     if (n1DeeSCEcna == 29 || n1DeeSCEcna == 32 ||    //  261a, 207c, 268a, 178c
7507                                                                      // [ 14a,  25c,  21a,   3c]
7508                         n1DeeSCEcna == 144 || n1DeeSCEcna == 165 ||  //  261c, 261b [14c, 14b]
7509                         n1DeeSCEcna == 176 || n1DeeSCEcna == 193 ||  //  207a, 207b [25a, 25b]
7510                         n1DeeSCEcna == 60 || n1DeeSCEcna == 119 ||   //  182a, 182b [30a, 30b]
7511                         n1DeeSCEcna == 102 || n1DeeSCEcna == 123 ||  //  268c, 268b [21c, 21b]
7512                         n1DeeSCEcna == 138 || n1DeeSCEcna == 157)    //  178a, 178b [ 3a,  3b]
7513                     {
7514                       //--------------- DSSC 14
7515                       if (n1DeeSCEcna == 29 && i_xgeo >= 0) {
7516                         histo_for_plot[i_xgeo] += read_histo[i0StexStinEcna] / (Double_t)5.;
7517                       }
7518                       if ((n1DeeSCEcna == 144 || n1DeeSCEcna == 165) && i_xgeo >= 0) {
7519                         histo_for_plot[i_xgeo] += read_histo[i0StexStinEcna] * (Double_t)10. / (Double_t)25.;
7520                       }
7521 
7522                       //--------------- DSSC 25
7523                       if (n1DeeSCEcna == 32 && i_xgeo >= 0) {
7524                         histo_for_plot[i_xgeo] += read_histo[i0StexStinEcna] / (Double_t)5.;
7525                       }
7526                       if ((n1DeeSCEcna == 176 || n1DeeSCEcna == 193) && i_xgeo >= 0) {
7527                         histo_for_plot[i_xgeo] += read_histo[i0StexStinEcna] * (Double_t)10. / (Double_t)25.;
7528                       }
7529 
7530                       //--------------- DSSC 30
7531                       if ((n1DeeSCEcna == 60 || n1DeeSCEcna == 119) && i_xgeo >= 0) {
7532                         histo_for_plot[i_xgeo] += read_histo[i0StexStinEcna] / (Double_t)2.;
7533                       }
7534 
7535                       //--------------- DSSC 21 (Add SC translated at 10-1 only once, i_xgeo = -1 accepted)
7536                       if (n1DeeSCEcna == 102) {
7537                         histo_for_plot[i_xgeo] +=
7538                             read_histo[9] / (Double_t)21. + read_histo[i0StexStinEcna] * (Double_t)10. / (Double_t)21.;
7539                       }
7540                       if (n1DeeSCEcna == 123 && i_xgeo >= 0) {
7541                         histo_for_plot[i_xgeo] += read_histo[i0StexStinEcna] * (Double_t)10. / (Double_t)21.;
7542                       }
7543 
7544                       //--------------- DSSC 3 (Add SC translated at 11-1 only once, i_xgeo = -1 accepted)
7545                       if (n1DeeSCEcna == 138) {
7546                         histo_for_plot[i_xgeo] +=
7547                             read_histo[10] / (Double_t)21. + read_histo[i0StexStinEcna] * (Double_t)10. / (Double_t)21.;
7548                       }
7549                       if (n1DeeSCEcna == 157 && i_xgeo >= 0) {
7550                         histo_for_plot[i_xgeo] += read_histo[i0StexStinEcna] * (Double_t)10. / (Double_t)21.;
7551                       }
7552                     } else {
7553                       if (i_xgeo >= 0) {
7554                         histo_for_plot[i_xgeo] += read_histo[i0StexStinEcna];
7555                       }  // standard treatment
7556                     }
7557                   }  // end of if( i_xgeo >= -1 && i_xgeo < SizeForPlot )
7558                   else {
7559                     //std::cout << "!TEcnaHistos::ViewHisto(...)> <EE>  i_xgeo = " << i_xgeo
7560                     //     << ". OUT OF RANGE ( range = [0,"<< SizeForPlot << "] " << std::endl;
7561                   }
7562                 }  // end of if( fFlagSubDet == "EE" )
7563               }    // end of for(Int_t i0StexStinEcna=0; i0StexStinEcna<fEcal->MaxStinEcnaInStex(); i0StexStinEcna++)
7564             } else {
7565               std::cout << "!TEcnaHistos::ViewHisto(...)>  "
7566                         << " Data not available for " << fFapStexName << " " << iStasStex + 1
7567                         << " (Quantity not present in the ROOT file)" << std::endl;
7568             }
7569           }  // end of if ( fMyRootFile->LookAtRootFile() == kTRUE )   (ViewHisto/Stas)
7570           else {
7571             fStatusFileFound = kFALSE;
7572 
7573             std::cout << "!TEcnaHistos::ViewHisto(...)>  "
7574                       << " Data not available for " << fFapStexName << " " << iStasStex + 1 << " (ROOT file not found)"
7575                       << std::endl;
7576           }
7577 
7578           if (fFapNbOfEvts <= xFapNbOfEvts[iStasStex]) {
7579             fFapNbOfEvts = xFapNbOfEvts[iStasStex];
7580           }
7581 
7582         }  // end of for(Int_t iStasStex=0; iStasStex<fEcal->MaxStexInStas(); iStasStex++)
7583 
7584         //delete [] NOFE_int; NOFE_int = 0;               fCdelete++;
7585         delete[] xFapNbOfEvts;
7586         xFapNbOfEvts = nullptr;
7587         fCdelete++;
7588 
7589         if (CounterExistingFile > 0 && CounterDataExist > 0) {
7590           OKPlot = 1;
7591         }
7592 
7593       }  // end of if( fFapStexNumber == 0 )
7594 
7595       //---------------------------------------------------------------------------- (ViewHisto [Stex])
7596 
7597       if (fFapStexNumber > 0) {
7598         Bool_t OKFileExists = kFALSE;
7599         Bool_t ok_view_histo = kFALSE;
7600 
7601         if (arg_AlreadyRead == 0) {
7602           fMyRootFile->PrintNoComment();
7603           fMyRootFile->FileParameters(fFapAnaType,
7604                                       fFapNbOfSamples,
7605                                       fFapRunNumber,
7606                                       fFapFirstReqEvtNumber,
7607                                       fFapLastReqEvtNumber,
7608                                       fFapReqNbOfEvts,
7609                                       fFapStexNumber,
7610                                       fCfgResultsRootFilePath.Data());
7611 
7612           if (fMyRootFile->LookAtRootFile() == kTRUE) {
7613             OKFileExists = kTRUE;
7614           }  //   (ViewHisto, Stex)
7615 
7616           if (OKFileExists == kTRUE) {
7617             fFapNbOfEvts = fMyRootFile->GetNumberOfEvents(fFapReqNbOfEvts, fFapStexNumber);
7618             fp_name_short = fMyRootFile->GetRootFileNameShort();
7619             // std::cout << "*TEcnaHistos::ViewHisto(...)> Data are analyzed from file ----> "
7620             //      << fp_name_short << std::endl;
7621 
7622             fStartDate = fMyRootFile->GetStartDate();
7623             fStopDate = fMyRootFile->GetStopDate();
7624             fRunType = fMyRootFile->GetRunType();
7625 
7626             ok_view_histo = GetOkViewHisto(fMyRootFile, StexStin_A, i0StinEcha, i0Sample, HistoCode.Data());
7627           }
7628         }
7629 
7630         if (arg_AlreadyRead >= 1) {
7631           OKFileExists = kTRUE;
7632           ok_view_histo = kTRUE;
7633         }
7634 
7635         if (OKFileExists == kTRUE) {
7636           fStatusFileFound = kTRUE;
7637           //---------------------------------------------------------------------------- (ViewHisto [Stex])
7638 
7639           if (ok_view_histo == kTRUE) {
7640             //------------ EB or EE with SampGlobal or SampProj (histo_for_plot = read_histo)
7641             if (fFlagSubDet == "EB" ||
7642                 (fFlagSubDet == "EE" && (HistoType == "SampGlobal" || HistoType == "SampProj"))) {
7643               histo_for_plot = GetHistoValues(arg_read_histo,
7644                                               arg_AlreadyRead,
7645                                               fMyRootFile,
7646                                               HistoCode.Data(),
7647                                               SizeForPlot,
7648                                               SizeForRead,
7649                                               StexStin_A,
7650                                               i0StinEcha,
7651                                               i0Sample,
7652                                               i_data_exist);
7653               if (i_data_exist > 0) {
7654                 OKPlot = 1;
7655               }
7656               if (OKPlot == 1 && opt_plot == "ASCII" && (HistoType == "Global" || HistoType == "Proj")) {
7657                 WriteHistoAscii(HistoCode.Data(), SizeForPlot, histo_for_plot);
7658               }
7659             }
7660 
7661             //------------ EE  except for SampGlobal and SampProj) (histo_for_plot # read_histo)
7662             if (fFlagSubDet == "EE" && !(HistoType == "SampGlobal" || HistoType == "SampProj")) {
7663               TVectorD read_histo(SizeForRead);
7664               for (Int_t i = 0; i < SizeForRead; i++) {
7665                 read_histo(i) = (Double_t)0.;
7666               }
7667 
7668               read_histo = GetHistoValues(arg_read_histo,
7669                                           arg_AlreadyRead,
7670                                           fMyRootFile,
7671                                           HistoCode.Data(),
7672                                           SizeForRead,
7673                                           SizeForRead,
7674                                           StexStin_A,
7675                                           i0StinEcha,
7676                                           i0Sample,
7677                                           i_data_exist);
7678               if (i_data_exist > 0) {
7679                 OKPlot = 1;
7680               }
7681               if (OKPlot == 1 && opt_plot == "ASCII") {
7682                 WriteHistoAscii(HistoCode.Data(), fEcal->MaxCrysEcnaInDee(), read_histo);
7683               }
7684               if (OKPlot == 1 && opt_plot != "ASCII") {
7685                 //..................... Build histo_for_plot from read_histo (ViewHisto [Stex])
7686                 Int_t DeeNumber = fFapStexNumber;
7687                 TString DeeDir = fEcalNumbering->GetDeeDirViewedFromIP(DeeNumber);
7688 
7689                 //%%%%%%%%%%%%%%%%%%%%%%%%%%%% LOOP ON Echa (Ecna) %%%%%%%%%%%%%%%%%%%%%%%%%% (ViewHisto [Stex])
7690                 for (Int_t i0DeeEcha = 0; i0DeeEcha < fEcal->MaxCrysEcnaInDee(); i0DeeEcha++) {
7691                   Int_t n1SCEcha = fEcalNumbering->Get1SCEchaFrom0DeeEcha(i0DeeEcha);
7692                   Int_t n1DeeSCEcna = i0DeeEcha / fEcal->MaxCrysInSC() + 1;
7693 
7694                   Int_t DataSector = fEcalNumbering->GetDSFrom1DeeSCEcna(DeeNumber, n1DeeSCEcna);
7695                   Int_t SC_in_DS = fEcalNumbering->GetDSSCFrom1DeeSCEcna(DeeNumber, n1DeeSCEcna, n1SCEcha);
7696 
7697                   Int_t i_xgeo = -1;
7698 
7699                   if (n1SCEcha >= 1 && n1SCEcha <= fEcal->MaxCrysInSC()) {
7700                     if (n1DeeSCEcna >= 1 && n1DeeSCEcna <= fEcal->MaxSCEcnaInDee()) {
7701                       if (DataSector >= 1 && DataSector <= 9) {
7702                         if (SC_in_DS >= 1 && SC_in_DS <= fEcalNumbering->GetMaxSCInDS(DataSector)) {
7703                           if (read_histo[i0DeeEcha] != 0) {
7704                             //................................... Data Sector offset
7705                             Int_t DSOffset = GetDSOffset(DeeNumber, DataSector);
7706 
7707                             //........................ Super-Crystal (SC) offset (ViewHisto [Stex])
7708                             Int_t SCOffset = GetSCOffset(DeeNumber, DataSector, SC_in_DS);
7709 
7710                             //........................ Xtal final bin
7711                             Int_t nSCCons =
7712                                 fEcalNumbering->GetDeeSCConsFrom1DeeSCEcna(DeeNumber, n1DeeSCEcna, n1SCEcha);
7713 
7714                             Int_t n1FinalSCEcha = n1SCEcha;
7715 
7716                             if (fEcalNumbering->GetSCType(nSCCons) == "NotConnected" ||
7717                                 fEcalNumbering->GetSCType(nSCCons) ==
7718                                     "NotComplete") {  //----- not complete and not connected SC's
7719                               // no i_xgeo value if SC = 14 or 25 and channel 11
7720                               if (!((SC_in_DS == 14 || SC_in_DS == 25) && n1SCEcha == 11)) {
7721                                 n1FinalSCEcha = ModifiedSCEchaForNotConnectedSCs(
7722                                     DeeNumber, nSCCons, SC_in_DS, n1DeeSCEcna, n1SCEcha);
7723                                 i_xgeo = DSOffset + SCOffset + (n1FinalSCEcha - 1);
7724                               }
7725                               // change SC 14 -> 21 and channel 11 -> 21
7726                               if (SC_in_DS == 14 && n1SCEcha == 11) {
7727                                 SCOffset = GetSCOffset(DeeNumber, DataSector, 21);
7728                                 n1FinalSCEcha = 21;
7729                                 i_xgeo = DSOffset + SCOffset + (n1FinalSCEcha - 1);
7730                               }
7731                               // change SC 25 -> 3 for channel 11 -> 21
7732                               if (SC_in_DS == 25 && n1SCEcha == 11) {
7733                                 SCOffset = GetSCOffset(DeeNumber, DataSector, 3);
7734                                 n1FinalSCEcha = 21;
7735                                 i_xgeo = DSOffset + SCOffset + (n1FinalSCEcha - 1);
7736                               }
7737                             } else {  //----------- Complete SCs
7738                               i_xgeo = DSOffset + SCOffset + (n1FinalSCEcha - 1);
7739                             }
7740 
7741                             histo_for_plot_memo[i_xgeo]++;
7742                             if (histo_for_plot_memo[i_xgeo] >= 2) {
7743                               std::cout << "! histo_memo[" << i_xgeo << "] = " << histo_for_plot_memo[i_xgeo]
7744                                         << ", nSCCons = " << nSCCons << ", SC_in_DS = " << SC_in_DS
7745                                         << ", DSOffset = " << DSOffset << ", SCOffset = " << SCOffset
7746                                         << ", n1DeeSCEcna = " << n1DeeSCEcna << ", n1SCEcha = " << n1SCEcha
7747                                         << ", n1FinalSCEcha = " << n1FinalSCEcha << std::endl;
7748                             }
7749                             //.............................. transfert read_histo -> histo_for_plot
7750                             if (i_xgeo >= 0 && i_xgeo < SizeForPlot) {
7751                               if (n1FinalSCEcha > 0) {
7752                                 histo_for_plot[i_xgeo] += read_histo[i0DeeEcha];
7753                               }
7754                             } else {
7755                               std::cout << "!TEcnaHistos::ViewHisto(...)> <EE>  i_xgeo = " << i_xgeo
7756                                         << ". OUT OF RANGE ( range = [0," << SizeForPlot << "] " << std::endl;
7757                             }
7758                           }  // end of  if( read_histo[i0DeeEcha] > 0 )
7759                         }    // end of if( SC_in_DS >= 1 && SC_in_DS <= fEcalNumbering->GetMaxSCInDS(DataSector) )
7760                         else {
7761                           std::cout << "!TEcnaHistos::ViewHisto(...)> <EE>  SC_in_DS = " << SC_in_DS
7762                                     << ". OUT OF RANGE ( range = [1," << fEcalNumbering->GetMaxSCInDS(DataSector)
7763                                     << "] "
7764                                     << ", DataSector = " << DataSector << ", n1DeeSCEcna = " << n1DeeSCEcna
7765                                     << ", n1SCEcha = " << n1SCEcha << ", i0DeeEcha = " << i0DeeEcha << std::endl;
7766                         }
7767                       }  // end of if( DataSector >= 1 && DataSector <= 9 )
7768                       else {
7769                         if (DataSector != 0) {
7770                           std::cout << "!TEcnaHistos::ViewHisto(...)> <EE>  DataSector = " << DataSector
7771                                     << ". OUT OF RANGE ( range = [1,9] "
7772                                     << ", n1DeeSCEcna = " << n1DeeSCEcna << ", n1SCEcha = " << n1SCEcha
7773                                     << ", i0DeeEcha = " << i0DeeEcha << std::endl;
7774                         }
7775                       }
7776                     }  // end of if( n1DeeSCEcna >= 1 && n1DeeSCEcna <= fEcal->MaxSCEcnaInDee() )
7777                     else {
7778                       std::cout << "!TEcnaHistos::ViewHisto(...)> <EE>  n1DeeSCEcna = " << n1DeeSCEcna
7779                                 << ". OUT OF RANGE ( range = [1," << fEcal->MaxSCEcnaInDee() << "] "
7780                                 << ", n1SCEcha = " << n1SCEcha << ", i0DeeEcha = " << i0DeeEcha << std::endl;
7781                     }
7782                   }  // end of if(n1SCEcha >= 1 && n1SCEcha <= fEcal->MaxCrysInSC() )
7783                   else {
7784                     std::cout << "!TEcnaHistos::ViewHisto(...)> <EE>  n1SCEcha = " << n1SCEcha
7785                               << ". OUT OF RANGE ( range = [1," << fEcal->MaxCrysInSC() << "] "
7786                               << ", i0DeeEcha = " << i0DeeEcha << std::endl;
7787                   }
7788                 }
7789               }  // end of if( OKPlot == 1 && opt_plot != "ASCII" )
7790             }    // end of if(fFlagSubDet == "EE")
7791           }      // end of if(ok_view_histo == kTRUE)
7792           else {
7793             std::cout << "!TEcnaHistos::ViewHisto(...)> *ERROR* =====> "
7794                       << " ok_view_histo != kTRUE " << fTTBELL << std::endl;
7795           }
7796         }  // end of if(fMyRootFile->LookAtRootFile() == kTRUE)
7797         else {
7798           fStatusFileFound = kFALSE;
7799 
7800           std::cout << "!TEcnaHistos::ViewHisto(...)> *ERROR* =====> "
7801                     << " ROOT file not found" << fTTBELL << std::endl;
7802         }
7803       }  // end of if(fFapStexNumber > 0)
7804     }  // end of if( HistoType == "Global" || HistoType == "Proj" || HistoType == "SampGlobal" || HistoType == "SampProj" )
7805     else {
7806       //--------------------------------------------------------------------- not Global-Proj Histo
7807       if ((fFapStexNumber > 0) && (fFapStexNumber <= fEcal->MaxStexInStas())) {
7808         Bool_t OKFileExists = kFALSE;
7809 
7810         if (!(arg_AlreadyRead > 1)) {
7811           fMyRootFile->PrintNoComment();
7812           fMyRootFile->FileParameters(fFapAnaType,
7813                                       fFapNbOfSamples,
7814                                       fFapRunNumber,
7815                                       fFapFirstReqEvtNumber,
7816                                       fFapLastReqEvtNumber,
7817                                       fFapReqNbOfEvts,
7818                                       fFapStexNumber,
7819                                       fCfgResultsRootFilePath.Data());
7820           OKFileExists = fMyRootFile->LookAtRootFile();
7821           if (OKFileExists == kTRUE) {
7822             fFapNbOfEvts = fMyRootFile->GetNumberOfEvents(fFapReqNbOfEvts, fFapStexNumber);
7823           }
7824         } else {
7825           OKFileExists = kTRUE;
7826         }
7827 
7828         if (OKFileExists == kTRUE)  //   (ViewHisto, not Global-Proj)
7829         {
7830           fStatusFileFound = kTRUE;
7831 
7832           for (Int_t i = 0; i < SizeForPlot; i++) {
7833             histo_for_plot[i] = (Double_t)0;
7834           }
7835 
7836           histo_for_plot = GetHistoValues(arg_read_histo,
7837                                           arg_AlreadyRead,
7838                                           fMyRootFile,
7839                                           HistoCode.Data(),
7840                                           SizeForPlot,
7841                                           SizeForRead,
7842                                           StexStin_A,
7843                                           i0StinEcha,
7844                                           i0Sample,
7845                                           i_data_exist);
7846 
7847           fFapNbOfEvts = fMyRootFile->GetNumberOfEvents(fFapReqNbOfEvts, fFapStexNumber);
7848           fStartDate = fMyRootFile->GetStartDate();
7849           fStopDate = fMyRootFile->GetStopDate();
7850           fRunType = fMyRootFile->GetRunType();
7851 
7852           if (i_data_exist > 0) {
7853             OKPlot = 1;
7854           }
7855         } else {
7856           std::cout << "!TEcnaHistos::ViewHisto(...)> *ERROR* =====> "
7857                     << " ROOT file not found" << fTTBELL << std::endl;
7858         }
7859       } else {
7860         std::cout << "!TEcnaHistos::ViewHisto(...)> " << fFapStexName.Data() << " = " << fFapStexNumber
7861                   << ". Out of range (range = [1," << fEcal->MaxStexInStas() << "]) " << fTTBELL << std::endl;
7862       }
7863     }
7864 
7865     //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PLOT accepted
7866 
7867     if ((HistoType == "Global" || HistoType == "Proj" || HistoType == "SampGlobal" || HistoType == "SampProj" ||
7868          HistoType == "H1Basic" || HistoType == "H1BasicProj") ||
7869         (!(HistoType == "Global" || HistoType == "Proj" || HistoType == "SampGlobal" || HistoType == "SampProj" ||
7870            HistoType == "H1Basic" || HistoType == "H1BasicProj") &&
7871          ((fFapStexNumber > 0) && (fFapStexNumber <= fEcal->MaxStexInStas())))) {
7872       if (opt_plot != "ASCII") {
7873         if (OKPlot > 0) {
7874           //... Ymin and ymax default values will be taken if fFlagUserHistoMin/Max = "OFF"
7875           //    and if "Free" for "SAME" and "SAME n" options
7876           if ((opt_plot == fOnlyOnePlot && (arg_AlreadyRead == 0 || arg_AlreadyRead == 1)) ||
7877               (opt_plot == fSeveralPlot && GetMemoFlag(HistoCode, opt_plot) == "Free") ||
7878               (opt_plot == fSameOnePlot && GetMemoFlag(HistoCode, opt_plot) == "Free")) {
7879             SetYminMemoFromValue(HistoCode.Data(), fCnaParHistos->GetYminDefaultValue(HistoCode.Data()));
7880             SetYmaxMemoFromValue(HistoCode.Data(), fCnaParHistos->GetYmaxDefaultValue(HistoCode.Data()));
7881           }
7882 
7883           //====  H I S T O  P R O J   X I N F / X S U P   M A N A G E M E N T  ========  (ViewHisto)
7884           //
7885           //  must be done before booking because of the x <-> y permutation in case of "Proj"
7886           //
7887           //-----------------------------------------------------------------------------------------
7888           //
7889           //        CASE:    HistoType == "Proj"   OR   HistoType == "SampProj"
7890           //
7891           //                 Xinf and Xsup must be calculated from ymin and ymax
7892           //                 of the direct ("Global") histo
7893           //
7894           //-----------------------------------------------------------------------------------------
7895           if (HistoType == "Proj" || HistoType == "SampProj" || HistoType == "H1BasicProj") {
7896             TString HistoCodi = HistoCode;  // HistoCodi = direct histo
7897 
7898             if (HistoCode == "D_NOE_ChDs") {
7899               HistoCodi = "D_NOE_ChNb";
7900             }
7901             if (HistoCode == "D_Ped_ChDs") {
7902               HistoCodi = "D_Ped_ChNb";
7903             }
7904             if (HistoCode == "D_TNo_ChDs") {
7905               HistoCodi = "D_TNo_ChNb";
7906             }
7907             if (HistoCode == "D_MCs_ChDs") {
7908               HistoCodi = "D_MCs_ChNb";
7909             }
7910             if (HistoCode == "D_LFN_ChDs") {
7911               HistoCodi = "D_LFN_ChNb";
7912             }
7913             if (HistoCode == "D_HFN_ChDs") {
7914               HistoCodi = "D_HFN_ChNb";
7915             }
7916             if (HistoCode == "D_SCs_ChDs") {
7917               HistoCodi = "D_SCs_ChNb";
7918             }
7919             if (HistoCode == "D_MSp_SpDs") {
7920               HistoCodi = "D_MSp_SpNb";
7921             }
7922             if (HistoCode == "D_SSp_SpDs") {
7923               HistoCodi = "D_SSp_SpNb";
7924             }
7925             if (HistoCode == "D_Adc_EvDs") {
7926               HistoCodi = "D_Adc_EvNb";
7927             }
7928 
7929             TString TitleHisto = ";";
7930             if (opt_plot != fSameOnePlot) {
7931               TitleHisto = fCnaParHistos->GetQuantityName(HistoCodi);
7932             }
7933 
7934             if (fUserHistoMin >= fUserHistoMax) {
7935               fFlagUserHistoMin = "AUTO";
7936               fFlagUserHistoMax = "AUTO";
7937             }
7938 
7939             //--------------------------------------------------------------------------- (ViewHisto)
7940             //
7941             //    fOnlyOnePlot => compute Xinf and Xsup at each time
7942             //    fSeveralPlot => compute Xinf and Xsup once when flag = "Free" for each HistoCode
7943             //    fSameOnePlot => compute Xinf and Xsup once
7944             //
7945             //--------------------------------------------------------------------------------------
7946             if ((opt_plot == fOnlyOnePlot && (arg_AlreadyRead == 0 || arg_AlreadyRead == 1)) ||
7947                 (opt_plot == fSeveralPlot && GetMemoFlag(HistoCode, fSeveralPlot) == "Free") ||
7948                 (opt_plot == fSameOnePlot && GetMemoFlag(HistoCode, fSameOnePlot) == "Free")) {
7949               Double_t XinfProj = (Double_t)0;
7950               Double_t XsupProj = (Double_t)0;
7951 
7952               //...................................................................... (ViewHisto)
7953               if (fFlagUserHistoMin == "AUTO" || fFlagUserHistoMax == "AUTO") {
7954                 Int_t HisSiza = GetHistoSize(HistoCodi.Data(), "plot");
7955                 Int_t ReadHisSiza = HisSiza;
7956                 //..............................  prepa direct histogram booking (ViewHisto)
7957                 Axis_t xinf_hisa = GetHistoXinf(HistoCodi.Data(), HisSiza, opt_plot);
7958                 Axis_t xsup_hisa = GetHistoXsup(HistoCodi.Data(), HisSiza, opt_plot);
7959                 Int_t nb_binxa = GetHistoNumberOfBins(HistoCodi.Data(), HisSiza);
7960                 //..............................  direct ("Global") histogram booking (ViewHisto)
7961                 TH1D* h_hisa = new TH1D("histoa", TitleHisto.Data(), nb_binxa, xinf_hisa, xsup_hisa);
7962                 fCnewRoot++;
7963                 h_hisa->Reset();
7964                 //.... direct histogram filling to get its ymin (=> xminProj) and ymax (=> xmaxProj)
7965                 FillHisto(h_hisa, histo_for_plot, HistoCodi.Data(), ReadHisSiza);
7966                 //... Get direct histo ymin and/or ymax and keep them as xinf and xsup
7967                 //    in memo for the plotted histo
7968                 XinfProj = fUserHistoMin;
7969                 XsupProj = fUserHistoMax;
7970                 if (fFlagUserHistoMin == "AUTO") {
7971                   XinfProj = h_hisa->GetMinimum();
7972                 }
7973                 if (fFlagUserHistoMax == "AUTO") {
7974                   XsupProj = h_hisa->GetMaximum();
7975                 }
7976                 XsupProj += (XsupProj - XinfProj) * fCnaParHistos->GetMarginAutoMinMax();  // to see the last bin
7977                 h_hisa->Delete();
7978                 h_hisa = nullptr;
7979                 fCdeleteRoot++;
7980               }  // end of  if( fFlagUserHistoMin == "AUTO" || fFlagUserHistoMax == "AUTO" )
7981               else {
7982                 if (fFlagUserHistoMin == "OFF") {
7983                   SetYminMemoFromValue(HistoCode.Data(), fCnaParHistos->GetYminDefaultValue(HistoCode.Data()));
7984                   XinfProj = GetYminValueFromMemo(HistoCode.Data());
7985                 }
7986 
7987                 if (fFlagUserHistoMax == "OFF") {
7988                   SetYmaxMemoFromValue(HistoCode.Data(), fCnaParHistos->GetYmaxDefaultValue(HistoCode.Data()));
7989                   XsupProj = GetYmaxValueFromMemo(HistoCode.Data());
7990                 }
7991                 if (fFlagUserHistoMin == "ON") {
7992                   XinfProj = fUserHistoMin;
7993                 }
7994                 if (fFlagUserHistoMax == "ON") {
7995                   XsupProj = fUserHistoMax;
7996                 }
7997               }
7998 
7999               if (opt_plot == fOnlyOnePlot || opt_plot == fSeveralPlot) {
8000                 SetXinfMemoFromValue(HistoCode.Data(), XinfProj);
8001                 SetXsupMemoFromValue(HistoCode.Data(), XsupProj);
8002               } else {
8003                 SetXinfMemoFromValue(XinfProj);
8004                 SetXsupMemoFromValue(XsupProj);
8005               }
8006             }  // end of if( (opt_plot == fOnlyOnePlot) ||
8007                // (opt_plot == fSeveralPlot  && GetMemoFlag(HistoCode, opt_plot) == "Free") ||
8008                // (opt_plot == fSameOnePlot  && GetMemoFlag(HistoCode, opt_plot) == "Free") )
8009           }    // end of  if( HistoType == "Proj" || HistoType == "SampProj" || HistoType == "H1BasicProj" )
8010 
8011           //===============  H I S T O   B O O K I N G   A N D   F I L L I N G  ========  (ViewHisto)
8012           //..............................  prepa histogram booking (ViewHisto)
8013 
8014           //.......... Set number of bins: forcing to fNbBinsProj if "HistoType" == "Proj"
8015           Int_t xNbBins = GetHistoNumberOfBins(HistoCode.Data(), SizeForPlot);
8016 
8017           Double_t cXinf = (Double_t)0.;
8018           Double_t cXsup = (Double_t)0.;
8019 
8020           //.......... Set Xinf and Xsup at each time because of simultaneous SAME options
8021           if (HistoType == "Proj" || HistoType == "SampProj" || HistoType == "H1BasicProj") {
8022             if (opt_plot == fOnlyOnePlot || opt_plot == fSeveralPlot) {
8023               cXinf = GetXinfValueFromMemo(HistoCode.Data());
8024               cXsup = GetXsupValueFromMemo(HistoCode.Data());
8025             } else {
8026               cXinf = GetXinfValueFromMemo();
8027               cXsup = GetXsupValueFromMemo();
8028             }
8029           } else {
8030             cXinf = GetHistoXinf(HistoCode.Data(), SizeForPlot, opt_plot);
8031             cXsup = GetHistoXsup(HistoCode.Data(), SizeForPlot, opt_plot);
8032           }
8033 
8034           //..............................  histogram booking (ViewHisto)
8035           Axis_t xinf_his = cXinf;  // ancillary variables since no const in arguments of TH1D
8036           Axis_t xsup_his = cXsup;
8037           Int_t nb_binx = xNbBins;
8038 
8039           TString TitleHisto = ";";
8040           if (opt_plot != fSameOnePlot) {
8041             TitleHisto = fCnaParHistos->GetQuantityName(HistoCode.Data());
8042           }
8043           TH1D* h_his0 = new TH1D("histo", TitleHisto.Data(), nb_binx, xinf_his, xsup_his);
8044           fCnewRoot++;
8045           h_his0->Reset();
8046           //............................... histogram filling
8047           FillHisto(h_his0, histo_for_plot, HistoCode.Data(), SizeForPlot);
8048 
8049           //===============  H I S T O   Y M I N / Y M A X   M A N A G E M E N T  ===========  (ViewHisto)
8050           if (opt_plot == fOnlyOnePlot || (opt_plot == fSeveralPlot && GetMemoFlag(HistoCode, opt_plot) == "Free") ||
8051               (opt_plot == fSameOnePlot && GetMemoFlag(HistoCode, opt_plot) == "Free")) {
8052             if (opt_plot == fSameOnePlot) {
8053               fHistoCodeFirst = HistoCode;
8054             }  // registration of first HistoCode
8055             //................................. Automatic min and/or max for other options than "Proj"
8056             if (HistoType != "Proj" && HistoType != "SampProj" && HistoType != "H1BasicProj") {
8057               if (fUserHistoMin >= fUserHistoMax) {
8058                 fFlagUserHistoMin = "AUTO";
8059                 fFlagUserHistoMax = "AUTO";
8060               }
8061               //................................. user's min and/or max
8062               if (fFlagUserHistoMin == "ON") {
8063                 SetYminMemoFromValue(HistoCode.Data(), fUserHistoMin);
8064                 fFlagUserHistoMin = "OFF";
8065               }
8066               if (fFlagUserHistoMax == "ON") {
8067                 SetYmaxMemoFromValue(HistoCode.Data(), fUserHistoMax);
8068                 fFlagUserHistoMax = "OFF";
8069               }
8070               //................................. automatic min and/or max
8071               if (fFlagUserHistoMin == "AUTO") {
8072                 //.............. no bottom margin if ymin = 0
8073                 Double_t ymin = GetYminFromHistoFrameAndMarginValue(h_his0, (Double_t)0.);
8074                 if (ymin != (Double_t)0.) {
8075                   ymin = GetYminFromHistoFrameAndMarginValue(h_his0, fCnaParHistos->GetMarginAutoMinMax());
8076                 }
8077                 SetYminMemoFromValue(HistoCode.Data(), ymin);
8078                 fFlagUserHistoMin = "OFF";
8079               }
8080               if (fFlagUserHistoMax == "AUTO") {
8081                 Double_t ymax = GetYmaxFromHistoFrameAndMarginValue(h_his0, fCnaParHistos->GetMarginAutoMinMax());
8082                 SetYmaxMemoFromValue(HistoCode.Data(), ymax);
8083                 fFlagUserHistoMax = "OFF";
8084               }
8085               //................................. Set YMin and YMax of histo (ViewHisto)
8086               SetYminMemoFromPreviousMemo(HistoCode);
8087               SetYmaxMemoFromPreviousMemo(HistoCode);
8088             }  // end of if( HistoType != "Proj" && HistoType != "SampProj" && HistoType != "H1BasicProj" )
8089 
8090             //.......... Find maximum in case of Proj (LIN scale only) // PS: EvolProj => in ViewHistime
8091             if ((HistoType == "Proj" || HistoType == "SampProj" || HistoType == "H1BasicProj") &&
8092                 fFlagScaleY == "LIN") {
8093               SetYmaxMemoFromValue(HistoCode.Data(),
8094                                    GetYmaxFromHistoFrameAndMarginValue(h_his0, fCnaParHistos->GetMarginAutoMinMax()));
8095             }
8096           }  // end of  if( opt_plot == fOnlyOnePlot ||
8097           // (opt_plot == fSeveralPlot && GetMemoFlag(HistoCode, opt_plot) == "Free") ||
8098           // (opt_plot == fSameOnePlot && GetMemoFlag(HistoCode, opt_plot) == "Free") )
8099 
8100           //--- Set ymin and ymax to the first HistoCode values for option SAME n
8101           if (opt_plot == fSameOnePlot && GetMemoFlag(HistoCode, opt_plot) == "Busy") {
8102             Double_t ymin = GetYminValueFromMemo(fHistoCodeFirst.Data());
8103             SetYminMemoFromValue(HistoCode.Data(), ymin);
8104 
8105             Double_t ymax = GetYmaxValueFromMemo(fHistoCodeFirst.Data());
8106             SetYmaxMemoFromValue(HistoCode.Data(), ymax);
8107           }
8108 
8109           //... histogram set ymin and ymax and consequently margin at top of the plot
8110           Int_t xFlagAutoYsupMargin = SetHistoFrameYminYmaxFromMemo(h_his0, HistoCode);
8111 
8112           //==================================== P L O T ==============================  (ViewHisto)
8113           HistoPlot(h_his0,
8114                     SizeForPlot,
8115                     xinf_his,
8116                     xsup_his,
8117                     HistoCode.Data(),
8118                     HistoType.Data(),
8119                     StexStin_A,
8120                     i0StinEcha,
8121                     i0Sample,
8122                     opt_scale_x,
8123                     opt_scale_y,
8124                     opt_plot,
8125                     arg_AlreadyRead,
8126                     xFlagAutoYsupMargin);
8127           h_his0->Delete();
8128           h_his0 = nullptr;
8129           fCdeleteRoot++;
8130           //===========================================================================
8131 
8132           //--- Recover ymin and ymax from user's values in option SAME n
8133           if ((opt_plot == fSameOnePlot && GetMemoFlag(HistoCode, opt_plot) == "Busy")) {
8134             SetYminMemoFromValue(HistoCode.Data(), fUserHistoMin);
8135             SetYmaxMemoFromValue(HistoCode.Data(), fUserHistoMax);
8136           }
8137         }  // end of if( OKPlot > 0 )
8138         else {
8139           std::cout << "!TEcnaHistos::ViewHisto(...)> Histo not available." << fTTBELL << std::endl;
8140         }
8141       }
8142     }
8143   }  // end of  if( OKHisto == 1 )
8144 
8145 }  // end of ViewHisto(...)
8146 
8147 //------------------------------------------------------------------------------------
8148 Int_t TEcnaHistos::GetDSOffset(const Int_t& DeeNumber, const Int_t& DataSector) {
8149   // gives the DataSector Offset on 1D histos for option "Global"
8150 
8151   Int_t DSOffset = 0;
8152 
8153   if (DeeNumber == 4) {
8154     if (DataSector >= 1) {
8155     }
8156     if (DataSector >= 2) {
8157       DSOffset += fEcalNumbering->GetMaxSCInDS(1) * fEcal->MaxCrysInSC();
8158     }
8159     if (DataSector >= 3) {
8160       DSOffset += fEcalNumbering->GetMaxSCInDS(2) * fEcal->MaxCrysInSC();
8161     }
8162     if (DataSector >= 4) {
8163       DSOffset += fEcalNumbering->GetMaxSCInDS(3) * fEcal->MaxCrysInSC();
8164     }
8165     if (DataSector >= 5) {
8166       DSOffset += fEcalNumbering->GetMaxSCInDS(4) * fEcal->MaxCrysInSC();
8167     }
8168   }
8169   if (DeeNumber == 3) {
8170     if (DataSector >= 5) {
8171     }
8172     if (DataSector >= 6) {
8173       DSOffset += (fEcalNumbering->GetMaxSCInDS(5) / 2) * fEcal->MaxCrysInSC();
8174     }
8175     if (DataSector >= 7) {
8176       DSOffset += fEcalNumbering->GetMaxSCInDS(6) * fEcal->MaxCrysInSC();
8177     }
8178     if (DataSector >= 8) {
8179       DSOffset += fEcalNumbering->GetMaxSCInDS(7) * fEcal->MaxCrysInSC();
8180     }
8181     if (DataSector >= 9) {
8182       DSOffset += fEcalNumbering->GetMaxSCInDS(8) * fEcal->MaxCrysInSC();
8183     }
8184   }
8185   if (DeeNumber == 2) {
8186     if (DataSector <= 9) {
8187     }
8188     if (DataSector <= 8) {
8189       DSOffset += fEcalNumbering->GetMaxSCInDS(9) * fEcal->MaxCrysInSC();
8190     }
8191     if (DataSector <= 7) {
8192       DSOffset += fEcalNumbering->GetMaxSCInDS(8) * fEcal->MaxCrysInSC();
8193     }
8194     if (DataSector <= 6) {
8195       DSOffset += fEcalNumbering->GetMaxSCInDS(7) * fEcal->MaxCrysInSC();
8196     }
8197     if (DataSector <= 5) {
8198       DSOffset += fEcalNumbering->GetMaxSCInDS(6) * fEcal->MaxCrysInSC();
8199     }
8200   }
8201   if (DeeNumber == 1) {
8202     if (DataSector <= 5) {
8203     }
8204     if (DataSector <= 4) {
8205       DSOffset += (fEcalNumbering->GetMaxSCInDS(5) / 2) * fEcal->MaxCrysInSC();
8206     }
8207     if (DataSector <= 3) {
8208       DSOffset += fEcalNumbering->GetMaxSCInDS(4) * fEcal->MaxCrysInSC();
8209     }
8210     if (DataSector <= 2) {
8211       DSOffset += fEcalNumbering->GetMaxSCInDS(3) * fEcal->MaxCrysInSC();
8212     }
8213     if (DataSector <= 1) {
8214       DSOffset += fEcalNumbering->GetMaxSCInDS(2) * fEcal->MaxCrysInSC();
8215     }
8216   }
8217   return DSOffset;
8218 }
8219 //------------------------------------------------------------------------------------
8220 Int_t TEcnaHistos::GetSCOffset(const Int_t& DeeNumber, const Int_t& DataSector, const Int_t& SC_in_DS) {
8221   // gives the SC (Super-Crystal) Offset on 1D histos for option "Global"
8222 
8223   Int_t SCOffset = 0;
8224 
8225   if (DeeNumber == 1 || DeeNumber == 3) {
8226     if (DataSector == 5) {
8227       SCOffset += ((SC_in_DS - 17) - 1) * fEcal->MaxCrysInSC();
8228     }
8229     if (DataSector != 5) {
8230       SCOffset += (SC_in_DS - 1) * fEcal->MaxCrysInSC();
8231     }
8232   }
8233 
8234   if (DeeNumber == 2 || DeeNumber == 4) {
8235     SCOffset += (SC_in_DS - 1) * fEcal->MaxCrysInSC();
8236   }
8237 
8238   return SCOffset;
8239 }
8240 //------------------------------------------------------------------------------------
8241 Int_t TEcnaHistos::ModifiedSCEchaForNotConnectedSCs(const Int_t& n1DeeNumber,
8242                                                     const Int_t& nSCCons,
8243                                                     const Int_t& SC_in_DS,
8244                                                     const Int_t& n1DeeSCEcna,
8245                                                     const Int_t& n1SCEcha) {
8246   //------------------------ Modification of n1SCEcha number for not connected SC's
8247 
8248   Int_t ModifiedSCEcha = -1;
8249   TString SCQuad = fEcalNumbering->GetSCQuadFrom1DeeSCEcna(n1DeeSCEcna);  // SCQuad = top  OR bottom
8250   TString DeeDir = fEcalNumbering->GetDeeDirViewedFromIP(n1DeeNumber);    // DeeDir = left OR right
8251 
8252   TString TypQuad = "?";
8253   if (SCQuad == "top" && DeeDir == "right") {
8254     TypQuad = "TR";
8255   }
8256   if (SCQuad == "top" && DeeDir == "left") {
8257     TypQuad = "TL";
8258   }
8259   if (SCQuad == "bottom" && DeeDir == "left") {
8260     TypQuad = "BL";
8261   }
8262   if (SCQuad == "bottom" && DeeDir == "right") {
8263     TypQuad = "BR";
8264   }
8265 
8266   //------------------------------------------------------------------------------------------- top
8267 
8268   //..... (D1,S1), (D3,S9) SC_in_DS = 30, n1DeeSCEcna =  60 -> 182a for construction top/right
8269   //..... (D1,S2), (D3,S8) SC_in_DS =  3, n1DeeSCEcna = 138 -> 178a for construction top/right
8270   if ((SC_in_DS == 30 && n1DeeSCEcna == 60 && TypQuad == "TR") ||
8271       (SC_in_DS == 3 && n1DeeSCEcna == 138 && TypQuad == "TR")) {
8272     if (n1SCEcha > 15) {
8273       ModifiedSCEcha = n1SCEcha - 15;
8274     }
8275   }
8276 
8277   //..... (D4,S1), (D2,S9) SC_in_DS = 30, n1DeeSCEcna =  60 ->  33a for construction top/left
8278   //..... (D4,S2), (D2,S8) SC_in_DS =  3, n1DeeSCEcna = 138 ->  29a for construction top/left
8279   if ((SC_in_DS == 30 && n1DeeSCEcna == 60 && TypQuad == "TL") ||
8280       (SC_in_DS == 3 && n1DeeSCEcna == 138 && TypQuad == "TL")) {
8281     if (n1SCEcha == 4) {
8282       ModifiedSCEcha = 1;
8283     }
8284     if (n1SCEcha == 5) {
8285       ModifiedSCEcha = 2;
8286     }
8287     if (n1SCEcha == 9) {
8288       ModifiedSCEcha = 3;
8289     }
8290     if (n1SCEcha == 10) {
8291       ModifiedSCEcha = 4;
8292     }
8293     if (n1SCEcha == 14) {
8294       ModifiedSCEcha = 5;
8295     }
8296     if (n1SCEcha == 15) {
8297       ModifiedSCEcha = 6;
8298     }
8299     if (n1SCEcha == 19) {
8300       ModifiedSCEcha = 7;
8301     }
8302     if (n1SCEcha == 20) {
8303       ModifiedSCEcha = 8;
8304     }
8305     if (n1SCEcha == 24) {
8306       ModifiedSCEcha = 9;
8307     }
8308     if (n1SCEcha == 25) {
8309       ModifiedSCEcha = 10;
8310     }
8311   }
8312 
8313   //..... (D1,S1), (D3,S9) SC_in_DS = 30, n1DeeSCEcna = 119 -> 182b for construction top/right
8314   if (SC_in_DS == 30 && n1DeeSCEcna == 119 && TypQuad == "TR") {
8315     if (n1SCEcha > 5) {
8316       ModifiedSCEcha = n1SCEcha - 5;
8317     }
8318   }
8319 
8320   //..... (D4,S1), (D2,S9) SC_in_DS = 30, n1DeeSCEcna = 119 ->  33b for construction top/left
8321   if (SC_in_DS == 30 && n1DeeSCEcna == 119 && TypQuad == "TL") {
8322     if (n1SCEcha == 4) {
8323       ModifiedSCEcha = 11;
8324     }
8325     if (n1SCEcha == 5) {
8326       ModifiedSCEcha = 12;
8327     }
8328     if (n1SCEcha == 9) {
8329       ModifiedSCEcha = 13;
8330     }
8331     if (n1SCEcha == 10) {
8332       ModifiedSCEcha = 14;
8333     }
8334     if (n1SCEcha == 14) {
8335       ModifiedSCEcha = 15;
8336     }
8337     if (n1SCEcha == 15) {
8338       ModifiedSCEcha = 16;
8339     }
8340     if (n1SCEcha == 19) {
8341       ModifiedSCEcha = 17;
8342     }
8343     if (n1SCEcha == 20) {
8344       ModifiedSCEcha = 18;
8345     }
8346     if (n1SCEcha == 24) {
8347       ModifiedSCEcha = 19;
8348     }
8349     if (n1SCEcha == 25) {
8350       ModifiedSCEcha = 20;
8351     }
8352   }
8353 
8354   //..... (D1,S1), (D3,S9) SC_in_DS = 12, n1DeeSCEcna =  13 -> 161  for construction top/right
8355   //..... (D4,S1), (D2,S9) SC_in_DS = 12, n1DeeSCEcna =  13 ->  12  for construction top/left
8356   if (SC_in_DS == 12 && n1DeeSCEcna == 13 && TypQuad == "TR") {
8357     ModifiedSCEcha = n1SCEcha;
8358   }
8359   if (SC_in_DS == 12 && n1DeeSCEcna == 13 && TypQuad == "TL") {
8360     if (n1SCEcha >= 1 && n1SCEcha <= 4) {
8361       ModifiedSCEcha = n1SCEcha;
8362     }
8363     if (n1SCEcha >= 6 && n1SCEcha <= 9) {
8364       ModifiedSCEcha = n1SCEcha - 1;
8365     }
8366     if (n1SCEcha >= 11 && n1SCEcha <= 14) {
8367       ModifiedSCEcha = n1SCEcha - 2;
8368     }
8369     if (n1SCEcha >= 16 && n1SCEcha <= 19) {
8370       ModifiedSCEcha = n1SCEcha - 3;
8371     }
8372     if (n1SCEcha >= 21 && n1SCEcha <= 24) {
8373       ModifiedSCEcha = n1SCEcha - 4;
8374     }
8375   }
8376 
8377   //..... (D1,S2), (D3,S8) SC_in_DS = 25, n1DeeSCEcna = 176 -> 207a for construction top/right
8378   if (SC_in_DS == 25 && n1DeeSCEcna == 176 && TypQuad == "TR") {
8379     if (n1SCEcha == 4) {
8380       ModifiedSCEcha = 1;
8381     }
8382     if (n1SCEcha == 5) {
8383       ModifiedSCEcha = 2;
8384     }
8385     if (n1SCEcha == 9) {
8386       ModifiedSCEcha = 3;
8387     }
8388     if (n1SCEcha == 10) {
8389       ModifiedSCEcha = 4;
8390     }
8391     if (n1SCEcha == 14) {
8392       ModifiedSCEcha = 5;
8393     }
8394     if (n1SCEcha == 15) {
8395       ModifiedSCEcha = 6;
8396     }
8397     if (n1SCEcha == 19) {
8398       ModifiedSCEcha = 7;
8399     }
8400     if (n1SCEcha == 20) {
8401       ModifiedSCEcha = 8;
8402     }
8403     if (n1SCEcha == 24) {
8404       ModifiedSCEcha = 9;
8405     }
8406     if (n1SCEcha == 25) {
8407       ModifiedSCEcha = 10;
8408     }
8409   }
8410 
8411   //..... (D4,S2), (D2,S8) SC_in_DS = 25, n1DeeSCEcna = 176 ->  58a for construction top/left
8412   if (SC_in_DS == 25 && n1DeeSCEcna == 176 && TypQuad == "TL") {
8413     if (n1SCEcha == 16) {
8414       ModifiedSCEcha = 1;
8415     }
8416     if (n1SCEcha == 21) {
8417       ModifiedSCEcha = 2;
8418     }
8419     if (n1SCEcha == 17) {
8420       ModifiedSCEcha = 3;
8421     }
8422     if (n1SCEcha == 22) {
8423       ModifiedSCEcha = 4;
8424     }
8425     if (n1SCEcha == 18) {
8426       ModifiedSCEcha = 5;
8427     }
8428     if (n1SCEcha == 23) {
8429       ModifiedSCEcha = 6;
8430     }
8431     if (n1SCEcha == 19) {
8432       ModifiedSCEcha = 7;
8433     }
8434     if (n1SCEcha == 24) {
8435       ModifiedSCEcha = 8;
8436     }
8437     if (n1SCEcha == 20) {
8438       ModifiedSCEcha = 9;
8439     }
8440     if (n1SCEcha == 25) {
8441       ModifiedSCEcha = 10;
8442     }
8443   }
8444 
8445   //..... (D1,S2), (D3,S8) SC_in_DS =  3, n1DeeSCEcna = 157 -> 178b for construction top/right
8446   //..... (D1,S2), (D3,S8) SC_in_DS = 25, n1DeeSCEcna = 193 -> 207b for construction top/right
8447   if ((SC_in_DS == 3 && n1DeeSCEcna == 157 && TypQuad == "TR") ||
8448       (SC_in_DS == 25 && n1DeeSCEcna == 193 && TypQuad == "TR")) {
8449     if (n1SCEcha == 4) {
8450       ModifiedSCEcha = 11;
8451     }
8452     if (n1SCEcha == 5) {
8453       ModifiedSCEcha = 12;
8454     }
8455     if (n1SCEcha == 9) {
8456       ModifiedSCEcha = 13;
8457     }
8458     if (n1SCEcha == 10) {
8459       ModifiedSCEcha = 14;
8460     }
8461     if (n1SCEcha == 14) {
8462       ModifiedSCEcha = 15;
8463     }
8464     if (n1SCEcha == 15) {
8465       ModifiedSCEcha = 16;
8466     }
8467     if (n1SCEcha == 19) {
8468       ModifiedSCEcha = 17;
8469     }
8470     if (n1SCEcha == 20) {
8471       ModifiedSCEcha = 18;
8472     }
8473     if (n1SCEcha == 24) {
8474       ModifiedSCEcha = 19;
8475     }
8476     if (n1SCEcha == 25) {
8477       ModifiedSCEcha = 20;
8478     }
8479   }
8480 
8481   //..... (D4,S2), (D2,S8) SC_in_DS =  3, n1DeeSCEcna = 157 ->  29b for construction top/left
8482   //..... (D4,S2), (D2,S8) SC_in_DS = 25, n1DeeSCEcna = 193 ->  58b for construction top/left
8483   if ((SC_in_DS == 3 && n1DeeSCEcna == 157 && TypQuad == "TL") ||
8484       (SC_in_DS == 25 && n1DeeSCEcna == 193 && TypQuad == "TL")) {
8485     if (n1SCEcha == 16) {
8486       ModifiedSCEcha = 11;
8487     }
8488     if (n1SCEcha == 21) {
8489       ModifiedSCEcha = 12;
8490     }
8491     if (n1SCEcha == 17) {
8492       ModifiedSCEcha = 13;
8493     }
8494     if (n1SCEcha == 22) {
8495       ModifiedSCEcha = 14;
8496     }
8497     if (n1SCEcha == 18) {
8498       ModifiedSCEcha = 15;
8499     }
8500     if (n1SCEcha == 23) {
8501       ModifiedSCEcha = 16;
8502     }
8503     if (n1SCEcha == 19) {
8504       ModifiedSCEcha = 17;
8505     }
8506     if (n1SCEcha == 24) {
8507       ModifiedSCEcha = 18;
8508     }
8509     if (n1SCEcha == 20) {
8510       ModifiedSCEcha = 19;
8511     }
8512     if (n1SCEcha == 25) {
8513       ModifiedSCEcha = 20;
8514     }
8515   }
8516 
8517   //..... (D1,S2), (D3,S8) SC_in_DS = 32, n1DeeSCEcna =  51 -> 216  for construction top/right
8518   if (SC_in_DS == 32 && n1DeeSCEcna == 51 && TypQuad == "TR") {
8519     if (n1SCEcha >= 1 && n1SCEcha <= 4) {
8520       ModifiedSCEcha = n1SCEcha;
8521     }
8522     if (n1SCEcha >= 6 && n1SCEcha <= 9) {
8523       ModifiedSCEcha = n1SCEcha - 1;
8524     }
8525     if (n1SCEcha >= 11 && n1SCEcha <= 14) {
8526       ModifiedSCEcha = n1SCEcha - 2;
8527     }
8528     if (n1SCEcha >= 16 && n1SCEcha <= 19) {
8529       ModifiedSCEcha = n1SCEcha - 3;
8530     }
8531     if (n1SCEcha >= 21 && n1SCEcha <= 24) {
8532       ModifiedSCEcha = n1SCEcha - 4;
8533     }
8534   }
8535 
8536   //..... (D4,S2), (D2,S8) SC_in_DS = 32, n1DeeSCEcna =  51 ->  67  for construction top/left
8537   if (SC_in_DS == 32 && n1DeeSCEcna == 51 && TypQuad == "TL") {
8538     ModifiedSCEcha = n1SCEcha;
8539   }
8540 
8541   // **************************** Special case: TWO SC's IN THE SAME SC-Ecna place *************************
8542   //========================================================================================== D1,D3 ======
8543   //      (D1,S2), (D3,S8) SC_in_DS =  3, n1DeeSCEcna =  32 -> 178c for construction top/right
8544   //      (D1,S2), (D3,S8) SC_in_DS = 25, n1DeeSCEcna =  32 -> 207c for construction top/right
8545   //       For  n1DeeSCEcna =  32: ONLY "25" IN ARRAY fT2d_DSSC[][] (see TEcnaNumbering.cc)
8546   //       fT2d_DSSC[dee-1][32-1] =  25;  // also 3;  // ( (207c, 58c) also (178c, 29c) for construction)
8547   //       is recovered from number for construction
8548   //=======================================================================================================
8549   if (n1DeeSCEcna == 32 && TypQuad == "TR") {
8550     if (nSCCons == 207) {
8551       if (n1SCEcha == 1) {
8552         ModifiedSCEcha = 21;
8553       }
8554       if (n1SCEcha == 2) {
8555         ModifiedSCEcha = 22;
8556       }
8557       if (n1SCEcha == 3) {
8558         ModifiedSCEcha = 23;
8559       }
8560       if (n1SCEcha == 6) {
8561         ModifiedSCEcha = 24;
8562       }
8563       if (n1SCEcha == 7) {
8564         ModifiedSCEcha = 25;
8565       }
8566     }
8567     if (nSCCons == 178) {
8568       if (n1SCEcha == 11) {
8569         ModifiedSCEcha = 21;
8570       }
8571     }
8572   }
8573 
8574   //========================================================================================== D2,D4 ======
8575   //      (D4,S2), (D2,S8) SC_in_DS =  3, n1DeeSCEcna =  32 ->  29c for construction top/left
8576   //      (D4,S2), (D2,S8) SC_in_DS = 25, n1DeeSCEcna =  32 ->  58c for construction top/left
8577   //       For  n1DeeSCEcna =  32: ONLY "25" IN ARRAY fT2d_DSSC[][] (see TEcnaNumbering.cc)
8578   //       fT2d_DSSC[dee-1][32-1] =  25;  // also 3;  // ( (207c, 58c) also (178c, 29c) for construction)
8579   //       is recovered from number for construction
8580   //=======================================================================================================
8581   if (n1DeeSCEcna == 32 && TypQuad == "TL") {
8582     if (nSCCons == 58) {
8583       if (n1SCEcha == 1) {
8584         ModifiedSCEcha = 21;
8585       }
8586       if (n1SCEcha == 2) {
8587         ModifiedSCEcha = 22;
8588       }
8589       if (n1SCEcha == 3) {
8590         ModifiedSCEcha = 23;
8591       }
8592       if (n1SCEcha == 6) {
8593         ModifiedSCEcha = 24;
8594       }
8595       if (n1SCEcha == 7) {
8596         ModifiedSCEcha = 25;
8597       }
8598     }
8599     if (nSCCons == 29) {
8600       if (n1SCEcha == 11) {
8601         ModifiedSCEcha = 21;
8602       }
8603     }
8604   }
8605   //****************************************************************************************************
8606 
8607   //------------------------------------------------------------------------------------------- bottom
8608 
8609   // **************************** Special case: TWO SC's IN THE SAME SC-Ecna place *************************
8610   //========================================================================================== D1,D3 ======
8611   //      (D1,S4), (D3,S6) SC_in_DS = 14, n1DeeSCEcna =  29 -> 261a for construction bottom/right
8612   //      (D1,S4), (D3,S6) SC_in_DS = 21, n1DeeSCEcna =  29 -> 268a for construction bottom/right
8613   //       For  n1DeeSCEcna =  29: ONLY "14" IN ARRAY fT2d_DSSC[][] (see TEcnaNumbering.cc)
8614   //       fT2d_DSSC[dee-1][29-1] = 14; // also 21;  //  ( (261a, 112a) also (268a, 119a) for construction)
8615   //       is recovered from number for construction
8616   //=======================================================================================================
8617   if (n1DeeSCEcna == 29 && TypQuad == "BR") {
8618     if (nSCCons == 261) {
8619       if (n1SCEcha == 1) {
8620         ModifiedSCEcha = 21;
8621       }
8622       if (n1SCEcha == 2) {
8623         ModifiedSCEcha = 22;
8624       }
8625       if (n1SCEcha == 3) {
8626         ModifiedSCEcha = 23;
8627       }
8628       if (n1SCEcha == 6) {
8629         ModifiedSCEcha = 24;
8630       }
8631       if (n1SCEcha == 7) {
8632         ModifiedSCEcha = 25;
8633       }
8634     }
8635     if (nSCCons == 268) {
8636       if (n1SCEcha == 11) {
8637         ModifiedSCEcha = 21;
8638       }
8639     }
8640   }
8641 
8642   //========================================================================================== D2,D4 ======
8643   //      (D4,S4), (D2,S6) SC_in_DS = 14, n1DeeSCEcna =  29 -> 112a for construction bottom/left
8644   //      (D4,S4), (D2,S6) SC_in_DS = 21, n1DeeSCEcna =  29 -> 119a for construction bottom/left
8645   //       For  n1DeeSCEcna =  29: ONLY "14" IN ARRAY fT2d_DSSC[][] (see TEcnaNumbering.cc)
8646   //       fT2d_DSSC[dee-1][29-1] = 14; // also 21;  //  ( (261a, 112a) also (268a, 119a) for construction)
8647   //       is recovered from number for construction
8648   //=======================================================================================================
8649   if (n1DeeSCEcna == 29 && TypQuad == "BL") {
8650     if (nSCCons == 119) {
8651       if (n1SCEcha == 11) {
8652         ModifiedSCEcha = 21;
8653       }
8654     }
8655     if (nSCCons == 112) {
8656       if (n1SCEcha == 1) {
8657         ModifiedSCEcha = 21;
8658       }
8659       if (n1SCEcha == 2) {
8660         ModifiedSCEcha = 22;
8661       }
8662       if (n1SCEcha == 3) {
8663         ModifiedSCEcha = 23;
8664       }
8665       if (n1SCEcha == 6) {
8666         ModifiedSCEcha = 24;
8667       }
8668       if (n1SCEcha == 7) {
8669         ModifiedSCEcha = 25;
8670       }
8671     }
8672   }
8673 
8674   // ****************************************************************************************************
8675 
8676   //..... (D1,S3), (D3,S7) SC_in_DS = 34, n1DeeSCEcna = 188 -> 298a for construction bottom/right
8677   //..... (D1,S4), (D3,S6) SC_in_DS = 14, n1DeeSCEcna = 165 -> 261b for construction bottom/right
8678   if ((SC_in_DS == 34 && n1DeeSCEcna == 188 && TypQuad == "BR") ||
8679       (SC_in_DS == 14 && n1DeeSCEcna == 165 && TypQuad == "BR")) {
8680     if (n1SCEcha > 15) {
8681       ModifiedSCEcha = n1SCEcha - 15;
8682     }
8683   }
8684 
8685   //..... (D4,S3), (D2,S7) SC_in_DS = 34, n1DeeSCEcna = 188 -> 149a for construction bottom/left
8686   //..... (D4,S4), (D2,S6) SC_in_DS = 14, n1DeeSCEcna = 165 -> 112b for construction bottom/left
8687   if ((SC_in_DS == 34 && n1DeeSCEcna == 188 && TypQuad == "BL") ||
8688       (SC_in_DS == 14 && n1DeeSCEcna == 165 && TypQuad == "BL")) {
8689     if (n1SCEcha == 4) {
8690       ModifiedSCEcha = 1;
8691     }
8692     if (n1SCEcha == 5) {
8693       ModifiedSCEcha = 2;
8694     }
8695     if (n1SCEcha == 9) {
8696       ModifiedSCEcha = 3;
8697     }
8698     if (n1SCEcha == 10) {
8699       ModifiedSCEcha = 4;
8700     }
8701     if (n1SCEcha == 14) {
8702       ModifiedSCEcha = 5;
8703     }
8704     if (n1SCEcha == 15) {
8705       ModifiedSCEcha = 6;
8706     }
8707     if (n1SCEcha == 19) {
8708       ModifiedSCEcha = 7;
8709     }
8710     if (n1SCEcha == 20) {
8711       ModifiedSCEcha = 8;
8712     }
8713     if (n1SCEcha == 24) {
8714       ModifiedSCEcha = 9;
8715     }
8716     if (n1SCEcha == 25) {
8717       ModifiedSCEcha = 10;
8718     }
8719   }
8720 
8721   //..... (D1,S3), (D3,S7) SC_in_DS = 10, n1DeeSCEcna =  50 -> 224  for construction bottom/right
8722   if (SC_in_DS == 10 && n1DeeSCEcna == 50 && TypQuad == "BR") {
8723     ModifiedSCEcha = n1SCEcha;
8724   }
8725 
8726   //..... (D4,S3), (D2,S7) SC_in_DS = 10, n1DeeSCEcna =  50 ->  75  for construction bottom/left
8727   if (SC_in_DS == 10 && n1DeeSCEcna == 50 && TypQuad == "BL") {
8728     if (n1SCEcha >= 1 && n1SCEcha <= 4) {
8729       ModifiedSCEcha = n1SCEcha;
8730     }
8731     if (n1SCEcha >= 6 && n1SCEcha <= 9) {
8732       ModifiedSCEcha = n1SCEcha - 1;
8733     }
8734     if (n1SCEcha >= 11 && n1SCEcha <= 14) {
8735       ModifiedSCEcha = n1SCEcha - 2;
8736     }
8737     if (n1SCEcha >= 16 && n1SCEcha <= 19) {
8738       ModifiedSCEcha = n1SCEcha - 3;
8739     }
8740     if (n1SCEcha >= 21 && n1SCEcha <= 24) {
8741       ModifiedSCEcha = n1SCEcha - 4;
8742     }
8743   }
8744 
8745   //..... (D1,S4), (D3,S6) SC_in_DS = 14, n1DeeSCEcna = 144 -> 261c for construction bottom/right
8746   if (SC_in_DS == 14 && n1DeeSCEcna == 144 && TypQuad == "BR") {
8747     if (n1SCEcha > 5) {
8748       ModifiedSCEcha = n1SCEcha - 5;
8749     }
8750   }
8751 
8752   //..... (D4,S4), (D2,S6) SC_in_DS = 14, n1DeeSCEcna = 144 -> 112c for construction bottom/left
8753   if (SC_in_DS == 14 && n1DeeSCEcna == 144 && TypQuad == "BL") {
8754     if (n1SCEcha == 4) {
8755       ModifiedSCEcha = 11;
8756     }
8757     if (n1SCEcha == 5) {
8758       ModifiedSCEcha = 12;
8759     }
8760     if (n1SCEcha == 9) {
8761       ModifiedSCEcha = 13;
8762     }
8763     if (n1SCEcha == 10) {
8764       ModifiedSCEcha = 14;
8765     }
8766     if (n1SCEcha == 14) {
8767       ModifiedSCEcha = 15;
8768     }
8769     if (n1SCEcha == 15) {
8770       ModifiedSCEcha = 16;
8771     }
8772     if (n1SCEcha == 19) {
8773       ModifiedSCEcha = 17;
8774     }
8775     if (n1SCEcha == 20) {
8776       ModifiedSCEcha = 18;
8777     }
8778     if (n1SCEcha == 24) {
8779       ModifiedSCEcha = 19;
8780     }
8781     if (n1SCEcha == 25) {
8782       ModifiedSCEcha = 20;
8783     }
8784   }
8785 
8786   //..... (D1,S4), (D3,S6) SC_in_DS = 21, n1DeeSCEcna = 123 -> 268b for construction bottom/right
8787   //..... (D1,S5), (D3,S5) SC_in_DS = 20, n1DeeSCEcna =  21 -> 281a for construction bottom/right
8788   if ((SC_in_DS == 21 && n1DeeSCEcna == 123 && TypQuad == "BR") ||
8789       (SC_in_DS == 20 && n1DeeSCEcna == 41 && TypQuad == "BR")) {
8790     if (n1SCEcha == 4) {
8791       ModifiedSCEcha = 1;
8792     }
8793     if (n1SCEcha == 5) {
8794       ModifiedSCEcha = 2;
8795     }
8796     if (n1SCEcha == 9) {
8797       ModifiedSCEcha = 3;
8798     }
8799     if (n1SCEcha == 10) {
8800       ModifiedSCEcha = 4;
8801     }
8802     if (n1SCEcha == 14) {
8803       ModifiedSCEcha = 5;
8804     }
8805     if (n1SCEcha == 15) {
8806       ModifiedSCEcha = 6;
8807     }
8808     if (n1SCEcha == 19) {
8809       ModifiedSCEcha = 7;
8810     }
8811     if (n1SCEcha == 20) {
8812       ModifiedSCEcha = 8;
8813     }
8814     if (n1SCEcha == 24) {
8815       ModifiedSCEcha = 9;
8816     }
8817     if (n1SCEcha == 25) {
8818       ModifiedSCEcha = 10;
8819     }
8820   }
8821 
8822   //..... (D4,S4), (D2,S6) SC_in_DS = 21, n1DeeSCEcna = 123 -> 119b for construction bottom/left
8823   //..... (D4,S5), (D2,S5) SC_in_DS =  3, n1DeeSCEcna =  41 -> 132a for construction bottom/left
8824   if ((SC_in_DS == 21 && n1DeeSCEcna == 123 && TypQuad == "BL") ||
8825       (SC_in_DS == 3 && n1DeeSCEcna == 41 && TypQuad == "BL")) {
8826     if (n1SCEcha > 15) {
8827       ModifiedSCEcha = n1SCEcha - 15;
8828     }
8829   }
8830 
8831   //..... (D1,S4), (D3,S6) SC_in_DS = 21, n1DeeSCEcna = 102 -> 268c for construction bottom/right
8832   if (SC_in_DS == 21 && n1DeeSCEcna == 102 && TypQuad == "BR") {
8833     if (n1SCEcha == 4) {
8834       ModifiedSCEcha = 11;
8835     }
8836     if (n1SCEcha == 5) {
8837       ModifiedSCEcha = 12;
8838     }
8839     if (n1SCEcha == 9) {
8840       ModifiedSCEcha = 13;
8841     }
8842     if (n1SCEcha == 10) {
8843       ModifiedSCEcha = 14;
8844     }
8845     if (n1SCEcha == 14) {
8846       ModifiedSCEcha = 15;
8847     }
8848     if (n1SCEcha == 15) {
8849       ModifiedSCEcha = 16;
8850     }
8851     if (n1SCEcha == 19) {
8852       ModifiedSCEcha = 17;
8853     }
8854     if (n1SCEcha == 20) {
8855       ModifiedSCEcha = 18;
8856     }
8857     if (n1SCEcha == 24) {
8858       ModifiedSCEcha = 19;
8859     }
8860     if (n1SCEcha == 25) {
8861       ModifiedSCEcha = 20;
8862     }
8863   }
8864 
8865   //..... (D4,S4), (D2,S6) SC_in_DS = 21, n1DeeSCEcna = 102 -> 119c for construction bottom/left
8866   if (SC_in_DS == 21 && n1DeeSCEcna == 102 && TypQuad == "BL") {
8867     if (n1SCEcha == 16) {
8868       ModifiedSCEcha = 11;
8869     }
8870     if (n1SCEcha == 21) {
8871       ModifiedSCEcha = 12;
8872     }
8873     if (n1SCEcha == 17) {
8874       ModifiedSCEcha = 13;
8875     }
8876     if (n1SCEcha == 22) {
8877       ModifiedSCEcha = 14;
8878     }
8879     if (n1SCEcha == 18) {
8880       ModifiedSCEcha = 15;
8881     }
8882     if (n1SCEcha == 23) {
8883       ModifiedSCEcha = 16;
8884     }
8885     if (n1SCEcha == 19) {
8886       ModifiedSCEcha = 17;
8887     }
8888     if (n1SCEcha == 24) {
8889       ModifiedSCEcha = 18;
8890     }
8891     if (n1SCEcha == 20) {
8892       ModifiedSCEcha = 19;
8893     }
8894     if (n1SCEcha == 25) {
8895       ModifiedSCEcha = 20;
8896     }
8897   }
8898 
8899   //..... (D1,S5), (D3,S5) SC_in_DS = 23, n1DeeSCEcna =   8 -> 286 for construction bottom/right
8900   if (SC_in_DS == 23 && n1DeeSCEcna == 8 && TypQuad == "BR") {
8901     if (n1SCEcha >= 1 && n1SCEcha <= 4) {
8902       ModifiedSCEcha = n1SCEcha;
8903     }
8904     if (n1SCEcha >= 6 && n1SCEcha <= 9) {
8905       ModifiedSCEcha = n1SCEcha - 1;
8906     }
8907     if (n1SCEcha >= 11 && n1SCEcha <= 14) {
8908       ModifiedSCEcha = n1SCEcha - 2;
8909     }
8910     if (n1SCEcha >= 16 && n1SCEcha <= 19) {
8911       ModifiedSCEcha = n1SCEcha - 3;
8912     }
8913     if (n1SCEcha >= 21 && n1SCEcha <= 24) {
8914       ModifiedSCEcha = n1SCEcha - 4;
8915     }
8916   }
8917 
8918   //..... (D4,S5), (D2,S5) SC_in_DS =  6, n1DeeSCEcna =   8 -> 137 for construction bottom/left
8919   if (SC_in_DS == 6 && n1DeeSCEcna == 8 && TypQuad == "BL") {
8920     ModifiedSCEcha = n1SCEcha;
8921   }
8922 
8923   //======================= ERROR message if ModifiedSCEcha is not correct
8924   if (ModifiedSCEcha < 1 || ModifiedSCEcha > fEcal->MaxCrysInSC()) {
8925     std::cout << "! *** ERROR *** > ModifiedSCEcha = " << ModifiedSCEcha << ", SC_in_DS = " << SC_in_DS
8926               << ", nSCCons = " << nSCCons << ", n1DeeSCEcna = " << n1DeeSCEcna << ", n1SCEcha = " << n1SCEcha
8927               << ", ModifiedSCEcha = " << ModifiedSCEcha << ", TypQuad = " << TypQuad << fTTBELL << std::endl;
8928   }
8929 
8930   return ModifiedSCEcha;
8931 }
8932 // end of ModifiedSCEchaForNotConnectedSCs(...)
8933 
8934 //======================================================================================
8935 //
8936 //                          ViewHistime: evolution in time
8937 //
8938 //======================================================================================
8939 
8940 //======================================================================================
8941 //
8942 //                          ViewHistime: time evolution
8943 //
8944 //======================================================================================
8945 void TEcnaHistos::ViewHistime(const TString& list_of_run_file_name,
8946                               const Int_t& StexStin_A,
8947                               const Int_t& i0StinEcha,
8948                               const TString& HistoCode,
8949                               const TString& opt_plot_arg) {
8950   //Histogram of the quantities as a function of time (several runs)
8951 
8952   TString opt_plot = opt_plot_arg;
8953   TString HistoType = fCnaParHistos->GetHistoType(HistoCode);
8954 
8955   if (opt_plot_arg == "ONLYONE") {
8956     opt_plot = fOnlyOnePlot;
8957   }
8958   if (opt_plot_arg == "SEVERAL") {
8959     opt_plot = fSeveralPlot;
8960   }
8961   if (opt_plot_arg == "SAMEONE") {
8962     opt_plot = fSameOnePlot;
8963   }
8964 
8965   Int_t OKHisto = 0;
8966 
8967   //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Canvas already closed in option SAME %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8968   Int_t xCanvasExists = 1;  // a priori ==> SAME plot                                  //   (ViewHistime)
8969   if (opt_plot != fOnlyOnePlot && GetMemoFlag(HistoCode, opt_plot) == "Busy") {
8970     TVirtualPad* main_subpad = nullptr;
8971     //---------------- Call to ActivePad
8972     main_subpad = ActivePad(HistoCode.Data(), opt_plot.Data());  // => return 0 if canvas has been closed
8973     if (main_subpad == nullptr) {
8974       std::cout << "*TEcnaHistos::ViewHistime(...)> WARNING ===> Canvas has been closed in option SAME or SAME n."
8975                 << std::endl
8976                 << "                               Please, restart with a new canvas." << fTTBELL << std::endl;
8977 
8978       ReInitCanvas(HistoCode, opt_plot);
8979       xCanvasExists = 0;
8980     }
8981   }
8982   //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8983 
8984   //%%%%%%%%%%%%%%%%%%%%% Change of X variable in option SAME n with no proj %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8985   Int_t SameXVarMemo = 1;  //  a priori ==> SAME n option: X variable OK                     (ViewHistime)
8986   if (!(HistoType == "Proj" || HistoType == "SampProj" || HistoType == "H1BasicProj" || HistoType == "EvolProj")) {
8987     TString XVarHisto = fCnaParHistos->GetXVarHisto(HistoCode.Data(), fFlagSubDet.Data(), fFapStexNumber);
8988     TString YVarHisto = fCnaParHistos->GetYVarHisto(HistoCode.Data(), fFlagSubDet.Data(), fFapStexNumber);
8989 
8990     if ((opt_plot == fSameOnePlot) && GetMemoFlag(HistoCode, opt_plot) == "Free") {
8991       SetXVarMemo(HistoCode, opt_plot, XVarHisto);
8992       SetYVarMemo(HistoCode, opt_plot, YVarHisto);
8993       SameXVarMemo = 1;
8994     }
8995     if ((opt_plot == fSameOnePlot) && GetMemoFlag(HistoCode, opt_plot) == "Busy") {
8996       TString XVariableMemo = GetXVarFromMemo(HistoCode, opt_plot);
8997       TString YVariableMemo = GetYVarFromMemo(HistoCode, opt_plot);
8998 
8999       if (XVarHisto != XVariableMemo) {
9000         std::cout << "!TEcnaHistos::ViewHistime(...)> *** ERROR *** ===> X coordinate changed in option SAME n."
9001                   << std::endl
9002                   << "                               Present  X = " << XVarHisto << std::endl
9003                   << "                               Present  Y = " << YVarHisto << std::endl
9004                   << "                               Previous X = " << XVariableMemo << std::endl
9005                   << "                               Previous Y = " << YVariableMemo << fTTBELL << std::endl;
9006         SameXVarMemo = 0;
9007       } else {
9008         SetYVarMemo(HistoCode, opt_plot, YVarHisto);
9009       }
9010     }
9011   }
9012   //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9013 
9014   //%%%%%%%%%%%%%%%%%%%%%%% Change of Y variable in option SAME n with proj %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9015   Int_t SameYVarMemo = 1;  //  a priori ==> SAME n option: Y variable OK                     (ViewHistime)
9016   if (HistoType == "Proj" || HistoType == "SampProj" || HistoType == "H1BasicProj" || HistoType == "EvolProj") {
9017     TString XVarHisto = fCnaParHistos->GetXVarHisto(HistoCode.Data(), fFlagSubDet.Data(), fFapStexNumber);
9018     TString YVarHisto = fCnaParHistos->GetYVarHisto(HistoCode.Data(), fFlagSubDet.Data(), fFapStexNumber);
9019 
9020     if ((opt_plot == fSameOnePlot) && GetMemoFlag(HistoCode, opt_plot) == "Free") {
9021       SetYVarMemo(HistoCode, opt_plot, YVarHisto);
9022       SetYVarMemo(HistoCode, opt_plot, YVarHisto);
9023       SameYVarMemo = 1;
9024     }
9025     if ((opt_plot == fSameOnePlot) && GetMemoFlag(HistoCode, opt_plot) == "Busy") {
9026       TString XVariableMemo = GetXVarFromMemo(HistoCode, opt_plot);
9027       TString YVariableMemo = GetYVarFromMemo(HistoCode, opt_plot);
9028 
9029       if (YVarHisto != YVariableMemo) {
9030         std::cout << "!TEcnaHistos::ViewHistime(...)> *** ERROR *** ===> Y coordinate changed in option SAME n."
9031                   << std::endl
9032                   << "                               Present  X = " << XVarHisto << std::endl
9033                   << "                               Present  Y = " << YVarHisto << std::endl
9034                   << "                               Previous X = " << XVariableMemo << std::endl
9035                   << "                               Previous Y = " << YVariableMemo << fTTBELL << std::endl;
9036         SameYVarMemo = 0;
9037       } else {
9038         SetYVarMemo(HistoCode, opt_plot, YVarHisto);
9039       }
9040     }
9041   }
9042   //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9043   if (xCanvasExists == 1 && SameXVarMemo == 1 && SameYVarMemo == 1) {
9044     OKHisto = 1;
9045   }
9046 
9047   //======================== Histime accepted
9048   if (OKHisto == 1) {
9049     // fMyRootFile->PrintNoComment();
9050 
9051     fCnaParHistos->SetColorPalette(fFlagColPal);
9052 
9053     //................................. Init YMin and YMax of histo         //   (ViewHistime)
9054     if ((opt_plot == fOnlyOnePlot) || (opt_plot == fSeveralPlot && GetMemoFlag(HistoCode, opt_plot) == "Free") ||
9055         (opt_plot == fSameOnePlot && GetMemoFlag(HistoCode, opt_plot) == "Free")) {
9056       SetYminMemoFromPreviousMemo(HistoCode);
9057       SetYmaxMemoFromPreviousMemo(HistoCode);
9058     }
9059 
9060     //........ GetHistoryRunListParameters(...) : performs the allocation of the array fT1DRunNumber[]
9061     //         at first call of the present method ViewHistime
9062     //         increments the number of read file (fNbOfListFileEvolXXX) for option SAME
9063     //         and read the values fT1DRunNumber[0 to max] from the file list_of_run_file_name
9064     //         return the number of runs in the list of the file
9065     //............... Get the run parameters
9066 
9067     Int_t nb_of_runs_in_list = GetHistoryRunListParameters(list_of_run_file_name.Data(), HistoCode);
9068 
9069     if (nb_of_runs_in_list > 0) {
9070       //..............................  prepa x axis: time in hours
9071       //Double_t sec_in_day   = (Double_t)86400.;          //===> (number of seconds in a day)
9072       Double_t margin_frame_xaxis = (Double_t)25.;  //===> margin in x coordinates
9073 
9074       Double_t thstart_evol = (Double_t)0.;
9075       Double_t thstop_evol = (Double_t)0.;
9076 
9077       Int_t* exist_indic = new Int_t[nb_of_runs_in_list];
9078       fCnew++;
9079 
9080       //===================================== FIRST LOOP BEGINNING ===================================
9081       //-------------------------------------------------------------------------------- (ViewHistime)
9082       //
9083       //     FIRST LOOP: read the "HistoryRunList" file. Check the existence of the runs
9084       //                 and determine the number of existing runs.
9085       //
9086       //--------------------------------------------------------------------------------
9087 
9088       fNbOfExistingRuns = (Int_t)0;
9089 
9090       if (fFapStexNumber > 0) {
9091         for (Int_t i_run = 0; i_run < nb_of_runs_in_list; i_run++) {
9092           exist_indic[i_run] = 0;
9093           // ==> set the attribute value relative to the run (fFapRunNumber)
9094           SetRunNumberFromList(i_run, nb_of_runs_in_list);
9095 
9096           fMyRootFile->PrintNoComment();
9097           fMyRootFile->FileParameters(fFapAnaType.Data(),
9098                                       fFapNbOfSamples,
9099                                       fT1DRunNumber[i_run],
9100                                       fFapFirstReqEvtNumber,
9101                                       fFapLastReqEvtNumber,
9102                                       fFapReqNbOfEvts,
9103                                       fFapStexNumber,
9104                                       fCfgResultsRootFilePath.Data());
9105 
9106           if (fMyRootFile->LookAtRootFile() == kTRUE)  //   (ViewHistime, 1rst loop)
9107           {
9108             fStatusFileFound = kTRUE;
9109 
9110             //------ At first HistoryRunList file: set fStartEvol... and fStopEvol... quantities
9111             if (GetListFileNumber(HistoCode) == 1) {
9112               if (fNbOfExistingRuns == 0) {
9113                 // start time of the first existing run of the list
9114                 fStartEvolTime = fMyRootFile->GetStartTime();
9115                 fStartEvolDate = fMyRootFile->GetStartDate();
9116                 fStartEvolRun = fT1DRunNumber[i_run];
9117                 // start time of the last existing run of the list
9118                 // (in case of only one existing run in the list)
9119                 fStopEvolTime = fMyRootFile->GetStartTime();
9120                 fStopEvolDate = fMyRootFile->GetStartDate();
9121                 fStopEvolRun = fT1DRunNumber[i_run];
9122               } else {
9123                 // start time of the last existing run of the list
9124                 fStopEvolTime = fMyRootFile->GetStartTime();
9125                 fStopEvolDate = fMyRootFile->GetStartDate();
9126                 fStopEvolRun = fT1DRunNumber[i_run];
9127               }
9128             }
9129             //---- set flag of run existence and increase number of existing runs
9130             //     (for the first HistoryRunList file)
9131             exist_indic[i_run] = 1;
9132             fNbOfExistingRuns++;
9133           }  // end of if ( fMyRootFile->LookAtRootFile() == kTRUE )
9134           else {
9135             fStatusFileFound = kFALSE;
9136 
9137             std::cout << "!TEcnaHistos::ViewHistime(...)> *ERROR* =====> "
9138                       << " ROOT file not found for run " << fT1DRunNumber[i_run] << fTTBELL << std::endl
9139                       << std::endl;
9140           }
9141         }  // end of for(Int_t i_run = 0; i_run < nb_of_runs_in_list; i_run++)
9142 
9143         //===================================== FIRST LOOP END ===========================     (ViewHistime)
9144         if (fNbOfExistingRuns > 0) {
9145           //-------------------- recover the array after removing non existing ROOT files
9146           Int_t i_existing_run = (Int_t)0;
9147 
9148           for (Int_t i_run = 0; i_run < nb_of_runs_in_list; i_run++) {
9149             if (exist_indic[i_run] == 1) {
9150               fT1DRunNumber[i_existing_run] = fT1DRunNumber[i_run];
9151               i_existing_run++;
9152             }
9153           }
9154 
9155           //---------------------- Get start and stop time values to set the axis limits        (ViewHistime)
9156 
9157           thstart_evol = (Double_t)fStartEvolTime;
9158           thstop_evol = (Double_t)fStopEvolTime;
9159 
9160           Double_t xinf_lim = thstart_evol - (thstop_evol - thstart_evol) / margin_frame_xaxis;
9161           Double_t xsup_lim = thstop_evol + (thstop_evol - thstart_evol) / margin_frame_xaxis;
9162 
9163           Axis_t xinf_his = (Axis_t)(xinf_lim);
9164           Axis_t xsup_his = (Axis_t)(xsup_lim);
9165 
9166           //............................. i0StexEcha, i0Sample
9167           Int_t i0StexEcha = fEcalNumbering->Get0StexEchaFrom1StexStinAnd0StinEcha(StexStin_A, i0StinEcha);
9168           Int_t i0Sample = 0;
9169 
9170           Double_t* time_coordx = new Double_t[fNbOfExistingRuns];
9171           fCnew++;
9172           Double_t* hval_coordy = new Double_t[fNbOfExistingRuns];
9173           fCnew++;
9174 
9175           //........... Set values to -1
9176 
9177           for (Int_t i_run = 0; i_run < fNbOfExistingRuns; i_run++) {
9178             time_coordx[i_run] = (Double_t)(-1);
9179             hval_coordy[i_run] = (Double_t)(-1);
9180           }
9181 
9182           //========================== SECOND LOOP BEGINNING =====================================
9183           //----------------------------------------------------------------------- (ViewHistime)
9184           //
9185           //      SECOND LOOP OVER THE EXISTING RUNS : FILL THE GRAPH COORDINATES
9186           //
9187           //-----------------------------------------------------------------------
9188           for (Int_t i_run = 0; i_run < fNbOfExistingRuns; i_run++) {
9189             // => set the attribute value relative to the run (fFapRunNumber)
9190             SetRunNumberFromList(i_run, fNbOfExistingRuns);
9191 
9192             fMyRootFile->PrintNoComment();
9193             fMyRootFile->FileParameters(fFapAnaType.Data(),
9194                                         fFapNbOfSamples,
9195                                         fT1DRunNumber[i_run],
9196                                         fFapFirstReqEvtNumber,
9197                                         fFapLastReqEvtNumber,
9198                                         fFapReqNbOfEvts,
9199                                         fFapStexNumber,
9200                                         fCfgResultsRootFilePath.Data());
9201 
9202             if (fMyRootFile->LookAtRootFile() == kTRUE)  //  (ViewHistime, 2nd loop)
9203             {
9204               fStatusFileFound = kTRUE;
9205 
9206               Bool_t ok_view_histo = GetOkViewHisto(fMyRootFile, StexStin_A, i0StinEcha, i0Sample, HistoCode);
9207 
9208               //............... F I L L   G R A P H   C O O R D I N A T E S   (ViewHistime)
9209               if (ok_view_histo == kTRUE) {
9210                 //................................................. x coordinate
9211                 time_t xStartTime = fMyRootFile->GetStartTime();
9212                 Double_t thstart = (Double_t)xStartTime;
9213                 time_coordx[i_run] = (Double_t)(thstart - xinf_lim);
9214                 //................................................. y coordinate
9215                 TVectorD read_histo(fEcal->MaxCrysEcnaInStex());
9216                 for (Int_t i = 0; i < fEcal->MaxCrysEcnaInStex(); i++) {
9217                   read_histo(i) = (Double_t)0.;
9218                 }
9219 
9220                 if (HistoCode == "H_Ped_Date" || HistoCode == "H_Ped_RuDs") {
9221                   read_histo = fMyRootFile->ReadPedestals(fEcal->MaxCrysEcnaInStex());
9222                 }
9223                 if (HistoCode == "H_TNo_Date" || HistoCode == "H_TNo_RuDs") {
9224                   read_histo = fMyRootFile->ReadTotalNoise(fEcal->MaxCrysEcnaInStex());
9225                 }
9226                 if (HistoCode == "H_MCs_Date" || HistoCode == "H_MCs_RuDs") {
9227                   read_histo = fMyRootFile->ReadMeanCorrelationsBetweenSamples(fEcal->MaxCrysEcnaInStex());
9228                 }
9229 
9230                 if (HistoCode == "H_LFN_Date" || HistoCode == "H_LFN_RuDs") {
9231                   read_histo = fMyRootFile->ReadLowFrequencyNoise(fEcal->MaxCrysEcnaInStex());
9232                 }
9233                 if (HistoCode == "H_HFN_Date" || HistoCode == "H_HFN_RuDs") {
9234                   read_histo = fMyRootFile->ReadHighFrequencyNoise(fEcal->MaxCrysEcnaInStex());
9235                 }
9236                 if (HistoCode == "H_SCs_Date" || HistoCode == "H_SCs_RuDs") {
9237                   read_histo = fMyRootFile->ReadSigmaOfCorrelationsBetweenSamples(fEcal->MaxCrysEcnaInStex());
9238                 }
9239                 hval_coordy[i_run] = (Double_t)read_histo(i0StexEcha);
9240               } else {
9241                 std::cout << "!TEcnaHistos::ViewHistime(...)> Histo not available. " << fTTBELL << std::endl;
9242               }
9243             }  // end of if ( fMyRootFile->LookAtRootFile() == kTRUE )
9244             else {
9245               fStatusFileFound = kFALSE;
9246             }
9247           }
9248           //========================== END OF SECOND LOOP ===========================================
9249 
9250           //.................................................................... SCALE x and y
9251           Int_t opt_scale_x = fOptScaleLinx;
9252           if (fFlagScaleX == "LIN") {
9253             opt_scale_x = fOptScaleLinx;
9254           }
9255           if (fFlagScaleX == "LOG") {
9256             opt_scale_x = fOptScaleLogx;
9257           }
9258 
9259           Int_t opt_scale_y = fOptScaleLiny;
9260           if (fFlagScaleY == "LIN") {
9261             opt_scale_y = fOptScaleLiny;
9262           }
9263           if (fFlagScaleY == "LOG") {
9264             opt_scale_y = fOptScaleLogy;
9265           }
9266 
9267           //------------------------------------------------- G R A P H    (ViewHistime)
9268           TGraph* g_graph0 = new TGraph(fNbOfExistingRuns, time_coordx, hval_coordy);
9269           fCnewRoot++;
9270           if (opt_plot == fOnlyOnePlot || opt_plot == fSeveralPlot) {
9271             g_graph0->SetTitle(fCnaParHistos->GetQuantityName(HistoCode));
9272           }
9273           if (opt_plot == fSameOnePlot) {
9274             g_graph0->SetTitle(";");
9275           }
9276 
9277           //... Ymin and ymax default values will be taken if fFlagUserHistoMin/Max = "OFF"
9278           //    (and if "Free" for "SAME" and "SAME n" options)
9279           if ((opt_plot == fOnlyOnePlot) || (opt_plot == fSeveralPlot && GetMemoFlag(HistoCode, opt_plot) == "Free") ||
9280               (opt_plot == fSameOnePlot && GetMemoFlag(HistoCode, opt_plot) == "Free")) {
9281             SetYminMemoFromValue(HistoCode.Data(), fCnaParHistos->GetYminDefaultValue(HistoCode.Data()));
9282             SetYmaxMemoFromValue(HistoCode.Data(), fCnaParHistos->GetYmaxDefaultValue(HistoCode.Data()));
9283           }
9284 
9285           //................................ Put min max values       (ViewHistime)
9286           //.......... default if flag not set to "ON"
9287           //SetYminMemoFromValue(HistoCode.Data(), fCnaParHistos->GetYminDefaultValue(HistoCode.Data()));
9288           //SetYmaxMemoFromValue(HistoCode.Data(), fCnaParHistos->GetYmaxDefaultValue(HistoCode.Data()));
9289 
9290           g_graph0->Set(fNbOfExistingRuns);
9291           Double_t graph_ymin = GetYminFromGraphFrameAndMarginValue(g_graph0, fCnaParHistos->GetMarginAutoMinMax());
9292           Double_t graph_ymax = GetYmaxFromGraphFrameAndMarginValue(g_graph0, fCnaParHistos->GetMarginAutoMinMax());
9293 
9294           //---------------------------------- G R A P H   P L O T  ---------------------------- (ViewHistime)
9295           if (HistoType == "Evol") {
9296             //----------------- G R A P H  Y M I N / Y M A X    M A N A G E M E N T
9297             if ((opt_plot == fOnlyOnePlot) ||
9298                 (opt_plot == fSeveralPlot && GetMemoFlag(HistoCode, opt_plot) == "Free") ||
9299                 (opt_plot == fSameOnePlot && GetMemoFlag(HistoCode, opt_plot) == "Free")) {
9300               if (opt_plot == fSameOnePlot) {
9301                 fHistoCodeFirst = HistoCode;
9302               }  // registration of first HistoCode
9303 
9304               if (fUserHistoMin >= fUserHistoMax) {
9305                 fFlagUserHistoMin = "AUTO";
9306                 fFlagUserHistoMax = "AUTO";
9307               }
9308               //.......... user's value if flag set to "ON"
9309               if (fFlagUserHistoMin == "ON") {
9310                 SetYminMemoFromValue(HistoCode.Data(), fUserHistoMin);
9311                 fFlagUserHistoMin = "OFF";
9312               }
9313               if (fFlagUserHistoMax == "ON") {
9314                 SetYmaxMemoFromValue(HistoCode.Data(), fUserHistoMax);
9315                 fFlagUserHistoMax = "OFF";
9316               }
9317               //................................. automatic min and/or max
9318               if (fFlagUserHistoMin == "AUTO") {
9319                 SetYminMemoFromValue(HistoCode.Data(), graph_ymin);
9320                 fFlagUserHistoMin = "OFF";
9321               }
9322               if (fFlagUserHistoMax == "AUTO") {
9323                 SetYmaxMemoFromValue(HistoCode.Data(), graph_ymax);
9324                 fFlagUserHistoMax = "OFF";
9325               }
9326 
9327               //................................. Init Ymin and Ymax for graph
9328               SetYminMemoFromPreviousMemo(HistoCode);
9329               SetYmaxMemoFromPreviousMemo(HistoCode);
9330             }
9331             //--- Set ymin and ymax to the first HistoCode values for option SAME n
9332             if (opt_plot == fSameOnePlot && GetMemoFlag(HistoCode, opt_plot) == "Busy") {
9333               Double_t ymin = GetYminValueFromMemo(fHistoCodeFirst.Data());
9334               SetYminMemoFromValue(HistoCode.Data(), ymin);
9335 
9336               Double_t ymax = GetYmaxValueFromMemo(fHistoCodeFirst.Data());
9337               SetYmaxMemoFromValue(HistoCode.Data(), ymax);
9338             }
9339 
9340             //..... graph set ymin and ymax and consequently margin at top of the plot
9341             Int_t xFlagAutoYsupMargin = SetGraphFrameYminYmaxFromMemo(g_graph0, HistoCode);
9342 
9343             HistimePlot(g_graph0,
9344                         xinf_his,
9345                         xsup_his,
9346                         HistoCode.Data(),
9347                         HistoType.Data(),
9348                         StexStin_A,
9349                         i0StinEcha,
9350                         i0Sample,
9351                         opt_scale_x,
9352                         opt_scale_y,
9353                         opt_plot,
9354                         xFlagAutoYsupMargin);
9355             //  g_graph0->Delete();   fCdeleteRoot++;  // *===> NE PAS DELETER LE GRAPH SINON CA EFFACE TOUT!
9356 
9357             //--- Recover ymin and ymax from user's values in option SAME n
9358             if (opt_plot == fSameOnePlot && GetMemoFlag(HistoCode, opt_plot) == "Busy") {
9359               SetYminMemoFromValue(HistoCode.Data(), fUserHistoMin);
9360               SetYmaxMemoFromValue(HistoCode.Data(), fUserHistoMax);
9361             }
9362           }
9363 
9364           //---------- H I S T O    Y    P R O J E C T I O N     P L O T  ---------------------- (ViewHistime)
9365 
9366           //======  G R A P H   P R O J   X I N F / X S U P   M A N A G E M E N T  =======  (ViewHistime)
9367           //
9368           //  must be done before booking because of the x <-> y permutation in case of "Proj"
9369           //
9370           //-----------------------------------------------------------------------------------------
9371           //
9372           //        CASE:    HistoType == "Proj"   OR   HistoType == "SampProj"
9373           //
9374           //                 Xinf and Xsup must be calculated from ymin and ymax
9375           //                 of the direct graph
9376           //
9377           //-----------------------------------------------------------------------------------------
9378 
9379           if (HistoType == "EvolProj") {
9380             Int_t HisSizeEvolProj = fNbBinsProj;
9381             TVectorD histo_for_plot(HisSizeEvolProj);
9382             for (Int_t i = 0; i < HisSizeEvolProj; i++) {
9383               histo_for_plot[i] = (Double_t)0.;
9384             }
9385 
9386             //graph_ymin = GetYminValueFromMemo(HistoCode.Data());
9387             //graph_ymax = GetYmaxValueFromMemo(HistoCode.Data());
9388 
9389             TString HistoCodi = HistoCode;  // HistoCodi = direct histo
9390 
9391             if (HistoCode == "H_Ped_RuDs") {
9392               HistoCodi = "H_Ped_Date";
9393             }
9394             if (HistoCode == "H_TNo_RuDs") {
9395               HistoCodi = "H_TNo_Date";
9396             }
9397             if (HistoCode == "H_LFN_RuDs") {
9398               HistoCodi = "H_LFN_Date";
9399             }
9400             if (HistoCode == "H_HFN_RuDs") {
9401               HistoCodi = "H_HFN_Date";
9402             }
9403             if (HistoCode == "H_MCs_RuDs") {
9404               HistoCodi = "H_MCs_Date";
9405             }
9406             if (HistoCode == "H_SCs_RuDs") {
9407               HistoCodi = "H_SCs_Date";
9408             }
9409 
9410             if (fUserHistoMin >= fUserHistoMax) {
9411               fFlagUserHistoMin = "AUTO";
9412               fFlagUserHistoMax = "AUTO";
9413             }
9414 
9415             //--------------------------------------------------------------------------- (ViewHistime)
9416             //
9417             //    fOnlyOnePlot => compute Xinf and Xsup at each time
9418             //    fSeveralPlot => compute Xinf and Xsup once when flag = "Free" for each HistoCode
9419             //    fSameOnePlot => compute Xinf and Xsup once
9420             //
9421             //--------------------------------------------------------------------------------------
9422             if ((opt_plot == fOnlyOnePlot) ||
9423                 ((opt_plot == fSeveralPlot && GetMemoFlag(HistoCode, fSeveralPlot) == "Free") ||
9424                  (opt_plot == fSameOnePlot && GetMemoFlag(HistoCode, fSameOnePlot) == "Free"))) {
9425               Double_t XinfProj = (Double_t)0;
9426               Double_t XsupProj = (Double_t)0;
9427 
9428               //...................................................................... (ViewHistime)
9429               if (fFlagUserHistoMin == "AUTO" || fFlagUserHistoMax == "AUTO") {
9430                 //... Get direct graph ymin and/or ymax and keep them as xinf and xsup
9431                 //    in memo for the plotted histo
9432                 XinfProj = fUserHistoMin;
9433                 XsupProj = fUserHistoMax;
9434                 if (fFlagUserHistoMin == "AUTO") {
9435                   XinfProj = GetYminValueFromMemo(HistoCodi.Data());
9436                 }
9437                 if (fFlagUserHistoMax == "AUTO") {
9438                   XsupProj = GetYmaxValueFromMemo(HistoCodi.Data());
9439                 }
9440               }  // end of  if( fFlagUserHistoMin == "AUTO" || fFlagUserHistoMax == "AUTO" )
9441               else {
9442                 if (fFlagUserHistoMin == "OFF") {
9443                   SetYminMemoFromValue(HistoCode.Data(), fCnaParHistos->GetYminDefaultValue(HistoCode.Data()));
9444                   XinfProj = GetYminValueFromMemo(HistoCode.Data());
9445                 }
9446 
9447                 if (fFlagUserHistoMax == "OFF") {
9448                   SetYmaxMemoFromValue(HistoCode.Data(), fCnaParHistos->GetYmaxDefaultValue(HistoCode.Data()));
9449                   XsupProj = GetYmaxValueFromMemo(HistoCode.Data());
9450                 }
9451                 if (fFlagUserHistoMin == "ON") {
9452                   XinfProj = fUserHistoMin;
9453                 }
9454                 if (fFlagUserHistoMax == "ON") {
9455                   XsupProj = fUserHistoMax;
9456                 }
9457               }
9458 
9459               if (opt_plot == fOnlyOnePlot || opt_plot == fSeveralPlot) {
9460                 SetXinfMemoFromValue(HistoCode.Data(), XinfProj);
9461                 SetXsupMemoFromValue(HistoCode.Data(), XsupProj);
9462               } else {
9463                 SetXinfMemoFromValue(XinfProj);
9464                 SetXsupMemoFromValue(XsupProj);
9465               }
9466             }  // end of if( (opt_plot == fOnlyOnePlot) ||
9467             // (opt_plot == fSeveralPlot  && GetMemoFlag(HistoCode, opt_plot) == "Free") ||
9468             // (opt_plot == fSameOnePlot  && GetMemoFlag(HistoCode, opt_plot) == "Free") )
9469 
9470             Double_t cXinf = (Double_t)0.;
9471             Double_t cXsup = (Double_t)0.;
9472 
9473             //.......... Set Xinf and Xsup at each time because of simultaneous SAME options    (ViewHistime)
9474             if (opt_plot == fOnlyOnePlot || opt_plot == fSeveralPlot) {
9475               cXinf = GetXinfValueFromMemo(HistoCode.Data());
9476               cXsup = GetXsupValueFromMemo(HistoCode.Data());
9477             } else {
9478               cXinf = GetXinfValueFromMemo();
9479               cXsup = GetXsupValueFromMemo();
9480             }
9481             //....... In case of only one run: in order to have cXinf < cXsup for "EvolProj" plot
9482             if (cXinf >= cXsup) {
9483               cXinf -= 1.;
9484               cXsup += 1.;
9485             }
9486 
9487             //..............................  histogram booking (ViewHisto)
9488             Axis_t xinf_his = cXinf;  // ancillary variables since no const in arguments of TH1D
9489             Axis_t xsup_his = cXsup;
9490 
9491             TString TitleHisto = ";";
9492             if (opt_plot != fSameOnePlot) {
9493               TitleHisto = fCnaParHistos->GetQuantityName(HistoCode.Data());
9494             }
9495 
9496             //........ fill array histo_for_plot from hval_coordy                    (ViewHistime)
9497             for (Int_t i_run = 0; i_run < fNbOfExistingRuns; i_run++) {
9498               Double_t XFromYGraph = hval_coordy[i_run];
9499               Double_t binXProjY = (Double_t)HisSizeEvolProj * (XFromYGraph - cXinf) / (cXsup - cXinf);
9500               Int_t ibinXProjY = (Int_t)binXProjY;
9501               if (ibinXProjY >= 0 && ibinXProjY < HisSizeEvolProj) {
9502                 histo_for_plot[ibinXProjY]++;
9503               }
9504             }
9505 
9506             TH1D* h_his_evol_proj = new TH1D("histevolproj", TitleHisto.Data(), HisSizeEvolProj, xinf_his, xsup_his);
9507             fCnewRoot++;
9508 
9509             h_his_evol_proj->Reset();
9510 
9511             //.... direct histogram filling                                                 (ViewHistime)
9512             for (Int_t i = 0; i < HisSizeEvolProj; i++) {
9513               Double_t yi = (Double_t)i / (Double_t)HisSizeEvolProj * (cXsup - cXinf) + cXinf;
9514               Double_t his_val = (Double_t)histo_for_plot[i];
9515               h_his_evol_proj->Fill(yi, his_val);
9516             }
9517 
9518             //------- H I S T O   P R O J    Y M I N / Y M A X    M A N A G E M E N T
9519             if (fUserHistoMin >= fUserHistoMax) {
9520               fFlagUserHistoMin = "AUTO";
9521               fFlagUserHistoMax = "AUTO";
9522             }
9523             //.......... user's value if flag set to "ON"
9524             if (fFlagUserHistoMin == "ON") {
9525               SetYminMemoFromValue(HistoCode.Data(), fUserHistoMin);
9526               fFlagUserHistoMin = "OFF";
9527             }
9528             if (fFlagUserHistoMax == "ON") {
9529               SetYmaxMemoFromValue(HistoCode.Data(), fUserHistoMax);
9530               fFlagUserHistoMax = "OFF";
9531             }
9532             //................................. automatic min and/or max
9533             if (fFlagUserHistoMin == "AUTO") {
9534               SetYminMemoFromValue(HistoCode.Data(), graph_ymin);
9535               fFlagUserHistoMin = "OFF";
9536             }
9537             if (fFlagUserHistoMax == "AUTO") {
9538               SetYmaxMemoFromValue(HistoCode.Data(), graph_ymax);
9539               fFlagUserHistoMax = "OFF";
9540             }
9541 
9542             //................................. Init Ymin and Ymax for graph
9543             SetYminMemoFromPreviousMemo(HistoCode);
9544             SetYmaxMemoFromPreviousMemo(HistoCode);
9545 
9546             //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9547             //.......... Find maximum in case of Proj (LIN scale only) // PS: EvolProj => in ViewHistime
9548             if (fFlagScaleY == "LIN") {
9549               SetYmaxMemoFromValue(
9550                   HistoCode.Data(),
9551                   GetYmaxFromHistoFrameAndMarginValue(h_his_evol_proj, fCnaParHistos->GetMarginAutoMinMax()));
9552             }
9553 
9554             //--- Set ymin and ymax to the first HistoCode values for option SAME n
9555             if (opt_plot == fSameOnePlot && GetMemoFlag(HistoCode, opt_plot) == "Busy") {
9556               Double_t ymin = GetYminValueFromMemo(fHistoCodeFirst.Data());
9557               SetYminMemoFromValue(HistoCode.Data(), ymin);
9558 
9559               Double_t ymax = GetYmaxValueFromMemo(fHistoCodeFirst.Data());
9560               SetYmaxMemoFromValue(HistoCode.Data(), ymax);
9561             }
9562             //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9563 
9564             //..... graph set ymin and ymax and consequently margin at top of the plot
9565             Int_t xFlagAutoYsupMargin = SetGraphFrameYminYmaxFromMemo(g_graph0, HistoCode);
9566             Int_t arg_AlreadyRead = 0;
9567 
9568             HistoPlot(h_his_evol_proj,
9569                       HisSizeEvolProj,
9570                       xinf_his,
9571                       xsup_his,
9572                       HistoCode.Data(),
9573                       HistoType.Data(),
9574                       StexStin_A,
9575                       i0StinEcha,
9576                       i0Sample,
9577                       opt_scale_x,
9578                       opt_scale_y,
9579                       opt_plot,
9580                       arg_AlreadyRead,
9581                       xFlagAutoYsupMargin);
9582 
9583             h_his_evol_proj->Delete();
9584             h_his_evol_proj = nullptr;
9585             fCdeleteRoot++;
9586             //*===> deleter l'histo sinon "Replacing existing histo (potential memory leak)" a l'execution
9587 
9588           }  // end of if( HistoType == "EvolProj" )
9589           //---------------------------------------------------------------------------------- (ViewHistime)
9590 
9591           delete[] time_coordx;
9592           time_coordx = nullptr;
9593           fCdelete++;
9594           delete[] hval_coordy;
9595           hval_coordy = nullptr;
9596           fCdelete++;
9597         } else {
9598           std::cout << "!TEcnaHistos::ViewHistime(...)> The list of runs in file: " << list_of_run_file_name << " has "
9599                     << nb_of_runs_in_list << " run numbers" << std::endl
9600                     << " but none of them correspond to an existing ROOT file." << fTTBELL << std::endl;
9601         }
9602       }  // end of if( fFapStexNumber > 0 )
9603       else {
9604         std::cout << "!TEcnaHistos::ViewHistime(...)> *ERROR* =====> " << fFapStexName << " number = " << fFapStexNumber
9605                   << ". " << fFapStexName << " number must be in range [1," << fEcal->MaxStexInStas() << "] ";
9606         if (fFlagSubDet == "EB") {
9607           std::cout << " (or [-18,+18])";
9608         }
9609         std::cout << fTTBELL << std::endl;
9610       }
9611       delete[] exist_indic;
9612       exist_indic = nullptr;
9613       fCdelete++;
9614     }  // end of if( nb_of_runs_in_list > 0 )
9615     else {
9616       if (nb_of_runs_in_list == 0) {
9617         std::cout << "!TEcnaHistos::ViewHistime(...)> The list of runs in file: " << list_of_run_file_name
9618                   << " is empty !" << fTTBELL << std::endl;
9619       }
9620       if (nb_of_runs_in_list < 0) {
9621         std::cout << "!TEcnaHistos::ViewHistime(...)> " << list_of_run_file_name
9622                   << ": file not found in directory: " << fCfgHistoryRunListFilePath.Data() << fTTBELL << std::endl;
9623       }
9624     }
9625   }  // end of if( OKHisto == 1 )
9626 }  // end of ViewHistime
9627 
9628 //------------------------------------------------------------------------------------
9629 //
9630 //      GetHistoryRunListParameters(...), AllocArraysForEvol(), GetListFileNumber(...)
9631 //
9632 //------------------------------------------------------------------------------------
9633 
9634 Int_t TEcnaHistos::GetHistoryRunListParameters(const TString& list_of_run_file_name, const TString& HistoCode) {
9635   // Build the array of run numbers from the list-of-runs .ascii file.
9636   // Return the list size
9637   // *=====> list_of_run_file_name is the name of the ASCII file containing the list of the runs
9638   //
9639   // SYNTAX OF THE FILE:
9640   //
9641   // HistoryRunList_EB_SM6_Analysis_1.ascii    <- 1rst line: comment (file name for example)
9642   // 73677                                 <- 2nd  line and others: run numbers (empty lines accepted)
9643   // 73688
9644   // 73689
9645   //
9646   // 73690
9647   // 73692
9648   //
9649   // In option SAME (of TEcnaHistos), several lists of runs can be called and these lists can have
9650   // DIFFERENT sizes (here the "size" is the number of runs of the list). In addition,
9651   // some runs in some lists may not exist in reality. So, we must adopt a convention which is
9652   // the following: the number of runs corresponds to the number of EXISTING runs
9653   // of the FIRST read list. Let be N1 this number.
9654   // If another list has more runs than N1 runs, we read only the first N1 runs.
9655   // If another list has less runs than N1 runs, we read all the runs of this list.
9656   //
9657   //--------------------------------------------------------------------------------------------------
9658 
9659   Int_t nb_of_runs_in_list = 0;
9660 
9661   //========= immediate return if file name is an empty string
9662   if (!strcmp(list_of_run_file_name.Data(), "\0")) {
9663     std::cout << "!TEcnaHistos::GetHistoryRunListParameters(...)> *** ERROR *** =====> "
9664               << " EMPTY STRING for list of run file name." << fTTBELL << std::endl;
9665   } else {
9666     // ===> increase the HistoryRunList file number
9667     if (HistoCode == "H_Ped_Date") {
9668       fNbOfListFileH_Ped_Date++;
9669     }
9670     if (HistoCode == "H_TNo_Date") {
9671       fNbOfListFileH_TNo_Date++;
9672     }
9673     if (HistoCode == "H_MCs_Date") {
9674       fNbOfListFileH_MCs_Date++;
9675     }
9676     if (HistoCode == "H_LFN_Date") {
9677       fNbOfListFileH_LFN_Date++;
9678     }
9679     if (HistoCode == "H_HFN_Date") {
9680       fNbOfListFileH_HFN_Date++;
9681     }
9682     if (HistoCode == "H_SCs_Date") {
9683       fNbOfListFileH_SCs_Date++;
9684     }
9685 
9686     if (HistoCode == "H_Ped_RuDs") {
9687       fNbOfListFileH_Ped_RuDs++;
9688     }
9689     if (HistoCode == "H_TNo_RuDs") {
9690       fNbOfListFileH_TNo_RuDs++;
9691     }
9692     if (HistoCode == "H_MCs_RuDs") {
9693       fNbOfListFileH_MCs_RuDs++;
9694     }
9695     if (HistoCode == "H_LFN_RuDs") {
9696       fNbOfListFileH_LFN_RuDs++;
9697     }
9698     if (HistoCode == "H_HFN_RuDs") {
9699       fNbOfListFileH_HFN_RuDs++;
9700     }
9701     if (HistoCode == "H_SCs_RuDs") {
9702       fNbOfListFileH_SCs_RuDs++;
9703     }
9704 
9705     fFapFileRuns = list_of_run_file_name.Data();  // (short name)
9706 
9707     //........... Add the path to the file name           ( GetHistoryRunListParameters )
9708     TString xFileNameRunList = list_of_run_file_name.Data();
9709     const Text_t* t_file_name = (const Text_t*)xFileNameRunList.Data();
9710 
9711     //.............. replace the string "$HOME" by the true $HOME path
9712     if (fCfgHistoryRunListFilePath.BeginsWith("$HOME")) {
9713       fCfgHistoryRunListFilePath.Remove(0, 5);
9714       const Text_t* t_file_nohome = (const Text_t*)fCfgHistoryRunListFilePath.Data();  //  /scratch0/cna/...
9715 
9716       TString home_path = gSystem->Getenv("HOME");
9717       fCfgHistoryRunListFilePath = home_path;            //  /afs/cern.ch/u/USER
9718       fCfgHistoryRunListFilePath.Append(t_file_nohome);  //  /afs/cern.ch/u/USER/scratch0/cna/...
9719     }
9720 
9721     xFileNameRunList = fCfgHistoryRunListFilePath.Data();
9722 
9723     xFileNameRunList.Append('/');
9724     xFileNameRunList.Append(t_file_name);
9725 
9726     fFcin_f.open(xFileNameRunList.Data());
9727 
9728     //.......................................           ( GetHistoryRunListParameters )
9729     if (fFcin_f.fail() == kFALSE) {
9730       //...................................... first reading to get the number of runs in the list
9731       fFcin_f.clear();
9732       std::string xHeadComment;
9733       fFcin_f >> xHeadComment;
9734       Int_t cRunNumber;
9735       Int_t list_size_read = 0;
9736 
9737       while (!fFcin_f.eof()) {
9738         fFcin_f >> cRunNumber;
9739         list_size_read++;
9740       }
9741       fFapNbOfRuns = list_size_read - 1;
9742 
9743       //...................................... second reading to get the run numbers
9744 
9745       //====== Return to the beginning of the file =====
9746       fFcin_f.clear();
9747       fFcin_f.seekg(0, std::ios::beg);
9748       //================================================
9749 
9750       std::string yHeadComment;
9751       fFcin_f >> yHeadComment;
9752 
9753       //....................... Set fFapMaxNbOfRuns to -1 at first call (first read file)
9754       //
9755       //                        fNbOfListFileEvolXXX is initialized to 0 in Init()
9756       //                        It is incremented once here above
9757       //                        So, at first call fNbOfListFileEvolXXX = 1
9758       //                        then fFapMaxNbOfRuns = -1
9759       //..........................................................................   (GetHistoryRunListParameters)
9760       if ((HistoCode == "H_Ped_Date" && fNbOfListFileH_Ped_Date == 1) ||
9761           (HistoCode == "H_TNo_Date" && fNbOfListFileH_TNo_Date == 1) ||
9762           (HistoCode == "H_MCs_Date" && fNbOfListFileH_MCs_Date == 1) ||
9763           (HistoCode == "H_LFN_Date" && fNbOfListFileH_LFN_Date == 1) ||
9764           (HistoCode == "H_HFN_Date" && fNbOfListFileH_HFN_Date == 1) ||
9765           (HistoCode == "H_SCs_Date" && fNbOfListFileH_SCs_Date == 1) ||
9766           (HistoCode == "H_Ped_RuDs" && fNbOfListFileH_Ped_RuDs == 1) ||
9767           (HistoCode == "H_TNo_RuDs" && fNbOfListFileH_TNo_RuDs == 1) ||
9768           (HistoCode == "H_MCs_RuDs" && fNbOfListFileH_MCs_RuDs == 1) ||
9769           (HistoCode == "H_LFN_RuDs" && fNbOfListFileH_LFN_RuDs == 1) ||
9770           (HistoCode == "H_HFN_RuDs" && fNbOfListFileH_HFN_RuDs == 1) ||
9771           (HistoCode == "H_SCs_RuDs" && fNbOfListFileH_SCs_RuDs == 1)) {
9772         fFapMaxNbOfRuns = -1;
9773       }
9774 
9775       // first call: fFapMaxNbOfRuns = fFapNbOfRuns = nb of run from the first reading
9776       if (fFapMaxNbOfRuns == -1) {
9777         fFapMaxNbOfRuns = fFapNbOfRuns;
9778       }
9779       // next calls: fFapNbOfRuns must not be greater than fFapMaxNbOfRuns found at first time
9780       else {
9781         if (fFapNbOfRuns > fFapMaxNbOfRuns) {
9782           fFapNbOfRuns = fFapMaxNbOfRuns;
9783         }
9784       }
9785 
9786       // Allocation and initialization of the array fT1DRunNumber[].
9787       //................. check maximum value for allocation
9788       if (fFapMaxNbOfRuns > fCnaParHistos->MaxNbOfRunsInLists()) {
9789         std::cout << "TEcnaHistos::GetHistoryRunListParameters(...)> Max number of runs in HistoryRunList = "
9790                   << fFapMaxNbOfRuns << " too large, forced to parameter TEcnaParHistos->fMaxNbOfRunsInLists value (= "
9791                   << fCnaParHistos->MaxNbOfRunsInLists() << "). Please, set this parameter to a larger value than "
9792                   << fFapMaxNbOfRuns << fTTBELL << std::endl;
9793         fFapMaxNbOfRuns = fCnaParHistos->MaxNbOfRunsInLists();
9794       }
9795       //................................. Alloc of the array and init
9796       if (fT1DRunNumber == nullptr) {
9797         if (fFapMaxNbOfRuns > 0) {
9798           fT1DRunNumber = new Int_t[fFapMaxNbOfRuns];
9799           fCnew++;
9800         } else {
9801           std::cout << "!TEcnaHistos::GetHistoryRunListParameters(...)> *** ERROR *** =====> fFapMaxNbOfRuns = "
9802                     << fFapMaxNbOfRuns << ". Forced to 1." << fTTBELL << std::endl;
9803           fFapMaxNbOfRuns = 1;
9804           fT1DRunNumber = new Int_t[fFapMaxNbOfRuns];
9805           fCnew++;
9806         }
9807       }
9808 
9809       //.................................... Init the list of runs
9810       for (Int_t i_run = 0; i_run < fFapMaxNbOfRuns; i_run++) {
9811         fT1DRunNumber[i_run] = -1;
9812       }
9813       //.................................... read the list of runs
9814       for (Int_t i_list = 0; i_list < fFapNbOfRuns; i_list++) {
9815         fFcin_f >> cRunNumber;
9816         fT1DRunNumber[i_list] = cRunNumber;
9817       }
9818       //........................................           ( GetHistoryRunListParameters )
9819       nb_of_runs_in_list = fFapNbOfRuns;
9820       fFcin_f.close();
9821     } else {
9822       fFcin_f.clear();
9823       std::cout << "!TEcnaHistos::GetHistoryRunListParameters(...)> *** ERROR *** =====> " << xFileNameRunList.Data()
9824                 << " : file not found." << fTTBELL << std::endl;
9825       nb_of_runs_in_list = -1;
9826     }
9827   }
9828   return nb_of_runs_in_list;
9829 }
9830 //   end of GetHistoryRunListParameters(...)
9831 
9832 //------------------------------------------------------------------------------------------------
9833 
9834 Int_t TEcnaHistos::GetListFileNumber(const TString& HistoCode) {
9835   // Get the number of the read list file
9836 
9837   Int_t number = 0;
9838 
9839   if (HistoCode == "H_Ped_Date") {
9840     number = fNbOfListFileH_Ped_Date;
9841   }
9842   if (HistoCode == "H_TNo_Date") {
9843     number = fNbOfListFileH_TNo_Date;
9844   }
9845   if (HistoCode == "H_MCs_Date") {
9846     number = fNbOfListFileH_MCs_Date;
9847   }
9848   if (HistoCode == "H_LFN_Date") {
9849     number = fNbOfListFileH_LFN_Date;
9850   }
9851   if (HistoCode == "H_HFN_Date") {
9852     number = fNbOfListFileH_HFN_Date;
9853   }
9854   if (HistoCode == "H_SCs_Date") {
9855     number = fNbOfListFileH_SCs_Date;
9856   }
9857   if (HistoCode == "H_Ped_RuDs") {
9858     number = fNbOfListFileH_Ped_RuDs;
9859   }
9860   if (HistoCode == "H_TNo_RuDs") {
9861     number = fNbOfListFileH_TNo_RuDs;
9862   }
9863   if (HistoCode == "H_MCs_RuDs") {
9864     number = fNbOfListFileH_MCs_RuDs;
9865   }
9866   if (HistoCode == "H_LFN_RuDs") {
9867     number = fNbOfListFileH_LFN_RuDs;
9868   }
9869   if (HistoCode == "H_HFN_RuDs") {
9870     number = fNbOfListFileH_HFN_RuDs;
9871   }
9872   if (HistoCode == "H_SCs_RuDs") {
9873     number = fNbOfListFileH_SCs_RuDs;
9874   }
9875   return number;
9876 }
9877 
9878 //--------------------------------------------------------------------------------------------------
9879 void TEcnaHistos::SetRunNumberFromList(const Int_t& xArgIndexRun, const Int_t& MaxNbOfRuns) {
9880   // Set run number for the xArgIndexRun_th run in the list of runs (evolution plots)
9881   //     The array fT1DRunNumber[] have been obtained from a previous call
9882   //     to GetHistoryRunListParameters(xFileNameRunList, HistoCode)
9883 
9884   if (xArgIndexRun >= 0 && xArgIndexRun < MaxNbOfRuns) {
9885     fFapRunNumber = fT1DRunNumber[xArgIndexRun];
9886     if (xArgIndexRun == 0) {
9887       InitSpecParBeforeFileReading();
9888     }  // SpecPar = Special Parameters (dates, times, run types)
9889   } else {
9890     std::cout << "!TEcnaHistos::SetRunNumberFromList(...)> **** ERROR **** Run index out of range in list of runs. "
9891                  "xArgIndexRun = "
9892               << xArgIndexRun << " (MaxNbOfRuns = " << MaxNbOfRuns << ")" << std::endl;
9893   }
9894 }
9895 
9896 //--------------------------------------------------------------------------------------------------
9897 void TEcnaHistos::InitSpecParBeforeFileReading() {
9898   // Init parameters that will be set by reading the info which are in the results ROOT file
9899   // SpecPar = Special Parameters (dates, times, run types)
9900 
9901   fStartDate.Resize(charArrLen);
9902   fStartDate = "(date not found)";
9903 
9904   fStopDate.Resize(charArrLen);
9905   fStopDate = "(date not found)";
9906 
9907   fStartTime = (time_t)0;
9908   fStopTime = (time_t)0;
9909 
9910   fRunType = "(run type not found)";
9911 
9912 }  // ------------- ( end of InitSpecParBeforeFileReading() ) -------------
9913 
9914 //======================================================================================
9915 //
9916 //           C O M M E N T S / I N F O S     P A V E S      M E T H O D S
9917 //
9918 //======================================================================================
9919 
9920 Bool_t TEcnaHistos::GetOkViewHisto(TEcnaRead* aMyRootFile,
9921                                    const Int_t& StexStin_A,
9922                                    const Int_t& i0StinEcha,
9923                                    const Int_t& i0Sample,
9924                                    const TString& HistoCode) {
9925   // Check possibility to plot the histo
9926 
9927   Bool_t ok_view_histo = kFALSE;
9928 
9929   TString HistoType = fCnaParHistos->GetHistoType(HistoCode);
9930 
9931   TString root_file_name = aMyRootFile->GetRootFileNameShort();
9932 
9933   TVectorD vStin(fEcal->MaxStinEcnaInStex());
9934   for (Int_t i = 0; i < fEcal->MaxStinEcnaInStex(); i++) {
9935     vStin(i) = (Double_t)0.;
9936   }
9937   vStin = aMyRootFile->ReadStinNumbers(fEcal->MaxStinEcnaInStex());
9938 
9939   if (aMyRootFile->DataExist() == kTRUE) {
9940     fStatusDataExist = kTRUE;
9941 
9942     Int_t Stin_ok = 0;
9943     for (Int_t index_Stin = 0; index_Stin < fEcal->MaxStinEcnaInStex(); index_Stin++) {
9944       if (vStin(index_Stin) == StexStin_A) {
9945         Stin_ok++;
9946       };
9947     }
9948 
9949     //.............................................. ok_view
9950     Int_t ok_view = 1;
9951 
9952     if (!(HistoType == "Global" || HistoType == "Proj")) {
9953       if (Stin_ok != 1) {
9954         Int_t StinNumber = StexStin_A;
9955         if (fFlagSubDet == "EE") {
9956           StinNumber = fEcalNumbering->GetDeeSCConsFrom1DeeSCEcna(fFapStexNumber, StexStin_A);
9957         }
9958         std::cout << "!TEcnaHistos::GetOkViewHisto(...)> *ERROR* =====> "
9959                   << "File: " << root_file_name << ", " << fFapStinName.Data() << " " << StinNumber
9960                   << " not found. Available numbers = ";
9961         for (Int_t i = 0; i < fEcal->MaxStinEcnaInStex(); i++) {
9962           if (vStin(i) > 0) {
9963             if (fFlagSubDet == "EB") {
9964               std::cout << vStin(i) << ", ";
9965             }
9966             if (fFlagSubDet == "EE") {
9967               std::cout << fEcalNumbering->GetDeeSCConsFrom1DeeSCEcna(fFapStexNumber, (Int_t)vStin(i)) << ", ";
9968             }
9969           }
9970         }
9971         std::cout << fTTBELL << std::endl;
9972         ok_view = -1;
9973       } else {
9974         ok_view = 1;
9975       }
9976     }
9977 
9978     //.............................................. ok_max_elt   ( GetOkViewHisto(...) )
9979     Int_t ok_max_elt = 1;
9980 
9981     if ((((HistoType == "H1Basic") || (HistoType == "Evol") || (HistoType == "EvolProj")) && (i0StinEcha >= 0) &&
9982          (i0StinEcha < fEcal->MaxCrysInStin()) && (i0Sample >= 0) && (i0Sample < fFapNbOfSamples)) ||
9983         !((HistoType == "H1Basic") || (HistoType == "Evol") || (HistoType == "EvolProj"))) {
9984       ok_max_elt = 1;
9985     } else {
9986       Int_t Choffset = 0;
9987       if (fFlagSubDet == "EE") {
9988         Choffset = 1;
9989       }
9990       if (((HistoType == "H1Basic") || (HistoType == "Evol") || (HistoType == "EvolProj")) &&
9991           !((i0StinEcha >= 0) && (i0StinEcha < fEcal->MaxCrysInStin()))) {
9992         std::cout << "!TEcnaHistos::GetOkViewHisto(...)> *ERROR* =====> "
9993                   << "File: " << root_file_name << ". Wrong channel number. Value = " << i0StinEcha
9994                   << " (required range: [" << Choffset << ", " << fEcal->MaxCrysInStin() - 1 + Choffset << "] )"
9995                   << fTTBELL << std::endl;
9996       }
9997       if ((HistoCode == "D_Adc_EvDs" || HistoCode == "D_Adc_EvNb") &&
9998           !((i0Sample >= 0) && (i0Sample < fFapNbOfSamples))) {
9999         std::cout << "!TEcnaHistos::GetOkViewHisto(...)> *ERROR* =====> "
10000                   << "File: " << root_file_name << ". Wrong sample index. Value = " << i0Sample
10001                   << " (required range: [0, " << fFapNbOfSamples - 1 << "] )" << fTTBELL << std::endl;
10002       }
10003       ok_max_elt = -1;
10004     }
10005 
10006     if ((ok_view == 1) && (ok_max_elt == 1)) {
10007       ok_view_histo = kTRUE;
10008     } else {
10009       std::cout << "!TEcnaHistos::GetOkViewHisto(...)> At least one ERROR has been detected. ok_view = " << ok_view
10010                 << ", ok_max_elt = " << ok_max_elt << fTTBELL << std::endl;
10011     }
10012   } else {
10013     fStatusDataExist = kFALSE;
10014 
10015     std::cout << "!TEcnaHistos::GetOkViewHisto(...)> No data in ROOT file "
10016               << ", aMyRootFile->DataExist() = " << aMyRootFile->DataExist() << fTTBELL << std::endl;
10017   }
10018   return ok_view_histo;
10019 }
10020 //..............................................................................................
10021 
10022 Int_t TEcnaHistos::SetHistoFrameYminYmaxFromMemo(TH1D* h_his0, const TString& HistoCode) {
10023   // Set min and max according to HistoCode
10024 
10025   // if Ymin = Ymax (or Ymin > Ymax): nothing done here
10026   // return xFlagAutoYsupMargin = 1
10027   //
10028   // if Ymin < Ymax: min and max calculated by h_his0->SetMinimum() and h_his0->SetMaximum()
10029   // return xFlagAutoYsupMargin = 0
10030 
10031   Int_t xFlagAutoYsupMargin = 1;  //  (SetHistoFrameYminYmaxFromMemo)
10032 
10033   if (HistoCode == "D_NOE_ChNb") {
10034     if (fD_NOE_ChNbYmin < fD_NOE_ChNbYmax) {
10035       xFlagAutoYsupMargin = 0;
10036       h_his0->SetMinimum(fD_NOE_ChNbYmin);
10037       h_his0->SetMaximum(fD_NOE_ChNbYmax);
10038     }
10039   }
10040 
10041   if (HistoCode == "D_NOE_ChDs") {
10042     if (fD_NOE_ChDsYmin < fD_NOE_ChDsYmax) {
10043       xFlagAutoYsupMargin = 0;
10044       h_his0->SetMinimum(fD_NOE_ChDsYmin);
10045       h_his0->SetMaximum(fD_NOE_ChDsYmax);
10046     }
10047   }
10048 
10049   if (HistoCode == "D_Ped_ChNb") {
10050     if (fD_Ped_ChNbYmin < fD_Ped_ChNbYmax) {
10051       xFlagAutoYsupMargin = 0;
10052       h_his0->SetMinimum(fD_Ped_ChNbYmin);
10053       h_his0->SetMaximum(fD_Ped_ChNbYmax);
10054     }
10055   }
10056 
10057   if (HistoCode == "D_Ped_ChDs") {
10058     if (fD_Ped_ChDsYmin < fD_Ped_ChDsYmax) {
10059       xFlagAutoYsupMargin = 0;
10060       h_his0->SetMinimum(fD_Ped_ChDsYmin);
10061       h_his0->SetMaximum(fD_Ped_ChDsYmax);
10062     }
10063   }
10064 
10065   if (HistoCode == "D_TNo_ChNb") {
10066     if (fD_TNo_ChNbYmin < fD_TNo_ChNbYmax) {
10067       xFlagAutoYsupMargin = 0;
10068       h_his0->SetMinimum(fD_TNo_ChNbYmin);
10069       h_his0->SetMaximum(fD_TNo_ChNbYmax);
10070     }
10071   }
10072 
10073   if (HistoCode == "D_TNo_ChDs") {
10074     if (fD_TNo_ChDsYmin < fD_TNo_ChDsYmax) {
10075       xFlagAutoYsupMargin = 0;
10076       h_his0->SetMinimum(fD_TNo_ChDsYmin);
10077       h_his0->SetMaximum(fD_TNo_ChDsYmax);
10078     }
10079   }
10080 
10081   if (HistoCode == "D_MCs_ChNb") {
10082     if (fD_MCs_ChNbYmin < fD_MCs_ChNbYmax) {
10083       xFlagAutoYsupMargin = 0;
10084       h_his0->SetMinimum(fD_MCs_ChNbYmin);
10085       h_his0->SetMaximum(fD_MCs_ChNbYmax);
10086     }
10087   }
10088 
10089   if (HistoCode == "D_MCs_ChDs") {
10090     if (fD_MCs_ChDsYmin < fD_MCs_ChDsYmax) {
10091       xFlagAutoYsupMargin = 0;
10092       h_his0->SetMinimum(fD_MCs_ChDsYmin);
10093       h_his0->SetMaximum(fD_MCs_ChDsYmax);
10094     }
10095   }
10096 
10097   if (HistoCode == "D_LFN_ChNb") {
10098     if (fD_LFN_ChNbYmin < fD_LFN_ChNbYmax) {
10099       xFlagAutoYsupMargin = 0;
10100       h_his0->SetMinimum(fD_LFN_ChNbYmin);
10101       h_his0->SetMaximum(fD_LFN_ChNbYmax);
10102     }
10103   }
10104 
10105   if (HistoCode == "D_LFN_ChDs") {
10106     if (fD_LFN_ChDsYmin < fD_LFN_ChDsYmax) {
10107       xFlagAutoYsupMargin = 0;
10108       h_his0->SetMinimum(fD_LFN_ChDsYmin);
10109       h_his0->SetMaximum(fD_LFN_ChDsYmax);
10110     }
10111   }
10112 
10113   if (HistoCode == "D_HFN_ChNb") {
10114     if (fD_HFN_ChNbYmin < fD_HFN_ChNbYmax) {
10115       xFlagAutoYsupMargin = 0;
10116       h_his0->SetMinimum(fD_HFN_ChNbYmin);
10117       h_his0->SetMaximum(fD_HFN_ChNbYmax);
10118     }
10119   }
10120 
10121   if (HistoCode == "D_HFN_ChDs") {
10122     if (fD_HFN_ChDsYmin < fD_HFN_ChDsYmax) {
10123       xFlagAutoYsupMargin = 0;
10124       h_his0->SetMinimum(fD_HFN_ChDsYmin);
10125       h_his0->SetMaximum(fD_HFN_ChDsYmax);
10126     }
10127   }
10128 
10129   if (HistoCode == "D_SCs_ChNb") {
10130     if (fD_SCs_ChNbYmin < fD_SCs_ChNbYmax) {
10131       xFlagAutoYsupMargin = 0;
10132       h_his0->SetMinimum(fD_SCs_ChNbYmin);
10133       h_his0->SetMaximum(fD_SCs_ChNbYmax);
10134     }
10135   }
10136 
10137   if (HistoCode == "D_SCs_ChDs") {
10138     if (fD_SCs_ChDsYmin < fD_SCs_ChDsYmax) {
10139       xFlagAutoYsupMargin = 0;
10140       h_his0->SetMinimum(fD_SCs_ChDsYmin);
10141       h_his0->SetMaximum(fD_SCs_ChDsYmax);
10142     }
10143   }
10144 
10145   if (HistoCode == "D_MSp_SpNb") {
10146     if (fD_MSp_SpNbYmin < fD_MSp_SpNbYmax) {
10147       xFlagAutoYsupMargin = 0;
10148       h_his0->SetMinimum(fD_MSp_SpNbYmin);
10149       h_his0->SetMaximum(fD_MSp_SpNbYmax);
10150     }
10151   }
10152 
10153   if (HistoCode == "D_MSp_SpDs") {
10154     if (fD_MSp_SpDsYmin < fD_MSp_SpDsYmax) {
10155       xFlagAutoYsupMargin = 0;
10156       h_his0->SetMinimum(fD_MSp_SpDsYmin);
10157       h_his0->SetMaximum(fD_MSp_SpDsYmax);
10158     }
10159   }
10160 
10161   if (HistoCode == "D_SSp_SpNb") {
10162     if (fD_SSp_SpNbYmin < fD_SSp_SpNbYmax) {
10163       xFlagAutoYsupMargin = 0;
10164       h_his0->SetMinimum(fD_SSp_SpNbYmin);
10165       h_his0->SetMaximum(fD_SSp_SpNbYmax);
10166     }
10167   }
10168 
10169   if (HistoCode == "D_SSp_SpDs") {
10170     if (fD_SSp_SpDsYmin < fD_SSp_SpDsYmax) {
10171       xFlagAutoYsupMargin = 0;
10172       h_his0->SetMinimum(fD_SSp_SpDsYmin);
10173       h_his0->SetMaximum(fD_SSp_SpDsYmax);
10174     }
10175   }
10176 
10177   if (HistoCode == "D_Adc_EvNb") {
10178     if (fD_Adc_EvNbYmin < fD_Adc_EvNbYmax) {
10179       xFlagAutoYsupMargin = 0;
10180       h_his0->SetMinimum(fD_Adc_EvNbYmin);
10181       h_his0->SetMaximum(fD_Adc_EvNbYmax);
10182     }
10183   }
10184 
10185   if (HistoCode == "D_Adc_EvDs") {
10186     if (fD_Adc_EvDsYmin < fD_Adc_EvDsYmax) {
10187       xFlagAutoYsupMargin = 0;
10188       h_his0->SetMinimum(fD_Adc_EvDsYmin);
10189       h_his0->SetMaximum(fD_Adc_EvDsYmax);
10190     }
10191   }
10192 
10193   if (HistoCode == "H2CorccInStins") {
10194     if (fH2CorccInStinsYmin < fH2CorccInStinsYmax) {
10195       xFlagAutoYsupMargin = 0;
10196       h_his0->SetMinimum(fH2CorccInStinsYmin);
10197       h_his0->SetMaximum(fH2CorccInStinsYmax);
10198     }
10199   }
10200 
10201   if (HistoCode == "H2LFccMosMatrix") {
10202     if (fH2LFccMosMatrixYmin < fH2LFccMosMatrixYmax) {
10203       xFlagAutoYsupMargin = 0;
10204       h_his0->SetMinimum(fH2LFccMosMatrixYmin);
10205       h_his0->SetMaximum(fH2LFccMosMatrixYmax);
10206     }
10207   }
10208 
10209   if (HistoCode == "H2HFccMosMatrix") {
10210     if (fH2HFccMosMatrixYmin < fH2HFccMosMatrixYmax) {
10211       xFlagAutoYsupMargin = 0;
10212       h_his0->SetMinimum(fH2HFccMosMatrixYmin);
10213       h_his0->SetMaximum(fH2HFccMosMatrixYmax);
10214     }
10215   }
10216 
10217   if (HistoCode == "H_Ped_RuDs") {
10218     if (fH_Ped_RuDsYmin < fH_Ped_RuDsYmax) {
10219       xFlagAutoYsupMargin = 0;
10220       h_his0->SetMinimum(fH_Ped_RuDsYmin);
10221       h_his0->SetMaximum(fH_Ped_RuDsYmax);
10222     }
10223   }
10224 
10225   if (HistoCode == "H_TNo_RuDs") {
10226     if (fH_TNo_RuDsYmin < fH_TNo_RuDsYmax) {
10227       xFlagAutoYsupMargin = 0;
10228       h_his0->SetMinimum(fH_TNo_RuDsYmin);
10229       h_his0->SetMaximum(fH_TNo_RuDsYmax);
10230     }
10231   }
10232 
10233   if (HistoCode == "H_MCs_RuDs") {
10234     if (fH_MCs_RuDsYmin < fH_MCs_RuDsYmax) {
10235       xFlagAutoYsupMargin = 0;
10236       h_his0->SetMinimum(fH_MCs_RuDsYmin);
10237       h_his0->SetMaximum(fH_MCs_RuDsYmax);
10238     }
10239   }
10240 
10241   if (HistoCode == "H_LFN_RuDs") {
10242     if (fH_LFN_RuDsYmin < fH_LFN_RuDsYmax) {
10243       xFlagAutoYsupMargin = 0;
10244       h_his0->SetMinimum(fH_LFN_RuDsYmin);
10245       h_his0->SetMaximum(fH_LFN_RuDsYmax);
10246     }
10247   }
10248 
10249   if (HistoCode == "H_HFN_RuDs") {
10250     if (fH_HFN_RuDsYmin < fH_HFN_RuDsYmax) {
10251       xFlagAutoYsupMargin = 0;
10252       h_his0->SetMinimum(fH_HFN_RuDsYmin);
10253       h_his0->SetMaximum(fH_HFN_RuDsYmax);
10254     }
10255   }
10256 
10257   if (HistoCode == "H_SCs_RuDs") {
10258     if (fH_SCs_RuDsYmin < fH_SCs_RuDsYmax) {
10259       xFlagAutoYsupMargin = 0;
10260       h_his0->SetMinimum(fH_SCs_RuDsYmin);
10261       h_his0->SetMaximum(fH_SCs_RuDsYmax);
10262     }
10263   }
10264 
10265   return xFlagAutoYsupMargin;
10266 }  // end of  SetHistoFrameYminYmaxFromMemo
10267 
10268 Int_t TEcnaHistos::SetGraphFrameYminYmaxFromMemo(TGraph* g_graph0, const TString& HistoCode) {
10269   // Set min and max according to HistoCode
10270 
10271   Int_t xFlagAutoYsupMargin = 1;  // DEFAULT: 1 = min and max calulated by ROOT, 0 = by this code
10272 
10273   if (HistoCode == "H_Ped_Date") {
10274     if (fH_Ped_DateYmin < fH_Ped_DateYmax) {
10275       xFlagAutoYsupMargin = 0;
10276       g_graph0->SetMinimum(fH_Ped_DateYmin);
10277       g_graph0->SetMaximum(fH_Ped_DateYmax);
10278     }
10279   }
10280 
10281   if (HistoCode == "H_TNo_Date") {
10282     if (fH_TNo_DateYmin < fH_TNo_DateYmax) {
10283       xFlagAutoYsupMargin = 0;
10284       g_graph0->SetMinimum(fH_TNo_DateYmin);
10285       g_graph0->SetMaximum(fH_TNo_DateYmax);
10286     }
10287   }
10288 
10289   if (HistoCode == "H_MCs_Date") {
10290     if (fH_MCs_DateYmin < fH_MCs_DateYmax) {
10291       xFlagAutoYsupMargin = 0;
10292       g_graph0->SetMinimum(fH_MCs_DateYmin);
10293       g_graph0->SetMaximum(fH_MCs_DateYmax);
10294     }
10295   }
10296 
10297   if (HistoCode == "H_LFN_Date") {
10298     if (fH_LFN_DateYmin < fH_LFN_DateYmax) {
10299       xFlagAutoYsupMargin = 0;
10300       g_graph0->SetMinimum(fH_LFN_DateYmin);
10301       g_graph0->SetMaximum(fH_LFN_DateYmax);
10302     }
10303   }
10304 
10305   if (HistoCode == "H_HFN_Date") {
10306     if (fH_HFN_DateYmin < fH_HFN_DateYmax) {
10307       xFlagAutoYsupMargin = 0;
10308       g_graph0->SetMinimum(fH_HFN_DateYmin);
10309       g_graph0->SetMaximum(fH_HFN_DateYmax);
10310     }
10311   }
10312 
10313   if (HistoCode == "H_SCs_Date") {
10314     if (fH_SCs_DateYmin < fH_SCs_DateYmax) {
10315       xFlagAutoYsupMargin = 0;
10316       g_graph0->SetMinimum(fH_SCs_DateYmin);
10317       g_graph0->SetMaximum(fH_SCs_DateYmax);
10318     }
10319   }
10320 
10321   return xFlagAutoYsupMargin;
10322 }  // end of SetGraphFrameYminYmaxFromMemo
10323 
10324 //..............................................................................................
10325 Double_t TEcnaHistos::GetYminFromHistoFrameAndMarginValue(TH1D* h_his0, const Double_t margin_factor) {
10326   //Calculation for automatic minimum with margin
10327   Double_t minproj = h_his0->GetMinimum();
10328   Double_t maxproj = h_his0->GetMaximum();
10329   minproj = minproj - (maxproj - minproj) * margin_factor;
10330   return minproj;
10331 }
10332 
10333 Double_t TEcnaHistos::GetYmaxFromHistoFrameAndMarginValue(TH1D* h_his0, const Double_t margin_factor) {
10334   //Calculation for automatic maximum with margin
10335   Double_t minproj = h_his0->GetMinimum();
10336   Double_t maxproj = h_his0->GetMaximum();
10337   maxproj = maxproj + (maxproj - minproj) * margin_factor;
10338   return maxproj;
10339 }
10340 
10341 Double_t TEcnaHistos::GetYminFromGraphFrameAndMarginValue(TGraph* g_graph0, const Double_t margin_factor) {
10342   //Calculation for automatic minimum with margin
10343   Double_t graph_ymin = g_graph0->GetY()[0];
10344   for (Int_t i = 1; i < g_graph0->GetN(); i++) {
10345     if (g_graph0->GetY()[i] < graph_ymin) {
10346       graph_ymin = g_graph0->GetY()[i];
10347     }
10348   }
10349 
10350   Double_t graph_ymax = g_graph0->GetY()[0];
10351   for (Int_t i = 1; i < g_graph0->GetN(); i++) {
10352     if (g_graph0->GetY()[i] > graph_ymax) {
10353       graph_ymax = g_graph0->GetY()[i];
10354     }
10355   }
10356 
10357   graph_ymin = graph_ymin - (graph_ymax - graph_ymin) * margin_factor;
10358   return graph_ymin;
10359 }
10360 Double_t TEcnaHistos::GetYmaxFromGraphFrameAndMarginValue(TGraph* g_graph0, const Double_t margin_factor) {
10361   //Calculation for automatic maximum with margin
10362   Double_t graph_ymin = g_graph0->GetY()[0];
10363   for (Int_t i = 1; i < g_graph0->GetN(); i++) {
10364     if (g_graph0->GetY()[i] < graph_ymin) {
10365       graph_ymin = g_graph0->GetY()[i];
10366     }
10367   }
10368 
10369   Double_t graph_ymax = g_graph0->GetY()[0];
10370   for (Int_t i = 1; i < g_graph0->GetN(); i++) {
10371     if (g_graph0->GetY()[i] > graph_ymax) {
10372       graph_ymax = g_graph0->GetY()[i];
10373     }
10374   }
10375 
10376   graph_ymax = graph_ymax + (graph_ymax - graph_ymin) * margin_factor;
10377   return graph_ymax;
10378 }
10379 //----------------------------------------------- HistoPlot
10380 
10381 void TEcnaHistos::HistoPlot(TH1D* h_his0,
10382                             const Int_t& HisSize,
10383                             const Axis_t& xinf_his,
10384                             const Axis_t& xsup_his,
10385                             const TString& HistoCode,
10386                             const TString& HistoType,
10387                             const Int_t& StexStin_A,
10388                             const Int_t& i0StinEcha,
10389                             const Int_t& i0Sample,
10390                             const Int_t& opt_scale_x,
10391                             const Int_t& opt_scale_y,
10392                             const TString& opt_plot,
10393                             const Int_t& arg_AlreadyRead,
10394                             const Int_t& xFlagAutoYsupMargin) {
10395   // Plot 1D histogram
10396 
10397   UInt_t canv_w = fCnaParHistos->SetCanvasWidth(HistoCode.Data(), opt_plot);
10398   UInt_t canv_h = fCnaParHistos->SetCanvasHeight(HistoCode.Data(), opt_plot);
10399 
10400   TString QuantityName = "                                ";
10401   QuantityName.Resize(charArrLen);
10402   QuantityName = fCnaParHistos->GetQuantityName(HistoCode.Data());
10403 
10404   if (arg_AlreadyRead == 0 || arg_AlreadyRead == 1) {
10405     SetHistoPresentation(h_his0, HistoType.Data(), opt_plot);  // (gStyle parameters)
10406     //.................................................. prepa paves commentaires (HistoPlot)
10407     SetAllPavesViewHisto(HistoCode.Data(), StexStin_A, i0StinEcha, i0Sample, opt_plot.Data(), arg_AlreadyRead);
10408   }
10409 
10410   //..................................................... Canvas name (HistoPlot)
10411   TString canvas_name = SetCanvasName(
10412       HistoCode.Data(), opt_scale_x, opt_scale_y, opt_plot.Data(), arg_AlreadyRead, StexStin_A, i0StinEcha, i0Sample);
10413   //..................................................... Canvas allocations (HistoPlot)
10414   TCanvas* MainCanvas = nullptr;
10415 
10416   if (opt_plot == fOnlyOnePlot && (arg_AlreadyRead == 0 || arg_AlreadyRead == 1)) {
10417     MainCanvas = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h);
10418     fCnewRoot++;
10419     fCurrentPad = gPad;
10420     fCurrentCanvas = MainCanvas;
10421     fCurrentCanvasName = canvas_name.Data();
10422   }
10423 
10424   if (opt_plot == fSeveralPlot || opt_plot == fSameOnePlot) {
10425     if (GetMemoFlag(HistoCode, opt_plot) == "Free") {
10426       MainCanvas = CreateCanvas(HistoCode, opt_plot, canvas_name, canv_w, canv_h);
10427       fCurrentPad = gPad;
10428       fCurrentCanvas = MainCanvas;
10429       fCurrentCanvasName = canvas_name.Data();
10430     }
10431   }
10432 
10433   // std::cout << "*TEcnaHistos::HistoPlot(...)> Plot is displayed on canvas ----> " << canvas_name.Data() << std::endl;
10434 
10435   //--------------- EE => SC for construction, EB => Xtal in SM (default: Stin ECNA number, i0StinEcha)
10436   Int_t Stex_StinCons = StexStin_A;   // Stex_StinCons = Tower for EB, SC for construction for EE
10437   Int_t n1StexCrys = i0StinEcha + 1;  // n1StexCrys = Crys in SM for EB, ECNA
10438 
10439   if (StexStin_A >= 1 && StexStin_A <= fEcal->MaxStinEcnaInStex()) {
10440     if (fFlagSubDet == "EB") {
10441       n1StexCrys = fEcalNumbering->Get1StexCrysFrom1StexStinAnd0StinEcha(StexStin_A, i0StinEcha, fFapStexNumber);
10442     }
10443     if (fFlagSubDet == "EE") {
10444       Stex_StinCons = fEcalNumbering->GetDeeSCConsFrom1DeeSCEcna(fFapStexNumber, StexStin_A);
10445     }
10446   }
10447 
10448   //------ String for StexNumber ( to display "EB" or "EE" if Stex = 0 )
10449   TString sFapStexNumber = StexNumberToString(fFapStexNumber);
10450 
10451   //============================================================================= (HistoPlot)
10452   //
10453   //     1st  OPERATIONS:  Pave texts preparation and first Draw.
10454   //                       SetParametersCanvas
10455   //                       Set Memo Flags.
10456   //                       Set main_subpad and main_pavtxt
10457   //
10458   //=============================================================================
10459   TVirtualPad* main_subpad = nullptr;  // main_subpad: Pad for the histo
10460   TPaveText* main_pavtxt = nullptr;    // Pave for the "Several Changing" parameters (options SAME and SAME n)
10461 
10462   Int_t xMemoPlotSame = 1;  // a priori ==> SAME plot
10463 
10464   //========================================= Option ONLYONE    (HistoPlot)
10465   if (opt_plot == fOnlyOnePlot) {
10466     if (arg_AlreadyRead == 0 || arg_AlreadyRead == 1) {
10467       //.................................... Draw titles and paves (pad = main canvas)
10468       if (fPavComGeneralTitle != nullptr) {
10469         fPavComGeneralTitle->Draw();
10470       }
10471       fPavComStex->Draw();
10472       if (!(HistoType == "Global" || HistoType == "Proj")) {
10473         fPavComStin->Draw();
10474         fPavComXtal->Draw();
10475       }
10476 
10477       if (HistoType == "EvolProj") {
10478         fPavComEvolRuns->Draw();
10479         fPavComEvolNbOfEvtsAna->Draw();
10480       } else {
10481         fPavComAnaRun->Draw();
10482         fPavComNbOfEvts->Draw();
10483       }
10484 
10485       Double_t x_low = fCnaParHistos->BoxLeftX("bottom_left_box") - 0.005;
10486       Double_t x_up = fCnaParHistos->BoxRightX("bottom_right_box") + 0.005;
10487       Double_t y_low = fCnaParHistos->BoxTopY("bottom_right_box") + 0.005;
10488       Double_t y_up = fCnaParHistos->BoxBottomY("top_right_box_EB") - 0.005;
10489       Color_t fond_pad = fCnaParHistos->ColorDefinition("blanc");
10490 
10491       Double_t x_margin = x_low;
10492       Double_t y_margin = y_low;
10493       MainCanvas->Divide(1, 1, x_margin, y_margin, fond_pad);
10494       //           Divide(nx, ny, x_margin, y_margin,    color);
10495 
10496       gPad->cd(1);
10497       main_subpad = gPad;
10498       main_subpad->SetPad(x_low, y_low, x_up, y_up);
10499 
10500       xMemoPlotSame = 0;
10501     }
10502     if (arg_AlreadyRead > 1) {
10503       main_subpad = fCurrentPad;
10504     }
10505 
10506   }  // end of if(opt_plot == fOnlyOnePlot && (arg_AlreadyRead == 0 || arg_AlreadyRead == 1 ) )
10507 
10508   //========================================= Options SAME and SAME n  (HistoPlot)
10509   if ((opt_plot == fSeveralPlot) || (opt_plot == fSameOnePlot)) {
10510     //..................... First call in options SAME and SAME n
10511     if (GetMemoFlag(HistoCode, opt_plot) == "Free") {
10512       //Call to SetParametersPavTxt
10513       //fPavTxt<HISTOCODE> = fPavComSeveralChanging;  => come from SetAllPavesViewHisto
10514       SetParametersPavTxt(HistoCode, opt_plot);
10515 
10516       //---------------- Call to ActivePavTxt
10517       // main_pavtxt = fPavTxt<HISTOCODE>;} (return main_pavtxt)
10518       main_pavtxt = ActivePavTxt(HistoCode.Data(), opt_plot.Data());
10519 
10520       //---------------------------- Set texts for pave "several changing", options SAME and SAME n
10521       if (fPavComGeneralTitle != nullptr) {
10522         fPavComGeneralTitle->Draw();
10523       }
10524 
10525       main_pavtxt->SetTextAlign(fTextPaveAlign);
10526       main_pavtxt->SetTextFont(fTextPaveFont);
10527       main_pavtxt->SetBorderSize(fTextBorderSize);
10528       Float_t cTextPaveSize = 0.025;
10529       if (HistoType == "H1Basic" || HistoType == "SampProj" || HistoType == "H1BasicProj" || HistoType == "Proj" ||
10530           HistoType == "EvolProj") {
10531         cTextPaveSize = 0.025;
10532       }
10533       main_pavtxt->SetTextSize(cTextPaveSize);
10534 
10535       char f_in[charArrLen];
10536 
10537       //------------------------------------------------------------ titles pave "several" (HistoPlot)
10538       TString DecalStexName = "";
10539       if (fFlagSubDet == "EB") {
10540         DecalStexName = " ";
10541       }
10542       TString DecalStinName = "";
10543       if (fFlagSubDet == "EE") {
10544         DecalStinName = "   ";
10545       }
10546 
10547       TString sStexOrStasName = "";
10548       if (fFapStexNumber == 0) {
10549         sStexOrStasName = "  ";
10550       }
10551       if (fFapStexNumber != 0) {
10552         sStexOrStasName = fFapStexName;
10553       }
10554 
10555       if (opt_plot == fSeveralPlot || opt_plot == fSameOnePlot) {
10556         if (HistoType == "SampGlobal") {
10557           sprintf(f_in,
10558                   "Analysis   Samp   RUN# (run type            )  Evts range  Nb Evts   %s%s %s%s %s %s Sample",
10559                   DecalStexName.Data(),
10560                   sStexOrStasName.Data(),
10561                   DecalStinName.Data(),
10562                   fFapStinName.Data(),
10563                   fFapXtalName.Data(),
10564                   fFapEchaName.Data());
10565         }
10566         if (HistoType == "SampProj") {
10567           sprintf(f_in,
10568                   "Analysis   Samp   RUN# (run type            )  Evts range  Nb Evts   %s%s %s%s %s %s Sample",
10569                   DecalStexName.Data(),
10570                   sStexOrStasName.Data(),
10571                   DecalStinName.Data(),
10572                   fFapStinName.Data(),
10573                   fFapXtalName.Data(),
10574                   fFapEchaName.Data());
10575         }
10576         if (HistoType == "H1Basic" || HistoType == "H1BasicProj") {
10577           sprintf(f_in,
10578                   "Analysis   Samp   RUN# (run type            )  Evts range  Nb Evts   %s%s %s%s %s %s",
10579                   DecalStexName.Data(),
10580                   sStexOrStasName.Data(),
10581                   DecalStinName.Data(),
10582                   fFapStinName.Data(),
10583                   fFapXtalName.Data(),
10584                   fFapEchaName.Data());
10585         }
10586         if ((HistoType == "Global") || (HistoType == "Proj")) {
10587           sprintf(f_in,
10588                   "Analysis   Samp   RUN# (run type            )  Evts range  Nb Evts   %s%s",
10589                   DecalStexName.Data(),
10590                   sStexOrStasName.Data());
10591         }
10592 
10593         if (HistoType == "EvolProj") {
10594           sprintf(f_in,
10595                   "Analysis   Samp   Evts range  Nb Evts   %s%s  %s%s %s %s",
10596                   DecalStexName.Data(),
10597                   sStexOrStasName.Data(),
10598                   DecalStinName.Data(),
10599                   fFapStinName.Data(),
10600                   fFapXtalName.Data(),
10601                   fFapEchaName.Data());
10602         }
10603       }
10604 
10605       TText* ttit = main_pavtxt->AddText(f_in);
10606       ttit->SetTextColor(fCnaParHistos->ColorDefinition("noir"));
10607 
10608       //------------------------------------------------------------ values pave "several"  (HistoPlot)
10609 
10610       //.................................... option SAME n only  (HistoPlot)
10611       if (opt_plot == fSameOnePlot) {
10612         if ((HistoType == "Global") || (HistoType == "Proj") || (HistoType == "H1BasicProj")) {
10613           sprintf(f_in,
10614                   "%-10s 1-%2d%7d (%-20s) %5d-%5d  %7d  %4s %-25s",
10615                   fFapAnaType.Data(),
10616                   fFapNbOfSamples,
10617                   fFapRunNumber,
10618                   fRunType.Data(),
10619                   fFapFirstReqEvtNumber,
10620                   fFapLastReqEvtNumber,
10621                   fFapReqNbOfEvts,
10622                   sFapStexNumber.Data(),
10623                   QuantityName.Data());
10624         }
10625 
10626         if (HistoType == "EvolProj") {
10627           sprintf(f_in,
10628                   "%-10s 1-%2d %5d-%5d  %7d %5s%6d%7d%7d %-25s",
10629                   fFapAnaType.Data(),
10630                   fFapNbOfSamples,
10631                   fFapFirstReqEvtNumber,
10632                   fFapLastReqEvtNumber,
10633                   fFapReqNbOfEvts,
10634                   sFapStexNumber.Data(),
10635                   Stex_StinCons,
10636                   n1StexCrys,
10637                   i0StinEcha,
10638                   QuantityName.Data());
10639         }
10640 
10641       }  // end of if for option SAME n only
10642 
10643       //..................................... option SAME (HistoPlot)
10644       if (opt_plot == fSeveralPlot) {
10645         Int_t kSample = i0Sample + 1;  // Sample number range = [1,n<=10]
10646 
10647         if (HistoType == "SampGlobal") {
10648           sprintf(f_in,
10649                   "%-10s 1-%2d%7d (%-20s) %5d-%5d  %7d  %4s%6d%5d%5d%6d",
10650                   fFapAnaType.Data(),
10651                   fFapNbOfSamples,
10652                   fFapRunNumber,
10653                   fRunType.Data(),
10654                   fFapFirstReqEvtNumber,
10655                   fFapLastReqEvtNumber,
10656                   fFapReqNbOfEvts,
10657                   sFapStexNumber.Data(),
10658                   Stex_StinCons,
10659                   n1StexCrys,
10660                   i0StinEcha,
10661                   kSample);
10662         }
10663         if (HistoType == "SampProj") {
10664           sprintf(f_in,
10665                   "%-10s 1-%2d%7d (%-20s) %5d-%5d  %7d  %4s%6d%5d%5d%6d",
10666                   fFapAnaType.Data(),
10667                   fFapNbOfSamples,
10668                   fFapRunNumber,
10669                   fRunType.Data(),
10670                   fFapFirstReqEvtNumber,
10671                   fFapLastReqEvtNumber,
10672                   fFapReqNbOfEvts,
10673                   sFapStexNumber.Data(),
10674                   Stex_StinCons,
10675                   n1StexCrys,
10676                   i0StinEcha,
10677                   kSample);
10678         }
10679         if (HistoType == "H1Basic" || HistoType == "H1BasicProj") {
10680           sprintf(f_in,
10681                   "%-10s 1-%2d%7d (%-20s) %5d-%5d  %7d  %4s%6d%5d%5d",
10682                   fFapAnaType.Data(),
10683                   fFapNbOfSamples,
10684                   fFapRunNumber,
10685                   fRunType.Data(),
10686                   fFapFirstReqEvtNumber,
10687                   fFapLastReqEvtNumber,
10688                   fFapReqNbOfEvts,
10689                   sFapStexNumber.Data(),
10690                   Stex_StinCons,
10691                   n1StexCrys,
10692                   i0StinEcha);
10693         }
10694         if ((HistoType == "Global") || (HistoType == "Proj")) {
10695           sprintf(f_in,
10696                   "%-10s 1-%2d%7d (%-20s) %5d-%5d  %7d  %4s",
10697                   fFapAnaType.Data(),
10698                   fFapNbOfSamples,
10699                   fFapRunNumber,
10700                   fRunType.Data(),
10701                   fFapFirstReqEvtNumber,
10702                   fFapLastReqEvtNumber,
10703                   fFapReqNbOfEvts,
10704                   sFapStexNumber.Data());
10705         }
10706 
10707         if (HistoType == "EvolProj") {
10708           sprintf(f_in,
10709                   "%-10s 1-%2d  %5d-%5d  %7d  %4s%7d%5d%5d",
10710                   fFapAnaType.Data(),
10711                   fFapNbOfSamples,
10712                   fFapFirstReqEvtNumber,
10713                   fFapLastReqEvtNumber,
10714                   fFapReqNbOfEvts,
10715                   sFapStexNumber.Data(),
10716                   Stex_StinCons,
10717                   n1StexCrys,
10718                   i0StinEcha);
10719         }
10720       }
10721 
10722       TText* tt = main_pavtxt->AddText(f_in);
10723       tt->SetTextColor(GetViewHistoColor(HistoCode, opt_plot));
10724 
10725       //---------------- Draw the "several changing" pave with its text in the Canvas (AT FIRST TIME)
10726       main_pavtxt->Draw();
10727       //---------------- Draw evol run pave if "EvolProj" (AT FIRST TIME)
10728       if (HistoType == "EvolProj") {
10729         fPavComEvolRuns->Draw();
10730       }
10731 
10732       //---------------- Call to SetParametersCanvas
10733       //fImp<HISTOCODE> = (TCanvasImp*)fCanv<HISTOCODE>->GetCanvasImp();
10734       //fCanv<HISTOCODE>->Divide(1, 1, x_margin_factor , y_margin_factor); gPad->cd(1);
10735       //fPad<HISTOCODE> = gPad;
10736       //fMemoPlot<HISTOCODE> = 1;          =======>  set MemoFlag to "Buzy"
10737       //fMemoColor<HISTOCODE> = 0;
10738       SetParametersCanvas(HistoCode, opt_plot);
10739 
10740       //---------------- Set xMemoPlotSame to 0
10741       xMemoPlotSame = 0;
10742     }  // end of if( GetMemoFlag(HistoCode, opt_plot) == "Free" )    (HistoPlot)
10743 
10744     //.......... First and further calls in options SAME and SAME n (fMemoPlot<HISTOCODE> = 1)
10745     if (GetMemoFlag(HistoCode, opt_plot) == "Busy") {
10746       //---------------- Call to ActivePavTxt
10747       // main_pavtxt = fPavTxt<HISTOCODE>;} (return main_pavtxt)
10748       main_pavtxt = ActivePavTxt(HistoCode.Data(), opt_plot.Data());
10749 
10750       //---------------- Call to ActivePad
10751       main_subpad = ActivePad(HistoCode.Data(), opt_plot.Data());  // => return 0 if canvas has been closed
10752 
10753       //---------------- Recover pointer to the current canvas
10754       MainCanvas = GetCurrentCanvas(HistoCode.Data(), opt_plot.Data());
10755     }
10756   }  // end of if( (opt_plot == fSeveralPlot) || (opt_plot == fSameOnePlot) )
10757 
10758   //============================================================================= (HistoPlot)
10759   //
10760   //     2nd  OPERATIONS: Write and Draw the parameter values in the
10761   //                      "several changing" pave (options SAME and SAME n)
10762   //                      and Draw Histo
10763   //=============================================================================
10764   if (main_subpad != nullptr) {
10765     if ((opt_plot == fSeveralPlot) || (opt_plot == fSameOnePlot)) {
10766       //------------------------------------------------------------ values
10767       if (xMemoPlotSame != 0) {
10768         // main_pavtxt = fPavComSeveralChanging = fPavTxt<HISTOCODE>
10769         main_pavtxt->SetTextAlign(fTextPaveAlign);
10770         main_pavtxt->SetTextFont(fTextPaveFont);
10771         main_pavtxt->SetBorderSize(fTextBorderSize);
10772         Float_t cTextPaveSize = 0.025;
10773         if (HistoType == "H1Basic" || HistoType == "SampProj" || HistoType == "Proj" || HistoType == "EvolProj" ||
10774             HistoType == "H1BasicProj") {
10775           cTextPaveSize = 0.025;
10776         }
10777         main_pavtxt->SetTextSize(cTextPaveSize);
10778 
10779         char f_in[charArrLen];
10780 
10781         if (opt_plot == fSameOnePlot) {
10782           if ((HistoType == "Global") || (HistoType == "Proj")) {
10783             sprintf(f_in,
10784                     "%-10s 1-%2d%7d (%-20s) %5d-%5d  %7d  %4s %-25s",
10785                     fFapAnaType.Data(),
10786                     fFapNbOfSamples,
10787                     fFapRunNumber,
10788                     fRunType.Data(),
10789                     fFapFirstReqEvtNumber,
10790                     fFapLastReqEvtNumber,
10791                     fFapReqNbOfEvts,
10792                     sFapStexNumber.Data(),
10793                     QuantityName.Data());
10794           }
10795 
10796           if (HistoType == "EvolProj") {
10797             sprintf(f_in,
10798                     "%-10s 1-%2d %5d-%5d  %7d %5s%6d%7d%7d %-25s",
10799                     fFapAnaType.Data(),
10800                     fFapNbOfSamples,
10801                     fFapFirstReqEvtNumber,
10802                     fFapLastReqEvtNumber,
10803                     fFapReqNbOfEvts,
10804                     sFapStexNumber.Data(),
10805                     Stex_StinCons,
10806                     n1StexCrys,
10807                     i0StinEcha,
10808                     QuantityName.Data());
10809           }
10810         }
10811 
10812         if (opt_plot == fOnlyOnePlot || opt_plot == fSeveralPlot) {
10813           Int_t kSample = i0Sample + 1;  // Sample number range = [1,n<=10] (HistoPlot)
10814 
10815           if (HistoType == "SampGlobal") {
10816             sprintf(f_in,
10817                     "%-10s 1-%2d%7d (%-20s) %5d-%5d  %7d  %4s%6d%5d%5d%6d",
10818                     fFapAnaType.Data(),
10819                     fFapNbOfSamples,
10820                     fFapRunNumber,
10821                     fRunType.Data(),
10822                     fFapFirstReqEvtNumber,
10823                     fFapLastReqEvtNumber,
10824                     fFapReqNbOfEvts,
10825                     sFapStexNumber.Data(),
10826                     Stex_StinCons,
10827                     n1StexCrys,
10828                     i0StinEcha,
10829                     kSample);
10830           }
10831           if (HistoType == "SampProj") {
10832             sprintf(f_in,
10833                     "%-10s 1-%2d%7d (%-20s) %5d-%5d  %7d  %4s%6d%5d%5d%6d",
10834                     fFapAnaType.Data(),
10835                     fFapNbOfSamples,
10836                     fFapRunNumber,
10837                     fRunType.Data(),
10838                     fFapFirstReqEvtNumber,
10839                     fFapLastReqEvtNumber,
10840                     fFapReqNbOfEvts,
10841                     sFapStexNumber.Data(),
10842                     Stex_StinCons,
10843                     n1StexCrys,
10844                     i0StinEcha,
10845                     kSample);
10846           }
10847           if (HistoType == "H1Basic" || HistoType == "H1BasicProj") {
10848             sprintf(f_in,
10849                     "%-10s 1-%2d%7d (%-20s) %5d-%5d  %7d  %4s%6d%5d%5d",
10850                     fFapAnaType.Data(),
10851                     fFapNbOfSamples,
10852                     fFapRunNumber,
10853                     fRunType.Data(),
10854                     fFapFirstReqEvtNumber,
10855                     fFapLastReqEvtNumber,
10856                     fFapReqNbOfEvts,
10857                     sFapStexNumber.Data(),
10858                     Stex_StinCons,
10859                     n1StexCrys,
10860                     i0StinEcha);
10861           }
10862           if ((HistoType == "Global") || (HistoType == "Proj")) {
10863             sprintf(f_in,
10864                     "%-10s 1-%2d%7d (%-20s) %5d-%5d  %7d  %4s",
10865                     fFapAnaType.Data(),
10866                     fFapNbOfSamples,
10867                     fFapRunNumber,
10868                     fRunType.Data(),
10869                     fFapFirstReqEvtNumber,
10870                     fFapLastReqEvtNumber,
10871                     fFapReqNbOfEvts,
10872                     sFapStexNumber.Data());
10873           }
10874 
10875           if (HistoType == "EvolProj") {
10876             sprintf(f_in,
10877                     "%-10s 1-%2d  %5d-%5d  %7d  %4s%7d%5d%5d",
10878                     fFapAnaType.Data(),
10879                     fFapNbOfSamples,
10880                     fFapFirstReqEvtNumber,
10881                     fFapLastReqEvtNumber,
10882                     fFapReqNbOfEvts,
10883                     sFapStexNumber.Data(),
10884                     Stex_StinCons,
10885                     n1StexCrys,
10886                     i0StinEcha);
10887           }
10888         }
10889 
10890         TText* tt = main_pavtxt->AddText(f_in);
10891         tt->SetTextColor(GetViewHistoColor(HistoCode, opt_plot));
10892         MainCanvas->cd();
10893         gStyle->SetOptDate(0);
10894         main_pavtxt->Draw();
10895       }
10896 
10897       main_subpad->cd();
10898       Double_t x_low = fCnaParHistos->BoxLeftX("bottom_left_box") - 0.005;
10899       Double_t x_up = fCnaParHistos->BoxRightX("bottom_right_box") + 0.005;
10900       Double_t y_low = fCnaParHistos->BoxTopY("several_plots_box") + 0.005;
10901       Double_t y_up = fCnaParHistos->BoxBottomY("general_comment") - 0.005;
10902       if (opt_plot == fSameOnePlot && HistoType == "EvolProj") {
10903         y_up = fCnaParHistos->BoxBottomY("top_left_box_EB") - 0.005;
10904       }
10905       main_subpad->SetPad(x_low, y_low, x_up, y_up);
10906     }  // end of if( (opt_plot == fSeveralPlot) || (opt_plot == fSameOnePlot) )
10907 
10908     //............................................ Style    (HistoPlot)
10909     SetViewHistoColors(h_his0, HistoCode.Data(), opt_plot, arg_AlreadyRead);
10910 
10911     //................................. Set axis titles
10912     TString axis_x_var_name = SetHistoXAxisTitle(HistoCode);
10913     TString axis_y_var_name = SetHistoYAxisTitle(HistoCode);
10914     h_his0->GetXaxis()->SetTitle(axis_x_var_name);
10915     h_his0->GetYaxis()->SetTitle(axis_y_var_name);
10916 
10917     Int_t lin_scale = 0;
10918     Int_t log_scale = 1;
10919 
10920     if (opt_scale_x == fOptScaleLinx) {
10921       gPad->SetLogx(lin_scale);
10922     }
10923     if (opt_scale_x == fOptScaleLogx) {
10924       gPad->SetLogx(log_scale);
10925     }
10926     if (opt_scale_y == fOptScaleLiny) {
10927       gPad->SetLogy(lin_scale);
10928     }
10929     if (opt_scale_y == fOptScaleLogy) {
10930       gPad->SetLogy(log_scale);
10931     }
10932 
10933     //---------------------------------------------------------------- Draw histo   (HistoPlot)
10934     if (opt_plot == fOnlyOnePlot && arg_AlreadyRead == 0) {
10935       h_his0->DrawCopy();
10936     }
10937     if (opt_plot == fOnlyOnePlot && arg_AlreadyRead == 1) {
10938       h_his0->DrawCopy();
10939     }
10940     if (opt_plot == fOnlyOnePlot && arg_AlreadyRead > 1) {
10941       h_his0->DrawCopy("AHSAME");
10942     }
10943 
10944     if (opt_plot == fSeveralPlot || opt_plot == fSameOnePlot) {
10945       if (xMemoPlotSame == 0) {
10946         h_his0->DrawCopy();
10947       }
10948       if (xMemoPlotSame != 0) {
10949         h_his0->DrawCopy("SAME");
10950       }
10951     }
10952     //----------------------------------------------------------------
10953 
10954     //.................... Horizontal line at y=0   (HistoPlot)
10955     if (!(HistoCode == "D_Adc_EvDs" || HistoCode == "D_Adc_EvNb" || HistoType == "Proj" || HistoType == "SampProj" ||
10956           HistoType == "EvolProj" || HistoType == "H1BasicProj") &&
10957         !(HistoType == "H1Basic" && arg_AlreadyRead == 0)) {
10958       Double_t yinf = h_his0->GetMinimum();
10959       Double_t ysup = h_his0->GetMaximum();
10960       if (yinf <= (Double_t)0. && ysup >= (Double_t)0.) {
10961         TLine* lin = new TLine(0., 0., (Double_t)HisSize, 0.);
10962         fCnewRoot++;
10963         lin->Draw();
10964       }
10965     }
10966 
10967     if ((opt_plot == fOnlyOnePlot) || ((opt_plot == fSeveralPlot || opt_plot == fSameOnePlot) && xMemoPlotSame == 0)) {
10968       Double_t yinf = (Double_t)h_his0->GetMinimum();
10969       Double_t ysup = (Double_t)h_his0->GetMaximum();
10970 
10971       if (xFlagAutoYsupMargin == 1) {
10972         if (yinf >= ysup) {
10973           yinf = (Double_t)0.;
10974           ysup += ysup;
10975         }                                           // ROOT default if ymin >= ymax
10976         Double_t MaxMarginFactor = (Double_t)0.05;  // frame top line = 5% above the maximum
10977         ysup += (ysup - yinf) * MaxMarginFactor;    // ROOT default if ymin < ymax
10978       }
10979 
10980       char f_in[charArrLen];
10981 
10982       //.................... Vertical lines for Data sectors (EE Global plot only)
10983       if (fFlagSubDet == "EE" && fFapStexNumber == 0) {
10984         //............................................................. Data Sectors    (HistoPlot)
10985         Color_t coul_DS = fCnaParHistos->ColorDefinition("noir");
10986         Int_t DeeOffset = 0;
10987         for (Int_t n1Dee = 1; n1Dee <= 4; n1Dee++) {
10988           if (n1Dee == 4) {
10989             DeeOffset = 0;
10990           }
10991           if (n1Dee == 3) {
10992             DeeOffset = fEcal->MaxSCForConsInDee();
10993           }  // 149
10994           if (n1Dee == 2) {
10995             DeeOffset = 2 * fEcal->MaxSCForConsInDee();
10996           }  // 446
10997           if (n1Dee == 1) {
10998             DeeOffset = 3 * fEcal->MaxSCForConsInDee();
10999           }  // 595
11000 
11001           Double_t ydee = ysup + (ysup - yinf) / (Double_t)15.;
11002           Double_t xBinDee = DeeOffset + fEcal->MaxSCForConsInDee() / (Double_t)2.;
11003           sprintf(f_in, "D%d", n1Dee);
11004           TText* text_Dee = new TText(xBinDee, ydee, f_in);
11005           fCnewRoot++;
11006           text_Dee->SetTextColor(coul_DS);
11007           text_Dee->SetTextSize((Double_t)0.04);
11008           text_Dee->Draw("SAME");
11009 
11010           Double_t DSLabelOffset = (Double_t)12;
11011 
11012           for (Int_t i = 1; i < 5; i++) {
11013             Int_t iDS = 0;
11014             if (n1Dee == 1) {
11015               iDS = i;
11016             }
11017             if (n1Dee == 2) {
11018               iDS = i + 4;
11019             }
11020             if (n1Dee == 3) {
11021               iDS = i + 5;
11022             }
11023             if (n1Dee == 4) {
11024               iDS = i + 1;
11025             }
11026 
11027             Double_t xBinDS = DeeOffset + (Double_t)GetDSOffset(n1Dee, iDS) / fEcal->MaxCrysInSC();
11028             TLine* lin_DS = new TLine(xBinDS, yinf, xBinDS, ysup);
11029             fCnewRoot++;
11030             lin_DS->SetLineColor(coul_DS);
11031             lin_DS->SetLineWidth(1);
11032             lin_DS->SetLineStyle(2);
11033             lin_DS->Draw();
11034 
11035             if (n1Dee == 2 && i == 4) {
11036               TLine* lin_DSp = new TLine(DeeOffset, yinf, DeeOffset, ysup);
11037               fCnewRoot++;
11038               lin_DSp->SetLineColor(coul_DS);
11039               lin_DSp->SetLineWidth(1);
11040               lin_DSp->SetLineStyle(2);
11041               lin_DSp->Draw();
11042             }
11043 
11044             Double_t yds = ysup + (ysup - yinf) / (Double_t)50.;
11045             Double_t xBinDSp = xBinDS + DSLabelOffset;
11046             Int_t nDS = iDS;
11047 
11048             sprintf(f_in, "S%d", nDS);
11049             TText* text_DS = new TText(xBinDSp, yds, f_in);
11050             fCnewRoot++;
11051             text_DS->SetTextColor(coul_DS);
11052             text_DS->SetTextSize((Double_t)0.03);
11053             text_DS->Draw("SAME");
11054             if ((n1Dee == 4 && i == 1) || (n1Dee == 2 && i == 4)) {
11055               if (n1Dee == 4) {
11056                 nDS = iDS - 1;
11057               }
11058               if (n1Dee == 2) {
11059                 nDS = iDS + 1;
11060               }
11061               sprintf(f_in, "S%d", nDS);
11062               TText* text_DS = new TText(xBinDS - 1.75 * DSLabelOffset, yds, f_in);
11063               fCnewRoot++;
11064               text_DS->SetTextColor(coul_DS);
11065               text_DS->SetTextSize((Double_t)0.03);
11066               text_DS->Draw("SAME");
11067             }
11068           }
11069         }
11070       }
11071 
11072       //........... Vertical lines for Data sectors and special SC's (EE only, Dee's Global plots)  (HistoPlot)
11073       if (fFlagSubDet == "EE" && fFapStexNumber > 0) {
11074         if (HistoType == "Global") {
11075           Double_t ytext = yinf - (ysup - yinf) / 8.5;
11076           //............................................................. Data Sectors
11077           Color_t coul_DS = fCnaParHistos->ColorDefinition("noir");
11078           for (Int_t i = 1; i < 5; i++) {
11079             Int_t iDS = 0;
11080             if (fFapStexNumber == 1) {
11081               iDS = i;
11082             }
11083             if (fFapStexNumber == 2) {
11084               iDS = i + 4;
11085             }
11086             if (fFapStexNumber == 3) {
11087               iDS = i + 5;
11088             }
11089             if (fFapStexNumber == 4) {
11090               iDS = i + 1;
11091             }
11092 
11093             Double_t xBinDS = (Double_t)GetDSOffset(fFapStexNumber, iDS);
11094             TLine* lin_DS = new TLine(xBinDS, yinf, xBinDS, ysup);
11095             fCnewRoot++;
11096             lin_DS->SetLineColor(coul_DS);
11097             lin_DS->SetLineWidth(2);
11098             lin_DS->SetLineStyle(2);
11099             lin_DS->Draw();
11100             Double_t ytextds = ysup + (ysup - yinf) / 30.;
11101             Double_t xBinDSNumber = xBinDS + fEcalNumbering->GetMaxSCInDS(iDS) * fEcal->MaxCrysInSC() / (Double_t)2.25;
11102             sprintf(f_in, "S%d", iDS);
11103             TText* text_DS = new TText(xBinDSNumber, ytextds, f_in);
11104             fCnewRoot++;
11105             text_DS->SetTextColor(coul_DS);
11106             text_DS->SetTextSize((Double_t)0.04);
11107             text_DS->Draw("SAME");
11108             if (((fFapStexNumber == 1 || fFapStexNumber == 2) && i == 4) ||
11109                 ((fFapStexNumber == 3 || fFapStexNumber == 4) && i == 1)) {
11110               Int_t iDSp = iDS;
11111               if (i == 4) {
11112                 iDSp = iDS + 1;
11113               }
11114               if (i == 1) {
11115                 iDSp = iDS - 1;
11116               }
11117               sprintf(f_in, "S%d", iDSp);
11118               Double_t xBinpDSNumber = xBinDSNumber - fEcalNumbering->GetMaxSCInDS(iDS) * fEcal->MaxCrysInSC();
11119               TText* text_DSp = new TText(xBinpDSNumber, ytextds, f_in);
11120               fCnewRoot++;
11121               text_DSp->SetTextColor(coul_DS);
11122               text_DSp->SetTextSize((Double_t)0.04);
11123               text_DSp->Draw("SAME");
11124             }
11125           }
11126           //.............................................................. Vertical lines for SC's
11127           //                                                       Trop serre. A garder en reserve.
11128           //for(Int_t i=0; i<fEcal->MaxSCForConsInDee(); i++)
11129           //  {
11130           //    Double_t xBinSC =(Double_t)(fEcal->MaxCrysInSC()*i);
11131           //    TLine* lin_SC = new TLine(xBinSC, yinf, xBinSC, ysup);  fCnewRoot++;
11132           //    lin_SC->SetLineColor(coul_DS);
11133           //    lin_SC->SetLineStyle(3);
11134           //    lin_SC->Draw();
11135           //  }
11136           //............................................................... Not connected SC's
11137           Color_t coul_notconnected = fCnaParHistos->ColorDefinition("bleu_fonce");
11138           for (Int_t i = 1; i <= fEcal->NumberOfNotConnectedSCs(); i++) {
11139             Int_t index = 0;
11140             if (fFapStexNumber == 1 || fFapStexNumber == 3) {
11141               index = 2 * i - 1;
11142             }
11143             if (fFapStexNumber == 2 || fFapStexNumber == 4) {
11144               index = 2 * i;
11145             }
11146             //................. display of the not connected SC's numbers (+ vertical line)
11147             Double_t xBinNotConnectedSC = NotConnectedSCH1DBin(index);
11148             TLine* lin_notconnected = new TLine(xBinNotConnectedSC, yinf, xBinNotConnectedSC, ysup);
11149             fCnewRoot++;
11150             lin_notconnected->SetLineColor(coul_notconnected);
11151             lin_notconnected->SetLineStyle(3);
11152             lin_notconnected->Draw();
11153 
11154             Double_t xBinNotConnectedSCEnd = NotConnectedSCH1DBin(index) + fEcal->MaxCrysInSC();
11155             TLine* lin_notconnected_end = new TLine(xBinNotConnectedSCEnd, yinf, xBinNotConnectedSCEnd, ysup);
11156             fCnewRoot++;
11157             lin_notconnected_end->SetLineColor(coul_notconnected);
11158             lin_notconnected_end->SetLineStyle(3);
11159             lin_notconnected_end->Draw();
11160 
11161             //sprintf( f_in, "%d", GetNotConnectedSCForConsFromIndex(index) );
11162             sprintf(f_in, "%d", GetNotConnectedDSSCFromIndex(index));
11163             TText* text_SC_NotConnected = new TText(xBinNotConnectedSC, ytext, f_in);
11164             fCnewRoot++;
11165             text_SC_NotConnected->SetTextAngle((Double_t)45.);
11166             text_SC_NotConnected->SetTextColor(coul_notconnected);
11167             text_SC_NotConnected->SetTextFont(42);
11168             text_SC_NotConnected->SetTextSize((Double_t)0.03);
11169             text_SC_NotConnected->Draw("SAME");
11170           }
11171           //Double_t xtext = xinf_his - (xsup_his-xinf_his)/8.;
11172           //Double_t ytextp = yinf - (ysup-yinf)/6.;
11173           //sprintf( f_in, "Special SC => ");
11174           //TText *text_legend_NotConnected = new TText(xtext, ytext, f_in);  fCnewRoot++;
11175           //text_legend_NotConnected->SetTextColor(coul_notconnected);
11176           //text_legend_NotConnected->SetTextSize((Double_t)0.03);
11177           //text_legend_NotConnected->Draw("SAME");
11178 
11179           //............................................................... Not complete SC's
11180           Color_t coul_notcomplete = fCnaParHistos->ColorDefinition("rouge40");
11181           for (Int_t i = 1; i <= fEcal->NumberOfNotCompleteSCs(); i++) {
11182             Int_t index = 0;
11183             if (fFapStexNumber == 1 || fFapStexNumber == 3) {
11184               index = 2 * i - 1;
11185             }
11186             if (fFapStexNumber == 2 || fFapStexNumber == 4) {
11187               index = 2 * i;
11188             }
11189             //................. display of the not complete SC's numbers (+ vertical line)
11190             Double_t xBinNotCompleteSC = NotCompleteSCH1DBin(index);
11191             TLine* lin_notcomplete = new TLine(xBinNotCompleteSC, yinf, xBinNotCompleteSC, ysup);
11192             fCnewRoot++;
11193             lin_notcomplete->SetLineColor(coul_notcomplete);
11194             lin_notcomplete->SetLineStyle(3);
11195             lin_notcomplete->Draw();
11196 
11197             Double_t xBinNotCompleteSCEnd = NotCompleteSCH1DBin(index) + fEcal->MaxCrysInSC();
11198             ;
11199             TLine* lin_notcomplete_end = new TLine(xBinNotCompleteSCEnd, yinf, xBinNotCompleteSCEnd, ysup);
11200             fCnewRoot++;
11201             lin_notcomplete_end->SetLineColor(coul_notcomplete);
11202             lin_notcomplete_end->SetLineStyle(3);
11203             lin_notcomplete_end->Draw();
11204 
11205             sprintf(f_in, "%d", GetNotCompleteDSSCFromIndex(index));
11206             // sprintf( f_in, "%d", GetNotCompleteSCForConsFromIndex(index) );
11207             TText* text_SC_NotComplete = new TText(xBinNotCompleteSC, ytext, f_in);
11208             fCnewRoot++;
11209             text_SC_NotComplete->SetTextAngle((Double_t)45.);
11210             text_SC_NotComplete->SetTextColor(coul_notcomplete);
11211             text_SC_NotComplete->SetTextFont(42);
11212             text_SC_NotComplete->SetTextSize((Double_t)0.03);
11213             text_SC_NotComplete->Draw("SAME");
11214           }
11215           //Double_t xtextp = xinf_his + (xsup_his-xinf_his)/15.;
11216           //sprintf( f_in, "Not complete SC");
11217           //TText *text_legend_NotComplete = new TText(xtextp, ytextp, f_in);  fCnewRoot++;
11218           //text_legend_NotComplete->SetTextColor(coul_notcomplete);
11219           //text_legend_NotComplete->SetTextSize((Double_t)0.03);
11220           //text_legend_NotComplete->Draw("SAME");
11221         }
11222       }
11223     }  // end of if( ( opt_plot == fOnlyOnePlot )
11224        // || ( (opt_plot == fSeveralPlot || opt_plot == fSameOnePlot) && xMemoPlotSame == 0 ) )
11225 
11226     //..............................................Top Axis (HistoPlot)
11227     Int_t min_value = 0;
11228     Int_t max_value = 0;
11229     if (HistoType == "Global") {
11230       if (fFapStexNumber > 0) {
11231         //.......................... Axis for the Stin numbers and Data sectors (EE) numbers
11232         if (fFlagSubDet == "EB") {
11233           min_value = 0;
11234           max_value = fEcal->MaxStinEcnaInStex() - 1;
11235         }
11236         if (fFlagSubDet == "EE") {
11237           if (fFapStexNumber == 1) {
11238             min_value = 1;
11239             max_value = 5;
11240           }
11241           if (fFapStexNumber == 2) {
11242             min_value = 5;
11243             max_value = 9;
11244           }
11245           if (fFapStexNumber == 3) {
11246             min_value = 5;
11247             max_value = 9;
11248           }
11249           if (fFapStexNumber == 4) {
11250             min_value = 1;
11251             max_value = 5;
11252           }
11253         }
11254       }
11255       if (fFapStexNumber == 0) {
11256         //.......................... Axis for the SM (EB) and Dee numbers (EE)
11257         if (fFlagSubDet == "EB") {
11258           min_value = 0;
11259           max_value = fEcal->MaxStexInStas() - 1;
11260         }
11261         if (fFlagSubDet == "EE") {
11262           min_value = 1;
11263           max_value = fEcal->MaxStexInStas();
11264         }
11265       }
11266       TopAxisForHistos(h_his0, opt_plot, xMemoPlotSame, min_value, max_value, xFlagAutoYsupMargin, HisSize);
11267     }  // end of if (HistoType == "Global")
11268 
11269     if (!((HistoType == "H1Basic" || HistoType == "H1BasicProj") &&
11270           (arg_AlreadyRead > 1 && arg_AlreadyRead < fEcal->MaxCrysInStin()))) {
11271       gPad->Update();
11272     }
11273   } else  // else du if(main_subpad !=0)
11274   {
11275     std::cout << "*TEcnaHistos::HistoPlot(...)> Canvas not found. Previously closed in option SAME." << fTTBELL
11276               << std::endl;
11277 
11278     ReInitCanvas(HistoCode, opt_plot);
11279   }
11280 
11281   //  delete MainCanvas;                  fCdeleteRoot++;
11282 
11283 }  // end of HistoPlot
11284 
11285 TString TEcnaHistos::StexNumberToString(const Int_t& StexNumber) {
11286   // Convert Int_t StexNumber into TString: "StexNumber" if StexNumber in [-18,36]
11287   // or into TString: "EB" or "EE" if StexNumber = 0.
11288 
11289   TString sFapStexNumber = "?";
11290   if (StexNumber == -1) {
11291     sFapStexNumber = " -1";
11292   }
11293   if (StexNumber == -2) {
11294     sFapStexNumber = " -2";
11295   }
11296   if (StexNumber == -3) {
11297     sFapStexNumber = " -3";
11298   }
11299   if (StexNumber == -4) {
11300     sFapStexNumber = " -4";
11301   }
11302   if (StexNumber == -5) {
11303     sFapStexNumber = " -5";
11304   }
11305   if (StexNumber == -6) {
11306     sFapStexNumber = " -6";
11307   }
11308   if (StexNumber == -7) {
11309     sFapStexNumber = " -7";
11310   }
11311   if (StexNumber == -8) {
11312     sFapStexNumber = " -8";
11313   }
11314   if (StexNumber == -9) {
11315     sFapStexNumber = " -9";
11316   }
11317   if (StexNumber == -10) {
11318     sFapStexNumber = "-10";
11319   }
11320   if (StexNumber == -11) {
11321     sFapStexNumber = "-11";
11322   }
11323   if (StexNumber == -12) {
11324     sFapStexNumber = "-12";
11325   }
11326   if (StexNumber == -13) {
11327     sFapStexNumber = "-13";
11328   }
11329   if (StexNumber == -14) {
11330     sFapStexNumber = "-14";
11331   }
11332   if (StexNumber == -15) {
11333     sFapStexNumber = "-15";
11334   }
11335   if (StexNumber == -16) {
11336     sFapStexNumber = "-16";
11337   }
11338   if (StexNumber == -17) {
11339     sFapStexNumber = "-17";
11340   }
11341   if (StexNumber == -18) {
11342     sFapStexNumber = "-18";
11343   }
11344   if (StexNumber == 0) {
11345     sFapStexNumber = fFlagSubDet;
11346   }
11347   if (StexNumber == 1) {
11348     sFapStexNumber = "  1";
11349   }
11350   if (StexNumber == 2) {
11351     sFapStexNumber = "  2";
11352   }
11353   if (StexNumber == 3) {
11354     sFapStexNumber = "  3";
11355   }
11356   if (StexNumber == 4) {
11357     sFapStexNumber = "  4";
11358   }
11359   if (StexNumber == 5) {
11360     sFapStexNumber = "  5";
11361   }
11362   if (StexNumber == 6) {
11363     sFapStexNumber = "  6";
11364   }
11365   if (StexNumber == 7) {
11366     sFapStexNumber = "  7";
11367   }
11368   if (StexNumber == 8) {
11369     sFapStexNumber = "  8";
11370   }
11371   if (StexNumber == 9) {
11372     sFapStexNumber = "  9";
11373   }
11374   if (StexNumber == 10) {
11375     sFapStexNumber = " 10";
11376   }
11377   if (StexNumber == 11) {
11378     sFapStexNumber = " 11";
11379   }
11380   if (StexNumber == 12) {
11381     sFapStexNumber = " 12";
11382   }
11383   if (StexNumber == 13) {
11384     sFapStexNumber = " 13";
11385   }
11386   if (StexNumber == 14) {
11387     sFapStexNumber = " 14";
11388   }
11389   if (StexNumber == 15) {
11390     sFapStexNumber = " 15";
11391   }
11392   if (StexNumber == 16) {
11393     sFapStexNumber = " 16";
11394   }
11395   if (StexNumber == 17) {
11396     sFapStexNumber = " 17";
11397   }
11398   if (StexNumber == 18) {
11399     sFapStexNumber = " 18";
11400   }
11401   if (StexNumber == 19) {
11402     sFapStexNumber = " -1";
11403   }
11404   if (StexNumber == 20) {
11405     sFapStexNumber = " -2";
11406   }
11407   if (StexNumber == 21) {
11408     sFapStexNumber = " -3";
11409   }
11410   if (StexNumber == 22) {
11411     sFapStexNumber = " -4";
11412   }
11413   if (StexNumber == 23) {
11414     sFapStexNumber = " -5";
11415   }
11416   if (StexNumber == 24) {
11417     sFapStexNumber = " -6";
11418   }
11419   if (StexNumber == 25) {
11420     sFapStexNumber = " -7";
11421   }
11422   if (StexNumber == 26) {
11423     sFapStexNumber = " -8";
11424   }
11425   if (StexNumber == 27) {
11426     sFapStexNumber = " -9";
11427   }
11428   if (StexNumber == 28) {
11429     sFapStexNumber = "-10";
11430   }
11431   if (StexNumber == 29) {
11432     sFapStexNumber = "-11";
11433   }
11434   if (StexNumber == 30) {
11435     sFapStexNumber = "-12";
11436   }
11437   if (StexNumber == 31) {
11438     sFapStexNumber = "-13";
11439   }
11440   if (StexNumber == 32) {
11441     sFapStexNumber = "-14";
11442   }
11443   if (StexNumber == 33) {
11444     sFapStexNumber = "-15";
11445   }
11446   if (StexNumber == 34) {
11447     sFapStexNumber = "-16";
11448   }
11449   if (StexNumber == 35) {
11450     sFapStexNumber = "-17";
11451   }
11452   if (StexNumber == 36) {
11453     sFapStexNumber = "-18";
11454   }
11455   return sFapStexNumber;
11456 }
11457 
11458 Double_t TEcnaHistos::NotConnectedSCH1DBin(const Int_t& index) {
11459   // gives the x coordinate for the i_th NotConnected SC
11460   // GetDSOffset(DeeNumber, DataSector) , GetSCOffset(DeeNumber, DataSector, SC_in_DS)
11461 
11462   Double_t xbin = (Double_t)(-1);
11463 
11464   if (index == 1) {
11465     xbin = GetDSOffset(1, 1) + GetSCOffset(1, 1, 30);
11466   }  // nb_for_cons == 182  (D1,S1) (D3,S9)
11467   if (index == 2) {
11468     xbin = GetDSOffset(2, 9) + GetSCOffset(2, 9, 30);
11469   }  // nb_for_cons ==  33  (D2,S9) (D4,S1)
11470 
11471   if (index == 3) {
11472     xbin = GetDSOffset(1, 2) + GetSCOffset(1, 2, 3);
11473   }  // nb_for_cons == 178  (D1,S2) (D3,S8)
11474   if (index == 4) {
11475     xbin = GetDSOffset(2, 8) + GetSCOffset(2, 8, 3);
11476   }  // nb_for_cons ==  29  (D2,S8) (D4,S2)
11477 
11478   if (index == 5) {
11479     xbin = GetDSOffset(1, 2) + GetSCOffset(1, 2, 25);
11480   }  // nb_for_cons == 207  (D1,S2) (D3,S8)
11481   if (index == 6) {
11482     xbin = GetDSOffset(2, 8) + GetSCOffset(2, 8, 25);
11483   }  // nb_for_cons ==  58  (D2,S8) (D4,S2)
11484 
11485   if (index == 7) {
11486     xbin = GetDSOffset(1, 3) + GetSCOffset(1, 3, 34);
11487   }  // nb_for_cons == 298  (D1,S3) (D3,S7)
11488   if (index == 8) {
11489     xbin = GetDSOffset(2, 7) + GetSCOffset(2, 7, 34);
11490   }  // nb_for_cons == 149  (D2,S7) (D4,S3)
11491 
11492   if (index == 9) {
11493     xbin = GetDSOffset(1, 4) + GetSCOffset(1, 4, 14);
11494   }  // nb_for_cons == 261  (D1,S4) (D3,S6)
11495   if (index == 10) {
11496     xbin = GetDSOffset(2, 6) + GetSCOffset(2, 6, 14);
11497   }  // nb_for_cons == 112  (D2,S6) (D4,S4)
11498   if (index == 11) {
11499     xbin = GetDSOffset(1, 4) + GetSCOffset(1, 4, 21);
11500   }  // nb_for_cons == 268  (D1,S4) (D3,S6)
11501   if (index == 12) {
11502     xbin = GetDSOffset(2, 6) + GetSCOffset(2, 6, 21);
11503   }  // nb_for_cons == 119  (D2,S6) (D4,S4)
11504 
11505   if (index == 13) {
11506     xbin = GetDSOffset(1, 5) + GetSCOffset(1, 5, 20);
11507   }  // nb_for_cons == 281  (D1,S5) (D3,S5)
11508   if (index == 14) {
11509     xbin = GetDSOffset(2, 5) + GetSCOffset(2, 5, 3);
11510   }  // nb_for_cons == 132  (D2,S5) (D4,S5)
11511 
11512   return xbin;
11513 }
11514 
11515 Double_t TEcnaHistos::NotCompleteSCH1DBin(const Int_t& index) {
11516   // gives the x coordinate for the i_th NotConnected SC
11517 
11518   Double_t xbin = (Double_t)(-1);
11519 
11520   if (index == 1) {
11521     xbin = GetDSOffset(1, 1) + GetSCOffset(1, 1, 12);
11522   }  // nb_for_cons == 161  (D1,S1) (D3,S9)
11523   if (index == 2) {
11524     xbin = GetDSOffset(2, 9) + GetSCOffset(2, 9, 12);
11525   }  // nb_for_cons ==  12  (D2,S9) (D4,S1)
11526 
11527   if (index == 3) {
11528     xbin = GetDSOffset(1, 2) + GetSCOffset(1, 2, 32);
11529   }  // nb_for_cons == 216  (D1,S2) (D3,S8)
11530   if (index == 4) {
11531     xbin = GetDSOffset(2, 8) + GetSCOffset(2, 8, 32);
11532   }  // nb_for_cons ==  67  (D2,S8) (D4,S2)
11533 
11534   if (index == 5) {
11535     xbin = GetDSOffset(1, 3) + GetSCOffset(1, 3, 10);
11536   }  // nb_for_cons == 224  (D1,S3) (D3,S7)
11537   if (index == 6) {
11538     xbin = GetDSOffset(2, 7) + GetSCOffset(2, 7, 10);
11539   }  // nb_for_cons ==  75  (D2,S7) (D4,S3)
11540 
11541   if (index == 7) {
11542     xbin = GetDSOffset(1, 5) + GetSCOffset(1, 5, 23);
11543   }  // nb_for_cons == 286  (D1,S5) (D3,S5)
11544   if (index == 8) {
11545     xbin = GetDSOffset(2, 5) + GetSCOffset(2, 5, 6);
11546   }  // nb_for_cons == 137  (D2,S5) (D4,S5)
11547 
11548   return xbin;
11549 }
11550 
11551 Int_t TEcnaHistos::GetNotConnectedSCForConsFromIndex(const Int_t& index) {
11552   Int_t SCForCons = 0;
11553   if (index == 1) {
11554     SCForCons = 182;
11555   }  // (D1,S1) (D3,S9)
11556   if (index == 2) {
11557     SCForCons = 33;
11558   }  // (D2,S9) (D4,S1)
11559 
11560   if (index == 3) {
11561     SCForCons = 178;
11562   }  // (D1,S2) (D3,S8)
11563   if (index == 4) {
11564     SCForCons = 29;
11565   }  // (D2,S8) (D4,S2)
11566   if (index == 5) {
11567     SCForCons = 207;
11568   }  // (D1,S2) (D3,S8)
11569   if (index == 6) {
11570     SCForCons = 58;
11571   }  // (D2,S8) (D4,S2)
11572 
11573   if (index == 7) {
11574     SCForCons = 298;
11575   }  // (D1,S3) (D3,S7)
11576   if (index == 8) {
11577     SCForCons = 149;
11578   }  // (D2,S7) (D4,S3)
11579 
11580   if (index == 9) {
11581     SCForCons = 261;
11582   }  // (D1,S4) (D3,S6)
11583   if (index == 10) {
11584     SCForCons = 112;
11585   }  // (D2,S6) (D4,S4)
11586   if (index == 11) {
11587     SCForCons = 268;
11588   }  // (D1,S4) (D3,S6)
11589   if (index == 12) {
11590     SCForCons = 119;
11591   }  // (D2,S6) (D4,S4)
11592 
11593   if (index == 13) {
11594     SCForCons = 281;
11595   }  // (D1,S5) (D3,S5)
11596   if (index == 14) {
11597     SCForCons = 132;
11598   }  // (D2,S5) (D4,S5)
11599   return SCForCons;
11600 }
11601 
11602 Int_t TEcnaHistos::GetNotConnectedDSSCFromIndex(const Int_t& index) {
11603   Int_t DSSC = 0;
11604   if (index == 1) {
11605     DSSC = 30;
11606   }  // (D1,S1) (D3,S9)
11607   if (index == 2) {
11608     DSSC = 30;
11609   }  // (D2,S9) (D4,S1)
11610 
11611   if (index == 3) {
11612     DSSC = 3;
11613   }  // (D1,S2) (D3,S8)
11614   if (index == 4) {
11615     DSSC = 3;
11616   }  // (D2,S8) (D4,S2)
11617   if (index == 5) {
11618     DSSC = 25;
11619   }  // (D1,S2) (D3,S8)
11620   if (index == 6) {
11621     DSSC = 25;
11622   }  // (D2,S8) (D4,S2)
11623 
11624   if (index == 7) {
11625     DSSC = 34;
11626   }  // (D1,S3) (D3,S7)
11627   if (index == 8) {
11628     DSSC = 34;
11629   }  // (D2,S7) (D4,S3)
11630 
11631   if (index == 9) {
11632     DSSC = 14;
11633   }  // (D1,S4) (D3,S6)
11634   if (index == 10) {
11635     DSSC = 14;
11636   }  // (D2,S6) (D4,S4)
11637   if (index == 11) {
11638     DSSC = 21;
11639   }  // (D1,S4) (D3,S6)
11640   if (index == 12) {
11641     DSSC = 21;
11642   }  // (D2,S6) (D4,S4)
11643 
11644   if (index == 13) {
11645     DSSC = 20;
11646   }  // (D1,S5) (D3,S5)
11647   if (index == 14) {
11648     DSSC = 3;
11649   }  // (D2,S5) (D4,S5)
11650   return DSSC;
11651 }
11652 
11653 Int_t TEcnaHistos::GetNotCompleteSCForConsFromIndex(const Int_t& index) {
11654   Int_t DSSC = 0;
11655   if (index == 1) {
11656     DSSC = 161;
11657   }  // (D1,S1) (D3,S9)
11658   if (index == 2) {
11659     DSSC = 12;
11660   }  // (D2,S9) (D4,S1)
11661 
11662   if (index == 3) {
11663     DSSC = 216;
11664   }  // (D1,S2) (D3,S8)
11665   if (index == 4) {
11666     DSSC = 67;
11667   }  // (D2,S8) (D4,S2)
11668 
11669   if (index == 5) {
11670     DSSC = 224;
11671   }  // (D1,S3) (D3,S7)
11672   if (index == 6) {
11673     DSSC = 75;
11674   }  // (D2,S7) (D4,S3)
11675 
11676   if (index == 7) {
11677     DSSC = 286;
11678   }  // (D1,S5) (D3,S5)
11679   if (index == 8) {
11680     DSSC = 137;
11681   }  // (D2,S5) (D4,S5)
11682   return DSSC;
11683 }
11684 
11685 Int_t TEcnaHistos::GetNotCompleteDSSCFromIndex(const Int_t& index) {
11686   Int_t DSSC = 0;
11687   if (index == 1) {
11688     DSSC = 12;
11689   }  // (D1,S1) (D3,S9)
11690   if (index == 2) {
11691     DSSC = 12;
11692   }  // (D2,S9) (D4,S1)
11693 
11694   if (index == 3) {
11695     DSSC = 32;
11696   }  // (D1,S2) (D3,S8)
11697   if (index == 4) {
11698     DSSC = 32;
11699   }  // (D2,S8) (D4,S2)
11700 
11701   if (index == 5) {
11702     DSSC = 10;
11703   }  // (D1,S3) (D3,S7)
11704   if (index == 6) {
11705     DSSC = 10;
11706   }  // (D2,S7) (D4,S3)
11707 
11708   if (index == 7) {
11709     DSSC = 23;
11710   }  // (D1,S5) (D3,S5)
11711   if (index == 8) {
11712     DSSC = 6;
11713   }  // (D2,S5) (D4,S5)
11714   return DSSC;
11715 }
11716 //----------------------------------------------- HistimePlot
11717 void TEcnaHistos::HistimePlot(TGraph* g_graph0,
11718                               Axis_t xinf,
11719                               Axis_t xsup,
11720                               const TString& HistoCode,
11721                               const TString& HistoType,
11722                               const Int_t& StexStin_A,
11723                               const Int_t& i0StinEcha,
11724                               const Int_t& i0Sample,
11725                               const Int_t& opt_scale_x,
11726                               const Int_t& opt_scale_y,
11727                               const TString& opt_plot,
11728                               const Int_t& xFlagAutoYsupMargin) {
11729   // Plot 1D histogram for evolution in time
11730 
11731   UInt_t canv_w = fCnaParHistos->SetCanvasWidth(HistoCode, opt_plot);
11732   UInt_t canv_h = fCnaParHistos->SetCanvasHeight(HistoCode, opt_plot);
11733 
11734   SetGraphPresentation(g_graph0, HistoType.Data(), opt_plot.Data());  // (gStyle parameters)}
11735 
11736   //...................................................... paves commentaires (HistimePlot)
11737   SetAllPavesViewHisto(HistoCode, StexStin_A, i0StinEcha, i0Sample, opt_plot);
11738 
11739   //..................................................... Canvas name (HistimePlot)
11740   Int_t arg_AlreadyRead = 0;
11741   TString canvas_name = SetCanvasName(
11742       HistoCode.Data(), opt_scale_x, opt_scale_y, opt_plot, arg_AlreadyRead, StexStin_A, i0StinEcha, i0Sample);
11743 
11744   //------------------------------------------------ Canvas allocation  (HistimePlot)
11745   //......................................... declarations canvas et pad
11746   TCanvas* MainCanvas = nullptr;
11747 
11748   if (opt_plot == fOnlyOnePlot) {
11749     MainCanvas = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h);
11750     fCnewRoot++;
11751     fCurrentPad = gPad;
11752     fCurrentCanvas = MainCanvas;
11753     fCurrentCanvasName = canvas_name.Data();
11754   }
11755 
11756   if (opt_plot == fSeveralPlot) {
11757     if (GetMemoFlag(HistoCode, opt_plot) == "Free") {
11758       MainCanvas = CreateCanvas(HistoCode, opt_plot, canvas_name, canv_w, canv_h);
11759       fCurrentPad = gPad;
11760       fCurrentCanvas = MainCanvas;
11761       fCurrentCanvasName = canvas_name.Data();
11762     }
11763   }
11764 
11765   if (opt_plot == fSameOnePlot) {
11766     if (GetMemoFlag(HistoCode, opt_plot) == "Free") {
11767       MainCanvas = CreateCanvas(HistoCode, opt_plot, canvas_name, canv_w, canv_h);
11768       fCurrentPad = gPad;
11769       fCurrentCanvas = MainCanvas;
11770       fCurrentCanvasName = canvas_name.Data();
11771     }
11772   }
11773 
11774   // std::cout << "*TEcnaHistos::HistimePlot(...)> Plot is displayed on canvas ----> " << canvas_name.Data() << std::endl;
11775 
11776   //--------------- EE => SC for construction, EB => Xtal in SM (default: Stin ECNA number, i0StinEcha)
11777   Int_t Stex_StinCons = StexStin_A;   // Stex_StinCons = Tower for EB, SC for construction for EE
11778   Int_t n1StexCrys = i0StinEcha + 1;  // n1StexCrys = Crys in SM for EB
11779 
11780   if (StexStin_A >= 1 && StexStin_A <= fEcal->MaxStinEcnaInStex()) {
11781     if (fFlagSubDet == "EB") {
11782       n1StexCrys = fEcalNumbering->Get1StexCrysFrom1StexStinAnd0StinEcha(StexStin_A, i0StinEcha, fFapStexNumber);
11783     }
11784     if (fFlagSubDet == "EE") {
11785       Stex_StinCons = fEcalNumbering->GetDeeSCConsFrom1DeeSCEcna(fFapStexNumber, StexStin_A);
11786     }
11787   }
11788 
11789   //------ String for StexNumber ( to display "EB" or "EE" if Stex = 0 )
11790   TString sFapStexNumber = StexNumberToString(fFapStexNumber);
11791 
11792   //============================================================================= (HistimePlot)
11793   //
11794   //     1st  OPERATIONS:  Pave texts preparation and first Draw.
11795   //                       SetParametersCanvas
11796   //                       Set Memo Flags.
11797   //                       Set main_subpad and main_pavtxt
11798   //
11799   //=============================================================================
11800   TVirtualPad* main_subpad = nullptr;  //      main_subpad: Pad for the histo
11801   TPaveText* main_pavtxt = nullptr;    //      main_pavtxt: pave for changing parameters
11802 
11803   Int_t xMemoPlotSame = 1;  // a priori ==> SAME plot
11804 
11805   TString QuantityName = fCnaParHistos->GetQuantityName(HistoCode.Data());
11806 
11807   //========================================= Option ONLYONE    (HistimePlot)
11808   if (opt_plot == fOnlyOnePlot) {
11809     //................................. Draw titles and paves (pad = main canvas)
11810     if (fPavComGeneralTitle != nullptr) {
11811       fPavComGeneralTitle->Draw();
11812     }
11813     fPavComStex->Draw();
11814 
11815     if (!(HistoType == "Global" || HistoType == "Proj")) {
11816       fPavComStin->Draw();
11817       fPavComXtal->Draw();
11818     }
11819     fPavComEvolNbOfEvtsAna->Draw();
11820     fPavComEvolRuns->Draw();
11821 
11822     Double_t x_low = fCnaParHistos->BoxLeftX("bottom_left_box") - 0.005;
11823     Double_t x_up = fCnaParHistos->BoxRightX("bottom_right_box") + 0.005;
11824     Double_t y_low = fCnaParHistos->BoxTopY("bottom_right_box") + 0.005;
11825     Double_t y_up = fCnaParHistos->BoxBottomY("top_left_box_EB") - 0.005;
11826 
11827     Double_t x_margin = x_low;
11828     Double_t y_margin = y_low;
11829 
11830     Color_t fond_pad = fCnaParHistos->ColorDefinition("gris18");
11831 
11832     MainCanvas->Divide(1, 1, x_margin, y_margin, fond_pad);
11833     //           Divide(nx, ny, x_margin, y_margin,    color);
11834 
11835     gPad->cd(1);
11836     main_subpad = gPad;
11837     main_subpad->SetPad(x_low, y_low, x_up, y_up);
11838 
11839     xMemoPlotSame = 0;
11840   }
11841   //========================================= Options SAME and SAME n   (HistimePlot)
11842   if (opt_plot == fSeveralPlot || opt_plot == fSameOnePlot) {
11843     if (GetMemoFlag(HistoCode, opt_plot) == "Free") {
11844       if (fPavComGeneralTitle != nullptr) {
11845         fPavComGeneralTitle->Draw();
11846       }
11847       fPavComSeveralChanging->Draw();
11848 
11849       fPavComEvolRuns->Draw();
11850 
11851       if (!(HistoType == "Global" || HistoType == "Proj" || HistoCode == "H_Ped_Date" || HistoCode == "H_TNo_Date" ||
11852             HistoCode == "H_MCs_Date" || HistoCode == "H_LFN_Date" || HistoCode == "H_HFN_Date" ||
11853             HistoCode == "H_SCs_Date")) {
11854         fPavComStin->Draw();
11855         fPavComXtal->Draw();
11856       }
11857 
11858       if (!(HistoCode == "H_Ped_Date" || HistoCode == "H_TNo_Date" || HistoCode == "H_MCs_Date" ||
11859             HistoCode == "H_LFN_Date" || HistoCode == "H_HFN_Date" || HistoCode == "H_SCs_Date")) {
11860         fPavComXtal->Draw();
11861       }
11862       //Call to SetParametersPavTxt
11863       //fPavTxt<HISTOCODE> = fPavComSeveralChanging;  => come from SetAllPavesViewHisto
11864       SetParametersPavTxt(HistoCode, opt_plot);
11865 
11866       //---------------- Call to ActivePavTxt
11867       // main_pavtxt = fPavTxt<HISTOCODE>;} (return main_pavtxt)
11868       main_pavtxt = ActivePavTxt(HistoCode.Data(), opt_plot.Data());
11869 
11870       //-------------------- Set texts for pave "several changing", options SAME and SAME n (HistimePlot)
11871       main_pavtxt->SetTextAlign(fTextPaveAlign);
11872       main_pavtxt->SetTextFont(fTextPaveFont);
11873       main_pavtxt->SetTextSize(fTextPaveSize);
11874       main_pavtxt->SetBorderSize(fTextBorderSize);
11875 
11876       char f_in[charArrLen];
11877 
11878       TString DecalStexName = "";
11879       if (fFlagSubDet == "EB") {
11880         DecalStexName = " ";
11881       }
11882       TString DecalStinName = "";
11883       if (fFlagSubDet == "EE") {
11884         DecalStinName = "   ";
11885       }
11886 
11887       TString sStexOrStasName = "";
11888       if (fFapStexNumber == 0) {
11889         sStexOrStasName = "  ";
11890       }
11891       if (fFapStexNumber != 0) {
11892         sStexOrStasName = fFapStexName;
11893       }
11894 
11895       //-----------------------------> HistoType = "EvolProj" => treated in HistoPlot, not here.
11896       if (opt_plot == fSeveralPlot) {
11897         sprintf(f_in,
11898                 "Analysis   Samp  Evts range  Nb Evts   %s%s %s%s   %s  %s",
11899                 DecalStexName.Data(),
11900                 sStexOrStasName.Data(),
11901                 DecalStinName.Data(),
11902                 fFapStinName.Data(),
11903                 fFapXtalName.Data(),
11904                 fFapEchaName.Data());
11905       }
11906       if (opt_plot == fSameOnePlot) {
11907         sprintf(f_in,
11908                 "Analysis   Samp  Evts range  Nb Evts   %s%s %s%s   %s  %s",
11909                 DecalStexName.Data(),
11910                 sStexOrStasName.Data(),
11911                 DecalStinName.Data(),
11912                 fFapStinName.Data(),
11913                 fFapXtalName.Data(),
11914                 fFapEchaName.Data());
11915       }
11916 
11917       //................................................................... (HistimePlot)
11918       TText* ttit = main_pavtxt->AddText(f_in);
11919       ttit->SetTextColor(fCnaParHistos->ColorDefinition("noir"));
11920 
11921       if (opt_plot == fSeveralPlot) {
11922         sprintf(f_in,
11923                 "%-10s 1-%2d %5d-%5d  %7d %5s%6d%7d%6d",
11924                 fFapAnaType.Data(),
11925                 fFapNbOfSamples,
11926                 fFapFirstReqEvtNumber,
11927                 fFapLastReqEvtNumber,
11928                 fFapReqNbOfEvts,
11929                 sFapStexNumber.Data(),
11930                 Stex_StinCons,
11931                 n1StexCrys,
11932                 i0StinEcha);
11933       }
11934       if (opt_plot == fSameOnePlot) {
11935         sprintf(f_in,
11936                 "%-10s 1-%2d %5d-%5d  %7d %5s%6d%7d%6d %-25s",
11937                 fFapAnaType.Data(),
11938                 fFapNbOfSamples,
11939                 fFapFirstReqEvtNumber,
11940                 fFapLastReqEvtNumber,
11941                 fFapReqNbOfEvts,
11942                 sFapStexNumber.Data(),
11943                 Stex_StinCons,
11944                 n1StexCrys,
11945                 i0StinEcha,
11946                 QuantityName.Data());
11947       }
11948 
11949       TText* tt = main_pavtxt->AddText(f_in);
11950       tt->SetTextColor(GetViewHistoColor(HistoCode, opt_plot));
11951 
11952       //---------- Draw the "several changing" pave with its text in the Canvas (FIRST TIME)    (HistimePlot)
11953       main_pavtxt->Draw();
11954 
11955       //---------------- Call to SetParametersCanvas
11956       //fImp<HISTOCODE> = (TCanvasImp*)fCanv<HISTOCODE>->GetCanvasImp();
11957       //fCanv<HISTOCODE>->Divide(1, 1, x_margin_factor , y_margin_factor); gPad->cd(1);
11958       //fPad<HISTOCODE> = gPad;
11959       //fMemoPlot<HISTOCODE> = 1;          =======>  set MemoFlag to "Buzy"
11960       //fMemoColor<HISTOCODE> = 0;
11961       SetParametersCanvas(HistoCode, opt_plot);
11962 
11963       //---------------- Set xMemoPlotSame to 0
11964       xMemoPlotSame = 0;
11965     }
11966 
11967     //............................ cases fMemoPlotxxx = 1            (HistimePlot)
11968     if (GetMemoFlag(HistoCode, opt_plot) == "Busy") {
11969       //---------------- Call to ActivePavTxt
11970       // main_pavtxt = fPavTxt<HISTOCODE>;} (return main_pavtxt)
11971       main_pavtxt = ActivePavTxt(HistoCode.Data(), opt_plot.Data());
11972 
11973       //---------------- Call to ActivePad
11974       main_subpad = ActivePad(HistoCode.Data(), opt_plot.Data());  // => return 0 if canvas has been closed
11975 
11976       //---------------- Recover pointer to the current canvas
11977       MainCanvas = GetCurrentCanvas(HistoCode.Data(), opt_plot.Data());
11978     }
11979   }
11980 
11981   //============================================================================= (HistimePlot)
11982   //
11983   //     2nd  OPERATIONS: Write and Draw the parameter values in the
11984   //                      "several changing" pave (options SAME and SAME n)
11985   //                      Draw Histo
11986   //=============================================================================
11987   if (main_subpad != nullptr) {
11988     if (opt_plot == fSeveralPlot || opt_plot == fSameOnePlot) {
11989       if (xMemoPlotSame != 0) {
11990         main_pavtxt->SetTextAlign(fTextPaveAlign);
11991         main_pavtxt->SetTextFont(fTextPaveFont);
11992         main_pavtxt->SetTextSize(fTextPaveSize);
11993         main_pavtxt->SetBorderSize(fTextBorderSize);
11994 
11995         char f_in[charArrLen];
11996 
11997         if (opt_plot == fSeveralPlot) {
11998           sprintf(f_in,
11999                   "%-10s 1-%2d %5d-%5d  %7d %5s%6d%7d%6d",
12000                   fFapAnaType.Data(),
12001                   fFapNbOfSamples,
12002                   fFapFirstReqEvtNumber,
12003                   fFapLastReqEvtNumber,
12004                   fFapReqNbOfEvts,
12005                   sFapStexNumber.Data(),
12006                   Stex_StinCons,
12007                   n1StexCrys,
12008                   i0StinEcha);
12009         }
12010         if (opt_plot == fSameOnePlot) {
12011           sprintf(f_in,
12012                   "%-10s 1-%2d %5d-%5d  %7d %5s%6d%7d%6d %-25s",
12013                   fFapAnaType.Data(),
12014                   fFapNbOfSamples,
12015                   fFapFirstReqEvtNumber,
12016                   fFapLastReqEvtNumber,
12017                   fFapReqNbOfEvts,
12018                   sFapStexNumber.Data(),
12019                   Stex_StinCons,
12020                   n1StexCrys,
12021                   i0StinEcha,
12022                   QuantityName.Data());
12023         }
12024 
12025         TText* tt = main_pavtxt->AddText(f_in);
12026         tt->SetTextColor(GetViewHistoColor(HistoCode, opt_plot));
12027         MainCanvas->cd();
12028         gStyle->SetOptDate(0);
12029         main_pavtxt->Draw();
12030       }
12031       main_subpad->cd();
12032       Double_t x_low = fCnaParHistos->BoxLeftX("bottom_left_box") - 0.005;
12033       Double_t x_up = fCnaParHistos->BoxRightX("bottom_right_box") + 0.005;
12034       Double_t y_low = fCnaParHistos->BoxTopY("several_evol_box") + 0.005;
12035       Double_t y_up = fCnaParHistos->BoxBottomY("general_comment") - 0.005;
12036       if (opt_plot == fSameOnePlot) {
12037         y_up = fCnaParHistos->BoxBottomY("top_left_box_EB") - 0.005;
12038       }
12039       main_subpad->SetPad(x_low, y_low, x_up, y_up);
12040     }
12041 
12042     //............................................ Style    (HistimePlot)
12043     SetViewGraphColors(g_graph0, HistoCode, opt_plot);
12044 
12045     //................................. Set axis titles
12046     TString axis_x_var_name = SetHistoXAxisTitle(HistoCode);
12047     TString axis_y_var_name = SetHistoYAxisTitle(HistoCode);
12048     g_graph0->GetXaxis()->SetTitle(axis_x_var_name);
12049     g_graph0->GetYaxis()->SetTitle(axis_y_var_name);
12050 
12051     //................................. Xaxis is a time axis
12052     g_graph0->GetXaxis()->SetTimeDisplay(1);
12053     g_graph0->GetXaxis()->SetTimeFormat("%d %b-%Hh");
12054 
12055     g_graph0->GetXaxis()->SetTimeOffset(xinf);
12056 
12057     Int_t nb_displayed = fCnaParHistos->GetNbOfRunsDisplayed();  // max nb of run numbers displayed
12058 
12059     //...........................................................................   (HistimePlot)
12060     Int_t liny = 0;
12061     Int_t logy = 1;
12062 
12063     if (opt_plot == fOnlyOnePlot) {
12064       fXinf = (Double_t)xinf;
12065       fXsup = (Double_t)xsup;
12066       fYinf = (Double_t)GetYminValueFromMemo(HistoCode);
12067       fYsup = (Double_t)GetYmaxValueFromMemo(HistoCode);
12068 
12069       gPad->RangeAxis(fXinf, fYinf, fXsup, fYsup);
12070 
12071       //if(opt_scale_y == fOptScaleLiny){gPad->SetLogy(liny);}
12072       if (opt_scale_y == fOptScaleLogy) {
12073         gPad->SetLogy(logy);
12074         g_graph0->Draw("ALP");
12075       }
12076 
12077       if (opt_scale_y == fOptScaleLiny) {
12078         gPad->SetLogy(liny);
12079         g_graph0->Draw("ALP");
12080         Int_t nb_pts = g_graph0->GetN();
12081         Double_t* coord_x = g_graph0->GetX();
12082         Double_t* coord_y = g_graph0->GetY();
12083 
12084         char f_in[charArrLen];
12085 
12086         //................. display of the run numbers                                         (HistimePlot)
12087         Double_t interv_displayed = (coord_x[nb_pts - 1] - coord_x[0]) / (Double_t)nb_displayed;
12088         Double_t last_drawn_coordx = coord_x[0] - 1.5 * interv_displayed;
12089 
12090         for (Int_t i_run = 0; i_run < nb_pts; i_run++) {
12091           if ((coord_x[i_run] - last_drawn_coordx) > interv_displayed) {
12092             Double_t joinYinf = fYinf;
12093             Double_t joinYsup = fYsup;
12094             if (joinYsup <= joinYinf) {
12095               joinYinf = GetYminFromGraphFrameAndMarginValue(g_graph0, fCnaParHistos->GetMarginAutoMinMax());
12096               joinYsup = GetYmaxFromGraphFrameAndMarginValue(g_graph0, fCnaParHistos->GetMarginAutoMinMax());
12097               joinYsup = joinYsup + (joinYsup - joinYinf) / 20.;
12098             }
12099 
12100             sprintf(f_in, "R%d", fT1DRunNumber[i_run]);
12101             TText* text_run_num = new TText(coord_x[i_run], joinYsup, f_in);
12102             fCnewRoot++;
12103             text_run_num->SetTextAngle((Double_t)45.);
12104             text_run_num->SetTextSize((Double_t)0.035);
12105             text_run_num->Draw("SAME");
12106             // delete text_StexStin_num;             fCdeleteRoot++;
12107 
12108             TLine* jointlign;
12109             jointlign = new TLine(coord_x[i_run], joinYsup, coord_x[i_run], coord_y[i_run]);
12110             fCnewRoot++;
12111             jointlign->SetLineWidth(1);
12112             jointlign->SetLineStyle(2);
12113             jointlign->Draw("SAME");
12114             // delete jointlign;                  fCdeleteRoot++;
12115 
12116             last_drawn_coordx = coord_x[i_run];  //        (HistimePlot)
12117           }
12118         }
12119       }
12120       if (opt_scale_y == fOptScaleLogy) {
12121         gPad->SetLogy(logy);
12122         g_graph0->Draw("ALP");
12123       }
12124     }
12125 
12126     //......................................................................  (HistimePlot)
12127     if (opt_plot == fSeveralPlot || opt_plot == fSameOnePlot) {
12128       if (xMemoPlotSame == 0) {
12129         if (opt_scale_y == fOptScaleLiny) {
12130           gPad->SetLogy(liny);
12131         }
12132         if (opt_scale_y == fOptScaleLogy) {
12133           gPad->SetLogy(logy);
12134         }
12135         g_graph0->Draw("ALP");
12136 
12137         fXinf = (Double_t)xinf;
12138         fXsup = (Double_t)xsup;
12139         fYinf = (Double_t)GetYminValueFromMemo(HistoCode);
12140         fYsup = (Double_t)GetYmaxValueFromMemo(HistoCode);
12141 
12142         gPad->RangeAxis(fXinf, fYinf, fXsup, fYsup);
12143       }
12144 
12145       if (xMemoPlotSame != 0)  //        (HistimePlot)
12146       {
12147         if (opt_scale_y == fOptScaleLiny) {
12148           gPad->SetLogy(liny);
12149         }
12150         if (opt_scale_y == fOptScaleLogy) {
12151           gPad->SetLogy(logy);
12152         }
12153 
12154         g_graph0->Draw("LP");
12155       }
12156     }
12157     gPad->Update();
12158   } else  // else du if(main_subpad !=0)
12159   {
12160     std::cout << "*TEcnaHistos::HistimePlot(...)> Canvas not found. Previously closed in option SAME." << fTTBELL
12161               << std::endl;
12162 
12163     ReInitCanvas(HistoCode, opt_plot);
12164   }
12165 
12166   //  delete MainCanvas;                  fCdeleteRoot++;
12167 
12168 }  // end of HistimePlot
12169 
12170 //------------------------------------------------------------------------------------------------------
12171 void TEcnaHistos::TopAxisForHistos(TH1D* h_his0,
12172                                    const TString& opt_plot,
12173                                    const Int_t& xMemoPlotSame,
12174                                    const Int_t& min_value,
12175                                    const Int_t& max_value,
12176                                    const Int_t& xFlagAutoYsupMargin,
12177                                    const Int_t& HisSize) {
12178   // Axis on top of the plot to indicate the Stin numbers
12179 
12180   if (opt_plot == fOnlyOnePlot || ((opt_plot == fSeveralPlot) && (xMemoPlotSame == 0)) ||
12181       ((opt_plot == fSameOnePlot) && (xMemoPlotSame == 0))) {
12182     Double_t Maxih = (Double_t)h_his0->GetMaximum();
12183     Double_t Minih = (Double_t)h_his0->GetMinimum();
12184 
12185     if (xFlagAutoYsupMargin == 1) {
12186       if (Minih >= Maxih) {
12187         Minih = (Double_t)0.;
12188         Maxih += Maxih;
12189       }                                            // ROOT default if ymin >= ymax
12190       Double_t MaxMarginFactor = (Double_t)0.05;   // frame top line = 5% above the maximum
12191       Maxih += (Maxih - Minih) * MaxMarginFactor;  // ROOT default if ymin < ymax
12192     }
12193 
12194     Double_t v_min = min_value;
12195     Double_t v_max = max_value + (Double_t)1.;
12196     Double_t v_min_p = v_min + (Double_t)1.;
12197     Double_t v_max_p = v_max + (Double_t)1.;
12198 
12199     Int_t ndiv = 50207;
12200     TString opt = "B-";
12201     Double_t Xbegin = 0.;
12202     Double_t Xend = (Double_t)HisSize;
12203     Double_t ticks = 0.05;
12204 
12205     if (fFapStexNumber == 0 && fFlagSubDet == "EE") {
12206       v_min = 0;
12207       v_max = max_value;
12208       ndiv = 4;
12209       opt = "CSU";  // first draw axis with ticksize and no label
12210       Xbegin = (Double_t)HisSize;
12211       Xend = 0.;
12212     }
12213 
12214     if (fFapStexNumber > 0 && fFlagSubDet == "EE") {
12215       ticks = 0;
12216       if (fFapStexNumber == 1) {
12217         v_min = min_value;
12218         v_max = max_value + 0.5;
12219         Xbegin = (Double_t)HisSize;
12220         Xend = 0.;
12221         opt = "CSU";  // first draw axis with no ticksize and no label
12222       }
12223       if (fFapStexNumber == 2) {
12224         v_min = min_value + 0.5;
12225         v_max = max_value + 1.;
12226         Xbegin = (Double_t)HisSize;
12227         Xend = 0.;
12228         opt = "CSU";  // first draw axis with no ticksize and no label
12229       }
12230       if (fFapStexNumber == 3) {
12231         v_min = min_value + 0.5;
12232         v_max = max_value + 1.;
12233         Xbegin = 0.;
12234         Xend = (Double_t)HisSize;
12235         opt = "-CSU";  // first draw axis with no ticksize and no label
12236       }
12237       if (fFapStexNumber == 4) {
12238         v_min = min_value;
12239         v_max = max_value + 0.5;
12240         Xbegin = 0.;
12241         Xend = (Double_t)HisSize;
12242         opt = "-CSU";  // first draw axis with no ticksize and no label
12243       }
12244       v_min -= 1;
12245       v_max -= 1;
12246       ndiv = 5;
12247     }
12248 
12249     TGaxis* top_axis_x = nullptr;
12250 
12251     top_axis_x = new TGaxis(Xbegin, Maxih, Xend, Maxih, v_min, v_max, ndiv, opt, 0.);
12252     fCnewRoot++;
12253 
12254     top_axis_x->SetTickSize(ticks);
12255     top_axis_x->SetTitleOffset((Float_t)(1.2));
12256     top_axis_x->SetLabelOffset((Float_t)(0.005));
12257 
12258     TString x_var_name = "?";
12259     x_var_name.Resize(charArrLen);
12260     if (fFapStexNumber > 0) {
12261       if (fFlagSubDet == "EB") {
12262         x_var_name = "Tower number";
12263       }
12264       if (fFlagSubDet == "EE") {
12265         x_var_name = " ";
12266         // x_var_name = "                                                                                                            Data sector"; // don't remove the space characters !
12267       }
12268     }
12269     if (fFapStexNumber == 0) {
12270       if (fFlagSubDet == "EB") {
12271         x_var_name = "SM number";
12272       }
12273       if (fFlagSubDet == "EE") {
12274         x_var_name = " ";
12275       }
12276     }
12277     top_axis_x->SetTitle(x_var_name);
12278     top_axis_x->Draw("SAME");
12279 
12280     if (fFlagSubDet == "EE") {
12281       // redraw axis with ticksize = 0, with labelOffset<0 or >0 and div centered in middle division
12282       opt = "-MS";
12283       if (fFapStexNumber == 1 || fFapStexNumber == 2) {
12284         opt = "-MS";
12285       }
12286       if (fFapStexNumber == 3 || fFapStexNumber == 4) {
12287         opt = "MS";
12288       }
12289       ndiv = 4;
12290       if (fFapStexNumber > 0) {
12291         ndiv = 5;
12292       }
12293       TGaxis* top_axis_x_bis = nullptr;
12294       top_axis_x_bis = new TGaxis(Xbegin, Maxih, Xend, Maxih, v_min_p, v_max_p, ndiv, opt, 0.);
12295       fCnewRoot++;
12296       top_axis_x_bis->SetTickSize(0.);
12297       Float_t lab_siz_x = top_axis_x->GetLabelSize();
12298       top_axis_x_bis->SetLabelSize(lab_siz_x);
12299       top_axis_x_bis->SetLabelOffset(-0.1);
12300 
12301       top_axis_x_bis->SetLabelOffset((Float_t)(9999.));
12302       // if(fFapStexNumber == 1 || fFapStexNumber == 2 ){top_axis_x_bis->SetLabelOffset(-0.07);}
12303       // if(fFapStexNumber == 3 || fFapStexNumber == 4 ){top_axis_x_bis->SetLabelOffset(-0.05);}
12304       // if(fFapStexNumber == 0 )
12305       //  {top_axis_x_bis->SetLabelOffset((Float_t)(9999.));}  // keep the tick and remove the value
12306       top_axis_x_bis->Draw("SAME");
12307     }
12308   }
12309 }  // end of TopAxisForHistos
12310 
12311 //............................................................................................
12312 void TEcnaHistos::SetAllPavesViewMatrix(const TString& BetweenWhat,
12313                                         const Int_t& StexStin_A,
12314                                         const Int_t& StexStin_B,
12315                                         const Int_t& i0StinEcha) {
12316   // Put all the paves of a matrix view
12317 
12318   fPavComGeneralTitle = fCnaParHistos->SetPaveGeneralComment(fFlagGeneralTitle);
12319 
12320   fPavComStex = fCnaParHistos->SetPaveStex("standard", fFapStexNumber);
12321 
12322   if (BetweenWhat == fLFBetweenChannels || BetweenWhat == fHFBetweenChannels) {
12323     fPavComStin = fCnaParHistos->SetPaveStinsXY(StexStin_A, StexStin_B);
12324   }
12325   if (BetweenWhat == fBetweenSamples) {
12326     fPavComStin = fCnaParHistos->SetPaveStin(StexStin_A, fFapStexNumber);
12327 
12328     if (fFlagSubDet == "EB") {
12329       Int_t n1StexCrys = fEcalNumbering->Get1StexCrysFrom1StexStinAnd0StinEcha(StexStin_A, i0StinEcha, fFapStexNumber);
12330       fPavComXtal = fCnaParHistos->SetPaveCrystal(n1StexCrys, StexStin_A, i0StinEcha);
12331     }
12332     if (fFlagSubDet == "EE") {
12333       TString Dir = fEcalNumbering->GetDeeDirViewedFromIP(fFapStexNumber);
12334       Int_t n1StexCrys = fEcalNumbering->Get1StexCrysFrom1StexStinAnd0StinEcha(StexStin_A, i0StinEcha, fFapStexNumber);
12335       fPavComXtal = fCnaParHistos->SetPaveCrystal(n1StexCrys, StexStin_A, i0StinEcha);
12336     }
12337   }
12338 
12339   fPavComAnaRun = fCnaParHistos->SetPaveAnalysisRun(
12340       fFapAnaType, fFapNbOfSamples, fFapRunNumber, fRunType, fFapFirstReqEvtNumber, fFapLastReqEvtNumber, "OneCol");
12341   fPavComNbOfEvts = fCnaParHistos->SetPaveNbOfEvts(fFapNbOfEvts, fStartDate, fStopDate, "OneCol");
12342 }
12343 
12344 void TEcnaHistos::SetAllPavesViewStin(const Int_t& StexStin_A) {
12345   // Put all the paves of a Stin view
12346 
12347   fPavComGeneralTitle = fCnaParHistos->SetPaveGeneralComment(fFlagGeneralTitle);
12348   fPavComStex = fCnaParHistos->SetPaveStex("standard", fFapStexNumber);
12349 
12350   fPavComStin = fCnaParHistos->SetPaveStin(StexStin_A, fFapStexNumber);
12351 
12352   fPavComAnaRun = fCnaParHistos->SetPaveAnalysisRun(
12353       fFapAnaType, fFapNbOfSamples, fFapRunNumber, fRunType, fFapFirstReqEvtNumber, fFapLastReqEvtNumber, "OneCol");
12354   fPavComNbOfEvts = fCnaParHistos->SetPaveNbOfEvts(fFapNbOfEvts, fStartDate, fStopDate, "OneCol");
12355 }
12356 
12357 void TEcnaHistos::SetAllPavesViewStinCrysNb(const Int_t& StexNumber, const Int_t& StexStin_A) {
12358   // Put all the paves of a crystal numbering Stin view
12359 
12360   fPavComStex = fCnaParHistos->SetPaveStex("standard", StexNumber);
12361   fPavComStin = fCnaParHistos->SetPaveStin(StexStin_A, StexNumber);
12362 
12363   if (fFlagSubDet == "EB") {
12364     fPavComLVRB = fCnaParHistos->SetPaveLVRB(StexNumber, StexStin_A);
12365   }
12366   if (fFlagSubDet == "EE") {
12367     fPavComCxyz = fCnaParHistos->SetPaveCxyz(StexNumber);
12368   }
12369 }
12370 
12371 void TEcnaHistos::SetAllPavesViewStex(const TString& chopt, const Int_t& StexNumber) {
12372   if (chopt == "Numbering") {
12373     fCnaParHistos->SetViewHistoStyle("Stex2DEENb");
12374     gStyle->SetTextColor(fCnaParHistos->ColorDefinition("noir"));
12375     fPavComStex = fCnaParHistos->SetPaveStex("standStex", StexNumber);
12376     if (fFlagSubDet == "EE") {
12377       fPavComCxyz = fCnaParHistos->SetPaveCxyz(StexNumber);
12378     }
12379   } else {
12380     SetAllPavesViewStex(StexNumber);
12381   }
12382 }
12383 // end of SetAllPavesViewStex(...,...)
12384 
12385 void TEcnaHistos::SetAllPavesViewStex(const Int_t& StexNumber) {
12386   gStyle->SetTextColor(fCnaParHistos->ColorDefinition("noir"));
12387   fPavComGeneralTitle = fCnaParHistos->SetPaveGeneralComment(fFlagGeneralTitle);
12388   fPavComStex = fCnaParHistos->SetPaveStex("standStex", StexNumber);
12389 
12390   TString opt_pave_nbcol = "OneCol";
12391   if (fFapStexName == "SM") {
12392     opt_pave_nbcol = "TwoCol";
12393   }
12394 
12395   fPavComAnaRun = fCnaParHistos->SetPaveAnalysisRun(fFapAnaType,
12396                                                     fFapNbOfSamples,
12397                                                     fFapRunNumber,
12398                                                     fRunType,
12399                                                     fFapFirstReqEvtNumber,
12400                                                     fFapLastReqEvtNumber,
12401                                                     opt_pave_nbcol);
12402   fPavComNbOfEvts = fCnaParHistos->SetPaveNbOfEvts(fFapNbOfEvts, fStartDate, fStopDate, opt_pave_nbcol);
12403 }
12404 // end of SetAllPavesViewStex(...)
12405 
12406 void TEcnaHistos::SetAllPavesViewStas() {
12407   gStyle->SetTextColor(fCnaParHistos->ColorDefinition("noir"));
12408   fPavComGeneralTitle = fCnaParHistos->SetPaveGeneralComment(fFlagGeneralTitle);
12409   fPavComStas = fCnaParHistos->SetPaveStas();
12410 
12411   fPavComAnaRun = fCnaParHistos->SetPaveAnalysisRun(
12412       fFapAnaType, fFapNbOfSamples, fFapRunNumber, fRunType, fFapFirstReqEvtNumber, fFapLastReqEvtNumber, "OneCol");
12413   fPavComNbOfEvts = fCnaParHistos->SetPaveNbOfEvts(fFapNbOfEvts, fStartDate, fStopDate, "OneCol");
12414 }
12415 // end of SetAllPavesViewStas
12416 
12417 void TEcnaHistos::SetAllPavesViewHisto(const TString& HistoCode,
12418                                        const Int_t& StexStin_A,
12419                                        const Int_t& i0StinEcha,
12420                                        const Int_t& i0Sample,
12421                                        const TString& opt_plot) {
12422   Int_t arg_AlreadyRead = 0;
12423   SetAllPavesViewHisto(HistoCode, StexStin_A, i0StinEcha, i0Sample, opt_plot, arg_AlreadyRead);
12424 }
12425 
12426 void TEcnaHistos::SetAllPavesViewHisto(const TString& HistoCode,
12427                                        const Int_t& StexStin_A,
12428                                        const Int_t& i0StinEcha,
12429                                        const Int_t& i0Sample,
12430                                        const TString& opt_plot,
12431                                        const Int_t& arg_AlreadyRead) {
12432   // Put all the paves of a histo view according to HistoCode
12433 
12434   gStyle->SetTextColor(fCnaParHistos->ColorDefinition("noir"));
12435 
12436   TString HistoType = fCnaParHistos->GetHistoType(HistoCode.Data());
12437 
12438   fPavComGeneralTitle = fCnaParHistos->SetPaveGeneralComment(fFlagGeneralTitle);
12439 
12440   if (opt_plot == fOnlyOnePlot) {
12441     if (!(HistoCode == "D_NOE_ChNb" || HistoCode == "D_NOE_ChDs" || HistoCode == "D_Ped_ChNb" ||
12442           HistoCode == "D_Ped_ChDs" || HistoCode == "D_LFN_ChNb" || HistoCode == "D_LFN_ChDs" ||
12443           HistoCode == "D_TNo_ChNb" || HistoCode == "D_TNo_ChDs" || HistoCode == "D_HFN_ChNb" ||
12444           HistoCode == "D_HFN_ChDs" || HistoCode == "D_MCs_ChNb" || HistoCode == "D_MCs_ChDs" ||
12445           HistoCode == "D_SCs_ChNb" || HistoCode == "D_SCs_ChDs")) {
12446       fPavComStex = fCnaParHistos->SetPaveStex("standard", fFapStexNumber);
12447       fPavComStin = fCnaParHistos->SetPaveStin(StexStin_A, fFapStexNumber);
12448     } else {
12449       if (HistoCode == "D_NOE_ChNb" || HistoCode == "D_Ped_ChNb" || HistoCode == "D_TNo_ChNb" ||
12450           HistoCode == "D_MCs_ChNb" || HistoCode == "D_LFN_ChNb" || HistoCode == "D_HFN_ChNb" ||
12451           HistoCode == "D_SCs_ChNb") {
12452         fPavComStex = fCnaParHistos->SetPaveStex("standGH", fFapStexNumber);
12453       } else {
12454         fPavComStex = fCnaParHistos->SetPaveStex("standard", fFapStexNumber);
12455       }
12456     }
12457     //.................................................... (SetAllPavesViewHisto)
12458 
12459     if (HistoCode == "H_Ped_Date" || HistoCode == "H_TNo_Date" || HistoCode == "H_MCs_Date" ||
12460         HistoCode == "H_LFN_Date" || HistoCode == "H_HFN_Date" || HistoCode == "H_SCs_Date" ||
12461         HistoCode == "H_Ped_RuDs" || HistoCode == "H_TNo_RuDs" || HistoCode == "H_MCs_RuDs" ||
12462         HistoCode == "H_LFN_RuDs" || HistoCode == "H_HFN_RuDs" || HistoCode == "H_SCs_RuDs") {
12463       Int_t n1StexCrys = fEcalNumbering->Get1StexCrysFrom1StexStinAnd0StinEcha(StexStin_A, i0StinEcha, fFapStexNumber);
12464       fPavComXtal = fCnaParHistos->SetPaveCrystal(n1StexCrys, StexStin_A, i0StinEcha);
12465     }
12466 
12467     if (HistoCode == "D_MSp_SpNb" || HistoCode == "D_SSp_SpNb" || HistoCode == "D_MSp_SpDs" ||
12468         HistoCode == "D_SSp_SpDs") {
12469       Int_t n1StexCrys = fEcalNumbering->Get1StexCrysFrom1StexStinAnd0StinEcha(StexStin_A, i0StinEcha, fFapStexNumber);
12470       fPavComXtal =
12471           fCnaParHistos->SetPaveCrystal(n1StexCrys, StexStin_A, i0StinEcha, arg_AlreadyRead, fPlotAllXtalsInStin);
12472     }
12473 
12474     if (HistoCode == "D_Adc_EvDs" || HistoCode == "D_Adc_EvNb") {
12475       Int_t n1StexCrys = fEcalNumbering->Get1StexCrysFrom1StexStinAnd0StinEcha(StexStin_A, i0StinEcha, fFapStexNumber);
12476       fPavComXtal = fCnaParHistos->SetPaveCrystalSample(n1StexCrys, StexStin_A, i0StinEcha, i0Sample);
12477     }
12478 
12479     if (HistoCode == "H_Ped_Date" || HistoCode == "H_TNo_Date" || HistoCode == "H_MCs_Date" ||
12480         HistoCode == "H_LFN_Date" || HistoCode == "H_HFN_Date" || HistoCode == "H_SCs_Date" ||
12481         HistoCode == "H_Ped_RuDs" || HistoCode == "H_TNo_RuDs" || HistoCode == "H_MCs_RuDs" ||
12482         HistoCode == "H_LFN_RuDs" || HistoCode == "H_HFN_RuDs" || HistoCode == "H_SCs_RuDs") {
12483       fPavComEvolNbOfEvtsAna = fCnaParHistos->SetPaveEvolNbOfEvtsAna(
12484           fFapAnaType, fFapNbOfSamples, fFapFirstReqEvtNumber, fFapLastReqEvtNumber, HistoType);
12485       fPavComEvolRuns = fCnaParHistos->SetPaveEvolRuns(
12486           fStartEvolRun, fStartEvolDate, fStopEvolRun, fStopEvolDate, opt_plot, HistoType);
12487     } else {
12488       fPavComAnaRun = fCnaParHistos->SetPaveAnalysisRun(
12489           fFapAnaType, fFapNbOfSamples, fFapRunNumber, fRunType, fFapFirstReqEvtNumber, fFapLastReqEvtNumber, "OneCol");
12490       fPavComNbOfEvts = fCnaParHistos->SetPaveNbOfEvts(fFapNbOfEvts, fStartDate, fStopDate, "OneCol");
12491     }
12492   }
12493 
12494   //.................................................... (SetAllPavesViewHisto)
12495 
12496   if (opt_plot == fSeveralPlot && GetMemoFlag(HistoCode, opt_plot) == "Free") {
12497     if (HistoCode == "H_Ped_Date" || HistoCode == "H_TNo_Date" || HistoCode == "H_MCs_Date" ||
12498         HistoCode == "H_LFN_Date" || HistoCode == "H_HFN_Date" || HistoCode == "H_SCs_Date" ||
12499         HistoCode == "H_Ped_RuDs" || HistoCode == "H_TNo_RuDs" || HistoCode == "H_MCs_RuDs" ||
12500         HistoCode == "H_LFN_RuDs" || HistoCode == "H_HFN_RuDs" || HistoCode == "H_SCs_RuDs") {
12501       fPavComSeveralChanging = fCnaParHistos->SetOptionSamePaveBorder("sevevol", HistoType);
12502       fPavComEvolRuns = fCnaParHistos->SetPaveEvolRuns(
12503           fStartEvolRun, fStartEvolDate, fStopEvolRun, fStopEvolDate, opt_plot, HistoType);
12504     } else {
12505       fPavComSeveralChanging = fCnaParHistos->SetOptionSamePaveBorder("several", HistoType);
12506     }
12507   }
12508 
12509   if (opt_plot == fSameOnePlot && GetMemoFlag(HistoCode, opt_plot) == "Free") {
12510     fPavComSeveralChanging = fCnaParHistos->SetOptionSamePaveBorder("several", HistoType);
12511     fPavComEvolRuns =
12512         fCnaParHistos->SetPaveEvolRuns(fStartEvolRun, fStartEvolDate, fStopEvolRun, fStopEvolDate, opt_plot, HistoType);
12513   }
12514 }
12515 // end of SetAllPavesViewHisto
12516 
12517 TString TEcnaHistos::SetCanvasName(const TString& HistoCode,
12518                                    const Int_t& opt_scale_x,
12519                                    const Int_t& opt_scale_y,
12520                                    const TString& opt_plot,
12521                                    const Int_t& arg_AlreadyRead,
12522                                    const Int_t& StexStin_A,
12523                                    const Int_t& i0StinEcha,
12524                                    const Int_t& i0Sample) {
12525   //......... Set Canvas name *===> FOR 1D HISTO ONLY
12526   //          (for 2D histos, see inside ViewMatrix, ViewStex,...)
12527 
12528   TString canvas_name;
12529   canvas_name.Resize(charArrLen);
12530   canvas_name = "?";
12531 
12532   char f_in[charArrLen];
12533 
12534   //......................... name_ opt_plot  (Set Canvas name)
12535   TString name_opt_plot;
12536   name_opt_plot.Resize(charArrLen);
12537   name_opt_plot = "?";
12538 
12539   //if(opt_plot == fOnlyOnePlot && arg_AlreadyRead == 0){name_opt_plot = "P0";}  // Only one plot
12540   //if(opt_plot == fOnlyOnePlot && arg_AlreadyRead == 1){name_opt_plot = "P1";}  // SAME in Stin plot
12541   //if(opt_plot == fOnlyOnePlot && arg_AlreadyRead >= 1){name_opt_plot = "Pn";}  // SAME in Stin plot
12542 
12543   if (opt_plot == fOnlyOnePlot) {
12544     sprintf(f_in, "P%d", arg_AlreadyRead);
12545     name_opt_plot = f_in;
12546   }
12547 
12548   if (opt_plot == fSeveralPlot) {
12549     name_opt_plot = "SAME_N";
12550     //...................................... name_same (opt_plot = fSeveralPlot)
12551     Int_t name_same = -1;
12552 
12553     if (HistoCode == "D_NOE_ChNb") {
12554       name_same = fCanvSameD_NOE_ChNb;
12555     }
12556     if (HistoCode == "D_NOE_ChDs") {
12557       name_same = fCanvSameD_NOE_ChDs;
12558     }
12559     if (HistoCode == "D_Ped_ChNb") {
12560       name_same = fCanvSameD_Ped_ChNb;
12561     }
12562     if (HistoCode == "D_Ped_ChDs") {
12563       name_same = fCanvSameD_Ped_ChDs;
12564     }
12565     if (HistoCode == "D_TNo_ChNb") {
12566       name_same = fCanvSameD_TNo_ChNb;
12567     }
12568     if (HistoCode == "D_TNo_ChDs") {
12569       name_same = fCanvSameD_TNo_ChDs;
12570     }
12571     if (HistoCode == "D_MCs_ChNb") {
12572       name_same = fCanvSameD_MCs_ChNb;
12573     }
12574     if (HistoCode == "D_MCs_ChDs") {
12575       name_same = fCanvSameD_MCs_ChDs;
12576     }
12577     if (HistoCode == "D_LFN_ChNb") {
12578       name_same = fCanvSameD_LFN_ChNb;
12579     }
12580     if (HistoCode == "D_LFN_ChDs") {
12581       name_same = fCanvSameD_LFN_ChDs;
12582     }
12583     if (HistoCode == "D_HFN_ChNb") {
12584       name_same = fCanvSameD_HFN_ChNb;
12585     }
12586     if (HistoCode == "D_HFN_ChDs") {
12587       name_same = fCanvSameD_HFN_ChDs;
12588     }
12589     if (HistoCode == "D_SCs_ChNb") {
12590       name_same = fCanvSameD_SCs_ChNb;
12591     }
12592     if (HistoCode == "D_SCs_ChDs") {
12593       name_same = fCanvSameD_SCs_ChDs;
12594     }
12595     if (HistoCode == "D_MSp_SpNb") {
12596       name_same = fCanvSameD_MSp_SpNb;
12597     }
12598     if (HistoCode == "D_MSp_SpDs") {
12599       name_same = fCanvSameD_MSp_SpDs;
12600     }
12601     if (HistoCode == "D_SSp_SpNb") {
12602       name_same = fCanvSameD_SSp_SpNb;
12603     }
12604     if (HistoCode == "D_SSp_SpDs") {
12605       name_same = fCanvSameD_SSp_SpDs;
12606     }
12607     if (HistoCode == "D_Adc_EvDs") {
12608       name_same = fCanvSameD_Adc_EvDs;
12609     }
12610     if (HistoCode == "D_Adc_EvNb") {
12611       name_same = fCanvSameD_Adc_EvNb;
12612     }
12613     if (HistoCode == "H_Ped_Date") {
12614       name_same = fCanvSameH_Ped_Date;
12615     }
12616     if (HistoCode == "H_TNo_Date") {
12617       name_same = fCanvSameH_TNo_Date;
12618     }
12619     if (HistoCode == "H_MCs_Date") {
12620       name_same = fCanvSameH_MCs_Date;
12621     }
12622     if (HistoCode == "H_LFN_Date") {
12623       name_same = fCanvSameH_LFN_Date;
12624     }
12625     if (HistoCode == "H_HFN_Date") {
12626       name_same = fCanvSameH_HFN_Date;
12627     }
12628     if (HistoCode == "H_SCs_Date") {
12629       name_same = fCanvSameH_SCs_Date;
12630     }
12631     if (HistoCode == "H_Ped_RuDs") {
12632       name_same = fCanvSameH_Ped_RuDs;
12633     }
12634     if (HistoCode == "H_TNo_RuDs") {
12635       name_same = fCanvSameH_TNo_RuDs;
12636     }
12637     if (HistoCode == "H_MCs_RuDs") {
12638       name_same = fCanvSameH_MCs_RuDs;
12639     }
12640     if (HistoCode == "H_LFN_RuDs") {
12641       name_same = fCanvSameH_LFN_RuDs;
12642     }
12643     if (HistoCode == "H_HFN_RuDs") {
12644       name_same = fCanvSameH_HFN_RuDs;
12645     }
12646     if (HistoCode == "H_SCs_RuDs") {
12647       name_same = fCanvSameH_SCs_RuDs;
12648     }
12649 
12650     sprintf(f_in, "%d", name_same);
12651     TString s_name_same = f_in;
12652     const Text_t* t_name_same = (const Text_t*)s_name_same.Data();
12653     name_opt_plot.Append(t_name_same);
12654   }
12655   if (opt_plot == fSameOnePlot) {
12656     name_opt_plot = "SAME_Plus_N";
12657     //...................................... name_same (opt_plot = fSeveralPlot)
12658     Int_t name_same = fCanvSameH1SamePlus;
12659     sprintf(f_in, "%d", name_same);
12660     TString s_name_same = f_in;
12661     const Text_t* t_name_same = (const Text_t*)s_name_same.Data();
12662     name_opt_plot.Append(t_name_same);
12663   }
12664 
12665   //......................... name_visu (Set Canvas name)
12666   TString name_visu;
12667   name_visu.Resize(charArrLen);
12668   name_visu = "";
12669 
12670   TString name_line;
12671   name_line.Resize(charArrLen);
12672   name_line = "Line_";
12673   TString HistoType = fCnaParHistos->GetHistoType(HistoCode.Data());
12674   if (HistoType == "Global" && (opt_plot == fSeveralPlot || opt_plot == fSameOnePlot)) {
12675     name_line = "Polm_";
12676   }
12677 
12678   // if(opt_visu == fOptVisLine){name_line = "Line_";}
12679   // if(opt_visu == fOptVisPolm){name_line = "Poly_";}
12680 
12681   const Text_t* t_line = (const Text_t*)name_line.Data();
12682   name_visu.Append(t_line);
12683 
12684   TString name_scale_x;
12685   name_scale_x.Resize(charArrLen);
12686   name_scale_x = "?";
12687   if (opt_scale_x == fOptScaleLinx) {
12688     name_scale_x = "LinX_";
12689   }
12690   if (opt_scale_x == fOptScaleLogx) {
12691     name_scale_x = "LogX_";
12692   }
12693   const Text_t* t_scale_x = (const Text_t*)name_scale_x.Data();
12694   name_visu.Append(t_scale_x);
12695 
12696   TString name_scale_y;
12697   name_scale_y.Resize(charArrLen);
12698   name_scale_y = "?";
12699   if (opt_scale_y == fOptScaleLiny) {
12700     name_scale_y = "LinY";
12701   }
12702   if (opt_scale_y == fOptScaleLogy) {
12703     name_scale_y = "LogY";
12704   }
12705   const Text_t* t_scale_y = (const Text_t*)name_scale_y.Data();
12706   name_visu.Append(t_scale_y);
12707 
12708   //...................................... name quantity (Set Canvas name)
12709   TString name_quantity;
12710   name_quantity.Resize(charArrLen);
12711   name_quantity = "?";
12712 
12713   if (HistoCode == "D_NOE_ChNb") {
12714     name_quantity = "Nb_of_evts_as_func_of_Xtal";
12715   }
12716   if (HistoCode == "D_NOE_ChDs") {
12717     name_quantity = "Nb_of_evts_Xtal_distrib";
12718   }
12719   if (HistoCode == "D_Ped_ChNb") {
12720     name_quantity = "Pedestals_as_func_of_Xtal";
12721   }
12722   if (HistoCode == "D_Ped_ChDs") {
12723     name_quantity = "Pedestals_Xtal_distrib";
12724   }
12725   if (HistoCode == "D_TNo_ChNb") {
12726     name_quantity = "Total_Noise_as_func_of_Xtal";
12727   }
12728   if (HistoCode == "D_TNo_ChDs") {
12729     name_quantity = "Total_Noise_Xtal_distrib";
12730   }
12731   if (HistoCode == "D_MCs_ChNb") {
12732     name_quantity = "Mean_Corss_as_func_of_Xtal";
12733   }
12734   if (HistoCode == "D_MCs_ChDs") {
12735     name_quantity = "Mean_Corss_Xtal_distrib";
12736   }
12737   if (HistoCode == "D_LFN_ChNb") {
12738     name_quantity = "Low_Fq_Noise_as_func_of_Xtal";
12739   }
12740   if (HistoCode == "D_LFN_ChDs") {
12741     name_quantity = "Low_Fq_Noise_Xtal_distrib";
12742   }
12743   if (HistoCode == "D_HFN_ChNb") {
12744     name_quantity = "High_Fq_Noise_as_func_of_Xtal";
12745   }
12746   if (HistoCode == "D_HFN_ChDs") {
12747     name_quantity = "High_Fq_Noise_Xtal_distrib";
12748   }
12749   if (HistoCode == "D_SCs_ChNb") {
12750     name_quantity = "Sigma_Corss_as_func_of_Xtal";
12751   }
12752   if (HistoCode == "D_SCs_ChDs") {
12753     name_quantity = "Sigma_Corss_Xtal_distrib";
12754   }
12755   if (HistoCode == "D_MSp_SpNb") {
12756     name_quantity = "ExpValue_of_samples";
12757   }
12758   if (HistoCode == "D_MSp_SpDs") {
12759     name_quantity = "ExpValue_of_samples_distrib";
12760   }
12761   if (HistoCode == "D_SSp_SpNb") {
12762     name_quantity = "Sigma_of_samples";
12763   }
12764   if (HistoCode == "D_SSp_SpDs") {
12765     name_quantity = "Sigma_of_samples_distrib";
12766   }
12767   if (HistoCode == "D_Adc_EvDs") {
12768     name_quantity = "hevt";
12769   }
12770   if (HistoCode == "D_Adc_EvNb") {
12771     name_quantity = "ADC_as_func_of_Event";
12772   }
12773   if (HistoCode == "H_Ped_Date") {
12774     name_quantity = "Pedestal_history";
12775   }
12776   if (HistoCode == "H_TNo_Date") {
12777     name_quantity = "Total_Noise_history";
12778   }
12779   if (HistoCode == "H_MCs_Date") {
12780     name_quantity = "Mean_Corss_history";
12781   }
12782   if (HistoCode == "H_LFN_Date") {
12783     name_quantity = "Low_Fq_Noise_history";
12784   }
12785   if (HistoCode == "H_HFN_Date") {
12786     name_quantity = "High_Fq_Noise_history";
12787   }
12788   if (HistoCode == "H_SCs_Date") {
12789     name_quantity = "Sigma_Corss_history";
12790   }
12791   if (HistoCode == "H_Ped_RuDs") {
12792     name_quantity = "Pedestal_run_distribution";
12793   }
12794   if (HistoCode == "H_TNo_RuDs") {
12795     name_quantity = "Total_Noise_run_distribution";
12796   }
12797   if (HistoCode == "H_MCs_RuDs") {
12798     name_quantity = "Mean_Corss_run_distribution";
12799   }
12800   if (HistoCode == "H_LFN_RuDs") {
12801     name_quantity = "Low_Fq_Noise_run_distribution";
12802   }
12803   if (HistoCode == "H_HFN_RuDs") {
12804     name_quantity = "High_Fq_Noise_run_distribution";
12805   }
12806   if (HistoCode == "H_SCs_RuDs") {
12807     name_quantity = "Sigma_Corss_run_distribution";
12808   }
12809 
12810   Int_t num_crys = -1;
12811   if (HistoCode == "D_MSp_SpNb") {
12812     num_crys = i0StinEcha;
12813   }
12814   if (HistoCode == "D_MSp_SpDs") {
12815     num_crys = i0StinEcha;
12816   }
12817   if (HistoCode == "D_SSp_SpNb") {
12818     num_crys = i0StinEcha;
12819   }
12820   if (HistoCode == "D_SSp_SpDs") {
12821     num_crys = i0StinEcha;
12822   }
12823   if (HistoCode == "D_Adc_EvDs") {
12824     num_crys = i0StinEcha;
12825   }
12826   if (HistoCode == "D_Adc_EvNb") {
12827     num_crys = i0StinEcha;
12828   }
12829   if (HistoCode == "H_Ped_Date") {
12830     num_crys = i0StinEcha;
12831   }
12832   if (HistoCode == "H_TNo_Date") {
12833     num_crys = i0StinEcha;
12834   }
12835   if (HistoCode == "H_MCs_Date") {
12836     num_crys = i0StinEcha;
12837   }
12838   if (HistoCode == "H_LFN_Date") {
12839     num_crys = i0StinEcha;
12840   }
12841   if (HistoCode == "H_HFN_Date") {
12842     num_crys = i0StinEcha;
12843   }
12844   if (HistoCode == "H_SCs_Date") {
12845     num_crys = i0StinEcha;
12846   }
12847   if (HistoCode == "H_Ped_RuDs") {
12848     num_crys = i0StinEcha;
12849   }
12850   if (HistoCode == "H_TNo_RuDs") {
12851     num_crys = i0StinEcha;
12852   }
12853   if (HistoCode == "H_MCs_RuDs") {
12854     num_crys = i0StinEcha;
12855   }
12856   if (HistoCode == "H_LFN_RuDs") {
12857     num_crys = i0StinEcha;
12858   }
12859   if (HistoCode == "H_HFN_RuDs") {
12860     num_crys = i0StinEcha;
12861   }
12862   if (HistoCode == "H_SCs_RuDs") {
12863     num_crys = i0StinEcha;
12864   }
12865 
12866   Int_t num_samp = -1;
12867   if (HistoCode == "D_Adc_EvDs") {
12868     num_samp = i0Sample;
12869   }
12870   if (HistoCode == "D_Adc_EvNb") {
12871     num_samp = i0Sample;
12872   }
12873 
12874   //........................................................... (Set Canvas name)
12875 
12876   if (HistoCode == "D_NOE_ChNb" || HistoCode == "D_NOE_ChDs" || HistoCode == "D_Ped_ChNb" ||
12877       HistoCode == "D_Ped_ChDs" || HistoCode == "D_TNo_ChNb" || HistoCode == "D_TNo_ChDs" ||
12878       HistoCode == "D_MCs_ChNb" || HistoCode == "D_MCs_ChDs" || HistoCode == "D_LFN_ChNb" ||
12879       HistoCode == "D_LFN_ChDs" || HistoCode == "D_HFN_ChNb" || HistoCode == "D_HFN_ChDs" ||
12880       HistoCode == "D_SCs_ChNb" || HistoCode == "D_SCs_ChDs") {
12881     sprintf(f_in,
12882             "%s_%s_S1_%d_R%d_%d_%d_%d_%s%d_%s_%s",
12883             name_quantity.Data(),
12884             fFapAnaType.Data(),
12885             fFapNbOfSamples,
12886             fFapRunNumber,
12887             fFapFirstReqEvtNumber,
12888             fFapLastReqEvtNumber,
12889             fFapReqNbOfEvts,
12890             fFapStexName.Data(),
12891             fFapStexNumber,
12892             name_opt_plot.Data(),
12893             name_visu.Data());
12894   }
12895 
12896   if (HistoCode == "D_MSp_SpNb" || HistoCode == "D_SSp_SpNb" || HistoCode == "H_Ped_Date" ||
12897       HistoCode == "H_TNo_Date" || HistoCode == "H_MCs_Date" || HistoCode == "H_LFN_Date" ||
12898       HistoCode == "H_HFN_Date" || HistoCode == "H_SCs_Date" || HistoCode == "D_MSp_SpDs" ||
12899       HistoCode == "D_SSp_SpDs" || HistoCode == "H_Ped_RuDs" || HistoCode == "H_TNo_RuDs" ||
12900       HistoCode == "H_MCs_RuDs" || HistoCode == "H_LFN_RuDs" || HistoCode == "H_HFN_RuDs" ||
12901       HistoCode == "H_SCs_RuDs") {
12902     sprintf(f_in,
12903             "%s_%s_S1_%d_R%d_%d_%d_%d_%s%d_%s%d_Xtal%d_%s_%s",
12904             name_quantity.Data(),
12905             fFapAnaType.Data(),
12906             fFapNbOfSamples,
12907             fFapRunNumber,
12908             fFapFirstReqEvtNumber,
12909             fFapLastReqEvtNumber,
12910             fFapReqNbOfEvts,
12911             fFapStexName.Data(),
12912             fFapStexNumber,
12913             fFapStinName.Data(),
12914             StexStin_A,
12915             num_crys,
12916             name_opt_plot.Data(),
12917             name_visu.Data());
12918   }
12919 
12920   if (HistoCode == "D_Adc_EvNb" || HistoCode == "D_Adc_EvDs") {
12921     sprintf(f_in,
12922             "%s_%s_S1_%d_R%d_%d_%d_%d_%s%d_%s%d_Xtal%d_Samp%d_%s_%s",
12923             name_quantity.Data(),
12924             fFapAnaType.Data(),
12925             fFapNbOfSamples,
12926             fFapRunNumber,
12927             fFapFirstReqEvtNumber,
12928             fFapLastReqEvtNumber,
12929             fFapReqNbOfEvts,
12930             fFapStexName.Data(),
12931             fFapStexNumber,
12932             fFapStinName.Data(),
12933             StexStin_A,
12934             num_crys,
12935             num_samp,
12936             name_opt_plot.Data(),
12937             name_visu.Data());
12938   }
12939 
12940   canvas_name = f_in;
12941   return canvas_name.Data();
12942 
12943 }  // end of CanvasName()
12944 
12945 //-----------------------------------------------------------------------------
12946 //
12947 //        M I S C E L L A N E O U S     P A R A M E T E R S
12948 //
12949 //        C O N C E R N I N G    T H E    D I S P L A Y
12950 //
12951 //-----------------------------------------------------------------------------
12952 
12953 //===========================================================================
12954 //
12955 //  GetHistoSize, GetHistoValues, SetHistoXAxisTitle,   SetHistoYAxisTitle,
12956 //  GetHistoXinf, GetHistoXsup,   GetHistoNumberOfBins, FillHisto
12957 //
12958 //===========================================================================
12959 Int_t TEcnaHistos::GetHistoSize(const TString& chqcode, const TString& opt_plot_read) {
12960   // Histo size as a function of the quantity code
12961 
12962   // VERY IMPORTANT: in some cases the number of bins must be strictly related to the parameters values
12963   //                 (number of crystals, number of samples, etc...). See below comments "===> ONE BIN BY..."
12964 
12965   Int_t HisSize = fNbBinsProj;  // default value
12966 
12967   //............ histo with sample number as x coordinate => HisSize depends on option "plot" or "read"
12968   //             because of nb of samples in file: size for plot = 10 even if nb of samples in file < 10
12969   if (chqcode == "D_MSp_SpNb" || chqcode == "D_SSp_SpNb" || chqcode == "D_MSp_SpDs" || chqcode == "D_SSp_SpDs") {
12970     if (opt_plot_read == "read") {
12971       HisSize = fFapNbOfSamples;
12972     }
12973     if (opt_plot_read == "plot") {
12974       HisSize = fEcal->MaxSampADC();
12975     }
12976   }  // ===> ONE BIN BY SAMPLE
12977 
12978   //............ histo with event number as x coordinate.  (==> "D_Adc_EvDs" option: obsolete, to be confirmed)
12979   if (chqcode == "D_Adc_EvNb" || chqcode == "D_Adc_EvDs") {
12980     HisSize = fFapReqNbOfEvts;
12981   }  // ===> ONE BIN BY EVENT
12982 
12983   //............
12984   if (chqcode == "D_NOE_ChNb" || chqcode == "D_Ped_ChNb" || chqcode == "D_TNo_ChNb" || chqcode == "D_MCs_ChNb" ||
12985       chqcode == "D_LFN_ChNb" || chqcode == "D_HFN_ChNb" || chqcode == "D_SCs_ChNb" || chqcode == "D_NOE_ChDs" ||
12986       chqcode == "D_Ped_ChDs" || chqcode == "D_TNo_ChDs" || chqcode == "D_MCs_ChDs" || chqcode == "D_LFN_ChDs" ||
12987       chqcode == "D_HFN_ChDs" || chqcode == "D_SCs_ChDs") {
12988     if (fFlagSubDet == "EB") {
12989       if (fFapStexNumber > 0) {
12990         HisSize = fEcal->MaxCrysEcnaInStex();
12991       }  // ===> ONE BIN BY Xtal
12992       if (fFapStexNumber == 0) {
12993         HisSize = fEcal->MaxSMInEB() * fEcal->MaxTowInSM();
12994       }  // ===> ONE BIN BY Tower
12995     }
12996     if (fFlagSubDet == "EE") {
12997       if (fFapStexNumber > 0) {
12998         if (opt_plot_read == "read") {
12999           HisSize = fEcal->MaxCrysEcnaInDee();
13000         }
13001         if (opt_plot_read == "plot") {
13002           HisSize = fEcal->MaxCrysForConsInDee();
13003         }
13004       }  // ===> ONE BIN BY Xtal
13005       if (fFapStexNumber == 0) {
13006         HisSize = fEcal->MaxDeeInEE() * fEcal->MaxSCForConsInDee();
13007       }  // ===> ONE BIN BY SC
13008     }
13009   }
13010 
13011   if (chqcode == "H_Ped_RuDs" || chqcode == "H_TNo_RuDs" || chqcode == "H_MCs_RuDs" || chqcode == "H_LFN_RuDs" ||
13012       chqcode == "H_HFN_RuDs" || chqcode == "H_SCs_RuDs") {
13013     HisSize = fNbBinsProj;
13014   }
13015 
13016   return HisSize;
13017 }
13018 
13019 TVectorD TEcnaHistos::GetHistoValues(const TVectorD& arg_read_histo,
13020                                      const Int_t& arg_AlreadyRead,
13021                                      TEcnaRead* aMyRootFile,
13022                                      const TString& HistoCode,
13023                                      const Int_t& HisSizePlot,
13024                                      const Int_t& HisSizeRead,
13025                                      const Int_t& StexStin_A,
13026                                      const Int_t& i0StinEcha,
13027                                      const Int_t& i0Sample,
13028                                      Int_t& i_data_exist) {
13029   // Histo values in a TVectorD. i_data_exist entry value = 0. Incremented in this method.
13030 
13031   TVectorD plot_histo(HisSizePlot);
13032   for (Int_t i = 0; i < HisSizePlot; i++) {
13033     plot_histo(i) = (Double_t)0.;
13034   }
13035 
13036   fStatusDataExist = kFALSE;
13037 
13038   if (arg_AlreadyRead >= 1) {
13039     //std::cout << "*TEcnaHistos::GetHistoValues(...)> arg_AlreadyRead = " << arg_AlreadyRead << std::endl;
13040     for (Int_t i = 0; i < HisSizeRead; i++) {
13041       plot_histo(i) = arg_read_histo(i);
13042     }
13043     fStatusDataExist = kTRUE;
13044     i_data_exist++;
13045   }
13046 
13047   if (arg_AlreadyRead == 0) {
13048     //std::cout << "*TEcnaHistos::GetHistoValues(...)> arg_AlreadyRead = " << arg_AlreadyRead << std::endl;
13049     TVectorD read_histo(HisSizeRead);
13050     for (Int_t i = 0; i < HisSizeRead; i++) {
13051       read_histo(i) = (Double_t)0.;
13052     }
13053 
13054     if (HistoCode == "D_MSp_SpNb" || HistoCode == "D_MSp_SpDs" || HistoCode == "D_SSp_SpNb" ||
13055         HistoCode == "D_SSp_SpDs") {
13056       //====> For plots as a function of Sample# (read10->plot10, read3->plot10)
13057       if (HisSizeRead <= HisSizePlot) {
13058         if (HistoCode == "D_MSp_SpNb" || HistoCode == "D_MSp_SpDs") {
13059           read_histo = aMyRootFile->ReadSampleMeans(StexStin_A, i0StinEcha, HisSizeRead);
13060           if (aMyRootFile->DataExist() == kTRUE) {
13061             fStatusDataExist = kTRUE;
13062             i_data_exist++;
13063           }
13064           for (Int_t i = 0; i < HisSizeRead; i++) {
13065             plot_histo(i) = read_histo(i);
13066           }
13067         }
13068 
13069         if (HistoCode == "D_SSp_SpNb" || HistoCode == "D_SSp_SpDs") {
13070           read_histo = aMyRootFile->ReadSampleSigmas(StexStin_A, i0StinEcha, HisSizeRead);
13071           if (aMyRootFile->DataExist() == kTRUE) {
13072             fStatusDataExist = kTRUE;
13073             i_data_exist++;
13074           }
13075           for (Int_t i = 0; i < HisSizeRead; i++) {
13076             plot_histo(i) = read_histo(i);
13077           }
13078         }
13079       } else {
13080         std::cout << "!TEcnaHistos::GetHistoValues(...)> *** ERROR *** > HisSizeRead greater than HisSizePlot"
13081                   << " for plot as a function of sample#. HisSizeRead = " << HisSizeRead
13082                   << ", HisSizePlot = " << HisSizePlot << fTTBELL << std::endl;
13083       }
13084     }  // end of if( HistoCode == "D_MSp_SpNb" || HistoCode == "D_SSp_SpNb" " ||
13085        //            HistoCode == "D_SSp_SpNb" || HistoCode == "D_SSp_SpDs" )
13086 
13087     if (!(HistoCode == "D_MSp_SpNb" || HistoCode == "D_SSp_SpNb" || HistoCode == "D_MSp_SpDs" ||
13088           HistoCode == "D_SSp_SpDs"))  // = else of previous if
13089     {
13090       //====> For other plots
13091       if (HisSizeRead == HisSizePlot) {
13092         //========> for EE, HisSizeRead > HisSizePlot but readEcna#->plotForCons# will be build in the calling method
13093         //          HisSizeRead = fEcal->MaxCrysEcnaInStex() (GetHistoValues)
13094 
13095         if (HistoCode == "D_Adc_EvNb" || HistoCode == "D_Adc_EvDs") {
13096           read_histo = aMyRootFile->ReadSampleAdcValues(StexStin_A, i0StinEcha, i0Sample, HisSizeRead);
13097           if (aMyRootFile->DataExist() == kTRUE) {
13098             fStatusDataExist = kTRUE;
13099             i_data_exist++;
13100           }
13101         }
13102 
13103         if (HistoCode == "D_NOE_ChNb" || HistoCode == "D_NOE_ChDs") {
13104           read_histo = aMyRootFile->ReadNumberOfEvents(HisSizeRead);
13105           if (aMyRootFile->DataExist() == kTRUE) {
13106             fStatusDataExist = kTRUE;
13107             i_data_exist++;
13108           }
13109         }
13110 
13111         if (HistoCode == "D_Ped_ChNb" || HistoCode == "D_Ped_ChDs") {
13112           read_histo = aMyRootFile->ReadPedestals(HisSizeRead);
13113           if (aMyRootFile->DataExist() == kTRUE) {
13114             fStatusDataExist = kTRUE;
13115             i_data_exist++;
13116           }
13117         }
13118 
13119         //...................................................... (GetHistoValues)
13120         if (HistoCode == "D_TNo_ChNb" || HistoCode == "D_TNo_ChDs") {
13121           read_histo = aMyRootFile->ReadTotalNoise(HisSizeRead);
13122           if (aMyRootFile->DataExist() == kTRUE) {
13123             fStatusDataExist = kTRUE;
13124             i_data_exist++;
13125           }
13126         }
13127 
13128         if (HistoCode == "D_LFN_ChNb" || HistoCode == "D_LFN_ChDs") {
13129           read_histo = aMyRootFile->ReadLowFrequencyNoise(HisSizeRead);
13130           if (aMyRootFile->DataExist() == kTRUE) {
13131             fStatusDataExist = kTRUE;
13132             i_data_exist++;
13133           }
13134         }
13135 
13136         if (HistoCode == "D_HFN_ChNb" || HistoCode == "D_HFN_ChDs") {
13137           read_histo = aMyRootFile->ReadHighFrequencyNoise(HisSizeRead);
13138           if (aMyRootFile->DataExist() == kTRUE) {
13139             fStatusDataExist = kTRUE;
13140             i_data_exist++;
13141           }
13142         }
13143 
13144         if (HistoCode == "D_MCs_ChNb" || HistoCode == "D_MCs_ChDs") {
13145           read_histo = aMyRootFile->ReadMeanCorrelationsBetweenSamples(HisSizeRead);
13146           if (aMyRootFile->DataExist() == kTRUE) {
13147             fStatusDataExist = kTRUE;
13148             i_data_exist++;
13149           }
13150         }
13151 
13152         if (HistoCode == "D_SCs_ChNb" || HistoCode == "D_SCs_ChDs") {
13153           read_histo = aMyRootFile->ReadSigmaOfCorrelationsBetweenSamples(HisSizeRead);
13154           if (aMyRootFile->DataExist() == kTRUE) {
13155             fStatusDataExist = kTRUE;
13156             i_data_exist++;
13157           }
13158         }
13159 
13160         for (Int_t i = 0; i < HisSizeRead; i++) {
13161           plot_histo(i) = read_histo(i);
13162         }
13163 
13164       } else {
13165         std::cout << "!TEcnaHistos::GetHistoValues(...)> *** ERROR *** > HisSizeRead not equal to HisSizePlot."
13166                   << " HisSizeRead = " << HisSizeRead << ", HisSizePlot = " << HisSizePlot << fTTBELL << std::endl;
13167       }
13168     }  // end of if( !(HistoCode == "D_MSp_SpNb" || HistoCode == "D_SSp_SpNb") )
13169   }    // end of if( arg_AlreadyRead == 0 )
13170 
13171   if (i_data_exist == 0) {
13172     std::cout << "!TEcnaHistos::GetHistoValues(...)> Histo not found." << fTTBELL << std::endl;
13173   }
13174 
13175   return plot_histo;
13176 }
13177 //------- (end of GetHistoValues) -------------
13178 
13179 TString TEcnaHistos::SetHistoXAxisTitle(const TString& HistoCode) {
13180   // Set histo X axis title
13181 
13182   TString axis_x_var_name;
13183 
13184   if (HistoCode == "D_NOE_ChNb" || HistoCode == "D_Ped_ChNb" || HistoCode == "D_TNo_ChNb" ||
13185       HistoCode == "D_MCs_ChNb" || HistoCode == "D_LFN_ChNb" || HistoCode == "D_HFN_ChNb" ||
13186       HistoCode == "D_SCs_ChNb") {
13187     if (fFapStexNumber > 0) {
13188       if (fFlagSubDet == "EB") {
13189         axis_x_var_name = "Xtal (electronic channel number)";
13190       }
13191       if (fFlagSubDet == "EE") {
13192         axis_x_var_name = "Xtal";
13193       }
13194     }
13195     if (fFapStexNumber == 0) {
13196       if (fFlagSubDet == "EB") {
13197         axis_x_var_name = "Tower number";
13198       }
13199       if (fFlagSubDet == "EE") {
13200         axis_x_var_name = "SC number";
13201       }
13202     }
13203   }
13204 
13205   if (HistoCode == "D_NOE_ChDs") {
13206     axis_x_var_name = "Number of events";
13207   }
13208   if (HistoCode == "D_Ped_ChDs") {
13209     axis_x_var_name = "Pedestal";
13210   }
13211   if (HistoCode == "D_TNo_ChDs") {
13212     axis_x_var_name = "Total noise";
13213   }
13214   if (HistoCode == "D_MCs_ChDs") {
13215     axis_x_var_name = "Mean cor(s,s')";
13216   }
13217   if (HistoCode == "D_LFN_ChDs") {
13218     axis_x_var_name = "Low frequency noise";
13219   }
13220   if (HistoCode == "D_HFN_ChDs") {
13221     axis_x_var_name = "High frequency noise";
13222   }
13223   if (HistoCode == "D_SCs_ChDs") {
13224     axis_x_var_name = "Sigmas cor(s,s')";
13225   }
13226   if (HistoCode == "D_MSp_SpNb") {
13227     axis_x_var_name = "Sample";
13228   }
13229   if (HistoCode == "D_MSp_SpDs") {
13230     axis_x_var_name = "Pedestal";
13231   }
13232   if (HistoCode == "D_SSp_SpNb") {
13233     axis_x_var_name = "Sample";
13234   }
13235   if (HistoCode == "D_SSp_SpDs") {
13236     axis_x_var_name = "Total noise";
13237   }
13238   if (HistoCode == "D_Adc_EvDs") {
13239     axis_x_var_name = "ADC";
13240   }
13241   if (HistoCode == "D_Adc_EvNb") {
13242     axis_x_var_name = "Event number";
13243   }
13244   if (HistoCode == "H_Ped_Date" || HistoCode == "H_TNo_Date" || HistoCode == "H_MCs_Date" ||
13245       HistoCode == "H_LFN_Date" || HistoCode == "H_HFN_Date" || HistoCode == "H_SCs_Date") {
13246     axis_x_var_name = "Time";
13247   }
13248   if (HistoCode == "H_Ped_RuDs") {
13249     axis_x_var_name = "Pedestal";
13250   }
13251   if (HistoCode == "H_TNo_RuDs") {
13252     axis_x_var_name = "Total noise";
13253   }
13254   if (HistoCode == "H_MCs_RuDs") {
13255     axis_x_var_name = "Mean cor(s,s')";
13256   }
13257   if (HistoCode == "H_LFN_RuDs") {
13258     axis_x_var_name = "Low frequency noise";
13259   }
13260   if (HistoCode == "H_HFN_RuDs") {
13261     axis_x_var_name = "High frequency noise";
13262   }
13263   if (HistoCode == "H_SCs_RuDs") {
13264     axis_x_var_name = "Sigmas cor(s,s')";
13265   }
13266 
13267   return axis_x_var_name;
13268 }
13269 
13270 TString TEcnaHistos::SetHistoYAxisTitle(const TString& HistoCode) {
13271   // Set histo Y axis title
13272 
13273   TString axis_y_var_name;
13274 
13275   if (HistoCode == "D_NOE_ChNb") {
13276     axis_y_var_name = "Number of events";
13277   }
13278   if (HistoCode == "D_Ped_ChNb") {
13279     axis_y_var_name = "Pedestal";
13280   }
13281   if (HistoCode == "D_TNo_ChNb") {
13282     axis_y_var_name = "Total noise";
13283   }
13284   if (HistoCode == "D_MCs_ChNb") {
13285     axis_y_var_name = "Mean cor(s,s')";
13286   }
13287   if (HistoCode == "D_LFN_ChNb") {
13288     axis_y_var_name = "Low frequency noise";
13289   }
13290   if (HistoCode == "D_HFN_ChNb") {
13291     axis_y_var_name = "High frequency noise";
13292   }
13293   if (HistoCode == "D_SCs_ChNb") {
13294     axis_y_var_name = "Sigma of cor(s,s')";
13295   }
13296 
13297   if (HistoCode == "D_NOE_ChDs" || HistoCode == "D_Ped_ChDs" || HistoCode == "D_TNo_ChDs" ||
13298       HistoCode == "D_MCs_ChDs" || HistoCode == "D_LFN_ChDs" || HistoCode == "D_HFN_ChDs" ||
13299       HistoCode == "D_SCs_ChDs") {
13300     if (fFapStexNumber > 0) {
13301       axis_y_var_name = "number of crystals";
13302     }
13303     if (fFapStexNumber == 0) {
13304       if (fFlagSubDet == "EB") {
13305         axis_y_var_name = "number of towers";
13306       }
13307       if (fFlagSubDet == "EE") {
13308         axis_y_var_name = "number of SC's";
13309       }
13310     }
13311   }
13312 
13313   if (HistoCode == "D_MSp_SpNb") {
13314     axis_y_var_name = "Sample mean";
13315   }
13316   if (HistoCode == "D_MSp_SpDs") {
13317     axis_y_var_name = "Number of samples";
13318   }
13319   if (HistoCode == "D_SSp_SpNb") {
13320     axis_y_var_name = "Sample sigma";
13321   }
13322   if (HistoCode == "D_SSp_SpDs") {
13323     axis_y_var_name = "Number of samples";
13324   }
13325   if (HistoCode == "D_Adc_EvNb") {
13326     axis_y_var_name = "Sample ADC value";
13327   }
13328   if (HistoCode == "D_Adc_EvDs") {
13329     axis_y_var_name = "Number of events";
13330   }
13331   if (HistoCode == "H_Ped_Date") {
13332     axis_y_var_name = "Pedestal";
13333   }
13334   if (HistoCode == "H_TNo_Date") {
13335     axis_y_var_name = "Total noise";
13336   }
13337   if (HistoCode == "H_MCs_Date") {
13338     axis_y_var_name = "Mean cor(s,s')";
13339   }
13340   if (HistoCode == "H_LFN_Date") {
13341     axis_y_var_name = "Low frequency noise";
13342   }
13343   if (HistoCode == "H_HFN_Date") {
13344     axis_y_var_name = "High frequency noise";
13345   }
13346   if (HistoCode == "H_SCs_Date") {
13347     axis_y_var_name = "Sigma cor(s,s')";
13348   }
13349 
13350   if (HistoCode == "H_Ped_RuDs" || HistoCode == "H_TNo_RuDs" || HistoCode == "H_MCs_RuDs" ||
13351       HistoCode == "H_LFN_RuDs" || HistoCode == "H_HFN_RuDs" || HistoCode == "H_SCs_RuDs") {
13352     axis_y_var_name = "number of runs";
13353   }
13354 
13355   return axis_y_var_name;
13356 }
13357 //-------------------------------------------------------------------------------
13358 Axis_t TEcnaHistos::GetHistoXinf(const TString& HistoCode, const Int_t& HisSize, const TString& opt_plot) {
13359   // Set histo Xinf
13360 
13361   Axis_t xinf_his = (Axis_t)0;
13362 
13363   if (HistoCode == "D_NOE_ChNb") {
13364     xinf_his = (Axis_t)0.;
13365   }
13366   if (HistoCode == "D_Ped_ChNb") {
13367     xinf_his = (Axis_t)0.;
13368   }
13369   if (HistoCode == "D_TNo_ChNb") {
13370     xinf_his = (Axis_t)0.;
13371   }
13372   if (HistoCode == "D_MCs_ChNb") {
13373     xinf_his = (Axis_t)0.;
13374   }
13375   if (HistoCode == "D_LFN_ChNb") {
13376     xinf_his = (Axis_t)0.;
13377   }
13378   if (HistoCode == "D_HFN_ChNb") {
13379     xinf_his = (Axis_t)0.;
13380   }
13381   if (HistoCode == "D_SCs_ChNb") {
13382     xinf_his = (Axis_t)0.;
13383   }
13384   if (HistoCode == "D_MSp_SpNb") {
13385     xinf_his = (Axis_t)0.;
13386   }
13387   if (HistoCode == "D_SSp_SpNb") {
13388     xinf_his = (Axis_t)0.;
13389   }
13390   if (HistoCode == "D_Adc_EvNb") {
13391     xinf_his = (Axis_t)0.;
13392   }
13393 
13394   if (HistoCode == "D_NOE_ChDs") {
13395     xinf_his = (Axis_t)fD_NOE_ChNbYmin;
13396   }  // D_XXX_YYDs = projection of D_XXX_YYNb
13397   if (HistoCode == "D_Ped_ChDs") {
13398     xinf_his = (Axis_t)fD_Ped_ChNbYmin;
13399   }
13400   if (HistoCode == "D_TNo_ChDs") {
13401     xinf_his = (Axis_t)fD_TNo_ChNbYmin;
13402   }
13403   if (HistoCode == "D_MCs_ChDs") {
13404     xinf_his = (Axis_t)fD_MCs_ChNbYmin;
13405   }
13406   if (HistoCode == "D_LFN_ChDs") {
13407     xinf_his = (Axis_t)fD_LFN_ChNbYmin;
13408   }
13409   if (HistoCode == "D_HFN_ChDs") {
13410     xinf_his = (Axis_t)fD_HFN_ChNbYmin;
13411   }
13412   if (HistoCode == "D_SCs_ChDs") {
13413     xinf_his = (Axis_t)fD_SCs_ChNbYmin;
13414   }
13415   if (HistoCode == "D_MSp_SpDs") {
13416     xinf_his = (Axis_t)fD_MSp_SpNbYmin;
13417   }
13418   if (HistoCode == "D_SSp_SpDs") {
13419     xinf_his = (Axis_t)fD_SSp_SpNbYmin;
13420   }
13421   if (HistoCode == "D_Adc_EvDs") {
13422     xinf_his = (Axis_t)fD_Adc_EvNbYmin;
13423   }
13424 
13425   if (HistoCode == "H_Ped_Date") {
13426     xinf_his = (Axis_t)0.;
13427   }
13428   if (HistoCode == "H_TNo_Date") {
13429     xinf_his = (Axis_t)0.;
13430   }
13431   if (HistoCode == "H_MCs_Date") {
13432     xinf_his = (Axis_t)0.;
13433   }
13434   if (HistoCode == "H_LFN_Date") {
13435     xinf_his = (Axis_t)0.;
13436   }
13437   if (HistoCode == "H_HFN_Date") {
13438     xinf_his = (Axis_t)0.;
13439   }
13440   if (HistoCode == "H_SCs_Date") {
13441     xinf_his = (Axis_t)0.;
13442   }
13443 
13444   if (HistoCode == "H_Ped_RuDs") {
13445     xinf_his = (Axis_t)fH_Ped_RuDsYmin;
13446   }
13447   if (HistoCode == "H_TNo_RuDs") {
13448     xinf_his = (Axis_t)fH_TNo_RuDsYmin;
13449   }
13450   if (HistoCode == "H_MCs_RuDs") {
13451     xinf_his = (Axis_t)fH_MCs_RuDsYmin;
13452   }
13453   if (HistoCode == "H_LFN_RuDs") {
13454     xinf_his = (Axis_t)fH_LFN_RuDsYmin;
13455   }
13456   if (HistoCode == "H_HFN_RuDs") {
13457     xinf_his = (Axis_t)fH_HFN_RuDsYmin;
13458   }
13459   if (HistoCode == "H_SCs_RuDs") {
13460     xinf_his = (Axis_t)fH_SCs_RuDsYmin;
13461   }
13462 
13463   return xinf_his;
13464 }
13465 
13466 Axis_t TEcnaHistos::GetHistoXsup(const TString& HistoCode, const Int_t& HisSize, const TString& opt_plot) {
13467   // Set histo Xsup
13468 
13469   Axis_t xsup_his = (Axis_t)0;
13470 
13471   if (HistoCode == "D_NOE_ChNb") {
13472     xsup_his = (Axis_t)HisSize;
13473   }
13474   if (HistoCode == "D_Ped_ChNb") {
13475     xsup_his = (Axis_t)HisSize;
13476   }
13477   if (HistoCode == "D_TNo_ChNb") {
13478     xsup_his = (Axis_t)HisSize;
13479   }
13480   if (HistoCode == "D_MCs_ChNb") {
13481     xsup_his = (Axis_t)HisSize;
13482   }
13483   if (HistoCode == "D_LFN_ChNb") {
13484     xsup_his = (Axis_t)HisSize;
13485   }
13486   if (HistoCode == "D_HFN_ChNb") {
13487     xsup_his = (Axis_t)HisSize;
13488   }
13489   if (HistoCode == "D_SCs_ChNb") {
13490     xsup_his = (Axis_t)HisSize;
13491   }
13492   if (HistoCode == "D_MSp_SpNb") {
13493     xsup_his = (Axis_t)HisSize;
13494   }
13495   if (HistoCode == "D_SSp_SpNb") {
13496     xsup_his = (Axis_t)HisSize;
13497   }
13498   if (HistoCode == "D_Adc_EvNb") {
13499     xsup_his = (Axis_t)(fFapReqNbOfEvts);
13500   }
13501 
13502   if (HistoCode == "D_NOE_ChDs") {
13503     xsup_his = (Axis_t)fD_NOE_ChNbYmax;
13504   }
13505   if (HistoCode == "D_Ped_ChDs") {
13506     xsup_his = (Axis_t)fD_Ped_ChNbYmax;
13507   }
13508   if (HistoCode == "D_TNo_ChDs") {
13509     xsup_his = (Axis_t)fD_TNo_ChNbYmax;
13510   }
13511   if (HistoCode == "D_MCs_ChDs") {
13512     xsup_his = (Axis_t)fD_MCs_ChNbYmax;
13513   }
13514   if (HistoCode == "D_LFN_ChDs") {
13515     xsup_his = (Axis_t)fD_LFN_ChNbYmax;
13516   }
13517   if (HistoCode == "D_HFN_ChDs") {
13518     xsup_his = (Axis_t)fD_HFN_ChNbYmax;
13519   }
13520   if (HistoCode == "D_SCs_ChDs") {
13521     xsup_his = (Axis_t)fD_SCs_ChNbYmax;
13522   }
13523   if (HistoCode == "D_MSp_SpDs") {
13524     xsup_his = (Axis_t)fD_MSp_SpNbYmax;
13525   }
13526   if (HistoCode == "D_SSp_SpDs") {
13527     xsup_his = (Axis_t)fD_SSp_SpNbYmax;
13528   }
13529   if (HistoCode == "D_Adc_EvDs") {
13530     xsup_his = (Axis_t)fD_Adc_EvNbYmax;
13531   }
13532 
13533   if (HistoCode == "H_Ped_Date") {
13534     xsup_his = (Axis_t)0.;
13535   }
13536   if (HistoCode == "H_TNo_Date") {
13537     xsup_his = (Axis_t)0.;
13538   }
13539   if (HistoCode == "H_MCs_Date") {
13540     xsup_his = (Axis_t)0.;
13541   }
13542   if (HistoCode == "H_LFN_Date") {
13543     xsup_his = (Axis_t)0.;
13544   }
13545   if (HistoCode == "H_HFN_Date") {
13546     xsup_his = (Axis_t)0.;
13547   }
13548   if (HistoCode == "H_SCs_Date") {
13549     xsup_his = (Axis_t)0.;
13550   }
13551 
13552   if (HistoCode == "H_Ped_RuDs") {
13553     xsup_his = (Axis_t)fH_Ped_RuDsYmax;
13554   }
13555   if (HistoCode == "H_TNo_RuDs") {
13556     xsup_his = (Axis_t)fH_TNo_RuDsYmax;
13557   }
13558   if (HistoCode == "H_MCs_RuDs") {
13559     xsup_his = (Axis_t)fH_MCs_RuDsYmax;
13560   }
13561   if (HistoCode == "H_LFN_RuDs") {
13562     xsup_his = (Axis_t)fH_LFN_RuDsYmax;
13563   }
13564   if (HistoCode == "H_HFN_RuDs") {
13565     xsup_his = (Axis_t)fH_HFN_RuDsYmax;
13566   }
13567   if (HistoCode == "H_SCs_RuDs") {
13568     xsup_his = (Axis_t)fH_SCs_RuDsYmax;
13569   }
13570 
13571   return xsup_his;
13572 }
13573 //-----------------------------------------------------------------------------------
13574 Int_t TEcnaHistos::GetHistoNumberOfBins(const TString& HistoCode, const Int_t& HisSize) {
13575   // Set histo number of bins
13576 
13577   Int_t nb_binx = HisSize;
13578   TString HistoType = fCnaParHistos->GetHistoType(HistoCode.Data());
13579   if (HistoType == "Proj" || HistoType == "SampProj" || HistoType == "EvolProj" || HistoType == "H1BasicProj") {
13580     nb_binx = fNbBinsProj;
13581   }
13582 
13583   return nb_binx;
13584 }
13585 //-----------------------------------------------------------------------------------
13586 void TEcnaHistos::FillHisto(TH1D* h_his0, const TVectorD& read_histo, const TString& HistoCode, const Int_t& HisSize) {
13587   // Fill histo
13588 
13589   h_his0->Reset();
13590 
13591   for (Int_t i = 0; i < HisSize; i++) {
13592     Double_t his_val = (Double_t)0;
13593     Double_t xi = (Double_t)0;
13594     //................................................... Basic + Global
13595     if (HistoCode == "D_NOE_ChNb" || HistoCode == "D_Ped_ChNb" || HistoCode == "D_LFN_ChNb" ||
13596         HistoCode == "D_TNo_ChNb" || HistoCode == "D_HFN_ChNb" || HistoCode == "D_MCs_ChNb" ||
13597         HistoCode == "D_SCs_ChNb" || HistoCode == "D_MSp_SpNb" || HistoCode == "D_SSp_SpNb") {
13598       xi = (Double_t)i;
13599       his_val = (Double_t)read_histo[i];
13600       h_his0->Fill(xi, his_val);
13601     }
13602 
13603     //................................................... D_Adc_EvNb option
13604     if (HistoCode == "D_Adc_EvNb") {
13605       xi = (Double_t)i;
13606       his_val = (Double_t)read_histo[i];
13607       h_his0->Fill(xi, his_val);
13608     }
13609     //................................................... Proj
13610     if (HistoCode == "D_NOE_ChDs" || HistoCode == "D_Ped_ChDs" || HistoCode == "D_LFN_ChDs" ||
13611         HistoCode == "D_TNo_ChDs" || HistoCode == "D_HFN_ChDs" || HistoCode == "D_MCs_ChDs" ||
13612         HistoCode == "D_SCs_ChDs" || HistoCode == "D_MSp_SpDs" || HistoCode == "D_SSp_SpDs" ||
13613         HistoCode == "D_Adc_EvDs") {
13614       his_val = (Double_t)read_histo[i];
13615       Double_t increment = (Double_t)1;
13616       h_his0->Fill(his_val, increment);
13617     }
13618 
13619     //................................................... EvolProj
13620     //
13621     //    *=======> direct Fill in ViewHistime(...)
13622     //
13623   }
13624 }
13625 
13626 //===========================================================================
13627 //
13628 //          SetXinfMemoFromValue(...), SetXsupMemoFromValue(...)
13629 //          GetXsupValueFromMemo(...), GetXsupValueFromMemo(...)
13630 //
13631 //===========================================================================
13632 void TEcnaHistos::SetXinfMemoFromValue(const TString& HistoCode, const Double_t& value) {
13633   if (HistoCode == "D_NOE_ChNb") {
13634     fD_NOE_ChNbXinf = value;
13635   }
13636   if (HistoCode == "D_NOE_ChDs") {
13637     fD_NOE_ChDsXinf = value;
13638   }
13639   if (HistoCode == "D_Ped_ChNb") {
13640     fD_Ped_ChNbXinf = value;
13641   }
13642   if (HistoCode == "D_Ped_ChDs") {
13643     fD_Ped_ChDsXinf = value;
13644   }
13645   if (HistoCode == "D_TNo_ChNb") {
13646     fD_TNo_ChNbXinf = value;
13647   }
13648   if (HistoCode == "D_TNo_ChDs") {
13649     fD_TNo_ChDsXinf = value;
13650   }
13651   if (HistoCode == "D_MCs_ChNb") {
13652     fD_MCs_ChNbXinf = value;
13653   }
13654   if (HistoCode == "D_MCs_ChDs") {
13655     fD_MCs_ChDsXinf = value;
13656   }
13657   if (HistoCode == "D_LFN_ChNb") {
13658     fD_LFN_ChNbXinf = value;
13659   }
13660   if (HistoCode == "D_LFN_ChDs") {
13661     fD_LFN_ChDsXinf = value;
13662   }
13663   if (HistoCode == "D_HFN_ChNb") {
13664     fD_HFN_ChNbXinf = value;
13665   }
13666   if (HistoCode == "D_HFN_ChDs") {
13667     fD_HFN_ChDsXinf = value;
13668   }
13669   if (HistoCode == "D_SCs_ChNb") {
13670     fD_SCs_ChNbXinf = value;
13671   }
13672   if (HistoCode == "D_SCs_ChDs") {
13673     fD_SCs_ChDsXinf = value;
13674   }
13675   if (HistoCode == "D_MSp_SpNb") {
13676     fD_Ped_ChNbXinf = value;
13677   }
13678   if (HistoCode == "D_MSp_SpDs") {
13679     fD_Ped_ChDsXinf = value;
13680   }
13681   if (HistoCode == "D_SSp_SpNb") {
13682     fD_TNo_ChNbXinf = value;
13683   }
13684   if (HistoCode == "D_SSp_SpDs") {
13685     fD_TNo_ChDsXinf = value;
13686   }
13687   if (HistoCode == "D_Adc_EvNb") {
13688     fD_Ped_ChNbXinf = value;
13689   }
13690   if (HistoCode == "D_Adc_EvDs") {
13691     fD_Adc_EvDsXinf = value;
13692   }
13693   if (HistoCode == "H_Ped_Date") {
13694     fH_Ped_DateXinf = value;
13695   }
13696   if (HistoCode == "H_TNo_Date") {
13697     fH_TNo_DateXinf = value;
13698   }
13699   if (HistoCode == "H_MCs_Date") {
13700     fH_MCs_DateXinf = value;
13701   }
13702   if (HistoCode == "H_LFN_Date") {
13703     fH_LFN_DateXinf = value;
13704   }
13705   if (HistoCode == "H_HFN_Date") {
13706     fH_HFN_DateXinf = value;
13707   }
13708   if (HistoCode == "H_SCs_Date") {
13709     fH_SCs_DateXinf = value;
13710   }
13711   if (HistoCode == "H_Ped_RuDs") {
13712     fH_Ped_RuDsXinf = value;
13713   }
13714   if (HistoCode == "H_TNo_RuDs") {
13715     fH_TNo_RuDsXinf = value;
13716   }
13717   if (HistoCode == "H_MCs_RuDs") {
13718     fH_MCs_RuDsXinf = value;
13719   }
13720   if (HistoCode == "H_LFN_RuDs") {
13721     fH_LFN_RuDsXinf = value;
13722   }
13723   if (HistoCode == "H_HFN_RuDs") {
13724     fH_HFN_RuDsXinf = value;
13725   }
13726   if (HistoCode == "H_SCs_RuDs") {
13727     fH_SCs_RuDsXinf = value;
13728   }
13729 }  // end of SetXinfMemoFromValue(...)
13730 
13731 void TEcnaHistos::SetXinfMemoFromValue(const Double_t& value) { fH1SameOnePlotXinf = value; }
13732 
13733 void TEcnaHistos::SetXsupMemoFromValue(const TString& HistoCode, const Double_t& value) {
13734   if (HistoCode == "D_NOE_ChNb") {
13735     fD_NOE_ChNbXsup = value;
13736   }
13737   if (HistoCode == "D_NOE_ChDs") {
13738     fD_NOE_ChDsXsup = value;
13739   }
13740   if (HistoCode == "D_Ped_ChNb") {
13741     fD_Ped_ChNbXsup = value;
13742   }
13743   if (HistoCode == "D_Ped_ChDs") {
13744     fD_Ped_ChDsXsup = value;
13745   }
13746   if (HistoCode == "D_TNo_ChNb") {
13747     fD_TNo_ChNbXsup = value;
13748   }
13749   if (HistoCode == "D_TNo_ChDs") {
13750     fD_TNo_ChDsXsup = value;
13751   }
13752   if (HistoCode == "D_MCs_ChNb") {
13753     fD_MCs_ChNbXsup = value;
13754   }
13755   if (HistoCode == "D_MCs_ChDs") {
13756     fD_MCs_ChDsXsup = value;
13757   }
13758   if (HistoCode == "D_LFN_ChNb") {
13759     fD_LFN_ChNbXsup = value;
13760   }
13761   if (HistoCode == "D_LFN_ChDs") {
13762     fD_LFN_ChDsXsup = value;
13763   }
13764   if (HistoCode == "D_HFN_ChNb") {
13765     fD_HFN_ChNbXsup = value;
13766   }
13767   if (HistoCode == "D_HFN_ChDs") {
13768     fD_HFN_ChDsXsup = value;
13769   }
13770   if (HistoCode == "D_SCs_ChNb") {
13771     fD_SCs_ChNbXsup = value;
13772   }
13773   if (HistoCode == "D_SCs_ChDs") {
13774     fD_SCs_ChDsXsup = value;
13775   }
13776   if (HistoCode == "D_MSp_SpNb") {
13777     fD_Ped_ChNbXsup = value;
13778   }
13779   if (HistoCode == "D_MSp_SpDs") {
13780     fD_Ped_ChDsXsup = value;
13781   }
13782   if (HistoCode == "D_SSp_SpNb") {
13783     fD_TNo_ChNbXsup = value;
13784   }
13785   if (HistoCode == "D_SSp_SpDs") {
13786     fD_TNo_ChDsXsup = value;
13787   }
13788   if (HistoCode == "D_Adc_EvNb") {
13789     fD_Ped_ChNbXsup = value;
13790   }
13791   if (HistoCode == "D_Adc_EvDs") {
13792     fD_Adc_EvDsXsup = value;
13793   }
13794   if (HistoCode == "H_Ped_Date") {
13795     fH_Ped_DateXsup = value;
13796   }
13797   if (HistoCode == "H_TNo_Date") {
13798     fH_TNo_DateXsup = value;
13799   }
13800   if (HistoCode == "H_MCs_Date") {
13801     fH_MCs_DateXsup = value;
13802   }
13803   if (HistoCode == "H_LFN_Date") {
13804     fH_LFN_DateXsup = value;
13805   }
13806   if (HistoCode == "H_HFN_Date") {
13807     fH_HFN_DateXsup = value;
13808   }
13809   if (HistoCode == "H_SCs_Date") {
13810     fH_SCs_DateXsup = value;
13811   }
13812   if (HistoCode == "H_Ped_RuDs") {
13813     fH_Ped_RuDsXsup = value;
13814   }
13815   if (HistoCode == "H_TNo_RuDs") {
13816     fH_TNo_RuDsXsup = value;
13817   }
13818   if (HistoCode == "H_MCs_RuDs") {
13819     fH_MCs_RuDsXsup = value;
13820   }
13821   if (HistoCode == "H_LFN_RuDs") {
13822     fH_LFN_RuDsXsup = value;
13823   }
13824   if (HistoCode == "H_HFN_RuDs") {
13825     fH_HFN_RuDsXsup = value;
13826   }
13827   if (HistoCode == "H_SCs_RuDs") {
13828     fH_SCs_RuDsXsup = value;
13829   }
13830 }  // end of SetXsupMemoFromValue(...)
13831 
13832 void TEcnaHistos::SetXsupMemoFromValue(const Double_t& value) { fH1SameOnePlotXsup = value; }
13833 
13834 Double_t TEcnaHistos::GetXinfValueFromMemo(const TString& HistoCode) {
13835   Double_t val_inf = (Double_t)0.;
13836 
13837   if (HistoCode == "D_NOE_ChNb") {
13838     val_inf = fD_NOE_ChNbXinf;
13839   }
13840   if (HistoCode == "D_NOE_ChDs") {
13841     val_inf = fD_NOE_ChDsXinf;
13842   }
13843   if (HistoCode == "D_Ped_ChNb") {
13844     val_inf = fD_Ped_ChNbXinf;
13845   }
13846   if (HistoCode == "D_Ped_ChDs") {
13847     val_inf = fD_Ped_ChDsXinf;
13848   }
13849   if (HistoCode == "D_TNo_ChNb") {
13850     val_inf = fD_TNo_ChNbXinf;
13851   }
13852   if (HistoCode == "D_TNo_ChDs") {
13853     val_inf = fD_TNo_ChDsXinf;
13854   }
13855   if (HistoCode == "D_MCs_ChNb") {
13856     val_inf = fD_MCs_ChNbXinf;
13857   }
13858   if (HistoCode == "D_MCs_ChDs") {
13859     val_inf = fD_MCs_ChDsXinf;
13860   }
13861   if (HistoCode == "D_LFN_ChNb") {
13862     val_inf = fD_LFN_ChNbXinf;
13863   }
13864   if (HistoCode == "D_LFN_ChDs") {
13865     val_inf = fD_LFN_ChDsXinf;
13866   }
13867   if (HistoCode == "D_HFN_ChNb") {
13868     val_inf = fD_HFN_ChNbXinf;
13869   }
13870   if (HistoCode == "D_HFN_ChDs") {
13871     val_inf = fD_HFN_ChDsXinf;
13872   }
13873   if (HistoCode == "D_SCs_ChNb") {
13874     val_inf = fD_SCs_ChNbXinf;
13875   }
13876   if (HistoCode == "D_SCs_ChDs") {
13877     val_inf = fD_SCs_ChDsXinf;
13878   }
13879   if (HistoCode == "D_MSp_SpNb") {
13880     val_inf = fD_Ped_ChNbXinf;
13881   }
13882   if (HistoCode == "D_MSp_SpDs") {
13883     val_inf = fD_Ped_ChDsXinf;
13884   }
13885   if (HistoCode == "D_SSp_SpNb") {
13886     val_inf = fD_TNo_ChNbXinf;
13887   }
13888   if (HistoCode == "D_SSp_SpDs") {
13889     val_inf = fD_TNo_ChDsXinf;
13890   }
13891   if (HistoCode == "D_Adc_EvNb") {
13892     val_inf = fD_Adc_EvNbXinf;
13893   }
13894   if (HistoCode == "D_Adc_EvDs") {
13895     val_inf = fD_Adc_EvDsXinf;
13896   }
13897   if (HistoCode == "H_Ped_Date") {
13898     val_inf = fH_Ped_DateXinf;
13899   }
13900   if (HistoCode == "H_TNo_Date") {
13901     val_inf = fH_TNo_DateXinf;
13902   }
13903   if (HistoCode == "H_MCs_Date") {
13904     val_inf = fH_MCs_DateXinf;
13905   }
13906   if (HistoCode == "H_LFN_Date") {
13907     val_inf = fH_LFN_DateXinf;
13908   }
13909   if (HistoCode == "H_HFN_Date") {
13910     val_inf = fH_HFN_DateXinf;
13911   }
13912   if (HistoCode == "H_SCs_Date") {
13913     val_inf = fH_SCs_DateXinf;
13914   }
13915   if (HistoCode == "H_Ped_RuDs") {
13916     val_inf = fH_Ped_RuDsXinf;
13917   }
13918   if (HistoCode == "H_TNo_RuDs") {
13919     val_inf = fH_TNo_RuDsXinf;
13920   }
13921   if (HistoCode == "H_MCs_RuDs") {
13922     val_inf = fH_MCs_RuDsXinf;
13923   }
13924   if (HistoCode == "H_LFN_RuDs") {
13925     val_inf = fH_LFN_RuDsXinf;
13926   }
13927   if (HistoCode == "H_HFN_RuDs") {
13928     val_inf = fH_HFN_RuDsXinf;
13929   }
13930   if (HistoCode == "H_SCs_RuDs") {
13931     val_inf = fH_SCs_RuDsXinf;
13932   }
13933   return val_inf;
13934 }  // end of GetXinfValueFromMemo(...)
13935 
13936 Double_t TEcnaHistos::GetXinfValueFromMemo() { return fH1SameOnePlotXinf; }
13937 
13938 Double_t TEcnaHistos::GetXsupValueFromMemo(const TString& HistoCode) {
13939   Double_t val_sup = (Double_t)0.;
13940 
13941   if (HistoCode == "D_NOE_ChNb") {
13942     val_sup = fD_NOE_ChNbXsup;
13943   }
13944   if (HistoCode == "D_NOE_ChDs") {
13945     val_sup = fD_NOE_ChDsXsup;
13946   }
13947   if (HistoCode == "D_Ped_ChNb") {
13948     val_sup = fD_Ped_ChNbXsup;
13949   }
13950   if (HistoCode == "D_Ped_ChDs") {
13951     val_sup = fD_Ped_ChDsXsup;
13952   }
13953   if (HistoCode == "D_TNo_ChNb") {
13954     val_sup = fD_TNo_ChNbXsup;
13955   }
13956   if (HistoCode == "D_TNo_ChDs") {
13957     val_sup = fD_TNo_ChDsXsup;
13958   }
13959   if (HistoCode == "D_MCs_ChNb") {
13960     val_sup = fD_MCs_ChNbXsup;
13961   }
13962   if (HistoCode == "D_MCs_ChDs") {
13963     val_sup = fD_MCs_ChDsXsup;
13964   }
13965   if (HistoCode == "D_LFN_ChNb") {
13966     val_sup = fD_LFN_ChNbXsup;
13967   }
13968   if (HistoCode == "D_LFN_ChDs") {
13969     val_sup = fD_LFN_ChDsXsup;
13970   }
13971   if (HistoCode == "D_HFN_ChNb") {
13972     val_sup = fD_HFN_ChNbXsup;
13973   }
13974   if (HistoCode == "D_HFN_ChDs") {
13975     val_sup = fD_HFN_ChDsXsup;
13976   }
13977   if (HistoCode == "D_SCs_ChNb") {
13978     val_sup = fD_SCs_ChNbXsup;
13979   }
13980   if (HistoCode == "D_SCs_ChDs") {
13981     val_sup = fD_SCs_ChDsXsup;
13982   }
13983   if (HistoCode == "D_MSp_SpNb") {
13984     val_sup = fD_Ped_ChNbXsup;
13985   }
13986   if (HistoCode == "D_MSp_SpDs") {
13987     val_sup = fD_Ped_ChDsXsup;
13988   }
13989   if (HistoCode == "D_SSp_SpNb") {
13990     val_sup = fD_TNo_ChNbXsup;
13991   }
13992   if (HistoCode == "D_SSp_SpDs") {
13993     val_sup = fD_TNo_ChDsXsup;
13994   }
13995   if (HistoCode == "D_Adc_EvNb") {
13996     val_sup = fD_Adc_EvNbXsup;
13997   }
13998   if (HistoCode == "D_Adc_EvDs") {
13999     val_sup = fD_Adc_EvDsXsup;
14000   }
14001   if (HistoCode == "H_Ped_Date") {
14002     val_sup = fH_Ped_DateXsup;
14003   }
14004   if (HistoCode == "H_TNo_Date") {
14005     val_sup = fH_TNo_DateXsup;
14006   }
14007   if (HistoCode == "H_MCs_Date") {
14008     val_sup = fH_MCs_DateXsup;
14009   }
14010   if (HistoCode == "H_LFN_Date") {
14011     val_sup = fH_LFN_DateXsup;
14012   }
14013   if (HistoCode == "H_HFN_Date") {
14014     val_sup = fH_HFN_DateXsup;
14015   }
14016   if (HistoCode == "H_SCs_Date") {
14017     val_sup = fH_SCs_DateXsup;
14018   }
14019   if (HistoCode == "H_Ped_RuDs") {
14020     val_sup = fH_Ped_RuDsXsup;
14021   }
14022   if (HistoCode == "H_TNo_RuDs") {
14023     val_sup = fH_TNo_RuDsXsup;
14024   }
14025   if (HistoCode == "H_MCs_RuDs") {
14026     val_sup = fH_MCs_RuDsXsup;
14027   }
14028   if (HistoCode == "H_LFN_RuDs") {
14029     val_sup = fH_LFN_RuDsXsup;
14030   }
14031   if (HistoCode == "H_HFN_RuDs") {
14032     val_sup = fH_HFN_RuDsXsup;
14033   }
14034   if (HistoCode == "H_SCs_RuDs") {
14035     val_sup = fH_SCs_RuDsXsup;
14036   }
14037   return val_sup;
14038 }  // end of GetXsupValueFromMemo(...)
14039 
14040 Double_t TEcnaHistos::GetXsupValueFromMemo() { return fH1SameOnePlotXsup; }
14041 
14042 //-------------------------------------------------------------------------------------------
14043 //
14044 //           SetHistoMin, SetHistoMax, SetAllYminYmaxMemoFromDefaultValues
14045 //
14046 //-------------------------------------------------------------------------------------------
14047 void TEcnaHistos::SetHistoMin(const Double_t& value) {
14048   fUserHistoMin = value;
14049   fFlagUserHistoMin = "ON";
14050 }
14051 void TEcnaHistos::SetHistoMax(const Double_t& value) {
14052   fUserHistoMax = value;
14053   fFlagUserHistoMax = "ON";
14054 }
14055 
14056 void TEcnaHistos::SetHistoMin() { fFlagUserHistoMin = "AUTO"; }
14057 void TEcnaHistos::SetHistoMax() { fFlagUserHistoMax = "AUTO"; }
14058 
14059 void TEcnaHistos::SetAllYminYmaxMemoFromDefaultValues() {
14060   //.......... Default values for histo min and max
14061 
14062   SetYminMemoFromValue("D_NOE_ChNb", fCnaParHistos->GetYminDefaultValue("D_NOE_ChNb"));
14063   SetYmaxMemoFromValue("D_NOE_ChNb", fCnaParHistos->GetYmaxDefaultValue("D_NOE_ChNb"));
14064 
14065   SetYminMemoFromValue("D_NOE_ChDs", fCnaParHistos->GetYminDefaultValue("D_NOE_ChDs"));
14066   SetYmaxMemoFromValue("D_NOE_ChDs", fCnaParHistos->GetYmaxDefaultValue("D_NOE_ChDs"));
14067 
14068   SetYminMemoFromValue("D_Ped_ChNb", fCnaParHistos->GetYminDefaultValue("D_Ped_ChNb"));
14069   SetYmaxMemoFromValue("D_Ped_ChNb", fCnaParHistos->GetYmaxDefaultValue("D_Ped_ChNb"));
14070 
14071   SetYminMemoFromValue("D_Ped_ChDs", fCnaParHistos->GetYminDefaultValue("D_Ped_ChDs"));
14072   SetYmaxMemoFromValue("D_Ped_ChDs", fCnaParHistos->GetYmaxDefaultValue("D_Ped_ChDs"));
14073 
14074   SetYminMemoFromValue("D_TNo_ChNb", fCnaParHistos->GetYminDefaultValue("D_TNo_ChNb"));
14075   SetYmaxMemoFromValue("D_TNo_ChNb", fCnaParHistos->GetYmaxDefaultValue("D_TNo_ChNb"));
14076 
14077   SetYminMemoFromValue("D_TNo_ChDs", fCnaParHistos->GetYminDefaultValue("D_TNo_ChDs"));
14078   SetYmaxMemoFromValue("D_TNo_ChDs", fCnaParHistos->GetYmaxDefaultValue("D_TNo_ChDs"));
14079 
14080   SetYminMemoFromValue("D_MCs_ChNb", fCnaParHistos->GetYminDefaultValue("D_MCs_ChNb"));
14081   SetYmaxMemoFromValue("D_MCs_ChNb", fCnaParHistos->GetYmaxDefaultValue("D_MCs_ChNb"));
14082 
14083   SetYminMemoFromValue("D_MCs_ChDs", fCnaParHistos->GetYminDefaultValue("D_MCs_ChDs"));
14084   SetYmaxMemoFromValue("D_MCs_ChDs", fCnaParHistos->GetYmaxDefaultValue("D_MCs_ChDs"));
14085 
14086   SetYminMemoFromValue("D_LFN_ChNb", fCnaParHistos->GetYminDefaultValue("D_LFN_ChNb"));
14087   SetYmaxMemoFromValue("D_LFN_ChNb", fCnaParHistos->GetYmaxDefaultValue("D_LFN_ChNb"));
14088 
14089   SetYminMemoFromValue("D_LFN_ChDs", fCnaParHistos->GetYminDefaultValue("D_LFN_ChDs"));
14090   SetYmaxMemoFromValue("D_LFN_ChDs", fCnaParHistos->GetYmaxDefaultValue("D_LFN_ChDs"));
14091 
14092   SetYminMemoFromValue("D_HFN_ChNb", fCnaParHistos->GetYminDefaultValue("D_HFN_ChNb"));
14093   SetYmaxMemoFromValue("D_HFN_ChNb", fCnaParHistos->GetYmaxDefaultValue("D_HFN_ChNb"));
14094 
14095   SetYminMemoFromValue("D_HFN_ChDs", fCnaParHistos->GetYminDefaultValue("D_HFN_ChDs"));
14096   SetYmaxMemoFromValue("D_HFN_ChDs", fCnaParHistos->GetYmaxDefaultValue("D_HFN_ChDs"));
14097 
14098   SetYminMemoFromValue("D_SCs_ChNb", fCnaParHistos->GetYminDefaultValue("D_SCs_ChNb"));
14099   SetYmaxMemoFromValue("D_SCs_ChNb", fCnaParHistos->GetYmaxDefaultValue("D_SCs_ChNb"));
14100 
14101   SetYminMemoFromValue("D_SCs_ChDs", fCnaParHistos->GetYminDefaultValue("D_SCs_ChDs"));
14102   SetYmaxMemoFromValue("D_SCs_ChDs", fCnaParHistos->GetYmaxDefaultValue("D_SCs_ChDs"));
14103 
14104   SetYminMemoFromValue("D_MSp_SpNb", fCnaParHistos->GetYminDefaultValue("D_MSp_SpNb"));
14105   SetYmaxMemoFromValue("D_MSp_SpNb", fCnaParHistos->GetYmaxDefaultValue("D_MSp_SpNb"));
14106 
14107   SetYminMemoFromValue("D_MSp_SpDs", fCnaParHistos->GetYminDefaultValue("D_MSp_SpDs"));
14108   SetYmaxMemoFromValue("D_MSp_SpDs", fCnaParHistos->GetYmaxDefaultValue("D_MSp_SpDs"));
14109 
14110   SetYminMemoFromValue("D_SSp_SpNb", fCnaParHistos->GetYminDefaultValue("D_SSp_SpNb"));
14111   SetYmaxMemoFromValue("D_SSp_SpNb", fCnaParHistos->GetYmaxDefaultValue("D_SSp_SpNb"));
14112 
14113   SetYminMemoFromValue("D_SSp_SpDs", fCnaParHistos->GetYminDefaultValue("D_SSp_SpDs"));
14114   SetYmaxMemoFromValue("D_SSp_SpDs", fCnaParHistos->GetYmaxDefaultValue("D_SSp_SpDs"));
14115 
14116   SetYminMemoFromValue("D_Adc_EvDs", fCnaParHistos->GetYminDefaultValue("D_Adc_EvDs"));
14117   SetYmaxMemoFromValue("D_Adc_EvDs", fCnaParHistos->GetYmaxDefaultValue("D_Adc_EvDs"));
14118 
14119   SetYminMemoFromValue("D_Adc_EvNb", fCnaParHistos->GetYminDefaultValue("D_Adc_EvNb"));
14120   SetYmaxMemoFromValue("D_Adc_EvNb", fCnaParHistos->GetYmaxDefaultValue("D_Adc_EvNb"));
14121 
14122   SetYminMemoFromValue("H_Ped_Date", fCnaParHistos->GetYminDefaultValue("H_Ped_Date"));
14123   SetYmaxMemoFromValue("H_Ped_Date", fCnaParHistos->GetYmaxDefaultValue("H_Ped_Date"));
14124 
14125   SetYminMemoFromValue("H_TNo_Date", fCnaParHistos->GetYminDefaultValue("H_TNo_Date"));
14126   SetYmaxMemoFromValue("H_TNo_Date", fCnaParHistos->GetYmaxDefaultValue("H_TNo_Date"));
14127 
14128   SetYminMemoFromValue("H_LFN_Date", fCnaParHistos->GetYminDefaultValue("H_LFN_Date"));
14129   SetYmaxMemoFromValue("H_LFN_Date", fCnaParHistos->GetYmaxDefaultValue("H_LFN_Date"));
14130 
14131   SetYminMemoFromValue("H_HFN_Date", fCnaParHistos->GetYminDefaultValue("H_HFN_Date"));
14132   SetYmaxMemoFromValue("H_HFN_Date", fCnaParHistos->GetYmaxDefaultValue("H_HFN_Date"));
14133 
14134   SetYminMemoFromValue("H_MCs_Date", fCnaParHistos->GetYminDefaultValue("H_MCs_Date"));
14135   SetYmaxMemoFromValue("H_MCs_Date", fCnaParHistos->GetYmaxDefaultValue("H_MCs_Date"));
14136 
14137   SetYminMemoFromValue("H_SCs_Date", fCnaParHistos->GetYminDefaultValue("H_SCs_Date"));
14138   SetYmaxMemoFromValue("H_SCs_Date", fCnaParHistos->GetYmaxDefaultValue("H_SCs_Date"));
14139 
14140   SetYminMemoFromValue("H_Ped_RuDs", fCnaParHistos->GetYminDefaultValue("H_Ped_RuDs"));
14141   SetYmaxMemoFromValue("H_Ped_RuDs", fCnaParHistos->GetYmaxDefaultValue("H_Ped_RuDs"));
14142 
14143   SetYminMemoFromValue("H_TNo_RuDs", fCnaParHistos->GetYminDefaultValue("H_TNo_RuDs"));
14144   SetYmaxMemoFromValue("H_TNo_RuDs", fCnaParHistos->GetYmaxDefaultValue("H_TNo_RuDs"));
14145 
14146   SetYminMemoFromValue("H_LFN_RuDs", fCnaParHistos->GetYminDefaultValue("H_LFN_RuDs"));
14147   SetYmaxMemoFromValue("H_LFN_RuDs", fCnaParHistos->GetYmaxDefaultValue("H_LFN_RuDs"));
14148 
14149   SetYminMemoFromValue("H_HFN_RuDs", fCnaParHistos->GetYminDefaultValue("H_HFN_RuDs"));
14150   SetYmaxMemoFromValue("H_HFN_RuDs", fCnaParHistos->GetYmaxDefaultValue("H_HFN_RuDs"));
14151 
14152   SetYminMemoFromValue("H_MCs_RuDs", fCnaParHistos->GetYminDefaultValue("H_MCs_RuDs"));
14153   SetYmaxMemoFromValue("H_MCs_RuDs", fCnaParHistos->GetYmaxDefaultValue("H_MCs_RuDs"));
14154 
14155   SetYminMemoFromValue("H_SCs_RuDs", fCnaParHistos->GetYminDefaultValue("H_SCs_RuDs"));
14156   SetYmaxMemoFromValue("H_SCs_RuDs", fCnaParHistos->GetYmaxDefaultValue("H_SCs_RuDs"));
14157 
14158   SetYminMemoFromValue("H2LFccMosMatrix", fCnaParHistos->GetYminDefaultValue("H2LFccMosMatrix"));
14159   SetYmaxMemoFromValue("H2LFccMosMatrix", fCnaParHistos->GetYmaxDefaultValue("H2LFccMosMatrix"));
14160 
14161   SetYminMemoFromValue("H2HFccMosMatrix", fCnaParHistos->GetYminDefaultValue("H2HFccMosMatrix"));
14162   SetYmaxMemoFromValue("H2HFccMosMatrix", fCnaParHistos->GetYmaxDefaultValue("H2HFccMosMatrix"));
14163 
14164   SetYminMemoFromValue("H2CorccInStins", fCnaParHistos->GetYminDefaultValue("H2CorccInStins"));
14165   SetYmaxMemoFromValue("H2CorccInStins", fCnaParHistos->GetYmaxDefaultValue("H2CorccInStins"));
14166 
14167   //........... set user's min and max flags to "OFF" and values to -1 and +1 (just to have fUserHistoMin < fUserHistoMax)
14168   fUserHistoMin = -1.;
14169   fFlagUserHistoMin = "OFF";
14170   fUserHistoMax = 1.;
14171   fFlagUserHistoMax = "OFF";
14172 }  // end of SetAllYminYmaxMemoFromDefaultValues()
14173 
14174 //===========================================================================
14175 //
14176 //          SetYminMemoFromValue(...), SetYmaxMemoFromValue(...)
14177 //          GetYminValueFromMemo(...), GetYmaxValueFromMemo(...)
14178 //
14179 //===========================================================================
14180 void TEcnaHistos::SetYminMemoFromValue(const TString& HistoCode, const Double_t& value) {
14181   if (HistoCode == "D_NOE_ChNb") {
14182     fD_NOE_ChNbYmin = value;
14183   }
14184   if (HistoCode == "D_NOE_ChDs") {
14185     fD_NOE_ChDsYmin = value;
14186   }
14187   if (HistoCode == "D_Ped_ChNb") {
14188     fD_Ped_ChNbYmin = value;
14189   }
14190   if (HistoCode == "D_Ped_ChDs") {
14191     fD_Ped_ChDsYmin = value;
14192   }
14193   if (HistoCode == "D_TNo_ChNb") {
14194     fD_TNo_ChNbYmin = value;
14195   }
14196   if (HistoCode == "D_TNo_ChDs") {
14197     fD_TNo_ChDsYmin = value;
14198   }
14199   if (HistoCode == "D_MCs_ChNb") {
14200     fD_MCs_ChNbYmin = value;
14201   }
14202   if (HistoCode == "D_MCs_ChDs") {
14203     fD_MCs_ChDsYmin = value;
14204   }
14205   if (HistoCode == "D_LFN_ChNb") {
14206     fD_LFN_ChNbYmin = value;
14207   }
14208   if (HistoCode == "D_LFN_ChDs") {
14209     fD_LFN_ChDsYmin = value;
14210   }
14211   if (HistoCode == "D_HFN_ChNb") {
14212     fD_HFN_ChNbYmin = value;
14213   }
14214   if (HistoCode == "D_HFN_ChDs") {
14215     fD_HFN_ChDsYmin = value;
14216   }
14217   if (HistoCode == "D_SCs_ChNb") {
14218     fD_SCs_ChNbYmin = value;
14219   }
14220   if (HistoCode == "D_SCs_ChDs") {
14221     fD_SCs_ChDsYmin = value;
14222   }
14223   if (HistoCode == "D_MSp_SpNb") {
14224     fD_Ped_ChNbYmin = value;
14225   }
14226   if (HistoCode == "D_MSp_SpDs") {
14227     fD_Ped_ChDsYmin = value;
14228   }
14229   if (HistoCode == "D_SSp_SpNb") {
14230     fD_TNo_ChNbYmin = value;
14231   }
14232   if (HistoCode == "D_SSp_SpDs") {
14233     fD_TNo_ChDsYmin = value;
14234   }
14235   if (HistoCode == "D_Adc_EvNb") {
14236     fD_Ped_ChNbYmin = value;
14237   }
14238   if (HistoCode == "D_Adc_EvDs") {
14239     fD_Adc_EvDsYmin = value;
14240   }
14241   if (HistoCode == "H_Ped_Date") {
14242     fH_Ped_DateYmin = value;
14243   }
14244   if (HistoCode == "H_TNo_Date") {
14245     fH_TNo_DateYmin = value;
14246   }
14247   if (HistoCode == "H_MCs_Date") {
14248     fH_MCs_DateYmin = value;
14249   }
14250   if (HistoCode == "H_LFN_Date") {
14251     fH_LFN_DateYmin = value;
14252   }
14253   if (HistoCode == "H_HFN_Date") {
14254     fH_HFN_DateYmin = value;
14255   }
14256   if (HistoCode == "H_SCs_Date") {
14257     fH_SCs_DateYmin = value;
14258   }
14259   if (HistoCode == "H_Ped_RuDs") {
14260     fH_Ped_RuDsYmin = value;
14261   }
14262   if (HistoCode == "H_TNo_RuDs") {
14263     fH_TNo_RuDsYmin = value;
14264   }
14265   if (HistoCode == "H_MCs_RuDs") {
14266     fH_MCs_RuDsYmin = value;
14267   }
14268   if (HistoCode == "H_LFN_RuDs") {
14269     fH_LFN_RuDsYmin = value;
14270   }
14271   if (HistoCode == "H_HFN_RuDs") {
14272     fH_HFN_RuDsYmin = value;
14273   }
14274   if (HistoCode == "H_SCs_RuDs") {
14275     fH_SCs_RuDsYmin = value;
14276   }
14277   if (HistoCode == "H2LFccMosMatrix") {
14278     fH2LFccMosMatrixYmin = value;
14279   }
14280   if (HistoCode == "H2HFccMosMatrix") {
14281     fH2HFccMosMatrixYmin = value;
14282   }
14283   if (HistoCode == "H2CorccInStins") {
14284     fH2CorccInStinsYmin = value;
14285   }
14286 }  // end of SetYminMemoFromValue(...)
14287 
14288 void TEcnaHistos::SetYmaxMemoFromValue(const TString& HistoCode, const Double_t& value) {
14289   if (HistoCode == "D_NOE_ChNb") {
14290     fD_NOE_ChNbYmax = value;
14291   }
14292   if (HistoCode == "D_NOE_ChDs") {
14293     fD_NOE_ChDsYmax = value;
14294   }
14295   if (HistoCode == "D_Ped_ChNb") {
14296     fD_Ped_ChNbYmax = value;
14297   }
14298   if (HistoCode == "D_Ped_ChDs") {
14299     fD_Ped_ChDsYmax = value;
14300   }
14301   if (HistoCode == "D_TNo_ChNb") {
14302     fD_TNo_ChNbYmax = value;
14303   }
14304   if (HistoCode == "D_TNo_ChDs") {
14305     fD_TNo_ChDsYmax = value;
14306   }
14307   if (HistoCode == "D_MCs_ChNb") {
14308     fD_MCs_ChNbYmax = value;
14309   }
14310   if (HistoCode == "D_MCs_ChDs") {
14311     fD_MCs_ChDsYmax = value;
14312   }
14313   if (HistoCode == "D_LFN_ChNb") {
14314     fD_LFN_ChNbYmax = value;
14315   }
14316   if (HistoCode == "D_LFN_ChDs") {
14317     fD_LFN_ChDsYmax = value;
14318   }
14319   if (HistoCode == "D_HFN_ChNb") {
14320     fD_HFN_ChNbYmax = value;
14321   }
14322   if (HistoCode == "D_HFN_ChDs") {
14323     fD_HFN_ChDsYmax = value;
14324   }
14325   if (HistoCode == "D_SCs_ChNb") {
14326     fD_SCs_ChNbYmax = value;
14327   }
14328   if (HistoCode == "D_SCs_ChDs") {
14329     fD_SCs_ChDsYmax = value;
14330   }
14331   if (HistoCode == "D_MSp_SpNb") {
14332     fD_Ped_ChNbYmax = value;
14333   }
14334   if (HistoCode == "D_MSp_SpDs") {
14335     fD_Ped_ChDsYmax = value;
14336   }
14337   if (HistoCode == "D_SSp_SpNb") {
14338     fD_TNo_ChNbYmax = value;
14339   }
14340   if (HistoCode == "D_SSp_SpDs") {
14341     fD_TNo_ChDsYmax = value;
14342   }
14343   if (HistoCode == "D_Adc_EvNb") {
14344     fD_Ped_ChNbYmax = value;
14345   }
14346   if (HistoCode == "D_Adc_EvDs") {
14347     fD_Ped_ChDsYmax = value;
14348   }
14349   if (HistoCode == "H_Ped_Date") {
14350     fH_Ped_DateYmax = value;
14351   }
14352   if (HistoCode == "H_TNo_Date") {
14353     fH_TNo_DateYmax = value;
14354   }
14355   if (HistoCode == "H_MCs_Date") {
14356     fH_MCs_DateYmax = value;
14357   }
14358   if (HistoCode == "H_LFN_Date") {
14359     fH_LFN_DateYmax = value;
14360   }
14361   if (HistoCode == "H_HFN_Date") {
14362     fH_HFN_DateYmax = value;
14363   }
14364   if (HistoCode == "H_SCs_Date") {
14365     fH_SCs_DateYmax = value;
14366   }
14367   if (HistoCode == "H_Ped_RuDs") {
14368     fH_Ped_RuDsYmax = value;
14369   }
14370   if (HistoCode == "H_TNo_RuDs") {
14371     fH_TNo_RuDsYmax = value;
14372   }
14373   if (HistoCode == "H_MCs_RuDs") {
14374     fH_MCs_RuDsYmax = value;
14375   }
14376   if (HistoCode == "H_LFN_RuDs") {
14377     fH_LFN_RuDsYmax = value;
14378   }
14379   if (HistoCode == "H_HFN_RuDs") {
14380     fH_HFN_RuDsYmax = value;
14381   }
14382   if (HistoCode == "H_SCs_RuDs") {
14383     fH_SCs_RuDsYmax = value;
14384   }
14385   if (HistoCode == "H2LFccMosMatrix") {
14386     fH2LFccMosMatrixYmax = value;
14387   }
14388   if (HistoCode == "H2HFccMosMatrix") {
14389     fH2HFccMosMatrixYmax = value;
14390   }
14391   if (HistoCode == "H2CorccInStins") {
14392     fH2CorccInStinsYmax = value;
14393   }
14394 }  // end of SetYmaxMemoFromValue(...)
14395 
14396 Double_t TEcnaHistos::GetYminValueFromMemo(const TString& HistoCode) {
14397   Double_t val_min = (Double_t)0.;
14398   Double_t val_min_proj = (Double_t)0.1;
14399 
14400   if (HistoCode == "D_NOE_ChNb") {
14401     val_min = fD_NOE_ChNbYmin;
14402   }
14403   if (HistoCode == "D_NOE_ChDs") {
14404     val_min = val_min_proj;
14405   }
14406   if (HistoCode == "D_Ped_ChNb") {
14407     val_min = fD_Ped_ChNbYmin;
14408   }
14409   if (HistoCode == "D_Ped_ChDs") {
14410     val_min = val_min_proj;
14411   }
14412   if (HistoCode == "D_TNo_ChNb") {
14413     val_min = fD_TNo_ChNbYmin;
14414   }
14415   if (HistoCode == "D_TNo_ChDs") {
14416     val_min = val_min_proj;
14417   }
14418   if (HistoCode == "D_MCs_ChNb") {
14419     val_min = fD_MCs_ChNbYmin;
14420   }
14421   if (HistoCode == "D_MCs_ChDs") {
14422     val_min = val_min_proj;
14423   }
14424   if (HistoCode == "D_LFN_ChNb") {
14425     val_min = fD_LFN_ChNbYmin;
14426   }
14427   if (HistoCode == "D_LFN_ChDs") {
14428     val_min = val_min_proj;
14429   }
14430   if (HistoCode == "D_HFN_ChNb") {
14431     val_min = fD_HFN_ChNbYmin;
14432   }
14433   if (HistoCode == "D_HFN_ChDs") {
14434     val_min = val_min_proj;
14435   }
14436   if (HistoCode == "D_SCs_ChNb") {
14437     val_min = fD_SCs_ChNbYmin;
14438   }
14439   if (HistoCode == "D_SCs_ChDs") {
14440     val_min = val_min_proj;
14441   }
14442   if (HistoCode == "D_MSp_SpNb") {
14443     val_min = fD_Ped_ChNbYmin;
14444   }
14445   if (HistoCode == "D_MSp_SpDs") {
14446     val_min = val_min_proj;
14447   }
14448   if (HistoCode == "D_SSp_SpNb") {
14449     val_min = fD_TNo_ChNbYmin;
14450   }
14451   if (HistoCode == "D_SSp_SpDs") {
14452     val_min = val_min_proj;
14453   }
14454   if (HistoCode == "D_Adc_EvNb") {
14455     val_min = fD_Ped_ChNbYmin;
14456   }
14457   if (HistoCode == "D_Adc_EvDs") {
14458     val_min = val_min_proj;
14459   }
14460   if (HistoCode == "H_Ped_Date") {
14461     val_min = fH_Ped_DateYmin;
14462   }
14463   if (HistoCode == "H_TNo_Date") {
14464     val_min = fH_TNo_DateYmin;
14465   }
14466   if (HistoCode == "H_MCs_Date") {
14467     val_min = fH_MCs_DateYmin;
14468   }
14469   if (HistoCode == "H_LFN_Date") {
14470     val_min = fH_LFN_DateYmin;
14471   }
14472   if (HistoCode == "H_HFN_Date") {
14473     val_min = fH_HFN_DateYmin;
14474   }
14475   if (HistoCode == "H_SCs_Date") {
14476     val_min = fH_SCs_DateYmin;
14477   }
14478   if (HistoCode == "H_Ped_RuDs") {
14479     val_min = fH_Ped_RuDsYmin;
14480   }
14481   if (HistoCode == "H_TNo_RuDs") {
14482     val_min = fH_TNo_RuDsYmin;
14483   }
14484   if (HistoCode == "H_MCs_RuDs") {
14485     val_min = fH_MCs_RuDsYmin;
14486   }
14487   if (HistoCode == "H_LFN_RuDs") {
14488     val_min = fH_LFN_RuDsYmin;
14489   }
14490   if (HistoCode == "H_HFN_RuDs") {
14491     val_min = fH_HFN_RuDsYmin;
14492   }
14493   if (HistoCode == "H_SCs_RuDs") {
14494     val_min = fH_SCs_RuDsYmin;
14495   }
14496   if (HistoCode == "H2LFccMosMatrix") {
14497     val_min = fH2LFccMosMatrixYmin;
14498   }
14499   if (HistoCode == "H2HFccMosMatrix") {
14500     val_min = fH2HFccMosMatrixYmin;
14501   }
14502   if (HistoCode == "H2CorccInStins") {
14503     val_min = fH2CorccInStinsYmin;
14504   }
14505   return val_min;
14506 }  // end of GetYminValueFromMemo(...)
14507 
14508 Double_t TEcnaHistos::GetYmaxValueFromMemo(const TString& HistoCode) {
14509   Double_t val_max = (Double_t)0.;
14510   Double_t val_max_proj = (Double_t)2000.;
14511 
14512   if (HistoCode == "D_NOE_ChNb") {
14513     val_max = fD_NOE_ChNbYmax;
14514   }
14515   if (HistoCode == "D_NOE_ChDs") {
14516     val_max = val_max_proj;
14517   }
14518   if (HistoCode == "D_Ped_ChNb") {
14519     val_max = fD_Ped_ChNbYmax;
14520   }
14521   if (HistoCode == "D_Ped_ChDs") {
14522     val_max = val_max_proj;
14523   }
14524   if (HistoCode == "D_TNo_ChNb") {
14525     val_max = fD_TNo_ChNbYmax;
14526   }
14527   if (HistoCode == "D_TNo_ChDs") {
14528     val_max = val_max_proj;
14529   }
14530   if (HistoCode == "D_MCs_ChNb") {
14531     val_max = fD_MCs_ChNbYmax;
14532   }
14533   if (HistoCode == "D_MCs_ChDs") {
14534     val_max = val_max_proj;
14535   }
14536   if (HistoCode == "D_LFN_ChNb") {
14537     val_max = fD_LFN_ChNbYmax;
14538   }
14539   if (HistoCode == "D_LFN_ChDs") {
14540     val_max = val_max_proj;
14541   }
14542   if (HistoCode == "D_HFN_ChNb") {
14543     val_max = fD_HFN_ChNbYmax;
14544   }
14545   if (HistoCode == "D_HFN_ChDs") {
14546     val_max = val_max_proj;
14547   }
14548   if (HistoCode == "D_SCs_ChNb") {
14549     val_max = fD_SCs_ChNbYmax;
14550   }
14551   if (HistoCode == "D_SCs_ChDs") {
14552     val_max = val_max_proj;
14553   }
14554   if (HistoCode == "D_MSp_SpNb") {
14555     val_max = fD_Ped_ChNbYmax;
14556   }
14557   if (HistoCode == "D_MSp_SpDs") {
14558     val_max = val_max_proj;
14559   }
14560   if (HistoCode == "D_SSp_SpNb") {
14561     val_max = fD_TNo_ChNbYmax;
14562   }
14563   if (HistoCode == "D_SSp_SpDs") {
14564     val_max = val_max_proj;
14565   }
14566   if (HistoCode == "D_Adc_EvNb") {
14567     val_max = fD_Ped_ChNbYmax;
14568   }
14569   if (HistoCode == "D_Adc_EvDs") {
14570     val_max = val_max_proj;
14571   }
14572   if (HistoCode == "H_Ped_Date") {
14573     val_max = fH_Ped_DateYmax;
14574   }
14575   if (HistoCode == "H_TNo_Date") {
14576     val_max = fH_TNo_DateYmax;
14577   }
14578   if (HistoCode == "H_MCs_Date") {
14579     val_max = fH_MCs_DateYmax;
14580   }
14581   if (HistoCode == "H_LFN_Date") {
14582     val_max = fH_LFN_DateYmax;
14583   }
14584   if (HistoCode == "H_HFN_Date") {
14585     val_max = fH_HFN_DateYmax;
14586   }
14587   if (HistoCode == "H_SCs_Date") {
14588     val_max = fH_SCs_DateYmax;
14589   }
14590   if (HistoCode == "H_Ped_RuDs") {
14591     val_max = fH_Ped_RuDsYmax;
14592   }
14593   if (HistoCode == "H_TNo_RuDs") {
14594     val_max = fH_TNo_RuDsYmax;
14595   }
14596   if (HistoCode == "H_MCs_RuDs") {
14597     val_max = fH_MCs_RuDsYmax;
14598   }
14599   if (HistoCode == "H_LFN_RuDs") {
14600     val_max = fH_LFN_RuDsYmax;
14601   }
14602   if (HistoCode == "H_HFN_RuDs") {
14603     val_max = fH_HFN_RuDsYmax;
14604   }
14605   if (HistoCode == "H_SCs_RuDs") {
14606     val_max = fH_SCs_RuDsYmax;
14607   }
14608   if (HistoCode == "H2LFccMosMatrix") {
14609     val_max = fH2LFccMosMatrixYmax;
14610   }
14611   if (HistoCode == "H2HFccMosMatrix") {
14612     val_max = fH2HFccMosMatrixYmax;
14613   }
14614   if (HistoCode == "H2CorccInStins") {
14615     val_max = fH2CorccInStinsYmax;
14616   }
14617   return val_max;
14618 }  // end of GetYmaxValueFromMemo(...)
14619 
14620 void TEcnaHistos::SetYminMemoFromPreviousMemo(const TString& HistoCode) {
14621   // InitQuantity Ymin
14622 
14623   if (HistoCode == "D_NOE_ChNb") {
14624     fD_NOE_ChNbYmin = GetYminValueFromMemo("D_NOE_ChNb");
14625   }
14626   if (HistoCode == "D_NOE_ChDs") {
14627     fD_NOE_ChDsYmin = GetYminValueFromMemo("D_NOE_ChDs");
14628   }
14629   if (HistoCode == "D_Ped_ChNb") {
14630     fD_Ped_ChNbYmin = GetYminValueFromMemo("D_Ped_ChNb");
14631   }
14632   if (HistoCode == "D_Ped_ChDs") {
14633     fD_Ped_ChDsYmin = GetYminValueFromMemo("D_Ped_ChDs");
14634   }
14635   if (HistoCode == "D_TNo_ChNb") {
14636     fD_TNo_ChNbYmin = GetYminValueFromMemo("D_TNo_ChNb");
14637   }
14638   if (HistoCode == "D_TNo_ChDs") {
14639     fD_TNo_ChDsYmin = GetYminValueFromMemo("D_TNo_ChDs");
14640   }
14641   if (HistoCode == "D_MCs_ChNb") {
14642     fD_MCs_ChNbYmin = GetYminValueFromMemo("D_MCs_ChNb");
14643   }
14644   if (HistoCode == "D_MCs_ChDs") {
14645     fD_MCs_ChDsYmin = GetYminValueFromMemo("D_MCs_ChDs");
14646   }
14647   if (HistoCode == "D_LFN_ChNb") {
14648     fD_LFN_ChNbYmin = GetYminValueFromMemo("D_LFN_ChNb");
14649   }
14650   if (HistoCode == "D_LFN_ChDs") {
14651     fD_LFN_ChDsYmin = GetYminValueFromMemo("D_LFN_ChDs");
14652   }
14653   if (HistoCode == "D_HFN_ChNb") {
14654     fD_HFN_ChNbYmin = GetYminValueFromMemo("D_HFN_ChNb");
14655   }
14656   if (HistoCode == "D_HFN_ChDs") {
14657     fD_HFN_ChDsYmin = GetYminValueFromMemo("D_HFN_ChDs");
14658   }
14659   if (HistoCode == "D_SCs_ChNb") {
14660     fD_SCs_ChNbYmin = GetYminValueFromMemo("D_SCs_ChNb");
14661   }
14662   if (HistoCode == "D_SCs_ChDs") {
14663     fD_SCs_ChDsYmin = GetYminValueFromMemo("D_SCs_ChDs");
14664   }
14665   if (HistoCode == "D_MSp_SpNb") {
14666     fD_MSp_SpNbYmin = GetYminValueFromMemo("D_MSp_SpNb");
14667   }
14668   if (HistoCode == "D_MSp_SpDs") {
14669     fD_MSp_SpDsYmin = GetYminValueFromMemo("D_MSp_SpDs");
14670   }
14671   if (HistoCode == "D_SSp_SpNb") {
14672     fD_SSp_SpNbYmin = GetYminValueFromMemo("D_SSp_SpNb");
14673   }
14674   if (HistoCode == "D_SSp_SpDs") {
14675     fD_SSp_SpDsYmin = GetYminValueFromMemo("D_SSp_SpDs");
14676   }
14677   if (HistoCode == "D_Adc_EvNb") {
14678     fD_Adc_EvNbYmin = GetYminValueFromMemo("D_Adc_EvNb");
14679   }
14680   if (HistoCode == "D_Adc_EvDs") {
14681     fD_Adc_EvDsYmin = GetYminValueFromMemo("D_Adc_EvDs");
14682   }
14683   if (HistoCode == "H_Ped_Date") {
14684     fH_Ped_DateYmin = GetYminValueFromMemo("H_Ped_Date");
14685   }
14686   if (HistoCode == "H_TNo_Date") {
14687     fH_TNo_DateYmin = GetYminValueFromMemo("H_TNo_Date");
14688   }
14689   if (HistoCode == "H_MCs_Date") {
14690     fH_MCs_DateYmin = GetYminValueFromMemo("H_MCs_Date");
14691   }
14692   if (HistoCode == "H_LFN_Date") {
14693     fH_LFN_DateYmin = GetYminValueFromMemo("H_LFN_Date");
14694   }
14695   if (HistoCode == "H_HFN_Date") {
14696     fH_HFN_DateYmin = GetYminValueFromMemo("H_HFN_Date");
14697   }
14698   if (HistoCode == "H_SCs_Date") {
14699     fH_SCs_DateYmin = GetYminValueFromMemo("H_SCs_Date");
14700   }
14701   if (HistoCode == "H_Ped_RuDs") {
14702     fH_Ped_RuDsYmin = GetYminValueFromMemo("H_Ped_RuDs");
14703   }
14704   if (HistoCode == "H_TNo_RuDs") {
14705     fH_TNo_RuDsYmin = GetYminValueFromMemo("H_TNo_RuDs");
14706   }
14707   if (HistoCode == "H_MCs_RuDs") {
14708     fH_MCs_RuDsYmin = GetYminValueFromMemo("H_MCs_RuDs");
14709   }
14710   if (HistoCode == "H_LFN_RuDs") {
14711     fH_LFN_RuDsYmin = GetYminValueFromMemo("H_LFN_RuDs");
14712   }
14713   if (HistoCode == "H_HFN_RuDs") {
14714     fH_HFN_RuDsYmin = GetYminValueFromMemo("H_HFN_RuDs");
14715   }
14716   if (HistoCode == "H_SCs_RuDs") {
14717     fH_SCs_RuDsYmin = GetYminValueFromMemo("H_SCs_RuDs");
14718   }
14719   if (HistoCode == "H2LFccMosMatrix") {
14720     fH2LFccMosMatrixYmin = GetYminValueFromMemo("H2LFccMosMatrix");
14721   }
14722   if (HistoCode == "H2HFccMosMatrix") {
14723     fH2HFccMosMatrixYmin = GetYminValueFromMemo("H2HFccMosMatrix");
14724   }
14725   if (HistoCode == "H2CorccInStins") {
14726     fH2CorccInStinsYmin = GetYminValueFromMemo("H2CorccInStins");
14727   }
14728 }  // end of SetYminMemoFromPreviousMemo(...)
14729 
14730 void TEcnaHistos::SetYmaxMemoFromPreviousMemo(const TString& HistoCode) {
14731   // InitQuantity Ymax
14732 
14733   if (HistoCode == "D_NOE_ChNb") {
14734     fD_NOE_ChNbYmax = GetYmaxValueFromMemo("D_NOE_ChNb");
14735   }
14736   if (HistoCode == "D_NOE_ChDs") {
14737     fD_NOE_ChDsYmax = GetYmaxValueFromMemo("D_NOE_ChDs");
14738   }
14739   if (HistoCode == "D_Ped_ChNb") {
14740     fD_Ped_ChNbYmax = GetYmaxValueFromMemo("D_Ped_ChNb");
14741   }
14742   if (HistoCode == "D_Ped_ChDs") {
14743     fD_Ped_ChDsYmax = GetYmaxValueFromMemo("D_Ped_ChDs");
14744   }
14745   if (HistoCode == "D_TNo_ChNb") {
14746     fD_TNo_ChNbYmax = GetYmaxValueFromMemo("D_TNo_ChNb");
14747   }
14748   if (HistoCode == "D_TNo_ChDs") {
14749     fD_TNo_ChDsYmax = GetYmaxValueFromMemo("D_TNo_ChDs");
14750   }
14751   if (HistoCode == "D_MCs_ChNb") {
14752     fD_MCs_ChNbYmax = GetYmaxValueFromMemo("D_MCs_ChNb");
14753   }
14754   if (HistoCode == "D_MCs_ChDs") {
14755     fD_MCs_ChDsYmax = GetYmaxValueFromMemo("D_MCs_ChDs");
14756   }
14757   if (HistoCode == "D_LFN_ChNb") {
14758     fD_LFN_ChNbYmax = GetYmaxValueFromMemo("D_LFN_ChNb");
14759   }
14760   if (HistoCode == "D_LFN_ChDs") {
14761     fD_LFN_ChDsYmax = GetYmaxValueFromMemo("D_LFN_ChDs");
14762   }
14763   if (HistoCode == "D_HFN_ChNb") {
14764     fD_HFN_ChNbYmax = GetYmaxValueFromMemo("D_HFN_ChNb");
14765   }
14766   if (HistoCode == "D_HFN_ChDs") {
14767     fD_HFN_ChDsYmax = GetYmaxValueFromMemo("D_HFN_ChDs");
14768   }
14769   if (HistoCode == "D_SCs_ChNb") {
14770     fD_SCs_ChNbYmax = GetYmaxValueFromMemo("D_SCs_ChNb");
14771   }
14772   if (HistoCode == "D_SCs_ChDs") {
14773     fD_SCs_ChDsYmax = GetYmaxValueFromMemo("D_SCs_ChDs");
14774   }
14775   if (HistoCode == "D_MSp_SpNb") {
14776     fD_MSp_SpNbYmax = GetYmaxValueFromMemo("D_MSp_SpNb");
14777   }
14778   if (HistoCode == "D_MSp_SpDs") {
14779     fD_MSp_SpDsYmax = GetYmaxValueFromMemo("D_MSp_SpDs");
14780   }
14781   if (HistoCode == "D_SSp_SpNb") {
14782     fD_SSp_SpNbYmax = GetYmaxValueFromMemo("D_SSp_SpNb");
14783   }
14784   if (HistoCode == "D_SSp_SpDs") {
14785     fD_SSp_SpDsYmax = GetYmaxValueFromMemo("D_SSp_SpDs");
14786   }
14787   if (HistoCode == "D_Adc_EvNb") {
14788     fD_Adc_EvNbYmax = GetYmaxValueFromMemo("D_Adc_EvNb");
14789   }
14790   if (HistoCode == "D_Adc_EvDs") {
14791     fD_Adc_EvDsYmax = GetYmaxValueFromMemo("D_Adc_EvDs");
14792   }
14793   if (HistoCode == "H_Ped_Date") {
14794     fH_Ped_DateYmax = GetYmaxValueFromMemo("H_Ped_Date");
14795   }
14796   if (HistoCode == "H_TNo_Date") {
14797     fH_TNo_DateYmax = GetYmaxValueFromMemo("H_TNo_Date");
14798   }
14799   if (HistoCode == "H_MCs_Date") {
14800     fH_MCs_DateYmax = GetYmaxValueFromMemo("H_MCs_Date");
14801   }
14802   if (HistoCode == "H_LFN_Date") {
14803     fH_LFN_DateYmax = GetYmaxValueFromMemo("H_LFN_Date");
14804   }
14805   if (HistoCode == "H_HFN_Date") {
14806     fH_HFN_DateYmax = GetYmaxValueFromMemo("H_HFN_Date");
14807   }
14808   if (HistoCode == "H_SCs_Date") {
14809     fH_SCs_DateYmax = GetYmaxValueFromMemo("H_SCs_Date");
14810   }
14811   if (HistoCode == "H_Ped_RuDs") {
14812     fH_Ped_RuDsYmax = GetYmaxValueFromMemo("H_Ped_RuDs");
14813   }
14814   if (HistoCode == "H_TNo_RuDs") {
14815     fH_TNo_RuDsYmax = GetYmaxValueFromMemo("H_TNo_RuDs");
14816   }
14817   if (HistoCode == "H_MCs_RuDs") {
14818     fH_MCs_RuDsYmax = GetYmaxValueFromMemo("H_MCs_RuDs");
14819   }
14820   if (HistoCode == "H_LFN_RuDs") {
14821     fH_LFN_RuDsYmax = GetYmaxValueFromMemo("H_LFN_RuDs");
14822   }
14823   if (HistoCode == "H_HFN_RuDs") {
14824     fH_HFN_RuDsYmax = GetYmaxValueFromMemo("H_HFN_RuDs");
14825   }
14826   if (HistoCode == "H_SCs_RuDs") {
14827     fH_SCs_RuDsYmax = GetYmaxValueFromMemo("H_SCs_RuDs");
14828   }
14829   if (HistoCode == "H2LFccMosMatrix") {
14830     fH2LFccMosMatrixYmax = GetYmaxValueFromMemo("H2LFccMosMatrix");
14831   }
14832   if (HistoCode == "H2HFccMosMatrix") {
14833     fH2HFccMosMatrixYmax = GetYmaxValueFromMemo("H2HFccMosMatrix");
14834   }
14835   if (HistoCode == "H2CorccInStins") {
14836     fH2CorccInStinsYmax = GetYmaxValueFromMemo("H2CorccInStins");
14837   }
14838 }  // end of SetYmaxMemoFromPreviousMemo(...)
14839 
14840 //------------------------------------------------------------------------------------------------------
14841 void TEcnaHistos::SetXVarMemo(const TString& HistoCode, const TString& opt_plot, const TString& xvar) {
14842   if (opt_plot == fSameOnePlot) {
14843     fXMemoH1SamePlus = xvar;
14844   }
14845 
14846   if (opt_plot == fOnlyOnePlot || opt_plot == fSeveralPlot) {
14847     if (HistoCode == "D_NOE_ChNb") {
14848       fXMemoD_NOE_ChNb = xvar;
14849     }
14850     if (HistoCode == "D_NOE_ChDs") {
14851       fXMemoD_NOE_ChDs = xvar;
14852     }
14853     if (HistoCode == "D_Ped_ChNb") {
14854       fXMemoD_Ped_ChNb = xvar;
14855     }
14856     if (HistoCode == "D_Ped_ChDs") {
14857       fXMemoD_Ped_ChDs = xvar;
14858     }
14859     if (HistoCode == "D_TNo_ChNb") {
14860       fXMemoD_TNo_ChNb = xvar;
14861     }
14862     if (HistoCode == "D_TNo_ChDs") {
14863       fXMemoD_TNo_ChDs = xvar;
14864     }
14865     if (HistoCode == "D_MCs_ChNb") {
14866       fXMemoD_MCs_ChNb = xvar;
14867     }
14868     if (HistoCode == "D_MCs_ChDs") {
14869       fXMemoD_MCs_ChDs = xvar;
14870     }
14871     if (HistoCode == "D_LFN_ChNb") {
14872       fXMemoD_LFN_ChNb = xvar;
14873     }
14874     if (HistoCode == "D_LFN_ChDs") {
14875       fXMemoD_LFN_ChDs = xvar;
14876     }
14877     if (HistoCode == "D_HFN_ChNb") {
14878       fXMemoD_HFN_ChNb = xvar;
14879     }
14880     if (HistoCode == "D_HFN_ChDs") {
14881       fXMemoD_HFN_ChDs = xvar;
14882     }
14883     if (HistoCode == "D_SCs_ChNb") {
14884       fXMemoD_SCs_ChNb = xvar;
14885     }
14886     if (HistoCode == "D_SCs_ChDs") {
14887       fXMemoD_SCs_ChDs = xvar;
14888     }
14889     if (HistoCode == "D_MSp_SpNb") {
14890       fXMemoD_MSp_SpNb = xvar;
14891     }
14892     if (HistoCode == "D_MSp_SpDs") {
14893       fXMemoD_MSp_SpDs = xvar;
14894     }
14895     if (HistoCode == "D_SSp_SpNb") {
14896       fXMemoD_SSp_SpNb = xvar;
14897     }
14898     if (HistoCode == "D_SSp_SpDs") {
14899       fXMemoD_SSp_SpDs = xvar;
14900     }
14901     if (HistoCode == "D_Adc_EvNb") {
14902       fXMemoD_Adc_EvNb = xvar;
14903     }
14904     if (HistoCode == "D_Adc_EvDs") {
14905       fXMemoD_Adc_EvDs = xvar;
14906     }
14907     if (HistoCode == "H_Ped_Date") {
14908       fXMemoH_Ped_Date = xvar;
14909     }
14910     if (HistoCode == "H_TNo_Date") {
14911       fXMemoH_TNo_Date = xvar;
14912     }
14913     if (HistoCode == "H_MCs_Date") {
14914       fXMemoH_MCs_Date = xvar;
14915     }
14916     if (HistoCode == "H_LFN_Date") {
14917       fXMemoH_LFN_Date = xvar;
14918     }
14919     if (HistoCode == "H_HFN_Date") {
14920       fXMemoH_HFN_Date = xvar;
14921     }
14922     if (HistoCode == "H_SCs_Date") {
14923       fXMemoH_SCs_Date = xvar;
14924     }
14925     if (HistoCode == "H_Ped_RuDs") {
14926       fXMemoH_Ped_RuDs = xvar;
14927     }
14928     if (HistoCode == "H_TNo_RuDs") {
14929       fXMemoH_TNo_RuDs = xvar;
14930     }
14931     if (HistoCode == "H_MCs_RuDs") {
14932       fXMemoH_MCs_RuDs = xvar;
14933     }
14934     if (HistoCode == "H_LFN_RuDs") {
14935       fXMemoH_LFN_RuDs = xvar;
14936     }
14937     if (HistoCode == "H_HFN_RuDs") {
14938       fXMemoH_HFN_RuDs = xvar;
14939     }
14940     if (HistoCode == "H_SCs_RuDs") {
14941       fXMemoH_SCs_RuDs = xvar;
14942     }
14943   }
14944 }  // end of SetXVarMemo(...)
14945 
14946 TString TEcnaHistos::GetXVarFromMemo(const TString& HistoCode, const TString& opt_plot) {
14947   TString xvar = "(xvar not found)";
14948 
14949   if (opt_plot == fSameOnePlot) {
14950     xvar = fXMemoH1SamePlus;
14951   }
14952 
14953   if (opt_plot == fOnlyOnePlot || opt_plot == fSeveralPlot) {
14954     if (HistoCode == "D_NOE_ChNb") {
14955       xvar = fXMemoD_NOE_ChNb;
14956     }
14957     if (HistoCode == "D_NOE_ChDs") {
14958       xvar = fXMemoD_NOE_ChDs;
14959     }
14960     if (HistoCode == "D_Ped_ChNb") {
14961       xvar = fXMemoD_Ped_ChNb;
14962     }
14963     if (HistoCode == "D_Ped_ChDs") {
14964       xvar = fXMemoD_Ped_ChDs;
14965     }
14966     if (HistoCode == "D_TNo_ChNb") {
14967       xvar = fXMemoD_TNo_ChNb;
14968     }
14969     if (HistoCode == "D_TNo_ChDs") {
14970       xvar = fXMemoD_TNo_ChDs;
14971     }
14972     if (HistoCode == "D_MCs_ChNb") {
14973       xvar = fXMemoD_MCs_ChNb;
14974     }
14975     if (HistoCode == "D_MCs_ChDs") {
14976       xvar = fXMemoD_MCs_ChDs;
14977     }
14978     if (HistoCode == "D_LFN_ChNb") {
14979       xvar = fXMemoD_LFN_ChNb;
14980     }
14981     if (HistoCode == "D_LFN_ChDs") {
14982       xvar = fXMemoD_LFN_ChDs;
14983     }
14984     if (HistoCode == "D_HFN_ChNb") {
14985       xvar = fXMemoD_HFN_ChNb;
14986     }
14987     if (HistoCode == "D_HFN_ChDs") {
14988       xvar = fXMemoD_HFN_ChDs;
14989     }
14990     if (HistoCode == "D_SCs_ChNb") {
14991       xvar = fXMemoD_SCs_ChNb;
14992     }
14993     if (HistoCode == "D_SCs_ChDs") {
14994       xvar = fXMemoD_SCs_ChDs;
14995     }
14996     if (HistoCode == "D_MSp_SpNb") {
14997       xvar = fXMemoD_MSp_SpNb;
14998     }
14999     if (HistoCode == "D_MSp_SpDs") {
15000       xvar = fXMemoD_MSp_SpDs;
15001     }
15002     if (HistoCode == "D_SSp_SpNb") {
15003       xvar = fXMemoD_SSp_SpNb;
15004     }
15005     if (HistoCode == "D_SSp_SpDs") {
15006       xvar = fXMemoD_SSp_SpDs;
15007     }
15008     if (HistoCode == "D_Adc_EvNb") {
15009       xvar = fXMemoD_Adc_EvNb;
15010     }
15011     if (HistoCode == "D_Adc_EvDs") {
15012       xvar = fXMemoD_Adc_EvDs;
15013     }
15014     if (HistoCode == "H_Ped_Date") {
15015       xvar = fXMemoH_Ped_Date;
15016     }
15017     if (HistoCode == "H_TNo_Date") {
15018       xvar = fXMemoH_TNo_Date;
15019     }
15020     if (HistoCode == "H_MCs_Date") {
15021       xvar = fXMemoH_MCs_Date;
15022     }
15023     if (HistoCode == "H_LFN_Date") {
15024       xvar = fXMemoH_LFN_Date;
15025     }
15026     if (HistoCode == "H_HFN_Date") {
15027       xvar = fXMemoH_HFN_Date;
15028     }
15029     if (HistoCode == "H_SCs_Date") {
15030       xvar = fXMemoH_SCs_Date;
15031     }
15032     if (HistoCode == "H_Ped_RuDs") {
15033       xvar = fXMemoH_Ped_RuDs;
15034     }
15035     if (HistoCode == "H_TNo_RuDs") {
15036       xvar = fXMemoH_TNo_RuDs;
15037     }
15038     if (HistoCode == "H_MCs_RuDs") {
15039       xvar = fXMemoH_MCs_RuDs;
15040     }
15041     if (HistoCode == "H_LFN_RuDs") {
15042       xvar = fXMemoH_LFN_RuDs;
15043     }
15044     if (HistoCode == "H_HFN_RuDs") {
15045       xvar = fXMemoH_HFN_RuDs;
15046     }
15047     if (HistoCode == "H_SCs_RuDs") {
15048       xvar = fXMemoH_SCs_RuDs;
15049     }
15050   }
15051   return xvar;
15052 }  // end of GetXVarFromMemo(...)
15053 
15054 void TEcnaHistos::SetYVarMemo(const TString& HistoCode, const TString& opt_plot, const TString& yvar) {
15055   if (opt_plot == fSameOnePlot) {
15056     fYMemoH1SamePlus = yvar;
15057   }
15058 
15059   if (opt_plot == fOnlyOnePlot || opt_plot == fSeveralPlot) {
15060     if (HistoCode == "D_NOE_ChNb") {
15061       fYMemoD_NOE_ChNb = yvar;
15062     }
15063     if (HistoCode == "D_NOE_ChDs") {
15064       fYMemoD_NOE_ChDs = yvar;
15065     }
15066     if (HistoCode == "D_Ped_ChNb") {
15067       fYMemoD_Ped_ChNb = yvar;
15068     }
15069     if (HistoCode == "D_Ped_ChDs") {
15070       fYMemoD_Ped_ChDs = yvar;
15071     }
15072     if (HistoCode == "D_TNo_ChNb") {
15073       fYMemoD_TNo_ChNb = yvar;
15074     }
15075     if (HistoCode == "D_TNo_ChDs") {
15076       fYMemoD_TNo_ChDs = yvar;
15077     }
15078     if (HistoCode == "D_MCs_ChNb") {
15079       fYMemoD_MCs_ChNb = yvar;
15080     }
15081     if (HistoCode == "D_MCs_ChDs") {
15082       fYMemoD_MCs_ChDs = yvar;
15083     }
15084     if (HistoCode == "D_LFN_ChNb") {
15085       fYMemoD_LFN_ChNb = yvar;
15086     }
15087     if (HistoCode == "D_LFN_ChDs") {
15088       fYMemoD_LFN_ChDs = yvar;
15089     }
15090     if (HistoCode == "D_HFN_ChNb") {
15091       fYMemoD_HFN_ChNb = yvar;
15092     }
15093     if (HistoCode == "D_HFN_ChDs") {
15094       fYMemoD_HFN_ChDs = yvar;
15095     }
15096     if (HistoCode == "D_SCs_ChNb") {
15097       fYMemoD_SCs_ChNb = yvar;
15098     }
15099     if (HistoCode == "D_SCs_ChDs") {
15100       fYMemoD_SCs_ChDs = yvar;
15101     }
15102     if (HistoCode == "D_MSp_SpNb") {
15103       fYMemoD_MSp_SpNb = yvar;
15104     }
15105     if (HistoCode == "D_MSp_SpDs") {
15106       fYMemoD_MSp_SpDs = yvar;
15107     }
15108     if (HistoCode == "D_SSp_SpNb") {
15109       fYMemoD_SSp_SpNb = yvar;
15110     }
15111     if (HistoCode == "D_Adc_EvDs") {
15112       fYMemoD_Adc_EvDs = yvar;
15113     }
15114     if (HistoCode == "D_SSp_SpDs") {
15115       fYMemoD_SSp_SpDs = yvar;
15116     }
15117     if (HistoCode == "D_Adc_EvNb") {
15118       fYMemoD_Adc_EvNb = yvar;
15119     }
15120     if (HistoCode == "H_Ped_Date") {
15121       fYMemoH_Ped_Date = yvar;
15122     }
15123     if (HistoCode == "H_TNo_Date") {
15124       fYMemoH_TNo_Date = yvar;
15125     }
15126     if (HistoCode == "H_MCs_Date") {
15127       fYMemoH_MCs_Date = yvar;
15128     }
15129     if (HistoCode == "H_LFN_Date") {
15130       fYMemoH_LFN_Date = yvar;
15131     }
15132     if (HistoCode == "H_HFN_Date") {
15133       fYMemoH_HFN_Date = yvar;
15134     }
15135     if (HistoCode == "H_SCs_Date") {
15136       fYMemoH_SCs_Date = yvar;
15137     }
15138     if (HistoCode == "H_Ped_RuDs") {
15139       fYMemoH_Ped_RuDs = yvar;
15140     }
15141     if (HistoCode == "H_TNo_RuDs") {
15142       fYMemoH_TNo_RuDs = yvar;
15143     }
15144     if (HistoCode == "H_MCs_RuDs") {
15145       fYMemoH_MCs_RuDs = yvar;
15146     }
15147     if (HistoCode == "H_LFN_RuDs") {
15148       fYMemoH_LFN_RuDs = yvar;
15149     }
15150     if (HistoCode == "H_HFN_RuDs") {
15151       fYMemoH_HFN_RuDs = yvar;
15152     }
15153     if (HistoCode == "H_SCs_RuDs") {
15154       fYMemoH_SCs_RuDs = yvar;
15155     }
15156   }
15157 }  // end of SetYVarMemo(...)
15158 
15159 TString TEcnaHistos::GetYVarFromMemo(const TString& HistoCode, const TString& opt_plot) {
15160   TString yvar = "(yvar not found)";
15161 
15162   if (opt_plot == fSameOnePlot) {
15163     yvar = fYMemoH1SamePlus;
15164   }
15165 
15166   if (opt_plot == fOnlyOnePlot || opt_plot == fSeveralPlot) {
15167     if (HistoCode == "D_NOE_ChNb") {
15168       yvar = fYMemoD_NOE_ChNb;
15169     }
15170     if (HistoCode == "D_NOE_ChDs") {
15171       yvar = fYMemoD_NOE_ChDs;
15172     }
15173     if (HistoCode == "D_Ped_ChNb") {
15174       yvar = fYMemoD_Ped_ChNb;
15175     }
15176     if (HistoCode == "D_Ped_ChDs") {
15177       yvar = fYMemoD_Ped_ChDs;
15178     }
15179     if (HistoCode == "D_TNo_ChNb") {
15180       yvar = fYMemoD_TNo_ChNb;
15181     }
15182     if (HistoCode == "D_TNo_ChDs") {
15183       yvar = fYMemoD_TNo_ChDs;
15184     }
15185     if (HistoCode == "D_MCs_ChNb") {
15186       yvar = fYMemoD_MCs_ChNb;
15187     }
15188     if (HistoCode == "D_MCs_ChDs") {
15189       yvar = fYMemoD_MCs_ChDs;
15190     }
15191     if (HistoCode == "D_LFN_ChNb") {
15192       yvar = fYMemoD_LFN_ChNb;
15193     }
15194     if (HistoCode == "D_LFN_ChDs") {
15195       yvar = fYMemoD_LFN_ChDs;
15196     }
15197     if (HistoCode == "D_HFN_ChNb") {
15198       yvar = fYMemoD_HFN_ChNb;
15199     }
15200     if (HistoCode == "D_HFN_ChDs") {
15201       yvar = fYMemoD_HFN_ChDs;
15202     }
15203     if (HistoCode == "D_SCs_ChNb") {
15204       yvar = fYMemoD_SCs_ChNb;
15205     }
15206     if (HistoCode == "D_SCs_ChDs") {
15207       yvar = fYMemoD_SCs_ChDs;
15208     }
15209     if (HistoCode == "D_MSp_SpNb") {
15210       yvar = fYMemoD_MSp_SpNb;
15211     }
15212     if (HistoCode == "D_MSp_SpDs") {
15213       yvar = fYMemoD_MSp_SpDs;
15214     }
15215     if (HistoCode == "D_SSp_SpNb") {
15216       yvar = fYMemoD_SSp_SpNb;
15217     }
15218     if (HistoCode == "D_SSp_SpDs") {
15219       yvar = fYMemoD_SSp_SpDs;
15220     }
15221     if (HistoCode == "D_Adc_EvNb") {
15222       yvar = fYMemoD_Adc_EvNb;
15223     }
15224     if (HistoCode == "D_Adc_EvDs") {
15225       yvar = fYMemoD_Adc_EvDs;
15226     }
15227     if (HistoCode == "H_Ped_Date") {
15228       yvar = fYMemoH_Ped_Date;
15229     }
15230     if (HistoCode == "H_TNo_Date") {
15231       yvar = fYMemoH_TNo_Date;
15232     }
15233     if (HistoCode == "H_MCs_Date") {
15234       yvar = fYMemoH_MCs_Date;
15235     }
15236     if (HistoCode == "H_LFN_Date") {
15237       yvar = fYMemoH_LFN_Date;
15238     }
15239     if (HistoCode == "H_HFN_Date") {
15240       yvar = fYMemoH_HFN_Date;
15241     }
15242     if (HistoCode == "H_SCs_Date") {
15243       yvar = fYMemoH_SCs_Date;
15244     }
15245     if (HistoCode == "H_Ped_RuDs") {
15246       yvar = fYMemoH_Ped_RuDs;
15247     }
15248     if (HistoCode == "H_TNo_RuDs") {
15249       yvar = fYMemoH_TNo_RuDs;
15250     }
15251     if (HistoCode == "H_MCs_RuDs") {
15252       yvar = fYMemoH_MCs_RuDs;
15253     }
15254     if (HistoCode == "H_LFN_RuDs") {
15255       yvar = fYMemoH_LFN_RuDs;
15256     }
15257     if (HistoCode == "H_HFN_RuDs") {
15258       yvar = fYMemoH_HFN_RuDs;
15259     }
15260     if (HistoCode == "H_SCs_RuDs") {
15261       yvar = fYMemoH_SCs_RuDs;
15262     }
15263   }
15264   return yvar;
15265 }  // end of GetYVarFromMemo(...)
15266 
15267 void TEcnaHistos::SetNbBinsMemo(const TString& HistoCode, const TString& opt_plot, const Int_t& nb_bins) {
15268   if (opt_plot == fSameOnePlot) {
15269     fNbBinsMemoH1SamePlus = nb_bins;
15270   }
15271 
15272   if (opt_plot == fOnlyOnePlot || opt_plot == fSeveralPlot) {
15273     if (HistoCode == "D_NOE_ChNb") {
15274       fNbBinsMemoD_NOE_ChNb = nb_bins;
15275     }
15276     if (HistoCode == "D_NOE_ChDs") {
15277       fNbBinsMemoD_NOE_ChDs = nb_bins;
15278     }
15279     if (HistoCode == "D_Ped_ChNb") {
15280       fNbBinsMemoD_Ped_ChNb = nb_bins;
15281     }
15282     if (HistoCode == "D_Ped_ChDs") {
15283       fNbBinsMemoD_Ped_ChDs = nb_bins;
15284     }
15285     if (HistoCode == "D_TNo_ChNb") {
15286       fNbBinsMemoD_TNo_ChNb = nb_bins;
15287     }
15288     if (HistoCode == "D_TNo_ChDs") {
15289       fNbBinsMemoD_TNo_ChDs = nb_bins;
15290     }
15291     if (HistoCode == "D_MCs_ChNb") {
15292       fNbBinsMemoD_MCs_ChNb = nb_bins;
15293     }
15294     if (HistoCode == "D_MCs_ChDs") {
15295       fNbBinsMemoD_MCs_ChDs = nb_bins;
15296     }
15297     if (HistoCode == "D_LFN_ChNb") {
15298       fNbBinsMemoD_LFN_ChNb = nb_bins;
15299     }
15300     if (HistoCode == "D_LFN_ChDs") {
15301       fNbBinsMemoD_LFN_ChDs = nb_bins;
15302     }
15303     if (HistoCode == "D_HFN_ChNb") {
15304       fNbBinsMemoD_HFN_ChNb = nb_bins;
15305     }
15306     if (HistoCode == "D_HFN_ChDs") {
15307       fNbBinsMemoD_HFN_ChDs = nb_bins;
15308     }
15309     if (HistoCode == "D_SCs_ChNb") {
15310       fNbBinsMemoD_SCs_ChNb = nb_bins;
15311     }
15312     if (HistoCode == "D_SCs_ChDs") {
15313       fNbBinsMemoD_SCs_ChDs = nb_bins;
15314     }
15315     if (HistoCode == "D_MSp_SpNb") {
15316       fNbBinsMemoD_MSp_SpNb = nb_bins;
15317     }
15318     if (HistoCode == "D_MSp_SpDs") {
15319       fNbBinsMemoD_MSp_SpDs = nb_bins;
15320     }
15321     if (HistoCode == "D_SSp_SpNb") {
15322       fNbBinsMemoD_SSp_SpNb = nb_bins;
15323     }
15324     if (HistoCode == "D_SSp_SpDs") {
15325       fNbBinsMemoD_SSp_SpDs = nb_bins;
15326     }
15327     if (HistoCode == "D_Adc_EvNb") {
15328       fNbBinsMemoD_Adc_EvNb = nb_bins;
15329     }
15330     if (HistoCode == "D_Adc_EvDs") {
15331       fNbBinsMemoD_Adc_EvDs = nb_bins;
15332     }
15333     if (HistoCode == "H_Ped_Date") {
15334       fNbBinsMemoH_Ped_Date = nb_bins;
15335     }
15336     if (HistoCode == "H_TNo_Date") {
15337       fNbBinsMemoH_TNo_Date = nb_bins;
15338     }
15339     if (HistoCode == "H_MCs_Date") {
15340       fNbBinsMemoH_MCs_Date = nb_bins;
15341     }
15342     if (HistoCode == "H_LFN_Date") {
15343       fNbBinsMemoH_LFN_Date = nb_bins;
15344     }
15345     if (HistoCode == "H_HFN_Date") {
15346       fNbBinsMemoH_HFN_Date = nb_bins;
15347     }
15348     if (HistoCode == "H_SCs_Date") {
15349       fNbBinsMemoH_SCs_Date = nb_bins;
15350     }
15351     if (HistoCode == "H_Ped_RuDs") {
15352       fNbBinsMemoH_Ped_RuDs = nb_bins;
15353     }
15354     if (HistoCode == "H_TNo_RuDs") {
15355       fNbBinsMemoH_TNo_RuDs = nb_bins;
15356     }
15357     if (HistoCode == "H_MCs_RuDs") {
15358       fNbBinsMemoH_MCs_RuDs = nb_bins;
15359     }
15360     if (HistoCode == "H_LFN_RuDs") {
15361       fNbBinsMemoH_LFN_RuDs = nb_bins;
15362     }
15363     if (HistoCode == "H_HFN_RuDs") {
15364       fNbBinsMemoH_HFN_RuDs = nb_bins;
15365     }
15366     if (HistoCode == "H_SCs_RuDs") {
15367       fNbBinsMemoH_SCs_RuDs = nb_bins;
15368     }
15369   }
15370 }  // end of SetNbBinsMemo(...)
15371 
15372 Int_t TEcnaHistos::GetNbBinsFromMemo(const TString& HistoCode, const TString& opt_plot) {
15373   Int_t nb_bins = 0;
15374 
15375   if (opt_plot == fSameOnePlot) {
15376     nb_bins = fNbBinsMemoH1SamePlus;
15377   }
15378 
15379   if (opt_plot == fOnlyOnePlot || opt_plot == fSeveralPlot) {
15380     if (HistoCode == "D_NOE_ChNb") {
15381       nb_bins = fNbBinsMemoD_NOE_ChNb;
15382     }
15383     if (HistoCode == "D_NOE_ChDs") {
15384       nb_bins = fNbBinsMemoD_NOE_ChDs;
15385     }
15386     if (HistoCode == "D_Ped_ChNb") {
15387       nb_bins = fNbBinsMemoD_Ped_ChNb;
15388     }
15389     if (HistoCode == "D_Ped_ChDs") {
15390       nb_bins = fNbBinsMemoD_Ped_ChDs;
15391     }
15392     if (HistoCode == "D_TNo_ChNb") {
15393       nb_bins = fNbBinsMemoD_TNo_ChNb;
15394     }
15395     if (HistoCode == "D_TNo_ChDs") {
15396       nb_bins = fNbBinsMemoD_TNo_ChDs;
15397     }
15398     if (HistoCode == "D_MCs_ChNb") {
15399       nb_bins = fNbBinsMemoD_MCs_ChNb;
15400     }
15401     if (HistoCode == "D_MCs_ChDs") {
15402       nb_bins = fNbBinsMemoD_MCs_ChDs;
15403     }
15404     if (HistoCode == "D_LFN_ChNb") {
15405       nb_bins = fNbBinsMemoD_LFN_ChNb;
15406     }
15407     if (HistoCode == "D_LFN_ChDs") {
15408       nb_bins = fNbBinsMemoD_LFN_ChDs;
15409     }
15410     if (HistoCode == "D_HFN_ChNb") {
15411       nb_bins = fNbBinsMemoD_HFN_ChNb;
15412     }
15413     if (HistoCode == "D_HFN_ChDs") {
15414       nb_bins = fNbBinsMemoD_HFN_ChDs;
15415     }
15416     if (HistoCode == "D_SCs_ChNb") {
15417       nb_bins = fNbBinsMemoD_SCs_ChNb;
15418     }
15419     if (HistoCode == "D_SCs_ChDs") {
15420       nb_bins = fNbBinsMemoD_SCs_ChDs;
15421     }
15422     if (HistoCode == "D_MSp_SpNb") {
15423       nb_bins = fNbBinsMemoD_MSp_SpNb;
15424     }
15425     if (HistoCode == "D_MSp_SpDs") {
15426       nb_bins = fNbBinsMemoD_MSp_SpDs;
15427     }
15428     if (HistoCode == "D_SSp_SpNb") {
15429       nb_bins = fNbBinsMemoD_SSp_SpNb;
15430     }
15431     if (HistoCode == "D_SSp_SpDs") {
15432       nb_bins = fNbBinsMemoD_SSp_SpDs;
15433     }
15434     if (HistoCode == "D_Adc_EvNb") {
15435       nb_bins = fNbBinsMemoD_Adc_EvNb;
15436     }
15437     if (HistoCode == "D_Adc_EvDs") {
15438       nb_bins = fNbBinsMemoD_Adc_EvDs;
15439     }
15440     if (HistoCode == "H_Ped_Date") {
15441       nb_bins = fNbBinsMemoH_Ped_Date;
15442     }
15443     if (HistoCode == "H_TNo_Date") {
15444       nb_bins = fNbBinsMemoH_TNo_Date;
15445     }
15446     if (HistoCode == "H_MCs_Date") {
15447       nb_bins = fNbBinsMemoH_MCs_Date;
15448     }
15449     if (HistoCode == "H_LFN_Date") {
15450       nb_bins = fNbBinsMemoH_LFN_Date;
15451     }
15452     if (HistoCode == "H_HFN_Date") {
15453       nb_bins = fNbBinsMemoH_HFN_Date;
15454     }
15455     if (HistoCode == "H_SCs_Date") {
15456       nb_bins = fNbBinsMemoH_SCs_Date;
15457     }
15458     if (HistoCode == "H_Ped_RuDs") {
15459       nb_bins = fNbBinsMemoH_Ped_RuDs;
15460     }
15461     if (HistoCode == "H_TNo_RuDs") {
15462       nb_bins = fNbBinsMemoH_TNo_RuDs;
15463     }
15464     if (HistoCode == "H_MCs_RuDs") {
15465       nb_bins = fNbBinsMemoH_MCs_RuDs;
15466     }
15467     if (HistoCode == "H_LFN_RuDs") {
15468       nb_bins = fNbBinsMemoH_LFN_RuDs;
15469     }
15470     if (HistoCode == "H_HFN_RuDs") {
15471       nb_bins = fNbBinsMemoH_HFN_RuDs;
15472     }
15473     if (HistoCode == "H_SCs_RuDs") {
15474       nb_bins = fNbBinsMemoH_SCs_RuDs;
15475     }
15476   }
15477   return nb_bins;
15478 }  // end of GetNbBinsFromMemo(...)
15479 
15480 TString TEcnaHistos::GetMemoFlag(const TString& opt_plot) {
15481   TString memo_flag;
15482   memo_flag.Resize(charArrLen);
15483   memo_flag = "(no memo_flag info)";
15484 
15485   Int_t memo_flag_number = -1;
15486 
15487   if (opt_plot == fSameOnePlot) {
15488     memo_flag_number = fMemoPlotH1SamePlus;
15489   }
15490 
15491   if (opt_plot == fOnlyOnePlot || opt_plot == fSeveralPlot) {
15492     memo_flag_number =
15493         fMemoPlotD_TNo_ChDs + fMemoPlotD_MCs_ChDs + fMemoPlotD_LFN_ChDs + fMemoPlotD_HFN_ChDs + fMemoPlotD_SCs_ChDs;
15494   }
15495 
15496   if (memo_flag_number == 0) {
15497     memo_flag = "Free";
15498   }
15499   if (memo_flag_number >= 1) {
15500     memo_flag = "Busy";
15501   }
15502 
15503   return memo_flag;
15504 }
15505 
15506 TString TEcnaHistos::GetMemoFlag(const TString& HistoCode, const TString& opt_plot) {
15507   // Get Memo Flag
15508 
15509   TString memo_flag;
15510   memo_flag.Resize(charArrLen);
15511   memo_flag = "(no memo_flag info)";
15512 
15513   Int_t memo_flag_number = -1;
15514 
15515   if (opt_plot == fSameOnePlot) {
15516     memo_flag_number = fMemoPlotH1SamePlus;
15517   }
15518 
15519   if (opt_plot == fOnlyOnePlot || opt_plot == fSeveralPlot) {
15520     if (HistoCode == "D_NOE_ChNb") {
15521       memo_flag_number = fMemoPlotD_NOE_ChNb;
15522     }
15523     if (HistoCode == "D_NOE_ChDs") {
15524       memo_flag_number = fMemoPlotD_NOE_ChDs;
15525     }
15526     if (HistoCode == "D_Ped_ChNb") {
15527       memo_flag_number = fMemoPlotD_Ped_ChNb;
15528     }
15529     if (HistoCode == "D_Ped_ChDs") {
15530       memo_flag_number = fMemoPlotD_Ped_ChDs;
15531     }
15532     if (HistoCode == "D_TNo_ChNb") {
15533       memo_flag_number = fMemoPlotD_TNo_ChNb;
15534     }
15535     if (HistoCode == "D_TNo_ChDs") {
15536       memo_flag_number = fMemoPlotD_TNo_ChDs;
15537     }
15538     if (HistoCode == "D_MCs_ChNb") {
15539       memo_flag_number = fMemoPlotD_MCs_ChNb;
15540     }
15541     if (HistoCode == "D_MCs_ChDs") {
15542       memo_flag_number = fMemoPlotD_MCs_ChDs;
15543     }
15544     if (HistoCode == "D_LFN_ChNb") {
15545       memo_flag_number = fMemoPlotD_LFN_ChNb;
15546     }
15547     if (HistoCode == "D_LFN_ChDs") {
15548       memo_flag_number = fMemoPlotD_LFN_ChDs;
15549     }
15550     if (HistoCode == "D_HFN_ChNb") {
15551       memo_flag_number = fMemoPlotD_HFN_ChNb;
15552     }
15553     if (HistoCode == "D_HFN_ChDs") {
15554       memo_flag_number = fMemoPlotD_HFN_ChDs;
15555     }
15556     if (HistoCode == "D_SCs_ChNb") {
15557       memo_flag_number = fMemoPlotD_SCs_ChNb;
15558     }
15559     if (HistoCode == "D_SCs_ChDs") {
15560       memo_flag_number = fMemoPlotD_SCs_ChDs;
15561     }
15562     if (HistoCode == "D_MSp_SpNb") {
15563       memo_flag_number = fMemoPlotD_MSp_SpNb;
15564     }
15565     if (HistoCode == "D_MSp_SpDs") {
15566       memo_flag_number = fMemoPlotD_MSp_SpDs;
15567     }
15568     if (HistoCode == "D_SSp_SpNb") {
15569       memo_flag_number = fMemoPlotD_SSp_SpNb;
15570     }
15571     if (HistoCode == "D_SSp_SpDs") {
15572       memo_flag_number = fMemoPlotD_SSp_SpDs;
15573     }
15574     if (HistoCode == "D_Adc_EvNb") {
15575       memo_flag_number = fMemoPlotD_Adc_EvNb;
15576     }
15577     if (HistoCode == "D_Adc_EvDs") {
15578       memo_flag_number = fMemoPlotD_Adc_EvDs;
15579     }
15580     if (HistoCode == "H_Ped_Date") {
15581       memo_flag_number = fMemoPlotH_Ped_Date;
15582     }
15583     if (HistoCode == "H_TNo_Date") {
15584       memo_flag_number = fMemoPlotH_TNo_Date;
15585     }
15586     if (HistoCode == "H_MCs_Date") {
15587       memo_flag_number = fMemoPlotH_MCs_Date;
15588     }
15589     if (HistoCode == "H_LFN_Date") {
15590       memo_flag_number = fMemoPlotH_LFN_Date;
15591     }
15592     if (HistoCode == "H_HFN_Date") {
15593       memo_flag_number = fMemoPlotH_HFN_Date;
15594     }
15595     if (HistoCode == "H_SCs_Date") {
15596       memo_flag_number = fMemoPlotH_SCs_Date;
15597     }
15598     if (HistoCode == "H_Ped_RuDs") {
15599       memo_flag_number = fMemoPlotH_Ped_RuDs;
15600     }
15601     if (HistoCode == "H_TNo_RuDs") {
15602       memo_flag_number = fMemoPlotH_TNo_RuDs;
15603     }
15604     if (HistoCode == "H_MCs_RuDs") {
15605       memo_flag_number = fMemoPlotH_MCs_RuDs;
15606     }
15607     if (HistoCode == "H_LFN_RuDs") {
15608       memo_flag_number = fMemoPlotH_LFN_RuDs;
15609     }
15610     if (HistoCode == "H_HFN_RuDs") {
15611       memo_flag_number = fMemoPlotH_HFN_RuDs;
15612     }
15613     if (HistoCode == "H_SCs_RuDs") {
15614       memo_flag_number = fMemoPlotH_SCs_RuDs;
15615     }
15616   }
15617 
15618   if (memo_flag_number == 0) {
15619     memo_flag = "Free";
15620   }
15621   if (memo_flag_number == 1) {
15622     memo_flag = "Busy";
15623   }
15624 
15625   return memo_flag;
15626 }
15627 
15628 TCanvas* TEcnaHistos::CreateCanvas(
15629     const TString& HistoCode, const TString& opt_plot, const TString& canvas_name, UInt_t canv_w, UInt_t canv_h) {
15630   // Create canvas according to HistoCode
15631 
15632   TCanvas* main_canvas = nullptr;
15633 
15634   if (opt_plot == fSameOnePlot) {
15635     fCanvH1SamePlus = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h);
15636     fCnewRoot++;
15637     main_canvas = fCanvH1SamePlus;
15638   }
15639   if (opt_plot == fSeveralPlot || opt_plot == fOnlyOnePlot) {
15640     if (HistoCode == "D_NOE_ChNb") {
15641       fCanvD_NOE_ChNb = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h);
15642       fCnewRoot++;
15643       main_canvas = fCanvD_NOE_ChNb;
15644     }
15645     if (HistoCode == "D_NOE_ChDs") {
15646       fCanvD_NOE_ChDs = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h);
15647       fCnewRoot++;
15648       main_canvas = fCanvD_NOE_ChDs;
15649     }
15650     if (HistoCode == "D_Ped_ChNb") {
15651       fCanvD_Ped_ChNb = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h);
15652       fCnewRoot++;
15653       main_canvas = fCanvD_Ped_ChNb;
15654     }
15655     if (HistoCode == "D_Ped_ChDs") {
15656       fCanvD_Ped_ChDs = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h);
15657       fCnewRoot++;
15658       main_canvas = fCanvD_Ped_ChDs;
15659     }
15660     if (HistoCode == "D_TNo_ChNb") {
15661       fCanvD_TNo_ChNb = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h);
15662       fCnewRoot++;
15663       main_canvas = fCanvD_TNo_ChNb;
15664     }
15665     if (HistoCode == "D_TNo_ChDs") {
15666       fCanvD_TNo_ChDs = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h);
15667       fCnewRoot++;
15668       main_canvas = fCanvD_TNo_ChDs;
15669     }
15670     if (HistoCode == "D_MCs_ChNb") {
15671       fCanvD_MCs_ChNb = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h);
15672       fCnewRoot++;
15673       main_canvas = fCanvD_MCs_ChNb;
15674     }
15675     if (HistoCode == "D_MCs_ChDs") {
15676       fCanvD_MCs_ChDs = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h);
15677       fCnewRoot++;
15678       main_canvas = fCanvD_MCs_ChDs;
15679     }
15680     if (HistoCode == "D_LFN_ChNb") {
15681       fCanvD_LFN_ChNb = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h);
15682       fCnewRoot++;
15683       main_canvas = fCanvD_LFN_ChNb;
15684     }
15685     if (HistoCode == "D_LFN_ChDs") {
15686       fCanvD_LFN_ChDs = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h);
15687       fCnewRoot++;
15688       main_canvas = fCanvD_LFN_ChDs;
15689     }
15690     if (HistoCode == "D_HFN_ChNb") {
15691       fCanvD_HFN_ChNb = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h);
15692       fCnewRoot++;
15693       main_canvas = fCanvD_HFN_ChNb;
15694     }
15695     if (HistoCode == "D_HFN_ChDs") {
15696       fCanvD_HFN_ChDs = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h);
15697       fCnewRoot++;
15698       main_canvas = fCanvD_HFN_ChDs;
15699     }
15700     if (HistoCode == "D_SCs_ChNb") {
15701       fCanvD_SCs_ChNb = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h);
15702       fCnewRoot++;
15703       main_canvas = fCanvD_SCs_ChNb;
15704     }
15705     if (HistoCode == "D_SCs_ChDs") {
15706       fCanvD_SCs_ChDs = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h);
15707       fCnewRoot++;
15708       main_canvas = fCanvD_SCs_ChDs;
15709     }
15710 
15711     if (HistoCode == "D_MSp_SpNb") {
15712       fCanvD_MSp_SpNb = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h);
15713       fCnewRoot++;
15714       main_canvas = fCanvD_MSp_SpNb;
15715     }
15716     if (HistoCode == "D_MSp_SpDs") {
15717       fCanvD_MSp_SpDs = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h);
15718       fCnewRoot++;
15719       main_canvas = fCanvD_MSp_SpDs;
15720     }
15721     if (HistoCode == "D_SSp_SpNb") {
15722       fCanvD_SSp_SpNb = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h);
15723       fCnewRoot++;
15724       main_canvas = fCanvD_SSp_SpNb;
15725     }
15726     if (HistoCode == "D_SSp_SpDs") {
15727       fCanvD_SSp_SpDs = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h);
15728       fCnewRoot++;
15729       main_canvas = fCanvD_SSp_SpDs;
15730     }
15731 
15732     if (HistoCode == "D_Adc_EvNb") {
15733       fCanvD_Adc_EvNb = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h);
15734       fCnewRoot++;
15735       main_canvas = fCanvD_Adc_EvNb;
15736     }
15737     if (HistoCode == "D_Adc_EvDs") {
15738       fCanvD_Adc_EvDs = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h);
15739       fCnewRoot++;
15740       main_canvas = fCanvD_Adc_EvDs;
15741     }
15742 
15743     if (HistoCode == "H_Ped_Date") {
15744       fCanvH_Ped_Date = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h);
15745       fCnewRoot++;
15746       main_canvas = fCanvH_Ped_Date;
15747     }
15748     if (HistoCode == "H_TNo_Date") {
15749       fCanvH_TNo_Date = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h);
15750       fCnewRoot++;
15751       main_canvas = fCanvH_TNo_Date;
15752     }
15753     if (HistoCode == "H_MCs_Date") {
15754       fCanvH_MCs_Date = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h);
15755       fCnewRoot++;
15756       main_canvas = fCanvH_MCs_Date;
15757     }
15758     if (HistoCode == "H_LFN_Date") {
15759       fCanvH_LFN_Date = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h);
15760       fCnewRoot++;
15761       main_canvas = fCanvH_LFN_Date;
15762     }
15763     if (HistoCode == "H_HFN_Date") {
15764       fCanvH_HFN_Date = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h);
15765       fCnewRoot++;
15766       main_canvas = fCanvH_HFN_Date;
15767     }
15768     if (HistoCode == "H_SCs_Date") {
15769       fCanvH_SCs_Date = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h);
15770       fCnewRoot++;
15771       main_canvas = fCanvH_SCs_Date;
15772     }
15773 
15774     if (HistoCode == "H_Ped_RuDs") {
15775       fCanvH_Ped_RuDs = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h);
15776       fCnewRoot++;
15777       main_canvas = fCanvH_Ped_RuDs;
15778     }
15779     if (HistoCode == "H_TNo_RuDs") {
15780       fCanvH_TNo_RuDs = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h);
15781       fCnewRoot++;
15782       main_canvas = fCanvH_TNo_RuDs;
15783     }
15784     if (HistoCode == "H_MCs_RuDs") {
15785       fCanvH_MCs_RuDs = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h);
15786       fCnewRoot++;
15787       main_canvas = fCanvH_MCs_RuDs;
15788     }
15789     if (HistoCode == "H_LFN_RuDs") {
15790       fCanvH_LFN_RuDs = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h);
15791       fCnewRoot++;
15792       main_canvas = fCanvH_LFN_RuDs;
15793     }
15794     if (HistoCode == "H_HFN_RuDs") {
15795       fCanvH_HFN_RuDs = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h);
15796       fCnewRoot++;
15797       main_canvas = fCanvH_HFN_RuDs;
15798     }
15799     if (HistoCode == "H_SCs_RuDs") {
15800       fCanvH_SCs_RuDs = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h);
15801       fCnewRoot++;
15802       main_canvas = fCanvH_SCs_RuDs;
15803     }
15804   }
15805   return main_canvas;
15806 }
15807 // end of CreateCanvas
15808 
15809 void TEcnaHistos::SetParametersCanvas(const TString& HistoCode, const TString& opt_plot) {
15810   // Set parameters canvas according to HistoCode
15811 
15812   Double_t x_margin_factor = fCnaParHistos->BoxLeftX("bottom_left_box") - 0.005;
15813   Double_t y_margin_factor = fCnaParHistos->BoxTopY("bottom_right_box") + 0.005;
15814 
15815   if (opt_plot == fSameOnePlot) {
15816     fImpH1SamePlus = (TCanvasImp*)fCanvH1SamePlus->GetCanvasImp();
15817     fCanvH1SamePlus->Divide(1, 1, x_margin_factor, y_margin_factor);
15818     gPad->cd(1);
15819     fPadH1SamePlus = gPad;
15820     fClosedH1SamePlus = kFALSE;
15821     fMemoPlotH1SamePlus = 1;
15822     fMemoColorH1SamePlus = 0;
15823   }
15824 
15825   if (opt_plot == fOnlyOnePlot || opt_plot == fSeveralPlot) {
15826     if (HistoCode == "D_NOE_ChNb") {
15827       fImpD_NOE_ChNb = (TCanvasImp*)fCanvD_NOE_ChNb->GetCanvasImp();
15828       fCanvD_NOE_ChNb->Divide(1, 1, x_margin_factor, y_margin_factor);
15829       gPad->cd(1);
15830       fPadD_NOE_ChNb = gPad;
15831       fClosedD_NOE_ChNb = kFALSE;
15832       fMemoPlotD_NOE_ChNb = 1;
15833       fMemoColorD_NOE_ChNb = 0;
15834     }
15835 
15836     if (HistoCode == "D_NOE_ChDs")  // (SetParametersCanvas)
15837     {
15838       fImpD_NOE_ChDs = (TCanvasImp*)fCanvD_NOE_ChDs->GetCanvasImp();
15839       fCanvD_NOE_ChDs->Divide(1, 1, x_margin_factor, y_margin_factor);
15840       gPad->cd(1);
15841       fPadD_NOE_ChDs = gPad;
15842       fClosedD_NOE_ChDs = kFALSE;
15843       fMemoPlotD_NOE_ChDs = 1;
15844       fMemoColorD_NOE_ChDs = 0;
15845     }
15846 
15847     if (HistoCode == "D_Ped_ChNb") {
15848       fImpD_Ped_ChNb = (TCanvasImp*)fCanvD_Ped_ChNb->GetCanvasImp();
15849       fCanvD_Ped_ChNb->Divide(1, 1, x_margin_factor, y_margin_factor);
15850       gPad->cd(1);
15851       fPadD_Ped_ChNb = gPad;
15852       fClosedD_Ped_ChNb = kFALSE;
15853       fMemoPlotD_Ped_ChNb = 1;
15854       fMemoColorD_Ped_ChNb = 0;
15855     }
15856 
15857     if (HistoCode == "D_Ped_ChDs") {
15858       fImpD_Ped_ChDs = (TCanvasImp*)fCanvD_Ped_ChDs->GetCanvasImp();
15859       fCanvD_Ped_ChDs->Divide(1, 1, x_margin_factor, y_margin_factor);
15860       gPad->cd(1);
15861       fPadD_Ped_ChDs = gPad;
15862       fClosedD_Ped_ChDs = kFALSE;
15863       fMemoPlotD_Ped_ChDs = 1;
15864       fMemoColorD_Ped_ChDs = 0;
15865     }
15866 
15867     if (HistoCode == "D_TNo_ChNb") {
15868       fImpD_TNo_ChNb = (TCanvasImp*)fCanvD_TNo_ChNb->GetCanvasImp();
15869       fCanvD_TNo_ChNb->Divide(1, 1, x_margin_factor, y_margin_factor);
15870       gPad->cd(1);
15871       fPadD_TNo_ChNb = gPad;
15872       fClosedD_TNo_ChNb = kFALSE;
15873       fMemoPlotD_TNo_ChNb = 1;
15874       fMemoColorD_TNo_ChNb = 0;
15875     }
15876 
15877     if (HistoCode == "D_TNo_ChDs")  // (SetParametersCanvas)
15878     {
15879       fImpD_TNo_ChDs = (TCanvasImp*)fCanvD_TNo_ChDs->GetCanvasImp();
15880       fCanvD_TNo_ChDs->Divide(1, 1, x_margin_factor, y_margin_factor);
15881       gPad->cd(1);
15882       fPadD_TNo_ChDs = gPad;
15883       fClosedD_TNo_ChDs = kFALSE;
15884       fMemoPlotD_TNo_ChDs = 1;
15885       fMemoColorD_TNo_ChDs = 0;
15886     }
15887 
15888     if (HistoCode == "D_MCs_ChNb") {
15889       fImpD_MCs_ChNb = (TCanvasImp*)fCanvD_MCs_ChNb->GetCanvasImp();
15890       fCanvD_MCs_ChNb->Divide(1, 1, x_margin_factor, y_margin_factor);
15891       gPad->cd(1);
15892       fPadD_MCs_ChNb = gPad;
15893       fClosedD_MCs_ChNb = kFALSE;
15894       fMemoPlotD_MCs_ChNb = 1;
15895       fMemoColorD_MCs_ChNb = 0;
15896     }
15897 
15898     if (HistoCode == "D_MCs_ChDs") {
15899       fImpD_MCs_ChDs = (TCanvasImp*)fCanvD_MCs_ChDs->GetCanvasImp();
15900       fCanvD_MCs_ChDs->Divide(1, 1, x_margin_factor, y_margin_factor);
15901       gPad->cd(1);
15902       fPadD_MCs_ChDs = gPad;
15903       fClosedD_MCs_ChDs = kFALSE;
15904       fMemoPlotD_MCs_ChDs = 1;
15905       fMemoColorD_MCs_ChDs = 0;
15906     }
15907 
15908     if (HistoCode == "D_LFN_ChNb")  // (SetParametersCanvas)
15909     {
15910       fImpD_LFN_ChNb = (TCanvasImp*)fCanvD_LFN_ChNb->GetCanvasImp();
15911       fCanvD_LFN_ChNb->Divide(1, 1, x_margin_factor, y_margin_factor);
15912       gPad->cd(1);
15913       fPadD_LFN_ChNb = gPad;
15914       fClosedD_LFN_ChNb = kFALSE;
15915       fMemoPlotD_LFN_ChNb = 1;
15916       fMemoColorD_LFN_ChNb = 0;
15917     }
15918 
15919     if (HistoCode == "D_LFN_ChDs") {
15920       fImpD_LFN_ChDs = (TCanvasImp*)fCanvD_LFN_ChDs->GetCanvasImp();
15921       fCanvD_LFN_ChDs->Divide(1, 1, x_margin_factor, y_margin_factor);
15922       gPad->cd(1);
15923       fPadD_LFN_ChDs = gPad;
15924       fClosedD_LFN_ChDs = kFALSE;
15925       fMemoPlotD_LFN_ChDs = 1;
15926       fMemoColorD_LFN_ChDs = 0;
15927     }
15928 
15929     if (HistoCode == "D_HFN_ChNb") {
15930       fImpD_HFN_ChNb = (TCanvasImp*)fCanvD_HFN_ChNb->GetCanvasImp();
15931       fCanvD_HFN_ChNb->Divide(1, 1, x_margin_factor, y_margin_factor);
15932       gPad->cd(1);
15933       fPadD_HFN_ChNb = gPad;
15934       fClosedD_HFN_ChNb = kFALSE;
15935       fMemoPlotD_HFN_ChNb = 1;
15936       fMemoColorD_HFN_ChNb = 0;
15937     }
15938 
15939     if (HistoCode == "D_HFN_ChDs") {
15940       fImpD_HFN_ChDs = (TCanvasImp*)fCanvD_HFN_ChDs->GetCanvasImp();
15941       fCanvD_HFN_ChDs->Divide(1, 1, x_margin_factor, y_margin_factor);
15942       gPad->cd(1);
15943       fPadD_HFN_ChDs = gPad;
15944       fClosedD_HFN_ChDs = kFALSE;
15945       fMemoPlotD_HFN_ChDs = 1;
15946       fMemoColorD_HFN_ChDs = 0;
15947     }
15948 
15949     if (HistoCode == "D_SCs_ChNb")  // (SetParametersCanvas)
15950     {
15951       fImpD_SCs_ChNb = (TCanvasImp*)fCanvD_SCs_ChNb->GetCanvasImp();
15952       fCanvD_SCs_ChNb->Divide(1, 1, x_margin_factor, y_margin_factor);
15953       gPad->cd(1);
15954       fPadD_SCs_ChNb = gPad;
15955       fClosedD_SCs_ChNb = kFALSE;
15956       fMemoPlotD_SCs_ChNb = 1;
15957       fMemoColorD_SCs_ChNb = 0;
15958     }
15959 
15960     if (HistoCode == "D_SCs_ChDs") {
15961       fImpD_SCs_ChDs = (TCanvasImp*)fCanvD_SCs_ChDs->GetCanvasImp();
15962       fCanvD_SCs_ChDs->Divide(1, 1, x_margin_factor, y_margin_factor);
15963       gPad->cd(1);
15964       fPadD_SCs_ChDs = gPad;
15965       fClosedD_SCs_ChDs = kFALSE;
15966       fMemoPlotD_SCs_ChDs = 1;
15967       fMemoColorD_SCs_ChDs = 0;
15968     }
15969 
15970     if (HistoCode == "D_MSp_SpNb") {
15971       fImpD_MSp_SpNb = (TCanvasImp*)fCanvD_MSp_SpNb->GetCanvasImp();
15972       fCanvD_MSp_SpNb->Divide(1, 1, x_margin_factor, y_margin_factor);
15973       gPad->cd(1);
15974       fPadD_MSp_SpNb = gPad;
15975       fClosedD_MSp_SpNb = kFALSE;
15976       fMemoPlotD_MSp_SpNb = 1;
15977       fMemoColorD_MSp_SpNb = 0;
15978     }
15979 
15980     if (HistoCode == "D_MSp_SpDs") {
15981       fImpD_MSp_SpDs = (TCanvasImp*)fCanvD_MSp_SpDs->GetCanvasImp();
15982       fCanvD_MSp_SpDs->Divide(1, 1, x_margin_factor, y_margin_factor);
15983       gPad->cd(1);
15984       fPadD_MSp_SpDs = gPad;
15985       fClosedD_MSp_SpDs = kFALSE;
15986       fMemoPlotD_MSp_SpDs = 1;
15987       fMemoColorD_MSp_SpDs = 0;
15988     }
15989 
15990     if (HistoCode == "D_SSp_SpNb")  // (SetParametersCanvas)
15991     {
15992       fImpD_SSp_SpNb = (TCanvasImp*)fCanvD_SSp_SpNb->GetCanvasImp();
15993       fCanvD_SSp_SpNb->Divide(1, 1, x_margin_factor, y_margin_factor);
15994       gPad->cd(1);
15995       fPadD_SSp_SpNb = gPad;
15996       fClosedD_SSp_SpNb = kFALSE;
15997       fMemoPlotD_SSp_SpNb = 1;
15998       fMemoColorD_SSp_SpNb = 0;
15999     }
16000 
16001     if (HistoCode == "D_SSp_SpDs")  // (SetParametersCanvas)
16002     {
16003       fImpD_SSp_SpDs = (TCanvasImp*)fCanvD_SSp_SpDs->GetCanvasImp();
16004       fCanvD_SSp_SpDs->Divide(1, 1, x_margin_factor, y_margin_factor);
16005       gPad->cd(1);
16006       fPadD_SSp_SpDs = gPad;
16007       fClosedD_SSp_SpDs = kFALSE;
16008       fMemoPlotD_SSp_SpDs = 1;
16009       fMemoColorD_SSp_SpDs = 0;
16010     }
16011 
16012     if (HistoCode == "D_Adc_EvDs") {
16013       fImpD_Adc_EvDs = (TCanvasImp*)fCanvD_Adc_EvDs->GetCanvasImp();
16014       fCanvD_Adc_EvDs->Divide(1, 1, x_margin_factor, y_margin_factor);
16015       gPad->cd(1);
16016       fPadD_Adc_EvDs = gPad;
16017       fClosedD_Adc_EvDs = kFALSE;
16018       fMemoPlotD_Adc_EvDs = 1;
16019       fMemoColorD_Adc_EvDs = 0;
16020     }
16021 
16022     if (HistoCode == "D_Adc_EvNb") {
16023       fImpD_Adc_EvNb = (TCanvasImp*)fCanvD_Adc_EvNb->GetCanvasImp();
16024       fCanvD_Adc_EvNb->Divide(1, 1, x_margin_factor, y_margin_factor);
16025       gPad->cd(1);
16026       fPadD_Adc_EvNb = gPad;
16027       fClosedD_Adc_EvNb = kFALSE;
16028       fMemoPlotD_Adc_EvNb = 1;
16029       fMemoColorD_Adc_EvNb = 0;
16030     }
16031 
16032     if (HistoCode == "H_Ped_Date")  // (SetParametersCanvas)
16033     {
16034       fImpH_Ped_Date = (TCanvasImp*)fCanvH_Ped_Date->GetCanvasImp();
16035       fCanvH_Ped_Date->Divide(1, 1, x_margin_factor, y_margin_factor);
16036       gPad->cd(1);
16037       fPadH_Ped_Date = gPad;
16038       fClosedH_Ped_Date = kFALSE;
16039       fMemoPlotH_Ped_Date = 1;
16040       fMemoColorH_Ped_Date = 0;
16041     }
16042     if (HistoCode == "H_TNo_Date") {
16043       fImpH_TNo_Date = (TCanvasImp*)fCanvH_TNo_Date->GetCanvasImp();
16044       fCanvH_TNo_Date->Divide(1, 1, x_margin_factor, y_margin_factor);
16045       gPad->cd(1);
16046       fPadH_TNo_Date = gPad;
16047       fClosedH_TNo_Date = kFALSE;
16048       fMemoPlotH_TNo_Date = 1;
16049       fMemoColorH_TNo_Date = 0;
16050     }
16051     if (HistoCode == "H_MCs_Date") {
16052       fImpH_MCs_Date = (TCanvasImp*)fCanvH_MCs_Date->GetCanvasImp();
16053       fCanvH_MCs_Date->Divide(1, 1, x_margin_factor, y_margin_factor);
16054       gPad->cd(1);
16055       fPadH_MCs_Date = gPad;
16056       fClosedH_MCs_Date = kFALSE;
16057       fMemoPlotH_MCs_Date = 1;
16058       fMemoColorH_MCs_Date = 0;
16059     }
16060 
16061     if (HistoCode == "H_LFN_Date")  // (SetParametersCanvas)
16062     {
16063       fImpH_LFN_Date = (TCanvasImp*)fCanvH_LFN_Date->GetCanvasImp();
16064       fCanvH_LFN_Date->Divide(1, 1, x_margin_factor, y_margin_factor);
16065       gPad->cd(1);
16066       fPadH_LFN_Date = gPad;
16067       fClosedH_LFN_Date = kFALSE;
16068       fMemoPlotH_LFN_Date = 1;
16069       fMemoColorH_LFN_Date = 0;
16070     }
16071     if (HistoCode == "H_HFN_Date") {
16072       fImpH_HFN_Date = (TCanvasImp*)fCanvH_HFN_Date->GetCanvasImp();
16073       fCanvH_HFN_Date->Divide(1, 1, x_margin_factor, y_margin_factor);
16074       gPad->cd(1);
16075       fPadH_HFN_Date = gPad;
16076       fClosedH_HFN_Date = kFALSE;
16077       fMemoPlotH_HFN_Date = 1;
16078       fMemoColorH_HFN_Date = 0;
16079     }
16080     if (HistoCode == "H_SCs_Date") {
16081       fImpH_SCs_Date = (TCanvasImp*)fCanvH_SCs_Date->GetCanvasImp();
16082       fCanvH_SCs_Date->Divide(1, 1, x_margin_factor, y_margin_factor);
16083       gPad->cd(1);
16084       fPadH_SCs_Date = gPad;
16085       fClosedH_SCs_Date = kFALSE;
16086       fMemoPlotH_SCs_Date = 1;
16087       fMemoColorH_SCs_Date = 0;
16088     }
16089 
16090     if (HistoCode == "H_Ped_RuDs")  // (SetParametersCanvas)
16091     {
16092       fImpH_Ped_RuDs = (TCanvasImp*)fCanvH_Ped_RuDs->GetCanvasImp();
16093       fCanvH_Ped_RuDs->Divide(1, 1, x_margin_factor, y_margin_factor);
16094       gPad->cd(1);
16095       fPadH_Ped_RuDs = gPad;
16096       fClosedH_Ped_RuDs = kFALSE;
16097       fMemoPlotH_Ped_RuDs = 1;
16098       fMemoColorH_Ped_RuDs = 0;
16099     }
16100     if (HistoCode == "H_TNo_RuDs") {
16101       fImpH_TNo_RuDs = (TCanvasImp*)fCanvH_TNo_RuDs->GetCanvasImp();
16102       fCanvH_TNo_RuDs->Divide(1, 1, x_margin_factor, y_margin_factor);
16103       gPad->cd(1);
16104       fPadH_TNo_RuDs = gPad;
16105       fClosedH_TNo_RuDs = kFALSE;
16106       fMemoPlotH_TNo_RuDs = 1;
16107       fMemoColorH_TNo_RuDs = 0;
16108     }
16109     if (HistoCode == "H_MCs_RuDs") {
16110       fImpH_MCs_RuDs = (TCanvasImp*)fCanvH_MCs_RuDs->GetCanvasImp();
16111       fCanvH_MCs_RuDs->Divide(1, 1, x_margin_factor, y_margin_factor);
16112       gPad->cd(1);
16113       fPadH_MCs_RuDs = gPad;
16114       fClosedH_MCs_RuDs = kFALSE;
16115       fMemoPlotH_MCs_RuDs = 1;
16116       fMemoColorH_MCs_RuDs = 0;
16117     }
16118 
16119     if (HistoCode == "H_LFN_RuDs")  // (SetParametersCanvas)
16120     {
16121       fImpH_LFN_RuDs = (TCanvasImp*)fCanvH_LFN_RuDs->GetCanvasImp();
16122       fCanvH_LFN_RuDs->Divide(1, 1, x_margin_factor, y_margin_factor);
16123       gPad->cd(1);
16124       fPadH_LFN_RuDs = gPad;
16125       fClosedH_LFN_RuDs = kFALSE;
16126       fMemoPlotH_LFN_RuDs = 1;
16127       fMemoColorH_LFN_RuDs = 0;
16128     }
16129     if (HistoCode == "H_HFN_RuDs") {
16130       fImpH_HFN_RuDs = (TCanvasImp*)fCanvH_HFN_RuDs->GetCanvasImp();
16131       fCanvH_HFN_RuDs->Divide(1, 1, x_margin_factor, y_margin_factor);
16132       gPad->cd(1);
16133       fPadH_HFN_RuDs = gPad;
16134       fClosedH_HFN_RuDs = kFALSE;
16135       fMemoPlotH_HFN_RuDs = 1;
16136       fMemoColorH_HFN_RuDs = 0;
16137     }
16138     if (HistoCode == "H_SCs_RuDs") {
16139       fImpH_SCs_RuDs = (TCanvasImp*)fCanvH_SCs_RuDs->GetCanvasImp();
16140       fCanvH_SCs_RuDs->Divide(1, 1, x_margin_factor, y_margin_factor);
16141       gPad->cd(1);
16142       fPadH_SCs_RuDs = gPad;
16143       fClosedH_SCs_RuDs = kFALSE;
16144       fMemoPlotH_SCs_RuDs = 1;
16145       fMemoColorH_SCs_RuDs = 0;
16146     }
16147   }
16148 }
16149 // end of SetParametersCanvas
16150 
16151 TCanvas* TEcnaHistos::GetCurrentCanvas(const TString& HistoCode, const TString& opt_plot) {
16152   TCanvas* main_canvas = nullptr;
16153 
16154   if (opt_plot == fSameOnePlot) {
16155     main_canvas = fCanvH1SamePlus;
16156   }
16157 
16158   if (opt_plot == fOnlyOnePlot || opt_plot == fSeveralPlot) {
16159     if (HistoCode == "D_NOE_ChNb") {
16160       main_canvas = fCanvD_NOE_ChNb;
16161     }
16162     if (HistoCode == "D_NOE_ChDs") {
16163       main_canvas = fCanvD_NOE_ChDs;
16164     }
16165     if (HistoCode == "D_Ped_ChNb") {
16166       main_canvas = fCanvD_Ped_ChNb;
16167     }
16168     if (HistoCode == "D_Ped_ChDs") {
16169       main_canvas = fCanvD_Ped_ChDs;
16170     }
16171     if (HistoCode == "D_TNo_ChNb") {
16172       main_canvas = fCanvD_TNo_ChNb;
16173     }
16174     if (HistoCode == "D_TNo_ChDs") {
16175       main_canvas = fCanvD_TNo_ChDs;
16176     }
16177     if (HistoCode == "D_MCs_ChNb") {
16178       main_canvas = fCanvD_MCs_ChNb;
16179     }
16180     if (HistoCode == "D_MCs_ChDs") {
16181       main_canvas = fCanvD_MCs_ChDs;
16182     }
16183     if (HistoCode == "D_LFN_ChNb") {
16184       main_canvas = fCanvD_LFN_ChNb;
16185     }
16186     if (HistoCode == "D_LFN_ChDs") {
16187       main_canvas = fCanvD_LFN_ChDs;
16188     }
16189     if (HistoCode == "D_HFN_ChNb") {
16190       main_canvas = fCanvD_HFN_ChNb;
16191     }
16192     if (HistoCode == "D_HFN_ChDs") {
16193       main_canvas = fCanvD_HFN_ChDs;
16194     }
16195     if (HistoCode == "D_SCs_ChNb") {
16196       main_canvas = fCanvD_SCs_ChNb;
16197     }
16198     if (HistoCode == "D_SCs_ChDs") {
16199       main_canvas = fCanvD_SCs_ChDs;
16200     }
16201     if (HistoCode == "D_MSp_SpNb") {
16202       main_canvas = fCanvD_MSp_SpNb;
16203     }
16204     if (HistoCode == "D_MSp_SpDs") {
16205       main_canvas = fCanvD_MSp_SpDs;
16206     }
16207     if (HistoCode == "D_SSp_SpNb") {
16208       main_canvas = fCanvD_SSp_SpNb;
16209     }
16210     if (HistoCode == "D_SSp_SpDs") {
16211       main_canvas = fCanvD_SSp_SpDs;
16212     }
16213     if (HistoCode == "D_Adc_EvNb") {
16214       main_canvas = fCanvD_Adc_EvNb;
16215     }
16216     if (HistoCode == "D_Adc_EvDs") {
16217       main_canvas = fCanvD_Adc_EvDs;
16218     }
16219     if (HistoCode == "H_Ped_Date") {
16220       main_canvas = fCanvH_Ped_Date;
16221     }
16222     if (HistoCode == "H_TNo_Date") {
16223       main_canvas = fCanvH_TNo_Date;
16224     }
16225     if (HistoCode == "H_MCs_Date") {
16226       main_canvas = fCanvH_MCs_Date;
16227     }
16228     if (HistoCode == "H_LFN_Date") {
16229       main_canvas = fCanvH_LFN_Date;
16230     }
16231     if (HistoCode == "H_HFN_Date") {
16232       main_canvas = fCanvH_HFN_Date;
16233     }
16234     if (HistoCode == "H_SCs_Date") {
16235       main_canvas = fCanvH_SCs_Date;
16236     }
16237     if (HistoCode == "H_Ped_RuDs") {
16238       main_canvas = fCanvH_Ped_RuDs;
16239     }
16240     if (HistoCode == "H_TNo_RuDs") {
16241       main_canvas = fCanvH_TNo_RuDs;
16242     }
16243     if (HistoCode == "H_MCs_RuDs") {
16244       main_canvas = fCanvH_MCs_RuDs;
16245     }
16246     if (HistoCode == "H_LFN_RuDs") {
16247       main_canvas = fCanvH_LFN_RuDs;
16248     }
16249     if (HistoCode == "H_HFN_RuDs") {
16250       main_canvas = fCanvH_HFN_RuDs;
16251     }
16252     if (HistoCode == "H_SCs_RuDs") {
16253       main_canvas = fCanvH_SCs_RuDs;
16254     }
16255   }
16256   return main_canvas;
16257 }
16258 // end of GetCurrentCanvas(...)
16259 
16260 TCanvas* TEcnaHistos::GetCurrentCanvas() { return fCurrentCanvas; }
16261 TString TEcnaHistos::GetCurrentCanvasName() { return fCurrentCanvasName; }
16262 
16263 void TEcnaHistos::PlotCloneOfCurrentCanvas() {
16264   if (fCurrentCanvas != nullptr) {
16265     if ((TCanvasImp*)fCurrentCanvas->GetCanvasImp() != nullptr) {
16266       static_cast<TCanvas*>(fCurrentCanvas)->DrawClone();
16267     } else {
16268       std::cout << "TEcnaHistos::PlotCloneOfCurrentCanvas()> Last canvas has been removed. No clone can be done."
16269                 << std::endl
16270                 << "                                        Please, display the canvas again." << fTTBELL << std::endl;
16271     }
16272   } else {
16273     std::cout << "TEcnaHistos::PlotCloneOfCurrentCanvas()> No canvas has been created. No clone can be done." << fTTBELL
16274               << std::endl;
16275   }
16276 }
16277 
16278 //--------------------------------------------------------------------------------------------
16279 TVirtualPad* TEcnaHistos::ActivePad(const TString& HistoCode, const TString& opt_plot) {
16280   // Active Pad for Same plot option
16281 
16282   TVirtualPad* main_subpad = nullptr;
16283 
16284   fCurrentHistoCode = HistoCode;
16285   fCurrentOptPlot = opt_plot;
16286 
16287   if (opt_plot == fSameOnePlot) {
16288     fCanvH1SamePlus->Connect("Closed()", "TEcnaHistos", this, "DoCanvasClosed()");
16289     if (fClosedH1SamePlus == kFALSE) {
16290       main_subpad = fPadH1SamePlus;
16291     }
16292   }
16293 
16294   if (opt_plot == fOnlyOnePlot || opt_plot == fSeveralPlot) {
16295     if (HistoCode == "D_NOE_ChNb") {
16296       fCanvD_NOE_ChNb->Connect("Closed()", "TEcnaHistos", this, "DoCanvasClosed()");
16297       if (fClosedD_NOE_ChNb == kFALSE) {
16298         main_subpad = fPadD_NOE_ChNb;
16299       }
16300     }
16301 
16302     if (HistoCode == "D_NOE_ChDs") {
16303       fCanvD_NOE_ChDs->Connect("Closed()", "TEcnaHistos", this, "DoCanvasClosed()");
16304       if (fClosedD_NOE_ChDs == kFALSE) {
16305         main_subpad = fPadD_NOE_ChDs;
16306       }
16307     }
16308 
16309     if (HistoCode == "D_Ped_ChNb") {
16310       fCanvD_Ped_ChNb->Connect("Closed()", "TEcnaHistos", this, "DoCanvasClosed()");
16311       if (fClosedD_Ped_ChNb == kFALSE) {
16312         main_subpad = fPadD_Ped_ChNb;
16313       }
16314     }
16315 
16316     if (HistoCode == "D_Ped_ChDs") {
16317       fCanvD_Ped_ChDs->Connect("Closed()", "TEcnaHistos", this, "DoCanvasClosed()");
16318       if (fClosedD_Ped_ChDs == kFALSE) {
16319         main_subpad = fPadD_Ped_ChDs;
16320       }
16321     }
16322 
16323     if (HistoCode == "D_TNo_ChNb") {
16324       fCanvD_TNo_ChNb->Connect("Closed()", "TEcnaHistos", this, "DoCanvasClosed()");
16325       if (fClosedD_TNo_ChNb == kFALSE) {
16326         main_subpad = fPadD_TNo_ChNb;
16327       }
16328     }
16329 
16330     if (HistoCode == "D_TNo_ChDs") {
16331       fCanvD_TNo_ChDs->Connect("Closed()", "TEcnaHistos", this, "DoCanvasClosed()");
16332       if (fClosedD_TNo_ChDs == kFALSE) {
16333         main_subpad = fPadD_TNo_ChDs;
16334       }
16335     }
16336 
16337     if (HistoCode == "D_MCs_ChNb") {
16338       fCanvD_MCs_ChNb->Connect("Closed()", "TEcnaHistos", this, "DoCanvasClosed()");
16339       if (fClosedD_MCs_ChNb == kFALSE) {
16340         main_subpad = fPadD_MCs_ChNb;
16341       }
16342     }
16343 
16344     if (HistoCode == "D_MCs_ChDs") {
16345       fCanvD_MCs_ChDs->Connect("Closed()", "TEcnaHistos", this, "DoCanvasClosed()");
16346       if (fClosedD_MCs_ChDs == kFALSE) {
16347         main_subpad = fPadD_MCs_ChDs;
16348       }
16349     }
16350 
16351     if (HistoCode == "D_LFN_ChNb") {
16352       fCanvD_LFN_ChNb->Connect("Closed()", "TEcnaHistos", this, "DoCanvasClosed()");
16353       if (fClosedD_LFN_ChNb == kFALSE) {
16354         main_subpad = fPadD_LFN_ChNb;
16355       }
16356     }
16357 
16358     if (HistoCode == "D_LFN_ChDs") {
16359       fCanvD_LFN_ChDs->Connect("Closed()", "TEcnaHistos", this, "DoCanvasClosed()");
16360       if (fClosedD_LFN_ChDs == kFALSE) {
16361         main_subpad = fPadD_LFN_ChDs;
16362       }
16363     }
16364 
16365     if (HistoCode == "D_HFN_ChNb") {
16366       fCanvD_HFN_ChNb->Connect("Closed()", "TEcnaHistos", this, "DoCanvasClosed()");
16367       if (fClosedD_HFN_ChNb == kFALSE) {
16368         main_subpad = fPadD_HFN_ChNb;
16369       }
16370     }
16371 
16372     if (HistoCode == "D_HFN_ChDs") {
16373       fCanvD_HFN_ChDs->Connect("Closed()", "TEcnaHistos", this, "DoCanvasClosed()");
16374       if (fClosedD_HFN_ChDs == kFALSE) {
16375         main_subpad = fPadD_HFN_ChDs;
16376       }
16377     }
16378 
16379     if (HistoCode == "D_SCs_ChNb") {
16380       fCanvD_SCs_ChNb->Connect("Closed()", "TEcnaHistos", this, "DoCanvasClosed()");
16381       if (fClosedD_SCs_ChNb == kFALSE) {
16382         main_subpad = fPadD_SCs_ChNb;
16383       }
16384     }
16385 
16386     if (HistoCode == "D_SCs_ChDs") {
16387       fCanvD_SCs_ChDs->Connect("Closed()", "TEcnaHistos", this, "DoCanvasClosed()");
16388       if (fClosedD_SCs_ChDs == kFALSE) {
16389         main_subpad = fPadD_SCs_ChDs;
16390       }
16391     }
16392 
16393     if (HistoCode == "D_MSp_SpNb") {
16394       fCanvD_MSp_SpNb->Connect("Closed()", "TEcnaHistos", this, "DoCanvasClosed()");
16395       if (fClosedD_MSp_SpNb == kFALSE) {
16396         main_subpad = fPadD_MSp_SpNb;
16397       }
16398     }
16399 
16400     if (HistoCode == "D_MSp_SpDs") {
16401       fCanvD_MSp_SpDs->Connect("Closed()", "TEcnaHistos", this, "DoCanvasClosed()");
16402       if (fClosedD_MSp_SpDs == kFALSE) {
16403         main_subpad = fPadD_MSp_SpDs;
16404       }
16405     }
16406 
16407     if (HistoCode == "D_SSp_SpNb") {
16408       fCanvD_SSp_SpNb->Connect("Closed()", "TEcnaHistos", this, "DoCanvasClosed()");
16409       if (fClosedD_SSp_SpNb == kFALSE) {
16410         main_subpad = fPadD_SSp_SpNb;
16411       }
16412     }
16413 
16414     if (HistoCode == "D_SSp_SpDs") {
16415       fCanvD_SSp_SpDs->Connect("Closed()", "TEcnaHistos", this, "DoCanvasClosed()");
16416       if (fClosedD_SSp_SpDs == kFALSE) {
16417         main_subpad = fPadD_SSp_SpDs;
16418       }
16419     }
16420 
16421     if (HistoCode == "D_Adc_EvNb") {
16422       fCanvD_Adc_EvNb->Connect("Closed()", "TEcnaHistos", this, "DoCanvasClosed()");
16423       if (fClosedD_Adc_EvNb == kFALSE) {
16424         main_subpad = fPadD_Adc_EvNb;
16425       }
16426     }
16427 
16428     if (HistoCode == "D_Adc_EvDs") {
16429       fCanvD_Adc_EvDs->Connect("Closed()", "TEcnaHistos", this, "DoCanvasClosed()");
16430       if (fClosedD_Adc_EvDs == kFALSE) {
16431         main_subpad = fPadD_Adc_EvDs;
16432       }
16433     }
16434 
16435     if (HistoCode == "H_Ped_Date") {
16436       fCanvH_Ped_Date->Connect("Closed()", "TEcnaHistos", this, "DoCanvasClosed()");
16437       if (fClosedH_Ped_Date == kFALSE) {
16438         main_subpad = fPadH_Ped_Date;
16439       }
16440     }
16441 
16442     if (HistoCode == "H_TNo_Date") {
16443       fCanvH_TNo_Date->Connect("Closed()", "TEcnaHistos", this, "DoCanvasClosed()");
16444       if (fClosedH_TNo_Date == kFALSE) {
16445         main_subpad = fPadH_TNo_Date;
16446       }
16447     }
16448 
16449     if (HistoCode == "H_MCs_Date") {
16450       fCanvH_MCs_Date->Connect("Closed()", "TEcnaHistos", this, "DoCanvasClosed()");
16451       if (fClosedH_MCs_Date == kFALSE) {
16452         main_subpad = fPadH_MCs_Date;
16453       }
16454     }
16455 
16456     if (HistoCode == "H_LFN_Date") {
16457       fCanvH_LFN_Date->Connect("Closed()", "TEcnaHistos", this, "DoCanvasClosed()");
16458       if (fClosedH_LFN_Date == kFALSE) {
16459         main_subpad = fPadH_LFN_Date;
16460       }
16461     }
16462 
16463     if (HistoCode == "H_HFN_Date") {
16464       fCanvH_HFN_Date->Connect("Closed()", "TEcnaHistos", this, "DoCanvasClosed()");
16465       if (fClosedH_HFN_Date == kFALSE) {
16466         main_subpad = fPadH_HFN_Date;
16467       }
16468     }
16469 
16470     if (HistoCode == "H_SCs_Date") {
16471       fCanvH_SCs_Date->Connect("Closed()", "TEcnaHistos", this, "DoCanvasClosed()");
16472       if (fClosedH_SCs_Date == kFALSE) {
16473         main_subpad = fPadH_SCs_Date;
16474       }
16475     }
16476 
16477     if (HistoCode == "H_Ped_RuDs") {
16478       fCanvH_Ped_RuDs->Connect("Closed()", "TEcnaHistos", this, "DoCanvasClosed()");
16479       if (fClosedH_Ped_RuDs == kFALSE) {
16480         main_subpad = fPadH_Ped_RuDs;
16481       }
16482     }
16483 
16484     if (HistoCode == "H_TNo_RuDs") {
16485       fCanvH_TNo_RuDs->Connect("Closed()", "TEcnaHistos", this, "DoCanvasClosed()");
16486       if (fClosedH_TNo_RuDs == kFALSE) {
16487         main_subpad = fPadH_TNo_RuDs;
16488       }
16489     }
16490 
16491     if (HistoCode == "H_MCs_RuDs") {
16492       fCanvH_MCs_RuDs->Connect("Closed()", "TEcnaHistos", this, "DoCanvasClosed()");
16493       if (fClosedH_MCs_RuDs == kFALSE) {
16494         main_subpad = fPadH_MCs_RuDs;
16495       }
16496     }
16497 
16498     if (HistoCode == "H_LFN_RuDs") {
16499       fCanvH_LFN_RuDs->Connect("Closed()", "TEcnaHistos", this, "DoCanvasClosed()");
16500       if (fClosedH_LFN_RuDs == kFALSE) {
16501         main_subpad = fPadH_LFN_RuDs;
16502       }
16503     }
16504 
16505     if (HistoCode == "H_HFN_RuDs") {
16506       fCanvH_HFN_RuDs->Connect("Closed()", "TEcnaHistos", this, "DoCanvasClosed()");
16507       if (fClosedH_HFN_RuDs == kFALSE) {
16508         main_subpad = fPadH_HFN_RuDs;
16509       }
16510     }
16511 
16512     if (HistoCode == "H_SCs_RuDs") {
16513       fCanvH_SCs_RuDs->Connect("Closed()", "TEcnaHistos", this, "DoCanvasClosed()");
16514       if (fClosedH_SCs_RuDs == kFALSE) {
16515         main_subpad = fPadH_SCs_RuDs;
16516       }
16517     }
16518   }
16519 
16520   if (main_subpad == nullptr) {
16521     std::cout << "*TEcnaHistos::ActivePad(...)> main_subpad = " << main_subpad << ". This canvas has been closed."
16522               << std::endl;
16523   }
16524 
16525   return main_subpad;
16526 }
16527 // end of ActivePad
16528 
16529 void TEcnaHistos::DoCanvasClosed() {
16530   if (fCurrentOptPlot == fSameOnePlot) {
16531     fClosedH1SamePlus = kTRUE;
16532   }
16533   if (fCurrentOptPlot == fOnlyOnePlot || fCurrentOptPlot == fSeveralPlot) {
16534     if (fCurrentHistoCode == "D_NOE_ChNb") {
16535       fClosedD_NOE_ChNb = kTRUE;
16536     }
16537     if (fCurrentHistoCode == "D_NOE_ChDs") {
16538       fClosedD_NOE_ChDs = kTRUE;
16539     }
16540     if (fCurrentHistoCode == "D_Ped_ChNb") {
16541       fClosedD_Ped_ChNb = kTRUE;
16542     }
16543     if (fCurrentHistoCode == "D_Ped_ChDs") {
16544       fClosedD_Ped_ChDs = kTRUE;
16545     }
16546     if (fCurrentHistoCode == "D_TNo_ChNb") {
16547       fClosedD_TNo_ChNb = kTRUE;
16548     }
16549     if (fCurrentHistoCode == "D_TNo_ChDs") {
16550       fClosedD_TNo_ChDs = kTRUE;
16551     }
16552     if (fCurrentHistoCode == "D_MCs_ChNb") {
16553       fClosedD_MCs_ChNb = kTRUE;
16554     }
16555     if (fCurrentHistoCode == "D_MCs_ChDs") {
16556       fClosedD_MCs_ChDs = kTRUE;
16557     }
16558     if (fCurrentHistoCode == "D_LFN_ChNb") {
16559       fClosedD_LFN_ChNb = kTRUE;
16560     }
16561     if (fCurrentHistoCode == "D_LFN_ChDs") {
16562       fClosedD_LFN_ChDs = kTRUE;
16563     }
16564     if (fCurrentHistoCode == "D_HFN_ChNb") {
16565       fClosedD_HFN_ChNb = kTRUE;
16566     }
16567     if (fCurrentHistoCode == "D_HFN_ChDs") {
16568       fClosedD_HFN_ChDs = kTRUE;
16569     }
16570     if (fCurrentHistoCode == "D_SCs_ChNb") {
16571       fClosedD_SCs_ChNb = kTRUE;
16572     }
16573     if (fCurrentHistoCode == "D_SCs_ChDs") {
16574       fClosedD_SCs_ChDs = kTRUE;
16575     }
16576     if (fCurrentHistoCode == "D_MSp_SpNb") {
16577       fClosedD_MSp_SpNb = kTRUE;
16578     }
16579     if (fCurrentHistoCode == "D_MSp_SpDs") {
16580       fClosedD_MSp_SpDs = kTRUE;
16581     }
16582     if (fCurrentHistoCode == "D_SSp_SpNb") {
16583       fClosedD_SSp_SpNb = kTRUE;
16584     }
16585     if (fCurrentHistoCode == "D_SSp_SpDs") {
16586       fClosedD_SSp_SpDs = kTRUE;
16587     }
16588     if (fCurrentHistoCode == "D_Adc_EvNb") {
16589       fClosedD_Adc_EvNb = kTRUE;
16590     }
16591     if (fCurrentHistoCode == "D_Adc_EvDs") {
16592       fClosedD_Adc_EvDs = kTRUE;
16593     }
16594     if (fCurrentHistoCode == "H_Ped_Date") {
16595       fClosedH_Ped_Date = kTRUE;
16596     }
16597     if (fCurrentHistoCode == "H_TNo_Date") {
16598       fClosedH_TNo_Date = kTRUE;
16599     }
16600     if (fCurrentHistoCode == "H_MCs_Date") {
16601       fClosedH_MCs_Date = kTRUE;
16602     }
16603     if (fCurrentHistoCode == "H_LFN_Date") {
16604       fClosedH_LFN_Date = kTRUE;
16605     }
16606     if (fCurrentHistoCode == "H_HFN_Date") {
16607       fClosedH_HFN_Date = kTRUE;
16608     }
16609     if (fCurrentHistoCode == "H_SCs_Date") {
16610       fClosedH_SCs_Date = kTRUE;
16611     }
16612     if (fCurrentHistoCode == "H_Ped_RuDs") {
16613       fClosedH_Ped_RuDs = kTRUE;
16614     }
16615     if (fCurrentHistoCode == "H_TNo_RuDs") {
16616       fClosedH_TNo_RuDs = kTRUE;
16617     }
16618     if (fCurrentHistoCode == "H_MCs_RuDs") {
16619       fClosedH_MCs_RuDs = kTRUE;
16620     }
16621     if (fCurrentHistoCode == "H_LFN_RuDs") {
16622       fClosedH_LFN_RuDs = kTRUE;
16623     }
16624     if (fCurrentHistoCode == "H_HFN_RuDs") {
16625       fClosedH_HFN_RuDs = kTRUE;
16626     }
16627     if (fCurrentHistoCode == "H_SCs_RuDs") {
16628       fClosedH_SCs_RuDs = kTRUE;
16629     }
16630   }
16631 
16632   fCurrentOptPlot = "NADA";  // to avoid fClosed... = kTRUE if other canvas than those above Closed (i.e. 2D plots)
16633   fCurrentHistoCode = "NADA";
16634 
16635   std::cout << "!TEcnaHistos::DoCanvasClosed(...)> WARNING: canvas has been closed." << std::endl;
16636 }
16637 
16638 void TEcnaHistos::SetParametersPavTxt(const TString& HistoCode, const TString& opt_plot) {
16639   // Set parameters pave "sevearl changing" according to HistoCode
16640 
16641   if (opt_plot == fSameOnePlot) {
16642     fPavTxtH1SamePlus = fPavComSeveralChanging;
16643   }
16644 
16645   if (opt_plot == fOnlyOnePlot || opt_plot == fSeveralPlot) {
16646     if (HistoCode == "D_NOE_ChNb") {
16647       fPavTxtD_NOE_ChNb = fPavComSeveralChanging;
16648     }
16649     if (HistoCode == "D_NOE_ChDs") {
16650       fPavTxtD_NOE_ChDs = fPavComSeveralChanging;
16651     }
16652     if (HistoCode == "D_Ped_ChNb") {
16653       fPavTxtD_Ped_ChNb = fPavComSeveralChanging;
16654     }
16655     if (HistoCode == "D_Ped_ChDs") {
16656       fPavTxtD_Ped_ChDs = fPavComSeveralChanging;
16657     }
16658     if (HistoCode == "D_TNo_ChNb") {
16659       fPavTxtD_TNo_ChNb = fPavComSeveralChanging;
16660     }
16661     if (HistoCode == "D_TNo_ChDs") {
16662       fPavTxtD_TNo_ChDs = fPavComSeveralChanging;
16663     }
16664     if (HistoCode == "D_MCs_ChNb") {
16665       fPavTxtD_MCs_ChNb = fPavComSeveralChanging;
16666     }
16667     if (HistoCode == "D_MCs_ChDs") {
16668       fPavTxtD_MCs_ChDs = fPavComSeveralChanging;
16669     }
16670     if (HistoCode == "D_LFN_ChNb") {
16671       fPavTxtD_LFN_ChNb = fPavComSeveralChanging;
16672     }
16673     if (HistoCode == "D_LFN_ChDs") {
16674       fPavTxtD_LFN_ChDs = fPavComSeveralChanging;
16675     }
16676     if (HistoCode == "D_HFN_ChNb") {
16677       fPavTxtD_HFN_ChNb = fPavComSeveralChanging;
16678     }
16679     if (HistoCode == "D_HFN_ChDs") {
16680       fPavTxtD_HFN_ChDs = fPavComSeveralChanging;
16681     }
16682     if (HistoCode == "D_SCs_ChNb") {
16683       fPavTxtD_SCs_ChNb = fPavComSeveralChanging;
16684     }
16685     if (HistoCode == "D_SCs_ChDs") {
16686       fPavTxtD_SCs_ChDs = fPavComSeveralChanging;
16687     }
16688     if (HistoCode == "D_MSp_SpNb") {
16689       fPavTxtD_MSp_SpNb = fPavComSeveralChanging;
16690     }
16691     if (HistoCode == "D_MSp_SpDs") {
16692       fPavTxtD_MSp_SpDs = fPavComSeveralChanging;
16693     }
16694     if (HistoCode == "D_SSp_SpNb") {
16695       fPavTxtD_SSp_SpNb = fPavComSeveralChanging;
16696     }
16697     if (HistoCode == "D_SSp_SpDs") {
16698       fPavTxtD_SSp_SpDs = fPavComSeveralChanging;
16699     }
16700     if (HistoCode == "D_Adc_EvNb") {
16701       fPavTxtD_Adc_EvNb = fPavComSeveralChanging;
16702     }
16703     if (HistoCode == "D_Adc_EvDs") {
16704       fPavTxtD_Adc_EvDs = fPavComSeveralChanging;
16705     }
16706     if (HistoCode == "H_Ped_Date") {
16707       fPavTxtH_Ped_Date = fPavComSeveralChanging;
16708     }
16709     if (HistoCode == "H_TNo_Date") {
16710       fPavTxtH_TNo_Date = fPavComSeveralChanging;
16711     }
16712     if (HistoCode == "H_MCs_Date") {
16713       fPavTxtH_MCs_Date = fPavComSeveralChanging;
16714     }
16715     if (HistoCode == "H_LFN_Date") {
16716       fPavTxtH_LFN_Date = fPavComSeveralChanging;
16717     }
16718     if (HistoCode == "H_HFN_Date") {
16719       fPavTxtH_HFN_Date = fPavComSeveralChanging;
16720     }
16721     if (HistoCode == "H_SCs_Date") {
16722       fPavTxtH_SCs_Date = fPavComSeveralChanging;
16723     }
16724     if (HistoCode == "H_Ped_RuDs") {
16725       fPavTxtH_Ped_RuDs = fPavComSeveralChanging;
16726     }
16727     if (HistoCode == "H_TNo_RuDs") {
16728       fPavTxtH_TNo_RuDs = fPavComSeveralChanging;
16729     }
16730     if (HistoCode == "H_MCs_RuDs") {
16731       fPavTxtH_MCs_RuDs = fPavComSeveralChanging;
16732     }
16733     if (HistoCode == "H_LFN_RuDs") {
16734       fPavTxtH_LFN_RuDs = fPavComSeveralChanging;
16735     }
16736     if (HistoCode == "H_HFN_RuDs") {
16737       fPavTxtH_HFN_RuDs = fPavComSeveralChanging;
16738     }
16739     if (HistoCode == "H_SCs_RuDs") {
16740       fPavTxtH_SCs_RuDs = fPavComSeveralChanging;
16741     }
16742   }
16743 }
16744 // end of SetParametersPavTxt
16745 
16746 TPaveText* TEcnaHistos::ActivePavTxt(const TString& HistoCode, const TString& opt_plot) {
16747   // Active Pad for Same plot option
16748 
16749   TPaveText* main_pavtxt = nullptr;
16750 
16751   if (opt_plot == fSameOnePlot) {
16752     main_pavtxt = fPavTxtH1SamePlus;
16753   }
16754 
16755   if (opt_plot == fOnlyOnePlot || opt_plot == fSeveralPlot) {
16756     if (HistoCode == "D_NOE_ChNb") {
16757       main_pavtxt = fPavTxtD_NOE_ChNb;
16758     }
16759     if (HistoCode == "D_NOE_ChDs") {
16760       main_pavtxt = fPavTxtD_NOE_ChDs;
16761     }
16762     if (HistoCode == "D_Ped_ChNb") {
16763       main_pavtxt = fPavTxtD_Ped_ChNb;
16764     }
16765     if (HistoCode == "D_Ped_ChDs") {
16766       main_pavtxt = fPavTxtD_Ped_ChDs;
16767     }
16768     if (HistoCode == "D_TNo_ChNb") {
16769       main_pavtxt = fPavTxtD_TNo_ChNb;
16770     }
16771     if (HistoCode == "D_TNo_ChDs") {
16772       main_pavtxt = fPavTxtD_TNo_ChDs;
16773     }
16774     if (HistoCode == "D_MCs_ChNb") {
16775       main_pavtxt = fPavTxtD_MCs_ChNb;
16776     }
16777     if (HistoCode == "D_MCs_ChDs") {
16778       main_pavtxt = fPavTxtD_MCs_ChDs;
16779     }
16780     if (HistoCode == "D_LFN_ChNb") {
16781       main_pavtxt = fPavTxtD_LFN_ChNb;
16782     }
16783     if (HistoCode == "D_LFN_ChDs") {
16784       main_pavtxt = fPavTxtD_LFN_ChDs;
16785     }
16786     if (HistoCode == "D_HFN_ChNb") {
16787       main_pavtxt = fPavTxtD_HFN_ChNb;
16788     }
16789     if (HistoCode == "D_HFN_ChDs") {
16790       main_pavtxt = fPavTxtD_HFN_ChDs;
16791     }
16792     if (HistoCode == "D_SCs_ChNb") {
16793       main_pavtxt = fPavTxtD_SCs_ChNb;
16794     }
16795     if (HistoCode == "D_SCs_ChDs") {
16796       main_pavtxt = fPavTxtD_SCs_ChDs;
16797     }
16798     if (HistoCode == "D_MSp_SpNb") {
16799       main_pavtxt = fPavTxtD_MSp_SpNb;
16800     }
16801     if (HistoCode == "D_MSp_SpDs") {
16802       main_pavtxt = fPavTxtD_MSp_SpDs;
16803     }
16804     if (HistoCode == "D_SSp_SpNb") {
16805       main_pavtxt = fPavTxtD_SSp_SpNb;
16806     }
16807     if (HistoCode == "D_SSp_SpDs") {
16808       main_pavtxt = fPavTxtD_SSp_SpDs;
16809     }
16810     if (HistoCode == "D_Adc_EvNb") {
16811       main_pavtxt = fPavTxtD_Adc_EvNb;
16812     }
16813     if (HistoCode == "D_Adc_EvDs") {
16814       main_pavtxt = fPavTxtD_Adc_EvDs;
16815     }
16816     if (HistoCode == "H_Ped_Date") {
16817       main_pavtxt = fPavTxtH_Ped_Date;
16818     }
16819     if (HistoCode == "H_TNo_Date") {
16820       main_pavtxt = fPavTxtH_TNo_Date;
16821     }
16822     if (HistoCode == "H_MCs_Date") {
16823       main_pavtxt = fPavTxtH_MCs_Date;
16824     }
16825     if (HistoCode == "H_LFN_Date") {
16826       main_pavtxt = fPavTxtH_LFN_Date;
16827     }
16828     if (HistoCode == "H_HFN_Date") {
16829       main_pavtxt = fPavTxtH_HFN_Date;
16830     }
16831     if (HistoCode == "H_SCs_Date") {
16832       main_pavtxt = fPavTxtH_SCs_Date;
16833     }
16834     if (HistoCode == "H_Ped_RuDs") {
16835       main_pavtxt = fPavTxtH_Ped_RuDs;
16836     }
16837     if (HistoCode == "H_TNo_RuDs") {
16838       main_pavtxt = fPavTxtH_TNo_RuDs;
16839     }
16840     if (HistoCode == "H_MCs_RuDs") {
16841       main_pavtxt = fPavTxtH_MCs_RuDs;
16842     }
16843     if (HistoCode == "H_LFN_RuDs") {
16844       main_pavtxt = fPavTxtH_LFN_RuDs;
16845     }
16846     if (HistoCode == "H_HFN_RuDs") {
16847       main_pavtxt = fPavTxtH_HFN_RuDs;
16848     }
16849     if (HistoCode == "H_SCs_RuDs") {
16850       main_pavtxt = fPavTxtH_SCs_RuDs;
16851     }
16852   }
16853 
16854   if (main_pavtxt == nullptr) {
16855     std::cout << "*TEcnaHistos::ActivePavTxt(...)> ERROR: main_pavtxt = " << main_pavtxt << std::endl;
16856   }
16857 
16858   return main_pavtxt;
16859 }
16860 // end of ActivePavTxt
16861 
16862 //void TEcnaHistos::SetViewHistoMarkerAndLine(TH1D* h_his0, const TString& HistoCode, const TString& opt_plot)
16863 //{
16864 //// Set marker style and line style for histo view
16865 //
16866 //  TString HistoType = fCnaParHistos->GetHistoType(HistoCode.Data());
16867 //
16868 //  //............................... Marker
16869 //  h_his0->SetMarkerStyle(1);        // default
16870 //
16871 //  if( HistoType == "Global" && ( opt_plot == fSeveralPlot || opt_plot == fSameOnePlot ) )
16872 //    {h_his0->SetMarkerStyle(7); }
16873 //
16874 //  //............................... Line
16875 //  h_his0->SetLineWidth(1);        // default
16876 //
16877 //  if( HistoType == "Global" && ( opt_plot == fSeveralPlot || opt_plot == fSameOnePlot ) )
16878 //    {h_his0->SetLineWidth(0);}
16879 //
16880 //}
16881 
16882 void TEcnaHistos::SetViewHistoColors(TH1D* h_his0,
16883                                      const TString& HistoCode,
16884                                      const TString& opt_plot,
16885                                      const Int_t& arg_AlreadyRead) {
16886   // Set colors, fill, marker, line style for histo view
16887 
16888   TString HistoType = fCnaParHistos->GetHistoType(HistoCode.Data());
16889   if (HistoType == "Global") {
16890     h_his0->SetMarkerStyle(1);
16891   }
16892 
16893   Int_t MaxNbOfColors = fCnaParHistos->GetMaxNbOfColors();
16894 
16895   if (opt_plot == fSameOnePlot) {
16896     h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorH1SamePlus));
16897     h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorH1SamePlus));
16898     fMemoColorH1SamePlus++;
16899     if (fMemoColorH1SamePlus > MaxNbOfColors) {
16900       fMemoColorH1SamePlus = 0;
16901     }
16902   }
16903 
16904   if (opt_plot == fOnlyOnePlot || opt_plot == fSeveralPlot) {
16905     if (HistoCode == "D_NOE_ChNb") {
16906       if (opt_plot == fOnlyOnePlot) {
16907         h_his0->SetFillColor(fCnaParHistos->ColorDefinition("rose"));
16908       }
16909       if (opt_plot == fSeveralPlot) {
16910         h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorD_NOE_ChNb));
16911         h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorD_NOE_ChNb));
16912         fMemoColorD_NOE_ChNb++;
16913         if (fMemoColorD_NOE_ChNb > MaxNbOfColors) {
16914           fMemoColorD_NOE_ChNb = 0;
16915         }
16916       }
16917     }
16918     if (HistoCode == "D_NOE_ChDs") {
16919       if (opt_plot == fOnlyOnePlot) {
16920         h_his0->SetFillColor(fCnaParHistos->ColorDefinition("rose"));
16921       }
16922       if (opt_plot == fSeveralPlot) {
16923         h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorD_NOE_ChDs));
16924         h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorD_NOE_ChDs));
16925         fMemoColorD_NOE_ChDs++;
16926         if (fMemoColorD_NOE_ChDs > MaxNbOfColors) {
16927           fMemoColorD_NOE_ChDs = 0;
16928         }
16929       }
16930     }
16931     if (HistoCode == "D_Ped_ChNb") {
16932       if (opt_plot == fOnlyOnePlot) {
16933         h_his0->SetFillColor(fCnaParHistos->ColorDefinition("bleu38"));
16934       }
16935       if (opt_plot == fSeveralPlot) {
16936         h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorD_Ped_ChNb));
16937         h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorD_Ped_ChNb));
16938         fMemoColorD_Ped_ChNb++;
16939         if (fMemoColorD_Ped_ChNb > MaxNbOfColors) {
16940           fMemoColorD_Ped_ChNb = 0;
16941         }
16942       }
16943     }
16944     if (HistoCode == "D_Ped_ChDs") {
16945       if (opt_plot == fOnlyOnePlot) {
16946         h_his0->SetFillColor(fCnaParHistos->ColorDefinition("bleu38"));
16947       }
16948       if (opt_plot == fSeveralPlot) {
16949         h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorD_Ped_ChDs));
16950         h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorD_Ped_ChDs));
16951         fMemoColorD_Ped_ChDs++;
16952         if (fMemoColorD_Ped_ChDs > MaxNbOfColors) {
16953           fMemoColorD_Ped_ChDs = 0;
16954         }
16955       }
16956     }
16957     if (HistoCode == "D_TNo_ChNb") {
16958       if (opt_plot == fOnlyOnePlot) {
16959         h_his0->SetFillColor(fCnaParHistos->ColorDefinition("rouge48"));
16960       }
16961       if (opt_plot == fSeveralPlot) {
16962         h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorD_TNo_ChNb));
16963         h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorD_TNo_ChNb));
16964         fMemoColorD_TNo_ChNb++;
16965         if (fMemoColorD_TNo_ChNb > MaxNbOfColors) {
16966           fMemoColorD_TNo_ChNb = 0;
16967         }
16968       }
16969     }
16970     if (HistoCode == "D_TNo_ChDs") {
16971       if (opt_plot == fOnlyOnePlot) {
16972         h_his0->SetFillColor(fCnaParHistos->ColorDefinition("rouge48"));
16973       }
16974       if (opt_plot == fSeveralPlot) {
16975         h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorD_TNo_ChDs));
16976         h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorD_TNo_ChDs));
16977         fMemoColorD_TNo_ChDs++;
16978         if (fMemoColorD_TNo_ChDs > MaxNbOfColors) {
16979           fMemoColorD_TNo_ChDs = 0;
16980         }
16981       }
16982     }
16983 
16984     if (HistoCode == "D_MCs_ChNb") {
16985       if (opt_plot == fOnlyOnePlot) {
16986         h_his0->SetFillColor(fCnaParHistos->ColorDefinition("vert31"));
16987       }
16988       if (opt_plot == fSeveralPlot) {
16989         h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorD_MCs_ChNb));
16990         h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorD_MCs_ChNb));
16991         fMemoColorD_MCs_ChNb++;
16992         if (fMemoColorD_MCs_ChNb > MaxNbOfColors) {
16993           fMemoColorD_MCs_ChNb = 0;
16994         }
16995       }
16996     }
16997     if (HistoCode == "D_MCs_ChDs") {
16998       if (opt_plot == fOnlyOnePlot) {
16999         h_his0->SetFillColor(fCnaParHistos->ColorDefinition("vert31"));
17000       }
17001       if (opt_plot == fSeveralPlot) {
17002         h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorD_MCs_ChDs));
17003         h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorD_MCs_ChDs));
17004         fMemoColorD_MCs_ChDs++;
17005         if (fMemoColorD_MCs_ChDs > MaxNbOfColors) {
17006           fMemoColorD_MCs_ChDs = 0;
17007         }
17008       }
17009     }
17010     if (HistoCode == "D_LFN_ChNb") {
17011       if (opt_plot == fOnlyOnePlot) {
17012         h_his0->SetFillColor(fCnaParHistos->ColorDefinition("rouge44"));
17013       }
17014       if (opt_plot == fSeveralPlot) {
17015         h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorD_LFN_ChNb));
17016         h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorD_LFN_ChNb));
17017         fMemoColorD_LFN_ChNb++;
17018         if (fMemoColorD_LFN_ChNb > MaxNbOfColors) {
17019           fMemoColorD_LFN_ChNb = 0;
17020         }
17021       }
17022     }
17023     if (HistoCode == "D_LFN_ChDs") {
17024       if (opt_plot == fOnlyOnePlot) {
17025         h_his0->SetFillColor(fCnaParHistos->ColorDefinition("rouge44"));
17026       }
17027       if (opt_plot == fSeveralPlot) {
17028         h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorD_LFN_ChDs));
17029         h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorD_LFN_ChDs));
17030         fMemoColorD_LFN_ChDs++;
17031         if (fMemoColorD_LFN_ChDs > MaxNbOfColors) {
17032           fMemoColorD_LFN_ChDs = 0;
17033         }
17034       }
17035     }
17036     if (HistoCode == "D_HFN_ChNb") {
17037       if (opt_plot == fOnlyOnePlot) {
17038         h_his0->SetFillColor(fCnaParHistos->ColorDefinition("rouge50"));
17039       }
17040       if (opt_plot == fSeveralPlot) {
17041         h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorD_HFN_ChNb));
17042         h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorD_HFN_ChNb));
17043         fMemoColorD_HFN_ChNb++;
17044         if (fMemoColorD_HFN_ChNb > MaxNbOfColors) {
17045           fMemoColorD_HFN_ChNb = 0;
17046         }
17047       }
17048     }
17049     if (HistoCode == "D_HFN_ChDs") {
17050       if (opt_plot == fOnlyOnePlot) {
17051         h_his0->SetFillColor(fCnaParHistos->ColorDefinition("rouge50"));
17052       }
17053       if (opt_plot == fSeveralPlot) {
17054         h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorD_HFN_ChDs));
17055         h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorD_HFN_ChDs));
17056         fMemoColorD_HFN_ChDs++;
17057         if (fMemoColorD_HFN_ChDs > MaxNbOfColors) {
17058           fMemoColorD_HFN_ChDs = 0;
17059         }
17060       }
17061     }
17062 
17063     if (HistoCode == "D_SCs_ChNb") {
17064       if (opt_plot == fOnlyOnePlot) {
17065         h_his0->SetFillColor(fCnaParHistos->ColorDefinition("marron23"));
17066       }
17067       if (opt_plot == fSeveralPlot) {
17068         h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorD_SCs_ChNb));
17069         h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorD_SCs_ChNb));
17070         fMemoColorD_SCs_ChNb++;
17071         if (fMemoColorD_SCs_ChNb > MaxNbOfColors) {
17072           fMemoColorD_SCs_ChNb = 0;
17073         }
17074       }
17075     }
17076     if (HistoCode == "D_SCs_ChDs") {
17077       if (opt_plot == fOnlyOnePlot) {
17078         h_his0->SetFillColor(fCnaParHistos->ColorDefinition("marron23"));
17079       }
17080       if (opt_plot == fSeveralPlot) {
17081         h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorD_SCs_ChDs));
17082         h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorD_SCs_ChDs));
17083         fMemoColorD_SCs_ChDs++;
17084         if (fMemoColorD_SCs_ChDs > MaxNbOfColors) {
17085           fMemoColorD_SCs_ChDs = 0;
17086         }
17087       }
17088     }
17089 
17090     if (HistoCode == "D_MSp_SpNb") {
17091       if ((opt_plot == fOnlyOnePlot && arg_AlreadyRead == 0) ||
17092           (opt_plot == fOnlyOnePlot && arg_AlreadyRead >= 1 && fPlotAllXtalsInStin == 0)) {
17093         h_his0->SetFillColor(fCnaParHistos->ColorDefinition("bleu38"));
17094       }
17095 
17096       if (opt_plot == fOnlyOnePlot && arg_AlreadyRead >= 0 && fPlotAllXtalsInStin == 1) {
17097         h_his0->SetFillColor((Color_t)0);
17098       }
17099 
17100       if (opt_plot == fSeveralPlot) {
17101         h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorD_MSp_SpNb));
17102         h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorD_MSp_SpNb));
17103         fMemoColorD_MSp_SpNb++;
17104         if (fMemoColorD_MSp_SpNb > MaxNbOfColors) {
17105           fMemoColorD_MSp_SpNb = 0;
17106         }
17107       }
17108     }
17109 
17110     if (HistoCode == "D_MSp_SpDs") {
17111       if ((opt_plot == fOnlyOnePlot && arg_AlreadyRead == 0) ||
17112           (opt_plot == fOnlyOnePlot && arg_AlreadyRead >= 1 && fPlotAllXtalsInStin == 0)) {
17113         h_his0->SetFillColor(fCnaParHistos->ColorDefinition("bleu38"));
17114       }
17115 
17116       if (opt_plot == fOnlyOnePlot && arg_AlreadyRead >= 0 && fPlotAllXtalsInStin == 1) {
17117         h_his0->SetFillColor((Color_t)0);
17118       }
17119 
17120       if (opt_plot == fSeveralPlot) {
17121         h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorD_MSp_SpDs));
17122         h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorD_MSp_SpDs));
17123         fMemoColorD_MSp_SpDs++;
17124         if (fMemoColorD_MSp_SpDs > MaxNbOfColors) {
17125           fMemoColorD_MSp_SpDs = 0;
17126         }
17127       }
17128     }
17129 
17130     if (HistoCode == "D_SSp_SpNb") {
17131       if ((opt_plot == fOnlyOnePlot && arg_AlreadyRead == 0) ||
17132           (opt_plot == fOnlyOnePlot && arg_AlreadyRead >= 1 && fPlotAllXtalsInStin == 0)) {
17133         h_his0->SetFillColor(fCnaParHistos->ColorDefinition("rouge50"));
17134       }
17135 
17136       if (opt_plot == fOnlyOnePlot && arg_AlreadyRead >= 0 && fPlotAllXtalsInStin == 1) {
17137         h_his0->SetFillColor((Color_t)0);
17138       }
17139 
17140       if (opt_plot == fSeveralPlot) {
17141         h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorD_SSp_SpNb));
17142         h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorD_SSp_SpNb));
17143         fMemoColorD_SSp_SpNb++;
17144         if (fMemoColorD_SSp_SpNb > MaxNbOfColors) {
17145           fMemoColorD_SSp_SpNb = 0;
17146         }
17147       }
17148     }
17149 
17150     if (HistoCode == "D_SSp_SpDs") {
17151       if ((opt_plot == fOnlyOnePlot && arg_AlreadyRead == 0) ||
17152           (opt_plot == fOnlyOnePlot && arg_AlreadyRead >= 1 && fPlotAllXtalsInStin == 0)) {
17153         h_his0->SetFillColor(fCnaParHistos->ColorDefinition("rouge50"));
17154       }
17155 
17156       if (opt_plot == fOnlyOnePlot && arg_AlreadyRead >= 0 && fPlotAllXtalsInStin == 1) {
17157         h_his0->SetFillColor((Color_t)0);
17158       }
17159 
17160       if (opt_plot == fSeveralPlot) {
17161         h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorD_SSp_SpDs));
17162         h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorD_SSp_SpDs));
17163         fMemoColorD_SSp_SpDs++;
17164         if (fMemoColorD_SSp_SpDs > MaxNbOfColors) {
17165           fMemoColorD_SSp_SpDs = 0;
17166         }
17167       }
17168     }
17169 
17170     if (HistoCode == "D_Adc_EvNb") {
17171       if (opt_plot == fOnlyOnePlot) {
17172         h_his0->SetFillColor(fCnaParHistos->ColorDefinition("orange42"));
17173       }
17174       if (opt_plot == fSeveralPlot) {
17175         h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorD_Adc_EvNb));
17176         h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorD_Adc_EvNb));
17177         fMemoColorD_Adc_EvNb++;
17178         if (fMemoColorD_Adc_EvNb > MaxNbOfColors) {
17179           fMemoColorD_Adc_EvNb = 0;
17180         }
17181       }
17182       gPad->SetGrid(1, 0);
17183     }
17184 
17185     if (HistoCode == "D_Adc_EvDs") {
17186       if (opt_plot == fOnlyOnePlot) {
17187         h_his0->SetFillColor(fCnaParHistos->ColorDefinition("orange42"));
17188       }
17189       if (opt_plot == fSeveralPlot) {
17190         h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorD_Adc_EvDs));
17191         h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorD_Adc_EvDs));
17192         fMemoColorD_Adc_EvDs++;
17193         if (fMemoColorD_Adc_EvDs > MaxNbOfColors) {
17194           fMemoColorD_Adc_EvDs = 0;
17195         }
17196       }
17197     }
17198 
17199     if (HistoCode == "H_Ped_RuDs") {
17200       if (opt_plot == fOnlyOnePlot) {
17201         h_his0->SetFillColor(fCnaParHistos->ColorDefinition("bleu38"));
17202       }
17203       if (opt_plot == fSeveralPlot) {
17204         h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorH_Ped_RuDs));
17205         h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorH_Ped_RuDs));
17206         fMemoColorH_Ped_RuDs++;
17207         if (fMemoColorH_Ped_RuDs > MaxNbOfColors) {
17208           fMemoColorH_Ped_RuDs = 0;
17209         }
17210       }
17211       gPad->SetGrid(1, 1);
17212     }
17213 
17214     if (HistoCode == "H_TNo_RuDs") {
17215       if (opt_plot == fOnlyOnePlot) {
17216         h_his0->SetFillColor(fCnaParHistos->ColorDefinition("rouge48"));
17217       }
17218       if (opt_plot == fSeveralPlot) {
17219         h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorH_TNo_RuDs));
17220         h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorH_TNo_RuDs));
17221         fMemoColorH_TNo_RuDs++;
17222         if (fMemoColorH_TNo_RuDs > MaxNbOfColors) {
17223           fMemoColorH_TNo_RuDs = 0;
17224         }
17225       }
17226       gPad->SetGrid(1, 1);
17227     }
17228 
17229     if (HistoCode == "H_MCs_RuDs") {
17230       if (opt_plot == fOnlyOnePlot) {
17231         h_his0->SetFillColor(fCnaParHistos->ColorDefinition("vert31"));
17232       }
17233       if (opt_plot == fSeveralPlot) {
17234         h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorH_MCs_RuDs));
17235         h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorH_MCs_RuDs));
17236         fMemoColorH_MCs_RuDs++;
17237         if (fMemoColorH_MCs_RuDs > MaxNbOfColors) {
17238           fMemoColorH_MCs_RuDs = 0;
17239         }
17240       }
17241       gPad->SetGrid(1, 1);
17242     }
17243 
17244     if (HistoCode == "H_LFN_RuDs") {
17245       if (opt_plot == fOnlyOnePlot) {
17246         h_his0->SetFillColor(fCnaParHistos->ColorDefinition("rouge44"));
17247       }
17248       if (opt_plot == fSeveralPlot) {
17249         h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorH_LFN_RuDs));
17250         h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorH_LFN_RuDs));
17251         fMemoColorH_LFN_RuDs++;
17252         if (fMemoColorH_LFN_RuDs > MaxNbOfColors) {
17253           fMemoColorH_LFN_RuDs = 0;
17254         }
17255       }
17256       gPad->SetGrid(1, 1);
17257     }
17258 
17259     if (HistoCode == "H_HFN_RuDs") {
17260       if (opt_plot == fOnlyOnePlot) {
17261         h_his0->SetFillColor(fCnaParHistos->ColorDefinition("rouge50"));
17262       }
17263       if (opt_plot == fSeveralPlot) {
17264         h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorH_HFN_RuDs));
17265         h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorH_HFN_RuDs));
17266         fMemoColorH_HFN_RuDs++;
17267         if (fMemoColorH_HFN_RuDs > MaxNbOfColors) {
17268           fMemoColorH_HFN_RuDs = 0;
17269         }
17270       }
17271       gPad->SetGrid(1, 1);
17272     }
17273 
17274     if (HistoCode == "H_SCs_RuDs") {
17275       if (opt_plot == fOnlyOnePlot) {
17276         h_his0->SetFillColor(fCnaParHistos->ColorDefinition("marron23"));
17277       }
17278       if (opt_plot == fSeveralPlot) {
17279         h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorH_SCs_RuDs));
17280         h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorH_SCs_RuDs));
17281         fMemoColorH_SCs_RuDs++;
17282         if (fMemoColorH_SCs_RuDs > MaxNbOfColors) {
17283           fMemoColorH_SCs_RuDs = 0;
17284         }
17285       }
17286       gPad->SetGrid(1, 1);
17287     }
17288   }
17289 
17290   // if(opt_plot == fSeveralPlot || opt_plot == fSameOnePlot){h_his0->SetLineWidth(2);}
17291 }
17292 // end of SetViewHistoColors
17293 
17294 void TEcnaHistos::SetViewGraphColors(TGraph* g_graph0, const TString& HistoCode, const TString& opt_plot) {
17295   // Set colors for histo view
17296 
17297   Int_t MaxNbOfColors = fCnaParHistos->GetMaxNbOfColors();
17298 
17299   if (opt_plot == fSameOnePlot) {
17300     g_graph0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorH1SamePlus));
17301     g_graph0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorH1SamePlus));
17302     fMemoColorH1SamePlus++;
17303     if (fMemoColorH1SamePlus > MaxNbOfColors) {
17304       fMemoColorH1SamePlus = 0;
17305     }
17306     gPad->SetGrid(1, 1);
17307   }
17308 
17309   if (opt_plot == fOnlyOnePlot || opt_plot == fSeveralPlot) {
17310     if (HistoCode == "H_Ped_Date") {
17311       if (opt_plot == fOnlyOnePlot) {
17312         g_graph0->SetMarkerColor(fCnaParHistos->ColorDefinition("bleu38"));
17313       }
17314       if (opt_plot == fSeveralPlot) {
17315         g_graph0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorH_Ped_Date));
17316         g_graph0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorH_Ped_Date));
17317         fMemoColorH_Ped_Date++;
17318         if (fMemoColorH_Ped_Date > MaxNbOfColors) {
17319           fMemoColorH_Ped_Date = 0;
17320         }
17321       }
17322       gPad->SetGrid(1, 1);
17323     }
17324 
17325     if (HistoCode == "H_TNo_Date") {
17326       if (opt_plot == fOnlyOnePlot) {
17327         g_graph0->SetMarkerColor(fCnaParHistos->ColorDefinition("rouge48"));
17328       }
17329       if (opt_plot == fSeveralPlot) {
17330         g_graph0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorH_TNo_Date));
17331         g_graph0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorH_TNo_Date));
17332         fMemoColorH_TNo_Date++;
17333         if (fMemoColorH_TNo_Date > MaxNbOfColors) {
17334           fMemoColorH_TNo_Date = 0;
17335         }
17336       }
17337       gPad->SetGrid(1, 1);
17338     }
17339 
17340     if (HistoCode == "H_MCs_Date") {
17341       if (opt_plot == fOnlyOnePlot) {
17342         g_graph0->SetMarkerColor(fCnaParHistos->ColorDefinition("vert31"));
17343       }
17344       if (opt_plot == fSeveralPlot) {
17345         g_graph0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorH_MCs_Date));
17346         g_graph0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorH_MCs_Date));
17347         fMemoColorH_MCs_Date++;
17348         if (fMemoColorH_MCs_Date > MaxNbOfColors) {
17349           fMemoColorH_MCs_Date = 0;
17350         }
17351       }
17352       gPad->SetGrid(1, 1);
17353     }
17354 
17355     if (HistoCode == "H_LFN_Date") {
17356       if (opt_plot == fOnlyOnePlot) {
17357         g_graph0->SetMarkerColor(fCnaParHistos->ColorDefinition("bleu38"));
17358       }
17359       if (opt_plot == fSeveralPlot) {
17360         g_graph0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorH_LFN_Date));
17361         g_graph0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorH_LFN_Date));
17362         fMemoColorH_LFN_Date++;
17363         if (fMemoColorH_LFN_Date > MaxNbOfColors) {
17364           fMemoColorH_LFN_Date = 0;
17365         }
17366       }
17367       gPad->SetGrid(1, 1);
17368     }
17369 
17370     if (HistoCode == "H_HFN_Date") {
17371       if (opt_plot == fOnlyOnePlot) {
17372         g_graph0->SetMarkerColor(fCnaParHistos->ColorDefinition("rouge48"));
17373       }
17374       if (opt_plot == fSeveralPlot) {
17375         g_graph0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorH_HFN_Date));
17376         g_graph0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorH_HFN_Date));
17377         fMemoColorH_HFN_Date++;
17378         if (fMemoColorH_HFN_Date > MaxNbOfColors) {
17379           fMemoColorH_HFN_Date = 0;
17380         }
17381       }
17382       gPad->SetGrid(1, 1);
17383     }
17384 
17385     if (HistoCode == "H_SCs_Date") {
17386       if (opt_plot == fOnlyOnePlot) {
17387         g_graph0->SetMarkerColor(fCnaParHistos->ColorDefinition("vert31"));
17388       }
17389       if (opt_plot == fSeveralPlot) {
17390         g_graph0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorH_SCs_Date));
17391         g_graph0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorH_SCs_Date));
17392         fMemoColorH_SCs_Date++;
17393         if (fMemoColorH_SCs_Date > MaxNbOfColors) {
17394           fMemoColorH_SCs_Date = 0;
17395         }
17396       }
17397       gPad->SetGrid(1, 1);
17398     }
17399   }
17400   //if(opt_plot == fSeveralPlot){g_graph0->SetLineWidth(2);}
17401 }
17402 // end of SetViewGraphColors
17403 
17404 Color_t TEcnaHistos::GetViewHistoColor(const TString& HistoCode, const TString& opt_plot) {
17405   Color_t couleur = fCnaParHistos->ColorDefinition("noir");  // a priori = "noir"
17406 
17407   if (opt_plot == fSameOnePlot) {
17408     couleur = fCnaParHistos->ColorTab(fMemoColorH1SamePlus);
17409   }
17410 
17411   if (opt_plot == fOnlyOnePlot || opt_plot == fSeveralPlot) {
17412     if (HistoCode == "D_NOE_ChNb") {
17413       couleur = fCnaParHistos->ColorTab(fMemoColorD_NOE_ChNb);
17414     }
17415     if (HistoCode == "D_NOE_ChDs") {
17416       couleur = fCnaParHistos->ColorTab(fMemoColorD_NOE_ChDs);
17417     }
17418     if (HistoCode == "D_Ped_ChNb") {
17419       couleur = fCnaParHistos->ColorTab(fMemoColorD_Ped_ChNb);
17420     }
17421     if (HistoCode == "D_Ped_ChDs") {
17422       couleur = fCnaParHistos->ColorTab(fMemoColorD_Ped_ChDs);
17423     }
17424     if (HistoCode == "D_TNo_ChNb") {
17425       couleur = fCnaParHistos->ColorTab(fMemoColorD_TNo_ChNb);
17426     }
17427     if (HistoCode == "D_TNo_ChDs") {
17428       couleur = fCnaParHistos->ColorTab(fMemoColorD_TNo_ChDs);
17429     }
17430     if (HistoCode == "D_MCs_ChNb") {
17431       couleur = fCnaParHistos->ColorTab(fMemoColorD_MCs_ChNb);
17432     }
17433     if (HistoCode == "D_MCs_ChDs") {
17434       couleur = fCnaParHistos->ColorTab(fMemoColorD_MCs_ChDs);
17435     }
17436     if (HistoCode == "D_LFN_ChNb") {
17437       couleur = fCnaParHistos->ColorTab(fMemoColorD_LFN_ChNb);
17438     }
17439     if (HistoCode == "D_LFN_ChDs") {
17440       couleur = fCnaParHistos->ColorTab(fMemoColorD_LFN_ChDs);
17441     }
17442     if (HistoCode == "D_HFN_ChNb") {
17443       couleur = fCnaParHistos->ColorTab(fMemoColorD_HFN_ChNb);
17444     }
17445     if (HistoCode == "D_HFN_ChDs") {
17446       couleur = fCnaParHistos->ColorTab(fMemoColorD_HFN_ChDs);
17447     }
17448     if (HistoCode == "D_SCs_ChNb") {
17449       couleur = fCnaParHistos->ColorTab(fMemoColorD_SCs_ChNb);
17450     }
17451     if (HistoCode == "D_SCs_ChDs") {
17452       couleur = fCnaParHistos->ColorTab(fMemoColorD_SCs_ChDs);
17453     }
17454     if (HistoCode == "D_MSp_SpNb") {
17455       couleur = fCnaParHistos->ColorTab(fMemoColorD_MSp_SpNb);
17456     }
17457     if (HistoCode == "D_MSp_SpDs") {
17458       couleur = fCnaParHistos->ColorTab(fMemoColorD_MSp_SpDs);
17459     }
17460     if (HistoCode == "D_SSp_SpNb") {
17461       couleur = fCnaParHistos->ColorTab(fMemoColorD_SSp_SpNb);
17462     }
17463     if (HistoCode == "D_SSp_SpDs") {
17464       couleur = fCnaParHistos->ColorTab(fMemoColorD_SSp_SpDs);
17465     }
17466     if (HistoCode == "D_Adc_EvNb") {
17467       couleur = fCnaParHistos->ColorTab(fMemoColorD_Adc_EvNb);
17468     }
17469     if (HistoCode == "D_Adc_EvDs") {
17470       couleur = fCnaParHistos->ColorTab(fMemoColorD_Adc_EvDs);
17471     }
17472     if (HistoCode == "H_Ped_Date") {
17473       couleur = fCnaParHistos->ColorTab(fMemoColorH_Ped_Date);
17474     }
17475     if (HistoCode == "H_TNo_Date") {
17476       couleur = fCnaParHistos->ColorTab(fMemoColorH_TNo_Date);
17477     }
17478     if (HistoCode == "H_MCs_Date") {
17479       couleur = fCnaParHistos->ColorTab(fMemoColorH_MCs_Date);
17480     }
17481     if (HistoCode == "H_LFN_Date") {
17482       couleur = fCnaParHistos->ColorTab(fMemoColorH_LFN_Date);
17483     }
17484     if (HistoCode == "H_HFN_Date") {
17485       couleur = fCnaParHistos->ColorTab(fMemoColorH_HFN_Date);
17486     }
17487     if (HistoCode == "H_SCs_Date") {
17488       couleur = fCnaParHistos->ColorTab(fMemoColorH_SCs_Date);
17489     }
17490     if (HistoCode == "H_Ped_RuDs") {
17491       couleur = fCnaParHistos->ColorTab(fMemoColorH_Ped_RuDs);
17492     }
17493     if (HistoCode == "H_TNo_RuDs") {
17494       couleur = fCnaParHistos->ColorTab(fMemoColorH_TNo_RuDs);
17495     }
17496     if (HistoCode == "H_MCs_RuDs") {
17497       couleur = fCnaParHistos->ColorTab(fMemoColorH_MCs_RuDs);
17498     }
17499     if (HistoCode == "H_LFN_RuDs") {
17500       couleur = fCnaParHistos->ColorTab(fMemoColorH_LFN_RuDs);
17501     }
17502     if (HistoCode == "H_HFN_RuDs") {
17503       couleur = fCnaParHistos->ColorTab(fMemoColorH_HFN_RuDs);
17504     }
17505     if (HistoCode == "H_SCs_RuDs") {
17506       couleur = fCnaParHistos->ColorTab(fMemoColorH_SCs_RuDs);
17507     }
17508   }
17509   return couleur;
17510 }
17511 // end of GetViewHistoColor
17512 
17513 Color_t TEcnaHistos::GetSCColor(const TString& DeeEndcap, const TString& DeeDir, const TString& QuadType) {
17514   //gives the SC color for the numbering plots
17515   TColor* my_color = new TColor();
17516   Color_t couleur = fCnaParHistos->ColorDefinition("noir");  // default = "noir"
17517 
17518   if (DeeEndcap == "EE+") {
17519     if (DeeDir == "right" && QuadType == "top") {
17520       couleur = fCnaParHistos->ColorDefinition("rouge");
17521     }
17522     if (DeeDir == "right" && QuadType == "bottom") {
17523       couleur = fCnaParHistos->ColorDefinition("bleu_fonce");
17524     }
17525     if (DeeDir == "left" && QuadType == "top") {
17526       couleur = (Color_t)my_color->GetColor("#006600");
17527     }
17528     if (DeeDir == "left" && QuadType == "bottom") {
17529       couleur = (Color_t)my_color->GetColor("#CC3300");
17530     }
17531   }
17532   if (DeeEndcap == "EE-") {
17533     if (DeeDir == "right" && QuadType == "top") {
17534       couleur = (Color_t)my_color->GetColor("#008800");
17535     }
17536     if (DeeDir == "right" && QuadType == "bottom") {
17537       couleur = (Color_t)my_color->GetColor("#EE5500");
17538     }
17539     if (DeeDir == "left" && QuadType == "top") {
17540       couleur = fCnaParHistos->ColorDefinition("rouge");
17541     }
17542     if (DeeDir == "left" && QuadType == "bottom") {
17543       couleur = fCnaParHistos->ColorDefinition("bleu_fonce");
17544     }
17545   }
17546 
17547   return couleur;
17548 }
17549 void TEcnaHistos::SetHistoPresentation(TH1D* histo, const TString& HistoType) {
17550   // Set presentation (axis title offsets, title size, label size, etc...
17551 
17552   fCnaParHistos->SetViewHistoStyle(HistoType.Data());
17553   fCnaParHistos->SetViewHistoPadMargins(HistoType.Data(), " ");
17554   fCnaParHistos->SetViewHistoOffsets(histo, HistoType.Data(), " ");
17555   fCnaParHistos->SetViewHistoStats(histo, HistoType.Data());
17556 }
17557 void TEcnaHistos::SetHistoPresentation(TH1D* histo, const TString& HistoType, const TString& opt_plot) {
17558   // Set presentation (axis title offsets, title size, label size, etc...
17559 
17560   fCnaParHistos->SetViewHistoStyle(HistoType.Data());
17561   fCnaParHistos->SetViewHistoPadMargins(HistoType.Data(), opt_plot.Data());
17562   fCnaParHistos->SetViewHistoOffsets(histo, HistoType.Data(), opt_plot.Data());
17563   fCnaParHistos->SetViewHistoStats(histo, HistoType.Data());
17564 }
17565 
17566 void TEcnaHistos::SetGraphPresentation(TGraph* graph, const TString& HistoType, const TString& opt_plot) {
17567   // Set presentation (axis title offsets, title size, label size, etc...
17568 
17569   fCnaParHistos->SetViewHistoStyle(HistoType.Data());
17570   fCnaParHistos->SetViewHistoPadMargins(HistoType.Data(), opt_plot);
17571   fCnaParHistos->SetViewGraphOffsets(graph, HistoType.Data());
17572 
17573   //............................... Graph marker
17574   graph->SetMarkerStyle(1);
17575   if (HistoType == "Evol") {
17576     graph->SetMarkerStyle(20);
17577   }
17578 }
17579 
17580 //=====================================================================
17581 //
17582 //                 NewCanvas, ReInitCanvas
17583 //
17584 //=====================================================================
17585 void TEcnaHistos::NewCanvas(const TString& opt_plot) {
17586   // ReInit canvas in option SAME n in order to restart a new SAME n plot
17587   // (called by user only for option Same n)
17588 
17589   if (opt_plot == fSameOnePlot) {
17590     fImpH1SamePlus = nullptr;
17591     fCanvH1SamePlus = nullptr;
17592     fPadH1SamePlus = nullptr;
17593     fMemoPlotH1SamePlus = 0;
17594     fMemoColorH1SamePlus = 0;
17595     fCanvSameH1SamePlus++;
17596     fPavTxtH1SamePlus = nullptr;
17597     fClosedH1SamePlus = kFALSE;
17598   } else {
17599     std::cout << "TEcnaHistos::NewCanvas(...)> *** ERROR *** " << opt_plot.Data() << ": "
17600               << "unknown option for NewCanvas. Only " << fSameOnePlot << " option is accepted." << fTTBELL
17601               << std::endl;
17602   }
17603 }
17604 
17605 void TEcnaHistos::ReInitCanvas(const TString& HistoCode, const TString& opt_plot) {
17606   // ReInit canvas in option SAME and SAME n
17607 
17608   if (opt_plot == fSameOnePlot) {
17609     fImpH1SamePlus = nullptr;
17610     fCanvH1SamePlus = nullptr;
17611     fPadH1SamePlus = nullptr;
17612     fMemoPlotH1SamePlus = 0;
17613     fMemoColorH1SamePlus = 0;
17614     fCanvSameH1SamePlus++;
17615     fPavTxtH1SamePlus = nullptr;
17616     fClosedH1SamePlus = kFALSE;
17617   }
17618 
17619   if (opt_plot == fOnlyOnePlot || opt_plot == fSeveralPlot) {
17620     if (HistoCode == "D_NOE_ChNb") {
17621       fImpD_NOE_ChNb = nullptr;
17622       fCanvD_NOE_ChNb = nullptr;
17623       fPadD_NOE_ChNb = nullptr;
17624       fMemoPlotD_NOE_ChNb = 0;
17625       fMemoColorD_NOE_ChNb = 0;
17626       fCanvSameD_NOE_ChNb++;
17627       fPavTxtD_NOE_ChNb = nullptr;
17628       fClosedD_NOE_ChNb = kFALSE;
17629     }
17630 
17631     if (HistoCode == "D_NOE_ChDs") {
17632       fImpD_NOE_ChDs = nullptr;
17633       fCanvD_NOE_ChDs = nullptr;
17634       fPadD_NOE_ChDs = nullptr;
17635       fMemoPlotD_NOE_ChDs = 0;
17636       fMemoColorD_NOE_ChDs = 0;
17637       fCanvSameD_NOE_ChDs++;
17638       fPavTxtD_NOE_ChDs = nullptr;
17639       fClosedD_NOE_ChDs = kFALSE;
17640     }
17641 
17642     if (HistoCode == "D_Ped_ChNb")  // (ReInitCanvas)
17643     {
17644       fImpD_Ped_ChNb = nullptr;
17645       fCanvD_Ped_ChNb = nullptr;
17646       fPadD_Ped_ChNb = nullptr;
17647       fMemoPlotD_Ped_ChNb = 0;
17648       fMemoColorD_Ped_ChNb = 0;
17649       fCanvSameD_Ped_ChNb++;
17650       fPavTxtD_Ped_ChNb = nullptr;
17651       fClosedD_Ped_ChNb = kFALSE;
17652     }
17653 
17654     if (HistoCode == "D_Ped_ChDs") {
17655       fImpD_Ped_ChDs = nullptr;
17656       fCanvD_Ped_ChDs = nullptr;
17657       fPadD_Ped_ChDs = nullptr;
17658       fMemoPlotD_Ped_ChDs = 0;
17659       fMemoColorD_Ped_ChDs = 0;
17660       fCanvSameD_Ped_ChDs++;
17661       fPavTxtD_Ped_ChDs = nullptr;
17662       fClosedD_Ped_ChDs = kFALSE;
17663     }
17664 
17665     if (HistoCode == "D_TNo_ChNb") {
17666       fImpD_TNo_ChNb = nullptr;
17667       fCanvD_TNo_ChNb = nullptr;
17668       fPadD_TNo_ChNb = nullptr;
17669       fMemoPlotD_TNo_ChNb = 0;
17670       fMemoColorD_TNo_ChNb = 0;
17671       fCanvSameD_TNo_ChNb++;
17672       fPavTxtD_TNo_ChNb = nullptr;
17673       fClosedD_TNo_ChNb = kFALSE;
17674     }
17675 
17676     if (HistoCode == "D_TNo_ChDs") {
17677       fImpD_TNo_ChDs = nullptr;
17678       fCanvD_TNo_ChDs = nullptr;
17679       fPadD_TNo_ChDs = nullptr;
17680       fMemoPlotD_TNo_ChDs = 0;
17681       fMemoColorD_TNo_ChDs = 0;
17682       fCanvSameD_TNo_ChDs++;
17683       fPavTxtD_TNo_ChDs = nullptr;
17684       fClosedD_TNo_ChDs = kFALSE;
17685     }
17686 
17687     if (HistoCode == "D_MCs_ChNb")  // (ReInitCanvas)
17688     {
17689       fImpD_MCs_ChNb = nullptr;
17690       fCanvD_MCs_ChNb = nullptr;
17691       fPadD_MCs_ChNb = nullptr;
17692       fMemoPlotD_MCs_ChNb = 0;
17693       fMemoColorD_MCs_ChNb = 0;
17694       fCanvSameD_MCs_ChNb++;
17695       fPavTxtD_MCs_ChNb = nullptr;
17696       fClosedD_MCs_ChNb = kFALSE;
17697     }
17698 
17699     if (HistoCode == "D_MCs_ChDs") {
17700       fImpD_MCs_ChDs = nullptr;
17701       fCanvD_MCs_ChDs = nullptr;
17702       fPadD_MCs_ChDs = nullptr;
17703       fMemoPlotD_MCs_ChDs = 0;
17704       fMemoColorD_MCs_ChDs = 0;
17705       fCanvSameD_MCs_ChDs++;
17706       fPavTxtD_MCs_ChDs = nullptr;
17707       fClosedD_MCs_ChDs = kFALSE;
17708     }
17709 
17710     if (HistoCode == "D_LFN_ChNb") {
17711       fImpD_LFN_ChNb = nullptr;
17712       fCanvD_LFN_ChNb = nullptr;
17713       fPadD_LFN_ChNb = nullptr;
17714       fMemoPlotD_LFN_ChNb = 0;
17715       fMemoColorD_LFN_ChNb = 0;
17716       fCanvSameD_LFN_ChNb++;
17717       fPavTxtD_LFN_ChNb = nullptr;
17718       fClosedD_LFN_ChNb = kFALSE;
17719     }
17720 
17721     if (HistoCode == "D_LFN_ChDs")  // (ReInitCanvas)
17722     {
17723       fImpD_LFN_ChDs = nullptr;
17724       fCanvD_LFN_ChDs = nullptr;
17725       fPadD_LFN_ChDs = nullptr;
17726       fMemoPlotD_LFN_ChDs = 0;
17727       fMemoColorD_LFN_ChDs = 0;
17728       fCanvSameD_LFN_ChDs++;
17729       fPavTxtD_LFN_ChDs = nullptr;
17730       fClosedD_LFN_ChDs = kFALSE;
17731     }
17732 
17733     if (HistoCode == "D_HFN_ChNb") {
17734       fImpD_HFN_ChNb = nullptr;
17735       fCanvD_HFN_ChNb = nullptr;
17736       fPadD_HFN_ChNb = nullptr;
17737       fMemoPlotD_HFN_ChNb = 0;
17738       fMemoColorD_HFN_ChNb = 0;
17739       fCanvSameD_HFN_ChNb++;
17740       fPavTxtD_HFN_ChNb = nullptr;
17741       fClosedD_HFN_ChNb = kFALSE;
17742     }
17743 
17744     if (HistoCode == "D_HFN_ChDs") {
17745       fImpD_HFN_ChDs = nullptr;
17746       fCanvD_HFN_ChDs = nullptr;
17747       fPadD_HFN_ChDs = nullptr;
17748       fMemoPlotD_HFN_ChDs = 0;
17749       fMemoColorD_HFN_ChDs = 0;
17750       fCanvSameD_HFN_ChDs++;
17751       fPavTxtD_HFN_ChDs = nullptr;
17752       fClosedD_HFN_ChDs = kFALSE;
17753     }
17754 
17755     if (HistoCode == "D_SCs_ChNb") {
17756       fImpD_SCs_ChNb = nullptr;
17757       fCanvD_SCs_ChNb = nullptr;
17758       fPadD_SCs_ChNb = nullptr;
17759       fMemoPlotD_SCs_ChNb = 0;
17760       fMemoColorD_SCs_ChNb = 0;
17761       fCanvSameD_SCs_ChNb++;
17762       fPavTxtD_SCs_ChNb = nullptr;
17763       fClosedD_SCs_ChNb = kFALSE;
17764     }
17765 
17766     if (HistoCode == "D_SCs_ChDs")  // (ReInitCanvas)
17767     {
17768       fImpD_SCs_ChDs = nullptr;
17769       fCanvD_SCs_ChDs = nullptr;
17770       fPadD_SCs_ChDs = nullptr;
17771       fMemoPlotD_SCs_ChDs = 0;
17772       fMemoColorD_SCs_ChDs = 0;
17773       fCanvSameD_SCs_ChDs++;
17774       fPavTxtD_SCs_ChDs = nullptr;
17775       fClosedD_SCs_ChDs = kFALSE;
17776     }
17777 
17778     if (HistoCode == "D_MSp_SpNb") {
17779       fImpD_MSp_SpNb = nullptr;
17780       fCanvD_MSp_SpNb = nullptr;
17781       fPadD_MSp_SpNb = nullptr;
17782       fMemoPlotD_MSp_SpNb = 0;
17783       fMemoColorD_MSp_SpNb = 0;
17784       fCanvSameD_MSp_SpNb++;
17785       fPavTxtD_MSp_SpNb = nullptr;
17786       fClosedD_MSp_SpNb = kFALSE;
17787     }
17788 
17789     if (HistoCode == "D_MSp_SpDs") {
17790       fImpD_MSp_SpDs = nullptr;
17791       fCanvD_MSp_SpDs = nullptr;
17792       fPadD_MSp_SpDs = nullptr;
17793       fMemoPlotD_MSp_SpDs = 0;
17794       fMemoColorD_MSp_SpDs = 0;
17795       fCanvSameD_MSp_SpDs++;
17796       fPavTxtD_MSp_SpDs = nullptr;
17797       fClosedD_MSp_SpDs = kFALSE;
17798     }
17799 
17800     if (HistoCode == "D_SSp_SpNb") {
17801       fImpD_SSp_SpNb = nullptr;
17802       fCanvD_SSp_SpNb = nullptr;
17803       fPadD_SSp_SpNb = nullptr;
17804       fMemoPlotD_SSp_SpNb = 0;
17805       fMemoColorD_SSp_SpNb = 0;
17806       fCanvSameD_SSp_SpNb++;
17807       fPavTxtD_SSp_SpNb = nullptr;
17808       fClosedD_SSp_SpNb = kFALSE;
17809     }
17810 
17811     if (HistoCode == "D_SSp_SpDs") {
17812       fImpD_SSp_SpDs = nullptr;
17813       fCanvD_SSp_SpDs = nullptr;
17814       fPadD_SSp_SpDs = nullptr;
17815       fMemoPlotD_SSp_SpDs = 0;
17816       fMemoColorD_SSp_SpDs = 0;
17817       fCanvSameD_SSp_SpDs++;
17818       fPavTxtD_SSp_SpDs = nullptr;
17819       fClosedD_SSp_SpDs = kFALSE;
17820     }
17821 
17822     if (HistoCode == "D_Adc_EvNb")  // (ReInitCanvas)
17823     {
17824       fImpD_Adc_EvNb = nullptr;
17825       fCanvD_Adc_EvNb = nullptr;
17826       fPadD_Adc_EvNb = nullptr;
17827       fMemoPlotD_Adc_EvNb = 0;
17828       fMemoColorD_Adc_EvNb = 0;
17829       fCanvSameD_Adc_EvNb++;
17830       fPavTxtD_Adc_EvNb = nullptr;
17831       fClosedD_Adc_EvNb = kFALSE;
17832     }
17833 
17834     if (HistoCode == "D_Adc_EvDs") {
17835       fImpD_Adc_EvDs = nullptr;
17836       fCanvD_Adc_EvDs = nullptr;
17837       fPadD_Adc_EvDs = nullptr;
17838       fMemoPlotD_Adc_EvDs = 0;
17839       fMemoColorD_Adc_EvDs = 0;
17840       fCanvSameD_Adc_EvDs++;
17841       fPavTxtD_Adc_EvDs = nullptr;
17842       fClosedD_Adc_EvDs = kFALSE;
17843     }
17844 
17845     if (HistoCode == "H_Ped_Date") {
17846       fImpH_Ped_Date = nullptr;
17847       fCanvH_Ped_Date = nullptr;
17848       fPadH_Ped_Date = nullptr;
17849       fMemoPlotH_Ped_Date = 0;
17850       fMemoColorH_Ped_Date = 0;
17851       fCanvSameH_Ped_Date++;
17852       fNbOfListFileH_Ped_Date = 0;
17853       fClosedH_Ped_Date = kFALSE;
17854     }
17855 
17856     if (HistoCode == "H_TNo_Date") {
17857       fImpH_TNo_Date = nullptr;
17858       fCanvH_TNo_Date = nullptr;
17859       fPadH_TNo_Date = nullptr;
17860       fMemoPlotH_TNo_Date = 0;
17861       fMemoColorH_TNo_Date = 0;
17862       fCanvSameH_TNo_Date++;
17863       fNbOfListFileH_TNo_Date = 0;
17864       fClosedH_TNo_Date = kFALSE;
17865     }
17866 
17867     if (HistoCode == "H_MCs_Date")  // (ReInitCanvas)
17868     {
17869       fImpH_MCs_Date = nullptr;
17870       fCanvH_MCs_Date = nullptr;
17871       fPadH_MCs_Date = nullptr;
17872       fMemoPlotH_MCs_Date = 0;
17873       fMemoColorH_MCs_Date = 0;
17874       fCanvSameH_MCs_Date++;
17875       fNbOfListFileH_MCs_Date = 0;
17876       fClosedH_MCs_Date = kFALSE;
17877     }
17878 
17879     if (HistoCode == "H_LFN_Date") {
17880       fImpH_LFN_Date = nullptr;
17881       fCanvH_LFN_Date = nullptr;
17882       fPadH_LFN_Date = nullptr;
17883       fMemoPlotH_LFN_Date = 0;
17884       fMemoColorH_LFN_Date = 0;
17885       fCanvSameH_LFN_Date++;
17886       fNbOfListFileH_LFN_Date = 0;
17887       fClosedH_LFN_Date = kFALSE;
17888     }
17889 
17890     if (HistoCode == "H_HFN_Date") {
17891       fImpH_HFN_Date = nullptr;
17892       fCanvH_HFN_Date = nullptr;
17893       fPadH_HFN_Date = nullptr;
17894       fMemoPlotH_HFN_Date = 0;
17895       fMemoColorH_HFN_Date = 0;
17896       fCanvSameH_HFN_Date++;
17897       fNbOfListFileH_HFN_Date = 0;
17898       fClosedH_HFN_Date = kFALSE;
17899     }
17900 
17901     if (HistoCode == "H_SCs_Date") {
17902       fImpH_SCs_Date = nullptr;
17903       fCanvH_SCs_Date = nullptr;
17904       fPadH_SCs_Date = nullptr;
17905       fMemoPlotH_SCs_Date = 0;
17906       fMemoColorH_SCs_Date = 0;
17907       fCanvSameH_SCs_Date++;
17908       fNbOfListFileH_SCs_Date = 0;
17909       fClosedH_SCs_Date = kFALSE;
17910     }
17911 
17912     if (HistoCode == "H_Ped_RuDs") {
17913       fImpH_Ped_RuDs = nullptr;
17914       fCanvH_Ped_RuDs = nullptr;
17915       fPadH_Ped_RuDs = nullptr;
17916       fMemoPlotH_Ped_RuDs = 0;
17917       fMemoColorH_Ped_RuDs = 0;
17918       fCanvSameH_Ped_RuDs++;
17919       fNbOfListFileH_Ped_RuDs = 0;
17920       fClosedH_Ped_RuDs = kFALSE;
17921     }
17922 
17923     if (HistoCode == "H_TNo_RuDs") {
17924       fImpH_TNo_RuDs = nullptr;
17925       fCanvH_TNo_RuDs = nullptr;
17926       fPadH_TNo_RuDs = nullptr;
17927       fMemoPlotH_TNo_RuDs = 0;
17928       fMemoColorH_TNo_RuDs = 0;
17929       fCanvSameH_TNo_RuDs++;
17930       fNbOfListFileH_TNo_RuDs = 0;
17931       fClosedH_TNo_RuDs = kFALSE;
17932     }
17933 
17934     if (HistoCode == "H_MCs_RuDs")  // (ReInitCanvas)
17935     {
17936       fImpH_MCs_RuDs = nullptr;
17937       fCanvH_MCs_RuDs = nullptr;
17938       fPadH_MCs_RuDs = nullptr;
17939       fMemoPlotH_MCs_RuDs = 0;
17940       fMemoColorH_MCs_RuDs = 0;
17941       fCanvSameH_MCs_RuDs++;
17942       fNbOfListFileH_MCs_RuDs = 0;
17943       fClosedH_MCs_RuDs = kFALSE;
17944     }
17945 
17946     if (HistoCode == "H_LFN_RuDs") {
17947       fImpH_LFN_RuDs = nullptr;
17948       fCanvH_LFN_RuDs = nullptr;
17949       fPadH_LFN_RuDs = nullptr;
17950       fMemoPlotH_LFN_RuDs = 0;
17951       fMemoColorH_LFN_RuDs = 0;
17952       fCanvSameH_LFN_RuDs++;
17953       fNbOfListFileH_LFN_RuDs = 0;
17954       fClosedH_LFN_RuDs = kFALSE;
17955     }
17956 
17957     if (HistoCode == "H_HFN_RuDs") {
17958       fImpH_HFN_RuDs = nullptr;
17959       fCanvH_HFN_RuDs = nullptr;
17960       fPadH_HFN_RuDs = nullptr;
17961       fMemoPlotH_HFN_RuDs = 0;
17962       fMemoColorH_HFN_RuDs = 0;
17963       fCanvSameH_HFN_RuDs++;
17964       fNbOfListFileH_HFN_RuDs = 0;
17965       fClosedH_HFN_RuDs = kFALSE;
17966     }
17967 
17968     if (HistoCode == "H_SCs_RuDs") {
17969       fImpH_SCs_RuDs = nullptr;
17970       fCanvH_SCs_RuDs = nullptr;
17971       fPadH_SCs_RuDs = nullptr;
17972       fMemoPlotH_SCs_RuDs = 0;
17973       fMemoColorH_SCs_RuDs = 0;
17974       fCanvSameH_SCs_RuDs++;
17975       fNbOfListFileH_SCs_RuDs = 0;
17976       fClosedH_SCs_RuDs = kFALSE;
17977     }
17978   }
17979 }
17980 // ------- end of ReInitCanvas(...) ------------
17981 
17982 //==========================================================================================
17983 void TEcnaHistos::WriteMatrixAscii(const TString& BetweenWhat,
17984                                    const TString& CorOrCov,
17985                                    const Int_t& StexStinEcna,
17986                                    const Int_t& MatrixBinIndex,
17987                                    const Int_t& MatSize,
17988                                    const TMatrixD& read_matrix) {
17989   // write matrix in ascii file
17990 
17991   Int_t ChanNumber = MatrixBinIndex;
17992 
17993   fCnaWrite->RegisterFileParameters(fFapAnaType,
17994                                     fFapNbOfSamples,
17995                                     fFapRunNumber,
17996                                     fFapFirstReqEvtNumber,
17997                                     fFapLastReqEvtNumber,
17998                                     fFapReqNbOfEvts,
17999                                     fFapStexNumber,
18000                                     fStartDate,
18001                                     fStopDate,
18002                                     fStartTime,
18003                                     fStopTime);
18004 
18005   if (BetweenWhat == fBetweenSamples && CorOrCov == fCorrelationMatrix) {
18006     fCnaWrite->WriteAsciiCorrelationsBetweenSamples(StexStinEcna, ChanNumber, MatSize, read_matrix);
18007     fAsciiFileName = fCnaWrite->GetAsciiFileName();
18008   }
18009 
18010   if (BetweenWhat == fBetweenSamples && CorOrCov == fCovarianceMatrix) {
18011     fCnaWrite->WriteAsciiCovariancesBetweenSamples(StexStinEcna, ChanNumber, MatSize, read_matrix);
18012     fAsciiFileName = fCnaWrite->GetAsciiFileName();
18013   }
18014 }
18015 //...............................................................................................
18016 void TEcnaHistos::WriteHistoAscii(const TString& HistoCode, const Int_t& HisSize, const TVectorD& read_histo) {
18017   // write matrix in ascii file
18018 
18019   fCnaWrite->RegisterFileParameters(fFapAnaType,
18020                                     fFapNbOfSamples,
18021                                     fFapRunNumber,
18022                                     fFapFirstReqEvtNumber,
18023                                     fFapLastReqEvtNumber,
18024                                     fFapReqNbOfEvts,
18025                                     fFapStexNumber,
18026                                     fStartDate,
18027                                     fStopDate,
18028                                     fStartTime,
18029                                     fStopTime);
18030 
18031   fCnaWrite->WriteAsciiHisto(HistoCode, HisSize, read_histo);
18032   fAsciiFileName = fCnaWrite->GetAsciiFileName();
18033 }
18034 
18035 TString TEcnaHistos::AsciiFileName() { return fAsciiFileName.Data(); }
18036 
18037 //---------------> messages de rappel pour l'auteur:
18038 //
18039 //======= A T T E N T I O N ========= A T T E N T I O N ========= A T T E N T I O N ==============!!!!
18040 //      A EVITER ABSOLUMENT quand on est sous TEcnaGui CAR LE cin >> BLOQUE X11
18041 //      puisqu'on n'a pas la main dans la fenetre de compte-rendu de la CNA
18042 //     {Int_t cintoto; std::cout << "taper 0 pour continuer" << std::endl; cin >> cintoto;}
18043 //                         *=================================================*
18044 //                         |                                                 |
18045 //++++++++++++++++++++++++|  A T T E N T I O N:  PAS DE TEST "cintoto" ici! |+++++++++++++++++++++!!!!
18046 //                         |                                                 |
18047 //                         *=================================================*
18048 //
18049 // INFO: When "new" fails to allocate the memory for an object, or "new[]" fails to allocate the memory
18050 // for an object array, a std::bad_alloc object is thrown.
18051 // "In GCC, the RTTI mangled name of std::bad_alloc is, I'm guessing, St9bad_alloc."