Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-09-07 04:34:48

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