CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_9_patch3/src/CalibCalorimetry/EcalCorrelatedNoiseAnalysisAlgos/src/TEcnaHistos.cc

Go to the documentation of this file.
00001 //---------Author's Name: B.Fabbro DSM/IRFU/SPP CEA-Saclay
00002 //---------Copyright: Those valid for CEA sofware
00003 //---------Modified: 04/07/2011
00004 
00005 #include "CalibCalorimetry/EcalCorrelatedNoiseAnalysisAlgos/interface/TEcnaHistos.h"
00006 
00007 //--------------------------------------
00008 //  TEcnaHistos.cc
00009 //  Class creation: 18 April 2005
00010 //  Documentation: see TEcnaHistos.h
00011 //--------------------------------------
00012 
00013 ClassImp(TEcnaHistos)
00014 //______________________________________________________________________________
00015 //
00016 
00017 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
00018 //
00019 //       (attributes) ===> TEcnaParPaths --->|
00020 //                         TEcnaParEcal --->|
00021 //                         TEcnaWrite ---> TEcnaParPaths --->| 
00022 //                                         TEcnaParCout  --->| 
00023 //                                         TEcnaParEcal --->|
00024 //                                         TEcnaNumbering ---> TEcnaParEcal --->|
00025 //                         TEcnaParHistos ---> TEcnaParEcal --->|
00026 //                                             TEcnaNumbering ---> TEcnaParEcal --->|
00027 //                         TEcnaNumbering ---> TEcnaParEcal --->|
00028 //
00029 //                         TEcnaRead ---> TEcnaParCout --->|  
00030 //                                        TEcnaParPaths --->|
00031 //                                        TEcnaHeader --->|
00032 //                                        TEcnaParEcal --->|
00033 //                                        TEcnaWrite ---> TEcnaParPaths --->|
00034 //                                                        TEcnaParCout --->| 
00035 //                                                        TEcnaParEcal --->|
00036 //                                                        TEcnaNumbering ---> TEcnaParEcal --->|
00037 //                                        TEcnaNumbering ---> TEcnaParEcal --->|
00038 //
00039 //
00040 //          Terminal classes: TEcnaParPaths, TEcnaParEcal, TEcnaParCout, TEcnaHeader, TEcnaNArrayD,
00041 //                            TEcnaObject, TEcnaResultType, TEcnaRootFile
00042 //      Non terminal classes: TEcnaGui, TEcnaHistos, TEcnaParHistos, TEcnaNumbering, TEcnaRead,
00043 //                            TEcnaRun, TEcnaWrite
00044 //
00045 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
00046 
00047 TEcnaHistos::~TEcnaHistos()
00048 {
00049   //destructor
00050 
00051   if (fT1DRunNumber != 0){delete [] fT1DRunNumber; fCdelete++;}
00052   
00053   //if (fCnaParHistos  != 0){delete fCnaParHistos;  fCdelete++;}
00054   //if (fCnaParPaths   != 0){delete fCnaParPaths;   fCdelete++;}
00055   //if (fCnaParCout    != 0){delete fCnaParCout;    fCdelete++;}
00056   //if (fCnaWrite      != 0){delete fCnaWrite;      fCdelete++;}
00057   //if (fEcal          != 0){delete fEcal;          fCdelete++;}
00058   //if (fEcalNumbering != 0){delete fEcalNumbering; fCdelete++;}
00059 
00060   //if (fMyRootFile     != 0){delete fMyRootFile;     fCdelete++;}
00061   //if (fReadHistoDummy != 0){delete fReadHistoDummy; fCdelete++;}
00062 
00063 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00064 
00065   if ( fCnew != fCdelete )
00066     {
00067       cout << "*TEcnaHistos> WRONG MANAGEMENT OF ALLOCATIONS: fCnew = "
00068            << fCnew << ", fCdelete = " << fCdelete << fTTBELL << endl;
00069     }
00070   else
00071     {
00072      //  cout << "*TEcnaHistos> BRAVO! GOOD MANAGEMENT OF ALLOCATIONS: fCnew = "
00073      //       << fCnew << ", fCdelete = " << fCdelete << endl;
00074     }
00075 
00076 #define MGRA
00077 #ifndef MGRA
00078   if ( fCnewRoot != fCdeleteRoot )
00079     {
00080       cout << "*TEcnaHistos> WRONG MANAGEMENT OF ROOT ALLOCATIONS: fCnewRoot = "
00081            << fCnewRoot << ", fCdeleteRoot = " << fCdeleteRoot << endl;
00082     }
00083   else
00084     {
00085       cout << "*TEcnaHistos> BRAVO! GOOD MANAGEMENT OF ROOT ALLOCATIONS:"
00086            << " fCnewRoot = " << fCnewRoot <<", fCdeleteRoot = "
00087            << fCdeleteRoot << endl;
00088     }
00089 #endif // MGRA
00090 
00091   // cout << "TEcnaHistos> Leaving destructor" << endl;
00092   // cout << "            fCnew = " << fCnew << ", fCdelete = " << fCdelete << endl;
00093 
00094  // cout << "[Info Management] CLASS: TEcnaHistos.        DESTROY OBJECT: this = " << this << endl;
00095 
00096 }
00097 
00098 //===================================================================
00099 //
00100 //                   Constructors 
00101 //
00102 //===================================================================
00103 TEcnaHistos::TEcnaHistos(){
00104 // Constructor without argument. Call to Init() 
00105 
00106  // cout << "[Info Management] CLASS: TEcnaHistos.        CREATE OBJECT: this = " << this << endl;
00107 
00108   Init();
00109 }
00110 
00111 TEcnaHistos::TEcnaHistos(TEcnaObject* pObjectManager, const TString SubDet)
00112 {
00113  // cout << "[Info Management] CLASS: TEcnaHistos.        CREATE OBJECT: this = " << this << endl;
00114 
00115 
00116   Long_t i_this = (Long_t)this;
00117   pObjectManager->RegisterPointer("TEcnaHistos", i_this);
00118 
00119   Init();
00120 
00121   //----------------------- Object management
00122 
00123   //............................ fCnaParCout
00124   fCnaParCout = 0;
00125   Long_t iCnaParCout = pObjectManager->GetPointerValue("TEcnaParCout");
00126   if( iCnaParCout == 0 )
00127     {fCnaParCout = new TEcnaParCout(pObjectManager); /*fCnew++*/}
00128   else
00129     {fCnaParCout = (TEcnaParCout*)iCnaParCout;}
00130 
00131   //............................ fCnaParPaths
00132   fCnaParPaths = 0;
00133   Long_t iCnaParPaths = pObjectManager->GetPointerValue("TEcnaParPaths");
00134   if( iCnaParPaths == 0 )
00135     {fCnaParPaths = new TEcnaParPaths(pObjectManager); /*fCnew++*/}
00136   else
00137     {fCnaParPaths = (TEcnaParPaths*)iCnaParPaths;}
00138 
00139   fCfgResultsRootFilePath    = fCnaParPaths->ResultsRootFilePath();
00140   fCfgHistoryRunListFilePath = fCnaParPaths->HistoryRunListFilePath();
00141 
00142   //............................ fEcal  => to be changed in fParEcal
00143   fEcal = 0;
00144   Long_t iParEcal = pObjectManager->GetPointerValue("TEcnaParEcal");
00145   if( iParEcal == 0 )
00146     {fEcal = new TEcnaParEcal(pObjectManager, SubDet.Data()); /*fCnew++*/}
00147   else
00148     {fEcal = (TEcnaParEcal*)iParEcal;}
00149 
00150   //............................ fEcalNumbering
00151   fEcalNumbering = 0;
00152   Long_t iEcalNumbering = pObjectManager->GetPointerValue("TEcnaNumbering");
00153   if( iEcalNumbering == 0 )
00154     {fEcalNumbering = new TEcnaNumbering(pObjectManager, SubDet.Data()); /*fCnew++*/}
00155   else
00156     {fEcalNumbering = (TEcnaNumbering*)iEcalNumbering;}
00157 
00158   //............................ fCnaParHistos
00159   fCnaParHistos = 0;
00160   Long_t iCnaParHistos = pObjectManager->GetPointerValue("TEcnaParHistos");
00161   if( iCnaParHistos == 0 )
00162     {fCnaParHistos = new TEcnaParHistos(pObjectManager, SubDet.Data()); /*fCnew++*/}
00163   else
00164     {fCnaParHistos = (TEcnaParHistos*)iCnaParHistos;}
00165 
00166   //............................ fCnaWrite
00167   fCnaWrite = 0;
00168   Long_t iCnaWrite = pObjectManager->GetPointerValue("TEcnaWrite");
00169   if( iCnaWrite == 0 )
00170     {fCnaWrite = new TEcnaWrite(pObjectManager, SubDet.Data()); /*fCnew++*/}
00171   else
00172     {fCnaWrite = (TEcnaWrite*)iCnaWrite;}
00173 
00174   //............................ fMyRootFile
00175   fMyRootFile = 0;
00176   Long_t iMyRootFile = pObjectManager->GetPointerValue("TEcnaRead");
00177   if( iMyRootFile == 0 )
00178     {fMyRootFile = new TEcnaRead(pObjectManager, SubDet.Data()); /*fCnew++*/}
00179   else
00180     {fMyRootFile = (TEcnaRead*)iMyRootFile;}
00181 
00182   fMyRootFile->PrintNoComment();
00183 
00184   //------------------- creation objet TEcnaRead fMyRootFile (a reprendre plus clairement)
00185   //fFileHeader = 0;
00186   //fMyRootFile = new TEcnaRead(fFlagSubDet.Data(), fCnaParPaths, fCnaParCout,
00187   //                          fFileHeader, fEcalNumbering, fCnaWrite);           fCnew++;
00188   //fMyRootFile->PrintNoComment();
00189 
00190 
00191   SetEcalSubDetector(SubDet.Data());
00192   //......... init ymin,ymax histos -> Default values for Ymin and Ymax
00193   SetAllYminYmaxMemoFromDefaultValues();
00194 }
00195 
00196 
00197 void TEcnaHistos::Init()
00198 {
00199 //========================= GENERAL INITIALISATION 
00200   fCnew        = 0;
00201   fCdelete     = 0;
00202   fCnewRoot    = 0;
00203   fCdeleteRoot = 0;
00204 
00205   fCnaCommand  = 0;
00206   fCnaError    = 0;
00207 
00208   fgMaxCar = 512;
00209   Int_t MaxCar = fgMaxCar;
00210 
00211   //------------------------------ initialisations ----------------------
00212   fTTBELL = '\007';
00213 
00214   fT1DRunNumber = 0;
00215 
00216   //.......... init flags Same plot
00217   fMemoPlotH1SamePlus = 0;
00218   fMemoPlotD_NOE_ChNb = 0; fMemoPlotD_NOE_ChDs = 0;
00219   fMemoPlotD_Ped_ChNb = 0; fMemoPlotD_Ped_ChDs = 0;
00220   fMemoPlotD_TNo_ChNb = 0; fMemoPlotD_TNo_ChDs = 0; 
00221   fMemoPlotD_MCs_ChNb = 0; fMemoPlotD_MCs_ChDs = 0;
00222   fMemoPlotD_LFN_ChNb = 0; fMemoPlotD_LFN_ChDs = 0; 
00223   fMemoPlotD_HFN_ChNb = 0; fMemoPlotD_HFN_ChDs = 0; 
00224   fMemoPlotD_SCs_ChNb = 0; fMemoPlotD_SCs_ChDs = 0; 
00225   fMemoPlotD_MSp_SpNb = 0; fMemoPlotD_SSp_SpNb = 0; 
00226   fMemoPlotD_MSp_SpDs = 0; fMemoPlotD_SSp_SpDs = 0;
00227   fMemoPlotD_Adc_EvDs = 0; fMemoPlotD_Adc_EvNb = 0;
00228   fMemoPlotH_Ped_Date = 0; fMemoPlotH_TNo_Date = 0;
00229   fMemoPlotH_MCs_Date = 0; fMemoPlotH_LFN_Date = 0;
00230   fMemoPlotH_HFN_Date = 0; fMemoPlotH_SCs_Date = 0;
00231   fMemoPlotH_Ped_RuDs = 0; fMemoPlotH_TNo_RuDs = 0;
00232   fMemoPlotH_MCs_RuDs = 0; fMemoPlotH_LFN_RuDs = 0;
00233   fMemoPlotH_HFN_RuDs = 0; fMemoPlotH_SCs_RuDs = 0;
00234   //.......... init flags colors                                       (Init)
00235   fMemoColorH1SamePlus = 0;
00236   fMemoColorD_NOE_ChNb = 0; fMemoColorD_NOE_ChDs = 0;
00237   fMemoColorD_Ped_ChNb = 0; fMemoColorD_Ped_ChDs = 0;
00238   fMemoColorD_TNo_ChNb = 0; fMemoColorD_TNo_ChDs = 0; 
00239   fMemoColorD_MCs_ChNb = 0; fMemoColorD_MCs_ChDs = 0;
00240   fMemoColorD_LFN_ChNb = 0; fMemoColorD_LFN_ChDs = 0; 
00241   fMemoColorD_HFN_ChNb = 0; fMemoColorD_HFN_ChDs = 0; 
00242   fMemoColorD_SCs_ChNb = 0; fMemoColorD_SCs_ChDs = 0; 
00243   fMemoColorD_MSp_SpNb = 0; fMemoColorD_SSp_SpNb = 0; 
00244   fMemoColorD_MSp_SpDs = 0; fMemoColorD_SSp_SpDs = 0;
00245   fMemoColorD_Adc_EvDs = 0; fMemoColorD_Adc_EvNb = 0;
00246   fMemoColorH_Ped_Date = 0; fMemoColorH_TNo_Date = 0;
00247   fMemoColorH_MCs_Date = 0; fMemoColorH_LFN_Date = 0;
00248   fMemoColorH_HFN_Date = 0; fMemoColorH_SCs_Date = 0;
00249   fMemoColorH_Ped_RuDs = 0; fMemoColorH_TNo_RuDs = 0;
00250   fMemoColorH_MCs_RuDs = 0; fMemoColorH_LFN_RuDs = 0;
00251   fMemoColorH_HFN_RuDs = 0; fMemoColorH_SCs_RuDs = 0;
00252 
00253   //.......... init counter Same canvas
00254   fCanvSameH1SamePlus = 0;
00255   fCanvSameD_NOE_ChNb = 0; fCanvSameD_NOE_ChDs = 0;
00256   fCanvSameD_Ped_ChNb = 0; fCanvSameD_Ped_ChDs = 0;
00257   fCanvSameD_TNo_ChNb = 0; fCanvSameD_TNo_ChDs = 0; 
00258   fCanvSameD_MCs_ChNb = 0; fCanvSameD_MCs_ChDs = 0;
00259   fCanvSameD_LFN_ChNb = 0; fCanvSameD_LFN_ChDs = 0; 
00260   fCanvSameD_HFN_ChNb = 0; fCanvSameD_HFN_ChDs = 0; 
00261   fCanvSameD_SCs_ChNb = 0; fCanvSameD_SCs_ChDs = 0; 
00262   fCanvSameD_MSp_SpNb = 0; fCanvSameD_SSp_SpNb = 0;
00263   fCanvSameD_MSp_SpDs = 0; fCanvSameD_SSp_SpDs = 0;
00264   fCanvSameD_Adc_EvDs = 0; fCanvSameD_Adc_EvNb = 0;
00265   fCanvSameH_Ped_Date = 0; fCanvSameH_TNo_Date = 0;
00266   fCanvSameH_MCs_Date = 0; fCanvSameH_LFN_Date = 0;
00267   fCanvSameH_HFN_Date = 0; fCanvSameH_SCs_Date = 0;
00268   fCanvSameH_Ped_RuDs = 0; fCanvSameH_TNo_RuDs = 0;
00269   fCanvSameH_MCs_RuDs = 0; fCanvSameH_LFN_RuDs = 0;
00270   fCanvSameH_HFN_RuDs = 0; fCanvSameH_SCs_RuDs = 0;
00271   //................. Flag Scale X anf Y set to "LIN" and flag color palete set to "Black/Red/Blue"
00272 
00273   MaxCar = fgMaxCar;
00274   fFlagScaleX.Resize(MaxCar);
00275   fFlagScaleX = "LIN";
00276 
00277   MaxCar = fgMaxCar;                                     //   (Init)
00278   fFlagScaleY.Resize(MaxCar);
00279   fFlagScaleY = "LIN";
00280 
00281   MaxCar = fgMaxCar;
00282   fFlagColPal.Resize(MaxCar);
00283   fFlagColPal = "Black/Red/Blue";
00284 
00285   //................. Flag General Title set to empty string
00286   MaxCar = fgMaxCar;
00287   fFlagGeneralTitle.Resize(MaxCar);
00288   fFlagGeneralTitle = "";
00289 
00290   //................. Init codes Options
00291   fOptScaleLinx = 31400;
00292   fOptScaleLogx = 31401;
00293   fOptScaleLiny = 31402;
00294   fOptScaleLogy = 31403;
00295 
00296   fOptVisLine = 1101; 
00297   fOptVisPolm = 1102;
00298 
00299   //............................                                       (Init)
00300   MaxCar = fgMaxCar;
00301   fCovarianceMatrix.Resize(MaxCar);
00302   fCovarianceMatrix = "Cov";
00303   MaxCar = fgMaxCar;
00304   fCorrelationMatrix.Resize(MaxCar);
00305   fCorrelationMatrix = "Cor";
00306 
00307   MaxCar = fgMaxCar;
00308   fLFBetweenStins.Resize(MaxCar);
00309   fLFBetweenStins = "MttLF";
00310   MaxCar = fgMaxCar;
00311   fHFBetweenStins.Resize(MaxCar);
00312   fHFBetweenStins = "MttHF";
00313 
00314   MaxCar = fgMaxCar;
00315   fLFBetweenChannels.Resize(MaxCar);
00316   fLFBetweenChannels = "MccLF";
00317   MaxCar = fgMaxCar;
00318   fHFBetweenChannels.Resize(MaxCar);
00319   fHFBetweenChannels = "MccHF";
00320 
00321   MaxCar = fgMaxCar;
00322   fBetweenSamples.Resize(MaxCar);
00323   fBetweenSamples = "Mss";
00324 
00325   //.................................. text pave alignement for pave "SeveralChanging" (HistimePlot)
00326   fTextPaveAlign  = 12;              // 1 = left adjusted, 2 = vertically centered
00327   fTextPaveFont   = 100;             // 10*10 = 10*(ID10 = Courier New)
00328   fTextPaveSize   = (Float_t)0.025;  // 0.0xxx = xxx% of the pave size
00329   fTextBorderSize = 1;               // Pave Border (=>Shadow)
00330 
00331   //................................. Init Xvar, Yvar, NbBins management for options SAME and SAME n
00332   fXMemoH1SamePlus = "";
00333   fXMemoD_NOE_ChNb = "";
00334   fXMemoD_NOE_ChDs = "";
00335   fXMemoD_Ped_ChNb = "";
00336   fXMemoD_Ped_ChDs = "";
00337   fXMemoD_TNo_ChNb = "";   
00338   fXMemoD_TNo_ChDs = ""; 
00339   fXMemoD_MCs_ChNb = ""; 
00340   fXMemoD_MCs_ChDs = "";
00341   fXMemoD_LFN_ChNb = "";
00342   fXMemoD_LFN_ChDs = ""; 
00343   fXMemoD_HFN_ChNb = "";   
00344   fXMemoD_HFN_ChDs = ""; 
00345   fXMemoD_SCs_ChNb = ""; 
00346   fXMemoD_SCs_ChDs = ""; 
00347   fXMemoD_MSp_SpNb = "";
00348   fXMemoD_MSp_SpDs = "";
00349   fXMemoD_SSp_SpNb = "";  
00350   fXMemoD_SSp_SpDs = "";  
00351   fXMemoD_Adc_EvDs = "";     
00352   fXMemoD_Adc_EvNb = "";
00353   fXMemoH_Ped_Date = "";
00354   fXMemoH_TNo_Date = "";
00355   fXMemoH_MCs_Date = "";
00356   fXMemoH_LFN_Date = "";
00357   fXMemoH_HFN_Date = "";
00358   fXMemoH_SCs_Date = "";
00359   fXMemoH_Ped_RuDs = "";
00360   fXMemoH_TNo_RuDs = "";
00361   fXMemoH_MCs_RuDs = "";
00362   fXMemoH_LFN_RuDs = "";
00363   fXMemoH_HFN_RuDs = "";
00364   fXMemoH_SCs_RuDs = "";
00365 
00366   fYMemoH1SamePlus = "";
00367   fYMemoD_NOE_ChNb = "";
00368   fYMemoD_NOE_ChDs = "";
00369   fYMemoD_Ped_ChNb = "";
00370   fYMemoD_Ped_ChDs = "";
00371   fYMemoD_TNo_ChNb = "";
00372   fYMemoD_TNo_ChDs = "";
00373   fYMemoD_MCs_ChNb = "";
00374   fYMemoD_MCs_ChDs = "";
00375   fYMemoD_LFN_ChNb = "";
00376   fYMemoD_LFN_ChDs = "";
00377   fYMemoD_HFN_ChNb = "";
00378   fYMemoD_HFN_ChDs = "";
00379   fYMemoD_SCs_ChNb = "";
00380   fYMemoD_SCs_ChDs = "";
00381   fYMemoD_MSp_SpNb = "";
00382   fYMemoD_MSp_SpDs = "";
00383   fYMemoD_SSp_SpNb = ""; 
00384   fYMemoD_SSp_SpDs = "";  
00385   fYMemoD_Adc_EvDs = "";     
00386   fYMemoD_Adc_EvNb = "";
00387   fYMemoH_Ped_Date = "";
00388   fYMemoH_TNo_Date = "";
00389   fYMemoH_MCs_Date = "";
00390   fYMemoH_LFN_Date = "";
00391   fYMemoH_HFN_Date = "";
00392   fYMemoH_SCs_Date = "";
00393   fYMemoH_Ped_RuDs = "";
00394   fYMemoH_TNo_RuDs = "";
00395   fYMemoH_MCs_RuDs = "";
00396   fYMemoH_LFN_RuDs = "";
00397   fYMemoH_HFN_RuDs = "";
00398   fYMemoH_SCs_RuDs = "";
00399 
00400   fNbBinsMemoH1SamePlus = 0;
00401   fNbBinsMemoD_NOE_ChNb = 0;
00402   fNbBinsMemoD_NOE_ChDs = 0;
00403   fNbBinsMemoD_Ped_ChNb = 0;
00404   fNbBinsMemoD_Ped_ChDs = 0;
00405   fNbBinsMemoD_TNo_ChNb = 0;   
00406   fNbBinsMemoD_TNo_ChDs = 0; 
00407   fNbBinsMemoD_MCs_ChNb = 0; 
00408   fNbBinsMemoD_MCs_ChDs = 0;
00409   fNbBinsMemoD_LFN_ChNb = 0;
00410   fNbBinsMemoD_LFN_ChDs = 0; 
00411   fNbBinsMemoD_HFN_ChNb = 0;   
00412   fNbBinsMemoD_HFN_ChDs = 0; 
00413   fNbBinsMemoD_SCs_ChNb = 0; 
00414   fNbBinsMemoD_SCs_ChDs = 0; 
00415   fNbBinsMemoD_MSp_SpNb = 0; 
00416   fNbBinsMemoD_MSp_SpDs = 0;
00417   fNbBinsMemoD_SSp_SpNb = 0; 
00418   fNbBinsMemoD_SSp_SpDs = 0;  
00419   fNbBinsMemoD_Adc_EvDs = 0;     
00420   fNbBinsMemoD_Adc_EvNb = 0;
00421   fNbBinsMemoH_Ped_Date = 0;
00422   fNbBinsMemoH_TNo_Date = 0;
00423   fNbBinsMemoH_MCs_Date = 0;
00424   fNbBinsMemoH_LFN_Date = 0;
00425   fNbBinsMemoH_HFN_Date = 0;
00426   fNbBinsMemoH_SCs_Date = 0;
00427   fNbBinsMemoH_Ped_RuDs = 0;
00428   fNbBinsMemoH_TNo_RuDs = 0;
00429   fNbBinsMemoH_MCs_RuDs = 0;
00430   fNbBinsMemoH_LFN_RuDs = 0;
00431   fNbBinsMemoH_HFN_RuDs = 0;
00432   fNbBinsMemoH_SCs_RuDs = 0;
00433 
00434   //.................................. Init canvas/pad pointers                (Init)
00435   fCurrentCanvas         = 0;
00436 
00437   fCurrentCanvasName     = "?";
00438 
00439   fCanvH1SamePlus = 0; 
00440   fCanvD_NOE_ChNb = 0;
00441   fCanvD_NOE_ChDs = 0;
00442   fCanvD_Ped_ChNb = 0;
00443   fCanvD_Ped_ChDs = 0;
00444   fCanvD_TNo_ChNb = 0;   
00445   fCanvD_TNo_ChDs = 0; 
00446   fCanvD_MCs_ChNb = 0; 
00447   fCanvD_MCs_ChDs = 0;
00448   fCanvD_LFN_ChNb = 0;
00449   fCanvD_LFN_ChDs = 0; 
00450   fCanvD_HFN_ChNb = 0;   
00451   fCanvD_HFN_ChDs = 0; 
00452   fCanvD_SCs_ChNb = 0; 
00453   fCanvD_SCs_ChDs = 0; 
00454   fCanvD_MSp_SpNb = 0; 
00455   fCanvD_MSp_SpDs = 0;
00456   fCanvD_SSp_SpNb = 0;
00457   fCanvD_SSp_SpDs = 0;  
00458   fCanvD_Adc_EvDs = 0;     
00459   fCanvD_Adc_EvNb = 0;
00460   fCanvH_Ped_Date = 0;
00461   fCanvH_TNo_Date = 0;
00462   fCanvH_MCs_Date = 0;
00463   fCanvH_LFN_Date = 0;
00464   fCanvH_HFN_Date = 0;
00465   fCanvH_SCs_Date = 0;
00466   fCanvH_Ped_RuDs = 0;
00467   fCanvH_TNo_RuDs = 0;
00468   fCanvH_MCs_RuDs = 0;
00469   fCanvH_LFN_RuDs = 0;
00470   fCanvH_HFN_RuDs = 0;
00471   fCanvH_SCs_RuDs = 0;
00472   
00473 
00474   fClosedH1SamePlus = kFALSE;    // (Canvas Closed SIGNAL)
00475   fClosedD_NOE_ChNb = kFALSE;
00476   fClosedD_NOE_ChDs = kFALSE;
00477   fClosedD_Ped_ChNb = kFALSE;
00478   fClosedD_Ped_ChDs = kFALSE;
00479   fClosedD_TNo_ChNb = kFALSE; 
00480   fClosedD_TNo_ChDs = kFALSE; 
00481   fClosedD_MCs_ChNb = kFALSE; 
00482   fClosedD_MCs_ChDs = kFALSE;
00483   fClosedD_LFN_ChNb = kFALSE;
00484   fClosedD_LFN_ChDs = kFALSE; 
00485   fClosedD_HFN_ChNb = kFALSE; 
00486   fClosedD_HFN_ChDs = kFALSE; 
00487   fClosedD_SCs_ChNb = kFALSE; 
00488   fClosedD_SCs_ChDs = kFALSE; 
00489   fClosedD_MSp_SpNb = kFALSE; 
00490   fClosedD_MSp_SpDs = kFALSE;
00491   fClosedD_SSp_SpNb = kFALSE;
00492   fClosedD_SSp_SpDs = kFALSE;  
00493   fClosedD_Adc_EvDs = kFALSE;   
00494   fClosedD_Adc_EvNb = kFALSE;
00495   fClosedH_Ped_Date = kFALSE;
00496   fClosedH_TNo_Date = kFALSE;
00497   fClosedH_MCs_Date = kFALSE;
00498   fClosedH_LFN_Date = kFALSE;
00499   fClosedH_HFN_Date = kFALSE;
00500   fClosedH_SCs_Date = kFALSE;
00501   fClosedH_Ped_RuDs = kFALSE;
00502   fClosedH_TNo_RuDs = kFALSE;
00503   fClosedH_MCs_RuDs = kFALSE;
00504   fClosedH_LFN_RuDs = kFALSE;
00505   fClosedH_HFN_RuDs = kFALSE;
00506   fClosedH_SCs_RuDs = kFALSE;
00507 
00508   fCurrentPad = 0;                                    //   (Init)
00509 
00510   fPadH1SamePlus = 0;
00511   fPadD_NOE_ChNb = 0;
00512   fPadD_NOE_ChDs = 0;
00513   fPadD_Ped_ChNb = 0;
00514   fPadD_Ped_ChDs = 0;
00515   fPadD_TNo_ChNb = 0;   
00516   fPadD_TNo_ChDs = 0; 
00517   fPadD_MCs_ChNb = 0; 
00518   fPadD_MCs_ChDs = 0;
00519   fPadD_LFN_ChNb = 0;
00520   fPadD_LFN_ChDs = 0; 
00521   fPadD_HFN_ChNb = 0;   
00522   fPadD_HFN_ChDs = 0; 
00523   fPadD_SCs_ChNb = 0; 
00524   fPadD_SCs_ChDs = 0; 
00525   fPadD_MSp_SpNb = 0;
00526   fPadD_MSp_SpDs = 0;
00527   fPadD_SSp_SpNb = 0;
00528   fPadD_SSp_SpDs = 0;
00529   fPadD_Adc_EvDs = 0;
00530   fPadD_Adc_EvNb = 0;
00531   fPadH_Ped_Date = 0;
00532   fPadH_TNo_Date = 0;
00533   fPadH_MCs_Date = 0;
00534   fPadH_LFN_Date = 0;
00535   fPadH_HFN_Date = 0;
00536   fPadH_SCs_Date = 0;
00537   fPadH_Ped_RuDs = 0;
00538   fPadH_TNo_RuDs = 0;
00539   fPadH_MCs_RuDs = 0;
00540   fPadH_LFN_RuDs = 0;
00541   fPadH_HFN_RuDs = 0;
00542   fPadH_SCs_RuDs = 0;
00543 
00544   fPavTxtH1SamePlus = 0;                                    //   (Init)
00545   fPavTxtD_NOE_ChNb = 0;
00546   fPavTxtD_NOE_ChDs = 0;
00547   fPavTxtD_Ped_ChNb = 0;
00548   fPavTxtD_Ped_ChDs = 0;
00549   fPavTxtD_TNo_ChNb = 0;   
00550   fPavTxtD_TNo_ChDs = 0; 
00551   fPavTxtD_MCs_ChNb = 0; 
00552   fPavTxtD_MCs_ChDs = 0;
00553   fPavTxtD_LFN_ChNb = 0;
00554   fPavTxtD_LFN_ChDs = 0; 
00555   fPavTxtD_HFN_ChNb = 0;   
00556   fPavTxtD_HFN_ChDs = 0; 
00557   fPavTxtD_SCs_ChNb = 0; 
00558   fPavTxtD_SCs_ChDs = 0; 
00559   fPavTxtD_MSp_SpNb = 0; 
00560   fPavTxtD_MSp_SpDs = 0;
00561   fPavTxtD_SSp_SpNb = 0;
00562   fPavTxtD_SSp_SpDs = 0;
00563   fPavTxtD_Adc_EvDs = 0;
00564   fPavTxtD_Adc_EvNb = 0;
00565   fPavTxtH_Ped_Date = 0;
00566   fPavTxtH_TNo_Date = 0;
00567   fPavTxtH_MCs_Date = 0;
00568   fPavTxtH_LFN_Date = 0;
00569   fPavTxtH_HFN_Date = 0;
00570   fPavTxtH_SCs_Date = 0;
00571   fPavTxtH_Ped_RuDs = 0;
00572   fPavTxtH_TNo_RuDs = 0;
00573   fPavTxtH_MCs_RuDs = 0;
00574   fPavTxtH_LFN_RuDs = 0;
00575   fPavTxtH_HFN_RuDs = 0;
00576   fPavTxtH_SCs_RuDs = 0;
00577 
00578   fImpH1SamePlus = 0;                                    //   (Init)
00579   fImpD_NOE_ChNb = 0;
00580   fImpD_NOE_ChDs = 0;
00581   fImpD_Ped_ChNb = 0;
00582   fImpD_Ped_ChDs = 0;
00583   fImpD_TNo_ChNb = 0;   
00584   fImpD_TNo_ChDs = 0; 
00585   fImpD_MCs_ChNb = 0; 
00586   fImpD_MCs_ChDs = 0;
00587   fImpD_LFN_ChNb = 0;
00588   fImpD_LFN_ChDs = 0; 
00589   fImpD_HFN_ChNb = 0;   
00590   fImpD_HFN_ChDs = 0; 
00591   fImpD_SCs_ChNb = 0; 
00592   fImpD_SCs_ChDs = 0; 
00593   fImpD_MSp_SpNb = 0; 
00594   fImpD_MSp_SpDs = 0;
00595   fImpD_SSp_SpNb = 0; 
00596   fImpD_SSp_SpDs = 0;  
00597   fImpD_Adc_EvDs = 0;     
00598   fImpD_Adc_EvNb = 0;
00599   fImpH_Ped_Date = 0;
00600   fImpH_TNo_Date = 0;
00601   fImpH_MCs_Date = 0;
00602   fImpH_LFN_Date = 0;
00603   fImpH_HFN_Date = 0;
00604   fImpH_SCs_Date = 0;
00605   fImpH_Ped_RuDs = 0;
00606   fImpH_TNo_RuDs = 0;
00607   fImpH_MCs_RuDs = 0;
00608   fImpH_LFN_RuDs = 0;
00609   fImpH_HFN_RuDs = 0;
00610   fImpH_SCs_RuDs = 0;
00611 
00612   fNbBinsProj = 100;       // number of bins for histos in option Projection
00613 
00614   //.................................... Miscellaneous parameters                (Init)
00615 
00616   fNbOfListFileH_Ped_Date = 0;
00617   fNbOfListFileH_TNo_Date = 0;
00618   fNbOfListFileH_MCs_Date = 0;
00619   fNbOfListFileH_LFN_Date = 0;
00620   fNbOfListFileH_HFN_Date = 0;
00621   fNbOfListFileH_SCs_Date = 0;
00622 
00623   fNbOfListFileH_Ped_RuDs = 0;
00624   fNbOfListFileH_TNo_RuDs = 0;
00625   fNbOfListFileH_MCs_RuDs = 0;
00626   fNbOfListFileH_LFN_RuDs = 0;
00627   fNbOfListFileH_HFN_RuDs = 0;
00628   fNbOfListFileH_SCs_RuDs = 0;
00629 
00630   fNbOfExistingRuns = 0;
00631 
00632   fFapNbOfRuns    = -1;      // INIT NUMBER OF RUNS: set to -1
00633   fFapMaxNbOfRuns = -1;      // INIT MAXIMUM NUMBER OF RUNS: set to -1 
00634 
00635   MaxCar = fgMaxCar;
00636   fFapFileRuns.Resize(MaxCar);
00637   fFapFileRuns = "(file with list of runs parameters: no info)";
00638 
00639   fStartEvolTime = 0;
00640   fStopEvolTime  = 0;
00641   fStartEvolDate = "Start date: not known";
00642   fStopEvolDate  = "Stop date:  not known";
00643 
00644   fStartEvolRun  = 0;
00645   fStopEvolRun   = 0;
00646 
00647   fRunType       = "Run type: not known";
00648 
00649   fFapNbOfEvts = 0;
00650 
00651   MaxCar = fgMaxCar;
00652   fMyRootFileName.Resize(MaxCar);
00653   fMyRootFileName = "No ROOT file name available (fMyRootFileName).";
00654 
00655   fFapAnaType           = "Analysis name: not known"; // Init Type of analysis
00656   fFapNbOfSamples       = 0; // Init Nb of required samples
00657   fFapRunNumber         = 0; // Init Run number
00658   fFapFirstReqEvtNumber = 0; // Init First requested event number
00659   fFapLastReqEvtNumber  = 0; // Init Last requested event number
00660   fFapReqNbOfEvts       = 0; // Init Requested number of events
00661   fFapStexNumber        = 0; // Init Stex number
00662 
00663   //------------------ Init read file flags
00664   fAlreadyRead = 1;
00665   fMemoAlreadyRead = 0;
00666   fTobeRead = 0;
00667   fZerv    =   0;
00668   fUnev    =   1;
00669   TVectorD fReadHistoDummy(fUnev);
00670   TMatrixD fReadMatrixDummy(fUnev, fUnev);
00671 
00672   //------------------ Init fAsciiFileName
00673   fAsciiFileName = "?";
00674 
00675 } // end of Init()
00676 
00677 //----------------------------------------------------------------------------------------
00678 void TEcnaHistos::SetEcalSubDetector(const TString SubDet)
00679 {
00680  // Set Subdetector (EB or EE)
00681 
00682   Int_t MaxCar = fgMaxCar;
00683   fFlagSubDet.Resize(MaxCar);
00684   fFlagSubDet = fEcal->GetEcalSubDetector();      // fFlagSubDet = "EB" or "EE"
00685 
00686   //.................................. Init specific EB/EE parameters ( SetEcalSubDetector(...) )
00687   MaxCar = fgMaxCar;
00688   fFapStexName.Resize(MaxCar);
00689   fFapStexName = "no info for Stex";
00690   MaxCar = fgMaxCar;
00691   fFapStinName.Resize(MaxCar);
00692   fFapStinName = "no info for Stin";
00693   MaxCar = fgMaxCar;
00694   fFapXtalName.Resize(MaxCar);
00695   fFapXtalName = "no info for Xtal";
00696   MaxCar = fgMaxCar;
00697   fFapEchaName.Resize(MaxCar);
00698   fFapEchaName = "no info for Echa";
00699 
00700   if( fFlagSubDet == "EB" )
00701     {
00702       fFapStexName   = "SM";
00703       fFapStinName   = "Tower";
00704       fFapXtalName   = "Xtal";
00705       fFapEchaName   = "Chan";
00706       fFapStexBarrel = fEcalNumbering->GetSMHalfBarrel(fFapStexNumber);
00707     }
00708 
00709   if( fFlagSubDet == "EE" )
00710     {
00711       fFapStexName     = "Dee";
00712       fFapStinName     = "SC";
00713       fFapXtalName     = "Xtal";
00714       fFapEchaName     = "Chan";
00715       fFapStexType     = fEcalNumbering->GetEEDeeType(fFapStexNumber);
00716       fFapStexDir      = "right";
00717       fFapStinQuadType = "top";
00718     }
00719 
00720   //........................ init code plot type                     (SetEcalSubDetector)
00721   MaxCar = fgMaxCar;
00722   fOnlyOnePlot.Resize(MaxCar);
00723   fOnlyOnePlot = fCnaParHistos->GetCodeOnlyOnePlot();  // "ONLYONE"
00724 
00725   MaxCar = fgMaxCar;
00726   fSeveralPlot.Resize(MaxCar);
00727   fSeveralPlot = fCnaParHistos->GetCodeSeveralPlot();  // "SEVERAL"
00728 
00729   MaxCar = fgMaxCar;
00730   fSameOnePlot.Resize(MaxCar);
00731   fSameOnePlot = fCnaParHistos->GetCodeSameOnePlot();  // "SAME n";
00732 
00733   MaxCar = fgMaxCar;
00734   fAllXtalsInStinPlot.Resize(MaxCar);
00735   fAllXtalsInStinPlot = fCnaParHistos->GetCodeAllXtalsInStinPlot();  // "SAME in Stin";
00736 
00737   fPlotAllXtalsInStin = fCnaParHistos->GetCodePlotAllXtalsInStin();  //  0
00738 
00739 } // ---------------- end of  SetEcalSubDetector(...) ----------------
00740 
00741 //--------------------------------------------------------------------------------------------
00742 //
00743 //          FileParameters(s)(...) 
00744 //
00745 //--------------------------------------------------------------------------------------------
00746 
00747 //===> DON'T SUPPRESS: THESE METHODS ARE CALLED BY TEcnaGui and can be called by any other program
00748 void TEcnaHistos::FileParameters(const TString xArgAnaType,          const Int_t&  xArgNbOfSamples, 
00749                                  const Int_t&  xArgRunNumber,        const Int_t&  xArgFirstReqEvtNumber,
00750                                  const Int_t&  xArgLastReqEvtNumber, const Int_t&  xArgReqNbOfEvts, 
00751                                  const Int_t&  xArgStexNumber)
00752 {
00753 // Set parameters for reading the right ECNA results file
00754 
00755   fFapAnaType           = xArgAnaType;
00756   fFapNbOfSamples       = xArgNbOfSamples;
00757   fFapRunNumber         = xArgRunNumber;
00758   fFapFirstReqEvtNumber = xArgFirstReqEvtNumber;
00759   fFapLastReqEvtNumber  = xArgLastReqEvtNumber;
00760   fFapReqNbOfEvts       = xArgReqNbOfEvts;
00761   fFapStexNumber        = xArgStexNumber;
00762 
00763   InitSpecParBeforeFileReading();   // SpecPar = Special Parameters (dates, times, run types)
00764 }
00765 
00766 void TEcnaHistos::FileParameters(TEcnaRead* MyRootFile)
00767 {
00768 // Set parameters for reading the right ECNA results file
00769 
00770   InitSpecParBeforeFileReading();   // SpecPar = Special Parameters (dates, times, run types)
00771 
00772   //............... Filename parameter values
00773   fFapAnaType           = MyRootFile->GetAnalysisName();
00774   fFapNbOfSamples       = MyRootFile->GetNbOfSamples();
00775   fFapRunNumber         = MyRootFile->GetRunNumber();
00776   fFapFirstReqEvtNumber = MyRootFile->GetFirstReqEvtNumber();
00777   fFapLastReqEvtNumber  = MyRootFile->GetLastReqEvtNumber();
00778   fFapReqNbOfEvts       = MyRootFile->GetReqNbOfEvts();
00779   fFapStexNumber        = MyRootFile->GetStexNumber();
00780 
00781   //............... parameter values from file contents
00782   fStartDate = MyRootFile->GetStartDate();
00783   fStopDate  = MyRootFile->GetStopDate();
00784   fRunType   = MyRootFile->GetRunType();
00785 
00786   fFapNbOfEvts = MyRootFile->GetNumberOfEvents(fFapReqNbOfEvts, fFapStexNumber);
00787 }
00788 
00789 //=============================================================================================
00790 //                 Set general title
00791 //                 Set lin or log scale on X or Y axis
00792 //                 Set color palette
00793 //                 Set start and stop date
00794 //                 Set run type
00795 //=============================================================================================
00796 //............................................................................................ 
00797 void TEcnaHistos::GeneralTitle(const TString title)
00798 {
00799   fFlagGeneralTitle = title.Data();
00800 }
00801 void TEcnaHistos::SetHistoScaleX(const TString  option_scale)
00802 {
00803   fFlagScaleX = "LIN";
00804   if ( option_scale == "LOG" ){fFlagScaleX = "LOG";}
00805 }
00806 void TEcnaHistos::SetHistoScaleY(const TString  option_scale)
00807 {
00808   fFlagScaleY = "LIN";
00809   if ( option_scale == "LOG" ){fFlagScaleY = "LOG";}
00810 }
00811 void TEcnaHistos::SetHistoColorPalette (const TString  option_palette)
00812 {
00813   fFlagColPal = "Black/Red/Blue";
00814   if ( !(option_palette == "Rainbow" || option_palette == "rainbow") ){fFlagColPal = "Black/Red/Blue";}
00815   if (   option_palette == "Rainbow" || option_palette == "rainbow"  ){fFlagColPal = "Rainbow";}
00816 }
00817 void TEcnaHistos::StartStopDate(const TString start_date, const TString stop_date)
00818 {
00819   fStartDate = start_date.Data();
00820   fStopDate  = stop_date.Data();
00821 }
00822 void TEcnaHistos::RunType(const TString run_type)
00823 {
00824   fRunType = run_type.Data();
00825 }
00826 void TEcnaHistos::NumberOfEvents(const Int_t& nb_of_evts)
00827 {
00828   fFapNbOfEvts = nb_of_evts;
00829 }
00830 //====================== return status for root file and data existence
00831 Bool_t TEcnaHistos::StatusFileFound(){return fStatusFileFound;}
00832 Bool_t TEcnaHistos::StatusDataExist(){return fStatusDataExist;}
00833 
00834 //=======================================================================================
00835 //
00836 //                       ( R e a d A n d ) P l o t    (1D , 2D , History)
00837 //
00838 //=======================================================================================
00839 //---------------------------------------------------------------------------------------------
00840 // TechHistoCode list modification (06/10/09)
00841 //
00842 //    D = Detector Plot    ChNb = Channel Number
00843 //                         ChDs = Channel Distribution (Y projection)
00844 //
00845 //    H = History  Plot    Date = date in format YYMMJJ hhmmss
00846 //                         RuDs = Run distribution
00847 //
00848 //      old code             new code    std code X  std code Y   (std = standard)
00849 //                     
00850 // *  1 H1NbOfEvtsGlobal     D_NOE_ChNb   Xtal        NOE            NOE = Number Of Events
00851 // *  2 H1NbOfEvtsProj       D_NOE_ChDs   NOE         NOX            NOX = Number Of Xtals
00852 // *  3 H1EvEvGlobal         D_Ped_ChNb   Xtal        Ped            Ped = Pedestal
00853 // *  4 H1EvEvProj           D_Ped_ChDs   Ped         NOX
00854 // *  5 H1EvSigGlobal        D_TNo_ChNb   Xtal        TNo            TNo = Total Noise
00855 // *  6 H1EvSigProj          D_TNo_ChDs   TNo         NOX
00856 // *  7 H1SigEvGlobal        D_LFN_ChNb   Xtal        LFN            LFN = Low Frequency noise
00857 // *  8 H1SigEvProj          D_LFN_ChDs   LFN         NOX
00858 // *  9 H1SigSigGlobal       D_HFN_ChNb   Xtal        HFN            HFN = High Frequency noise
00859 // * 10 H1SigSigProj         D_HFN_ChDs   HFN         NOX
00860 // * 11 H1EvCorssGlobal      D_MCs_ChNb   Xtal        MCs            MCs = Mean correlations between samples
00861 // * 12 H1EvCorssProj        D_MCs_ChDs   MCs         NOX
00862 // * 13 H1SigCorssGlobal     D_SCs_ChNb   Xtal        SCs            SCs = Sigma of the correlations between samples
00863 // * 14 H1SigCorssProj       D_SCs_ChDs   SCs         NOX
00864 // * 15 Ev                   D_MSp_SpNb   Sample      MSp            MSp = Means  of the samples
00865 // * 16 EvProj               D_MSp_SpDs   MSp         NOS            NOS = Number of samples
00866 // * 17 Sigma                D_SSp_SpNb   Sample      SSp            SSp = Sigmas of the samples
00867 // * 18 SigmaProj            D_SSp_SpDs   SSp         NOS 
00868 // * 19 SampTime             D_Adc_EvNb   Event       Adc            Adc = ADC count as a function of Event number
00869 // * 20 AdcProj              D_Adc_EvDs   Adc         NOE            EvDs = Event distribution
00870 // * 21 EvolEvEv             H_Ped_Date   Time        Ped            Time = date YY/MM/DD hh:mm:ss
00871 // * 22 EvolEvEvProj         H_Ped_RuDs   Ped         NOR            NOR  = Number Of Runs
00872 // * 23 EvolEvSig            H_TNo_Date   Time        TNo
00873 // * 24 EvolEvSigProj        H_TNo_RuDs   TNo         NOR
00874 // * 25 EvolSigEv            H_LFN_Date   Time        LFN
00875 // * 26 EvolSigEvProj        H_LFN_RuDs   LFN         NOR
00876 // * 27 EvolSigSig           H_HFN_Date   Time        HFN
00877 // * 28 EvolSigSigProj       H_HFN_RuDs   HFN         NOR
00878 // * 29 EvolEvCorss          H_MCs_Date   Time        MCs
00879 // * 30 EvolEvCorssProj      H_MCs_RuDs   MCs         NOR
00880 // * 31 EvolSigCorss         H_SCs_Date   Time        SCs
00881 // * 32 EvolSigCorssProj     H_SCs_RuDs   SCs         NOR
00882 //
00883 //---------------------------------------------------------------------------------------------
00884 
00885 //---------------------------------------------------------------------------------------
00886 //
00887 //                              (ReadAnd)PlotMatrix
00888 //
00889 //---------------------------------------------------------------------------------------
00890 //................................ Corcc[for 1 Stex] (big matrix), Cortt[for 1 Stex]
00891 void TEcnaHistos::PlotMatrix(const TMatrixD& read_matrix_corcc,
00892                              const TString   UserCorOrCov, const TString UserBetweenWhat)
00893 {PlotMatrix(read_matrix_corcc, UserCorOrCov, UserBetweenWhat, "");}
00894 
00895 void TEcnaHistos::PlotMatrix(const TMatrixD& read_matrix_corcc,
00896                              const TString   UserCorOrCov, const TString UserBetweenWhat,
00897                              const TString   UserPlotOption)
00898 {
00899   TString CallingMethod = "2D";
00900 
00901   TString StandardPlotOption = fCnaParHistos->BuildStandardPlotOption(CallingMethod, UserPlotOption); 
00902 
00903   TString BetweenWhat = fCnaParHistos->BuildStandardBetweenWhatCode(CallingMethod, UserBetweenWhat);
00904   TString CorOrCov = fCnaParHistos->BuildStandardCovOrCorCode(CallingMethod, UserCorOrCov);
00905   
00906   if( BetweenWhat != "?" && CorOrCov != "?" )
00907     {
00908       if( BetweenWhat == "MttLF" ||  BetweenWhat == "MttHF" )
00909         {
00910           fAlreadyRead = 1;
00911           ViewMatrix(read_matrix_corcc, fAlreadyRead,
00912                      fZerv, fZerv, fZerv, CorOrCov, BetweenWhat, StandardPlotOption); 
00913         }
00914       if( BetweenWhat == "MccLF" ){StexHocoVecoLHFCorcc("LF");} // forced to Read file and Plot
00915       if( BetweenWhat == "MccHF" ){StexHocoVecoLHFCorcc("HF");} // forced to Read file and Plot
00916     }
00917   else
00918     {fFlagUserHistoMin = "OFF"; fFlagUserHistoMax = "OFF";
00919       cout << "!TEcnaHistos::PlotMatrix(...)> Histo cannot be reached." << fTTBELL << endl;}
00920 }
00921 
00922 void TEcnaHistos::PlotMatrix(const TString UserCorOrCov, const TString UserBetweenWhat)
00923 {PlotMatrix(UserCorOrCov, UserBetweenWhat, "");}
00924 
00925 void TEcnaHistos::PlotMatrix(const TString UserCorOrCov, const TString UserBetweenWhat,
00926                              const TString UserPlotOption)
00927 {
00928   TString CallingMethod = "2D";
00929 
00930   TString StandardPlotOption = fCnaParHistos->BuildStandardPlotOption(CallingMethod, UserPlotOption); 
00931 
00932   TString BetweenWhat = fCnaParHistos->BuildStandardBetweenWhatCode(CallingMethod, UserBetweenWhat);
00933   TString CorOrCov = fCnaParHistos->BuildStandardCovOrCorCode(CallingMethod, UserCorOrCov);
00934 
00935   if( BetweenWhat != "?" && CorOrCov != "?" )
00936     {
00937       if( BetweenWhat == "MttLF" ||  BetweenWhat == "MttHF" )
00938         {
00939           ViewMatrix(fReadMatrixDummy, fTobeRead,
00940                      fZerv, fZerv, fZerv, CorOrCov, BetweenWhat, StandardPlotOption);
00941         }
00942       if( BetweenWhat == "MccLF" ){StexHocoVecoLHFCorcc("LF");} // Plot  only
00943       if( BetweenWhat == "MccHF" ){StexHocoVecoLHFCorcc("HF");} // Plot  only
00944     }
00945   else
00946     {fFlagUserHistoMin = "OFF"; fFlagUserHistoMax = "OFF";
00947       cout << "!TEcnaHistos::PlotMatrix(...)> Histo cannot be reached." << fTTBELL << endl;}
00948 }
00949 
00950 //....................................... Corcc for channels (cStexStin_A, cStexStin_B)
00951 //                                        Corss, Covss for one channel (-> i0StinEcha)
00952 void TEcnaHistos::PlotMatrix(const TMatrixD& read_matrix,
00953                              const TString   UserCorOrCov, const TString UserBetweenWhat,
00954                              const Int_t&    arg_n1,       const Int_t& arg_n2)
00955 {PlotMatrix(read_matrix, UserCorOrCov, UserBetweenWhat, arg_n1, arg_n2, "");}
00956 
00957 void TEcnaHistos::PlotMatrix(const TMatrixD& read_matrix,
00958                              const TString   UserCorOrCov, const TString UserBetweenWhat,
00959                              const Int_t&    arg_n1,       const Int_t& arg_n2,
00960                              const TString   UserPlotOption)
00961 {
00962   TString CallingMethod = "2D";
00963 
00964   TString StandardPlotOption = fCnaParHistos->BuildStandardPlotOption(CallingMethod, UserPlotOption); 
00965 
00966   TString BetweenWhat = fCnaParHistos->BuildStandardBetweenWhatCode(CallingMethod, UserBetweenWhat);
00967   TString CorOrCov    = fCnaParHistos->BuildStandardCovOrCorCode(CallingMethod, UserCorOrCov);
00968 
00969   if( BetweenWhat != "?" && CorOrCov != "?" )
00970     {
00971       if( BetweenWhat == "MccLF" || BetweenWhat == "MccHF" )
00972         {
00973           Int_t cStexStin_A = arg_n1;
00974           Int_t cStexStin_B = arg_n2;
00975           fAlreadyRead = 1;
00976           ViewMatrix(read_matrix, fAlreadyRead,
00977                      cStexStin_A, cStexStin_B, fZerv, CorOrCov, BetweenWhat, StandardPlotOption); 
00978         }
00979       
00980       if( BetweenWhat == "Mss" )
00981         {
00982           Int_t n1StexStin = arg_n1;
00983           Int_t i0StinEcha = arg_n2; 
00984           if( fFlagSubDet == "EE" ){n1StexStin = fEcalNumbering->Get1DeeSCEcnaFromDeeSCCons(fFapStexNumber, arg_n1);}
00985           fAlreadyRead = 1;
00986           ViewMatrix(read_matrix, fAlreadyRead,
00987                      n1StexStin, fZerv,  i0StinEcha, CorOrCov, BetweenWhat, StandardPlotOption); 
00988         }
00989     }
00990   else
00991     {fFlagUserHistoMin = "OFF"; fFlagUserHistoMax = "OFF";
00992       cout << "!TEcnaHistos::PlotMatrix(...)> Histo cannot be reached." << fTTBELL << endl;}
00993 }
00994 
00995 void TEcnaHistos::PlotMatrix(const TString UserCorOrCov, const TString UserBetweenWhat,
00996                              const Int_t&  arg_n1,       const Int_t&  arg_n2)
00997 {PlotMatrix(UserCorOrCov, UserBetweenWhat, arg_n1, arg_n2, "");}
00998 
00999 void TEcnaHistos::PlotMatrix(const TString UserCorOrCov, const TString UserBetweenWhat,
01000                              const Int_t&  arg_n1,       const Int_t&  arg_n2,
01001                              const TString UserPlotOption)
01002 {
01003   TString CallingMethod = "2D";
01004 
01005   TString StandardPlotOption = fCnaParHistos->BuildStandardPlotOption(CallingMethod, UserPlotOption); 
01006 
01007   TString StandardBetweenWhat = fCnaParHistos->BuildStandardBetweenWhatCode(CallingMethod, UserBetweenWhat);
01008   TString StandardCorOrCov = fCnaParHistos->BuildStandardCovOrCorCode(CallingMethod, UserCorOrCov);
01009 
01010   if( StandardBetweenWhat != "?" && StandardCorOrCov != "?" )
01011     {
01012       if( StandardBetweenWhat == "MccLF" ||  StandardBetweenWhat == "MccHF" )
01013         {
01014           Int_t cStexStin_A = arg_n1;
01015           Int_t cStexStin_B = arg_n2;
01016           ViewMatrix(fReadMatrixDummy, fTobeRead,
01017                      cStexStin_A, cStexStin_B, fZerv, StandardCorOrCov, StandardBetweenWhat, StandardPlotOption); 
01018         }
01019       
01020       if( StandardBetweenWhat == "Mss" )
01021         {
01022           Int_t n1StexStin = arg_n1;
01023           Int_t i0StinEcha = arg_n2;
01024           if( fFlagSubDet == "EE" ){n1StexStin = fEcalNumbering->Get1DeeSCEcnaFromDeeSCCons(fFapStexNumber, arg_n1);}
01025           
01026           ViewMatrix(fReadMatrixDummy,  fTobeRead,
01027                      n1StexStin, fZerv, i0StinEcha, StandardCorOrCov, StandardBetweenWhat, StandardPlotOption); 
01028         }
01029     }
01030   else
01031     {fFlagUserHistoMin = "OFF"; fFlagUserHistoMax = "OFF";
01032       cout << "!TEcnaHistos::PlotMatrix(...)> Histo cannot be reached." << fTTBELL << endl;}
01033 }
01034 
01035 //---------------------------------------------------------------------------------------
01036 //
01037 //                              (ReadAnd)PlotDetector
01038 //
01039 //---------------------------------------------------------------------------------------
01040 //.................................... 2D plots for Stex OR Stas
01041 void TEcnaHistos::PlotDetector(const TString UserHistoCode, const TString UserDetector)
01042 {
01043   TString CallingMethod = "2DS";
01044 
01045   TString StandardHistoCode = fCnaParHistos->BuildStandard1DHistoCodeY(CallingMethod, UserHistoCode);
01046   if( StandardHistoCode != "?" )
01047     {
01048       TString TechHistoCode = fCnaParHistos->GetTechHistoCode(StandardHistoCode);
01049       TString StandardDetectorCode = fCnaParHistos->BuildStandardDetectorCode(UserDetector);
01050       if( StandardDetectorCode != "?" )
01051         {
01052           //if( StandardDetectorCode == "SM" || StandardDetectorCode == "EB" )
01053           //  {fEcal->SetEcalSubDetector("EB");}
01054           //if( StandardDetectorCode == "Dee" || StandardDetectorCode == "EE" )
01055           //  {fEcal->SetEcalSubDetector("EE");}
01056 
01057           if( StandardDetectorCode == "SM" || StandardDetectorCode == "Dee" )
01058             {ViewStex(fReadHistoDummy, fTobeRead, TechHistoCode);}
01059           if( StandardDetectorCode == "EB" || StandardDetectorCode == "EE"  )
01060             {ViewStas(fReadHistoDummy, fTobeRead, TechHistoCode);}
01061         }
01062       else
01063         {fFlagUserHistoMin = "OFF"; fFlagUserHistoMax = "OFF";
01064           cout << "!TEcnaHistos::PlotDetector(...)> Histo cannot be reached." << fTTBELL << endl;}
01065     }
01066   else
01067     {fFlagUserHistoMin = "OFF"; fFlagUserHistoMax = "OFF";
01068       cout << "!TEcnaHistos::PlotDetector(...)> Histo cannot be reached." << fTTBELL << endl;}
01069 }
01070 
01071 void TEcnaHistos::PlotDetector(const TVectorD& read_histo, const TString UserHistoCode, const TString UserDetector)
01072 {
01073   TString CallingMethod = "2DS";
01074 
01075   TString StandardHistoCode = fCnaParHistos->BuildStandard1DHistoCodeY(CallingMethod, UserHistoCode);
01076   if( StandardHistoCode != "?" )
01077     {
01078       TString TechHistoCode = fCnaParHistos->GetTechHistoCode(StandardHistoCode);
01079       TString StandardDetectorCode = fCnaParHistos->BuildStandardDetectorCode(UserDetector);
01080       if( StandardDetectorCode != "?" )
01081         {
01082           fAlreadyRead = 1;
01083 
01084           //if( StandardDetectorCode == "SM" || StandardDetectorCode == "EB" )
01085           //  {fEcal->SetEcalSubDetector("EB");}
01086           //if( StandardDetectorCode == "Dee" || StandardDetectorCode == "EE" )
01087           //  {fEcal->SetEcalSubDetector("EE");}
01088 
01089           if( StandardDetectorCode == "SM" || StandardDetectorCode == "Dee" )
01090             {ViewStex(read_histo, fAlreadyRead, TechHistoCode);}
01091           if( StandardDetectorCode == "EB" || StandardDetectorCode == "EE"  )
01092             {ViewStas(read_histo, fAlreadyRead, TechHistoCode);}
01093         }
01094       else
01095         {fFlagUserHistoMin = "OFF"; fFlagUserHistoMax = "OFF";
01096           cout << "!TEcnaHistos::PlotDetector(...)> Histo cannot be reached." << fTTBELL << endl;}
01097     }
01098   else
01099     {fFlagUserHistoMin = "OFF"; fFlagUserHistoMax = "OFF";
01100       cout << "!TEcnaHistos::PlotDetector(...)> Histo cannot be reached." << fTTBELL << endl;}
01101 }
01102 
01103 //---------------------------------------------------------------------------------------
01104 //
01105 //                              (ReadAnd)Plot1DHisto
01106 //
01107 //---------------------------------------------------------------------------------------
01108 void TEcnaHistos::Plot1DHisto(const TVectorD& InputHisto,
01109                               const TString   User_X_Quantity, const TString User_Y_Quantity,
01110                               const TString   UserDetector)
01111 {Plot1DHisto(InputHisto, User_X_Quantity, User_Y_Quantity, UserDetector, "");}
01112 
01113 void TEcnaHistos::Plot1DHisto(const TVectorD& InputHisto,
01114                               const TString   User_X_Quantity, const TString User_Y_Quantity,
01115                               const TString   UserDetector,
01116                               const TString   UserPlotOption)
01117 {
01118   TString CallingMethod = "1D";
01119 
01120   TString StandardPlotOption = fCnaParHistos->BuildStandardPlotOption(CallingMethod, UserPlotOption); 
01121 
01122   TString Standard_X_Quantity = fCnaParHistos->BuildStandard1DHistoCodeX(CallingMethod, User_X_Quantity);
01123   TString Standard_Y_Quantity = fCnaParHistos->BuildStandard1DHistoCodeY(CallingMethod, User_Y_Quantity);
01124   
01125   if( Standard_X_Quantity != "?" && Standard_Y_Quantity != "?" )
01126     {  
01127       TString TechHistoCode = fCnaParHistos->GetTechHistoCode(Standard_X_Quantity, Standard_Y_Quantity);
01128       if( fAlreadyRead > 1 ){fAlreadyRead = 1;}
01129       TString StandardDetectorCode = fCnaParHistos->BuildStandardDetectorCode(UserDetector);
01130       if( StandardDetectorCode != "?" )
01131         {
01132           if( StandardDetectorCode == "EB" || StandardDetectorCode == "EE" ){fFapStexNumber = 0;}
01133           ViewHisto(InputHisto, fAlreadyRead, fZerv, fZerv, fZerv, TechHistoCode, StandardPlotOption);
01134         }
01135       else
01136         {fFlagUserHistoMin = "OFF"; fFlagUserHistoMax = "OFF";
01137           cout << "!TEcnaHistos::Plot1DHisto(...)> Histo cannot be reached." << fTTBELL << endl;}
01138     }
01139   else
01140     {fFlagUserHistoMin = "OFF"; fFlagUserHistoMax = "OFF";
01141       cout << "!TEcnaHistos::Plot1DHisto(...)> Histo cannot be reached." << fTTBELL << endl;}
01142 }
01143 
01144 void TEcnaHistos::Plot1DHisto(const TString User_X_Quantity, const TString User_Y_Quantity,
01145                               const TString UserDetector)
01146 {Plot1DHisto(User_X_Quantity, User_Y_Quantity, UserDetector, "");}
01147 
01148 void TEcnaHistos::Plot1DHisto(const TString User_X_Quantity, const TString User_Y_Quantity,
01149                               const TString UserDetector,    const TString UserPlotOption)
01150 {
01151   TString CallingMethod = "1D";
01152 
01153   TString StandardPlotOption = fCnaParHistos->BuildStandardPlotOption(CallingMethod, UserPlotOption); 
01154 
01155   TString Standard_X_Quantity = fCnaParHistos->BuildStandard1DHistoCodeX(CallingMethod, User_X_Quantity);
01156   TString Standard_Y_Quantity = fCnaParHistos->BuildStandard1DHistoCodeY(CallingMethod, User_Y_Quantity);
01157   
01158   if( Standard_X_Quantity != "?" && Standard_Y_Quantity != "?" )
01159     {
01160       TString TechHistoCode = fCnaParHistos->GetTechHistoCode(Standard_X_Quantity, Standard_Y_Quantity);
01161       TString StandardDetectorCode = fCnaParHistos->BuildStandardDetectorCode(UserDetector);
01162       if( StandardDetectorCode != "?" )
01163         {
01164           if( StandardDetectorCode == "EB" || StandardDetectorCode == "EE" ){fFapStexNumber = 0;}
01165           ViewHisto(fReadHistoDummy, fTobeRead, fZerv, fZerv, fZerv, TechHistoCode, StandardPlotOption);
01166         }
01167       else
01168         {fFlagUserHistoMin = "OFF"; fFlagUserHistoMax = "OFF";
01169           cout << "!TEcnaHistos::Plot1DHisto(...)> Histo cannot be reached." << fTTBELL << endl;}
01170     }
01171   else
01172     {fFlagUserHistoMin = "OFF"; fFlagUserHistoMax = "OFF";
01173       cout << "!TEcnaHistos::Plot1DHisto(...)> Histo cannot be reached." << fTTBELL << endl;}
01174 }
01175 
01176 
01177 
01178 //=> BUG SCRAM? Si on enleve la methode ci-dessous, ca passe a la compilation de test/EcnaHistosExample2.cc 
01179 //   (qui appelle cette methode) et ca se plante a l'execution (voir test/TEcnaHistosExample2.cc).
01180 #define PLUD
01181 #ifdef PLUD
01182 void TEcnaHistos::Plot1DHisto(const TVectorD& InputHisto,
01183                               const TString   User_X_Quantity, const TString User_Y_Quantity,
01184                               const Int_t&    n1StexStin)
01185 {Plot1DHisto(InputHisto, User_X_Quantity, User_Y_Quantity, n1StexStin, "");}
01186 
01187 void TEcnaHistos::Plot1DHisto(const TVectorD& InputHisto,
01188                               const TString   User_X_Quantity, const TString User_Y_Quantity,
01189                               const Int_t&    n1StexStin,   
01190                               const TString   UserPlotOption)
01191 {
01192   TString CallingMethod = "1DX";
01193   TString StandardPlotOption = fCnaParHistos->BuildStandardPlotOption(CallingMethod, UserPlotOption);
01194   Int_t i0StinEcha = 0;
01195   Plot1DHisto(InputHisto, User_X_Quantity, User_Y_Quantity, n1StexStin, i0StinEcha, StandardPlotOption);
01196 }
01197 #endif // PLUD
01198 
01199 void TEcnaHistos::Plot1DHisto(const TVectorD& InputHisto,
01200                               const TString   User_X_Quantity, const TString User_Y_Quantity,
01201                               const Int_t&    n1StexStin,      const Int_t&  i0StinEcha)
01202 {Plot1DHisto(InputHisto, User_X_Quantity, User_Y_Quantity, n1StexStin, i0StinEcha, "");}
01203 
01204 void TEcnaHistos::Plot1DHisto(const TVectorD& InputHisto,
01205                               const TString   User_X_Quantity, const TString User_Y_Quantity,
01206                               const Int_t&    n1StexStin,      const Int_t&  i0StinEcha,   
01207                               const TString   UserPlotOption)
01208 {
01209   TString CallingMethod = "1D";
01210   TString StandardPlotOption  = fCnaParHistos->BuildStandardPlotOption(CallingMethod, UserPlotOption); 
01211   TString Standard_X_Quantity = fCnaParHistos->BuildStandard1DHistoCodeX(CallingMethod, User_X_Quantity);
01212   TString Standard_Y_Quantity = fCnaParHistos->BuildStandard1DHistoCodeY(CallingMethod, User_Y_Quantity);
01213   
01214   TString TechHistoCode = fCnaParHistos->GetTechHistoCode(Standard_X_Quantity, Standard_Y_Quantity);
01215   
01216   if( Standard_X_Quantity != "?" && Standard_Y_Quantity != "?" )
01217     {
01218       fAlreadyRead = 1;
01219       if( StandardPlotOption != fAllXtalsInStinPlot )
01220         {
01221           ViewHisto(InputHisto, fAlreadyRead, n1StexStin, i0StinEcha, fZerv, TechHistoCode, StandardPlotOption);
01222         }
01223       
01224       if( StandardPlotOption == fAllXtalsInStinPlot && fAlreadyRead >= 1 && fAlreadyRead <= fEcal->MaxCrysInStin() )
01225         {
01226           if( Standard_X_Quantity == "Smp" && Standard_Y_Quantity == "MSp" )
01227             {XtalSamplesEv(InputHisto, fAlreadyRead, n1StexStin, i0StinEcha, StandardPlotOption);}
01228           if( Standard_X_Quantity == "MSp" && Standard_Y_Quantity == "NOS" )
01229             {EvSamplesXtals(InputHisto, fAlreadyRead, n1StexStin, i0StinEcha, StandardPlotOption);}
01230           if( Standard_X_Quantity == "Smp" && Standard_Y_Quantity == "SSp" )
01231             {XtalSamplesSigma(InputHisto, fAlreadyRead, n1StexStin, i0StinEcha, StandardPlotOption);}
01232           if( Standard_X_Quantity == "SSp" && Standard_Y_Quantity == "NOS" )
01233             {SigmaSamplesXtals(InputHisto, fAlreadyRead, n1StexStin, i0StinEcha, StandardPlotOption);}
01234         }   
01235     }
01236   else
01237     {fFlagUserHistoMin = "OFF"; fFlagUserHistoMax = "OFF";
01238       cout << "!TEcnaHistos::Plot1DHisto(...)> Histo cannot be reached." << fTTBELL << endl;}
01239 }
01240 
01241 void TEcnaHistos::Plot1DHisto(const TString User_X_Quantity, const TString User_Y_Quantity,
01242                               const Int_t&  n1StexStin,      const Int_t&  i0StinEcha)
01243 {Plot1DHisto(User_X_Quantity, User_Y_Quantity, n1StexStin, i0StinEcha, "");}
01244 
01245 void TEcnaHistos::Plot1DHisto(const TString User_X_Quantity, const TString User_Y_Quantity,
01246                               const Int_t&  n1StexStin,      const Int_t&  i0StinEcha,
01247                               const TString UserPlotOption)
01248 {
01249   TString CallingMethod = "1D";
01250   
01251   TString StandardPlotOption = fCnaParHistos->BuildStandardPlotOption(CallingMethod, UserPlotOption); 
01252   
01253   TString Standard_X_Quantity = fCnaParHistos->BuildStandard1DHistoCodeX(CallingMethod, User_X_Quantity);
01254   TString Standard_Y_Quantity = fCnaParHistos->BuildStandard1DHistoCodeY(CallingMethod, User_Y_Quantity);
01255   
01256   if( Standard_X_Quantity != "?" && Standard_Y_Quantity != "?" )
01257     {  
01258       if( StandardPlotOption != fAllXtalsInStinPlot )
01259         {
01260           TString TechHistoCode = fCnaParHistos->GetTechHistoCode(Standard_X_Quantity, Standard_Y_Quantity);
01261           ViewHisto(fReadHistoDummy, fTobeRead, n1StexStin, i0StinEcha, fZerv, TechHistoCode, StandardPlotOption);
01262         }
01263       if( StandardPlotOption == fAllXtalsInStinPlot && fAlreadyRead >= 1 && fAlreadyRead <= fEcal->MaxCrysInStin() )
01264         {
01265           if( Standard_X_Quantity == "Smp" && Standard_Y_Quantity == "MSp" )
01266             {XtalSamplesEv(fReadHistoDummy, fTobeRead, n1StexStin, i0StinEcha, StandardPlotOption);}
01267           if( Standard_X_Quantity == "MSp" && Standard_Y_Quantity == "NOS" )
01268             {EvSamplesXtals(fReadHistoDummy, fTobeRead, n1StexStin, i0StinEcha, StandardPlotOption);}
01269           if( Standard_X_Quantity == "Smp" && Standard_Y_Quantity == "SSp" )
01270             {XtalSamplesSigma(fReadHistoDummy, fTobeRead, n1StexStin, i0StinEcha, StandardPlotOption);}
01271           if( Standard_X_Quantity == "SSp" && Standard_Y_Quantity == "NOS" )
01272             {SigmaSamplesXtals(fReadHistoDummy, fTobeRead, n1StexStin, i0StinEcha, StandardPlotOption);}
01273         }
01274     }
01275   else
01276     {fFlagUserHistoMin = "OFF"; fFlagUserHistoMax = "OFF";
01277       cout << "!TEcnaHistos::Plot1DHisto(...)> Histo cannot be reached." << fTTBELL << endl;}
01278 }
01279 
01280 void TEcnaHistos::Plot1DHisto(const TVectorD& InputHisto,
01281                               const TString   User_X_Quantity, const TString User_Y_Quantity,
01282                               const Int_t&    n1StexStin,      const Int_t&  i0StinEcha, const Int_t& n1Sample)
01283 {Plot1DHisto(InputHisto, User_X_Quantity, User_Y_Quantity, n1StexStin, i0StinEcha, n1Sample, "");}
01284 
01285 void TEcnaHistos::Plot1DHisto(const TVectorD& InputHisto,
01286                               const TString   User_X_Quantity, const TString User_Y_Quantity,
01287                               const Int_t&    n1StexStin,      const Int_t&  i0StinEcha, const Int_t& n1Sample,  
01288                               const TString   UserPlotOption)
01289 {
01290   TString CallingMethod = "1D";
01291 
01292   TString StandardPlotOption = fCnaParHistos->BuildStandardPlotOption(CallingMethod, UserPlotOption); 
01293 
01294   TString Standard_X_Quantity = fCnaParHistos->BuildStandard1DHistoCodeX(CallingMethod, User_X_Quantity);
01295   TString Standard_Y_Quantity = fCnaParHistos->BuildStandard1DHistoCodeY(CallingMethod, User_Y_Quantity);
01296   
01297   TString TechHistoCode = fCnaParHistos->GetTechHistoCode(Standard_X_Quantity, Standard_Y_Quantity);
01298   
01299   if( Standard_X_Quantity != "?" && Standard_Y_Quantity != "?" )
01300     {
01301       Int_t i0Sample = n1Sample-1;
01302       fAlreadyRead = 1;
01303       ViewHisto(InputHisto, fAlreadyRead, n1StexStin, i0StinEcha, i0Sample, TechHistoCode, StandardPlotOption); 
01304     }
01305   else
01306     {fFlagUserHistoMin = "OFF"; fFlagUserHistoMax = "OFF";
01307       cout << "!TEcnaHistos::Plot1DHisto(...)> Histo cannot be reached." << fTTBELL << endl;}
01308 }
01309 
01310 void TEcnaHistos::Plot1DHisto(const TString User_X_Quantity, const TString User_Y_Quantity,
01311                               const Int_t&  n1StexStin,      const Int_t&  i0StinEcha, const Int_t& n1Sample)
01312 {Plot1DHisto(User_X_Quantity, User_Y_Quantity, n1StexStin, i0StinEcha, n1Sample, "");}
01313 
01314 void TEcnaHistos::Plot1DHisto(const TString User_X_Quantity, const TString User_Y_Quantity,
01315                               const Int_t&  n1StexStin,      const Int_t&  i0StinEcha, const Int_t& n1Sample,
01316                               const TString UserPlotOption)
01317 {
01318   TString CallingMethod = "1D";
01319 
01320   TString StandardPlotOption = fCnaParHistos->BuildStandardPlotOption(CallingMethod, UserPlotOption); 
01321 
01322   TString Standard_X_Quantity = fCnaParHistos->BuildStandard1DHistoCodeX(CallingMethod, User_X_Quantity);
01323   TString Standard_Y_Quantity = fCnaParHistos->BuildStandard1DHistoCodeY(CallingMethod, User_Y_Quantity);
01324   
01325   Int_t i0Sample = n1Sample-1;
01326   
01327   if( Standard_X_Quantity != "?" && Standard_Y_Quantity != "?" )
01328     {
01329       TString TechHistoCode = fCnaParHistos->GetTechHistoCode(Standard_X_Quantity, Standard_Y_Quantity);
01330       ViewHisto(fReadHistoDummy, fTobeRead, n1StexStin, i0StinEcha, i0Sample, TechHistoCode, StandardPlotOption);
01331     }
01332   else
01333     {fFlagUserHistoMin = "OFF"; fFlagUserHistoMax = "OFF";
01334       cout << "!TEcnaHistos::Plot1DHisto(...)> Histo cannot be reached." << fTTBELL << endl;}
01335 }
01336 
01337 //---------------------------------------------------------------------------------------
01338 //
01339 //                              (ReadAnd)PlotHistory
01340 //
01341 //---------------------------------------------------------------------------------------
01342 void TEcnaHistos::PlotHistory(const TString User_X_Quantity, const TString User_Y_Quantity,
01343                               const TString list_of_run_file_name,
01344                               const Int_t&  StexStin_A, const Int_t& i0StinEcha)
01345 {PlotHistory(User_X_Quantity, User_Y_Quantity, list_of_run_file_name, StexStin_A, i0StinEcha, "");}
01346 
01347 void TEcnaHistos::PlotHistory(const TString User_X_Quantity, const TString User_Y_Quantity,
01348                               const TString list_of_run_file_name,
01349                               const Int_t&  StexStin_A, const Int_t& i0StinEcha,
01350                               const TString UserPlotOption)
01351 {
01352   TString CallingMethod = "Time";
01353 
01354   TString StandardPlotOption = fCnaParHistos->BuildStandardPlotOption(CallingMethod, UserPlotOption); 
01355 
01356   TString Standard_X_Quantity = fCnaParHistos->BuildStandard1DHistoCodeX(CallingMethod, User_X_Quantity);
01357   TString Standard_Y_Quantity = fCnaParHistos->BuildStandard1DHistoCodeY(CallingMethod, User_Y_Quantity);
01358 
01359   if( Standard_X_Quantity != "?" && Standard_Y_Quantity != "?" )
01360     { 
01361       TString TechHistoCode = fCnaParHistos->GetTechHistoCode(Standard_X_Quantity, Standard_Y_Quantity);
01362       ViewHistime(list_of_run_file_name, StexStin_A, i0StinEcha, TechHistoCode, StandardPlotOption);
01363     }
01364   else
01365     {fFlagUserHistoMin = "OFF"; fFlagUserHistoMax = "OFF";
01366       cout << "!TEcnaHistos::PlotHistory(...)> Histo cannot be reached." << fTTBELL << endl;} 
01367 }
01368 
01369 //=============================================================================================
01370 //
01371 //                            " V I E W "    M E T H O D S
01372 //
01373 //=============================================================================================
01374 
01375 //=============================================================================================================
01376 //
01377 //                                       ViewMatrix(***)
01378 //     
01379 //     arg_read_matrix:   2D array
01380 //     arg_AlreadyRead:   =1 <=> use arg_read_matrix 
01381 //                        =0 <=> read the 2D array in this method with TEcnaRead
01382 //     StexStin_A:        tower  number in SM (if EB) OR SC  "ECNA" number in Dee (if EE)
01383 //     StexStin_B:        tower' number in SM (if EB) OR SC' "ECNA" number in Dee (if EE)
01384 //     MatrixBinIndex:    channel number in tower (if EB) OR in SC (if EE)
01385 //     CorOrCov:          flag CORRELATION/COVARIANCE
01386 //     BetweenWhat:       flag BETWEEN SAMPLES / BETWEEN CHANNELS / BETWEEN TOWERS / BETWEEN SCs / LF, HF, ...
01387 //     PlotOption:        ROOT 2D histos draw options (COLZ, LEGO, ...) + additional (ASCII)
01388 //
01389 //     MatrixBinIndex:  = i0StinEcha if cov(s,s'), cor(s,s')
01390 //                      = 0          if cov(c,c'), cor(c,c'), cov(Stin,Stin'), cor(Stin,Stin')
01391 //
01392 //     ViewMatrix(StexStin_A, StexStin_B, MatrixBinIndex, CorOrCov, BetweenWhat, PlotOption)
01393 //     ViewMatrix(StexStin_A,          0,     i0StinEcha, CorOrCov,       "Mss", PlotOption)      
01394 //     Output:
01395 //     Plot of cov(s,s') or cor(s,s') matrix for i0StinEcha of StexStin_A              
01396 //
01397 //     ViewMatrix(StexStin_A, StexStin_B, MatrixBinIndex, CorOrCov, BetweenWhat, PlotOption)
01398 //     ViewMatrix(StexStin_A, StexStin_B,              0, CorOrCov,       "Mcc", PlotOption)
01399 //     Output:
01400 //     Plot LF-HF Corcc matrix for Stins: (StexStin_A, StexStin_B)
01401 //
01402 //     ViewMatrix(StexStin_A, StexStin_B, MatrixBinIndex, CorOrCov, BetweenWhat, PlotOption)
01403 //     ViewMatrix(         0,          0,              0, CorOrCov,       "Mcc", PlotOption)
01404 //     Output:
01405 //     Plot of LF-HF Corcc matrix for Stex (big matrix)
01406 //
01407 //     ViewMatrix(StexStin_A, StexStin_B, MatrixBinIndex, CorOrCov, BetweenWhat, PlotOption)
01408 //     ViewMatrix(         0,          0,              0, CorOrCov,       "Mtt", PlotOption)
01409 //     Output:
01410 //     Plot of LF-HF Cortt matrix
01411 //
01412 //=============================================================================================================
01413 void TEcnaHistos::ViewMatrix(const TMatrixD& arg_read_matrix, const Int_t&  arg_AlreadyRead,
01414                              const Int_t&    StexStin_A,      const Int_t&  StexStin_B,
01415                              const Int_t&    MatrixBinIndex,  const TString CorOrCov,
01416                              const TString   BetweenWhat,     const TString PlotOption)
01417 {
01418   //Plot correlation or covariance matrix between samples or channels or Stins
01419 
01420   if( (fFapStexNumber > 0) &&  (fFapStexNumber <= fEcal->MaxStexInStas()) )
01421     {
01422       Bool_t OKArray = kFALSE;
01423       Bool_t OKData  = kFALSE;
01424       TVectorD vStin(fEcal->MaxStinEcnaInStex());
01425 
01426       if( arg_AlreadyRead == fTobeRead )
01427         {
01428           fMyRootFile->PrintNoComment();
01429           fMyRootFile->FileParameters(fFapAnaType,          fFapNbOfSamples,
01430                                       fFapRunNumber,        fFapFirstReqEvtNumber,
01431                                       fFapLastReqEvtNumber, fFapReqNbOfEvts,
01432                                       fFapStexNumber,       fCfgResultsRootFilePath.Data());
01433           OKArray = fMyRootFile->LookAtRootFile();
01434           if( OKArray == kTRUE )
01435             {
01436               fFapNbOfEvts = fMyRootFile->GetNumberOfEvents(fFapReqNbOfEvts, fFapStexNumber);
01437               TString fp_name_short = fMyRootFile->GetRootFileNameShort();
01438               // cout << "*TEcnaHistos::ViewMatrix(...)> Data are analyzed from file ----> "
01439               //      << fp_name_short << endl;
01440               //...................................................................... (ViewMatrix) 
01441               for(Int_t i=0; i<fEcal->MaxStinEcnaInStex(); i++){vStin(i)=(Double_t)0.;}
01442               vStin = fMyRootFile->ReadStinNumbers(fEcal->MaxStinEcnaInStex());
01443 
01444               fStartDate = fMyRootFile->GetStartDate();
01445               fStopDate  = fMyRootFile->GetStopDate();
01446               fRunType   = fMyRootFile->GetRunType();
01447 
01448               if( fMyRootFile->DataExist() == kTRUE ){OKData = kTRUE;}
01449             }
01450 
01451         }
01452       if( arg_AlreadyRead >= 1 )
01453         {
01454           OKArray = kTRUE;
01455           OKData  = kTRUE;
01456           if( fFlagSubDet == "EB") 
01457             {
01458               for(Int_t i=0; i<fEcal->MaxStinEcnaInStex(); i++){vStin(i)=i;}
01459             }
01460           if( fFlagSubDet == "EE") 
01461             {
01462               for(Int_t i=0; i<fEcal->MaxStinEcnaInStex(); i++)
01463                 {vStin(i)= fEcalNumbering->GetDeeSCConsFrom1DeeSCEcna(fFapStexNumber, (Int_t)vStin(i));}
01464             }
01465         }
01466 
01467       if ( OKArray == kTRUE )                         //  (ViewMatrix) 
01468         {
01469           fStatusFileFound = kTRUE;
01470       
01471           if( OKData == kTRUE )
01472             {
01473               fStatusDataExist = kTRUE;
01474 
01475               Int_t Stin_X_ok = 0;
01476               Int_t Stin_Y_ok = 0;
01477           
01478               if( (BetweenWhat == fLFBetweenStins) || (BetweenWhat == fHFBetweenStins) )
01479                 {Stin_X_ok = 1; Stin_Y_ok = 1;}
01480               if( BetweenWhat == fBetweenSamples )
01481                 {Stin_Y_ok = 1;}
01482           
01483               for (Int_t index_Stin = 0; index_Stin < fEcal->MaxStinEcnaInStex(); index_Stin++)
01484                 {
01485                   if ( vStin(index_Stin) == StexStin_A ){Stin_X_ok = 1;}
01486                   if ( vStin(index_Stin) == StexStin_B ){Stin_Y_ok = 1;}
01487                 }
01488               //................................................................. (ViewMatrix)
01489               if( Stin_X_ok == 1 && Stin_Y_ok == 1 )
01490                 {
01491                   Int_t MatSize      = -1; 
01492                   Int_t ReadMatSize  = -1; 
01493                   Int_t i0StinEcha   = -1;
01494               
01495                   //-------------------------- Set values of ReadMatSize, MatSize, i0StinEcha
01496                   if( BetweenWhat == fBetweenSamples )
01497                     {ReadMatSize = fFapNbOfSamples; MatSize = fEcal->MaxSampADC(); i0StinEcha=(Int_t)MatrixBinIndex;}
01498 
01499                   if( BetweenWhat == fLFBetweenChannels || BetweenWhat == fHFBetweenChannels )
01500                     {ReadMatSize = fEcal->MaxCrysInStin(); MatSize = fEcal->MaxCrysInStin(); /*i0Sample=MatrixBinIndex;*/}
01501 
01502                   if( (BetweenWhat == fLFBetweenStins) || (BetweenWhat == fHFBetweenStins) )
01503                     {ReadMatSize = fEcal->MaxStinEcnaInStex(); MatSize = fEcal->MaxStinInStex();}
01504  
01505                   //------------------------------------------------------------------------------------- (ViewMatrix)
01506                   if( ( BetweenWhat == fLFBetweenStins    || BetweenWhat == fHFBetweenStins    ) ||
01507                       ( BetweenWhat == fLFBetweenChannels || BetweenWhat == fHFBetweenChannels 
01508                         /* && (i0Sample  >= 0) && (i0Sample  < fFapNbOfSamples ) */ ) ||
01509                       ( (BetweenWhat == fBetweenSamples) && (i0StinEcha >= 0) && (i0StinEcha < fEcal->MaxCrysInStin()) ) )
01510                     {
01511                       TMatrixD read_matrix(ReadMatSize, ReadMatSize);
01512                       for(Int_t i=0; i-ReadMatSize<0; i++)
01513                         {for(Int_t j=0; j-ReadMatSize<0; j++){read_matrix(i,j)=(Double_t)0.;}}
01514                  
01515                       Bool_t OKData = kFALSE;
01516                       if( arg_AlreadyRead == fTobeRead )
01517                         {
01518                           if( BetweenWhat == fBetweenSamples && CorOrCov == fCovarianceMatrix )
01519                             {read_matrix =
01520                                 fMyRootFile->ReadCovariancesBetweenSamples(StexStin_A, i0StinEcha, ReadMatSize);}
01521 
01522                           if( BetweenWhat == fBetweenSamples && CorOrCov == fCorrelationMatrix )
01523                             {read_matrix =
01524                                 fMyRootFile->ReadCorrelationsBetweenSamples(StexStin_A, i0StinEcha, ReadMatSize);}
01525                           
01526                           if( BetweenWhat == fLFBetweenChannels && CorOrCov == fCovarianceMatrix )
01527                             {read_matrix =
01528                                 fMyRootFile->ReadLowFrequencyCovariancesBetweenChannels(StexStin_A, StexStin_B, ReadMatSize);}
01529 
01530                           if( BetweenWhat == fLFBetweenChannels && CorOrCov == fCorrelationMatrix )
01531                             {read_matrix =
01532                                 fMyRootFile->ReadLowFrequencyCorrelationsBetweenChannels(StexStin_A, StexStin_B, ReadMatSize);}
01533                           
01534                           if( BetweenWhat == fHFBetweenChannels && CorOrCov == fCovarianceMatrix )
01535                             {read_matrix =
01536                                 fMyRootFile->ReadHighFrequencyCovariancesBetweenChannels(StexStin_A, StexStin_B, ReadMatSize);}
01537 
01538                           if( BetweenWhat == fHFBetweenChannels && CorOrCov == fCorrelationMatrix )
01539                             {read_matrix =
01540                                 fMyRootFile->ReadHighFrequencyCorrelationsBetweenChannels(StexStin_A, StexStin_B, ReadMatSize);}
01541                           
01542                           if( BetweenWhat == fLFBetweenStins && CorOrCov == fCorrelationMatrix )
01543                             {read_matrix =
01544                                 fMyRootFile->ReadLowFrequencyMeanCorrelationsBetweenStins(ReadMatSize);}
01545 
01546                           if( BetweenWhat == fHFBetweenStins && CorOrCov == fCorrelationMatrix )
01547                             {read_matrix =
01548                                 fMyRootFile->ReadHighFrequencyMeanCorrelationsBetweenStins(ReadMatSize);
01549                             }
01550 
01551                           OKData = fMyRootFile->DataExist();
01552                         }
01553                       else
01554                         {
01555                           read_matrix = arg_read_matrix;
01556                           OKData = kTRUE;
01557                         }
01558                       //.......................................................... (ViewMatrix)
01559                       if( OKData == kTRUE )
01560                         {
01561                           fStatusDataExist = kTRUE;
01562 
01563                           if( PlotOption == "ASCII" )
01564                             {
01565                               WriteMatrixAscii(BetweenWhat, CorOrCov, 
01566                                                StexStin_A, MatrixBinIndex, ReadMatSize, read_matrix);
01567                             }
01568                           else
01569                             {
01570                               //......................... matrix title  (ViewMatrix)
01571                               char* f_in_mat_tit = new char[fgMaxCar];               fCnew++;
01572                           
01573                               if( BetweenWhat == fBetweenSamples && CorOrCov == fCovarianceMatrix )
01574                                 {sprintf(f_in_mat_tit, "Covariance(Sample, Sample')");}
01575                               if( BetweenWhat == fBetweenSamples && CorOrCov == fCorrelationMatrix )
01576                                 {sprintf(f_in_mat_tit, "Correlation(Sample, Sample')");}
01577 
01578                               if(fFlagSubDet == "EB" )
01579                                 {
01580                                   if( BetweenWhat == fLFBetweenStins && CorOrCov == fCorrelationMatrix )
01581                                     {sprintf(f_in_mat_tit,
01582                                              "Mean LF |Cor(Xtal,Xtal')| for each (Tower,Tower')");}
01583                                   if( BetweenWhat == fHFBetweenStins && CorOrCov == fCorrelationMatrix )
01584                                     {sprintf(f_in_mat_tit,
01585                                              "Mean HF |Cor(Xtal,Xtal')| for each (Tower,Tower')");}
01586                                 }
01587                               if(fFlagSubDet == "EE" )
01588                                 {
01589                                   if( BetweenWhat == fLFBetweenStins && CorOrCov == fCorrelationMatrix )
01590                                     {sprintf(f_in_mat_tit,
01591                                              "Mean LF |Cor(Xtal,Xtal')| for each (SC,SC')");}
01592                                   if( BetweenWhat == fHFBetweenStins && CorOrCov == fCorrelationMatrix )
01593                                     {sprintf(f_in_mat_tit,
01594                                              "Mean HF |Cor(Xtal,Xtal')| for each (SC,SC')");}
01595                                 }
01596 
01597                               if( BetweenWhat == fLFBetweenChannels && CorOrCov == fCorrelationMatrix )
01598                                 {
01599                                   if( fFlagSubDet == "EB" )
01600                                     {sprintf(f_in_mat_tit, "LF Cor(Xtal,Xtal') matrix elts for (Tow,Tow')");}
01601                                   if( fFlagSubDet == "EE" )
01602                                     {sprintf(f_in_mat_tit, "LF Cor(Xtal,Xtal') matrix elts for (SC,SC')");}
01603                                 }
01604                               if( BetweenWhat == fHFBetweenChannels && CorOrCov == fCorrelationMatrix )
01605                                 {
01606                                   if( fFlagSubDet == "EB" )
01607                                     {sprintf(f_in_mat_tit, "HF Cor(Xtal,Xtal') matrix elts for (Tow,Tow')");}
01608                                   if( fFlagSubDet == "EE" )
01609                                     {sprintf(f_in_mat_tit, "LF Cor(Xtal,Xtal') matrix elts for (SC,SC')");}
01610                                 }
01611                           
01612                               //................................. Axis parameters (ViewMatrix)
01613                               TString axis_x_var_name;
01614                               TString axis_y_var_name;
01615                           
01616                               char* f_in_axis_x = new char[fgMaxCar];               fCnew++;
01617                               char* f_in_axis_y = new char[fgMaxCar];               fCnew++;
01618                           
01619                               if( BetweenWhat == fLFBetweenStins || BetweenWhat == fHFBetweenStins )
01620                                 {
01621                                   if( fFlagSubDet == "EB" )
01622                                     {sprintf(f_in_axis_x, " %s number  ", fFapStinName.Data());}
01623                                   if( fFlagSubDet == "EE" )
01624                                     {sprintf(f_in_axis_x, " %s number for construction ", fFapStinName.Data());}
01625 
01626                                   axis_x_var_name = f_in_axis_x; axis_y_var_name = f_in_axis_x;
01627                                 }      
01628                               if( BetweenWhat == fBetweenSamples)
01629                                 {
01630                                   axis_x_var_name = " Sample      "; axis_y_var_name = "    Sample ";
01631                                 }
01632                               if( BetweenWhat == fLFBetweenChannels || BetweenWhat == fHFBetweenChannels ){
01633                                 sprintf(f_in_axis_x, " Crystal %s %d   ", fFapStinName.Data(), StexStin_A);
01634                                 sprintf(f_in_axis_y, " Crystal %s %d   ", fFapStinName.Data(),StexStin_B);
01635                                 axis_x_var_name = f_in_axis_x; axis_y_var_name = f_in_axis_y;}
01636                           
01637                               Int_t  nb_binx  = MatSize;
01638                               Int_t  nb_biny  = MatSize;
01639                               Axis_t xinf_bid = (Axis_t)0.;
01640                               Axis_t xsup_bid = (Axis_t)MatSize;
01641                               Axis_t yinf_bid = (Axis_t)0.;
01642                               Axis_t ysup_bid = (Axis_t)MatSize;   
01643                           
01644                               if( (fFlagSubDet == "EE") &&
01645                                   (BetweenWhat == fLFBetweenStins || BetweenWhat == fHFBetweenStins) )
01646                                 {
01647                                   if( fFapStexNumber == 1 || fFapStexNumber == 3 )
01648                                     {
01649                                       xinf_bid += fEcal->MaxStinInStex();
01650                                       xsup_bid += fEcal->MaxStinInStex();
01651                                       yinf_bid += fEcal->MaxStinInStex();
01652                                       ysup_bid += fEcal->MaxStinInStex();
01653                                     }
01654                                 }
01655                               //...................................................  histogram booking (ViewMatrix)
01656                               TH2D* h_fbid0 = new TH2D("bidim", f_in_mat_tit,
01657                                                        nb_binx, xinf_bid, xsup_bid,
01658                                                        nb_biny, yinf_bid, ysup_bid);     fCnewRoot++;
01659                               h_fbid0->Reset();
01660                           
01661                               h_fbid0->GetXaxis()->SetTitle(axis_x_var_name);
01662                               h_fbid0->GetYaxis()->SetTitle(axis_y_var_name);
01663                           
01664                               //------------------------------------------------  F I L L    H I S T O  (ViewMatrix)
01665                               if( (fFlagSubDet == "EE") &&
01666                                   (BetweenWhat == fLFBetweenStins || BetweenWhat == fHFBetweenStins) )
01667                                 {
01668                                   for(Int_t i = 0 ; i < ReadMatSize ; i++)
01669                                     {
01670                                       for(Int_t j = 0 ; j < ReadMatSize ; j++)
01671                                         {
01672                                           Int_t ip = i+1;
01673                                           Double_t xi_bid =
01674                                             (Double_t)fEcalNumbering->GetDeeSCConsFrom1DeeSCEcna(fFapStexNumber, ip);
01675                                           Int_t jp = j+1;
01676                                           Double_t xj_bid =
01677                                             (Double_t)fEcalNumbering->GetDeeSCConsFrom1DeeSCEcna(fFapStexNumber, jp);
01678                                           if( xi_bid > 0 && xj_bid > 0 )
01679                                             {
01680                                               Int_t xi_bid_m = xi_bid-1;
01681                                               Int_t xj_bid_m = xj_bid-1;
01682                                               h_fbid0->Fill(xi_bid_m, xj_bid_m, read_matrix(i,j));
01683                                             }
01684                                         }
01685                                     }
01686                                 }
01687                               else
01688                                 {
01689                                   for(Int_t i = 0 ; i - ReadMatSize < 0 ; i++)
01690                                     {
01691                                       Double_t xi = (Double_t)i;
01692                                       for(Int_t j = 0 ; j < ReadMatSize ; j++)
01693                                         {
01694                                           Double_t xj      = (Double_t)j;
01695                                           Double_t mat_val = (Double_t)read_matrix(i,j);
01696                                           h_fbid0->Fill(xi, xj, (Double_t)mat_val);
01697                                         }
01698                                     }
01699                                 }
01700                               //--------------- H I S T O   M I N / M A X   M A N A G E M E N T   (ViewMatrix)
01701                           
01702                               //................................ Put histo min max values
01703                               TString quantity_code = "D_MCs_ChNb";
01704                               if ( CorOrCov == fCorrelationMatrix )
01705                                 {
01706                                   if( BetweenWhat == fBetweenSamples ){quantity_code = "D_MCs_ChNb";}
01707 
01708                                   if( BetweenWhat == fLFBetweenChannels  ){quantity_code = "H2LFccMosMatrix";}
01709                                   if( BetweenWhat == fHFBetweenChannels ){quantity_code = "H2HFccMosMatrix";}
01710 
01711                                   if( BetweenWhat == fLFBetweenStins  ){quantity_code = "H2LFccMosMatrix";}
01712                                   if( BetweenWhat == fHFBetweenStins ){quantity_code = "H2HFccMosMatrix";}
01713                                 }
01714                               if( CorOrCov == fCovarianceMatrix ){quantity_code = "H2HFccMosMatrix";}
01715                               //.......... default if flag not set to "ON"
01716                               SetYminMemoFromValue(quantity_code, fCnaParHistos->GetYminDefaultValue(quantity_code));
01717                               SetYmaxMemoFromValue(quantity_code, fCnaParHistos->GetYmaxDefaultValue(quantity_code));
01718 
01719                               if( fUserHistoMin == fUserHistoMax ){fFlagUserHistoMin = "AUTO"; fFlagUserHistoMax = "AUTO";}
01720                               //................................. User's min and/or max  (ViewMatrix)
01721                               if( fFlagUserHistoMin == "ON" )
01722                                 {SetYminMemoFromValue(quantity_code, fUserHistoMin); fFlagUserHistoMin = "OFF";}
01723                               if( fFlagUserHistoMax == "ON" )
01724                                 {SetYmaxMemoFromValue(quantity_code, fUserHistoMax); fFlagUserHistoMax = "OFF";}
01725                               //................................. automatic min and/or max
01726                               if( fFlagUserHistoMin == "AUTO" )
01727                                 {SetYminMemoFromValue(quantity_code, h_fbid0->GetMinimum()); fFlagUserHistoMin = "OFF";}
01728                               if( fFlagUserHistoMax == "AUTO" )
01729                                 {SetYmaxMemoFromValue(quantity_code, h_fbid0->GetMaximum()); fFlagUserHistoMax = "OFF";}
01730                               //...................................... histo set ymin and ymax  (ViewMatrix)    
01731                               if( CorOrCov == fCorrelationMatrix )
01732                                 {
01733                                   if(BetweenWhat == fBetweenSamples)
01734                                     {SetHistoFrameYminYmaxFromMemo((TH1D*)h_fbid0, "D_MCs_ChNb");}
01735                                   if( BetweenWhat == fLFBetweenStins  || BetweenWhat == fLFBetweenChannels  )
01736                                     {SetHistoFrameYminYmaxFromMemo((TH1D*)h_fbid0, "H2LFccMosMatrix");}
01737                                   if( BetweenWhat == fHFBetweenStins || BetweenWhat == fHFBetweenChannels )
01738                                     {SetHistoFrameYminYmaxFromMemo((TH1D*)h_fbid0, "H2HFccMosMatrix");}
01739                                   //************************** A GARDER EN RESERVE ******************************
01740                                   //............. special contour level for correlations (square root wise scale)
01741                                   // Int_t nb_niv  = 9;
01742                                   // Double_t* cont_niv = new Double_t[nb_niv];                  fCnew++;
01743                                   // SqrtContourLevels(nb_niv, &cont_niv[0]);
01744                                   // h_fbid0->SetContour(nb_niv, &cont_niv[0]);           
01745                                   // delete [] cont_niv;                                  fCdelete++;
01746                                   //******************************** (FIN RESERVE) ****************************** 
01747                                 }
01748                               if( CorOrCov == fCovarianceMatrix )
01749                                 {
01750                                   if (BetweenWhat == fBetweenSamples)
01751                                     {SetYminMemoFromPreviousMemo("D_TNo_ChNb");   // covariance => same level as sigmas
01752                                     SetYmaxMemoFromPreviousMemo("D_TNo_ChNb");
01753                                     SetHistoFrameYminYmaxFromMemo((TH1D*)h_fbid0, "D_TNo_ChNb");}
01754                                   if ( BetweenWhat == fLFBetweenStins || BetweenWhat == fHFBetweenStins ||
01755                                        BetweenWhat == fLFBetweenChannels || BetweenWhat == fHFBetweenChannels )
01756                                     {SetHistoFrameYminYmaxFromMemo((TH1D*)h_fbid0, "H2HFccMosMatrix");}
01757                                 }
01758                           
01759                               // ----------------------------------------------- P L O T S  (ViewMatrix)
01760                               char* f_in = new char[fgMaxCar];          fCnew++;
01761                               //...................... Taille/format canvas
01762                               UInt_t canv_w = fCnaParHistos->CanvasFormatW("petit");
01763                               UInt_t canv_h = fCnaParHistos->CanvasFormatH("petit");
01764                           
01765                               //............................. options generales 
01766                               TString HistoType;
01767                               Int_t MaxCar = fgMaxCar;
01768                               HistoType.Resize(MaxCar);
01769                               HistoType = "(no quantity type info)";
01770                           
01771                               if (PlotOption == "COLZ"  ){HistoType = "colz";}
01772                               if (PlotOption == "BOX"   ){HistoType = "colz";}
01773                               if (PlotOption == "TEXT"  ){HistoType = "colz";}
01774                               if (PlotOption == "CONTZ" ){HistoType = "colz";}
01775                               if (PlotOption == "LEGO2Z"){HistoType = "lego";}
01776                               if (PlotOption == "SURF1Z"){HistoType = "surf";}
01777                               if (PlotOption == "SURF2Z"){HistoType = "surf";}
01778                               if (PlotOption == "SURF3Z"){HistoType = "surf";}
01779                               if (PlotOption == "SURF4" ){HistoType = "surf";}
01780 
01781                               if( fFlagSubDet == "EB" )
01782                                 {
01783                                   fFapStexBarrel = fEcalNumbering->GetSMHalfBarrel(fFapStexNumber);
01784                                   SetAllPavesViewMatrix(BetweenWhat.Data(), StexStin_A, StexStin_B, i0StinEcha);
01785                                 }
01786                               if( fFlagSubDet == "EE" )
01787                                 {
01788                                   fFapStexType = fEcalNumbering->GetEEDeeType(fFapStexNumber);
01789                                   fFapStinQuadType = fEcalNumbering->GetSCQuadFrom1DeeSCEcna(StexStin_A);
01790                                   SetAllPavesViewMatrix(BetweenWhat.Data(), StexStin_A, StexStin_B, i0StinEcha);
01791                                 }
01792 
01793                               //---------------------------------------- Canvas name (ViewMatrix)
01794                               TString  name_cov_cor;
01795                               MaxCar = fgMaxCar;
01796                               name_cov_cor.Resize(MaxCar);
01797                               name_cov_cor = "?";
01798                               if( CorOrCov == fCovarianceMatrix){name_cov_cor = "Covariance";}
01799                               if( CorOrCov == fCorrelationMatrix){name_cov_cor = "Correlation";}
01800                           
01801                               TString name_chan_samp;
01802                               MaxCar = fgMaxCar;
01803                               name_chan_samp.Resize(MaxCar);
01804                               name_chan_samp = "?";
01805                           
01806                               if( BetweenWhat == fLFBetweenStins ){name_chan_samp = "LFccMos";}
01807                               if( BetweenWhat == fHFBetweenStins ){name_chan_samp = "HFccMos"; }
01808 
01809                               if( BetweenWhat == fLFBetweenChannels ){name_chan_samp = "LF_cc";}
01810                               if( BetweenWhat == fHFBetweenChannels ){name_chan_samp = "HF_cc";}
01811                 
01812                               if(BetweenWhat == fBetweenSamples)
01813                                 {
01814                                   name_chan_samp = "Between_Samples";  // MatrixBinIndex = i0StinEcha
01815                                 }
01816 
01817                               TString name_visu;
01818                               MaxCar = fgMaxCar;
01819                               name_visu.Resize(MaxCar);
01820                               name_visu = "?";
01821                           
01822                               name_visu = PlotOption;
01823                           
01824                               if( (BetweenWhat == fLFBetweenStins) || (BetweenWhat == fHFBetweenStins) ){
01825                                 sprintf(f_in, "%s_%s_%s_S1_%d_R%d_%d_%d_%s%d_%s",
01826                                         name_cov_cor.Data(), name_chan_samp.Data(),
01827                                         fFapAnaType.Data(), fFapNbOfSamples, fFapRunNumber,
01828                                         fFapFirstReqEvtNumber, fFapLastReqEvtNumber,
01829                                         fFapStexName.Data(), fFapStexNumber,
01830                                         name_visu.Data());}
01831 
01832                               if( BetweenWhat == fLFBetweenChannels || BetweenWhat == fHFBetweenChannels ){
01833                                 sprintf(f_in, "%s_%s_%s_S1_%d_R%d_%d_%d_%s%d_%sX%d_%sY%d_%s",
01834                                         name_cov_cor.Data(), name_chan_samp.Data(),
01835                                         fFapAnaType.Data(), fFapNbOfSamples, fFapRunNumber,
01836                                         fFapFirstReqEvtNumber, fFapLastReqEvtNumber,
01837                                         fFapStexName.Data(), fFapStexNumber,
01838                                         fFapStexName.Data(), StexStin_A, fFapStexName.Data(), StexStin_B,
01839                                         name_visu.Data());}
01840                                                   
01841                               if( BetweenWhat == fBetweenSamples ){
01842                                 sprintf(f_in, "%s_%s_%s_S1_%d_R%d_%d_%d_%s%d_%sX%d_%sY%d_ElecChannel_%d_%s",
01843                                         name_cov_cor.Data(), name_chan_samp.Data(),
01844                                         fFapAnaType.Data(), fFapNbOfSamples, fFapRunNumber,
01845                                         fFapFirstReqEvtNumber, fFapLastReqEvtNumber,
01846                                         fFapStexName.Data(), fFapStexNumber,
01847                                         fFapStexName.Data(), StexStin_A,  fFapStexName.Data(), StexStin_B,
01848                                         MatrixBinIndex,
01849                                         name_visu.Data());}
01850                           
01851                               //----------------------------------------------------------      (ViewMatrix)
01852 
01853                               SetHistoPresentation((TH1D*)h_fbid0, HistoType);
01854                               TCanvas *MainCanvas = new TCanvas(f_in, f_in, canv_w , canv_h);   fCnewRoot++;
01855                               fCurrentCanvas = MainCanvas; fCurrentCanvasName = f_in;
01856                           
01857                               // cout << "*TEcnaHistos::ViewMatrix(...)> Plot is displayed on canvas ----> "
01858                               //      << fCurrentCanvasName << endl;
01859                               // cout << "*TEcnaHistos::ViewMatrix(...)> fCurrentCanvas = " << fCurrentCanvas << endl;
01860                           
01861                               delete [] f_in; f_in = 0;                         fCdelete++;
01862 
01863                               if( fPavComGeneralTitle != 0 ){fPavComGeneralTitle->Draw();}
01864                               fPavComStex->Draw();
01865 
01866                               if(BetweenWhat == fLFBetweenChannels || BetweenWhat == fHFBetweenChannels)
01867                                 {fPavComStin->Draw();}
01868                               if(BetweenWhat == fBetweenSamples)
01869                                 {fPavComStin->Draw(); fPavComXtal->Draw();}
01870 
01871                               fPavComAnaRun->Draw();
01872                               fPavComNbOfEvts->Draw();
01873 
01874                               Double_t x_margin = fCnaParHistos->BoxLeftX("bottom_left_box") - 0.005;
01875                               Double_t y_margin = fCnaParHistos->BoxTopY("bottom_right_box") + 0.005;
01876                               MainCanvas->Divide(1, 1, x_margin, y_margin);
01877                               gPad->cd(1);
01878 
01879                               //----------------------------------------------------------      (ViewMatrix)      
01880                               Int_t logy = 0;  
01881                               gPad->SetLogy(logy);
01882                               if( (BetweenWhat == fLFBetweenStins) ||
01883                                   (BetweenWhat == fHFBetweenStins) ){gPad->SetGrid(1,1);}
01884                               h_fbid0->DrawCopy(PlotOption);
01885                               h_fbid0->SetStats((Bool_t)1);    
01886                               gPad->Update();
01887                               h_fbid0->Delete();  h_fbid0 = 0;              fCdeleteRoot++;
01888                           
01889                               //MainCanvas->Delete();                 fCdeleteRoot++;
01890                               delete [] f_in_axis_x;  f_in_axis_x  = 0;       fCdelete++;
01891                               delete [] f_in_axis_y;  f_in_axis_y  = 0;       fCdelete++;
01892                               delete [] f_in_mat_tit; f_in_mat_tit = 0;       fCdelete++;
01893                             }
01894                         } // end of if ( OKData == kTRUE )
01895                       else
01896                         {
01897                           fStatusDataExist = kFALSE;
01898                         }
01899                     } // end of if ((BetweenWhat == fLFBetweenStins) || (BetweenWhat == fHFBetweenStins)  ) ||
01900                       //( (BetweenWhat == fBetweenSamples) && (i0StinEcha>= 0) && (i0StinEcha<fEcal->MaxCrysInStin())) ||
01901                       //( (BetweenWhat == fLFBetweenChannels || BetweenWhat == fHFBetweenChannels)
01902                       // /* && (i0Sample  >= 0) && (i0Sample  < fFapNbOfSamples ) */ ) )
01903                   else
01904                     {
01905                       if(BetweenWhat == fBetweenSamples)
01906                         {
01907                           cout << "*TEcnaHistos::ViewMatrix(...)> *ERROR* ==> Wrong channel number in "
01908                                << fFapStinName.Data() << ". Value = "
01909                                << i0StinEcha << " (required range: [0, "
01910                                << fEcal->MaxCrysInStin()-1 << "] )"
01911                                << fTTBELL << endl;
01912                         }
01913 
01914                      // if( BetweenWhat == fLFBetweenChannels || BetweenWhat == fHFBetweenChannels )
01915                      // {
01916                          // cout << "*TEcnaHistos::ViewMatrix(...)> *ERROR* ==> Wrong sample index. Value = "
01917                          //      << i0Sample << " (required range: [0, "
01918                          //      << fFapNbOfSamples-1 << "] )"
01919                          //      << fTTBELL << endl;
01920                         //}
01921                     }
01922                 }
01923               else    // else of the if ( Stin_X_ok ==1 && Stin_Y_ok ==1 )
01924                 {
01925                   //----------------------------------------------------------  (ViewMatrix)
01926                   if ( Stin_X_ok != 1 )
01927                     {
01928                       if( fFlagSubDet == "EB") 
01929                         {
01930                           cout << "*TEcnaHistos::ViewMatrix(...)> *ERROR* =====> "
01931                                << fFapStinName.Data() << " "
01932                                << StexStin_A << ", "
01933                                << fFapStinName.Data() << " not found. Available numbers = ";
01934                           for(Int_t i = 0; i < fEcal->MaxStinEcnaInStex(); i++)
01935                             {
01936                               if( vStin(i) > 0 )
01937                                 {
01938                                   cout << vStin(i) << ", ";
01939                                 }
01940                             }
01941                         }
01942 
01943                       if( fFlagSubDet == "EE") 
01944                         {
01945                           cout << "*TEcnaHistos::ViewMatrix(...)> *ERROR* =====> "
01946                                << fFapStinName.Data() << " "
01947                                << fEcalNumbering->GetDeeSCConsFrom1DeeSCEcna(fFapStexNumber, StexStin_A) << ", "
01948                                << fFapStinName.Data() << " not found. Available numbers = ";
01949                           for(Int_t i = 0; i < fEcal->MaxStinEcnaInStex(); i++)
01950                             {
01951                               if( vStin(i) > 0 )
01952                                 {
01953                                   cout << fEcalNumbering->GetDeeSCConsFrom1DeeSCEcna(fFapStexNumber, (Int_t)vStin(i)) << ", ";
01954                                 }
01955                             }
01956                         }
01957                       cout << fTTBELL << endl;
01958                     }
01959                   if ( Stin_Y_ok != 1 )
01960                     {
01961 
01962                       if( fFlagSubDet == "EB") 
01963                         {
01964                           cout << "*TEcnaHistos::ViewMatrix(...)> *ERROR* =====> "
01965                                << fFapStinName.Data() << " "
01966                                << StexStin_B << ", "
01967                                << fFapStinName.Data() << " not found. Available numbers = ";
01968                           for(Int_t i = 0; i < fEcal->MaxStinEcnaInStex(); i++)
01969                             {
01970                               if( vStin(i) > 0 )
01971                                 {
01972                                   cout << vStin(i) << ", ";
01973                                 }
01974                             }
01975                         }
01976 
01977                       if( fFlagSubDet == "EE") 
01978                         {
01979                           cout << "*TEcnaHistos::ViewMatrix(...)> *ERROR* =====> "
01980                                << fFapStinName.Data() << " "
01981                                << fEcalNumbering->GetDeeSCConsFrom1DeeSCEcna(fFapStexNumber, StexStin_B) << ", "
01982                                << fFapStinName.Data() << " not found. Available numbers = ";
01983                           for(Int_t i = 0; i < fEcal->MaxStinEcnaInStex(); i++)
01984                             {
01985                               if( vStin(i) > 0 )
01986                                 {
01987                                   cout << fEcalNumbering->GetDeeSCConsFrom1DeeSCEcna(fFapStexNumber, (Int_t)vStin(i)) << ", ";
01988                                 }
01989                             }
01990                         }     
01991                       cout << fTTBELL << endl;
01992                     }
01993                 }
01994             } // end of if ( fMyRootFile->DataExist() == kTRUE )
01995           else
01996             {
01997               fStatusDataExist = kFALSE;
01998               cout  << "!TEcnaHistos::ViewMatrix(...)> *ERROR* =====> "
01999                     << " Histo not available." << fTTBELL << endl;
02000               fFlagUserHistoMin = "OFF";
02001               fFlagUserHistoMax = "OFF";
02002             }
02003         } // end of if ( fMyRootFile->LookAtRootFile() == kTRUE )
02004       else
02005         {
02006           fStatusFileFound = kFALSE;
02007           cout  << "!TEcnaHistos::ViewMatrix(...)> *ERROR* =====> "
02008                 << " ROOT file not found" << fTTBELL << endl;
02009         }
02010     } // ---- end of if( (fFapStexNumber > 0) &&  (fFapStexNumber <= fEcal->MaxStexInStas()) ) -----
02011   else
02012     {
02013       cout << "!TEcnaHistos::ViewMatrix(...)> " << fFapStexName.Data()
02014            << " = " << fFapStexNumber << ". Out of range (range = [1,"
02015            << fEcal->MaxStexInStas() << "]) " << fTTBELL << endl;
02016     }
02017 }  // end of ViewMatrix(...)
02018 
02019 //==========================================================================
02020 //
02021 //                         ViewStin   ( => option COLZ )
02022 //   
02023 //==========================================================================
02024 
02025 void TEcnaHistos::CorrelationsBetweenSamples(const Int_t& StinNumber)
02026 {
02027   TString   CorOrCov = fCorrelationMatrix;
02028   ViewStin(StinNumber, CorOrCov);
02029 }
02030 
02031 void TEcnaHistos::CovariancesBetweenSamples(const Int_t& StinNumber)
02032 {
02033   TString   CorOrCov = fCovarianceMatrix;
02034   ViewStin(StinNumber, CorOrCov);
02035 }
02036 
02037 //==========================================================================
02038 //
02039 //                         ViewStin   ( => option COLZ )   
02040 //
02041 //  StexStin ==>
02042 //  (sample,sample) cor or cov matrices for all the crystal of StexStin              
02043 //
02044 //
02045 //==========================================================================
02046 void TEcnaHistos::ViewStin(const Int_t& cStexStin, const TString CorOrCov)
02047 {
02048   //cor(s,s') or cov(s,s') matrices for all the crystals of one given Stin. Option COLZ mandatory.
02049 
02050   // cStexStin = number for cons (in case of EE)
02051   // StexStin   = ECNA number
02052 
02053   if( (fFapStexNumber > 0) &&  fFapStexNumber <= fEcal->MaxStexInStas() )
02054     {
02055       Int_t StexStin =  cStexStin; 
02056       if(fFlagSubDet == "EE" )
02057         {StexStin = fEcalNumbering->Get1DeeSCEcnaFromDeeSCCons(fFapStexNumber, cStexStin);}
02058 
02059       fMyRootFile->PrintNoComment();
02060       fMyRootFile->FileParameters(fFapAnaType,          fFapNbOfSamples,
02061                                   fFapRunNumber,        fFapFirstReqEvtNumber,
02062                                   fFapLastReqEvtNumber, fFapReqNbOfEvts,
02063                                   fFapStexNumber,       fCfgResultsRootFilePath.Data());
02064       
02065       if ( fMyRootFile->LookAtRootFile() == kTRUE )              //  (ViewStin)
02066         {
02067           fStatusFileFound = kTRUE;
02068 
02069           fFapNbOfEvts = fMyRootFile->GetNumberOfEvents(fFapReqNbOfEvts, fFapStexNumber);
02070           TString fp_name_short = fMyRootFile->GetRootFileNameShort(); 
02071           // cout << "*TEcnaHistos::ViewStin(...)> Data are analyzed from file ----> "
02072           //      << fp_name_short << endl;
02073 
02074           TVectorD vStin(fEcal->MaxStinEcnaInStex());
02075           for(Int_t i=0; i<fEcal->MaxStinEcnaInStex(); i++){vStin(i)=(Double_t)0.;}
02076           vStin = fMyRootFile->ReadStinNumbers(fEcal->MaxStinEcnaInStex());
02077 
02078           if ( fMyRootFile->DataExist() == kTRUE )
02079             {
02080               fStatusDataExist = kTRUE;
02081 
02082               Int_t Stin_ok = 0;
02083               for (Int_t index_Stin = 0; index_Stin < fEcal->MaxStinEcnaInStex(); index_Stin++)
02084                 {
02085                   if ( vStin(index_Stin) == StexStin ){Stin_ok++;}
02086                 }
02087 
02088               if( Stin_ok == 1)
02089                 {
02090                   fStartDate = fMyRootFile->GetStartDate();
02091                   fStopDate  = fMyRootFile->GetStopDate();
02092                   fRunType   = fMyRootFile->GetRunType();
02093               
02094                   //......................... matrix title                              (ViewStin)
02095                   char* f_in_mat_tit = new char[fgMaxCar];               fCnew++;
02096               
02097                   if ( CorOrCov == fCovarianceMatrix )
02098                     {sprintf(f_in_mat_tit, "Xtal's Cov(s,s') matrices in %s.",
02099                              fFapStinName.Data());}
02100                   if ( CorOrCov == fCorrelationMatrix )
02101                     {sprintf(f_in_mat_tit, "Xtal's Cor(s,s') matrices in %s.",
02102                              fFapStinName.Data());}
02103 
02104                   //................................. Bidim parameters
02105                   Int_t  GeoBidSize = fEcal->MaxSampADC()*fEcal->MaxCrysHocoInStin(); 
02106                   Int_t  nb_binx  = GeoBidSize;
02107                   Int_t  nb_biny  = GeoBidSize;
02108                   Axis_t xinf_bid = (Axis_t)0.;
02109                   Axis_t xsup_bid = (Axis_t)GeoBidSize;
02110                   Axis_t yinf_bid = (Axis_t)0.;
02111                   Axis_t ysup_bid = (Axis_t)GeoBidSize;   
02112       
02113                   //--------------------------------------------------------- (ViewStin)
02114                   //............. matrices reading and histogram filling
02115       
02116                   TH2D* h_geo_bid = new TH2D("geobidim_ViewStin", f_in_mat_tit,
02117                                              nb_binx, xinf_bid, xsup_bid,
02118                                              nb_biny, yinf_bid, ysup_bid);     fCnewRoot++;
02119           
02120                   h_geo_bid->Reset();
02121 
02122                   //======================================================== (ViewStin)
02123           
02124                   //----------------------------------------------- Geographical bidim filling
02125                   Int_t ReadMatSize = fFapNbOfSamples;
02126                   Int_t MatSize     = fEcal->MaxSampADC();
02127                   TMatrixD read_matrix(ReadMatSize, ReadMatSize);
02128                   for(Int_t i=0; i-ReadMatSize < 0; i++){for(Int_t j=0; j-ReadMatSize < 0; j++)
02129                     {read_matrix(i,j)=(Double_t)0.;}}
02130 
02131                   Int_t i_data_exist = 0;
02132 
02133                   for(Int_t n_crys = 0; n_crys < fEcal->MaxCrysInStin(); n_crys++)
02134                     {
02135                       if( CorOrCov == fCovarianceMatrix )
02136                         {read_matrix = fMyRootFile->ReadCovariancesBetweenSamples(StexStin, n_crys, ReadMatSize);}
02137                       if ( CorOrCov == fCorrelationMatrix )
02138                         {read_matrix = fMyRootFile->ReadCorrelationsBetweenSamples(StexStin, n_crys, ReadMatSize);}
02139 
02140                       if( fMyRootFile->DataExist() == kFALSE )
02141                         {
02142                           fStatusDataExist = kFALSE;
02143                           break;   // <= if no data: exiting loop over the channels
02144                         }
02145                       else
02146                         {
02147                           fStatusDataExist = kTRUE;
02148                           i_data_exist++;
02149 
02150                           for(Int_t i_samp = 0 ; i_samp < ReadMatSize ; i_samp++)
02151                             {
02152                               Int_t i_xgeo = GetXSampInStin(fFapStexNumber, StexStin, n_crys, i_samp);
02153                               for(Int_t j_samp = 0; j_samp < ReadMatSize ; j_samp++)
02154                                 {
02155                                   Int_t j_ygeo = GetYSampInStin(fFapStexNumber,
02156                                                                 StexStin,     n_crys, j_samp);
02157                                   h_geo_bid->Fill((Double_t)i_xgeo, (Double_t)j_ygeo,
02158                                                   (Double_t)read_matrix(i_samp, j_samp));
02159                                 }
02160                             }
02161                         }
02162                     }
02163 
02164                   //===========  H I S T O   M I N / M A X   M A N A G E M E N T  ========  (ViewStin)
02165                   //................................ Put histo min max values
02166                   TString quantity_code = "D_MCs_ChNb";
02167                   if( CorOrCov == fCorrelationMatrix ){quantity_code = "D_MCs_ChNb";}
02168                   if( CorOrCov == fCovarianceMatrix ){quantity_code = "H2HFccMosMatrix";}
02169               
02170                   //.......... default if flag not set to "ON"
02171                   SetYminMemoFromValue(quantity_code, fCnaParHistos->GetYminDefaultValue(quantity_code));
02172                   SetYmaxMemoFromValue(quantity_code, fCnaParHistos->GetYmaxDefaultValue(quantity_code));
02173               
02174                   if( fUserHistoMin == fUserHistoMax ){fFlagUserHistoMin = "AUTO"; fFlagUserHistoMax = "AUTO";}
02175                   //.......... user's min and/or max values
02176                   if( fFlagUserHistoMin == "ON" )
02177                     {SetYminMemoFromValue(quantity_code, fUserHistoMin); fFlagUserHistoMin = "OFF";}
02178                   if( fFlagUserHistoMax == "ON" )
02179                     {SetYmaxMemoFromValue(quantity_code, fUserHistoMax); fFlagUserHistoMax = "OFF";}
02180                   //................................. automatic min and/or max
02181                   if( fFlagUserHistoMin == "AUTO" )
02182                     {SetYminMemoFromValue(quantity_code, h_geo_bid->GetMinimum()); fFlagUserHistoMin = "OFF";}
02183                   if( fFlagUserHistoMax == "AUTO" )
02184                     {SetYmaxMemoFromValue(quantity_code, h_geo_bid->GetMaximum()); fFlagUserHistoMax = "OFF";}
02185                   //...................................... histo set ymin and ymax   (ViewStin)
02186                   if ( CorOrCov == fCorrelationMatrix )
02187                     {SetHistoFrameYminYmaxFromMemo((TH1D*)h_geo_bid, "D_MCs_ChNb");
02188                 
02189                     // ************************** A GARDER EN RESERVE *******************************
02190                     //............. special  contour level for correlations (square root wise scale)
02191                     //Int_t nb_niv  = 9;
02192                     //Double_t* cont_niv = new Double_t[nb_niv];                  fCnew++;
02193                     //SqrtContourLevels(nb_niv, &cont_niv[0]);
02194                     //h_geo_bid->SetContour(nb_niv, &cont_niv[0]);            
02195                     //delete [] cont_niv;                                  fCdelete++;
02196                     // ******************************** (FIN RESERVE) *******************************
02197                     }
02198                   if ( CorOrCov == fCovarianceMatrix )
02199                     {SetHistoFrameYminYmaxFromMemo((TH1D*)h_geo_bid, "D_TNo_ChNb");}
02200 
02201                   // =================================== P L O T S ========================  (ViewStin)
02202                   if( i_data_exist > 0 )
02203                     {             
02204                       char* f_in = new char[fgMaxCar];                           fCnew++;
02205 
02206                       //...................... Taille/format canvas  
02207                       UInt_t canv_w = fCnaParHistos->CanvasFormatW("petit");
02208                       UInt_t canv_h = fCnaParHistos->CanvasFormatH("petit");
02209                   
02210                       //.................................................. paves commentaires (ViewStin)          
02211                       SetAllPavesViewStin(StexStin);
02212                   
02213                       //------------------------------------ Canvas name ----------------- (ViewStin)  
02214                       TString name_cov_cor;
02215                       Int_t MaxCar = fgMaxCar;
02216                       name_cov_cor.Resize(MaxCar);
02217                       name_cov_cor = "?";
02218                       if( CorOrCov == fCovarianceMatrix ){name_cov_cor = "CovSS_Matrices_in_";}
02219                       if( CorOrCov == fCorrelationMatrix){name_cov_cor = "CorSS_Matrices_in_";}
02220                   
02221                       TString name_visu;
02222                       MaxCar = fgMaxCar;
02223                       name_visu.Resize(MaxCar);
02224                       name_visu = "colz";
02225                   
02226                       sprintf(f_in, "%s_%s_%s_S1_%d_R%d_%d_%d_%s%d_%s%d_%s",
02227                               name_cov_cor.Data(), fFapStinName.Data(),
02228                               fFapAnaType.Data(), fFapNbOfSamples, fFapRunNumber,
02229                               fFapFirstReqEvtNumber, fFapLastReqEvtNumber,
02230                               fFapStexName.Data(), fFapStexNumber,
02231                               fFapStinName.Data(), StexStin, name_visu.Data()); 
02232                   
02233                       SetHistoPresentation((TH1D*)h_geo_bid, "Stin");
02234                   
02235                       TCanvas *MainCanvas = new TCanvas(f_in, f_in, canv_w, canv_h);   fCnewRoot++;
02236                       fCurrentCanvas = MainCanvas; fCurrentCanvasName = f_in;
02237                   
02238                       // cout << "*TEcnaHistos::ViewStin(...)> Plot is displayed on canvas ----> " << f_in << endl;
02239                   
02240                       delete [] f_in; f_in = 0;                                 fCdelete++;
02241                   
02242                       //------------------------ Canvas draw and update ------------ (ViewStin)  
02243                       if( fPavComGeneralTitle != 0 ){fPavComGeneralTitle->Draw();}
02244                       fPavComStex->Draw();
02245                       fPavComStin->Draw();
02246                       fPavComAnaRun->Draw();
02247                       fPavComNbOfEvts->Draw();
02248 
02249                       Double_t x_margin = fCnaParHistos->BoxLeftX("bottom_left_box") - 0.005;
02250                       Double_t y_margin = fCnaParHistos->BoxTopY("bottom_right_box") + 0.005;             
02251                       MainCanvas->Divide(1, 1, x_margin, y_margin);
02252                       gPad->cd(1);
02253 
02254                       Int_t logy = 0;  
02255                       gPad->SetLogy(logy);
02256                   
02257                       h_geo_bid->DrawCopy("COLZ");
02258                   
02259                       //--------------------------------------------------------------------------- (ViewStin)       
02260                       Int_t size_Hoco    = fEcal->MaxCrysHocoInStin();
02261                       Int_t size_Veco    = fEcal->MaxCrysVecoInStin();
02262                   
02263                       ViewStinGrid(fFapStexNumber, StexStin, MatSize, size_Hoco, size_Veco, " ");
02264                   
02265                       gPad->Update();
02266                   
02267                       h_geo_bid->SetStats((Bool_t)1);    
02268 
02269                       //      delete MainCanvas;              fCdeleteRoot++;
02270                     }
02271                   delete [] f_in_mat_tit;   f_in_mat_tit = 0;        fCdelete++;
02272                   
02273                   h_geo_bid->Delete();   h_geo_bid = 0;             fCdeleteRoot++;
02274                 }
02275               else
02276                 {
02277                   cout << "!TEcnaHistos::ViewStin(...)> *ERROR* =====> "
02278                        << fFapStinName.Data() << " "
02279                        << cStexStin << " not found."
02280                        << " Available numbers = ";
02281                   for(Int_t i = 0; i < fEcal->MaxStinEcnaInStex(); i++)
02282                     {
02283                       if( vStin(i) > 0 )
02284                         {
02285                           if( fFlagSubDet == "EB" ){cout << (Int_t)vStin(i) << ", ";}
02286                           if( fFlagSubDet == "EE" )
02287                             {cout << fEcalNumbering->GetDeeSCConsFrom1DeeSCEcna(fFapStexNumber, (Int_t)vStin(i)) << ", ";}
02288                         }
02289                     }
02290                   cout << fTTBELL << endl;  
02291                 }
02292             }  // end of if ( myRootFile->DataExist() == kTRUE )
02293           else
02294             {
02295               fStatusDataExist = kFALSE;
02296             }
02297         } // end of if ( fMyRootFile->LookAtRootFile() == kTRUE )
02298       else
02299         {
02300           fStatusFileFound = kFALSE;
02301 
02302           cout << "!TEcnaHistos::ViewStin(...)> *ERROR* =====> "
02303                << " ROOT file not found" << fTTBELL << endl;
02304         }
02305     }
02306   else
02307     {
02308       cout << "!TEcnaHistos::ViewStin(...)> " << fFapStexName.Data()
02309            << " = " << fFapStexNumber << ". Out of range (range = [1,"
02310            << fEcal->MaxStexInStas() << "]) " << fTTBELL << endl;
02311     }
02312 }  // end of ViewStin(...)
02313 
02314 //====================================================================================
02315 //
02316 //                         StinCrystalNumbering
02317 //              independent of the ROOT file => StexNumber as argument
02318 //
02319 //====================================================================================  
02320 void TEcnaHistos::StinCrystalNumbering(const Int_t& StexNumber, const Int_t& cStexStin)
02321 {
02322 //display the crystal numbering of one Stin
02323 // cStexStin = Tower number in case of EB or SC number for construction in case of EE
02324 
02325   if( fFlagSubDet == "EB" ){TowerCrystalNumbering(StexNumber, cStexStin);}
02326   if( fFlagSubDet == "EE" ){SCCrystalNumbering(StexNumber, cStexStin);}
02327 }
02328 //---------------->  end of StinCrystalNumbering()
02329 
02330 //====================================================================================
02331 //
02332 //                         TowerCrystalNumbering
02333 //              independent of the ROOT file => SMNumber as argument
02334 //
02335 //====================================================================================  
02336 void TEcnaHistos::TowerCrystalNumbering(const Int_t& SMNumber, const Int_t& n1SMTow)
02337 {
02338   //display the crystal numbering of one tower
02339 
02340   if( (SMNumber > 0) && (SMNumber <= fEcal->MaxSMInEB()) )
02341     {
02342       fFapStexBarrel = fEcalNumbering->GetSMHalfBarrel(SMNumber);
02343 
02344       Int_t MatSize   = fEcal->MaxSampADC();
02345       Int_t size_eta  = fEcal->MaxCrysEtaInTow();
02346       Int_t size_phi  = fEcal->MaxCrysPhiInTow();
02347 
02348       //---------------------------------- bidim
02349 
02350       Int_t nb_bins  = fEcal->MaxSampADC();
02351       Int_t nx_gbins = nb_bins*size_eta;
02352       Int_t ny_gbins = nb_bins*size_phi;
02353 
02354       Axis_t xinf_gbid = (Axis_t)0.;
02355       Axis_t xsup_gbid = (Axis_t)fEcal->MaxSampADC()*size_eta;
02356       Axis_t yinf_gbid = (Axis_t)0.;
02357       Axis_t ysup_gbid = (Axis_t)fEcal->MaxSampADC()*size_phi;
02358 
02359       TString fg_name = "M0' crystals";
02360       TString fg_tit  = "Xtal numbering (chan. in tow, chan. in SM, Xtal in SM, hashed)"; 
02361  
02362       //----------------------- empty 2D histo for pave coordinates registration
02363       TH2D *h_gbid;
02364       h_gbid = new TH2D(fg_name.Data(),  fg_tit.Data(),
02365                         nx_gbins, xinf_gbid, xsup_gbid,
02366                         ny_gbins, yinf_gbid, ysup_gbid);    fCnewRoot++;
02367       h_gbid->Reset();
02368 
02369       //-----------------  T R A C E  D E S   P L O T S ------ (TowerCrystalNumbering)
02370 
02371       char* f_in = new char[fgMaxCar];                           fCnew++;
02372           
02373       //...................... Taille/format canvas
02374   
02375       UInt_t canv_w = fCnaParHistos->CanvasFormatW("petit");
02376       UInt_t canv_h = fCnaParHistos->CanvasFormatH("petit");
02377 
02378       //........................................ couleurs
02379       Color_t couleur_noir       = fCnaParHistos->SetColorsForNumbers("crystal");
02380       Color_t couleur_rouge      = fCnaParHistos->SetColorsForNumbers("lvrb_top");
02381       Color_t couleur_bleu_fonce = fCnaParHistos->SetColorsForNumbers("lvrb_bottom");
02382 
02383       gStyle->SetPalette(1,0);          // Rainbow spectrum
02384 
02385       //.................................... options generales
02386       fCnaParHistos->SetViewHistoStyle("Stin");
02387           
02388       //.................................... paves commentaires (TowerCrystalNumbering)
02389   
02390       SetAllPavesViewStinCrysNb(SMNumber, n1SMTow);
02391  
02392       //---------------------------------------------- (TowerCrystalNumbering)
02393 
02394       //..................... Canvas name
02395       sprintf(f_in, "Crystal_Numbering_for_%s_X_%d_%s%d",
02396               fFapStinName.Data(), n1SMTow, fFapStexName.Data(), SMNumber);
02397   
02398       SetHistoPresentation((TH1D*)h_gbid, "Stin");
02399 
02400       TCanvas *MainCanvas = new TCanvas(f_in, f_in, canv_w , canv_h);    fCnewRoot++;
02401       fCurrentCanvas = MainCanvas; fCurrentCanvasName = f_in;
02402 
02403       // cout << "*TEcnaHistosEB::TowerCrystalNumbering(...)> Plot is displayed on canvas ----> "
02404       //      << f_in << endl;
02405 
02406       Double_t x_margin = fCnaParHistos->BoxLeftX("bottom_left_box") - 0.005;
02407       Double_t y_margin = fCnaParHistos->BoxTopY("bottom_right_box") + 0.005;  
02408       MainCanvas->Divide(1, 1, x_margin, y_margin);
02409 
02410       fPavComStex->Draw();
02411       fPavComStin->Draw();
02412       fPavComLVRB->Draw();
02413   
02414       Bool_t b_true = 1; 
02415       Bool_t b_false = 0;
02416       gPad->cd(1);
02417 
02418       gStyle->SetMarkerColor(couleur_rouge);
02419   
02420       Int_t logy = 0;
02421       gPad->SetLogy(logy);
02422   
02423       //............................... bidim .......... (TowerCrystalNumbering)   
02424 
02425       h_gbid->SetStats(b_false);
02426       h_gbid->DrawCopy("COLZ");
02427     
02428       //..... Ecriture des numeros de channels dans la grille..... (TowerCrystalNumbering)
02429       //      et des numeros SM des cristaux
02430 
02431       //............... prepa arguments fixes appels [TText]->DrawText()
02432       char* f_in_elec = new char[fgMaxCar];                                         fCnew++;
02433       TString TowerLvrbType = fEcalNumbering->GetTowerLvrbType(n1SMTow) ;
02434       TText *text_elec_num = new TText();                                           fCnewRoot++;
02435       if ( TowerLvrbType == "top"    ){text_elec_num->SetTextColor(couleur_rouge);}
02436       if ( TowerLvrbType == "bottom" ){text_elec_num->SetTextColor(couleur_bleu_fonce);}
02437       text_elec_num->SetTextSize(0.04);
02438 
02439       char* f_in_sme = new char[fgMaxCar];                                         fCnew++;
02440       TText *text_sme_num = new TText();                                           fCnewRoot++;
02441       if ( TowerLvrbType == "top"    ){text_sme_num->SetTextColor(couleur_rouge);}
02442       if ( TowerLvrbType == "bottom" ){text_sme_num->SetTextColor(couleur_bleu_fonce);}
02443       text_sme_num->SetTextSize(0.03);
02444 
02445       char* f_in_sm = new char[fgMaxCar];                                             fCnew++;
02446       TText *text_sm_num = new TText();                                               fCnewRoot++;
02447       text_sm_num->SetTextColor(couleur_noir);
02448       text_sm_num->SetTextSize(0.03);
02449 
02450       char* f_in_hsd = new char[fgMaxCar];                                             fCnew++;
02451       TText *text_hsd_num = new TText();                                               fCnewRoot++;
02452       text_hsd_num->SetTextColor(couleur_noir);
02453       text_hsd_num->SetTextSize(0.03);
02454 
02455       //............... prepa arguments fixes appels GetXGeo(...) et GetYGeo(...)
02456       Int_t    i_samp  = 0;
02457       //Double_t off_set = (Double_t)(fEcal->MaxSampADC()/4);
02458       Double_t off_set = (Double_t)1.;
02459 
02460       //------------------ LOOP ON THE CRYSTAL ELECTRONIC CHANNEL NUMBER  (TowerCrystalNumbering)
02461 
02462       for (Int_t i_chan = 0; i_chan < fEcal->MaxCrysInTow(); i_chan++)
02463         {
02464           Int_t i_xgeo = GetXSampInStin(SMNumber, n1SMTow, i_chan, i_samp);
02465           Int_t i_ygeo = GetYSampInStin(SMNumber, n1SMTow, i_chan, i_samp);
02466 
02467           Double_t xgi     =  i_xgeo + 3.*off_set;
02468           Double_t ygj     =  i_ygeo + 7.*off_set;
02469 
02470           Double_t xgi_sme =  i_xgeo + 3.*off_set;
02471           Double_t ygj_sme =  i_ygeo + 5.*off_set;
02472 
02473           Double_t xgi_sm  =  i_xgeo + 3.*off_set;
02474           Double_t ygj_sm  =  i_ygeo + 3.*off_set;
02475 
02476           Double_t xgi_hsd =  i_xgeo + 3.*off_set;
02477           Double_t ygj_hsd =  i_ygeo + 1.*off_set;
02478 
02479           Int_t i_crys_sme = fEcalNumbering->Get0SMEchaFrom1SMTowAnd0TowEcha(n1SMTow, i_chan);
02480           Int_t i_crys_sm  = fEcalNumbering->Get1SMCrysFrom1SMTowAnd0TowEcha(n1SMTow, i_chan);
02481 
02482           Double_t Eta = fEcalNumbering->GetEta(SMNumber, n1SMTow, i_chan);
02483           Double_t Phi = fEcalNumbering->GetPhi(SMNumber, n1SMTow, i_chan);
02484 
02485           Int_t i_crys_hsd = fEcalNumbering->GetHashedNumberFromIEtaAndIPhi((Int_t)Eta, (Int_t)Phi);
02486 
02487           //------------------------------------------------------- TowerCrystalNumbering
02488 
02489           sprintf(f_in_elec, "%d", i_chan);
02490           text_elec_num->DrawText(xgi, ygj, f_in_elec);
02491 
02492           sprintf(f_in_sme, "%d", i_crys_sme);
02493           text_sme_num->DrawText(xgi_sme, ygj_sme, f_in_sme);
02494 
02495           sprintf(f_in_sm, "%d", i_crys_sm);
02496           text_sm_num->DrawText(xgi_sm, ygj_sm, f_in_sm);
02497 
02498           sprintf(f_in_hsd, "%d", i_crys_hsd);
02499           text_sm_num->DrawText(xgi_hsd, ygj_hsd, f_in_hsd);
02500         }
02501       text_sm_num->Delete();   text_sm_num   = 0;        fCdeleteRoot++;
02502       text_sme_num->Delete();  text_sme_num  = 0;        fCdeleteRoot++;
02503       text_elec_num->Delete(); text_elec_num = 0;        fCdeleteRoot++;
02504       text_hsd_num->Delete();  text_hsd_num  = 0;        fCdeleteRoot++;
02505 
02506       ViewStinGrid(SMNumber, n1SMTow, MatSize, size_eta, size_phi, "CrystalNumbering");
02507 
02508       gPad->Update();
02509       h_gbid->SetStats(b_true);
02510 
02511       h_gbid->Delete();     h_gbid = 0;             fCdeleteRoot++;
02512 
02513       delete [] f_in;       f_in      = 0;          fCdelete++; 
02514       delete [] f_in_sm;    f_in_sm   = 0;          fCdelete++;
02515       delete [] f_in_sme;   f_in_sme  = 0;          fCdelete++;
02516       delete [] f_in_elec;  f_in_elec = 0;          fCdelete++;
02517     }
02518   else
02519     {
02520       cout << "!TEcnaHistos::TowerCrystalNumbering(...)> SM = " << SMNumber
02521            << ". Out of range ( range = [1," << fEcal->MaxSMInEB() << "] )" << fTTBELL << endl;
02522     }
02523 }
02524 //---------------->  end of TowerCrystalNumbering()
02525 
02526 //====================================================================================
02527 //
02528 //                         SCCrystalNumbering
02529 //              independent of the ROOT file => DeeNumber and n1DeeSCEcna as argument
02530 //
02531 //====================================================================================  
02532 void TEcnaHistos::SCCrystalNumbering(const Int_t& DeeNumber, const Int_t& n1DeeSCCons)
02533 {
02534   //display the crystal numbering of one SC
02535 
02536   if( (DeeNumber > 0) && (DeeNumber <= fEcal->MaxDeeInEE()) )
02537     {
02538       Int_t n1DeeSCEcna = fEcalNumbering->Get1DeeSCEcnaFromDeeSCCons(DeeNumber, n1DeeSCCons);
02539       fFapStexType      = fEcalNumbering->GetEEDeeType(DeeNumber);
02540       fFapStinQuadType  = fEcalNumbering->GetSCQuadFrom1DeeSCEcna(n1DeeSCEcna);
02541 
02542       //Int_t MatSize  = fEcal->MaxSampADC();
02543       Int_t size_IX  = fEcal->MaxCrysIXInSC();
02544       Int_t size_IY  = fEcal->MaxCrysIYInSC();
02545 
02546       //---------------------------------- bidim
02547 
02548       Int_t nb_bins  = fEcal->MaxSampADC();
02549       Int_t nx_gbins = nb_bins*size_IX;
02550       Int_t ny_gbins = nb_bins*size_IY;
02551 
02552       Axis_t xinf_gbid = (Axis_t)0.;
02553       Axis_t xsup_gbid = (Axis_t)fEcal->MaxSampADC()*size_IX;
02554       Axis_t yinf_gbid = (Axis_t)0.;
02555       Axis_t ysup_gbid = (Axis_t)fEcal->MaxSampADC()*size_IY;
02556 
02557       TString fg_name = "crystalnbring";
02558       TString fg_tit  = "Xtal numbering for construction"; 
02559   
02560       TH2D *h_gbid;
02561       h_gbid = new TH2D(fg_name.Data(),  fg_tit.Data(),
02562                         nx_gbins, xinf_gbid, xsup_gbid,
02563                         ny_gbins, yinf_gbid, ysup_gbid);    fCnewRoot++;
02564       h_gbid->Reset();
02565 
02566       //-----------------  T R A C E  D E S   P L O T S ------ (SCCrystalNumbering)
02567 
02568       char* f_in = new char[fgMaxCar];                           fCnew++;
02569           
02570       //...................... Taille/format canvas
02571   
02572       UInt_t canv_w = fCnaParHistos->CanvasFormatW("petit");
02573       UInt_t canv_h = fCnaParHistos->CanvasFormatH("petit");
02574       //........................................ couleurs
02575       // Color_t couleur_noir       = fCnaParHistos->ColorDefinition("noir");
02576       Color_t couleur_rouge      = fCnaParHistos->ColorDefinition("rouge");
02577       // Color_t couleur_bleu_fonce = fCnaParHistos->ColorDefinition("bleu_fonce");
02578 
02579       gStyle->SetPalette(1,0);          // Rainbow spectrum
02580       //.................................... options generales
02581       fCnaParHistos->SetViewHistoStyle("Stin");
02582           
02583       //.................................... paves commentaires (SCCrystalNumbering)
02584       SetAllPavesViewStinCrysNb(DeeNumber, n1DeeSCEcna);
02585 
02586       //---------------------------------------------- (SCCrystalNumbering)
02587       //..................... Canvas name
02588       sprintf(f_in, "Crystal_Numbering_for_%s_X_%d_%s%d",
02589               fFapStinName.Data(), n1DeeSCEcna,  fFapStexName.Data(), DeeNumber);
02590 
02591       SetHistoPresentation((TH1D*)h_gbid, "Stin");
02592 
02593       TCanvas *MainCanvas = new TCanvas(f_in, f_in, canv_w , canv_h);    fCnewRoot++;
02594       fCurrentCanvas = MainCanvas; fCurrentCanvasName = f_in;
02595 
02596       // cout << "*TEcnaHistosEE::SCCrystalNumbering(...)> Plot is displayed on canvas ----> "
02597       //      << f_in << endl;
02598 
02599       Double_t x_margin = fCnaParHistos->BoxLeftX("bottom_left_box") - 0.005;
02600       Double_t y_margin = fCnaParHistos->BoxTopY("bottom_right_box") + 0.005;
02601 
02602       MainCanvas->Divide(1, 1, x_margin, y_margin);
02603 
02604       fPavComStex->Draw();
02605       fPavComStin->Draw();
02606       fPavComCxyz->Draw();
02607 
02608       Bool_t b_true  = 1; 
02609       Bool_t b_false = 0;
02610       gPad->cd(1);
02611 
02612       gStyle->SetMarkerColor(couleur_rouge);
02613   
02614       Int_t logy = 0;
02615       gPad->SetLogy(logy);
02616   
02617       //............................... bidim .......... (SCCrystalNumbering)   
02618       h_gbid->SetStats(b_false); 
02619       fCnaParHistos->SetViewHistoOffsets((TH1D*)h_gbid, "Stin", " ");
02620       h_gbid->DrawCopy("COLZ");
02621 
02622       //..... Ecriture des numeros de channels dans la grille..... (SCCrystalNumbering)
02623       //      et des numeros Dee des cristaux
02624       TString SCQuadType = fEcalNumbering->GetSCQuadFrom1DeeSCEcna(n1DeeSCEcna);
02625       TString DeeDir     = fEcalNumbering->GetDeeDirViewedFromIP(DeeNumber);
02626       TString DeeEndcap  = fEcalNumbering->GetEEDeeEndcap(DeeNumber);
02627       Color_t couleur_SC = GetSCColor(DeeEndcap, DeeDir, SCQuadType);
02628       //............... prepa arguments fixes appels [TText]->DrawText()
02629       char* f_in_elec = new char[fgMaxCar];                                           fCnew++;
02630       TText *text_elec_num   = new TText();                                           fCnewRoot++;
02631       text_elec_num->SetTextColor(couleur_SC);
02632       text_elec_num->SetTextSize(0.06);
02633 
02634       //............... prepa arguments fixes appels GetXGeo(...) et GetYGeo(...)
02635       Int_t    i_samp  = 0;
02636       Double_t off_set = (Double_t)(fEcal->MaxSampADC()/3);
02637 
02638       //------------------ LOOP ON THE CRYSTAL ELECTRONIC CHANNEL NUMBER  (SCCrystalNumbering)
02639 
02640       for (Int_t i_chan = 0; i_chan < fEcal->MaxCrysInSC(); i_chan++)
02641         {
02642           Int_t i_xgeo = GetXSampInStin(DeeNumber, n1DeeSCEcna, i_chan, i_samp);
02643           Int_t i_ygeo = GetYSampInStin(DeeNumber, n1DeeSCEcna, i_chan, i_samp);
02644 
02645           Double_t xgi = i_xgeo + off_set;
02646           Double_t ygj = i_ygeo + 2*off_set;
02647 
02648           //------------------------------------------------------- SCCrystalNumbering
02649           Int_t i_chan_p = i_chan+1;
02650           sprintf(f_in_elec, "%d", i_chan_p);   // offset = +1 (Xtal for construction numbering, CMS NOTE 2006/027)
02651           text_elec_num->DrawText(xgi, ygj, f_in_elec);
02652         }
02653       text_elec_num->Delete();   text_elec_num = 0;           fCdeleteRoot++;
02654 
02655       ViewStinGrid(DeeNumber, n1DeeSCEcna, fEcal->MaxSampADC(), size_IX, size_IY, "CrystalNumbering");
02656 
02657       gPad->Update();
02658       h_gbid->SetStats(b_true);
02659 
02660       h_gbid->Delete();     h_gbid = 0;                         fCdeleteRoot++;
02661 
02662       delete [] f_in;       f_in      = 0;          fCdelete++; 
02663       delete [] f_in_elec;  f_in_elec = 0;          fCdelete++;
02664     }
02665   else
02666     {
02667       cout << "!TEcnaHistos::SCCrystalNumbering(...)> Dee = " << DeeNumber
02668            << ". Out of range ( range = [1," << fEcal->MaxDeeInEE() << "] )" << fTTBELL << endl;
02669     }
02670 }
02671 //---------------->  end of SCCrystalNumbering()
02672               
02673 //==================================================================================
02674 //
02675 //                       GetXSampInStin, GetYSampInStin
02676 //
02677 //==================================================================================
02678 Int_t TEcnaHistos::GetXSampInStin(const Int_t& StexNumber,  const Int_t& StexStin,
02679                                   const Int_t& i0StinEcha,  const Int_t& i_samp) 
02680 {
02681 //Gives the X coordinate in the geographic view of one Stin
02682 
02683   Int_t ix_geo = -1;
02684 
02685   if( fFlagSubDet == "EB" )
02686     {TString ctype = fEcalNumbering->GetStinLvrbType(StexStin);
02687     TString btype = fEcalNumbering->GetStexHalfStas(StexNumber);
02688     if( (btype == "EB+" && ctype == "bottom")  || (btype == "EB-" && ctype == "top") )
02689       {ix_geo = ( (fEcal->MaxCrysHocoInStin()-1)-(i0StinEcha/fEcal->MaxCrysHocoInStin()) )
02690          *fEcal->MaxSampADC() + i_samp;}
02691     if( (btype == "EB+" &&  ctype  == "top")   || (btype == "EB-" && ctype == "bottom") )
02692       {ix_geo = ( i0StinEcha/fEcal->MaxCrysHocoInStin() )*fEcal->MaxSampADC() + i_samp;}}
02693   
02694   if( fFlagSubDet == "EE" )
02695     {  TString DeeDir = fEcalNumbering->GetDeeDirViewedFromIP(StexNumber);
02696     if( DeeDir == "right" )
02697       {ix_geo = (fEcalNumbering->GetIXCrysInSC(StexNumber, StexStin, i0StinEcha)-1)*fEcal->MaxSampADC() + i_samp;}
02698     if( DeeDir == "left"  )
02699       {ix_geo = (fEcal->MaxCrysHocoInStin() - fEcalNumbering->GetIXCrysInSC(StexNumber, StexStin, i0StinEcha))*
02700          fEcal->MaxSampADC() + i_samp;}}
02701 
02702   return ix_geo;
02703 }
02704 //--------------------------------------------------------------------------------------------
02705 Int_t TEcnaHistos::GetYSampInStin(const Int_t& StexNumber, const Int_t& StexStin,
02706                                   const Int_t& i0StinEcha, const Int_t& j_samp)
02707 {
02708 //Gives the Y coordinate in the geographic view of one Stin
02709 
02710   Int_t jy_geo = -1;
02711 
02712   if( fFlagSubDet == "EB" )
02713     {
02714       TString ctype = fEcalNumbering->GetStinLvrbType(StexStin);
02715       TString btype = fEcalNumbering->GetStexHalfStas(StexNumber);
02716       
02717       //.......................... jy_geo for the EB+ (and beginning for the EB-)
02718       
02719       if( (btype == "EB+" && ctype == "top")    ||  (btype == "EB-" && ctype == "bottom") )
02720         {
02721           if( i0StinEcha >=  0 && i0StinEcha <=  4 ) {jy_geo =  (i0StinEcha -  0)*fEcal->MaxSampADC() + j_samp;}
02722           if( i0StinEcha >=  5 && i0StinEcha <=  9 ) {jy_geo = -(i0StinEcha -  9)*fEcal->MaxSampADC() + j_samp;}
02723           if( i0StinEcha >= 10 && i0StinEcha <= 14 ) {jy_geo =  (i0StinEcha - 10)*fEcal->MaxSampADC() + j_samp;}
02724           if( i0StinEcha >= 15 && i0StinEcha <= 19 ) {jy_geo = -(i0StinEcha - 19)*fEcal->MaxSampADC() + j_samp;}
02725           if( i0StinEcha >= 20 && i0StinEcha <= 24 ) {jy_geo =  (i0StinEcha - 20)*fEcal->MaxSampADC() + j_samp;}
02726         }
02727       
02728       if( (btype == "EB+" && ctype == "bottom") ||  (btype == "EB-" && ctype == "top") )
02729         {
02730           if( i0StinEcha >=  0 && i0StinEcha <=  4 )
02731             {jy_geo = ( (fEcal->MaxCrysVecoInStin()-1) - (i0StinEcha- 0))*fEcal->MaxSampADC() + j_samp;}  
02732           if( i0StinEcha >=  5 && i0StinEcha <=  9 )
02733             {jy_geo = ( (fEcal->MaxCrysVecoInStin()-1) + (i0StinEcha- 9))*fEcal->MaxSampADC() + j_samp;}
02734           if( i0StinEcha >= 10 && i0StinEcha <= 14 )
02735             {jy_geo = ( (fEcal->MaxCrysVecoInStin()-1) - (i0StinEcha-10))*fEcal->MaxSampADC() + j_samp;}
02736           if( i0StinEcha >= 15 && i0StinEcha <= 19 )
02737             {jy_geo = ( (fEcal->MaxCrysVecoInStin()-1) + (i0StinEcha-19))*fEcal->MaxSampADC() + j_samp;}
02738           if( i0StinEcha >= 20 && i0StinEcha <= 24 )
02739             {jy_geo = ( (fEcal->MaxCrysVecoInStin()-1) - (i0StinEcha-20))*fEcal->MaxSampADC() + j_samp;}
02740         }
02741     }
02742   
02743   if( fFlagSubDet == "EE" )
02744     {jy_geo =
02745     (fEcalNumbering->GetJYCrysInSC(StexNumber, StexStin, i0StinEcha) - 1)*fEcal->MaxSampADC() + j_samp;}
02746 
02747   return jy_geo;
02748 }
02749 
02750 //===============================================================================
02751 //
02752 //                           ViewStinGrid
02753 //              independent of the ROOT file => StexNumber as argument
02754 //
02755 //===============================================================================
02756 void TEcnaHistos::ViewStinGrid(const Int_t& StexNumber, 
02757                                const Int_t&  StexStin,   const Int_t& MatSize,
02758                                const Int_t&  size_Hoco,  const Int_t& size_Veco,
02759                                const TString chopt)
02760 {
02761   //Grid of one Stin with axis Hoco and Veco
02762 
02763   if( fFlagSubDet == "EB"){ViewTowerGrid(StexNumber, StexStin, MatSize,
02764                                          size_Hoco,   size_Veco,  chopt);}
02765   if( fFlagSubDet == "EE"){ViewSCGrid(StexNumber, StexStin, MatSize,
02766                                       size_Hoco,   size_Veco,  chopt);}
02767 
02768 } // end of ViewStinGrid
02769 
02770 //===============================================================================
02771 //
02772 //                           ViewTowerGrid
02773 //              independent of the ROOT file => SMNumber as argument
02774 //
02775 //===============================================================================
02776 void TEcnaHistos::ViewTowerGrid(const Int_t&  SMNumber, 
02777                                 const Int_t&  n1SMTow,  const Int_t& MatSize,
02778                                 const Int_t&  size_eta, const Int_t& size_phi,
02779                                 const TString chopt)
02780 {
02781   //Grid of one tower with axis eta and phi
02782   //.......................... lignes verticales
02783   Double_t xline = 0.;
02784   
02785   Double_t yline_bot = 0.;
02786   Double_t yline_top = (Double_t)(MatSize*size_eta);
02787   
02788   for( Int_t i = 0 ; i < size_eta ; i++)
02789     {  
02790       xline = xline + (Double_t)MatSize;
02791       TLine *lin;
02792       lin = new TLine(xline, yline_bot, xline, yline_top); fCnewRoot++;
02793       lin->Draw();
02794       // delete lin;             fCdeleteRoot++;
02795     }
02796   //............................. lignes horizontales
02797   Double_t xline_left  = 0;
02798   Double_t xline_right = (Double_t)(MatSize*size_eta);
02799   
02800   Double_t yline = -(Double_t)MatSize;
02801   
02802   for( Int_t j = 0 ; j < size_eta+1 ; j++)
02803     {
02804       yline = yline + (Double_t)MatSize;
02805       TLine *lin;
02806       lin = new TLine(xline_left, yline, xline_right, yline); fCnewRoot++;
02807       lin->Draw();
02808       // delete lin;             fCdeleteRoot++;
02809     }
02810  
02811   //------------------ trace axes en eta et phi --------------- ViewTowerGrid
02812 
02813   //...................................................... Axe i(eta) (x bottom)  (ViewTowerGrid)
02814 
02815   Double_t eta_min = fEcalNumbering->GetIEtaMin(SMNumber, n1SMTow);
02816   Double_t eta_max = fEcalNumbering->GetIEtaMax(SMNumber, n1SMTow);
02817 
02818   TString  x_var_name  = GetEtaPhiAxisTitle("ietaTow");
02819   TString  x_direction = fEcalNumbering->GetXDirectionEB(SMNumber);
02820 
02821   Float_t tit_siz_x = fCnaParHistos->AxisTitleSize();
02822   Float_t lab_siz_x = fCnaParHistos->AxisLabelSize();
02823   Float_t tic_siz_x = fCnaParHistos->AxisTickSize();
02824   Float_t tit_off_x = fCnaParHistos->AxisTitleOffset("Towx");
02825   Float_t lab_off_x = fCnaParHistos->AxisLabelOffset("Towx");
02826   
02827   new TF1("f1", x_direction.Data(), eta_min, eta_max);                fCnewRoot++;
02828 
02829   TGaxis* sup_axis_x = 0;
02830 
02831   if ( x_direction == "-x" )   // NEVER  IN THIS CASE: xmin->xmax <=> right->left ("-x") direction
02832     {sup_axis_x = new TGaxis( -(Float_t)MatSize, (Float_t)0, (Float_t)(size_eta*MatSize), (Float_t)0.,
02833                               "f1", size_eta, "BCS" , 0.);                                fCnewRoot++;
02834     cout << "TEcnaHistosEB::ViewTowerGrid()> non foreseen case. eta with -x direction." << fTTBELL << endl;}
02835 
02836   if ( x_direction == "x" )    // ALWAYS IN THIS CASE: xmin->xmax <=> left->right ("x") direction
02837     {sup_axis_x = new TGaxis( (Float_t)0.      , (Float_t)0., (Float_t)(size_eta*MatSize), (Float_t)0.,
02838                               "f1", size_eta, "CS" , 0.);                                fCnewRoot++;}
02839   
02840   sup_axis_x->SetTitle(x_var_name);
02841   sup_axis_x->SetTitleSize(tit_siz_x);
02842   sup_axis_x->SetTitleOffset(tit_off_x);
02843   sup_axis_x->SetLabelSize(lab_siz_x);
02844   sup_axis_x->SetLabelOffset(lab_off_x);
02845   sup_axis_x->SetTickSize(tic_siz_x);
02846   sup_axis_x->Draw("SAME");
02847 
02848   //...................................................... Axe phi (y right)  (ViewTowerGrid)
02849   Float_t tit_siz_y = fCnaParHistos->AxisTitleSize();
02850   Float_t lab_siz_y = fCnaParHistos->AxisLabelSize();
02851   Float_t tic_siz_y = fCnaParHistos->AxisTickSize();
02852   Float_t tit_off_y = fCnaParHistos->AxisTitleOffset("Towy");
02853   Float_t lab_off_y = fCnaParHistos->AxisLabelOffset("Towy");
02854 
02855   if( chopt == "CrystalNumbering" )
02856     {
02857       Double_t phi_min     = fEcalNumbering->GetPhiMin(SMNumber, n1SMTow);
02858       Double_t phi_max     = fEcalNumbering->GetPhiMax(SMNumber, n1SMTow);
02859       
02860       TString  y_var_name  = GetEtaPhiAxisTitle("phi");
02861       TString  y_direction = fEcalNumbering->GetYDirectionEB(SMNumber);
02862   
02863       new TF1("f2", y_direction.Data(), phi_min, phi_max);               fCnewRoot++;
02864       TGaxis* sup_axis_y = 0;
02865       
02866       if ( y_direction == "-x" )  // ALWAYS IN THIS CASE: ymin->ymax <=> top->bottom ("-x") direction
02867         {sup_axis_y = new TGaxis( (Float_t)(size_eta*MatSize), (Float_t)0.,
02868                                   (Float_t)(size_eta*MatSize), (Float_t)(size_phi*MatSize),
02869                                   "f2", size_phi, "+CS", 0.);                fCnewRoot++;}
02870       
02871       if ( y_direction == "x" )   // NEVER  IN THIS CASE: ymin->ymax <=> bottom->top ("x") direction
02872         {sup_axis_y = new TGaxis( (Float_t)0.,  (Float_t)0., (Float_t) 0., (Float_t)(size_phi*MatSize),
02873                                   "f2", size_phi, "BCS", 0.);                fCnewRoot++;}
02874       
02875       sup_axis_y->SetTitle(y_var_name);
02876       sup_axis_y->SetTitleSize(tit_siz_y);
02877       sup_axis_y->SetTitleOffset(tit_off_y);
02878       sup_axis_y->SetLabelSize(lab_siz_y);
02879       sup_axis_y->SetLabelOffset(lab_off_y);
02880       sup_axis_y->SetTickSize(tic_siz_y);
02881       sup_axis_y->Draw("SAME");
02882     }
02883   //...................................................... Axe j(phi) (y left)  (ViewTowerGrid)
02884 
02885   Double_t j_phi_min = fEcalNumbering->GetJPhiMin(SMNumber, n1SMTow);
02886   Double_t j_phi_max = fEcalNumbering->GetJPhiMax(SMNumber, n1SMTow);
02887 
02888   TString  jy_var_name  = GetEtaPhiAxisTitle("jphiTow");
02889   TString  jy_direction = fEcalNumbering->GetJYDirectionEB(SMNumber);
02890 
02891   new TF1("f3", jy_direction.Data(), j_phi_min, j_phi_max);               fCnewRoot++;
02892   TGaxis* sup_axis_jy = 0;
02893 
02894   sup_axis_jy = new TGaxis( (Float_t)0., (Float_t)0.,
02895                             (Float_t)0., (Float_t)(size_phi*MatSize),
02896                             "f3", size_phi, "SC", 0.);                fCnewRoot++;
02897   
02898   sup_axis_jy->SetTitle(jy_var_name);
02899   sup_axis_jy->SetTitleSize(tit_siz_y);
02900   sup_axis_jy->SetTitleOffset(tit_off_y);
02901   sup_axis_jy->SetLabelSize(lab_siz_y);
02902   sup_axis_jy->SetLabelOffset(lab_off_y);
02903   sup_axis_jy->SetTickSize(tic_siz_y);
02904   sup_axis_jy->Draw("SAME");
02905 } // end of ViewTowerGrid
02906 
02907 //===============================================================================
02908 //
02909 //                           ViewSCGrid
02910 //              independent of the ROOT file => DeeNumber as argument
02911 //
02912 //===============================================================================
02913 void TEcnaHistos::ViewSCGrid(const Int_t& DeeNumber, const Int_t&  n1DeeSCEcna,
02914                              const Int_t& MatSize,   const Int_t&  size_IX,
02915                              const Int_t& size_IY,   const TString chopt)
02916 {
02917   //Grid of one SC with axis IX and IY
02918   //.......................... lignes verticales
02919   Double_t xline = 0.;
02920   
02921   Double_t yline_bot = 0.;
02922   Double_t yline_top = (Double_t)(MatSize*size_IX);
02923   
02924   for( Int_t i = 0 ; i < size_IX ; i++)
02925     {  
02926       xline = xline + (Double_t)MatSize;
02927       TLine *lin;
02928       lin = new TLine(xline, yline_bot, xline, yline_top); fCnewRoot++;
02929       lin->Draw();
02930       // delete lin;             fCdeleteRoot++;
02931     }
02932   //............................. lignes horizontales
02933   Double_t xline_left  = 0;
02934   Double_t xline_right = (Double_t)(MatSize*size_IX);
02935   
02936   Double_t yline = -(Double_t)MatSize;
02937   
02938   for( Int_t j = 0 ; j < size_IX+1 ; j++)
02939     {
02940       yline = yline + (Double_t)MatSize;
02941       TLine *lin;
02942       lin = new TLine(xline_left, yline, xline_right, yline); fCnewRoot++;
02943       lin->Draw();
02944       // delete lin;             fCdeleteRoot++;
02945     }
02946  
02947   //------------------ trace axes en IX et IY --------------- ViewSCGrid
02948 
02949   //...................................................... Axe i(IX) (x bottom)  (ViewSCGrid)
02950 
02951   Double_t IX_min = fEcalNumbering->GetIIXMin(n1DeeSCEcna) - 0.5;
02952   Double_t IX_max = fEcalNumbering->GetIIXMax(n1DeeSCEcna) + 0.5;
02953 
02954   Float_t axis_x_inf  = 0;
02955   Float_t axis_x_sup  = 0;
02956   Float_t axis_y_inf  = 0;
02957   Float_t axis_y_sup  = 0;
02958   Int_t   axis_nb_div = 1;
02959   Double_t IX_values_min = 0;
02960   Double_t IX_values_max = 0;
02961   Option_t* axis_chopt = "CS";
02962 
02963   Float_t tit_siz_x = fCnaParHistos->AxisTitleSize();
02964   Float_t lab_siz_x = fCnaParHistos->AxisLabelSize();
02965   Float_t tic_siz_x = fCnaParHistos->AxisTickSize();
02966   Float_t tit_off_x = fCnaParHistos->AxisTitleOffset("SCx");
02967   Float_t lab_off_x = fCnaParHistos->AxisLabelOffset("SCx");
02968 
02969   TString StrDee = "iIXSC";
02970   if( DeeNumber == 1 ){StrDee = "iIXDee1";}
02971   if( DeeNumber == 2 ){StrDee = "iIXDee2";}
02972   if( DeeNumber == 3 ){StrDee = "iIXDee3";}
02973   if( DeeNumber == 4 ){StrDee = "iIXDee4";}
02974 
02975   TString  x_var_name  = GetIXIYAxisTitle(StrDee.Data());
02976   TString  x_direction = fEcalNumbering->GetXDirectionEE(DeeNumber);
02977 
02978   TGaxis* sup_axis_x = 0;
02979 
02980   if( DeeNumber == 1 ) //  -xmin -> -xmax <=> left->right
02981     {
02982       axis_x_inf    = 0; axis_y_inf  = 0;  axis_x_sup    = size_IX*MatSize;  axis_y_sup    = 0;
02983       axis_nb_div   = size_IX;
02984       IX_values_min = -IX_min ;   IX_values_max = -IX_max; axis_chopt = "CS";
02985     }
02986   if( DeeNumber == 2 ) //  xmin -> xmax <=> right->left
02987     {
02988       axis_x_inf    = 0; axis_y_inf  = 0;  axis_x_sup    = size_IX*MatSize;  axis_y_sup    = 0;
02989       axis_nb_div   = size_IX;
02990       IX_values_min = IX_min ;    IX_values_max = IX_max;   axis_chopt = "CS";
02991     }
02992   if( DeeNumber == 3 )  //  xmin -> xmax <=>  left->right
02993     {
02994       axis_x_inf    = 0; axis_y_inf  = 0;  axis_x_sup    = size_IX*MatSize;  axis_y_sup    = 0;
02995       axis_nb_div   = size_IX;
02996       IX_values_min = IX_min ;    IX_values_max = IX_max;   axis_chopt = "CS";
02997     }
02998   if( DeeNumber == 4 )  //  -xmin -> -xmax <=> right->left
02999     {
03000       axis_x_inf    = 0; axis_y_inf  = 0;  axis_x_sup    = size_IX*MatSize;  axis_y_sup    = 0;
03001       axis_nb_div   = size_IX;
03002       IX_values_min = -IX_min ;   IX_values_max = -IX_max; axis_chopt = "CS";
03003     }
03004 
03005   new TF1("f1", x_direction.Data(), IX_values_min, IX_values_max);    fCnewRoot++;
03006   sup_axis_x = new TGaxis( axis_x_inf, axis_y_inf, axis_x_sup, axis_y_sup,
03007                            "f1", axis_nb_div, axis_chopt , 0.);   fCnewRoot++;
03008 
03009   sup_axis_x->SetTitle(x_var_name);
03010   sup_axis_x->SetTitleSize(tit_siz_x);
03011   sup_axis_x->SetTitleOffset(tit_off_x);
03012   sup_axis_x->SetLabelSize(lab_siz_x);
03013   sup_axis_x->SetLabelOffset(lab_off_x);
03014   sup_axis_x->SetTickSize(tic_siz_x);     // <===== NE MARCHE QU'AVEC L'OPTION "S"
03015   sup_axis_x->Draw("SAME");
03016 
03017   //...................................................... Axe j(IY) (ViewSCGrid)
03018 
03019   Float_t tit_siz_y = fCnaParHistos->AxisTitleSize();
03020   Float_t lab_siz_y = fCnaParHistos->AxisLabelSize();
03021   Float_t tic_siz_y = fCnaParHistos->AxisTickSize();
03022   Float_t tit_off_y = fCnaParHistos->AxisTitleOffset("SCy");
03023   Float_t lab_off_y = fCnaParHistos->AxisLabelOffset("SCy");
03024 
03025   Double_t j_IY_min = fEcalNumbering->GetJIYMin(DeeNumber, n1DeeSCEcna) - 0.5;
03026   Double_t j_IY_max = fEcalNumbering->GetJIYMax(DeeNumber, n1DeeSCEcna) + 0.5;
03027 
03028   TString  jy_var_name  = GetIXIYAxisTitle("jIYSC");
03029   TString  jy_direction = fEcalNumbering->GetJYDirectionEE(DeeNumber);
03030 
03031   new TF1("f2", jy_direction.Data(), j_IY_min, j_IY_max);             fCnewRoot++;
03032 
03033   TGaxis* sup_axis_jy = new TGaxis( (Float_t)0., (Float_t)0.,
03034                             (Float_t)0., (Float_t)(size_IY*MatSize),
03035                             "f2", size_IY, "CS", 0.);                     fCnewRoot++;
03036 
03037   sup_axis_jy->SetTitle(jy_var_name);
03038   sup_axis_jy->SetTitleSize(tit_siz_y);
03039   sup_axis_jy->SetTitleOffset(tit_off_y);
03040   sup_axis_jy->SetLabelSize(lab_siz_y);
03041   sup_axis_jy->SetLabelOffset(lab_off_y);
03042   sup_axis_jy->SetTickSize(tic_siz_y);     // <===== NE MARCHE QU'AVEC L'OPTION "S"
03043   sup_axis_jy->Draw();
03044 
03045 } // end of ViewSCGrid
03046 
03047 //=======================================================================================
03048 //
03049 //                              ViewStex(***)     
03050 //
03051 //           (Hoco,Veco) matrices for all the Stins of a Stex             
03052 //
03053 //     arg_read_histo:    1D array containing the quantity for each channel in the Stex
03054 //                        (dim = MaxCrysInStex())
03055 //     arg_AlreadyRead:   =1 <=> arg_read_histo 
03056 //                        =0 <=> read the 1D array in this method with TEcnaRead
03057 //     
03058 //      HistoCode:        code for the plotted quantity
03059 //
03060 //=======================================================================================
03061 void TEcnaHistos::ViewStex(const TVectorD& arg_read_histo, const Int_t& arg_AlreadyRead,
03062                            const TString   HistoCode)
03063 {
03064 // (Hoco, Veco) matrices for all the Stins of a Stex
03065 
03066   Bool_t OKFileExists = kFALSE;
03067   Bool_t OKData  = kFALSE;
03068 
03069   Int_t n1StexStin = -1;
03070 
03071   if( arg_AlreadyRead == fTobeRead )
03072     {
03073       fMyRootFile->PrintNoComment();
03074       fMyRootFile->FileParameters(fFapAnaType,          fFapNbOfSamples,
03075                                   fFapRunNumber,        fFapFirstReqEvtNumber,
03076                                   fFapLastReqEvtNumber, fFapReqNbOfEvts,
03077                                   fFapStexNumber,       fCfgResultsRootFilePath.Data());
03078       
03079       if( fMyRootFile->LookAtRootFile() == kTRUE ){OKFileExists = kTRUE;}
03080 
03081       if( OKFileExists == kTRUE )
03082         {
03083           fFapNbOfEvts = fMyRootFile->GetNumberOfEvents(fFapReqNbOfEvts, fFapStexNumber);
03084           TString fp_name_short = fMyRootFile->GetRootFileNameShort();
03085           // cout << "*TEcnaHistos::ViewStex(...)> Data are analyzed from file ----> "
03086           //      << fp_name_short << endl;
03087           
03088           fStartDate = fMyRootFile->GetStartDate();
03089           fStopDate  = fMyRootFile->GetStopDate();
03090           fRunType   = fMyRootFile->GetRunType();
03091         }
03092     }
03093   if( arg_AlreadyRead >= 1 )
03094     {
03095       OKFileExists = kTRUE;
03096     }
03097 
03098   if( OKFileExists == kTRUE ) 
03099     {
03100       fStatusFileFound = kTRUE;
03101 
03102       //......................... matrix title    (ViewStex)
03103       char* f_in_mat_tit = new char[fgMaxCar];               fCnew++;
03104       sprintf(f_in_mat_tit, "?");
03105 
03106       if (HistoCode == "D_NOE_ChNb") {sprintf(f_in_mat_tit, "Number of events");}
03107       if (HistoCode == "D_Ped_ChNb") {sprintf(f_in_mat_tit, "Pedestals");}
03108       if (HistoCode == "D_TNo_ChNb") {sprintf(f_in_mat_tit, "Total noise");}
03109       if (HistoCode == "D_MCs_ChNb") {sprintf(f_in_mat_tit, "Mean cor(s,s')");}
03110       if (HistoCode == "D_LFN_ChNb") {sprintf(f_in_mat_tit, "Low frequency noise");}
03111       if (HistoCode == "D_HFN_ChNb") {sprintf(f_in_mat_tit, "High frequency noise");}
03112       if (HistoCode == "D_SCs_ChNb") {sprintf(f_in_mat_tit, "Sigma of cor(s,s')");}
03113       
03114       //................................. Axis parameters
03115       Int_t  GeoBidSizeHoco = fEcal->MaxStinHocoInStex()*fEcal->MaxCrysHocoInStin();
03116       Int_t  GeoBidSizeVeco = fEcal->MaxStinVecoInStex()*fEcal->MaxCrysVecoInStin();
03117 
03118       Int_t  nb_binx  = GeoBidSizeHoco;
03119       Int_t  nb_biny  = GeoBidSizeVeco;
03120       Axis_t xinf_bid = (Axis_t)0.;
03121       Axis_t xsup_bid = (Axis_t)GeoBidSizeHoco;
03122       Axis_t yinf_bid = (Axis_t)0.;
03123       Axis_t ysup_bid = (Axis_t)GeoBidSizeVeco;   
03124       
03125       TString axis_x_var_name = "  #Hoco  ";
03126       TString axis_y_var_name = "  #Veco  ";
03127       
03128       //............. matrices reading and histogram filling   (ViewStex)
03129       
03130       TH2D* h_geo_bid = new TH2D("geobidim_ViewStex", f_in_mat_tit,
03131                                  nb_binx, xinf_bid,  xsup_bid,
03132                                  nb_biny, yinf_bid,  ysup_bid);     fCnewRoot++;
03133 
03134       h_geo_bid->Reset();
03135 
03136       //............................................... 1D histo reading  (ViewStex)
03137       TVectorD partial_histp(fEcal->MaxCrysEcnaInStex());
03138       for(Int_t i=0; i<fEcal->MaxCrysEcnaInStex(); i++){partial_histp(i)=(Double_t)0.;}
03139 
03140       if( arg_AlreadyRead == fTobeRead )
03141         {
03142           if (HistoCode == "D_NOE_ChNb" ){partial_histp = fMyRootFile->ReadNumberOfEvents(fEcal->MaxCrysEcnaInStex());}
03143           if (HistoCode == "D_Ped_ChNb" ){
03144             partial_histp = fMyRootFile->ReadPedestals(fEcal->MaxCrysEcnaInStex());}
03145           if (HistoCode == "D_TNo_ChNb" ){
03146             partial_histp = fMyRootFile->ReadTotalNoise(fEcal->MaxCrysEcnaInStex());}
03147           if (HistoCode == "D_MCs_ChNb" ){
03148             partial_histp = fMyRootFile->ReadMeanCorrelationsBetweenSamples(fEcal->MaxCrysEcnaInStex());}
03149           if (HistoCode == "D_LFN_ChNb" ){
03150             partial_histp = fMyRootFile->ReadLowFrequencyNoise(fEcal->MaxCrysEcnaInStex());}
03151           if (HistoCode == "D_HFN_ChNb" ){
03152             partial_histp = fMyRootFile->ReadHighFrequencyNoise(fEcal->MaxCrysEcnaInStex());}
03153           if (HistoCode == "D_SCs_ChNb" ){
03154             partial_histp = fMyRootFile->ReadSigmaOfCorrelationsBetweenSamples(fEcal->MaxCrysEcnaInStex());}
03155 
03156           OKData = fMyRootFile->DataExist();
03157         }
03158 
03159       if( arg_AlreadyRead >= 1 )
03160         {
03161           partial_histp = arg_read_histo;
03162           OKData = kTRUE;
03163         }
03164 
03165       //------------------------------- Build 2D matrix to be ploted from 1D read histo  (ViewStex)
03166       TMatrixD read_matrix(nb_binx, nb_biny);
03167       for(Int_t i=0; i<nb_binx; i++)
03168         {for(Int_t j=0; j<nb_biny; j++){read_matrix(i,j)=(Double_t)0.;}}
03169 
03170       if ( OKData == kTRUE )
03171         {
03172           fStatusDataExist = kTRUE;
03173 
03174           for(Int_t i0StexStinEcna=0; i0StexStinEcna<fEcal->MaxStinEcnaInStex(); i0StexStinEcna++)
03175             {
03176               if( arg_AlreadyRead == fTobeRead )              
03177                 {n1StexStin = fMyRootFile->GetStexStinFromIndex(i0StexStinEcna);}
03178               if( arg_AlreadyRead >= 1 )
03179                 {n1StexStin = i0StexStinEcna+1;}
03180 
03181               if (n1StexStin != -1)
03182                 {
03183                   //------------------ Geographical bidim filling   (ViewStex)
03184                   for(Int_t i0StinEcha=0; i0StinEcha<fEcal->MaxCrysInStin(); i0StinEcha++)
03185                     {
03186                       Int_t iStexEcha = (n1StexStin-1)*fEcal->MaxCrysInStin() + i0StinEcha;
03187                       Int_t i_xgeo = GetXCrysInStex(fFapStexNumber, n1StexStin, i0StinEcha);
03188                       Int_t i_ygeo = GetYCrysInStex(fFapStexNumber, n1StexStin, i0StinEcha);
03189                       
03190                       if(i_xgeo >=0 && i_xgeo < nb_binx && i_ygeo >=0 && i_ygeo < nb_biny)
03191                         {
03192                           read_matrix(i_xgeo, i_ygeo) = partial_histp(iStexEcha);
03193                           h_geo_bid->Fill((Double_t)i_xgeo, (Double_t)i_ygeo,
03194                                           (Double_t)read_matrix(i_xgeo, i_ygeo));
03195                         }          
03196                     }
03197                 }
03198             }
03199           
03200           //===============  H I S T O   M I N / M A X   M A N A G E M E N T ============  (ViewStex)
03201           
03202           //................................ Put histo min max values
03203           //.......... default if flag not set to "ON"
03204           SetYminMemoFromValue(HistoCode.Data(), fCnaParHistos->GetYminDefaultValue(HistoCode.Data()));
03205           SetYmaxMemoFromValue(HistoCode.Data(), fCnaParHistos->GetYmaxDefaultValue(HistoCode.Data()));
03206           
03207           if( fUserHistoMin == fUserHistoMax ){fFlagUserHistoMin = "AUTO"; fFlagUserHistoMax = "AUTO";}
03208           //.......... user's value if flag set to "ON"
03209           if( fFlagUserHistoMin == "ON" )
03210             {SetYminMemoFromValue(HistoCode.Data(), fUserHistoMin); fFlagUserHistoMin = "OFF";}
03211           if( fFlagUserHistoMax == "ON" )
03212             {SetYmaxMemoFromValue(HistoCode.Data(), fUserHistoMax); fFlagUserHistoMax = "OFF";}
03213           //................................. automatic min and/or max
03214           if( fFlagUserHistoMin == "AUTO" )
03215             {SetYminMemoFromValue(HistoCode.Data(), h_geo_bid->GetMinimum()); fFlagUserHistoMin = "OFF";}
03216           if( fFlagUserHistoMax == "AUTO" )
03217             {SetYmaxMemoFromValue(HistoCode.Data(), h_geo_bid->GetMaximum()); fFlagUserHistoMax = "OFF";}
03218           //...................................... histo set ymin and ymax
03219           SetHistoFrameYminYmaxFromMemo((TH1D*)h_geo_bid, HistoCode);
03220           
03221           // ************************** A GARDER EN RESERVE *******************************
03222           //............. special contour level for correlations (square root wise scale)
03223           //if ( HistoCode == "D_MCs_ChNb" )
03224           //{
03225           //  Int_t nb_niv  = 9;
03226           //  Double_t* cont_niv = new Double_t[nb_niv];           fCnew++;
03227           //  SqrtContourLevels(nb_niv, &cont_niv[0]);      
03228           //  h_geo_bid->SetContour(nb_niv, &cont_niv[0]);            
03229           //  delete [] cont_niv;                                  fCdelete++;
03230           //}
03231           // ******************************** (FIN RESERVE) *******************************
03232           
03233           // =================================== P L O T S ========================   (ViewStex) 
03234           
03235           char* f_in = new char[fgMaxCar];                           fCnew++;
03236 
03237           //...................... Taille/format canvas
03238           UInt_t canv_h = fCnaParHistos->CanvasFormatH("petit");
03239           UInt_t canv_w = fCnaParHistos->CanvasFormatW("petit");
03240 
03241           if( fFlagSubDet == "EB")
03242           {canv_h = fCnaParHistos->CanvasFormatH("etaphiSM");
03243           canv_w = fCnaParHistos->CanvasFormatW("etaphiSM");}
03244           if( fFlagSubDet == "EE")        
03245           {canv_h = fCnaParHistos->CanvasFormatH("IXIYDee");
03246           canv_w = fCnaParHistos->CanvasFormatW("IXIYDee");}
03247 
03248           //............................................... paves commentaires (ViewStex)
03249           SetAllPavesViewStex(fFapStexNumber);
03250           
03251           //------------------------------------ Canvas name ----------------- (ViewStex)  
03252           TString name_cov_cor;
03253           Int_t MaxCar = fgMaxCar;
03254           name_cov_cor.Resize(MaxCar);
03255           name_cov_cor = "?";
03256 
03257           if( HistoCode == "D_NOE_ChNb"){name_cov_cor = "Nb_Of_D_Adc_EvDs";}
03258           if( HistoCode == "D_Ped_ChNb"){name_cov_cor = "Pedestals";}
03259           if( HistoCode == "D_TNo_ChNb"){name_cov_cor = "Total_noise";}
03260           if( HistoCode == "D_MCs_ChNb"){name_cov_cor = "Mean_Corss";}
03261           if( HistoCode == "D_LFN_ChNb"){name_cov_cor = "Low_Fq_Noise";}
03262           if( HistoCode == "D_HFN_ChNb"){name_cov_cor = "High_Fq_Noise";}
03263           if( HistoCode == "D_SCs_ChNb"){name_cov_cor = "Sigma_Corss";}
03264           
03265           TString name_visu;
03266           MaxCar = fgMaxCar;
03267           name_visu.Resize(MaxCar);
03268           name_visu = "colz";
03269           
03270           TString flag_already_read;
03271           MaxCar = fgMaxCar;
03272           flag_already_read.Resize(MaxCar);
03273           flag_already_read = "?";
03274           sprintf(f_in,"M%d", arg_AlreadyRead); flag_already_read = f_in;
03275 
03276           sprintf(f_in, "%s_%s_S1_%d_R%d_%d_%d_%s%d_%s_HocoVeco_R%s",
03277                   name_cov_cor.Data(), fFapAnaType.Data(), fFapNbOfSamples, fFapRunNumber,
03278                   fFapFirstReqEvtNumber, fFapLastReqEvtNumber, fFapStexName.Data(), fFapStexNumber,
03279                   name_visu.Data(), flag_already_read.Data());
03280           
03281           if( fFlagSubDet == "EB" ){SetHistoPresentation((TH1D*)h_geo_bid, "Stex2DEB");}
03282           if( fFlagSubDet == "EE" ){SetHistoPresentation((TH1D*)h_geo_bid, "Stex2DEE");}
03283           
03284           TCanvas *MainCanvas = new TCanvas(f_in, f_in, canv_w, canv_h);   fCnewRoot++;
03285           fCurrentCanvas = MainCanvas; fCurrentCanvasName = f_in;
03286 
03287           // cout << "*TEcnaHistos::ViewStex(...)> Plot is displayed on canvas ----> " << f_in << endl;
03288           
03289           delete [] f_in; f_in = 0;                                 fCdelete++;
03290           
03291           //------------------------ Canvas draw and update ------------ (ViewStex)  
03292           if( fPavComGeneralTitle != 0 ){fPavComGeneralTitle->Draw();}
03293           fPavComStex->Draw();
03294           fPavComAnaRun->Draw();
03295           fPavComNbOfEvts->Draw();
03296 
03297           //----------------------------------------------------------- pad margins
03298           Double_t x_low = fCnaParHistos->BoxLeftX("bottom_left_box")    - 0.005;
03299           Double_t y_low = fCnaParHistos->BoxTopY("bottom_left_box")     + 0.005;
03300           Double_t x_margin = x_low;
03301           Double_t y_margin = y_low;      
03302           MainCanvas->Divide( 1,  1, x_margin, y_margin);
03303           //           Divide(nx, ny, x_margin, y_margin,    color);      
03304           gPad->cd(1);
03305           //........................... specific EE
03306           if( fFlagSubDet == "EE" )
03307             {Double_t x_up  = fCnaParHistos->BoxRightX("bottom_right_box")  + 0.005;
03308             Double_t y_up  = fCnaParHistos->BoxBottomY("top_left_box_Dee") - 0.005;
03309             TVirtualPad* main_subpad = gPad;
03310             main_subpad->SetPad(x_low, y_low, x_up, y_up);}
03311           
03312           //------------------------------------------------------------
03313           h_geo_bid->GetXaxis()->SetTitle(axis_x_var_name);
03314           h_geo_bid->GetYaxis()->SetTitle(axis_y_var_name);
03315           
03316           h_geo_bid->DrawCopy("COLZ");
03317           
03318           // trace de la grille: un rectangle = une tour ou un SC ---------------- (ViewStex) 
03319           ViewStexGrid(fFapStexNumber, " ");
03320           gPad->Draw();
03321           gPad->Update();
03322 
03323           //..................... retour aux options standard
03324           Bool_t b_true = 1;
03325           h_geo_bid->SetStats(b_true);    
03326           h_geo_bid->Delete();  h_geo_bid = 0;              fCdeleteRoot++;
03327 
03328           //      delete MainCanvas;              fCdeleteRoot++;
03329         }  // end of if OKData == kTRUE )
03330       delete [] f_in_mat_tit;    f_in_mat_tit = 0;                        fCdelete++;
03331     } // end of if OKFileExists == kTRUE )
03332   else
03333     {
03334       fStatusFileFound = kFALSE;
03335 
03336       cout << "!TEcnaHistos::ViewStex(...)> *ERROR* =====> "
03337            << " ROOT file not found" << fTTBELL << endl;
03338     }
03339 }  // end of ViewStex(...)
03340 
03341 //===========================================================================
03342 //
03343 //                       StexHocoVecoLHFCorcc(***)
03344 //
03345 //     Geographical view of the cor(c,c) matrices (mean over samples) of
03346 //     all (Stin_A,Stin_A) [case A=B only] of a given Stex (BIG MATRIX)
03347 //
03348 //===========================================================================  
03349 void TEcnaHistos::StexHocoVecoLHFCorcc(const TString Freq)
03350 {
03351 // (Hoco, Veco) matrices for all the Stins of a Stex
03352 
03353   fMyRootFile->PrintNoComment();
03354   fMyRootFile->FileParameters(fFapAnaType,          fFapNbOfSamples,
03355                               fFapRunNumber,        fFapFirstReqEvtNumber,
03356                               fFapLastReqEvtNumber, fFapReqNbOfEvts,
03357                               fFapStexNumber,       fCfgResultsRootFilePath.Data());
03358   
03359   if ( fMyRootFile->LookAtRootFile() == kTRUE )                 // (StexHocoVecoLHFCorcc)
03360     {
03361       fStatusFileFound = kTRUE;
03362 
03363       fFapNbOfEvts = fMyRootFile->GetNumberOfEvents(fFapReqNbOfEvts, fFapStexNumber);
03364       TString fp_name_short = fMyRootFile->GetRootFileNameShort(); 
03365       //cout << "*TEcnaHistos::StexHocoVecoLHFCorcc(...)> Data are analyzed from file ----> "
03366       //     << fp_name_short << endl;
03367 
03368       fStartDate = fMyRootFile->GetStartDate();
03369       fStopDate  = fMyRootFile->GetStopDate();
03370       fRunType   = fMyRootFile->GetRunType();
03371       
03372       //......................... matrix title  
03373       char* f_in_mat_tit = new char[fgMaxCar];               fCnew++;
03374       
03375       if( fFlagSubDet == "EB" && Freq == "LF" )
03376         {sprintf(f_in_mat_tit, "LF Cor(Xtal,Xtal') for each tower in SM");}
03377       if( fFlagSubDet == "EB" && Freq == "HF" )
03378         {sprintf(f_in_mat_tit, "HF Cor(Xtal,Xtal') for each tower in SM");}
03379       if( fFlagSubDet == "EE" && Freq == "LF"  )
03380         {sprintf(f_in_mat_tit, "LF Cor(Xtal,Xtal') for each SC in Dee");}
03381       if( fFlagSubDet == "EE" && Freq == "HF"  )
03382         {sprintf(f_in_mat_tit, "HF Cor(Xtal,Xtal') for each SC in Dee");}
03383 
03384       //................................. Axis parameters
03385       Int_t  GeoBidSizeHoco = fEcal->MaxStinHocoInStex()*fEcal->MaxCrysInStin();
03386       Int_t  GeoBidSizeVeco = fEcal->MaxStinVecoInStex()*fEcal->MaxCrysInStin();
03387 
03388       Int_t  nb_binx  = GeoBidSizeHoco;
03389       Int_t  nb_biny  = GeoBidSizeVeco;
03390       Axis_t xinf_bid = (Axis_t)0.;
03391       Axis_t xsup_bid = (Axis_t)GeoBidSizeHoco;
03392       Axis_t yinf_bid = (Axis_t)0.;
03393       Axis_t ysup_bid = (Axis_t)GeoBidSizeVeco;   
03394       
03395       TString axis_x_var_name = "  #Hoco  ";
03396       TString axis_y_var_name = "  #varVeco  ";
03397 
03398       //======================================================== (StexHocoVecoLHFCorcc)
03399       TVectorD Stin_numbers(fEcal->MaxStinEcnaInStex());
03400       for(Int_t i=0; i<fEcal->MaxStinEcnaInStex(); i++){Stin_numbers(i)=(Double_t)0.;}
03401       Stin_numbers = fMyRootFile->ReadStinNumbers(fEcal->MaxStinEcnaInStex());
03402 
03403       if ( fMyRootFile->DataExist() == kTRUE )
03404         {
03405           fStatusDataExist = kTRUE;
03406 
03407           //............. matrices reading and histogram filling
03408           TMatrixD partial_matrix(fEcal->MaxCrysEcnaInStex(), fEcal->MaxCrysEcnaInStex());
03409           for(Int_t i=0; i<fEcal->MaxCrysEcnaInStex(); i++)
03410             {for(Int_t j=0; j<fEcal->MaxCrysEcnaInStex(); j++){partial_matrix(i,j)=(Double_t)0.;}}
03411 
03412           if( Freq == "LF")
03413             {
03414               partial_matrix = fMyRootFile->ReadLowFrequencyCorrelationsBetweenChannels(fEcal->MaxCrysEcnaInStex());
03415             }
03416           if( Freq == "HF")
03417             {
03418               partial_matrix = fMyRootFile->ReadHighFrequencyCorrelationsBetweenChannels(fEcal->MaxCrysEcnaInStex());
03419             }
03420 
03421           if ( fMyRootFile->DataExist() == kTRUE )
03422             {
03423               fStatusDataExist = kTRUE;
03424               
03425               //............................... 2D histo booking
03426               TH2D* h_geo_bid = new TH2D("geobidim_HocoVecoLHFCorcc", f_in_mat_tit,
03427                                          nb_binx, xinf_bid,  xsup_bid,
03428                                          nb_biny, yinf_bid,  ysup_bid);     fCnewRoot++;
03429               h_geo_bid->Reset();
03430 
03431               fFapStexBarrel = fEcalNumbering->GetStexHalfStas(fFapStexNumber);
03432               
03433               for(Int_t i0StexStinEcna=0; i0StexStinEcna<fEcal->MaxStinEcnaInStex(); i0StexStinEcna++)
03434                 {
03435                   Int_t n1StexStin = (Int_t)Stin_numbers(i0StexStinEcna);
03436                   Int_t offset_x = ((n1StexStin-1)/fEcal->MaxStinVecoInStex())*fEcal->MaxCrysInStin();
03437                   Int_t offset_y = ((n1StexStin-1)%fEcal->MaxStinVecoInStex())*fEcal->MaxCrysInStin();
03438                   
03439                   if (n1StexStin != -1)
03440                     {
03441                       //================================================= (StexHocoVecoLHFCorcc)
03442                       //------------------ Geographical bidim filling
03443                       for(Int_t i0StinEcha=0; i0StinEcha<fEcal->MaxCrysInStin(); i0StinEcha++)
03444                         {
03445                           for(Int_t j0StinEcha=0; j0StinEcha<fEcal->MaxCrysInStin(); j0StinEcha++)
03446                             {
03447                               Int_t i_xgeo = offset_x + i0StinEcha;
03448                               Int_t i_ygeo = offset_y + j0StinEcha;
03449                               
03450                               if(i_xgeo >=0 && i_xgeo < nb_binx && i_ygeo >=0 && i_ygeo < nb_biny)
03451                                 {
03452                                   Int_t iEcha = (n1StexStin-1)*fEcal->MaxCrysInStin() + i0StinEcha;
03453                                   Int_t jEcha = (n1StexStin-1)*fEcal->MaxCrysInStin() + j0StinEcha;
03454                                   
03455                                   h_geo_bid->Fill((Double_t)i_xgeo, (Double_t)i_ygeo,
03456                                                   (Double_t)partial_matrix(iEcha, jEcha));
03457                                 }
03458                             }      
03459                         }
03460                     }
03461                 }
03462               
03463               //===============  H I S T O   M I N / M A X   M A N A G E M E N T ============  (StexHocoVecoLHFCorcc)
03464               
03465               TString HistoCode = "H2CorccInStins";
03466               
03467               //................................ Put histo min max values
03468               //.......... default if flag not set to "ON"
03469               SetYminMemoFromValue(HistoCode.Data(), fCnaParHistos->GetYminDefaultValue(HistoCode.Data()));
03470               SetYmaxMemoFromValue(HistoCode.Data(), fCnaParHistos->GetYmaxDefaultValue(HistoCode.Data()));
03471               
03472               if( fUserHistoMin == fUserHistoMax ){fFlagUserHistoMin = "AUTO"; fFlagUserHistoMax = "AUTO";}
03473               //.......... user's value if flag set to "ON"
03474               if( fFlagUserHistoMin == "ON" )
03475                 {SetYminMemoFromValue(HistoCode.Data(), fUserHistoMin); fFlagUserHistoMin = "OFF";}
03476               if( fFlagUserHistoMax == "ON" )
03477                 {SetYmaxMemoFromValue(HistoCode.Data(), fUserHistoMax); fFlagUserHistoMax = "OFF";}
03478               //................................. automatic min and/or max
03479               if( fFlagUserHistoMin == "AUTO" )
03480                 {SetYminMemoFromValue(HistoCode.Data(), h_geo_bid->GetMinimum()); fFlagUserHistoMin = "OFF";}
03481               if( fFlagUserHistoMax == "AUTO" )
03482                 {SetYmaxMemoFromValue(HistoCode.Data(), h_geo_bid->GetMaximum()); fFlagUserHistoMax = "OFF";}
03483               //...................................... histo set ymin and ymax
03484               SetHistoFrameYminYmaxFromMemo((TH1D*)h_geo_bid, HistoCode);
03485               
03486               // ----------------------------------- P L O T S   (StexHocoVecoLHFCorcc)
03487               
03488               char* f_in = new char[fgMaxCar];                           fCnew++;
03489               
03490               //...................... Taille/format canvas
03491               
03492               UInt_t canv_h = fCnaParHistos->CanvasFormatH("petit");
03493               UInt_t canv_w = fCnaParHistos->CanvasFormatW("petit");
03494               
03495               if( fFlagSubDet == "EB")
03496                 {canv_h = fCnaParHistos->CanvasFormatH("etaphiSM");
03497                 canv_w = fCnaParHistos->CanvasFormatW("etaphiSM");}
03498               if( fFlagSubDet == "EE")    
03499                 {canv_h = fCnaParHistos->CanvasFormatH("IXIYDee");
03500                 canv_w = fCnaParHistos->CanvasFormatW("IXIYDee");}
03501               
03502               //..................................... paves commentaires (StexHocoVecoLHFCorcc)
03503               SetAllPavesViewStex(fFapStexNumber);        
03504               
03505               //----------------- Canvas name ------- (StexHocoVecoLHFCorcc)
03506               TString name_cov_cor;
03507               Int_t MaxCar = fgMaxCar;
03508               name_cov_cor.Resize(MaxCar);
03509               if( Freq == "LF" ){name_cov_cor = "StexLFCorcc";}
03510               if( Freq == "HF" ){name_cov_cor = "StexHFCorcc";}
03511               
03512               TString name_visu;
03513               MaxCar = fgMaxCar;
03514               name_visu.Resize(MaxCar);
03515               name_visu = "colz";
03516               
03517               sprintf(f_in, "%s_%s_S1_%d_R%d_%d_%d_Stex%s%d_%s_HocoVeco",
03518                       name_cov_cor.Data(), fFapAnaType.Data(), fFapNbOfSamples, fFapRunNumber,
03519                       fFapFirstReqEvtNumber, fFapLastReqEvtNumber, fFapStexName.Data(), fFapStexNumber,
03520                       name_visu.Data());
03521               
03522               if( fFlagSubDet == "EB" ){SetHistoPresentation((TH1D*)h_geo_bid, "Stex2DEB");}
03523               if( fFlagSubDet == "EE" ){SetHistoPresentation((TH1D*)h_geo_bid, "Stex2DEE");}
03524               
03525               TCanvas *MainCanvas = new TCanvas(f_in, f_in, canv_w, canv_h);   fCnewRoot++;
03526               fCurrentCanvas = MainCanvas; fCurrentCanvasName = f_in;
03527 
03528               // cout << "*TEcnaHistos::StexHocoVecoLHFCorcc(...)> Plot is displayed on canvas ----> "
03529               //      << f_in << endl;
03530               
03531               delete [] f_in; f_in = 0;                                 fCdelete++;
03532              
03533               //------------ Canvas draw and update ------ (StexHocoVecoLHFCorcc)  
03534               if( fPavComGeneralTitle != 0 ){fPavComGeneralTitle->Draw();}
03535               fPavComStex->Draw();
03536               fPavComAnaRun->Draw();
03537               fPavComNbOfEvts->Draw();
03538 
03539               //----------------------------------------------------------- pad margins
03540               Double_t x_low = fCnaParHistos->BoxLeftX("bottom_left_box")    - 0.005;
03541               Double_t y_low = fCnaParHistos->BoxTopY("bottom_left_box")     + 0.005;
03542               Double_t x_margin = x_low;
03543               Double_t y_margin = y_low;          
03544               MainCanvas->Divide( 1,  1, x_margin, y_margin);
03545               //           Divide(nx, ny, x_margin, y_margin,    color);          
03546               gPad->cd(1);
03547               //........................... specific EE
03548               if( fFlagSubDet == "EE" )
03549                 {
03550                   Double_t x_up  = fCnaParHistos->BoxRightX("bottom_right_box")  + 0.005;
03551                   Double_t y_up  = fCnaParHistos->BoxBottomY("top_left_box_Dee") - 0.005;
03552                   TVirtualPad* main_subpad = gPad;
03553                   main_subpad->SetPad(x_low, y_low, x_up, y_up);
03554                 }
03555               
03556               h_geo_bid->GetXaxis()->SetTitle(axis_x_var_name);
03557               h_geo_bid->GetYaxis()->SetTitle(axis_y_var_name);
03558               
03559               h_geo_bid->DrawCopy("COLZ");
03560               
03561               // trace de la grille: un rectangle = une tour (StexHocoVecoLHFCorcc) 
03562               ViewStexGrid(fFapStexNumber, "corcc");
03563               gPad->Draw();
03564               gPad->Update();
03565 
03566               //..................... retour aux options standard
03567               Bool_t b_true = 1;
03568               h_geo_bid->SetStats(b_true);    
03569               h_geo_bid->Delete();   h_geo_bid = 0;             fCdeleteRoot++;
03570                       
03571               //      delete MainCanvas;              fCdeleteRoot++;
03572             }
03573         }
03574       delete [] f_in_mat_tit;   f_in_mat_tit = 0;               fCdelete++;
03575     } // end of if ( fMyRootFile->LookAtRootFile() == kTRUE )
03576   else
03577     {
03578       fStatusFileFound = kFALSE;
03579 
03580       cout << "!TEcnaHistos::StexHocoVecoLHFCorcc(...)> *ERROR* =====> "
03581            << " ROOT file not found" << fTTBELL << endl;
03582     }
03583 } // end of StexHocoVecoLHFCorcc
03584 
03585 //==================================================================================
03586 //
03587 //                          GetXCrysInStex, GetYCrysInStex
03588 //
03589 //==================================================================================
03590 Int_t TEcnaHistos::GetXCrysInStex(const Int_t&  StexNumber,  const Int_t& n1StexStin,
03591                                   const Int_t&  i0StinEcha) 
03592 {
03593 //Gives the X crystal coordinate in the geographic view of one Stex
03594 // (X = 0 to MaxStinHocoInStex*NbCrysHocoInStin - 1)
03595 
03596   Int_t ix_geo = 0;
03597 
03598   if( fFlagSubDet == "EB")
03599     {TString ctype = fEcalNumbering->GetStexHalfStas(StexNumber);
03600     Int_t n1StexCrys = fEcalNumbering->Get1StexCrysFrom1StexStinAnd0StinEcha(n1StexStin, i0StinEcha, StexNumber);  
03601     ix_geo = (n1StexCrys-1)/fEcal->MaxCrysVecoInStex();  // ix_geo for EB+
03602     if( ctype == "EB-"){ix_geo = fEcal->MaxCrysHocoInStex() - ix_geo - 1;}}
03603 
03604   if( fFlagSubDet == "EE")
03605     {TString DeeDir = fEcalNumbering->GetDeeDirViewedFromIP(StexNumber);  
03606     ix_geo = 0;
03607     if( DeeDir == "right" )
03608       {ix_geo = fEcalNumbering->GetIXCrysInDee(StexNumber, n1StexStin, i0StinEcha) - 1;}
03609     if( DeeDir == "left"  )
03610       {ix_geo = fEcal->MaxCrysIXInDee() - fEcalNumbering->GetIXCrysInDee(StexNumber, n1StexStin, i0StinEcha);}}
03611 
03612   return ix_geo;
03613 }
03614 
03615 Int_t TEcnaHistos::GetYCrysInStex(const Int_t& StexNumber, const Int_t& n1StexStin,
03616                                   const Int_t& j0StinEcha) 
03617 {
03618 //Gives the Y crystal coordinate in the geographic view of one Stex
03619 // (Y = 0 to MaxStinVecoInStex*NbCrysVecoInStin - 1)
03620 
03621   Int_t iy_geo = 0;
03622 
03623   if( fFlagSubDet == "EB")
03624     {TString ctype    = fEcalNumbering->GetStexHalfStas(StexNumber);
03625     Int_t n1StexCrys = fEcalNumbering->Get1StexCrysFrom1StexStinAnd0StinEcha(n1StexStin, j0StinEcha, StexNumber);
03626     Int_t ix_geo = (n1StexCrys-1)/fEcal->MaxCrysVecoInStex();     // ix_geo for EB+
03627     iy_geo = n1StexCrys - 1 - ix_geo*fEcal->MaxCrysVecoInStex();  // iy_geo for EB+
03628     if( ctype == "EB-"){iy_geo = fEcal->MaxCrysVecoInStex() - iy_geo - 1;}}
03629   
03630   if( fFlagSubDet == "EE")
03631     {iy_geo = fEcalNumbering->GetJYCrysInDee(StexNumber, n1StexStin, j0StinEcha) - 1;}
03632   
03633   return iy_geo;
03634 }
03635 
03636 //===========================================================================
03637 //
03638 //     StexStinNumbering, ViewStexStinNumberingPad
03639 //
03640 //              independent of the ROOT file => StexNumber as argument
03641 //
03642 //===========================================================================  
03643 void TEcnaHistos::StexStinNumbering(const Int_t& StexNumber)
03644 {
03645 //display the Stin numbering of the Stex
03646 
03647   if( fFlagSubDet == "EB" ){SMTowerNumbering(StexNumber);}
03648   if( fFlagSubDet == "EE" ){DeeSCNumbering(StexNumber);}
03649 }
03650 // end of StexStinNumbering
03651 
03652 //=============================================================================
03653 //
03654 //                   ViewStexStinNumberingPad
03655 //            independent of the ROOT file => StexNumber as argument
03656 //
03657 //=============================================================================
03658 void TEcnaHistos::ViewStexStinNumberingPad(const Int_t& StexNumber)
03659 {
03660 //display the Stin numbering of the Stex in a Pad
03661 
03662   if( fFlagSubDet ==  "EB"){ViewSMTowerNumberingPad(StexNumber);}
03663   if( fFlagSubDet ==  "EE"){ViewDeeSCNumberingPad(StexNumber);}
03664 }
03665 //---------------->  end of ViewStexStinNumberingPad()
03666 
03667 //==========================================================================
03668 //
03669 //                       ViewStexGrid
03670 //              independent of the ROOT file => StexNumber as argument
03671 //
03672 //==========================================================================
03673 void TEcnaHistos::ViewStexGrid(const Int_t& StexNumber, const TString  c_option)
03674 {
03675  //Grid of one Stex with axis Hoco and Veco
03676 
03677   if( fFlagSubDet ==  "EB"){ViewSMGrid(StexNumber, c_option);}
03678   if( fFlagSubDet ==  "EE"){ViewDeeGrid(StexNumber, c_option);}
03679 
03680 } // end of ViewStexGrid
03681 
03682 //&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&  S P E C I F I C  &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
03683 
03684 //=======================================      BARREL       ===============================
03685 void TEcnaHistos::SMTowerNumbering(const Int_t& SMNumber)
03686 {
03687   //display the tower numbering of the super-module
03688 
03689   if( (SMNumber > 0) && (SMNumber <= fEcal->MaxSMInEB()) )
03690     {
03691       Int_t  GeoBidSizeEta = fEcal->MaxTowEtaInSM()*fEcal->MaxCrysEtaInTow();
03692       Int_t  GeoBidSizePhi = fEcal->MaxTowPhiInSM()*fEcal->MaxCrysPhiInTow();
03693 
03694       Int_t  nb_binx  = GeoBidSizeEta;
03695       Int_t  nb_biny  = GeoBidSizePhi;
03696       Axis_t xinf_bid = (Axis_t)0.;
03697       Axis_t xsup_bid = (Axis_t)GeoBidSizeEta;
03698       Axis_t yinf_bid = (Axis_t)0.;
03699       Axis_t ysup_bid = (Axis_t)GeoBidSizePhi;   
03700   
03701       TString axis_x_var_name = "  #eta  ";
03702       TString axis_y_var_name = "  #varphi  ";
03703 
03704       //------------------------------------------------------------------- SMTowerNumbering
03705   
03706       //............. matrices reading and histogram filling
03707       char* f_in_mat_tit = new char[fgMaxCar];                           fCnew++;
03708 
03709       sprintf(f_in_mat_tit, "SM tower numbering");
03710 
03711       // il faut tracer un bidim vide pour pouvoir tracer la grille et les axes
03712 
03713       TH2D* h_empty_bid = new TH2D("grid_bidim_eta_phi", f_in_mat_tit,
03714                                    nb_binx, xinf_bid, xsup_bid,
03715                                    nb_biny, yinf_bid, ysup_bid);     fCnewRoot++; 
03716       h_empty_bid->Reset();
03717   
03718       h_empty_bid->GetXaxis()->SetTitle(axis_x_var_name);
03719       h_empty_bid->GetYaxis()->SetTitle(axis_y_var_name);
03720 
03721       // ------------------------------------------------ P L O T S   (SMTowerNumbering)
03722   
03723       char* f_in = new char[fgMaxCar];                           fCnew++;
03724   
03725       //...................... Taille/format canvas
03726   
03727       UInt_t canv_h = fCnaParHistos->CanvasFormatH("etaphiSM");
03728       UInt_t canv_w = fCnaParHistos->CanvasFormatW("etaphiSM");
03729   
03730       //............................................... options generales
03731 
03732       fFapStexBarrel = fEcalNumbering->GetSMHalfBarrel(SMNumber);
03733 
03734       //............................................... paves commentaires (SMTowerNumbering)
03735       SetAllPavesViewStex("Numbering", SMNumber);         
03736 
03737       //------------------------------------ Canvas name ----------------- (SMTowerNumbering)  
03738 
03739       sprintf(f_in, "tower_numbering_for_SuperModule_SM%d", SMNumber);
03740   
03741       SetHistoPresentation((TH1D*)h_empty_bid,"Stex2DEB");
03742 
03743       TCanvas *MainCanvas = new TCanvas(f_in, f_in, canv_w, canv_h);   fCnewRoot++;
03744       fCurrentCanvas = MainCanvas; fCurrentCanvasName = f_in;
03745 
03746       // cout << "*TEcnaHistosEB::ViewSM(...)> Plot is displayed on canvas ----> " << f_in << endl;
03747   
03748       delete [] f_in; f_in = 0;                                 fCdelete++;
03749 
03750       //------------------------ Canvas draw and update ------------ (SMTowerNumbering)  
03751       fPavComStex->Draw();
03752   
03753       Double_t x_margin = fCnaParHistos->BoxLeftX("bottom_left_box") - 0.005;
03754       Double_t y_margin = fCnaParHistos->BoxTopY("bottom_right_box") + 0.005; 
03755       MainCanvas->Divide(1, 1, x_margin, y_margin);
03756       gPad->cd(1);
03757 
03758       h_empty_bid->DrawCopy("COL");   // il faut tracer un bidim vide pour pouvoir tracer la grille et les axes
03759 
03760       ViewSMTowerNumberingPad(SMNumber);
03761       gPad->Update();
03762   
03763       //..................... retour aux options standard
03764       Bool_t b_true = 1;
03765       h_empty_bid->SetStats(b_true);    
03766   
03767       h_empty_bid->Delete();  h_empty_bid = 0;            fCdeleteRoot++;      
03768   
03769       //      delete MainCanvas;              fCdeleteRoot++;
03770   
03771       delete [] f_in_mat_tit;  f_in_mat_tit = 0;         fCdelete++;
03772     }
03773   else
03774     {
03775       cout << "!TEcnaHistos::SMTowerNumbering(...)> SM = " << SMNumber
03776            << ". Out of range ( range = [1," << fEcal->MaxSMInEB() << "] )" << fTTBELL << endl;
03777     }
03778 }
03779 // end of SMTowerNumbering
03780 
03781 void TEcnaHistos::ViewSMTowerNumberingPad(const Int_t& SMNumber)
03782 {
03783   //display the tower numbering of the super-module in a Pad
03784 
03785   gStyle->SetTitleW(0.2);        // taille titre histos
03786   gStyle->SetTitleH(0.07);
03787 
03788   ViewSMGrid(SMNumber, " ");
03789 
03790   Color_t couleur_rouge      = fCnaParHistos->SetColorsForNumbers("lvrb_top");
03791   Color_t couleur_bleu_fonce = fCnaParHistos->SetColorsForNumbers("lvrb_bottom");
03792 
03793   //..... Ecriture des numeros de tours dans la grille..... (ViewSMTowerNumberingPad)
03794 
03795   char* f_in = new char[fgMaxCar];                           fCnew++;
03796   gStyle->SetTextSize(0.075);
03797 
03798   // x_channel, y_channel: coordinates of the text "Txx"
03799   Int_t y_channel = 12;
03800   Int_t x_channel = 12;
03801 
03802   Int_t max_tow_phi = fEcal->MaxTowPhiInSM()*fEcal->MaxCrysPhiInTow();
03803 
03804   //------------------ LOOP ON THE SM_TOWER NUMBER   (ViewSMTowerNumberingPad)
03805 
03806   TText *text_SMtow_num = new TText();        fCnewRoot++;
03807 
03808   for (Int_t i_SMtow = 1; i_SMtow <= fEcal->MaxTowInSM(); i_SMtow++)
03809     {
03810       if(fEcalNumbering->GetTowerLvrbType(i_SMtow) == "top")
03811         {text_SMtow_num->SetTextColor(couleur_rouge);}
03812       if(fEcalNumbering->GetTowerLvrbType(i_SMtow) == "bottom")
03813         {text_SMtow_num->SetTextColor(couleur_bleu_fonce);}
03814 
03815       //................................ x from eta
03816       Double_t x_from_eta = fEcalNumbering->GetEta(SMNumber, i_SMtow, x_channel) - (Double_t)1;
03817       if(fEcalNumbering->GetSMHalfBarrel(SMNumber) == "EB-")
03818       {x_from_eta = fEcal->MaxTowEtaInSM()*fEcal->MaxCrysEtaInTow() + x_from_eta + (Double_t)1;}
03819 
03820       //................................ y from phi
03821       Double_t y_from_phi = max_tow_phi - 1
03822         - (fEcalNumbering->GetPhi(SMNumber, i_SMtow, y_channel) - fEcalNumbering->GetPhiMin(SMNumber));
03823       if( fEcalNumbering->GetSMHalfBarrel(SMNumber) == "EB-")
03824         {y_from_phi = - y_from_phi + fEcal->MaxTowPhiInSM()*fEcal->MaxCrysPhiInTow() - (Double_t)1;}
03825 
03826       sprintf(f_in, "%d", i_SMtow);
03827       text_SMtow_num->DrawText(x_from_eta, y_from_phi, f_in);  // <=== prend du temps si on mets "T%d" dans le sprintf
03828     }
03829 
03830   text_SMtow_num->Delete();    text_SMtow_num = 0;         fCdeleteRoot++;
03831 
03832   //.................................................... legende (ViewSMTowerNumberingPad)
03833   Double_t offset_tow_tex_eta = (Double_t)8.;
03834   Double_t offset_tow_tex_phi = (Double_t)15.;
03835 
03836   Color_t couleur_noir = fCnaParHistos->ColorDefinition("noir");
03837   Double_t x_legend    = (Double_t)0.;
03838   Double_t y_legend    = (Double_t)0.;
03839 
03840   Int_t ref_tower = fEcal->MaxTowInSM();
03841 
03842   //.................................................  LVRB TOP (ViewSMTowerNumberingPad)
03843   gStyle->SetTextSize(0.075);  
03844   gStyle->SetTextColor(couleur_rouge);
03845   x_legend = fEcalNumbering->GetEta(SMNumber, ref_tower, x_channel);
03846   y_legend = fEcalNumbering->GetPhi(SMNumber, ref_tower, y_channel) - fEcalNumbering->GetPhiMin(SMNumber);
03847 
03848   if( fEcalNumbering->GetSMHalfBarrel(SMNumber) == "EB+" )
03849     {
03850       x_legend = x_legend + offset_tow_tex_eta;
03851       y_legend = y_legend + offset_tow_tex_phi;
03852     }
03853   if( fEcalNumbering->GetSMHalfBarrel(SMNumber) == "EB-" )
03854     {
03855       x_legend = -x_legend + offset_tow_tex_eta;
03856       y_legend =  y_legend + offset_tow_tex_phi;
03857     }
03858 
03859   sprintf( f_in, "xx");
03860   TText *text_legend_rouge = new TText(x_legend, y_legend, f_in);        fCnewRoot++;
03861   text_legend_rouge->Draw();
03862   gStyle->SetTextSize(0.05);
03863   x_legend = x_legend - (Double_t)3.5;
03864   y_legend = y_legend - (Double_t)2.;
03865   sprintf(f_in, "       LVRB     ");
03866   TText *text_legend_rouge_expl = new TText(x_legend, y_legend, f_in);        fCnewRoot++;
03867   text_legend_rouge_expl->Draw();
03868   y_legend = y_legend - (Double_t)1.75;
03869   if( fEcalNumbering->GetSMHalfBarrel(SMNumber) == "EB+" ){sprintf(f_in, "        <---  ");}
03870   if( fEcalNumbering->GetSMHalfBarrel(SMNumber) == "EB-" ){sprintf(f_in, "        --->  ");}
03871   TText *text_legend_rouge_expm = new TText(x_legend, y_legend, f_in);        fCnewRoot++;
03872   text_legend_rouge_expm->Draw();
03873   //text_legend_rouge_expl->Delete();   text_legend_rouge_expl = 0;          fCdeleteRoot++;
03874   
03875   //.................................................  LVRB BOTTOM (ViewSMTowerNumberingPad)
03876   gStyle->SetTextSize(0.075);  
03877   gStyle->SetTextColor(couleur_bleu_fonce);
03878   x_legend = fEcalNumbering->GetEta(SMNumber, ref_tower, x_channel);
03879   y_legend = fEcalNumbering->GetPhi(SMNumber, ref_tower, y_channel) - fEcalNumbering->GetPhiMin(SMNumber); 
03880 
03881   if( fEcalNumbering->GetSMHalfBarrel(SMNumber) == "EB+" )
03882     {
03883       x_legend = x_legend + offset_tow_tex_eta;
03884       y_legend = y_legend + offset_tow_tex_phi/3;
03885     }
03886   if( fEcalNumbering->GetSMHalfBarrel(SMNumber) == "EB-" )
03887     {
03888       x_legend = -x_legend + offset_tow_tex_eta;
03889       y_legend =  y_legend + offset_tow_tex_phi/3;
03890     }
03891 
03892   sprintf(f_in, "xx");
03893   TText *text_legend_bleu = new TText(x_legend, y_legend, f_in);        fCnewRoot++;
03894   text_legend_bleu->Draw();
03895   //text_legend_bleu->Delete();   text_legend_bleu = 0;          fCdeleteRoot++;
03896   gStyle->SetTextSize(0.05);
03897   x_legend = x_legend - (Double_t)3.5;
03898   y_legend = y_legend - (Double_t)2.;
03899   sprintf( f_in, "       LVRB     ");
03900   TText *text_legend_bleu_expl = new TText(x_legend, y_legend, f_in);        fCnewRoot++;
03901   text_legend_bleu_expl->Draw();
03902   y_legend = y_legend - (Double_t)1.75;
03903   if( fEcalNumbering->GetSMHalfBarrel(SMNumber) == "EB+" ){sprintf( f_in, "        --->  ");}
03904   if( fEcalNumbering->GetSMHalfBarrel(SMNumber) == "EB-" ){sprintf( f_in, "        <---  ");}
03905   TText *text_legend_bleu_expm = new TText(x_legend, y_legend, f_in);        fCnewRoot++;
03906   text_legend_bleu_expm->Draw();
03907   //text_legend_bleu_expl->Delete();   text_legend_bleu_expl = 0;          fCdeleteRoot++;
03908   
03909   delete [] f_in;   f_in = 0;                                    fCdelete++;
03910 
03911   gStyle->SetTextColor(couleur_noir);
03912 }
03913 //---------------->  end of ViewSMTowerNumberingPad()
03914 
03915 void TEcnaHistos::ViewSMGrid(const Int_t& SMNumber, const TString c_option)
03916 {
03917  //Grid of one supermodule with axis eta and phi
03918 
03919   Int_t  GeoBidSizeEta = fEcal->MaxTowEtaInSM()*fEcal->MaxCrysEtaInTow();
03920   Int_t  GeoBidSizePhi = fEcal->MaxTowPhiInSM()*fEcal->MaxCrysPhiInTow();
03921 
03922   if ( c_option == "corcc")
03923     {
03924       GeoBidSizeEta = fEcal->MaxTowEtaInSM()*fEcal->MaxCrysInTow();
03925       GeoBidSizePhi = fEcal->MaxTowPhiInSM()*fEcal->MaxCrysInTow();
03926     }
03927 
03928   Int_t  nb_binx  = GeoBidSizeEta;
03929   Int_t  nb_biny  = GeoBidSizePhi;
03930   Axis_t xinf_bid = (Axis_t)0.;
03931   Axis_t xsup_bid = (Axis_t)GeoBidSizeEta;
03932   Axis_t yinf_bid = (Axis_t)0.;
03933   Axis_t ysup_bid = (Axis_t)GeoBidSizePhi;   
03934   
03935   //---------------- trace de la grille: un rectangle = une tour
03936 
03937   Int_t size_eta = fEcal->MaxCrysEtaInTow();
03938   Int_t size_phi = fEcal->MaxCrysPhiInTow();
03939   if ( c_option == "corcc")
03940     {
03941       size_eta = fEcal->MaxCrysInTow();
03942       size_phi = fEcal->MaxCrysInTow();
03943     }
03944   Int_t max_x = nb_binx/size_eta;
03945   Int_t max_y = nb_biny/size_phi;
03946 
03947   //............................. lignes horizontales
03948   Double_t yline = (Double_t)yinf_bid;
03949 
03950   Double_t xline_left  = (Double_t)xinf_bid;
03951   Double_t xline_right = (Double_t)xsup_bid;
03952   
03953   for( Int_t j = 0 ; j < max_y ; j++)
03954     {
03955       yline = yline + (Double_t)size_phi;
03956       TLine *lin;
03957       lin = new TLine(xline_left, yline, xline_right, yline); fCnewRoot++;
03958       lin->Draw();
03959       // delete lin;             fCdeleteRoot++;
03960     }
03961 
03962   //.......................... lignes verticales
03963   Double_t xline = (Double_t)xinf_bid - (Double_t)size_eta;
03964   
03965   Double_t yline_bot = (Double_t)yinf_bid;
03966   Double_t yline_top = (Double_t)ysup_bid;
03967   
03968   Color_t coul_surligne = fCnaParHistos->ColorDefinition("noir");
03969   Color_t coul_textmodu = fCnaParHistos->ColorDefinition("vert36");
03970 
03971   //............................ Mj text
03972   gStyle->SetTextColor(coul_textmodu);
03973   gStyle->SetTextSize(0.075);
03974 
03975   char* f_in = new char[fgMaxCar];                           fCnew++;
03976 
03977   for( Int_t i = 0 ; i < max_x ; i++)
03978     {  
03979       xline = xline + (Double_t)size_eta;
03980       TLine *lin;
03981       lin = new TLine(xline, yline_bot, xline, yline_top); fCnewRoot++;
03982       
03983       //............. Surlignage separateur des modules
03984       if( (fEcalNumbering->GetSMHalfBarrel(SMNumber) == "EB-") && (i == 4 || i == 8 || i == 12) )
03985         {lin->SetLineWidth(2); lin->SetLineColor(coul_surligne);}      
03986       if( (fEcalNumbering->GetSMHalfBarrel(SMNumber) == "EB+") && (i == 5 || i == 9 || i == 13) )
03987         {lin->SetLineWidth(2); lin->SetLineColor(coul_surligne);}
03988        
03989       lin->Draw();
03990       // delete lin;             fCdeleteRoot++;
03991 
03992       //............. Numeros des modules
03993       if( (fEcalNumbering->GetSMHalfBarrel(SMNumber) == "EB-") && (i == 2 || i == 6 || i == 10 || i == 14)  )
03994         {
03995           if( i ==  2 ){sprintf( f_in, "M4");}
03996           if( i ==  6 ){sprintf( f_in, "M3");}
03997           if( i == 10 ){sprintf( f_in, "M2");}
03998           if( i == 14 ){sprintf( f_in, "M1");}
03999 
04000           TText *text_num_module = new TText(xline + 1, yline_top + 1, f_in);        fCnewRoot++;
04001           text_num_module->Draw();
04002           //text_num_module->Delete(); text_num_module = 0;      fCdeleteRoot++;      
04003         }      
04004       if( (fEcalNumbering->GetSMHalfBarrel(SMNumber) == "EB+") && (i == 3 || i == 7 || i == 11 || i == 15)  )
04005         {
04006           if( i ==  3 ){sprintf( f_in, "M1");}
04007           if( i ==  7 ){sprintf( f_in, "M2");}
04008           if( i == 11 ){sprintf( f_in, "M3");}
04009           if( i == 15 ){sprintf( f_in, "M4");}
04010          
04011           TText *text_num_module = new TText(xline, yline_top + 1, f_in);        fCnewRoot++;
04012           text_num_module->Draw();
04013           //text_num_module->Delete();  text_num_module = 0;    fCdeleteRoot++;     
04014         }
04015     }
04016   delete [] f_in;   f_in = 0;    fCdelete++;
04017 
04018   //------------------ trace axes en eta et phi --------------- ViewSMGrid
04019 
04020   Int_t MatSize      = fEcal->MaxCrysEtaInTow();
04021   if ( c_option == "corcc"){MatSize = fEcal->MaxCrysInTow();}
04022 
04023   Int_t size_eta_sm  = fEcal->MaxTowEtaInSM();
04024   Int_t size_phi_sm  = fEcal->MaxTowPhiInSM();
04025 
04026   //...................................................... Axe i(eta) (bottom x) ViewSMGrid
04027   Double_t eta_min = fEcalNumbering->GetIEtaMin(SMNumber);
04028   Double_t eta_max = fEcalNumbering->GetIEtaMax(SMNumber);
04029 
04030   TString  x_var_name  = GetHocoVecoAxisTitle("ietaSM");;
04031   TString  x_direction = fEcalNumbering->GetXDirectionEB(SMNumber);
04032 
04033   Float_t tit_siz_x = fCnaParHistos->AxisTitleSize();
04034   Float_t lab_siz_x = fCnaParHistos->AxisLabelSize("SMx");
04035   Float_t tic_siz_x = fCnaParHistos->AxisTickSize("SMx");
04036   Float_t tit_off_x = fCnaParHistos->AxisTitleOffset("SMx");
04037   Float_t lab_off_x = fCnaParHistos->AxisLabelOffset("SMx");
04038 
04039   new TF1("f1", x_direction.Data(), eta_min, eta_max);          fCnewRoot++;
04040     TGaxis* sup_axis_x = 0;
04041 
04042   if( x_direction == "-x" ) // NEVER  IN THIS CASE: xmin->xmax <=> right->left ("-x") direction
04043     {sup_axis_x = new TGaxis( (Float_t)0., (Float_t)0., (Float_t)(size_eta_sm*MatSize), (Float_t)0.,
04044                               "f1", size_eta_sm, "SC" , 0.);   fCnewRoot++;}
04045 
04046   if( x_direction == "x" )  // ALWAYS IN THIS CASE: xmin->xmax <=> left->right ("x") direction    
04047     {sup_axis_x = new TGaxis( (Float_t)0., (Float_t)0., (Float_t)(size_eta_sm*MatSize), (Float_t)0.,
04048                               "f1", size_eta_sm, "SC" , 0.);   fCnewRoot++;}
04049   
04050   sup_axis_x->SetTitle(x_var_name);
04051   sup_axis_x->SetTitleSize(tit_siz_x);
04052   sup_axis_x->SetTitleOffset(tit_off_x);
04053   sup_axis_x->SetLabelSize(lab_siz_x);
04054   sup_axis_x->SetLabelOffset(lab_off_x);
04055   sup_axis_x->SetTickSize(tic_siz_x);
04056   sup_axis_x->Draw("SAME");
04057 
04058   //...................................................... Axe phi (y) ViewSMGrid
04059   Double_t phi_min = fEcalNumbering->GetPhiMin(SMNumber);
04060   Double_t phi_max = fEcalNumbering->GetPhiMax(SMNumber);
04061 
04062   TString  y_var_name  = GetHocoVecoAxisTitle("phi");
04063   TString  y_direction = fEcalNumbering->GetYDirectionEB(SMNumber);
04064 
04065   Float_t tit_siz_y = fCnaParHistos->AxisTitleSize();
04066   Float_t lab_siz_y = fCnaParHistos->AxisLabelSize("SMy");
04067   Float_t tic_siz_y = fCnaParHistos->AxisTickSize("SMy");
04068   Float_t tit_off_y = fCnaParHistos->AxisTitleOffset("SMy");
04069   Float_t lab_off_y = fCnaParHistos->AxisLabelOffset("SMy");
04070 
04071   new TF1("f2", y_direction.Data(), phi_min, phi_max);           fCnewRoot++;
04072   TGaxis* sup_axis_y = 0;
04073   
04074   if ( y_direction == "-x" ) // ALWAYS IN THIS CASE: ymin->ymax <=> top->bottom ("-x") direction
04075     {sup_axis_y = new TGaxis(-(Float_t)1.5*(Float_t)size_eta, (Float_t)0.,
04076                              -(Float_t)1.5*(Float_t)size_eta, (Float_t)(size_phi_sm*MatSize),
04077                              "f2", (Int_t)size_phi_sm, "SC", 0.);   fCnewRoot++;}
04078   
04079   if ( y_direction == "x" )  // NEVER  IN THIS CASE: ymin->ymax <=> bottom->top ("x") direction
04080     {sup_axis_y = new TGaxis(-(Float_t)1.5*(Float_t)size_eta, (Float_t)0.,
04081                              -(Float_t)1.5*(Float_t)size_eta, (Float_t)(size_phi_sm*MatSize),
04082                              "f2", (Int_t)size_phi_sm, "SC", 0.);   fCnewRoot++;}
04083   
04084   sup_axis_y->SetTitle(y_var_name);
04085   sup_axis_y->SetTitleSize(tit_siz_y);
04086   sup_axis_y->SetTitleOffset(tit_off_y);
04087   sup_axis_y->SetLabelSize(lab_siz_y);
04088   sup_axis_y->SetLabelOffset(lab_off_y);
04089   sup_axis_y->SetTickSize(tic_siz_y);
04090   sup_axis_y->Draw("SAME");
04091 
04092   //...................................................... Axe jphi (jy) ViewSMGrid
04093   Double_t jphi_min     = fEcalNumbering->GetJPhiMin(SMNumber);
04094   Double_t jphi_max     = fEcalNumbering->GetJPhiMax(SMNumber);
04095 
04096   TString  jy_var_name  = " ";
04097   TString  jy_direction = fEcalNumbering->GetJYDirectionEB(SMNumber);
04098 
04099   new TF1("f3", jy_direction.Data(), jphi_min, jphi_max);           fCnewRoot++;
04100   TGaxis* sup_axis_jy = 0;
04101   
04102   //............; essai
04103   sup_axis_jy = new TGaxis((Float_t)0., (Float_t)0.,
04104                            (Float_t)0., (Float_t)(size_phi_sm*MatSize),
04105                            "f3", (Int_t)size_phi_sm, "SC", 0.);   fCnewRoot++;
04106   
04107   if ( jy_direction == "-x" ) // IN THIS CASE FOR EB+: ymin->ymax <=> top->bottom ("-x") direction
04108     {jy_var_name  = GetEtaPhiAxisTitle("jphiSMB+");}
04109   
04110   if ( jy_direction == "x" )  // IN THIS CASE FOR EB-: ymin->ymax <=> bottom->top ("x") direction
04111     {jy_var_name  = GetEtaPhiAxisTitle("jphiSMB-");}
04112   
04113   lab_off_y = fCnaParHistos->AxisLabelOffset("SMyInEB");
04114 
04115   sup_axis_jy->SetTitle(jy_var_name);
04116   sup_axis_jy->SetTitleSize(tit_siz_y);
04117   sup_axis_jy->SetTitleOffset(tit_off_y);
04118   sup_axis_jy->SetLabelSize(lab_siz_y);
04119   sup_axis_jy->SetLabelOffset(lab_off_y);
04120   sup_axis_jy->SetTickSize(tic_siz_y);
04121   sup_axis_jy->Draw("SAME");
04122 
04123   //--------------------------- ViewSMGrid
04124           
04125   gStyle->SetTextColor(fCnaParHistos->ColorDefinition("noir"));
04126 
04127 } // end of ViewSMGrid
04128 
04129 //=======================================      ENDCAP       ===============================
04130 void TEcnaHistos::DeeSCNumbering(const Int_t& DeeNumber)
04131 {
04132   //display the SC numbering of the Dee
04133 
04134   if( (DeeNumber > 0) && (DeeNumber <= fEcal->MaxDeeInEE()) )
04135     {
04136       Int_t  GeoBidSizeIX = fEcal->MaxSCIXInDee()*fEcal->MaxCrysIXInSC();
04137       Int_t  GeoBidSizeIY = fEcal->MaxSCIYInDee()*fEcal->MaxCrysIYInSC();
04138 
04139       Int_t  nb_binx  = GeoBidSizeIX;
04140       Int_t  nb_biny  = GeoBidSizeIY;
04141       Axis_t xinf_bid = (Axis_t)0.;
04142       Axis_t xsup_bid = (Axis_t)GeoBidSizeIX;
04143       Axis_t yinf_bid = (Axis_t)0.;
04144       Axis_t ysup_bid = (Axis_t)GeoBidSizeIY;   
04145   
04146       TString axis_x_var_name = "  IX  ";
04147       TString axis_y_var_name = "  IY  ";
04148 
04149       //------------------------------------------------------------------- DeeSCNumbering
04150       //........................................... empty histogram filling
04151       char* f_in_mat_tit = new char[fgMaxCar];                           fCnew++;
04152 
04153       sprintf(f_in_mat_tit, " Dee SC numbering ");
04154 
04155       // il faut tracer un bidim vide pour pouvoir tracer la grille et les axes
04156 
04157       TH2D* h_empty_bid = new TH2D("grid_bidim_IX_IY", f_in_mat_tit,
04158                                    nb_binx, xinf_bid,  xsup_bid,
04159                                    nb_biny, yinf_bid,  ysup_bid);     fCnewRoot++;
04160       h_empty_bid->Reset();
04161   
04162       h_empty_bid->GetXaxis()->SetTitle(axis_x_var_name);
04163       h_empty_bid->GetYaxis()->SetTitle(axis_y_var_name);
04164 
04165       // ------------------------------------------------ P L O T S   (DeeSCNumbering)
04166   
04167       char* f_in = new char[fgMaxCar];                           fCnew++;
04168   
04169       //...................... Taille/format canvas
04170   
04171       UInt_t canv_h = fCnaParHistos->CanvasFormatH("IXIYDee");
04172       UInt_t canv_w = fCnaParHistos->CanvasFormatW("IXIYDee");
04173   
04174       //............................................... options generales
04175       fFapStexType = fEcalNumbering->GetEEDeeType(DeeNumber);
04176 
04177       //............................................... paves commentaires (DeeSCNumbering)
04178       SetAllPavesViewStex("Numbering", DeeNumber);
04179 
04180       //------------------------------------ Canvas name ----------------- (DeeSCNumbering)  
04181 
04182       sprintf(f_in, "SC_numbering_for_Dee_Dee%d", DeeNumber);
04183       SetHistoPresentation((TH1D*)h_empty_bid,"Stex2DEENb");
04184       TCanvas *MainCanvas = new TCanvas(f_in, f_in, canv_w, canv_h);   fCnewRoot++;
04185       fCurrentCanvas = MainCanvas; fCurrentCanvasName = f_in;
04186 
04187       // cout << "*TEcnaHistosEE::ViewDee(...)> Plot is displayed on canvas ----> " << f_in << endl;
04188   
04189       delete [] f_in; f_in = 0;                                 fCdelete++;
04190 
04191       //------------------------ Canvas draw and update ------------ (DeeSCNumbering)  
04192       fPavComStex->Draw();
04193       fPavComCxyz->Draw();
04194   
04195       Double_t x_low = fCnaParHistos->BoxLeftX("bottom_left_box")    - 0.005;
04196       Double_t x_up  = fCnaParHistos->BoxRightX("bottom_right_box")  + 0.005;
04197       Double_t y_low = fCnaParHistos->BoxTopY("bottom_left_box")     + 0.005;
04198       Double_t y_up  = fCnaParHistos->BoxBottomY("top_left_box_Dee") - 0.005;
04199   
04200       Double_t x_margin = x_low;
04201       Double_t y_margin = y_low;
04202   
04203       MainCanvas->Divide( 1,  1, x_margin, y_margin);
04204       //           Divide(nx, ny, x_margin, y_margin,    color);
04205   
04206       gPad->cd(1);
04207       TVirtualPad* main_subpad = gPad;
04208       main_subpad->SetPad(x_low, y_low, x_up, y_up);
04209   
04210       h_empty_bid->DrawCopy("COL");   // il faut tracer un bidim vide pour pouvoir tracer la grille et les axes
04211       ViewDeeSCNumberingPad(DeeNumber);
04212       gPad->Update();   // prend beaucoup de temps...
04213   
04214       //..................... retour aux options standard
04215       Bool_t b_true = 1;
04216       h_empty_bid->SetStats(b_true);    
04217   
04218       h_empty_bid->Delete(); h_empty_bid = 0;             fCdeleteRoot++;      
04219 
04220       //      delete MainCanvas;              fCdeleteRoot++;
04221   
04222       delete [] f_in_mat_tit;  f_in_mat_tit = 0;         fCdelete++;
04223     }
04224   else
04225     {
04226       cout << "!TEcnaHistos::DeeSCNumbering(...)> Dee = " << DeeNumber
04227            << ". Out of range ( range = [1," << fEcal->MaxDeeInEE() << "] )" << fTTBELL << endl;
04228     }
04229 }
04230 // end of DeeSCNumbering
04231 
04232 void TEcnaHistos::ViewDeeSCNumberingPad(const Int_t&   DeeNumber)
04233 {
04234 //display the SC numbering of the Dee in a Pad
04235 
04236   gStyle->SetTitleW(0.4);        // taille titre histos
04237   gStyle->SetTitleH(0.08);
04238 
04239   ViewDeeGrid(DeeNumber, " ");
04240 
04241   //..... SC numbers writing in the grid .... (ViewDeeSCNumberingPad)
04242 
04243   char* f_in = new char[fgMaxCar];                           fCnew++;
04244   gStyle->SetTextSize(0.0325);
04245 
04246   //------------------ LOOP ON THE Dee_SC NUMBER   (ViewDeeSCNumberingPad)
04247   Int_t x_channel =  0;    // => defined here after according to DeeDir and SCQuadType
04248   TText *text_DSSC_num      = new TText();        fCnewRoot++;
04249   TText *text_DeeSCCons_num = new TText();        fCnewRoot++;
04250 
04251   for (Int_t n1DeeSCEcna = 1; n1DeeSCEcna <= fEcal->MaxSCEcnaInDee(); n1DeeSCEcna++)
04252     {
04253       TString DeeDir     = fEcalNumbering->GetDeeDirViewedFromIP(DeeNumber);
04254       TString SCQuadType = fEcalNumbering->GetSCQuadFrom1DeeSCEcna(n1DeeSCEcna);
04255       if( SCQuadType == "top"    &&  DeeDir == "right"){x_channel = 13;}
04256       if( SCQuadType == "top"    &&  DeeDir == "left" ){x_channel =  7;}
04257       if( SCQuadType == "bottom" &&  DeeDir == "left" ){x_channel = 11;}  
04258       if( SCQuadType == "bottom" &&  DeeDir == "right"){x_channel = 17;}
04259       Int_t i_SCEcha = (Int_t)x_channel;
04260 
04261       Double_t x_from_IX = (Double_t)GetXCrysInStex(DeeNumber, n1DeeSCEcna, i_SCEcha);
04262       Double_t y_from_IY = (Double_t)GetYCrysInStex(DeeNumber, n1DeeSCEcna, i_SCEcha);
04263       Double_t y_from_IYp = y_from_IY + (Double_t)1.;
04264       Double_t y_from_IYm = y_from_IY - (Double_t)1.;
04265 
04266       TString DeeEndcap  = fEcalNumbering->GetEEDeeEndcap(DeeNumber);
04267       Color_t couleur_SC = GetSCColor(DeeEndcap, DeeDir, SCQuadType);
04268       text_DSSC_num->SetTextColor(couleur_SC);
04269       text_DeeSCCons_num->SetTextColor((Color_t)1);
04270 
04271       Int_t i_DSSC      = fEcalNumbering->GetDSSCFrom1DeeSCEcna(DeeNumber, n1DeeSCEcna);
04272       Int_t i_DeeSCCons = fEcalNumbering->GetDeeSCConsFrom1DeeSCEcna(DeeNumber, n1DeeSCEcna);
04273       if( i_DSSC > 0 )
04274         {
04275           if(
04276              //.................................................... (D2,S9) , (D4,S1)
04277               !(i_DeeSCCons ==  33 && n1DeeSCEcna ==  60) &&
04278               !(i_DeeSCCons ==  33 && n1DeeSCEcna == 119) &&
04279               //................................................... (D2,S8) , (D4,S2)
04280               !(i_DeeSCCons ==  29 && n1DeeSCEcna ==  32) &&   // !(29c and 58c)
04281               !(i_DeeSCCons ==  29 && n1DeeSCEcna == 138) &&
04282               !(i_DeeSCCons ==  29 && n1DeeSCEcna == 157) &&
04283               !(i_DeeSCCons ==  58 && n1DeeSCEcna == 176) &&
04284               !(i_DeeSCCons ==  58 && n1DeeSCEcna == 193) &&
04285               //.................................................... (D2,S7) , (D4,S3)
04286               !(i_DeeSCCons == 149 && n1DeeSCEcna == 188) &&
04287               //.................................................... (D2,S6) , (D4,S4)
04288               !(i_DeeSCCons == 112 && n1DeeSCEcna ==  29) &&
04289               !(i_DeeSCCons == 112 && n1DeeSCEcna == 144) &&
04290               !(i_DeeSCCons == 112 && n1DeeSCEcna == 165) &&
04291               !(i_DeeSCCons == 119 && n1DeeSCEcna == 102) &&
04292               !(i_DeeSCCons == 119 && n1DeeSCEcna == 123) &&
04293               //.................................................... (D2,S5) , (D4,S5)
04294               !(i_DeeSCCons == 132 && n1DeeSCEcna ==  41) &&
04295               //----------------------------------------------------------------------
04296               //.................................................... (D1,S1) , (D3,S9)
04297               !(i_DeeSCCons == 182 && n1DeeSCEcna ==  60) &&
04298               !(i_DeeSCCons == 182 && n1DeeSCEcna == 119) &&
04299               //.................................................... (D1,S2) , (D3,S8)
04300               !(i_DeeSCCons == 178 && n1DeeSCEcna ==  32) &&   // !(178c and 207c)
04301               !(i_DeeSCCons == 178 && n1DeeSCEcna == 138) &&
04302               !(i_DeeSCCons == 178 && n1DeeSCEcna == 157) &&
04303               !(i_DeeSCCons == 207 && n1DeeSCEcna == 176) &&
04304               !(i_DeeSCCons == 207 && n1DeeSCEcna == 193) &&
04305               //.................................................... (D1,S3) , (D3,S7)
04306               !(i_DeeSCCons == 298 && n1DeeSCEcna == 188) &&
04307               //.................................................... (D1,S4) , (D3,S6)
04308               !(i_DeeSCCons == 261 && n1DeeSCEcna ==  29) &&   // !(261a and 268a)
04309               !(i_DeeSCCons == 261 && n1DeeSCEcna == 144) &&
04310               !(i_DeeSCCons == 261 && n1DeeSCEcna == 165) &&
04311               !(i_DeeSCCons == 268 && n1DeeSCEcna == 102) &&
04312               !(i_DeeSCCons == 268 && n1DeeSCEcna == 123) &&
04313               //.................................................... (D1,S5) , (D3,S5)
04314               !(i_DeeSCCons == 281 && n1DeeSCEcna ==  41) 
04315               )
04316             {
04317               sprintf(f_in, "%d", i_DSSC);
04318               text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);      // <=== DrawText: prend du temps
04319               sprintf(f_in, "%d", i_DeeSCCons);
04320               text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in); // <=== DrawText: prend du temps
04321             }
04322 
04323           //.................................................... (D2,S9) , (D4,S1)
04324 
04325           if( i_DeeSCCons ==  33 && n1DeeSCEcna ==  60 )
04326             {
04327               sprintf(f_in, "30a");
04328               text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);
04329               sprintf(f_in, "33a");
04330               text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in);
04331             }
04332           if( i_DeeSCCons ==  33 && n1DeeSCEcna == 119 )
04333             {
04334               sprintf(f_in, "30b");
04335               text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);
04336               sprintf(f_in, "33b");
04337               text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in);
04338             }
04339           //.................................................... (D2,S8) , (D4,S2)
04340           if( i_DeeSCCons ==  29 && n1DeeSCEcna == 32 )
04341             {
04342               sprintf(f_in, " 3c-25c");
04343               text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);
04344               sprintf(f_in, "29c-58c");
04345               text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in);
04346             }
04347           if( i_DeeSCCons ==  29 && n1DeeSCEcna == 138 )
04348             {
04349               sprintf(f_in, "3a");
04350               text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);
04351               sprintf(f_in, "29a");
04352               text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in);
04353             }
04354           if( i_DeeSCCons ==  29 && n1DeeSCEcna == 157 )
04355             {
04356               sprintf(f_in, "3b");
04357               text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);
04358               sprintf(f_in, "29b");
04359               text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in);
04360             }
04361 
04362           if( i_DeeSCCons ==  58 && n1DeeSCEcna == 176 )
04363             {
04364               sprintf(f_in, "25a");
04365               text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);
04366               sprintf(f_in, "58a");
04367               text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in);
04368             }
04369           if( i_DeeSCCons ==  58 && n1DeeSCEcna == 193 )
04370             {
04371               sprintf(f_in, "25b");
04372               text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);
04373               sprintf(f_in, "58b");
04374               text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in);
04375             }
04376           //.................................................... (D2,S7) , (D4,S3)
04377           if( i_DeeSCCons == 149 && n1DeeSCEcna == 188 )
04378             {
04379               sprintf(f_in, "34a");
04380               text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);
04381               sprintf(f_in, "149a");
04382               text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in);
04383             }
04384           //.................................................... (D2,S6) , (D4,S4)
04385           if( i_DeeSCCons == 112 && n1DeeSCEcna == 29 )
04386             {
04387               sprintf(f_in, " 14a-21a");
04388               text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);
04389               sprintf(f_in, "112a-119a");
04390               text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in);
04391             }
04392           if( i_DeeSCCons == 112 && n1DeeSCEcna == 144 )
04393             {
04394               sprintf(f_in, "14c");
04395               text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);
04396               sprintf(f_in, "112c");
04397               text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in);
04398             }
04399           if( i_DeeSCCons == 112 && n1DeeSCEcna == 165 )
04400             {
04401               sprintf(f_in, "14b");
04402               text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);
04403               sprintf(f_in, "112b");
04404               text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in);
04405             }
04406 
04407           if( i_DeeSCCons == 119 && n1DeeSCEcna == 102 )
04408             {
04409               sprintf(f_in, "21c");
04410               text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);
04411               sprintf(f_in, "119c");
04412               text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in);
04413             }
04414           if( i_DeeSCCons == 119 && n1DeeSCEcna == 123 )
04415             {
04416               sprintf(f_in, "21b");
04417               text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);
04418               sprintf(f_in, "119b");
04419               text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in);
04420             }
04421           //.................................................... (D2,S5) , (D4,S5)
04422           if( i_DeeSCCons == 132 && n1DeeSCEcna ==  41 )
04423             {
04424               sprintf(f_in, "3a");
04425               text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);
04426               sprintf(f_in, "132a");
04427               text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in);
04428             }
04429 
04430           //.................................................... (D1,S1) , (D3,S9)
04431           if( i_DeeSCCons == 182 && n1DeeSCEcna ==  60 )
04432             {
04433               sprintf(f_in, "30a");
04434               text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);
04435               sprintf(f_in, "182a");
04436               text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in);
04437             }
04438           if( i_DeeSCCons == 182 && n1DeeSCEcna == 119 )
04439             {
04440               sprintf(f_in, "30b");
04441               text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);
04442               sprintf(f_in, "182b");
04443               text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in);
04444             }
04445           //.................................................... (D1,S2) , (D3,S8)
04446           if( i_DeeSCCons == 178 && n1DeeSCEcna == 32 )
04447             {
04448               sprintf(f_in, "  3c-25c");
04449               text_DSSC_num->DrawText(x_from_IX-6, y_from_IYp, f_in);
04450               sprintf(f_in, "178c-207c");
04451               text_DeeSCCons_num->DrawText(x_from_IX-6, y_from_IYm, f_in);
04452             }
04453           if( i_DeeSCCons == 178 && n1DeeSCEcna == 138 )
04454             {
04455               sprintf(f_in, "3a");
04456               text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);
04457               sprintf(f_in, "178a");
04458               text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in);
04459             }
04460           if( i_DeeSCCons == 178 && n1DeeSCEcna == 157 )
04461             {
04462               sprintf(f_in, "3b");
04463               text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);
04464               sprintf(f_in, "178b");
04465               text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in);
04466             }
04467 
04468           if( i_DeeSCCons == 207 && n1DeeSCEcna == 176 )
04469             {
04470               sprintf(f_in, "25a");
04471               text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);
04472               sprintf(f_in, "207a");
04473               text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in);
04474             }
04475           if( i_DeeSCCons == 207 && n1DeeSCEcna == 193 )
04476             {
04477               sprintf(f_in, "25b");
04478               text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);
04479               sprintf(f_in, "207b");
04480               text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in);
04481             }
04482           //.................................................... (D1,S3) , (D3,S7)
04483           if( i_DeeSCCons == 298 && n1DeeSCEcna == 188 )
04484             {
04485               sprintf(f_in, "34a");
04486               text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);
04487               sprintf(f_in, "298a");
04488               text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in);
04489             }
04490           //.................................................... (D1,S4) , (D3,S6)
04491           if( i_DeeSCCons == 261 && n1DeeSCEcna == 29 )
04492             {
04493               sprintf(f_in, " 14a-21a");
04494               text_DSSC_num->DrawText(x_from_IX-6, y_from_IYp, f_in);
04495               sprintf(f_in, "261a-268a");
04496               text_DeeSCCons_num->DrawText(x_from_IX-6, y_from_IYm, f_in);
04497             }
04498           if( i_DeeSCCons == 261 && n1DeeSCEcna == 144 )
04499             {
04500               sprintf(f_in, "14c");
04501               text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);
04502               sprintf(f_in, "261c");
04503               text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in);
04504             }
04505           if( i_DeeSCCons == 261 && n1DeeSCEcna == 165 )
04506             {
04507               sprintf(f_in, "14b");
04508               text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);
04509               sprintf(f_in, "261b");
04510               text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in);
04511             }
04512 
04513           if( i_DeeSCCons == 268 && n1DeeSCEcna == 102 )
04514             {
04515               sprintf(f_in, "21c");
04516               text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);
04517               sprintf(f_in, "268c");
04518               text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in);
04519             }
04520           if( i_DeeSCCons == 268 && n1DeeSCEcna == 123 )
04521             {
04522               sprintf(f_in, "21b");
04523               text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);
04524               sprintf(f_in, "268b");
04525               text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in);
04526             }
04527           //.................................................... (D1,S5) , (D3,S5)
04528           if( i_DeeSCCons == 281 && n1DeeSCEcna ==  41 )
04529             {
04530               sprintf(f_in, "20a");
04531               text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);
04532               sprintf(f_in, "281a");
04533               text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in);
04534             }
04535         }
04536     }
04537 
04538   // delete text_DSSC_num;             fCdeleteRoot++;
04539  
04540   //......................... mention "color, black"  
04541   Color_t coul_textcolors = fCnaParHistos->ColorDefinition("noir");
04542   sprintf( f_in, "color: nb in Data Sector, black: nb for construction");
04543   Int_t x_colors = 3;
04544   Int_t y_colors = -14;
04545 
04546   TText *text_colors = new TText(x_colors, y_colors, f_in);        fCnewRoot++;
04547   text_colors->SetTextSize(0.03);
04548   text_colors->SetTextColor(coul_textcolors);
04549   text_colors->Draw();
04550 
04551   delete [] f_in;  f_in = 0;                                     fCdelete++;
04552 
04553   Color_t couleur_noir = fCnaParHistos->ColorDefinition("noir");
04554   gStyle->SetTextColor(couleur_noir);
04555 }
04556 //---------------->  end of ViewDeeSCNumberingPad()
04557 
04558 void TEcnaHistos::ViewDeeGrid(const Int_t& DeeNumber, const TString c_option)
04559 {
04560  //Grid of one Dee with axis IX and IY
04561 
04562   Int_t  GeoBidSizeIX = fEcal->MaxSCIXInDee()*fEcal->MaxCrysIXInSC();
04563   Int_t  GeoBidSizeIY = fEcal->MaxSCIYInDee()*fEcal->MaxCrysIYInSC();
04564 
04565   if ( c_option == "corcc")
04566     {
04567       GeoBidSizeIX = fEcal->MaxSCIXInDee()*fEcal->MaxCrysInSC();
04568       GeoBidSizeIY = fEcal->MaxSCIYInDee()*fEcal->MaxCrysInSC();
04569     }
04570 
04571   Int_t  nb_binx  = GeoBidSizeIX;
04572   Int_t  nb_biny  = GeoBidSizeIY;
04573   Axis_t xinf_bid = (Axis_t)0.;
04574   Axis_t xsup_bid = (Axis_t)GeoBidSizeIX;
04575  
04576   Axis_t   yinf_bid = (Axis_t)0.;
04577   Axis_t   ysup_bid = (Axis_t)GeoBidSizeIY;
04578   Double_t ymid_bid = (Double_t)(ysup_bid-yinf_bid)/2.;
04579  
04580   //---------------- trace de la grille: un rectangle = un super-cristal
04581 
04582   Int_t size_IX = fEcal->MaxCrysIXInSC();
04583   Int_t size_IY = fEcal->MaxCrysIYInSC();
04584 
04585   if ( c_option == "corcc"){size_IX = fEcal->MaxCrysInSC(); size_IY = fEcal->MaxCrysInSC();}
04586 
04587   Int_t max_x  = nb_binx/size_IX;
04588   Int_t max_y  = nb_biny/size_IY;
04589   Int_t max_yd = max_y/2;
04590 
04591   //= SURLIGNAGES (unite de coordonnees: le cristal ou 5 fois le cristal si option corcc)
04592   //........................... multplicative coefficient for corcc option
04593   Int_t coefcc_x = 1;
04594   Int_t coefcc_y = 1;
04595   if ( c_option == "corcc"){coefcc_x = fEcal->MaxCrysIXInSC(); coefcc_y = fEcal->MaxCrysIYInSC();}
04596 
04597   //............................. lignes horizontales
04598   Double_t yline = (Double_t)yinf_bid - (Double_t)size_IY;
04599 
04600   Double_t xline_beg = (Double_t)xinf_bid;
04601   Double_t xline_end = (Double_t)xsup_bid;
04602 
04603   //           k  =   0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10
04604   Int_t x_min[11] = {11,11, 7, 0, 0, 0, 0, 0, 0, 0, 0};
04605   Int_t x_max[11] = {50,50,47,45,45,42,37,35,30,15,50}; 
04606   for(Int_t i=0;i<11;i++){x_min[i] = coefcc_x*x_min[i]; x_max[i] = coefcc_x*x_max[i];}
04607   
04608   for( Int_t j = 0 ; j < max_y ; j++)
04609     {
04610       if( j < max_yd )  // j = 0,1,2,3,4,5,6,7,8,9
04611         {
04612           if( DeeNumber == 1 || DeeNumber == 3 ) 
04613             {
04614               xline_beg = xinf_bid + (Double_t)x_min[10-j];
04615               xline_end = xinf_bid + (Double_t)x_max[10-j];
04616             }
04617           if( DeeNumber == 2 || DeeNumber == 4 ) 
04618             {
04619               xline_beg = xsup_bid - (Double_t)x_max[10-j];
04620               xline_end = xsup_bid - (Double_t)x_min[10-j];
04621             }
04622         }
04623 
04624       if( j == max_yd ) // j = 10
04625         {
04626           if( DeeNumber == 1 || DeeNumber == 3 ) 
04627             {
04628               xline_beg = xinf_bid + (Double_t)x_min[0];
04629               xline_end = xinf_bid + (Double_t)x_max[0];
04630             }
04631           if( DeeNumber == 2 || DeeNumber == 4 ) 
04632             {
04633               xline_beg = xsup_bid - (Double_t)x_max[0];
04634               xline_end = xsup_bid - (Double_t)x_min[0];
04635             }
04636         }
04637 
04638       if( j > max_yd ) // j = 11,12,13,14,15,16,17,18,19,20
04639         {
04640           if( DeeNumber == 1 || DeeNumber == 3 ) 
04641             {
04642               xline_beg = xinf_bid + (Double_t)x_min[j-10];
04643               xline_end = xinf_bid + (Double_t)x_max[j-10];
04644             }
04645           if( DeeNumber == 2 || DeeNumber == 4 ) 
04646             {
04647               xline_beg = xsup_bid - (Double_t)x_max[j-10];
04648               xline_end = xsup_bid - (Double_t)x_min[j-10];
04649             }
04650         }
04651 
04652       yline = yline + (Double_t)size_IY;
04653       TLine *lin;
04654       lin = new TLine(xline_beg, yline, xline_end, yline); fCnewRoot++;
04655       lin->Draw();
04656       //lin->Delete();   // => si on delete, pas de trace de la ligne
04657       // delete lin;             fCdeleteRoot++;
04658     }
04659 
04660   //.......................... lignes verticales
04661   Double_t xline = (Double_t)xinf_bid - (Double_t)size_IX;
04662   
04663   Double_t yline_haut_bot = (Double_t)ymid_bid;
04664   Double_t yline_haut_top = (Double_t)ysup_bid;
04665 
04666   Double_t yline_bas_bot = (Double_t)yinf_bid;
04667   Double_t yline_bas_top = (Double_t)ymid_bid;
04668 
04669   // coordonnees demi-lignes 
04670   //           l  =   0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10
04671   Int_t y_min[11] = { 0,11, 7, 0, 0, 0, 0, 0, 0, 0, 0};
04672   Int_t y_max[11] = {50,50,47,45,45,42,38,35,30,15,10};
04673   for(Int_t i=0;i<11;i++){y_min[i] = coefcc_y*y_min[i]; y_max[i] = coefcc_y*y_max[i];}
04674 
04675   gStyle->SetTextSize(0.075);   //  ===> pourquoi pas avant?
04676 
04677   for( Int_t i = 0 ; i <= max_x ; i++)
04678     {
04679       if( DeeNumber == 1 || DeeNumber == 3 ) 
04680         {
04681           yline_haut_bot = ymid_bid + (Double_t)y_min[i];
04682           yline_haut_top = ymid_bid + (Double_t)y_max[i];
04683         }
04684       if( DeeNumber == 2 || DeeNumber == 4 ) 
04685         {
04686           yline_haut_bot = ymid_bid + (Double_t)y_min[10-i];
04687           yline_haut_top = ymid_bid + (Double_t)y_max[10-i];
04688         }
04689       yline_bas_bot  = ysup_bid - yline_haut_top;
04690       yline_bas_top  = ysup_bid - yline_haut_bot;
04691       
04692       xline = xline + (Double_t)size_IX;
04693       TLine *lin_haut;
04694       lin_haut = new TLine(xline, yline_haut_bot, xline, yline_haut_top); fCnewRoot++;
04695       lin_haut->Draw();
04696       // delete lin_haut;             fCdeleteRoot++;
04697       TLine *lin_bas;
04698       lin_bas = new TLine(xline, yline_bas_bot, xline, yline_bas_top); fCnewRoot++;
04699       lin_bas->Draw();
04700       // delete lin_bas;             fCdeleteRoot++;
04701     }
04702 
04703   EEDataSectors(coefcc_x, coefcc_y, DeeNumber, "Dee");
04704   EEGridAxis(coefcc_x, coefcc_y, DeeNumber, "Dee", c_option);
04705 
04706 } // end of ViewDeeGrid
04707 
04708 //=================================================================================
04709 //
04710 //             SqrtContourLevels(const Int_t& nb_niv, Double_t* cont_niv)
04711 //
04712 //=================================================================================
04713 void TEcnaHistos::SqrtContourLevels(const Int_t& nb_niv, Double_t* cont_niv)
04714 {
04715 //Calculation of levels in z coordinate for 3D plots. Square root scale
04716   
04717   Int_t nb_niv2 = (nb_niv+1)/2;
04718   
04719   for (Int_t num_niv = 0; num_niv < nb_niv2; num_niv++)
04720     {
04721       Int_t ind_niv = num_niv + nb_niv2 - 1;
04722       if ( ind_niv < 0 || ind_niv > nb_niv )
04723         {
04724           cout << "!TEcnaHistos::ContourLevels(...)> *** ERROR *** "
04725                << "wrong contour levels for correlation matrix"
04726                << fTTBELL << endl;
04727         }
04728       else
04729         {
04730           cont_niv[ind_niv] =
04731             (Double_t)(num_niv*num_niv)/
04732             ((Double_t)((nb_niv2-1)*(nb_niv2-1)));
04733         }
04734     }
04735   for (Int_t num_niv = -1; num_niv > -nb_niv2; num_niv--)
04736     {
04737       Int_t ind_niv = num_niv + nb_niv2 - 1;
04738       if ( ind_niv < 0 || ind_niv > nb_niv )
04739         {
04740           cout << "!TEcnaHistos::ContourLevels(...)> *** ERROR *** "
04741                << "wrong contour levels for correlation matrix"
04742                << fTTBELL << endl;
04743         }
04744       else
04745         {
04746           cont_niv[ind_niv] =
04747             -(Double_t)(num_niv*num_niv)/
04748             ((Double_t)((nb_niv2-1)*(nb_niv2-1)));
04749         }
04750     }
04751 }
04752 
04753 //==========================================================================
04754 //
04755 //                    GetHocoVecoAxisTitle
04756 //
04757 //==========================================================================
04758 TString TEcnaHistos::GetHocoVecoAxisTitle(const TString chcode)
04759 {
04760   TString xname = " ";
04761 
04762   if ( fFlagSubDet == "EB" ){xname = GetEtaPhiAxisTitle(chcode);}
04763   if ( fFlagSubDet == "EE" ){xname = GetIXIYAxisTitle(chcode);}
04764 
04765   return xname;
04766 }
04767 
04768 TString TEcnaHistos::GetEtaPhiAxisTitle(const TString chcode)
04769 {
04770   TString xname = " ";
04771 
04772   if ( chcode == "ietaEB" ){xname = "i#eta Xtal ";}
04773   if ( chcode == "ietaSM" ){xname = "i#eta Xtal ";}
04774   if ( chcode == "ietaTow"){xname = "i#eta Xtal        ";}
04775 
04776   if ( chcode == "iphiEB"   ){xname = "         i#varphi Xtal";}
04777   if ( chcode == "jphiEB+"  ){xname = "         i#varphi Xtal";}
04778   if ( chcode == "jphiEB-"  ){xname = "         i#varphi Xtal";}
04779   if ( chcode == "jphiSMB+" ){xname = "         i#varphi Xtal";}
04780   if ( chcode == "jphiSMB-" ){xname = "i#varphi Xtal    ";}
04781   if ( chcode == "jphiTow"  ){xname = "i#varphi Xtal in SM        ";}
04782   if ( chcode == "phi"      ){xname = "i#varphi Xtal in EB  ";}
04783 
04784   return xname;
04785 }
04786 
04787 TString TEcnaHistos::GetIXIYAxisTitle(const TString chcode)
04788 {
04789   TString xname = " ";
04790 
04791   if ( chcode == "iIXDee"  ){xname = "IX(SC)";}
04792 
04793   if ( chcode == "iIXDee1" ){xname = "                                                    -IX Xtal";}
04794   if ( chcode == "iIXDee2" ){xname = " IX Xtal                                                     ";}
04795   if ( chcode == "iIXDee3" ){xname = " IX Xtal";}
04796   if ( chcode == "iIXDee4" ){xname = "-IX Xtal                                                             ";}
04797 
04798   if ( chcode == "iIXEE"   ){xname = "                      IX Xtal";}
04799 
04800   if ( chcode == "iIXSC"  ){xname = "IX Xtal";}
04801 
04802   if ( chcode == "jIYDee" ){xname = "IY Xtal";}
04803   if ( chcode == "jIYSC"  ){xname = "IY Xtal";}
04804   if ( chcode == "IY"     ){xname = "IY";}
04805 
04806   return xname;
04807 }
04808 
04809 //=======================================================================================
04810 //
04811 //                              ViewStas(***)     
04812 //
04813 //           (Hoco,Veco) matrices for all the Stex's of a Stas             
04814 //                        Stas = EB or EE
04815 //
04816 //=======================================================================================
04817 void TEcnaHistos::ViewStas(const TVectorD& arg_read_histo, const Int_t& arg_AlreadyRead,
04818                            const TString   HistoCode)
04819 {
04820 // (Hoco, Veco) matrices for all the Stex's of a Stas
04821 
04822   //......................... matrix title  
04823   char* f_in_mat_tit = new char[fgMaxCar];               fCnew++;
04824           
04825   if (HistoCode == "D_NOE_ChNb"){sprintf(f_in_mat_tit, "Number of Events");}
04826   if (HistoCode == "D_Ped_ChNb"){sprintf(f_in_mat_tit, "Pedestals");}
04827   if (HistoCode == "D_TNo_ChNb"){sprintf(f_in_mat_tit, "Total noise");}
04828   if (HistoCode == "D_MCs_ChNb"){sprintf(f_in_mat_tit, "Mean cor(s,s')");}
04829   if (HistoCode == "D_LFN_ChNb"){sprintf(f_in_mat_tit, "Low frequency noise");}
04830   if (HistoCode == "D_HFN_ChNb"){sprintf(f_in_mat_tit, "High frequency noise");}
04831   if (HistoCode == "D_SCs_ChNb"){sprintf(f_in_mat_tit, "Sigma of cor(s,s')");}
04832           
04833   //.... Axis parameters: *** WARNING *** EB ===>  x (Bid Hoco) = phi (StinVeco),  y (Bid Veco) = eta (StinHoco)
04834   Int_t GeoBidSizeHoco = fEcal->MaxStinVecoInStas();
04835   Int_t GeoBidSizeVeco = fEcal->MaxStinHocoInStas();
04836 
04837   Int_t vertic_empty_strips  = 3;
04838   Int_t vertic_empty_strip_1 = 1;
04839 
04840   if ( fFlagSubDet == "EE" )
04841     {
04842       // for empty vertical strips: before EE-, between EE- and EE+, after EE+ on plot
04843       GeoBidSizeHoco = fEcal->MaxStinHocoInStas() + vertic_empty_strips; 
04844       GeoBidSizeVeco = fEcal->MaxStinVecoInStas();
04845     }
04846 
04847   Int_t  nb_binx  = GeoBidSizeHoco;
04848   Int_t  nb_biny  = GeoBidSizeVeco;
04849   Axis_t xinf_bid = (Axis_t)0.;
04850   Axis_t xsup_bid = (Axis_t)GeoBidSizeHoco;
04851   Axis_t yinf_bid = (Axis_t)0.;
04852   Axis_t ysup_bid = (Axis_t)GeoBidSizeVeco;   
04853       
04854   TString axis_x_var_name = "  #Hoco  ";
04855   TString axis_y_var_name = "  #varVeco  ";
04856 
04857   //............. matrices reading and histogram filling   (ViewStas)
04858 
04859   TH2D* h_geo_bid = new TH2D("geobidim_ViewStas", f_in_mat_tit,
04860                              nb_binx, xinf_bid,   xsup_bid,
04861                              nb_biny, yinf_bid,   ysup_bid);     fCnewRoot++;
04862   h_geo_bid->Reset();
04863 
04864   Int_t CounterExistingFile = 0;
04865   Int_t CounterDataExist = 0;
04866 
04867   Int_t* xFapNbOfEvts = new Int_t[fEcal->MaxStexInStas()];      fCnew++;
04868   for(Int_t i=0; i<fEcal->MaxStexInStas(); i++){xFapNbOfEvts[i]=0;}
04869 
04870   //Int_t* NOFE_int = new Int_t[fEcal->MaxCrysEcnaInStex()];      fCnew++;
04871 
04872   //......................................................................... (ViewStas)
04873   for(Int_t iStasStex=0; iStasStex<fEcal->MaxStexInStas(); iStasStex++)
04874     {
04875       TVectorD partial_histp(fEcal->MaxStinEcnaInStex());
04876       for(Int_t i=0; i<fEcal->MaxStinEcnaInStex(); i++){partial_histp(i)=(Double_t)0.;}
04877 
04878       Bool_t OKFileExists = kFALSE;
04879       Bool_t OKDataExist  = kFALSE;
04880 
04881       if( arg_AlreadyRead == fTobeRead )
04882         {
04883           fMyRootFile->PrintNoComment();
04884           Int_t n1StasStex = iStasStex+1;
04885           fMyRootFile->FileParameters(fFapAnaType,          fFapNbOfSamples,
04886                                       fFapRunNumber,        fFapFirstReqEvtNumber,
04887                                       fFapLastReqEvtNumber, fFapReqNbOfEvts,
04888                                       n1StasStex,           fCfgResultsRootFilePath.Data());
04889           
04890           if ( fMyRootFile->LookAtRootFile() == kTRUE ){OKFileExists = kTRUE;}       //   (ViewStas)
04891 
04892           if( OKFileExists == kTRUE )
04893             {
04894               xFapNbOfEvts[iStasStex] = fMyRootFile->GetNumberOfEvents(fFapReqNbOfEvts, n1StasStex);
04895               TString fp_name_short = fMyRootFile->GetRootFileNameShort();
04896               // cout << "*TEcnaHistos::ViewStas(...)> Data are analyzed from file ----> "
04897               //      << fp_name_short << endl;
04898               
04899               //....................... search for first and last dates
04900               if( iStasStex == 0 )
04901                 {
04902                   fStartTime = fMyRootFile->GetStartTime();
04903                   fStopTime  = fMyRootFile->GetStopTime();
04904                   fStartDate = fMyRootFile->GetStartDate();
04905                   fStopDate  = fMyRootFile->GetStopDate();
04906                 }
04907               
04908               time_t  xStartTime = fMyRootFile->GetStartTime();
04909               time_t  xStopTime  = fMyRootFile->GetStopTime();
04910               TString xStartDate = fMyRootFile->GetStartDate();
04911               TString xStopDate  = fMyRootFile->GetStopDate();
04912 
04913               if( xStartTime < fStartTime ){fStartTime = xStartTime; fStartDate = xStartDate;}
04914               if( xStopTime  > fStopTime  ){fStopTime  = xStopTime;  fStopDate  = xStopDate;}
04915               
04916               fRunType = fMyRootFile->GetRunType();
04917 
04918               //----------------------------------------------------------------------------- file reading   (ViewStas)
04919               if( HistoCode == "D_NOE_ChNb" ){
04920                 partial_histp = fMyRootFile->ReadAverageNumberOfEvents(fEcal->MaxStinEcnaInStex());}
04921               if( HistoCode == "D_Ped_ChNb" ){
04922                  partial_histp = fMyRootFile->ReadAveragePedestals(fEcal->MaxStinEcnaInStex());}
04923               if (HistoCode == "D_TNo_ChNb" ){
04924                 partial_histp = fMyRootFile->ReadAverageTotalNoise(fEcal->MaxStinEcnaInStex());}
04925               if( HistoCode == "D_MCs_ChNb" ){
04926                 partial_histp = fMyRootFile->ReadAverageMeanCorrelationsBetweenSamples(fEcal->MaxStinEcnaInStex());}
04927               if( HistoCode == "D_LFN_ChNb" ){
04928                 partial_histp = fMyRootFile->ReadAverageLowFrequencyNoise(fEcal->MaxStinEcnaInStex());}
04929               if( HistoCode == "D_HFN_ChNb" ){
04930                 partial_histp = fMyRootFile->ReadAverageHighFrequencyNoise(fEcal->MaxStinEcnaInStex());}
04931               if( HistoCode == "D_SCs_ChNb" ){
04932                 partial_histp = fMyRootFile->ReadAverageSigmaOfCorrelationsBetweenSamples(fEcal->MaxStinEcnaInStex());}
04933           
04934               if ( fMyRootFile->DataExist() == kTRUE ){OKDataExist = kTRUE;}
04935             }
04936           else
04937             {
04938               fStatusFileFound = kFALSE;
04939               cout << "!TEcnaHistos::ViewStas(...)> *ERROR* =====> "
04940                    << " ROOT file not found" << fTTBELL << endl;
04941             }
04942         }
04943 
04944       if( arg_AlreadyRead == 1 )
04945         {
04946           OKDataExist = kTRUE;
04947           for(Int_t i0Stin=0; i0Stin<fEcal->MaxStinEcnaInStex(); i0Stin++)
04948             {
04949               partial_histp(i0Stin) = arg_read_histo(fEcal->MaxStinEcnaInStex()*iStasStex+i0Stin);
04950             }
04951         }
04952       
04953       if( OKDataExist == kTRUE)
04954         {
04955           fStatusFileFound = kTRUE;
04956           CounterExistingFile++;
04957 
04958           //.................................................................     (ViewStas)
04959           TMatrixD read_matrix(nb_binx, nb_biny);
04960           for(Int_t i=0; i<nb_binx; i++)
04961             {for(Int_t j=0; j<nb_biny; j++){read_matrix(i,j)=(Double_t)0.;}}
04962 
04963           if ( OKDataExist == kTRUE )
04964             {
04965               fStatusDataExist = kTRUE;
04966               CounterDataExist++;
04967 
04968               for(Int_t i0StexStinEcna=0; i0StexStinEcna<fEcal->MaxStinEcnaInStex(); i0StexStinEcna++)
04969                 {
04970                   //-------------------------------------- Geographical bidim filling   (ViewStas)
04971                   Int_t i_xgeo = GetXStinInStas(iStasStex, i0StexStinEcna, vertic_empty_strip_1);
04972                   Int_t i_ygeo = GetYStinInStas(iStasStex, i0StexStinEcna);
04973 
04974                   if(i_xgeo >=0 && i_xgeo < nb_binx && i_ygeo >=0 && i_ygeo < nb_biny)
04975                     {
04976                       Int_t n1StexStinEcna = i0StexStinEcna+1;
04977 
04978                       if( fFlagSubDet == "EB" )
04979                         {            
04980                           read_matrix(i_xgeo, i_ygeo) = partial_histp(i0StexStinEcna);
04981                           h_geo_bid->Fill((Double_t)i_xgeo, (Double_t)i_ygeo,
04982                                           (Double_t)read_matrix(i_xgeo, i_ygeo));
04983                         }
04984 
04985                       if( fFlagSubDet == "EE" )
04986                         {
04987                           //---------------------> do not draw bin for SCEcna = 10 or 11          (ViewStas)
04988                           if( !( (n1StexStinEcna == 10 || n1StexStinEcna == 11 ||
04989                                   n1StexStinEcna == 29 || n1StexStinEcna == 32) ) )
04990                             {
04991                               read_matrix(i_xgeo, i_ygeo) = partial_histp(i0StexStinEcna);
04992                               h_geo_bid->Fill((Double_t)i_xgeo, (Double_t)i_ygeo,
04993                                               (Double_t)read_matrix(i_xgeo, i_ygeo));
04994                             }
04995                           if( n1StexStinEcna == 29 )
04996                             {
04997                               //----------------------------------------------------------------- (ViewStas)
04998                               //   Average on SCEcna 29 (x1+x2+x3+x6+x7) and SCEcna 10: (x11)
04999                               //   (x = Xtal# in SC; see CMS NOTE 2006/027, p.10)
05000                               // 
05001                               //   (x1+x2+x3+x6+x7)/5 = partial_histp(29-1)   ;   x11 = partial_histp(10-1) 
05002                               //
05003                               //    => (x1+x2+x3+x6+x7+x11)/6 = partial_histp(29-1)*5/6 + partial_histp(10-1)/6
05004                               //
05005                               //   //  except for "D_NOE_ChNb" because average done in ReadAverageNumberOfEvents
05006                               //   //  (no averaged NbOfEvts in root file)
05007                               //---------------------------------------------------------------------------------
05008                               read_matrix(i_xgeo, i_ygeo) =
05009                                 partial_histp(i0StexStinEcna)*(Double_t)(5./6.) + partial_histp(9)/(Double_t)6.;
05010                               h_geo_bid->Fill((Double_t)i_xgeo, (Double_t)i_ygeo,
05011                                               (Double_t)read_matrix(i_xgeo, i_ygeo));
05012                             }
05013                           //if( n1StexStinEcna == 32 && HistoCode != "D_NOE_ChNb" )       (ViewStas)
05014                           if( n1StexStinEcna == 32 )
05015                             {
05016                               //---- same as previous case: replace SCEcna 29 by 32 AND SCEcna 10 by 11
05017                               //---->  (x1+x2+x3+x6+x7+x11)/6 = partial_histp(32-1)*5/6 + partial_histp(11-1)/6
05018                               read_matrix(i_xgeo, i_ygeo) =
05019                                 partial_histp(i0StexStinEcna)*(Double_t)(5./6.) + partial_histp(10)/(Double_t)6.;
05020                               h_geo_bid->Fill((Double_t)i_xgeo, (Double_t)i_ygeo,
05021                                               (Double_t)read_matrix(i_xgeo, i_ygeo));
05022                             }
05023                         } // end of if( fFlagSubDet == "EE" )
05024                     } // end of if(i_xgeo >=0 && i_xgeo < nb_binx && i_ygeo >=0 && i_ygeo < nb_biny)
05025                 }  // end of for(Int_t i0StexStinEcna=0; i0StexStinEcna<fEcal->MaxStinEcnaInStex(); i0StexStinEcna++)
05026             } // end of if ( fMyRootFile->DataExist() == kTRUE )
05027           else
05028             {
05029               fStatusDataExist = kFALSE;
05030 
05031               cout << "!TEcnaHistos::ViewStas(...)>  "
05032                    << " Data not available for " << fFapStexName << " " << iStasStex+1
05033                    << " (Quantity not present in the ROOT file)" << fTTBELL << endl;
05034             }
05035         } // end of if( fMyRootFile->LookAtRootFile() == kTRUE )          (ViewStas)
05036       else
05037         {
05038           fStatusFileFound = kFALSE;
05039 
05040           cout << "!TEcnaHistos::ViewStas(...)>  "
05041                << " Data not available for " << fFapStexName << " " << iStasStex+1
05042                << " (ROOT file not found)"  << fTTBELL << endl;
05043         }
05044 
05045       if( fFapNbOfEvts <= xFapNbOfEvts[iStasStex] ){fFapNbOfEvts = xFapNbOfEvts[iStasStex];}
05046 
05047     } // end of for(Int_t iStasStex=0; iStasStex<fEcal->MaxStexInStas(); iStasStex++)
05048 
05049   //delete [] NOFE_int;     NOFE_int = 0;       fCdelete++;
05050   delete [] xFapNbOfEvts; xFapNbOfEvts = 0;   fCdelete++;
05051 
05052   if( CounterExistingFile > 0 && CounterDataExist > 0 )
05053     {
05054       //===============  H I S T O   M I N / M A X   M A N A G E M E N T ============  (ViewStas)
05055       //................................ Put histo min max values
05056       //.......... default if flag not set to "ON"
05057       SetYminMemoFromValue(HistoCode.Data(), fCnaParHistos->GetYminDefaultValue(HistoCode.Data()));
05058       SetYmaxMemoFromValue(HistoCode.Data(), fCnaParHistos->GetYmaxDefaultValue(HistoCode.Data()));
05059           
05060       if( fUserHistoMin == fUserHistoMax ){fFlagUserHistoMin = "AUTO"; fFlagUserHistoMax = "AUTO";}
05061       //.......... user's value if flag set to "ON"
05062       if( fFlagUserHistoMin == "ON" )
05063         {SetYminMemoFromValue(HistoCode.Data(), fUserHistoMin); fFlagUserHistoMin = "OFF";}
05064       if( fFlagUserHistoMax == "ON" )
05065         {SetYmaxMemoFromValue(HistoCode.Data(), fUserHistoMax); fFlagUserHistoMax = "OFF";}
05066       //................................. automatic min and/or max
05067       if( fFlagUserHistoMin == "AUTO" )
05068         {SetYminMemoFromValue(HistoCode.Data(), h_geo_bid->GetMinimum()); fFlagUserHistoMin = "OFF";}
05069       if( fFlagUserHistoMax == "AUTO" )
05070         {SetYmaxMemoFromValue(HistoCode.Data(), h_geo_bid->GetMaximum()); fFlagUserHistoMax = "OFF";}
05071       //...................................... histo set ymin and ymax
05072       SetHistoFrameYminYmaxFromMemo((TH1D*)h_geo_bid, HistoCode);
05073           
05074       // ************************** A GARDER EN RESERVE *******************************
05075       //............. special contour level for correlations (square root wise scale)
05076       //if ( HistoCode == "D_MCs_ChNb" )
05077       //{
05078       //  Int_t nb_niv  = 9;
05079       //  Double_t* cont_niv = new Double_t[nb_niv];           fCnew++;
05080       //  SqrtContourLevels(nb_niv, &cont_niv[0]);      
05081       //  h_geo_bid->SetContour(nb_niv, &cont_niv[0]);        
05082       //  delete [] cont_niv;                                  fCdelete++;
05083       //}
05084       // ******************************** (FIN RESERVE) *******************************
05085 
05086       // =================================== P L O T S ========================   (ViewStas) 
05087           
05088       char* f_in = new char[fgMaxCar];                           fCnew++;
05089 
05090       //...................... Taille/format canvas
05091       UInt_t canv_h = fCnaParHistos->CanvasFormatH("petit");
05092       UInt_t canv_w = fCnaParHistos->CanvasFormatW("petit");
05093 
05094       if( fFlagSubDet == "EB")
05095         {canv_w = fCnaParHistos->CanvasFormatW("phietaEB");
05096         canv_h = fCnaParHistos->CanvasFormatH("phietaEB");}
05097       if( fFlagSubDet == "EE")    
05098         {canv_w = fCnaParHistos->CanvasFormatW("IYIXEE");
05099         canv_h = fCnaParHistos->CanvasFormatH("IYIXEE");}
05100 
05101       //............................................... paves commentaires (ViewStas)
05102       SetAllPavesViewStas();
05103 
05104       //------------------------------------ Canvas name ----------------- (ViewStas)  
05105       TString name_cov_cor;
05106       Int_t MaxCar = fgMaxCar;
05107       name_cov_cor.Resize(MaxCar);
05108       name_cov_cor = "?";
05109           
05110       if( HistoCode == "D_NOE_ChNb"){name_cov_cor = "Number_of_Events";}
05111       if( HistoCode == "D_Ped_ChNb"){name_cov_cor = "Pedestals";}
05112       if( HistoCode == "D_TNo_ChNb"){name_cov_cor = "Total_noise";}
05113       if( HistoCode == "D_MCs_ChNb"){name_cov_cor = "Mean_Corss";}
05114       if( HistoCode == "D_LFN_ChNb"){name_cov_cor = "Low_Fq_Noise";}
05115       if( HistoCode == "D_HFN_ChNb"){name_cov_cor = "High_Fq_Noise";}
05116       if( HistoCode == "D_SCs_ChNb"){name_cov_cor = "Sigma_Corss";}
05117           
05118       TString name_visu;
05119       MaxCar = fgMaxCar;
05120       name_visu.Resize(MaxCar);
05121       name_visu = "colz";
05122           
05123       sprintf(f_in, "%s_%s_S1_%d_R%d_%d_%d_%s_%s_HocoVeco_R%d",
05124               name_cov_cor.Data(),   fFapAnaType.Data(),   fFapNbOfSamples, fFapRunNumber,
05125               fFapFirstReqEvtNumber, fFapLastReqEvtNumber, fFlagSubDet.Data(),
05126               name_visu.Data(),      arg_AlreadyRead);
05127           
05128       if( fFlagSubDet == "EB" ){SetHistoPresentation((TH1D*)h_geo_bid, "Stas2DEB");}
05129       if( fFlagSubDet == "EE" ){SetHistoPresentation((TH1D*)h_geo_bid, "Stas2DEE");}
05130 
05131       TCanvas *MainCanvas = new TCanvas(f_in, f_in, canv_w, canv_h);   fCnewRoot++;
05132       fCurrentCanvas = MainCanvas; fCurrentCanvasName = f_in;
05133 
05134       // cout << "*TEcnaHistos::ViewStas(...)> Plot is displayed on canvas ----> " << f_in << endl;
05135           
05136       delete [] f_in; f_in = 0;                                 fCdelete++;
05137 
05138       //------------------------ Canvas draw and update ------------ (ViewStas)  
05139       if( fPavComGeneralTitle != 0 ){fPavComGeneralTitle->Draw();}
05140 
05141       fPavComStas->Draw();
05142       fPavComAnaRun->Draw();
05143       fPavComNbOfEvts->Draw();
05144 
05145       //----------------------------------------------------------- pad margins
05146       Double_t x_low = fCnaParHistos->BoxLeftX("bottom_left_box") - 0.005;
05147       Double_t y_low = fCnaParHistos->BoxTopY("bottom_left_box")  + 0.005;
05148       Double_t x_margin = x_low;
05149       Double_t y_margin = y_low;          
05150       MainCanvas->Divide( 1,  1, x_margin, y_margin);
05151       //           Divide(nx, ny, x_margin, y_margin,    color);          
05152       gPad->cd(1);
05153       //........................... specific EE
05154       if( fFlagSubDet == "EE" ){
05155         Double_t x_up  = fCnaParHistos->BoxRightX("bottom_right_box")  + 0.005;
05156         Double_t y_up  = fCnaParHistos->BoxBottomY("top_left_box_EE") - 0.005;
05157         TVirtualPad* main_subpad = gPad;
05158         main_subpad->SetPad(x_low, y_low, x_up, y_up);}
05159           
05160       //------------------------------------------------------------
05161       h_geo_bid->GetXaxis()->SetTitle(axis_x_var_name);
05162       h_geo_bid->GetYaxis()->SetTitle(axis_y_var_name);
05163           
05164       h_geo_bid->DrawCopy("COLZ");
05165           
05166       // trace de la grille  ---------------- (ViewStas) 
05167       ViewStasGrid(vertic_empty_strips);
05168       gPad->Draw();
05169       gPad->Update();
05170 
05171       //      delete MainCanvas;              fCdeleteRoot++;
05172     }
05173   //..................... retour aux options standard
05174 
05175   Bool_t b_true = 1;
05176   h_geo_bid->SetStats(b_true);    
05177   h_geo_bid->Delete();  h_geo_bid = 0;              fCdeleteRoot++;
05178   
05179   delete [] f_in_mat_tit;    f_in_mat_tit = 0;             fCdelete++;
05180 
05181 }  // end of ViewStas(...)
05182 
05183 //==================================================================================
05184 //
05185 //                         GetXStinInStas , GetYStinInStas
05186 //
05187 //==================================================================================
05188 Int_t TEcnaHistos::GetXStinInStas(const Int_t& iStasStex, const Int_t& StexStinEcna,
05189                                   const Int_t& vertic_empty_strip_1) 
05190 {
05191 //Gives the X Stin coordinate in the geographic view of the Stas
05192 // (X = 0 to MaxStexHocoInStas*MaxStinHocoInStex - 1 + vertic_empty_strips(EE only))
05193 
05194   Int_t ix_geo = 0;
05195   Int_t n1StasStex = iStasStex+1;
05196   TString ctype = fEcalNumbering->GetStexHalfStas(n1StasStex);
05197 
05198   if( fFlagSubDet == "EB")
05199     {
05200       if( ctype == "EB-")
05201         {
05202           ix_geo = (iStasStex - fEcal->MaxStexInStasMinus())*fEcal->MaxStinVecoInStex()
05203             + StexStinEcna%fEcal->MaxStinVecoInStex();
05204         }
05205       if( ctype == "EB+")
05206         {
05207           ix_geo = iStasStex*fEcal->MaxStinVecoInStex()
05208             + fEcal->MaxStinVecoInStex()- 1 - StexStinEcna%fEcal->MaxStinVecoInStex();
05209         }
05210     }
05211 
05212   if( fFlagSubDet == "EE")
05213     {
05214       TString LeftRightFromIP = fEcalNumbering->GetDeeDirViewedFromIP(n1StasStex);
05215 
05216       if( ctype == "EE-" && LeftRightFromIP == "left"  )
05217         {
05218           ix_geo = fEcal->MaxStinHocoInStex() - StexStinEcna/fEcal->MaxStinVecoInStex() - 1 + vertic_empty_strip_1;
05219         }
05220       if( ctype == "EE-" && LeftRightFromIP == "right" )
05221         {
05222           ix_geo = fEcal->MaxStinHocoInStex() + StexStinEcna/fEcal->MaxStinVecoInStex() + vertic_empty_strip_1;
05223         }
05224       if( ctype == "EE+" && LeftRightFromIP == "left"  )
05225         {
05226           ix_geo = (Int_t)fCnaParHistos->DeeOffsetX(fFlagSubDet, n1StasStex)
05227             + fEcal->MaxStinHocoInStex() - StexStinEcna/fEcal->MaxStinVecoInStex() - 1;
05228         }
05229       if( ctype == "EE+" && LeftRightFromIP == "right" )
05230         {
05231           ix_geo = (Int_t)fCnaParHistos->DeeOffsetX(fFlagSubDet, n1StasStex)
05232             + StexStinEcna/fEcal->MaxStinVecoInStex();
05233         }
05234     }
05235   return ix_geo;
05236 }
05237 
05238 Int_t TEcnaHistos::GetYStinInStas(const Int_t& iStasStex, const Int_t& StexStinEcna) 
05239 {
05240 //Gives the Y crystal coordinate in the geographic view of one Stex
05241 // (Y = 0 to MaxStexVecoInStas*MaxStinVecoInStex - 1)
05242 
05243   Int_t iy_geo = 0;
05244   
05245   if( fFlagSubDet == "EB")
05246     {
05247       Int_t n1StasStex = iStasStex+1;
05248       TString ctype = fEcalNumbering->GetStexHalfStas(n1StasStex);
05249       if( ctype == "EB+")
05250         {iy_geo = StexStinEcna/fEcal->MaxStinVecoInStex() + fEcal->MaxStinHocoInStex(); }
05251       if( ctype == "EB-")
05252         {iy_geo = fEcal->MaxStinHocoInStex() - 1 - StexStinEcna/fEcal->MaxStinVecoInStex();}
05253     }
05254   
05255   if( fFlagSubDet == "EE")
05256     {iy_geo = StexStinEcna%fEcal->MaxStinVecoInStex();} 
05257   return iy_geo;
05258 }
05259 
05260 //==========================================================================
05261 //
05262 //                       ViewStasGrid
05263 //              independent of the ROOT file
05264 //
05265 //==========================================================================
05266 void TEcnaHistos::ViewStasGrid(const Int_t & vertic_empty_strips)
05267 {
05268  //Grid of Stas with axis Hoco and Veco
05269 
05270   if( fFlagSubDet ==  "EB"){ViewEBGrid();}
05271   if( fFlagSubDet ==  "EE"){ViewEEGrid(vertic_empty_strips);}
05272 
05273 } // end of ViewStasGrid
05274 
05275 void TEcnaHistos::ViewEBGrid()
05276 {
05277  //Grid of EB with axis Hoco and Veco
05278 
05279   Int_t  GeoBidSizeEta = fEcal->MaxSMEtaInEB()*fEcal->MaxTowEtaInSM();
05280   Int_t  GeoBidSizePhi = fEcal->MaxSMPhiInEB()*fEcal->MaxTowPhiInSM();
05281 
05282   Int_t size_y = fEcal->MaxTowEtaInSM();
05283   Int_t size_x = fEcal->MaxTowPhiInSM();
05284 
05285   Int_t  nb_binx  = GeoBidSizePhi;
05286   Int_t  nb_biny  = GeoBidSizeEta;
05287   Axis_t xinf_bid = (Axis_t)0.;
05288   Axis_t xsup_bid = (Axis_t)nb_binx;
05289   Axis_t yinf_bid = (Axis_t)0.;
05290   Axis_t ysup_bid = (Axis_t)nb_biny;   
05291   
05292   //---------------- trace de la grille: un rectangle = un SM
05293 
05294   Int_t max_x = nb_binx/size_x;  // = fEcal->MaxSMPhiInEB()
05295   Int_t max_y = nb_biny/size_y;  // = fEcal->MaxSMEtaInEB()
05296 
05297   //............................. lignes horizontales  (ViewEBGrid)
05298   Double_t yline = (Double_t)yinf_bid;
05299 
05300   Double_t xline_left  = (Double_t)xinf_bid;
05301   Double_t xline_right = (Double_t)xsup_bid;
05302   
05303   for( Int_t j = 0 ; j < max_y ; j++)
05304     {
05305       yline = yline + (Double_t)size_y;
05306       TLine *lin;
05307       lin = new TLine(xline_left, yline, xline_right, yline); fCnewRoot++;
05308       lin->Draw();
05309       // delete lin;             fCdeleteRoot++;
05310     }
05311 
05312   //-------------------------------- lignes verticales
05313   Double_t xline = (Double_t)xinf_bid - (Double_t)size_x;
05314   
05315   Double_t yline_bot = (Double_t)yinf_bid;
05316   Double_t yline_top = (Double_t)ysup_bid;
05317 
05318   for( Int_t i = 0 ; i < max_x ; i++)
05319     {  
05320       xline = xline + (Double_t)size_x;
05321       TLine *lin;
05322       lin = new TLine(xline, yline_bot, xline, yline_top); fCnewRoot++;
05323       lin->Draw();
05324     }
05325 
05326   //-------------------------------- Numeros des SM
05327   Double_t yTextBot = yline_bot - (yline_top - yline_bot)/25.;
05328   Double_t yTextTop = yline_top + (yline_top - yline_bot)/120.;
05329   xline = (Double_t)xinf_bid - (Double_t)size_x;
05330 
05331   char* f_in = new char[fgMaxCar];                  fCnew++;
05332   TText *text_SM = new TText();              fCnewRoot++;
05333   for( Int_t i = 0 ; i < max_x ; i++)
05334     {  
05335       xline = xline + (Double_t)size_x;
05336       text_SM->SetTextColor(fCnaParHistos->ColorDefinition("bleu_fonce"));
05337       text_SM->SetTextSize((Double_t)0.03);
05338       sprintf( f_in, "  +%d", i+1 );
05339       text_SM->DrawText(xline, yTextTop, f_in);
05340       sprintf( f_in, "  %d", -i-1 );
05341       text_SM->DrawText(xline, yTextBot, f_in);
05342     }
05343   delete [] f_in;                                   fCdelete++;
05344 
05345   //------------------ trace axes en eta et phi --------------- ViewEBGrid
05346 
05347   Int_t SMNumber = 1;
05348 
05349   //...................................................... Axe i(phi) (bottom x) ViewEBGrid
05350   Int_t MatSize    = fEcal->MaxTowPhiInSM();
05351   Int_t size_x_eb  = fEcal->MaxSMPhiInEB();
05352   Double_t phi_min =   0;
05353   Double_t phi_max = 360;
05354 
05355   TString  x_var_name  = GetHocoVecoAxisTitle("iphiEB");;
05356   TString  x_direction = fEcalNumbering->GetXDirectionEB(SMNumber);
05357 
05358   new TF1("f1", x_direction.Data(), phi_min, phi_max);          fCnewRoot++;
05359     TGaxis* sup_axis_x = 0;
05360 
05361   if( x_direction == "-x" ) // NEVER  IN THIS CASE: xmin->xmax <=> right->left ("-x") direction
05362     {sup_axis_x = new TGaxis( (Float_t)0., (Float_t)0., (Float_t)(size_x_eb*MatSize), (Float_t)0.,
05363                               "f1", size_x_eb, "SC" , 0.);   fCnewRoot++;}
05364 
05365   if( x_direction == "x" )  // ALWAYS IN THIS CASE: xmin->xmax <=> left->right ("x") direction    
05366     {sup_axis_x = new TGaxis( (Float_t)0., (Float_t)0., (Float_t)(size_x_eb*MatSize), (Float_t)0.,
05367                               "f1", size_x_eb, "SC" , 0.);   fCnewRoot++;} 
05368 
05369   Float_t tit_siz_x = fCnaParHistos->AxisTitleSize();
05370   Float_t lab_siz_x = fCnaParHistos->AxisLabelSize("EBx");
05371   Float_t tic_siz_x = fCnaParHistos->AxisTickSize("SMx");
05372   Float_t tit_off_x = fCnaParHistos->AxisTitleOffset("EBx");
05373   Float_t lab_off_x = fCnaParHistos->AxisLabelOffset("EBx");
05374  
05375   sup_axis_x->SetTitle(x_var_name);
05376   sup_axis_x->SetTitleSize(tit_siz_x);
05377   sup_axis_x->SetTitleOffset(tit_off_x);
05378   sup_axis_x->SetLabelSize(lab_siz_x);
05379   sup_axis_x->SetLabelOffset(lab_off_x);
05380   sup_axis_x->SetTickSize(tic_siz_x);
05381   sup_axis_x->Draw("SAME");
05382 
05383   //...................................................... Axe eta (y) ViewEBGrid
05384   MatSize = fEcal->MaxTowEtaInSM();
05385   Int_t size_y_eb = fEcal->MaxSMEtaInEB(); 
05386 
05387   Double_t eta_min = (Double_t)(-85.); 
05388   Double_t eta_max = (Double_t)85.; 
05389 
05390   TString y_var_name = GetHocoVecoAxisTitle("ietaEB");
05391 
05392   TGaxis* sup_axis_y = 0;
05393   sup_axis_y = new TGaxis((Float_t)0., (Float_t)0.,
05394                           (Float_t)0., (Float_t)(size_y_eb*MatSize),
05395                           eta_min, eta_max, MatSize/2, "SC", 0.);         fCnewRoot++;
05396 
05397   Float_t tit_siz_y = fCnaParHistos->AxisTitleSize();
05398   Float_t lab_siz_y = fCnaParHistos->AxisLabelSize("EBy");
05399   Float_t tic_siz_y = fCnaParHistos->AxisTickSize("SMy");
05400   Float_t tit_off_y = fCnaParHistos->AxisTitleOffset("EBy");
05401   Float_t lab_off_y = fCnaParHistos->AxisLabelOffset("EBy");
05402   
05403   sup_axis_y->SetTitle(y_var_name);
05404   sup_axis_y->SetTitleSize(tit_siz_y);
05405   sup_axis_y->SetTitleOffset(tit_off_y);
05406   sup_axis_y->SetLabelColor(1);
05407   sup_axis_y->SetLabelSize(lab_siz_y);
05408   sup_axis_y->SetLabelOffset(lab_off_y);
05409   sup_axis_y->SetTickSize(tic_siz_y);
05410   sup_axis_y->Draw("SAME");
05411 
05412   //f2 = 0;
05413 
05414   gStyle->SetTextColor(fCnaParHistos->ColorDefinition("noir"));
05415 
05416 } // end of ViewEBGrid
05417 //---------------------------------------------------------------------
05418 void TEcnaHistos::ViewEEGrid(const Int_t& vertic_empty_strips)
05419 {
05420  //Grid of EE with axis Hoco and Veco
05421 
05422   Float_t coefcc_x = (Float_t)1./(Float_t)5.;
05423   Float_t coefcc_y = (Float_t)1./(Float_t)5.;
05424   
05425   for( Int_t DeeNumber = 1; DeeNumber <= 4; DeeNumber++)
05426     {
05427       EEDataSectors(coefcc_x, coefcc_y, DeeNumber, "EE");
05428       EEGridAxis(coefcc_x, coefcc_y, DeeNumber, "EE", " "); 
05429     }
05430 
05431   // vertical line between the two endcaps
05432   Double_t xline = coefcc_x*( 2*fEcal->MaxCrysIXInDee()
05433                               + ((Double_t)vertic_empty_strips)/2.*fEcal->MaxCrysIXInSC() );
05434   
05435   Double_t yline_bot = coefcc_y*(Double_t)0.;
05436   Double_t yline_top = coefcc_y*(Double_t)fEcal->MaxCrysIYInDee();
05437 
05438   TLine *lin;
05439   lin = new TLine(xline, yline_bot, xline, yline_top); fCnewRoot++;
05440   lin->Draw();
05441 
05442   // vertical line in the midles of the two endcaps
05443   //  xline = xline + coefcc_x*( fEcal->MaxCrysIXInDee()+ 0.5*fEcal->MaxCrysIXInSC() );
05444   xline = coefcc_x*(3*fEcal->MaxCrysIXInDee()
05445                     + ((Double_t)vertic_empty_strips-1.)*fEcal->MaxCrysIXInSC() );
05446   TLine *lin12;
05447   lin12 = new TLine(xline, yline_bot, xline, yline_top); fCnewRoot++;
05448   lin12->SetLineStyle(2);
05449   lin12->Draw();
05450 
05451   xline = coefcc_x*(fEcal->MaxCrysIXInDee()
05452                      + ((Double_t)vertic_empty_strips)/3.*fEcal->MaxCrysIXInSC() );
05453   TLine *lin34;
05454   lin34 = new TLine(xline, yline_bot, xline, yline_top); fCnewRoot++;
05455   lin34->SetLineStyle(2);
05456   lin34->Draw();
05457 
05458   // horizontal line at IY = 50
05459   Double_t xline_end = coefcc_x*( 4*fEcal->MaxCrysIXInDee() + vertic_empty_strips*fEcal->MaxCrysIXInSC());
05460   Double_t yline_mid = coefcc_x*fEcal->MaxCrysIYInDee()/2;
05461 
05462   TLine *linh;
05463   linh = new TLine( 0., yline_mid, xline_end, yline_mid); fCnewRoot++;
05464   linh->SetLineStyle(2);
05465   linh->Draw();
05466 
05467 } // end of ViewEEGrid
05468 
05469 //==================================================================================================
05470 void TEcnaHistos::EEDataSectors(const Float_t& coefcc_x,  const Float_t& coefcc_y,
05471                                 const Int_t&   DeeNumber, const TString opt_plot)
05472 {
05473   //Surlignage des bords du Dee et des Data Sectors. Numeros des secteurs.
05474 
05475   // Epaisseur du trait selon option
05476   Int_t LineWidth = 2;   // DEFAULT => option "EE"
05477   if( opt_plot == "Dee" ){LineWidth = 3;}
05478 
05479   Int_t ngmax = 0;
05480   // surlignage du bord interne du Dee (unite de coordonnees: le cristal)
05481   ngmax = 13;
05482   Float_t xg_dee_int_bot[13] = { 0, 5, 5, 7, 7, 8, 8, 9, 9,10,10,11,11};
05483   Float_t yg_dee_int_bot[13] = {39,39,40,40,41,41,42,42,43,43,45,45,50};
05484   for(Int_t i=0;i<ngmax;i++){
05485     xg_dee_int_bot[i] = coefcc_x*xg_dee_int_bot[i];
05486     yg_dee_int_bot[i] = coefcc_y*yg_dee_int_bot[i];}
05487   
05488   Float_t XgDeeIntBotRight[13]; Float_t YgDeeIntBotRight[13];
05489   Float_t XgDeeIntTopRight[13]; Float_t YgDeeIntTopRight[13];
05490   
05491   for( Int_t i=0; i<ngmax; i++)
05492     {
05493       XgDeeIntBotRight[i] = xg_dee_int_bot[i];
05494       YgDeeIntBotRight[i] = yg_dee_int_bot[i];
05495       XgDeeIntTopRight[i] = XgDeeIntBotRight[i];
05496       YgDeeIntTopRight[i] = coefcc_y*fEcal->MaxCrysIYInDee() - YgDeeIntBotRight[i];
05497       if ( DeeNumber == 2 || DeeNumber == 4 )
05498         {
05499           XgDeeIntBotRight[i] = -XgDeeIntBotRight[i] + coefcc_x*fEcal->MaxCrysIXInDee();
05500           XgDeeIntTopRight[i] = -XgDeeIntTopRight[i] + coefcc_x*fEcal->MaxCrysIXInDee();
05501         }
05502       XgDeeIntBotRight[i] += fCnaParHistos->DeeOffsetX(opt_plot, DeeNumber);
05503       XgDeeIntTopRight[i] += fCnaParHistos->DeeOffsetX(opt_plot, DeeNumber);
05504     }
05505 
05506   TGraph *BDeeIntBotRight = new TGraph(ngmax, XgDeeIntBotRight, YgDeeIntBotRight);
05507   BDeeIntBotRight->SetLineWidth(LineWidth);
05508   BDeeIntBotRight->Draw();
05509   
05510   TGraph *BDeeIntTopRight = new TGraph(ngmax, XgDeeIntTopRight, YgDeeIntTopRight);
05511   BDeeIntTopRight->SetLineWidth(LineWidth);
05512   BDeeIntTopRight->Draw();
05513 
05514   // surlignage du bord externe du Dee  (unite de coordonnees: le cristal)
05515   ngmax = 21;
05516   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};
05517   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};
05518   for(Int_t i=0;i<ngmax;i++){
05519     xg_dee_ext_bot[i] = coefcc_x*xg_dee_ext_bot[i];
05520     yg_dee_ext_bot[i] = coefcc_y*yg_dee_ext_bot[i];}
05521   
05522   Float_t XgDeeExtBotRight[21]; Float_t YgDeeExtBotRight[21];
05523   Float_t XgDeeExtTopRight[21]; Float_t YgDeeExtTopRight[21];
05524   
05525   for( Int_t i=0; i<ngmax; i++)
05526     {
05527       XgDeeExtBotRight[i] = xg_dee_ext_bot[i];
05528       YgDeeExtBotRight[i] = yg_dee_ext_bot[i];
05529       XgDeeExtTopRight[i] = XgDeeExtBotRight[i];
05530       YgDeeExtTopRight[i] = coefcc_y*fEcal->MaxCrysIYInDee() - YgDeeExtBotRight[i];
05531       if ( DeeNumber == 2 || DeeNumber == 4 )
05532         {
05533           XgDeeExtBotRight[i] = -XgDeeExtBotRight[i] + coefcc_x*fEcal->MaxCrysIXInDee();
05534           XgDeeExtTopRight[i] = -XgDeeExtTopRight[i] + coefcc_x*fEcal->MaxCrysIXInDee();
05535         }
05536       XgDeeExtBotRight[i] += fCnaParHistos->DeeOffsetX(opt_plot, DeeNumber);
05537       XgDeeExtTopRight[i] += fCnaParHistos->DeeOffsetX(opt_plot, DeeNumber);
05538     }
05539   
05540   TGraph *BDeeExtBotRight = new TGraph(ngmax, XgDeeExtBotRight, YgDeeExtBotRight);
05541   BDeeExtBotRight->SetLineWidth(LineWidth);
05542   BDeeExtBotRight->Draw();
05543   
05544   TGraph *BDeeExtTopRight = new TGraph(ngmax, XgDeeExtTopRight, YgDeeExtTopRight);
05545   BDeeExtTopRight->SetLineWidth(LineWidth);
05546   BDeeExtTopRight->Draw();
05547 
05548   char* f_in = new char[fgMaxCar];                           fCnew++;
05549   
05550   //............. Surlignage separateurs des secteurs en phi (Data sectors)
05551 
05552   //================== S9 -> S1 (EE-) option "EE" seulement
05553   if( opt_plot == "EE" )
05554     {
05555       ngmax = 2;
05556       Float_t xg_dee_data_sec9[2] = { 0,  0};
05557       Float_t yg_dee_data_sec9[2] = {61,100};
05558       for(Int_t i=0;i<ngmax;i++){
05559         xg_dee_data_sec9[i] = coefcc_x*xg_dee_data_sec9[i];
05560         yg_dee_data_sec9[i] = coefcc_y*yg_dee_data_sec9[i];}
05561       
05562       Float_t XgDeeDataSec9[11]; Float_t YgDeeDataSec9[11];
05563       for( Int_t i=0; i<ngmax; i++)
05564         {
05565           XgDeeDataSec9[i] = xg_dee_data_sec9[i]; YgDeeDataSec9[i] = yg_dee_data_sec9[i];
05566           if ( DeeNumber == 2 || DeeNumber == 4 )
05567             {
05568               XgDeeDataSec9[i] = -XgDeeDataSec9[i] + coefcc_x*fEcal->MaxCrysIXInDee();
05569             }
05570           XgDeeDataSec9[i] += fCnaParHistos->DeeOffsetX(opt_plot, DeeNumber);
05571         }      
05572       TGraph *BDeeDataSec9 = new TGraph(ngmax, XgDeeDataSec9, YgDeeDataSec9);
05573       BDeeDataSec9->SetLineWidth(LineWidth);
05574       BDeeDataSec9->Draw();      
05575     }
05576 
05577   //================= S1->S2(EE-)
05578   ngmax = 11;
05579   Float_t xg_dee_data_sec1[11] = { 7,10,10,15,15,20,20,25,25,30,30};
05580   Float_t yg_dee_data_sec1[11] = {60,60,65,65,70,70,75,75,85,85,87};
05581   for(Int_t i=0;i<ngmax;i++){
05582     xg_dee_data_sec1[i] = coefcc_x*xg_dee_data_sec1[i];
05583     yg_dee_data_sec1[i] = coefcc_y*yg_dee_data_sec1[i];}
05584   
05585   Float_t XgDeeDataSec1[11]; Float_t YgDeeDataSec1[11];
05586   for( Int_t i=0; i<ngmax; i++)
05587     {
05588       XgDeeDataSec1[i] = xg_dee_data_sec1[i]; YgDeeDataSec1[i] = yg_dee_data_sec1[i];
05589       if ( DeeNumber == 2 || DeeNumber == 4 )
05590         {
05591           XgDeeDataSec1[i] = -XgDeeDataSec1[i] + coefcc_x*fEcal->MaxCrysIXInDee();
05592         }
05593       XgDeeDataSec1[i] += fCnaParHistos->DeeOffsetX(opt_plot, DeeNumber);
05594     }
05595 
05596   TGraph *BDeeDataSec1 = new TGraph(ngmax, XgDeeDataSec1, YgDeeDataSec1);
05597   BDeeDataSec1->SetLineWidth(LineWidth);
05598   BDeeDataSec1->Draw();
05599 
05600   //================= S2->S3(EE-)
05601   ngmax = 6;
05602   Float_t xg_dee_data_sec2[6] = {11,15,15,40,40,47};
05603   Float_t yg_dee_data_sec2[6] = {50,50,55,55,60,60};
05604   for(Int_t i=0;i<ngmax;i++){
05605     xg_dee_data_sec2[i] = coefcc_x*xg_dee_data_sec2[i];
05606     yg_dee_data_sec2[i] = coefcc_y*yg_dee_data_sec2[i];}
05607   
05608   Float_t XgDeeDataSec2[6]; Float_t YgDeeDataSec2[6];
05609   for( Int_t i=0; i<ngmax; i++)
05610     {
05611       XgDeeDataSec2[i] = xg_dee_data_sec2[i]; YgDeeDataSec2[i] = yg_dee_data_sec2[i];
05612       if ( DeeNumber == 2 || DeeNumber == 4 )
05613         {
05614           XgDeeDataSec2[i] = -XgDeeDataSec2[i] + coefcc_x*fEcal->MaxCrysIXInDee();
05615         }
05616       XgDeeDataSec2[i] += fCnaParHistos->DeeOffsetX(opt_plot, DeeNumber);
05617     }
05618   TGraph *BDeeDataSec2 = new TGraph(ngmax, XgDeeDataSec2, YgDeeDataSec2);
05619   BDeeDataSec2->SetLineWidth(LineWidth);
05620   BDeeDataSec2->Draw();
05621  
05622   //================= S3->S4(EE-)
05623   ngmax = 10;
05624   Float_t xg_dee_data_sec3[10] = {10,15,15,20,20,30,30,40,40,42};
05625   Float_t yg_dee_data_sec3[10] = {45,45,40,40,35,35,30,30,25,25};
05626   for(Int_t i=0;i<ngmax;i++){
05627     xg_dee_data_sec3[i] = coefcc_x*xg_dee_data_sec3[i];
05628     yg_dee_data_sec3[i] = coefcc_y*yg_dee_data_sec3[i];}
05629   
05630   Float_t XgDeeDataSec3[10]; Float_t YgDeeDataSec3[10];
05631   for( Int_t i=0; i<ngmax; i++)
05632     {
05633       XgDeeDataSec3[i] = xg_dee_data_sec3[i]; YgDeeDataSec3[i] = yg_dee_data_sec3[i];
05634       if ( DeeNumber == 2 || DeeNumber == 4 )
05635         {
05636           XgDeeDataSec3[i] = -XgDeeDataSec3[i] + coefcc_x*fEcal->MaxCrysIXInDee();
05637         }
05638       XgDeeDataSec3[i] += fCnaParHistos->DeeOffsetX(opt_plot, DeeNumber);
05639     }
05640   TGraph *BDeeDataSec3 = new TGraph(ngmax, XgDeeDataSec3, YgDeeDataSec3);
05641   BDeeDataSec3->SetLineWidth(LineWidth);
05642   BDeeDataSec3->Draw();
05643  
05644   //================= S4->S5(EE-)
05645   ngmax = 6;
05646   Float_t xg_dee_data_sec4[6] = { 5, 5,10,10,15,15};
05647   Float_t yg_dee_data_sec4[6] = {40,30,30,15,15, 5};
05648   for(Int_t i=0;i<ngmax;i++){
05649     xg_dee_data_sec4[i] = coefcc_x*xg_dee_data_sec4[i];
05650     yg_dee_data_sec4[i] = coefcc_y*yg_dee_data_sec4[i];}
05651   
05652   Float_t XgDeeDataSec4[6]; Float_t YgDeeDataSec4[6];
05653   for( Int_t i=0; i<ngmax; i++)
05654     {
05655       XgDeeDataSec4[i] = xg_dee_data_sec4[i]; YgDeeDataSec4[i] = yg_dee_data_sec4[i];
05656       if ( DeeNumber == 2 || DeeNumber == 4 )
05657         {
05658           XgDeeDataSec4[i] = -XgDeeDataSec4[i] + coefcc_x*fEcal->MaxCrysIXInDee();
05659         }
05660       XgDeeDataSec4[i] += fCnaParHistos->DeeOffsetX(opt_plot, DeeNumber);
05661     }
05662   TGraph *BDeeDataSec4 = new TGraph(ngmax, XgDeeDataSec4, YgDeeDataSec4);
05663   BDeeDataSec4->SetLineWidth(LineWidth);
05664   BDeeDataSec4->Draw();
05665   
05666 
05667   //..................................... Numeros des secteurs S_i (option "Dee" seulement)
05668   if( opt_plot == "Dee" || opt_plot == "EE" )
05669     {
05670       //............. Coordonnees des numeros de secteurs
05671       ngmax = 5;
05672       Float_t  xg_coord_sector[5] = { 16, 41, 45, 33, -2};
05673       Float_t  yg_coord_sector[5] = { 96, 83, 30,  5, -8};
05674 
05675       //....... Reprise secteurs 3 et 7
05676       if(opt_plot == "Dee" && (DeeNumber == 1) ){xg_coord_sector[2] += 0.5;}
05677       if(opt_plot == "Dee" && (DeeNumber == 2) ){xg_coord_sector[2] -= 1. ;}
05678       if(opt_plot == "Dee" && (DeeNumber == 3) ){xg_coord_sector[2] += 0.7;}
05679       if(opt_plot == "Dee" && (DeeNumber == 4) ){xg_coord_sector[2] -= 1.2;}
05680 
05681       if(opt_plot == "EE"  && (DeeNumber == 2 || DeeNumber == 3) ){xg_coord_sector[2] += 0.55;}
05682       if(opt_plot == "EE"  && (DeeNumber == 4 ) ){xg_coord_sector[2] -= 0.2;}
05683 
05684       for(Int_t i=0;i<ngmax;i++){
05685         xg_coord_sector[i] = coefcc_x*xg_coord_sector[i];
05686         yg_coord_sector[i] = coefcc_y*yg_coord_sector[i];}
05687 
05688       Float_t  xg_sector[9];
05689       Float_t  yg_sector[9];
05690       Int_t ns1 = 1;
05691       Int_t ns2 = 5;
05692       Float_t xinv_d2d4 = coefcc_x*44;
05693       
05694       if( DeeNumber == 1 )
05695         {
05696           ns1 = 1; ns2 = 5;
05697           xg_sector[1-ns1] = xg_coord_sector[1-ns1];  yg_sector[1-ns1] = yg_coord_sector[1-ns1];
05698           xg_sector[2-ns1] = xg_coord_sector[2-ns1];  yg_sector[2-ns1] = yg_coord_sector[2-ns1];
05699           xg_sector[3-ns1] = xg_coord_sector[3-ns1];  yg_sector[3-ns1] = yg_coord_sector[3-ns1];
05700           xg_sector[4-ns1] = xg_coord_sector[4-ns1];  yg_sector[4-ns1] = yg_coord_sector[4-ns1];
05701           xg_sector[5-ns1] = xg_coord_sector[5-ns1];  yg_sector[5-ns1] = yg_coord_sector[5-ns1];
05702         }
05703       
05704       if( DeeNumber == 2 )
05705         {
05706           ns1 = 5; ns2 = 9;
05707           xg_sector[ns2-1] = xinv_d2d4-xg_coord_sector[1-1];  yg_sector[ns2-1] = yg_coord_sector[1-1];
05708           xg_sector[ns2-2] = xinv_d2d4-xg_coord_sector[2-1];  yg_sector[ns2-2] = yg_coord_sector[2-1];
05709           xg_sector[ns2-3] = xinv_d2d4-xg_coord_sector[3-1];  yg_sector[ns2-3] = yg_coord_sector[3-1];
05710           xg_sector[ns2-4] = xinv_d2d4-xg_coord_sector[4-1];  yg_sector[ns2-4] = yg_coord_sector[4-1];
05711           xg_sector[ns2-5] = xinv_d2d4-xg_coord_sector[5-1];  yg_sector[ns2-5] = yg_coord_sector[5-1];
05712         }
05713       if( DeeNumber == 3 )
05714         {
05715           ns1 = 5; ns2 = 9;
05716           xg_sector[ns2-1]= xg_coord_sector[1-1];  yg_sector[ns2-1] = yg_coord_sector[1-1];
05717           xg_sector[ns2-2]= xg_coord_sector[2-1];  yg_sector[ns2-2] = yg_coord_sector[2-1];
05718           xg_sector[ns2-3]= xg_coord_sector[3-1];  yg_sector[ns2-3] = yg_coord_sector[3-1];
05719           xg_sector[ns2-4]= xg_coord_sector[4-1];  yg_sector[ns2-4] = yg_coord_sector[4-1];
05720           xg_sector[ns2-5]= xg_coord_sector[5-1];  yg_sector[ns2-5] = yg_coord_sector[5-1];
05721         }
05722       if( DeeNumber == 4 )
05723         {
05724           ns1 = 1; ns2 = 5;
05725           xg_sector[1-ns1]= xinv_d2d4-xg_coord_sector[1-ns1];  yg_sector[1-ns1] = yg_coord_sector[1-ns1];
05726           xg_sector[2-ns1]= xinv_d2d4-xg_coord_sector[2-ns1];  yg_sector[2-ns1] = yg_coord_sector[2-ns1];
05727           xg_sector[3-ns1]= xinv_d2d4-xg_coord_sector[3-ns1];  yg_sector[3-ns1] = yg_coord_sector[3-ns1];
05728           xg_sector[4-ns1]= xinv_d2d4-xg_coord_sector[4-ns1];  yg_sector[4-ns1] = yg_coord_sector[4-ns1];
05729           xg_sector[5-ns1]= xinv_d2d4-xg_coord_sector[5-ns1];  yg_sector[5-ns1] = yg_coord_sector[5-ns1];
05730         }
05731       
05732       Color_t coul_textsector = fCnaParHistos->ColorDefinition("vert37");
05733       for(Int_t ns=ns1; ns<= ns2; ns++)
05734         {
05735           xg_sector[ns-1] += fCnaParHistos->DeeOffsetX(opt_plot, DeeNumber);
05736           if( DeeNumber == 1 || DeeNumber == 2 ){sprintf( f_in, "+%d", ns);}
05737           if( DeeNumber == 3 || DeeNumber == 4 ){sprintf( f_in, "-%d", ns);}
05738           TText *text_num_module = new TText(xg_sector[ns-1], yg_sector[ns-1], f_in);        fCnewRoot++;
05739           if(opt_plot == "Dee"){text_num_module->SetTextSize(0.065);}
05740           if(opt_plot == "EE" ){text_num_module->SetTextSize(0.045);}
05741           text_num_module->SetTextColor(coul_textsector);
05742           if( opt_plot == "Dee" ||
05743               ( opt_plot == "EE" && !( (DeeNumber == 3 && ns == 5) || (DeeNumber == 1 && ns == 5) ) ) )
05744             {text_num_module->Draw();}
05745 
05746           // text_num_module->Delete(); text_num_module = 0;     fCdeleteRoot++;     
05747         }
05748       
05749       //............................ numeros des dee's
05750       ngmax = 4;
05751       Float_t  xg_coord_dee[4] = { 0,  0,  0,  0};
05752       Float_t  yg_coord_dee[4] = {48, 48, 48, 48};
05753       
05754       xg_coord_dee[DeeNumber-1] = coefcc_x*xg_coord_dee[DeeNumber-1];
05755       yg_coord_dee[DeeNumber-1] = coefcc_y*yg_coord_dee[DeeNumber-1];
05756 
05757       Float_t  xg_dee = xg_coord_dee[DeeNumber-1];
05758       Float_t  yg_dee = yg_coord_dee[DeeNumber-1];
05759 
05760       Color_t coul_textdee = fCnaParHistos->ColorDefinition("noir");
05761    
05762       xg_dee += fCnaParHistos->DeeOffsetX(opt_plot, DeeNumber)
05763         + fCnaParHistos->DeeNumberOffsetX(opt_plot, DeeNumber);
05764 
05765       if( DeeNumber == 1 ){sprintf( f_in, "D1");}
05766       if( DeeNumber == 2 ){sprintf( f_in, "D2");}
05767       if( DeeNumber == 3 ){sprintf( f_in, "D3");}
05768       if( DeeNumber == 4 ){sprintf( f_in, "D4");}
05769 
05770       TText *text_num_module = new TText(xg_dee, yg_dee, f_in);        fCnewRoot++;
05771       if( opt_plot == "EE" ){text_num_module->SetTextSize(0.045);}
05772       if( opt_plot == "Dee"){text_num_module->SetTextSize(0.085);}
05773       text_num_module->SetTextColor(coul_textdee);
05774       text_num_module->Draw();
05775     }
05776 
05777   //..................................... Numeros des Dee et indication EE+- (option "EE" seulement)
05778   if( opt_plot == "EE" )
05779     {
05780       //............................ indication EE+-
05781       ngmax = 4;
05782       Float_t  xg_coord_eepm[4] = { 0,  0,  0,  0};
05783       Float_t  yg_coord_eepm[4] = {95, 95, 95, 95};
05784      
05785       xg_coord_eepm[DeeNumber-1] = coefcc_x*xg_coord_eepm[DeeNumber-1];
05786       yg_coord_eepm[DeeNumber-1] = coefcc_y*yg_coord_eepm[DeeNumber-1];
05787 
05788       Float_t  xg_eepm = xg_coord_eepm[DeeNumber-1];
05789       Float_t  yg_eepm = yg_coord_eepm[DeeNumber-1];
05790 
05791       Color_t coul_texteepm = fCnaParHistos->ColorDefinition("noir");
05792    
05793       xg_eepm += fCnaParHistos->DeeOffsetX(opt_plot, DeeNumber)
05794         + fCnaParHistos->DeeNameOffsetX(DeeNumber);
05795 
05796       if( DeeNumber == 1 ){sprintf( f_in, "EE+F");}
05797       if( DeeNumber == 2 ){sprintf( f_in, "EE+N");}
05798       if( DeeNumber == 3 ){sprintf( f_in, "EE-N");}
05799       if( DeeNumber == 4 ){sprintf( f_in, "EE-F");}
05800 
05801       TText *text_num_eepm = new TText(xg_eepm, yg_eepm, f_in);        fCnewRoot++;
05802       text_num_eepm->SetTextSize(0.04);
05803       text_num_eepm->SetTextColor(coul_texteepm);
05804       text_num_eepm->Draw();
05805     }
05806 
05807   //......................... mention "viewed from IP"
05808   Color_t coul_textfromIP = fCnaParHistos->ColorDefinition("rouge49");
05809   sprintf( f_in, "viewed from IP");
05810   Float_t x_from_ip = 15.;
05811   Float_t y_from_ip = -10.;
05812   if( opt_plot == "EE" ){y_from_ip = -16.;}
05813   x_from_ip = coefcc_x*x_from_ip;
05814   y_from_ip = coefcc_x*y_from_ip;
05815   if( opt_plot == "EE" && DeeNumber == 3 ){x_from_ip += 1.4*fCnaParHistos->DeeOffsetX(opt_plot, DeeNumber);}
05816   TText *text_from_ip = new TText(x_from_ip, y_from_ip, f_in);        fCnewRoot++;
05817   text_from_ip->SetTextSize(0.045);
05818   if( opt_plot == "EE" ){text_from_ip->SetTextSize(0.035);}
05819   text_from_ip->SetTextColor(coul_textfromIP);
05820   if( opt_plot == "Dee" || (opt_plot == "EE" && DeeNumber == 3) ){text_from_ip->Draw();}
05821 
05822   delete [] f_in;      f_in = 0;                                 fCdelete++;
05823 
05824 }  // ------ end of EEDataSectors() ------
05825 
05826 //==========================================================================================
05827 
05828 void TEcnaHistos::EEGridAxis(const Float_t& coefcc_x,  const Float_t& coefcc_y,
05829                              const Int_t&   DeeNumber, const TString opt_plot,  const TString c_option)
05830 {
05831   //------------------ trace axes en IX et IY --------------- EEGridAxis
05832   //=============================================================================== Axe IX
05833   Int_t size_IX_dee  = fEcal->MaxSCIXInDee();
05834 
05835   Double_t IX_min = fEcalNumbering->GetIIXMin(1) - 0.5;                        // IX_min = 0.5  pour les 4 dee's
05836   Double_t IX_max = fEcalNumbering->GetIIXMax()*fEcal->MaxCrysIXInSC() + 0.5;  // IX_max = 50.5 pour les 4 dee's
05837 
05838   Int_t MatSize = 1;
05839   if( opt_plot == "Dee" && c_option == "corcc" )
05840     {
05841       MatSize = fEcal->MaxCrysInSC();
05842       IX_min = fEcalNumbering->GetIIXMin() - 0.5;
05843       IX_max = fEcalNumbering->GetIIXMax() + 0.5;
05844     }
05845   if( opt_plot == "EE"  && c_option == "corcc" ){return;}     // => a voir...
05846 
05847   if( opt_plot == "Dee" && c_option != "corcc" ){MatSize = fEcal->MaxCrysIXInSC();}
05848   if( opt_plot == "EE"  && c_option != "corcc" ){MatSize = 1;}
05849 
05850   TString  x_var_name  = " ";
05851 
05852   Float_t axis_x_inf  = 0;
05853   Float_t axis_x_sup  = 0;
05854   Float_t axis_y_inf  = 0;
05855   Float_t axis_y_sup  = 0;
05856   Int_t   axis_nb_div = 205;   // DEFAULT: option "EE"
05857   Double_t IX_values_min = 0;
05858   Double_t IX_values_max = 0;
05859   Option_t* chopt = "C";
05860 
05861   //........................................................................EEGridAxis
05862   if( DeeNumber == 1 ) //  xmin -> xmax <=> right->left
05863     {
05864       //.....axis min->max/left->right: first draw axis with -ticksize and no label
05865       axis_x_inf    = size_IX_dee*MatSize;
05866       axis_x_sup    = 0;
05867       axis_y_inf    = 0; 
05868       axis_y_sup    = 0;
05869       IX_values_min = -IX_max;   // -50.5 right
05870       IX_values_max = -IX_min;   // - 0.5 left
05871       if( opt_plot == "Dee" ){x_var_name = GetIXIYAxisTitle("iIXDee1");}
05872       if( opt_plot == "EE"  ){x_var_name = GetIXIYAxisTitle("iIXEE");}
05873       if( opt_plot == "Dee" ){axis_nb_div = size_IX_dee;} 
05874       chopt         = "-CSU";
05875     }
05876   if( DeeNumber == 2 ) //  xmin -> xmax <=> right->left
05877     {
05878       //.....axis min->max/left->right: first draw axis with -ticksize and no label
05879       axis_x_inf    = size_IX_dee*MatSize;
05880       axis_x_sup    = 0;
05881       axis_y_inf    = 0;
05882       axis_y_sup    = 0;
05883       IX_values_min = IX_min;   // + 0.5 right
05884       IX_values_max = IX_max;   // +50.5 left
05885       if( opt_plot == "Dee" ){x_var_name = GetIXIYAxisTitle("iIXDee2");}
05886       if( opt_plot == "EE"  ){x_var_name = " ";}
05887       if( opt_plot == "Dee" ){axis_nb_div = size_IX_dee;}  
05888       chopt         = "-CSU";
05889     }
05890   if( DeeNumber == 3 )  //  xmin -> xmax <=> left->right
05891     {
05892       axis_x_inf    = 0;
05893       axis_x_sup    = size_IX_dee*MatSize;
05894       axis_y_inf    = 0; 
05895       axis_y_sup    = 0;
05896       IX_values_min = IX_min;   // + 0.5 left
05897       IX_values_max = IX_max;   // +50.5 right
05898       if( opt_plot == "Dee" ){x_var_name = GetIXIYAxisTitle("iIXDee3");}
05899       if( opt_plot == "EE"  ){x_var_name = " ";}
05900       if( opt_plot == "Dee" ){axis_nb_div = size_IX_dee;} 
05901       chopt         = "CS";
05902     }
05903   if( DeeNumber == 4 )  //  xmin -> xmax <=> left->right
05904     {
05905       axis_x_inf    = 0;
05906       axis_x_sup    = size_IX_dee*MatSize;
05907       axis_y_inf    = 0; 
05908       axis_y_sup    = 0;
05909       IX_values_min = -IX_max;   // -50.5 left
05910       IX_values_max = -IX_min;   // - 0.5 right
05911       if( opt_plot == "Dee" ){x_var_name = GetIXIYAxisTitle("iIXDee4");}
05912       if( opt_plot == "EE"  ){x_var_name = " ";}
05913       if( opt_plot == "Dee" ){axis_nb_div = size_IX_dee;} 
05914       chopt         = "CS"; 
05915     }
05916 
05917   //.................................................................... EEGridAxis
05918   axis_x_inf += fCnaParHistos->DeeOffsetX(opt_plot, DeeNumber);
05919   axis_x_sup += fCnaParHistos->DeeOffsetX(opt_plot, DeeNumber);
05920 
05921   TGaxis* sup_axis_x = 0;
05922   sup_axis_x = new TGaxis(axis_x_inf, axis_y_inf, axis_x_sup, axis_y_sup,
05923                           IX_values_min, IX_values_max, axis_nb_div, chopt, 0.);   fCnewRoot++;
05924 
05925   Float_t tit_siz_x = fCnaParHistos->AxisTitleSize();
05926   Float_t lab_siz_x = fCnaParHistos->AxisLabelSize();
05927 
05928   Float_t tic_siz_x = fCnaParHistos->AxisTickSize("Deex");
05929   if(opt_plot == "EE"){tic_siz_x = fCnaParHistos->AxisTickSize("EEx");}
05930 
05931   Float_t tit_off_x = fCnaParHistos->AxisTitleOffset("Deex");
05932   if(opt_plot == "EE"){tit_off_x = fCnaParHistos->AxisTitleOffset("EEx");}
05933 
05934   Float_t lab_off_x = fCnaParHistos->AxisLabelOffset("Deex");
05935   if(opt_plot == "EE"){lab_off_x = fCnaParHistos->AxisLabelOffset("EEx");}
05936 
05937   sup_axis_x->SetTitle(x_var_name);
05938   sup_axis_x->SetTitleSize(tit_siz_x);
05939   sup_axis_x->SetTitleOffset(tit_off_x);
05940   sup_axis_x->SetLabelSize(lab_siz_x);
05941   sup_axis_x->SetLabelOffset(lab_off_x);
05942   sup_axis_x->SetTickSize(tic_siz_x);
05943   sup_axis_x->Draw("SAME");
05944 
05945   //.....axis min->max/right->left: redraw axis with ticksize = 0 and with -labelOffset
05946   if( DeeNumber == 1 || DeeNumber == 2 )
05947     {
05948       chopt = "CS";
05949       TGaxis* sup_axis_x_bis = 0;
05950       sup_axis_x_bis = new TGaxis(axis_x_inf, axis_y_inf, axis_x_sup, axis_y_sup,
05951                                   IX_values_min, IX_values_max, axis_nb_div, chopt, 0.);   fCnewRoot++;
05952       sup_axis_x_bis->SetTickSize(0.);
05953       lab_siz_x = sup_axis_x->GetLabelSize();
05954       sup_axis_x_bis->SetLabelSize(lab_siz_x);
05955       lab_off_x = sup_axis_x->GetLabelOffset();
05956       sup_axis_x_bis->SetLabelOffset(-lab_off_x);
05957       sup_axis_x_bis->Draw("SAME");
05958     }
05959 
05960   //================================================================== Axe IY  EEGridAxis
05961 
05962   if( opt_plot == "Dee" || (opt_plot == "EE" && DeeNumber == 4) )
05963     {
05964       Int_t size_IY_dee  = fEcal->MaxSCIYInDee();
05965       Int_t size_IY_axis = size_IY_dee;
05966 
05967       if( opt_plot == "Dee" ){axis_nb_div = size_IY_axis;}
05968       if( opt_plot == "EE"  ){axis_nb_div = 210;}
05969 
05970       Double_t jIY_min = fEcalNumbering->GetJIYMin(DeeNumber, 1) - 0.5;
05971       Double_t jIY_max = fEcalNumbering->GetJIYMax(DeeNumber)*fEcal->MaxCrysIYInSC() + 0.5;
05972 
05973       TString  jy_var_name  = " ";
05974       TString  jy_direction = "x";
05975 
05976       Float_t tit_siz_y = fCnaParHistos->AxisTitleSize();
05977       Float_t lab_siz_y = fCnaParHistos->AxisLabelSize();
05978 
05979       Float_t tic_siz_y = fCnaParHistos->AxisTickSize("Deey");
05980       if(opt_plot == "EE"){tic_siz_y = fCnaParHistos->AxisTickSize("EEy");}
05981 
05982       Float_t tit_off_y = fCnaParHistos->AxisTitleOffset("Deey");
05983       if(opt_plot == "EE"){tit_off_y = fCnaParHistos->AxisTitleOffset("EEy");}
05984 
05985       Float_t lab_off_y = fCnaParHistos->AxisLabelOffset("Deey");
05986       if(opt_plot == "EE"){lab_off_y = fCnaParHistos->AxisLabelOffset("EEy");}
05987 
05988       TGaxis* axis_jy_plus = 0;
05989       axis_jy_plus = new TGaxis((Float_t)0., (Float_t)0.,
05990                                 (Float_t)0., (Float_t)(size_IY_axis*MatSize),
05991                                 jIY_min, jIY_max, axis_nb_div, "SC", 0.);   fCnewRoot++;
05992 
05993       jy_var_name  = GetIXIYAxisTitle("jIYDee");  
05994       axis_jy_plus->SetTitle(jy_var_name);
05995       axis_jy_plus->SetTitleSize(tit_siz_y);
05996       axis_jy_plus->SetTitleOffset(tit_off_y);
05997       axis_jy_plus->SetLabelSize(lab_siz_y);
05998       axis_jy_plus->SetLabelOffset(lab_off_y);
05999       axis_jy_plus->SetTickSize(tic_siz_y);
06000       axis_jy_plus->Draw("SAME");
06001     }
06002 
06003 //---------------------------------- 2 axes (0,50) et (0,-50)
06004 #define IYAX
06005 #ifndef IYAX
06006   if( opt_plot == "Dee" || (opt_plot == "EE" && DeeNumber == 4) )
06007     {
06008       Int_t size_IY_dee  = fEcal->MaxSCIYInDee();
06009       Int_t size_IY_axis = size_IY_dee/2;
06010 
06011       if( opt_plot == "Dee" ){axis_nb_div = (Int_t)size_IY_axis;}
06012       if( opt_plot == "EE"  ){axis_nb_div = 5;}
06013 
06014       Double_t jIY_min = fEcalNumbering->GetJIYMin(DeeNumber, 1) - 0.5;
06015       Double_t jIY_max = (fEcalNumbering->GetJIYMax(DeeNumber)/2)*fEcal->MaxCrysIYInSC() + 0.5;
06016 
06017       TString  jy_var_name  = " ";
06018       TString  jy_direction = "x";
06019 
06020       Float_t tit_siz_y = fCnaParHistos->AxisTitleSize();
06021       Float_t lab_siz_y = fCnaParHistos->AxisLabelSize();
06022 
06023       Float_t tic_siz_y = fCnaParHistos->AxisTickSize("Deey");
06024       if(opt_plot == "EE"){tic_siz_y = fCnaParHistos->AxisTickSize("EEy");}
06025 
06026       Float_t tit_off_y = fCnaParHistos->AxisTitleOffset("Deey");
06027       if(opt_plot == "EE"){tit_off_y = fCnaParHistos->AxisTitleOffset("EEy");}
06028 
06029       Float_t lab_off_y = fCnaParHistos->AxisLabelOffset("Deey");
06030       if(opt_plot == "EE"){lab_off_y = fCnaParHistos->AxisLabelOffset("EEy");}
06031 
06032       TGaxis* axis_jy_plus = 0;
06033       axis_jy_plus = new TGaxis((Float_t)0., (Float_t)(size_IY_dee*MatSize/2),
06034                                 (Float_t)0., (Float_t)(2*size_IY_dee*MatSize/2),
06035                                 jIY_min, jIY_max, axis_nb_div, "SC", 0.);   fCnewRoot++;
06036 
06037       jy_var_name  = GetIXIYAxisTitle("jIYDee");  
06038       axis_jy_plus->SetTitle(jy_var_name);
06039       axis_jy_plus->SetTitleSize(tit_siz_y);
06040       axis_jy_plus->SetTitleOffset(tit_off_y);
06041       axis_jy_plus->SetLabelSize(lab_siz_y);
06042       axis_jy_plus->SetLabelOffset(lab_off_y);
06043       axis_jy_plus->SetTickSize(tic_siz_y);
06044       axis_jy_plus->Draw("SAME");
06045 
06046       TGaxis* axis_jy_minus = 0;
06047       axis_jy_minus = new TGaxis((Float_t)0., (Float_t)(size_IY_dee*MatSize/2),
06048                                  (Float_t)0., (Float_t)0.,
06049                                  -jIY_min, -jIY_max, axis_nb_div, "-SC", 0.);   fCnewRoot++;
06050 
06051       jy_var_name  = GetIXIYAxisTitle("jIYDee");  
06052       axis_jy_minus->SetTitle(jy_var_name);
06053       axis_jy_minus->SetTitleSize(tit_siz_y);
06054       axis_jy_minus->SetTitleOffset(tit_off_y);
06055       axis_jy_minus->SetLabelSize(lab_siz_y);
06056       axis_jy_minus->SetLabelOffset(lab_off_y);
06057       axis_jy_minus->SetTickSize(tic_siz_y);
06058       axis_jy_minus->Draw("SAME");
06059     }
06060 #endif // IYAX
06061 
06062 } // ------------- end of EEGridAxis(...) --------------
06063 
06064 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
06065 //
06066 //                               ViewHisto(***)
06067 // 
06068 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
06069 //======================== D_MSp_SpNb
06070 void TEcnaHistos::XtalSamplesEv(const TVectorD& arg_read_histo, const Int_t& arg_AlreadyRead,
06071                                 const Int_t&    n1StexStin,     const Int_t& i0StinEcha)
06072 {XtalSamplesEv(arg_read_histo, arg_AlreadyRead, n1StexStin, i0StinEcha, "ONLYONE");}
06073 void TEcnaHistos::XtalSamplesEv(const TVectorD& arg_read_histo, const Int_t& arg_AlreadyRead,
06074                                 const Int_t&    n1StexStin,     const Int_t& i0StinEcha,
06075                                 const TString   PlotOption)
06076 {
06077   if( fFapStexNumber > 0 )
06078     {
06079       if( PlotOption == fAllXtalsInStinPlot )
06080         {
06081           Int_t StexStin_A = n1StexStin;
06082           if( fFlagSubDet == "EE" )
06083             {StexStin_A = fEcalNumbering->Get1DeeSCEcnaFromDeeSCCons(fFapStexNumber, n1StexStin);}
06084 
06085           Bool_t aOKData = kFALSE;
06086           TVectorD read_histo(fEcal->MaxCrysInStin()*fEcal->MaxSampADC());
06087 
06088           if( arg_AlreadyRead == fTobeRead )
06089             {
06090               fMyRootFile->PrintNoComment();
06091               fMyRootFile->FileParameters(fFapAnaType,          fFapNbOfSamples,
06092                                           fFapRunNumber,        fFapFirstReqEvtNumber,
06093                                           fFapLastReqEvtNumber, fFapReqNbOfEvts,
06094                                           fFapStexNumber,       fCfgResultsRootFilePath.Data());
06095               
06096               if ( fMyRootFile->LookAtRootFile() == kTRUE )
06097                 {
06098                   fStatusFileFound = kTRUE;
06099                   read_histo = fMyRootFile->ReadSampleMeans(StexStin_A, fEcal->MaxCrysInStin()*fEcal->MaxSampADC());
06100                   if( fMyRootFile->DataExist() == kTRUE ){fStatusDataExist = kTRUE;}
06101                 }
06102               else
06103                 {
06104                   fStatusFileFound = kFALSE;
06105                   cout << "!TEcnaHistos::XtalSamplesEv(...)> Data not available (ROOT file not found)." << endl;
06106                 }
06107               if( fStatusFileFound == kTRUE && fStatusDataExist == kTRUE ){aOKData = kTRUE;}
06108             }
06109           if( arg_AlreadyRead >= 1 )
06110             {
06111               for(Int_t i=0; i<fEcal->MaxCrysInStin()*fEcal->MaxSampADC(); i++){read_histo[i] = arg_read_histo[i];}
06112               fStatusDataExist = kTRUE;
06113               aOKData = kTRUE;
06114             }
06115 
06116           if( aOKData == kTRUE )
06117             {
06118               TVectorD read_histo_samps(fFapNbOfSamples);
06119               
06120               Int_t xAlreadyRead = 1;
06121               for( Int_t i0_stin_echa=0; i0_stin_echa<fEcal->MaxCrysInStin(); i0_stin_echa++)
06122                 {
06123                   if( fFapStexName == "SM" )
06124                     {cout << "*TEcnaHistos::XtalSamplesEv(...)> channel " << setw(2) << i0_stin_echa << ": ";}
06125                   if( fFapStexName == "Dee" )
06126                     {cout << "*TEcnaHistos::XtalSamplesEv(...)> Xtal " << setw(2) << i0_stin_echa+1 << ": ";}
06127                   
06128                   for( Int_t i0_samp=0; i0_samp<fFapNbOfSamples; i0_samp++ )
06129                     {
06130                       read_histo_samps(i0_samp) = read_histo(i0_stin_echa*fFapNbOfSamples+i0_samp);
06131                       cout << setprecision(4) << setw(8) << read_histo_samps(i0_samp) << ", " ;
06132                     }
06133                   cout << endl;
06134                   ViewHisto(read_histo_samps, xAlreadyRead,
06135                             StexStin_A, i0_stin_echa, fZerv, "D_MSp_SpNb", fAllXtalsInStinPlot);
06136                   xAlreadyRead++;
06137                 }
06138               xAlreadyRead = 0;
06139             }
06140           else
06141             {
06142               cout << "!TEcnaHistos::XtalSamplesEv(...)> Data not available." << endl;
06143             }
06144         }
06145       
06146       if( !(PlotOption == fAllXtalsInStinPlot) )      
06147         {
06148           Int_t StexStin_A = n1StexStin;
06149           if( fFlagSubDet == "EE" )
06150             {StexStin_A = fEcalNumbering->Get1DeeSCEcnaFromDeeSCCons(fFapStexNumber, n1StexStin);}
06151           ViewHisto(fReadHistoDummy, fTobeRead, StexStin_A, i0StinEcha, fZerv, "D_MSp_SpNb", PlotOption);
06152         }
06153     }
06154   else
06155     {
06156       cout << "!TEcnaHistos::XtalSamplesEv(...)> " << fFapStexName.Data() << " number = " << fFapStexNumber
06157            << " out of range (range = [1," << fEcal->MaxStexInStas() << "])" << fTTBELL << endl;
06158     }
06159 }
06160 
06161 //======================== D_MSp_SpDs
06162 void TEcnaHistos::EvSamplesXtals(const TVectorD& arg_read_histo, const Int_t& arg_AlreadyRead,
06163                                  const Int_t&    n1StexStin,     const Int_t& i0StinEcha)
06164 {EvSamplesXtals(arg_read_histo, arg_AlreadyRead, n1StexStin, i0StinEcha, "ONLYONE");}
06165 void TEcnaHistos::EvSamplesXtals(const TVectorD& arg_read_histo, const Int_t& arg_AlreadyRead,
06166                                  const Int_t&    n1StexStin,     const Int_t& i0StinEcha,
06167                                  const TString   PlotOption)
06168 {
06169   if( fFapStexNumber > 0 )
06170     {
06171       if( PlotOption == fAllXtalsInStinPlot )
06172         {
06173           Int_t StexStin_A = n1StexStin;
06174           if( fFlagSubDet == "EE" )
06175             {StexStin_A = fEcalNumbering->Get1DeeSCEcnaFromDeeSCCons(fFapStexNumber, n1StexStin);}
06176 
06177           Bool_t aOKData = kFALSE;
06178           TVectorD read_histo(fEcal->MaxCrysInStin()*fEcal->MaxSampADC());
06179 
06180           if( arg_AlreadyRead == fTobeRead )
06181             {
06182               fMyRootFile->PrintNoComment();
06183               fMyRootFile->FileParameters(fFapAnaType,          fFapNbOfSamples,
06184                                           fFapRunNumber,        fFapFirstReqEvtNumber,
06185                                           fFapLastReqEvtNumber, fFapReqNbOfEvts,
06186                                           fFapStexNumber,       fCfgResultsRootFilePath.Data());
06187 
06188               if ( fMyRootFile->LookAtRootFile() == kTRUE )
06189                 {
06190                   fStatusFileFound = kTRUE;
06191                   read_histo = fMyRootFile->ReadSampleMeans(StexStin_A, fEcal->MaxCrysInStin()*fEcal->MaxSampADC());
06192                   if( fMyRootFile->DataExist() == kTRUE ){fStatusDataExist = kTRUE;}
06193                 }
06194               else
06195                 {
06196                   fStatusFileFound = kFALSE;
06197                   cout << "!TEcnaHistos::EvSamplesXtals(...)> Data not available (ROOT file not found)." << endl;
06198                 }
06199               if( fStatusFileFound == kTRUE && fStatusDataExist == kTRUE ){aOKData = kTRUE;}
06200             }
06201           if( arg_AlreadyRead >= 1 )
06202             {
06203               for(Int_t i=0; i<fEcal->MaxCrysInStin()*fEcal->MaxSampADC(); i++){read_histo[i] = arg_read_histo[i];}
06204               fStatusDataExist = kTRUE;
06205               aOKData = kTRUE;
06206             }
06207           if( aOKData == kTRUE )
06208             {
06209               TVectorD read_histo_samps(fFapNbOfSamples);
06210               
06211               Int_t xAlreadyRead = 1;
06212               for( Int_t i0_stin_echa=0; i0_stin_echa<fEcal->MaxCrysInStin(); i0_stin_echa++)
06213                 {
06214                   if( fFapStexName == "SM" )
06215                     {cout << "*TEcnaHistos::EvSamplesXtals(...)> channel " << setw(2) << i0_stin_echa << ": ";}
06216                   if( fFapStexName == "Dee" )
06217                     {cout << "*TEcnaHistos::EvSamplesXtals(...)> Xtal " << setw(2) << i0_stin_echa+1 << ": ";}
06218                   
06219                   for( Int_t i0_samp=0; i0_samp<fFapNbOfSamples; i0_samp++ )
06220                     {
06221                       read_histo_samps(i0_samp) = read_histo(i0_stin_echa*fFapNbOfSamples+i0_samp);
06222                       cout << setprecision(4) << setw(8) << read_histo_samps(i0_samp) << ", " ;
06223                     }
06224                   cout << endl;
06225                   ViewHisto(read_histo_samps, xAlreadyRead,
06226                             StexStin_A, i0_stin_echa, fZerv, "D_MSp_SpDs", fAllXtalsInStinPlot);
06227                   xAlreadyRead++;
06228                 }
06229               xAlreadyRead = 0;
06230             }
06231           else
06232             {
06233               cout << "!TEcnaHistos::EvSamplesXtals(...)> Data not available." << endl;
06234             }
06235         }
06236       
06237       if( !(PlotOption == fAllXtalsInStinPlot) )      
06238         {
06239           Int_t StexStin_A = n1StexStin;
06240           if( fFlagSubDet == "EE" )
06241             {StexStin_A = fEcalNumbering->Get1DeeSCEcnaFromDeeSCCons(fFapStexNumber, n1StexStin);}
06242           ViewHisto(fReadHistoDummy, fTobeRead, StexStin_A, i0StinEcha, fZerv, "D_MSp_SpDs", PlotOption);
06243         }
06244     }
06245   else
06246     {
06247       cout << "!TEcnaHistos::EvSamplesXtals(...)> " << fFapStexName.Data() << " number = " << fFapStexNumber
06248            << " out of range (range = [1," << fEcal->MaxStexInStas() << "])" << fTTBELL << endl;
06249     }
06250 } // end of EvSamplesXtals(...)
06251 
06252 //======================== D_SSp_SpNb
06253 void TEcnaHistos::XtalSamplesSigma(const TVectorD& arg_read_histo, const Int_t& arg_AlreadyRead,
06254                                    const Int_t&    n1StexStin,     const Int_t& i0StinEcha)
06255 {XtalSamplesSigma(arg_read_histo, arg_AlreadyRead, n1StexStin, i0StinEcha, "ONLYONE");}
06256 void TEcnaHistos::XtalSamplesSigma(const TVectorD& arg_read_histo, const Int_t& arg_AlreadyRead,
06257                                    const Int_t&    n1StexStin,     const Int_t& i0StinEcha,
06258                                    const TString   PlotOption)
06259 {
06260   if( fFapStexNumber > 0 )
06261     {  
06262       if( PlotOption == fAllXtalsInStinPlot )
06263         {
06264           Int_t StexStin_A = n1StexStin;
06265           if( fFlagSubDet == "EE" )
06266             {StexStin_A = fEcalNumbering->Get1DeeSCEcnaFromDeeSCCons(fFapStexNumber, n1StexStin);}
06267           
06268           Bool_t aOKData = kFALSE;
06269           TVectorD read_histo(fEcal->MaxCrysInStin()*fEcal->MaxSampADC());
06270           
06271           if( arg_AlreadyRead == fTobeRead )
06272             {
06273               fMyRootFile->PrintNoComment();
06274               fMyRootFile->FileParameters(fFapAnaType,          fFapNbOfSamples,
06275                                           fFapRunNumber,        fFapFirstReqEvtNumber,
06276                                           fFapLastReqEvtNumber, fFapReqNbOfEvts,
06277                                           fFapStexNumber,       fCfgResultsRootFilePath.Data());
06278               
06279               if ( fMyRootFile->LookAtRootFile() == kTRUE )
06280                 {
06281                   fStatusFileFound = kTRUE;
06282                   read_histo = fMyRootFile->ReadSampleSigmas(StexStin_A, fEcal->MaxCrysInStin()*fEcal->MaxSampADC());
06283                   if( fMyRootFile->DataExist() == kTRUE ){fStatusDataExist = kTRUE;}
06284                 }
06285               else
06286                 {
06287                   fStatusFileFound = kFALSE;
06288                   cout << "!TEcnaHistos::XtalSamplesSigma(...)> Data not available (ROOT file not found)." << endl;
06289                 }
06290               if( fStatusFileFound == kTRUE && fStatusDataExist == kTRUE ){aOKData = kTRUE;}
06291             }
06292           if( arg_AlreadyRead >= 1 )
06293             {
06294               for(Int_t i=0; i<fEcal->MaxCrysInStin()*fEcal->MaxSampADC(); i++){read_histo[i] = arg_read_histo[i];}
06295               fStatusDataExist = kTRUE;
06296               aOKData = kTRUE;
06297             }
06298           if( aOKData == kTRUE )
06299             {
06300               TVectorD read_histo_samps(fFapNbOfSamples);
06301               
06302               Int_t xAlreadyRead = 1;
06303               for( Int_t i0_stin_echa=0; i0_stin_echa<fEcal->MaxCrysInStin(); i0_stin_echa++)
06304                 {
06305                   if( fFapStexName == "SM" )
06306                     {cout << "*TEcnaHistos::XtalSamplesSigma(...)> channel " << setw(2) << i0_stin_echa << ": ";}
06307                   if( fFapStexName == "Dee" )
06308                     {cout << "*TEcnaHistos::XtalSamplesSigma(...)> Xtal " << setw(2) << i0_stin_echa+1 << ": ";}
06309                   
06310                   for( Int_t i0_samp=0; i0_samp<fFapNbOfSamples; i0_samp++ )
06311                     {
06312                       read_histo_samps(i0_samp) = read_histo(i0_stin_echa*fFapNbOfSamples+i0_samp);
06313                       cout << setprecision(3) << setw(6) << read_histo_samps(i0_samp) << ", " ;
06314                     }
06315                   cout << endl;
06316                   ViewHisto(read_histo_samps, xAlreadyRead,
06317                             StexStin_A, i0StinEcha, fZerv, "D_SSp_SpNb", fAllXtalsInStinPlot);
06318                   xAlreadyRead++;    
06319                 }
06320               xAlreadyRead = 0;
06321             }
06322           else
06323             {
06324               cout << "!TEcnaHistos::XtalSamplesSigma(...)> Data not available." << endl;
06325             }
06326         }
06327 
06328       if( !(PlotOption == fAllXtalsInStinPlot) )      
06329         {
06330           Int_t StexStin_A = n1StexStin;
06331           if( fFlagSubDet == "EE" )
06332             {StexStin_A = fEcalNumbering->Get1DeeSCEcnaFromDeeSCCons(fFapStexNumber, n1StexStin);}
06333           ViewHisto(fReadHistoDummy, fTobeRead, StexStin_A, i0StinEcha, fZerv, "D_SSp_SpNb", PlotOption);
06334         } 
06335     }
06336   else
06337     {
06338       cout << "!TEcnaHistos::XtalSamplesSigma(...)> " << fFapStexName.Data() << " number = " << fFapStexNumber
06339            << " out of range (range = [1," << fEcal->MaxStexInStas() << "])" << fTTBELL << endl;
06340     }
06341 }
06342 
06343 
06344 //======================== D_SSp_SpDs
06345 void TEcnaHistos::SigmaSamplesXtals(const TVectorD& arg_read_histo, const Int_t& arg_AlreadyRead,
06346                                     const Int_t&    n1StexStin,     const Int_t& i0StinEcha)
06347 {SigmaSamplesXtals(arg_read_histo, arg_AlreadyRead, n1StexStin, i0StinEcha, "ONLYONE");}
06348 void TEcnaHistos::SigmaSamplesXtals(const TVectorD& arg_read_histo, const Int_t& arg_AlreadyRead,
06349                                     const Int_t&    n1StexStin,     const Int_t& i0StinEcha,
06350                                     const TString   PlotOption)
06351 {
06352   if( fFapStexNumber > 0 )
06353     {  
06354       if( PlotOption == fAllXtalsInStinPlot )
06355         {
06356           Int_t StexStin_A = n1StexStin;
06357           if( fFlagSubDet == "EE" )
06358             {StexStin_A = fEcalNumbering->Get1DeeSCEcnaFromDeeSCCons(fFapStexNumber, n1StexStin);}
06359                   
06360           Bool_t aOKData = kFALSE;
06361           TVectorD read_histo(fEcal->MaxCrysInStin()*fEcal->MaxSampADC());
06362           
06363           if( arg_AlreadyRead == fTobeRead )
06364             {
06365               fMyRootFile->PrintNoComment();
06366               fMyRootFile->FileParameters(fFapAnaType,          fFapNbOfSamples,
06367                                           fFapRunNumber,        fFapFirstReqEvtNumber,
06368                                           fFapLastReqEvtNumber, fFapReqNbOfEvts,
06369                                           fFapStexNumber,       fCfgResultsRootFilePath.Data());
06370               if ( fMyRootFile->LookAtRootFile() == kTRUE )
06371                 {
06372                   fStatusFileFound = kTRUE;
06373                   read_histo = fMyRootFile->ReadSampleSigmas(StexStin_A, fEcal->MaxCrysInStin()*fEcal->MaxSampADC());
06374                   if( fMyRootFile->DataExist() == kTRUE ){fStatusDataExist = kTRUE;}
06375                 }
06376               else
06377                 {
06378                   fStatusFileFound = kFALSE;
06379                   cout << "!TEcnaHistos::SigmaSamplesXtals(...)> Data not available (ROOT file not found)." << endl;
06380                 }
06381               if( fStatusFileFound == kTRUE && fStatusDataExist == kTRUE ){aOKData = kTRUE;}
06382             }
06383           
06384           if( arg_AlreadyRead >= 1 )
06385             {
06386               for(Int_t i=0; i<fEcal->MaxCrysInStin()*fEcal->MaxSampADC(); i++){read_histo[i] = arg_read_histo[i];}
06387               fStatusDataExist = kTRUE;
06388               aOKData = kTRUE;
06389             }
06390           if( aOKData == kTRUE )
06391             {
06392               TVectorD read_histo_samps(fFapNbOfSamples);
06393               
06394               Int_t xAlreadyRead = 1;
06395               for( Int_t i0_stin_echa=0; i0_stin_echa<fEcal->MaxCrysInStin(); i0_stin_echa++)
06396                 {
06397                   if( fFapStexName == "SM" )
06398                     {cout << "*TEcnaHistos::SigmaSamplesXtals(...)> channel " << setw(2) << i0_stin_echa << ": ";}
06399                   if( fFapStexName == "Dee" )
06400                     {cout << "*TEcnaHistos::SigmaSamplesXtals(...)> Xtal " << setw(2) << i0_stin_echa+1 << ": ";}
06401                   
06402                   for( Int_t i0_samp=0; i0_samp<fFapNbOfSamples; i0_samp++ )
06403                     {
06404                       read_histo_samps(i0_samp) = read_histo(i0_stin_echa*fFapNbOfSamples+i0_samp);
06405                       cout << setprecision(3) << setw(6) << read_histo_samps(i0_samp) << ", " ;
06406                     }
06407                   cout << endl;
06408                   ViewHisto(read_histo_samps, xAlreadyRead,
06409                             StexStin_A, i0StinEcha, fZerv, "D_SSp_SpDs", fAllXtalsInStinPlot);
06410                   xAlreadyRead++;    
06411                 }
06412               xAlreadyRead = 0;
06413             }
06414           else
06415             {
06416               cout << "!TEcnaHistos::SigmaSamplesXtals(...)> Data not available." << endl;
06417             }
06418         }
06419       
06420       if( !(PlotOption == fAllXtalsInStinPlot) )      
06421         {
06422           Int_t StexStin_A = n1StexStin;
06423           if( fFlagSubDet == "EE" )
06424             {StexStin_A = fEcalNumbering->Get1DeeSCEcnaFromDeeSCCons(fFapStexNumber, n1StexStin);}
06425           ViewHisto(fReadHistoDummy, fTobeRead, StexStin_A, i0StinEcha, fZerv, "D_SSp_SpDs", PlotOption);
06426         } 
06427     }
06428   else
06429     {
06430       cout << "!TEcnaHistos::SigmaSamplesXtals(...)> " << fFapStexName.Data() << " number = " << fFapStexNumber
06431            << " out of range (range = [1," << fEcal->MaxStexInStas() << "])" << fTTBELL << endl;
06432     }
06433 } // end of SigmaSamplesXtals(...)
06434 
06435 //==========================================================================================
06436 //
06437 //                         ViewHisto
06438 //
06439 //    arg_read_histo  = array containing the values
06440 //    arg_AlreadyRead = histo flag: =1 => arg_read_histo exists,
06441 //                                  =0 => values will be read by internal
06442 //                                        call to TEcnaRead inside ViewHisto
06443 //    StexStin_A      = [1,68] or [1,150]  ==> tower# if EB,  SC# if EE
06444 //    i0StinEcha      = [0,24] = Electronic channel# in tower (if EB) or SC (if EE) 
06445 //    i0Sample        = [0,9]  = sample#
06446 //    HistoCode       = String for histo type (pedestal, total noise, mean cor(s,s), ...)  
06447 //    opt_plot_arg    = String for plot option (SAME or not SAME)
06448 //
06449 //===========================================================================================
06450 void TEcnaHistos::ViewHisto(const TVectorD& arg_read_histo, const Int_t&  arg_AlreadyRead,
06451                             const Int_t&    StexStin_A,     const Int_t&  i0StinEcha,
06452                             const Int_t&    i0Sample,       const TString HistoCode,
06453                             const TString   opt_plot_arg)
06454 {
06455   //Histogram of the quantities (one run)
06456 
06457   TString opt_plot  = opt_plot_arg;
06458   fPlotAllXtalsInStin = 0;
06459 
06460   if( opt_plot_arg == fAllXtalsInStinPlot ){opt_plot = fOnlyOnePlot; fPlotAllXtalsInStin = 1;}
06461 
06462   TString HistoType = fCnaParHistos->GetHistoType(HistoCode.Data());
06463 
06464   Int_t OKHisto = 0;
06465 
06466   //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Canvas already closed in option SAME %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
06467   Int_t xCanvasExists = 1; // a priori ==> Canvas exists                                   // (ViewHisto)
06468   if( opt_plot != fOnlyOnePlot && GetMemoFlag(HistoCode, opt_plot) == "Busy" )
06469     {
06470       TVirtualPad* main_subpad = 0; 
06471       //---------------- Call to ActivePad
06472       main_subpad = ActivePad(HistoCode.Data(), opt_plot.Data());  // => return 0 if canvas has been closed
06473       if( main_subpad == 0 )
06474         {
06475           cout << "*TEcnaHistos::ViewHisto(...)> WARNING ===> Canvas has been closed in option SAME or SAME n."
06476                << endl
06477                << "                              Please, restart with a new canvas."
06478                << fTTBELL << endl;
06479           
06480           ReInitCanvas(HistoCode, opt_plot);
06481           xCanvasExists = 0;
06482         }
06483     }
06484   //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
06485 
06486   //%%%%%%%%%%%%%%%%%%%%%%%% Change of X variable in option SAME n with no proj %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
06487   Int_t SameXVarMemo = 1;   //  a priori ==> SAME n option: X variable OK                     (ViewHisto)
06488   if( !(HistoType == "Proj" || HistoType == "SampProj" || HistoType == "EvolProj") && 
06489       !(arg_AlreadyRead >= 1) )
06490     {
06491       TString XVarHisto = fCnaParHistos->GetXVarHisto(HistoCode.Data(), fFlagSubDet.Data(), fFapStexNumber);
06492       TString YVarHisto = fCnaParHistos->GetYVarHisto(HistoCode.Data(), fFlagSubDet.Data(), fFapStexNumber);
06493       if( (opt_plot == fSameOnePlot ) && GetMemoFlag(HistoCode, opt_plot) == "Free" )
06494         {
06495           SetXVarMemo(HistoCode, opt_plot, XVarHisto);  SetYVarMemo(HistoCode, opt_plot, YVarHisto); SameXVarMemo = 1;
06496         }
06497       if( (opt_plot == fSameOnePlot ) && GetMemoFlag(HistoCode, opt_plot) == "Busy" )
06498         {
06499           TString XVariableMemo = GetXVarFromMemo(HistoCode, opt_plot);
06500           TString YVariableMemo = GetYVarFromMemo(HistoCode, opt_plot);
06501           
06502           if( XVarHisto != XVariableMemo )
06503             {
06504               cout << "!TEcnaHistos::ViewHisto(...)> *** ERROR *** ===> X coordinate changed in option SAME n." << endl
06505                    << "                              Present  X = " << XVarHisto << endl
06506                    << "                              Present  Y = " << YVarHisto << endl
06507                    << "                              Previous X = " << XVariableMemo << endl
06508                    << "                              Previous Y = " << YVariableMemo 
06509                    << fTTBELL << endl;
06510               SameXVarMemo = 0;
06511             }
06512           else
06513             {SetYVarMemo(HistoCode, opt_plot, YVarHisto);}
06514         }
06515     }
06516   //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
06517 
06518   //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Change of Y variable in option SAME n %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
06519   Int_t SameYVarMemo = 1;   //  a priori ==> SAME n option: Y variable OK                     (ViewHisto)
06520   if( (HistoType == "Proj" || HistoType == "SampProj" || HistoType == "EvolProj") && 
06521       !(arg_AlreadyRead >= 1) )
06522     {
06523       TString XVarHisto = fCnaParHistos->GetXVarHisto(HistoCode.Data(), fFlagSubDet.Data(), fFapStexNumber);
06524       TString YVarHisto = fCnaParHistos->GetYVarHisto(HistoCode.Data(), fFlagSubDet.Data(), fFapStexNumber);
06525       if( (opt_plot == fSameOnePlot ) && GetMemoFlag(HistoCode, opt_plot) == "Free" )
06526         {
06527           SetYVarMemo(HistoCode, opt_plot, YVarHisto);  SetYVarMemo(HistoCode, opt_plot, YVarHisto); SameYVarMemo = 1;
06528         }
06529       if( (opt_plot == fSameOnePlot ) && GetMemoFlag(HistoCode, opt_plot) == "Busy" )
06530         {
06531           TString XVariableMemo = GetXVarFromMemo(HistoCode, opt_plot);
06532           TString YVariableMemo = GetYVarFromMemo(HistoCode, opt_plot);
06533           
06534           if( YVarHisto != YVariableMemo )
06535             {
06536               cout << "!TEcnaHistos::ViewHisto(...)> *** ERROR *** ===> Y coordinate changed in option SAME n." << endl
06537                    << "                              Present  X = " << XVarHisto << endl
06538                    << "                              Present  Y = " << YVarHisto << endl
06539                    << "                              Previous X = " << XVariableMemo << endl
06540                    << "                              Previous Y = " << YVariableMemo 
06541                    << fTTBELL << endl;
06542               SameYVarMemo = 0;
06543             }
06544           else
06545             {SetYVarMemo(HistoCode, opt_plot, YVarHisto);}
06546         }
06547     }
06548   //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
06549 
06550   //%%%%%%%%%%%%%%%%%%%%%%%%%%% Number of bins change in option SAME or SAME n %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
06551   Int_t OkBinsMemoSameOne = 1;   //  a priori ==> SAME n option: Nb bins OK                     (ViewHisto)
06552 
06553   Int_t SizeForPlot = GetHistoSize(HistoCode.Data(), "plot");
06554   Int_t xNbBins = GetHistoNumberOfBins(HistoCode.Data(), SizeForPlot);  
06555 
06556   if( (opt_plot == fSameOnePlot || opt_plot == fSeveralPlot) && GetMemoFlag(HistoCode, opt_plot) == "Free" )
06557     {
06558       SetNbBinsMemo(HistoCode, opt_plot, xNbBins); OkBinsMemoSameOne = 1;
06559     }
06560 
06561   if( (opt_plot == fSameOnePlot || opt_plot == fSeveralPlot) && GetMemoFlag(HistoCode, opt_plot) == "Busy" )
06562     {
06563       Int_t NbBinsMemo = GetNbBinsFromMemo(HistoCode, opt_plot);
06564       if( xNbBins != NbBinsMemo )
06565         {
06566           cout << "!TEcnaHistos::ViewHisto(...)> *** ERROR *** ===> Number of bins changed in option SAME or SAME n."
06567                << " Present number = " << xNbBins << ", requested number = " << NbBinsMemo << fTTBELL << endl;
06568           OkBinsMemoSameOne = 0;
06569         }
06570     }
06571 
06572   //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
06573 
06574   if( xCanvasExists == 1 && SameXVarMemo == 1 && SameYVarMemo == 1 && OkBinsMemoSameOne == 1 ){OKHisto = 1;}
06575 
06576   //======================== Histo accepted                                                       (ViewHisto)
06577   if( OKHisto == 1 )
06578     {
06579       Int_t opt_scale_x = fOptScaleLinx;
06580       if (fFlagScaleX == "LIN" ){opt_scale_x = fOptScaleLinx;}
06581       if (fFlagScaleX == "LOG" ){opt_scale_x = fOptScaleLogx;}
06582 
06583       Int_t opt_scale_y = fOptScaleLiny;
06584       if (fFlagScaleY == "LIN" ){opt_scale_y = fOptScaleLiny;}
06585       if (fFlagScaleY == "LOG" ){opt_scale_y = fOptScaleLogy;}
06586 
06587       fCnaParHistos->SetColorPalette(fFlagColPal);
06588       TString fp_name_short = " ";
06589   
06590       //-------------------- read_histo size
06591       Int_t SizeForRead = GetHistoSize(HistoCode.Data(), "read");
06592 
06593       //............................................... allocation/init_histo
06594       TVectorD histo_for_plot(SizeForPlot);
06595       for(Int_t i=0; i<SizeForPlot; i++){histo_for_plot[i]=(Double_t)0;}
06596 
06597       TVectorD histo_for_plot_memo(SizeForPlot);
06598       for(Int_t i=0; i<SizeForPlot; i++){histo_for_plot_memo[i]=(Double_t)0;}
06599 
06600       Int_t i_data_exist = 0;
06601       Int_t OKPlot = 0;
06602 
06603       //------------------------------------- histos Global, (Global)Proj, SampGlobal and SampProj
06604       if( HistoType == "Global"   || HistoType == "Proj" || HistoType == "SampGlobal" ||
06605           HistoType == "SampProj" )
06606         {     
06607           if( fFapStexNumber == 0 )
06608             {
06609               Bool_t ok_view_histo  = kFALSE;
06610 
06611               //--------------------------------------------------------------------- Stas Histo      (ViewHisto)
06612               Int_t CounterExistingFile = 0;
06613               Int_t CounterDataExist = 0;
06614 
06615               Int_t* xFapNbOfEvts = new Int_t[fEcal->MaxStexInStas()];     fCnew++;
06616               for(Int_t i=0; i<fEcal->MaxStexInStas(); i++){xFapNbOfEvts[i]=0;}
06617 
06618               //Int_t* NOFE_int = new Int_t[fEcal->MaxCrysEcnaInStex()];     fCnew++;
06619 
06620               for(Int_t iStasStex=0; iStasStex<fEcal->MaxStexInStas(); iStasStex++)
06621                 {
06622                   Bool_t OKFileExists   = kFALSE;
06623                   Bool_t ok_data_exists = kFALSE;
06624 
06625                   TVectorD read_histo(fEcal->MaxStinEcnaInStex());
06626                   for(Int_t i=0; i<fEcal->MaxStinEcnaInStex(); i++){read_histo(i)=(Double_t)0.;}
06627 
06628                   if( arg_AlreadyRead == 0 )
06629                     {
06630                       //----------------------------------------------------------------------------- file reading
06631                       fMyRootFile->PrintNoComment();
06632                       Int_t n1StasStex = iStasStex+1;
06633                       fMyRootFile->FileParameters(fFapAnaType,          fFapNbOfSamples,
06634                                                   fFapRunNumber,        fFapFirstReqEvtNumber,
06635                                                   fFapLastReqEvtNumber, fFapReqNbOfEvts,
06636                                                   n1StasStex,           fCfgResultsRootFilePath.Data());
06637                       
06638                       if( fMyRootFile->LookAtRootFile() == kTRUE ){OKFileExists = kTRUE;}            //   (ViewHisto, Stas)
06639                       if( OKFileExists == kTRUE )
06640                         {
06641                           xFapNbOfEvts[iStasStex] = fMyRootFile->GetNumberOfEvents(fFapReqNbOfEvts, n1StasStex);
06642                           fp_name_short = fMyRootFile->GetRootFileNameShort();
06643                           // cout << "*TEcnaHistos::ViewHisto(...)> Data are analyzed from file ----> "
06644                           //      << fp_name_short << endl;
06645                           //....................... search for first and last dates
06646                           if( iStasStex == 0 )
06647                             {
06648                               fStartTime = fMyRootFile->GetStartTime();
06649                               fStopTime  = fMyRootFile->GetStopTime();
06650                               fStartDate = fMyRootFile->GetStartDate();
06651                               fStopDate  = fMyRootFile->GetStopDate();
06652                             }
06653 
06654                           time_t xStartTime = fMyRootFile->GetStartTime();
06655                           time_t xStopTime  = fMyRootFile->GetStopTime();
06656                           TString xStartDate = fMyRootFile->GetStartDate();
06657                           TString xStopDate  = fMyRootFile->GetStopDate();
06658 
06659                           if( xStartTime < fStartTime ){fStartTime = xStartTime; fStartDate = xStartDate;}
06660                           if( xStopTime  > fStopTime  ){fStopTime  = xStopTime;  fStopDate  = xStopDate;}
06661 
06662                           fRunType = fMyRootFile->GetRunType();
06663                           ok_view_histo =
06664                             GetOkViewHisto(fMyRootFile, StexStin_A, i0StinEcha, i0Sample, HistoCode.Data());
06665 
06666                           if( ok_view_histo == kTRUE )
06667                             {
06668                               //............................................... histo reading   (ViewHisto, Stas)
06669                               if( HistoCode == "D_NOE_ChNb" || HistoCode == "D_NOE_ChDs" ){
06670                                 read_histo = fMyRootFile->ReadAverageNumberOfEvents(fEcal->MaxStinEcnaInStex());}
06671                               if( HistoCode == "D_Ped_ChNb" || HistoCode == "D_Ped_ChDs" ){
06672                                 read_histo = fMyRootFile->ReadAveragePedestals(fEcal->MaxStinEcnaInStex());}
06673                               if( HistoCode == "D_TNo_ChNb" || HistoCode == "D_TNo_ChDs" ){
06674                                 read_histo = fMyRootFile->ReadAverageTotalNoise(fEcal->MaxStinEcnaInStex());}
06675                               if( HistoCode == "D_MCs_ChNb" || HistoCode == "D_MCs_ChDs" ){
06676                                 read_histo = fMyRootFile->ReadAverageMeanCorrelationsBetweenSamples(fEcal->MaxStinEcnaInStex());}
06677                               if( HistoCode == "D_LFN_ChNb" || HistoCode == "D_LFN_ChDs" ){
06678                                 read_histo = fMyRootFile->ReadAverageLowFrequencyNoise(fEcal->MaxStinEcnaInStex());}
06679                               if( HistoCode == "D_HFN_ChNb" || HistoCode == "D_HFN_ChDs" ){
06680                                 read_histo = fMyRootFile->ReadAverageHighFrequencyNoise(fEcal->MaxStinEcnaInStex());}
06681                               if( HistoCode == "D_SCs_ChNb" || HistoCode == "D_SCs_ChDs" ){
06682                                 read_histo = fMyRootFile->ReadAverageSigmaOfCorrelationsBetweenSamples(fEcal->MaxStinEcnaInStex());}
06683                               if( fMyRootFile->DataExist() == kTRUE ){ok_data_exists = kTRUE;}
06684                             }
06685                         }
06686                     }
06687                   
06688                   if( arg_AlreadyRead >= 1 )
06689                     {
06690                       ok_data_exists = kTRUE;
06691                       for(Int_t i0Stin=0; i0Stin<fEcal->MaxStinEcnaInStex(); i0Stin++ )
06692                         {read_histo(i0Stin) = arg_read_histo(fEcal->MaxStinEcnaInStex()*iStasStex+i0Stin);}
06693                     }
06694 
06695                   if( ok_data_exists == kTRUE )
06696                     {
06697                       fStatusFileFound = kTRUE;
06698                       CounterExistingFile++;
06699 
06700 
06701                       //...........................................................
06702                       if( ok_data_exists == kTRUE )
06703                         {
06704                           fStatusDataExist = kTRUE;
06705                           CounterDataExist++;
06706 
06707                           for(Int_t i0StexStinEcna=0; i0StexStinEcna<fEcal->MaxStinEcnaInStex(); i0StexStinEcna++)
06708                             {
06709                               //Int_t n1StexStinEcna = i0StexStinEcna+1;
06710                               //-------------------------------------- Stas histo filling   (ViewHisto, Stas)
06711                               Int_t i_xgeo = -1;
06712                               //...................................... EB
06713                               if( fFlagSubDet == "EB" )
06714                                 {
06715                                   i_xgeo = iStasStex*fEcal->MaxStinEcnaInStex() + i0StexStinEcna;
06716                                   if( i_xgeo >= 0 && i_xgeo < SizeForPlot )
06717                                     {
06718                                       histo_for_plot[i_xgeo] = read_histo[i0StexStinEcna];
06719                                     }
06720                                   else
06721                                     {
06722                                       cout << "!TEcnaHistos::ViewHisto(...)> <EB> i_xgeo = " << i_xgeo
06723                                            << ". OUT OF RANGE ( range = [0,"<< SizeForPlot << "] " << endl;
06724                                     }  
06725                                 }
06726                               //...................................... EE    (ViewHisto)
06727                               //-------> Dee order: D4, D3, D2, D1                    
06728                               if( fFlagSubDet == "EE" )
06729                                 {
06730                                   Int_t DeeOffset = 0;
06731                                   Int_t DSOffset  = 0;
06732                               
06733                                   Int_t DeeNumber = iStasStex+1;
06734                                   Int_t n1DeeSCEcna = i0StexStinEcna+1;
06735                               
06736                                   //................................................ Dee offset
06737                                   if( DeeNumber == 3 ){DeeOffset +=   fEcal->MaxSCForConsInDee();}     // 149
06738                                   if( DeeNumber == 2 ){DeeOffset += 3*fEcal->MaxSCForConsInDee()-1;}   // 446
06739                                   if( DeeNumber == 1 ){DeeOffset += 4*fEcal->MaxSCForConsInDee()-1;}   // 595
06740                               
06741                                   //................................................ Data Sector offset   (ViewHisto, Stas)
06742                                   Int_t StexDataSector = fEcalNumbering->GetDSFrom1DeeSCEcna(DeeNumber, n1DeeSCEcna);
06743                                   //.... returns 0 if n1DeeSCEcna corresponds to an empty "ECNA-SC"
06744                                   
06745                                   //................................................ SC final coordinate   (ViewHisto, Stas)
06746                                   Int_t StexDSStin = fEcalNumbering->GetDSSCFrom1DeeSCEcna(DeeNumber, n1DeeSCEcna);
06747                                   //--> return StexDSStin = 25 (not  3) for n1DeeSCEcna = 32
06748                                   //--> return StexDSStin = 14 (not 21) for n1DeeSCEcna = 29
06749                                   //--> return StexDSStin = -1 for n1DeeSCEcna = 10 and n1DeeSCEcna = 11 
06750 
06751                                   if( StexDataSector >= 1 && StexDataSector <= 9 )
06752                                     {
06753                                       if( DeeNumber == 4 ) // Sectors 1,2,3,4,5a
06754                                         {
06755                                           for(Int_t is=2; is<=5; is++)
06756                                             { if( StexDataSector >= is )
06757                                                 {Int_t ism = is-1; DSOffset += fEcalNumbering->GetMaxSCInDS(ism);}}
06758                                         }
06759                                   
06760                                       if( DeeNumber == 3 ) // Sectors 5b,6,7,8,9
06761                                         {
06762                                           if( StexDataSector >= 6 )
06763                                             {DSOffset += fEcalNumbering->GetMaxSCInDS(5)/2;}
06764                                           for(Int_t is=7; is<=9; is++)
06765                                             { if( StexDataSector >= is )
06766                                               {Int_t ism = is-1; DSOffset += fEcalNumbering->GetMaxSCInDS(ism);}}
06767                                         }
06768                                   
06769                                       if( DeeNumber == 2 ) // Sectors 9,8,7,6,5a
06770                                         {
06771                                           if( StexDataSector >= 6 )
06772                                             {DSOffset -= fEcalNumbering->GetMaxSCInDS(5)/2;}
06773                                           for(Int_t is=7; is<=9; is++)
06774                                             {if( StexDataSector >= is )
06775                                               {Int_t ism = is-1; DSOffset -= fEcalNumbering->GetMaxSCInDS(ism);}}
06776                                         }
06777                                   
06778                                       if( DeeNumber == 1 ) // Sectors 5b,4,3,2,1
06779                                         {
06780                                           for(Int_t is=2; is<=5; is++)
06781                                             { if( StexDataSector >= is )
06782                                               {Int_t ism = is-1; DSOffset -= fEcalNumbering->GetMaxSCInDS(ism);}}
06783                                         }
06784                                   
06785                                       if( StexDSStin >=1 && StexDSStin <= fEcalNumbering->GetMaxSCInDS(StexDataSector) )
06786                                         {
06787                                           if( DeeNumber == 4 ) // Sectors 1,2,3,4,5a
06788                                             {
06789                                               if(StexDataSector != 5)
06790                                                 {i_xgeo = DeeOffset + DSOffset + (StexDSStin - 1);}
06791                                               if( StexDataSector == 5)
06792                                                 {i_xgeo = DeeOffset + DSOffset + (StexDSStin - 1);}
06793                                             }
06794                                           if( DeeNumber == 3 ) // Sectors 5b,6,7,8,9
06795                                             {
06796                                               if(StexDataSector != 5)
06797                                                 {i_xgeo = DeeOffset + DSOffset + (StexDSStin - 1);}
06798                                               if( StexDataSector == 5)
06799                                                 {i_xgeo = DeeOffset + DSOffset + (StexDSStin-17) - 1;}
06800                                             }
06801                                           if( DeeNumber == 2 ) // Sectors 5a,6,7,8,9
06802                                             {
06803                                               if(StexDataSector != 5)
06804                                                 {i_xgeo = DeeOffset + DSOffset
06805                                                    - fEcalNumbering->GetMaxSCInDS(StexDataSector) + StexDSStin;}
06806                                               if( StexDataSector == 5)
06807                                                 {i_xgeo = DeeOffset + DSOffset
06808                                                    - fEcalNumbering->GetMaxSCInDS(StexDataSector)/2 + StexDSStin;}
06809                                             }
06810                                           if( DeeNumber == 1 ) // Sectors 1,2,3,4,5b
06811                                             {
06812                                               if(StexDataSector != 5)
06813                                                 {i_xgeo = DeeOffset + DSOffset
06814                                                    - fEcalNumbering->GetMaxSCInDS(StexDataSector) + StexDSStin;}
06815                                               if( StexDataSector == 5)
06816                                                 {i_xgeo = DeeOffset + DSOffset
06817                                                    - fEcalNumbering->GetMaxSCInDS(StexDataSector)/2 +(StexDSStin-17);}
06818                                             }
06819                                           
06820                                         }// end of if(StexDSStin >=1 && StexDSStin <= fEcalNumbering->GetMaxSCInDS(StexDataSector))
06821                                       else
06822                                         {
06823                                           cout << "!TEcnaHistos::ViewHisto(...)> <EE>  StexDSStin = " << StexDSStin
06824                                                << ". OUT OF RANGE ( range = [1,"
06825                                                << fEcalNumbering->GetMaxSCInDS(StexDataSector)
06826                                                << "]. DeeNumber =  " << DeeNumber
06827                                                << ", n1DeeSCEcna = " << n1DeeSCEcna
06828                                                << ", StexDataSector = "  << StexDataSector 
06829                                                << ", i_xgeo = "  << i_xgeo << endl;
06830                                         }
06831                                     }// end of if( StexDataSector >= 1 && StexDataSector <= 9 )
06832                                   else
06833                                     {
06834                                       //cout << "!TEcnaHistos::ViewHisto(...)> <EE>  StexDataSector = " << StexDataSector
06835                                       //     << ". OUT OF RANGE ( range = [1,9]. DeeNumber = " << DeeNumber
06836                                       //     << ", n1DeeSCEcna = " << n1DeeSCEcna
06837                                       //     << ", i_xgeo = "  << i_xgeo << endl;
06838                                     }
06839                                   //......................................... transfert read_histo -> histo_for_plot
06840                                   if( i_xgeo >= -1 && i_xgeo < SizeForPlot )
06841                                     {
06842                                       // special treatement for not connected & mixed SC's
06843                                       if( n1DeeSCEcna ==  29 || n1DeeSCEcna ==  32 ||   //  261a, 207c, 268a, 178c 
06844                                                                                         // [ 14a,  25c,  21a,   3c]
06845                                           n1DeeSCEcna == 144 || n1DeeSCEcna == 165 ||   //  261c, 261b [14c, 14b]
06846                                           n1DeeSCEcna == 176 || n1DeeSCEcna == 193 ||   //  207a, 207b [25a, 25b]
06847                                           n1DeeSCEcna ==  60 || n1DeeSCEcna == 119 ||   //  182a, 182b [30a, 30b]
06848                                           n1DeeSCEcna == 102 || n1DeeSCEcna == 123 ||   //  268c, 268b [21c, 21b]
06849                                           n1DeeSCEcna == 138 || n1DeeSCEcna == 157 )    //  178a, 178b [ 3a,  3b] 
06850                                         {
06851                                           //--------------- DSSC 14
06852                                           if( n1DeeSCEcna ==  29 && i_xgeo >= 0 )
06853                                             {histo_for_plot[i_xgeo] += read_histo[i0StexStinEcna]/(Double_t)5.;}
06854                                           if( (n1DeeSCEcna ==  144 || n1DeeSCEcna == 165) && i_xgeo >= 0 )
06855                                             {histo_for_plot[i_xgeo] +=
06856                                                read_histo[i0StexStinEcna]*(Double_t)10./(Double_t)25.;}
06857                                           
06858                                           //--------------- DSSC 25
06859                                           if( n1DeeSCEcna ==  32 && i_xgeo >= 0 )
06860                                             {histo_for_plot[i_xgeo] += read_histo[i0StexStinEcna]/(Double_t)5.;}
06861                                           if( (n1DeeSCEcna ==  176 || n1DeeSCEcna == 193) && i_xgeo >= 0 )
06862                                             {histo_for_plot[i_xgeo] +=
06863                                                read_histo[i0StexStinEcna]*(Double_t)10./(Double_t)25.;}
06864                                           
06865                                           //--------------- DSSC 30 
06866                                           if( (n1DeeSCEcna == 60 || n1DeeSCEcna == 119) && i_xgeo >= 0 )
06867                                             {histo_for_plot[i_xgeo] += read_histo[i0StexStinEcna]/(Double_t)2.;}
06868                                           
06869                                           //--------------- DSSC 21 (Add SC translated at 10-1 only once, i_xgeo = -1 accepted)
06870                                           if( n1DeeSCEcna == 102 )
06871                                             {histo_for_plot[i_xgeo] += read_histo[9]/(Double_t)21.
06872                                                + read_histo[i0StexStinEcna]*(Double_t)10./(Double_t)21.;}
06873                                           if( n1DeeSCEcna == 123 && i_xgeo >= 0 )
06874                                             {histo_for_plot[i_xgeo] +=
06875                                                read_histo[i0StexStinEcna]*(Double_t)10./(Double_t)21.;}
06876                                           
06877                                           //--------------- DSSC 3 (Add SC translated at 11-1 only once, i_xgeo = -1 accepted)
06878                                           if( n1DeeSCEcna == 138 )
06879                                             {histo_for_plot[i_xgeo] += read_histo[10]/(Double_t)21.
06880                                                + read_histo[i0StexStinEcna]*(Double_t)10./(Double_t)21.;}
06881                                           if( n1DeeSCEcna == 157 && i_xgeo >= 0 )
06882                                             {histo_for_plot[i_xgeo] +=
06883                                                read_histo[i0StexStinEcna]*(Double_t)10./(Double_t)21.;}
06884                                         }
06885                                       else
06886                                         {
06887                                           if( i_xgeo >= 0 )
06888                                             {histo_for_plot[i_xgeo] += read_histo[i0StexStinEcna];} // standard treatment
06889                                         }
06890                                     } // end of if( i_xgeo >= -1 && i_xgeo < SizeForPlot )
06891                                   else
06892                                     {
06893                                       //cout << "!TEcnaHistos::ViewHisto(...)> <EE>  i_xgeo = " << i_xgeo
06894                                       //     << ". OUT OF RANGE ( range = [0,"<< SizeForPlot << "] " << endl;
06895                                     }
06896                                 }// end of if( fFlagSubDet == "EE" )
06897                             }// end of for(Int_t i0StexStinEcna=0; i0StexStinEcna<fEcal->MaxStinEcnaInStex(); i0StexStinEcna++)
06898                         }
06899                       else
06900                         {
06901                           cout << "!TEcnaHistos::ViewHisto(...)>  "
06902                                << " Data not available for " << fFapStexName << " " << iStasStex+1
06903                                << " (Quantity not present in the ROOT file)" << endl;
06904                         }
06905                     } // end of if ( fMyRootFile->LookAtRootFile() == kTRUE )   (ViewHisto/Stas)
06906                   else
06907                     {
06908                       fStatusFileFound = kFALSE;
06909 
06910                       cout << "!TEcnaHistos::ViewHisto(...)>  "
06911                            << " Data not available for " << fFapStexName << " " << iStasStex+1
06912                            << " (ROOT file not found)" << endl;
06913                     }
06914 
06915                   if( fFapNbOfEvts <= xFapNbOfEvts[iStasStex] ){fFapNbOfEvts = xFapNbOfEvts[iStasStex];}
06916 
06917                 } // end of for(Int_t iStasStex=0; iStasStex<fEcal->MaxStexInStas(); iStasStex++)
06918 
06919               //delete [] NOFE_int; NOFE_int = 0;               fCdelete++;
06920               delete [] xFapNbOfEvts; xFapNbOfEvts = 0;       fCdelete++;
06921             
06922               if( CounterExistingFile > 0 && CounterDataExist > 0 ){OKPlot = 1;} 
06923           
06924             } // end of if( fFapStexNumber == 0 )
06925         
06926           //---------------------------------------------------------------------------- (ViewHisto [Stex])
06927 
06928           if( fFapStexNumber > 0 )
06929             {
06930               Bool_t OKFileExists  = kFALSE ;
06931               Bool_t ok_view_histo = kFALSE;
06932 
06933               if( arg_AlreadyRead == 0 )
06934                 {
06935                   fMyRootFile->PrintNoComment();
06936                   fMyRootFile->FileParameters(fFapAnaType,          fFapNbOfSamples,
06937                                               fFapRunNumber,        fFapFirstReqEvtNumber,
06938                                               fFapLastReqEvtNumber, fFapReqNbOfEvts,
06939                                               fFapStexNumber,       fCfgResultsRootFilePath.Data());
06940                   
06941                   if ( fMyRootFile->LookAtRootFile() == kTRUE ){OKFileExists = kTRUE;}       //   (ViewHisto, Stex)            
06942                   
06943                   if( OKFileExists == kTRUE )
06944                     {
06945                       fFapNbOfEvts = fMyRootFile->GetNumberOfEvents(fFapReqNbOfEvts, fFapStexNumber);
06946                       fp_name_short = fMyRootFile->GetRootFileNameShort();
06947                       // cout << "*TEcnaHistos::ViewHisto(...)> Data are analyzed from file ----> "
06948                       //      << fp_name_short << endl;
06949                       
06950                       fStartDate = fMyRootFile->GetStartDate();
06951                       fStopDate  = fMyRootFile->GetStopDate();
06952                       fRunType   = fMyRootFile->GetRunType();
06953 
06954                       ok_view_histo =
06955                         GetOkViewHisto(fMyRootFile, StexStin_A, i0StinEcha, i0Sample, HistoCode.Data());
06956                     }
06957                 }
06958               
06959               if( arg_AlreadyRead >= 1 )
06960                 {
06961                   OKFileExists = kTRUE; ok_view_histo = kTRUE;
06962                 }
06963               
06964               if( OKFileExists == kTRUE ) 
06965                 {
06966                   fStatusFileFound = kTRUE;
06967                   //---------------------------------------------------------------------------- (ViewHisto [Stex])
06968               
06969                   if( ok_view_histo == kTRUE )
06970                     {
06971                       //------------ EB or EE with SampGlobal or SampProj (histo_for_plot = read_histo)
06972                       if( fFlagSubDet == "EB" || 
06973                           ( fFlagSubDet == "EE" && ( HistoType == "SampGlobal" || HistoType == "SampProj" )  )  )
06974                         {
06975                           histo_for_plot = GetHistoValues(arg_read_histo, arg_AlreadyRead, fMyRootFile, HistoCode.Data(),
06976                                                           SizeForPlot, SizeForRead,
06977                                                           StexStin_A,  i0StinEcha, i0Sample, i_data_exist);
06978                           if( i_data_exist > 0 ){OKPlot = 1;}
06979                           if( OKPlot == 1 && opt_plot == "ASCII" && ( HistoType == "Global" || HistoType == "Proj" ) )
06980                             {WriteHistoAscii(HistoCode.Data(), SizeForPlot, histo_for_plot);}
06981                         }
06982                   
06983                       //------------ EE  except for SampGlobal and SampProj) (histo_for_plot # read_histo)
06984                       if( fFlagSubDet == "EE" && !( HistoType == "SampGlobal" || HistoType == "SampProj" ) )
06985                         {
06986                           TVectorD read_histo(SizeForRead);
06987                           for(Int_t i=0; i<SizeForRead; i++){read_histo(i)=(Double_t)0.;}
06988 
06989                           read_histo = GetHistoValues(arg_read_histo, arg_AlreadyRead, fMyRootFile, HistoCode.Data(),
06990                                                       SizeForRead, SizeForRead,
06991                                                       StexStin_A, i0StinEcha, i0Sample, i_data_exist);
06992                           if( i_data_exist > 0 ){OKPlot = 1;}
06993                           if( OKPlot == 1 && opt_plot == "ASCII" )
06994                             {
06995                               WriteHistoAscii(HistoCode.Data(), fEcal->MaxCrysEcnaInDee(), read_histo);
06996                             }
06997                           if( OKPlot == 1 && opt_plot != "ASCII" )
06998                             {
06999                               //..................... Build histo_for_plot from read_histo (ViewHisto [Stex])
07000                               Int_t DeeNumber = fFapStexNumber;
07001                               TString DeeDir  = fEcalNumbering->GetDeeDirViewedFromIP(DeeNumber);
07002                           
07003                               //%%%%%%%%%%%%%%%%%%%%%%%%%%%% LOOP ON Echa (Ecna) %%%%%%%%%%%%%%%%%%%%%%%%%% (ViewHisto [Stex])
07004                               for(Int_t i0DeeEcha=0; i0DeeEcha<fEcal->MaxCrysEcnaInDee(); i0DeeEcha++)
07005                                 {
07006                                   Int_t n1SCEcha    = fEcalNumbering->Get1SCEchaFrom0DeeEcha(i0DeeEcha);
07007                                   Int_t n1DeeSCEcna = i0DeeEcha/fEcal->MaxCrysInSC()+1;
07008                               
07009                                   Int_t DataSector = fEcalNumbering->GetDSFrom1DeeSCEcna(DeeNumber, n1DeeSCEcna);
07010                                   Int_t SC_in_DS   = fEcalNumbering->GetDSSCFrom1DeeSCEcna(DeeNumber, n1DeeSCEcna, n1SCEcha);
07011                               
07012                                   Int_t i_xgeo = -1;                  
07013                               
07014                                   if( n1SCEcha >= 1 && n1SCEcha <= fEcal->MaxCrysInSC() )
07015                                     {
07016                                       if( n1DeeSCEcna >= 1 && n1DeeSCEcna <= fEcal->MaxSCEcnaInDee() )
07017                                         {
07018                                           if( DataSector >= 1 && DataSector <= 9 )
07019                                             {
07020                                               if( SC_in_DS >= 1 && SC_in_DS <= fEcalNumbering->GetMaxSCInDS(DataSector) )
07021                                                 {
07022                                                   if( read_histo[i0DeeEcha] != 0 )
07023                                                     {
07024                                                       //................................... Data Sector offset
07025                                                       Int_t DSOffset = GetDSOffset(DeeNumber, DataSector);
07026                                               
07027                                                       //........................ Super-Crystal (SC) offset (ViewHisto [Stex])
07028                                                       Int_t SCOffset = GetSCOffset(DeeNumber, DataSector, SC_in_DS);
07029                                               
07030                                                       //........................ Xtal final bin
07031                                                       Int_t nSCCons = fEcalNumbering->
07032                                                         GetDeeSCConsFrom1DeeSCEcna(DeeNumber, n1DeeSCEcna, n1SCEcha);
07033 
07034                                                       Int_t n1FinalSCEcha = n1SCEcha;
07035                                                       
07036                                                       if( fEcalNumbering->GetSCType(nSCCons) == "NotConnected" || 
07037                                                           fEcalNumbering->GetSCType(nSCCons) == "NotComplete"  )
07038                                                         { //----- not complete and not connected SC's
07039                                                           // no i_xgeo value if SC = 14 or 25 and channel 11
07040                                                           if( !( (SC_in_DS == 14 || SC_in_DS == 25 ) && n1SCEcha == 11 )  )
07041                                                             {
07042                                                               n1FinalSCEcha =
07043                                                                 ModifiedSCEchaForNotConnectedSCs(DeeNumber, nSCCons, SC_in_DS,
07044                                                                                                  n1DeeSCEcna, n1SCEcha);
07045                                                               i_xgeo = DSOffset + SCOffset + (n1FinalSCEcha-1);
07046                                                             }
07047                                                           // change SC 14 -> 21 and channel 11 -> 21
07048                                                           if( SC_in_DS ==  14 && n1SCEcha == 11 )
07049                                                             {
07050                                                               SCOffset = GetSCOffset(DeeNumber, DataSector, 21);
07051                                                               n1FinalSCEcha = 21;
07052                                                               i_xgeo = DSOffset + SCOffset + (n1FinalSCEcha-1);
07053                                                             }
07054                                                           // change SC 25 -> 3 for channel 11 -> 21
07055                                                           if( SC_in_DS ==  25 && n1SCEcha == 11 )
07056                                                             {
07057                                                               SCOffset = GetSCOffset(DeeNumber, DataSector, 3);
07058                                                               n1FinalSCEcha = 21;
07059                                                               i_xgeo = DSOffset + SCOffset + (n1FinalSCEcha-1);
07060                                                             }
07061                                                         }
07062                                                       else
07063                                                         { //----------- Complete SCs
07064                                                           i_xgeo = DSOffset + SCOffset + (n1FinalSCEcha-1);
07065                                                         }
07066 
07067                                                       histo_for_plot_memo[i_xgeo]++;
07068                                                       if( histo_for_plot_memo[i_xgeo] >= 2 )
07069                                                         {
07070                                                           cout << "! histo_memo[" << i_xgeo
07071                                                                << "] = " << histo_for_plot_memo[i_xgeo]
07072                                                                << ", nSCCons = " <<  nSCCons
07073                                                                << ", SC_in_DS = " << SC_in_DS
07074                                                                << ", DSOffset = " << DSOffset
07075                                                                << ", SCOffset = " << SCOffset
07076                                                                << ", n1DeeSCEcna = " << n1DeeSCEcna
07077                                                                << ", n1SCEcha = " << n1SCEcha
07078                                                                << ", n1FinalSCEcha = " << n1FinalSCEcha << endl;
07079                                                         }
07080                                                       //.............................. transfert read_histo -> histo_for_plot
07081                                                       if( i_xgeo >= 0 && i_xgeo < SizeForPlot )
07082                                                         {
07083                                                           if( n1FinalSCEcha > 0 )
07084                                                             {histo_for_plot[i_xgeo] += read_histo[i0DeeEcha];}
07085                                                         }
07086                                                       else
07087                                                         {
07088                                                           cout << "!TEcnaHistos::ViewHisto(...)> <EE>  i_xgeo = " << i_xgeo
07089                                                                << ". OUT OF RANGE ( range = [0,"<< SizeForPlot << "] " << endl;
07090                                                         }
07091                                                     } // end of  if( read_histo[i0DeeEcha] > 0 )
07092                                                 } // end of if( SC_in_DS >= 1 && SC_in_DS <= fEcalNumbering->GetMaxSCInDS(DataSector) )
07093                                               else
07094                                                 {
07095                                                   cout << "!TEcnaHistos::ViewHisto(...)> <EE>  SC_in_DS = " << SC_in_DS
07096                                                        << ". OUT OF RANGE ( range = [1,"
07097                                                        << fEcalNumbering->GetMaxSCInDS(DataSector) << "] "
07098                                                        << ", DataSector = " << DataSector
07099                                                        << ", n1DeeSCEcna = " << n1DeeSCEcna
07100                                                        << ", n1SCEcha = " << n1SCEcha
07101                                                        << ", i0DeeEcha = " << i0DeeEcha
07102                                                        << endl;
07103                                                 }
07104                                             } // end of if( DataSector >= 1 && DataSector <= 9 )
07105                                           else
07106                                             {
07107                                               if( DataSector != 0 )
07108                                                 {
07109                                                   cout << "!TEcnaHistos::ViewHisto(...)> <EE>  DataSector = " << DataSector
07110                                                        << ". OUT OF RANGE ( range = [1,9] "
07111                                                        << ", n1DeeSCEcna = " << n1DeeSCEcna
07112                                                        << ", n1SCEcha = " << n1SCEcha
07113                                                        << ", i0DeeEcha = " << i0DeeEcha
07114                                                        << endl;
07115                                                 }
07116                                             }
07117                                         } // end of if( n1DeeSCEcna >= 1 && n1DeeSCEcna <= fEcal->MaxSCEcnaInDee() )
07118                                       else
07119                                         {
07120                                           cout << "!TEcnaHistos::ViewHisto(...)> <EE>  n1DeeSCEcna = " << n1DeeSCEcna
07121                                                << ". OUT OF RANGE ( range = [1,"<< fEcal->MaxSCEcnaInDee() << "] "
07122                                                << ", n1SCEcha = " << n1SCEcha
07123                                                << ", i0DeeEcha = " << i0DeeEcha
07124                                                << endl;
07125                                         }
07126                                     } // end of if(n1SCEcha >= 1 && n1SCEcha <= fEcal->MaxCrysInSC() )
07127                                   else
07128                                     {
07129                                       cout << "!TEcnaHistos::ViewHisto(...)> <EE>  n1SCEcha = " << n1SCEcha
07130                                            << ". OUT OF RANGE ( range = [1,"<< fEcal->MaxCrysInSC() << "] "
07131                                            << ", i0DeeEcha = " << i0DeeEcha
07132                                            << endl;
07133                                     }
07134                                 }
07135                             } // end of if( OKPlot == 1 && opt_plot != "ASCII" )
07136                         } // end of if(fFlagSubDet == "EE")
07137                     } // end of if(ok_view_histo == kTRUE)
07138                   else
07139                     {
07140                       cout << "!TEcnaHistos::ViewHisto(...)> *ERROR* =====> "
07141                            << " ok_view_histo != kTRUE " << fTTBELL << endl;
07142                     }
07143                 } // end of if(fMyRootFile->LookAtRootFile() == kTRUE)
07144               else
07145                 {
07146                   fStatusFileFound = kFALSE;
07147 
07148                   cout << "!TEcnaHistos::ViewHisto(...)> *ERROR* =====> "
07149                        << " ROOT file not found" << fTTBELL << endl;
07150                 }
07151             } // end of if(fFapStexNumber > 0)
07152         } // end of if( HistoType == "Global" || HistoType == "Proj" || HistoType == "SampGlobal" || HistoType == "SampProj" )
07153       else        
07154         {
07155           //--------------------------------------------------------------------- not Global-Proj Histo
07156           if( (fFapStexNumber > 0) && (fFapStexNumber <= fEcal->MaxStexInStas()) )
07157             {
07158               Bool_t OKFileExists = kFALSE;
07159 
07160               if( !(arg_AlreadyRead > 1) )
07161                 {
07162                   fMyRootFile->PrintNoComment();
07163                   fMyRootFile->FileParameters(fFapAnaType,          fFapNbOfSamples,
07164                                               fFapRunNumber,        fFapFirstReqEvtNumber,
07165                                               fFapLastReqEvtNumber, fFapReqNbOfEvts,
07166                                               fFapStexNumber,       fCfgResultsRootFilePath.Data());
07167                   OKFileExists = fMyRootFile->LookAtRootFile();
07168                   if( OKFileExists == kTRUE ){fFapNbOfEvts = fMyRootFile->GetNumberOfEvents(fFapReqNbOfEvts, fFapStexNumber);}
07169                 }
07170               else
07171                 {
07172                   OKFileExists = kTRUE;
07173                 }
07174               
07175               if( OKFileExists == kTRUE )    //   (ViewHisto, not Global-Proj)
07176                 {
07177                   fStatusFileFound = kTRUE;
07178 
07179                   for(Int_t i=0; i<SizeForPlot; i++){histo_for_plot[i]=(Double_t)0;}
07180 
07181                   histo_for_plot = GetHistoValues(arg_read_histo, arg_AlreadyRead, fMyRootFile, HistoCode.Data(),
07182                                                   SizeForPlot, SizeForRead,
07183                                                   StexStin_A, i0StinEcha, i0Sample, i_data_exist);
07184 
07185                   fFapNbOfEvts = fMyRootFile->GetNumberOfEvents(fFapReqNbOfEvts, fFapStexNumber);
07186                   fStartDate = fMyRootFile->GetStartDate();
07187                   fStopDate  = fMyRootFile->GetStopDate();
07188                   fRunType   = fMyRootFile->GetRunType();
07189                   
07190                   if( i_data_exist > 0 ){OKPlot = 1;}
07191                 }
07192               else
07193                 {
07194                   cout << "!TEcnaHistos::ViewHisto(...)> *ERROR* =====> "
07195                        << " ROOT file not found" << fTTBELL << endl;
07196                 }
07197             }
07198           else
07199             {
07200               cout << "!TEcnaHistos::ViewHisto(...)> " << fFapStexName.Data()
07201                    << " = " << fFapStexNumber << ". Out of range (range = [1,"
07202                    << fEcal->MaxStexInStas() << "]) " << fTTBELL << endl;
07203             }
07204         }
07205 
07206       //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PLOT accepted 
07207 
07208       if( (    HistoType == "Global"     || HistoType == "Proj" ||
07209                HistoType == "SampGlobal" || HistoType == "SampProj" || 
07210                HistoType == "H1Basic"    || HistoType == "H1BasicProj" ) ||
07211           ( !( HistoType == "Global"     || HistoType == "Proj" ||
07212                HistoType == "SampGlobal" || HistoType == "SampProj" || 
07213                HistoType == "H1Basic"    || HistoType == "H1BasicProj" ) &&
07214             ( (fFapStexNumber > 0) && (fFapStexNumber <= fEcal->MaxStexInStas()) ) ) )
07215         {
07216           if( opt_plot != "ASCII" )
07217             {
07218               if( OKPlot > 0 )
07219                 {
07220                   //... Ymin and ymax default values will be taken if fFlagUserHistoMin/Max = "OFF"
07221                   //    and if "Free" for "SAME" and "SAME n" options
07222                   if( (opt_plot == fOnlyOnePlot && ( arg_AlreadyRead == 0 || arg_AlreadyRead == 1 ) ) ||
07223                       (opt_plot == fSeveralPlot && GetMemoFlag(HistoCode, opt_plot) == "Free") ||
07224                       (opt_plot == fSameOnePlot && GetMemoFlag(HistoCode, opt_plot) == "Free") )
07225                     {
07226                       SetYminMemoFromValue(HistoCode.Data(), fCnaParHistos->GetYminDefaultValue(HistoCode.Data()));
07227                       SetYmaxMemoFromValue(HistoCode.Data(), fCnaParHistos->GetYmaxDefaultValue(HistoCode.Data()));
07228                     }
07229                   
07230                   //====  H I S T O  P R O J   X I N F / X S U P   M A N A G E M E N T  ========  (ViewHisto)
07231                   //
07232                   //  must be done before booking because of the x <-> y permutation in case of "Proj"
07233                   //
07234                   //-----------------------------------------------------------------------------------------
07235                   //
07236                   //        CASE:    HistoType == "Proj"   OR   HistoType == "SampProj"
07237                   //
07238                   //                 Xinf and Xsup must be calculated from ymin and ymax
07239                   //                 of the direct ("Global") histo
07240                   //
07241                   //-----------------------------------------------------------------------------------------
07242                   if( HistoType == "Proj" || HistoType == "SampProj" || HistoType == "H1BasicProj" )
07243                     {
07244                       TString HistoCodi = HistoCode;     // HistoCodi = direct histo
07245 
07246                       if( HistoCode == "D_NOE_ChDs" ){HistoCodi = "D_NOE_ChNb";}
07247                       if( HistoCode == "D_Ped_ChDs" ){HistoCodi = "D_Ped_ChNb";}
07248                       if( HistoCode == "D_TNo_ChDs" ){HistoCodi = "D_TNo_ChNb";}
07249                       if( HistoCode == "D_MCs_ChDs" ){HistoCodi = "D_MCs_ChNb";}
07250                       if( HistoCode == "D_LFN_ChDs" ){HistoCodi = "D_LFN_ChNb";}
07251                       if( HistoCode == "D_HFN_ChDs" ){HistoCodi = "D_HFN_ChNb";}
07252                       if( HistoCode == "D_SCs_ChDs" ){HistoCodi = "D_SCs_ChNb";}
07253                       if( HistoCode == "D_MSp_SpDs" ){HistoCodi = "D_MSp_SpNb";}
07254                       if( HistoCode == "D_SSp_SpDs" ){HistoCodi = "D_SSp_SpNb";}
07255                       if( HistoCode == "D_Adc_EvDs" ){HistoCodi = "D_Adc_EvNb";}                      
07256 
07257                       TString TitleHisto = ";";
07258                       if( opt_plot != fSameOnePlot )
07259                         {TitleHisto = fCnaParHistos->GetQuantityName(HistoCodi);}                     
07260 
07261                       if( fUserHistoMin >= fUserHistoMax ){fFlagUserHistoMin = "AUTO"; fFlagUserHistoMax = "AUTO";}
07262 
07263                       //--------------------------------------------------------------------------- (ViewHisto)
07264                       //
07265                       //    fOnlyOnePlot => compute Xinf and Xsup at each time
07266                       //    fSeveralPlot => compute Xinf and Xsup once when flag = "Free" for each HistoCode
07267                       //    fSameOnePlot => compute Xinf and Xsup once
07268                       //
07269                       //--------------------------------------------------------------------------------------
07270                       if( (opt_plot == fOnlyOnePlot && ( arg_AlreadyRead == 0 || arg_AlreadyRead == 1 ) ) ||
07271                           (opt_plot == fSeveralPlot && GetMemoFlag(HistoCode, fSeveralPlot) == "Free" ) ||
07272                           (opt_plot == fSameOnePlot && GetMemoFlag(HistoCode, fSameOnePlot) == "Free" ) )
07273                         {
07274                           Double_t XinfProj =(Double_t)0;
07275                           Double_t XsupProj =(Double_t)0;
07276 
07277                           //...................................................................... (ViewHisto)
07278                           if( fFlagUserHistoMin == "AUTO" || fFlagUserHistoMax == "AUTO" )
07279                             {
07280                               Int_t HisSiza = GetHistoSize(HistoCodi.Data(), "plot");
07281                               Int_t ReadHisSiza = HisSiza;
07282                               //..............................  prepa direct histogram booking (ViewHisto)
07283                               Axis_t xinf_hisa = GetHistoXinf(HistoCodi.Data(), HisSiza, opt_plot);
07284                               Axis_t xsup_hisa = GetHistoXsup(HistoCodi.Data(), HisSiza, opt_plot);
07285                               Int_t nb_binxa   = GetHistoNumberOfBins(HistoCodi.Data(), HisSiza);
07286                               //..............................  direct ("Global") histogram booking (ViewHisto)
07287                               TH1D* h_hisa =
07288                                 new TH1D("histoa", TitleHisto.Data(), nb_binxa, xinf_hisa, xsup_hisa); fCnewRoot++;
07289                               h_hisa->Reset();
07290                               //.... direct histogram filling to get its ymin (=> xminProj) and ymax (=> xmaxProj)
07291                               FillHisto(h_hisa, histo_for_plot, HistoCodi.Data(), ReadHisSiza);
07292                               //... Get direct histo ymin and/or ymax and keep them as xinf and xsup
07293                               //    in memo for the plotted histo 
07294                               XinfProj = fUserHistoMin;
07295                               XsupProj = fUserHistoMax;
07296                               if( fFlagUserHistoMin == "AUTO" ){XinfProj = h_hisa->GetMinimum();}
07297                               if( fFlagUserHistoMax == "AUTO" ){XsupProj = h_hisa->GetMaximum();}
07298                               XsupProj += (XsupProj-XinfProj)*fCnaParHistos->GetMarginAutoMinMax(); // to see the last bin
07299                               h_hisa->Delete();  h_hisa = 0;     fCdeleteRoot++;
07300                             } // end of  if( fFlagUserHistoMin == "AUTO" || fFlagUserHistoMax == "AUTO" )
07301                           else
07302                             {
07303                               if( fFlagUserHistoMin == "OFF" )
07304                                 {
07305                                   SetYminMemoFromValue(HistoCode.Data(),
07306                                                        fCnaParHistos->GetYminDefaultValue(HistoCode.Data()));
07307                                   XinfProj = GetYminValueFromMemo(HistoCode.Data());
07308                                 }
07309 
07310                               if( fFlagUserHistoMax == "OFF" )
07311                                 {
07312                                   SetYmaxMemoFromValue(HistoCode.Data(),
07313                                                        fCnaParHistos->GetYmaxDefaultValue(HistoCode.Data()));
07314                                   XsupProj = GetYmaxValueFromMemo(HistoCode.Data());      
07315                                 }
07316                               if( fFlagUserHistoMin == "ON" ){XinfProj = fUserHistoMin;}
07317                               if( fFlagUserHistoMax == "ON" ){XsupProj = fUserHistoMax;}
07318                             }
07319 
07320                           if( opt_plot == fOnlyOnePlot || opt_plot == fSeveralPlot )
07321                             {
07322                               SetXinfMemoFromValue(HistoCode.Data(), XinfProj);
07323                               SetXsupMemoFromValue(HistoCode.Data(), XsupProj);                   
07324                             }
07325                           else
07326                             {
07327                               SetXinfMemoFromValue(XinfProj);
07328                               SetXsupMemoFromValue(XsupProj);
07329                             }
07330                         } // end of if( (opt_plot == fOnlyOnePlot) || 
07331                           // (opt_plot == fSeveralPlot  && GetMemoFlag(HistoCode, opt_plot) == "Free") ||
07332                           // (opt_plot == fSameOnePlot  && GetMemoFlag(HistoCode, opt_plot) == "Free") )
07333                     } // end of  if( HistoType == "Proj" || HistoType == "SampProj" || HistoType == "H1BasicProj" )
07334 
07335                   //===============  H I S T O   B O O K I N G   A N D   F I L L I N G  ========  (ViewHisto)
07336                   //..............................  prepa histogram booking (ViewHisto)
07337                   
07338                   //.......... Set number of bins: forcing to fNbBinsProj if "HistoType" == "Proj"
07339                   Int_t xNbBins = GetHistoNumberOfBins(HistoCode.Data(), SizeForPlot);
07340                   
07341                   Double_t cXinf = (Double_t)0.;
07342                   Double_t cXsup = (Double_t)0.;
07343 
07344                   //.......... Set Xinf and Xsup at each time because of simultaneous SAME options
07345                   if( HistoType == "Proj" || HistoType == "SampProj" || HistoType == "H1BasicProj")
07346                     {
07347                       if( opt_plot == fOnlyOnePlot || opt_plot == fSeveralPlot )
07348                         {
07349                           cXinf = GetXinfValueFromMemo(HistoCode.Data());
07350                           cXsup = GetXsupValueFromMemo(HistoCode.Data());
07351                         }
07352                       else
07353                         {
07354                           cXinf = GetXinfValueFromMemo();
07355                           cXsup = GetXsupValueFromMemo();
07356                         }
07357                     }
07358                   else
07359                     {
07360                       cXinf = GetHistoXinf(HistoCode.Data(), SizeForPlot, opt_plot);
07361                       cXsup = GetHistoXsup(HistoCode.Data(), SizeForPlot, opt_plot);
07362                     }
07363 
07364                   //..............................  histogram booking (ViewHisto)
07365                   Axis_t xinf_his = cXinf;  // ancillary variables since no const in arguments of TH1D
07366                   Axis_t xsup_his = cXsup;
07367                   Int_t   nb_binx = xNbBins;
07368 
07369                   TString TitleHisto = ";";
07370                   if( opt_plot != fSameOnePlot )
07371                     {TitleHisto = fCnaParHistos->GetQuantityName(HistoCode.Data());}
07372                   TH1D* h_his0 = new TH1D("histo", TitleHisto.Data(), nb_binx, xinf_his, xsup_his); fCnewRoot++;
07373                   h_his0->Reset();
07374                   //............................... histogram filling
07375                   FillHisto(h_his0, histo_for_plot, HistoCode.Data(), SizeForPlot);
07376                   
07377                   //===============  H I S T O   Y M I N / Y M A X   M A N A G E M E N T  ===========  (ViewHisto)
07378                   if( opt_plot == fOnlyOnePlot ||
07379                       (opt_plot == fSeveralPlot && GetMemoFlag(HistoCode, opt_plot) == "Free") || 
07380                       (opt_plot == fSameOnePlot && GetMemoFlag(HistoCode, opt_plot) == "Free") )
07381                     {
07382                       if( opt_plot == fSameOnePlot ){fHistoCodeFirst = HistoCode;} // registration of first HistoCode
07383                       //................................. Automatic min and/or max for other options than "Proj" 
07384                       if( HistoType != "Proj" && HistoType != "SampProj" && HistoType != "H1BasicProj" )
07385                         {
07386                           if( fUserHistoMin >= fUserHistoMax ){fFlagUserHistoMin = "AUTO"; fFlagUserHistoMax = "AUTO";}
07387                           //................................. user's min and/or max
07388                           if( fFlagUserHistoMin == "ON" )
07389                             {SetYminMemoFromValue(HistoCode.Data(), fUserHistoMin); fFlagUserHistoMin = "OFF";}
07390                           if( fFlagUserHistoMax == "ON" )
07391                             {SetYmaxMemoFromValue(HistoCode.Data(), fUserHistoMax); fFlagUserHistoMax = "OFF";}
07392                           //................................. automatic min and/or max
07393                           if( fFlagUserHistoMin == "AUTO" )
07394                             {
07395                               //.............. no bottom margin if ymin = 0
07396                               Double_t ymin = GetYminFromHistoFrameAndMarginValue(h_his0, (Double_t)0.);
07397                               if( ymin != (Double_t)0. )
07398                                 {ymin =
07399                                    GetYminFromHistoFrameAndMarginValue(h_his0, fCnaParHistos->GetMarginAutoMinMax());}
07400                               SetYminMemoFromValue(HistoCode.Data(),ymin);
07401                               fFlagUserHistoMin = "OFF";
07402                             }
07403                           if( fFlagUserHistoMax == "AUTO" )
07404                             {
07405                               Double_t ymax =
07406                                 GetYmaxFromHistoFrameAndMarginValue(h_his0,fCnaParHistos->GetMarginAutoMinMax());
07407                               SetYmaxMemoFromValue(HistoCode.Data(),ymax);
07408                               fFlagUserHistoMax = "OFF";
07409                             }
07410                           //................................. Set YMin and YMax of histo (ViewHisto)
07411                           SetYminMemoFromPreviousMemo(HistoCode);
07412                           SetYmaxMemoFromPreviousMemo(HistoCode);
07413                         } // end of if( HistoType != "Proj" && HistoType != "SampProj" && HistoType != "H1BasicProj" )
07414 
07415                       //.......... Find maximum in case of Proj (LIN scale only) // PS: EvolProj => in ViewHistime
07416                       if( ( HistoType == "Proj" || HistoType == "SampProj" ||
07417                             HistoType == "H1BasicProj" ) && fFlagScaleY == "LIN" )
07418                         {
07419                           SetYmaxMemoFromValue
07420                             (HistoCode.Data(),
07421                              GetYmaxFromHistoFrameAndMarginValue(h_his0, fCnaParHistos->GetMarginAutoMinMax()));
07422                         }
07423                     } // end of  if( opt_plot == fOnlyOnePlot ||
07424                   // (opt_plot == fSeveralPlot && GetMemoFlag(HistoCode, opt_plot) == "Free") || 
07425                   // (opt_plot == fSameOnePlot && GetMemoFlag(HistoCode, opt_plot) == "Free") )
07426                   
07427                   //--- Set ymin and ymax to the first HistoCode values for option SAME n
07428                   if( opt_plot == fSameOnePlot && GetMemoFlag(HistoCode, opt_plot) == "Busy" )            
07429                     {
07430                       Double_t ymin = GetYminValueFromMemo(fHistoCodeFirst.Data());
07431                       SetYminMemoFromValue(HistoCode.Data(), ymin);
07432 
07433                       Double_t ymax = GetYmaxValueFromMemo(fHistoCodeFirst.Data());
07434                       SetYmaxMemoFromValue(HistoCode.Data(), ymax);
07435                     }
07436 
07437                   //... histogram set ymin and ymax and consequently margin at top of the plot
07438                   Int_t  xFlagAutoYsupMargin = SetHistoFrameYminYmaxFromMemo(h_his0, HistoCode);
07439 
07440                   //==================================== P L O T ==============================  (ViewHisto)
07441                   HistoPlot(h_his0,           SizeForPlot,   xinf_his, xsup_his,
07442                             HistoCode.Data(), HistoType.Data(),
07443                             StexStin_A,       i0StinEcha,    i0Sample,
07444                             opt_scale_x,      opt_scale_y,   opt_plot, arg_AlreadyRead,
07445                             xFlagAutoYsupMargin);
07446                   h_his0->Delete();   h_his0 = 0;             fCdeleteRoot++;
07447                   //===========================================================================
07448 
07449                   //--- Recover ymin and ymax from user's values in option SAME n
07450                   if( (opt_plot == fSameOnePlot && GetMemoFlag(HistoCode, opt_plot) == "Busy") )                  
07451                     {
07452                       SetYminMemoFromValue(HistoCode.Data(), fUserHistoMin);
07453                       SetYmaxMemoFromValue(HistoCode.Data(), fUserHistoMax);
07454                     }
07455                 } // end of if( OKPlot > 0 )
07456               else
07457                 {
07458                   cout << "!TEcnaHistos::ViewHisto(...)> Histo not available."
07459                        << fTTBELL << endl;
07460                 }
07461             }
07462         }
07463     } // end of  if( OKHisto == 1 )
07464 
07465 }  // end of ViewHisto(...)
07466 
07467 //------------------------------------------------------------------------------------
07468 Int_t TEcnaHistos::GetDSOffset(const Int_t& DeeNumber, const Int_t& DataSector)
07469 {
07470   // gives the DataSector Offset on 1D histos for option "Global"
07471 
07472   Int_t DSOffset = 0;
07473 
07474   if( DeeNumber == 4 )
07475     {
07476       if( DataSector >= 1 ){}
07477       if( DataSector >= 2 ){DSOffset += fEcalNumbering->GetMaxSCInDS(1)*fEcal->MaxCrysInSC();}
07478       if( DataSector >= 3 ){DSOffset += fEcalNumbering->GetMaxSCInDS(2)*fEcal->MaxCrysInSC();}
07479       if( DataSector >= 4 ){DSOffset += fEcalNumbering->GetMaxSCInDS(3)*fEcal->MaxCrysInSC();}
07480       if( DataSector >= 5 ){DSOffset += fEcalNumbering->GetMaxSCInDS(4)*fEcal->MaxCrysInSC();}
07481     }
07482   if( DeeNumber == 3 )
07483     {
07484       if( DataSector >= 5 ){}
07485       if( DataSector >= 6 ){DSOffset += (fEcalNumbering->GetMaxSCInDS(5)/2)*fEcal->MaxCrysInSC();}
07486       if( DataSector >= 7 ){DSOffset += fEcalNumbering->GetMaxSCInDS(6)*fEcal->MaxCrysInSC();}
07487       if( DataSector >= 8 ){DSOffset += fEcalNumbering->GetMaxSCInDS(7)*fEcal->MaxCrysInSC();}
07488       if( DataSector >= 9 ){DSOffset += fEcalNumbering->GetMaxSCInDS(8)*fEcal->MaxCrysInSC();}
07489     }
07490   if( DeeNumber == 2 )
07491     {
07492       if( DataSector <= 9 ){}
07493       if( DataSector <= 8 ){DSOffset += fEcalNumbering->GetMaxSCInDS(9)*fEcal->MaxCrysInSC();}
07494       if( DataSector <= 7 ){DSOffset += fEcalNumbering->GetMaxSCInDS(8)*fEcal->MaxCrysInSC();}
07495       if( DataSector <= 6 ){DSOffset += fEcalNumbering->GetMaxSCInDS(7)*fEcal->MaxCrysInSC();}
07496       if( DataSector <= 5 ){DSOffset += fEcalNumbering->GetMaxSCInDS(6)*fEcal->MaxCrysInSC();}
07497     }
07498   if( DeeNumber == 1 )
07499     {
07500       if( DataSector <= 5 ){}
07501       if( DataSector <= 4 ){DSOffset += (fEcalNumbering->GetMaxSCInDS(5)/2)*fEcal->MaxCrysInSC();}
07502       if( DataSector <= 3 ){DSOffset += fEcalNumbering->GetMaxSCInDS(4)*fEcal->MaxCrysInSC();}
07503       if( DataSector <= 2 ){DSOffset += fEcalNumbering->GetMaxSCInDS(3)*fEcal->MaxCrysInSC();}
07504       if( DataSector <= 1 ){DSOffset += fEcalNumbering->GetMaxSCInDS(2)*fEcal->MaxCrysInSC();}
07505     }
07506   return DSOffset;                            
07507 }
07508 //------------------------------------------------------------------------------------
07509 Int_t TEcnaHistos::GetSCOffset(const Int_t& DeeNumber, const Int_t& DataSector, const Int_t& SC_in_DS)
07510 {
07511   // gives the SC (Super-Crystal) Offset on 1D histos for option "Global"
07512 
07513   Int_t SCOffset = 0;
07514 
07515   if( DeeNumber == 1 || DeeNumber == 3 )
07516     {
07517       if( DataSector == 5 ){SCOffset += ((SC_in_DS-17)-1)*fEcal->MaxCrysInSC();}
07518       if( DataSector != 5 ){SCOffset += (SC_in_DS-1)*fEcal->MaxCrysInSC();}
07519     }
07520 
07521   if( DeeNumber == 2 || DeeNumber == 4 ){SCOffset += (SC_in_DS-1)*fEcal->MaxCrysInSC();}
07522 
07523   return SCOffset;      
07524 }
07525 //------------------------------------------------------------------------------------
07526 Int_t TEcnaHistos::ModifiedSCEchaForNotConnectedSCs(const Int_t& n1DeeNumber,
07527                                                    const Int_t& nSCCons,     const Int_t& SC_in_DS,
07528                                                    const Int_t& n1DeeSCEcna, const Int_t& n1SCEcha)
07529 {
07530   //------------------------ Modification of n1SCEcha number for not connected SC's
07531 
07532   Int_t ModifiedSCEcha = -1;
07533   TString SCQuad = fEcalNumbering->GetSCQuadFrom1DeeSCEcna(n1DeeSCEcna);  // SCQuad = top  OR bottom
07534   TString DeeDir = fEcalNumbering->GetDeeDirViewedFromIP(n1DeeNumber);    // DeeDir = left OR right
07535 
07536   TString TypQuad = "?";
07537   if( SCQuad == "top"    && DeeDir == "right" ){TypQuad = "TR";}
07538   if( SCQuad == "top"    && DeeDir == "left"  ){TypQuad = "TL";}
07539   if( SCQuad == "bottom" && DeeDir == "left"  ){TypQuad = "BL";}
07540   if( SCQuad == "bottom" && DeeDir == "right" ){TypQuad = "BR";}
07541 
07542   //------------------------------------------------------------------------------------------- top
07543 
07544   //..... (D1,S1), (D3,S9) SC_in_DS = 30, n1DeeSCEcna =  60 -> 182a for construction top/right
07545   //..... (D1,S2), (D3,S8) SC_in_DS =  3, n1DeeSCEcna = 138 -> 178a for construction top/right
07546   if( (SC_in_DS == 30 && n1DeeSCEcna ==  60 && TypQuad == "TR") ||
07547       (SC_in_DS ==  3 && n1DeeSCEcna == 138 && TypQuad == "TR") ){if(n1SCEcha > 15){ModifiedSCEcha = n1SCEcha - 15;}}
07548 
07549   //..... (D4,S1), (D2,S9) SC_in_DS = 30, n1DeeSCEcna =  60 ->  33a for construction top/left
07550   //..... (D4,S2), (D2,S8) SC_in_DS =  3, n1DeeSCEcna = 138 ->  29a for construction top/left
07551   if( (SC_in_DS == 30 && n1DeeSCEcna ==  60 && TypQuad == "TL") ||
07552       (SC_in_DS ==  3 && n1DeeSCEcna == 138 && TypQuad == "TL") )
07553     {
07554       if(n1SCEcha ==  4){ModifiedSCEcha =  1;}
07555       if(n1SCEcha ==  5){ModifiedSCEcha =  2;}
07556       if(n1SCEcha ==  9){ModifiedSCEcha =  3;}
07557       if(n1SCEcha == 10){ModifiedSCEcha =  4;}
07558       if(n1SCEcha == 14){ModifiedSCEcha =  5;}
07559       if(n1SCEcha == 15){ModifiedSCEcha =  6;}
07560       if(n1SCEcha == 19){ModifiedSCEcha =  7;}
07561       if(n1SCEcha == 20){ModifiedSCEcha =  8;}
07562       if(n1SCEcha == 24){ModifiedSCEcha =  9;}
07563       if(n1SCEcha == 25){ModifiedSCEcha = 10;}
07564     }
07565 
07566   //..... (D1,S1), (D3,S9) SC_in_DS = 30, n1DeeSCEcna = 119 -> 182b for construction top/right
07567   if( SC_in_DS == 30 && n1DeeSCEcna == 119 && TypQuad == "TR" ){if(n1SCEcha > 5){ModifiedSCEcha = n1SCEcha - 5;}}
07568 
07569   //..... (D4,S1), (D2,S9) SC_in_DS = 30, n1DeeSCEcna = 119 ->  33b for construction top/left
07570   if( SC_in_DS == 30 && n1DeeSCEcna == 119 && TypQuad == "TL" )
07571     {
07572       if(n1SCEcha ==  4){ModifiedSCEcha = 11;}
07573       if(n1SCEcha ==  5){ModifiedSCEcha = 12;}
07574       if(n1SCEcha ==  9){ModifiedSCEcha = 13;}
07575       if(n1SCEcha == 10){ModifiedSCEcha = 14;}
07576       if(n1SCEcha == 14){ModifiedSCEcha = 15;}
07577       if(n1SCEcha == 15){ModifiedSCEcha = 16;}
07578       if(n1SCEcha == 19){ModifiedSCEcha = 17;}
07579       if(n1SCEcha == 20){ModifiedSCEcha = 18;}
07580       if(n1SCEcha == 24){ModifiedSCEcha = 19;}
07581       if(n1SCEcha == 25){ModifiedSCEcha = 20;}
07582     }
07583 
07584   //..... (D1,S1), (D3,S9) SC_in_DS = 12, n1DeeSCEcna =  13 -> 161  for construction top/right
07585   //..... (D4,S1), (D2,S9) SC_in_DS = 12, n1DeeSCEcna =  13 ->  12  for construction top/left
07586   if( SC_in_DS == 12 && n1DeeSCEcna ==  13 && TypQuad == "TR" )
07587     {
07588       ModifiedSCEcha = n1SCEcha;
07589     } 
07590   if( SC_in_DS == 12 && n1DeeSCEcna ==  13 && TypQuad == "TL" )
07591     {
07592       if( n1SCEcha >=  1 &&  n1SCEcha <=  4 ){ModifiedSCEcha = n1SCEcha;}
07593       if( n1SCEcha >=  6 &&  n1SCEcha <=  9 ){ModifiedSCEcha = n1SCEcha-1;}
07594       if( n1SCEcha >= 11 &&  n1SCEcha <= 14 ){ModifiedSCEcha = n1SCEcha-2;}
07595       if( n1SCEcha >= 16 &&  n1SCEcha <= 19 ){ModifiedSCEcha = n1SCEcha-3;}
07596       if( n1SCEcha >= 21 &&  n1SCEcha <= 24 ){ModifiedSCEcha = n1SCEcha-4;}
07597     }
07598 
07599   //..... (D1,S2), (D3,S8) SC_in_DS = 25, n1DeeSCEcna = 176 -> 207a for construction top/right
07600   if( SC_in_DS == 25 && n1DeeSCEcna == 176 && TypQuad == "TR" )
07601     {
07602       if(n1SCEcha ==  4){ModifiedSCEcha =  1;}
07603       if(n1SCEcha ==  5){ModifiedSCEcha =  2;}
07604       if(n1SCEcha ==  9){ModifiedSCEcha =  3;}
07605       if(n1SCEcha == 10){ModifiedSCEcha =  4;}
07606       if(n1SCEcha == 14){ModifiedSCEcha =  5;}
07607       if(n1SCEcha == 15){ModifiedSCEcha =  6;}
07608       if(n1SCEcha == 19){ModifiedSCEcha =  7;}
07609       if(n1SCEcha == 20){ModifiedSCEcha =  8;}
07610       if(n1SCEcha == 24){ModifiedSCEcha =  9;}
07611       if(n1SCEcha == 25){ModifiedSCEcha = 10;}
07612     }
07613 
07614   //..... (D4,S2), (D2,S8) SC_in_DS = 25, n1DeeSCEcna = 176 ->  58a for construction top/left
07615   if( SC_in_DS == 25 && n1DeeSCEcna == 176 && TypQuad == "TL" )
07616     {
07617       if(n1SCEcha == 16){ModifiedSCEcha =  1;}
07618       if(n1SCEcha == 21){ModifiedSCEcha =  2;}
07619       if(n1SCEcha == 17){ModifiedSCEcha =  3;}
07620       if(n1SCEcha == 22){ModifiedSCEcha =  4;}
07621       if(n1SCEcha == 18){ModifiedSCEcha =  5;}
07622       if(n1SCEcha == 23){ModifiedSCEcha =  6;}
07623       if(n1SCEcha == 19){ModifiedSCEcha =  7;}
07624       if(n1SCEcha == 24){ModifiedSCEcha =  8;}
07625       if(n1SCEcha == 20){ModifiedSCEcha =  9;}
07626       if(n1SCEcha == 25){ModifiedSCEcha = 10;}
07627     }
07628 
07629   //..... (D1,S2), (D3,S8) SC_in_DS =  3, n1DeeSCEcna = 157 -> 178b for construction top/right
07630   //..... (D1,S2), (D3,S8) SC_in_DS = 25, n1DeeSCEcna = 193 -> 207b for construction top/right
07631   if( (SC_in_DS ==  3 && n1DeeSCEcna == 157 && TypQuad == "TR") ||
07632       (SC_in_DS == 25 && n1DeeSCEcna == 193 && TypQuad == "TR") )
07633     {
07634       if(n1SCEcha ==  4){ModifiedSCEcha = 11;}
07635       if(n1SCEcha ==  5){ModifiedSCEcha = 12;}
07636       if(n1SCEcha ==  9){ModifiedSCEcha = 13;}
07637       if(n1SCEcha == 10){ModifiedSCEcha = 14;}
07638       if(n1SCEcha == 14){ModifiedSCEcha = 15;}
07639       if(n1SCEcha == 15){ModifiedSCEcha = 16;}
07640       if(n1SCEcha == 19){ModifiedSCEcha = 17;}
07641       if(n1SCEcha == 20){ModifiedSCEcha = 18;}
07642       if(n1SCEcha == 24){ModifiedSCEcha = 19;}
07643       if(n1SCEcha == 25){ModifiedSCEcha = 20;}
07644     }
07645 
07646   //..... (D4,S2), (D2,S8) SC_in_DS =  3, n1DeeSCEcna = 157 ->  29b for construction top/left
07647   //..... (D4,S2), (D2,S8) SC_in_DS = 25, n1DeeSCEcna = 193 ->  58b for construction top/left
07648   if( (SC_in_DS ==  3 && n1DeeSCEcna == 157 && TypQuad == "TL") ||
07649       (SC_in_DS == 25 && n1DeeSCEcna == 193 && TypQuad == "TL") )
07650     {
07651       if(n1SCEcha == 16){ModifiedSCEcha = 11;}
07652       if(n1SCEcha == 21){ModifiedSCEcha = 12;}
07653       if(n1SCEcha == 17){ModifiedSCEcha = 13;}
07654       if(n1SCEcha == 22){ModifiedSCEcha = 14;}
07655       if(n1SCEcha == 18){ModifiedSCEcha = 15;}
07656       if(n1SCEcha == 23){ModifiedSCEcha = 16;}
07657       if(n1SCEcha == 19){ModifiedSCEcha = 17;}
07658       if(n1SCEcha == 24){ModifiedSCEcha = 18;}
07659       if(n1SCEcha == 20){ModifiedSCEcha = 19;}
07660       if(n1SCEcha == 25){ModifiedSCEcha = 20;}
07661     }
07662 
07663   //..... (D1,S2), (D3,S8) SC_in_DS = 32, n1DeeSCEcna =  51 -> 216  for construction top/right
07664   if( SC_in_DS == 32 && n1DeeSCEcna ==  51 && TypQuad == "TR" )
07665     {
07666       if( n1SCEcha >=  1 && n1SCEcha <=  4 ){ModifiedSCEcha = n1SCEcha;}
07667       if( n1SCEcha >=  6 && n1SCEcha <=  9 ){ModifiedSCEcha = n1SCEcha-1;}
07668       if( n1SCEcha >= 11 && n1SCEcha <= 14 ){ModifiedSCEcha = n1SCEcha-2;}
07669       if( n1SCEcha >= 16 && n1SCEcha <= 19 ){ModifiedSCEcha = n1SCEcha-3;}
07670       if( n1SCEcha >= 21 && n1SCEcha <= 24 ){ModifiedSCEcha = n1SCEcha-4;}
07671     }
07672 
07673   //..... (D4,S2), (D2,S8) SC_in_DS = 32, n1DeeSCEcna =  51 ->  67  for construction top/left
07674   if( SC_in_DS == 32 && n1DeeSCEcna ==  51 && TypQuad == "TL" )
07675     {
07676       ModifiedSCEcha = n1SCEcha;
07677     }
07678 
07679   // **************************** Special case: TWO SC's IN THE SAME SC-Ecna place *************************
07680   //========================================================================================== D1,D3 ======
07681   //      (D1,S2), (D3,S8) SC_in_DS =  3, n1DeeSCEcna =  32 -> 178c for construction top/right
07682   //      (D1,S2), (D3,S8) SC_in_DS = 25, n1DeeSCEcna =  32 -> 207c for construction top/right
07683   //       For  n1DeeSCEcna =  32: ONLY "25" IN ARRAY fT2d_DSSC[][] (see TEcnaNumbering.cc)
07684   //       fT2d_DSSC[dee-1][32-1] =  25;  // also 3;  // ( (207c, 58c) also (178c, 29c) for construction)
07685   //       is recovered from number for construction
07686   //=======================================================================================================
07687   if( n1DeeSCEcna ==  32 && TypQuad == "TR" )
07688     {
07689       if( nSCCons == 207 )
07690         {
07691           if(n1SCEcha ==  1){ModifiedSCEcha = 21;}
07692           if(n1SCEcha ==  2){ModifiedSCEcha = 22;}
07693           if(n1SCEcha ==  3){ModifiedSCEcha = 23;}
07694           if(n1SCEcha ==  6){ModifiedSCEcha = 24;}
07695           if(n1SCEcha ==  7){ModifiedSCEcha = 25;}
07696         }
07697       if( nSCCons == 178 )
07698         {
07699           if(n1SCEcha == 11){ModifiedSCEcha = 21;}
07700         }
07701     }
07702 
07703   //========================================================================================== D2,D4 ======
07704   //      (D4,S2), (D2,S8) SC_in_DS =  3, n1DeeSCEcna =  32 ->  29c for construction top/left
07705   //      (D4,S2), (D2,S8) SC_in_DS = 25, n1DeeSCEcna =  32 ->  58c for construction top/left
07706   //       For  n1DeeSCEcna =  32: ONLY "25" IN ARRAY fT2d_DSSC[][] (see TEcnaNumbering.cc)
07707   //       fT2d_DSSC[dee-1][32-1] =  25;  // also 3;  // ( (207c, 58c) also (178c, 29c) for construction)
07708   //       is recovered from number for construction
07709   //=======================================================================================================
07710   if( n1DeeSCEcna ==  32 && TypQuad == "TL" )
07711     {
07712       if( nSCCons == 58 )
07713         {
07714           if(n1SCEcha ==  1){ModifiedSCEcha = 21;}
07715           if(n1SCEcha ==  2){ModifiedSCEcha = 22;}
07716           if(n1SCEcha ==  3){ModifiedSCEcha = 23;}
07717           if(n1SCEcha ==  6){ModifiedSCEcha = 24;}
07718           if(n1SCEcha ==  7){ModifiedSCEcha = 25;}
07719         }
07720       if( nSCCons == 29 )
07721         {
07722           if(n1SCEcha == 11){ModifiedSCEcha = 21;}
07723         }
07724     }
07725   //****************************************************************************************************
07726 
07727   //------------------------------------------------------------------------------------------- bottom
07728 
07729   // **************************** Special case: TWO SC's IN THE SAME SC-Ecna place *************************
07730   //========================================================================================== D1,D3 ======
07731   //      (D1,S4), (D3,S6) SC_in_DS = 14, n1DeeSCEcna =  29 -> 261a for construction bottom/right
07732   //      (D1,S4), (D3,S6) SC_in_DS = 21, n1DeeSCEcna =  29 -> 268a for construction bottom/right
07733   //       For  n1DeeSCEcna =  29: ONLY "14" IN ARRAY fT2d_DSSC[][] (see TEcnaNumbering.cc)
07734   //       fT2d_DSSC[dee-1][29-1] = 14; // also 21;  //  ( (261a, 112a) also (268a, 119a) for construction)
07735   //       is recovered from number for construction
07736   //=======================================================================================================
07737   if( n1DeeSCEcna ==  29 && TypQuad == "BR" )
07738     {
07739       if( nSCCons == 261 )
07740         {
07741           if(n1SCEcha ==  1){ModifiedSCEcha = 21;}
07742           if(n1SCEcha ==  2){ModifiedSCEcha = 22;}
07743           if(n1SCEcha ==  3){ModifiedSCEcha = 23;}
07744           if(n1SCEcha ==  6){ModifiedSCEcha = 24;}
07745           if(n1SCEcha ==  7){ModifiedSCEcha = 25;}
07746         }
07747       if( nSCCons == 268 )
07748         {
07749           if(n1SCEcha == 11){ModifiedSCEcha = 21;}
07750         }
07751     }
07752 
07753   //========================================================================================== D2,D4 ======
07754   //      (D4,S4), (D2,S6) SC_in_DS = 14, n1DeeSCEcna =  29 -> 112a for construction bottom/left
07755   //      (D4,S4), (D2,S6) SC_in_DS = 21, n1DeeSCEcna =  29 -> 119a for construction bottom/left
07756   //       For  n1DeeSCEcna =  29: ONLY "14" IN ARRAY fT2d_DSSC[][] (see TEcnaNumbering.cc)
07757   //       fT2d_DSSC[dee-1][29-1] = 14; // also 21;  //  ( (261a, 112a) also (268a, 119a) for construction)
07758   //       is recovered from number for construction
07759   //======================================================================================================= 
07760   if( n1DeeSCEcna ==  29 && TypQuad == "BL" )
07761     {
07762       if( nSCCons == 119 )
07763         {
07764           if(n1SCEcha == 11){ModifiedSCEcha = 21;}
07765         }
07766       if( nSCCons == 112 )
07767         {
07768           if(n1SCEcha ==  1){ModifiedSCEcha = 21;}
07769           if(n1SCEcha ==  2){ModifiedSCEcha = 22;}
07770           if(n1SCEcha ==  3){ModifiedSCEcha = 23;}
07771           if(n1SCEcha ==  6){ModifiedSCEcha = 24;}
07772           if(n1SCEcha ==  7){ModifiedSCEcha = 25;}
07773         }
07774     }
07775 
07776   // ****************************************************************************************************
07777 
07778   //..... (D1,S3), (D3,S7) SC_in_DS = 34, n1DeeSCEcna = 188 -> 298a for construction bottom/right
07779   //..... (D1,S4), (D3,S6) SC_in_DS = 14, n1DeeSCEcna = 165 -> 261b for construction bottom/right
07780   if( (SC_in_DS == 34 && n1DeeSCEcna == 188 && TypQuad == "BR") || 
07781       (SC_in_DS == 14 && n1DeeSCEcna == 165 && TypQuad == "BR") ){if(n1SCEcha > 15){ModifiedSCEcha = n1SCEcha - 15;}}
07782 
07783   //..... (D4,S3), (D2,S7) SC_in_DS = 34, n1DeeSCEcna = 188 -> 149a for construction bottom/left
07784   //..... (D4,S4), (D2,S6) SC_in_DS = 14, n1DeeSCEcna = 165 -> 112b for construction bottom/left
07785   if( (SC_in_DS == 34 && n1DeeSCEcna == 188 && TypQuad == "BL") ||
07786       (SC_in_DS == 14 && n1DeeSCEcna == 165 && TypQuad == "BL") )
07787     {
07788       if(n1SCEcha ==  4){ModifiedSCEcha =  1;}
07789       if(n1SCEcha ==  5){ModifiedSCEcha =  2;}
07790       if(n1SCEcha ==  9){ModifiedSCEcha =  3;}
07791       if(n1SCEcha == 10){ModifiedSCEcha =  4;}
07792       if(n1SCEcha == 14){ModifiedSCEcha =  5;}
07793       if(n1SCEcha == 15){ModifiedSCEcha =  6;}
07794       if(n1SCEcha == 19){ModifiedSCEcha =  7;}
07795       if(n1SCEcha == 20){ModifiedSCEcha =  8;}
07796       if(n1SCEcha == 24){ModifiedSCEcha =  9;}
07797       if(n1SCEcha == 25){ModifiedSCEcha = 10;}
07798     }
07799 
07800   //..... (D1,S3), (D3,S7) SC_in_DS = 10, n1DeeSCEcna =  50 -> 224  for construction bottom/right
07801   if( SC_in_DS == 10 && n1DeeSCEcna ==  50 && TypQuad == "BR" )
07802     {
07803       ModifiedSCEcha = n1SCEcha;
07804     }
07805 
07806   //..... (D4,S3), (D2,S7) SC_in_DS = 10, n1DeeSCEcna =  50 ->  75  for construction bottom/left 
07807   if( SC_in_DS == 10 && n1DeeSCEcna ==  50 && TypQuad == "BL")
07808     {
07809       if( n1SCEcha >=  1 &&  n1SCEcha <=  4 ){ModifiedSCEcha = n1SCEcha;}
07810       if( n1SCEcha >=  6 &&  n1SCEcha <=  9 ){ModifiedSCEcha = n1SCEcha-1;}
07811       if( n1SCEcha >= 11 &&  n1SCEcha <= 14 ){ModifiedSCEcha = n1SCEcha-2;}
07812       if( n1SCEcha >= 16 &&  n1SCEcha <= 19 ){ModifiedSCEcha = n1SCEcha-3;}
07813       if( n1SCEcha >= 21 &&  n1SCEcha <= 24 ){ModifiedSCEcha = n1SCEcha-4;}
07814     }
07815   
07816   //..... (D1,S4), (D3,S6) SC_in_DS = 14, n1DeeSCEcna = 144 -> 261c for construction bottom/right
07817   if( SC_in_DS == 14 && n1DeeSCEcna == 144 && TypQuad == "BR" ){if(n1SCEcha > 5){ModifiedSCEcha = n1SCEcha - 5;}}
07818 
07819   //..... (D4,S4), (D2,S6) SC_in_DS = 14, n1DeeSCEcna = 144 -> 112c for construction bottom/left
07820   if( SC_in_DS == 14 && n1DeeSCEcna == 144 && TypQuad == "BL" )
07821     {
07822       if(n1SCEcha ==  4){ModifiedSCEcha = 11;}
07823       if(n1SCEcha ==  5){ModifiedSCEcha = 12;}
07824       if(n1SCEcha ==  9){ModifiedSCEcha = 13;}
07825       if(n1SCEcha == 10){ModifiedSCEcha = 14;}
07826       if(n1SCEcha == 14){ModifiedSCEcha = 15;}
07827       if(n1SCEcha == 15){ModifiedSCEcha = 16;}
07828       if(n1SCEcha == 19){ModifiedSCEcha = 17;}
07829       if(n1SCEcha == 20){ModifiedSCEcha = 18;}
07830       if(n1SCEcha == 24){ModifiedSCEcha = 19;}
07831       if(n1SCEcha == 25){ModifiedSCEcha = 20;}
07832     }
07833 
07834   //..... (D1,S4), (D3,S6) SC_in_DS = 21, n1DeeSCEcna = 123 -> 268b for construction bottom/right
07835   //..... (D1,S5), (D3,S5) SC_in_DS = 20, n1DeeSCEcna =  21 -> 281a for construction bottom/right
07836   if( (SC_in_DS == 21 && n1DeeSCEcna == 123 && TypQuad == "BR") ||
07837       (SC_in_DS == 20 && n1DeeSCEcna ==  41 && TypQuad == "BR") )
07838     {
07839       if(n1SCEcha ==  4){ModifiedSCEcha =  1;}
07840       if(n1SCEcha ==  5){ModifiedSCEcha =  2;}
07841       if(n1SCEcha ==  9){ModifiedSCEcha =  3;}
07842       if(n1SCEcha == 10){ModifiedSCEcha =  4;}
07843       if(n1SCEcha == 14){ModifiedSCEcha =  5;}
07844       if(n1SCEcha == 15){ModifiedSCEcha =  6;}
07845       if(n1SCEcha == 19){ModifiedSCEcha =  7;}
07846       if(n1SCEcha == 20){ModifiedSCEcha =  8;}
07847       if(n1SCEcha == 24){ModifiedSCEcha =  9;}
07848       if(n1SCEcha == 25){ModifiedSCEcha = 10;}
07849     }
07850 
07851   //..... (D4,S4), (D2,S6) SC_in_DS = 21, n1DeeSCEcna = 123 -> 119b for construction bottom/left
07852   //..... (D4,S5), (D2,S5) SC_in_DS =  3, n1DeeSCEcna =  41 -> 132a for construction bottom/left
07853   if( (SC_in_DS == 21 && n1DeeSCEcna == 123 && TypQuad == "BL") ||
07854       (SC_in_DS ==  3 && n1DeeSCEcna ==  41 && TypQuad == "BL") ){if(n1SCEcha > 15){ModifiedSCEcha = n1SCEcha - 15;}}
07855 
07856 
07857   //..... (D1,S4), (D3,S6) SC_in_DS = 21, n1DeeSCEcna = 102 -> 268c for construction bottom/right
07858   if( SC_in_DS == 21 && n1DeeSCEcna == 102 && TypQuad == "BR" )
07859     {
07860       if(n1SCEcha ==  4){ModifiedSCEcha = 11;}
07861       if(n1SCEcha ==  5){ModifiedSCEcha = 12;}
07862       if(n1SCEcha ==  9){ModifiedSCEcha = 13;}
07863       if(n1SCEcha == 10){ModifiedSCEcha = 14;}
07864       if(n1SCEcha == 14){ModifiedSCEcha = 15;}
07865       if(n1SCEcha == 15){ModifiedSCEcha = 16;}
07866       if(n1SCEcha == 19){ModifiedSCEcha = 17;}
07867       if(n1SCEcha == 20){ModifiedSCEcha = 18;}
07868       if(n1SCEcha == 24){ModifiedSCEcha = 19;}
07869       if(n1SCEcha == 25){ModifiedSCEcha = 20;}
07870     }
07871 
07872   //..... (D4,S4), (D2,S6) SC_in_DS = 21, n1DeeSCEcna = 102 -> 119c for construction bottom/left
07873   if( SC_in_DS == 21 && n1DeeSCEcna == 102 && TypQuad == "BL" )
07874     {
07875       if(n1SCEcha == 16){ModifiedSCEcha = 11;}
07876       if(n1SCEcha == 21){ModifiedSCEcha = 12;}
07877       if(n1SCEcha == 17){ModifiedSCEcha = 13;}
07878       if(n1SCEcha == 22){ModifiedSCEcha = 14;}
07879       if(n1SCEcha == 18){ModifiedSCEcha = 15;}
07880       if(n1SCEcha == 23){ModifiedSCEcha = 16;}
07881       if(n1SCEcha == 19){ModifiedSCEcha = 17;}
07882       if(n1SCEcha == 24){ModifiedSCEcha = 18;}
07883       if(n1SCEcha == 20){ModifiedSCEcha = 19;}
07884       if(n1SCEcha == 25){ModifiedSCEcha = 20;}
07885     }
07886 
07887   //..... (D1,S5), (D3,S5) SC_in_DS = 23, n1DeeSCEcna =   8 -> 286 for construction bottom/right
07888   if( SC_in_DS == 23 && n1DeeSCEcna ==   8 && TypQuad == "BR" )
07889     {
07890       if( n1SCEcha >=  1 &&  n1SCEcha <=  4 ){ModifiedSCEcha = n1SCEcha;}
07891       if( n1SCEcha >=  6 &&  n1SCEcha <=  9 ){ModifiedSCEcha = n1SCEcha-1;}
07892       if( n1SCEcha >= 11 &&  n1SCEcha <= 14 ){ModifiedSCEcha = n1SCEcha-2;}
07893       if( n1SCEcha >= 16 &&  n1SCEcha <= 19 ){ModifiedSCEcha = n1SCEcha-3;}
07894       if( n1SCEcha >= 21 &&  n1SCEcha <= 24 ){ModifiedSCEcha = n1SCEcha-4;}
07895     }
07896 
07897   //..... (D4,S5), (D2,S5) SC_in_DS =  6, n1DeeSCEcna =   8 -> 137 for construction bottom/left
07898   if( SC_in_DS ==  6 && n1DeeSCEcna ==   8 && TypQuad == "BL" )
07899     {
07900       ModifiedSCEcha = n1SCEcha;
07901     }
07902      
07903      //======================= ERROR message if ModifiedSCEcha is not correct
07904   if( ModifiedSCEcha < 1 || ModifiedSCEcha > fEcal->MaxCrysInSC() )
07905     {
07906       cout << "! *** ERROR *** > ModifiedSCEcha = " << ModifiedSCEcha
07907            << ", SC_in_DS = " << SC_in_DS
07908            << ", nSCCons = " << nSCCons
07909            << ", n1DeeSCEcna = " << n1DeeSCEcna
07910            << ", n1SCEcha = " << n1SCEcha
07911            << ", ModifiedSCEcha = " << ModifiedSCEcha
07912            << ", TypQuad = " << TypQuad
07913            << fTTBELL << endl;
07914     }
07915 
07916  
07917   return ModifiedSCEcha;
07918 }
07919 // end of ModifiedSCEchaForNotConnectedSCs(...)
07920 
07921 //======================================================================================
07922 //
07923 //                          ViewHistime: evolution in time
07924 //
07925 //======================================================================================
07926 
07927 //======================================================================================
07928 //
07929 //                          ViewHistime: time evolution
07930 //
07931 //======================================================================================
07932 void TEcnaHistos::ViewHistime(const TString list_of_run_file_name, 
07933                               const Int_t&  StexStin_A, const Int_t& i0StinEcha,
07934                               const TString HistoCode,  const TString opt_plot_arg)
07935 {
07936   //Histogram of the quantities as a function of time (several runs)
07937 
07938   TString opt_plot  = opt_plot_arg;
07939   TString HistoType = fCnaParHistos->GetHistoType(HistoCode);
07940 
07941   if( opt_plot_arg == "ONLYONE" ){opt_plot = fOnlyOnePlot;}
07942   if( opt_plot_arg == "SEVERAL" ){opt_plot = fSeveralPlot;}
07943   if( opt_plot_arg == "SAMEONE" ){opt_plot = fSameOnePlot;}
07944 
07945   Int_t OKHisto = 0;
07946 
07947   //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Canvas already closed in option SAME %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
07948   Int_t xCanvasExists = 1; // a priori ==> SAME plot                                  //   (ViewHistime)
07949   if( opt_plot != fOnlyOnePlot && GetMemoFlag(HistoCode, opt_plot) == "Busy" )
07950     {
07951       TVirtualPad* main_subpad = 0; 
07952       //---------------- Call to ActivePad
07953       main_subpad = ActivePad(HistoCode.Data(), opt_plot.Data());  // => return 0 if canvas has been closed
07954       if( main_subpad == 0 )
07955         {
07956           cout << "*TEcnaHistos::ViewHistime(...)> WARNING ===> Canvas has been closed in option SAME or SAME n."
07957                << endl
07958                << "                               Please, restart with a new canvas."
07959                << fTTBELL << endl;
07960           
07961           ReInitCanvas(HistoCode, opt_plot);
07962           xCanvasExists = 0;
07963         }
07964     }
07965   //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
07966 
07967   //%%%%%%%%%%%%%%%%%%%%% Change of X variable in option SAME n with no proj %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
07968   Int_t SameXVarMemo = 1;   //  a priori ==> SAME n option: X variable OK                     (ViewHistime)
07969   if( !( HistoType == "Proj" || HistoType == "SampProj" || HistoType == "H1BasicProj" || HistoType == "EvolProj" ) )
07970     {
07971       TString XVarHisto = fCnaParHistos->GetXVarHisto(HistoCode.Data(), fFlagSubDet.Data(), fFapStexNumber);
07972       TString YVarHisto = fCnaParHistos->GetYVarHisto(HistoCode.Data(), fFlagSubDet.Data(), fFapStexNumber);
07973 
07974       if( (opt_plot == fSameOnePlot ) && GetMemoFlag(HistoCode, opt_plot) == "Free" )
07975         {
07976           SetXVarMemo(HistoCode, opt_plot, XVarHisto);  SetYVarMemo(HistoCode, opt_plot, YVarHisto); SameXVarMemo = 1;
07977         }
07978       if( (opt_plot == fSameOnePlot ) && GetMemoFlag(HistoCode, opt_plot) == "Busy" )
07979         {
07980           TString XVariableMemo = GetXVarFromMemo(HistoCode, opt_plot);
07981           TString YVariableMemo = GetYVarFromMemo(HistoCode, opt_plot);
07982           
07983           if( XVarHisto != XVariableMemo )
07984             {
07985               cout << "!TEcnaHistos::ViewHistime(...)> *** ERROR *** ===> X coordinate changed in option SAME n." << endl
07986                    << "                               Present  X = " << XVarHisto << endl
07987                    << "                               Present  Y = " << YVarHisto << endl
07988                    << "                               Previous X = " << XVariableMemo << endl
07989                    << "                               Previous Y = " << YVariableMemo 
07990                    << fTTBELL << endl;
07991               SameXVarMemo = 0;
07992             }
07993           else
07994             {SetYVarMemo(HistoCode, opt_plot, YVarHisto);}
07995         }
07996     }
07997   //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
07998 
07999   //%%%%%%%%%%%%%%%%%%%%%%% Change of Y variable in option SAME n with proj %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
08000   Int_t SameYVarMemo = 1;   //  a priori ==> SAME n option: Y variable OK                     (ViewHistime)
08001   if(  HistoType == "Proj" || HistoType == "SampProj" || HistoType == "H1BasicProj" || HistoType == "EvolProj" )
08002     {
08003       TString XVarHisto = fCnaParHistos->GetXVarHisto(HistoCode.Data(), fFlagSubDet.Data(), fFapStexNumber);
08004       TString YVarHisto = fCnaParHistos->GetYVarHisto(HistoCode.Data(), fFlagSubDet.Data(), fFapStexNumber);
08005 
08006       if( (opt_plot == fSameOnePlot ) && GetMemoFlag(HistoCode, opt_plot) == "Free" )
08007         {
08008           SetYVarMemo(HistoCode, opt_plot, YVarHisto);  SetYVarMemo(HistoCode, opt_plot, YVarHisto); SameYVarMemo = 1;
08009         }
08010       if( (opt_plot == fSameOnePlot ) && GetMemoFlag(HistoCode, opt_plot) == "Busy" )
08011         {
08012           TString XVariableMemo = GetXVarFromMemo(HistoCode, opt_plot);
08013           TString YVariableMemo = GetYVarFromMemo(HistoCode, opt_plot);
08014           
08015           if( YVarHisto != YVariableMemo )
08016             {
08017               cout << "!TEcnaHistos::ViewHistime(...)> *** ERROR *** ===> Y coordinate changed in option SAME n." << endl
08018                    << "                               Present  X = " << XVarHisto << endl
08019                    << "                               Present  Y = " << YVarHisto << endl
08020                    << "                               Previous X = " << XVariableMemo << endl
08021                    << "                               Previous Y = " << YVariableMemo 
08022                    << fTTBELL << endl;
08023               SameYVarMemo = 0;
08024             }
08025           else
08026             {SetYVarMemo(HistoCode, opt_plot, YVarHisto);}
08027         }
08028     }
08029   //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
08030   if( xCanvasExists == 1 && SameXVarMemo == 1 && SameYVarMemo == 1 ){OKHisto = 1;}
08031 
08032   //======================== Histime accepted
08033   if( OKHisto == 1 )
08034     {
08035       // fMyRootFile->PrintNoComment();
08036 
08037       fCnaParHistos->SetColorPalette(fFlagColPal);
08038 
08039       //................................. Init YMin and YMax of histo         //   (ViewHistime)
08040       if((opt_plot == fOnlyOnePlot) ||
08041          (opt_plot == fSeveralPlot && GetMemoFlag(HistoCode, opt_plot) == "Free") ||
08042          (opt_plot == fSameOnePlot && GetMemoFlag(HistoCode, opt_plot) == "Free"))
08043         {SetYminMemoFromPreviousMemo(HistoCode); SetYmaxMemoFromPreviousMemo(HistoCode);}
08044 
08045       //........ GetHistoryRunListParameters(...) : performs the allocation of the array fT1DRunNumber[]
08046       //         at first call of the present method ViewHistime
08047       //         increments the number of read file (fNbOfListFileEvolXXX) for option SAME
08048       //         and read the values fT1DRunNumber[0 to max] from the file list_of_run_file_name
08049       //         return the number of runs in the list of the file
08050       //............... Get the run parameters
08051 
08052       Int_t nb_of_runs_in_list = GetHistoryRunListParameters(list_of_run_file_name.Data(), HistoCode);
08053 
08054       if( nb_of_runs_in_list > 0 )
08055         {
08056           //..............................  prepa x axis: time in hours
08057           //Double_t sec_in_day   = (Double_t)86400.;          //===> (number of seconds in a day)
08058           Double_t margin_frame_xaxis = (Double_t)25.;       //===> margin in x coordinates 
08059 
08060           Double_t thstart_evol = (Double_t)0.;
08061           Double_t thstop_evol  = (Double_t)0.;
08062 
08063           Int_t* exist_indic  = new Int_t[nb_of_runs_in_list];    fCnew++;
08064 
08065           //===================================== FIRST LOOP BEGINNING ===================================
08066           //-------------------------------------------------------------------------------- (ViewHistime)
08067           //
08068           //     FIRST LOOP: read the "HistoryRunList" file. Check the existence of the runs
08069           //                 and determine the number of existing runs.
08070           //
08071           //--------------------------------------------------------------------------------
08072 
08073           fNbOfExistingRuns = (Int_t)0;
08074 
08075           if( fFapStexNumber > 0 )
08076             {
08077               for(Int_t i_run = 0; i_run < nb_of_runs_in_list; i_run++)
08078                 {
08079                   exist_indic[i_run] = 0;
08080                   // ==> set the attribute value relative to the run (fFapRunNumber)
08081                   SetRunNumberFromList(i_run, nb_of_runs_in_list);
08082 
08083                   fMyRootFile->PrintNoComment();
08084                   fMyRootFile->FileParameters(fFapAnaType.Data(),   fFapNbOfSamples,
08085                                               fT1DRunNumber[i_run], fFapFirstReqEvtNumber,
08086                                               fFapLastReqEvtNumber, fFapReqNbOfEvts,
08087                                               fFapStexNumber,       fCfgResultsRootFilePath.Data());
08088                   
08089                   if ( fMyRootFile->LookAtRootFile() == kTRUE )             //   (ViewHistime, 1rst loop)
08090                     {
08091                       fStatusFileFound = kTRUE;
08092 
08093                       //------ At first HistoryRunList file: set fStartEvol... and fStopEvol... quantities
08094                       if( GetListFileNumber(HistoCode) == 1 )
08095                         {
08096                           if( fNbOfExistingRuns == 0 ) 
08097                             {  
08098                               // start time of the first existing run of the list
08099                               fStartEvolTime = fMyRootFile->GetStartTime();
08100                               fStartEvolDate = fMyRootFile->GetStartDate();
08101                               fStartEvolRun  = fT1DRunNumber[i_run];
08102                               // start time of the last existing run of the list
08103                               // (in case of only one existing run in the list)
08104                               fStopEvolTime = fMyRootFile->GetStartTime(); 
08105                               fStopEvolDate = fMyRootFile->GetStartDate();
08106                               fStopEvolRun  = fT1DRunNumber[i_run];
08107                             }
08108                           else
08109                             {
08110                               // start time of the last existing run of the list
08111                               fStopEvolTime = fMyRootFile->GetStartTime();
08112                               fStopEvolDate = fMyRootFile->GetStartDate();
08113                               fStopEvolRun  = fT1DRunNumber[i_run];
08114                             }
08115                         }
08116                       //---- set flag of run existence and increase number of existing runs 
08117                       //     (for the first HistoryRunList file)
08118                       exist_indic[i_run] = 1;
08119                       fNbOfExistingRuns++;
08120                     } // end of if ( fMyRootFile->LookAtRootFile() == kTRUE )
08121                   else
08122                     {
08123                       fStatusFileFound = kFALSE;
08124 
08125                       cout << "!TEcnaHistos::ViewHistime(...)> *ERROR* =====> "
08126                            << " ROOT file not found for run " << fT1DRunNumber[i_run]
08127                            << fTTBELL << endl << endl;
08128                     }
08129                 } // end of for(Int_t i_run = 0; i_run < nb_of_runs_in_list; i_run++)
08130 
08131               //===================================== FIRST LOOP END ===========================     (ViewHistime) 
08132               if( fNbOfExistingRuns > 0 )
08133                 {
08134                   //-------------------- recover the array after removing non existing ROOT files
08135                   Int_t i_existing_run = (Int_t)0;
08136 
08137                   for( Int_t i_run = 0; i_run < nb_of_runs_in_list;  i_run++)
08138                     {
08139                       if( exist_indic[i_run] == 1 )
08140                         {
08141                           fT1DRunNumber[i_existing_run] = fT1DRunNumber[i_run];
08142                           i_existing_run++;
08143                         }
08144                     }    
08145 
08146                   //---------------------- Get start and stop time values to set the axis limits        (ViewHistime)
08147 
08148                   thstart_evol = (Double_t)fStartEvolTime;
08149                   thstop_evol  = (Double_t)fStopEvolTime;
08150 
08151                   Double_t xinf_lim = thstart_evol-(thstop_evol-thstart_evol)/margin_frame_xaxis;
08152                   Double_t xsup_lim = thstop_evol +(thstop_evol-thstart_evol)/margin_frame_xaxis;
08153 
08154                   Axis_t xinf_his = (Axis_t)(xinf_lim);
08155                   Axis_t xsup_his = (Axis_t)(xsup_lim);
08156 
08157                   //............................. i0StexEcha, i0Sample
08158                   Int_t i0StexEcha = fEcalNumbering->Get0StexEchaFrom1StexStinAnd0StinEcha(StexStin_A, i0StinEcha);
08159                   Int_t i0Sample = 0;
08160          
08161                   Double_t* time_coordx  = new Double_t[fNbOfExistingRuns];   fCnew++;
08162                   Double_t* hval_coordy  = new Double_t[fNbOfExistingRuns];   fCnew++;
08163          
08164                   //........... Set values to -1 
08165 
08166                   for( Int_t i_run = 0; i_run < fNbOfExistingRuns;  i_run++)
08167                     {
08168                       time_coordx[i_run] = (Double_t)(-1);
08169                       hval_coordy[i_run] = (Double_t)(-1);
08170                     }    
08171  
08172                   //========================== SECOND LOOP BEGINNING =====================================
08173                   //----------------------------------------------------------------------- (ViewHistime)
08174                   //
08175                   //      SECOND LOOP OVER THE EXISTING RUNS : FILL THE GRAPH COORDINATES
08176                   //
08177                   //-----------------------------------------------------------------------
08178                   for (Int_t i_run = 0; i_run < fNbOfExistingRuns; i_run++)
08179                     {
08180                       // => set the attribute value relative to the run (fFapRunNumber)
08181                       SetRunNumberFromList(i_run, fNbOfExistingRuns);
08182 
08183                       fMyRootFile->PrintNoComment();
08184                       fMyRootFile->FileParameters(fFapAnaType.Data(),   fFapNbOfSamples,
08185                                                   fT1DRunNumber[i_run], fFapFirstReqEvtNumber,
08186                                                   fFapLastReqEvtNumber, fFapReqNbOfEvts,
08187                                                   fFapStexNumber,       fCfgResultsRootFilePath.Data());
08188           
08189                       if ( fMyRootFile->LookAtRootFile() == kTRUE )    //  (ViewHistime, 2nd loop) 
08190                         {
08191                           fStatusFileFound = kTRUE;
08192 
08193                           Bool_t ok_view_histo = GetOkViewHisto(fMyRootFile, StexStin_A, i0StinEcha, i0Sample, HistoCode);
08194 
08195                           //............... F I L L   G R A P H   C O O R D I N A T E S   (ViewHistime)           
08196                           if( ok_view_histo == kTRUE )
08197                             {
08198                               //................................................. x coordinate
08199                               time_t xStartTime = fMyRootFile->GetStartTime();
08200                               Double_t thstart  = (Double_t)xStartTime;
08201                               time_coordx[i_run] = (Double_t)(thstart - xinf_lim);
08202                               //................................................. y coordinate
08203                               TVectorD read_histo(fEcal->MaxCrysEcnaInStex());
08204                               for(Int_t i=0; i<fEcal->MaxCrysEcnaInStex(); i++){read_histo(i)=(Double_t)0.;}
08205                              
08206                               if(HistoCode == "H_Ped_Date" || HistoCode == "H_Ped_RuDs")
08207                                 {read_histo = fMyRootFile->ReadPedestals(fEcal->MaxCrysEcnaInStex());}
08208                               if(HistoCode == "H_TNo_Date" || HistoCode == "H_TNo_RuDs")
08209                                 {read_histo = fMyRootFile->ReadTotalNoise(fEcal->MaxCrysEcnaInStex());}
08210                               if(HistoCode == "H_MCs_Date" || HistoCode == "H_MCs_RuDs")
08211                                 {read_histo = fMyRootFile->ReadMeanCorrelationsBetweenSamples(fEcal->MaxCrysEcnaInStex());}
08212                              
08213                               if(HistoCode == "H_LFN_Date" || HistoCode == "H_LFN_RuDs")
08214                                 {read_histo = fMyRootFile->ReadLowFrequencyNoise(fEcal->MaxCrysEcnaInStex());}
08215                               if(HistoCode == "H_HFN_Date" || HistoCode == "H_HFN_RuDs")
08216                                 {read_histo = fMyRootFile->ReadHighFrequencyNoise(fEcal->MaxCrysEcnaInStex());}
08217                               if(HistoCode == "H_SCs_Date" || HistoCode == "H_SCs_RuDs")
08218                                 {read_histo = fMyRootFile->ReadSigmaOfCorrelationsBetweenSamples(fEcal->MaxCrysEcnaInStex());}
08219                               hval_coordy[i_run] = (Double_t)read_histo(i0StexEcha);
08220                             }
08221                           else
08222                             {
08223                               cout << "!TEcnaHistos::ViewHistime(...)> Histo not available. "
08224                                    << fTTBELL << endl;
08225                             }
08226                         } // end of if ( fMyRootFile->LookAtRootFile() == kTRUE )
08227                       else
08228                         {
08229                           fStatusFileFound = kFALSE;
08230                         }
08231                     }
08232                   //========================== END OF SECOND LOOP ===========================================
08233 
08234                   //.................................................................... SCALE x and y
08235                   Int_t opt_scale_x = fOptScaleLinx;
08236                   if (fFlagScaleX == "LIN" ){opt_scale_x = fOptScaleLinx;}
08237                   if (fFlagScaleX == "LOG" ){opt_scale_x = fOptScaleLogx;}
08238 
08239                   Int_t opt_scale_y = fOptScaleLiny;
08240                   if (fFlagScaleY == "LIN" ){opt_scale_y = fOptScaleLiny;}
08241                   if (fFlagScaleY == "LOG" ){opt_scale_y = fOptScaleLogy;}
08242 
08243                   //------------------------------------------------- G R A P H    (ViewHistime)
08244                   TGraph* g_graph0 = new TGraph(fNbOfExistingRuns, time_coordx, hval_coordy); fCnewRoot++;
08245                   if( opt_plot == fOnlyOnePlot || opt_plot == fSeveralPlot)
08246                     {g_graph0->SetTitle(fCnaParHistos->GetQuantityName(HistoCode));}
08247                   if( opt_plot == fSameOnePlot )
08248                     {g_graph0->SetTitle(";");} 
08249 
08250                   //... Ymin and ymax default values will be taken if fFlagUserHistoMin/Max = "OFF"
08251                   //    (and if "Free" for "SAME" and "SAME n" options)
08252                   if((opt_plot == fOnlyOnePlot) ||
08253                      (opt_plot == fSeveralPlot && GetMemoFlag(HistoCode, opt_plot) == "Free") ||
08254                      (opt_plot == fSameOnePlot && GetMemoFlag(HistoCode, opt_plot) == "Free") )
08255                     {
08256                       SetYminMemoFromValue(HistoCode.Data(), fCnaParHistos->GetYminDefaultValue(HistoCode.Data()));
08257                       SetYmaxMemoFromValue(HistoCode.Data(), fCnaParHistos->GetYmaxDefaultValue(HistoCode.Data()));
08258                     }
08259               
08260                   //................................ Put min max values       (ViewHistime)
08261                   //.......... default if flag not set to "ON"
08262                   //SetYminMemoFromValue(HistoCode.Data(), fCnaParHistos->GetYminDefaultValue(HistoCode.Data()));
08263                   //SetYmaxMemoFromValue(HistoCode.Data(), fCnaParHistos->GetYmaxDefaultValue(HistoCode.Data()));
08264 
08265                   g_graph0->Set(fNbOfExistingRuns);
08266                   Double_t graph_ymin =
08267                     GetYminFromGraphFrameAndMarginValue(g_graph0, fCnaParHistos->GetMarginAutoMinMax());
08268                   Double_t graph_ymax =
08269                     GetYmaxFromGraphFrameAndMarginValue(g_graph0, fCnaParHistos->GetMarginAutoMinMax());
08270 
08271                   //---------------------------------- G R A P H   P L O T  ---------------------------- (ViewHistime)
08272                   if( HistoType == "Evol" )
08273                     {
08274                       //----------------- G R A P H  Y M I N / Y M A X    M A N A G E M E N T
08275                       if((opt_plot == fOnlyOnePlot) ||
08276                          (opt_plot == fSeveralPlot && GetMemoFlag(HistoCode, opt_plot) == "Free") ||
08277                          (opt_plot == fSameOnePlot && GetMemoFlag(HistoCode, opt_plot) == "Free") )
08278                         {
08279                           if( opt_plot == fSameOnePlot ){fHistoCodeFirst = HistoCode;} // registration of first HistoCode
08280 
08281                           if( fUserHistoMin >= fUserHistoMax ){fFlagUserHistoMin = "AUTO"; fFlagUserHistoMax = "AUTO";}
08282                           //.......... user's value if flag set to "ON"
08283                           if( fFlagUserHistoMin == "ON" )
08284                             {SetYminMemoFromValue(HistoCode.Data(), fUserHistoMin); fFlagUserHistoMin = "OFF";}
08285                           if( fFlagUserHistoMax == "ON" )
08286                             {SetYmaxMemoFromValue(HistoCode.Data(), fUserHistoMax); fFlagUserHistoMax = "OFF";}
08287                           //................................. automatic min and/or max
08288                           if( fFlagUserHistoMin == "AUTO" )
08289                             {SetYminMemoFromValue(HistoCode.Data(), graph_ymin); fFlagUserHistoMin = "OFF";}
08290                           if( fFlagUserHistoMax == "AUTO" )
08291                             {SetYmaxMemoFromValue(HistoCode.Data(), graph_ymax); fFlagUserHistoMax = "OFF";}
08292                       
08293                           //................................. Init Ymin and Ymax for graph
08294                           SetYminMemoFromPreviousMemo(HistoCode);
08295                           SetYmaxMemoFromPreviousMemo(HistoCode);
08296                         }
08297                       //--- Set ymin and ymax to the first HistoCode values for option SAME n
08298                       if( opt_plot == fSameOnePlot && GetMemoFlag(HistoCode, opt_plot) == "Busy" )                
08299                         {
08300                           Double_t ymin = GetYminValueFromMemo(fHistoCodeFirst.Data());
08301                           SetYminMemoFromValue(HistoCode.Data(), ymin);
08302                       
08303                           Double_t ymax = GetYmaxValueFromMemo(fHistoCodeFirst.Data());
08304                           SetYmaxMemoFromValue(HistoCode.Data(), ymax);
08305                         }
08306                   
08307                       //..... graph set ymin and ymax and consequently margin at top of the plot  
08308                       Int_t  xFlagAutoYsupMargin = SetGraphFrameYminYmaxFromMemo(g_graph0, HistoCode);
08309                   
08310                       HistimePlot(g_graph0,         xinf_his,         xsup_his,
08311                                   HistoCode.Data(), HistoType.Data(),
08312                                   StexStin_A,       i0StinEcha,       i0Sample,
08313                                   opt_scale_x,      opt_scale_y,      opt_plot, xFlagAutoYsupMargin);
08314                       //  g_graph0->Delete();   fCdeleteRoot++;  // *===> NE PAS DELETER LE GRAPH SINON CA EFFACE TOUT!
08315                   
08316                       //--- Recover ymin and ymax from user's values in option SAME n
08317                       if( opt_plot == fSameOnePlot && GetMemoFlag(HistoCode, opt_plot) == "Busy" )                
08318                         {
08319                           SetYminMemoFromValue(HistoCode.Data(), fUserHistoMin);
08320                           SetYmaxMemoFromValue(HistoCode.Data(), fUserHistoMax);
08321                         }
08322                     }
08323               
08324                   //---------- H I S T O    Y    P R O J E C T I O N     P L O T  ---------------------- (ViewHistime)
08325               
08326                   //======  G R A P H   P R O J   X I N F / X S U P   M A N A G E M E N T  =======  (ViewHistime)
08327                   //
08328                   //  must be done before booking because of the x <-> y permutation in case of "Proj"
08329                   //
08330                   //-----------------------------------------------------------------------------------------
08331                   //
08332                   //        CASE:    HistoType == "Proj"   OR   HistoType == "SampProj"
08333                   //
08334                   //                 Xinf and Xsup must be calculated from ymin and ymax
08335                   //                 of the direct graph
08336                   //
08337                   //-----------------------------------------------------------------------------------------
08338               
08339                   if( HistoType == "EvolProj" )
08340                     {
08341                       Int_t HisSizeEvolProj = fNbBinsProj;
08342                       TVectorD histo_for_plot(HisSizeEvolProj);
08343                       for(Int_t i=0; i<HisSizeEvolProj; i++){histo_for_plot[i]=(Double_t)0.;}
08344 
08345                       //graph_ymin = GetYminValueFromMemo(HistoCode.Data());
08346                       //graph_ymax = GetYmaxValueFromMemo(HistoCode.Data());
08347 
08348                       TString HistoCodi = HistoCode;     // HistoCodi = direct histo
08349 
08350                       if( HistoCode == "H_Ped_RuDs" ){HistoCodi = "H_Ped_Date";}
08351                       if( HistoCode == "H_TNo_RuDs" ){HistoCodi = "H_TNo_Date";}
08352                       if( HistoCode == "H_LFN_RuDs" ){HistoCodi = "H_LFN_Date";}
08353                       if( HistoCode == "H_HFN_RuDs" ){HistoCodi = "H_HFN_Date";}
08354                       if( HistoCode == "H_MCs_RuDs" ){HistoCodi = "H_MCs_Date";}
08355                       if( HistoCode == "H_SCs_RuDs" ){HistoCodi = "H_SCs_Date";}              
08356 
08357                       if( fUserHistoMin >= fUserHistoMax ){fFlagUserHistoMin = "AUTO"; fFlagUserHistoMax = "AUTO";}
08358 
08359                       //--------------------------------------------------------------------------- (ViewHistime)
08360                       //
08361                       //    fOnlyOnePlot => compute Xinf and Xsup at each time
08362                       //    fSeveralPlot => compute Xinf and Xsup once when flag = "Free" for each HistoCode
08363                       //    fSameOnePlot => compute Xinf and Xsup once
08364                       //
08365                       //--------------------------------------------------------------------------------------
08366                       if( (opt_plot == fOnlyOnePlot) ||
08367                           ( (opt_plot == fSeveralPlot && GetMemoFlag(HistoCode, fSeveralPlot) == "Free" ) ||
08368                             (opt_plot == fSameOnePlot && GetMemoFlag(HistoCode, fSameOnePlot) == "Free" ) ) )
08369                         {
08370                           Double_t XinfProj =(Double_t)0;
08371                           Double_t XsupProj =(Double_t)0;
08372 
08373                           //...................................................................... (ViewHistime)
08374                           if( fFlagUserHistoMin == "AUTO" || fFlagUserHistoMax == "AUTO" )
08375                             {
08376                               //... Get direct graph ymin and/or ymax and keep them as xinf and xsup
08377                               //    in memo for the plotted histo 
08378                               XinfProj = fUserHistoMin;
08379                               XsupProj = fUserHistoMax;
08380                               if( fFlagUserHistoMin == "AUTO" ){XinfProj = GetYminValueFromMemo(HistoCodi.Data());}
08381                               if( fFlagUserHistoMax == "AUTO" ){XsupProj = GetYmaxValueFromMemo(HistoCodi.Data());}
08382                             } // end of  if( fFlagUserHistoMin == "AUTO" || fFlagUserHistoMax == "AUTO" )
08383                           else
08384                             {
08385                               if( fFlagUserHistoMin == "OFF" )
08386                                 {
08387                                   SetYminMemoFromValue(HistoCode.Data(),
08388                                                        fCnaParHistos->GetYminDefaultValue(HistoCode.Data()));
08389                                   XinfProj = GetYminValueFromMemo(HistoCode.Data());
08390                                 }
08391 
08392                               if( fFlagUserHistoMax == "OFF" )
08393                                 {
08394                                   SetYmaxMemoFromValue(HistoCode.Data(),
08395                                                        fCnaParHistos->GetYmaxDefaultValue(HistoCode.Data()));
08396                                   XsupProj = GetYmaxValueFromMemo(HistoCode.Data());      
08397                                 }
08398                               if( fFlagUserHistoMin == "ON" ){XinfProj = fUserHistoMin;}
08399                               if( fFlagUserHistoMax == "ON" ){XsupProj = fUserHistoMax;}
08400                             }
08401 
08402                           if( opt_plot == fOnlyOnePlot || opt_plot == fSeveralPlot )
08403                             {
08404                               SetXinfMemoFromValue(HistoCode.Data(), XinfProj);
08405                               SetXsupMemoFromValue(HistoCode.Data(), XsupProj);                   
08406                             }
08407                           else
08408                             {
08409                               SetXinfMemoFromValue(XinfProj);
08410                               SetXsupMemoFromValue(XsupProj);
08411                             }
08412                         } // end of if( (opt_plot == fOnlyOnePlot) || 
08413                       // (opt_plot == fSeveralPlot  && GetMemoFlag(HistoCode, opt_plot) == "Free") ||
08414                       // (opt_plot == fSameOnePlot  && GetMemoFlag(HistoCode, opt_plot) == "Free") )
08415 
08416                       Double_t cXinf = (Double_t)0.;
08417                       Double_t cXsup = (Double_t)0.;
08418 
08419                       //.......... Set Xinf and Xsup at each time because of simultaneous SAME options    (ViewHistime)
08420                       if( opt_plot == fOnlyOnePlot || opt_plot == fSeveralPlot )
08421                         {
08422                           cXinf = GetXinfValueFromMemo(HistoCode.Data());
08423                           cXsup = GetXsupValueFromMemo(HistoCode.Data());
08424                         }
08425                       else
08426                         {
08427                           cXinf = GetXinfValueFromMemo();
08428                           cXsup = GetXsupValueFromMemo();
08429                         }
08430                       //....... In case of only one run: in order to have cXinf < cXsup for "EvolProj" plot
08431                       if( cXinf >= cXsup ){cXinf -= 1.; cXsup +=1.;}
08432 
08433                       //..............................  histogram booking (ViewHisto)
08434                       Axis_t xinf_his = cXinf;  // ancillary variables since no const in arguments of TH1D
08435                       Axis_t xsup_his = cXsup;
08436 
08437                       TString TitleHisto = ";";
08438                       if( opt_plot != fSameOnePlot )
08439                         {TitleHisto = fCnaParHistos->GetQuantityName(HistoCode.Data());}
08440 
08441                       //........ fill array histo_for_plot from hval_coordy                    (ViewHistime)
08442                       for(Int_t i_run=0; i_run<fNbOfExistingRuns; i_run++)
08443                         {
08444                           Double_t XFromYGraph = hval_coordy[i_run];
08445                           Double_t binXProjY = (Double_t)HisSizeEvolProj*(XFromYGraph - cXinf)/(cXsup - cXinf);
08446                           Int_t ibinXProjY = (Int_t)binXProjY;
08447                           if( ibinXProjY >= 0 && ibinXProjY<HisSizeEvolProj ){histo_for_plot[ibinXProjY]++;}
08448                         }
08449 
08450                       TH1D* h_his_evol_proj = new TH1D("histevolproj", TitleHisto.Data(),
08451                                                        HisSizeEvolProj, xinf_his, xsup_his); fCnewRoot++;
08452 
08453                       h_his_evol_proj->Reset();
08454 
08455                       //.... direct histogram filling                                                 (ViewHistime)
08456                       for(Int_t i=0; i<HisSizeEvolProj; i++)
08457                         {
08458                           Double_t yi = (Double_t)i/(Double_t)HisSizeEvolProj*(cXsup-cXinf) + cXinf;
08459                           Double_t his_val = (Double_t)histo_for_plot[i];
08460                           h_his_evol_proj->Fill(yi, his_val);
08461                         }
08462 
08463                       //------- H I S T O   P R O J    Y M I N / Y M A X    M A N A G E M E N T
08464                       if( fUserHistoMin >= fUserHistoMax ){fFlagUserHistoMin = "AUTO"; fFlagUserHistoMax = "AUTO";}
08465                       //.......... user's value if flag set to "ON"
08466                       if( fFlagUserHistoMin == "ON" )
08467                         {SetYminMemoFromValue(HistoCode.Data(), fUserHistoMin); fFlagUserHistoMin = "OFF";}
08468                       if( fFlagUserHistoMax == "ON" )
08469                         {SetYmaxMemoFromValue(HistoCode.Data(), fUserHistoMax); fFlagUserHistoMax = "OFF";}
08470                       //................................. automatic min and/or max
08471                       if( fFlagUserHistoMin == "AUTO" )
08472                         {SetYminMemoFromValue(HistoCode.Data(), graph_ymin); fFlagUserHistoMin = "OFF";}
08473                       if( fFlagUserHistoMax == "AUTO" )
08474                         {SetYmaxMemoFromValue(HistoCode.Data(), graph_ymax); fFlagUserHistoMax = "OFF";}
08475 
08476                       //................................. Init Ymin and Ymax for graph
08477                       SetYminMemoFromPreviousMemo(HistoCode);
08478                       SetYmaxMemoFromPreviousMemo(HistoCode);
08479 
08480                       //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
08481                       //.......... Find maximum in case of Proj (LIN scale only) // PS: EvolProj => in ViewHistime
08482                       if( fFlagScaleY == "LIN" )
08483                         {
08484                           SetYmaxMemoFromValue
08485                             (HistoCode.Data(),
08486                              GetYmaxFromHistoFrameAndMarginValue(h_his_evol_proj, fCnaParHistos->GetMarginAutoMinMax()));
08487                         }
08488                       
08489                       //--- Set ymin and ymax to the first HistoCode values for option SAME n
08490                       if( opt_plot == fSameOnePlot && GetMemoFlag(HistoCode, opt_plot) == "Busy" )                
08491                         {
08492                           Double_t ymin = GetYminValueFromMemo(fHistoCodeFirst.Data());
08493                           SetYminMemoFromValue(HistoCode.Data(), ymin);
08494                           
08495                           Double_t ymax = GetYmaxValueFromMemo(fHistoCodeFirst.Data());
08496                           SetYmaxMemoFromValue(HistoCode.Data(), ymax);
08497                         }
08498                       //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
08499                       
08500                       //..... graph set ymin and ymax and consequently margin at top of the plot  
08501                       Int_t  xFlagAutoYsupMargin = SetGraphFrameYminYmaxFromMemo(g_graph0, HistoCode);
08502                       Int_t  arg_AlreadyRead = 0;
08503 
08504                       HistoPlot(h_his_evol_proj,  HisSizeEvolProj,
08505                                 xinf_his,         xsup_his,
08506                                 HistoCode.Data(), HistoType.Data(),
08507                                 StexStin_A,       i0StinEcha,       i0Sample,
08508                                 opt_scale_x,      opt_scale_y,      opt_plot, arg_AlreadyRead,
08509                                 xFlagAutoYsupMargin);
08510 
08511                       h_his_evol_proj->Delete();   h_his_evol_proj = 0;                         fCdeleteRoot++;
08512                       //*===> deleter l'histo sinon "Replacing existing histo (potential memory leak)" a l'execution
08513 
08514                     } // end of if( HistoType == "EvolProj" )
08515                   //---------------------------------------------------------------------------------- (ViewHistime)
08516 
08517                   delete [] time_coordx;   time_coordx = 0;      fCdelete++;   
08518                   delete [] hval_coordy;   hval_coordy = 0;      fCdelete++;  
08519                 }
08520               else
08521                 {
08522                   cout << "!TEcnaHistos::ViewHistime(...)> The list of runs in file: " << list_of_run_file_name 
08523                        << " has " << nb_of_runs_in_list << " run numbers" << endl
08524                        << " but none of them correspond to an existing ROOT file."
08525                        << fTTBELL << endl;
08526                 }
08527             } // end of if( fFapStexNumber > 0 )
08528           else
08529             {
08530               cout << "!TEcnaHistos::ViewHistime(...)> *ERROR* =====> "
08531                    << fFapStexName << " number = " << fFapStexNumber << ". "
08532                    << fFapStexName << " number must be in range [1," << fEcal->MaxStexInStas() << "] ";
08533               if( fFlagSubDet == "EB" ){cout << " (or [-18,+18])";}
08534                 cout << fTTBELL << endl;
08535             }
08536           delete [] exist_indic;  exist_indic = 0;         fCdelete++;
08537         } // end of if( nb_of_runs_in_list > 0 )
08538       else
08539         {
08540           if( nb_of_runs_in_list == 0 )
08541             {
08542               cout << "!TEcnaHistos::ViewHistime(...)> The list of runs in file: " << list_of_run_file_name
08543                    << " is empty !" << fTTBELL << endl;
08544             }
08545           if( nb_of_runs_in_list < 0 )
08546             {
08547               cout << "!TEcnaHistos::ViewHistime(...)> " << list_of_run_file_name
08548                    << ": file not found in directory: " << fCfgHistoryRunListFilePath.Data() << fTTBELL << endl;
08549             }
08550         }
08551     }  // end of if( OKHisto == 1 )
08552 } // end of ViewHistime
08553 
08554 //------------------------------------------------------------------------------------
08555 //
08556 //      GetHistoryRunListParameters(...), AllocArraysForEvol(), GetListFileNumber(...)
08557 //
08558 //------------------------------------------------------------------------------------
08559 
08560 Int_t TEcnaHistos::GetHistoryRunListParameters(const TString list_of_run_file_name, const TString HistoCode)
08561 {
08562   // Build the array of run numbers from the list-of-runs .ascii file.
08563   // Return the list size
08564   // *=====> list_of_run_file_name is the name of the ASCII file containing the list of the runs
08565   //
08566   // SYNTAX OF THE FILE:
08567   //
08568   // HistoryRunList_EB_SM6_Analysis_1.ascii    <- 1rst line: comment (file name for example)
08569   // 73677                                 <- 2nd  line and others: run numbers (empty lines accepted)
08570   // 73688          
08571   // 73689
08572   //
08573   // 73690
08574   // 73692 
08575   //
08576   // In option SAME (of TEcnaHistos), several lists of runs can be called and these lists can have
08577   // DIFFERENT sizes (here the "size" is the number of runs of the list). In addition,
08578   // some runs in some lists may not exist in reality. So, we must adopt a convention which is
08579   // the following: the number of runs corresponds to the number of EXISTING runs
08580   // of the FIRST read list. Let be N1 this number.
08581   // If another list has more runs than N1 runs, we read only the first N1 runs.
08582   // If another list has less runs than N1 runs, we read all the runs of this list. 
08583   //
08584   //--------------------------------------------------------------------------------------------------
08585 
08586   Int_t nb_of_runs_in_list = 0;
08587   
08588   //========= immediate return if file name is an empty string
08589   if( list_of_run_file_name.Data() == '\0' )
08590     {
08591       cout << "!TEcnaHistos::GetHistoryRunListParameters(...)> *** ERROR *** =====> "
08592            << " EMPTY STRING for list of run file name." << fTTBELL << endl;
08593     }
08594   else
08595     {
08596       // ===> increase the HistoryRunList file number
08597       if ( HistoCode == "H_Ped_Date" ){fNbOfListFileH_Ped_Date++;}
08598       if ( HistoCode == "H_TNo_Date" ){fNbOfListFileH_TNo_Date++;}
08599       if ( HistoCode == "H_MCs_Date" ){fNbOfListFileH_MCs_Date++;}
08600       if ( HistoCode == "H_LFN_Date" ){fNbOfListFileH_LFN_Date++;}
08601       if ( HistoCode == "H_HFN_Date" ){fNbOfListFileH_HFN_Date++;}
08602       if ( HistoCode == "H_SCs_Date" ){fNbOfListFileH_SCs_Date++;}
08603 
08604       if ( HistoCode == "H_Ped_RuDs" ){fNbOfListFileH_Ped_RuDs++;}
08605       if ( HistoCode == "H_TNo_RuDs" ){fNbOfListFileH_TNo_RuDs++;}
08606       if ( HistoCode == "H_MCs_RuDs" ){fNbOfListFileH_MCs_RuDs++;}
08607       if ( HistoCode == "H_LFN_RuDs" ){fNbOfListFileH_LFN_RuDs++;}
08608       if ( HistoCode == "H_HFN_RuDs" ){fNbOfListFileH_HFN_RuDs++;}
08609       if ( HistoCode == "H_SCs_RuDs" ){fNbOfListFileH_SCs_RuDs++;}
08610       
08611       fFapFileRuns = list_of_run_file_name.Data();    // (short name)
08612       
08613       //........... Add the path to the file name           ( GetHistoryRunListParameters )
08614       TString xFileNameRunList = list_of_run_file_name.Data();
08615       const Text_t *t_file_name = (const Text_t *)xFileNameRunList.Data();
08616 
08617       //.............. replace the string "$HOME" by the true $HOME path
08618       if(fCfgHistoryRunListFilePath.BeginsWith("$HOME"))
08619         {
08620           fCfgHistoryRunListFilePath.Remove(0,5);
08621           const Text_t *t_file_nohome = (const Text_t *)fCfgHistoryRunListFilePath.Data(); //  /scratch0/cna/...
08622           
08623           TString home_path = gSystem->Getenv("HOME");
08624           fCfgHistoryRunListFilePath = home_path;             //  /afs/cern.ch/u/USER
08625           fCfgHistoryRunListFilePath.Append(t_file_nohome);   //  /afs/cern.ch/u/USER/scratch0/cna/...
08626         }
08627      
08628       xFileNameRunList = fCfgHistoryRunListFilePath.Data();
08629       
08630       xFileNameRunList.Append('/');
08631       xFileNameRunList.Append(t_file_name);
08632       
08633       fFcin_f.open(xFileNameRunList.Data());
08634 
08635       //.......................................           ( GetHistoryRunListParameters )
08636       if( fFcin_f.fail() == kFALSE )
08637         {   
08638           //...................................... first reading to get the number of runs in the list
08639           fFcin_f.clear();
08640           string xHeadComment;
08641           fFcin_f >> xHeadComment;
08642           Int_t cRunNumber;
08643           Int_t list_size_read = 0;
08644           
08645           while( !fFcin_f.eof() ){fFcin_f >> cRunNumber; list_size_read++;}
08646           fFapNbOfRuns = list_size_read - 1;
08647 
08648           //...................................... second reading to get the run numbers
08649 
08650           //====== Return to the beginning of the file =====
08651           fFcin_f.clear();
08652           fFcin_f.seekg(0, ios::beg);
08653           //================================================
08654 
08655           string yHeadComment;
08656           fFcin_f >> yHeadComment;
08657 
08658           //....................... Set fFapMaxNbOfRuns to -1 at first call (first read file)
08659           //
08660           //                        fNbOfListFileEvolXXX is initialized to 0 in Init()
08661           //                        It is incremented once here above
08662           //                        So, at first call fNbOfListFileEvolXXX = 1
08663           //                        then fFapMaxNbOfRuns = -1
08664           //..........................................................................   (GetHistoryRunListParameters)
08665           if( (HistoCode == "H_Ped_Date" && fNbOfListFileH_Ped_Date == 1) || 
08666               (HistoCode == "H_TNo_Date" && fNbOfListFileH_TNo_Date == 1) ||
08667               (HistoCode == "H_MCs_Date" && fNbOfListFileH_MCs_Date == 1) ||
08668               (HistoCode == "H_LFN_Date" && fNbOfListFileH_LFN_Date == 1) || 
08669               (HistoCode == "H_HFN_Date" && fNbOfListFileH_HFN_Date == 1) ||
08670               (HistoCode == "H_SCs_Date" && fNbOfListFileH_SCs_Date == 1) ||
08671               (HistoCode == "H_Ped_RuDs" && fNbOfListFileH_Ped_RuDs == 1) || 
08672               (HistoCode == "H_TNo_RuDs" && fNbOfListFileH_TNo_RuDs == 1) ||
08673               (HistoCode == "H_MCs_RuDs" && fNbOfListFileH_MCs_RuDs == 1) ||
08674               (HistoCode == "H_LFN_RuDs" && fNbOfListFileH_LFN_RuDs == 1) || 
08675               (HistoCode == "H_HFN_RuDs" && fNbOfListFileH_HFN_RuDs == 1) ||
08676               (HistoCode == "H_SCs_RuDs" && fNbOfListFileH_SCs_RuDs == 1)){fFapMaxNbOfRuns = -1;}
08677           
08678           // first call: fFapMaxNbOfRuns = fFapNbOfRuns = nb of run from the first reading 
08679           if( fFapMaxNbOfRuns == -1 ){fFapMaxNbOfRuns = fFapNbOfRuns;}
08680           // next calls: fFapNbOfRuns must not be greater than fFapMaxNbOfRuns found at first time
08681           else{if( fFapNbOfRuns > fFapMaxNbOfRuns ){fFapNbOfRuns = fFapMaxNbOfRuns;}}
08682 
08683           // Allocation and initialization of the array fT1DRunNumber[].
08684           //................. check maximum value for allocation
08685           if( fFapMaxNbOfRuns > fCnaParHistos->MaxNbOfRunsInLists() )
08686             {
08687               cout << "TEcnaHistos::GetHistoryRunListParameters(...)> Max number of runs in HistoryRunList = "
08688                    << fFapMaxNbOfRuns
08689                    << " too large, forced to parameter TEcnaParHistos->fMaxNbOfRunsInLists value (= "
08690                    << fCnaParHistos->MaxNbOfRunsInLists()
08691                    << "). Please, set this parameter to a larger value than " << fFapMaxNbOfRuns
08692                    << fTTBELL << endl;
08693               fFapMaxNbOfRuns = fCnaParHistos->MaxNbOfRunsInLists();
08694             }
08695           //................................. Alloc of the array and init
08696           if( fT1DRunNumber == 0 )
08697             {
08698               if( fFapMaxNbOfRuns > 0 )
08699                 {
08700                   fT1DRunNumber = new Int_t[fFapMaxNbOfRuns];               fCnew++;
08701                 }
08702               else
08703                 {
08704                   cout << "!TEcnaHistos::GetHistoryRunListParameters(...)> *** ERROR *** =====> fFapMaxNbOfRuns = "
08705                        << fFapMaxNbOfRuns << ". Forced to 1." << fTTBELL << endl;
08706                   fFapMaxNbOfRuns = 1;
08707                   fT1DRunNumber = new Int_t[fFapMaxNbOfRuns];               fCnew++;
08708                 }
08709             }
08710 
08711 
08712           //.................................... Init the list of runs    
08713           for ( Int_t i_run = 0; i_run < fFapMaxNbOfRuns; i_run++ ){fT1DRunNumber[i_run] = -1;}
08714           //.................................... read the list of runs
08715           for (Int_t i_list = 0; i_list < fFapNbOfRuns; i_list++)
08716             {
08717               fFcin_f >> cRunNumber;
08718               fT1DRunNumber[i_list] = cRunNumber;
08719             }
08720           //........................................           ( GetHistoryRunListParameters )
08721           nb_of_runs_in_list = fFapNbOfRuns;
08722           fFcin_f.close();
08723         }
08724       else
08725         {
08726           fFcin_f.clear();
08727           cout << "!TEcnaHistos::GetHistoryRunListParameters(...)> *** ERROR *** =====> "
08728                << xFileNameRunList.Data() << " : file not found." << fTTBELL << endl;
08729           nb_of_runs_in_list = -1;
08730         }
08731     }
08732   return nb_of_runs_in_list;
08733 }
08734 //   end of GetHistoryRunListParameters(...)
08735 
08736 //------------------------------------------------------------------------------------------------
08737 
08738 Int_t TEcnaHistos::GetListFileNumber(const TString HistoCode)
08739 {
08740 // Get the number of the read list file
08741   
08742   Int_t number = 0;
08743 
08744   if ( HistoCode == "H_Ped_Date"){number = fNbOfListFileH_Ped_Date;}
08745   if ( HistoCode == "H_TNo_Date"){number = fNbOfListFileH_TNo_Date;}
08746   if ( HistoCode == "H_MCs_Date"){number = fNbOfListFileH_MCs_Date;}
08747   if ( HistoCode == "H_LFN_Date"){number = fNbOfListFileH_LFN_Date;}
08748   if ( HistoCode == "H_HFN_Date"){number = fNbOfListFileH_HFN_Date;}
08749   if ( HistoCode == "H_SCs_Date"){number = fNbOfListFileH_SCs_Date;}
08750   if ( HistoCode == "H_Ped_RuDs"){number = fNbOfListFileH_Ped_RuDs;}
08751   if ( HistoCode == "H_TNo_RuDs"){number = fNbOfListFileH_TNo_RuDs;}
08752   if ( HistoCode == "H_MCs_RuDs"){number = fNbOfListFileH_MCs_RuDs;}
08753   if ( HistoCode == "H_LFN_RuDs"){number = fNbOfListFileH_LFN_RuDs;}
08754   if ( HistoCode == "H_HFN_RuDs"){number = fNbOfListFileH_HFN_RuDs;}
08755   if ( HistoCode == "H_SCs_RuDs"){number = fNbOfListFileH_SCs_RuDs;}
08756   return number;
08757 }
08758 
08759 //--------------------------------------------------------------------------------------------------
08760 void TEcnaHistos::SetRunNumberFromList(const Int_t& xArgIndexRun, const Int_t& MaxNbOfRuns)
08761 {
08762   // Set run number for the xArgIndexRun_th run in the list of runs (evolution plots)
08763   //     The array fT1DRunNumber[] have been obtained from a previous call
08764   //     to GetHistoryRunListParameters(xFileNameRunList, HistoCode)
08765   
08766   if( xArgIndexRun >= 0 && xArgIndexRun < MaxNbOfRuns)
08767     {
08768       fFapRunNumber  = fT1DRunNumber[xArgIndexRun];
08769       if( xArgIndexRun == 0 ){InitSpecParBeforeFileReading();} // SpecPar = Special Parameters (dates, times, run types)
08770     }
08771   else
08772     {
08773       cout << "!TEcnaHistos::SetRunNumberFromList(...)> **** ERROR **** Run index out of range in list of runs. xArgIndexRun = "
08774            << xArgIndexRun << " (MaxNbOfRuns = "<< MaxNbOfRuns << ")" << endl;
08775     }
08776 }
08777 
08778 //--------------------------------------------------------------------------------------------------
08779 void TEcnaHistos::InitSpecParBeforeFileReading()
08780 {
08781   // Init parameters that will be set by reading the info which are in the results ROOT file
08782   // SpecPar = Special Parameters (dates, times, run types)
08783 
08784   Int_t MaxCar = fgMaxCar;
08785   fStartDate.Resize(MaxCar);
08786   fStartDate = "(date not found)";
08787 
08788   MaxCar = fgMaxCar;
08789   fStopDate.Resize(MaxCar);
08790   fStopDate  = "(date not found)";
08791 
08792   fStartTime = (time_t)0;
08793   fStopTime  = (time_t)0;
08794 
08795   fRunType   = "(run type not found)";
08796 
08797 } // ------------- ( end of InitSpecParBeforeFileReading() ) -------------
08798 
08799 //======================================================================================
08800 //
08801 //           C O M M E N T S / I N F O S     P A V E S      M E T H O D S 
08802 //
08803 //======================================================================================
08804 
08805 Bool_t TEcnaHistos::GetOkViewHisto(TEcnaRead*    aMyRootFile,
08806                                    const Int_t&  StexStin_A, const Int_t& i0StinEcha, const Int_t& i0Sample,
08807                                    const TString HistoCode)
08808 {
08809 // Check possibility to plot the histo
08810 
08811   Bool_t ok_view_histo = kFALSE;
08812 
08813   TString HistoType = fCnaParHistos->GetHistoType(HistoCode);
08814 
08815   TString root_file_name = aMyRootFile->GetRootFileNameShort();
08816 
08817   TVectorD  vStin(fEcal->MaxStinEcnaInStex());
08818   for(Int_t i=0; i<fEcal->MaxStinEcnaInStex() ; i++){vStin(i)=(Double_t)0.;}
08819   vStin = aMyRootFile->ReadStinNumbers(fEcal->MaxStinEcnaInStex());
08820 
08821   if( aMyRootFile->DataExist() == kTRUE )
08822     {
08823       fStatusDataExist = kTRUE;
08824 
08825       Int_t Stin_ok = 0;
08826       for (Int_t index_Stin = 0; index_Stin < fEcal->MaxStinEcnaInStex(); index_Stin++)
08827         {
08828           if ( vStin(index_Stin) == StexStin_A ){Stin_ok++;};
08829         }
08830       
08831       //.............................................. ok_view   
08832       Int_t ok_view    = 1;
08833       
08834       if( !( HistoType == "Global" || HistoType == "Proj" )  )
08835         {
08836           if( Stin_ok != 1)
08837           {
08838             Int_t StinNumber = StexStin_A;
08839             if( fFlagSubDet == "EE" )
08840               {StinNumber = fEcalNumbering->GetDeeSCConsFrom1DeeSCEcna(fFapStexNumber, StexStin_A);}
08841             cout << "!TEcnaHistos::GetOkViewHisto(...)> *ERROR* =====> " << "File: " << root_file_name
08842                  << ", " << fFapStinName.Data() << " "
08843                  << StinNumber
08844                  << " not found. Available numbers = ";
08845             for(Int_t i = 0; i < fEcal->MaxStinEcnaInStex(); i++)
08846               {
08847                 if( vStin(i) > 0 )
08848                   {
08849                     if( fFlagSubDet == "EB" ){cout << vStin(i) << ", ";}
08850                     if( fFlagSubDet == "EE" )
08851                       {cout << fEcalNumbering->GetDeeSCConsFrom1DeeSCEcna(fFapStexNumber, (Int_t)vStin(i)) << ", ";}
08852                   }
08853               }
08854             cout << fTTBELL << endl;
08855             ok_view = -1;
08856           }
08857           else 
08858             { 
08859               ok_view = 1;
08860             }
08861         }
08862       
08863       //.............................................. ok_max_elt   ( GetOkViewHisto(...) )
08864       Int_t ok_max_elt  = 1;
08865       
08866       if( ( ( (HistoType == "H1Basic") || (HistoType == "Evol") || (HistoType == "EvolProj") )
08867             && (i0StinEcha >= 0) && (i0StinEcha<fEcal->MaxCrysInStin()) 
08868             && (i0Sample  >= 0) && (i0Sample <fFapNbOfSamples ) ) ||
08869           !( (HistoType == "H1Basic") || (HistoType == "Evol") || (HistoType == "EvolProj") ))
08870         {ok_max_elt = 1;} 
08871       else
08872         {
08873           Int_t Choffset = 0;
08874           if( fFlagSubDet == "EE" ){Choffset = 1;}
08875           if( ( (HistoType == "H1Basic") || (HistoType == "Evol") || (HistoType == "EvolProj") )
08876               && !( (i0StinEcha >= 0) && (i0StinEcha<fEcal->MaxCrysInStin()) ) )
08877             {cout << "!TEcnaHistos::GetOkViewHisto(...)> *ERROR* =====> " << "File: " << root_file_name
08878                   << ". Wrong channel number. Value = " << i0StinEcha << " (required range: [" << Choffset << ", "
08879                   << fEcal->MaxCrysInStin()-1+Choffset << "] )"
08880                   << fTTBELL << endl;}
08881           if( (HistoCode == "D_Adc_EvDs" || HistoCode == "D_Adc_EvNb") &&
08882               !((i0Sample >= 0) && (i0Sample <fFapNbOfSamples)) )
08883             {cout << "!TEcnaHistos::GetOkViewHisto(...)> *ERROR* =====> " << "File: " << root_file_name
08884                   << ". Wrong sample index. Value = " << i0Sample << " (required range: [0, "
08885                   << fFapNbOfSamples-1 << "] )"
08886                   << fTTBELL << endl;}
08887           ok_max_elt = -1;
08888         }
08889       
08890       if( (ok_view == 1) && (ok_max_elt == 1) )
08891         {
08892           ok_view_histo = kTRUE;
08893         }
08894       else
08895         {
08896           cout << "!TEcnaHistos::GetOkViewHisto(...)> At least one ERROR has been detected. ok_view = " << ok_view
08897                << ", ok_max_elt = " << ok_max_elt << fTTBELL << endl;
08898         }
08899     }
08900   else
08901     {
08902       fStatusDataExist = kFALSE;
08903 
08904       cout << "!TEcnaHistos::GetOkViewHisto(...)> No data in ROOT file "
08905            << ", aMyRootFile->DataExist() = " << aMyRootFile->DataExist() << fTTBELL << endl;
08906     }
08907   return ok_view_histo;
08908 }
08909 //..............................................................................................
08910 
08911 Int_t TEcnaHistos::SetHistoFrameYminYmaxFromMemo(TH1D* h_his0, const TString HistoCode)
08912 {
08913 // Set min and max according to HistoCode
08914   
08915   // if Ymin = Ymax (or Ymin > Ymax): nothing done here
08916   // return xFlagAutoYsupMargin = 1
08917   //
08918   // if Ymin < Ymax: min and max calculated by h_his0->SetMinimum() and h_his0->SetMaximum()
08919   // return xFlagAutoYsupMargin = 0
08920 
08921   Int_t xFlagAutoYsupMargin = 1;                             //  (SetHistoFrameYminYmaxFromMemo)
08922   
08923   if(HistoCode == "D_NOE_ChNb"){ 
08924     if(fD_NOE_ChNbYmin < fD_NOE_ChNbYmax){xFlagAutoYsupMargin = 0;
08925     h_his0->SetMinimum(fD_NOE_ChNbYmin);  h_his0->SetMaximum(fD_NOE_ChNbYmax);}}
08926   
08927   if(HistoCode == "D_NOE_ChDs"){
08928     if(fD_NOE_ChDsYmin < fD_NOE_ChDsYmax){xFlagAutoYsupMargin = 0;
08929     h_his0->SetMinimum(fD_NOE_ChDsYmin); h_his0->SetMaximum(fD_NOE_ChDsYmax);}}
08930   
08931   if(HistoCode == "D_Ped_ChNb"){
08932     if(fD_Ped_ChNbYmin < fD_Ped_ChNbYmax){xFlagAutoYsupMargin = 0;
08933         h_his0->SetMinimum(fD_Ped_ChNbYmin);  h_his0->SetMaximum(fD_Ped_ChNbYmax);}}
08934   
08935   if(HistoCode == "D_Ped_ChDs"){
08936     if(fD_Ped_ChDsYmin < fD_Ped_ChDsYmax){xFlagAutoYsupMargin = 0;
08937     h_his0->SetMinimum(fD_Ped_ChDsYmin); h_his0->SetMaximum(fD_Ped_ChDsYmax);}}
08938   
08939   if(HistoCode == "D_TNo_ChNb"){
08940     if(fD_TNo_ChNbYmin < fD_TNo_ChNbYmax){xFlagAutoYsupMargin = 0;
08941     h_his0->SetMinimum(fD_TNo_ChNbYmin); h_his0->SetMaximum(fD_TNo_ChNbYmax);}}
08942   
08943   if(HistoCode == "D_TNo_ChDs"){
08944     if(fD_TNo_ChDsYmin < fD_TNo_ChDsYmax){xFlagAutoYsupMargin = 0;
08945     h_his0->SetMinimum(fD_TNo_ChDsYmin); h_his0->SetMaximum(fD_TNo_ChDsYmax);}}
08946   
08947   if(HistoCode == "D_MCs_ChNb"){
08948     if(fD_MCs_ChNbYmin < fD_MCs_ChNbYmax){xFlagAutoYsupMargin = 0;
08949     h_his0->SetMinimum(fD_MCs_ChNbYmin); h_his0->SetMaximum(fD_MCs_ChNbYmax);}}
08950   
08951   if(HistoCode == "D_MCs_ChDs"){
08952     if(fD_MCs_ChDsYmin < fD_MCs_ChDsYmax){xFlagAutoYsupMargin = 0;
08953     h_his0->SetMinimum(fD_MCs_ChDsYmin); h_his0->SetMaximum(fD_MCs_ChDsYmax);}}
08954   
08955   if(HistoCode == "D_LFN_ChNb"){
08956     if(fD_LFN_ChNbYmin < fD_LFN_ChNbYmax){xFlagAutoYsupMargin = 0;
08957     h_his0->SetMinimum(fD_LFN_ChNbYmin); h_his0->SetMaximum(fD_LFN_ChNbYmax);}}
08958   
08959   if(HistoCode == "D_LFN_ChDs"){
08960     if(fD_LFN_ChDsYmin < fD_LFN_ChDsYmax){xFlagAutoYsupMargin = 0;
08961     h_his0->SetMinimum(fD_LFN_ChDsYmin); h_his0->SetMaximum(fD_LFN_ChDsYmax);}}
08962   
08963   if(HistoCode == "D_HFN_ChNb"){
08964     if(fD_HFN_ChNbYmin < fD_HFN_ChNbYmax){xFlagAutoYsupMargin = 0;
08965     h_his0->SetMinimum(fD_HFN_ChNbYmin); h_his0->SetMaximum(fD_HFN_ChNbYmax);}}
08966   
08967   if(HistoCode == "D_HFN_ChDs"){
08968     if(fD_HFN_ChDsYmin < fD_HFN_ChDsYmax){xFlagAutoYsupMargin = 0;
08969     h_his0->SetMinimum(fD_HFN_ChDsYmin); h_his0->SetMaximum(fD_HFN_ChDsYmax);}}
08970 
08971   if(HistoCode == "D_SCs_ChNb"){
08972     if(fD_SCs_ChNbYmin < fD_SCs_ChNbYmax){xFlagAutoYsupMargin = 0;
08973     h_his0->SetMinimum(fD_SCs_ChNbYmin); h_his0->SetMaximum(fD_SCs_ChNbYmax);}}
08974   
08975   if(HistoCode == "D_SCs_ChDs"){
08976     if(fD_SCs_ChDsYmin < fD_SCs_ChDsYmax){xFlagAutoYsupMargin = 0;
08977     h_his0->SetMinimum(fD_SCs_ChDsYmin); h_his0->SetMaximum(fD_SCs_ChDsYmax);}}
08978   
08979   if(HistoCode == "D_MSp_SpNb"){
08980     if(fD_MSp_SpNbYmin < fD_MSp_SpNbYmax){xFlagAutoYsupMargin = 0;
08981     h_his0->SetMinimum(fD_MSp_SpNbYmin); h_his0->SetMaximum(fD_MSp_SpNbYmax);}}
08982    
08983   if(HistoCode == "D_MSp_SpDs"){
08984     if(fD_MSp_SpDsYmin < fD_MSp_SpDsYmax){xFlagAutoYsupMargin = 0;
08985     h_his0->SetMinimum(fD_MSp_SpDsYmin); h_his0->SetMaximum(fD_MSp_SpDsYmax);}}
08986    
08987   if(HistoCode == "D_SSp_SpNb"){
08988     if(fD_SSp_SpNbYmin < fD_SSp_SpNbYmax){xFlagAutoYsupMargin = 0;
08989     h_his0->SetMinimum(fD_SSp_SpNbYmin); h_his0->SetMaximum(fD_SSp_SpNbYmax);}}
08990    
08991   if(HistoCode == "D_SSp_SpDs"){
08992     if(fD_SSp_SpDsYmin < fD_SSp_SpDsYmax){xFlagAutoYsupMargin = 0;
08993     h_his0->SetMinimum(fD_SSp_SpDsYmin); h_his0->SetMaximum(fD_SSp_SpDsYmax);}}
08994   
08995   if(HistoCode == "D_Adc_EvNb"){
08996     if(fD_Adc_EvNbYmin < fD_Adc_EvNbYmax){xFlagAutoYsupMargin = 0;
08997     h_his0->SetMinimum(fD_Adc_EvNbYmin); h_his0->SetMaximum(fD_Adc_EvNbYmax);}}
08998 
08999   if(HistoCode == "D_Adc_EvDs"){
09000     if(fD_Adc_EvDsYmin < fD_Adc_EvDsYmax){xFlagAutoYsupMargin = 0;
09001     h_his0->SetMinimum(fD_Adc_EvDsYmin); h_his0->SetMaximum(fD_Adc_EvDsYmax);}}
09002 
09003   if(HistoCode == "H2CorccInStins"){
09004     if(fH2CorccInStinsYmin < fH2CorccInStinsYmax){xFlagAutoYsupMargin = 0;
09005     h_his0->SetMinimum(fH2CorccInStinsYmin); h_his0->SetMaximum(fH2CorccInStinsYmax);}}
09006 
09007   if(HistoCode == "H2LFccMosMatrix"){
09008     if(fH2LFccMosMatrixYmin < fH2LFccMosMatrixYmax){xFlagAutoYsupMargin = 0;
09009     h_his0->SetMinimum(fH2LFccMosMatrixYmin); h_his0->SetMaximum(fH2LFccMosMatrixYmax);}}
09010 
09011   if(HistoCode == "H2HFccMosMatrix"){
09012     if(fH2HFccMosMatrixYmin < fH2HFccMosMatrixYmax){xFlagAutoYsupMargin = 0;
09013     h_his0->SetMinimum(fH2HFccMosMatrixYmin); h_his0->SetMaximum(fH2HFccMosMatrixYmax);}}
09014 
09015   if(HistoCode == "H_Ped_RuDs"){
09016     if(fH_Ped_RuDsYmin < fH_Ped_RuDsYmax){xFlagAutoYsupMargin = 0;
09017     h_his0->SetMinimum(fH_Ped_RuDsYmin); h_his0->SetMaximum(fH_Ped_RuDsYmax);}}
09018 
09019   if(HistoCode == "H_TNo_RuDs"){
09020     if(fH_TNo_RuDsYmin < fH_TNo_RuDsYmax){xFlagAutoYsupMargin = 0;
09021     h_his0->SetMinimum(fH_TNo_RuDsYmin); h_his0->SetMaximum(fH_TNo_RuDsYmax);}}
09022 
09023   if(HistoCode == "H_MCs_RuDs"){
09024     if(fH_MCs_RuDsYmin < fH_MCs_RuDsYmax){xFlagAutoYsupMargin = 0;
09025     h_his0->SetMinimum(fH_MCs_RuDsYmin); h_his0->SetMaximum(fH_MCs_RuDsYmax);}}
09026 
09027   if(HistoCode == "H_LFN_RuDs"){
09028     if(fH_LFN_RuDsYmin < fH_LFN_RuDsYmax){xFlagAutoYsupMargin = 0;
09029     h_his0->SetMinimum(fH_LFN_RuDsYmin); h_his0->SetMaximum(fH_LFN_RuDsYmax);}}
09030 
09031   if(HistoCode == "H_HFN_RuDs"){
09032     if(fH_HFN_RuDsYmin < fH_HFN_RuDsYmax){xFlagAutoYsupMargin = 0;
09033     h_his0->SetMinimum(fH_HFN_RuDsYmin); h_his0->SetMaximum(fH_HFN_RuDsYmax);}}
09034 
09035   if(HistoCode == "H_SCs_RuDs"){
09036     if(fH_SCs_RuDsYmin < fH_SCs_RuDsYmax){xFlagAutoYsupMargin = 0;
09037     h_his0->SetMinimum(fH_SCs_RuDsYmin); h_his0->SetMaximum(fH_SCs_RuDsYmax);}}
09038 
09039   return xFlagAutoYsupMargin;  
09040 } // end of  SetHistoFrameYminYmaxFromMemo
09041 
09042 Int_t TEcnaHistos::SetGraphFrameYminYmaxFromMemo(TGraph* g_graph0, const TString HistoCode)
09043 {
09044 // Set min and max according to HistoCode
09045   
09046   Int_t xFlagAutoYsupMargin = 1;    // DEFAULT: 1 = min and max calulated by ROOT, 0 = by this code 
09047 
09048   if(HistoCode == "H_Ped_Date"){
09049     if(fH_Ped_DateYmin < fH_Ped_DateYmax){xFlagAutoYsupMargin = 0;
09050     g_graph0->SetMinimum(fH_Ped_DateYmin); g_graph0->SetMaximum(fH_Ped_DateYmax);}}
09051 
09052   if(HistoCode == "H_TNo_Date"){
09053     if(fH_TNo_DateYmin < fH_TNo_DateYmax){xFlagAutoYsupMargin = 0;
09054     g_graph0->SetMinimum(fH_TNo_DateYmin); g_graph0->SetMaximum(fH_TNo_DateYmax);}}
09055 
09056   if(HistoCode == "H_MCs_Date"){
09057     if(fH_MCs_DateYmin < fH_MCs_DateYmax){xFlagAutoYsupMargin = 0;
09058     g_graph0->SetMinimum(fH_MCs_DateYmin); g_graph0->SetMaximum(fH_MCs_DateYmax);}}
09059 
09060   if(HistoCode == "H_LFN_Date"){
09061     if(fH_LFN_DateYmin < fH_LFN_DateYmax){xFlagAutoYsupMargin = 0;
09062     g_graph0->SetMinimum(fH_LFN_DateYmin); g_graph0->SetMaximum(fH_LFN_DateYmax);}}
09063 
09064   if(HistoCode == "H_HFN_Date"){
09065     if(fH_HFN_DateYmin < fH_HFN_DateYmax){xFlagAutoYsupMargin = 0;
09066     g_graph0->SetMinimum(fH_HFN_DateYmin); g_graph0->SetMaximum(fH_HFN_DateYmax);}}
09067 
09068   if(HistoCode == "H_SCs_Date"){
09069     if(fH_SCs_DateYmin < fH_SCs_DateYmax){xFlagAutoYsupMargin = 0;
09070     g_graph0->SetMinimum(fH_SCs_DateYmin); g_graph0->SetMaximum(fH_SCs_DateYmax);}}
09071 
09072   return xFlagAutoYsupMargin;  
09073 } // end of SetGraphFrameYminYmaxFromMemo
09074 
09075 //..............................................................................................
09076 Double_t TEcnaHistos::GetYminFromHistoFrameAndMarginValue(TH1D* h_his0, const Double_t margin_factor)
09077 {
09078 //Calculation for automatic minimum with margin
09079   Double_t minproj = h_his0->GetMinimum();
09080   Double_t maxproj = h_his0->GetMaximum();
09081   minproj = minproj - (maxproj-minproj)*margin_factor;
09082   return minproj;
09083 }
09084 
09085 Double_t TEcnaHistos::GetYmaxFromHistoFrameAndMarginValue(TH1D* h_his0, const Double_t margin_factor)
09086 {
09087 //Calculation for automatic maximum with margin
09088   Double_t minproj = h_his0->GetMinimum();
09089   Double_t maxproj = h_his0->GetMaximum();
09090   maxproj = maxproj + (maxproj-minproj)*margin_factor;
09091   return maxproj;
09092 }
09093 
09094 Double_t TEcnaHistos::GetYminFromGraphFrameAndMarginValue(TGraph* g_graph0, const Double_t margin_factor)
09095 {
09096 //Calculation for automatic minimum with margin
09097   Double_t graph_ymin = g_graph0->GetY()[0];
09098   for(Int_t i=1; i<g_graph0->GetN(); i++)
09099     {if( g_graph0->GetY()[i] < graph_ymin ){graph_ymin = g_graph0->GetY()[i];}}
09100 
09101   Double_t graph_ymax = g_graph0->GetY()[0];
09102   for(Int_t i=1; i<g_graph0->GetN(); i++)
09103     {if( g_graph0->GetY()[i] > graph_ymax ){graph_ymax = g_graph0->GetY()[i];}}
09104 
09105   graph_ymin = graph_ymin - (graph_ymax-graph_ymin)*margin_factor;
09106   return graph_ymin;
09107 }
09108 Double_t TEcnaHistos::GetYmaxFromGraphFrameAndMarginValue(TGraph* g_graph0, const Double_t margin_factor)
09109 {
09110 //Calculation for automatic maximum with margin
09111   Double_t graph_ymin = g_graph0->GetY()[0];
09112   for(Int_t i=1; i<g_graph0->GetN(); i++)
09113     {if( g_graph0->GetY()[i] < graph_ymin ){graph_ymin = g_graph0->GetY()[i];}}
09114 
09115   Double_t graph_ymax = g_graph0->GetY()[0];
09116   for(Int_t i=1; i<g_graph0->GetN(); i++)
09117     {if( g_graph0->GetY()[i] > graph_ymax ){graph_ymax = g_graph0->GetY()[i];}}
09118 
09119   graph_ymax = graph_ymax + (graph_ymax-graph_ymin)*margin_factor;
09120   return graph_ymax;
09121 }
09122 //----------------------------------------------- HistoPlot
09123 
09124 void TEcnaHistos::HistoPlot(TH1D* h_his0,               const Int_t&   HisSize,  
09125                             const Axis_t& xinf_his,     const Axis_t&  xsup_his,
09126                             const TString HistoCode,    const TString  HistoType,
09127                             const Int_t&  StexStin_A,   const Int_t&   i0StinEcha,  const Int_t& i0Sample, 
09128                             const Int_t&  opt_scale_x,  const Int_t&   opt_scale_y,
09129                             const TString opt_plot,     const Int_t&   arg_AlreadyRead,
09130                             const Int_t&  xFlagAutoYsupMargin)
09131 {
09132   // Plot 1D histogram
09133 
09134   UInt_t canv_w = fCnaParHistos->SetCanvasWidth(HistoCode.Data(), opt_plot);
09135   UInt_t canv_h = fCnaParHistos->SetCanvasHeight(HistoCode.Data(), opt_plot);
09136 
09137   TString QuantityName = "                                ";
09138   Int_t MaxCar = fgMaxCar;
09139   QuantityName.Resize(MaxCar);
09140   QuantityName = fCnaParHistos->GetQuantityName(HistoCode.Data());
09141 
09142 
09143   if( arg_AlreadyRead == 0 || arg_AlreadyRead == 1 )
09144     {
09145       SetHistoPresentation(h_his0, HistoType.Data(), opt_plot);    // (gStyle parameters)
09146       //.................................................. prepa paves commentaires (HistoPlot)
09147       SetAllPavesViewHisto(HistoCode.Data(), StexStin_A, i0StinEcha, i0Sample, opt_plot.Data(), arg_AlreadyRead);
09148     }
09149   
09150   //..................................................... Canvas name (HistoPlot) 
09151   TString canvas_name = SetCanvasName(HistoCode.Data(), opt_scale_x, opt_scale_y,
09152                                       opt_plot.Data(),  arg_AlreadyRead, 
09153                                       StexStin_A,       i0StinEcha,  i0Sample);
09154   //..................................................... Canvas allocations (HistoPlot)
09155   TCanvas* MainCanvas = 0;
09156 
09157   if(opt_plot == fOnlyOnePlot && (arg_AlreadyRead == 0 || arg_AlreadyRead == 1 ) )
09158     {
09159       MainCanvas = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w , canv_h);   fCnewRoot++;
09160       fCurrentPad = gPad; fCurrentCanvas = MainCanvas; fCurrentCanvasName = canvas_name.Data();
09161     }
09162   
09163   if( opt_plot == fSeveralPlot ||  opt_plot == fSameOnePlot)
09164     {if(GetMemoFlag(HistoCode, opt_plot) == "Free")
09165       {MainCanvas = CreateCanvas(HistoCode, opt_plot, canvas_name, canv_w, canv_h);
09166       fCurrentPad = gPad; fCurrentCanvas = MainCanvas; fCurrentCanvasName = canvas_name.Data();}}
09167 
09168   // cout << "*TEcnaHistos::HistoPlot(...)> Plot is displayed on canvas ----> " << canvas_name.Data() << endl;
09169 
09170   //--------------- EE => SC for construction, EB => Xtal in SM (default: Stin ECNA number, i0StinEcha)
09171   Int_t Stex_StinCons = StexStin_A;   // Stex_StinCons = Tower for EB, SC for construction for EE
09172   Int_t n1StexCrys    = i0StinEcha+1; // n1StexCrys = Crys in SM for EB, ECNA
09173 
09174   if( StexStin_A >= 1 && StexStin_A <= fEcal->MaxStinEcnaInStex() )
09175     {
09176       if( fFlagSubDet == "EB" )
09177         {n1StexCrys  = fEcalNumbering->Get1StexCrysFrom1StexStinAnd0StinEcha(StexStin_A, i0StinEcha, fFapStexNumber);}
09178       if( fFlagSubDet == "EE" )
09179         {Stex_StinCons = fEcalNumbering->GetDeeSCConsFrom1DeeSCEcna(fFapStexNumber, StexStin_A);}
09180     }
09181 
09182   //------ String for StexNumber ( to display "EB" or "EE" if Stex = 0 )
09183   TString sFapStexNumber = StexNumberToString(fFapStexNumber);
09184 
09185   //============================================================================= (HistoPlot)
09186   //
09187   //     1st  OPERATIONS:  Pave texts preparation and first Draw.
09188   //                       SetParametersCanvas
09189   //                       Set Memo Flags.
09190   //                       Set main_subpad and main_pavtxt
09191   //
09192   //=============================================================================
09193   TVirtualPad* main_subpad = 0; // main_subpad: Pad for the histo
09194   TPaveText*   main_pavtxt = 0; // Pave for the "Several Changing" parameters (options SAME and SAME n)
09195 
09196   Int_t xMemoPlotSame = 1; // a priori ==> SAME plot
09197 
09198   //========================================= Option ONLYONE    (HistoPlot)
09199   if( opt_plot == fOnlyOnePlot )
09200     {
09201       if( arg_AlreadyRead == 0 || arg_AlreadyRead == 1 )
09202         {
09203           //.................................... Draw titles and paves (pad = main canvas)
09204           if( fPavComGeneralTitle != 0 ){fPavComGeneralTitle->Draw();}
09205           fPavComStex->Draw();
09206           if( !( HistoType == "Global" || HistoType == "Proj" ) ){fPavComStin->Draw(); fPavComXtal->Draw();}
09207 
09208           if( HistoType == "EvolProj" )
09209             {
09210               fPavComEvolRuns->Draw();
09211               fPavComEvolNbOfEvtsAna->Draw();
09212             }
09213           else
09214             {
09215               fPavComAnaRun->Draw();
09216               fPavComNbOfEvts->Draw();
09217             }
09218 
09219           Double_t x_low = fCnaParHistos->BoxLeftX("bottom_left_box")    - 0.005;
09220           Double_t x_up  = fCnaParHistos->BoxRightX("bottom_right_box")  + 0.005;
09221           Double_t y_low = fCnaParHistos->BoxTopY("bottom_right_box")    + 0.005;
09222           Double_t y_up  = fCnaParHistos->BoxBottomY("top_right_box_EB") - 0.005;
09223           Color_t  fond_pad = fCnaParHistos->ColorDefinition("blanc");
09224 
09225           Double_t x_margin = x_low;
09226           Double_t y_margin = y_low;
09227           MainCanvas->Divide( 1,  1, x_margin, y_margin, fond_pad);
09228           //           Divide(nx, ny, x_margin, y_margin,    color);
09229 
09230           gPad->cd(1);
09231           main_subpad = gPad;
09232           main_subpad->SetPad(x_low, y_low, x_up, y_up);
09233         
09234           xMemoPlotSame = 0;
09235         }
09236       if (arg_AlreadyRead > 1 )
09237         {main_subpad = fCurrentPad;}
09238 
09239     } // end of if(opt_plot == fOnlyOnePlot && (arg_AlreadyRead == 0 || arg_AlreadyRead == 1 ) )
09240 
09241   //========================================= Options SAME and SAME n  (HistoPlot)
09242   if( (opt_plot == fSeveralPlot) || (opt_plot == fSameOnePlot) )
09243     {
09244       //..................... First call in options SAME and SAME n
09245       if( GetMemoFlag(HistoCode, opt_plot) == "Free" )
09246         {
09247           //Call to SetParametersPavTxt
09248           //fPavTxt<HISTOCODE> = fPavComSeveralChanging;  => come from SetAllPavesViewHisto
09249           SetParametersPavTxt(HistoCode, opt_plot);
09250 
09251           //---------------- Call to ActivePavTxt
09252           // main_pavtxt = fPavTxt<HISTOCODE>;} (return main_pavtxt)
09253           main_pavtxt = ActivePavTxt(HistoCode.Data(), opt_plot.Data());
09254 
09255           //---------------------------- Set texts for pave "several changing", options SAME and SAME n
09256           if( fPavComGeneralTitle != 0 ){fPavComGeneralTitle->Draw();}
09257 
09258           main_pavtxt->SetTextAlign(fTextPaveAlign);
09259           main_pavtxt->SetTextFont(fTextPaveFont);
09260           main_pavtxt->SetBorderSize(fTextBorderSize);
09261           Float_t cTextPaveSize  = 0.025;
09262           if( HistoType == "H1Basic" || HistoType == "SampProj" || HistoType == "H1BasicProj" ||
09263               HistoType == "Proj"    || HistoType == "EvolProj"  )
09264             {cTextPaveSize = 0.025;}
09265           main_pavtxt->SetTextSize(cTextPaveSize);
09266 
09267           char* f_in = new char[fgMaxCar];                            fCnew++;
09268 
09269           //------------------------------------------------------------ titles pave "several" (HistoPlot)
09270           TString DecalStexName = "";
09271           if( fFlagSubDet == "EB" ){DecalStexName = " ";}
09272           TString DecalStinName = "";
09273           if( fFlagSubDet == "EE" ){DecalStinName = "   ";}
09274 
09275           TString sStexOrStasName = "";
09276           if( fFapStexNumber == 0 ){sStexOrStasName = "  ";}
09277           if( fFapStexNumber != 0 ){sStexOrStasName = fFapStexName;}
09278 
09279           if( opt_plot == fSeveralPlot || opt_plot == fSameOnePlot )
09280             {
09281               if( HistoType == "SampGlobal" )
09282                 {sprintf(f_in, "Analysis   Samp   RUN# (run type            )  Evts range  Nb Evts   %s%s %s%s %s %s Sample",
09283                          DecalStexName.Data(), sStexOrStasName.Data(),
09284                          DecalStinName.Data(), fFapStinName.Data(), fFapXtalName.Data(), fFapEchaName.Data());}
09285               if( HistoType == "SampProj" )
09286                 {sprintf(f_in, "Analysis   Samp   RUN# (run type            )  Evts range  Nb Evts   %s%s %s%s %s %s Sample",
09287                          DecalStexName.Data(), sStexOrStasName.Data(),
09288                          DecalStinName.Data(), fFapStinName.Data(), fFapXtalName.Data(), fFapEchaName.Data());}
09289               if( HistoType == "H1Basic" || HistoType == "H1BasicProj" )
09290                 {sprintf(f_in, "Analysis   Samp   RUN# (run type            )  Evts range  Nb Evts   %s%s %s%s %s %s",
09291                          DecalStexName.Data(), sStexOrStasName.Data(),
09292                          DecalStinName.Data(), fFapStinName.Data(), fFapXtalName.Data(), fFapEchaName.Data());}
09293               if((HistoType == "Global") || (HistoType == "Proj") )
09294                 {sprintf(f_in, "Analysis   Samp   RUN# (run type            )  Evts range  Nb Evts   %s%s",
09295                          DecalStexName.Data(), sStexOrStasName.Data());}
09296 
09297               if( HistoType == "EvolProj" )
09298                 {sprintf(f_in, "Analysis   Samp   Evts range  Nb Evts   %s%s  %s%s %s %s",
09299                          DecalStexName.Data(), sStexOrStasName.Data(),
09300                          DecalStinName.Data(), fFapStinName.Data(), fFapXtalName.Data(), fFapEchaName.Data());}
09301             }
09302 
09303           TText* ttit = main_pavtxt->AddText(f_in);
09304           ttit->SetTextColor(fCnaParHistos->ColorDefinition("noir"));
09305           
09306           //------------------------------------------------------------ values pave "several"  (HistoPlot)
09307 
09308           //.................................... option SAME n only  (HistoPlot)
09309           if( opt_plot == fSameOnePlot)
09310             {
09311               if( (HistoType == "Global") || (HistoType == "Proj") || (HistoType == "H1BasicProj") )
09312                 {
09313                   sprintf(f_in, "%-10s 1-%2d%7d (%-20s) %5d-%5d  %7d  %4s %-25s",
09314                           fFapAnaType.Data(), fFapNbOfSamples, fFapRunNumber, fRunType.Data(),
09315                           fFapFirstReqEvtNumber, fFapLastReqEvtNumber, fFapReqNbOfEvts,
09316                           sFapStexNumber.Data(), QuantityName.Data());
09317                 }
09318 
09319               if( HistoType == "EvolProj" )
09320                 {
09321                   sprintf(f_in, "%-10s 1-%2d %5d-%5d  %7d %5s%6d%7d%7d %-25s",
09322                           fFapAnaType.Data(), fFapNbOfSamples, fFapFirstReqEvtNumber, fFapLastReqEvtNumber, fFapReqNbOfEvts,
09323                           sFapStexNumber.Data(), Stex_StinCons, n1StexCrys, i0StinEcha, QuantityName.Data());
09324                 }
09325               
09326             } // end of if for option SAME n only
09327 
09328           //..................................... option SAME (HistoPlot)
09329           if( opt_plot == fSeveralPlot )
09330             {
09331               Int_t kSample = i0Sample+1;  // Sample number range = [1,n<=10]
09332 
09333               if( HistoType == "SampGlobal" )
09334                 {
09335                   sprintf(f_in, "%-10s 1-%2d%7d (%-20s) %5d-%5d  %7d  %4s%6d%5d%5d%6d",
09336                           fFapAnaType.Data(), fFapNbOfSamples, fFapRunNumber, fRunType.Data(),
09337                           fFapFirstReqEvtNumber, fFapLastReqEvtNumber, fFapReqNbOfEvts,sFapStexNumber.Data(),
09338                           Stex_StinCons, n1StexCrys, i0StinEcha, kSample);
09339                 }
09340               if( HistoType == "SampProj"  )
09341                 {
09342                   sprintf(f_in, "%-10s 1-%2d%7d (%-20s) %5d-%5d  %7d  %4s%6d%5d%5d%6d",
09343                           fFapAnaType.Data(), fFapNbOfSamples, fFapRunNumber, fRunType.Data(),
09344                           fFapFirstReqEvtNumber, fFapLastReqEvtNumber, fFapReqNbOfEvts, sFapStexNumber.Data(),
09345                           Stex_StinCons, n1StexCrys, i0StinEcha, kSample);
09346                 }             
09347               if( HistoType == "H1Basic" || HistoType == "H1BasicProj" )
09348                 {
09349                   sprintf(f_in, "%-10s 1-%2d%7d (%-20s) %5d-%5d  %7d  %4s%6d%5d%5d",
09350                           fFapAnaType.Data(), fFapNbOfSamples, fFapRunNumber, fRunType.Data(),
09351                           fFapFirstReqEvtNumber, fFapLastReqEvtNumber, fFapReqNbOfEvts, sFapStexNumber.Data(),
09352                           Stex_StinCons, n1StexCrys, i0StinEcha);
09353                 }             
09354               if( (HistoType == "Global") || (HistoType == "Proj")  )
09355                 {
09356                   sprintf(f_in, "%-10s 1-%2d%7d (%-20s) %5d-%5d  %7d  %4s",
09357                           fFapAnaType.Data(), fFapNbOfSamples, fFapRunNumber,  fRunType.Data(),
09358                           fFapFirstReqEvtNumber, fFapLastReqEvtNumber, fFapReqNbOfEvts, sFapStexNumber.Data());
09359                 }
09360               
09361               if( HistoType == "EvolProj" )
09362                 {
09363                   sprintf(f_in, "%-10s 1-%2d  %5d-%5d  %7d  %4s%7d%5d%5d",
09364                           fFapAnaType.Data(), fFapNbOfSamples,
09365                           fFapFirstReqEvtNumber, fFapLastReqEvtNumber, fFapReqNbOfEvts, sFapStexNumber.Data(), 
09366                           Stex_StinCons, n1StexCrys, i0StinEcha);
09367                 }
09368             } 
09369           
09370           TText* tt = main_pavtxt->AddText(f_in);
09371           tt->SetTextColor(GetViewHistoColor(HistoCode, opt_plot));
09372           
09373           delete [] f_in;   f_in = 0;                                          fCdelete++;
09374 
09375           //---------------- Draw the "several changing" pave with its text in the Canvas (AT FIRST TIME)
09376           main_pavtxt->Draw();
09377           //---------------- Draw evol run pave if "EvolProj" (AT FIRST TIME)  
09378           if( HistoType == "EvolProj" ){fPavComEvolRuns->Draw();}
09379 
09380           //---------------- Call to SetParametersCanvas
09381           //fImp<HISTOCODE> = (TCanvasImp*)fCanv<HISTOCODE>->GetCanvasImp();
09382           //fCanv<HISTOCODE>->Divide(1, 1, x_margin_factor , y_margin_factor); gPad->cd(1);
09383           //fPad<HISTOCODE> = gPad;
09384           //fMemoPlot<HISTOCODE> = 1;          =======>  set MemoFlag to "Buzy"
09385           //fMemoColor<HISTOCODE> = 0;
09386           SetParametersCanvas(HistoCode, opt_plot);       
09387 
09388           //---------------- Set xMemoPlotSame to 0
09389           xMemoPlotSame = 0;
09390         } // end of if( GetMemoFlag(HistoCode, opt_plot) == "Free" )    (HistoPlot)
09391 
09392       //.......... First and further calls in options SAME and SAME n (fMemoPlot<HISTOCODE> = 1)
09393       if(GetMemoFlag(HistoCode, opt_plot) == "Busy")
09394         {
09395           //---------------- Call to ActivePavTxt
09396           // main_pavtxt = fPavTxt<HISTOCODE>;} (return main_pavtxt)
09397           main_pavtxt = ActivePavTxt(HistoCode.Data(), opt_plot.Data());
09398           
09399           //---------------- Call to ActivePad
09400           main_subpad = ActivePad(HistoCode.Data(), opt_plot.Data());  // => return 0 if canvas has been closed
09401 
09402           //---------------- Recover pointer to the current canvas
09403           MainCanvas = GetCurrentCanvas(HistoCode.Data(), opt_plot.Data());
09404         }
09405     } // end of if( (opt_plot == fSeveralPlot) || (opt_plot == fSameOnePlot) )
09406 
09407 
09408   //============================================================================= (HistoPlot)
09409   //
09410   //     2nd  OPERATIONS: Write and Draw the parameter values in the
09411   //                      "several changing" pave (options SAME and SAME n)
09412   //                      and Draw Histo
09413   //=============================================================================
09414   if(main_subpad != 0)
09415     { 
09416       if( (opt_plot == fSeveralPlot) || (opt_plot == fSameOnePlot) )
09417         {
09418           //------------------------------------------------------------ values  
09419           if(xMemoPlotSame != 0)
09420             {
09421               // main_pavtxt = fPavComSeveralChanging = fPavTxt<HISTOCODE>
09422               main_pavtxt->SetTextAlign(fTextPaveAlign);
09423               main_pavtxt->SetTextFont(fTextPaveFont);
09424               main_pavtxt->SetBorderSize(fTextBorderSize);
09425               Float_t cTextPaveSize  = 0.025;
09426               if( HistoType == "H1Basic" || HistoType == "SampProj"
09427                   || HistoType == "Proj" || HistoType == "EvolProj" || HistoType == "H1BasicProj" )
09428                 {cTextPaveSize = 0.025;}
09429               main_pavtxt->SetTextSize(cTextPaveSize);
09430               
09431               char* f_in = new char[fgMaxCar];                            fCnew++;
09432               
09433               if( opt_plot == fSameOnePlot )
09434                 {
09435                   if( (HistoType == "Global") || (HistoType == "Proj") )
09436                     {
09437                       sprintf(f_in, "%-10s 1-%2d%7d (%-20s) %5d-%5d  %7d  %4s %-25s",
09438                               fFapAnaType.Data(), fFapNbOfSamples, fFapRunNumber, fRunType.Data(),
09439                               fFapFirstReqEvtNumber, fFapLastReqEvtNumber, fFapReqNbOfEvts,
09440                               sFapStexNumber.Data(), QuantityName.Data());
09441                     }
09442 
09443                   if( HistoType == "EvolProj" )
09444                     {
09445                       sprintf(f_in, "%-10s 1-%2d %5d-%5d  %7d %5s%6d%7d%7d %-25s",
09446                               fFapAnaType.Data(), fFapNbOfSamples,
09447                               fFapFirstReqEvtNumber, fFapLastReqEvtNumber, fFapReqNbOfEvts, sFapStexNumber.Data(),
09448                               Stex_StinCons, n1StexCrys, i0StinEcha, QuantityName.Data());
09449                     }
09450                 }
09451 
09452               if( opt_plot == fOnlyOnePlot || opt_plot == fSeveralPlot )
09453                 {
09454                   Int_t kSample = i0Sample+1;  // Sample number range = [1,n<=10] (HistoPlot)
09455 
09456                   if(HistoType == "SampGlobal" )
09457                     {
09458                       sprintf(f_in, "%-10s 1-%2d%7d (%-20s) %5d-%5d  %7d  %4s%6d%5d%5d%6d",
09459                               fFapAnaType.Data(), fFapNbOfSamples, fFapRunNumber, fRunType.Data(),
09460                               fFapFirstReqEvtNumber, fFapLastReqEvtNumber, fFapReqNbOfEvts, sFapStexNumber.Data(),
09461                               Stex_StinCons, n1StexCrys, i0StinEcha, kSample);
09462                     }
09463                   if( HistoType == "SampProj" )
09464                     {
09465                       sprintf(f_in, "%-10s 1-%2d%7d (%-20s) %5d-%5d  %7d  %4s%6d%5d%5d%6d",
09466                               fFapAnaType.Data(), fFapNbOfSamples, fFapRunNumber, fRunType.Data(),
09467                               fFapFirstReqEvtNumber, fFapLastReqEvtNumber, fFapReqNbOfEvts, sFapStexNumber.Data(),
09468                               Stex_StinCons, n1StexCrys, i0StinEcha, kSample);
09469                     }             
09470                   if( HistoType == "H1Basic" || HistoType == "H1BasicProj")
09471                     {
09472                       sprintf(f_in, "%-10s 1-%2d%7d (%-20s) %5d-%5d  %7d  %4s%6d%5d%5d",
09473                               fFapAnaType.Data(), fFapNbOfSamples, fFapRunNumber, fRunType.Data(),
09474                               fFapFirstReqEvtNumber, fFapLastReqEvtNumber, fFapReqNbOfEvts, sFapStexNumber.Data(),
09475                               Stex_StinCons, n1StexCrys, i0StinEcha);
09476                     }
09477                   if( (HistoType == "Global") || (HistoType == "Proj") )
09478                     {
09479                       sprintf(f_in, "%-10s 1-%2d%7d (%-20s) %5d-%5d  %7d  %4s",
09480                               fFapAnaType.Data(), fFapNbOfSamples, fFapRunNumber, fRunType.Data(),
09481                               fFapFirstReqEvtNumber, fFapLastReqEvtNumber, fFapReqNbOfEvts, sFapStexNumber.Data());
09482                     }
09483                   
09484                   if( HistoType == "EvolProj" )
09485                     {
09486                       sprintf(f_in, "%-10s 1-%2d  %5d-%5d  %7d  %4s%7d%5d%5d",
09487                               fFapAnaType.Data(), fFapNbOfSamples,
09488                               fFapFirstReqEvtNumber, fFapLastReqEvtNumber, fFapReqNbOfEvts,
09489                               sFapStexNumber.Data(), Stex_StinCons, n1StexCrys, i0StinEcha);
09490                     }
09491                 }
09492                
09493               TText *tt = main_pavtxt->AddText(f_in);
09494               tt->SetTextColor(GetViewHistoColor(HistoCode, opt_plot));
09495               MainCanvas->cd(); gStyle->SetOptDate(0);
09496               main_pavtxt->Draw();
09497 
09498               delete [] f_in;   f_in = 0;                      fCdelete++;
09499             }
09500           
09501           main_subpad->cd();
09502           Double_t x_low = fCnaParHistos->BoxLeftX("bottom_left_box")   - 0.005;
09503           Double_t x_up  = fCnaParHistos->BoxRightX("bottom_right_box") + 0.005;
09504           Double_t y_low = fCnaParHistos->BoxTopY("several_plots_box")  + 0.005;
09505           Double_t y_up  = fCnaParHistos->BoxBottomY("general_comment") - 0.005;
09506           if( opt_plot == fSameOnePlot && HistoType == "EvolProj" )
09507             {y_up = fCnaParHistos->BoxBottomY("top_left_box_EB") - 0.005;}
09508           main_subpad->SetPad(x_low, y_low, x_up, y_up);          
09509         } // end of if( (opt_plot == fSeveralPlot) || (opt_plot == fSameOnePlot) )
09510 
09511       //............................................ Style      (HistoPlot)
09512       SetViewHistoColors(h_his0, HistoCode.Data(), opt_plot, arg_AlreadyRead);
09513 
09514       //................................. Set axis titles
09515       TString axis_x_var_name = SetHistoXAxisTitle(HistoCode);
09516       TString axis_y_var_name = SetHistoYAxisTitle(HistoCode);
09517       h_his0->GetXaxis()->SetTitle(axis_x_var_name);
09518       h_his0->GetYaxis()->SetTitle(axis_y_var_name);
09519 
09520       Int_t lin_scale = 0;
09521       Int_t log_scale = 1;
09522       
09523       if(opt_scale_x == fOptScaleLinx){gPad->SetLogx(lin_scale);}
09524       if(opt_scale_x == fOptScaleLogx){gPad->SetLogx(log_scale);}
09525       if(opt_scale_y == fOptScaleLiny){gPad->SetLogy(lin_scale);}
09526       if(opt_scale_y == fOptScaleLogy){gPad->SetLogy(log_scale);}             
09527 
09528       //---------------------------------------------------------------- Draw histo     (HistoPlot)
09529       if(opt_plot == fOnlyOnePlot && arg_AlreadyRead == 0 ){h_his0->DrawCopy();}
09530       if(opt_plot == fOnlyOnePlot && arg_AlreadyRead == 1 ){h_his0->DrawCopy();}
09531       if(opt_plot == fOnlyOnePlot && arg_AlreadyRead >  1 ){h_his0->DrawCopy("AHSAME");}
09532 
09533       if(opt_plot == fSeveralPlot || opt_plot == fSameOnePlot)
09534         {
09535           if(xMemoPlotSame == 0){h_his0->DrawCopy();}
09536           if(xMemoPlotSame != 0){h_his0->DrawCopy("SAME");}
09537         }
09538       //----------------------------------------------------------------
09539 
09540       //.................... Horizontal line at y=0     (HistoPlot)
09541       if( !(  HistoCode == "D_Adc_EvDs" || HistoCode == "D_Adc_EvNb" ||
09542               HistoType == "Proj"       || HistoType == "SampProj" ||
09543               HistoType == "EvolProj"   || HistoType == "H1BasicProj"  ) &&
09544           !( HistoType == "H1Basic" && arg_AlreadyRead == 0 ) )
09545         {
09546           Double_t yinf = h_his0->GetMinimum();
09547           Double_t ysup = h_his0->GetMaximum();
09548           if( yinf <= (Double_t)0. && ysup >= (Double_t)0. )
09549             {TLine* lin =  new TLine(0.,0.,(Double_t)HisSize, 0.);   fCnewRoot++;
09550             lin->Draw();}
09551         }
09552 
09553       if( ( opt_plot == fOnlyOnePlot )
09554           || ( (opt_plot == fSeveralPlot || opt_plot == fSameOnePlot) && xMemoPlotSame == 0 ) )
09555         {
09556           Double_t yinf = (Double_t)h_his0->GetMinimum();
09557           Double_t ysup = (Double_t)h_his0->GetMaximum();
09558 
09559           if(xFlagAutoYsupMargin == 1)
09560             {
09561               if( yinf >= ysup ){yinf = (Double_t)0.; ysup += ysup;}  // ROOT default if ymin >= ymax
09562               Double_t MaxMarginFactor = (Double_t)0.05;    // frame top line = 5% above the maximum
09563               ysup += (ysup-yinf)*MaxMarginFactor;       // ROOT default if ymin < ymax
09564             }
09565 
09566           char* f_in = new char[fgMaxCar];               fCnew++;
09567 
09568           //.................... Vertical lines for Data sectors (EE Global plot only)
09569           if( fFlagSubDet == "EE" && fFapStexNumber == 0 )
09570             {
09571               //............................................................. Data Sectors      (HistoPlot)
09572               Color_t coul_DS = fCnaParHistos->ColorDefinition("noir");
09573               Int_t DeeOffset = 0;
09574               for(Int_t n1Dee=1; n1Dee<=4; n1Dee++)
09575                 {
09576                   if( n1Dee == 4 ){DeeOffset = 0;}
09577                   if( n1Dee == 3 ){DeeOffset =   fEcal->MaxSCForConsInDee();}   // 149
09578                   if( n1Dee == 2 ){DeeOffset = 2*fEcal->MaxSCForConsInDee();}   // 446
09579                   if( n1Dee == 1 ){DeeOffset = 3*fEcal->MaxSCForConsInDee();}   // 595
09580 
09581                   Double_t ydee = ysup + (ysup-yinf)/(Double_t)15.;
09582                   Double_t xBinDee = DeeOffset + fEcal->MaxSCForConsInDee()/(Double_t)2.;
09583                   sprintf( f_in, "D%d", n1Dee );
09584                   TText *text_Dee = new TText(xBinDee, ydee, f_in);  fCnewRoot++;
09585                   text_Dee->SetTextColor(coul_DS);
09586                   text_Dee->SetTextSize((Double_t)0.04);
09587                   text_Dee->Draw("SAME");
09588 
09589                   Double_t DSLabelOffset = (Double_t)12;
09590 
09591                   for(Int_t i=1; i<5; i++)
09592                     {
09593                       Int_t iDS = 0;
09594                       if( n1Dee == 1 ){iDS = i;}
09595                       if( n1Dee == 2 ){iDS = i+4;}
09596                       if( n1Dee == 3 ){iDS = i+5;}
09597                       if( n1Dee == 4 ){iDS = i+1;}
09598 
09599                       Double_t xBinDS = DeeOffset + (Double_t)GetDSOffset(n1Dee, iDS)/fEcal->MaxCrysInSC();
09600                       TLine* lin_DS = new TLine(xBinDS, yinf, xBinDS, ysup);   fCnewRoot++;
09601                       lin_DS->SetLineColor(coul_DS);
09602                       lin_DS->SetLineWidth(1);
09603                       lin_DS->SetLineStyle(2);
09604                       lin_DS->Draw();
09605 
09606                       if( n1Dee == 2 && i == 4 )
09607                         {
09608                           TLine* lin_DSp = new TLine(DeeOffset, yinf, DeeOffset, ysup);   fCnewRoot++;
09609                           lin_DSp->SetLineColor(coul_DS);
09610                           lin_DSp->SetLineWidth(1);
09611                           lin_DSp->SetLineStyle(2);
09612                           lin_DSp->Draw();
09613                         }
09614 
09615                       Double_t yds = ysup + (ysup-yinf)/(Double_t)50.;
09616                       Double_t xBinDSp = xBinDS + DSLabelOffset;
09617                       Int_t nDS = iDS;
09618 
09619                       sprintf( f_in, "S%d", nDS );
09620                       TText *text_DS = new TText(xBinDSp, yds, f_in);  fCnewRoot++;
09621                       text_DS->SetTextColor(coul_DS);
09622                       text_DS->SetTextSize((Double_t)0.03);
09623                       text_DS->Draw("SAME");
09624                       if( (n1Dee == 4 && i == 1) || (n1Dee == 2 && i == 4) )
09625                         {
09626                           if(n1Dee == 4){nDS = iDS-1;}
09627                           if(n1Dee == 2){nDS = iDS+1;}
09628                           sprintf( f_in, "S%d", nDS );
09629                           TText *text_DS = new TText(xBinDS-1.75*DSLabelOffset, yds, f_in);  fCnewRoot++;
09630                           text_DS->SetTextColor(coul_DS);
09631                           text_DS->SetTextSize((Double_t)0.03);
09632                           text_DS->Draw("SAME");
09633                         }
09634                     }
09635                 }
09636             }
09637 
09638           //........... Vertical lines for Data sectors and special SC's (EE only, Dee's Global plots)  (HistoPlot)
09639           if( fFlagSubDet == "EE" && fFapStexNumber > 0 )
09640             {
09641               if( HistoType == "Global" )
09642                 {
09643                   Double_t ytext = yinf - (ysup-yinf)/8.5;                
09644                   //............................................................. Data Sectors
09645                   Color_t coul_DS = fCnaParHistos->ColorDefinition("noir");
09646                   for(Int_t i=1; i<5; i++)
09647                     {
09648                       Int_t iDS = 0;
09649                       if( fFapStexNumber == 1 ){iDS = i;}
09650                       if( fFapStexNumber == 2 ){iDS = i+4;}
09651                       if( fFapStexNumber == 3 ){iDS = i+5;}
09652                       if( fFapStexNumber == 4 ){iDS = i+1;}
09653                       
09654                       Double_t xBinDS = (Double_t)GetDSOffset(fFapStexNumber, iDS);
09655                       TLine* lin_DS = new TLine(xBinDS, yinf, xBinDS, ysup);   fCnewRoot++;
09656                       lin_DS->SetLineColor(coul_DS);
09657                       lin_DS->SetLineWidth(2);
09658                       lin_DS->SetLineStyle(2);
09659                       lin_DS->Draw();
09660                       Double_t ytextds = ysup + (ysup-yinf)/30.;
09661                       Double_t xBinDSNumber =
09662                         xBinDS + fEcalNumbering->GetMaxSCInDS(iDS)*fEcal->MaxCrysInSC()/(Double_t)2.25;
09663                       sprintf( f_in, "S%d", iDS );
09664                       TText *text_DS = new TText(xBinDSNumber, ytextds, f_in);  fCnewRoot++;
09665                       text_DS->SetTextColor(coul_DS);
09666                       text_DS->SetTextSize((Double_t)0.04);
09667                       text_DS->Draw("SAME");
09668                       if( ( (fFapStexNumber == 1 || fFapStexNumber == 2 ) && i == 4 ) ||
09669                           ( (fFapStexNumber == 3 || fFapStexNumber == 4 ) && i == 1 ) )
09670                         {
09671                           Int_t iDSp = iDS;
09672                           if( i == 4 ){iDSp = iDS+1;}
09673                           if( i == 1 ){iDSp = iDS-1;}
09674                           sprintf( f_in, "S%d", iDSp);
09675                           Double_t xBinpDSNumber =
09676                             xBinDSNumber - fEcalNumbering->GetMaxSCInDS(iDS)*fEcal->MaxCrysInSC();
09677                           TText *text_DSp = new TText(xBinpDSNumber, ytextds, f_in);  fCnewRoot++;
09678                           text_DSp->SetTextColor(coul_DS);
09679                           text_DSp->SetTextSize((Double_t)0.04);
09680                           text_DSp->Draw("SAME");
09681                         }
09682                     }
09683                   //.............................................................. Vertical lines for SC's
09684                   //                                                       Trop serre. A garder en reserve.
09685                   //for(Int_t i=0; i<fEcal->MaxSCForConsInDee(); i++)
09686                   //  {
09687                   //    Double_t xBinSC =(Double_t)(fEcal->MaxCrysInSC()*i);
09688                   //    TLine* lin_SC = new TLine(xBinSC, yinf, xBinSC, ysup);  fCnewRoot++;
09689                   //    lin_SC->SetLineColor(coul_DS);
09690                   //    lin_SC->SetLineStyle(3);
09691                   //    lin_SC->Draw();
09692                   //  }
09693                   //............................................................... Not connected SC's
09694                   Color_t coul_notconnected = fCnaParHistos->ColorDefinition("bleu_fonce");
09695                   for(Int_t i=1; i<=fEcal->NumberOfNotConnectedSCs(); i++)
09696                     {
09697                       Int_t index = 0;
09698                       if( fFapStexNumber == 1 || fFapStexNumber == 3 ){index = 2*i - 1;}
09699                       if( fFapStexNumber == 2 || fFapStexNumber == 4 ){index = 2*i;}
09700                       //................. display of the not connected SC's numbers (+ vertical line)
09701                       Double_t xBinNotConnectedSC = NotConnectedSCH1DBin(index);
09702                       TLine* lin_notconnected =
09703                         new TLine(xBinNotConnectedSC, yinf, xBinNotConnectedSC, ysup);  fCnewRoot++;
09704                       lin_notconnected->SetLineColor(coul_notconnected);
09705                       lin_notconnected->SetLineStyle(3);
09706                       lin_notconnected->Draw();
09707                       
09708                       Double_t xBinNotConnectedSCEnd = NotConnectedSCH1DBin(index)+fEcal->MaxCrysInSC();
09709                       TLine* lin_notconnected_end =
09710                         new TLine(xBinNotConnectedSCEnd, yinf, xBinNotConnectedSCEnd, ysup); fCnewRoot++;
09711                       lin_notconnected_end->SetLineColor(coul_notconnected);
09712                       lin_notconnected_end->SetLineStyle(3);
09713                       lin_notconnected_end->Draw();
09714                       
09715                       //sprintf( f_in, "%d", GetNotConnectedSCForConsFromIndex(index) );
09716                       sprintf( f_in, "%d", GetNotConnectedDSSCFromIndex(index) );
09717                       TText *text_SC_NotConnected = new TText(xBinNotConnectedSC, ytext, f_in);  fCnewRoot++;
09718                       text_SC_NotConnected->SetTextAngle((Double_t)45.);
09719                       text_SC_NotConnected->SetTextColor(coul_notconnected);
09720                       text_SC_NotConnected->SetTextFont(42);
09721                       text_SC_NotConnected->SetTextSize((Double_t)0.03);
09722                       text_SC_NotConnected->Draw("SAME");
09723                     }
09724                   //Double_t xtext = xinf_his - (xsup_his-xinf_his)/8.;
09725                   //Double_t ytextp = yinf - (ysup-yinf)/6.;
09726                   //sprintf( f_in, "Special SC => ");
09727                   //TText *text_legend_NotConnected = new TText(xtext, ytext, f_in);  fCnewRoot++;
09728                   //text_legend_NotConnected->SetTextColor(coul_notconnected);
09729                   //text_legend_NotConnected->SetTextSize((Double_t)0.03);
09730                   //text_legend_NotConnected->Draw("SAME");
09731                   
09732                   //............................................................... Not complete SC's
09733                   Color_t coul_notcomplete = fCnaParHistos->ColorDefinition("rouge40");
09734                   for(Int_t i=1; i<=fEcal->NumberOfNotCompleteSCs(); i++)
09735                     {
09736                       Int_t index = 0;
09737                       if( fFapStexNumber == 1 || fFapStexNumber == 3 ){index = 2*i - 1;}
09738                       if( fFapStexNumber == 2 || fFapStexNumber == 4 ){index = 2*i;}
09739                       //................. display of the not complete SC's numbers (+ vertical line)
09740                       Double_t xBinNotCompleteSC = NotCompleteSCH1DBin(index);
09741                       TLine* lin_notcomplete =
09742                         new TLine(xBinNotCompleteSC, yinf, xBinNotCompleteSC, ysup);   fCnewRoot++;
09743                       lin_notcomplete->SetLineColor(coul_notcomplete);
09744                       lin_notcomplete->SetLineStyle(3);
09745                       lin_notcomplete->Draw();
09746                       
09747                       Double_t xBinNotCompleteSCEnd = NotCompleteSCH1DBin(index)+fEcal->MaxCrysInSC();;
09748                       TLine* lin_notcomplete_end =
09749                         new TLine(xBinNotCompleteSCEnd, yinf, xBinNotCompleteSCEnd, ysup);   fCnewRoot++;
09750                       lin_notcomplete_end->SetLineColor(coul_notcomplete);
09751                       lin_notcomplete_end->SetLineStyle(3);
09752                       lin_notcomplete_end->Draw();
09753 
09754                       sprintf( f_in, "%d", GetNotCompleteDSSCFromIndex(index) );
09755                       // sprintf( f_in, "%d", GetNotCompleteSCForConsFromIndex(index) );
09756                       TText *text_SC_NotComplete = new TText(xBinNotCompleteSC, ytext, f_in);  fCnewRoot++;
09757                       text_SC_NotComplete->SetTextAngle((Double_t)45.);
09758                       text_SC_NotComplete->SetTextColor(coul_notcomplete);
09759                       text_SC_NotComplete->SetTextFont(42);
09760                       text_SC_NotComplete->SetTextSize((Double_t)0.03);
09761                       text_SC_NotComplete->Draw("SAME");
09762                     }
09763                   //Double_t xtextp = xinf_his + (xsup_his-xinf_his)/15.;
09764                   //sprintf( f_in, "Not complete SC");
09765                   //TText *text_legend_NotComplete = new TText(xtextp, ytextp, f_in);  fCnewRoot++;
09766                   //text_legend_NotComplete->SetTextColor(coul_notcomplete);
09767                   //text_legend_NotComplete->SetTextSize((Double_t)0.03);
09768                   //text_legend_NotComplete->Draw("SAME");
09769                 }
09770             }
09771           delete [] f_in;   f_in = 0;                      fCdelete++;
09772         } // end of if( ( opt_plot == fOnlyOnePlot )
09773           // || ( (opt_plot == fSeveralPlot || opt_plot == fSameOnePlot) && xMemoPlotSame == 0 ) )
09774 
09775       //..............................................Top Axis (HistoPlot)
09776       Int_t min_value = 0;
09777       Int_t max_value = 0;
09778       if(HistoType == "Global")
09779         {
09780           if( fFapStexNumber > 0 )
09781             {
09782               //.......................... Axis for the Stin numbers and Data sectors (EE) numbers
09783               if( fFlagSubDet == "EB" )
09784                 {
09785                   min_value = 0;
09786                   max_value = fEcal->MaxStinEcnaInStex() - 1;
09787                 }
09788               if( fFlagSubDet == "EE" )
09789                 {
09790                   if( fFapStexNumber == 1 ){min_value = 1; max_value = 5;}
09791                   if( fFapStexNumber == 2 ){min_value = 5; max_value = 9;}
09792                   if( fFapStexNumber == 3 ){min_value = 5; max_value = 9;}
09793                   if( fFapStexNumber == 4 ){min_value = 1; max_value = 5;}
09794                 }
09795             }
09796           if( fFapStexNumber == 0 )
09797             {
09798               //.......................... Axis for the SM (EB) and Dee numbers (EE)
09799               if( fFlagSubDet == "EB" )
09800                 {
09801                   min_value = 0; 
09802                   max_value = fEcal->MaxStexInStas() - 1;
09803                 }
09804               if( fFlagSubDet == "EE" )
09805                 {
09806                   min_value = 1; 
09807                   max_value = fEcal->MaxStexInStas();
09808                 }
09809             }
09810           TopAxisForHistos(h_his0, opt_plot, xMemoPlotSame, min_value, max_value,
09811                            xFlagAutoYsupMargin, HisSize);
09812         } // end of if (HistoType == "Global")
09813 
09814       if( !( (HistoType == "H1Basic" || HistoType == "H1BasicProj")
09815              && ( arg_AlreadyRead > 1 && arg_AlreadyRead < fEcal->MaxCrysInStin() ) ) )
09816         {
09817           gPad->Update();
09818         }
09819     }
09820   else    // else du if(main_subpad !=0)
09821     {
09822       cout << "*TEcnaHistos::HistoPlot(...)> Canvas not found. Previously closed in option SAME."
09823            << fTTBELL << endl;
09824 
09825       ReInitCanvas(HistoCode, opt_plot);
09826       xMemoPlotSame = 0;
09827     }
09828 
09829   //  delete MainCanvas;                  fCdeleteRoot++;
09830 
09831 } // end of HistoPlot
09832 
09833 
09834 TString TEcnaHistos::StexNumberToString(const Int_t& StexNumber)
09835 {
09836   // Convert Int_t StexNumber into TString: "StexNumber" if StexNumber in [-18,36]
09837   // or into TString: "EB" or "EE" if StexNumber = 0. 
09838 
09839   TString sFapStexNumber = "?";
09840   if( StexNumber ==  -1 ){sFapStexNumber = " -1";}
09841   if( StexNumber ==  -2 ){sFapStexNumber = " -2";}
09842   if( StexNumber ==  -3 ){sFapStexNumber = " -3";}
09843   if( StexNumber ==  -4 ){sFapStexNumber = " -4";}
09844   if( StexNumber ==  -5 ){sFapStexNumber = " -5";}
09845   if( StexNumber ==  -6 ){sFapStexNumber = " -6";}
09846   if( StexNumber ==  -7 ){sFapStexNumber = " -7";}
09847   if( StexNumber ==  -8 ){sFapStexNumber = " -8";}
09848   if( StexNumber ==  -9 ){sFapStexNumber = " -9";}
09849   if( StexNumber == -10 ){sFapStexNumber = "-10";}
09850   if( StexNumber == -11 ){sFapStexNumber = "-11";}
09851   if( StexNumber == -12 ){sFapStexNumber = "-12";}
09852   if( StexNumber == -13 ){sFapStexNumber = "-13";}
09853   if( StexNumber == -14 ){sFapStexNumber = "-14";}
09854   if( StexNumber == -15 ){sFapStexNumber = "-15";}
09855   if( StexNumber == -16 ){sFapStexNumber = "-16";}
09856   if( StexNumber == -17 ){sFapStexNumber = "-17";}
09857   if( StexNumber == -18 ){sFapStexNumber = "-18";}
09858   if( StexNumber ==  0 ){sFapStexNumber = fFlagSubDet;}
09859   if( StexNumber ==  1 ){sFapStexNumber = "  1";}
09860   if( StexNumber ==  2 ){sFapStexNumber = "  2";}
09861   if( StexNumber ==  3 ){sFapStexNumber = "  3";}
09862   if( StexNumber ==  4 ){sFapStexNumber = "  4";}
09863   if( StexNumber ==  5 ){sFapStexNumber = "  5";}
09864   if( StexNumber ==  6 ){sFapStexNumber = "  6";}
09865   if( StexNumber ==  7 ){sFapStexNumber = "  7";}
09866   if( StexNumber ==  8 ){sFapStexNumber = "  8";}
09867   if( StexNumber ==  9 ){sFapStexNumber = "  9";}
09868   if( StexNumber == 10 ){sFapStexNumber = " 10";}
09869   if( StexNumber == 11 ){sFapStexNumber = " 11";}
09870   if( StexNumber == 12 ){sFapStexNumber = " 12";}
09871   if( StexNumber == 13 ){sFapStexNumber = " 13";}
09872   if( StexNumber == 14 ){sFapStexNumber = " 14";}
09873   if( StexNumber == 15 ){sFapStexNumber = " 15";}
09874   if( StexNumber == 16 ){sFapStexNumber = " 16";}
09875   if( StexNumber == 17 ){sFapStexNumber = " 17";}
09876   if( StexNumber == 18 ){sFapStexNumber = " 18";}
09877   if( StexNumber == 19 ){sFapStexNumber = " -1";}
09878   if( StexNumber == 20 ){sFapStexNumber = " -2";}
09879   if( StexNumber == 21 ){sFapStexNumber = " -3";}
09880   if( StexNumber == 22 ){sFapStexNumber = " -4";}
09881   if( StexNumber == 23 ){sFapStexNumber = " -5";}
09882   if( StexNumber == 24 ){sFapStexNumber = " -6";}
09883   if( StexNumber == 25 ){sFapStexNumber = " -7";}
09884   if( StexNumber == 26 ){sFapStexNumber = " -8";}
09885   if( StexNumber == 27 ){sFapStexNumber = " -9";}
09886   if( StexNumber == 28 ){sFapStexNumber = "-10";}
09887   if( StexNumber == 29 ){sFapStexNumber = "-11";}
09888   if( StexNumber == 30 ){sFapStexNumber = "-12";}
09889   if( StexNumber == 31 ){sFapStexNumber = "-13";}
09890   if( StexNumber == 32 ){sFapStexNumber = "-14";}
09891   if( StexNumber == 33 ){sFapStexNumber = "-15";}
09892   if( StexNumber == 34 ){sFapStexNumber = "-16";}
09893   if( StexNumber == 35 ){sFapStexNumber = "-17";}
09894   if( StexNumber == 36 ){sFapStexNumber = "-18";}
09895   return sFapStexNumber;
09896 }
09897 
09898 Double_t TEcnaHistos::NotConnectedSCH1DBin(const Int_t& index)
09899 {
09900   // gives the x coordinate for the i_th NotConnected SC
09901   // GetDSOffset(DeeNumber, DataSector) , GetSCOffset(DeeNumber, DataSector, SC_in_DS)
09902 
09903   Double_t xbin = (Double_t)(-1);
09904 
09905   if( index ==  1 ){xbin = GetDSOffset(1,1)+GetSCOffset(1,1, 30);}  // nb_for_cons == 182  (D1,S1) (D3,S9)
09906   if( index ==  2 ){xbin = GetDSOffset(2,9)+GetSCOffset(2,9, 30);}  // nb_for_cons ==  33  (D2,S9) (D4,S1)
09907 
09908   if( index ==  3 ){xbin = GetDSOffset(1,2)+GetSCOffset(1,2,  3);}  // nb_for_cons == 178  (D1,S2) (D3,S8)
09909   if( index ==  4 ){xbin = GetDSOffset(2,8)+GetSCOffset(2,8,  3);}  // nb_for_cons ==  29  (D2,S8) (D4,S2)
09910 
09911   if( index ==  5 ){xbin = GetDSOffset(1,2)+GetSCOffset(1,2, 25);}  // nb_for_cons == 207  (D1,S2) (D3,S8)
09912   if( index ==  6 ){xbin = GetDSOffset(2,8)+GetSCOffset(2,8, 25);}  // nb_for_cons ==  58  (D2,S8) (D4,S2)
09913 
09914   if( index ==  7 ){xbin = GetDSOffset(1,3)+GetSCOffset(1,3, 34);}  // nb_for_cons == 298  (D1,S3) (D3,S7) 
09915   if( index ==  8 ){xbin = GetDSOffset(2,7)+GetSCOffset(2,7, 34);}  // nb_for_cons == 149  (D2,S7) (D4,S3)
09916 
09917   if( index ==  9 ){xbin = GetDSOffset(1,4)+GetSCOffset(1,4, 14);}  // nb_for_cons == 261  (D1,S4) (D3,S6)
09918   if( index == 10 ){xbin = GetDSOffset(2,6)+GetSCOffset(2,6, 14);}  // nb_for_cons == 112  (D2,S6) (D4,S4)
09919   if( index == 11 ){xbin = GetDSOffset(1,4)+GetSCOffset(1,4, 21);}  // nb_for_cons == 268  (D1,S4) (D3,S6)
09920   if( index == 12 ){xbin = GetDSOffset(2,6)+GetSCOffset(2,6, 21);}  // nb_for_cons == 119  (D2,S6) (D4,S4)
09921 
09922   if( index == 13 ){xbin = GetDSOffset(1,5)+GetSCOffset(1,5, 20);}  // nb_for_cons == 281  (D1,S5) (D3,S5)
09923   if( index == 14 ){xbin = GetDSOffset(2,5)+GetSCOffset(2,5,  3);}  // nb_for_cons == 132  (D2,S5) (D4,S5)
09924 
09925   return xbin;
09926 }
09927 
09928 Double_t TEcnaHistos::NotCompleteSCH1DBin(const Int_t& index)
09929 {
09930   // gives the x coordinate for the i_th NotConnected SC
09931 
09932   Double_t xbin = (Double_t)(-1);
09933 
09934   if( index ==  1 ){xbin = GetDSOffset(1,1)+GetSCOffset(1,1, 12);}  // nb_for_cons == 161  (D1,S1) (D3,S9)
09935   if( index ==  2 ){xbin = GetDSOffset(2,9)+GetSCOffset(2,9, 12);}  // nb_for_cons ==  12  (D2,S9) (D4,S1)
09936 
09937   if( index ==  3 ){xbin = GetDSOffset(1,2)+GetSCOffset(1,2, 32);}  // nb_for_cons == 216  (D1,S2) (D3,S8)
09938   if( index ==  4 ){xbin = GetDSOffset(2,8)+GetSCOffset(2,8, 32);}  // nb_for_cons ==  67  (D2,S8) (D4,S2)
09939 
09940   if( index ==  5 ){xbin = GetDSOffset(1,3)+GetSCOffset(1,3, 10);}  // nb_for_cons == 224  (D1,S3) (D3,S7) 
09941   if( index ==  6 ){xbin = GetDSOffset(2,7)+GetSCOffset(2,7, 10);}  // nb_for_cons ==  75  (D2,S7) (D4,S3)
09942 
09943   if( index ==  7 ){xbin = GetDSOffset(1,5)+GetSCOffset(1,5, 23);}  // nb_for_cons == 286  (D1,S5) (D3,S5)
09944   if( index ==  8 ){xbin = GetDSOffset(2,5)+GetSCOffset(2,5,  6);}  // nb_for_cons == 137  (D2,S5) (D4,S5)
09945 
09946   return xbin;
09947 }
09948 
09949 Int_t TEcnaHistos::GetNotConnectedSCForConsFromIndex(const Int_t& index)
09950 {
09951 
09952   Int_t SCForCons = 0;
09953   if( index ==  1 ){SCForCons = 182;} // (D1,S1) (D3,S9)
09954   if( index ==  2 ){SCForCons =  33;} // (D2,S9) (D4,S1)
09955 
09956   if( index ==  3 ){SCForCons = 178;} // (D1,S2) (D3,S8)
09957   if( index ==  4 ){SCForCons =  29;} // (D2,S8) (D4,S2)
09958   if( index ==  5 ){SCForCons = 207;} // (D1,S2) (D3,S8)
09959   if( index ==  6 ){SCForCons =  58;} // (D2,S8) (D4,S2)
09960 
09961   if( index ==  7 ){SCForCons = 298;} // (D1,S3) (D3,S7) 
09962   if( index ==  8 ){SCForCons = 149;} // (D2,S7) (D4,S3)
09963 
09964   if( index ==  9 ){SCForCons = 261;} // (D1,S4) (D3,S6)
09965   if( index == 10 ){SCForCons = 112;} // (D2,S6) (D4,S4)
09966   if( index == 11 ){SCForCons = 268;} // (D1,S4) (D3,S6)
09967   if( index == 12 ){SCForCons = 119;} // (D2,S6) (D4,S4)
09968 
09969   if( index == 13 ){SCForCons = 281;} // (D1,S5) (D3,S5)
09970   if( index == 14 ){SCForCons = 132;} // (D2,S5) (D4,S5)
09971   return SCForCons;
09972 }
09973 
09974 Int_t TEcnaHistos::GetNotConnectedDSSCFromIndex(const Int_t& index)
09975 {
09976 
09977   Int_t DSSC = 0;
09978   if( index ==  1 ){DSSC =  30;} // (D1,S1) (D3,S9)
09979   if( index ==  2 ){DSSC =  30;} // (D2,S9) (D4,S1)
09980 
09981   if( index ==  3 ){DSSC =   3;} // (D1,S2) (D3,S8)
09982   if( index ==  4 ){DSSC =   3;} // (D2,S8) (D4,S2)
09983   if( index ==  5 ){DSSC =  25;} // (D1,S2) (D3,S8)
09984   if( index ==  6 ){DSSC =  25;} // (D2,S8) (D4,S2)
09985 
09986   if( index ==  7 ){DSSC =  34;} // (D1,S3) (D3,S7) 
09987   if( index ==  8 ){DSSC =  34;} // (D2,S7) (D4,S3)
09988 
09989   if( index ==  9 ){DSSC =  14;} // (D1,S4) (D3,S6)
09990   if( index == 10 ){DSSC =  14;} // (D2,S6) (D4,S4)
09991   if( index == 11 ){DSSC =  21;} // (D1,S4) (D3,S6)
09992   if( index == 12 ){DSSC =  21;} // (D2,S6) (D4,S4)
09993 
09994   if( index == 13 ){DSSC =  20;} // (D1,S5) (D3,S5)
09995   if( index == 14 ){DSSC =   3;} // (D2,S5) (D4,S5)
09996   return DSSC;
09997 }
09998 
09999 
10000 Int_t TEcnaHistos::GetNotCompleteSCForConsFromIndex(const Int_t& index)
10001 {
10002 
10003   Int_t DSSC = 0;
10004   if( index ==  1 ){DSSC =  161;} // (D1,S1) (D3,S9)
10005   if( index ==  2 ){DSSC =   12;} // (D2,S9) (D4,S1)
10006 
10007   if( index ==  3 ){DSSC =  216;} // (D1,S2) (D3,S8)
10008   if( index ==  4 ){DSSC =   67;} // (D2,S8) (D4,S2)
10009 
10010   if( index ==  5 ){DSSC =  224;} // (D1,S3) (D3,S7) 
10011   if( index ==  6 ){DSSC =   75;} // (D2,S7) (D4,S3)
10012 
10013   if( index ==  7 ){DSSC =  286;} // (D1,S5) (D3,S5)
10014   if( index ==  8 ){DSSC =  137;} // (D2,S5) (D4,S5)
10015   return DSSC;
10016 }
10017 
10018 Int_t TEcnaHistos::GetNotCompleteDSSCFromIndex(const Int_t& index)
10019 {
10020 
10021   Int_t DSSC = 0;
10022   if( index ==  1 ){DSSC =  12;} // (D1,S1) (D3,S9)
10023   if( index ==  2 ){DSSC =  12;} // (D2,S9) (D4,S1)
10024 
10025   if( index ==  3 ){DSSC =  32;} // (D1,S2) (D3,S8)
10026   if( index ==  4 ){DSSC =  32;} // (D2,S8) (D4,S2)
10027 
10028   if( index ==  5 ){DSSC =  10;} // (D1,S3) (D3,S7) 
10029   if( index ==  6 ){DSSC =  10;} // (D2,S7) (D4,S3)
10030 
10031   if( index ==  7 ){DSSC =  23;} // (D1,S5) (D3,S5)
10032   if( index ==  8 ){DSSC =   6;} // (D2,S5) (D4,S5)
10033   return DSSC;
10034 }
10035 //----------------------------------------------- HistimePlot
10036 void TEcnaHistos::HistimePlot(TGraph*       g_graph0, 
10037                               Axis_t        xinf,        Axis_t        xsup,
10038                               const TString HistoCode,   const TString HistoType,
10039                               const Int_t&  StexStin_A,  const Int_t&  i0StinEcha, const Int_t& i0Sample, 
10040                               const Int_t&  opt_scale_x, const Int_t& opt_scale_y,
10041                               const TString opt_plot,    const Int_t&  xFlagAutoYsupMargin)
10042 {
10043   // Plot 1D histogram for evolution in time
10044 
10045   UInt_t canv_w = fCnaParHistos->SetCanvasWidth(HistoCode, opt_plot);
10046   UInt_t canv_h = fCnaParHistos->SetCanvasHeight(HistoCode, opt_plot);
10047 
10048   SetGraphPresentation(g_graph0, HistoType.Data(), opt_plot.Data());   // (gStyle parameters)}
10049   
10050   //...................................................... paves commentaires (HistimePlot)      
10051   SetAllPavesViewHisto(HistoCode, StexStin_A, i0StinEcha, i0Sample, opt_plot);
10052   
10053   //..................................................... Canvas name (HistimePlot)
10054   Int_t arg_AlreadyRead = 0;
10055   TString canvas_name = SetCanvasName(HistoCode.Data(), opt_scale_x, opt_scale_y, opt_plot, arg_AlreadyRead,
10056                                       StexStin_A,       i0StinEcha,  i0Sample);
10057           
10058   //------------------------------------------------ Canvas allocation  (HistimePlot)
10059   //......................................... declarations canvas et pad
10060   TCanvas*  MainCanvas = 0;
10061 
10062   if( opt_plot == fOnlyOnePlot )
10063     {MainCanvas = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w , canv_h);   fCnewRoot++;
10064     fCurrentPad = gPad; fCurrentCanvas = MainCanvas; fCurrentCanvasName = canvas_name.Data();}
10065   
10066   if( opt_plot == fSeveralPlot )
10067     {
10068       if(GetMemoFlag(HistoCode, opt_plot) == "Free")
10069         {
10070           MainCanvas = CreateCanvas(HistoCode, opt_plot, canvas_name, canv_w, canv_h);
10071           fCurrentPad = gPad; fCurrentCanvas = MainCanvas; fCurrentCanvasName = canvas_name.Data();
10072         }
10073     }
10074   
10075   if( opt_plot == fSameOnePlot )
10076     {
10077       if(GetMemoFlag(HistoCode, opt_plot) == "Free")
10078         {
10079           MainCanvas = CreateCanvas(HistoCode, opt_plot, canvas_name, canv_w, canv_h);
10080           fCurrentPad = gPad; fCurrentCanvas = MainCanvas; fCurrentCanvasName = canvas_name.Data();
10081         }
10082     }
10083   
10084   // cout << "*TEcnaHistos::HistimePlot(...)> Plot is displayed on canvas ----> " << canvas_name.Data() << endl;
10085 
10086   //--------------- EE => SC for construction, EB => Xtal in SM (default: Stin ECNA number, i0StinEcha)
10087   Int_t Stex_StinCons = StexStin_A;   // Stex_StinCons = Tower for EB, SC for construction for EE
10088   Int_t n1StexCrys    = i0StinEcha+1; // n1StexCrys = Crys in SM for EB
10089 
10090   if( StexStin_A >= 1 && StexStin_A <= fEcal->MaxStinEcnaInStex() )
10091     {
10092       if( fFlagSubDet == "EB" )
10093         {n1StexCrys  = fEcalNumbering->Get1StexCrysFrom1StexStinAnd0StinEcha(StexStin_A, i0StinEcha, fFapStexNumber);}
10094       if( fFlagSubDet == "EE" )
10095         {Stex_StinCons = fEcalNumbering->GetDeeSCConsFrom1DeeSCEcna(fFapStexNumber, StexStin_A);}
10096     }
10097 
10098   //------ String for StexNumber ( to display "EB" or "EE" if Stex = 0 )
10099   TString sFapStexNumber = StexNumberToString(fFapStexNumber);
10100 
10101   //============================================================================= (HistimePlot)
10102   //
10103   //     1st  OPERATIONS:  Pave texts preparation and first Draw.
10104   //                       SetParametersCanvas
10105   //                       Set Memo Flags.
10106   //                       Set main_subpad and main_pavtxt
10107   //
10108   //=============================================================================
10109   TVirtualPad* main_subpad = 0;  //      main_subpad: Pad for the histo
10110   TPaveText*   main_pavtxt = 0;  //      main_pavtxt: pave for changing parameters
10111 
10112   Int_t xMemoPlotSame = 1;   // a priori ==> SAME plot 
10113 
10114   TString QuantityName = fCnaParHistos->GetQuantityName(HistoCode.Data());
10115 
10116   //========================================= Option ONLYONE    (HistimePlot)
10117   if( opt_plot == fOnlyOnePlot )
10118     {
10119       //................................. Draw titles and paves (pad = main canvas)
10120       if( fPavComGeneralTitle != 0 ){fPavComGeneralTitle->Draw();}
10121       fPavComStex->Draw();
10122 
10123       if( !( HistoType == "Global"  || HistoType == "Proj" ) )
10124         {
10125           fPavComStin->Draw();
10126           fPavComXtal->Draw();
10127         }
10128       fPavComEvolNbOfEvtsAna->Draw();
10129       fPavComEvolRuns->Draw();
10130 
10131       Double_t x_low = fCnaParHistos->BoxLeftX("bottom_left_box")   - 0.005;
10132       Double_t x_up  = fCnaParHistos->BoxRightX("bottom_right_box") + 0.005;
10133       Double_t y_low = fCnaParHistos->BoxTopY("bottom_right_box")   + 0.005;
10134       Double_t y_up  = fCnaParHistos->BoxBottomY("top_left_box_EB") - 0.005;
10135 
10136       Double_t x_margin = x_low;
10137       Double_t y_margin = y_low;
10138 
10139       Color_t  fond_pad = fCnaParHistos->ColorDefinition("gris18");
10140 
10141       MainCanvas->Divide( 1,  1, x_margin, y_margin, fond_pad);
10142       //           Divide(nx, ny, x_margin, y_margin,    color);
10143 
10144       gPad->cd(1);
10145       main_subpad = gPad;
10146       main_subpad->SetPad(x_low, y_low, x_up, y_up);
10147 
10148       xMemoPlotSame = 0;
10149     }
10150   //========================================= Options SAME and SAME n   (HistimePlot)
10151   if(opt_plot == fSeveralPlot || opt_plot == fSameOnePlot)
10152     {
10153       if(GetMemoFlag(HistoCode, opt_plot) == "Free")
10154         {
10155           if( fPavComGeneralTitle != 0 ){fPavComGeneralTitle->Draw();}
10156           fPavComSeveralChanging->Draw();
10157 
10158           fPavComEvolRuns->Draw();
10159 
10160           if( !( HistoType == "Global"     || HistoType == "Proj"       ||
10161                  HistoCode == "H_Ped_Date" || HistoCode == "H_TNo_Date" || HistoCode == "H_MCs_Date" ||
10162                  HistoCode == "H_LFN_Date" || HistoCode == "H_HFN_Date" || HistoCode == "H_SCs_Date") )
10163             {
10164               fPavComStin->Draw();
10165               fPavComXtal->Draw();
10166             } 
10167           
10168           if( !( HistoCode == "H_Ped_Date" || HistoCode == "H_TNo_Date" || HistoCode == "H_MCs_Date" ||
10169                  HistoCode == "H_LFN_Date" || HistoCode == "H_HFN_Date" || HistoCode == "H_SCs_Date" ) )
10170             {
10171               fPavComXtal->Draw();
10172             } 
10173           //Call to SetParametersPavTxt
10174           //fPavTxt<HISTOCODE> = fPavComSeveralChanging;  => come from SetAllPavesViewHisto
10175           SetParametersPavTxt(HistoCode, opt_plot);
10176           
10177           //---------------- Call to ActivePavTxt
10178           // main_pavtxt = fPavTxt<HISTOCODE>;} (return main_pavtxt)
10179           main_pavtxt = ActivePavTxt(HistoCode.Data(), opt_plot.Data());
10180           
10181           //-------------------- Set texts for pave "several changing", options SAME and SAME n (HistimePlot)
10182           main_pavtxt->SetTextAlign(fTextPaveAlign);
10183           main_pavtxt->SetTextFont(fTextPaveFont);
10184           main_pavtxt->SetTextSize(fTextPaveSize);
10185           main_pavtxt->SetBorderSize(fTextBorderSize);
10186 
10187           char* f_in = new char[fgMaxCar];                            fCnew++;
10188 
10189           TString DecalStexName = "";
10190           if( fFlagSubDet == "EB" ){DecalStexName = " ";}
10191           TString DecalStinName = "";
10192           if( fFlagSubDet == "EE" ){DecalStinName = "   ";}
10193 
10194           TString sStexOrStasName = "";
10195           if( fFapStexNumber == 0 ){sStexOrStasName = "  ";}
10196           if( fFapStexNumber != 0 ){sStexOrStasName = fFapStexName;}
10197 
10198 
10199           //-----------------------------> HistoType = "EvolProj" => treated in HistoPlot, not here.
10200           if(opt_plot == fSeveralPlot)
10201             {
10202               sprintf(f_in, "Analysis   Samp  Evts range  Nb Evts   %s%s %s%s   %s  %s",
10203                       DecalStexName.Data(), sStexOrStasName.Data(),
10204                       DecalStinName.Data(), fFapStinName.Data(), fFapXtalName.Data(), fFapEchaName.Data());
10205             }
10206           if(opt_plot == fSameOnePlot)
10207             {
10208               sprintf(f_in, "Analysis   Samp  Evts range  Nb Evts   %s%s %s%s   %s  %s",
10209                       DecalStexName.Data(), sStexOrStasName.Data(),
10210                       DecalStinName.Data(), fFapStinName.Data(), fFapXtalName.Data(), fFapEchaName.Data());
10211             }
10212 
10213           //................................................................... (HistimePlot)
10214           TText* ttit = main_pavtxt->AddText(f_in);
10215           ttit->SetTextColor(fCnaParHistos->ColorDefinition("noir"));
10216           
10217           if(opt_plot == fSeveralPlot)
10218             {
10219               sprintf(f_in, "%-10s 1-%2d %5d-%5d  %7d %5s%6d%7d%6d",
10220                       fFapAnaType.Data(), fFapNbOfSamples,
10221                       fFapFirstReqEvtNumber, fFapLastReqEvtNumber, fFapReqNbOfEvts, sFapStexNumber.Data(),
10222                       Stex_StinCons, n1StexCrys, i0StinEcha);
10223             }
10224           if(opt_plot == fSameOnePlot)
10225             {
10226               sprintf(f_in, "%-10s 1-%2d %5d-%5d  %7d %5s%6d%7d%6d %-25s",
10227                       fFapAnaType.Data(), fFapNbOfSamples,
10228                       fFapFirstReqEvtNumber, fFapLastReqEvtNumber, fFapReqNbOfEvts, sFapStexNumber.Data(),
10229                       Stex_StinCons, n1StexCrys, i0StinEcha, QuantityName.Data());
10230             }
10231 
10232           TText* tt = main_pavtxt->AddText(f_in);
10233           tt->SetTextColor(GetViewHistoColor(HistoCode, opt_plot));
10234 
10235           delete [] f_in;      f_in = 0;                                       fCdelete++;
10236 
10237           //---------- Draw the "several changing" pave with its text in the Canvas (FIRST TIME)        (HistimePlot)
10238           main_pavtxt->Draw();
10239 
10240           //---------------- Call to SetParametersCanvas
10241           //fImp<HISTOCODE> = (TCanvasImp*)fCanv<HISTOCODE>->GetCanvasImp();
10242           //fCanv<HISTOCODE>->Divide(1, 1, x_margin_factor , y_margin_factor); gPad->cd(1);
10243           //fPad<HISTOCODE> = gPad;
10244           //fMemoPlot<HISTOCODE> = 1;          =======>  set MemoFlag to "Buzy"
10245           //fMemoColor<HISTOCODE> = 0;
10246           SetParametersCanvas(HistoCode, opt_plot);
10247 
10248           //---------------- Set xMemoPlotSame to 0
10249           xMemoPlotSame = 0;
10250         }
10251 
10252       //............................ cases fMemoPlotxxx = 1            (HistimePlot)
10253       if(GetMemoFlag(HistoCode, opt_plot) == "Busy")
10254         {
10255           //---------------- Call to ActivePavTxt
10256           // main_pavtxt = fPavTxt<HISTOCODE>;} (return main_pavtxt)
10257           main_pavtxt = ActivePavTxt(HistoCode.Data(), opt_plot.Data());
10258           
10259           //---------------- Call to ActivePad
10260           main_subpad = ActivePad(HistoCode.Data(), opt_plot.Data());  // => return 0 if canvas has been closed
10261 
10262           //---------------- Recover pointer to the current canvas
10263           MainCanvas = GetCurrentCanvas(HistoCode.Data(), opt_plot.Data());
10264         }
10265     }
10266 
10267   //============================================================================= (HistimePlot)
10268   //
10269   //     2nd  OPERATIONS: Write and Draw the parameter values in the
10270   //                      "several changing" pave (options SAME and SAME n)
10271   //                      Draw Histo
10272   //=============================================================================
10273   if(main_subpad != 0)
10274     {
10275       if(opt_plot == fSeveralPlot || opt_plot == fSameOnePlot)
10276         {
10277           if(xMemoPlotSame != 0)
10278             {
10279               main_pavtxt->SetTextAlign(fTextPaveAlign);
10280               main_pavtxt->SetTextFont(fTextPaveFont);
10281               main_pavtxt->SetTextSize(fTextPaveSize);
10282               main_pavtxt->SetBorderSize(fTextBorderSize);
10283 
10284               char* f_in = new char[fgMaxCar];                            fCnew++;
10285               
10286               if(opt_plot == fSeveralPlot )
10287                 {sprintf(f_in, "%-10s 1-%2d %5d-%5d  %7d %5s%6d%7d%6d",
10288                          fFapAnaType.Data(), fFapNbOfSamples, fFapFirstReqEvtNumber, fFapLastReqEvtNumber, fFapReqNbOfEvts,
10289                          sFapStexNumber.Data(), Stex_StinCons, n1StexCrys, i0StinEcha);}
10290               if(opt_plot == fSameOnePlot )
10291                 {sprintf(f_in, "%-10s 1-%2d %5d-%5d  %7d %5s%6d%7d%6d %-25s",
10292                          fFapAnaType.Data(), fFapNbOfSamples, fFapFirstReqEvtNumber, fFapLastReqEvtNumber, fFapReqNbOfEvts,
10293                          sFapStexNumber.Data(), Stex_StinCons, n1StexCrys, i0StinEcha, QuantityName.Data());}
10294               
10295               TText *tt = main_pavtxt->AddText(f_in);
10296               tt->SetTextColor(GetViewHistoColor(HistoCode, opt_plot));
10297               MainCanvas->cd(); gStyle->SetOptDate(0);
10298               main_pavtxt->Draw();
10299 
10300               delete [] f_in;    f_in = 0;                          fCdelete++;
10301             }
10302           main_subpad->cd();
10303           Double_t x_low = fCnaParHistos->BoxLeftX("bottom_left_box")   - 0.005;
10304           Double_t x_up  = fCnaParHistos->BoxRightX("bottom_right_box") + 0.005;
10305           Double_t y_low = fCnaParHistos->BoxTopY("several_evol_box")   + 0.005;
10306           Double_t y_up  = fCnaParHistos->BoxBottomY("general_comment") - 0.005;
10307           if( opt_plot == fSameOnePlot ){y_up = fCnaParHistos->BoxBottomY("top_left_box_EB") - 0.005;}
10308           main_subpad->SetPad(x_low, y_low, x_up, y_up); 
10309         }
10310               
10311       //............................................ Style      (HistimePlot)
10312       SetViewGraphColors(g_graph0, HistoCode, opt_plot);
10313 
10314       //................................. Set axis titles
10315       TString axis_x_var_name = SetHistoXAxisTitle(HistoCode);
10316       TString axis_y_var_name = SetHistoYAxisTitle(HistoCode);
10317       g_graph0->GetXaxis()->SetTitle(axis_x_var_name);
10318       g_graph0->GetYaxis()->SetTitle(axis_y_var_name);
10319 
10320       //................................. Xaxis is a time axis
10321       g_graph0->GetXaxis()->SetTimeDisplay(1);
10322       g_graph0->GetXaxis()->SetTimeFormat("%d %b-%Hh");
10323  
10324       g_graph0->GetXaxis()->SetTimeOffset(xinf);
10325 
10326       Int_t nb_displayed = fCnaParHistos->GetNbOfRunsDisplayed();      // max nb of run numbers displayed
10327 
10328       //...........................................................................     (HistimePlot)
10329       Int_t liny = 0;
10330       Int_t logy = 1;
10331               
10332       if(opt_plot == fOnlyOnePlot)
10333         {
10334           fXinf = (Double_t)xinf;
10335           fXsup = (Double_t)xsup;
10336           fYinf = (Double_t)GetYminValueFromMemo(HistoCode);
10337           fYsup = (Double_t)GetYmaxValueFromMemo(HistoCode);
10338 
10339           gPad->RangeAxis(fXinf, fYinf, fXsup, fYsup);
10340 
10341           //if(opt_scale_y == fOptScaleLiny){gPad->SetLogy(liny);}
10342           if(opt_scale_y == fOptScaleLogy){gPad->SetLogy(logy); g_graph0->Draw("ALP");}
10343 
10344           if(opt_scale_y == fOptScaleLiny)
10345             {
10346               gPad->SetLogy(liny);
10347               g_graph0->Draw("ALP");
10348               Int_t     nb_pts  = g_graph0->GetN();
10349               Double_t* coord_x = g_graph0->GetX();
10350               Double_t* coord_y = g_graph0->GetY();
10351 
10352               char* f_in = new char[fgMaxCar];                            fCnew++;
10353 
10354               //................. display of the run numbers                                         (HistimePlot)
10355               Double_t interv_displayed = (coord_x[nb_pts-1] - coord_x[0])/(Double_t)nb_displayed;
10356               Double_t last_drawn_coordx = coord_x[0] - 1.5*interv_displayed;
10357 
10358               for(Int_t i_run=0; i_run<nb_pts; i_run++)
10359                 {
10360                   if ( (coord_x[i_run] - last_drawn_coordx) > interv_displayed )
10361                     {
10362                       Double_t joinYinf = fYinf;
10363                       Double_t joinYsup = fYsup;
10364                       if( joinYsup <= joinYinf )
10365                         {
10366                           joinYinf =
10367                             GetYminFromGraphFrameAndMarginValue(g_graph0, fCnaParHistos->GetMarginAutoMinMax());
10368                           joinYsup =
10369                             GetYmaxFromGraphFrameAndMarginValue(g_graph0, fCnaParHistos->GetMarginAutoMinMax());
10370                           joinYsup = joinYsup + (joinYsup-joinYinf)/20.;
10371                         }
10372 
10373                       sprintf( f_in, "R%d",  fT1DRunNumber[i_run]);
10374                       TText *text_run_num = new TText(coord_x[i_run], joinYsup, f_in);  fCnewRoot++;
10375                       text_run_num->SetTextAngle((Double_t)45.);
10376                       text_run_num->SetTextSize((Double_t)0.035);
10377                       text_run_num->Draw("SAME");
10378                       // delete text_StexStin_num;             fCdeleteRoot++;
10379 
10380                       TLine *jointlign;
10381                       jointlign = new TLine(coord_x[i_run], joinYsup, coord_x[i_run], coord_y[i_run]); fCnewRoot++;
10382                       jointlign->SetLineWidth(1);
10383                       jointlign->SetLineStyle(2);
10384                       jointlign->Draw("SAME");
10385                       // delete jointlign;                  fCdeleteRoot++;
10386 
10387                       last_drawn_coordx = coord_x[i_run];                           //        (HistimePlot)
10388                     }
10389                 }
10390 
10391               delete [] f_in;      f_in = 0;                                         fCdelete++;
10392 
10393             }
10394           if(opt_scale_y == fOptScaleLogy)
10395             {
10396               gPad->SetLogy(logy);
10397               g_graph0->Draw("ALP");
10398             }
10399         }
10400 
10401       //......................................................................  (HistimePlot)
10402       if(opt_plot == fSeveralPlot || opt_plot == fSameOnePlot)
10403         {
10404           if(xMemoPlotSame == 0)
10405             {
10406               if(opt_scale_y == fOptScaleLiny){gPad->SetLogy(liny);}
10407               if(opt_scale_y == fOptScaleLogy){gPad->SetLogy(logy);
10408 }
10409               g_graph0->Draw("ALP");
10410 
10411               fXinf = (Double_t)xinf;
10412               fXsup = (Double_t)xsup;
10413               fYinf = (Double_t)GetYminValueFromMemo(HistoCode);
10414               fYsup = (Double_t)GetYmaxValueFromMemo(HistoCode); 
10415 
10416               gPad->RangeAxis(fXinf, fYinf, fXsup, fYsup);
10417             }
10418           
10419           if(xMemoPlotSame != 0)                                          //        (HistimePlot)
10420             {
10421               if(opt_scale_y == fOptScaleLiny){gPad->SetLogy(liny);}
10422               if(opt_scale_y == fOptScaleLogy){gPad->SetLogy(logy);}
10423 
10424               g_graph0->Draw("LP");
10425             }
10426         }
10427       gPad->Update();
10428     }
10429   else    // else du if(main_subpad !=0)
10430     {
10431       cout << "*TEcnaHistos::HistimePlot(...)> Canvas not found. Previously closed in option SAME."
10432            << fTTBELL << endl;
10433 
10434       ReInitCanvas(HistoCode, opt_plot);
10435       xMemoPlotSame = 0;
10436     }
10437 
10438   //  delete MainCanvas;                  fCdeleteRoot++;
10439  
10440 } // end of HistimePlot
10441 
10442 //------------------------------------------------------------------------------------------------------
10443 void TEcnaHistos::TopAxisForHistos(TH1D*        h_his0,              const TString opt_plot,
10444                                    const Int_t& xMemoPlotSame,       const Int_t&  min_value, const Int_t&  max_value,
10445                                    const Int_t& xFlagAutoYsupMargin, const Int_t&  HisSize)
10446 {
10447 // Axis on top of the plot to indicate the Stin numbers
10448 
10449   if( opt_plot == fOnlyOnePlot ||
10450       ( (opt_plot == fSeveralPlot) && (xMemoPlotSame == 0) ) ||
10451       ( (opt_plot == fSameOnePlot) && (xMemoPlotSame == 0) ) )
10452     {   
10453       Double_t Maxih = (Double_t)h_his0->GetMaximum();
10454       Double_t Minih = (Double_t)h_his0->GetMinimum();
10455 
10456       if(xFlagAutoYsupMargin == 1)
10457         {
10458           if( Minih >= Maxih ){Minih = (Double_t)0.; Maxih += Maxih;}  // ROOT default if ymin >= ymax
10459           Double_t MaxMarginFactor = (Double_t)0.05;    // frame top line = 5% above the maximum
10460           Maxih += (Maxih-Minih)*MaxMarginFactor;       // ROOT default if ymin < ymax
10461         }
10462 
10463       Double_t v_min = min_value;
10464       Double_t v_max = max_value+(Double_t)1.;
10465       Double_t v_min_p = v_min+(Double_t)1.;
10466       Double_t v_max_p = v_max+(Double_t)1.;
10467 
10468       Int_t ndiv = 50207;
10469       TString opt = "B-";
10470       Double_t Xbegin = 0.;
10471       Double_t Xend   = (Double_t)HisSize;
10472       Double_t ticks  = 0.05;
10473 
10474       if( fFapStexNumber == 0 && fFlagSubDet == "EE" )
10475         {
10476           v_min = 0;
10477           v_max = max_value;
10478           ndiv = 4;
10479           opt = "CSU";                  // first draw axis with ticksize and no label
10480           Xbegin = (Double_t)HisSize;
10481           Xend = 0.;
10482         }
10483 
10484       if( fFapStexNumber > 0 && fFlagSubDet == "EE" )
10485         {
10486           ticks = 0;
10487           if( fFapStexNumber == 1 )
10488             {
10489               v_min = min_value;
10490               v_max = max_value+0.5;
10491               Xbegin = (Double_t)HisSize;
10492               Xend   = 0.;
10493               opt = "CSU";                // first draw axis with no ticksize and no label
10494             }
10495           if( fFapStexNumber == 2 )
10496             {
10497               v_min = min_value+0.5;
10498               v_max = max_value+1.;
10499               Xbegin = (Double_t)HisSize;
10500               Xend   = 0.;
10501               opt = "CSU";                // first draw axis with no ticksize and no label
10502             }
10503           if( fFapStexNumber == 3 )
10504             {
10505               v_min = min_value+0.5;
10506               v_max = max_value+1.;
10507               Xbegin = 0.;
10508               Xend   = (Double_t)HisSize;
10509               opt = "-CSU";                // first draw axis with no ticksize and no label
10510             }
10511           if( fFapStexNumber == 4 )
10512             {
10513               v_min = min_value;
10514               v_max = max_value+0.5;
10515               Xbegin = 0.;
10516               Xend   = (Double_t)HisSize;
10517               opt = "-CSU";                // first draw axis with no ticksize and no label
10518             }
10519           v_min -= 1;
10520           v_max -= 1;
10521           ndiv = 5;
10522         }
10523 
10524       TGaxis* top_axis_x = 0;
10525 
10526       top_axis_x = new TGaxis(Xbegin, Maxih, Xend, Maxih,
10527                                v_min, v_max, ndiv, opt, 0.);         fCnewRoot++;
10528 
10529       top_axis_x->SetTickSize(ticks);
10530       top_axis_x->SetTitleOffset((Float_t)(1.2));
10531       top_axis_x->SetLabelOffset((Float_t)(0.005));
10532 
10533       TString  x_var_name  = "?";
10534       Int_t MaxCar = fgMaxCar;
10535       x_var_name.Resize(MaxCar);
10536       if( fFapStexNumber >  0 )
10537         {
10538           if( fFlagSubDet == "EB"){x_var_name = "Tower number";}
10539           if( fFlagSubDet == "EE")
10540             {
10541               x_var_name = " ";
10542              // x_var_name = "                                                                                                            Data sector"; // don't remove the space characters !
10543             }
10544         }
10545       if( fFapStexNumber == 0 )
10546         {
10547           if( fFlagSubDet == "EB"){x_var_name = "SM number";}
10548           if( fFlagSubDet == "EE"){x_var_name = " ";}
10549         } 
10550       top_axis_x->SetTitle(x_var_name);
10551       top_axis_x->Draw("SAME");
10552       
10553       if( fFlagSubDet == "EE" )
10554         {
10555           // redraw axis with ticksize = 0, with labelOffset<0 or >0 and div centered in middle division
10556           opt = "-MS";
10557           if(fFapStexNumber == 1 || fFapStexNumber == 2 ){opt = "-MS";}
10558           if(fFapStexNumber == 3 || fFapStexNumber == 4 ){opt = "MS";} 
10559           ndiv = 4;
10560           if( fFapStexNumber > 0 ){ndiv = 5;}
10561           TGaxis* top_axis_x_bis = 0;
10562           top_axis_x_bis = new TGaxis(Xbegin, Maxih, Xend, Maxih,
10563                                       v_min_p, v_max_p, ndiv, opt, 0.);   fCnewRoot++;
10564           top_axis_x_bis->SetTickSize(0.);
10565           Float_t lab_siz_x = top_axis_x->GetLabelSize();
10566           top_axis_x_bis->SetLabelSize(lab_siz_x);
10567           top_axis_x_bis->SetLabelOffset(-0.1);
10568 
10569           top_axis_x_bis->SetLabelOffset((Float_t)(9999.));
10570           // if(fFapStexNumber == 1 || fFapStexNumber == 2 ){top_axis_x_bis->SetLabelOffset(-0.07);}
10571           // if(fFapStexNumber == 3 || fFapStexNumber == 4 ){top_axis_x_bis->SetLabelOffset(-0.05);}  
10572           // if(fFapStexNumber == 0 )
10573              //  {top_axis_x_bis->SetLabelOffset((Float_t)(9999.));}  // keep the tick and remove the value
10574           top_axis_x_bis->Draw("SAME");
10575         }
10576     } 
10577 } // end of TopAxisForHistos
10578 
10579 //............................................................................................
10580 void TEcnaHistos::SetAllPavesViewMatrix(const TString   BetweenWhat,
10581                                         const Int_t&    StexStin_A,  const Int_t&  StexStin_B,
10582                                         const Int_t&    i0StinEcha)
10583 {
10584 // Put all the paves of a matrix view
10585 
10586   fPavComGeneralTitle = fCnaParHistos->SetPaveGeneralComment(fFlagGeneralTitle);
10587 
10588   fPavComStex = fCnaParHistos->SetPaveStex("standard", fFapStexNumber);
10589   
10590   if(BetweenWhat == fLFBetweenChannels || BetweenWhat == fHFBetweenChannels)
10591     {fPavComStin = fCnaParHistos->SetPaveStinsXY(StexStin_A, StexStin_B);}
10592   if(BetweenWhat == fBetweenSamples)
10593     {
10594       fPavComStin = fCnaParHistos->SetPaveStin(StexStin_A, fFapStexNumber);
10595       
10596       if( fFlagSubDet == "EB" )
10597         {Int_t n1StexCrys = fEcalNumbering->Get1StexCrysFrom1StexStinAnd0StinEcha(StexStin_A, i0StinEcha, fFapStexNumber);
10598         fPavComXtal = fCnaParHistos->SetPaveCrystal(n1StexCrys, StexStin_A, i0StinEcha);}
10599       if( fFlagSubDet == "EE" )
10600         {TString Dir = fEcalNumbering->GetDeeDirViewedFromIP(fFapStexNumber);
10601         Int_t n1StexCrys = fEcalNumbering->Get1StexCrysFrom1StexStinAnd0StinEcha(StexStin_A, i0StinEcha, fFapStexNumber);
10602         fPavComXtal = fCnaParHistos->SetPaveCrystal(n1StexCrys, StexStin_A, i0StinEcha);}
10603     }
10604 
10605   fPavComAnaRun  = fCnaParHistos->SetPaveAnalysisRun(fFapAnaType,  fFapNbOfSamples, fFapRunNumber, fRunType,
10606                                                      fFapFirstReqEvtNumber, fFapLastReqEvtNumber, "OneCol");
10607   fPavComNbOfEvts = fCnaParHistos->SetPaveNbOfEvts(fFapNbOfEvts, fStartDate, fStopDate, "OneCol");
10608 }
10609 
10610 void TEcnaHistos::SetAllPavesViewStin(const Int_t& StexStin_A)
10611 {
10612 // Put all the paves of a Stin view
10613 
10614   fPavComGeneralTitle = fCnaParHistos->SetPaveGeneralComment(fFlagGeneralTitle);
10615   fPavComStex = fCnaParHistos->SetPaveStex("standard", fFapStexNumber);
10616 
10617   fPavComStin   = fCnaParHistos->SetPaveStin(StexStin_A, fFapStexNumber);
10618 
10619   fPavComAnaRun  = fCnaParHistos->SetPaveAnalysisRun(fFapAnaType, fFapNbOfSamples, fFapRunNumber, fRunType,
10620                                                      fFapFirstReqEvtNumber, fFapLastReqEvtNumber, "OneCol");
10621   fPavComNbOfEvts = fCnaParHistos->SetPaveNbOfEvts(fFapNbOfEvts, fStartDate, fStopDate, "OneCol");
10622 }
10623 
10624 void TEcnaHistos::SetAllPavesViewStinCrysNb(const Int_t& StexNumber, const Int_t& StexStin_A)
10625 {
10626 // Put all the paves of a crystal numbering Stin view
10627 
10628   fPavComStex  = fCnaParHistos->SetPaveStex("standard", StexNumber);
10629   fPavComStin  = fCnaParHistos->SetPaveStin(StexStin_A, StexNumber);
10630 
10631   if( fFlagSubDet == "EB")
10632     {fPavComLVRB   = fCnaParHistos->SetPaveLVRB(StexNumber, StexStin_A);}
10633   if( fFlagSubDet == "EE")
10634     {fPavComCxyz   = fCnaParHistos->SetPaveCxyz(StexNumber);}
10635 }
10636 
10637 void TEcnaHistos::SetAllPavesViewStex(const TString chopt, const Int_t& StexNumber)
10638 {
10639   if( chopt == "Numbering" )
10640     {
10641       fCnaParHistos->SetViewHistoStyle("Stex2DEENb");
10642       gStyle->SetTextColor(fCnaParHistos->ColorDefinition("noir"));
10643       fPavComStex = fCnaParHistos->SetPaveStex("standStex", StexNumber);
10644       if( fFlagSubDet == "EE" ){fPavComCxyz = fCnaParHistos->SetPaveCxyz(StexNumber);}
10645     }
10646   else
10647     {
10648       SetAllPavesViewStex(StexNumber);
10649     }
10650 }
10651 // end of SetAllPavesViewStex(...,...)
10652 
10653 void TEcnaHistos::SetAllPavesViewStex(const Int_t& StexNumber)
10654 {
10655   gStyle->SetTextColor(fCnaParHistos->ColorDefinition("noir"));
10656   fPavComGeneralTitle = fCnaParHistos->SetPaveGeneralComment(fFlagGeneralTitle);
10657   fPavComStex = fCnaParHistos->SetPaveStex("standStex", StexNumber);
10658 
10659   TString opt_pave_nbcol = "OneCol";
10660   if( fFapStexName == "SM"){opt_pave_nbcol = "TwoCol";}
10661     
10662   fPavComAnaRun  = fCnaParHistos->SetPaveAnalysisRun(fFapAnaType, fFapNbOfSamples, fFapRunNumber, fRunType,
10663                                                      fFapFirstReqEvtNumber, fFapLastReqEvtNumber,opt_pave_nbcol);
10664   fPavComNbOfEvts = fCnaParHistos->SetPaveNbOfEvts(fFapNbOfEvts, fStartDate, fStopDate, opt_pave_nbcol); 
10665 }
10666 // end of SetAllPavesViewStex(...)
10667 
10668 void TEcnaHistos::SetAllPavesViewStas()
10669 {
10670   gStyle->SetTextColor(fCnaParHistos->ColorDefinition("noir"));
10671   fPavComGeneralTitle = fCnaParHistos->SetPaveGeneralComment(fFlagGeneralTitle);
10672   fPavComStas = fCnaParHistos->SetPaveStas();
10673 
10674   fPavComAnaRun  = fCnaParHistos->SetPaveAnalysisRun(fFapAnaType, fFapNbOfSamples, fFapRunNumber, fRunType,
10675                                                      fFapFirstReqEvtNumber, fFapLastReqEvtNumber, "OneCol");
10676   fPavComNbOfEvts = fCnaParHistos->SetPaveNbOfEvts(fFapNbOfEvts, fStartDate, fStopDate, "OneCol");
10677 }
10678 // end of SetAllPavesViewStas
10679 
10680 void TEcnaHistos::SetAllPavesViewHisto(const TString HistoCode,  const Int_t&  StexStin_A,
10681                                        const Int_t&  i0StinEcha, const Int_t&  i0Sample,  
10682                                        const TString opt_plot)
10683 {
10684   Int_t arg_AlreadyRead = 0;
10685   SetAllPavesViewHisto(HistoCode, StexStin_A, i0StinEcha, i0Sample, opt_plot, arg_AlreadyRead);
10686 }
10687 
10688 void TEcnaHistos::SetAllPavesViewHisto(const TString HistoCode,  const Int_t&  StexStin_A,
10689                                        const Int_t&  i0StinEcha, const Int_t&  i0Sample,  
10690                                        const TString opt_plot,   const Int_t&  arg_AlreadyRead)
10691 {
10692 // Put all the paves of a histo view according to HistoCode
10693 
10694   gStyle->SetTextColor(fCnaParHistos->ColorDefinition("noir"));
10695 
10696   TString HistoType = fCnaParHistos->GetHistoType(HistoCode.Data());
10697 
10698   fPavComGeneralTitle = fCnaParHistos->SetPaveGeneralComment(fFlagGeneralTitle);
10699 
10700   if(opt_plot == fOnlyOnePlot)
10701     {      
10702       if( !( HistoCode == "D_NOE_ChNb" || HistoCode == "D_NOE_ChDs" ||
10703              HistoCode == "D_Ped_ChNb" || HistoCode == "D_Ped_ChDs" ||
10704              HistoCode == "D_LFN_ChNb" || HistoCode == "D_LFN_ChDs" ||
10705              HistoCode == "D_TNo_ChNb" || HistoCode == "D_TNo_ChDs" || 
10706              HistoCode == "D_HFN_ChNb" || HistoCode == "D_HFN_ChDs" || 
10707              HistoCode == "D_MCs_ChNb" || HistoCode == "D_MCs_ChDs" || 
10708              HistoCode == "D_SCs_ChNb" || HistoCode == "D_SCs_ChDs" ) )
10709         {
10710           fPavComStex = fCnaParHistos->SetPaveStex("standard", fFapStexNumber);
10711           fPavComStin = fCnaParHistos->SetPaveStin(StexStin_A, fFapStexNumber);
10712         }
10713       else
10714         {
10715           if( HistoCode == "D_NOE_ChNb" ||
10716               HistoCode == "D_Ped_ChNb" || HistoCode == "D_TNo_ChNb" ||
10717               HistoCode == "D_MCs_ChNb" || HistoCode == "D_LFN_ChNb" ||
10718               HistoCode == "D_HFN_ChNb" || HistoCode == "D_SCs_ChNb" )
10719             {fPavComStex = fCnaParHistos->SetPaveStex("standGH", fFapStexNumber);}
10720           else
10721             {fPavComStex = fCnaParHistos->SetPaveStex("standard", fFapStexNumber);}
10722         }
10723   //.................................................... (SetAllPavesViewHisto)
10724      
10725       if( HistoCode == "H_Ped_Date" || HistoCode == "H_TNo_Date" || HistoCode == "H_MCs_Date" ||
10726           HistoCode == "H_LFN_Date" || HistoCode == "H_HFN_Date" || HistoCode == "H_SCs_Date" ||
10727           HistoCode == "H_Ped_RuDs" || HistoCode == "H_TNo_RuDs" || HistoCode == "H_MCs_RuDs" ||
10728           HistoCode == "H_LFN_RuDs" || HistoCode == "H_HFN_RuDs" || HistoCode == "H_SCs_RuDs" )
10729         {
10730           Int_t n1StexCrys  =
10731             fEcalNumbering->Get1StexCrysFrom1StexStinAnd0StinEcha(StexStin_A, i0StinEcha, fFapStexNumber);
10732           fPavComXtal = fCnaParHistos->SetPaveCrystal(n1StexCrys, StexStin_A, i0StinEcha);
10733         }
10734 
10735       if( HistoCode == "D_MSp_SpNb" || HistoCode == "D_SSp_SpNb" ||
10736           HistoCode == "D_MSp_SpDs" || HistoCode == "D_SSp_SpDs" )
10737         {
10738           Int_t n1StexCrys  =
10739             fEcalNumbering->Get1StexCrysFrom1StexStinAnd0StinEcha(StexStin_A, i0StinEcha, fFapStexNumber);
10740           fPavComXtal =
10741             fCnaParHistos->SetPaveCrystal(n1StexCrys, StexStin_A, i0StinEcha, arg_AlreadyRead, fPlotAllXtalsInStin);
10742         }
10743 
10744       if( HistoCode == "D_Adc_EvDs" || HistoCode == "D_Adc_EvNb")
10745         {
10746           Int_t n1StexCrys  =
10747             fEcalNumbering->Get1StexCrysFrom1StexStinAnd0StinEcha(StexStin_A, i0StinEcha, fFapStexNumber);
10748           fPavComXtal = fCnaParHistos->SetPaveCrystalSample(n1StexCrys, StexStin_A, i0StinEcha, i0Sample);
10749         }
10750       
10751       if( HistoCode == "H_Ped_Date" || HistoCode == "H_TNo_Date" || HistoCode == "H_MCs_Date" ||
10752           HistoCode == "H_LFN_Date" || HistoCode == "H_HFN_Date" || HistoCode == "H_SCs_Date" ||
10753           HistoCode == "H_Ped_RuDs" || HistoCode == "H_TNo_RuDs" || HistoCode == "H_MCs_RuDs" ||
10754           HistoCode == "H_LFN_RuDs" || HistoCode == "H_HFN_RuDs" || HistoCode == "H_SCs_RuDs" )
10755         {
10756           fPavComEvolNbOfEvtsAna =
10757             fCnaParHistos->SetPaveEvolNbOfEvtsAna(fFapAnaType, fFapNbOfSamples,
10758                                                   fFapFirstReqEvtNumber, fFapLastReqEvtNumber, HistoType);
10759           fPavComEvolRuns = fCnaParHistos->SetPaveEvolRuns(fStartEvolRun, fStartEvolDate,
10760                                                            fStopEvolRun,  fStopEvolDate, opt_plot, HistoType);
10761         }
10762       else
10763         {
10764           fPavComAnaRun = fCnaParHistos->SetPaveAnalysisRun(fFapAnaType, fFapNbOfSamples, fFapRunNumber, fRunType,
10765                                                             fFapFirstReqEvtNumber, fFapLastReqEvtNumber, "OneCol");
10766           fPavComNbOfEvts = fCnaParHistos->SetPaveNbOfEvts(fFapNbOfEvts, fStartDate, fStopDate, "OneCol");
10767         }
10768     }
10769 
10770   //.................................................... (SetAllPavesViewHisto)
10771 
10772   if( opt_plot == fSeveralPlot && GetMemoFlag(HistoCode, opt_plot) == "Free" )
10773     {
10774       if( HistoCode == "H_Ped_Date" || HistoCode == "H_TNo_Date" || HistoCode == "H_MCs_Date" ||
10775           HistoCode == "H_LFN_Date" || HistoCode == "H_HFN_Date" || HistoCode == "H_SCs_Date" ||
10776           HistoCode == "H_Ped_RuDs" || HistoCode == "H_TNo_RuDs" || HistoCode == "H_MCs_RuDs" ||
10777           HistoCode == "H_LFN_RuDs" || HistoCode == "H_HFN_RuDs" || HistoCode == "H_SCs_RuDs" )
10778         {
10779           fPavComSeveralChanging = fCnaParHistos->SetOptionSamePaveBorder("sevevol", HistoType);
10780           fPavComEvolRuns = fCnaParHistos->SetPaveEvolRuns(fStartEvolRun, fStartEvolDate,
10781                                                            fStopEvolRun,  fStopEvolDate, opt_plot, HistoType);
10782         }
10783       else
10784         {
10785           fPavComSeveralChanging = fCnaParHistos->SetOptionSamePaveBorder("several", HistoType);
10786         }
10787     } 
10788 
10789   if( opt_plot == fSameOnePlot && GetMemoFlag(HistoCode, opt_plot) == "Free" )
10790     {
10791       fPavComSeveralChanging = fCnaParHistos->SetOptionSamePaveBorder("several", HistoType);
10792       fPavComEvolRuns = fCnaParHistos->SetPaveEvolRuns(fStartEvolRun, fStartEvolDate,
10793                                                        fStopEvolRun,  fStopEvolDate, opt_plot, HistoType);
10794     } 
10795 
10796 }
10797 // end of SetAllPavesViewHisto
10798 
10799 TString TEcnaHistos::SetCanvasName(const TString HistoCode,
10800                                    const Int_t&  opt_scale_x, const Int_t& opt_scale_y,
10801                                    const TString opt_plot,    const Int_t& arg_AlreadyRead,
10802                                    const Int_t& StexStin_A,   const Int_t& i0StinEcha,  const Int_t& i0Sample)
10803 {
10804   //......... Set Canvas name *===> FOR 1D HISTO ONLY 
10805   //          (for 2D histos, see inside ViewMatrix, ViewStex,...)
10806 
10807   TString canvas_name;
10808   Int_t MaxCar = fgMaxCar;
10809   canvas_name.Resize(MaxCar);
10810   canvas_name = "?";
10811 
10812   char* f_in = new char[fgMaxCar];               fCnew++;
10813 
10814   //......................... name_ opt_plot  (Set Canvas name)
10815   TString  name_opt_plot;
10816   MaxCar = fgMaxCar;
10817   name_opt_plot.Resize(MaxCar);
10818   name_opt_plot = "?";
10819 
10820   //if(opt_plot == fOnlyOnePlot && arg_AlreadyRead == 0){name_opt_plot = "P0";}  // Only one plot
10821   //if(opt_plot == fOnlyOnePlot && arg_AlreadyRead == 1){name_opt_plot = "P1";}  // SAME in Stin plot
10822   //if(opt_plot == fOnlyOnePlot && arg_AlreadyRead >= 1){name_opt_plot = "Pn";}  // SAME in Stin plot
10823 
10824   if( opt_plot == fOnlyOnePlot ){sprintf(f_in,"P%d", arg_AlreadyRead); name_opt_plot = f_in;}
10825 
10826   if(opt_plot == fSeveralPlot)
10827     {
10828       name_opt_plot = "SAME_N";
10829       //...................................... name_same (opt_plot = fSeveralPlot)
10830       Int_t name_same = -1;
10831       
10832       if(HistoCode == "D_NOE_ChNb"){name_same = fCanvSameD_NOE_ChNb;}
10833       if(HistoCode == "D_NOE_ChDs"){name_same = fCanvSameD_NOE_ChDs;}
10834       if(HistoCode == "D_Ped_ChNb"){name_same = fCanvSameD_Ped_ChNb;}
10835       if(HistoCode == "D_Ped_ChDs"){name_same = fCanvSameD_Ped_ChDs;}
10836       if(HistoCode == "D_TNo_ChNb"){name_same = fCanvSameD_TNo_ChNb;}
10837       if(HistoCode == "D_TNo_ChDs"){name_same = fCanvSameD_TNo_ChDs;}
10838       if(HistoCode == "D_MCs_ChNb"){name_same = fCanvSameD_MCs_ChNb;}
10839       if(HistoCode == "D_MCs_ChDs"){name_same = fCanvSameD_MCs_ChDs;}
10840       if(HistoCode == "D_LFN_ChNb"){name_same = fCanvSameD_LFN_ChNb;}
10841       if(HistoCode == "D_LFN_ChDs"){name_same = fCanvSameD_LFN_ChDs;}
10842       if(HistoCode == "D_HFN_ChNb"){name_same = fCanvSameD_HFN_ChNb;}
10843       if(HistoCode == "D_HFN_ChDs"){name_same = fCanvSameD_HFN_ChDs;}
10844       if(HistoCode == "D_SCs_ChNb"){name_same = fCanvSameD_SCs_ChNb;}
10845       if(HistoCode == "D_SCs_ChDs"){name_same = fCanvSameD_SCs_ChDs;}
10846       if(HistoCode == "D_MSp_SpNb"){name_same = fCanvSameD_MSp_SpNb;}
10847       if(HistoCode == "D_MSp_SpDs"){name_same = fCanvSameD_MSp_SpDs;}
10848       if(HistoCode == "D_SSp_SpNb"){name_same = fCanvSameD_SSp_SpNb;}
10849       if(HistoCode == "D_SSp_SpDs"){name_same = fCanvSameD_SSp_SpDs;}
10850       if(HistoCode == "D_Adc_EvDs"){name_same = fCanvSameD_Adc_EvDs;}
10851       if(HistoCode == "D_Adc_EvNb"){name_same = fCanvSameD_Adc_EvNb;}     
10852       if(HistoCode == "H_Ped_Date"){name_same = fCanvSameH_Ped_Date;}
10853       if(HistoCode == "H_TNo_Date"){name_same = fCanvSameH_TNo_Date;}
10854       if(HistoCode == "H_MCs_Date"){name_same = fCanvSameH_MCs_Date;}
10855       if(HistoCode == "H_LFN_Date"){name_same = fCanvSameH_LFN_Date;}
10856       if(HistoCode == "H_HFN_Date"){name_same = fCanvSameH_HFN_Date;}
10857       if(HistoCode == "H_SCs_Date"){name_same = fCanvSameH_SCs_Date;}
10858       if(HistoCode == "H_Ped_RuDs"){name_same = fCanvSameH_Ped_RuDs;}
10859       if(HistoCode == "H_TNo_RuDs"){name_same = fCanvSameH_TNo_RuDs;}
10860       if(HistoCode == "H_MCs_RuDs"){name_same = fCanvSameH_MCs_RuDs;}
10861       if(HistoCode == "H_LFN_RuDs"){name_same = fCanvSameH_LFN_RuDs;}
10862       if(HistoCode == "H_HFN_RuDs"){name_same = fCanvSameH_HFN_RuDs;}
10863       if(HistoCode == "H_SCs_RuDs"){name_same = fCanvSameH_SCs_RuDs;}   
10864 
10865       sprintf(f_in,"%d", name_same);
10866       TString s_name_same = f_in;     
10867       const Text_t *t_name_same = (const Text_t *)s_name_same.Data();
10868       name_opt_plot.Append(t_name_same);
10869     } 
10870   if(opt_plot == fSameOnePlot)
10871     {
10872       name_opt_plot = "SAME_Plus_N";
10873       //...................................... name_same (opt_plot = fSeveralPlot)
10874       Int_t name_same = fCanvSameH1SamePlus;
10875       sprintf(f_in,"%d", name_same);
10876       TString s_name_same = f_in;     
10877       const Text_t *t_name_same = (const Text_t *)s_name_same.Data();
10878       name_opt_plot.Append(t_name_same);
10879     }
10880 
10881   //......................... name_visu (Set Canvas name)
10882   TString name_visu;
10883   MaxCar = fgMaxCar;
10884   name_visu.Resize(MaxCar);
10885   name_visu = "";
10886           
10887   TString name_line;
10888   MaxCar = fgMaxCar;
10889   name_line.Resize(MaxCar);
10890   name_line = "Line_";
10891   TString HistoType = fCnaParHistos->GetHistoType(HistoCode.Data());
10892   if( HistoType == "Global" && (opt_plot == fSeveralPlot || opt_plot == fSameOnePlot) ){name_line = "Polm_";}
10893 
10894   // if(opt_visu == fOptVisLine){name_line = "Line_";}
10895   // if(opt_visu == fOptVisPolm){name_line = "Poly_";}
10896 
10897   const Text_t *t_line = (const Text_t *)name_line.Data();
10898   name_visu.Append(t_line);
10899 
10900   TString name_scale_x;
10901   MaxCar = fgMaxCar;
10902   name_scale_x.Resize(MaxCar);
10903   name_scale_x = "?";
10904   if(opt_scale_x == fOptScaleLinx){name_scale_x = "LinX_";}
10905   if(opt_scale_x == fOptScaleLogx){name_scale_x = "LogX_";}
10906   const Text_t *t_scale_x = (const Text_t *)name_scale_x.Data();
10907   name_visu.Append(t_scale_x);
10908 
10909   TString name_scale_y;
10910   MaxCar = fgMaxCar;
10911   name_scale_y.Resize(MaxCar);
10912   name_scale_y = "?";
10913   if(opt_scale_y == fOptScaleLiny){name_scale_y = "LinY";}
10914   if(opt_scale_y == fOptScaleLogy){name_scale_y = "LogY";}
10915   const Text_t *t_scale_y = (const Text_t *)name_scale_y.Data();
10916   name_visu.Append(t_scale_y);
10917 
10918   //...................................... name quantity (Set Canvas name)
10919   TString  name_quantity;
10920   MaxCar = fgMaxCar;
10921   name_quantity.Resize(MaxCar);
10922   name_quantity = "?";
10923 
10924   if(HistoCode == "D_NOE_ChNb"){name_quantity = "Nb_of_evts_as_func_of_Xtal";}
10925   if(HistoCode == "D_NOE_ChDs"){name_quantity = "Nb_of_evts_Xtal_distrib";}
10926   if(HistoCode == "D_Ped_ChNb"){name_quantity = "Pedestals_as_func_of_Xtal";}
10927   if(HistoCode == "D_Ped_ChDs"){name_quantity = "Pedestals_Xtal_distrib";}
10928   if(HistoCode == "D_TNo_ChNb"){name_quantity = "Total_Noise_as_func_of_Xtal";}
10929   if(HistoCode == "D_TNo_ChDs"){name_quantity = "Total_Noise_Xtal_distrib";}
10930   if(HistoCode == "D_MCs_ChNb"){name_quantity = "Mean_Corss_as_func_of_Xtal";}
10931   if(HistoCode == "D_MCs_ChDs"){name_quantity = "Mean_Corss_Xtal_distrib";}
10932   if(HistoCode == "D_LFN_ChNb"){name_quantity = "Low_Fq_Noise_as_func_of_Xtal";}
10933   if(HistoCode == "D_LFN_ChDs"){name_quantity = "Low_Fq_Noise_Xtal_distrib";}
10934   if(HistoCode == "D_HFN_ChNb"){name_quantity = "High_Fq_Noise_as_func_of_Xtal";}
10935   if(HistoCode == "D_HFN_ChDs"){name_quantity = "High_Fq_Noise_Xtal_distrib";}
10936   if(HistoCode == "D_SCs_ChNb"){name_quantity = "Sigma_Corss_as_func_of_Xtal";}
10937   if(HistoCode == "D_SCs_ChDs"){name_quantity = "Sigma_Corss_Xtal_distrib";}
10938   if(HistoCode == "D_MSp_SpNb"){name_quantity = "ExpValue_of_samples";}
10939   if(HistoCode == "D_MSp_SpDs"){name_quantity = "ExpValue_of_samples_distrib";}
10940   if(HistoCode == "D_SSp_SpNb"){name_quantity = "Sigma_of_samples";}
10941   if(HistoCode == "D_SSp_SpDs"){name_quantity = "Sigma_of_samples_distrib";}
10942   if(HistoCode == "D_Adc_EvDs"){name_quantity = "hevt";}
10943   if(HistoCode == "D_Adc_EvNb"){name_quantity = "ADC_as_func_of_Event";}          
10944   if(HistoCode == "H_Ped_Date"){name_quantity = "Pedestal_history";}
10945   if(HistoCode == "H_TNo_Date"){name_quantity = "Total_Noise_history";}
10946   if(HistoCode == "H_MCs_Date"){name_quantity = "Mean_Corss_history";}
10947   if(HistoCode == "H_LFN_Date"){name_quantity = "Low_Fq_Noise_history";}
10948   if(HistoCode == "H_HFN_Date"){name_quantity = "High_Fq_Noise_history";}
10949   if(HistoCode == "H_SCs_Date"){name_quantity = "Sigma_Corss_history";}
10950   if(HistoCode == "H_Ped_RuDs"){name_quantity = "Pedestal_run_distribution";}
10951   if(HistoCode == "H_TNo_RuDs"){name_quantity = "Total_Noise_run_distribution";}
10952   if(HistoCode == "H_MCs_RuDs"){name_quantity = "Mean_Corss_run_distribution";}
10953   if(HistoCode == "H_LFN_RuDs"){name_quantity = "Low_Fq_Noise_run_distribution";}
10954   if(HistoCode == "H_HFN_RuDs"){name_quantity = "High_Fq_Noise_run_distribution";}
10955   if(HistoCode == "H_SCs_RuDs"){name_quantity = "Sigma_Corss_run_distribution";}
10956 
10957   Int_t num_crys = -1;
10958   if(HistoCode == "D_MSp_SpNb"){num_crys = i0StinEcha;}
10959   if(HistoCode == "D_MSp_SpDs"){num_crys = i0StinEcha;}
10960   if(HistoCode == "D_SSp_SpNb"){num_crys = i0StinEcha;}
10961   if(HistoCode == "D_SSp_SpDs"){num_crys = i0StinEcha;}
10962   if(HistoCode == "D_Adc_EvDs"){num_crys = i0StinEcha;}
10963   if(HistoCode == "D_Adc_EvNb"){num_crys = i0StinEcha;}   
10964   if(HistoCode == "H_Ped_Date"){num_crys = i0StinEcha;}
10965   if(HistoCode == "H_TNo_Date"){num_crys = i0StinEcha;}
10966   if(HistoCode == "H_MCs_Date"){num_crys = i0StinEcha;}
10967   if(HistoCode == "H_LFN_Date"){num_crys = i0StinEcha;}
10968   if(HistoCode == "H_HFN_Date"){num_crys = i0StinEcha;}
10969   if(HistoCode == "H_SCs_Date"){num_crys = i0StinEcha;}
10970   if(HistoCode == "H_Ped_RuDs"){num_crys = i0StinEcha;}
10971   if(HistoCode == "H_TNo_RuDs"){num_crys = i0StinEcha;}
10972   if(HistoCode == "H_MCs_RuDs"){num_crys = i0StinEcha;}
10973   if(HistoCode == "H_LFN_RuDs"){num_crys = i0StinEcha;}
10974   if(HistoCode == "H_HFN_RuDs"){num_crys = i0StinEcha;}
10975   if(HistoCode == "H_SCs_RuDs"){num_crys = i0StinEcha;}
10976 
10977   Int_t num_samp = -1;
10978   if(HistoCode == "D_Adc_EvDs"){num_samp = i0Sample;}
10979   if(HistoCode == "D_Adc_EvNb"){num_samp = i0Sample;}
10980 
10981   //........................................................... (Set Canvas name)
10982   
10983   if (HistoCode == "D_NOE_ChNb" || HistoCode == "D_NOE_ChDs" || 
10984       HistoCode == "D_Ped_ChNb" || HistoCode == "D_Ped_ChDs" ||
10985       HistoCode == "D_TNo_ChNb" || HistoCode == "D_TNo_ChDs" ||
10986       HistoCode == "D_MCs_ChNb" || HistoCode == "D_MCs_ChDs" ||
10987       HistoCode == "D_LFN_ChNb" || HistoCode == "D_LFN_ChDs" || 
10988       HistoCode == "D_HFN_ChNb" || HistoCode == "D_HFN_ChDs" ||
10989       HistoCode == "D_SCs_ChNb" || HistoCode == "D_SCs_ChDs" )
10990     {
10991       sprintf(f_in, "%s_%s_S1_%d_R%d_%d_%d_%d_%s%d_%s_%s",
10992               name_quantity.Data(), fFapAnaType.Data(),
10993               fFapNbOfSamples, fFapRunNumber, fFapFirstReqEvtNumber, fFapLastReqEvtNumber, fFapReqNbOfEvts,
10994               fFapStexName.Data(), fFapStexNumber,
10995               name_opt_plot.Data(), name_visu.Data());
10996     }
10997   
10998   if (HistoCode == "D_MSp_SpNb" || HistoCode == "D_SSp_SpNb" ||
10999       HistoCode == "H_Ped_Date" || HistoCode == "H_TNo_Date" || HistoCode == "H_MCs_Date" ||
11000       HistoCode == "H_LFN_Date" || HistoCode == "H_HFN_Date" || HistoCode == "H_SCs_Date" ||
11001       HistoCode == "D_MSp_SpDs" || HistoCode == "D_SSp_SpDs" ||
11002       HistoCode == "H_Ped_RuDs" || HistoCode == "H_TNo_RuDs" || HistoCode == "H_MCs_RuDs" ||
11003       HistoCode == "H_LFN_RuDs" || HistoCode == "H_HFN_RuDs" || HistoCode == "H_SCs_RuDs")
11004     {
11005       sprintf(f_in, "%s_%s_S1_%d_R%d_%d_%d_%d_%s%d_%s%d_Xtal%d_%s_%s",
11006               name_quantity.Data(), fFapAnaType.Data(), 
11007               fFapNbOfSamples, fFapRunNumber, fFapFirstReqEvtNumber, fFapLastReqEvtNumber, fFapReqNbOfEvts,
11008               fFapStexName.Data(), fFapStexNumber, fFapStinName.Data(), StexStin_A, num_crys,
11009               name_opt_plot.Data(), name_visu.Data()); 
11010     }
11011   
11012   if (HistoCode == "D_Adc_EvNb" || HistoCode == "D_Adc_EvDs")
11013     {
11014       sprintf(f_in, "%s_%s_S1_%d_R%d_%d_%d_%d_%s%d_%s%d_Xtal%d_Samp%d_%s_%s",
11015               name_quantity.Data(), fFapAnaType.Data(),
11016               fFapNbOfSamples, fFapRunNumber, fFapFirstReqEvtNumber, fFapLastReqEvtNumber, fFapReqNbOfEvts,
11017               fFapStexName.Data(), fFapStexNumber, fFapStinName.Data(), StexStin_A, num_crys, num_samp,
11018               name_opt_plot.Data(), name_visu.Data());
11019     }
11020   
11021   canvas_name = f_in;
11022   delete [] f_in;    f_in = 0;              fCdelete++;
11023   return canvas_name.Data();
11024   
11025 }  // end of CanvasName()
11026 
11027 //-----------------------------------------------------------------------------
11028 //
11029 //        M I S C E L L A N E O U S     P A R A M E T E R S
11030 //
11031 //        C O N C E R N I N G    T H E    D I S P L A Y   
11032 //
11033 //-----------------------------------------------------------------------------
11034 
11035 //===========================================================================
11036 //
11037 //  GetHistoSize, GetHistoValues, SetHistoXAxisTitle,   SetHistoYAxisTitle,
11038 //  GetHistoXinf, GetHistoXsup,   GetHistoNumberOfBins, FillHisto
11039 //
11040 //===========================================================================
11041 Int_t TEcnaHistos::GetHistoSize(const TString chqcode, const TString opt_plot_read)
11042 {
11043 // Histo size as a function of the quantity code
11044 
11045 // VERY IMPORTANT: in some cases the number of bins must be strictly related to the parameters values
11046 //                 (number of crystals, number of samples, etc...). See below comments "===> ONE BIN BY..."
11047 
11048   Int_t HisSize = fNbBinsProj;   // default value
11049 
11050   //............ histo with sample number as x coordinate => HisSize depends on option "plot" or "read"
11051   //             because of nb of samples in file: size for plot = 10 even if nb of samples in file < 10
11052   if( chqcode == "D_MSp_SpNb" ||  chqcode == "D_SSp_SpNb" ||
11053       chqcode == "D_MSp_SpDs" ||  chqcode == "D_SSp_SpDs" )
11054     {
11055       if( opt_plot_read == "read" ){HisSize = fFapNbOfSamples;}
11056       if( opt_plot_read == "plot" ){HisSize = fEcal->MaxSampADC();}
11057     }   // ===> ONE BIN BY SAMPLE
11058 
11059   //............ histo with event number as x coordinate.  (==> "D_Adc_EvDs" option: obsolete, to be confirmed)
11060   if(chqcode == "D_Adc_EvNb" || chqcode == "D_Adc_EvDs"){HisSize = fFapReqNbOfEvts;}   // ===> ONE BIN BY EVENT
11061   
11062   //............ 
11063   if(chqcode == "D_NOE_ChNb" ||
11064      chqcode == "D_Ped_ChNb" || chqcode == "D_TNo_ChNb" || chqcode == "D_MCs_ChNb" ||
11065      chqcode == "D_LFN_ChNb" || chqcode == "D_HFN_ChNb" || chqcode == "D_SCs_ChNb" ||
11066      chqcode == "D_NOE_ChDs" ||
11067      chqcode == "D_Ped_ChDs" || chqcode == "D_TNo_ChDs" || chqcode == "D_MCs_ChDs" || 
11068      chqcode == "D_LFN_ChDs" || chqcode == "D_HFN_ChDs" || chqcode == "D_SCs_ChDs" )
11069     {
11070       if( fFlagSubDet == "EB" )
11071         {
11072           if( fFapStexNumber >  0 ){HisSize = fEcal->MaxCrysEcnaInStex();}             // ===> ONE BIN BY Xtal
11073           if( fFapStexNumber == 0 ){HisSize = fEcal->MaxSMInEB()*fEcal->MaxTowInSM();} // ===> ONE BIN BY Tower
11074         }
11075       if( fFlagSubDet == "EE" )
11076         {
11077           if( fFapStexNumber >  0 )
11078             {
11079               if( opt_plot_read == "read" ){HisSize = fEcal->MaxCrysEcnaInDee();}
11080               if( opt_plot_read == "plot" ){HisSize = fEcal->MaxCrysForConsInDee();}
11081             }                                                           // ===> ONE BIN BY Xtal
11082           if( fFapStexNumber == 0 )
11083             {HisSize = fEcal->MaxDeeInEE()*fEcal->MaxSCForConsInDee();} // ===> ONE BIN BY SC
11084         }
11085     }
11086 
11087   if( chqcode == "H_Ped_RuDs" || chqcode == "H_TNo_RuDs" || chqcode == "H_MCs_RuDs" || 
11088       chqcode == "H_LFN_RuDs" || chqcode == "H_HFN_RuDs" || chqcode == "H_SCs_RuDs" )
11089     {
11090       HisSize = fNbBinsProj;
11091     }
11092 
11093   return HisSize;
11094 }
11095 
11096 TVectorD TEcnaHistos::GetHistoValues(const TVectorD& arg_read_histo, const Int_t&  arg_AlreadyRead,
11097                                      TEcnaRead*      aMyRootFile,    const TString HistoCode,
11098                                      const Int_t&    HisSizePlot,    const Int_t&  HisSizeRead,
11099                                      const Int_t&    StexStin_A,     const Int_t&  i0StinEcha,
11100                                      const Int_t&    i0Sample,       Int_t&  i_data_exist)
11101 {
11102   // Histo values in a TVectorD. i_data_exist entry value = 0. Incremented in this method.
11103 
11104   TVectorD plot_histo(HisSizePlot); for(Int_t i=0; i<HisSizePlot; i++){plot_histo(i)=(Double_t)0.;}
11105 
11106   fStatusDataExist = kFALSE;
11107 
11108   if( arg_AlreadyRead >= 1 )
11109     {
11110       //cout << "*TEcnaHistos::GetHistoValues(...)> arg_AlreadyRead = " << arg_AlreadyRead << endl;
11111       for(Int_t i=0; i<HisSizeRead; i++){plot_histo(i)=arg_read_histo(i);}
11112       fStatusDataExist = kTRUE; i_data_exist++;
11113     }
11114 
11115   if( arg_AlreadyRead == 0 )
11116     {
11117       //cout << "*TEcnaHistos::GetHistoValues(...)> arg_AlreadyRead = " << arg_AlreadyRead << endl;
11118       TVectorD read_histo(HisSizeRead); for(Int_t i=0; i<HisSizeRead; i++){read_histo(i)=(Double_t)0.;}
11119 
11120       if( HistoCode == "D_MSp_SpNb" || HistoCode == "D_MSp_SpDs" ||
11121           HistoCode == "D_SSp_SpNb" || HistoCode == "D_SSp_SpDs" )
11122         {
11123           //====> For plots as a function of Sample# (read10->plot10, read3->plot10)
11124           if( HisSizeRead <= HisSizePlot )
11125             {
11126               if (HistoCode == "D_MSp_SpNb" || HistoCode == "D_MSp_SpDs" )
11127                 {
11128                   read_histo = aMyRootFile->ReadSampleMeans(StexStin_A, i0StinEcha, HisSizeRead);
11129                   if( aMyRootFile->DataExist() == kTRUE ){fStatusDataExist = kTRUE; i_data_exist++;}
11130                   for(Int_t i=0; i<HisSizeRead; i++){plot_histo(i)=read_histo(i);}
11131                 }
11132           
11133               if (HistoCode == "D_SSp_SpNb" || HistoCode == "D_SSp_SpDs" )
11134                 {
11135                   read_histo = aMyRootFile->ReadSampleSigmas(StexStin_A, i0StinEcha, HisSizeRead);
11136                   if( aMyRootFile->DataExist() == kTRUE ){fStatusDataExist = kTRUE; i_data_exist++;}
11137                   for(Int_t i=0; i<HisSizeRead; i++){plot_histo(i)=read_histo(i);}
11138                 }
11139             }
11140           else
11141             {
11142               cout << "!TEcnaHistos::GetHistoValues(...)> *** ERROR *** > HisSizeRead greater than HisSizePlot"
11143                    << " for plot as a function of sample#. HisSizeRead = " << HisSizeRead
11144                    << ", HisSizePlot = " << HisSizePlot << fTTBELL << endl;
11145             }
11146         } // end of if( HistoCode == "D_MSp_SpNb" || HistoCode == "D_SSp_SpNb" " ||
11147           //            HistoCode == "D_SSp_SpNb" || HistoCode == "D_SSp_SpDs" )
11148 
11149       if( !(HistoCode == "D_MSp_SpNb" || HistoCode == "D_SSp_SpNb" ||
11150             HistoCode == "D_MSp_SpDs" || HistoCode == "D_SSp_SpDs" ) )  // = else of previous if
11151         {
11152           //====> For other plots
11153           if( HisSizeRead == HisSizePlot )
11154             {
11155               //========> for EE, HisSizeRead > HisSizePlot but readEcna#->plotForCons# will be build in the calling method
11156               //          HisSizeRead = fEcal->MaxCrysEcnaInStex() (GetHistoValues)
11157 
11158               if( HistoCode == "D_Adc_EvNb" || HistoCode == "D_Adc_EvDs" )
11159                 {
11160                   read_histo = aMyRootFile->ReadSampleAdcValues(StexStin_A, i0StinEcha, i0Sample, HisSizeRead);
11161                   if( aMyRootFile->DataExist() == kTRUE ){fStatusDataExist = kTRUE; i_data_exist++;}
11162                 }
11163 
11164               if( HistoCode == "D_NOE_ChNb" || HistoCode == "D_NOE_ChDs" )
11165                 {
11166                   read_histo = aMyRootFile->ReadNumberOfEvents(HisSizeRead);
11167                   if( aMyRootFile->DataExist() == kTRUE ){fStatusDataExist = kTRUE; i_data_exist++;}
11168                 }
11169       
11170               if( HistoCode == "D_Ped_ChNb" || HistoCode == "D_Ped_ChDs" )
11171                 {
11172                   read_histo = aMyRootFile->ReadPedestals(HisSizeRead);
11173                   if( aMyRootFile->DataExist() == kTRUE ){fStatusDataExist = kTRUE; i_data_exist++;}
11174                 }
11175       
11176               //...................................................... (GetHistoValues)
11177               if( HistoCode == "D_TNo_ChNb" || HistoCode == "D_TNo_ChDs")
11178                 {
11179                   read_histo = aMyRootFile->ReadTotalNoise(HisSizeRead);
11180                   if( aMyRootFile->DataExist() == kTRUE ){fStatusDataExist = kTRUE; i_data_exist++;}
11181                 }
11182       
11183               if( HistoCode == "D_LFN_ChNb" || HistoCode == "D_LFN_ChDs" )
11184                 {
11185                   read_histo = aMyRootFile->ReadLowFrequencyNoise(HisSizeRead);
11186                   if( aMyRootFile->DataExist() == kTRUE ){fStatusDataExist = kTRUE; i_data_exist++;}
11187                 
11188                 }
11189       
11190               if( HistoCode == "D_HFN_ChNb" || HistoCode == "D_HFN_ChDs" )
11191                 {
11192                   read_histo = aMyRootFile->ReadHighFrequencyNoise(HisSizeRead);
11193                   if( aMyRootFile->DataExist() == kTRUE ){fStatusDataExist = kTRUE; i_data_exist++;}
11194                 
11195                 }
11196 
11197               if( HistoCode == "D_MCs_ChNb" || HistoCode == "D_MCs_ChDs" )
11198                 {
11199                   read_histo = aMyRootFile->ReadMeanCorrelationsBetweenSamples(HisSizeRead);
11200                   if( aMyRootFile->DataExist() == kTRUE ){fStatusDataExist = kTRUE; i_data_exist++;}
11201                 }
11202 
11203               if( HistoCode == "D_SCs_ChNb" || HistoCode == "D_SCs_ChDs"  )
11204                 {
11205                   read_histo = aMyRootFile->ReadSigmaOfCorrelationsBetweenSamples(HisSizeRead);
11206                   if( aMyRootFile->DataExist() == kTRUE ){fStatusDataExist = kTRUE; i_data_exist++;}
11207                 }
11208 
11209               for(Int_t i=0; i<HisSizeRead; i++){plot_histo(i)=read_histo(i);}
11210             
11211             }
11212           else
11213             {
11214               cout << "!TEcnaHistos::GetHistoValues(...)> *** ERROR *** > HisSizeRead not equal to HisSizePlot."
11215                    << " HisSizeRead = " << HisSizeRead
11216                    << ", HisSizePlot = " << HisSizePlot << fTTBELL << endl;
11217             }
11218         }  // end of if( !(HistoCode == "D_MSp_SpNb" || HistoCode == "D_SSp_SpNb") )
11219     }  // end of if( arg_AlreadyRead == 0 )
11220 
11221   if( i_data_exist == 0 )
11222     {
11223       cout << "!TEcnaHistos::GetHistoValues(...)> Histo not found." << fTTBELL << endl;
11224     }
11225 
11226   return plot_histo;
11227 }
11228 //------- (end of GetHistoValues) -------------
11229 
11230 TString  TEcnaHistos::SetHistoXAxisTitle(const TString HistoCode)
11231 {
11232   // Set histo X axis title
11233 
11234   TString axis_x_var_name;
11235   
11236   if(HistoCode == "D_NOE_ChNb" || HistoCode == "D_Ped_ChNb" ||
11237      HistoCode == "D_TNo_ChNb" || HistoCode == "D_MCs_ChNb" ||
11238      HistoCode == "D_LFN_ChNb" || HistoCode == "D_HFN_ChNb" ||
11239      HistoCode == "D_SCs_ChNb" )
11240     {
11241       if( fFapStexNumber >  0 )
11242         {
11243           if( fFlagSubDet == "EB" ){axis_x_var_name = "Xtal (electronic channel number)";}
11244           if( fFlagSubDet == "EE" ){axis_x_var_name = "Xtal";}
11245         }
11246       if( fFapStexNumber ==  0 )
11247         {
11248           if( fFlagSubDet == "EB" ){axis_x_var_name = "Tower number";}
11249           if( fFlagSubDet == "EE" ){axis_x_var_name = "SC number";}
11250         }
11251     }
11252 
11253   if(HistoCode == "D_NOE_ChDs"){axis_x_var_name = "Number of events";}
11254   if(HistoCode == "D_Ped_ChDs"){axis_x_var_name = "Pedestal";}
11255   if(HistoCode == "D_TNo_ChDs"){axis_x_var_name = "Total noise";}
11256   if(HistoCode == "D_MCs_ChDs"){axis_x_var_name = "Mean cor(s,s')";}
11257   if(HistoCode == "D_LFN_ChDs"){axis_x_var_name = "Low frequency noise";} 
11258   if(HistoCode == "D_HFN_ChDs"){axis_x_var_name = "High frequency noise";}
11259   if(HistoCode == "D_SCs_ChDs"){axis_x_var_name = "Sigmas cor(s,s')";}
11260   if(HistoCode == "D_MSp_SpNb"){axis_x_var_name = "Sample";}
11261   if(HistoCode == "D_MSp_SpDs"){axis_x_var_name = "Pedestal";}
11262   if(HistoCode == "D_SSp_SpNb"){axis_x_var_name = "Sample";}
11263   if(HistoCode == "D_SSp_SpDs"){axis_x_var_name = "Total noise";}
11264   if(HistoCode == "D_Adc_EvDs"){axis_x_var_name = "ADC";}
11265   if(HistoCode == "D_Adc_EvNb"){axis_x_var_name = "Event number";}
11266   if(HistoCode == "H_Ped_Date" || HistoCode == "H_TNo_Date" || HistoCode == "H_MCs_Date" ||
11267      HistoCode == "H_LFN_Date" || HistoCode == "H_HFN_Date" || HistoCode == "H_SCs_Date")
11268     {axis_x_var_name = "Time";}
11269   if(HistoCode == "H_Ped_RuDs"){axis_x_var_name = "Pedestal";}
11270   if(HistoCode == "H_TNo_RuDs"){axis_x_var_name = "Total noise";}
11271   if(HistoCode == "H_MCs_RuDs"){axis_x_var_name = "Mean cor(s,s')";}
11272   if(HistoCode == "H_LFN_RuDs"){axis_x_var_name = "Low frequency noise";} 
11273   if(HistoCode == "H_HFN_RuDs"){axis_x_var_name = "High frequency noise";}
11274   if(HistoCode == "H_SCs_RuDs"){axis_x_var_name = "Sigmas cor(s,s')";} 
11275 
11276   return axis_x_var_name; 
11277 }
11278 
11279 TString  TEcnaHistos::SetHistoYAxisTitle(const TString HistoCode)
11280 {
11281 // Set histo Y axis title
11282 
11283   TString axis_y_var_name;
11284 
11285   if(HistoCode == "D_NOE_ChNb"){axis_y_var_name = "Number of events";}
11286   if(HistoCode == "D_Ped_ChNb"){axis_y_var_name = "Pedestal";}
11287   if(HistoCode == "D_TNo_ChNb"){axis_y_var_name = "Total noise";}
11288   if(HistoCode == "D_MCs_ChNb"){axis_y_var_name = "Mean cor(s,s')";}
11289   if(HistoCode == "D_LFN_ChNb"){axis_y_var_name = "Low frequency noise";} 
11290   if(HistoCode == "D_HFN_ChNb"){axis_y_var_name = "High frequency noise";}  
11291   if(HistoCode == "D_SCs_ChNb"){axis_y_var_name = "Sigma of cor(s,s')";}
11292   
11293   if(HistoCode == "D_NOE_ChDs" ||
11294      HistoCode == "D_Ped_ChDs" || HistoCode == "D_TNo_ChDs" || HistoCode == "D_MCs_ChDs" ||
11295      HistoCode == "D_LFN_ChDs" || HistoCode == "D_HFN_ChDs" || HistoCode == "D_SCs_ChDs" )  
11296     {
11297       if( fFapStexNumber >  0 ){axis_y_var_name = "number of crystals";}
11298       if( fFapStexNumber == 0 )
11299         {
11300           if( fFlagSubDet == "EB" ){axis_y_var_name = "number of towers";}
11301           if( fFlagSubDet == "EE" ){axis_y_var_name = "number of SC's";}
11302         }
11303     }
11304 
11305   if(HistoCode == "D_MSp_SpNb"){axis_y_var_name = "Sample mean";}
11306   if(HistoCode == "D_MSp_SpDs"){axis_y_var_name = "Number of samples";}
11307   if(HistoCode == "D_SSp_SpNb"){axis_y_var_name = "Sample sigma";}
11308   if(HistoCode == "D_SSp_SpDs"){axis_y_var_name = "Number of samples";}
11309   if(HistoCode == "D_Adc_EvNb"){axis_y_var_name = "Sample ADC value";}
11310   if(HistoCode == "D_Adc_EvDs"){axis_y_var_name = "Number of events";}
11311   if(HistoCode == "H_Ped_Date"){axis_y_var_name = "Pedestal";}
11312   if(HistoCode == "H_TNo_Date"){axis_y_var_name = "Total noise";}
11313   if(HistoCode == "H_MCs_Date"){axis_y_var_name = "Mean cor(s,s')";}
11314   if(HistoCode == "H_LFN_Date"){axis_y_var_name = "Low frequency noise";}
11315   if(HistoCode == "H_HFN_Date"){axis_y_var_name = "High frequency noise";}
11316   if(HistoCode == "H_SCs_Date"){axis_y_var_name = "Sigma cor(s,s')";}
11317 
11318   if(HistoCode == "H_Ped_RuDs" || HistoCode == "H_TNo_RuDs" || HistoCode == "H_MCs_RuDs" ||
11319      HistoCode == "H_LFN_RuDs" || HistoCode == "H_HFN_RuDs" ||  HistoCode == "H_SCs_RuDs" ) 
11320     {axis_y_var_name = "number of runs";}
11321 
11322   return axis_y_var_name;
11323 }
11324 //-------------------------------------------------------------------------------
11325 Axis_t TEcnaHistos::GetHistoXinf(const TString HistoCode, const Int_t& HisSize, const TString opt_plot)
11326 {
11327 // Set histo Xinf
11328 
11329   Axis_t xinf_his = (Axis_t)0;
11330 
11331   if(HistoCode == "D_NOE_ChNb"){xinf_his = (Axis_t)0.;}
11332   if(HistoCode == "D_Ped_ChNb"){xinf_his = (Axis_t)0.;}
11333   if(HistoCode == "D_TNo_ChNb"){xinf_his = (Axis_t)0.;}
11334   if(HistoCode == "D_MCs_ChNb"){xinf_his = (Axis_t)0.;}
11335   if(HistoCode == "D_LFN_ChNb"){xinf_his = (Axis_t)0.;} 
11336   if(HistoCode == "D_HFN_ChNb"){xinf_his = (Axis_t)0.;}  
11337   if(HistoCode == "D_SCs_ChNb"){xinf_his = (Axis_t)0.;}
11338   if(HistoCode == "D_MSp_SpNb"){xinf_his = (Axis_t)0.;}
11339   if(HistoCode == "D_SSp_SpNb"){xinf_his = (Axis_t)0.;}
11340   if(HistoCode == "D_Adc_EvNb"){xinf_his = (Axis_t)0.;}
11341 
11342   if(HistoCode == "D_NOE_ChDs"){xinf_his = (Axis_t)fD_NOE_ChNbYmin;}  // D_XXX_YYDs = projection of D_XXX_YYNb
11343   if(HistoCode == "D_Ped_ChDs"){xinf_his = (Axis_t)fD_Ped_ChNbYmin;}
11344   if(HistoCode == "D_TNo_ChDs"){xinf_his = (Axis_t)fD_TNo_ChNbYmin;}
11345   if(HistoCode == "D_MCs_ChDs"){xinf_his = (Axis_t)fD_MCs_ChNbYmin;}
11346   if(HistoCode == "D_LFN_ChDs"){xinf_his = (Axis_t)fD_LFN_ChNbYmin;}
11347   if(HistoCode == "D_HFN_ChDs"){xinf_his = (Axis_t)fD_HFN_ChNbYmin;}
11348   if(HistoCode == "D_SCs_ChDs"){xinf_his = (Axis_t)fD_SCs_ChNbYmin;}
11349   if(HistoCode == "D_MSp_SpDs"){xinf_his = (Axis_t)fD_MSp_SpNbYmin;}
11350   if(HistoCode == "D_SSp_SpDs"){xinf_his = (Axis_t)fD_SSp_SpNbYmin;}
11351   if(HistoCode == "D_Adc_EvDs"){xinf_his = (Axis_t)fD_Adc_EvNbYmin;}
11352 
11353   if(HistoCode == "H_Ped_Date"){xinf_his = (Axis_t)0.;}
11354   if(HistoCode == "H_TNo_Date"){xinf_his = (Axis_t)0.;}
11355   if(HistoCode == "H_MCs_Date"){xinf_his = (Axis_t)0.;}
11356   if(HistoCode == "H_LFN_Date"){xinf_his = (Axis_t)0.;}
11357   if(HistoCode == "H_HFN_Date"){xinf_his = (Axis_t)0.;}
11358   if(HistoCode == "H_SCs_Date"){xinf_his = (Axis_t)0.;}
11359 
11360   if(HistoCode == "H_Ped_RuDs"){xinf_his = (Axis_t)fH_Ped_RuDsYmin;}
11361   if(HistoCode == "H_TNo_RuDs"){xinf_his = (Axis_t)fH_TNo_RuDsYmin;}
11362   if(HistoCode == "H_MCs_RuDs"){xinf_his = (Axis_t)fH_MCs_RuDsYmin;}
11363   if(HistoCode == "H_LFN_RuDs"){xinf_his = (Axis_t)fH_LFN_RuDsYmin;}
11364   if(HistoCode == "H_HFN_RuDs"){xinf_his = (Axis_t)fH_HFN_RuDsYmin;}
11365   if(HistoCode == "H_SCs_RuDs"){xinf_his = (Axis_t)fH_SCs_RuDsYmin;}
11366 
11367   return xinf_his;
11368 }
11369 
11370 Axis_t TEcnaHistos::GetHistoXsup(const TString HistoCode, const Int_t& HisSize, const TString opt_plot)
11371 {
11372 // Set histo Xsup
11373 
11374   Axis_t xsup_his = (Axis_t)0; 
11375 
11376   if(HistoCode == "D_NOE_ChNb"){xsup_his = (Axis_t)HisSize;}
11377   if(HistoCode == "D_Ped_ChNb"){xsup_his = (Axis_t)HisSize;}
11378   if(HistoCode == "D_TNo_ChNb"){xsup_his = (Axis_t)HisSize;}
11379   if(HistoCode == "D_MCs_ChNb"){xsup_his = (Axis_t)HisSize;}
11380   if(HistoCode == "D_LFN_ChNb"){xsup_his = (Axis_t)HisSize;} 
11381   if(HistoCode == "D_HFN_ChNb"){xsup_his = (Axis_t)HisSize;}  
11382   if(HistoCode == "D_SCs_ChNb"){xsup_his = (Axis_t)HisSize;}
11383   if(HistoCode == "D_MSp_SpNb"){xsup_his = (Axis_t)HisSize;}
11384   if(HistoCode == "D_SSp_SpNb"){xsup_his = (Axis_t)HisSize;}
11385   if(HistoCode == "D_Adc_EvNb"){xsup_his = (Axis_t)(fFapReqNbOfEvts);}
11386 
11387   if(HistoCode == "D_NOE_ChDs"){xsup_his = (Axis_t)fD_NOE_ChNbYmax;}
11388   if(HistoCode == "D_Ped_ChDs"){xsup_his = (Axis_t)fD_Ped_ChNbYmax;}
11389   if(HistoCode == "D_TNo_ChDs"){xsup_his = (Axis_t)fD_TNo_ChNbYmax;}
11390   if(HistoCode == "D_MCs_ChDs"){xsup_his = (Axis_t)fD_MCs_ChNbYmax;}
11391   if(HistoCode == "D_LFN_ChDs"){xsup_his = (Axis_t)fD_LFN_ChNbYmax;}
11392   if(HistoCode == "D_HFN_ChDs"){xsup_his = (Axis_t)fD_HFN_ChNbYmax;}
11393   if(HistoCode == "D_SCs_ChDs"){xsup_his = (Axis_t)fD_SCs_ChNbYmax;}
11394   if(HistoCode == "D_MSp_SpDs"){xsup_his = (Axis_t)fD_MSp_SpNbYmax;}
11395   if(HistoCode == "D_SSp_SpDs"){xsup_his = (Axis_t)fD_SSp_SpNbYmax;}
11396   if(HistoCode == "D_Adc_EvDs"){xsup_his = (Axis_t)fD_Adc_EvNbYmax;}
11397 
11398   if(HistoCode == "H_Ped_Date"){xsup_his = (Axis_t)0.;}
11399   if(HistoCode == "H_TNo_Date"){xsup_his = (Axis_t)0.;}
11400   if(HistoCode == "H_MCs_Date"){xsup_his = (Axis_t)0.;}
11401   if(HistoCode == "H_LFN_Date"){xsup_his = (Axis_t)0.;}
11402   if(HistoCode == "H_HFN_Date"){xsup_his = (Axis_t)0.;}
11403   if(HistoCode == "H_SCs_Date"){xsup_his = (Axis_t)0.;}
11404 
11405   if(HistoCode == "H_Ped_RuDs"){xsup_his = (Axis_t)fH_Ped_RuDsYmax;}
11406   if(HistoCode == "H_TNo_RuDs"){xsup_his = (Axis_t)fH_TNo_RuDsYmax;}
11407   if(HistoCode == "H_MCs_RuDs"){xsup_his = (Axis_t)fH_MCs_RuDsYmax;}
11408   if(HistoCode == "H_LFN_RuDs"){xsup_his = (Axis_t)fH_LFN_RuDsYmax;}
11409   if(HistoCode == "H_HFN_RuDs"){xsup_his = (Axis_t)fH_HFN_RuDsYmax;}
11410   if(HistoCode == "H_SCs_RuDs"){xsup_his = (Axis_t)fH_SCs_RuDsYmax;}
11411 
11412   return xsup_his;
11413 }
11414 //-----------------------------------------------------------------------------------
11415 Int_t TEcnaHistos::GetHistoNumberOfBins(const TString HistoCode, const Int_t& HisSize)
11416 {
11417 // Set histo number of bins
11418 
11419   Int_t nb_binx = HisSize;
11420   TString HistoType = fCnaParHistos->GetHistoType(HistoCode.Data());
11421   if ( HistoType == "Proj"     ||  HistoType == "SampProj" ||
11422        HistoType == "EvolProj" || HistoType == "H1BasicProj" )
11423     {nb_binx = fNbBinsProj;}
11424 
11425   return nb_binx;
11426 }
11427 //-----------------------------------------------------------------------------------
11428 void TEcnaHistos::FillHisto(TH1D* h_his0, const TVectorD& read_histo, const TString HistoCode,
11429                             const Int_t&  HisSize)
11430 {
11431 // Fill histo
11432 
11433   h_his0->Reset();
11434 
11435   for(Int_t i=0; i<HisSize; i++)
11436     {
11437       Double_t his_val = (Double_t)0;
11438       Double_t xi      = (Double_t)0;
11439       //................................................... Basic + Global
11440       if (HistoCode == "D_NOE_ChNb" || HistoCode == "D_Ped_ChNb" ||
11441           HistoCode == "D_LFN_ChNb" || HistoCode == "D_TNo_ChNb" ||
11442           HistoCode == "D_HFN_ChNb" || HistoCode == "D_MCs_ChNb" ||
11443           HistoCode == "D_SCs_ChNb" || HistoCode == "D_MSp_SpNb" || HistoCode == "D_SSp_SpNb" )
11444         {
11445           xi = (Double_t)i;
11446           his_val = (Double_t)read_histo[i];
11447           h_his0->Fill(xi, his_val);
11448         }
11449 
11450       //................................................... D_Adc_EvNb option
11451       if (HistoCode == "D_Adc_EvNb" )
11452         {
11453           xi = (Double_t)i;
11454           his_val = (Double_t)read_histo[i];
11455           h_his0->Fill(xi, his_val);
11456         }
11457       //................................................... Proj
11458       if (HistoCode == "D_NOE_ChDs" ||
11459           HistoCode == "D_Ped_ChDs" || HistoCode == "D_LFN_ChDs" ||
11460           HistoCode == "D_TNo_ChDs" || HistoCode == "D_HFN_ChDs" ||
11461           HistoCode == "D_MCs_ChDs" || HistoCode == "D_SCs_ChDs" ||
11462           HistoCode == "D_MSp_SpDs" || HistoCode == "D_SSp_SpDs" ||
11463           HistoCode == "D_Adc_EvDs" )
11464         {
11465           his_val = (Double_t)read_histo[i];
11466           Double_t increment = (Double_t)1;
11467           h_his0->Fill(his_val, increment);
11468         }
11469 
11470       //................................................... EvolProj
11471       //
11472       //    *=======> direct Fill in ViewHistime(...)
11473       //
11474     }
11475 }
11476 
11477 //===========================================================================
11478 //
11479 //          SetXinfMemoFromValue(...), SetXsupMemoFromValue(...)
11480 //          GetXsupValueFromMemo(...), GetXsupValueFromMemo(...)
11481 //
11482 //===========================================================================
11483 void TEcnaHistos::SetXinfMemoFromValue(const TString HistoCode, const Double_t& value)
11484 {
11485   if( HistoCode == "D_NOE_ChNb"){fD_NOE_ChNbXinf = value;}
11486   if( HistoCode == "D_NOE_ChDs"){fD_NOE_ChDsXinf = value;}  
11487   if( HistoCode == "D_Ped_ChNb"){fD_Ped_ChNbXinf = value;} 
11488   if( HistoCode == "D_Ped_ChDs"){fD_Ped_ChDsXinf = value;} 
11489   if( HistoCode == "D_TNo_ChNb"){fD_TNo_ChNbXinf = value;}
11490   if( HistoCode == "D_TNo_ChDs"){fD_TNo_ChDsXinf = value;} 
11491   if( HistoCode == "D_MCs_ChNb"){fD_MCs_ChNbXinf = value;} 
11492   if( HistoCode == "D_MCs_ChDs"){fD_MCs_ChDsXinf = value;} 
11493   if( HistoCode == "D_LFN_ChNb"){fD_LFN_ChNbXinf = value;} 
11494   if( HistoCode == "D_LFN_ChDs"){fD_LFN_ChDsXinf = value;}
11495   if( HistoCode == "D_HFN_ChNb"){fD_HFN_ChNbXinf = value;} 
11496   if( HistoCode == "D_HFN_ChDs"){fD_HFN_ChDsXinf = value;} 
11497   if( HistoCode == "D_SCs_ChNb"){fD_SCs_ChNbXinf = value;}
11498   if( HistoCode == "D_SCs_ChDs"){fD_SCs_ChDsXinf = value;}
11499   if( HistoCode == "D_MSp_SpNb"){fD_Ped_ChNbXinf = value;}
11500   if( HistoCode == "D_MSp_SpDs"){fD_Ped_ChDsXinf = value;}
11501   if( HistoCode == "D_SSp_SpNb"){fD_TNo_ChNbXinf = value;}
11502   if( HistoCode == "D_SSp_SpDs"){fD_TNo_ChDsXinf = value;}
11503   if( HistoCode == "D_Adc_EvNb"){fD_Ped_ChNbXinf = value;}
11504   if( HistoCode == "D_Adc_EvDs"){fD_Adc_EvDsXinf = value;}
11505   if( HistoCode == "H_Ped_Date"){fH_Ped_DateXinf = value;}
11506   if( HistoCode == "H_TNo_Date"){fH_TNo_DateXinf = value;}
11507   if( HistoCode == "H_MCs_Date"){fH_MCs_DateXinf = value;}
11508   if( HistoCode == "H_LFN_Date"){fH_LFN_DateXinf = value;}
11509   if( HistoCode == "H_HFN_Date"){fH_HFN_DateXinf = value;}
11510   if( HistoCode == "H_SCs_Date"){fH_SCs_DateXinf = value;}
11511   if( HistoCode == "H_Ped_RuDs"){fH_Ped_RuDsXinf = value;}
11512   if( HistoCode == "H_TNo_RuDs"){fH_TNo_RuDsXinf = value;}
11513   if( HistoCode == "H_MCs_RuDs"){fH_MCs_RuDsXinf = value;}
11514   if( HistoCode == "H_LFN_RuDs"){fH_LFN_RuDsXinf = value;}
11515   if( HistoCode == "H_HFN_RuDs"){fH_HFN_RuDsXinf = value;}
11516   if( HistoCode == "H_SCs_RuDs"){fH_SCs_RuDsXinf = value;}
11517 }// end of SetXinfMemoFromValue(...)
11518 
11519 void TEcnaHistos::SetXinfMemoFromValue(const Double_t& value)
11520 {fH1SameOnePlotXinf = value;}
11521 
11522 void TEcnaHistos::SetXsupMemoFromValue(const TString HistoCode, const Double_t& value)
11523 {
11524   if( HistoCode == "D_NOE_ChNb"){fD_NOE_ChNbXsup = value;}
11525   if( HistoCode == "D_NOE_ChDs"){fD_NOE_ChDsXsup = value;}  
11526   if( HistoCode == "D_Ped_ChNb"){fD_Ped_ChNbXsup = value;} 
11527   if( HistoCode == "D_Ped_ChDs"){fD_Ped_ChDsXsup = value;} 
11528   if( HistoCode == "D_TNo_ChNb"){fD_TNo_ChNbXsup = value;}
11529   if( HistoCode == "D_TNo_ChDs"){fD_TNo_ChDsXsup = value;} 
11530   if( HistoCode == "D_MCs_ChNb"){fD_MCs_ChNbXsup = value;} 
11531   if( HistoCode == "D_MCs_ChDs"){fD_MCs_ChDsXsup = value;} 
11532   if( HistoCode == "D_LFN_ChNb"){fD_LFN_ChNbXsup = value;} 
11533   if( HistoCode == "D_LFN_ChDs"){fD_LFN_ChDsXsup = value;}
11534   if( HistoCode == "D_HFN_ChNb"){fD_HFN_ChNbXsup = value;} 
11535   if( HistoCode == "D_HFN_ChDs"){fD_HFN_ChDsXsup = value;} 
11536   if( HistoCode == "D_SCs_ChNb"){fD_SCs_ChNbXsup = value;}
11537   if( HistoCode == "D_SCs_ChDs"){fD_SCs_ChDsXsup = value;}
11538   if( HistoCode == "D_MSp_SpNb"){fD_Ped_ChNbXsup = value;}
11539   if( HistoCode == "D_MSp_SpDs"){fD_Ped_ChDsXsup = value;}
11540   if( HistoCode == "D_SSp_SpNb"){fD_TNo_ChNbXsup = value;}
11541   if( HistoCode == "D_SSp_SpDs"){fD_TNo_ChDsXsup = value;}
11542   if( HistoCode == "D_Adc_EvNb"){fD_Ped_ChNbXsup = value;}
11543   if( HistoCode == "D_Adc_EvDs"){fD_Adc_EvDsXsup = value;}
11544   if( HistoCode == "H_Ped_Date"){fH_Ped_DateXsup = value;}
11545   if( HistoCode == "H_TNo_Date"){fH_TNo_DateXsup = value;}
11546   if( HistoCode == "H_MCs_Date"){fH_MCs_DateXsup = value;}
11547   if( HistoCode == "H_LFN_Date"){fH_LFN_DateXsup = value;}
11548   if( HistoCode == "H_HFN_Date"){fH_HFN_DateXsup = value;}
11549   if( HistoCode == "H_SCs_Date"){fH_SCs_DateXsup = value;}
11550   if( HistoCode == "H_Ped_RuDs"){fH_Ped_RuDsXsup = value;}
11551   if( HistoCode == "H_TNo_RuDs"){fH_TNo_RuDsXsup = value;}
11552   if( HistoCode == "H_MCs_RuDs"){fH_MCs_RuDsXsup = value;}
11553   if( HistoCode == "H_LFN_RuDs"){fH_LFN_RuDsXsup = value;}
11554   if( HistoCode == "H_HFN_RuDs"){fH_HFN_RuDsXsup = value;}
11555   if( HistoCode == "H_SCs_RuDs"){fH_SCs_RuDsXsup = value;}
11556 }// end of SetXsupMemoFromValue(...)
11557 
11558 void TEcnaHistos::SetXsupMemoFromValue(const Double_t& value)
11559 {fH1SameOnePlotXsup = value;}
11560 
11561 Double_t TEcnaHistos::GetXinfValueFromMemo(const TString HistoCode)
11562 {
11563   Double_t val_inf      = (Double_t)0.;
11564 
11565    if( HistoCode == "D_NOE_ChNb"){val_inf = fD_NOE_ChNbXinf;}
11566    if( HistoCode == "D_NOE_ChDs"){val_inf = fD_NOE_ChDsXinf;}  
11567    if( HistoCode == "D_Ped_ChNb"){val_inf = fD_Ped_ChNbXinf;} 
11568    if( HistoCode == "D_Ped_ChDs"){val_inf = fD_Ped_ChDsXinf;} 
11569    if( HistoCode == "D_TNo_ChNb"){val_inf = fD_TNo_ChNbXinf;}
11570    if( HistoCode == "D_TNo_ChDs"){val_inf = fD_TNo_ChDsXinf;} 
11571    if( HistoCode == "D_MCs_ChNb"){val_inf = fD_MCs_ChNbXinf;} 
11572    if( HistoCode == "D_MCs_ChDs"){val_inf = fD_MCs_ChDsXinf;} 
11573    if( HistoCode == "D_LFN_ChNb"){val_inf = fD_LFN_ChNbXinf;} 
11574    if( HistoCode == "D_LFN_ChDs"){val_inf = fD_LFN_ChDsXinf;}
11575    if( HistoCode == "D_HFN_ChNb"){val_inf = fD_HFN_ChNbXinf;} 
11576    if( HistoCode == "D_HFN_ChDs"){val_inf = fD_HFN_ChDsXinf;} 
11577    if( HistoCode == "D_SCs_ChNb"){val_inf = fD_SCs_ChNbXinf;}
11578    if( HistoCode == "D_SCs_ChDs"){val_inf = fD_SCs_ChDsXinf;}
11579    if( HistoCode == "D_MSp_SpNb"){val_inf = fD_Ped_ChNbXinf;}
11580    if( HistoCode == "D_MSp_SpDs"){val_inf = fD_Ped_ChDsXinf;}
11581    if( HistoCode == "D_SSp_SpNb"){val_inf = fD_TNo_ChNbXinf;}
11582    if( HistoCode == "D_SSp_SpDs"){val_inf = fD_TNo_ChDsXinf;}
11583    if( HistoCode == "D_Adc_EvNb"){val_inf = fD_Adc_EvNbXinf;}
11584    if( HistoCode == "D_Adc_EvDs"){val_inf = fD_Adc_EvDsXinf;}
11585    if( HistoCode == "H_Ped_Date"){val_inf = fH_Ped_DateXinf;}
11586    if( HistoCode == "H_TNo_Date"){val_inf = fH_TNo_DateXinf;}
11587    if( HistoCode == "H_MCs_Date"){val_inf = fH_MCs_DateXinf;}
11588    if( HistoCode == "H_LFN_Date"){val_inf = fH_LFN_DateXinf;}
11589    if( HistoCode == "H_HFN_Date"){val_inf = fH_HFN_DateXinf;}
11590    if( HistoCode == "H_SCs_Date"){val_inf = fH_SCs_DateXinf;}
11591    if( HistoCode == "H_Ped_RuDs"){val_inf = fH_Ped_RuDsXinf;}
11592    if( HistoCode == "H_TNo_RuDs"){val_inf = fH_TNo_RuDsXinf;}
11593    if( HistoCode == "H_MCs_RuDs"){val_inf = fH_MCs_RuDsXinf;}
11594    if( HistoCode == "H_LFN_RuDs"){val_inf = fH_LFN_RuDsXinf;}
11595    if( HistoCode == "H_HFN_RuDs"){val_inf = fH_HFN_RuDsXinf;}
11596    if( HistoCode == "H_SCs_RuDs"){val_inf = fH_SCs_RuDsXinf;}
11597   return val_inf;
11598 }// end of GetXinfValueFromMemo(...)
11599 
11600 Double_t TEcnaHistos::GetXinfValueFromMemo()
11601 {return fH1SameOnePlotXinf;}
11602 
11603 Double_t TEcnaHistos::GetXsupValueFromMemo(const TString HistoCode)
11604 {
11605   Double_t val_sup      = (Double_t)0.;
11606 
11607    if( HistoCode == "D_NOE_ChNb"){val_sup = fD_NOE_ChNbXsup;}
11608    if( HistoCode == "D_NOE_ChDs"){val_sup = fD_NOE_ChDsXsup;}  
11609    if( HistoCode == "D_Ped_ChNb"){val_sup = fD_Ped_ChNbXsup;} 
11610    if( HistoCode == "D_Ped_ChDs"){val_sup = fD_Ped_ChDsXsup;} 
11611    if( HistoCode == "D_TNo_ChNb"){val_sup = fD_TNo_ChNbXsup;}
11612    if( HistoCode == "D_TNo_ChDs"){val_sup = fD_TNo_ChDsXsup;} 
11613    if( HistoCode == "D_MCs_ChNb"){val_sup = fD_MCs_ChNbXsup;} 
11614    if( HistoCode == "D_MCs_ChDs"){val_sup = fD_MCs_ChDsXsup;} 
11615    if( HistoCode == "D_LFN_ChNb"){val_sup = fD_LFN_ChNbXsup;} 
11616    if( HistoCode == "D_LFN_ChDs"){val_sup = fD_LFN_ChDsXsup;}
11617    if( HistoCode == "D_HFN_ChNb"){val_sup = fD_HFN_ChNbXsup;} 
11618    if( HistoCode == "D_HFN_ChDs"){val_sup = fD_HFN_ChDsXsup;} 
11619    if( HistoCode == "D_SCs_ChNb"){val_sup = fD_SCs_ChNbXsup;}
11620    if( HistoCode == "D_SCs_ChDs"){val_sup = fD_SCs_ChDsXsup;}
11621    if( HistoCode == "D_MSp_SpNb"){val_sup = fD_Ped_ChNbXsup;}
11622    if( HistoCode == "D_MSp_SpDs"){val_sup = fD_Ped_ChDsXsup;}
11623    if( HistoCode == "D_SSp_SpNb"){val_sup = fD_TNo_ChNbXsup;}
11624    if( HistoCode == "D_SSp_SpDs"){val_sup = fD_TNo_ChDsXsup;}
11625    if( HistoCode == "D_Adc_EvNb"){val_sup = fD_Adc_EvNbXsup;}
11626    if( HistoCode == "D_Adc_EvDs"){val_sup = fD_Adc_EvDsXsup;}
11627    if( HistoCode == "H_Ped_Date"){val_sup = fH_Ped_DateXsup;}
11628    if( HistoCode == "H_TNo_Date"){val_sup = fH_TNo_DateXsup;}
11629    if( HistoCode == "H_MCs_Date"){val_sup = fH_MCs_DateXsup;}
11630    if( HistoCode == "H_LFN_Date"){val_sup = fH_LFN_DateXsup;}
11631    if( HistoCode == "H_HFN_Date"){val_sup = fH_HFN_DateXsup;}
11632    if( HistoCode == "H_SCs_Date"){val_sup = fH_SCs_DateXsup;}
11633    if( HistoCode == "H_Ped_RuDs"){val_sup = fH_Ped_RuDsXsup;}
11634    if( HistoCode == "H_TNo_RuDs"){val_sup = fH_TNo_RuDsXsup;}
11635    if( HistoCode == "H_MCs_RuDs"){val_sup = fH_MCs_RuDsXsup;}
11636    if( HistoCode == "H_LFN_RuDs"){val_sup = fH_LFN_RuDsXsup;}
11637    if( HistoCode == "H_HFN_RuDs"){val_sup = fH_HFN_RuDsXsup;}
11638    if( HistoCode == "H_SCs_RuDs"){val_sup = fH_SCs_RuDsXsup;}
11639   return val_sup;
11640 }// end of GetXsupValueFromMemo(...)
11641 
11642 Double_t TEcnaHistos::GetXsupValueFromMemo()
11643 {return fH1SameOnePlotXsup;}
11644 
11645 //-------------------------------------------------------------------------------------------
11646 //
11647 //           SetHistoMin, SetHistoMax, SetAllYminYmaxMemoFromDefaultValues
11648 //
11649 //-------------------------------------------------------------------------------------------
11650 void TEcnaHistos::SetHistoMin(const Double_t& value){fUserHistoMin = value; fFlagUserHistoMin = "ON";}
11651 void TEcnaHistos::SetHistoMax(const Double_t& value){fUserHistoMax = value; fFlagUserHistoMax = "ON";}
11652 
11653 void TEcnaHistos::SetHistoMin(){fFlagUserHistoMin = "AUTO";}
11654 void TEcnaHistos::SetHistoMax(){fFlagUserHistoMax = "AUTO";}
11655 
11656 void TEcnaHistos::SetAllYminYmaxMemoFromDefaultValues()
11657 {
11658 //.......... Default values for histo min and max
11659 
11660   SetYminMemoFromValue("D_NOE_ChNb", fCnaParHistos->GetYminDefaultValue("D_NOE_ChNb"));
11661   SetYmaxMemoFromValue("D_NOE_ChNb", fCnaParHistos->GetYmaxDefaultValue("D_NOE_ChNb"));
11662 
11663   SetYminMemoFromValue("D_NOE_ChDs", fCnaParHistos->GetYminDefaultValue("D_NOE_ChDs"));
11664   SetYmaxMemoFromValue("D_NOE_ChDs", fCnaParHistos->GetYmaxDefaultValue("D_NOE_ChDs"));
11665 
11666   SetYminMemoFromValue("D_Ped_ChNb", fCnaParHistos->GetYminDefaultValue("D_Ped_ChNb"));
11667   SetYmaxMemoFromValue("D_Ped_ChNb", fCnaParHistos->GetYmaxDefaultValue("D_Ped_ChNb"));
11668 
11669   SetYminMemoFromValue("D_Ped_ChDs", fCnaParHistos->GetYminDefaultValue("D_Ped_ChDs"));
11670   SetYmaxMemoFromValue("D_Ped_ChDs", fCnaParHistos->GetYmaxDefaultValue("D_Ped_ChDs"));
11671 
11672   SetYminMemoFromValue("D_TNo_ChNb", fCnaParHistos->GetYminDefaultValue("D_TNo_ChNb"));
11673   SetYmaxMemoFromValue("D_TNo_ChNb", fCnaParHistos->GetYmaxDefaultValue("D_TNo_ChNb"));
11674 
11675   SetYminMemoFromValue("D_TNo_ChDs", fCnaParHistos->GetYminDefaultValue("D_TNo_ChDs"));
11676   SetYmaxMemoFromValue("D_TNo_ChDs", fCnaParHistos->GetYmaxDefaultValue("D_TNo_ChDs"));
11677 
11678   SetYminMemoFromValue("D_MCs_ChNb", fCnaParHistos->GetYminDefaultValue("D_MCs_ChNb"));
11679   SetYmaxMemoFromValue("D_MCs_ChNb", fCnaParHistos->GetYmaxDefaultValue("D_MCs_ChNb"));
11680 
11681   SetYminMemoFromValue("D_MCs_ChDs", fCnaParHistos->GetYminDefaultValue("D_MCs_ChDs"));
11682   SetYmaxMemoFromValue("D_MCs_ChDs", fCnaParHistos->GetYmaxDefaultValue("D_MCs_ChDs"));
11683 
11684   SetYminMemoFromValue("D_LFN_ChNb", fCnaParHistos->GetYminDefaultValue("D_LFN_ChNb"));
11685   SetYmaxMemoFromValue("D_LFN_ChNb", fCnaParHistos->GetYmaxDefaultValue("D_LFN_ChNb"));
11686 
11687   SetYminMemoFromValue("D_LFN_ChDs", fCnaParHistos->GetYminDefaultValue("D_LFN_ChDs"));
11688   SetYmaxMemoFromValue("D_LFN_ChDs", fCnaParHistos->GetYmaxDefaultValue("D_LFN_ChDs"));
11689 
11690   SetYminMemoFromValue("D_HFN_ChNb", fCnaParHistos->GetYminDefaultValue("D_HFN_ChNb"));
11691   SetYmaxMemoFromValue("D_HFN_ChNb", fCnaParHistos->GetYmaxDefaultValue("D_HFN_ChNb"));
11692 
11693   SetYminMemoFromValue("D_HFN_ChDs", fCnaParHistos->GetYminDefaultValue("D_HFN_ChDs"));
11694   SetYmaxMemoFromValue("D_HFN_ChDs", fCnaParHistos->GetYmaxDefaultValue("D_HFN_ChDs"));
11695 
11696   SetYminMemoFromValue("D_SCs_ChNb", fCnaParHistos->GetYminDefaultValue("D_SCs_ChNb"));
11697   SetYmaxMemoFromValue("D_SCs_ChNb", fCnaParHistos->GetYmaxDefaultValue("D_SCs_ChNb"));
11698 
11699   SetYminMemoFromValue("D_SCs_ChDs", fCnaParHistos->GetYminDefaultValue("D_SCs_ChDs"));
11700   SetYmaxMemoFromValue("D_SCs_ChDs", fCnaParHistos->GetYmaxDefaultValue("D_SCs_ChDs"));
11701 
11702   SetYminMemoFromValue("D_MSp_SpNb", fCnaParHistos->GetYminDefaultValue("D_MSp_SpNb"));
11703   SetYmaxMemoFromValue("D_MSp_SpNb", fCnaParHistos->GetYmaxDefaultValue("D_MSp_SpNb"));
11704 
11705   SetYminMemoFromValue("D_MSp_SpDs", fCnaParHistos->GetYminDefaultValue("D_MSp_SpDs"));
11706   SetYmaxMemoFromValue("D_MSp_SpDs", fCnaParHistos->GetYmaxDefaultValue("D_MSp_SpDs"));
11707 
11708   SetYminMemoFromValue("D_SSp_SpNb", fCnaParHistos->GetYminDefaultValue("D_SSp_SpNb"));
11709   SetYmaxMemoFromValue("D_SSp_SpNb", fCnaParHistos->GetYmaxDefaultValue("D_SSp_SpNb"));
11710 
11711   SetYminMemoFromValue("D_SSp_SpDs", fCnaParHistos->GetYminDefaultValue("D_SSp_SpDs"));
11712   SetYmaxMemoFromValue("D_SSp_SpDs", fCnaParHistos->GetYmaxDefaultValue("D_SSp_SpDs"));
11713 
11714   SetYminMemoFromValue("D_Adc_EvDs", fCnaParHistos->GetYminDefaultValue("D_Adc_EvDs"));
11715   SetYmaxMemoFromValue("D_Adc_EvDs", fCnaParHistos->GetYmaxDefaultValue("D_Adc_EvDs"));
11716 
11717   SetYminMemoFromValue("D_Adc_EvNb", fCnaParHistos->GetYminDefaultValue("D_Adc_EvNb"));
11718   SetYmaxMemoFromValue("D_Adc_EvNb", fCnaParHistos->GetYmaxDefaultValue("D_Adc_EvNb"));
11719 
11720   SetYminMemoFromValue("H_Ped_Date", fCnaParHistos->GetYminDefaultValue("H_Ped_Date"));
11721   SetYmaxMemoFromValue("H_Ped_Date", fCnaParHistos->GetYmaxDefaultValue("H_Ped_Date"));
11722 
11723   SetYminMemoFromValue("H_TNo_Date", fCnaParHistos->GetYminDefaultValue("H_TNo_Date"));
11724   SetYmaxMemoFromValue("H_TNo_Date", fCnaParHistos->GetYmaxDefaultValue("H_TNo_Date"));
11725 
11726   SetYminMemoFromValue("H_LFN_Date", fCnaParHistos->GetYminDefaultValue("H_LFN_Date"));
11727   SetYmaxMemoFromValue("H_LFN_Date", fCnaParHistos->GetYmaxDefaultValue("H_LFN_Date"));
11728 
11729   SetYminMemoFromValue("H_HFN_Date", fCnaParHistos->GetYminDefaultValue("H_HFN_Date"));
11730   SetYmaxMemoFromValue("H_HFN_Date", fCnaParHistos->GetYmaxDefaultValue("H_HFN_Date"));
11731 
11732   SetYminMemoFromValue("H_MCs_Date", fCnaParHistos->GetYminDefaultValue("H_MCs_Date"));
11733   SetYmaxMemoFromValue("H_MCs_Date", fCnaParHistos->GetYmaxDefaultValue("H_MCs_Date"));
11734 
11735   SetYminMemoFromValue("H_SCs_Date", fCnaParHistos->GetYminDefaultValue("H_SCs_Date"));
11736   SetYmaxMemoFromValue("H_SCs_Date", fCnaParHistos->GetYmaxDefaultValue("H_SCs_Date"));
11737 
11738   SetYminMemoFromValue("H_Ped_RuDs", fCnaParHistos->GetYminDefaultValue("H_Ped_RuDs"));
11739   SetYmaxMemoFromValue("H_Ped_RuDs", fCnaParHistos->GetYmaxDefaultValue("H_Ped_RuDs"));
11740 
11741   SetYminMemoFromValue("H_TNo_RuDs", fCnaParHistos->GetYminDefaultValue("H_TNo_RuDs"));
11742   SetYmaxMemoFromValue("H_TNo_RuDs", fCnaParHistos->GetYmaxDefaultValue("H_TNo_RuDs"));
11743 
11744   SetYminMemoFromValue("H_LFN_RuDs", fCnaParHistos->GetYminDefaultValue("H_LFN_RuDs"));
11745   SetYmaxMemoFromValue("H_LFN_RuDs", fCnaParHistos->GetYmaxDefaultValue("H_LFN_RuDs"));
11746 
11747   SetYminMemoFromValue("H_HFN_RuDs", fCnaParHistos->GetYminDefaultValue("H_HFN_RuDs"));
11748   SetYmaxMemoFromValue("H_HFN_RuDs", fCnaParHistos->GetYmaxDefaultValue("H_HFN_RuDs"));
11749 
11750   SetYminMemoFromValue("H_MCs_RuDs", fCnaParHistos->GetYminDefaultValue("H_MCs_RuDs"));
11751   SetYmaxMemoFromValue("H_MCs_RuDs", fCnaParHistos->GetYmaxDefaultValue("H_MCs_RuDs"));
11752 
11753   SetYminMemoFromValue("H_SCs_RuDs", fCnaParHistos->GetYminDefaultValue("H_SCs_RuDs"));
11754   SetYmaxMemoFromValue("H_SCs_RuDs", fCnaParHistos->GetYmaxDefaultValue("H_SCs_RuDs"));
11755 
11756   SetYminMemoFromValue("H2LFccMosMatrix", fCnaParHistos->GetYminDefaultValue("H2LFccMosMatrix"));
11757   SetYmaxMemoFromValue("H2LFccMosMatrix", fCnaParHistos->GetYmaxDefaultValue("H2LFccMosMatrix"));
11758 
11759   SetYminMemoFromValue("H2HFccMosMatrix", fCnaParHistos->GetYminDefaultValue("H2HFccMosMatrix"));
11760   SetYmaxMemoFromValue("H2HFccMosMatrix", fCnaParHistos->GetYmaxDefaultValue("H2HFccMosMatrix"));
11761 
11762   SetYminMemoFromValue("H2CorccInStins",  fCnaParHistos->GetYminDefaultValue("H2CorccInStins"));
11763   SetYmaxMemoFromValue("H2CorccInStins",  fCnaParHistos->GetYmaxDefaultValue("H2CorccInStins"));
11764 
11765   //........... set user's min and max flags to "OFF" and values to -1 and +1 (just to have fUserHistoMin < fUserHistoMax)
11766   fUserHistoMin = -1.; fFlagUserHistoMin = "OFF";
11767   fUserHistoMax =  1.; fFlagUserHistoMax = "OFF";
11768 } // end of SetAllYminYmaxMemoFromDefaultValues()
11769 
11770 //===========================================================================
11771 //
11772 //          SetYminMemoFromValue(...), SetYmaxMemoFromValue(...)
11773 //          GetYminValueFromMemo(...), GetYmaxValueFromMemo(...)
11774 //
11775 //===========================================================================
11776 void TEcnaHistos::SetYminMemoFromValue(const TString HistoCode, const Double_t& value)
11777 {
11778   if( HistoCode == "D_NOE_ChNb" ){fD_NOE_ChNbYmin = value;}
11779   if( HistoCode == "D_NOE_ChDs" ){fD_NOE_ChDsYmin = value;}  
11780   if( HistoCode == "D_Ped_ChNb" ){fD_Ped_ChNbYmin = value;} 
11781   if( HistoCode == "D_Ped_ChDs" ){fD_Ped_ChDsYmin = value;} 
11782   if( HistoCode == "D_TNo_ChNb" ){fD_TNo_ChNbYmin = value;}
11783   if( HistoCode == "D_TNo_ChDs" ){fD_TNo_ChDsYmin = value;} 
11784   if( HistoCode == "D_MCs_ChNb" ){fD_MCs_ChNbYmin = value;} 
11785   if( HistoCode == "D_MCs_ChDs" ){fD_MCs_ChDsYmin = value;} 
11786   if( HistoCode == "D_LFN_ChNb" ){fD_LFN_ChNbYmin = value;} 
11787   if( HistoCode == "D_LFN_ChDs" ){fD_LFN_ChDsYmin = value;}
11788   if( HistoCode == "D_HFN_ChNb" ){fD_HFN_ChNbYmin = value;} 
11789   if( HistoCode == "D_HFN_ChDs" ){fD_HFN_ChDsYmin = value;} 
11790   if( HistoCode == "D_SCs_ChNb" ){fD_SCs_ChNbYmin = value;}
11791   if( HistoCode == "D_SCs_ChDs" ){fD_SCs_ChDsYmin = value;}
11792   if( HistoCode == "D_MSp_SpNb" ){fD_Ped_ChNbYmin = value;}
11793   if( HistoCode == "D_MSp_SpDs" ){fD_Ped_ChDsYmin = value;}
11794   if( HistoCode == "D_SSp_SpNb" ){fD_TNo_ChNbYmin = value;}
11795   if( HistoCode == "D_SSp_SpDs" ){fD_TNo_ChDsYmin = value;}
11796   if( HistoCode == "D_Adc_EvNb" ){fD_Ped_ChNbYmin = value;}
11797   if( HistoCode == "D_Adc_EvDs" ){fD_Adc_EvDsYmin = value;}
11798   if( HistoCode == "H_Ped_Date" ){fH_Ped_DateYmin = value;}
11799   if( HistoCode == "H_TNo_Date" ){fH_TNo_DateYmin = value;}
11800   if( HistoCode == "H_MCs_Date" ){fH_MCs_DateYmin = value;}
11801   if( HistoCode == "H_LFN_Date" ){fH_LFN_DateYmin = value;}
11802   if( HistoCode == "H_HFN_Date" ){fH_HFN_DateYmin = value;}
11803   if( HistoCode == "H_SCs_Date" ){fH_SCs_DateYmin = value;}
11804   if( HistoCode == "H_Ped_RuDs" ){fH_Ped_RuDsYmin = value;}
11805   if( HistoCode == "H_TNo_RuDs" ){fH_TNo_RuDsYmin = value;}
11806   if( HistoCode == "H_MCs_RuDs" ){fH_MCs_RuDsYmin = value;}
11807   if( HistoCode == "H_LFN_RuDs" ){fH_LFN_RuDsYmin = value;}
11808   if( HistoCode == "H_HFN_RuDs" ){fH_HFN_RuDsYmin = value;}
11809   if( HistoCode == "H_SCs_RuDs" ){fH_SCs_RuDsYmin = value;}
11810   if( HistoCode == "H2LFccMosMatrix" ){fH2LFccMosMatrixYmin = value;}
11811   if( HistoCode == "H2HFccMosMatrix" ){fH2HFccMosMatrixYmin = value;}
11812   if( HistoCode == "H2CorccInStins"  ){fH2CorccInStinsYmin  = value;}
11813 }// end of SetYminMemoFromValue(...)
11814 
11815 void TEcnaHistos::SetYmaxMemoFromValue(const TString HistoCode, const Double_t& value)
11816 {
11817   if( HistoCode == "D_NOE_ChNb" ){fD_NOE_ChNbYmax = value;}
11818   if( HistoCode == "D_NOE_ChDs" ){fD_NOE_ChDsYmax = value;}  
11819   if( HistoCode == "D_Ped_ChNb" ){fD_Ped_ChNbYmax = value;} 
11820   if( HistoCode == "D_Ped_ChDs" ){fD_Ped_ChDsYmax = value;} 
11821   if( HistoCode == "D_TNo_ChNb" ){fD_TNo_ChNbYmax = value;}
11822   if( HistoCode == "D_TNo_ChDs" ){fD_TNo_ChDsYmax = value;} 
11823   if( HistoCode == "D_MCs_ChNb" ){fD_MCs_ChNbYmax = value;} 
11824   if( HistoCode == "D_MCs_ChDs" ){fD_MCs_ChDsYmax = value;} 
11825   if( HistoCode == "D_LFN_ChNb" ){fD_LFN_ChNbYmax = value;} 
11826   if( HistoCode == "D_LFN_ChDs" ){fD_LFN_ChDsYmax = value;}
11827   if( HistoCode == "D_HFN_ChNb" ){fD_HFN_ChNbYmax = value;} 
11828   if( HistoCode == "D_HFN_ChDs" ){fD_HFN_ChDsYmax = value;} 
11829   if( HistoCode == "D_SCs_ChNb" ){fD_SCs_ChNbYmax = value;}
11830   if( HistoCode == "D_SCs_ChDs" ){fD_SCs_ChDsYmax = value;}
11831   if( HistoCode == "D_MSp_SpNb" ){fD_Ped_ChNbYmax = value;}
11832   if( HistoCode == "D_MSp_SpDs" ){fD_Ped_ChDsYmax = value;}
11833   if( HistoCode == "D_SSp_SpNb" ){fD_TNo_ChNbYmax = value;}
11834   if( HistoCode == "D_SSp_SpDs" ){fD_TNo_ChDsYmax = value;}
11835   if( HistoCode == "D_Adc_EvNb" ){fD_Ped_ChNbYmax = value;}
11836   if( HistoCode == "D_Adc_EvDs" ){fD_Ped_ChDsYmax = value;}
11837   if( HistoCode == "H_Ped_Date" ){fH_Ped_DateYmax = value;}
11838   if( HistoCode == "H_TNo_Date" ){fH_TNo_DateYmax = value;}
11839   if( HistoCode == "H_MCs_Date" ){fH_MCs_DateYmax = value;}
11840   if( HistoCode == "H_LFN_Date" ){fH_LFN_DateYmax = value;}
11841   if( HistoCode == "H_HFN_Date" ){fH_HFN_DateYmax = value;}
11842   if( HistoCode == "H_SCs_Date" ){fH_SCs_DateYmax = value;}
11843   if( HistoCode == "H_Ped_RuDs" ){fH_Ped_RuDsYmax = value;}
11844   if( HistoCode == "H_TNo_RuDs" ){fH_TNo_RuDsYmax = value;}
11845   if( HistoCode == "H_MCs_RuDs" ){fH_MCs_RuDsYmax = value;}
11846   if( HistoCode == "H_LFN_RuDs" ){fH_LFN_RuDsYmax = value;}
11847   if( HistoCode == "H_HFN_RuDs" ){fH_HFN_RuDsYmax = value;}
11848   if( HistoCode == "H_SCs_RuDs" ){fH_SCs_RuDsYmax = value;}
11849   if( HistoCode == "H2LFccMosMatrix" ){fH2LFccMosMatrixYmax = value;}
11850   if( HistoCode == "H2HFccMosMatrix" ){fH2HFccMosMatrixYmax = value;}
11851   if( HistoCode == "H2CorccInStins"  ){fH2CorccInStinsYmax  = value;}
11852 }// end of SetYmaxMemoFromValue(...)
11853 
11854 Double_t TEcnaHistos::GetYminValueFromMemo(const TString HistoCode)
11855 {
11856   Double_t val_min      = (Double_t)0.;
11857   Double_t val_min_proj = (Double_t)0.1;
11858 
11859    if( HistoCode == "D_NOE_ChNb" ){val_min = fD_NOE_ChNbYmin;}
11860    if( HistoCode == "D_NOE_ChDs" ){val_min = val_min_proj;}  
11861    if( HistoCode == "D_Ped_ChNb" ){val_min = fD_Ped_ChNbYmin;} 
11862    if( HistoCode == "D_Ped_ChDs" ){val_min = val_min_proj;} 
11863    if( HistoCode == "D_TNo_ChNb" ){val_min = fD_TNo_ChNbYmin;}
11864    if( HistoCode == "D_TNo_ChDs" ){val_min = val_min_proj;} 
11865    if( HistoCode == "D_MCs_ChNb" ){val_min = fD_MCs_ChNbYmin;} 
11866    if( HistoCode == "D_MCs_ChDs" ){val_min = val_min_proj;} 
11867    if( HistoCode == "D_LFN_ChNb" ){val_min = fD_LFN_ChNbYmin;} 
11868    if( HistoCode == "D_LFN_ChDs" ){val_min = val_min_proj;}
11869    if( HistoCode == "D_HFN_ChNb" ){val_min = fD_HFN_ChNbYmin;} 
11870    if( HistoCode == "D_HFN_ChDs" ){val_min = val_min_proj;} 
11871    if( HistoCode == "D_SCs_ChNb" ){val_min = fD_SCs_ChNbYmin;}
11872    if( HistoCode == "D_SCs_ChDs" ){val_min = val_min_proj;}
11873    if( HistoCode == "D_MSp_SpNb" ){val_min = fD_Ped_ChNbYmin;}
11874    if( HistoCode == "D_MSp_SpDs" ){val_min = val_min_proj;}
11875    if( HistoCode == "D_SSp_SpNb" ){val_min = fD_TNo_ChNbYmin;}
11876    if( HistoCode == "D_SSp_SpDs" ){val_min = val_min_proj;}
11877    if( HistoCode == "D_Adc_EvNb" ){val_min = fD_Ped_ChNbYmin;}
11878    if( HistoCode == "D_Adc_EvDs" ){val_min = val_min_proj;}
11879    if( HistoCode == "H_Ped_Date" ){val_min = fH_Ped_DateYmin;}
11880    if( HistoCode == "H_TNo_Date" ){val_min = fH_TNo_DateYmin;}
11881    if( HistoCode == "H_MCs_Date" ){val_min = fH_MCs_DateYmin;}
11882    if( HistoCode == "H_LFN_Date" ){val_min = fH_LFN_DateYmin;}
11883    if( HistoCode == "H_HFN_Date" ){val_min = fH_HFN_DateYmin;}
11884    if( HistoCode == "H_SCs_Date" ){val_min = fH_SCs_DateYmin;}
11885    if( HistoCode == "H_Ped_RuDs" ){val_min = fH_Ped_RuDsYmin;}
11886    if( HistoCode == "H_TNo_RuDs" ){val_min = fH_TNo_RuDsYmin;}
11887    if( HistoCode == "H_MCs_RuDs" ){val_min = fH_MCs_RuDsYmin;}
11888    if( HistoCode == "H_LFN_RuDs" ){val_min = fH_LFN_RuDsYmin;}
11889    if( HistoCode == "H_HFN_RuDs" ){val_min = fH_HFN_RuDsYmin;}
11890    if( HistoCode == "H_SCs_RuDs" ){val_min = fH_SCs_RuDsYmin;}
11891    if( HistoCode == "H2LFccMosMatrix" ){val_min = fH2LFccMosMatrixYmin;}
11892    if( HistoCode == "H2HFccMosMatrix" ){val_min = fH2HFccMosMatrixYmin;}
11893    if( HistoCode == "H2CorccInStins"  ){val_min = fH2CorccInStinsYmin;}
11894   return val_min;
11895 }// end of GetYminValueFromMemo(...)
11896 
11897 Double_t TEcnaHistos::GetYmaxValueFromMemo(const TString HistoCode)
11898 {
11899   Double_t val_max      = (Double_t)0.;
11900   Double_t val_max_proj = (Double_t)2000.;
11901 
11902    if( HistoCode == "D_NOE_ChNb" ){val_max = fD_NOE_ChNbYmax;}
11903    if( HistoCode == "D_NOE_ChDs" ){val_max = val_max_proj;} 
11904    if( HistoCode == "D_Ped_ChNb" ){val_max = fD_Ped_ChNbYmax;} 
11905    if( HistoCode == "D_Ped_ChDs" ){val_max = val_max_proj;}  
11906    if( HistoCode == "D_TNo_ChNb" ){val_max = fD_TNo_ChNbYmax;}   
11907    if( HistoCode == "D_TNo_ChDs" ){val_max = val_max_proj;} 
11908    if( HistoCode == "D_MCs_ChNb" ){val_max = fD_MCs_ChNbYmax;}
11909    if( HistoCode == "D_MCs_ChDs" ){val_max = val_max_proj;} 
11910    if( HistoCode == "D_LFN_ChNb" ){val_max = fD_LFN_ChNbYmax;} 
11911    if( HistoCode == "D_LFN_ChDs" ){val_max = val_max_proj;} 
11912    if( HistoCode == "D_HFN_ChNb" ){val_max = fD_HFN_ChNbYmax;}  
11913    if( HistoCode == "D_HFN_ChDs" ){val_max = val_max_proj;} 
11914    if( HistoCode == "D_SCs_ChNb" ){val_max = fD_SCs_ChNbYmax;} 
11915    if( HistoCode == "D_SCs_ChDs" ){val_max = val_max_proj;}
11916    if( HistoCode == "D_MSp_SpNb" ){val_max = fD_Ped_ChNbYmax;}
11917    if( HistoCode == "D_MSp_SpDs" ){val_max = val_max_proj;}
11918    if( HistoCode == "D_SSp_SpNb" ){val_max = fD_TNo_ChNbYmax;}
11919    if( HistoCode == "D_SSp_SpDs" ){val_max = val_max_proj;}
11920    if( HistoCode == "D_Adc_EvNb" ){val_max = fD_Ped_ChNbYmax;}
11921    if( HistoCode == "D_Adc_EvDs" ){val_max = val_max_proj;}
11922    if( HistoCode == "H_Ped_Date" ){val_max = fH_Ped_DateYmax;}
11923    if( HistoCode == "H_TNo_Date" ){val_max = fH_TNo_DateYmax;}
11924    if( HistoCode == "H_MCs_Date" ){val_max = fH_MCs_DateYmax;}
11925    if( HistoCode == "H_LFN_Date" ){val_max = fH_LFN_DateYmax;}
11926    if( HistoCode == "H_HFN_Date" ){val_max = fH_HFN_DateYmax;}
11927    if( HistoCode == "H_SCs_Date" ){val_max = fH_SCs_DateYmax;}
11928    if( HistoCode == "H_Ped_RuDs" ){val_max = fH_Ped_RuDsYmax;}
11929    if( HistoCode == "H_TNo_RuDs" ){val_max = fH_TNo_RuDsYmax;}
11930    if( HistoCode == "H_MCs_RuDs" ){val_max = fH_MCs_RuDsYmax;}
11931    if( HistoCode == "H_LFN_RuDs" ){val_max = fH_LFN_RuDsYmax;}
11932    if( HistoCode == "H_HFN_RuDs" ){val_max = fH_HFN_RuDsYmax;}
11933    if( HistoCode == "H_SCs_RuDs" ){val_max = fH_SCs_RuDsYmax;}
11934    if( HistoCode == "H2LFccMosMatrix" ){val_max = fH2LFccMosMatrixYmax;}
11935    if( HistoCode == "H2HFccMosMatrix" ){val_max = fH2HFccMosMatrixYmax;}
11936    if( HistoCode == "H2CorccInStins"  ){val_max = fH2CorccInStinsYmax;}
11937   return val_max;
11938 }// end of GetYmaxValueFromMemo(...)
11939 
11940 void TEcnaHistos::SetYminMemoFromPreviousMemo(const TString  HistoCode)
11941 {
11942 // InitQuantity Ymin
11943 
11944   if( HistoCode == "D_NOE_ChNb" ){fD_NOE_ChNbYmin = GetYminValueFromMemo("D_NOE_ChNb");}
11945   if( HistoCode == "D_NOE_ChDs" ){fD_NOE_ChDsYmin = GetYminValueFromMemo("D_NOE_ChDs");}
11946   if( HistoCode == "D_Ped_ChNb" ){fD_Ped_ChNbYmin = GetYminValueFromMemo("D_Ped_ChNb");}
11947   if( HistoCode == "D_Ped_ChDs" ){fD_Ped_ChDsYmin = GetYminValueFromMemo("D_Ped_ChDs");}
11948   if( HistoCode == "D_TNo_ChNb" ){fD_TNo_ChNbYmin = GetYminValueFromMemo("D_TNo_ChNb");}
11949   if( HistoCode == "D_TNo_ChDs" ){fD_TNo_ChDsYmin = GetYminValueFromMemo("D_TNo_ChDs");}
11950   if( HistoCode == "D_MCs_ChNb" ){fD_MCs_ChNbYmin = GetYminValueFromMemo("D_MCs_ChNb");}
11951   if( HistoCode == "D_MCs_ChDs" ){fD_MCs_ChDsYmin = GetYminValueFromMemo("D_MCs_ChDs");}
11952   if( HistoCode == "D_LFN_ChNb" ){fD_LFN_ChNbYmin = GetYminValueFromMemo("D_LFN_ChNb");}
11953   if( HistoCode == "D_LFN_ChDs" ){fD_LFN_ChDsYmin = GetYminValueFromMemo("D_LFN_ChDs");}
11954   if( HistoCode == "D_HFN_ChNb" ){fD_HFN_ChNbYmin = GetYminValueFromMemo("D_HFN_ChNb");}
11955   if( HistoCode == "D_HFN_ChDs" ){fD_HFN_ChDsYmin = GetYminValueFromMemo("D_HFN_ChDs");}
11956   if( HistoCode == "D_SCs_ChNb" ){fD_SCs_ChNbYmin = GetYminValueFromMemo("D_SCs_ChNb");}
11957   if( HistoCode == "D_SCs_ChDs" ){fD_SCs_ChDsYmin = GetYminValueFromMemo("D_SCs_ChDs");}
11958   if( HistoCode == "D_MSp_SpNb" ){fD_MSp_SpNbYmin = GetYminValueFromMemo("D_MSp_SpNb");}
11959   if( HistoCode == "D_MSp_SpDs" ){fD_MSp_SpDsYmin = GetYminValueFromMemo("D_MSp_SpDs");}
11960   if( HistoCode == "D_SSp_SpNb" ){fD_SSp_SpNbYmin = GetYminValueFromMemo("D_SSp_SpNb");}
11961   if( HistoCode == "D_SSp_SpDs" ){fD_SSp_SpDsYmin = GetYminValueFromMemo("D_SSp_SpDs");}
11962   if( HistoCode == "D_Adc_EvNb" ){fD_Adc_EvNbYmin = GetYminValueFromMemo("D_Adc_EvNb");}
11963   if( HistoCode == "D_Adc_EvDs" ){fD_Adc_EvDsYmin = GetYminValueFromMemo("D_Adc_EvDs");}
11964   if( HistoCode == "H_Ped_Date" ){fH_Ped_DateYmin = GetYminValueFromMemo("H_Ped_Date");}
11965   if( HistoCode == "H_TNo_Date" ){fH_TNo_DateYmin = GetYminValueFromMemo("H_TNo_Date");}
11966   if( HistoCode == "H_MCs_Date" ){fH_MCs_DateYmin = GetYminValueFromMemo("H_MCs_Date");}
11967   if( HistoCode == "H_LFN_Date" ){fH_LFN_DateYmin = GetYminValueFromMemo("H_LFN_Date");}
11968   if( HistoCode == "H_HFN_Date" ){fH_HFN_DateYmin = GetYminValueFromMemo("H_HFN_Date");}
11969   if( HistoCode == "H_SCs_Date" ){fH_SCs_DateYmin = GetYminValueFromMemo("H_SCs_Date");}
11970   if( HistoCode == "H_Ped_RuDs" ){fH_Ped_RuDsYmin = GetYminValueFromMemo("H_Ped_RuDs");}
11971   if( HistoCode == "H_TNo_RuDs" ){fH_TNo_RuDsYmin = GetYminValueFromMemo("H_TNo_RuDs");}
11972   if( HistoCode == "H_MCs_RuDs" ){fH_MCs_RuDsYmin = GetYminValueFromMemo("H_MCs_RuDs");}
11973   if( HistoCode == "H_LFN_RuDs" ){fH_LFN_RuDsYmin = GetYminValueFromMemo("H_LFN_RuDs");}
11974   if( HistoCode == "H_HFN_RuDs" ){fH_HFN_RuDsYmin = GetYminValueFromMemo("H_HFN_RuDs");}
11975   if( HistoCode == "H_SCs_RuDs" ){fH_SCs_RuDsYmin = GetYminValueFromMemo("H_SCs_RuDs");}
11976   if( HistoCode == "H2LFccMosMatrix" ){fH2LFccMosMatrixYmin = GetYminValueFromMemo("H2LFccMosMatrix");}
11977   if( HistoCode == "H2HFccMosMatrix" ){fH2HFccMosMatrixYmin = GetYminValueFromMemo("H2HFccMosMatrix");}
11978   if( HistoCode == "H2CorccInStins"  ){fH2CorccInStinsYmin  = GetYminValueFromMemo("H2CorccInStins");}
11979 }// end of SetYminMemoFromPreviousMemo(...)
11980 
11981 void TEcnaHistos::SetYmaxMemoFromPreviousMemo(const TString  HistoCode)
11982 {
11983 // InitQuantity Ymax
11984 
11985   if( HistoCode == "D_NOE_ChNb" ){fD_NOE_ChNbYmax = GetYmaxValueFromMemo("D_NOE_ChNb");}
11986   if( HistoCode == "D_NOE_ChDs" ){fD_NOE_ChDsYmax = GetYmaxValueFromMemo("D_NOE_ChDs");}
11987   if( HistoCode == "D_Ped_ChNb" ){fD_Ped_ChNbYmax = GetYmaxValueFromMemo("D_Ped_ChNb");}
11988   if( HistoCode == "D_Ped_ChDs" ){fD_Ped_ChDsYmax = GetYmaxValueFromMemo("D_Ped_ChDs");}
11989   if( HistoCode == "D_TNo_ChNb" ){fD_TNo_ChNbYmax = GetYmaxValueFromMemo("D_TNo_ChNb");}
11990   if( HistoCode == "D_TNo_ChDs" ){fD_TNo_ChDsYmax = GetYmaxValueFromMemo("D_TNo_ChDs");}
11991   if( HistoCode == "D_MCs_ChNb" ){fD_MCs_ChNbYmax = GetYmaxValueFromMemo("D_MCs_ChNb");}
11992   if( HistoCode == "D_MCs_ChDs" ){fD_MCs_ChDsYmax = GetYmaxValueFromMemo("D_MCs_ChDs");}
11993   if( HistoCode == "D_LFN_ChNb" ){fD_LFN_ChNbYmax = GetYmaxValueFromMemo("D_LFN_ChNb");}
11994   if( HistoCode == "D_LFN_ChDs" ){fD_LFN_ChDsYmax = GetYmaxValueFromMemo("D_LFN_ChDs");}
11995   if( HistoCode == "D_HFN_ChNb" ){fD_HFN_ChNbYmax = GetYmaxValueFromMemo("D_HFN_ChNb");}
11996   if( HistoCode == "D_HFN_ChDs" ){fD_HFN_ChDsYmax = GetYmaxValueFromMemo("D_HFN_ChDs");}
11997   if( HistoCode == "D_SCs_ChNb" ){fD_SCs_ChNbYmax = GetYmaxValueFromMemo("D_SCs_ChNb");}
11998   if( HistoCode == "D_SCs_ChDs" ){fD_SCs_ChDsYmax = GetYmaxValueFromMemo("D_SCs_ChDs");}
11999   if( HistoCode == "D_MSp_SpNb" ){fD_MSp_SpNbYmax = GetYmaxValueFromMemo("D_MSp_SpNb");}
12000   if( HistoCode == "D_MSp_SpDs" ){fD_MSp_SpDsYmax = GetYmaxValueFromMemo("D_MSp_SpDs");}
12001   if( HistoCode == "D_SSp_SpNb" ){fD_SSp_SpNbYmax = GetYmaxValueFromMemo("D_SSp_SpNb");}
12002   if( HistoCode == "D_SSp_SpDs" ){fD_SSp_SpDsYmax = GetYmaxValueFromMemo("D_SSp_SpDs");}
12003   if( HistoCode == "D_Adc_EvNb" ){fD_Adc_EvNbYmax = GetYmaxValueFromMemo("D_Adc_EvNb");}
12004   if( HistoCode == "D_Adc_EvDs" ){fD_Adc_EvDsYmax = GetYmaxValueFromMemo("D_Adc_EvDs");}
12005   if( HistoCode == "H_Ped_Date" ){fH_Ped_DateYmax = GetYmaxValueFromMemo("H_Ped_Date");}
12006   if( HistoCode == "H_TNo_Date" ){fH_TNo_DateYmax = GetYmaxValueFromMemo("H_TNo_Date");}
12007   if( HistoCode == "H_MCs_Date" ){fH_MCs_DateYmax = GetYmaxValueFromMemo("H_MCs_Date");}
12008   if( HistoCode == "H_LFN_Date" ){fH_LFN_DateYmax = GetYmaxValueFromMemo("H_LFN_Date");}
12009   if( HistoCode == "H_HFN_Date" ){fH_HFN_DateYmax = GetYmaxValueFromMemo("H_HFN_Date");}
12010   if( HistoCode == "H_SCs_Date" ){fH_SCs_DateYmax = GetYmaxValueFromMemo("H_SCs_Date");}
12011   if( HistoCode == "H_Ped_RuDs" ){fH_Ped_RuDsYmax = GetYmaxValueFromMemo("H_Ped_RuDs");}
12012   if( HistoCode == "H_TNo_RuDs" ){fH_TNo_RuDsYmax = GetYmaxValueFromMemo("H_TNo_RuDs");}
12013   if( HistoCode == "H_MCs_RuDs" ){fH_MCs_RuDsYmax = GetYmaxValueFromMemo("H_MCs_RuDs");}
12014   if( HistoCode == "H_LFN_RuDs" ){fH_LFN_RuDsYmax = GetYmaxValueFromMemo("H_LFN_RuDs");}
12015   if( HistoCode == "H_HFN_RuDs" ){fH_HFN_RuDsYmax = GetYmaxValueFromMemo("H_HFN_RuDs");}
12016   if( HistoCode == "H_SCs_RuDs" ){fH_SCs_RuDsYmax = GetYmaxValueFromMemo("H_SCs_RuDs");}
12017   if( HistoCode == "H2LFccMosMatrix" ){fH2LFccMosMatrixYmax = GetYmaxValueFromMemo("H2LFccMosMatrix");}
12018   if( HistoCode == "H2HFccMosMatrix" ){fH2HFccMosMatrixYmax = GetYmaxValueFromMemo("H2HFccMosMatrix");}
12019   if( HistoCode == "H2CorccInStins"  ){fH2CorccInStinsYmax  = GetYmaxValueFromMemo("H2CorccInStins");}
12020 }// end of SetYmaxMemoFromPreviousMemo(...)
12021 
12022 //------------------------------------------------------------------------------------------------------
12023 void TEcnaHistos::SetXVarMemo(const TString HistoCode, const TString opt_plot, const TString xvar)
12024 {
12025 
12026   if( opt_plot == fSameOnePlot ){fXMemoH1SamePlus = xvar;}
12027 
12028   if( opt_plot == fOnlyOnePlot || opt_plot == fSeveralPlot )
12029     {
12030       if( HistoCode == "D_NOE_ChNb"){fXMemoD_NOE_ChNb = xvar;}
12031       if( HistoCode == "D_NOE_ChDs"){fXMemoD_NOE_ChDs = xvar;}  
12032       if( HistoCode == "D_Ped_ChNb"){fXMemoD_Ped_ChNb = xvar;} 
12033       if( HistoCode == "D_Ped_ChDs"){fXMemoD_Ped_ChDs = xvar;} 
12034       if( HistoCode == "D_TNo_ChNb"){fXMemoD_TNo_ChNb = xvar;}
12035       if( HistoCode == "D_TNo_ChDs"){fXMemoD_TNo_ChDs = xvar;} 
12036       if( HistoCode == "D_MCs_ChNb"){fXMemoD_MCs_ChNb = xvar;} 
12037       if( HistoCode == "D_MCs_ChDs"){fXMemoD_MCs_ChDs = xvar;} 
12038       if( HistoCode == "D_LFN_ChNb"){fXMemoD_LFN_ChNb = xvar;} 
12039       if( HistoCode == "D_LFN_ChDs"){fXMemoD_LFN_ChDs = xvar;}
12040       if( HistoCode == "D_HFN_ChNb"){fXMemoD_HFN_ChNb = xvar;} 
12041       if( HistoCode == "D_HFN_ChDs"){fXMemoD_HFN_ChDs = xvar;} 
12042       if( HistoCode == "D_SCs_ChNb"){fXMemoD_SCs_ChNb = xvar;}
12043       if( HistoCode == "D_SCs_ChDs"){fXMemoD_SCs_ChDs = xvar;}
12044       if( HistoCode == "D_MSp_SpNb"){fXMemoD_MSp_SpNb = xvar;}
12045       if( HistoCode == "D_MSp_SpDs"){fXMemoD_MSp_SpDs = xvar;}
12046       if( HistoCode == "D_SSp_SpNb"){fXMemoD_SSp_SpNb = xvar;}
12047       if( HistoCode == "D_SSp_SpDs"){fXMemoD_SSp_SpDs = xvar;}
12048       if( HistoCode == "D_Adc_EvNb"){fXMemoD_Adc_EvNb = xvar;}
12049       if( HistoCode == "D_Adc_EvDs"){fXMemoD_Adc_EvDs = xvar;}
12050       if( HistoCode == "H_Ped_Date"){fXMemoH_Ped_Date = xvar;}
12051       if( HistoCode == "H_TNo_Date"){fXMemoH_TNo_Date = xvar;}
12052       if( HistoCode == "H_MCs_Date"){fXMemoH_MCs_Date = xvar;}
12053       if( HistoCode == "H_LFN_Date"){fXMemoH_LFN_Date = xvar;}
12054       if( HistoCode == "H_HFN_Date"){fXMemoH_HFN_Date = xvar;}
12055       if( HistoCode == "H_SCs_Date"){fXMemoH_SCs_Date = xvar;}
12056       if( HistoCode == "H_Ped_RuDs"){fXMemoH_Ped_RuDs = xvar;}
12057       if( HistoCode == "H_TNo_RuDs"){fXMemoH_TNo_RuDs = xvar;}
12058       if( HistoCode == "H_MCs_RuDs"){fXMemoH_MCs_RuDs = xvar;}
12059       if( HistoCode == "H_LFN_RuDs"){fXMemoH_LFN_RuDs = xvar;}
12060       if( HistoCode == "H_HFN_RuDs"){fXMemoH_HFN_RuDs = xvar;}
12061       if( HistoCode == "H_SCs_RuDs"){fXMemoH_SCs_RuDs = xvar;}
12062     }
12063 }// end of SetXVarMemo(...)
12064 
12065 TString TEcnaHistos::GetXVarFromMemo(const TString HistoCode, const TString opt_plot)
12066 {
12067   TString xvar = "(xvar not found)";
12068   
12069   if( opt_plot == fSameOnePlot ){xvar = fXMemoH1SamePlus;}
12070 
12071   if( opt_plot == fOnlyOnePlot || opt_plot == fSeveralPlot )
12072     {
12073       if( HistoCode == "D_NOE_ChNb"){xvar = fXMemoD_NOE_ChNb;}
12074       if( HistoCode == "D_NOE_ChDs"){xvar = fXMemoD_NOE_ChDs;}  
12075       if( HistoCode == "D_Ped_ChNb"){xvar = fXMemoD_Ped_ChNb;} 
12076       if( HistoCode == "D_Ped_ChDs"){xvar = fXMemoD_Ped_ChDs;} 
12077       if( HistoCode == "D_TNo_ChNb"){xvar = fXMemoD_TNo_ChNb;}
12078       if( HistoCode == "D_TNo_ChDs"){xvar = fXMemoD_TNo_ChDs;} 
12079       if( HistoCode == "D_MCs_ChNb"){xvar = fXMemoD_MCs_ChNb;} 
12080       if( HistoCode == "D_MCs_ChDs"){xvar = fXMemoD_MCs_ChDs;} 
12081       if( HistoCode == "D_LFN_ChNb"){xvar = fXMemoD_LFN_ChNb;} 
12082       if( HistoCode == "D_LFN_ChDs"){xvar = fXMemoD_LFN_ChDs;}
12083       if( HistoCode == "D_HFN_ChNb"){xvar = fXMemoD_HFN_ChNb;} 
12084       if( HistoCode == "D_HFN_ChDs"){xvar = fXMemoD_HFN_ChDs;} 
12085       if( HistoCode == "D_SCs_ChNb"){xvar = fXMemoD_SCs_ChNb;}
12086       if( HistoCode == "D_SCs_ChDs"){xvar = fXMemoD_SCs_ChDs;}
12087       if( HistoCode == "D_MSp_SpNb"){xvar = fXMemoD_MSp_SpNb;}
12088       if( HistoCode == "D_MSp_SpDs"){xvar = fXMemoD_MSp_SpDs;}
12089       if( HistoCode == "D_SSp_SpNb"){xvar = fXMemoD_SSp_SpNb;}
12090       if( HistoCode == "D_SSp_SpDs"){xvar = fXMemoD_SSp_SpDs;}
12091       if( HistoCode == "D_Adc_EvNb"){xvar = fXMemoD_Adc_EvNb;}
12092       if( HistoCode == "D_Adc_EvDs"){xvar = fXMemoD_Adc_EvDs;}
12093       if( HistoCode == "H_Ped_Date"){xvar = fXMemoH_Ped_Date;}
12094       if( HistoCode == "H_TNo_Date"){xvar = fXMemoH_TNo_Date;}
12095       if( HistoCode == "H_MCs_Date"){xvar = fXMemoH_MCs_Date;}
12096       if( HistoCode == "H_LFN_Date"){xvar = fXMemoH_LFN_Date;}
12097       if( HistoCode == "H_HFN_Date"){xvar = fXMemoH_HFN_Date;}
12098       if( HistoCode == "H_SCs_Date"){xvar = fXMemoH_SCs_Date;}
12099       if( HistoCode == "H_Ped_RuDs"){xvar = fXMemoH_Ped_RuDs;}
12100       if( HistoCode == "H_TNo_RuDs"){xvar = fXMemoH_TNo_RuDs;}
12101       if( HistoCode == "H_MCs_RuDs"){xvar = fXMemoH_MCs_RuDs;}
12102       if( HistoCode == "H_LFN_RuDs"){xvar = fXMemoH_LFN_RuDs;}
12103       if( HistoCode == "H_HFN_RuDs"){xvar = fXMemoH_HFN_RuDs;}
12104       if( HistoCode == "H_SCs_RuDs"){xvar = fXMemoH_SCs_RuDs;}
12105     }
12106   return xvar;
12107 }// end of GetXVarFromMemo(...)
12108 
12109 
12110 void TEcnaHistos::SetYVarMemo(const TString HistoCode, const TString opt_plot, const TString yvar)
12111 {
12112   if( opt_plot == fSameOnePlot ){fYMemoH1SamePlus = yvar;}
12113 
12114   if( opt_plot == fOnlyOnePlot || opt_plot == fSeveralPlot )
12115     {
12116       if( HistoCode == "D_NOE_ChNb"){fYMemoD_NOE_ChNb = yvar;}
12117       if( HistoCode == "D_NOE_ChDs"){fYMemoD_NOE_ChDs = yvar;}  
12118       if( HistoCode == "D_Ped_ChNb"){fYMemoD_Ped_ChNb = yvar;} 
12119       if( HistoCode == "D_Ped_ChDs"){fYMemoD_Ped_ChDs = yvar;} 
12120       if( HistoCode == "D_TNo_ChNb"){fYMemoD_TNo_ChNb = yvar;}
12121       if( HistoCode == "D_TNo_ChDs"){fYMemoD_TNo_ChDs = yvar;} 
12122       if( HistoCode == "D_MCs_ChNb"){fYMemoD_MCs_ChNb = yvar;} 
12123       if( HistoCode == "D_MCs_ChDs"){fYMemoD_MCs_ChDs = yvar;} 
12124       if( HistoCode == "D_LFN_ChNb"){fYMemoD_LFN_ChNb = yvar;} 
12125       if( HistoCode == "D_LFN_ChDs"){fYMemoD_LFN_ChDs = yvar;}
12126       if( HistoCode == "D_HFN_ChNb"){fYMemoD_HFN_ChNb = yvar;} 
12127       if( HistoCode == "D_HFN_ChDs"){fYMemoD_HFN_ChDs = yvar;} 
12128       if( HistoCode == "D_SCs_ChNb"){fYMemoD_SCs_ChNb = yvar;}
12129       if( HistoCode == "D_SCs_ChDs"){fYMemoD_SCs_ChDs = yvar;}
12130       if( HistoCode == "D_MSp_SpNb"){fYMemoD_MSp_SpNb = yvar;}
12131       if( HistoCode == "D_MSp_SpDs"){fYMemoD_MSp_SpDs = yvar;}
12132       if( HistoCode == "D_SSp_SpNb"){fYMemoD_SSp_SpNb = yvar;}
12133       if( HistoCode == "D_Adc_EvDs"){fYMemoD_Adc_EvDs = yvar;}
12134       if( HistoCode == "D_SSp_SpDs"){fYMemoD_SSp_SpDs = yvar;}
12135       if( HistoCode == "D_Adc_EvNb"){fYMemoD_Adc_EvNb = yvar;}
12136       if( HistoCode == "H_Ped_Date"){fYMemoH_Ped_Date = yvar;}
12137       if( HistoCode == "H_TNo_Date"){fYMemoH_TNo_Date = yvar;}
12138       if( HistoCode == "H_MCs_Date"){fYMemoH_MCs_Date = yvar;}
12139       if( HistoCode == "H_LFN_Date"){fYMemoH_LFN_Date = yvar;}
12140       if( HistoCode == "H_HFN_Date"){fYMemoH_HFN_Date = yvar;}
12141       if( HistoCode == "H_SCs_Date"){fYMemoH_SCs_Date = yvar;}
12142       if( HistoCode == "H_Ped_RuDs"){fYMemoH_Ped_RuDs = yvar;}
12143       if( HistoCode == "H_TNo_RuDs"){fYMemoH_TNo_RuDs = yvar;}
12144       if( HistoCode == "H_MCs_RuDs"){fYMemoH_MCs_RuDs = yvar;}
12145       if( HistoCode == "H_LFN_RuDs"){fYMemoH_LFN_RuDs = yvar;}
12146       if( HistoCode == "H_HFN_RuDs"){fYMemoH_HFN_RuDs = yvar;}
12147       if( HistoCode == "H_SCs_RuDs"){fYMemoH_SCs_RuDs = yvar;}
12148     }
12149 }// end of SetYVarMemo(...)
12150 
12151 TString TEcnaHistos::GetYVarFromMemo(const TString HistoCode, const TString opt_plot)
12152 {
12153   TString yvar = "(yvar not found)";
12154 
12155   if( opt_plot == fSameOnePlot ){yvar = fYMemoH1SamePlus;}
12156 
12157   if( opt_plot == fOnlyOnePlot || opt_plot == fSeveralPlot )
12158     {  
12159       if( HistoCode == "D_NOE_ChNb"){yvar = fYMemoD_NOE_ChNb;}
12160       if( HistoCode == "D_NOE_ChDs"){yvar = fYMemoD_NOE_ChDs;}
12161       if( HistoCode == "D_Ped_ChNb"){yvar = fYMemoD_Ped_ChNb;}
12162       if( HistoCode == "D_Ped_ChDs"){yvar = fYMemoD_Ped_ChDs;}
12163       if( HistoCode == "D_TNo_ChNb"){yvar = fYMemoD_TNo_ChNb;}
12164       if( HistoCode == "D_TNo_ChDs"){yvar = fYMemoD_TNo_ChDs;}
12165       if( HistoCode == "D_MCs_ChNb"){yvar = fYMemoD_MCs_ChNb;}
12166       if( HistoCode == "D_MCs_ChDs"){yvar = fYMemoD_MCs_ChDs;}
12167       if( HistoCode == "D_LFN_ChNb"){yvar = fYMemoD_LFN_ChNb;}
12168       if( HistoCode == "D_LFN_ChDs"){yvar = fYMemoD_LFN_ChDs;}
12169       if( HistoCode == "D_HFN_ChNb"){yvar = fYMemoD_HFN_ChNb;}
12170       if( HistoCode == "D_HFN_ChDs"){yvar = fYMemoD_HFN_ChDs;}
12171       if( HistoCode == "D_SCs_ChNb"){yvar = fYMemoD_SCs_ChNb;}
12172       if( HistoCode == "D_SCs_ChDs"){yvar = fYMemoD_SCs_ChDs;}
12173       if( HistoCode == "D_MSp_SpNb"){yvar = fYMemoD_MSp_SpNb;}
12174       if( HistoCode == "D_MSp_SpDs"){yvar = fYMemoD_MSp_SpDs;}
12175       if( HistoCode == "D_SSp_SpNb"){yvar = fYMemoD_SSp_SpNb;}
12176       if( HistoCode == "D_SSp_SpDs"){yvar = fYMemoD_SSp_SpDs;}
12177       if( HistoCode == "D_Adc_EvNb"){yvar = fYMemoD_Adc_EvNb;}
12178       if( HistoCode == "D_Adc_EvDs"){yvar = fYMemoD_Adc_EvDs;}
12179       if( HistoCode == "H_Ped_Date"){yvar = fYMemoH_Ped_Date;}
12180       if( HistoCode == "H_TNo_Date"){yvar = fYMemoH_TNo_Date;}
12181       if( HistoCode == "H_MCs_Date"){yvar = fYMemoH_MCs_Date;}
12182       if( HistoCode == "H_LFN_Date"){yvar = fYMemoH_LFN_Date;}
12183       if( HistoCode == "H_HFN_Date"){yvar = fYMemoH_HFN_Date;}
12184       if( HistoCode == "H_SCs_Date"){yvar = fYMemoH_SCs_Date;}
12185       if( HistoCode == "H_Ped_RuDs"){yvar = fYMemoH_Ped_RuDs;}
12186       if( HistoCode == "H_TNo_RuDs"){yvar = fYMemoH_TNo_RuDs;}
12187       if( HistoCode == "H_MCs_RuDs"){yvar = fYMemoH_MCs_RuDs;}
12188       if( HistoCode == "H_LFN_RuDs"){yvar = fYMemoH_LFN_RuDs;}
12189       if( HistoCode == "H_HFN_RuDs"){yvar = fYMemoH_HFN_RuDs;}
12190       if( HistoCode == "H_SCs_RuDs"){yvar = fYMemoH_SCs_RuDs;}
12191     }
12192   return yvar;
12193 }// end of GetYVarFromMemo(...)
12194 
12195 void TEcnaHistos::SetNbBinsMemo(const TString HistoCode, const TString opt_plot, const Int_t& nb_bins)
12196 {
12197 
12198   if( opt_plot == fSameOnePlot ){fNbBinsMemoH1SamePlus = nb_bins;}
12199 
12200   if( opt_plot == fOnlyOnePlot || opt_plot == fSeveralPlot )
12201     {
12202       if( HistoCode == "D_NOE_ChNb"){fNbBinsMemoD_NOE_ChNb = nb_bins;}
12203       if( HistoCode == "D_NOE_ChDs"){fNbBinsMemoD_NOE_ChDs = nb_bins;}  
12204       if( HistoCode == "D_Ped_ChNb"){fNbBinsMemoD_Ped_ChNb = nb_bins;} 
12205       if( HistoCode == "D_Ped_ChDs"){fNbBinsMemoD_Ped_ChDs = nb_bins;} 
12206       if( HistoCode == "D_TNo_ChNb"){fNbBinsMemoD_TNo_ChNb = nb_bins;}
12207       if( HistoCode == "D_TNo_ChDs"){fNbBinsMemoD_TNo_ChDs = nb_bins;} 
12208       if( HistoCode == "D_MCs_ChNb"){fNbBinsMemoD_MCs_ChNb = nb_bins;} 
12209       if( HistoCode == "D_MCs_ChDs"){fNbBinsMemoD_MCs_ChDs = nb_bins;} 
12210       if( HistoCode == "D_LFN_ChNb"){fNbBinsMemoD_LFN_ChNb = nb_bins;} 
12211       if( HistoCode == "D_LFN_ChDs"){fNbBinsMemoD_LFN_ChDs = nb_bins;}
12212       if( HistoCode == "D_HFN_ChNb"){fNbBinsMemoD_HFN_ChNb = nb_bins;} 
12213       if( HistoCode == "D_HFN_ChDs"){fNbBinsMemoD_HFN_ChDs = nb_bins;} 
12214       if( HistoCode == "D_SCs_ChNb"){fNbBinsMemoD_SCs_ChNb = nb_bins;}
12215       if( HistoCode == "D_SCs_ChDs"){fNbBinsMemoD_SCs_ChDs = nb_bins;}
12216       if( HistoCode == "D_MSp_SpNb"){fNbBinsMemoD_MSp_SpNb = nb_bins;}
12217       if( HistoCode == "D_MSp_SpDs"){fNbBinsMemoD_MSp_SpDs = nb_bins;}
12218       if( HistoCode == "D_SSp_SpNb"){fNbBinsMemoD_SSp_SpNb = nb_bins;}
12219       if( HistoCode == "D_SSp_SpDs"){fNbBinsMemoD_SSp_SpDs = nb_bins;}
12220       if( HistoCode == "D_Adc_EvNb"){fNbBinsMemoD_Adc_EvNb = nb_bins;}
12221       if( HistoCode == "D_Adc_EvDs"){fNbBinsMemoD_Adc_EvDs = nb_bins;}
12222       if( HistoCode == "H_Ped_Date"){fNbBinsMemoH_Ped_Date = nb_bins;}
12223       if( HistoCode == "H_TNo_Date"){fNbBinsMemoH_TNo_Date = nb_bins;}
12224       if( HistoCode == "H_MCs_Date"){fNbBinsMemoH_MCs_Date = nb_bins;}
12225       if( HistoCode == "H_LFN_Date"){fNbBinsMemoH_LFN_Date = nb_bins;}
12226       if( HistoCode == "H_HFN_Date"){fNbBinsMemoH_HFN_Date = nb_bins;}
12227       if( HistoCode == "H_SCs_Date"){fNbBinsMemoH_SCs_Date = nb_bins;}
12228       if( HistoCode == "H_Ped_RuDs"){fNbBinsMemoH_Ped_RuDs = nb_bins;}
12229       if( HistoCode == "H_TNo_RuDs"){fNbBinsMemoH_TNo_RuDs = nb_bins;}
12230       if( HistoCode == "H_MCs_RuDs"){fNbBinsMemoH_MCs_RuDs = nb_bins;}
12231       if( HistoCode == "H_LFN_RuDs"){fNbBinsMemoH_LFN_RuDs = nb_bins;}
12232       if( HistoCode == "H_HFN_RuDs"){fNbBinsMemoH_HFN_RuDs = nb_bins;}
12233       if( HistoCode == "H_SCs_RuDs"){fNbBinsMemoH_SCs_RuDs = nb_bins;}
12234     }
12235 }// end of SetNbBinsMemo(...)
12236 
12237 Int_t TEcnaHistos::GetNbBinsFromMemo(const TString HistoCode, const TString opt_plot)
12238 {
12239   Int_t nb_bins = 0;
12240 
12241   if( opt_plot == fSameOnePlot ){nb_bins = fNbBinsMemoH1SamePlus;}
12242 
12243   if( opt_plot == fOnlyOnePlot || opt_plot == fSeveralPlot )
12244     {
12245       if( HistoCode == "D_NOE_ChNb"){nb_bins = fNbBinsMemoD_NOE_ChNb;}
12246       if( HistoCode == "D_NOE_ChDs"){nb_bins = fNbBinsMemoD_NOE_ChDs;}  
12247       if( HistoCode == "D_Ped_ChNb"){nb_bins = fNbBinsMemoD_Ped_ChNb;} 
12248       if( HistoCode == "D_Ped_ChDs"){nb_bins = fNbBinsMemoD_Ped_ChDs;} 
12249       if( HistoCode == "D_TNo_ChNb"){nb_bins = fNbBinsMemoD_TNo_ChNb;}
12250       if( HistoCode == "D_TNo_ChDs"){nb_bins = fNbBinsMemoD_TNo_ChDs;} 
12251       if( HistoCode == "D_MCs_ChNb"){nb_bins = fNbBinsMemoD_MCs_ChNb;} 
12252       if( HistoCode == "D_MCs_ChDs"){nb_bins = fNbBinsMemoD_MCs_ChDs;} 
12253       if( HistoCode == "D_LFN_ChNb"){nb_bins = fNbBinsMemoD_LFN_ChNb;} 
12254       if( HistoCode == "D_LFN_ChDs"){nb_bins = fNbBinsMemoD_LFN_ChDs;}
12255       if( HistoCode == "D_HFN_ChNb"){nb_bins = fNbBinsMemoD_HFN_ChNb;} 
12256       if( HistoCode == "D_HFN_ChDs"){nb_bins = fNbBinsMemoD_HFN_ChDs;} 
12257       if( HistoCode == "D_SCs_ChNb"){nb_bins = fNbBinsMemoD_SCs_ChNb;}
12258       if( HistoCode == "D_SCs_ChDs"){nb_bins = fNbBinsMemoD_SCs_ChDs;}
12259       if( HistoCode == "D_MSp_SpNb"){nb_bins = fNbBinsMemoD_MSp_SpNb;}
12260       if( HistoCode == "D_MSp_SpDs"){nb_bins = fNbBinsMemoD_MSp_SpDs;}
12261       if( HistoCode == "D_SSp_SpNb"){nb_bins = fNbBinsMemoD_SSp_SpNb;}
12262       if( HistoCode == "D_SSp_SpDs"){nb_bins = fNbBinsMemoD_SSp_SpDs;}
12263       if( HistoCode == "D_Adc_EvNb"){nb_bins = fNbBinsMemoD_Adc_EvNb;}
12264       if( HistoCode == "D_Adc_EvDs"){nb_bins = fNbBinsMemoD_Adc_EvDs;}
12265       if( HistoCode == "H_Ped_Date"){nb_bins = fNbBinsMemoH_Ped_Date;}
12266       if( HistoCode == "H_TNo_Date"){nb_bins = fNbBinsMemoH_TNo_Date;}
12267       if( HistoCode == "H_MCs_Date"){nb_bins = fNbBinsMemoH_MCs_Date;}
12268       if( HistoCode == "H_LFN_Date"){nb_bins = fNbBinsMemoH_LFN_Date;}
12269       if( HistoCode == "H_HFN_Date"){nb_bins = fNbBinsMemoH_HFN_Date;}
12270       if( HistoCode == "H_SCs_Date"){nb_bins = fNbBinsMemoH_SCs_Date;}
12271       if( HistoCode == "H_Ped_RuDs"){nb_bins = fNbBinsMemoH_Ped_RuDs;}
12272       if( HistoCode == "H_TNo_RuDs"){nb_bins = fNbBinsMemoH_TNo_RuDs;}
12273       if( HistoCode == "H_MCs_RuDs"){nb_bins = fNbBinsMemoH_MCs_RuDs;}
12274       if( HistoCode == "H_LFN_RuDs"){nb_bins = fNbBinsMemoH_LFN_RuDs;}
12275       if( HistoCode == "H_HFN_RuDs"){nb_bins = fNbBinsMemoH_HFN_RuDs;}
12276       if( HistoCode == "H_SCs_RuDs"){nb_bins = fNbBinsMemoH_SCs_RuDs;}
12277     }
12278   return nb_bins;
12279 }// end of GetNbBinsFromMemo(...)
12280 
12281 TString TEcnaHistos::GetMemoFlag(const TString opt_plot)
12282 {
12283   TString memo_flag;
12284   Int_t MaxCar = fgMaxCar;
12285   memo_flag.Resize(MaxCar);
12286   memo_flag = "(no memo_flag info)";
12287 
12288   Int_t memo_flag_number = -1;
12289 
12290   if( opt_plot == fSameOnePlot ){memo_flag_number = fMemoPlotH1SamePlus;}
12291 
12292   if( opt_plot == fOnlyOnePlot || opt_plot == fSeveralPlot )
12293     {
12294       memo_flag_number = fMemoPlotD_TNo_ChDs+fMemoPlotD_MCs_ChDs
12295         +fMemoPlotD_LFN_ChDs+fMemoPlotD_HFN_ChDs+fMemoPlotD_SCs_ChDs;
12296     }
12297 
12298   if(memo_flag_number == 0){memo_flag = "Free";}
12299   if(memo_flag_number >= 1){memo_flag = "Busy";}
12300 
12301   return memo_flag;
12302 }
12303 
12304 TString TEcnaHistos::GetMemoFlag(const TString HistoCode, const TString opt_plot)
12305 {
12306 // Get Memo Flag
12307 
12308   TString memo_flag;
12309   Int_t MaxCar = fgMaxCar;
12310   memo_flag.Resize(MaxCar);
12311   memo_flag = "(no memo_flag info)";
12312 
12313   Int_t memo_flag_number = -1;
12314 
12315   if( opt_plot == fSameOnePlot ){memo_flag_number = fMemoPlotH1SamePlus;}
12316 
12317   if( opt_plot == fOnlyOnePlot || opt_plot == fSeveralPlot )
12318     {
12319       if(HistoCode == "D_NOE_ChNb"){memo_flag_number = fMemoPlotD_NOE_ChNb;}
12320       if(HistoCode == "D_NOE_ChDs"){memo_flag_number = fMemoPlotD_NOE_ChDs;}
12321       if(HistoCode == "D_Ped_ChNb"){memo_flag_number = fMemoPlotD_Ped_ChNb;}
12322       if(HistoCode == "D_Ped_ChDs"){memo_flag_number = fMemoPlotD_Ped_ChDs;}
12323       if(HistoCode == "D_TNo_ChNb"){memo_flag_number = fMemoPlotD_TNo_ChNb;}
12324       if(HistoCode == "D_TNo_ChDs"){memo_flag_number = fMemoPlotD_TNo_ChDs;}
12325       if(HistoCode == "D_MCs_ChNb"){memo_flag_number = fMemoPlotD_MCs_ChNb;}
12326       if(HistoCode == "D_MCs_ChDs"){memo_flag_number = fMemoPlotD_MCs_ChDs;}
12327       if(HistoCode == "D_LFN_ChNb"){memo_flag_number = fMemoPlotD_LFN_ChNb;}
12328       if(HistoCode == "D_LFN_ChDs"){memo_flag_number = fMemoPlotD_LFN_ChDs;} 
12329       if(HistoCode == "D_HFN_ChNb"){memo_flag_number = fMemoPlotD_HFN_ChNb;} 
12330       if(HistoCode == "D_HFN_ChDs"){memo_flag_number = fMemoPlotD_HFN_ChDs;}
12331       if(HistoCode == "D_SCs_ChNb"){memo_flag_number = fMemoPlotD_SCs_ChNb;}
12332       if(HistoCode == "D_SCs_ChDs"){memo_flag_number = fMemoPlotD_SCs_ChDs;}
12333       if(HistoCode == "D_MSp_SpNb"){memo_flag_number = fMemoPlotD_MSp_SpNb;}
12334       if(HistoCode == "D_MSp_SpDs"){memo_flag_number = fMemoPlotD_MSp_SpDs;}
12335       if(HistoCode == "D_SSp_SpNb"){memo_flag_number = fMemoPlotD_SSp_SpNb;}
12336       if(HistoCode == "D_SSp_SpDs"){memo_flag_number = fMemoPlotD_SSp_SpDs;}
12337       if(HistoCode == "D_Adc_EvNb"){memo_flag_number = fMemoPlotD_Adc_EvNb;}
12338       if(HistoCode == "D_Adc_EvDs"){memo_flag_number = fMemoPlotD_Adc_EvDs;}
12339       if(HistoCode == "H_Ped_Date"){memo_flag_number = fMemoPlotH_Ped_Date;}
12340       if(HistoCode == "H_TNo_Date"){memo_flag_number = fMemoPlotH_TNo_Date;}
12341       if(HistoCode == "H_MCs_Date"){memo_flag_number = fMemoPlotH_MCs_Date;}
12342       if(HistoCode == "H_LFN_Date"){memo_flag_number = fMemoPlotH_LFN_Date;}
12343       if(HistoCode == "H_HFN_Date"){memo_flag_number = fMemoPlotH_HFN_Date;}
12344       if(HistoCode == "H_SCs_Date"){memo_flag_number = fMemoPlotH_SCs_Date;}
12345       if(HistoCode == "H_Ped_RuDs"){memo_flag_number = fMemoPlotH_Ped_RuDs;}
12346       if(HistoCode == "H_TNo_RuDs"){memo_flag_number = fMemoPlotH_TNo_RuDs;}
12347       if(HistoCode == "H_MCs_RuDs"){memo_flag_number = fMemoPlotH_MCs_RuDs;}
12348       if(HistoCode == "H_LFN_RuDs"){memo_flag_number = fMemoPlotH_LFN_RuDs;}
12349       if(HistoCode == "H_HFN_RuDs"){memo_flag_number = fMemoPlotH_HFN_RuDs;}
12350       if(HistoCode == "H_SCs_RuDs"){memo_flag_number = fMemoPlotH_SCs_RuDs;}
12351     }
12352 
12353   if(memo_flag_number == 0){memo_flag = "Free";}
12354   if(memo_flag_number == 1){memo_flag = "Busy";}
12355 
12356   return memo_flag;
12357 }
12358 
12359 TCanvas* TEcnaHistos::CreateCanvas(const TString HistoCode, const TString opt_plot, const TString canvas_name,
12360                                    UInt_t canv_w, UInt_t canv_h)
12361 {
12362 // Create canvas according to HistoCode
12363 
12364   TCanvas* main_canvas = 0;
12365  
12366   if( opt_plot == fSameOnePlot )
12367     {
12368       fCanvH1SamePlus = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h); fCnewRoot++;
12369       main_canvas = fCanvH1SamePlus;
12370     }
12371   if( opt_plot == fSeveralPlot || opt_plot == fOnlyOnePlot )
12372     {
12373       if(HistoCode == "D_NOE_ChNb"){
12374         fCanvD_NOE_ChNb = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h); fCnewRoot++;
12375         main_canvas = fCanvD_NOE_ChNb;}
12376       if(HistoCode == "D_NOE_ChDs"){
12377         fCanvD_NOE_ChDs = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h); fCnewRoot++;
12378         main_canvas = fCanvD_NOE_ChDs;}
12379       if(HistoCode == "D_Ped_ChNb"){
12380         fCanvD_Ped_ChNb = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h); fCnewRoot++;
12381         main_canvas = fCanvD_Ped_ChNb;}
12382       if(HistoCode == "D_Ped_ChDs"){
12383         fCanvD_Ped_ChDs = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h); fCnewRoot++;
12384         main_canvas = fCanvD_Ped_ChDs;}
12385       if(HistoCode == "D_TNo_ChNb"){
12386         fCanvD_TNo_ChNb = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h); fCnewRoot++;
12387         main_canvas = fCanvD_TNo_ChNb;}
12388       if(HistoCode == "D_TNo_ChDs"){
12389         fCanvD_TNo_ChDs = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h); fCnewRoot++;
12390         main_canvas = fCanvD_TNo_ChDs;}
12391       if(HistoCode == "D_MCs_ChNb"){
12392         fCanvD_MCs_ChNb = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h); fCnewRoot++;
12393         main_canvas = fCanvD_MCs_ChNb;}
12394       if(HistoCode == "D_MCs_ChDs"){
12395         fCanvD_MCs_ChDs = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h); fCnewRoot++;
12396         main_canvas = fCanvD_MCs_ChDs;}
12397       if(HistoCode == "D_LFN_ChNb"){
12398         fCanvD_LFN_ChNb = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h); fCnewRoot++;
12399         main_canvas = fCanvD_LFN_ChNb;}
12400       if(HistoCode == "D_LFN_ChDs"){
12401         fCanvD_LFN_ChDs = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h); fCnewRoot++;
12402         main_canvas = fCanvD_LFN_ChDs;}
12403       if(HistoCode == "D_HFN_ChNb"){
12404         fCanvD_HFN_ChNb = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h); fCnewRoot++;
12405         main_canvas = fCanvD_HFN_ChNb;}
12406       if(HistoCode == "D_HFN_ChDs"){
12407         fCanvD_HFN_ChDs = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h); fCnewRoot++;
12408         main_canvas = fCanvD_HFN_ChDs;}
12409       if(HistoCode == "D_SCs_ChNb"){
12410         fCanvD_SCs_ChNb = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h); fCnewRoot++;
12411         main_canvas = fCanvD_SCs_ChNb;}
12412       if(HistoCode == "D_SCs_ChDs"){
12413         fCanvD_SCs_ChDs = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h); fCnewRoot++;
12414         main_canvas = fCanvD_SCs_ChDs;}
12415 
12416       if(HistoCode == "D_MSp_SpNb"        ){
12417         fCanvD_MSp_SpNb = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h); fCnewRoot++;
12418         main_canvas = fCanvD_MSp_SpNb;}
12419       if(HistoCode == "D_MSp_SpDs"        ){
12420         fCanvD_MSp_SpDs = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h); fCnewRoot++;
12421         main_canvas = fCanvD_MSp_SpDs;}
12422       if(HistoCode =="D_SSp_SpNb"      ){
12423         fCanvD_SSp_SpNb = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h); fCnewRoot++;
12424         main_canvas = fCanvD_SSp_SpNb;}
12425       if(HistoCode =="D_SSp_SpDs"      ){
12426         fCanvD_SSp_SpDs = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h); fCnewRoot++;
12427         main_canvas = fCanvD_SSp_SpDs;}
12428 
12429       if(HistoCode == "D_Adc_EvNb"){
12430         fCanvD_Adc_EvNb = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h); fCnewRoot++;
12431         main_canvas = fCanvD_Adc_EvNb;}
12432       if(HistoCode == "D_Adc_EvDs"){
12433         fCanvD_Adc_EvDs = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h); fCnewRoot++;
12434         main_canvas = fCanvD_Adc_EvDs;}
12435 
12436       if(HistoCode == "H_Ped_Date"){
12437         fCanvH_Ped_Date = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h); fCnewRoot++;
12438         main_canvas = fCanvH_Ped_Date;}
12439       if(HistoCode == "H_TNo_Date"){
12440         fCanvH_TNo_Date = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h); fCnewRoot++;
12441         main_canvas = fCanvH_TNo_Date;}
12442       if(HistoCode == "H_MCs_Date"){
12443         fCanvH_MCs_Date = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h); fCnewRoot++;
12444         main_canvas = fCanvH_MCs_Date;}
12445       if(HistoCode == "H_LFN_Date"){
12446         fCanvH_LFN_Date = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h); fCnewRoot++;
12447         main_canvas = fCanvH_LFN_Date;}
12448       if(HistoCode == "H_HFN_Date"){
12449         fCanvH_HFN_Date = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h); fCnewRoot++;
12450         main_canvas = fCanvH_HFN_Date;}
12451       if(HistoCode == "H_SCs_Date"){
12452         fCanvH_SCs_Date = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h); fCnewRoot++;
12453         main_canvas = fCanvH_SCs_Date;}
12454 
12455       if(HistoCode == "H_Ped_RuDs"){
12456         fCanvH_Ped_RuDs = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h); fCnewRoot++;
12457         main_canvas = fCanvH_Ped_RuDs;}
12458       if(HistoCode == "H_TNo_RuDs"){
12459         fCanvH_TNo_RuDs = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h); fCnewRoot++;
12460         main_canvas = fCanvH_TNo_RuDs;}
12461       if(HistoCode == "H_MCs_RuDs"){
12462         fCanvH_MCs_RuDs = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h); fCnewRoot++;
12463         main_canvas = fCanvH_MCs_RuDs;}
12464       if(HistoCode == "H_LFN_RuDs"){
12465         fCanvH_LFN_RuDs = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h); fCnewRoot++;
12466         main_canvas = fCanvH_LFN_RuDs;}
12467       if(HistoCode == "H_HFN_RuDs"){
12468         fCanvH_HFN_RuDs = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h); fCnewRoot++;
12469         main_canvas = fCanvH_HFN_RuDs;}
12470       if(HistoCode == "H_SCs_RuDs"){
12471         fCanvH_SCs_RuDs = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h); fCnewRoot++;
12472         main_canvas = fCanvH_SCs_RuDs;}
12473 
12474     }
12475   return main_canvas;
12476 }
12477 // end of CreateCanvas
12478 
12479 void TEcnaHistos::SetParametersCanvas(const TString HistoCode, const TString opt_plot)
12480 {
12481 // Set parameters canvas according to HistoCode
12482   
12483   Double_t x_margin_factor = fCnaParHistos->BoxLeftX("bottom_left_box") - 0.005;
12484   Double_t y_margin_factor = fCnaParHistos->BoxTopY("bottom_right_box") + 0.005;
12485 
12486   if( opt_plot == fSameOnePlot )
12487     {
12488       fImpH1SamePlus = (TCanvasImp*)fCanvH1SamePlus->GetCanvasImp();
12489       fCanvH1SamePlus->Divide(1, 1, x_margin_factor , y_margin_factor); gPad->cd(1);
12490       fPadH1SamePlus = gPad;   fClosedH1SamePlus = kFALSE;
12491       fMemoPlotH1SamePlus = 1; fMemoColorH1SamePlus = 0;
12492     }
12493 
12494   if( opt_plot == fOnlyOnePlot ||  opt_plot == fSeveralPlot)
12495     {
12496       if(HistoCode == "D_NOE_ChNb")
12497         {
12498           fImpD_NOE_ChNb = (TCanvasImp*)fCanvD_NOE_ChNb->GetCanvasImp();
12499           fCanvD_NOE_ChNb->Divide(1, 1, x_margin_factor , y_margin_factor); gPad->cd(1);
12500           fPadD_NOE_ChNb = gPad;   fClosedD_NOE_ChNb = kFALSE;
12501           fMemoPlotD_NOE_ChNb = 1; fMemoColorD_NOE_ChNb = 0;
12502         }
12503       
12504       if(HistoCode == "D_NOE_ChDs")                                               // (SetParametersCanvas)
12505         {
12506           fImpD_NOE_ChDs = (TCanvasImp*)fCanvD_NOE_ChDs->GetCanvasImp();
12507           fCanvD_NOE_ChDs->Divide(1, 1, x_margin_factor , y_margin_factor); gPad->cd(1);
12508           fPadD_NOE_ChDs = gPad;   fClosedD_NOE_ChDs = kFALSE;
12509           fMemoPlotD_NOE_ChDs = 1; fMemoColorD_NOE_ChDs = 0;
12510         }
12511       
12512       if(HistoCode == "D_Ped_ChNb")
12513         {
12514           fImpD_Ped_ChNb = (TCanvasImp*)fCanvD_Ped_ChNb->GetCanvasImp();
12515           fCanvD_Ped_ChNb->Divide(1, 1, x_margin_factor , y_margin_factor); gPad->cd(1);
12516           fPadD_Ped_ChNb = gPad;   fClosedD_Ped_ChNb = kFALSE;
12517           fMemoPlotD_Ped_ChNb = 1; fMemoColorD_Ped_ChNb = 0;
12518         }
12519       
12520       if(HistoCode == "D_Ped_ChDs")
12521         {
12522           fImpD_Ped_ChDs = (TCanvasImp*)fCanvD_Ped_ChDs->GetCanvasImp();
12523           fCanvD_Ped_ChDs->Divide(1, 1, x_margin_factor , y_margin_factor); gPad->cd(1);
12524           fPadD_Ped_ChDs = gPad;   fClosedD_Ped_ChDs = kFALSE;
12525           fMemoPlotD_Ped_ChDs = 1; fMemoColorD_Ped_ChDs = 0;
12526         }
12527       
12528       if(HistoCode == "D_TNo_ChNb")
12529         {
12530           fImpD_TNo_ChNb = (TCanvasImp*)fCanvD_TNo_ChNb->GetCanvasImp();
12531           fCanvD_TNo_ChNb->Divide(1, 1, x_margin_factor , y_margin_factor); gPad->cd(1);
12532           fPadD_TNo_ChNb = gPad;   fClosedD_TNo_ChNb = kFALSE;
12533           fMemoPlotD_TNo_ChNb = 1; fMemoColorD_TNo_ChNb = 0;
12534         }
12535       
12536       if(HistoCode == "D_TNo_ChDs")                                               // (SetParametersCanvas)
12537         {
12538           fImpD_TNo_ChDs = (TCanvasImp*)fCanvD_TNo_ChDs->GetCanvasImp();
12539           fCanvD_TNo_ChDs->Divide(1, 1, x_margin_factor , y_margin_factor); gPad->cd(1);
12540           fPadD_TNo_ChDs = gPad;   fClosedD_TNo_ChDs = kFALSE;
12541           fMemoPlotD_TNo_ChDs = 1; fMemoColorD_TNo_ChDs = 0;
12542         }
12543       
12544       if(HistoCode == "D_MCs_ChNb")
12545         {
12546           fImpD_MCs_ChNb = (TCanvasImp*)fCanvD_MCs_ChNb->GetCanvasImp();
12547           fCanvD_MCs_ChNb->Divide(1, 1, x_margin_factor , y_margin_factor); gPad->cd(1);
12548           fPadD_MCs_ChNb = gPad;   fClosedD_MCs_ChNb = kFALSE;
12549           fMemoPlotD_MCs_ChNb = 1; fMemoColorD_MCs_ChNb = 0;
12550         }
12551       
12552       if(HistoCode == "D_MCs_ChDs")
12553         {
12554           fImpD_MCs_ChDs = (TCanvasImp*)fCanvD_MCs_ChDs->GetCanvasImp();
12555           fCanvD_MCs_ChDs->Divide(1, 1, x_margin_factor , y_margin_factor); gPad->cd(1);
12556           fPadD_MCs_ChDs = gPad;   fClosedD_MCs_ChDs = kFALSE;
12557           fMemoPlotD_MCs_ChDs = 1; fMemoColorD_MCs_ChDs = 0;
12558         }
12559       
12560       if(HistoCode == "D_LFN_ChNb")                                               // (SetParametersCanvas)
12561         {
12562           fImpD_LFN_ChNb = (TCanvasImp*)fCanvD_LFN_ChNb->GetCanvasImp();
12563           fCanvD_LFN_ChNb->Divide(1, 1, x_margin_factor , y_margin_factor); gPad->cd(1);
12564           fPadD_LFN_ChNb = gPad;   fClosedD_LFN_ChNb = kFALSE;
12565           fMemoPlotD_LFN_ChNb = 1; fMemoColorD_LFN_ChNb = 0;
12566         }
12567       
12568       if(HistoCode == "D_LFN_ChDs")
12569         {
12570           fImpD_LFN_ChDs = (TCanvasImp*)fCanvD_LFN_ChDs->GetCanvasImp();
12571           fCanvD_LFN_ChDs->Divide(1, 1, x_margin_factor , y_margin_factor); gPad->cd(1);
12572           fPadD_LFN_ChDs = gPad;   fClosedD_LFN_ChDs = kFALSE;
12573           fMemoPlotD_LFN_ChDs = 1; fMemoColorD_LFN_ChDs = 0;
12574         }
12575       
12576       if(HistoCode == "D_HFN_ChNb")
12577         {
12578           fImpD_HFN_ChNb = (TCanvasImp*)fCanvD_HFN_ChNb->GetCanvasImp();
12579           fCanvD_HFN_ChNb->Divide(1, 1, x_margin_factor , y_margin_factor); gPad->cd(1);
12580           fPadD_HFN_ChNb = gPad;   fClosedD_HFN_ChNb = kFALSE;
12581           fMemoPlotD_HFN_ChNb = 1; fMemoColorD_HFN_ChNb = 0;
12582         }
12583       
12584       if(HistoCode == "D_HFN_ChDs")
12585         {
12586           fImpD_HFN_ChDs = (TCanvasImp*)fCanvD_HFN_ChDs->GetCanvasImp();
12587           fCanvD_HFN_ChDs->Divide(1, 1, x_margin_factor , y_margin_factor); gPad->cd(1);
12588           fPadD_HFN_ChDs = gPad;   fClosedD_HFN_ChDs = kFALSE;
12589           fMemoPlotD_HFN_ChDs = 1; fMemoColorD_HFN_ChDs = 0;
12590         }
12591       
12592       if(HistoCode == "D_SCs_ChNb")                                               // (SetParametersCanvas)
12593         {
12594           fImpD_SCs_ChNb = (TCanvasImp*)fCanvD_SCs_ChNb->GetCanvasImp();
12595           fCanvD_SCs_ChNb->Divide(1, 1, x_margin_factor , y_margin_factor); gPad->cd(1);
12596           fPadD_SCs_ChNb = gPad;   fClosedD_SCs_ChNb = kFALSE;
12597           fMemoPlotD_SCs_ChNb = 1; fMemoColorD_SCs_ChNb = 0;
12598         }
12599       
12600       if(HistoCode == "D_SCs_ChDs")
12601         {
12602           fImpD_SCs_ChDs = (TCanvasImp*)fCanvD_SCs_ChDs->GetCanvasImp();
12603           fCanvD_SCs_ChDs->Divide(1, 1, x_margin_factor , y_margin_factor); gPad->cd(1);
12604           fPadD_SCs_ChDs = gPad;   fClosedD_SCs_ChDs = kFALSE;
12605           fMemoPlotD_SCs_ChDs = 1; fMemoColorD_SCs_ChDs = 0;
12606         }
12607       
12608       if(HistoCode == "D_MSp_SpNb")
12609         {
12610           fImpD_MSp_SpNb = (TCanvasImp*)fCanvD_MSp_SpNb->GetCanvasImp();
12611           fCanvD_MSp_SpNb->Divide(1, 1, x_margin_factor , y_margin_factor); gPad->cd(1);
12612           fPadD_MSp_SpNb = gPad;   fClosedD_MSp_SpNb = kFALSE;
12613           fMemoPlotD_MSp_SpNb = 1; fMemoColorD_MSp_SpNb = 0;
12614         }
12615       
12616       if(HistoCode == "D_MSp_SpDs")
12617         {
12618           fImpD_MSp_SpDs = (TCanvasImp*)fCanvD_MSp_SpDs->GetCanvasImp();
12619           fCanvD_MSp_SpDs->Divide(1, 1, x_margin_factor , y_margin_factor); gPad->cd(1);
12620           fPadD_MSp_SpDs = gPad;   fClosedD_MSp_SpDs = kFALSE;
12621           fMemoPlotD_MSp_SpDs = 1; fMemoColorD_MSp_SpDs = 0;
12622         }
12623       
12624       if(HistoCode == "D_SSp_SpNb")                                               // (SetParametersCanvas)
12625         {
12626           fImpD_SSp_SpNb = (TCanvasImp*)fCanvD_SSp_SpNb->GetCanvasImp();
12627           fCanvD_SSp_SpNb->Divide(1, 1, x_margin_factor , y_margin_factor); gPad->cd(1);
12628           fPadD_SSp_SpNb = gPad;   fClosedD_SSp_SpNb = kFALSE;
12629           fMemoPlotD_SSp_SpNb = 1; fMemoColorD_SSp_SpNb = 0;
12630         }
12631       
12632       if(HistoCode == "D_SSp_SpDs")                                               // (SetParametersCanvas)
12633         {
12634           fImpD_SSp_SpDs = (TCanvasImp*)fCanvD_SSp_SpDs->GetCanvasImp();
12635           fCanvD_SSp_SpDs->Divide(1, 1, x_margin_factor , y_margin_factor); gPad->cd(1);
12636           fPadD_SSp_SpDs = gPad;   fClosedD_SSp_SpDs = kFALSE;
12637           fMemoPlotD_SSp_SpDs = 1; fMemoColorD_SSp_SpDs = 0;
12638         }
12639       
12640       if(HistoCode == "D_Adc_EvDs")
12641         {
12642           fImpD_Adc_EvDs = (TCanvasImp*)fCanvD_Adc_EvDs->GetCanvasImp();
12643           fCanvD_Adc_EvDs->Divide(1, 1, x_margin_factor , y_margin_factor); gPad->cd(1);
12644           fPadD_Adc_EvDs = gPad;   fClosedD_Adc_EvDs = kFALSE;
12645           fMemoPlotD_Adc_EvDs = 1; fMemoColorD_Adc_EvDs = 0;              
12646         }
12647       
12648       if(HistoCode == "D_Adc_EvNb")
12649         {
12650           fImpD_Adc_EvNb = (TCanvasImp*)fCanvD_Adc_EvNb->GetCanvasImp();
12651           fCanvD_Adc_EvNb->Divide(1, 1, x_margin_factor , y_margin_factor); gPad->cd(1);
12652           fPadD_Adc_EvNb = gPad;   fClosedD_Adc_EvNb = kFALSE;
12653           fMemoPlotD_Adc_EvNb = 1; fMemoColorD_Adc_EvNb = 0;
12654         }
12655       
12656       if(HistoCode == "H_Ped_Date")                                               // (SetParametersCanvas)
12657         {
12658           fImpH_Ped_Date = (TCanvasImp*)fCanvH_Ped_Date->GetCanvasImp();
12659           fCanvH_Ped_Date->Divide(1, 1, x_margin_factor , y_margin_factor); gPad->cd(1);
12660           fPadH_Ped_Date = gPad;   fClosedH_Ped_Date = kFALSE;
12661           fMemoPlotH_Ped_Date = 1; fMemoColorH_Ped_Date = 0;
12662         }
12663       if(HistoCode == "H_TNo_Date")
12664         {
12665           fImpH_TNo_Date = (TCanvasImp*)fCanvH_TNo_Date->GetCanvasImp();
12666           fCanvH_TNo_Date->Divide(1, 1, x_margin_factor , y_margin_factor); gPad->cd(1);
12667           fPadH_TNo_Date = gPad;   fClosedH_TNo_Date = kFALSE;
12668           fMemoPlotH_TNo_Date = 1; fMemoColorH_TNo_Date = 0;
12669         }
12670       if(HistoCode == "H_MCs_Date")
12671         {
12672           fImpH_MCs_Date = (TCanvasImp*)fCanvH_MCs_Date->GetCanvasImp();
12673           fCanvH_MCs_Date->Divide(1, 1, x_margin_factor , y_margin_factor); gPad->cd(1);
12674           fPadH_MCs_Date = gPad;   fClosedH_MCs_Date = kFALSE;
12675           fMemoPlotH_MCs_Date = 1; fMemoColorH_MCs_Date = 0;
12676         }
12677 
12678       if(HistoCode == "H_LFN_Date")                                               // (SetParametersCanvas)
12679         {
12680           fImpH_LFN_Date = (TCanvasImp*)fCanvH_LFN_Date->GetCanvasImp();
12681           fCanvH_LFN_Date->Divide(1, 1, x_margin_factor , y_margin_factor); gPad->cd(1);
12682           fPadH_LFN_Date = gPad;   fClosedH_LFN_Date = kFALSE;
12683           fMemoPlotH_LFN_Date = 1; fMemoColorH_LFN_Date = 0;
12684         }
12685       if(HistoCode == "H_HFN_Date")
12686         {
12687           fImpH_HFN_Date = (TCanvasImp*)fCanvH_HFN_Date->GetCanvasImp();
12688           fCanvH_HFN_Date->Divide(1, 1, x_margin_factor , y_margin_factor); gPad->cd(1);
12689           fPadH_HFN_Date = gPad;   fClosedH_HFN_Date = kFALSE;
12690           fMemoPlotH_HFN_Date = 1; fMemoColorH_HFN_Date = 0;
12691         }
12692       if(HistoCode == "H_SCs_Date")
12693         {
12694           fImpH_SCs_Date = (TCanvasImp*)fCanvH_SCs_Date->GetCanvasImp();
12695           fCanvH_SCs_Date->Divide(1, 1, x_margin_factor , y_margin_factor); gPad->cd(1);
12696           fPadH_SCs_Date = gPad;   fClosedH_SCs_Date = kFALSE;
12697           fMemoPlotH_SCs_Date = 1; fMemoColorH_SCs_Date = 0;
12698         }
12699 
12700       if(HistoCode == "H_Ped_RuDs")                                               // (SetParametersCanvas)
12701         {
12702           fImpH_Ped_RuDs = (TCanvasImp*)fCanvH_Ped_RuDs->GetCanvasImp();
12703           fCanvH_Ped_RuDs->Divide(1, 1, x_margin_factor , y_margin_factor); gPad->cd(1);
12704           fPadH_Ped_RuDs = gPad;   fClosedH_Ped_RuDs = kFALSE;
12705           fMemoPlotH_Ped_RuDs = 1; fMemoColorH_Ped_RuDs = 0;
12706         }
12707       if(HistoCode == "H_TNo_RuDs")
12708         {
12709           fImpH_TNo_RuDs = (TCanvasImp*)fCanvH_TNo_RuDs->GetCanvasImp();
12710           fCanvH_TNo_RuDs->Divide(1, 1, x_margin_factor , y_margin_factor); gPad->cd(1);
12711           fPadH_TNo_RuDs = gPad;   fClosedH_TNo_RuDs = kFALSE;
12712           fMemoPlotH_TNo_RuDs = 1; fMemoColorH_TNo_RuDs = 0;
12713         }
12714       if(HistoCode == "H_MCs_RuDs")
12715         {
12716           fImpH_MCs_RuDs = (TCanvasImp*)fCanvH_MCs_RuDs->GetCanvasImp();
12717           fCanvH_MCs_RuDs->Divide(1, 1, x_margin_factor , y_margin_factor); gPad->cd(1);
12718           fPadH_MCs_RuDs = gPad;   fClosedH_MCs_RuDs = kFALSE;
12719           fMemoPlotH_MCs_RuDs = 1; fMemoColorH_MCs_RuDs = 0;
12720         }
12721 
12722       if(HistoCode == "H_LFN_RuDs")                                               // (SetParametersCanvas)
12723         {
12724           fImpH_LFN_RuDs = (TCanvasImp*)fCanvH_LFN_RuDs->GetCanvasImp();
12725           fCanvH_LFN_RuDs->Divide(1, 1, x_margin_factor , y_margin_factor); gPad->cd(1);
12726           fPadH_LFN_RuDs = gPad;   fClosedH_LFN_RuDs = kFALSE;
12727           fMemoPlotH_LFN_RuDs = 1; fMemoColorH_LFN_RuDs = 0;
12728         }
12729       if(HistoCode == "H_HFN_RuDs")
12730         {
12731           fImpH_HFN_RuDs = (TCanvasImp*)fCanvH_HFN_RuDs->GetCanvasImp();
12732           fCanvH_HFN_RuDs->Divide(1, 1, x_margin_factor , y_margin_factor); gPad->cd(1);
12733           fPadH_HFN_RuDs = gPad;   fClosedH_HFN_RuDs = kFALSE;
12734           fMemoPlotH_HFN_RuDs = 1; fMemoColorH_HFN_RuDs = 0;
12735         }
12736       if(HistoCode == "H_SCs_RuDs")
12737         {
12738           fImpH_SCs_RuDs = (TCanvasImp*)fCanvH_SCs_RuDs->GetCanvasImp();
12739           fCanvH_SCs_RuDs->Divide(1, 1, x_margin_factor , y_margin_factor); gPad->cd(1);
12740           fPadH_SCs_RuDs = gPad;   fClosedH_SCs_RuDs = kFALSE;
12741           fMemoPlotH_SCs_RuDs = 1; fMemoColorH_SCs_RuDs = 0;
12742         }
12743     }
12744 }
12745 // end of SetParametersCanvas
12746 
12747 TCanvas* TEcnaHistos::GetCurrentCanvas(const TString HistoCode, const TString opt_plot)
12748 {
12749   TCanvas* main_canvas = 0;
12750 
12751   if( opt_plot == fSameOnePlot ){main_canvas = fCanvH1SamePlus;}
12752 
12753   if( opt_plot == fOnlyOnePlot ||  opt_plot == fSeveralPlot)
12754     {
12755       if(HistoCode == "D_NOE_ChNb"){main_canvas = fCanvD_NOE_ChNb;}
12756       if(HistoCode == "D_NOE_ChDs"){main_canvas = fCanvD_NOE_ChDs;}
12757       if(HistoCode == "D_Ped_ChNb"){main_canvas = fCanvD_Ped_ChNb;}
12758       if(HistoCode == "D_Ped_ChDs"){main_canvas = fCanvD_Ped_ChDs;}
12759       if(HistoCode == "D_TNo_ChNb"){main_canvas = fCanvD_TNo_ChNb;}
12760       if(HistoCode == "D_TNo_ChDs"){main_canvas = fCanvD_TNo_ChDs;}
12761       if(HistoCode == "D_MCs_ChNb"){main_canvas = fCanvD_MCs_ChNb;}
12762       if(HistoCode == "D_MCs_ChDs"){main_canvas = fCanvD_MCs_ChDs;}
12763       if(HistoCode == "D_LFN_ChNb"){main_canvas = fCanvD_LFN_ChNb;}
12764       if(HistoCode == "D_LFN_ChDs"){main_canvas = fCanvD_LFN_ChDs;}
12765       if(HistoCode == "D_HFN_ChNb"){main_canvas = fCanvD_HFN_ChNb;}
12766       if(HistoCode == "D_HFN_ChDs"){main_canvas = fCanvD_HFN_ChDs;}
12767       if(HistoCode == "D_SCs_ChNb"){main_canvas = fCanvD_SCs_ChNb;}
12768       if(HistoCode == "D_SCs_ChDs"){main_canvas = fCanvD_SCs_ChDs;}
12769       if(HistoCode == "D_MSp_SpNb"){main_canvas = fCanvD_MSp_SpNb;}
12770       if(HistoCode == "D_MSp_SpDs"){main_canvas = fCanvD_MSp_SpDs;}
12771       if(HistoCode == "D_SSp_SpNb"){main_canvas = fCanvD_SSp_SpNb;}
12772       if(HistoCode == "D_SSp_SpDs"){main_canvas = fCanvD_SSp_SpDs;}
12773       if(HistoCode == "D_Adc_EvNb"){main_canvas = fCanvD_Adc_EvNb;}
12774       if(HistoCode == "D_Adc_EvDs"){main_canvas = fCanvD_Adc_EvDs;}
12775       if(HistoCode == "H_Ped_Date"){main_canvas = fCanvH_Ped_Date;}
12776       if(HistoCode == "H_TNo_Date"){main_canvas = fCanvH_TNo_Date;}
12777       if(HistoCode == "H_MCs_Date"){main_canvas = fCanvH_MCs_Date;}
12778       if(HistoCode == "H_LFN_Date"){main_canvas = fCanvH_LFN_Date;}
12779       if(HistoCode == "H_HFN_Date"){main_canvas = fCanvH_HFN_Date;}
12780       if(HistoCode == "H_SCs_Date"){main_canvas = fCanvH_SCs_Date;}
12781       if(HistoCode == "H_Ped_RuDs"){main_canvas = fCanvH_Ped_RuDs;}
12782       if(HistoCode == "H_TNo_RuDs"){main_canvas = fCanvH_TNo_RuDs;}
12783       if(HistoCode == "H_MCs_RuDs"){main_canvas = fCanvH_MCs_RuDs;}
12784       if(HistoCode == "H_LFN_RuDs"){main_canvas = fCanvH_LFN_RuDs;}
12785       if(HistoCode == "H_HFN_RuDs"){main_canvas = fCanvH_HFN_RuDs;}
12786       if(HistoCode == "H_SCs_RuDs"){main_canvas = fCanvH_SCs_RuDs;}
12787     }
12788   return main_canvas;
12789 }
12790 // end of GetCurrentCanvas(...)
12791 
12792 TCanvas* TEcnaHistos::GetCurrentCanvas(){return fCurrentCanvas;}
12793 TString  TEcnaHistos::GetCurrentCanvasName(){return fCurrentCanvasName;}
12794 
12795 void TEcnaHistos::PlotCloneOfCurrentCanvas()
12796 {
12797   if( fCurrentCanvas != 0)
12798     {
12799       if( (TCanvasImp*)fCurrentCanvas->GetCanvasImp() != 0 )
12800         {
12801           (TCanvas*)fCurrentCanvas->DrawClone();
12802         }
12803       else
12804         {
12805           cout << "TEcnaHistos::PlotCloneOfCurrentCanvas()> Last canvas has been removed. No clone can be done."
12806                << endl << "                                        Please, display the canvas again."
12807                << fTTBELL << endl;
12808         }
12809     }
12810   else
12811     {
12812       cout << "TEcnaHistos::PlotCloneOfCurrentCanvas()> No canvas has been created. No clone can be done."
12813            << fTTBELL << endl;
12814     }
12815 }
12816 
12817 //--------------------------------------------------------------------------------------------
12818 TVirtualPad* TEcnaHistos::ActivePad(const TString HistoCode, const TString opt_plot)
12819 {
12820 // Active Pad for Same plot option
12821 
12822   TVirtualPad* main_subpad = 0;
12823 
12824   fCurrentHistoCode = HistoCode;
12825   fCurrentOptPlot   = opt_plot;
12826 
12827   if( opt_plot == fSameOnePlot )
12828     {
12829       fCanvH1SamePlus->
12830         Connect("Closed()","TEcnaHistos",this,"DoCanvasClosed()");
12831       if( fClosedH1SamePlus == kFALSE ){main_subpad = fPadH1SamePlus;}   
12832     }
12833 
12834   if( opt_plot == fOnlyOnePlot || opt_plot == fSeveralPlot )
12835     {
12836       if(HistoCode == "D_NOE_ChNb"){
12837         fCanvD_NOE_ChNb->Connect("Closed()","TEcnaHistos",this,"DoCanvasClosed()");
12838         if( fClosedD_NOE_ChNb == kFALSE ){main_subpad = fPadD_NOE_ChNb;}}
12839       
12840       if(HistoCode == "D_NOE_ChDs"){
12841         fCanvD_NOE_ChDs->Connect("Closed()","TEcnaHistos",this,"DoCanvasClosed()");
12842         if( fClosedD_NOE_ChDs == kFALSE ){main_subpad = fPadD_NOE_ChDs;}}
12843       
12844       if(HistoCode == "D_Ped_ChNb"){
12845         fCanvD_Ped_ChNb->Connect("Closed()","TEcnaHistos",this,"DoCanvasClosed()");
12846         if( fClosedD_Ped_ChNb == kFALSE ){main_subpad = fPadD_Ped_ChNb;}}
12847       
12848       if(HistoCode == "D_Ped_ChDs"){
12849         fCanvD_Ped_ChDs->Connect("Closed()","TEcnaHistos",this,"DoCanvasClosed()");
12850         if( fClosedD_Ped_ChDs == kFALSE ){main_subpad = fPadD_Ped_ChDs;}}
12851       
12852       if(HistoCode == "D_TNo_ChNb"){
12853         fCanvD_TNo_ChNb->Connect("Closed()","TEcnaHistos",this,"DoCanvasClosed()");
12854         if( fClosedD_TNo_ChNb == kFALSE ){main_subpad = fPadD_TNo_ChNb;}}
12855 
12856       if(HistoCode == "D_TNo_ChDs"){
12857         fCanvD_TNo_ChDs->Connect("Closed()","TEcnaHistos",this,"DoCanvasClosed()");
12858         if( fClosedD_TNo_ChDs == kFALSE ){main_subpad = fPadD_TNo_ChDs;}}
12859       
12860       if(HistoCode == "D_MCs_ChNb"){
12861         fCanvD_MCs_ChNb->Connect("Closed()","TEcnaHistos",this,"DoCanvasClosed()");
12862         if( fClosedD_MCs_ChNb == kFALSE ){main_subpad = fPadD_MCs_ChNb;}}
12863       
12864       if(HistoCode == "D_MCs_ChDs"){
12865         fCanvD_MCs_ChDs->Connect("Closed()","TEcnaHistos",this,"DoCanvasClosed()");
12866         if( fClosedD_MCs_ChDs == kFALSE ){main_subpad = fPadD_MCs_ChDs;}}
12867 
12868       if(HistoCode == "D_LFN_ChNb"){
12869         fCanvD_LFN_ChNb->Connect("Closed()","TEcnaHistos",this,"DoCanvasClosed()");
12870         if( fClosedD_LFN_ChNb == kFALSE ){main_subpad = fPadD_LFN_ChNb;}}
12871       
12872       if(HistoCode == "D_LFN_ChDs"){
12873         fCanvD_LFN_ChDs->Connect("Closed()","TEcnaHistos",this,"DoCanvasClosed()");
12874         if( fClosedD_LFN_ChDs == kFALSE ){main_subpad = fPadD_LFN_ChDs;}}
12875       
12876       if(HistoCode == "D_HFN_ChNb"){
12877         fCanvD_HFN_ChNb->Connect("Closed()","TEcnaHistos",this,"DoCanvasClosed()");
12878         if( fClosedD_HFN_ChNb == kFALSE ){main_subpad = fPadD_HFN_ChNb;}}
12879       
12880       if(HistoCode == "D_HFN_ChDs"){
12881         fCanvD_HFN_ChDs->Connect("Closed()","TEcnaHistos",this,"DoCanvasClosed()");
12882         if( fClosedD_HFN_ChDs == kFALSE ){main_subpad = fPadD_HFN_ChDs;}}
12883       
12884       if(HistoCode == "D_SCs_ChNb"){
12885         fCanvD_SCs_ChNb->Connect("Closed()","TEcnaHistos",this,"DoCanvasClosed()");
12886         if( fClosedD_SCs_ChNb == kFALSE ){main_subpad = fPadD_SCs_ChNb;}}
12887       
12888       if(HistoCode == "D_SCs_ChDs"){
12889           fCanvD_SCs_ChDs->Connect("Closed()","TEcnaHistos",this,"DoCanvasClosed()");
12890         if( fClosedD_SCs_ChDs == kFALSE ){main_subpad = fPadD_SCs_ChDs;}}
12891       
12892       if(HistoCode == "D_MSp_SpNb"){
12893           fCanvD_MSp_SpNb->Connect("Closed()","TEcnaHistos",this,"DoCanvasClosed()");
12894         if( fClosedD_MSp_SpNb == kFALSE ){main_subpad = fPadD_MSp_SpNb;}}
12895       
12896       if(HistoCode == "D_MSp_SpDs"){
12897         fCanvD_MSp_SpDs->Connect("Closed()","TEcnaHistos",this,"DoCanvasClosed()");
12898         if( fClosedD_MSp_SpDs == kFALSE ){main_subpad = fPadD_MSp_SpDs;}}
12899 
12900       if(HistoCode == "D_SSp_SpNb"){
12901         fCanvD_SSp_SpNb->Connect("Closed()","TEcnaHistos",this,"DoCanvasClosed()");
12902         if( fClosedD_SSp_SpNb == kFALSE ){main_subpad = fPadD_SSp_SpNb;}}
12903   
12904       if(HistoCode == "D_SSp_SpDs"){
12905         fCanvD_SSp_SpDs->Connect("Closed()","TEcnaHistos",this,"DoCanvasClosed()");
12906         if( fClosedD_SSp_SpDs == kFALSE ){main_subpad = fPadD_SSp_SpDs;}}
12907 
12908       if(HistoCode == "D_Adc_EvNb"){
12909         fCanvD_Adc_EvNb->Connect("Closed()","TEcnaHistos",this,"DoCanvasClosed()");
12910         if( fClosedD_Adc_EvNb == kFALSE ){main_subpad = fPadD_Adc_EvNb;}}
12911       
12912       if(HistoCode == "D_Adc_EvDs"){
12913         fCanvD_Adc_EvDs->Connect("Closed()","TEcnaHistos",this,"DoCanvasClosed()");
12914         if( fClosedD_Adc_EvDs == kFALSE ){main_subpad = fPadD_Adc_EvDs;}}
12915 
12916       if(HistoCode == "H_Ped_Date"){
12917         fCanvH_Ped_Date->Connect("Closed()","TEcnaHistos",this,"DoCanvasClosed()");
12918         if( fClosedH_Ped_Date == kFALSE ){main_subpad = fPadH_Ped_Date;}}
12919 
12920       if(HistoCode == "H_TNo_Date"){
12921         fCanvH_TNo_Date->Connect("Closed()","TEcnaHistos",this,"DoCanvasClosed()");
12922         if( fClosedH_TNo_Date == kFALSE ){main_subpad = fPadH_TNo_Date;}}
12923       
12924       if(HistoCode == "H_MCs_Date"){
12925         fCanvH_MCs_Date->Connect("Closed()","TEcnaHistos",this,"DoCanvasClosed()");
12926         if( fClosedH_MCs_Date == kFALSE ){main_subpad = fPadH_MCs_Date;}}
12927 
12928       if(HistoCode == "H_LFN_Date"){
12929         fCanvH_LFN_Date->Connect("Closed()","TEcnaHistos",this,"DoCanvasClosed()");
12930         if( fClosedH_LFN_Date == kFALSE ){main_subpad = fPadH_LFN_Date;}}
12931       
12932       if(HistoCode == "H_HFN_Date"){
12933         fCanvH_HFN_Date->Connect("Closed()","TEcnaHistos",this,"DoCanvasClosed()");
12934         if( fClosedH_HFN_Date == kFALSE ){main_subpad = fPadH_HFN_Date;}}
12935       
12936       if(HistoCode == "H_SCs_Date"){
12937         fCanvH_SCs_Date->Connect("Closed()","TEcnaHistos",this,"DoCanvasClosed()");
12938         if( fClosedH_SCs_Date == kFALSE ){main_subpad = fPadH_SCs_Date;}}
12939 
12940       if(HistoCode == "H_Ped_RuDs"){
12941         fCanvH_Ped_RuDs->Connect("Closed()","TEcnaHistos",this,"DoCanvasClosed()");
12942         if( fClosedH_Ped_RuDs == kFALSE ){main_subpad = fPadH_Ped_RuDs;}}
12943       
12944       if(HistoCode == "H_TNo_RuDs"){
12945         fCanvH_TNo_RuDs->Connect("Closed()","TEcnaHistos",this,"DoCanvasClosed()");
12946         if( fClosedH_TNo_RuDs == kFALSE ){main_subpad = fPadH_TNo_RuDs;}}
12947       
12948       if(HistoCode == "H_MCs_RuDs"){
12949         fCanvH_MCs_RuDs->Connect("Closed()","TEcnaHistos",this,"DoCanvasClosed()");
12950         if( fClosedH_MCs_RuDs == kFALSE ){main_subpad = fPadH_MCs_RuDs;}}
12951 
12952       if(HistoCode == "H_LFN_RuDs"){
12953         fCanvH_LFN_RuDs->Connect("Closed()","TEcnaHistos",this,"DoCanvasClosed()");
12954         if( fClosedH_LFN_RuDs == kFALSE ){main_subpad = fPadH_LFN_RuDs;}}
12955       
12956       if(HistoCode == "H_HFN_RuDs"){
12957         fCanvH_HFN_RuDs->Connect("Closed()","TEcnaHistos",this,"DoCanvasClosed()");
12958         if( fClosedH_HFN_RuDs == kFALSE ){main_subpad = fPadH_HFN_RuDs;}}
12959       
12960       if(HistoCode == "H_SCs_RuDs"){
12961         fCanvH_SCs_RuDs->Connect("Closed()","TEcnaHistos",this,"DoCanvasClosed()");
12962         if( fClosedH_SCs_RuDs == kFALSE ){main_subpad = fPadH_SCs_RuDs;}}
12963     }
12964     
12965   if( main_subpad == 0 )
12966     {cout << "*TEcnaHistos::ActivePad(...)> main_subpad = "
12967           << main_subpad << ". This canvas has been closed." << endl;}
12968 
12969   return main_subpad;
12970 }
12971 // end of ActivePad
12972 
12973 void TEcnaHistos::DoCanvasClosed()
12974 {  
12975   if( fCurrentOptPlot == fSameOnePlot ){fClosedH1SamePlus = kTRUE;}
12976   if( fCurrentOptPlot == fOnlyOnePlot || fCurrentOptPlot == fSeveralPlot )
12977     {
12978       if(fCurrentHistoCode == "D_NOE_ChNb"){fClosedD_NOE_ChNb = kTRUE;}
12979       if(fCurrentHistoCode == "D_NOE_ChDs"){fClosedD_NOE_ChDs = kTRUE;}
12980       if(fCurrentHistoCode == "D_Ped_ChNb"){fClosedD_Ped_ChNb = kTRUE;}
12981       if(fCurrentHistoCode == "D_Ped_ChDs"){fClosedD_Ped_ChDs = kTRUE;}
12982       if(fCurrentHistoCode == "D_TNo_ChNb"){fClosedD_TNo_ChNb = kTRUE;}
12983       if(fCurrentHistoCode == "D_TNo_ChDs"){fClosedD_TNo_ChDs = kTRUE;}
12984       if(fCurrentHistoCode == "D_MCs_ChNb"){fClosedD_MCs_ChNb = kTRUE;}
12985       if(fCurrentHistoCode == "D_MCs_ChDs"){fClosedD_MCs_ChDs = kTRUE;}
12986       if(fCurrentHistoCode == "D_LFN_ChNb"){fClosedD_LFN_ChNb = kTRUE;}
12987       if(fCurrentHistoCode == "D_LFN_ChDs"){fClosedD_LFN_ChDs = kTRUE;}
12988       if(fCurrentHistoCode == "D_HFN_ChNb"){fClosedD_HFN_ChNb = kTRUE;}
12989       if(fCurrentHistoCode == "D_HFN_ChDs"){fClosedD_HFN_ChDs = kTRUE;}
12990       if(fCurrentHistoCode == "D_SCs_ChNb"){fClosedD_SCs_ChNb = kTRUE;}
12991       if(fCurrentHistoCode == "D_SCs_ChDs"){fClosedD_SCs_ChDs = kTRUE;}
12992       if(fCurrentHistoCode == "D_MSp_SpNb"){fClosedD_MSp_SpNb = kTRUE;}
12993       if(fCurrentHistoCode == "D_MSp_SpDs"){fClosedD_MSp_SpDs = kTRUE;}
12994       if(fCurrentHistoCode == "D_SSp_SpNb"){fClosedD_SSp_SpNb = kTRUE;}
12995       if(fCurrentHistoCode == "D_SSp_SpDs"){fClosedD_SSp_SpDs = kTRUE;}
12996       if(fCurrentHistoCode == "D_Adc_EvNb"){fClosedD_Adc_EvNb = kTRUE;}
12997       if(fCurrentHistoCode == "D_Adc_EvDs"){fClosedD_Adc_EvDs = kTRUE;}
12998       if(fCurrentHistoCode == "H_Ped_Date"){fClosedH_Ped_Date = kTRUE;}
12999       if(fCurrentHistoCode == "H_TNo_Date"){fClosedH_TNo_Date = kTRUE;}
13000       if(fCurrentHistoCode == "H_MCs_Date"){fClosedH_MCs_Date = kTRUE;}
13001       if(fCurrentHistoCode == "H_LFN_Date"){fClosedH_LFN_Date = kTRUE;}
13002       if(fCurrentHistoCode == "H_HFN_Date"){fClosedH_HFN_Date = kTRUE;}
13003       if(fCurrentHistoCode == "H_SCs_Date"){fClosedH_SCs_Date = kTRUE;}
13004       if(fCurrentHistoCode == "H_Ped_RuDs"){fClosedH_Ped_RuDs = kTRUE;}
13005       if(fCurrentHistoCode == "H_TNo_RuDs"){fClosedH_TNo_RuDs = kTRUE;}
13006       if(fCurrentHistoCode == "H_MCs_RuDs"){fClosedH_MCs_RuDs = kTRUE;}
13007       if(fCurrentHistoCode == "H_LFN_RuDs"){fClosedH_LFN_RuDs = kTRUE;}
13008       if(fCurrentHistoCode == "H_HFN_RuDs"){fClosedH_HFN_RuDs = kTRUE;}
13009       if(fCurrentHistoCode == "H_SCs_RuDs"){fClosedH_SCs_RuDs = kTRUE;}
13010     }
13011 
13012   fCurrentOptPlot = "NADA";  // to avoid fClosed... = kTRUE if other canvas than those above Closed (i.e. 2D plots)
13013   fCurrentHistoCode = "NADA";
13014 
13015   cout << "!TEcnaHistos::DoCanvasClosed(...)> WARNING: canvas has been closed." << endl;
13016 }
13017 
13018 void TEcnaHistos::SetParametersPavTxt(const TString HistoCode, const TString opt_plot)
13019 {
13020 // Set parameters pave "sevearl changing" according to HistoCode
13021 
13022   if( opt_plot == fSameOnePlot ){fPavTxtH1SamePlus = fPavComSeveralChanging;}
13023 
13024   if( opt_plot == fOnlyOnePlot ||  opt_plot == fSeveralPlot)
13025     {
13026       if(HistoCode == "D_NOE_ChNb"){fPavTxtD_NOE_ChNb = fPavComSeveralChanging;}
13027       if(HistoCode == "D_NOE_ChDs"){fPavTxtD_NOE_ChDs = fPavComSeveralChanging;}
13028       if(HistoCode == "D_Ped_ChNb"){fPavTxtD_Ped_ChNb = fPavComSeveralChanging;}
13029       if(HistoCode == "D_Ped_ChDs"){fPavTxtD_Ped_ChDs = fPavComSeveralChanging;}
13030       if(HistoCode == "D_TNo_ChNb"){fPavTxtD_TNo_ChNb = fPavComSeveralChanging;}
13031       if(HistoCode == "D_TNo_ChDs"){fPavTxtD_TNo_ChDs = fPavComSeveralChanging;}
13032       if(HistoCode == "D_MCs_ChNb"){fPavTxtD_MCs_ChNb = fPavComSeveralChanging;}
13033       if(HistoCode == "D_MCs_ChDs"){fPavTxtD_MCs_ChDs = fPavComSeveralChanging;}
13034       if(HistoCode == "D_LFN_ChNb"){fPavTxtD_LFN_ChNb = fPavComSeveralChanging;}
13035       if(HistoCode == "D_LFN_ChDs"){fPavTxtD_LFN_ChDs = fPavComSeveralChanging;}
13036       if(HistoCode == "D_HFN_ChNb"){fPavTxtD_HFN_ChNb = fPavComSeveralChanging;}
13037       if(HistoCode == "D_HFN_ChDs"){fPavTxtD_HFN_ChDs = fPavComSeveralChanging;}
13038       if(HistoCode == "D_SCs_ChNb"){fPavTxtD_SCs_ChNb = fPavComSeveralChanging;}
13039       if(HistoCode == "D_SCs_ChDs"){fPavTxtD_SCs_ChDs = fPavComSeveralChanging;}
13040       if(HistoCode == "D_MSp_SpNb"){fPavTxtD_MSp_SpNb = fPavComSeveralChanging;}
13041       if(HistoCode == "D_MSp_SpDs"){fPavTxtD_MSp_SpDs = fPavComSeveralChanging;}
13042       if(HistoCode == "D_SSp_SpNb"){fPavTxtD_SSp_SpNb = fPavComSeveralChanging;}
13043       if(HistoCode == "D_SSp_SpDs"){fPavTxtD_SSp_SpDs = fPavComSeveralChanging;}
13044       if(HistoCode == "D_Adc_EvNb"){fPavTxtD_Adc_EvNb = fPavComSeveralChanging;}
13045       if(HistoCode == "D_Adc_EvDs"){fPavTxtD_Adc_EvDs = fPavComSeveralChanging;}
13046       if(HistoCode == "H_Ped_Date"){fPavTxtH_Ped_Date = fPavComSeveralChanging;}
13047       if(HistoCode == "H_TNo_Date"){fPavTxtH_TNo_Date = fPavComSeveralChanging;}
13048       if(HistoCode == "H_MCs_Date"){fPavTxtH_MCs_Date = fPavComSeveralChanging;}
13049       if(HistoCode == "H_LFN_Date"){fPavTxtH_LFN_Date = fPavComSeveralChanging;}
13050       if(HistoCode == "H_HFN_Date"){fPavTxtH_HFN_Date = fPavComSeveralChanging;}
13051       if(HistoCode == "H_SCs_Date"){fPavTxtH_SCs_Date = fPavComSeveralChanging;}
13052       if(HistoCode == "H_Ped_RuDs"){fPavTxtH_Ped_RuDs = fPavComSeveralChanging;}
13053       if(HistoCode == "H_TNo_RuDs"){fPavTxtH_TNo_RuDs = fPavComSeveralChanging;}
13054       if(HistoCode == "H_MCs_RuDs"){fPavTxtH_MCs_RuDs = fPavComSeveralChanging;}
13055       if(HistoCode == "H_LFN_RuDs"){fPavTxtH_LFN_RuDs = fPavComSeveralChanging;}
13056       if(HistoCode == "H_HFN_RuDs"){fPavTxtH_HFN_RuDs = fPavComSeveralChanging;}
13057       if(HistoCode == "H_SCs_RuDs"){fPavTxtH_SCs_RuDs = fPavComSeveralChanging;}
13058     }
13059 }
13060 // end of SetParametersPavTxt
13061 
13062 
13063 TPaveText* TEcnaHistos::ActivePavTxt(const TString HistoCode, const TString opt_plot)
13064 {
13065   // Active Pad for Same plot option
13066 
13067   TPaveText* main_pavtxt = 0;
13068   
13069   if( opt_plot == fSameOnePlot ){main_pavtxt = fPavTxtH1SamePlus;}
13070   
13071   if( opt_plot == fOnlyOnePlot || opt_plot == fSeveralPlot)
13072     {
13073       if(HistoCode == "D_NOE_ChNb"){main_pavtxt = fPavTxtD_NOE_ChNb;}
13074       if(HistoCode == "D_NOE_ChDs"){main_pavtxt = fPavTxtD_NOE_ChDs;}
13075       if(HistoCode == "D_Ped_ChNb"){main_pavtxt = fPavTxtD_Ped_ChNb;}
13076       if(HistoCode == "D_Ped_ChDs"){main_pavtxt = fPavTxtD_Ped_ChDs;}
13077       if(HistoCode == "D_TNo_ChNb"){main_pavtxt = fPavTxtD_TNo_ChNb;}
13078       if(HistoCode == "D_TNo_ChDs"){main_pavtxt = fPavTxtD_TNo_ChDs;}
13079       if(HistoCode == "D_MCs_ChNb"){main_pavtxt = fPavTxtD_MCs_ChNb;}     
13080       if(HistoCode == "D_MCs_ChDs"){main_pavtxt = fPavTxtD_MCs_ChDs;}
13081       if(HistoCode == "D_LFN_ChNb"){main_pavtxt = fPavTxtD_LFN_ChNb;}
13082       if(HistoCode == "D_LFN_ChDs"){main_pavtxt = fPavTxtD_LFN_ChDs;}
13083       if(HistoCode == "D_HFN_ChNb"){main_pavtxt = fPavTxtD_HFN_ChNb;}
13084       if(HistoCode == "D_HFN_ChDs"){main_pavtxt = fPavTxtD_HFN_ChDs;}
13085       if(HistoCode == "D_SCs_ChNb"){main_pavtxt = fPavTxtD_SCs_ChNb;}
13086       if(HistoCode == "D_SCs_ChDs"){main_pavtxt = fPavTxtD_SCs_ChDs;}
13087       if(HistoCode == "D_MSp_SpNb"){main_pavtxt = fPavTxtD_MSp_SpNb;}
13088       if(HistoCode == "D_MSp_SpDs"){main_pavtxt = fPavTxtD_MSp_SpDs;}
13089       if(HistoCode == "D_SSp_SpNb"){main_pavtxt = fPavTxtD_SSp_SpNb;}
13090       if(HistoCode == "D_SSp_SpDs"){main_pavtxt = fPavTxtD_SSp_SpDs;}
13091       if(HistoCode == "D_Adc_EvNb"){main_pavtxt = fPavTxtD_Adc_EvNb;}
13092       if(HistoCode == "D_Adc_EvDs"){main_pavtxt = fPavTxtD_Adc_EvDs;}
13093       if(HistoCode == "H_Ped_Date"){main_pavtxt = fPavTxtH_Ped_Date;}
13094       if(HistoCode == "H_TNo_Date"){main_pavtxt = fPavTxtH_TNo_Date;}
13095       if(HistoCode == "H_MCs_Date"){main_pavtxt = fPavTxtH_MCs_Date;}
13096       if(HistoCode == "H_LFN_Date"){main_pavtxt = fPavTxtH_LFN_Date;}
13097       if(HistoCode == "H_HFN_Date"){main_pavtxt = fPavTxtH_HFN_Date;}
13098       if(HistoCode == "H_SCs_Date"){main_pavtxt = fPavTxtH_SCs_Date;}
13099       if(HistoCode == "H_Ped_RuDs"){main_pavtxt = fPavTxtH_Ped_RuDs;}
13100       if(HistoCode == "H_TNo_RuDs"){main_pavtxt = fPavTxtH_TNo_RuDs;}
13101       if(HistoCode == "H_MCs_RuDs"){main_pavtxt = fPavTxtH_MCs_RuDs;}
13102       if(HistoCode == "H_LFN_RuDs"){main_pavtxt = fPavTxtH_LFN_RuDs;}
13103       if(HistoCode == "H_HFN_RuDs"){main_pavtxt = fPavTxtH_HFN_RuDs;}
13104       if(HistoCode == "H_SCs_RuDs"){main_pavtxt = fPavTxtH_SCs_RuDs;}
13105     }
13106   
13107   if( main_pavtxt == 0 )
13108     {cout << "*TEcnaHistos::ActivePavTxt(...)> ERROR: main_pavtxt = " << main_pavtxt << endl;}
13109 
13110   return main_pavtxt;
13111 }
13112 // end of ActivePavTxt
13113 
13114 //void TEcnaHistos::SetViewHistoMarkerAndLine(TH1D* h_his0, const TString HistoCode, const TString opt_plot)
13115 //{
13117 //
13118 //  TString HistoType = fCnaParHistos->GetHistoType(HistoCode.Data());
13119 //
13120 //  //............................... Marker
13121 //  h_his0->SetMarkerStyle(1);        // default
13122 //  
13123 //  if( HistoType == "Global" && ( opt_plot == fSeveralPlot || opt_plot == fSameOnePlot ) )
13124 //    {h_his0->SetMarkerStyle(7); }
13125 //  
13126 //  //............................... Line
13127 //  h_his0->SetLineWidth(1);        // default
13128 //
13129 //  if( HistoType == "Global" && ( opt_plot == fSeveralPlot || opt_plot == fSameOnePlot ) )
13130 //    {h_his0->SetLineWidth(0);}
13131 //
13132 //}
13133 
13134 void TEcnaHistos::SetViewHistoColors(TH1D* h_his0,           const TString HistoCode,
13135                                      const TString opt_plot, const Int_t&  arg_AlreadyRead)
13136 {
13137 // Set colors, fill, marker, line style for histo view
13138 
13139   TString HistoType = fCnaParHistos->GetHistoType(HistoCode.Data());
13140   if( HistoType == "Global" ){h_his0->SetMarkerStyle(1);}
13141 
13142   Int_t MaxNbOfColors = fCnaParHistos->GetMaxNbOfColors();
13143 
13144   if( opt_plot == fSameOnePlot )
13145     {
13146       h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorH1SamePlus));
13147       h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorH1SamePlus));
13148       fMemoColorH1SamePlus++;
13149       if(fMemoColorH1SamePlus>MaxNbOfColors){fMemoColorH1SamePlus = 0;}
13150     }
13151 
13152   if( opt_plot == fOnlyOnePlot || opt_plot == fSeveralPlot)
13153     {
13154       if(HistoCode == "D_NOE_ChNb")
13155         {
13156           if(opt_plot == fOnlyOnePlot){h_his0->SetFillColor(fCnaParHistos->ColorDefinition("rose"));}
13157           if(opt_plot == fSeveralPlot )
13158             {h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorD_NOE_ChNb));
13159             h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorD_NOE_ChNb));
13160             fMemoColorD_NOE_ChNb++;
13161             if(fMemoColorD_NOE_ChNb>MaxNbOfColors){fMemoColorD_NOE_ChNb = 0;}}
13162         }
13163       if(HistoCode == "D_NOE_ChDs")
13164         {
13165           if(opt_plot == fOnlyOnePlot){h_his0->SetFillColor(fCnaParHistos->ColorDefinition("rose"));}
13166           if(opt_plot == fSeveralPlot )
13167             {h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorD_NOE_ChDs));
13168             h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorD_NOE_ChDs));
13169            fMemoColorD_NOE_ChDs++;
13170             if(fMemoColorD_NOE_ChDs>MaxNbOfColors){fMemoColorD_NOE_ChDs = 0;}}
13171         }
13172       if(HistoCode == "D_Ped_ChNb")
13173         {
13174           if(opt_plot == fOnlyOnePlot){h_his0->SetFillColor(fCnaParHistos->ColorDefinition("bleu38"));}
13175           if(opt_plot == fSeveralPlot )
13176             {h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorD_Ped_ChNb));
13177             h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorD_Ped_ChNb));
13178             fMemoColorD_Ped_ChNb++;
13179             if(fMemoColorD_Ped_ChNb>MaxNbOfColors){fMemoColorD_Ped_ChNb = 0;}}
13180         }
13181       if(HistoCode == "D_Ped_ChDs")
13182         {
13183           if(opt_plot == fOnlyOnePlot){h_his0->SetFillColor(fCnaParHistos->ColorDefinition("bleu38"));}
13184           if(opt_plot == fSeveralPlot )
13185             {h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorD_Ped_ChDs));
13186             h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorD_Ped_ChDs));
13187             fMemoColorD_Ped_ChDs++;
13188             if(fMemoColorD_Ped_ChDs>MaxNbOfColors){fMemoColorD_Ped_ChDs = 0;}}
13189         }
13190       if(HistoCode == "D_TNo_ChNb")
13191         {
13192           if(opt_plot == fOnlyOnePlot){h_his0->SetFillColor(fCnaParHistos->ColorDefinition("rouge48"));}
13193           if(opt_plot == fSeveralPlot )
13194             {h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorD_TNo_ChNb));
13195             h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorD_TNo_ChNb));
13196             fMemoColorD_TNo_ChNb++;
13197             if(fMemoColorD_TNo_ChNb>MaxNbOfColors){fMemoColorD_TNo_ChNb = 0;}}
13198         }
13199       if(HistoCode == "D_TNo_ChDs")
13200         {
13201           if(opt_plot == fOnlyOnePlot){h_his0->SetFillColor(fCnaParHistos->ColorDefinition("rouge48"));}
13202           if(opt_plot == fSeveralPlot )
13203             {h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorD_TNo_ChDs));
13204             h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorD_TNo_ChDs));
13205             fMemoColorD_TNo_ChDs++;
13206             if(fMemoColorD_TNo_ChDs>MaxNbOfColors){fMemoColorD_TNo_ChDs = 0;}}
13207         }
13208               
13209       if(HistoCode == "D_MCs_ChNb")
13210         {
13211           if(opt_plot == fOnlyOnePlot){h_his0->SetFillColor(fCnaParHistos->ColorDefinition("vert31"));}
13212           if(opt_plot == fSeveralPlot )
13213             {h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorD_MCs_ChNb));
13214             h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorD_MCs_ChNb));
13215             fMemoColorD_MCs_ChNb++;
13216             if(fMemoColorD_MCs_ChNb>MaxNbOfColors){fMemoColorD_MCs_ChNb = 0;}}
13217         }
13218       if(HistoCode == "D_MCs_ChDs")
13219         {
13220           if(opt_plot == fOnlyOnePlot){h_his0->SetFillColor(fCnaParHistos->ColorDefinition("vert31"));}
13221           if(opt_plot == fSeveralPlot )
13222             {h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorD_MCs_ChDs));
13223             h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorD_MCs_ChDs));
13224             fMemoColorD_MCs_ChDs++;
13225             if(fMemoColorD_MCs_ChDs>MaxNbOfColors){fMemoColorD_MCs_ChDs = 0;}}
13226         }
13227       if(HistoCode == "D_LFN_ChNb")
13228         {
13229           if(opt_plot == fOnlyOnePlot){h_his0->SetFillColor(fCnaParHistos->ColorDefinition("rouge44"));}
13230           if(opt_plot == fSeveralPlot )
13231             {h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorD_LFN_ChNb));
13232             h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorD_LFN_ChNb));
13233             fMemoColorD_LFN_ChNb++;
13234             if(fMemoColorD_LFN_ChNb>MaxNbOfColors){fMemoColorD_LFN_ChNb = 0;}}
13235         }
13236       if(HistoCode == "D_LFN_ChDs")
13237         {
13238           if(opt_plot == fOnlyOnePlot){h_his0->SetFillColor(fCnaParHistos->ColorDefinition("rouge44"));}
13239           if(opt_plot == fSeveralPlot )
13240             {h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorD_LFN_ChDs));
13241             h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorD_LFN_ChDs));
13242             fMemoColorD_LFN_ChDs++;
13243             if(fMemoColorD_LFN_ChDs>MaxNbOfColors){fMemoColorD_LFN_ChDs = 0;}}
13244         }
13245       if(HistoCode == "D_HFN_ChNb")
13246         {
13247           if(opt_plot == fOnlyOnePlot){h_his0->SetFillColor(fCnaParHistos->ColorDefinition("rouge50"));}
13248           if(opt_plot == fSeveralPlot )
13249             {h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorD_HFN_ChNb));
13250             h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorD_HFN_ChNb));
13251             fMemoColorD_HFN_ChNb++;
13252             if(fMemoColorD_HFN_ChNb>MaxNbOfColors){fMemoColorD_HFN_ChNb = 0;}}
13253         }
13254       if(HistoCode == "D_HFN_ChDs")
13255         {
13256           if(opt_plot == fOnlyOnePlot){h_his0->SetFillColor(fCnaParHistos->ColorDefinition("rouge50"));}
13257           if(opt_plot == fSeveralPlot )
13258             {h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorD_HFN_ChDs));
13259             h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorD_HFN_ChDs));
13260             fMemoColorD_HFN_ChDs++;
13261             if(fMemoColorD_HFN_ChDs>MaxNbOfColors){fMemoColorD_HFN_ChDs = 0;}}
13262         }
13263 
13264       if(HistoCode == "D_SCs_ChNb")
13265         {
13266           if(opt_plot == fOnlyOnePlot){h_his0->SetFillColor(fCnaParHistos->ColorDefinition("marron23"));}
13267           if(opt_plot == fSeveralPlot )
13268             {h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorD_SCs_ChNb));
13269             h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorD_SCs_ChNb));
13270             fMemoColorD_SCs_ChNb++;
13271             if(fMemoColorD_SCs_ChNb>MaxNbOfColors){fMemoColorD_SCs_ChNb = 0;}}
13272         }
13273       if(HistoCode == "D_SCs_ChDs")
13274         {
13275           if(opt_plot == fOnlyOnePlot){h_his0->SetFillColor(fCnaParHistos->ColorDefinition("marron23"));}
13276           if(opt_plot == fSeveralPlot )
13277             {h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorD_SCs_ChDs));
13278             h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorD_SCs_ChDs));
13279             fMemoColorD_SCs_ChDs++;
13280             if(fMemoColorD_SCs_ChDs>MaxNbOfColors){fMemoColorD_SCs_ChDs = 0;}}
13281         }
13282               
13283       if(HistoCode == "D_MSp_SpNb")
13284         {
13285           if( (opt_plot == fOnlyOnePlot && arg_AlreadyRead == 0) ||
13286               (opt_plot == fOnlyOnePlot && arg_AlreadyRead >= 1 && fPlotAllXtalsInStin == 0 ) )
13287             {h_his0->SetFillColor(fCnaParHistos->ColorDefinition("bleu38"));}
13288 
13289           if( opt_plot == fOnlyOnePlot && arg_AlreadyRead >= 0 && fPlotAllXtalsInStin == 1 )
13290             {h_his0->SetFillColor((Color_t)0);}
13291 
13292           if(opt_plot == fSeveralPlot )
13293             {h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorD_MSp_SpNb));
13294             h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorD_MSp_SpNb));
13295             fMemoColorD_MSp_SpNb++;
13296             if(fMemoColorD_MSp_SpNb>MaxNbOfColors){fMemoColorD_MSp_SpNb = 0;}}
13297         }
13298 
13299       if(HistoCode == "D_MSp_SpDs")
13300         {
13301           if( (opt_plot == fOnlyOnePlot && arg_AlreadyRead == 0) ||
13302               (opt_plot == fOnlyOnePlot && arg_AlreadyRead >= 1 && fPlotAllXtalsInStin == 0 ) )
13303             {h_his0->SetFillColor(fCnaParHistos->ColorDefinition("bleu38"));}
13304 
13305           if( opt_plot == fOnlyOnePlot && arg_AlreadyRead >= 0 && fPlotAllXtalsInStin == 1 )
13306             {h_his0->SetFillColor((Color_t)0);}
13307 
13308           if(opt_plot == fSeveralPlot )
13309             {h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorD_MSp_SpDs));
13310             h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorD_MSp_SpDs));
13311             fMemoColorD_MSp_SpDs++;
13312             if(fMemoColorD_MSp_SpDs>MaxNbOfColors){fMemoColorD_MSp_SpDs = 0;}}
13313         }
13314               
13315       if(HistoCode == "D_SSp_SpNb")
13316         {
13317           if( (opt_plot == fOnlyOnePlot && arg_AlreadyRead == 0) ||
13318               (opt_plot == fOnlyOnePlot && arg_AlreadyRead >= 1 && fPlotAllXtalsInStin == 0 ) )
13319             {h_his0->SetFillColor(fCnaParHistos->ColorDefinition("rouge50"));}
13320 
13321           if(opt_plot == fOnlyOnePlot && arg_AlreadyRead >= 0 && fPlotAllXtalsInStin == 1 )
13322             {h_his0->SetFillColor((Color_t)0);}
13323 
13324           if(opt_plot == fSeveralPlot )
13325             {h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorD_SSp_SpNb));
13326             h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorD_SSp_SpNb));
13327             fMemoColorD_SSp_SpNb++;
13328             if(fMemoColorD_SSp_SpNb>MaxNbOfColors){fMemoColorD_SSp_SpNb = 0;}}
13329         }
13330 
13331       if(HistoCode == "D_SSp_SpDs")
13332         {
13333           if( (opt_plot == fOnlyOnePlot && arg_AlreadyRead == 0) ||
13334               (opt_plot == fOnlyOnePlot && arg_AlreadyRead >= 1 && fPlotAllXtalsInStin == 0 ) )
13335             {h_his0->SetFillColor(fCnaParHistos->ColorDefinition("rouge50"));}
13336 
13337           if(opt_plot == fOnlyOnePlot && arg_AlreadyRead >= 0 && fPlotAllXtalsInStin == 1 )
13338             {h_his0->SetFillColor((Color_t)0);}
13339 
13340           if(opt_plot == fSeveralPlot )
13341             {h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorD_SSp_SpDs));
13342             h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorD_SSp_SpDs));
13343             fMemoColorD_SSp_SpDs++;
13344             if(fMemoColorD_SSp_SpDs>MaxNbOfColors){fMemoColorD_SSp_SpDs = 0;}}
13345         }
13346 
13347       if(HistoCode == "D_Adc_EvNb")
13348         {
13349           if(opt_plot == fOnlyOnePlot){h_his0->SetFillColor(fCnaParHistos->ColorDefinition("orange42"));}
13350           if(opt_plot == fSeveralPlot )
13351             {h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorD_Adc_EvNb));
13352             h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorD_Adc_EvNb));
13353             fMemoColorD_Adc_EvNb++;
13354             if(fMemoColorD_Adc_EvNb>MaxNbOfColors){fMemoColorD_Adc_EvNb = 0;}}
13355           gPad->SetGrid(1,0);
13356         }
13357 
13358       if(HistoCode == "D_Adc_EvDs")
13359         {
13360           if(opt_plot == fOnlyOnePlot){h_his0->SetFillColor(fCnaParHistos->ColorDefinition("orange42"));}
13361           if(opt_plot == fSeveralPlot )
13362             {h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorD_Adc_EvDs));
13363             h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorD_Adc_EvDs));
13364             fMemoColorD_Adc_EvDs++;
13365             if(fMemoColorD_Adc_EvDs>MaxNbOfColors){fMemoColorD_Adc_EvDs = 0;}}
13366         }
13367 
13368       if(HistoCode == "H_Ped_RuDs")
13369         {
13370           if(opt_plot == fOnlyOnePlot){h_his0->SetFillColor(fCnaParHistos->ColorDefinition("bleu38"));}
13371           if(opt_plot == fSeveralPlot )
13372             {h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorH_Ped_RuDs));
13373             h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorH_Ped_RuDs));
13374             fMemoColorH_Ped_RuDs++;
13375             if(fMemoColorH_Ped_RuDs>MaxNbOfColors){fMemoColorH_Ped_RuDs = 0;}}
13376           gPad->SetGrid(1,1);
13377         }
13378 
13379       if(HistoCode == "H_TNo_RuDs")
13380         {
13381           if(opt_plot == fOnlyOnePlot){h_his0->SetFillColor(fCnaParHistos->ColorDefinition("rouge48"));}
13382           if(opt_plot == fSeveralPlot )
13383             {h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorH_TNo_RuDs));
13384             h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorH_TNo_RuDs));
13385             fMemoColorH_TNo_RuDs++;
13386             if(fMemoColorH_TNo_RuDs>MaxNbOfColors){fMemoColorH_TNo_RuDs = 0;}}
13387           gPad->SetGrid(1,1);
13388         }
13389 
13390       if(HistoCode == "H_MCs_RuDs")
13391         {
13392           if(opt_plot == fOnlyOnePlot){h_his0->SetFillColor(fCnaParHistos->ColorDefinition("vert31"));}
13393           if(opt_plot == fSeveralPlot )
13394             {h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorH_MCs_RuDs));
13395             h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorH_MCs_RuDs));
13396             fMemoColorH_MCs_RuDs++;
13397             if(fMemoColorH_MCs_RuDs>MaxNbOfColors){fMemoColorH_MCs_RuDs = 0;}}
13398           gPad->SetGrid(1,1);
13399         }
13400 
13401       if(HistoCode == "H_LFN_RuDs")
13402         {
13403           if(opt_plot == fOnlyOnePlot){h_his0->SetFillColor(fCnaParHistos->ColorDefinition("rouge44"));}
13404           if(opt_plot == fSeveralPlot )
13405             {h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorH_LFN_RuDs));
13406             h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorH_LFN_RuDs));
13407             fMemoColorH_LFN_RuDs++;
13408             if(fMemoColorH_LFN_RuDs>MaxNbOfColors){fMemoColorH_LFN_RuDs = 0;}}
13409           gPad->SetGrid(1,1);
13410         }
13411 
13412       if(HistoCode == "H_HFN_RuDs")
13413         {
13414           if(opt_plot == fOnlyOnePlot){h_his0->SetFillColor(fCnaParHistos->ColorDefinition("rouge50"));}
13415           if(opt_plot == fSeveralPlot )
13416             {h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorH_HFN_RuDs));
13417             h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorH_HFN_RuDs));
13418             fMemoColorH_HFN_RuDs++;
13419             if(fMemoColorH_HFN_RuDs>MaxNbOfColors){fMemoColorH_HFN_RuDs = 0;}}
13420           gPad->SetGrid(1,1);
13421         }
13422 
13423       if(HistoCode == "H_SCs_RuDs")
13424         {
13425           if(opt_plot == fOnlyOnePlot){h_his0->SetFillColor(fCnaParHistos->ColorDefinition("marron23"));}
13426           if(opt_plot == fSeveralPlot )
13427             {h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorH_SCs_RuDs));
13428             h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorH_SCs_RuDs));
13429             fMemoColorH_SCs_RuDs++;
13430             if(fMemoColorH_SCs_RuDs>MaxNbOfColors){fMemoColorH_SCs_RuDs = 0;}}
13431           gPad->SetGrid(1,1);
13432         }
13433     }
13434 
13435   // if(opt_plot == fSeveralPlot || opt_plot == fSameOnePlot){h_his0->SetLineWidth(2);}
13436 }
13437 // end of SetViewHistoColors
13438 
13439 void TEcnaHistos::SetViewGraphColors(TGraph* g_graph0, const TString HistoCode, const TString opt_plot)
13440 {
13441 // Set colors for histo view
13442 
13443   Int_t MaxNbOfColors = fCnaParHistos->GetMaxNbOfColors();
13444 
13445   if( opt_plot == fSameOnePlot )
13446     {
13447       g_graph0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorH1SamePlus));
13448       g_graph0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorH1SamePlus));
13449       fMemoColorH1SamePlus++;
13450       if(fMemoColorH1SamePlus>MaxNbOfColors){fMemoColorH1SamePlus = 0;}
13451       gPad->SetGrid(1,1);
13452     }
13453 
13454   if( opt_plot == fOnlyOnePlot || opt_plot == fSeveralPlot)
13455     {
13456       if(HistoCode == "H_Ped_Date")
13457         {
13458           if(opt_plot == fOnlyOnePlot){g_graph0->SetMarkerColor(fCnaParHistos->ColorDefinition("bleu38"));}
13459           if(opt_plot == fSeveralPlot )
13460             {g_graph0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorH_Ped_Date));
13461             g_graph0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorH_Ped_Date));
13462             fMemoColorH_Ped_Date++;
13463             if(fMemoColorH_Ped_Date>MaxNbOfColors){fMemoColorH_Ped_Date = 0;}}
13464           gPad->SetGrid(1,1);
13465         }
13466       
13467       if(HistoCode == "H_TNo_Date")
13468         {
13469           if(opt_plot == fOnlyOnePlot){g_graph0->SetMarkerColor(fCnaParHistos->ColorDefinition("rouge48"));}
13470           if(opt_plot == fSeveralPlot)
13471             {g_graph0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorH_TNo_Date));
13472             g_graph0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorH_TNo_Date));
13473             fMemoColorH_TNo_Date++;
13474             if(fMemoColorH_TNo_Date>MaxNbOfColors){fMemoColorH_TNo_Date = 0;}}
13475           gPad->SetGrid(1,1);
13476         }
13477       
13478       if(HistoCode == "H_MCs_Date")
13479         {
13480           if(opt_plot == fOnlyOnePlot){g_graph0->SetMarkerColor(fCnaParHistos->ColorDefinition("vert31"));}
13481           if(opt_plot == fSeveralPlot)
13482             {g_graph0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorH_MCs_Date));
13483             g_graph0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorH_MCs_Date));
13484             fMemoColorH_MCs_Date++;
13485             if(fMemoColorH_MCs_Date>MaxNbOfColors){fMemoColorH_MCs_Date = 0;}}
13486           gPad->SetGrid(1,1);
13487         }
13488 
13489       if(HistoCode == "H_LFN_Date")
13490         {
13491           if(opt_plot == fOnlyOnePlot){g_graph0->SetMarkerColor(fCnaParHistos->ColorDefinition("bleu38"));}
13492           if(opt_plot == fSeveralPlot )
13493             {g_graph0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorH_LFN_Date));
13494             g_graph0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorH_LFN_Date));
13495             fMemoColorH_LFN_Date++;
13496             if(fMemoColorH_LFN_Date>MaxNbOfColors){fMemoColorH_LFN_Date = 0;}}
13497           gPad->SetGrid(1,1);
13498         }
13499       
13500       if(HistoCode == "H_HFN_Date")
13501         {
13502           if(opt_plot == fOnlyOnePlot){g_graph0->SetMarkerColor(fCnaParHistos->ColorDefinition("rouge48"));}
13503           if(opt_plot == fSeveralPlot)
13504             {g_graph0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorH_HFN_Date));
13505             g_graph0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorH_HFN_Date));
13506             fMemoColorH_HFN_Date++;
13507             if(fMemoColorH_HFN_Date>MaxNbOfColors){fMemoColorH_HFN_Date = 0;}}
13508           gPad->SetGrid(1,1);
13509         }
13510       
13511       if(HistoCode == "H_SCs_Date")
13512         {
13513           if(opt_plot == fOnlyOnePlot){g_graph0->SetMarkerColor(fCnaParHistos->ColorDefinition("vert31"));}
13514           if(opt_plot == fSeveralPlot)
13515             {g_graph0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorH_SCs_Date));
13516             g_graph0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorH_SCs_Date));
13517             fMemoColorH_SCs_Date++;
13518             if(fMemoColorH_SCs_Date>MaxNbOfColors){fMemoColorH_SCs_Date = 0;}}
13519           gPad->SetGrid(1,1);
13520         }
13521     }
13522   //if(opt_plot == fSeveralPlot){g_graph0->SetLineWidth(2);}
13523 }
13524 // end of SetViewGraphColors
13525 
13526 Color_t TEcnaHistos::GetViewHistoColor(const TString HistoCode, const TString opt_plot)
13527 {
13528   Color_t couleur = fCnaParHistos->ColorDefinition("noir");        // a priori = "noir"
13529 
13530   if( opt_plot == fSameOnePlot ){couleur = fCnaParHistos->ColorTab(fMemoColorH1SamePlus);}
13531 
13532   if( opt_plot == fOnlyOnePlot || opt_plot == fSeveralPlot )
13533     {
13534       if(HistoCode == "D_NOE_ChNb"){couleur = fCnaParHistos->ColorTab(fMemoColorD_NOE_ChNb);}
13535       if(HistoCode == "D_NOE_ChDs"){couleur = fCnaParHistos->ColorTab(fMemoColorD_NOE_ChDs);}
13536       if(HistoCode == "D_Ped_ChNb"){couleur = fCnaParHistos->ColorTab(fMemoColorD_Ped_ChNb);}
13537       if(HistoCode == "D_Ped_ChDs"){couleur = fCnaParHistos->ColorTab(fMemoColorD_Ped_ChDs);}
13538       if(HistoCode == "D_TNo_ChNb"){couleur = fCnaParHistos->ColorTab(fMemoColorD_TNo_ChNb);}
13539       if(HistoCode == "D_TNo_ChDs"){couleur = fCnaParHistos->ColorTab(fMemoColorD_TNo_ChDs);}
13540       if(HistoCode == "D_MCs_ChNb"){couleur = fCnaParHistos->ColorTab(fMemoColorD_MCs_ChNb);}
13541       if(HistoCode == "D_MCs_ChDs"){couleur = fCnaParHistos->ColorTab(fMemoColorD_MCs_ChDs);}
13542       if(HistoCode == "D_LFN_ChNb"){couleur = fCnaParHistos->ColorTab(fMemoColorD_LFN_ChNb);}
13543       if(HistoCode == "D_LFN_ChDs"){couleur = fCnaParHistos->ColorTab(fMemoColorD_LFN_ChDs);} 
13544       if(HistoCode == "D_HFN_ChNb"){couleur = fCnaParHistos->ColorTab(fMemoColorD_HFN_ChNb);} 
13545       if(HistoCode == "D_HFN_ChDs"){couleur = fCnaParHistos->ColorTab(fMemoColorD_HFN_ChDs);}
13546       if(HistoCode == "D_SCs_ChNb"){couleur = fCnaParHistos->ColorTab(fMemoColorD_SCs_ChNb);}
13547       if(HistoCode == "D_SCs_ChDs"){couleur = fCnaParHistos->ColorTab(fMemoColorD_SCs_ChDs);}
13548       if(HistoCode == "D_MSp_SpNb"){couleur = fCnaParHistos->ColorTab(fMemoColorD_MSp_SpNb);}
13549       if(HistoCode == "D_MSp_SpDs"){couleur = fCnaParHistos->ColorTab(fMemoColorD_MSp_SpDs);}
13550       if(HistoCode == "D_SSp_SpNb"){couleur = fCnaParHistos->ColorTab(fMemoColorD_SSp_SpNb);}
13551       if(HistoCode == "D_SSp_SpDs"){couleur = fCnaParHistos->ColorTab(fMemoColorD_SSp_SpDs);}
13552       if(HistoCode == "D_Adc_EvNb"){couleur = fCnaParHistos->ColorTab(fMemoColorD_Adc_EvNb);}
13553       if(HistoCode == "D_Adc_EvDs"){couleur = fCnaParHistos->ColorTab(fMemoColorD_Adc_EvDs);}
13554       if(HistoCode == "H_Ped_Date"){couleur = fCnaParHistos->ColorTab(fMemoColorH_Ped_Date);}
13555       if(HistoCode == "H_TNo_Date"){couleur = fCnaParHistos->ColorTab(fMemoColorH_TNo_Date);}
13556       if(HistoCode == "H_MCs_Date"){couleur = fCnaParHistos->ColorTab(fMemoColorH_MCs_Date);}
13557       if(HistoCode == "H_LFN_Date"){couleur = fCnaParHistos->ColorTab(fMemoColorH_LFN_Date);}
13558       if(HistoCode == "H_HFN_Date"){couleur = fCnaParHistos->ColorTab(fMemoColorH_HFN_Date);}
13559       if(HistoCode == "H_SCs_Date"){couleur = fCnaParHistos->ColorTab(fMemoColorH_SCs_Date);}
13560       if(HistoCode == "H_Ped_RuDs"){couleur = fCnaParHistos->ColorTab(fMemoColorH_Ped_RuDs);}
13561       if(HistoCode == "H_TNo_RuDs"){couleur = fCnaParHistos->ColorTab(fMemoColorH_TNo_RuDs);}
13562       if(HistoCode == "H_MCs_RuDs"){couleur = fCnaParHistos->ColorTab(fMemoColorH_MCs_RuDs);}
13563       if(HistoCode == "H_LFN_RuDs"){couleur = fCnaParHistos->ColorTab(fMemoColorH_LFN_RuDs);}
13564       if(HistoCode == "H_HFN_RuDs"){couleur = fCnaParHistos->ColorTab(fMemoColorH_HFN_RuDs);}
13565       if(HistoCode == "H_SCs_RuDs"){couleur = fCnaParHistos->ColorTab(fMemoColorH_SCs_RuDs);}
13566     }
13567   return couleur;
13568 }
13569 // end of GetViewHistoColor
13570 
13571 Color_t TEcnaHistos::GetSCColor(const TString DeeEndcap, const TString DeeDir, const TString QuadType)
13572 {
13573  //gives the SC color for the numbering plots
13574   TColor* my_color = new TColor();
13575   Color_t couleur = fCnaParHistos->ColorDefinition("noir");        // default = "noir"
13576 
13577   if( DeeEndcap == "EE+" )
13578     {
13579       if ( DeeDir == "right" && QuadType == "top"    ){couleur=fCnaParHistos->ColorDefinition("rouge");}
13580       if ( DeeDir == "right" && QuadType == "bottom" ){couleur=fCnaParHistos->ColorDefinition("bleu_fonce");}
13581       if ( DeeDir == "left"  && QuadType == "top"    ){couleur=(Color_t)my_color->GetColor("#006600");}
13582       if ( DeeDir == "left"  && QuadType == "bottom" ){couleur=(Color_t)my_color->GetColor("#CC3300");}
13583     }
13584   if( DeeEndcap == "EE-" )
13585     {
13586       if ( DeeDir == "right"  && QuadType == "top"    ){couleur=(Color_t)my_color->GetColor("#008800");}
13587       if ( DeeDir == "right"  && QuadType == "bottom" ){couleur=(Color_t)my_color->GetColor("#EE5500");}
13588       if ( DeeDir == "left"   && QuadType == "top"    ){couleur=fCnaParHistos->ColorDefinition("rouge");}
13589       if ( DeeDir == "left"   && QuadType == "bottom" ){couleur=fCnaParHistos->ColorDefinition("bleu_fonce");}
13590     }
13591 
13592   return couleur;
13593 }
13594 void TEcnaHistos::SetHistoPresentation(TH1D* histo, const TString HistoType)
13595 {
13596   // Set presentation (axis title offsets, title size, label size, etc... 
13597 
13598   fCnaParHistos->SetViewHistoStyle(HistoType.Data());
13599   fCnaParHistos->SetViewHistoPadMargins(HistoType.Data(), " ");
13600   fCnaParHistos->SetViewHistoOffsets(histo, HistoType.Data(), " ");
13601   fCnaParHistos->SetViewHistoStats(histo, HistoType.Data());
13602 }
13603 void TEcnaHistos::SetHistoPresentation(TH1D* histo, const TString HistoType, const TString opt_plot)
13604 {
13605 // Set presentation (axis title offsets, title size, label size, etc... 
13606 
13607   fCnaParHistos->SetViewHistoStyle(HistoType.Data());
13608   fCnaParHistos->SetViewHistoPadMargins(HistoType.Data(), opt_plot.Data());
13609   fCnaParHistos->SetViewHistoOffsets(histo, HistoType.Data(), opt_plot.Data());
13610   fCnaParHistos->SetViewHistoStats(histo, HistoType.Data());
13611 }
13612 
13613 void TEcnaHistos::SetGraphPresentation(TGraph* graph, const TString HistoType, const TString opt_plot)
13614 {
13615 // Set presentation (axis title offsets, title size, label size, etc... 
13616 
13617   fCnaParHistos->SetViewHistoStyle(HistoType.Data());
13618   fCnaParHistos->SetViewHistoPadMargins(HistoType.Data(), opt_plot);
13619   fCnaParHistos->SetViewGraphOffsets(graph, HistoType.Data());
13620   
13621   //............................... Graph marker
13622   graph->SetMarkerStyle(1);
13623   if( HistoType == "Evol" ){graph->SetMarkerStyle(20);}
13624 }
13625 
13626 //=====================================================================
13627 //
13628 //                 NewCanvas, ReInitCanvas
13629 //
13630 //=====================================================================
13631 void TEcnaHistos::NewCanvas(const TString opt_plot)   
13632 {
13633 // ReInit canvas in option SAME n in order to restart a new SAME n plot
13634 // (called by user only for option Same n)
13635 
13636   if( opt_plot == fSameOnePlot )
13637     {
13638       fImpH1SamePlus = 0;       fCanvH1SamePlus = 0;
13639       fPadH1SamePlus = 0;       fMemoPlotH1SamePlus = 0;
13640       fMemoColorH1SamePlus = 0; fCanvSameH1SamePlus++;
13641       fPavTxtH1SamePlus = 0;    fClosedH1SamePlus = kFALSE;
13642     }
13643   else
13644     {
13645       cout << "TEcnaHistos::NewCanvas(...)> *** ERROR *** " << opt_plot.Data() << ": "
13646            << "unknown option for NewCanvas. Only " << fSameOnePlot << " option is accepted."
13647            << fTTBELL << endl;
13648     }
13649 }
13650 
13651 void TEcnaHistos::ReInitCanvas(const TString HistoCode, const TString opt_plot)
13652 {
13653 // ReInit canvas in option SAME and SAME n
13654 
13655   if( opt_plot == fSameOnePlot )
13656     {
13657       fImpH1SamePlus = 0;       fCanvH1SamePlus = 0;
13658       fPadH1SamePlus = 0;       fMemoPlotH1SamePlus = 0;
13659       fMemoColorH1SamePlus = 0; fCanvSameH1SamePlus++;
13660       fPavTxtH1SamePlus = 0;    fClosedH1SamePlus = kFALSE;
13661     }
13662 
13663   if( opt_plot == fOnlyOnePlot ||  opt_plot == fSeveralPlot)
13664     {
13665       if(HistoCode == "D_NOE_ChNb")
13666         {             
13667           fImpD_NOE_ChNb = 0;       fCanvD_NOE_ChNb = 0;
13668           fPadD_NOE_ChNb = 0;       fMemoPlotD_NOE_ChNb = 0;
13669           fMemoColorD_NOE_ChNb = 0; fCanvSameD_NOE_ChNb++;
13670           fPavTxtD_NOE_ChNb = 0;    fClosedD_NOE_ChNb = kFALSE;
13671         }
13672       
13673       if(HistoCode == "D_NOE_ChDs")
13674         {             
13675           fImpD_NOE_ChDs = 0;       fCanvD_NOE_ChDs = 0;
13676           fPadD_NOE_ChDs = 0;       fMemoPlotD_NOE_ChDs = 0;
13677           fMemoColorD_NOE_ChDs = 0; fCanvSameD_NOE_ChDs++;
13678           fPavTxtD_NOE_ChDs = 0;    fClosedD_NOE_ChDs = kFALSE;
13679         }
13680       
13681       if(HistoCode == "D_Ped_ChNb")                            // (ReInitCanvas)
13682         {             
13683           fImpD_Ped_ChNb = 0;       fCanvD_Ped_ChNb = 0;
13684           fPadD_Ped_ChNb = 0;       fMemoPlotD_Ped_ChNb = 0;
13685           fMemoColorD_Ped_ChNb = 0; fCanvSameD_Ped_ChNb++;
13686           fPavTxtD_Ped_ChNb = 0;    fClosedD_Ped_ChNb = kFALSE;
13687         }
13688       
13689       if(HistoCode == "D_Ped_ChDs")
13690         {             
13691           fImpD_Ped_ChDs = 0;       fCanvD_Ped_ChDs = 0;
13692           fPadD_Ped_ChDs = 0;       fMemoPlotD_Ped_ChDs = 0;
13693           fMemoColorD_Ped_ChDs = 0; fCanvSameD_Ped_ChDs++;
13694           fPavTxtD_Ped_ChDs = 0;    fClosedD_Ped_ChDs = kFALSE;
13695         }
13696       
13697       if(HistoCode == "D_TNo_ChNb")
13698         {             
13699           fImpD_TNo_ChNb = 0;       fCanvD_TNo_ChNb = 0;
13700           fPadD_TNo_ChNb = 0;       fMemoPlotD_TNo_ChNb = 0;
13701           fMemoColorD_TNo_ChNb = 0; fCanvSameD_TNo_ChNb++;
13702           fPavTxtD_TNo_ChNb = 0;    fClosedD_TNo_ChNb = kFALSE;
13703         }
13704       
13705       if(HistoCode == "D_TNo_ChDs") 
13706         {             
13707           fImpD_TNo_ChDs = 0;       fCanvD_TNo_ChDs = 0;
13708           fPadD_TNo_ChDs = 0;       fMemoPlotD_TNo_ChDs = 0;
13709           fMemoColorD_TNo_ChDs = 0; fCanvSameD_TNo_ChDs++;
13710           fPavTxtD_TNo_ChDs = 0;    fClosedD_TNo_ChDs = kFALSE;
13711         }
13712       
13713       if(HistoCode == "D_MCs_ChNb")                           // (ReInitCanvas)
13714         {             
13715           fImpD_MCs_ChNb = 0;       fCanvD_MCs_ChNb = 0;
13716           fPadD_MCs_ChNb = 0;       fMemoPlotD_MCs_ChNb = 0;
13717           fMemoColorD_MCs_ChNb = 0; fCanvSameD_MCs_ChNb++;
13718           fPavTxtD_MCs_ChNb = 0;    fClosedD_MCs_ChNb = kFALSE;
13719         }
13720       
13721       if(HistoCode == "D_MCs_ChDs")
13722         {             
13723           fImpD_MCs_ChDs = 0;       fCanvD_MCs_ChDs = 0;
13724           fPadD_MCs_ChDs = 0;       fMemoPlotD_MCs_ChDs = 0;
13725           fMemoColorD_MCs_ChDs = 0; fCanvSameD_MCs_ChDs++;
13726           fPavTxtD_MCs_ChDs = 0;    fClosedD_MCs_ChDs = kFALSE;
13727         }
13728 
13729       if(HistoCode == "D_LFN_ChNb")
13730         {             
13731           fImpD_LFN_ChNb = 0;       fCanvD_LFN_ChNb = 0;
13732           fPadD_LFN_ChNb = 0;       fMemoPlotD_LFN_ChNb = 0;
13733           fMemoColorD_LFN_ChNb = 0; fCanvSameD_LFN_ChNb++;
13734           fPavTxtD_LFN_ChNb = 0;    fClosedD_LFN_ChNb = kFALSE;
13735         }
13736       
13737       if(HistoCode == "D_LFN_ChDs")                            // (ReInitCanvas)
13738         {             
13739           fImpD_LFN_ChDs = 0;       fCanvD_LFN_ChDs = 0;
13740           fPadD_LFN_ChDs= 0;        fMemoPlotD_LFN_ChDs = 0;
13741           fMemoColorD_LFN_ChDs = 0; fCanvSameD_LFN_ChDs++;
13742           fPavTxtD_LFN_ChDs= 0;     fClosedD_LFN_ChDs = kFALSE;
13743         }
13744       
13745       if(HistoCode == "D_HFN_ChNb")
13746         {             
13747           fImpD_HFN_ChNb = 0;       fCanvD_HFN_ChNb = 0;
13748           fPadD_HFN_ChNb = 0;       fMemoPlotD_HFN_ChNb = 0;
13749           fMemoColorD_HFN_ChNb = 0; fCanvSameD_HFN_ChNb++;
13750           fPavTxtD_HFN_ChNb = 0;    fClosedD_HFN_ChNb = kFALSE;
13751         }
13752       
13753       if(HistoCode == "D_HFN_ChDs")
13754         {             
13755           fImpD_HFN_ChDs = 0;       fCanvD_HFN_ChDs = 0;
13756           fPadD_HFN_ChDs = 0;       fMemoPlotD_HFN_ChDs = 0;
13757           fMemoColorD_HFN_ChDs = 0; fCanvSameD_HFN_ChDs++;
13758           fPavTxtD_HFN_ChDs = 0;    fClosedD_HFN_ChDs = kFALSE;
13759         }
13760       
13761       if(HistoCode == "D_SCs_ChNb")
13762         {             
13763           fImpD_SCs_ChNb = 0;       fCanvD_SCs_ChNb = 0;
13764           fPadD_SCs_ChNb = 0;       fMemoPlotD_SCs_ChNb = 0;
13765           fMemoColorD_SCs_ChNb = 0; fCanvSameD_SCs_ChNb++;
13766           fPavTxtD_SCs_ChNb = 0;    fClosedD_SCs_ChNb = kFALSE;
13767         }
13768       
13769       if(HistoCode == "D_SCs_ChDs")                            // (ReInitCanvas)
13770         {             
13771           fImpD_SCs_ChDs = 0;       fCanvD_SCs_ChDs = 0;
13772           fPadD_SCs_ChDs = 0;       fMemoPlotD_SCs_ChDs = 0;
13773           fMemoColorD_SCs_ChDs = 0; fCanvSameD_SCs_ChDs++;
13774           fPavTxtD_SCs_ChDs = 0;    fClosedD_SCs_ChDs = kFALSE;
13775         }
13776       
13777       if(HistoCode == "D_MSp_SpNb")
13778         {             
13779           fImpD_MSp_SpNb = 0;       fCanvD_MSp_SpNb = 0;
13780           fPadD_MSp_SpNb = 0;       fMemoPlotD_MSp_SpNb = 0; 
13781           fMemoColorD_MSp_SpNb = 0; fCanvSameD_MSp_SpNb++;
13782           fPavTxtD_MSp_SpNb = 0;    fClosedD_MSp_SpNb = kFALSE;
13783         }
13784             
13785       if(HistoCode == "D_MSp_SpDs")
13786         {             
13787           fImpD_MSp_SpDs = 0;       fCanvD_MSp_SpDs = 0;
13788           fPadD_MSp_SpDs = 0;       fMemoPlotD_MSp_SpDs = 0; 
13789           fMemoColorD_MSp_SpDs = 0; fCanvSameD_MSp_SpDs++;
13790           fPavTxtD_MSp_SpDs = 0;    fClosedD_MSp_SpDs = kFALSE;
13791         }
13792       
13793       if(HistoCode == "D_SSp_SpNb")
13794         {             
13795           fImpD_SSp_SpNb = 0;       fCanvD_SSp_SpNb = 0;
13796           fPadD_SSp_SpNb = 0;       fMemoPlotD_SSp_SpNb= 0;
13797           fMemoColorD_SSp_SpNb = 0; fCanvSameD_SSp_SpNb++;
13798           fPavTxtD_SSp_SpNb = 0;    fClosedD_SSp_SpNb = kFALSE;
13799         }
13800 
13801       if(HistoCode == "D_SSp_SpDs")
13802         {             
13803           fImpD_SSp_SpDs = 0;       fCanvD_SSp_SpDs = 0;
13804           fPadD_SSp_SpDs = 0;       fMemoPlotD_SSp_SpDs= 0;
13805           fMemoColorD_SSp_SpDs = 0; fCanvSameD_SSp_SpDs++;
13806           fPavTxtD_SSp_SpDs = 0;    fClosedD_SSp_SpDs = kFALSE;
13807         }
13808 
13809       if(HistoCode == "D_Adc_EvNb")                            // (ReInitCanvas)
13810         {             
13811           fImpD_Adc_EvNb = 0;       fCanvD_Adc_EvNb = 0;
13812           fPadD_Adc_EvNb = 0;       fMemoPlotD_Adc_EvNb = 0;
13813           fMemoColorD_Adc_EvNb = 0; fCanvSameD_Adc_EvNb++;
13814           fPavTxtD_Adc_EvNb = 0;    fClosedD_Adc_EvNb = kFALSE;
13815         }
13816        
13817       if(HistoCode == "D_Adc_EvDs")
13818         {             
13819           fImpD_Adc_EvDs = 0;       fCanvD_Adc_EvDs = 0;
13820           fPadD_Adc_EvDs = 0;       fMemoPlotD_Adc_EvDs = 0;
13821           fMemoColorD_Adc_EvDs = 0; fCanvSameD_Adc_EvDs++;
13822           fPavTxtD_Adc_EvDs = 0;    fClosedD_Adc_EvDs = kFALSE;
13823         }
13824           
13825  
13826       if(HistoCode == "H_Ped_Date")
13827         {             
13828           fImpH_Ped_Date = 0;         fCanvH_Ped_Date = 0;
13829           fPadH_Ped_Date = 0;         fMemoPlotH_Ped_Date = 0;
13830           fMemoColorH_Ped_Date = 0;   fCanvSameH_Ped_Date++;
13831           fNbOfListFileH_Ped_Date = 0;fClosedH_Ped_Date = kFALSE;
13832         }
13833 
13834       if(HistoCode == "H_TNo_Date")
13835         {             
13836           fImpH_TNo_Date = 0;          fCanvH_TNo_Date = 0;
13837           fPadH_TNo_Date = 0;          fMemoPlotH_TNo_Date = 0;
13838           fMemoColorH_TNo_Date = 0;    fCanvSameH_TNo_Date++;
13839           fNbOfListFileH_TNo_Date = 0; fClosedH_TNo_Date = kFALSE;
13840         }
13841 
13842       if(HistoCode == "H_MCs_Date")                            // (ReInitCanvas)
13843         {             
13844           fImpH_MCs_Date = 0;          fCanvH_MCs_Date = 0;
13845           fPadH_MCs_Date = 0;          fMemoPlotH_MCs_Date = 0;
13846           fMemoColorH_MCs_Date = 0;    fCanvSameH_MCs_Date++;
13847           fNbOfListFileH_MCs_Date = 0; fClosedH_MCs_Date = kFALSE;
13848         }
13849 
13850       
13851       if(HistoCode == "H_LFN_Date")
13852         {             
13853           fImpH_LFN_Date = 0;          fCanvH_LFN_Date = 0;
13854           fPadH_LFN_Date = 0;          fMemoPlotH_LFN_Date = 0;
13855           fMemoColorH_LFN_Date = 0;    fCanvSameH_LFN_Date++;
13856           fNbOfListFileH_LFN_Date = 0; fClosedH_LFN_Date = kFALSE;
13857         }
13858 
13859       if(HistoCode == "H_HFN_Date")
13860         {             
13861           fImpH_HFN_Date = 0;          fCanvH_HFN_Date = 0;
13862           fPadH_HFN_Date = 0;          fMemoPlotH_HFN_Date = 0;
13863           fMemoColorH_HFN_Date = 0;    fCanvSameH_HFN_Date++;
13864           fNbOfListFileH_HFN_Date = 0; fClosedH_HFN_Date = kFALSE;
13865         }
13866 
13867       if(HistoCode == "H_SCs_Date")
13868         {             
13869           fImpH_SCs_Date = 0;          fCanvH_SCs_Date = 0;
13870           fPadH_SCs_Date = 0;          fMemoPlotH_SCs_Date = 0;
13871           fMemoColorH_SCs_Date = 0;    fCanvSameH_SCs_Date++;
13872           fNbOfListFileH_SCs_Date = 0; fClosedH_SCs_Date = kFALSE;
13873         }
13874 
13875       if(HistoCode == "H_Ped_RuDs")
13876         {             
13877           fImpH_Ped_RuDs = 0;          fCanvH_Ped_RuDs = 0;
13878           fPadH_Ped_RuDs = 0;          fMemoPlotH_Ped_RuDs = 0;
13879           fMemoColorH_Ped_RuDs = 0;    fCanvSameH_Ped_RuDs++;
13880           fNbOfListFileH_Ped_RuDs = 0; fClosedH_Ped_RuDs = kFALSE;
13881         }
13882 
13883       if(HistoCode == "H_TNo_RuDs")
13884         {             
13885           fImpH_TNo_RuDs = 0;          fCanvH_TNo_RuDs = 0;
13886           fPadH_TNo_RuDs = 0;          fMemoPlotH_TNo_RuDs = 0;
13887           fMemoColorH_TNo_RuDs = 0;    fCanvSameH_TNo_RuDs++;
13888           fNbOfListFileH_TNo_RuDs = 0; fClosedH_TNo_RuDs = kFALSE;
13889         }
13890 
13891       if(HistoCode == "H_MCs_RuDs")                            // (ReInitCanvas)
13892         {             
13893           fImpH_MCs_RuDs = 0;          fCanvH_MCs_RuDs = 0;
13894           fPadH_MCs_RuDs = 0;          fMemoPlotH_MCs_RuDs = 0;
13895           fMemoColorH_MCs_RuDs = 0;    fCanvSameH_MCs_RuDs++;
13896           fNbOfListFileH_MCs_RuDs = 0; fClosedH_MCs_RuDs = kFALSE;
13897         }
13898 
13899       
13900       if(HistoCode == "H_LFN_RuDs")
13901         {             
13902           fImpH_LFN_RuDs = 0;          fCanvH_LFN_RuDs = 0;
13903           fPadH_LFN_RuDs = 0;          fMemoPlotH_LFN_RuDs = 0;
13904           fMemoColorH_LFN_RuDs = 0;    fCanvSameH_LFN_RuDs++;
13905           fNbOfListFileH_LFN_RuDs = 0; fClosedH_LFN_RuDs = kFALSE;
13906         }
13907 
13908       if(HistoCode == "H_HFN_RuDs")
13909         {             
13910           fImpH_HFN_RuDs = 0;          fCanvH_HFN_RuDs = 0;
13911           fPadH_HFN_RuDs = 0;          fMemoPlotH_HFN_RuDs = 0;
13912           fMemoColorH_HFN_RuDs = 0;    fCanvSameH_HFN_RuDs++;
13913           fNbOfListFileH_HFN_RuDs = 0; fClosedH_HFN_RuDs = kFALSE;
13914         }
13915 
13916       if(HistoCode == "H_SCs_RuDs")
13917         {             
13918           fImpH_SCs_RuDs = 0;          fCanvH_SCs_RuDs = 0;
13919           fPadH_SCs_RuDs = 0;          fMemoPlotH_SCs_RuDs = 0;
13920           fMemoColorH_SCs_RuDs = 0;    fCanvSameH_SCs_RuDs++;
13921           fNbOfListFileH_SCs_RuDs = 0; fClosedH_SCs_RuDs = kFALSE;
13922         }
13923     }
13924 } 
13925 // ------- end of ReInitCanvas(...) ------------
13926 
13927 //==========================================================================================
13928 void TEcnaHistos::WriteMatrixAscii(const TString BetweenWhat,  const TString   CorOrCov,
13929                                    const Int_t&  StexStinEcna, const Int_t&    MatrixBinIndex,
13930                                    const Int_t&  MatSize,      const TMatrixD& read_matrix)
13931 {   
13932 // write matrix in ascii file
13933 
13934   Int_t ChanNumber = MatrixBinIndex;
13935 
13936   fCnaWrite->RegisterFileParameters(fFapAnaType,    fFapNbOfSamples, 
13937                                     fFapRunNumber,  fFapFirstReqEvtNumber, fFapLastReqEvtNumber, fFapReqNbOfEvts,
13938                                     fFapStexNumber, fStartDate, fStopDate, fStartTime, fStopTime);
13939 
13940   if( BetweenWhat == fBetweenSamples && CorOrCov == fCorrelationMatrix )
13941     {
13942       fCnaWrite->WriteAsciiCorrelationsBetweenSamples(StexStinEcna, ChanNumber, MatSize, read_matrix);
13943       fAsciiFileName = fCnaWrite->GetAsciiFileName();
13944     }
13945 
13946   if( BetweenWhat == fBetweenSamples && CorOrCov == fCovarianceMatrix )
13947     {
13948       fCnaWrite->WriteAsciiCovariancesBetweenSamples(StexStinEcna, ChanNumber, MatSize, read_matrix);
13949       fAsciiFileName = fCnaWrite->GetAsciiFileName();
13950     }
13951 }
13952 //...............................................................................................
13953 void TEcnaHistos::WriteHistoAscii(const TString   HistoCode, const Int_t& HisSize,
13954                                  const TVectorD& read_histo)
13955 {
13956 // write matrix in ascii file
13957 
13958   fCnaWrite->RegisterFileParameters(fFapAnaType,    fFapNbOfSamples, 
13959                                     fFapRunNumber,  fFapFirstReqEvtNumber, fFapLastReqEvtNumber, fFapReqNbOfEvts,
13960                                     fFapStexNumber, fStartDate, fStopDate,
13961                                     fStartTime,     fStopTime);
13962 
13963   fCnaWrite->WriteAsciiHisto(HistoCode, HisSize, read_histo);
13964   fAsciiFileName = fCnaWrite->GetAsciiFileName();
13965 }
13966 
13967 TString TEcnaHistos::AsciiFileName(){return fAsciiFileName.Data();}
13968 
13969 //---------------> messages de rappel pour l'auteur: 
13970 //
13971 //======= A T T E N T I O N ========= A T T E N T I O N ========= A T T E N T I O N ==============!!!!
13972 //      A EVITER ABSOLUMENT quand on est sous TEcnaGui CAR LE cin >> BLOQUE X11
13973 //      puisqu'on n'a pas la main dans la fenetre de compte-rendu de la CNA
13974 //     {Int_t cintoto; cout << "taper 0 pour continuer" << endl; cin >> cintoto;}
13975 //                         *=================================================*
13976 //                         |                                                 |
13977 //++++++++++++++++++++++++|  A T T E N T I O N:  PAS DE TEST "cintoto" ici! |+++++++++++++++++++++!!!!
13978 //                         |                                                 |
13979 //                         *=================================================*
13980 //
13981 // INFO: When "new" fails to allocate the memory for an object, or "new[]" fails to allocate the memory
13982 // for an object array, a std::bad_alloc object is thrown.
13983 // "In GCC, the RTTI mangled name of std::bad_alloc is, I'm guessing, St9bad_alloc."