CMS 3D CMS Logo

CMSSW_4_4_3_patch1/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: 24/03/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   Int_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   Int_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   Int_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   Int_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   Int_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   Int_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   Int_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   //.......... init counter Same canvas
00253   fCanvSameH1SamePlus = 0;
00254   fCanvSameD_NOE_ChNb = 0; fCanvSameD_NOE_ChDs = 0;
00255   fCanvSameD_Ped_ChNb = 0; fCanvSameD_Ped_ChDs = 0;
00256   fCanvSameD_TNo_ChNb = 0; fCanvSameD_TNo_ChDs = 0; 
00257   fCanvSameD_MCs_ChNb = 0; fCanvSameD_MCs_ChDs = 0;
00258   fCanvSameD_LFN_ChNb = 0; fCanvSameD_LFN_ChDs = 0; 
00259   fCanvSameD_HFN_ChNb = 0; fCanvSameD_HFN_ChDs = 0; 
00260   fCanvSameD_SCs_ChNb = 0; fCanvSameD_SCs_ChDs = 0; 
00261   fCanvSameD_MSp_SpNb = 0; fCanvSameD_SSp_SpNb = 0;
00262   fCanvSameD_MSp_SpDs = 0; fCanvSameD_SSp_SpDs = 0;
00263   fCanvSameD_Adc_EvDs = 0; fCanvSameD_Adc_EvNb = 0;
00264   fCanvSameH_Ped_Date = 0; fCanvSameH_TNo_Date = 0;
00265   fCanvSameH_MCs_Date = 0; fCanvSameH_LFN_Date = 0;
00266   fCanvSameH_HFN_Date = 0; fCanvSameH_SCs_Date = 0;
00267   fCanvSameH_Ped_RuDs = 0; fCanvSameH_TNo_RuDs = 0;
00268   fCanvSameH_MCs_RuDs = 0; fCanvSameH_LFN_RuDs = 0;
00269   fCanvSameH_HFN_RuDs = 0; fCanvSameH_SCs_RuDs = 0;
00270   //................. Flag Scale X anf Y set to "LIN" and flag color palete set to "Black/Red/Blue"
00271 
00272   MaxCar = fgMaxCar;
00273   fFlagScaleX.Resize(MaxCar);
00274   fFlagScaleX = "LIN";
00275 
00276   MaxCar = fgMaxCar;                                     //   (Init)
00277   fFlagScaleY.Resize(MaxCar);
00278   fFlagScaleY = "LIN";
00279 
00280   MaxCar = fgMaxCar;
00281   fFlagColPal.Resize(MaxCar);
00282   fFlagColPal = "Black/Red/Blue";
00283 
00284   //................. Flag General Title set to empty string
00285   MaxCar = fgMaxCar;
00286   fFlagGeneralTitle.Resize(MaxCar);
00287   fFlagGeneralTitle = "";
00288 
00289   //................. Init codes Options
00290   fOptScaleLinx = 31400;
00291   fOptScaleLogx = 31401;
00292   fOptScaleLiny = 31402;
00293   fOptScaleLogy = 31403;
00294 
00295   fOptVisLine = 1101; 
00296   fOptVisPolm = 1102;
00297 
00298   //............................                                       (Init)
00299   MaxCar = fgMaxCar;
00300   fCovarianceMatrix.Resize(MaxCar);
00301   fCovarianceMatrix = "Cov";
00302   MaxCar = fgMaxCar;
00303   fCorrelationMatrix.Resize(MaxCar);
00304   fCorrelationMatrix = "Cor";
00305 
00306   MaxCar = fgMaxCar;
00307   fLFBetweenStins.Resize(MaxCar);
00308   fLFBetweenStins = "MttLF";
00309   MaxCar = fgMaxCar;
00310   fHFBetweenStins.Resize(MaxCar);
00311   fHFBetweenStins = "MttHF";
00312 
00313   MaxCar = fgMaxCar;
00314   fLFBetweenChannels.Resize(MaxCar);
00315   fLFBetweenChannels = "MccLF";
00316   MaxCar = fgMaxCar;
00317   fHFBetweenChannels.Resize(MaxCar);
00318   fHFBetweenChannels = "MccHF";
00319 
00320   MaxCar = fgMaxCar;
00321   fBetweenSamples.Resize(MaxCar);
00322   fBetweenSamples = "Mss";
00323 
00324   //.................................. text pave alignement for pave "SeveralChanging" (HistimePlot)
00325   fTextPaveAlign  = 12;              // 1 = left adjusted, 2 = vertically centered
00326   fTextPaveFont   = 100;             // 10*10 = 10*(ID10 = Courier New)
00327   fTextPaveSize   = (Float_t)0.025;  // 0.0xxx = xxx% of the pave size
00328   fTextBorderSize = 1;               // Pave Border (=>Shadow)
00329 
00330   //................................. Init Xvar, Yvar, NbBins management for options SAME and SAME n
00331   fXMemoH1SamePlus = "";
00332   fXMemoD_NOE_ChNb = "";
00333   fXMemoD_NOE_ChDs = "";
00334   fXMemoD_Ped_ChNb = "";
00335   fXMemoD_Ped_ChDs = "";
00336   fXMemoD_TNo_ChNb = "";   
00337   fXMemoD_TNo_ChDs = ""; 
00338   fXMemoD_MCs_ChNb = ""; 
00339   fXMemoD_MCs_ChDs = "";
00340   fXMemoD_LFN_ChNb = "";
00341   fXMemoD_LFN_ChDs = ""; 
00342   fXMemoD_HFN_ChNb = "";   
00343   fXMemoD_HFN_ChDs = ""; 
00344   fXMemoD_SCs_ChNb = ""; 
00345   fXMemoD_SCs_ChDs = ""; 
00346   fXMemoD_MSp_SpNb = "";
00347   fXMemoD_MSp_SpDs = "";
00348   fXMemoD_SSp_SpNb = "";  
00349   fXMemoD_SSp_SpDs = "";  
00350   fXMemoD_Adc_EvDs = "";     
00351   fXMemoD_Adc_EvNb = "";
00352   fXMemoH_Ped_Date = "";
00353   fXMemoH_TNo_Date = "";
00354   fXMemoH_MCs_Date = "";
00355   fXMemoH_LFN_Date = "";
00356   fXMemoH_HFN_Date = "";
00357   fXMemoH_SCs_Date = "";
00358   fXMemoH_Ped_RuDs = "";
00359   fXMemoH_TNo_RuDs = "";
00360   fXMemoH_MCs_RuDs = "";
00361   fXMemoH_LFN_RuDs = "";
00362   fXMemoH_HFN_RuDs = "";
00363   fXMemoH_SCs_RuDs = "";
00364 
00365   fYMemoH1SamePlus = "";
00366   fYMemoD_NOE_ChNb = "";
00367   fYMemoD_NOE_ChDs = "";
00368   fYMemoD_Ped_ChNb = "";
00369   fYMemoD_Ped_ChDs = "";
00370   fYMemoD_TNo_ChNb = "";
00371   fYMemoD_TNo_ChDs = "";
00372   fYMemoD_MCs_ChNb = "";
00373   fYMemoD_MCs_ChDs = "";
00374   fYMemoD_LFN_ChNb = "";
00375   fYMemoD_LFN_ChDs = "";
00376   fYMemoD_HFN_ChNb = "";
00377   fYMemoD_HFN_ChDs = "";
00378   fYMemoD_SCs_ChNb = "";
00379   fYMemoD_SCs_ChDs = "";
00380   fYMemoD_MSp_SpNb = "";
00381   fYMemoD_MSp_SpDs = "";
00382   fYMemoD_SSp_SpNb = ""; 
00383   fYMemoD_SSp_SpDs = "";  
00384   fYMemoD_Adc_EvDs = "";     
00385   fYMemoD_Adc_EvNb = "";
00386   fYMemoH_Ped_Date = "";
00387   fYMemoH_TNo_Date = "";
00388   fYMemoH_MCs_Date = "";
00389   fYMemoH_LFN_Date = "";
00390   fYMemoH_HFN_Date = "";
00391   fYMemoH_SCs_Date = "";
00392   fYMemoH_Ped_RuDs = "";
00393   fYMemoH_TNo_RuDs = "";
00394   fYMemoH_MCs_RuDs = "";
00395   fYMemoH_LFN_RuDs = "";
00396   fYMemoH_HFN_RuDs = "";
00397   fYMemoH_SCs_RuDs = "";
00398 
00399   fNbBinsMemoH1SamePlus = 0;
00400   fNbBinsMemoD_NOE_ChNb = 0;
00401   fNbBinsMemoD_NOE_ChDs = 0;
00402   fNbBinsMemoD_Ped_ChNb = 0;
00403   fNbBinsMemoD_Ped_ChDs = 0;
00404   fNbBinsMemoD_TNo_ChNb = 0;   
00405   fNbBinsMemoD_TNo_ChDs = 0; 
00406   fNbBinsMemoD_MCs_ChNb = 0; 
00407   fNbBinsMemoD_MCs_ChDs = 0;
00408   fNbBinsMemoD_LFN_ChNb = 0;
00409   fNbBinsMemoD_LFN_ChDs = 0; 
00410   fNbBinsMemoD_HFN_ChNb = 0;   
00411   fNbBinsMemoD_HFN_ChDs = 0; 
00412   fNbBinsMemoD_SCs_ChNb = 0; 
00413   fNbBinsMemoD_SCs_ChDs = 0; 
00414   fNbBinsMemoD_MSp_SpNb = 0; 
00415   fNbBinsMemoD_MSp_SpDs = 0;
00416   fNbBinsMemoD_SSp_SpNb = 0; 
00417   fNbBinsMemoD_SSp_SpDs = 0;  
00418   fNbBinsMemoD_Adc_EvDs = 0;     
00419   fNbBinsMemoD_Adc_EvNb = 0;
00420   fNbBinsMemoH_Ped_Date = 0;
00421   fNbBinsMemoH_TNo_Date = 0;
00422   fNbBinsMemoH_MCs_Date = 0;
00423   fNbBinsMemoH_LFN_Date = 0;
00424   fNbBinsMemoH_HFN_Date = 0;
00425   fNbBinsMemoH_SCs_Date = 0;
00426   fNbBinsMemoH_Ped_RuDs = 0;
00427   fNbBinsMemoH_TNo_RuDs = 0;
00428   fNbBinsMemoH_MCs_RuDs = 0;
00429   fNbBinsMemoH_LFN_RuDs = 0;
00430   fNbBinsMemoH_HFN_RuDs = 0;
00431   fNbBinsMemoH_SCs_RuDs = 0;
00432 
00433   //.................................. Init canvas/pad pointers                (Init)
00434   fCurrentCanvas         = 0;
00435 
00436   fCurrentCanvasName     = "?";
00437 
00438   fCanvH1SamePlus = 0; 
00439   fCanvD_NOE_ChNb = 0;
00440   fCanvD_NOE_ChDs = 0;
00441   fCanvD_Ped_ChNb = 0;
00442   fCanvD_Ped_ChDs = 0;
00443   fCanvD_TNo_ChNb = 0;   
00444   fCanvD_TNo_ChDs = 0; 
00445   fCanvD_MCs_ChNb = 0; 
00446   fCanvD_MCs_ChDs = 0;
00447   fCanvD_LFN_ChNb = 0;
00448   fCanvD_LFN_ChDs = 0; 
00449   fCanvD_HFN_ChNb = 0;   
00450   fCanvD_HFN_ChDs = 0; 
00451   fCanvD_SCs_ChNb = 0; 
00452   fCanvD_SCs_ChDs = 0; 
00453   fCanvD_MSp_SpNb = 0; 
00454   fCanvD_MSp_SpDs = 0;
00455   fCanvD_SSp_SpNb = 0;
00456   fCanvD_SSp_SpDs = 0;  
00457   fCanvD_Adc_EvDs = 0;     
00458   fCanvD_Adc_EvNb = 0;
00459   fCanvH_Ped_Date = 0;
00460   fCanvH_TNo_Date = 0;
00461   fCanvH_MCs_Date = 0;
00462   fCanvH_LFN_Date = 0;
00463   fCanvH_HFN_Date = 0;
00464   fCanvH_SCs_Date = 0;
00465   fCanvH_Ped_RuDs = 0;
00466   fCanvH_TNo_RuDs = 0;
00467   fCanvH_MCs_RuDs = 0;
00468   fCanvH_LFN_RuDs = 0;
00469   fCanvH_HFN_RuDs = 0;
00470   fCanvH_SCs_RuDs = 0;
00471   
00472   fCurrentPad = 0;                                    //   (Init)
00473 
00474   fPadH1SamePlus = 0;
00475   fPadD_NOE_ChNb = 0;
00476   fPadD_NOE_ChDs = 0;
00477   fPadD_Ped_ChNb = 0;
00478   fPadD_Ped_ChDs = 0;
00479   fPadD_TNo_ChNb = 0;   
00480   fPadD_TNo_ChDs = 0; 
00481   fPadD_MCs_ChNb = 0; 
00482   fPadD_MCs_ChDs = 0;
00483   fPadD_LFN_ChNb = 0;
00484   fPadD_LFN_ChDs = 0; 
00485   fPadD_HFN_ChNb = 0;   
00486   fPadD_HFN_ChDs = 0; 
00487   fPadD_SCs_ChNb = 0; 
00488   fPadD_SCs_ChDs = 0; 
00489   fPadD_MSp_SpNb = 0;
00490   fPadD_MSp_SpDs = 0;
00491   fPadD_SSp_SpNb = 0;
00492   fPadD_SSp_SpDs = 0;
00493   fPadD_Adc_EvDs = 0;
00494   fPadD_Adc_EvNb = 0;
00495   fPadH_Ped_Date = 0;
00496   fPadH_TNo_Date = 0;
00497   fPadH_MCs_Date = 0;
00498   fPadH_LFN_Date = 0;
00499   fPadH_HFN_Date = 0;
00500   fPadH_SCs_Date = 0;
00501   fPadH_Ped_RuDs = 0;
00502   fPadH_TNo_RuDs = 0;
00503   fPadH_MCs_RuDs = 0;
00504   fPadH_LFN_RuDs = 0;
00505   fPadH_HFN_RuDs = 0;
00506   fPadH_SCs_RuDs = 0;
00507 
00508   fPavTxtH1SamePlus = 0;                                    //   (Init)
00509   fPavTxtD_NOE_ChNb = 0;
00510   fPavTxtD_NOE_ChDs = 0;
00511   fPavTxtD_Ped_ChNb = 0;
00512   fPavTxtD_Ped_ChDs = 0;
00513   fPavTxtD_TNo_ChNb = 0;   
00514   fPavTxtD_TNo_ChDs = 0; 
00515   fPavTxtD_MCs_ChNb = 0; 
00516   fPavTxtD_MCs_ChDs = 0;
00517   fPavTxtD_LFN_ChNb = 0;
00518   fPavTxtD_LFN_ChDs = 0; 
00519   fPavTxtD_HFN_ChNb = 0;   
00520   fPavTxtD_HFN_ChDs = 0; 
00521   fPavTxtD_SCs_ChNb = 0; 
00522   fPavTxtD_SCs_ChDs = 0; 
00523   fPavTxtD_MSp_SpNb = 0; 
00524   fPavTxtD_MSp_SpDs = 0;
00525   fPavTxtD_SSp_SpNb = 0;
00526   fPavTxtD_SSp_SpDs = 0;
00527   fPavTxtD_Adc_EvDs = 0;
00528   fPavTxtD_Adc_EvNb = 0;
00529   fPavTxtH_Ped_Date = 0;
00530   fPavTxtH_TNo_Date = 0;
00531   fPavTxtH_MCs_Date = 0;
00532   fPavTxtH_LFN_Date = 0;
00533   fPavTxtH_HFN_Date = 0;
00534   fPavTxtH_SCs_Date = 0;
00535   fPavTxtH_Ped_RuDs = 0;
00536   fPavTxtH_TNo_RuDs = 0;
00537   fPavTxtH_MCs_RuDs = 0;
00538   fPavTxtH_LFN_RuDs = 0;
00539   fPavTxtH_HFN_RuDs = 0;
00540   fPavTxtH_SCs_RuDs = 0;
00541 
00542   fImpH1SamePlus = 0;                                    //   (Init)
00543   fImpD_NOE_ChNb = 0;
00544   fImpD_NOE_ChDs = 0;
00545   fImpD_Ped_ChNb = 0;
00546   fImpD_Ped_ChDs = 0;
00547   fImpD_TNo_ChNb = 0;   
00548   fImpD_TNo_ChDs = 0; 
00549   fImpD_MCs_ChNb = 0; 
00550   fImpD_MCs_ChDs = 0;
00551   fImpD_LFN_ChNb = 0;
00552   fImpD_LFN_ChDs = 0; 
00553   fImpD_HFN_ChNb = 0;   
00554   fImpD_HFN_ChDs = 0; 
00555   fImpD_SCs_ChNb = 0; 
00556   fImpD_SCs_ChDs = 0; 
00557   fImpD_MSp_SpNb = 0; 
00558   fImpD_MSp_SpDs = 0;
00559   fImpD_SSp_SpNb = 0; 
00560   fImpD_SSp_SpDs = 0;  
00561   fImpD_Adc_EvDs = 0;     
00562   fImpD_Adc_EvNb = 0;
00563   fImpH_Ped_Date = 0;
00564   fImpH_TNo_Date = 0;
00565   fImpH_MCs_Date = 0;
00566   fImpH_LFN_Date = 0;
00567   fImpH_HFN_Date = 0;
00568   fImpH_SCs_Date = 0;
00569   fImpH_Ped_RuDs = 0;
00570   fImpH_TNo_RuDs = 0;
00571   fImpH_MCs_RuDs = 0;
00572   fImpH_LFN_RuDs = 0;
00573   fImpH_HFN_RuDs = 0;
00574   fImpH_SCs_RuDs = 0;
00575 
00576   fNbBinsProj = 100;       // number of bins for histos in option Projection
00577 
00578   //.................................... Miscellaneous parameters                (Init)
00579 
00580   fNbOfListFileH_Ped_Date = 0;
00581   fNbOfListFileH_TNo_Date = 0;
00582   fNbOfListFileH_MCs_Date = 0;
00583   fNbOfListFileH_LFN_Date = 0;
00584   fNbOfListFileH_HFN_Date = 0;
00585   fNbOfListFileH_SCs_Date = 0;
00586 
00587   fNbOfListFileH_Ped_RuDs = 0;
00588   fNbOfListFileH_TNo_RuDs = 0;
00589   fNbOfListFileH_MCs_RuDs = 0;
00590   fNbOfListFileH_LFN_RuDs = 0;
00591   fNbOfListFileH_HFN_RuDs = 0;
00592   fNbOfListFileH_SCs_RuDs = 0;
00593 
00594   fNbOfExistingRuns = 0;
00595 
00596   fFapNbOfRuns    = -1;      // INIT NUMBER OF RUNS: set to -1
00597   fFapMaxNbOfRuns = -1;      // INIT MAXIMUM NUMBER OF RUNS: set to -1 
00598 
00599   MaxCar = fgMaxCar;
00600   fFapFileRuns.Resize(MaxCar);
00601   fFapFileRuns = "(file with list of runs parameters: no info)";
00602 
00603   fStartEvolTime = 0;
00604   fStopEvolTime  = 0;
00605   fStartEvolDate = "Start date: not known";
00606   fStopEvolDate  = "Stop date:  not known";
00607 
00608   fStartEvolRun  = 0;
00609   fStopEvolRun   = 0;
00610 
00611   fRunType       = "Run type: not known";
00612 
00613   fFapNbOfEvts = 0;
00614 
00615   MaxCar = fgMaxCar;
00616   fMyRootFileName.Resize(MaxCar);
00617   fMyRootFileName = "No ROOT file name available (fMyRootFileName).";
00618 
00619   fFapAnaType           = "Analysis name: not known"; // Init Type of analysis
00620   fFapNbOfSamples       = 0; // Init Nb of required samples
00621   fFapRunNumber         = 0; // Init Run number
00622   fFapFirstReqEvtNumber = 0; // Init First requested event number
00623   fFapLastReqEvtNumber  = 0; // Init Last requested event number
00624   fFapReqNbOfEvts       = 0; // Init Requested number of events
00625   fFapStexNumber        = 0; // Init Stex number
00626 
00627   //------------------ Init read file flags
00628   fAlreadyRead = 1;
00629   fMemoAlreadyRead = 0;
00630   fTobeRead = 0;
00631   fZerv    =   0;
00632   fUnev    =   1;
00633   TVectorD fReadHistoDummy(fUnev);
00634   TMatrixD fReadMatrixDummy(fUnev, fUnev);
00635 
00636   //------------------ Init fAsciiFileName
00637   fAsciiFileName = "?";
00638 
00639 } // end of Init()
00640 
00641 //----------------------------------------------------------------------------------------
00642 void TEcnaHistos::SetEcalSubDetector(const TString SubDet)
00643 {
00644  // Set Subdetector (EB or EE)
00645 
00646   Int_t MaxCar = fgMaxCar;
00647   fFlagSubDet.Resize(MaxCar);
00648   fFlagSubDet = fEcal->GetEcalSubDetector();      // fFlagSubDet = "EB" or "EE"
00649 
00650   //.................................. Init specific EB/EE parameters ( SetEcalSubDetector(...) )
00651   MaxCar = fgMaxCar;
00652   fFapStexName.Resize(MaxCar);
00653   fFapStexName = "no info for Stex";
00654   MaxCar = fgMaxCar;
00655   fFapStinName.Resize(MaxCar);
00656   fFapStinName = "no info for Stin";
00657   MaxCar = fgMaxCar;
00658   fFapXtalName.Resize(MaxCar);
00659   fFapXtalName = "no info for Xtal";
00660   MaxCar = fgMaxCar;
00661   fFapEchaName.Resize(MaxCar);
00662   fFapEchaName = "no info for Echa";
00663 
00664   if( fFlagSubDet == "EB" )
00665     {
00666       fFapStexName   = "SM";
00667       fFapStinName   = "Tower";
00668       fFapXtalName   = "Xtal";
00669       fFapEchaName   = "Chan";
00670       fFapStexBarrel = fEcalNumbering->GetSMHalfBarrel(fFapStexNumber);
00671     }
00672 
00673   if( fFlagSubDet == "EE" )
00674     {
00675       fFapStexName     = "Dee";
00676       fFapStinName     = "SC";
00677       fFapXtalName     = "Xtal";
00678       fFapEchaName     = "Chan";
00679       fFapStexType     = fEcalNumbering->GetEEDeeType(fFapStexNumber);
00680       fFapStexDir      = "right";
00681       fFapStinQuadType = "top";
00682     }
00683 
00684   //........................ init code plot type                     (SetEcalSubDetector)
00685   MaxCar = fgMaxCar;
00686   fOnlyOnePlot.Resize(MaxCar);
00687   fOnlyOnePlot = fCnaParHistos->GetCodeOnlyOnePlot();  // "ONLYONE"
00688 
00689   MaxCar = fgMaxCar;
00690   fSeveralPlot.Resize(MaxCar);
00691   fSeveralPlot = fCnaParHistos->GetCodeSeveralPlot();  // "SEVERAL"
00692 
00693   MaxCar = fgMaxCar;
00694   fSameOnePlot.Resize(MaxCar);
00695   fSameOnePlot = fCnaParHistos->GetCodeSameOnePlot();  // "SAME n";
00696 
00697   MaxCar = fgMaxCar;
00698   fAllXtalsInStinPlot.Resize(MaxCar);
00699   fAllXtalsInStinPlot = fCnaParHistos->GetCodeAllXtalsInStinPlot();  // "SAME in Stin";
00700 
00701   fPlotAllXtalsInStin = fCnaParHistos->GetCodePlotAllXtalsInStin();  //  0
00702 
00703 } // ---------------- end of  SetEcalSubDetector(...) ----------------
00704 
00705 //--------------------------------------------------------------------------------------------
00706 //
00707 //          FileParameters(s)(...) 
00708 //
00709 //--------------------------------------------------------------------------------------------
00710 
00711 //===> DON'T SUPPRESS: THESE METHODS ARE CALLED BY TEcnaGui and can be called by any other program
00712 void TEcnaHistos::FileParameters(const TString xArgAnaType,          const Int_t&  xArgNbOfSamples, 
00713                                  const Int_t&  xArgRunNumber,        const Int_t&  xArgFirstReqEvtNumber,
00714                                  const Int_t&  xArgLastReqEvtNumber, const Int_t&  xArgReqNbOfEvts, 
00715                                  const Int_t&  xArgStexNumber)
00716 {
00717 // Set parameters for reading the right ECNA results file
00718 
00719   fFapAnaType           = xArgAnaType;
00720   fFapNbOfSamples       = xArgNbOfSamples;
00721   fFapRunNumber         = xArgRunNumber;
00722   fFapFirstReqEvtNumber = xArgFirstReqEvtNumber;
00723   fFapLastReqEvtNumber  = xArgLastReqEvtNumber;
00724   fFapReqNbOfEvts       = xArgReqNbOfEvts;
00725   fFapStexNumber        = xArgStexNumber;
00726 
00727   InitSpecParBeforeFileReading();   // SpecPar = Special Parameters (dates, times, run types)
00728 }
00729 
00730 void TEcnaHistos::FileParameters(TEcnaRead* MyRootFile)
00731 {
00732 // Set parameters for reading the right ECNA results file
00733 
00734   InitSpecParBeforeFileReading();   // SpecPar = Special Parameters (dates, times, run types)
00735 
00736   //............... Filename parameter values
00737   fFapAnaType           = MyRootFile->GetAnalysisName();
00738   fFapNbOfSamples       = MyRootFile->GetNbOfSamples();
00739   fFapRunNumber         = MyRootFile->GetRunNumber();
00740   fFapFirstReqEvtNumber = MyRootFile->GetFirstReqEvtNumber();
00741   fFapLastReqEvtNumber  = MyRootFile->GetLastReqEvtNumber();
00742   fFapReqNbOfEvts       = MyRootFile->GetReqNbOfEvts();
00743   fFapStexNumber        = MyRootFile->GetStexNumber();
00744 
00745   //............... parameter values from file contents
00746   fStartDate = MyRootFile->GetStartDate();
00747   fStopDate  = MyRootFile->GetStopDate();
00748   fRunType   = MyRootFile->GetRunType();
00749 
00750   fFapNbOfEvts = MyRootFile->GetNumberOfEvents(fFapReqNbOfEvts);
00751 }
00752 
00753 //=============================================================================================
00754 //                 Set general title
00755 //                 Set lin or log scale on X or Y axis
00756 //                 Set color palette
00757 //                 Set start and stop date
00758 //                 Set run type
00759 //=============================================================================================
00760 //............................................................................................ 
00761 void TEcnaHistos::GeneralTitle(const TString title)
00762 {
00763   fFlagGeneralTitle = title.Data();
00764 }
00765 void TEcnaHistos::SetHistoScaleX(const TString  option_scale)
00766 {
00767   fFlagScaleX = "LIN";
00768   if ( option_scale == "LOG" ){fFlagScaleX = "LOG";}
00769 }
00770 void TEcnaHistos::SetHistoScaleY(const TString  option_scale)
00771 {
00772   fFlagScaleY = "LIN";
00773   if ( option_scale == "LOG" ){fFlagScaleY = "LOG";}
00774 }
00775 void TEcnaHistos::SetHistoColorPalette (const TString  option_palette)
00776 {
00777   fFlagColPal = "Black/Red/Blue";
00778   if ( !(option_palette == "Rainbow" || option_palette == "rainbow") ){fFlagColPal = "Black/Red/Blue";}
00779   if (   option_palette == "Rainbow" || option_palette == "rainbow"  ){fFlagColPal = "Rainbow";}
00780 }
00781 void TEcnaHistos::StartStopDate(const TString start_date, const TString stop_date)
00782 {
00783   fStartDate = start_date.Data();
00784   fStopDate  = stop_date.Data();
00785 }
00786 void TEcnaHistos::RunType(const TString run_type)
00787 {
00788   fRunType = run_type.Data();
00789 }
00790 void TEcnaHistos::NumberOfEvents(const Int_t& nb_of_evts)
00791 {
00792   fFapNbOfEvts = nb_of_evts;
00793 }
00794 //====================== return status for root file and data existence
00795 Bool_t TEcnaHistos::StatusFileFound(){return fStatusFileFound;}
00796 Bool_t TEcnaHistos::StatusDataExist(){return fStatusDataExist;}
00797 
00798 //=======================================================================================
00799 //
00800 //                       ( R e a d A n d ) P l o t    (1D , 2D , History)
00801 //
00802 //=======================================================================================
00803 //---------------------------------------------------------------------------------------------
00804 // TechHistoCode list modification (06/10/09)
00805 //
00806 //    D = Detector Plot    ChNb = Channel Number
00807 //                         ChDs = Channel Distribution (Y projection)
00808 //
00809 //    H = History  Plot    Date = date in format YYMMJJ hhmmss
00810 //                         RuDs = Run distribution
00811 //
00812 //      old code             new code    std code X  std code Y   (std = standard)
00813 //                     
00814 // *  1 H1NbOfEvtsGlobal     D_NOE_ChNb   Xtal        NOE            NOE = Number Of Events
00815 // *  2 H1NbOfEvtsProj       D_NOE_ChDs   NOE         NOX            NOX = Number Of Xtals
00816 // *  3 H1EvEvGlobal         D_Ped_ChNb   Xtal        Ped            Ped = Pedestal
00817 // *  4 H1EvEvProj           D_Ped_ChDs   Ped         NOX
00818 // *  5 H1EvSigGlobal        D_TNo_ChNb   Xtal        TNo            TNo = Total Noise
00819 // *  6 H1EvSigProj          D_TNo_ChDs   TNo         NOX
00820 // *  7 H1SigEvGlobal        D_LFN_ChNb   Xtal        LFN            LFN = Low Frequency noise
00821 // *  8 H1SigEvProj          D_LFN_ChDs   LFN         NOX
00822 // *  9 H1SigSigGlobal       D_HFN_ChNb   Xtal        HFN            HFN = High Frequency noise
00823 // * 10 H1SigSigProj         D_HFN_ChDs   HFN         NOX
00824 // * 11 H1EvCorssGlobal      D_MCs_ChNb   Xtal        MCs            MCs = Mean correlations between samples
00825 // * 12 H1EvCorssProj        D_MCs_ChDs   MCs         NOX
00826 // * 13 H1SigCorssGlobal     D_SCs_ChNb   Xtal        SCs            SCs = Sigma of the correlations between samples
00827 // * 14 H1SigCorssProj       D_SCs_ChDs   SCs         NOX
00828 // * 15 Ev                   D_MSp_SpNb   Sample      MSp            MSp = Means  of the samples
00829 // * 16 EvProj               D_MSp_SpDs   MSp         NOS            NOS = Number of samples
00830 // * 17 Sigma                D_SSp_SpNb   Sample      SSp            SSp = Sigmas of the samples
00831 // * 18 SigmaProj            D_SSp_SpDs   SSp         NOS 
00832 // * 19 SampTime             D_Adc_EvNb   Event       Adc            Adc = ADC count as a function of Event number
00833 // * 20 AdcProj              D_Adc_EvDs   Adc         NOE            EvDs = Event distribution
00834 // * 21 EvolEvEv             H_Ped_Date   Time        Ped            Time = date YY/MM/DD hh:mm:ss
00835 // * 22 EvolEvEvProj         H_Ped_RuDs   Ped         NOR            NOR  = Number Of Runs
00836 // * 23 EvolEvSig            H_TNo_Date   Time        TNo
00837 // * 24 EvolEvSigProj        H_TNo_RuDs   TNo         NOR
00838 // * 25 EvolSigEv            H_LFN_Date   Time        LFN
00839 // * 26 EvolSigEvProj        H_LFN_RuDs   LFN         NOR
00840 // * 27 EvolSigSig           H_HFN_Date   Time        HFN
00841 // * 28 EvolSigSigProj       H_HFN_RuDs   HFN         NOR
00842 // * 29 EvolEvCorss          H_MCs_Date   Time        MCs
00843 // * 30 EvolEvCorssProj      H_MCs_RuDs   MCs         NOR
00844 // * 31 EvolSigCorss         H_SCs_Date   Time        SCs
00845 // * 32 EvolSigCorssProj     H_SCs_RuDs   SCs         NOR
00846 //
00847 //---------------------------------------------------------------------------------------------
00848 
00849 //---------------------------------------------------------------------------------------
00850 //
00851 //                              (ReadAnd)PlotMatrix
00852 //
00853 //---------------------------------------------------------------------------------------
00854 //................................ Corcc[for 1 Stex] (big matrix), Cortt[for 1 Stex]
00855 void TEcnaHistos::PlotMatrix(const TMatrixD& read_matrix_corcc,
00856                              const TString   UserCorOrCov, const TString UserBetweenWhat)
00857 {PlotMatrix(read_matrix_corcc, UserCorOrCov, UserBetweenWhat, "");}
00858 
00859 void TEcnaHistos::PlotMatrix(const TMatrixD& read_matrix_corcc,
00860                              const TString   UserCorOrCov, const TString UserBetweenWhat,
00861                              const TString   UserPlotOption)
00862 {
00863   TString CallingMethod = "2D";
00864 
00865   TString StandardPlotOption = fCnaParHistos->BuildStandardPlotOption(CallingMethod, UserPlotOption); 
00866 
00867   TString BetweenWhat = fCnaParHistos->BuildStandardHistoCode(CallingMethod, UserBetweenWhat);
00868   TString CorOrCov = fCnaParHistos->BuildStandardHistoCode(CallingMethod, UserCorOrCov);
00869   
00870   if( BetweenWhat != "?" && CorOrCov != "?" )
00871     {
00872       if( BetweenWhat == "MttLF" ||  BetweenWhat == "MttHF" )
00873         {
00874           fAlreadyRead = 1;
00875           ViewMatrix(read_matrix_corcc, fAlreadyRead,
00876                      fZerv, fZerv, fZerv, CorOrCov, BetweenWhat, StandardPlotOption); 
00877         }
00878       if( BetweenWhat == "MccLF" ){StexHocoVecoLHFCorcc("LF");} // forced to Read file and Plot
00879       if( BetweenWhat == "MccHF" ){StexHocoVecoLHFCorcc("HF");} // forced to Read file and Plot
00880     }
00881   else
00882     {fFlagUserHistoMin = "OFF"; fFlagUserHistoMax = "OFF";
00883       cout << "!TEcnaHistos::PlotMatrix(...)> Histo cannot be reached." << fTTBELL << endl;}
00884 }
00885 
00886 void TEcnaHistos::PlotMatrix(const TString UserCorOrCov, const TString UserBetweenWhat)
00887 {PlotMatrix(UserCorOrCov, UserBetweenWhat, "");}
00888 
00889 void TEcnaHistos::PlotMatrix(const TString UserCorOrCov, const TString UserBetweenWhat,
00890                              const TString UserPlotOption)
00891 {
00892   TString CallingMethod = "2D";
00893 
00894   TString StandardPlotOption = fCnaParHistos->BuildStandardPlotOption(CallingMethod, UserPlotOption); 
00895 
00896   TString BetweenWhat = fCnaParHistos->BuildStandardHistoCode(CallingMethod, UserBetweenWhat);
00897   TString CorOrCov = fCnaParHistos->BuildStandardHistoCode(CallingMethod, UserCorOrCov);
00898 
00899   if( BetweenWhat != "?" && CorOrCov != "?" )
00900     {
00901       if( BetweenWhat == "MttLF" ||  BetweenWhat == "MttHF" )
00902         {
00903           ViewMatrix(fReadMatrixDummy, fTobeRead,
00904                      fZerv, fZerv, fZerv, CorOrCov, BetweenWhat, StandardPlotOption);
00905         }
00906       if( BetweenWhat == "MccLF" ){StexHocoVecoLHFCorcc("LF");} // Plot  only
00907       if( BetweenWhat == "MccHF" ){StexHocoVecoLHFCorcc("HF");} // Plot  only
00908     }
00909   else
00910     {fFlagUserHistoMin = "OFF"; fFlagUserHistoMax = "OFF";
00911       cout << "!TEcnaHistos::PlotMatrix(...)> Histo cannot be reached." << fTTBELL << endl;}
00912 }
00913 
00914 //....................................... Corcc for channels (cStexStin_A, cStexStin_B)
00915 //                                        Corss, Covss for one channel (-> i0StinEcha)
00916 void TEcnaHistos::PlotMatrix(const TMatrixD& read_matrix,
00917                              const TString   UserCorOrCov, const TString UserBetweenWhat,
00918                              const Int_t&    arg_n1,       const Int_t& arg_n2)
00919 {PlotMatrix(read_matrix, UserCorOrCov, UserBetweenWhat, arg_n1, arg_n2, "");}
00920 
00921 void TEcnaHistos::PlotMatrix(const TMatrixD& read_matrix,
00922                              const TString   UserCorOrCov, const TString UserBetweenWhat,
00923                              const Int_t&    arg_n1,       const Int_t& arg_n2,
00924                              const TString   UserPlotOption)
00925 {
00926   TString CallingMethod = "2D";
00927 
00928   TString StandardPlotOption = fCnaParHistos->BuildStandardPlotOption(CallingMethod, UserPlotOption); 
00929 
00930   TString BetweenWhat = fCnaParHistos->BuildStandardHistoCode(CallingMethod, UserBetweenWhat);
00931   TString CorOrCov    = fCnaParHistos->BuildStandardHistoCode(CallingMethod, UserCorOrCov);
00932 
00933   if( BetweenWhat != "?" && CorOrCov != "?" )
00934     {
00935       if( BetweenWhat == "MccLF" || BetweenWhat == "MccHF" )
00936         {
00937           Int_t cStexStin_A = arg_n1;
00938           Int_t cStexStin_B = arg_n2;
00939           fAlreadyRead = 1;
00940           ViewMatrix(read_matrix, fAlreadyRead,
00941                      cStexStin_A, cStexStin_B, fZerv, CorOrCov, BetweenWhat, StandardPlotOption); 
00942         }
00943       
00944       if( BetweenWhat == "Mss" )
00945         {
00946           Int_t n1StexStin = arg_n1;
00947           Int_t i0StinEcha = arg_n2; 
00948           if( fFlagSubDet == "EE" ){n1StexStin = fEcalNumbering->Get1DeeSCEcnaFromDeeSCCons(fFapStexNumber, arg_n1);}
00949           fAlreadyRead = 1;
00950           ViewMatrix(read_matrix, fAlreadyRead,
00951                      n1StexStin, fZerv,  i0StinEcha, CorOrCov, BetweenWhat, StandardPlotOption); 
00952         }
00953     }
00954   else
00955     {fFlagUserHistoMin = "OFF"; fFlagUserHistoMax = "OFF";
00956       cout << "!TEcnaHistos::PlotMatrix(...)> Histo cannot be reached." << fTTBELL << endl;}
00957 }
00958 
00959 void TEcnaHistos::PlotMatrix(const TString UserCorOrCov, const TString UserBetweenWhat,
00960                              const Int_t&  arg_n1,       const Int_t&  arg_n2)
00961 {PlotMatrix(UserCorOrCov, UserBetweenWhat, arg_n1, arg_n2, "");}
00962 
00963 void TEcnaHistos::PlotMatrix(const TString UserCorOrCov, const TString UserBetweenWhat,
00964                              const Int_t&  arg_n1,       const Int_t&  arg_n2,
00965                              const TString UserPlotOption)
00966 {
00967   TString CallingMethod = "2D";
00968 
00969   TString StandardPlotOption = fCnaParHistos->BuildStandardPlotOption(CallingMethod, UserPlotOption); 
00970 
00971   TString StandardBetweenWhat = fCnaParHistos->BuildStandardHistoCode(CallingMethod, UserBetweenWhat);
00972   TString StandardCorOrCov = fCnaParHistos->BuildStandardHistoCode(CallingMethod, UserCorOrCov);
00973 
00974   if( StandardBetweenWhat != "?" && StandardCorOrCov != "?" )
00975     {
00976       if( StandardBetweenWhat == "MccLF" ||  StandardBetweenWhat == "MccHF" )
00977         {
00978           Int_t cStexStin_A = arg_n1;
00979           Int_t cStexStin_B = arg_n2;
00980           ViewMatrix(fReadMatrixDummy, fTobeRead,
00981                      cStexStin_A, cStexStin_B, fZerv, StandardCorOrCov, StandardBetweenWhat, StandardPlotOption); 
00982         }
00983       
00984       if( StandardBetweenWhat == "Mss" )
00985         {
00986           Int_t n1StexStin = arg_n1;
00987           Int_t i0StinEcha = arg_n2;
00988           if( fFlagSubDet == "EE" ){n1StexStin = fEcalNumbering->Get1DeeSCEcnaFromDeeSCCons(fFapStexNumber, arg_n1);}
00989           
00990           ViewMatrix(fReadMatrixDummy,  fTobeRead,
00991                      n1StexStin, fZerv, i0StinEcha, StandardCorOrCov, StandardBetweenWhat, StandardPlotOption); 
00992         }
00993     }
00994   else
00995     {fFlagUserHistoMin = "OFF"; fFlagUserHistoMax = "OFF";
00996       cout << "!TEcnaHistos::PlotMatrix(...)> Histo cannot be reached." << fTTBELL << endl;}
00997 }
00998 
00999 //---------------------------------------------------------------------------------------
01000 //
01001 //                              (ReadAnd)PlotDetector
01002 //
01003 //---------------------------------------------------------------------------------------
01004 //.................................... 2D plots for Stex OR Stas
01005 void TEcnaHistos::PlotDetector(const TString UserHistoCode, const TString UserDetector)
01006 {
01007   TString CallingMethod = "2DS";
01008 
01009   TString StandardHistoCode = fCnaParHistos->BuildStandardHistoCode(CallingMethod, UserHistoCode);
01010   if( StandardHistoCode != "?" )
01011     {
01012       TString TechHistoCode = fCnaParHistos->GetTechHistoCode(StandardHistoCode);
01013       TString StandardDetectorCode = fCnaParHistos->BuildStandardDetectorCode(UserDetector);
01014       if( StandardDetectorCode != "?" )
01015         {
01016           //if( StandardDetectorCode == "SM" || StandardDetectorCode == "EB" )
01017           //  {fEcal->SetEcalSubDetector("EB");}
01018           //if( StandardDetectorCode == "Dee" || StandardDetectorCode == "EE" )
01019           //  {fEcal->SetEcalSubDetector("EE");}
01020 
01021           if( StandardDetectorCode == "SM" || StandardDetectorCode == "Dee" )
01022             {ViewStex(fReadHistoDummy, fTobeRead, TechHistoCode);}
01023           if( StandardDetectorCode == "EB" || StandardDetectorCode == "EE"  )
01024             {ViewStas(fReadHistoDummy, fTobeRead, TechHistoCode);}
01025         }
01026       else
01027         {fFlagUserHistoMin = "OFF"; fFlagUserHistoMax = "OFF";
01028           cout << "!TEcnaHistos::PlotDetector(...)> Histo cannot be reached." << fTTBELL << endl;}
01029     }
01030   else
01031     {fFlagUserHistoMin = "OFF"; fFlagUserHistoMax = "OFF";
01032       cout << "!TEcnaHistos::PlotDetector(...)> Histo cannot be reached." << fTTBELL << endl;}
01033 }
01034 
01035 void TEcnaHistos::PlotDetector(const TVectorD& read_histo, const TString UserHistoCode, const TString UserDetector)
01036 {
01037   TString CallingMethod = "2DS";
01038 
01039   TString StandardHistoCode = fCnaParHistos->BuildStandardHistoCode(CallingMethod, UserHistoCode);
01040   if( StandardHistoCode != "?" )
01041     {
01042       TString TechHistoCode = fCnaParHistos->GetTechHistoCode(StandardHistoCode);
01043       TString StandardDetectorCode = fCnaParHistos->BuildStandardDetectorCode(UserDetector);
01044       if( StandardDetectorCode != "?" )
01045         {
01046           fAlreadyRead = 1;
01047 
01048           //if( StandardDetectorCode == "SM" || StandardDetectorCode == "EB" )
01049           //  {fEcal->SetEcalSubDetector("EB");}
01050           //if( StandardDetectorCode == "Dee" || StandardDetectorCode == "EE" )
01051           //  {fEcal->SetEcalSubDetector("EE");}
01052 
01053           if( StandardDetectorCode == "SM" || StandardDetectorCode == "Dee" )
01054             {ViewStex(read_histo, fAlreadyRead, TechHistoCode);}
01055           if( StandardDetectorCode == "EB" || StandardDetectorCode == "EE"  )
01056             {ViewStas(read_histo, fAlreadyRead, TechHistoCode);}
01057         }
01058       else
01059         {fFlagUserHistoMin = "OFF"; fFlagUserHistoMax = "OFF";
01060           cout << "!TEcnaHistos::PlotDetector(...)> Histo cannot be reached." << fTTBELL << endl;}
01061     }
01062   else
01063     {fFlagUserHistoMin = "OFF"; fFlagUserHistoMax = "OFF";
01064       cout << "!TEcnaHistos::PlotDetector(...)> Histo cannot be reached." << fTTBELL << endl;}
01065 }
01066 
01067 //---------------------------------------------------------------------------------------
01068 //
01069 //                              (ReadAnd)Plot1DHisto
01070 //
01071 //---------------------------------------------------------------------------------------
01072 void TEcnaHistos::Plot1DHisto(const TVectorD& InputHisto,
01073                               const TString   User_X_Quantity, const TString User_Y_Quantity,
01074                               const TString   UserDetector)
01075 {Plot1DHisto(InputHisto, User_X_Quantity, User_Y_Quantity, UserDetector, "");}
01076 
01077 void TEcnaHistos::Plot1DHisto(const TVectorD& InputHisto,
01078                               const TString   User_X_Quantity, const TString User_Y_Quantity,
01079                               const TString   UserDetector,
01080                               const TString   UserPlotOption)
01081 {
01082   TString CallingMethod = "1D";
01083 
01084   TString StandardPlotOption = fCnaParHistos->BuildStandardPlotOption(CallingMethod, UserPlotOption); 
01085 
01086   TString Standard_X_Quantity = fCnaParHistos->BuildStandardHistoCode(CallingMethod, User_X_Quantity);
01087   TString Standard_Y_Quantity = fCnaParHistos->BuildStandardHistoCode(CallingMethod, User_Y_Quantity);
01088   
01089   if( Standard_X_Quantity != "?" && Standard_Y_Quantity != "?" )
01090     {  
01091       TString TechHistoCode = fCnaParHistos->GetTechHistoCode(Standard_X_Quantity, Standard_Y_Quantity);
01092       if( fAlreadyRead > 1 ){fAlreadyRead = 1;}
01093       TString StandardDetectorCode = fCnaParHistos->BuildStandardDetectorCode(UserDetector);
01094       if( StandardDetectorCode != "?" )
01095         {
01096           if( StandardDetectorCode == "EB" || StandardDetectorCode == "EE" ){fFapStexNumber = 0;}
01097           ViewHisto(InputHisto, fAlreadyRead, fZerv, fZerv, fZerv, TechHistoCode, StandardPlotOption);
01098         }
01099       else
01100         {fFlagUserHistoMin = "OFF"; fFlagUserHistoMax = "OFF";
01101           cout << "!TEcnaHistos::Plot1DHisto(...)> Histo cannot be reached." << fTTBELL << endl;}
01102     }
01103   else
01104     {fFlagUserHistoMin = "OFF"; fFlagUserHistoMax = "OFF";
01105       cout << "!TEcnaHistos::Plot1DHisto(...)> Histo cannot be reached." << fTTBELL << endl;}
01106 }
01107 
01108 void TEcnaHistos::Plot1DHisto(const TString User_X_Quantity, const TString User_Y_Quantity,
01109                               const TString UserDetector)
01110 {Plot1DHisto(User_X_Quantity, User_Y_Quantity, UserDetector, "");}
01111 
01112 void TEcnaHistos::Plot1DHisto(const TString User_X_Quantity, const TString User_Y_Quantity,
01113                               const TString UserDetector,    const TString UserPlotOption)
01114 {
01115   TString CallingMethod = "1D";
01116 
01117   TString StandardPlotOption = fCnaParHistos->BuildStandardPlotOption(CallingMethod, UserPlotOption); 
01118 
01119   TString Standard_X_Quantity = fCnaParHistos->BuildStandardHistoCode(CallingMethod, User_X_Quantity);
01120   TString Standard_Y_Quantity = fCnaParHistos->BuildStandardHistoCode(CallingMethod, User_Y_Quantity);
01121   
01122   if( Standard_X_Quantity != "?" && Standard_Y_Quantity != "?" )
01123     {
01124       TString TechHistoCode = fCnaParHistos->GetTechHistoCode(Standard_X_Quantity, Standard_Y_Quantity);
01125       TString StandardDetectorCode = fCnaParHistos->BuildStandardDetectorCode(UserDetector);
01126       if( StandardDetectorCode != "?" )
01127         {
01128           if( StandardDetectorCode == "EB" || StandardDetectorCode == "EE" ){fFapStexNumber = 0;}
01129           ViewHisto(fReadHistoDummy, fTobeRead, fZerv, fZerv, fZerv, TechHistoCode, StandardPlotOption);
01130         }
01131       else
01132         {fFlagUserHistoMin = "OFF"; fFlagUserHistoMax = "OFF";
01133           cout << "!TEcnaHistos::Plot1DHisto(...)> Histo cannot be reached." << fTTBELL << endl;}
01134     }
01135   else
01136     {fFlagUserHistoMin = "OFF"; fFlagUserHistoMax = "OFF";
01137       cout << "!TEcnaHistos::Plot1DHisto(...)> Histo cannot be reached." << fTTBELL << endl;}
01138 }
01139 
01140 
01141 
01142 //=> BUG SCRAM? Si on enleve la methode ci-dessous, ca passe a la compilation de test/EcnaHistosExample2.cc 
01143 //   (qui appelle cette methode) et ca se plante a l'execution (voir test/TEcnaHistosExample2.cc).
01144 #define PLUD
01145 #ifdef PLUD
01146 void TEcnaHistos::Plot1DHisto(const TVectorD& InputHisto,
01147                               const TString   User_X_Quantity, const TString User_Y_Quantity,
01148                               const Int_t&    n1StexStin)
01149 {Plot1DHisto(InputHisto, User_X_Quantity, User_Y_Quantity, n1StexStin, "");}
01150 
01151 void TEcnaHistos::Plot1DHisto(const TVectorD& InputHisto,
01152                               const TString   User_X_Quantity, const TString User_Y_Quantity,
01153                               const Int_t&    n1StexStin,   
01154                               const TString   UserPlotOption)
01155 {
01156   TString CallingMethod = "1DX";
01157   TString StandardPlotOption = fCnaParHistos->BuildStandardPlotOption(CallingMethod, UserPlotOption);
01158   Int_t i0StinEcha = 0;
01159   Plot1DHisto(InputHisto, User_X_Quantity, User_Y_Quantity, n1StexStin, i0StinEcha, StandardPlotOption);
01160 }
01161 #endif // PLUD
01162 
01163 void TEcnaHistos::Plot1DHisto(const TVectorD& InputHisto,
01164                               const TString   User_X_Quantity, const TString User_Y_Quantity,
01165                               const Int_t&    n1StexStin,      const Int_t&  i0StinEcha)
01166 {Plot1DHisto(InputHisto, User_X_Quantity, User_Y_Quantity, n1StexStin, i0StinEcha, "");}
01167 
01168 void TEcnaHistos::Plot1DHisto(const TVectorD& InputHisto,
01169                               const TString   User_X_Quantity, const TString User_Y_Quantity,
01170                               const Int_t&    n1StexStin,      const Int_t&  i0StinEcha,   
01171                               const TString   UserPlotOption)
01172 {
01173   TString CallingMethod = "1D";
01174   TString StandardPlotOption  = fCnaParHistos->BuildStandardPlotOption(CallingMethod, UserPlotOption); 
01175   TString Standard_X_Quantity = fCnaParHistos->BuildStandardHistoCode(CallingMethod, User_X_Quantity);
01176   TString Standard_Y_Quantity = fCnaParHistos->BuildStandardHistoCode(CallingMethod, User_Y_Quantity);
01177   
01178   TString TechHistoCode = fCnaParHistos->GetTechHistoCode(Standard_X_Quantity, Standard_Y_Quantity);
01179   
01180   if( Standard_X_Quantity != "?" && Standard_Y_Quantity != "?" )
01181     {
01182       fAlreadyRead = 1;
01183       if( StandardPlotOption != fAllXtalsInStinPlot )
01184         {
01185           ViewHisto(InputHisto, fAlreadyRead, n1StexStin, i0StinEcha, fZerv, TechHistoCode, StandardPlotOption);
01186         }
01187       
01188       if( StandardPlotOption == fAllXtalsInStinPlot && fAlreadyRead >= 1 && fAlreadyRead <= fEcal->MaxCrysInStin() )
01189         {
01190           if( Standard_X_Quantity == "Smp" && Standard_Y_Quantity == "MSp" )
01191             {XtalSamplesEv(InputHisto, fAlreadyRead, n1StexStin, i0StinEcha, StandardPlotOption);}
01192           if( Standard_X_Quantity == "MSp" && Standard_Y_Quantity == "NOS" )
01193             {EvSamplesXtals(InputHisto, fAlreadyRead, n1StexStin, i0StinEcha, StandardPlotOption);}
01194           if( Standard_X_Quantity == "Smp" && Standard_Y_Quantity == "SSp" )
01195             {XtalSamplesSigma(InputHisto, fAlreadyRead, n1StexStin, i0StinEcha, StandardPlotOption);}
01196           if( Standard_X_Quantity == "SSp" && Standard_Y_Quantity == "NOS" )
01197             {SigmaSamplesXtals(InputHisto, fAlreadyRead, n1StexStin, i0StinEcha, StandardPlotOption);}
01198         }   
01199     }
01200   else
01201     {fFlagUserHistoMin = "OFF"; fFlagUserHistoMax = "OFF";
01202       cout << "!TEcnaHistos::Plot1DHisto(...)> Histo cannot be reached." << fTTBELL << endl;}
01203 }
01204 
01205 void TEcnaHistos::Plot1DHisto(const TString User_X_Quantity, const TString User_Y_Quantity,
01206                               const Int_t&  n1StexStin,      const Int_t&  i0StinEcha)
01207 {Plot1DHisto(User_X_Quantity, User_Y_Quantity, n1StexStin, i0StinEcha, "");}
01208 
01209 void TEcnaHistos::Plot1DHisto(const TString User_X_Quantity, const TString User_Y_Quantity,
01210                               const Int_t&  n1StexStin,      const Int_t&  i0StinEcha,
01211                               const TString UserPlotOption)
01212 {
01213   TString CallingMethod = "1D";
01214   
01215   TString StandardPlotOption = fCnaParHistos->BuildStandardPlotOption(CallingMethod, UserPlotOption); 
01216   
01217   TString Standard_X_Quantity = fCnaParHistos->BuildStandardHistoCode(CallingMethod, User_X_Quantity);
01218   TString Standard_Y_Quantity = fCnaParHistos->BuildStandardHistoCode(CallingMethod, User_Y_Quantity);
01219   
01220   if( Standard_X_Quantity != "?" && Standard_Y_Quantity != "?" )
01221     {  
01222       if( StandardPlotOption != fAllXtalsInStinPlot )
01223         {
01224           TString TechHistoCode = fCnaParHistos->GetTechHistoCode(Standard_X_Quantity, Standard_Y_Quantity);
01225           ViewHisto(fReadHistoDummy, fTobeRead, n1StexStin, i0StinEcha, fZerv, TechHistoCode, StandardPlotOption);
01226         }
01227       if( StandardPlotOption == fAllXtalsInStinPlot && fAlreadyRead >= 1 && fAlreadyRead <= fEcal->MaxCrysInStin() )
01228         {
01229           if( Standard_X_Quantity == "Smp" && Standard_Y_Quantity == "MSp" )
01230             {XtalSamplesEv(fReadHistoDummy, fTobeRead, n1StexStin, i0StinEcha, StandardPlotOption);}
01231           if( Standard_X_Quantity == "MSp" && Standard_Y_Quantity == "NOS" )
01232             {EvSamplesXtals(fReadHistoDummy, fTobeRead, n1StexStin, i0StinEcha, StandardPlotOption);}
01233           if( Standard_X_Quantity == "Smp" && Standard_Y_Quantity == "SSp" )
01234             {XtalSamplesSigma(fReadHistoDummy, fTobeRead, n1StexStin, i0StinEcha, StandardPlotOption);}
01235           if( Standard_X_Quantity == "SSp" && Standard_Y_Quantity == "NOS" )
01236             {SigmaSamplesXtals(fReadHistoDummy, fTobeRead, n1StexStin, i0StinEcha, StandardPlotOption);}
01237         }
01238     }
01239   else
01240     {fFlagUserHistoMin = "OFF"; fFlagUserHistoMax = "OFF";
01241       cout << "!TEcnaHistos::Plot1DHisto(...)> Histo cannot be reached." << fTTBELL << endl;}
01242 }
01243 
01244 void TEcnaHistos::Plot1DHisto(const TVectorD& InputHisto,
01245                               const TString   User_X_Quantity, const TString User_Y_Quantity,
01246                               const Int_t&    n1StexStin,      const Int_t&  i0StinEcha, const Int_t& n1Sample)
01247 {Plot1DHisto(InputHisto, User_X_Quantity, User_Y_Quantity, n1StexStin, i0StinEcha, n1Sample, "");}
01248 
01249 void TEcnaHistos::Plot1DHisto(const TVectorD& InputHisto,
01250                               const TString   User_X_Quantity, const TString User_Y_Quantity,
01251                               const Int_t&    n1StexStin,      const Int_t&  i0StinEcha, const Int_t& n1Sample,  
01252                               const TString   UserPlotOption)
01253 {
01254   TString CallingMethod = "1D";
01255 
01256   TString StandardPlotOption = fCnaParHistos->BuildStandardPlotOption(CallingMethod, UserPlotOption); 
01257 
01258   TString Standard_X_Quantity = fCnaParHistos->BuildStandardHistoCode(CallingMethod, User_X_Quantity);
01259   TString Standard_Y_Quantity = fCnaParHistos->BuildStandardHistoCode(CallingMethod, User_Y_Quantity);
01260   
01261   TString TechHistoCode = fCnaParHistos->GetTechHistoCode(Standard_X_Quantity, Standard_Y_Quantity);
01262   
01263   if( Standard_X_Quantity != "?" && Standard_Y_Quantity != "?" )
01264     {
01265       Int_t i0Sample = n1Sample-1;
01266       fAlreadyRead = 1;
01267       ViewHisto(InputHisto, fAlreadyRead, n1StexStin, i0StinEcha, i0Sample, TechHistoCode, StandardPlotOption); 
01268     }
01269   else
01270     {fFlagUserHistoMin = "OFF"; fFlagUserHistoMax = "OFF";
01271       cout << "!TEcnaHistos::Plot1DHisto(...)> Histo cannot be reached." << fTTBELL << endl;}
01272 }
01273 
01274 void TEcnaHistos::Plot1DHisto(const TString User_X_Quantity, const TString User_Y_Quantity,
01275                               const Int_t&  n1StexStin,      const Int_t&  i0StinEcha, const Int_t& n1Sample)
01276 {Plot1DHisto(User_X_Quantity, User_Y_Quantity, n1StexStin, i0StinEcha, n1Sample, "");}
01277 
01278 void TEcnaHistos::Plot1DHisto(const TString User_X_Quantity, const TString User_Y_Quantity,
01279                               const Int_t&  n1StexStin,      const Int_t&  i0StinEcha, const Int_t& n1Sample,
01280                               const TString UserPlotOption)
01281 {
01282   TString CallingMethod = "1D";
01283 
01284   TString StandardPlotOption = fCnaParHistos->BuildStandardPlotOption(CallingMethod, UserPlotOption); 
01285 
01286   TString Standard_X_Quantity = fCnaParHistos->BuildStandardHistoCode(CallingMethod, User_X_Quantity);
01287   TString Standard_Y_Quantity = fCnaParHistos->BuildStandardHistoCode(CallingMethod, User_Y_Quantity);
01288   
01289   Int_t i0Sample = n1Sample-1;
01290   
01291   if( Standard_X_Quantity != "?" && Standard_Y_Quantity != "?" )
01292     {
01293       TString TechHistoCode = fCnaParHistos->GetTechHistoCode(Standard_X_Quantity, Standard_Y_Quantity);
01294       ViewHisto(fReadHistoDummy, fTobeRead, n1StexStin, i0StinEcha, i0Sample, TechHistoCode, StandardPlotOption);
01295     }
01296   else
01297     {fFlagUserHistoMin = "OFF"; fFlagUserHistoMax = "OFF";
01298       cout << "!TEcnaHistos::Plot1DHisto(...)> Histo cannot be reached." << fTTBELL << endl;}
01299 }
01300 
01301 //---------------------------------------------------------------------------------------
01302 //
01303 //                              (ReadAnd)PlotHistory
01304 //
01305 //---------------------------------------------------------------------------------------
01306 void TEcnaHistos::PlotHistory(const TString User_X_Quantity, const TString User_Y_Quantity,
01307                               const TString list_of_run_file_name,
01308                               const Int_t&  StexStin_A, const Int_t& i0StinEcha)
01309 {PlotHistory(User_X_Quantity, User_Y_Quantity, list_of_run_file_name, StexStin_A, i0StinEcha, "");}
01310 
01311 void TEcnaHistos::PlotHistory(const TString User_X_Quantity, const TString User_Y_Quantity,
01312                               const TString list_of_run_file_name,
01313                               const Int_t&  StexStin_A, const Int_t& i0StinEcha,
01314                               const TString UserPlotOption)
01315 {
01316   TString CallingMethod = "Time";
01317 
01318   TString StandardPlotOption = fCnaParHistos->BuildStandardPlotOption(CallingMethod, UserPlotOption); 
01319 
01320   TString Standard_X_Quantity = fCnaParHistos->BuildStandardHistoCode(CallingMethod, User_X_Quantity);
01321   TString Standard_Y_Quantity = fCnaParHistos->BuildStandardHistoCode(CallingMethod, User_Y_Quantity);
01322 
01323   if( Standard_X_Quantity != "?" && Standard_Y_Quantity != "?" )
01324     { 
01325       TString TechHistoCode = fCnaParHistos->GetTechHistoCode(Standard_X_Quantity, Standard_Y_Quantity);
01326       ViewHistime(list_of_run_file_name, StexStin_A, i0StinEcha, TechHistoCode, StandardPlotOption);
01327     }
01328   else
01329     {fFlagUserHistoMin = "OFF"; fFlagUserHistoMax = "OFF";
01330       cout << "!TEcnaHistos::PlotHistory(...)> Histo cannot be reached." << fTTBELL << endl;} 
01331 }
01332 
01333 //=============================================================================================
01334 //
01335 //                            " V I E W "    M E T H O D S
01336 //
01337 //=============================================================================================
01338 
01339 //=============================================================================================================
01340 //
01341 //                                       ViewMatrix(***)
01342 //     
01343 //     arg_read_matrix:   2D array
01344 //     arg_AlreadyRead:   =1 <=> use arg_read_matrix 
01345 //                        =0 <=> read the 2D array in this method with TEcnaRead
01346 //     StexStin_A:        tower  number in SM (if EB) OR SC  "ECNA" number in Dee (if EE)
01347 //     StexStin_B:        tower' number in SM (if EB) OR SC' "ECNA" number in Dee (if EE)
01348 //     MatrixBinIndex:    channel number in tower (if EB) OR in SC (if EE)
01349 //     CorOrCov:          flag CORRELATION/COVARIANCE
01350 //     BetweenWhat:       flag BETWEEN SAMPLES / BETWEEN CHANNELS / BETWEEN TOWERS / BETWEEN SCs / LF, HF, ...
01351 //     PlotOption:        ROOT 2D histos draw options (COLZ, LEGO, ...) + additional (ASCII)
01352 //
01353 //     MatrixBinIndex:  = i0StinEcha if cov(s,s'), cor(s,s')
01354 //                      = 0          if cov(c,c'), cor(c,c'), cov(Stin,Stin'), cor(Stin,Stin')
01355 //
01356 //     ViewMatrix(StexStin_A, StexStin_B, MatrixBinIndex, CorOrCov, BetweenWhat, PlotOption)
01357 //     ViewMatrix(StexStin_A,          0,     i0StinEcha, CorOrCov,       "Mss", PlotOption)      
01358 //     Output:
01359 //     Plot of cov(s,s') or cor(s,s') matrix for i0StinEcha of StexStin_A              
01360 //
01361 //     ViewMatrix(StexStin_A, StexStin_B, MatrixBinIndex, CorOrCov, BetweenWhat, PlotOption)
01362 //     ViewMatrix(StexStin_A, StexStin_B,              0, CorOrCov,       "Mcc", PlotOption)
01363 //     Output:
01364 //     Plot LF-HF Corcc matrix for Stins: (StexStin_A, StexStin_B)
01365 //
01366 //     ViewMatrix(StexStin_A, StexStin_B, MatrixBinIndex, CorOrCov, BetweenWhat, PlotOption)
01367 //     ViewMatrix(         0,          0,              0, CorOrCov,       "Mcc", PlotOption)
01368 //     Output:
01369 //     Plot of LF-HF Corcc matrix for Stex (big matrix)
01370 //
01371 //     ViewMatrix(StexStin_A, StexStin_B, MatrixBinIndex, CorOrCov, BetweenWhat, PlotOption)
01372 //     ViewMatrix(         0,          0,              0, CorOrCov,       "Mtt", PlotOption)
01373 //     Output:
01374 //     Plot of LF-HF Cortt matrix
01375 //
01376 //=============================================================================================================
01377 void TEcnaHistos::ViewMatrix(const TMatrixD& arg_read_matrix, const Int_t&  arg_AlreadyRead,
01378                              const Int_t&    StexStin_A,      const Int_t&  StexStin_B,
01379                              const Int_t&    MatrixBinIndex,  const TString CorOrCov,
01380                              const TString   BetweenWhat,     const TString PlotOption)
01381 {
01382   //Plot correlation or covariance matrix between samples or channels or Stins
01383 
01384   if( (fFapStexNumber > 0) &&  (fFapStexNumber <= fEcal->MaxStexInStas()) )
01385     {
01386       Bool_t OKArray = kFALSE;
01387       Bool_t OKData  = kFALSE;
01388       TVectorD vStin(fEcal->MaxStinEcnaInStex());
01389 
01390       if( arg_AlreadyRead == fTobeRead )
01391         {
01392           fMyRootFile->PrintNoComment();
01393           fMyRootFile->FileParameters(fFapAnaType,          fFapNbOfSamples,
01394                                       fFapRunNumber,        fFapFirstReqEvtNumber,
01395                                       fFapLastReqEvtNumber, fFapReqNbOfEvts,
01396                                       fFapStexNumber,       fCfgResultsRootFilePath.Data());
01397           OKArray = fMyRootFile->LookAtRootFile();
01398           if( OKArray == kTRUE )
01399             {
01400               fFapNbOfEvts = fMyRootFile->GetNumberOfEvents(fFapReqNbOfEvts);
01401               TString fp_name_short = fMyRootFile->GetRootFileNameShort();
01402               // cout << "*TEcnaHistos::ViewMatrix(...)> Data are analyzed from file ----> "
01403               //      << fp_name_short << endl;
01404               //...................................................................... (ViewMatrix) 
01405               for(Int_t i=0; i<fEcal->MaxStinEcnaInStex(); i++){vStin(i)=(Double_t)0.;}
01406               vStin = fMyRootFile->ReadStinNumbers(fEcal->MaxStinEcnaInStex());
01407 
01408               fStartDate = fMyRootFile->GetStartDate();
01409               fStopDate  = fMyRootFile->GetStopDate();
01410               fRunType   = fMyRootFile->GetRunType();
01411 
01412               if( fMyRootFile->DataExist() == kTRUE ){OKData = kTRUE;}
01413             }
01414 
01415         }
01416       if( arg_AlreadyRead >= 1 )
01417         {
01418           OKArray = kTRUE;
01419           OKData  = kTRUE;
01420           if( fFlagSubDet == "EB") 
01421             {
01422               for(Int_t i=0; i<fEcal->MaxStinEcnaInStex(); i++){vStin(i)=i;}
01423             }
01424           if( fFlagSubDet == "EE") 
01425             {
01426               for(Int_t i=0; i<fEcal->MaxStinEcnaInStex(); i++)
01427                 {vStin(i)= fEcalNumbering->GetDeeSCConsFrom1DeeSCEcna(fFapStexNumber, (Int_t)vStin(i));}
01428             }
01429         }
01430 
01431       if ( OKArray == kTRUE )                         //  (ViewMatrix) 
01432         {
01433           fStatusFileFound = kTRUE;
01434       
01435           if( OKData == kTRUE )
01436             {
01437               fStatusDataExist = kTRUE;
01438 
01439               Int_t Stin_X_ok = 0;
01440               Int_t Stin_Y_ok = 0;
01441           
01442               if( (BetweenWhat == fLFBetweenStins) || (BetweenWhat == fHFBetweenStins) )
01443                 {Stin_X_ok = 1; Stin_Y_ok = 1;}
01444               if( BetweenWhat == fBetweenSamples )
01445                 {Stin_Y_ok = 1;}
01446           
01447               for (Int_t index_Stin = 0; index_Stin < fEcal->MaxStinEcnaInStex(); index_Stin++)
01448                 {
01449                   if ( vStin(index_Stin) == StexStin_A ){Stin_X_ok = 1;}
01450                   if ( vStin(index_Stin) == StexStin_B ){Stin_Y_ok = 1;}
01451                 }
01452               //................................................................. (ViewMatrix)
01453               if( Stin_X_ok == 1 && Stin_Y_ok == 1 )
01454                 {
01455                   Int_t MatSize      = -1; 
01456                   Int_t ReadMatSize  = -1; 
01457                   Int_t i0StinEcha   = -1;
01458               
01459                   //-------------------------- Set values of ReadMatSize, MatSize, i0StinEcha
01460                   if( BetweenWhat == fBetweenSamples )
01461                     {ReadMatSize = fFapNbOfSamples; MatSize = fEcal->MaxSampADC(); i0StinEcha=(Int_t)MatrixBinIndex;}
01462 
01463                   if( BetweenWhat == fLFBetweenChannels || BetweenWhat == fHFBetweenChannels )
01464                     {ReadMatSize = fEcal->MaxCrysInStin(); MatSize = fEcal->MaxCrysInStin(); /*i0Sample=MatrixBinIndex;*/}
01465 
01466                   if( (BetweenWhat == fLFBetweenStins) || (BetweenWhat == fHFBetweenStins) )
01467                     {ReadMatSize = fEcal->MaxStinEcnaInStex(); MatSize = fEcal->MaxStinInStex();}
01468  
01469                   //------------------------------------------------------------------------------------- (ViewMatrix)
01470                   if( ( BetweenWhat == fLFBetweenStins    || BetweenWhat == fHFBetweenStins    ) ||
01471                       ( BetweenWhat == fLFBetweenChannels || BetweenWhat == fHFBetweenChannels 
01472                         /* && (i0Sample  >= 0) && (i0Sample  < fFapNbOfSamples ) */ ) ||
01473                       ( (BetweenWhat == fBetweenSamples) && (i0StinEcha >= 0) && (i0StinEcha < fEcal->MaxCrysInStin()) ) )
01474                     {
01475                       TMatrixD read_matrix(ReadMatSize, ReadMatSize);
01476                       for(Int_t i=0; i<ReadMatSize; i++)
01477                         {for(Int_t j=0; j<ReadMatSize; j++){read_matrix(i,j)=(Double_t)0.;}}
01478                  
01479                       Bool_t OKData = kFALSE;
01480                       if( arg_AlreadyRead == fTobeRead )
01481                         {
01482                           if( BetweenWhat == fBetweenSamples && CorOrCov == fCovarianceMatrix )
01483                             {read_matrix =
01484                                 fMyRootFile->ReadCovariancesBetweenSamples(StexStin_A, i0StinEcha, ReadMatSize);}
01485 
01486                           if( BetweenWhat == fBetweenSamples && CorOrCov == fCorrelationMatrix )
01487                             {read_matrix =
01488                                 fMyRootFile->ReadCorrelationsBetweenSamples(StexStin_A, i0StinEcha, ReadMatSize);}
01489                           
01490                           if( BetweenWhat == fLFBetweenChannels && CorOrCov == fCovarianceMatrix )
01491                             {read_matrix =
01492                                 fMyRootFile->ReadLowFrequencyCovariancesBetweenChannels(StexStin_A, StexStin_B, ReadMatSize);}
01493 
01494                           if( BetweenWhat == fLFBetweenChannels && CorOrCov == fCorrelationMatrix )
01495                             {read_matrix =
01496                                 fMyRootFile->ReadLowFrequencyCorrelationsBetweenChannels(StexStin_A, StexStin_B, ReadMatSize);}
01497                           
01498                           if( BetweenWhat == fHFBetweenChannels && CorOrCov == fCovarianceMatrix )
01499                             {read_matrix =
01500                                 fMyRootFile->ReadHighFrequencyCovariancesBetweenChannels(StexStin_A, StexStin_B, ReadMatSize);}
01501 
01502                           if( BetweenWhat == fHFBetweenChannels && CorOrCov == fCorrelationMatrix )
01503                             {read_matrix =
01504                                 fMyRootFile->ReadHighFrequencyCorrelationsBetweenChannels(StexStin_A, StexStin_B, ReadMatSize);}
01505                           
01506                           if( BetweenWhat == fLFBetweenStins && CorOrCov == fCorrelationMatrix )
01507                             {read_matrix =
01508                                 fMyRootFile->ReadLowFrequencyMeanCorrelationsBetweenStins(ReadMatSize);}
01509 
01510                           if( BetweenWhat == fHFBetweenStins && CorOrCov == fCorrelationMatrix )
01511                             {read_matrix =
01512                                 fMyRootFile->ReadHighFrequencyMeanCorrelationsBetweenStins(ReadMatSize);
01513                             }
01514 
01515                           OKData = fMyRootFile->DataExist();
01516                         }
01517                       else
01518                         {
01519                           read_matrix = arg_read_matrix;
01520                           OKData = kTRUE;
01521                         }
01522                       //.......................................................... (ViewMatrix)
01523                       if( OKData == kTRUE )
01524                         {
01525                           fStatusDataExist = kTRUE;
01526 
01527                           if( PlotOption == "ASCII" )
01528                             {
01529                               WriteMatrixAscii(BetweenWhat, CorOrCov, 
01530                                                StexStin_A, MatrixBinIndex, ReadMatSize, read_matrix);
01531                             }
01532                           else
01533                             {
01534                               //......................... matrix title  (ViewMatrix)
01535                               char* f_in_mat_tit = new char[fgMaxCar];               fCnew++;
01536                           
01537                               if( BetweenWhat == fBetweenSamples && CorOrCov == fCovarianceMatrix )
01538                                 {sprintf(f_in_mat_tit, "Covariance(Sample, Sample')");}
01539                               if( BetweenWhat == fBetweenSamples && CorOrCov == fCorrelationMatrix )
01540                                 {sprintf(f_in_mat_tit, "Correlation(Sample, Sample')");}
01541 
01542                               if(fFlagSubDet == "EB" )
01543                                 {
01544                                   if( BetweenWhat == fLFBetweenStins && CorOrCov == fCorrelationMatrix )
01545                                     {sprintf(f_in_mat_tit,
01546                                              "Mean LF |Cor(Xtal,Xtal')| for each (Tower,Tower')");}
01547                                   if( BetweenWhat == fHFBetweenStins && CorOrCov == fCorrelationMatrix )
01548                                     {sprintf(f_in_mat_tit,
01549                                              "Mean HF |Cor(Xtal,Xtal')| for each (Tower,Tower')");}
01550                                 }
01551                               if(fFlagSubDet == "EE" )
01552                                 {
01553                                   if( BetweenWhat == fLFBetweenStins && CorOrCov == fCorrelationMatrix )
01554                                     {sprintf(f_in_mat_tit,
01555                                              "Mean LF |Cor(Xtal,Xtal')| for each (SC,SC')");}
01556                                   if( BetweenWhat == fHFBetweenStins && CorOrCov == fCorrelationMatrix )
01557                                     {sprintf(f_in_mat_tit,
01558                                              "Mean HF |Cor(Xtal,Xtal')| for each (SC,SC')");}
01559                                 }
01560 
01561                               if( BetweenWhat == fLFBetweenChannels && CorOrCov == fCorrelationMatrix )
01562                                 {
01563                                   if( fFlagSubDet == "EB" )
01564                                     {sprintf(f_in_mat_tit, "LF Cor(Xtal,Xtal') matrix elts for (Tow,Tow')");}
01565                                   if( fFlagSubDet == "EE" )
01566                                     {sprintf(f_in_mat_tit, "LF Cor(Xtal,Xtal') matrix elts for (SC,SC')");}
01567                                 }
01568                               if( BetweenWhat == fHFBetweenChannels && CorOrCov == fCorrelationMatrix )
01569                                 {
01570                                   if( fFlagSubDet == "EB" )
01571                                     {sprintf(f_in_mat_tit, "HF Cor(Xtal,Xtal') matrix elts for (Tow,Tow')");}
01572                                   if( fFlagSubDet == "EE" )
01573                                     {sprintf(f_in_mat_tit, "LF Cor(Xtal,Xtal') matrix elts for (SC,SC')");}
01574                                 }
01575                           
01576                               //................................. Axis parameters (ViewMatrix)
01577                               TString axis_x_var_name;
01578                               TString axis_y_var_name;
01579                           
01580                               char* f_in_axis_x = new char[fgMaxCar];               fCnew++;
01581                               char* f_in_axis_y = new char[fgMaxCar];               fCnew++;
01582                           
01583                               if( BetweenWhat == fLFBetweenStins || BetweenWhat == fHFBetweenStins )
01584                                 {
01585                                   if( fFlagSubDet == "EB" )
01586                                     {sprintf(f_in_axis_x, " %s number  ", fFapStinName.Data());}
01587                                   if( fFlagSubDet == "EE" )
01588                                     {sprintf(f_in_axis_x, " %s number for construction ", fFapStinName.Data());}
01589 
01590                                   axis_x_var_name = f_in_axis_x; axis_y_var_name = f_in_axis_x;
01591                                 }      
01592                               if( BetweenWhat == fBetweenSamples)
01593                                 {
01594                                   axis_x_var_name = " Sample      "; axis_y_var_name = "    Sample ";
01595                                 }
01596                               if( BetweenWhat == fLFBetweenChannels || BetweenWhat == fHFBetweenChannels ){
01597                                 sprintf(f_in_axis_x, " Crystal %s %d   ", fFapStinName.Data(), StexStin_A);
01598                                 sprintf(f_in_axis_y, " Crystal %s %d   ", fFapStinName.Data(),StexStin_B);
01599                                 axis_x_var_name = f_in_axis_x; axis_y_var_name = f_in_axis_y;}
01600                           
01601                               Int_t  nb_binx  = MatSize;
01602                               Int_t  nb_biny  = MatSize;
01603                               Axis_t xinf_bid = (Axis_t)0.;
01604                               Axis_t xsup_bid = (Axis_t)MatSize;
01605                               Axis_t yinf_bid = (Axis_t)0.;
01606                               Axis_t ysup_bid = (Axis_t)MatSize;   
01607                           
01608                               if( (fFlagSubDet == "EE") &&
01609                                   (BetweenWhat == fLFBetweenStins || BetweenWhat == fHFBetweenStins) )
01610                                 {
01611                                   if( fFapStexNumber == 1 || fFapStexNumber == 3 )
01612                                     {
01613                                       xinf_bid += fEcal->MaxStinInStex();
01614                                       xsup_bid += fEcal->MaxStinInStex();
01615                                       yinf_bid += fEcal->MaxStinInStex();
01616                                       ysup_bid += fEcal->MaxStinInStex();
01617                                     }
01618                                 }
01619                               //...................................................  histogram booking (ViewMatrix)
01620                               TH2D* h_fbid0 = new TH2D("bidim", f_in_mat_tit,
01621                                                        nb_binx, xinf_bid, xsup_bid,
01622                                                        nb_biny, yinf_bid, ysup_bid);     fCnewRoot++;
01623                               h_fbid0->Reset();
01624                           
01625                               h_fbid0->GetXaxis()->SetTitle(axis_x_var_name);
01626                               h_fbid0->GetYaxis()->SetTitle(axis_y_var_name);
01627                           
01628                               //------------------------------------------------  F I L L    H I S T O  (ViewMatrix)
01629                               if( (fFlagSubDet == "EE") &&
01630                                   (BetweenWhat == fLFBetweenStins || BetweenWhat == fHFBetweenStins) )
01631                                 {
01632                                   for(Int_t i = 0 ; i < ReadMatSize ; i++)
01633                                     {
01634                                       for(Int_t j = 0 ; j < ReadMatSize ; j++)
01635                                         {
01636                                           Int_t ip = i+1;
01637                                           Double_t xi_bid =
01638                                             (Double_t)fEcalNumbering->GetDeeSCConsFrom1DeeSCEcna(fFapStexNumber, ip);
01639                                           Int_t jp = j+1;
01640                                           Double_t xj_bid =
01641                                             (Double_t)fEcalNumbering->GetDeeSCConsFrom1DeeSCEcna(fFapStexNumber, jp);
01642                                           if( xi_bid > 0 && xj_bid > 0 )
01643                                             {
01644                                               Int_t xi_bid_m = xi_bid-1;
01645                                               Int_t xj_bid_m = xj_bid-1;
01646                                               h_fbid0->Fill(xi_bid_m, xj_bid_m, read_matrix(i,j));
01647                                             }
01648                                         }
01649                                     }
01650                                 }
01651                               else
01652                                 {
01653                                   for(Int_t i = 0 ; i < ReadMatSize ; i++)
01654                                     {
01655                                       Double_t xi = (Double_t)i;
01656                                       for(Int_t j = 0 ; j < ReadMatSize ; j++)
01657                                         {
01658                                           Double_t xj      = (Double_t)j;
01659                                           Double_t mat_val = (Double_t)read_matrix(i,j);
01660                                           h_fbid0->Fill(xi, xj, (Double_t)mat_val);
01661                                         }
01662                                     }
01663                                 }
01664                               //--------------- H I S T O   M I N / M A X   M A N A G E M E N T   (ViewMatrix)
01665                           
01666                               //................................ Put histo min max values
01667                               TString quantity_code = "D_MCs_ChNb";
01668                               if ( CorOrCov == fCorrelationMatrix )
01669                                 {
01670                                   if( BetweenWhat == fBetweenSamples ){quantity_code = "D_MCs_ChNb";}
01671 
01672                                   if( BetweenWhat == fLFBetweenChannels  ){quantity_code = "H2LFccMosMatrix";}
01673                                   if( BetweenWhat == fHFBetweenChannels ){quantity_code = "H2HFccMosMatrix";}
01674 
01675                                   if( BetweenWhat == fLFBetweenStins  ){quantity_code = "H2LFccMosMatrix";}
01676                                   if( BetweenWhat == fHFBetweenStins ){quantity_code = "H2HFccMosMatrix";}
01677                                 }
01678                               if( CorOrCov == fCovarianceMatrix ){quantity_code = "H2HFccMosMatrix";}
01679                               //.......... default if flag not set to "ON"
01680                               SetYminMemoFromValue(quantity_code, fCnaParHistos->GetYminDefaultValue(quantity_code));
01681                               SetYmaxMemoFromValue(quantity_code, fCnaParHistos->GetYmaxDefaultValue(quantity_code));
01682 
01683                               if( fUserHistoMin == fUserHistoMax ){fFlagUserHistoMin = "AUTO"; fFlagUserHistoMax = "AUTO";}
01684                               //................................. User's min and/or max  (ViewMatrix)
01685                               if( fFlagUserHistoMin == "ON" )
01686                                 {SetYminMemoFromValue(quantity_code, fUserHistoMin); fFlagUserHistoMin = "OFF";}
01687                               if( fFlagUserHistoMax == "ON" )
01688                                 {SetYmaxMemoFromValue(quantity_code, fUserHistoMax); fFlagUserHistoMax = "OFF";}
01689                               //................................. automatic min and/or max
01690                               if( fFlagUserHistoMin == "AUTO" )
01691                                 {SetYminMemoFromValue(quantity_code, h_fbid0->GetMinimum()); fFlagUserHistoMin = "OFF";}
01692                               if( fFlagUserHistoMax == "AUTO" )
01693                                 {SetYmaxMemoFromValue(quantity_code, h_fbid0->GetMaximum()); fFlagUserHistoMax = "OFF";}
01694                               //...................................... histo set ymin and ymax  (ViewMatrix)    
01695                               Int_t  xFlagAutoYsupMargin = 0;
01696                           
01697                               if( CorOrCov == fCorrelationMatrix )
01698                                 {
01699                                   if(BetweenWhat == fBetweenSamples)
01700                                     {xFlagAutoYsupMargin = SetHistoFrameYminYmaxFromMemo((TH1D*)h_fbid0, "D_MCs_ChNb");}
01701                                   if( BetweenWhat == fLFBetweenStins  || BetweenWhat == fLFBetweenChannels  )
01702                                     {xFlagAutoYsupMargin = SetHistoFrameYminYmaxFromMemo((TH1D*)h_fbid0, "H2LFccMosMatrix");}
01703                                   if( BetweenWhat == fHFBetweenStins || BetweenWhat == fHFBetweenChannels )
01704                                     {xFlagAutoYsupMargin = SetHistoFrameYminYmaxFromMemo((TH1D*)h_fbid0, "H2HFccMosMatrix");}
01705                                   //************************** A GARDER EN RESERVE ******************************
01706                                   //............. special contour level for correlations (square root wise scale)
01707                                   // Int_t nb_niv  = 9;
01708                                   // Double_t* cont_niv = new Double_t[nb_niv];                  fCnew++;
01709                                   // SqrtContourLevels(nb_niv, &cont_niv[0]);
01710                                   // h_fbid0->SetContour(nb_niv, &cont_niv[0]);           
01711                                   // delete [] cont_niv;                                  fCdelete++;
01712                                   //******************************** (FIN RESERVE) ****************************** 
01713                                 }
01714                               if( CorOrCov == fCovarianceMatrix )
01715                                 {
01716                                   if (BetweenWhat == fBetweenSamples)
01717                                     {SetYminMemoFromPreviousMemo("D_TNo_ChNb");   // covariance => same level as sigmas
01718                                     SetYmaxMemoFromPreviousMemo("D_TNo_ChNb");
01719                                     xFlagAutoYsupMargin = SetHistoFrameYminYmaxFromMemo((TH1D*)h_fbid0, "D_TNo_ChNb");}
01720                                   if ( BetweenWhat == fLFBetweenStins || BetweenWhat == fHFBetweenStins ||
01721                                        BetweenWhat == fLFBetweenChannels || BetweenWhat == fHFBetweenChannels )
01722                                     {xFlagAutoYsupMargin = SetHistoFrameYminYmaxFromMemo((TH1D*)h_fbid0, "H2HFccMosMatrix");}
01723                                 }
01724                           
01725                               // ----------------------------------------------- P L O T S  (ViewMatrix)
01726                               char* f_in = new char[fgMaxCar];          fCnew++;
01727                               //...................... Taille/format canvas
01728                               UInt_t canv_w = fCnaParHistos->CanvasFormatW("petit");
01729                               UInt_t canv_h = fCnaParHistos->CanvasFormatH("petit");
01730                           
01731                               //............................. options generales 
01732                               TString HistoType;
01733                               Int_t MaxCar = fgMaxCar;
01734                               HistoType.Resize(MaxCar);
01735                               HistoType = "(no quantity type info)";
01736                           
01737                               if (PlotOption == "COLZ"  ){HistoType = "colz";}
01738                               if (PlotOption == "BOX"   ){HistoType = "colz";}
01739                               if (PlotOption == "TEXT"  ){HistoType = "colz";}
01740                               if (PlotOption == "CONTZ" ){HistoType = "colz";}
01741                               if (PlotOption == "LEGO2Z"){HistoType = "lego";}
01742                               if (PlotOption == "SURF1Z"){HistoType = "surf";}
01743                               if (PlotOption == "SURF2Z"){HistoType = "surf";}
01744                               if (PlotOption == "SURF3Z"){HistoType = "surf";}
01745                               if (PlotOption == "SURF4" ){HistoType = "surf";}
01746 
01747                               if( fFlagSubDet == "EB" )
01748                                 {
01749                                   fFapStexBarrel = fEcalNumbering->GetSMHalfBarrel(fFapStexNumber);
01750                                   SetAllPavesViewMatrix(BetweenWhat.Data(), StexStin_A, StexStin_B, i0StinEcha);
01751                                 }
01752                               if( fFlagSubDet == "EE" )
01753                                 {
01754                                   fFapStexType = fEcalNumbering->GetEEDeeType(fFapStexNumber);
01755                                   fFapStinQuadType = fEcalNumbering->GetSCQuadFrom1DeeSCEcna(StexStin_A);
01756                                   SetAllPavesViewMatrix(BetweenWhat.Data(), StexStin_A, StexStin_B, i0StinEcha);
01757                                 }
01758 
01759                               //---------------------------------------- Canvas name (ViewMatrix)
01760                               TString  name_cov_cor;
01761                               MaxCar = fgMaxCar;
01762                               name_cov_cor.Resize(MaxCar);
01763                               name_cov_cor = "?";
01764                               if( CorOrCov == fCovarianceMatrix){name_cov_cor = "Covariance";}
01765                               if( CorOrCov == fCorrelationMatrix){name_cov_cor = "Correlation";}
01766                           
01767                               TString name_chan_samp;
01768                               MaxCar = fgMaxCar;
01769                               name_chan_samp.Resize(MaxCar);
01770                               name_chan_samp = "?";
01771                           
01772                               if( BetweenWhat == fLFBetweenStins ){name_chan_samp = "LFccMos";}
01773                               if( BetweenWhat == fHFBetweenStins ){name_chan_samp = "HFccMos"; }
01774 
01775                               if( BetweenWhat == fLFBetweenChannels ){name_chan_samp = "LF_cc";}
01776                               if( BetweenWhat == fHFBetweenChannels ){name_chan_samp = "HF_cc";}
01777                 
01778                               if(BetweenWhat == fBetweenSamples)
01779                                 {
01780                                   name_chan_samp = "Between_Samples";  // MatrixBinIndex = i0StinEcha
01781                                 }
01782 
01783                               TString name_visu;
01784                               MaxCar = fgMaxCar;
01785                               name_visu.Resize(MaxCar);
01786                               name_visu = "?";
01787                           
01788                               name_visu = PlotOption;
01789                           
01790                               if( (BetweenWhat == fLFBetweenStins) || (BetweenWhat == fHFBetweenStins) ){
01791                                 sprintf(f_in, "%s_%s_%s_S1_%d_R%d_%d_%d_%s%d_%s",
01792                                         name_cov_cor.Data(), name_chan_samp.Data(),
01793                                         fFapAnaType.Data(), fFapNbOfSamples, fFapRunNumber,
01794                                         fFapFirstReqEvtNumber, fFapLastReqEvtNumber,
01795                                         fFapStexName.Data(), fFapStexNumber,
01796                                         name_visu.Data());}
01797 
01798                               if( BetweenWhat == fLFBetweenChannels || BetweenWhat == fHFBetweenChannels ){
01799                                 sprintf(f_in, "%s_%s_%s_S1_%d_R%d_%d_%d_%s%d_%sX%d_%sY%d_%s",
01800                                         name_cov_cor.Data(), name_chan_samp.Data(),
01801                                         fFapAnaType.Data(), fFapNbOfSamples, fFapRunNumber,
01802                                         fFapFirstReqEvtNumber, fFapLastReqEvtNumber,
01803                                         fFapStexName.Data(), fFapStexNumber,
01804                                         fFapStexName.Data(), StexStin_A, fFapStexName.Data(), StexStin_B,
01805                                         name_visu.Data());}
01806                                                   
01807                               if( BetweenWhat == fBetweenSamples ){
01808                                 sprintf(f_in, "%s_%s_%s_S1_%d_R%d_%d_%d_%s%d_%sX%d_%sY%d_ElecChannel_%d_%s",
01809                                         name_cov_cor.Data(), name_chan_samp.Data(),
01810                                         fFapAnaType.Data(), fFapNbOfSamples, fFapRunNumber,
01811                                         fFapFirstReqEvtNumber, fFapLastReqEvtNumber,
01812                                         fFapStexName.Data(), fFapStexNumber,
01813                                         fFapStexName.Data(), StexStin_A,  fFapStexName.Data(), StexStin_B,
01814                                         MatrixBinIndex,
01815                                         name_visu.Data());}
01816                           
01817                               //----------------------------------------------------------      (ViewMatrix)
01818 
01819                               SetHistoPresentation((TH1D*)h_fbid0, HistoType);
01820                               TCanvas *MainCanvas = new TCanvas(f_in, f_in, canv_w , canv_h);   fCnewRoot++;
01821                               fCurrentCanvas = MainCanvas; fCurrentCanvasName = f_in;
01822                           
01823                               // cout << "*TEcnaHistos::ViewMatrix(...)> Plot is displayed on canvas ----> "
01824                               //      << fCurrentCanvasName << endl;
01825                               // cout << "*TEcnaHistos::ViewMatrix(...)> fCurrentCanvas = " << fCurrentCanvas << endl;
01826                           
01827                               delete [] f_in; f_in = 0;                         fCdelete++;
01828 
01829                               if( fPavComGeneralTitle != 0 ){fPavComGeneralTitle->Draw();}
01830                               fPavComStex->Draw();
01831 
01832                               if(BetweenWhat == fLFBetweenChannels || BetweenWhat == fHFBetweenChannels)
01833                                 {fPavComStin->Draw();}
01834                               if(BetweenWhat == fBetweenSamples)
01835                                 {fPavComStin->Draw(); fPavComXtal->Draw();}
01836 
01837                               fPavComAnaRun->Draw();
01838                               fPavComNbOfEvts->Draw();
01839 
01840                               Double_t x_margin = fCnaParHistos->BoxLeftX("bottom_left_box") - 0.005;
01841                               Double_t y_margin = fCnaParHistos->BoxTopY("bottom_right_box") + 0.005;
01842                               MainCanvas->Divide(1, 1, x_margin, y_margin);
01843                               gPad->cd(1);
01844 
01845                               //----------------------------------------------------------      (ViewMatrix)      
01846                               Int_t logy = 0;  
01847                               gPad->SetLogy(logy);
01848                               if( (BetweenWhat == fLFBetweenStins) ||
01849                                   (BetweenWhat == fHFBetweenStins) ){gPad->SetGrid(1,1);}
01850                               h_fbid0->DrawCopy(PlotOption);
01851                               h_fbid0->SetStats((Bool_t)1);    
01852                               gPad->Update();
01853                               h_fbid0->Delete();  h_fbid0 = 0;              fCdeleteRoot++;
01854                           
01855                               //MainCanvas->Delete();                 fCdeleteRoot++;
01856                               delete [] f_in_axis_x;  f_in_axis_x  = 0;       fCdelete++;
01857                               delete [] f_in_axis_y;  f_in_axis_y  = 0;       fCdelete++;
01858                               delete [] f_in_mat_tit; f_in_mat_tit = 0;       fCdelete++;
01859                             }
01860                         } // end of if ( OKData == kTRUE )
01861                       else
01862                         {
01863                           fStatusDataExist = kFALSE;
01864                         }
01865                     } // end of if ((BetweenWhat == fLFBetweenStins) || (BetweenWhat == fHFBetweenStins)  ) ||
01866                       //( (BetweenWhat == fBetweenSamples) && (i0StinEcha>= 0) && (i0StinEcha<fEcal->MaxCrysInStin())) ||
01867                       //( (BetweenWhat == fLFBetweenChannels || BetweenWhat == fHFBetweenChannels)
01868                       // /* && (i0Sample  >= 0) && (i0Sample  < fFapNbOfSamples ) */ ) )
01869                   else
01870                     {
01871                       if(BetweenWhat == fBetweenSamples)
01872                         {
01873                           cout << "*TEcnaHistos::ViewMatrix(...)> *ERROR* ==> Wrong channel number in "
01874                                << fFapStinName.Data() << ". Value = "
01875                                << i0StinEcha << " (required range: [0, "
01876                                << fEcal->MaxCrysInStin()-1 << "] )"
01877                                << fTTBELL << endl;
01878                         }
01879 
01880                      // if( BetweenWhat == fLFBetweenChannels || BetweenWhat == fHFBetweenChannels )
01881                      // {
01882                          // cout << "*TEcnaHistos::ViewMatrix(...)> *ERROR* ==> Wrong sample index. Value = "
01883                          //      << i0Sample << " (required range: [0, "
01884                          //      << fFapNbOfSamples-1 << "] )"
01885                          //      << fTTBELL << endl;
01886                         //}
01887                     }
01888                 }
01889               else    // else of the if ( Stin_X_ok ==1 && Stin_Y_ok ==1 )
01890                 {
01891                   //----------------------------------------------------------  (ViewMatrix)
01892                   if ( Stin_X_ok != 1 )
01893                     {
01894                       if( fFlagSubDet == "EB") 
01895                         {
01896                           cout << "*TEcnaHistos::ViewMatrix(...)> *ERROR* =====> "
01897                                << fFapStinName.Data() << " "
01898                                << StexStin_A << ", "
01899                                << fFapStinName.Data() << " not found. Available numbers = ";
01900                           for(Int_t i = 0; i < fEcal->MaxStinEcnaInStex(); i++)
01901                             {
01902                               if( vStin(i) > 0 )
01903                                 {
01904                                   cout << vStin(i) << ", ";
01905                                 }
01906                             }
01907                         }
01908 
01909                       if( fFlagSubDet == "EE") 
01910                         {
01911                           cout << "*TEcnaHistos::ViewMatrix(...)> *ERROR* =====> "
01912                                << fFapStinName.Data() << " "
01913                                << fEcalNumbering->GetDeeSCConsFrom1DeeSCEcna(fFapStexNumber, StexStin_A) << ", "
01914                                << fFapStinName.Data() << " not found. Available numbers = ";
01915                           for(Int_t i = 0; i < fEcal->MaxStinEcnaInStex(); i++)
01916                             {
01917                               if( vStin(i) > 0 )
01918                                 {
01919                                   cout << fEcalNumbering->GetDeeSCConsFrom1DeeSCEcna(fFapStexNumber, (Int_t)vStin(i)) << ", ";
01920                                 }
01921                             }
01922                         }
01923                       cout << fTTBELL << endl;
01924                     }
01925                   if ( Stin_Y_ok != 1 )
01926                     {
01927 
01928                       if( fFlagSubDet == "EB") 
01929                         {
01930                           cout << "*TEcnaHistos::ViewMatrix(...)> *ERROR* =====> "
01931                                << fFapStinName.Data() << " "
01932                                << StexStin_B << ", "
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_B) << ", "
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                 }
01960             } // end of if ( fMyRootFile->DataExist() == kTRUE )
01961           else
01962             {
01963               fStatusDataExist = kFALSE;
01964               cout  << "!TEcnaHistos::ViewMatrix(...)> *ERROR* =====> "
01965                     << " Histo not available." << fTTBELL << endl;
01966               fFlagUserHistoMin = "OFF";
01967               fFlagUserHistoMax = "OFF";
01968             }
01969         } // end of if ( fMyRootFile->LookAtRootFile() == kTRUE )
01970       else
01971         {
01972           fStatusFileFound = kFALSE;
01973           cout  << "!TEcnaHistos::ViewMatrix(...)> *ERROR* =====> "
01974                 << " ROOT file not found" << fTTBELL << endl;
01975         }
01976     } // ---- end of if( (fFapStexNumber > 0) &&  (fFapStexNumber <= fEcal->MaxStexInStas()) ) -----
01977   else
01978     {
01979       cout << "!TEcnaHistos::ViewMatrix(...)> " << fFapStexName.Data()
01980            << " = " << fFapStexNumber << ". Out of range (range = [1,"
01981            << fEcal->MaxStexInStas() << "]) " << fTTBELL << endl;
01982     }
01983 }  // end of ViewMatrix(...)
01984 
01985 //==========================================================================
01986 //
01987 //                         ViewStin   ( => option COLZ )
01988 //   
01989 //==========================================================================
01990 
01991 void TEcnaHistos::CorrelationsBetweenSamples(const Int_t& StinNumber)
01992 {
01993   TString   CorOrCov = fCorrelationMatrix;
01994   ViewStin(StinNumber, CorOrCov);
01995 }
01996 
01997 void TEcnaHistos::CovariancesBetweenSamples(const Int_t& StinNumber)
01998 {
01999   TString   CorOrCov = fCovarianceMatrix;
02000   ViewStin(StinNumber, CorOrCov);
02001 }
02002 
02003 //==========================================================================
02004 //
02005 //                         ViewStin   ( => option COLZ )   
02006 //
02007 //  StexStin ==>
02008 //  (sample,sample) cor or cov matrices for all the crystal of StexStin              
02009 //
02010 //
02011 //==========================================================================
02012 void TEcnaHistos::ViewStin(const Int_t& cStexStin, const TString CorOrCov)
02013 {
02014   //cor(s,s') or cov(s,s') matrices for all the crystals of one given Stin. Option COLZ mandatory.
02015 
02016   // cStexStin = number for cons (in case of EE)
02017   // StexStin   = ECNA number
02018 
02019   if( (fFapStexNumber > 0) &&  fFapStexNumber <= fEcal->MaxStexInStas() )
02020     {
02021       Int_t StexStin =  cStexStin; 
02022       if(fFlagSubDet == "EE" )
02023         {StexStin = fEcalNumbering->Get1DeeSCEcnaFromDeeSCCons(fFapStexNumber, cStexStin);}
02024 
02025       fMyRootFile->PrintNoComment();
02026       fMyRootFile->FileParameters(fFapAnaType,          fFapNbOfSamples,
02027                                   fFapRunNumber,        fFapFirstReqEvtNumber,
02028                                   fFapLastReqEvtNumber, fFapReqNbOfEvts,
02029                                   fFapStexNumber,       fCfgResultsRootFilePath.Data());
02030       
02031       if ( fMyRootFile->LookAtRootFile() == kTRUE )              //  (ViewStin)
02032         {
02033           fStatusFileFound = kTRUE;
02034 
02035           fFapNbOfEvts = fMyRootFile->GetNumberOfEvents(fFapReqNbOfEvts);
02036           TString fp_name_short = fMyRootFile->GetRootFileNameShort(); 
02037           // cout << "*TEcnaHistos::ViewStin(...)> Data are analyzed from file ----> "
02038           //      << fp_name_short << endl;
02039 
02040           TVectorD vStin(fEcal->MaxStinEcnaInStex());
02041           for(Int_t i=0; i<fEcal->MaxStinEcnaInStex(); i++){vStin(i)=(Double_t)0.;}
02042           vStin = fMyRootFile->ReadStinNumbers(fEcal->MaxStinEcnaInStex());
02043 
02044           if ( fMyRootFile->DataExist() == kTRUE )
02045             {
02046               fStatusDataExist = kTRUE;
02047 
02048               Int_t Stin_ok = 0;
02049               for (Int_t index_Stin = 0; index_Stin < fEcal->MaxStinEcnaInStex(); index_Stin++)
02050                 {
02051                   if ( vStin(index_Stin) == StexStin ){Stin_ok++;}
02052                 }
02053 
02054               if( Stin_ok == 1)
02055                 {
02056                   fStartDate = fMyRootFile->GetStartDate();
02057                   fStopDate  = fMyRootFile->GetStopDate();
02058                   fRunType   = fMyRootFile->GetRunType();
02059               
02060                   //......................... matrix title                              (ViewStin)
02061                   char* f_in_mat_tit = new char[fgMaxCar];               fCnew++;
02062               
02063                   if ( CorOrCov == fCovarianceMatrix )
02064                     {sprintf(f_in_mat_tit, "Xtal's Cov(s,s') matrices in %s.",
02065                              fFapStinName.Data());}
02066                   if ( CorOrCov == fCorrelationMatrix )
02067                     {sprintf(f_in_mat_tit, "Xtal's Cor(s,s') matrices in %s.",
02068                              fFapStinName.Data());}
02069 
02070                   //................................. Bidim parameters
02071                   Int_t  GeoBidSize = fEcal->MaxSampADC()*fEcal->MaxCrysHocoInStin(); 
02072                   Int_t  nb_binx  = GeoBidSize;
02073                   Int_t  nb_biny  = GeoBidSize;
02074                   Axis_t xinf_bid = (Axis_t)0.;
02075                   Axis_t xsup_bid = (Axis_t)GeoBidSize;
02076                   Axis_t yinf_bid = (Axis_t)0.;
02077                   Axis_t ysup_bid = (Axis_t)GeoBidSize;   
02078       
02079                   //--------------------------------------------------------- (ViewStin)
02080                   //............. matrices reading and histogram filling
02081       
02082                   TH2D* h_geo_bid = new TH2D("geobidim_ViewStin", f_in_mat_tit,
02083                                              nb_binx, xinf_bid, xsup_bid,
02084                                              nb_biny, yinf_bid, ysup_bid);     fCnewRoot++;
02085           
02086                   h_geo_bid->Reset();
02087 
02088                   //======================================================== (ViewStin)
02089           
02090                   //----------------------------------------------- Geographical bidim filling
02091                   Int_t  ReadMatSize = fFapNbOfSamples;
02092                   Int_t  MatSize     = fEcal->MaxSampADC();
02093                   TMatrixD read_matrix(ReadMatSize, ReadMatSize);
02094                   for(Int_t i=0; i<ReadMatSize; i++){for(Int_t j=0; j<ReadMatSize; j++)
02095                     {read_matrix(i,j)=(Double_t)0.;}}
02096 
02097                   Int_t i_data_exist = 0;
02098 
02099                   for(Int_t n_crys = 0; n_crys < fEcal->MaxCrysInStin(); n_crys++)
02100                     {
02101                       if( CorOrCov == fCovarianceMatrix )
02102                         {read_matrix = fMyRootFile->ReadCovariancesBetweenSamples(StexStin, n_crys, ReadMatSize);}
02103                       if ( CorOrCov == fCorrelationMatrix )
02104                         {read_matrix = fMyRootFile->ReadCorrelationsBetweenSamples(StexStin, n_crys, ReadMatSize);}
02105 
02106                       if( fMyRootFile->DataExist() == kFALSE )
02107                         {
02108                           fStatusDataExist = kFALSE;
02109                           break;   // <= if no data: exiting loop over the channels
02110                         }
02111                       else
02112                         {
02113                           fStatusDataExist = kTRUE;
02114                           i_data_exist++;
02115 
02116                           for(Int_t i_samp = 0 ; i_samp < ReadMatSize ; i_samp++)
02117                             {
02118                               Int_t i_xgeo = GetXSampInStin(fFapStexNumber, StexStin, n_crys, i_samp);
02119                               for(Int_t j_samp = 0; j_samp < ReadMatSize ; j_samp++)
02120                                 {
02121                                   Int_t j_ygeo = GetYSampInStin(fFapStexNumber,
02122                                                                 StexStin,     n_crys, j_samp);
02123                                   h_geo_bid->Fill((Double_t)i_xgeo, (Double_t)j_ygeo,
02124                                                   (Double_t)read_matrix(i_samp, j_samp));
02125                                 }
02126                             }
02127                         }
02128                     }
02129 
02130                   //===========  H I S T O   M I N / M A X   M A N A G E M E N T  ========  (ViewStin)
02131                   //................................ Put histo min max values
02132                   TString quantity_code = "D_MCs_ChNb";
02133                   if( CorOrCov == fCorrelationMatrix ){quantity_code = "D_MCs_ChNb";}
02134                   if( CorOrCov == fCovarianceMatrix ){quantity_code = "H2HFccMosMatrix";}
02135               
02136                   //.......... default if flag not set to "ON"
02137                   SetYminMemoFromValue(quantity_code, fCnaParHistos->GetYminDefaultValue(quantity_code));
02138                   SetYmaxMemoFromValue(quantity_code, fCnaParHistos->GetYmaxDefaultValue(quantity_code));
02139               
02140                   if( fUserHistoMin == fUserHistoMax ){fFlagUserHistoMin = "AUTO"; fFlagUserHistoMax = "AUTO";}
02141                   //.......... user's min and/or max values
02142                   if( fFlagUserHistoMin == "ON" )
02143                     {SetYminMemoFromValue(quantity_code, fUserHistoMin); fFlagUserHistoMin = "OFF";}
02144                   if( fFlagUserHistoMax == "ON" )
02145                     {SetYmaxMemoFromValue(quantity_code, fUserHistoMax); fFlagUserHistoMax = "OFF";}
02146                   //................................. automatic min and/or max
02147                   if( fFlagUserHistoMin == "AUTO" )
02148                     {SetYminMemoFromValue(quantity_code, h_geo_bid->GetMinimum()); fFlagUserHistoMin = "OFF";}
02149                   if( fFlagUserHistoMax == "AUTO" )
02150                     {SetYmaxMemoFromValue(quantity_code, h_geo_bid->GetMaximum()); fFlagUserHistoMax = "OFF";}
02151                   //...................................... histo set ymin and ymax   (ViewStin)
02152                   Int_t  xFlagAutoYsupMargin = 0; 
02153                   if ( CorOrCov == fCorrelationMatrix )
02154                     {xFlagAutoYsupMargin = SetHistoFrameYminYmaxFromMemo((TH1D*)h_geo_bid, "D_MCs_ChNb");
02155                 
02156                     // ************************** A GARDER EN RESERVE *******************************
02157                     //............. special  contour level for correlations (square root wise scale)
02158                     //Int_t nb_niv  = 9;
02159                     //Double_t* cont_niv = new Double_t[nb_niv];                  fCnew++;
02160                     //SqrtContourLevels(nb_niv, &cont_niv[0]);
02161                     //h_geo_bid->SetContour(nb_niv, &cont_niv[0]);            
02162                     //delete [] cont_niv;                                  fCdelete++;
02163                     // ******************************** (FIN RESERVE) *******************************
02164                     }
02165                   if ( CorOrCov == fCovarianceMatrix )
02166                     {xFlagAutoYsupMargin = SetHistoFrameYminYmaxFromMemo((TH1D*)h_geo_bid, "D_TNo_ChNb");}
02167 
02168                   // =================================== P L O T S ========================  (ViewStin)
02169                   if( i_data_exist > 0 )
02170                     {             
02171                       char* f_in = new char[fgMaxCar];                           fCnew++;
02172 
02173                       //...................... Taille/format canvas  
02174                       UInt_t canv_w = fCnaParHistos->CanvasFormatW("petit");
02175                       UInt_t canv_h = fCnaParHistos->CanvasFormatH("petit");
02176                   
02177                       //.................................................. paves commentaires (ViewStin)          
02178                       SetAllPavesViewStin(StexStin);
02179                   
02180                       //------------------------------------ Canvas name ----------------- (ViewStin)  
02181                       TString name_cov_cor;
02182                       Int_t MaxCar = fgMaxCar;
02183                       name_cov_cor.Resize(MaxCar);
02184                       name_cov_cor = "?";
02185                       if( CorOrCov == fCovarianceMatrix ){name_cov_cor = "CovSS_Matrices_in_";}
02186                       if( CorOrCov == fCorrelationMatrix){name_cov_cor = "CorSS_Matrices_in_";}
02187                   
02188                       TString name_visu;
02189                       MaxCar = fgMaxCar;
02190                       name_visu.Resize(MaxCar);
02191                       name_visu = "colz";
02192                   
02193                       sprintf(f_in, "%s_%s_%s_S1_%d_R%d_%d_%d_%s%d_%s%d_%s",
02194                               name_cov_cor.Data(), fFapStinName.Data(),
02195                               fFapAnaType.Data(), fFapNbOfSamples, fFapRunNumber,
02196                               fFapFirstReqEvtNumber, fFapLastReqEvtNumber,
02197                               fFapStexName.Data(), fFapStexNumber,
02198                               fFapStinName.Data(), StexStin, name_visu.Data()); 
02199                   
02200                       SetHistoPresentation((TH1D*)h_geo_bid, "Stin");
02201                   
02202                       TCanvas *MainCanvas = new TCanvas(f_in, f_in, canv_w, canv_h);   fCnewRoot++;
02203                       fCurrentCanvas = MainCanvas; fCurrentCanvasName = f_in;
02204                   
02205                       // cout << "*TEcnaHistos::ViewStin(...)> Plot is displayed on canvas ----> " << f_in << endl;
02206                   
02207                       delete [] f_in; f_in = 0;                                 fCdelete++;
02208                   
02209                       //------------------------ Canvas draw and update ------------ (ViewStin)  
02210                       if( fPavComGeneralTitle != 0 ){fPavComGeneralTitle->Draw();}
02211                       fPavComStex->Draw();
02212                       fPavComStin->Draw();
02213                       fPavComAnaRun->Draw();
02214                       fPavComNbOfEvts->Draw();
02215 
02216                       Double_t x_margin = fCnaParHistos->BoxLeftX("bottom_left_box") - 0.005;
02217                       Double_t y_margin = fCnaParHistos->BoxTopY("bottom_right_box") + 0.005;             
02218                       MainCanvas->Divide(1, 1, x_margin, y_margin);
02219                       gPad->cd(1);
02220 
02221                       Int_t logy = 0;  
02222                       gPad->SetLogy(logy);
02223                   
02224                       h_geo_bid->DrawCopy("COLZ");
02225                   
02226                       //--------------------------------------------------------------------------- (ViewStin)       
02227                       Int_t size_Hoco    = fEcal->MaxCrysHocoInStin();
02228                       Int_t size_Veco    = fEcal->MaxCrysVecoInStin();
02229                   
02230                       ViewStinGrid(fFapStexNumber, StexStin, MatSize, size_Hoco, size_Veco, " ");
02231                   
02232                       gPad->Update();
02233                   
02234                       h_geo_bid->SetStats((Bool_t)1);    
02235 
02236                       //      delete MainCanvas;              fCdeleteRoot++;
02237                     }
02238                   delete [] f_in_mat_tit;   f_in_mat_tit = 0;        fCdelete++;
02239                   
02240                   h_geo_bid->Delete();   h_geo_bid = 0;             fCdeleteRoot++;
02241                 }
02242               else
02243                 {
02244                   cout << "!TEcnaHistos::ViewStin(...)> *ERROR* =====> "
02245                        << fFapStinName.Data() << " "
02246                        << cStexStin << " not found."
02247                        << " Available numbers = ";
02248                   for(Int_t i = 0; i < fEcal->MaxStinEcnaInStex(); i++)
02249                     {
02250                       if( vStin(i) > 0 )
02251                         {
02252                           if( fFlagSubDet == "EB" ){cout << (Int_t)vStin(i) << ", ";}
02253                           if( fFlagSubDet == "EE" )
02254                             {cout << fEcalNumbering->GetDeeSCConsFrom1DeeSCEcna(fFapStexNumber, (Int_t)vStin(i)) << ", ";}
02255                         }
02256                     }
02257                   cout << fTTBELL << endl;  
02258                 }
02259             }  // end of if ( myRootFile->DataExist() == kTRUE )
02260           else
02261             {
02262               fStatusDataExist = kFALSE;
02263             }
02264         } // end of if ( fMyRootFile->LookAtRootFile() == kTRUE )
02265       else
02266         {
02267           fStatusFileFound = kFALSE;
02268 
02269           cout << "!TEcnaHistos::ViewStin(...)> *ERROR* =====> "
02270                << " ROOT file not found" << fTTBELL << endl;
02271         }
02272     }
02273   else
02274     {
02275       cout << "!TEcnaHistos::ViewStin(...)> " << fFapStexName.Data()
02276            << " = " << fFapStexNumber << ". Out of range (range = [1,"
02277            << fEcal->MaxStexInStas() << "]) " << fTTBELL << endl;
02278     }
02279 }  // end of ViewStin(...)
02280 
02281 //====================================================================================
02282 //
02283 //                         StinCrystalNumbering
02284 //              independent of the ROOT file => StexNumber as argument
02285 //
02286 //====================================================================================  
02287 void TEcnaHistos::StinCrystalNumbering(const Int_t& StexNumber, const Int_t& cStexStin)
02288 {
02289 //display the crystal numbering of one Stin
02290 // cStexStin = Tower number in case of EB or SC number for construction in case of EE
02291 
02292   if( fFlagSubDet == "EB" ){TowerCrystalNumbering(StexNumber, cStexStin);}
02293   if( fFlagSubDet == "EE" ){SCCrystalNumbering(StexNumber, cStexStin);}
02294 }
02295 //---------------->  end of StinCrystalNumbering()
02296 
02297 //====================================================================================
02298 //
02299 //                         TowerCrystalNumbering
02300 //              independent of the ROOT file => SMNumber as argument
02301 //
02302 //====================================================================================  
02303 void TEcnaHistos::TowerCrystalNumbering(const Int_t& SMNumber, const Int_t& n1SMTow)
02304 {
02305   //display the crystal numbering of one tower
02306 
02307   if( (SMNumber > 0) && (SMNumber <= fEcal->MaxSMInEB()) )
02308     {
02309       fFapStexBarrel = fEcalNumbering->GetSMHalfBarrel(SMNumber);
02310 
02311       Int_t MatSize   = fEcal->MaxSampADC();
02312       Int_t size_eta  = fEcal->MaxCrysEtaInTow();
02313       Int_t size_phi  = fEcal->MaxCrysPhiInTow();
02314 
02315       //---------------------------------- bidim
02316 
02317       Int_t nb_bins  = fEcal->MaxSampADC();
02318       Int_t nx_gbins = nb_bins*size_eta;
02319       Int_t ny_gbins = nb_bins*size_phi;
02320 
02321       Axis_t xinf_gbid = (Axis_t)0.;
02322       Axis_t xsup_gbid = (Axis_t)fEcal->MaxSampADC()*size_eta;
02323       Axis_t yinf_gbid = (Axis_t)0.;
02324       Axis_t ysup_gbid = (Axis_t)fEcal->MaxSampADC()*size_phi;
02325 
02326       TString fg_name = "M0' crystals";
02327       TString fg_tit  = "Xtal numbering (chan. in tow, chan. in SM, Xtal in SM, hashed)"; 
02328  
02329       //----------------------- empty 2D histo for pave coordinates registration
02330       TH2D *h_gbid;
02331       h_gbid = new TH2D(fg_name.Data(),  fg_tit.Data(),
02332                         nx_gbins, xinf_gbid, xsup_gbid,
02333                         ny_gbins, yinf_gbid, ysup_gbid);    fCnewRoot++;
02334       h_gbid->Reset();
02335 
02336       //-----------------  T R A C E  D E S   P L O T S ------ (TowerCrystalNumbering)
02337 
02338       char* f_in = new char[fgMaxCar];                           fCnew++;
02339           
02340       //...................... Taille/format canvas
02341   
02342       UInt_t canv_w = fCnaParHistos->CanvasFormatW("petit");
02343       UInt_t canv_h = fCnaParHistos->CanvasFormatH("petit");
02344 
02345       //........................................ couleurs
02346       Color_t couleur_noir       = fCnaParHistos->SetColorsForNumbers("crystal");
02347       Color_t couleur_rouge      = fCnaParHistos->SetColorsForNumbers("lvrb_top");
02348       Color_t couleur_bleu_fonce = fCnaParHistos->SetColorsForNumbers("lvrb_bottom");
02349 
02350       gStyle->SetPalette(1,0);          // Rainbow spectrum
02351 
02352       //.................................... options generales
02353       fCnaParHistos->SetViewHistoStyle("Stin");
02354           
02355       //.................................... paves commentaires (TowerCrystalNumbering)
02356   
02357       SetAllPavesViewStinCrysNb(SMNumber, n1SMTow);
02358  
02359       //---------------------------------------------- (TowerCrystalNumbering)
02360 
02361       //..................... Canvas name
02362       sprintf(f_in, "Crystal_Numbering_for_%s_X_%d_%s%d",
02363               fFapStinName.Data(), n1SMTow, fFapStexName.Data(), SMNumber);
02364   
02365       SetHistoPresentation((TH1D*)h_gbid, "Stin");
02366 
02367       TCanvas *MainCanvas = new TCanvas(f_in, f_in, canv_w , canv_h);    fCnewRoot++;
02368       fCurrentCanvas = MainCanvas; fCurrentCanvasName = f_in;
02369 
02370       // cout << "*TEcnaHistosEB::TowerCrystalNumbering(...)> Plot is displayed on canvas ----> "
02371       //      << f_in << endl;
02372 
02373       Double_t x_margin = fCnaParHistos->BoxLeftX("bottom_left_box") - 0.005;
02374       Double_t y_margin = fCnaParHistos->BoxTopY("bottom_right_box") + 0.005;  
02375       MainCanvas->Divide(1, 1, x_margin, y_margin);
02376 
02377       fPavComStex->Draw();
02378       fPavComStin->Draw();
02379       fPavComLVRB->Draw();
02380   
02381       Bool_t b_true = 1; 
02382       Bool_t b_false = 0;
02383       gPad->cd(1);
02384 
02385       gStyle->SetMarkerColor(couleur_rouge);
02386   
02387       Int_t logy = 0;
02388       gPad->SetLogy(logy);
02389   
02390       //............................... bidim .......... (TowerCrystalNumbering)   
02391 
02392       h_gbid->SetStats(b_false);
02393       h_gbid->DrawCopy("COLZ");
02394     
02395       //..... Ecriture des numeros de channels dans la grille..... (TowerCrystalNumbering)
02396       //      et des numeros SM des cristaux
02397 
02398       //............... prepa arguments fixes appels [TText]->DrawText()
02399       char* f_in_elec = new char[fgMaxCar];                                         fCnew++;
02400       TString TowerLvrbType = fEcalNumbering->GetTowerLvrbType(n1SMTow) ;
02401       TText *text_elec_num = new TText();                                           fCnewRoot++;
02402       if ( TowerLvrbType == "top"    ){text_elec_num->SetTextColor(couleur_rouge);}
02403       if ( TowerLvrbType == "bottom" ){text_elec_num->SetTextColor(couleur_bleu_fonce);}
02404       text_elec_num->SetTextSize(0.04);
02405 
02406       char* f_in_sme = new char[fgMaxCar];                                         fCnew++;
02407       TText *text_sme_num = new TText();                                           fCnewRoot++;
02408       if ( TowerLvrbType == "top"    ){text_sme_num->SetTextColor(couleur_rouge);}
02409       if ( TowerLvrbType == "bottom" ){text_sme_num->SetTextColor(couleur_bleu_fonce);}
02410       text_sme_num->SetTextSize(0.03);
02411 
02412       char* f_in_sm = new char[fgMaxCar];                                             fCnew++;
02413       TText *text_sm_num = new TText();                                               fCnewRoot++;
02414       text_sm_num->SetTextColor(couleur_noir);
02415       text_sm_num->SetTextSize(0.03);
02416 
02417       char* f_in_hsd = new char[fgMaxCar];                                             fCnew++;
02418       TText *text_hsd_num = new TText();                                               fCnewRoot++;
02419       text_hsd_num->SetTextColor(couleur_noir);
02420       text_hsd_num->SetTextSize(0.03);
02421 
02422       //............... prepa arguments fixes appels GetXGeo(...) et GetYGeo(...)
02423       Int_t    i_samp  = 0;
02424       //Double_t off_set = (Double_t)(fEcal->MaxSampADC()/4);
02425       Double_t off_set = (Double_t)1.;
02426 
02427       //------------------ LOOP ON THE CRYSTAL ELECTRONIC CHANNEL NUMBER  (TowerCrystalNumbering)
02428 
02429       for (Int_t i_chan = 0; i_chan < fEcal->MaxCrysInTow(); i_chan++)
02430         {
02431           Int_t i_xgeo = GetXSampInStin(SMNumber, n1SMTow, i_chan, i_samp);
02432           Int_t i_ygeo = GetYSampInStin(SMNumber, n1SMTow, i_chan, i_samp);
02433 
02434           Double_t xgi     =  i_xgeo + 3.*off_set;
02435           Double_t ygj     =  i_ygeo + 7.*off_set;
02436 
02437           Double_t xgi_sme =  i_xgeo + 3.*off_set;
02438           Double_t ygj_sme =  i_ygeo + 5.*off_set;
02439 
02440           Double_t xgi_sm  =  i_xgeo + 3.*off_set;
02441           Double_t ygj_sm  =  i_ygeo + 3.*off_set;
02442 
02443           Double_t xgi_hsd =  i_xgeo + 3.*off_set;
02444           Double_t ygj_hsd =  i_ygeo + 1.*off_set;
02445 
02446           Int_t i_crys_sme = fEcalNumbering->Get0SMEchaFrom1SMTowAnd0TowEcha(n1SMTow, i_chan);
02447           Int_t i_crys_sm  = fEcalNumbering->Get1SMCrysFrom1SMTowAnd0TowEcha(n1SMTow, i_chan);
02448 
02449           Double_t Eta = fEcalNumbering->GetEta(SMNumber, n1SMTow, i_chan);
02450           Double_t Phi = fEcalNumbering->GetPhi(SMNumber, n1SMTow, i_chan);
02451 
02452           Int_t i_crys_hsd = fEcalNumbering->GetHashedNumberFromIEtaAndIPhi((Int_t)Eta, (Int_t)Phi);
02453 
02454           //------------------------------------------------------- TowerCrystalNumbering
02455 
02456           sprintf(f_in_elec, "%d", i_chan);
02457           text_elec_num->DrawText(xgi, ygj, f_in_elec);
02458 
02459           sprintf(f_in_sme, "%d", i_crys_sme);
02460           text_sme_num->DrawText(xgi_sme, ygj_sme, f_in_sme);
02461 
02462           sprintf(f_in_sm, "%d", i_crys_sm);
02463           text_sm_num->DrawText(xgi_sm, ygj_sm, f_in_sm);
02464 
02465           sprintf(f_in_hsd, "%d", i_crys_hsd);
02466           text_sm_num->DrawText(xgi_hsd, ygj_hsd, f_in_hsd);
02467         }
02468       text_sm_num->Delete();   text_sm_num   = 0;        fCdeleteRoot++;
02469       text_sme_num->Delete();  text_sme_num  = 0;        fCdeleteRoot++;
02470       text_elec_num->Delete(); text_elec_num = 0;        fCdeleteRoot++;
02471       text_hsd_num->Delete();  text_hsd_num  = 0;        fCdeleteRoot++;
02472 
02473       ViewStinGrid(SMNumber, n1SMTow, MatSize, size_eta, size_phi, "CrystalNumbering");
02474 
02475       gPad->Update();
02476       h_gbid->SetStats(b_true);
02477 
02478       h_gbid->Delete();     h_gbid = 0;             fCdeleteRoot++;
02479 
02480       delete [] f_in;       f_in      = 0;          fCdelete++; 
02481       delete [] f_in_sm;    f_in_sm   = 0;          fCdelete++;
02482       delete [] f_in_sme;   f_in_sme  = 0;          fCdelete++;
02483       delete [] f_in_elec;  f_in_elec = 0;          fCdelete++;
02484     }
02485   else
02486     {
02487       cout << "!TEcnaHistos::TowerCrystalNumbering(...)> SM = " << SMNumber
02488            << ". Out of range ( range = [1," << fEcal->MaxSMInEB() << "] )" << fTTBELL << endl;
02489     }
02490 }
02491 //---------------->  end of TowerCrystalNumbering()
02492 
02493 //====================================================================================
02494 //
02495 //                         SCCrystalNumbering
02496 //              independent of the ROOT file => DeeNumber and n1DeeSCEcna as argument
02497 //
02498 //====================================================================================  
02499 void TEcnaHistos::SCCrystalNumbering(const Int_t& DeeNumber, const Int_t& n1DeeSCCons)
02500 {
02501   //display the crystal numbering of one SC
02502 
02503   if( (DeeNumber > 0) && (DeeNumber <= fEcal->MaxDeeInEE()) )
02504     {
02505       Int_t n1DeeSCEcna = fEcalNumbering->Get1DeeSCEcnaFromDeeSCCons(DeeNumber, n1DeeSCCons);
02506       fFapStexType      = fEcalNumbering->GetEEDeeType(DeeNumber);
02507       fFapStinQuadType  = fEcalNumbering->GetSCQuadFrom1DeeSCEcna(n1DeeSCEcna);
02508 
02509       //Int_t MatSize  = fEcal->MaxSampADC();
02510       Int_t size_IX  = fEcal->MaxCrysIXInSC();
02511       Int_t size_IY  = fEcal->MaxCrysIYInSC();
02512 
02513       //---------------------------------- bidim
02514 
02515       Int_t nb_bins  = fEcal->MaxSampADC();
02516       Int_t nx_gbins = nb_bins*size_IX;
02517       Int_t ny_gbins = nb_bins*size_IY;
02518 
02519       Axis_t xinf_gbid = (Axis_t)0.;
02520       Axis_t xsup_gbid = (Axis_t)fEcal->MaxSampADC()*size_IX;
02521       Axis_t yinf_gbid = (Axis_t)0.;
02522       Axis_t ysup_gbid = (Axis_t)fEcal->MaxSampADC()*size_IY;
02523 
02524       TString fg_name = "crystalnbring";
02525       TString fg_tit  = "Xtal numbering for construction"; 
02526   
02527       TH2D *h_gbid;
02528       h_gbid = new TH2D(fg_name.Data(),  fg_tit.Data(),
02529                         nx_gbins, xinf_gbid, xsup_gbid,
02530                         ny_gbins, yinf_gbid, ysup_gbid);    fCnewRoot++;
02531       h_gbid->Reset();
02532 
02533       //-----------------  T R A C E  D E S   P L O T S ------ (SCCrystalNumbering)
02534 
02535       char* f_in = new char[fgMaxCar];                           fCnew++;
02536           
02537       //...................... Taille/format canvas
02538   
02539       UInt_t canv_w = fCnaParHistos->CanvasFormatW("petit");
02540       UInt_t canv_h = fCnaParHistos->CanvasFormatH("petit");
02541       //........................................ couleurs
02542       // Color_t couleur_noir       = fCnaParHistos->ColorDefinition("noir");
02543       Color_t couleur_rouge      = fCnaParHistos->ColorDefinition("rouge");
02544       // Color_t couleur_bleu_fonce = fCnaParHistos->ColorDefinition("bleu_fonce");
02545 
02546       gStyle->SetPalette(1,0);          // Rainbow spectrum
02547       //.................................... options generales
02548       fCnaParHistos->SetViewHistoStyle("Stin");
02549           
02550       //.................................... paves commentaires (SCCrystalNumbering)
02551       SetAllPavesViewStinCrysNb(DeeNumber, n1DeeSCEcna);
02552 
02553       //---------------------------------------------- (SCCrystalNumbering)
02554       //..................... Canvas name
02555       sprintf(f_in, "Crystal_Numbering_for_%s_X_%d_%s%d",
02556               fFapStinName.Data(), n1DeeSCEcna,  fFapStexName.Data(), DeeNumber);
02557 
02558       SetHistoPresentation((TH1D*)h_gbid, "Stin");
02559 
02560       TCanvas *MainCanvas = new TCanvas(f_in, f_in, canv_w , canv_h);    fCnewRoot++;
02561       fCurrentCanvas = MainCanvas; fCurrentCanvasName = f_in;
02562 
02563       // cout << "*TEcnaHistosEE::SCCrystalNumbering(...)> Plot is displayed on canvas ----> "
02564       //      << f_in << endl;
02565 
02566       Double_t x_margin = fCnaParHistos->BoxLeftX("bottom_left_box") - 0.005;
02567       Double_t y_margin = fCnaParHistos->BoxTopY("bottom_right_box") + 0.005;
02568 
02569       MainCanvas->Divide(1, 1, x_margin, y_margin);
02570 
02571       fPavComStex->Draw();
02572       fPavComStin->Draw();
02573       fPavComCxyz->Draw();
02574 
02575       Bool_t b_true  = 1; 
02576       Bool_t b_false = 0;
02577       gPad->cd(1);
02578 
02579       gStyle->SetMarkerColor(couleur_rouge);
02580   
02581       Int_t logy = 0;
02582       gPad->SetLogy(logy);
02583   
02584       //............................... bidim .......... (SCCrystalNumbering)   
02585       h_gbid->SetStats(b_false); 
02586       fCnaParHistos->SetViewHistoOffsets((TH1D*)h_gbid, "Stin", " ");
02587       h_gbid->DrawCopy("COLZ");
02588 
02589       //..... Ecriture des numeros de channels dans la grille..... (SCCrystalNumbering)
02590       //      et des numeros Dee des cristaux
02591       TString SCQuadType = fEcalNumbering->GetSCQuadFrom1DeeSCEcna(n1DeeSCEcna);
02592       TString DeeDir     = fEcalNumbering->GetDeeDirViewedFromIP(DeeNumber);
02593       TString DeeEndcap  = fEcalNumbering->GetEEDeeEndcap(DeeNumber);
02594       Color_t couleur_SC = GetSCColor(DeeEndcap, DeeDir, SCQuadType);
02595       //............... prepa arguments fixes appels [TText]->DrawText()
02596       char* f_in_elec = new char[fgMaxCar];                                           fCnew++;
02597       TText *text_elec_num   = new TText();                                           fCnewRoot++;
02598       text_elec_num->SetTextColor(couleur_SC);
02599       text_elec_num->SetTextSize(0.06);
02600 
02601       //............... prepa arguments fixes appels GetXGeo(...) et GetYGeo(...)
02602       Int_t    i_samp  = 0;
02603       Double_t off_set = (Double_t)(fEcal->MaxSampADC()/3);
02604 
02605       //------------------ LOOP ON THE CRYSTAL ELECTRONIC CHANNEL NUMBER  (SCCrystalNumbering)
02606 
02607       for (Int_t i_chan = 0; i_chan < fEcal->MaxCrysInSC(); i_chan++)
02608         {
02609           Int_t i_xgeo = GetXSampInStin(DeeNumber, n1DeeSCEcna, i_chan, i_samp);
02610           Int_t i_ygeo = GetYSampInStin(DeeNumber, n1DeeSCEcna, i_chan, i_samp);
02611 
02612           Double_t xgi = i_xgeo + off_set;
02613           Double_t ygj = i_ygeo + 2*off_set;
02614 
02615           //------------------------------------------------------- SCCrystalNumbering
02616           Int_t i_chan_p = i_chan+1;
02617           sprintf(f_in_elec, "%d", i_chan_p);   // offset = +1 (Xtal for construction numbering, CMS NOTE 2006/027)
02618           text_elec_num->DrawText(xgi, ygj, f_in_elec);
02619         }
02620       text_elec_num->Delete();   text_elec_num = 0;           fCdeleteRoot++;
02621 
02622       ViewStinGrid(DeeNumber, n1DeeSCEcna, fEcal->MaxSampADC(), size_IX, size_IY, "CrystalNumbering");
02623 
02624       gPad->Update();
02625       h_gbid->SetStats(b_true);
02626 
02627       h_gbid->Delete();     h_gbid = 0;                         fCdeleteRoot++;
02628 
02629       delete [] f_in;       f_in      = 0;          fCdelete++; 
02630       delete [] f_in_elec;  f_in_elec = 0;          fCdelete++;
02631     }
02632   else
02633     {
02634       cout << "!TEcnaHistos::SCCrystalNumbering(...)> Dee = " << DeeNumber
02635            << ". Out of range ( range = [1," << fEcal->MaxDeeInEE() << "] )" << fTTBELL << endl;
02636     }
02637 }
02638 //---------------->  end of SCCrystalNumbering()
02639               
02640 //==================================================================================
02641 //
02642 //                       GetXSampInStin, GetYSampInStin
02643 //
02644 //==================================================================================
02645 Int_t TEcnaHistos::GetXSampInStin(const Int_t& StexNumber,  const Int_t& StexStin,
02646                                   const Int_t& i0StinEcha,  const Int_t& i_samp) 
02647 {
02648 //Gives the X coordinate in the geographic view of one Stin
02649 
02650   Int_t ix_geo = -1;
02651 
02652   if( fFlagSubDet == "EB" )
02653     {TString ctype = fEcalNumbering->GetStinLvrbType(StexStin);
02654     TString btype = fEcalNumbering->GetStexHalfStas(StexNumber);
02655     if( (btype == "EB+" && ctype == "bottom")  || (btype == "EB-" && ctype == "top") )
02656       {ix_geo = ( (fEcal->MaxCrysHocoInStin()-1)-(i0StinEcha/fEcal->MaxCrysHocoInStin()) )
02657          *fEcal->MaxSampADC() + i_samp;}
02658     if( (btype == "EB+" &&  ctype  == "top")   || (btype == "EB-" && ctype == "bottom") )
02659       {ix_geo = ( i0StinEcha/fEcal->MaxCrysHocoInStin() )*fEcal->MaxSampADC() + i_samp;}}
02660   
02661   if( fFlagSubDet == "EE" )
02662     {  TString DeeDir = fEcalNumbering->GetDeeDirViewedFromIP(StexNumber);
02663     if( DeeDir == "right" )
02664       {ix_geo = (fEcalNumbering->GetIXCrysInSC(StexNumber, StexStin, i0StinEcha)-1)*fEcal->MaxSampADC() + i_samp;}
02665     if( DeeDir == "left"  )
02666       {ix_geo = (fEcal->MaxCrysHocoInStin() - fEcalNumbering->GetIXCrysInSC(StexNumber, StexStin, i0StinEcha))*
02667          fEcal->MaxSampADC() + i_samp;}}
02668 
02669   return ix_geo;
02670 }
02671 //--------------------------------------------------------------------------------------------
02672 Int_t TEcnaHistos::GetYSampInStin(const Int_t& StexNumber, const Int_t& StexStin,
02673                                   const Int_t& i0StinEcha, const Int_t& j_samp)
02674 {
02675 //Gives the Y coordinate in the geographic view of one Stin
02676 
02677   Int_t jy_geo = -1;
02678 
02679   if( fFlagSubDet == "EB" )
02680     {
02681       TString ctype = fEcalNumbering->GetStinLvrbType(StexStin);
02682       TString btype = fEcalNumbering->GetStexHalfStas(StexNumber);
02683       
02684       //.......................... jy_geo for the EB+ (and beginning for the EB-)
02685       
02686       if( (btype == "EB+" && ctype == "top")    ||  (btype == "EB-" && ctype == "bottom") )
02687         {
02688           if( i0StinEcha >=  0 && i0StinEcha <=  4 ) {jy_geo =  (i0StinEcha -  0)*fEcal->MaxSampADC() + j_samp;}
02689           if( i0StinEcha >=  5 && i0StinEcha <=  9 ) {jy_geo = -(i0StinEcha -  9)*fEcal->MaxSampADC() + j_samp;}
02690           if( i0StinEcha >= 10 && i0StinEcha <= 14 ) {jy_geo =  (i0StinEcha - 10)*fEcal->MaxSampADC() + j_samp;}
02691           if( i0StinEcha >= 15 && i0StinEcha <= 19 ) {jy_geo = -(i0StinEcha - 19)*fEcal->MaxSampADC() + j_samp;}
02692           if( i0StinEcha >= 20 && i0StinEcha <= 24 ) {jy_geo =  (i0StinEcha - 20)*fEcal->MaxSampADC() + j_samp;}
02693         }
02694       
02695       if( (btype == "EB+" && ctype == "bottom") ||  (btype == "EB-" && ctype == "top") )
02696         {
02697           if( i0StinEcha >=  0 && i0StinEcha <=  4 )
02698             {jy_geo = ( (fEcal->MaxCrysVecoInStin()-1) - (i0StinEcha- 0))*fEcal->MaxSampADC() + j_samp;}  
02699           if( i0StinEcha >=  5 && i0StinEcha <=  9 )
02700             {jy_geo = ( (fEcal->MaxCrysVecoInStin()-1) + (i0StinEcha- 9))*fEcal->MaxSampADC() + j_samp;}
02701           if( i0StinEcha >= 10 && i0StinEcha <= 14 )
02702             {jy_geo = ( (fEcal->MaxCrysVecoInStin()-1) - (i0StinEcha-10))*fEcal->MaxSampADC() + j_samp;}
02703           if( i0StinEcha >= 15 && i0StinEcha <= 19 )
02704             {jy_geo = ( (fEcal->MaxCrysVecoInStin()-1) + (i0StinEcha-19))*fEcal->MaxSampADC() + j_samp;}
02705           if( i0StinEcha >= 20 && i0StinEcha <= 24 )
02706             {jy_geo = ( (fEcal->MaxCrysVecoInStin()-1) - (i0StinEcha-20))*fEcal->MaxSampADC() + j_samp;}
02707         }
02708     }
02709   
02710   if( fFlagSubDet == "EE" )
02711     {jy_geo =
02712     (fEcalNumbering->GetJYCrysInSC(StexNumber, StexStin, i0StinEcha) - 1)*fEcal->MaxSampADC() + j_samp;}
02713 
02714   return jy_geo;
02715 }
02716 
02717 //===============================================================================
02718 //
02719 //                           ViewStinGrid
02720 //              independent of the ROOT file => StexNumber as argument
02721 //
02722 //===============================================================================
02723 void TEcnaHistos::ViewStinGrid(const Int_t& StexNumber, 
02724                                const Int_t&  StexStin,   const Int_t& MatSize,
02725                                const Int_t&  size_Hoco,  const Int_t& size_Veco,
02726                                const TString chopt)
02727 {
02728   //Grid of one Stin with axis Hoco and Veco
02729 
02730   if( fFlagSubDet == "EB"){ViewTowerGrid(StexNumber, StexStin, MatSize,
02731                                          size_Hoco,   size_Veco,  chopt);}
02732   if( fFlagSubDet == "EE"){ViewSCGrid(StexNumber, StexStin, MatSize,
02733                                       size_Hoco,   size_Veco,  chopt);}
02734 
02735 } // end of ViewStinGrid
02736 
02737 //===============================================================================
02738 //
02739 //                           ViewTowerGrid
02740 //              independent of the ROOT file => SMNumber as argument
02741 //
02742 //===============================================================================
02743 void TEcnaHistos::ViewTowerGrid(const Int_t&  SMNumber, 
02744                                 const Int_t&  n1SMTow,  const Int_t& MatSize,
02745                                 const Int_t&  size_eta, const Int_t& size_phi,
02746                                 const TString chopt)
02747 {
02748   //Grid of one tower with axis eta and phi
02749   //.......................... lignes verticales
02750   Double_t xline = 0.;
02751   
02752   Double_t yline_bot = 0.;
02753   Double_t yline_top = (Double_t)(MatSize*size_eta);
02754   
02755   for( Int_t i = 0 ; i < size_eta ; i++)
02756     {  
02757       xline = xline + (Double_t)MatSize;
02758       TLine *lin;
02759       lin = new TLine(xline, yline_bot, xline, yline_top); fCnewRoot++;
02760       lin->Draw();
02761       // delete lin;             fCdeleteRoot++;
02762     }
02763   //............................. lignes horizontales
02764   Double_t xline_left  = 0;
02765   Double_t xline_right = (Double_t)(MatSize*size_eta);
02766   
02767   Double_t yline = -(Double_t)MatSize;
02768   
02769   for( Int_t j = 0 ; j < size_eta+1 ; j++)
02770     {
02771       yline = yline + (Double_t)MatSize;
02772       TLine *lin;
02773       lin = new TLine(xline_left, yline, xline_right, yline); fCnewRoot++;
02774       lin->Draw();
02775       // delete lin;             fCdeleteRoot++;
02776     }
02777  
02778   //------------------ trace axes en eta et phi --------------- ViewTowerGrid
02779 
02780   //...................................................... Axe i(eta) (x bottom)  (ViewTowerGrid)
02781 
02782   Double_t eta_min = fEcalNumbering->GetIEtaMin(SMNumber, n1SMTow);
02783   Double_t eta_max = fEcalNumbering->GetIEtaMax(SMNumber, n1SMTow);
02784 
02785   TString  x_var_name  = GetEtaPhiAxisTitle("ietaTow");
02786   TString  x_direction = fEcalNumbering->GetXDirectionEB(SMNumber);
02787 
02788   Float_t tit_siz_x = fCnaParHistos->AxisTitleSize();
02789   Float_t lab_siz_x = fCnaParHistos->AxisLabelSize();
02790   Float_t tic_siz_x = fCnaParHistos->AxisTickSize();
02791   Float_t tit_off_x = fCnaParHistos->AxisTitleOffset("Towx");
02792   Float_t lab_off_x = fCnaParHistos->AxisLabelOffset("Towx");
02793   
02794   TF1 *f1 = new TF1("f1", x_direction.Data(), eta_min, eta_max);                fCnewRoot++;
02795 
02796   TGaxis* sup_axis_x = 0;
02797 
02798   if ( x_direction == "-x" )   // NEVER  IN THIS CASE: xmin->xmax <=> right->left ("-x") direction
02799     {sup_axis_x = new TGaxis( -(Float_t)MatSize, (Float_t)0, (Float_t)(size_eta*MatSize), (Float_t)0.,
02800                               "f1", size_eta, "BCS" , 0.);                                fCnewRoot++;
02801     cout << "TEcnaHistosEB::ViewTowerGrid()> non foreseen case. eta with -x direction." << fTTBELL << endl;}
02802 
02803   if ( x_direction == "x" )    // ALWAYS IN THIS CASE: xmin->xmax <=> left->right ("x") direction
02804     {sup_axis_x = new TGaxis( (Float_t)0.      , (Float_t)0., (Float_t)(size_eta*MatSize), (Float_t)0.,
02805                               "f1", size_eta, "CS" , 0.);                                fCnewRoot++;}
02806   
02807   sup_axis_x->SetTitle(x_var_name);
02808   sup_axis_x->SetTitleSize(tit_siz_x);
02809   sup_axis_x->SetTitleOffset(tit_off_x);
02810   sup_axis_x->SetLabelSize(lab_siz_x);
02811   sup_axis_x->SetLabelOffset(lab_off_x);
02812   sup_axis_x->SetTickSize(tic_siz_x);
02813   sup_axis_x->Draw("SAME");
02814   f1 = 0;
02815 
02816   //...................................................... Axe phi (y right)  (ViewTowerGrid)
02817   Float_t tit_siz_y = fCnaParHistos->AxisTitleSize();
02818   Float_t lab_siz_y = fCnaParHistos->AxisLabelSize();
02819   Float_t tic_siz_y = fCnaParHistos->AxisTickSize();
02820   Float_t tit_off_y = fCnaParHistos->AxisTitleOffset("Towy");
02821   Float_t lab_off_y = fCnaParHistos->AxisLabelOffset("Towy");
02822 
02823   if( chopt == "CrystalNumbering" )
02824     {
02825       Double_t phi_min     = fEcalNumbering->GetPhiMin(SMNumber, n1SMTow);
02826       Double_t phi_max     = fEcalNumbering->GetPhiMax(SMNumber, n1SMTow);
02827       
02828       TString  y_var_name  = GetEtaPhiAxisTitle("phi");
02829       TString  y_direction = fEcalNumbering->GetYDirectionEB(SMNumber);
02830   
02831       TF1 *f2 = new TF1("f2", y_direction.Data(), phi_min, phi_max);               fCnewRoot++;
02832       TGaxis* sup_axis_y = 0;
02833       
02834       if ( y_direction == "-x" )  // ALWAYS IN THIS CASE: ymin->ymax <=> top->bottom ("-x") direction
02835         {sup_axis_y = new TGaxis( (Float_t)(size_eta*MatSize), (Float_t)0.,
02836                                   (Float_t)(size_eta*MatSize), (Float_t)(size_phi*MatSize),
02837                                   "f2", size_phi, "+CS", 0.);                fCnewRoot++;}
02838       
02839       if ( y_direction == "x" )   // NEVER  IN THIS CASE: ymin->ymax <=> bottom->top ("x") direction
02840         {sup_axis_y = new TGaxis( (Float_t)0.,  (Float_t)0., (Float_t) 0., (Float_t)(size_phi*MatSize),
02841                                   "f2", size_phi, "BCS", 0.);                fCnewRoot++;}
02842       
02843       sup_axis_y->SetTitle(y_var_name);
02844       sup_axis_y->SetTitleSize(tit_siz_y);
02845       sup_axis_y->SetTitleOffset(tit_off_y);
02846       sup_axis_y->SetLabelSize(lab_siz_y);
02847       sup_axis_y->SetLabelOffset(lab_off_y);
02848       sup_axis_y->SetTickSize(tic_siz_y);
02849       sup_axis_y->Draw("SAME");
02850       f2 = 0;
02851     }
02852   //...................................................... Axe j(phi) (y left)  (ViewTowerGrid)
02853 
02854   Double_t j_phi_min = fEcalNumbering->GetJPhiMin(SMNumber, n1SMTow);
02855   Double_t j_phi_max = fEcalNumbering->GetJPhiMax(SMNumber, n1SMTow);
02856 
02857   TString  jy_var_name  = GetEtaPhiAxisTitle("jphiTow");
02858   TString  jy_direction = fEcalNumbering->GetJYDirectionEB(SMNumber);
02859 
02860   TF1 *f3 = new TF1("f3", jy_direction.Data(), j_phi_min, j_phi_max);               fCnewRoot++;
02861   TGaxis* sup_axis_jy = 0;
02862 
02863   sup_axis_jy = new TGaxis( (Float_t)0., (Float_t)0.,
02864                             (Float_t)0., (Float_t)(size_phi*MatSize),
02865                             "f3", size_phi, "SC", 0.);                fCnewRoot++;
02866   
02867   sup_axis_jy->SetTitle(jy_var_name);
02868   sup_axis_jy->SetTitleSize(tit_siz_y);
02869   sup_axis_jy->SetTitleOffset(tit_off_y);
02870   sup_axis_jy->SetLabelSize(lab_siz_y);
02871   sup_axis_jy->SetLabelOffset(lab_off_y);
02872   sup_axis_jy->SetTickSize(tic_siz_y);
02873   sup_axis_jy->Draw("SAME");
02874   f3 = 0;
02875 
02876 } // end of ViewTowerGrid
02877 
02878 //===============================================================================
02879 //
02880 //                           ViewSCGrid
02881 //              independent of the ROOT file => DeeNumber as argument
02882 //
02883 //===============================================================================
02884 void TEcnaHistos::ViewSCGrid(const Int_t& DeeNumber, const Int_t&  n1DeeSCEcna,
02885                              const Int_t& MatSize,   const Int_t&  size_IX,
02886                              const Int_t& size_IY,   const TString chopt)
02887 {
02888   //Grid of one SC with axis IX and IY
02889   //.......................... lignes verticales
02890   Double_t xline = 0.;
02891   
02892   Double_t yline_bot = 0.;
02893   Double_t yline_top = (Double_t)(MatSize*size_IX);
02894   
02895   for( Int_t i = 0 ; i < size_IX ; i++)
02896     {  
02897       xline = xline + (Double_t)MatSize;
02898       TLine *lin;
02899       lin = new TLine(xline, yline_bot, xline, yline_top); fCnewRoot++;
02900       lin->Draw();
02901       // delete lin;             fCdeleteRoot++;
02902     }
02903   //............................. lignes horizontales
02904   Double_t xline_left  = 0;
02905   Double_t xline_right = (Double_t)(MatSize*size_IX);
02906   
02907   Double_t yline = -(Double_t)MatSize;
02908   
02909   for( Int_t j = 0 ; j < size_IX+1 ; j++)
02910     {
02911       yline = yline + (Double_t)MatSize;
02912       TLine *lin;
02913       lin = new TLine(xline_left, yline, xline_right, yline); fCnewRoot++;
02914       lin->Draw();
02915       // delete lin;             fCdeleteRoot++;
02916     }
02917  
02918   //------------------ trace axes en IX et IY --------------- ViewSCGrid
02919 
02920   //...................................................... Axe i(IX) (x bottom)  (ViewSCGrid)
02921 
02922   Double_t IX_min = fEcalNumbering->GetIIXMin(n1DeeSCEcna) - 0.5;
02923   Double_t IX_max = fEcalNumbering->GetIIXMax(n1DeeSCEcna) + 0.5;
02924 
02925   Float_t axis_x_inf  = 0;
02926   Float_t axis_x_sup  = 0;
02927   Float_t axis_y_inf  = 0;
02928   Float_t axis_y_sup  = 0;
02929   Int_t   axis_nb_div = 1;
02930   Double_t IX_values_min = 0;
02931   Double_t IX_values_max = 0;
02932   Option_t* axis_chopt = "CS";
02933 
02934   Float_t tit_siz_x = fCnaParHistos->AxisTitleSize();
02935   Float_t lab_siz_x = fCnaParHistos->AxisLabelSize();
02936   Float_t tic_siz_x = fCnaParHistos->AxisTickSize();
02937   Float_t tit_off_x = fCnaParHistos->AxisTitleOffset("SCx");
02938   Float_t lab_off_x = fCnaParHistos->AxisLabelOffset("SCx");
02939 
02940   TString StrDee = "iIXSC";
02941   if( DeeNumber == 1 ){StrDee = "iIXDee1";}
02942   if( DeeNumber == 2 ){StrDee = "iIXDee2";}
02943   if( DeeNumber == 3 ){StrDee = "iIXDee3";}
02944   if( DeeNumber == 4 ){StrDee = "iIXDee4";}
02945 
02946   TString  x_var_name  = GetIXIYAxisTitle(StrDee.Data());
02947   TString  x_direction = fEcalNumbering->GetXDirectionEE(DeeNumber);
02948 
02949   TGaxis* sup_axis_x = 0;
02950 
02951   if( DeeNumber == 1 ) //  -xmin -> -xmax <=> left->right
02952     {
02953       axis_x_inf    = 0; axis_y_inf  = 0;  axis_x_sup    = size_IX*MatSize;  axis_y_sup    = 0;
02954       axis_nb_div   = size_IX;
02955       IX_values_min = -IX_min ;   IX_values_max = -IX_max; axis_chopt = "CS";
02956     }
02957   if( DeeNumber == 2 ) //  xmin -> xmax <=> right->left
02958     {
02959       axis_x_inf    = 0; axis_y_inf  = 0;  axis_x_sup    = size_IX*MatSize;  axis_y_sup    = 0;
02960       axis_nb_div   = size_IX;
02961       IX_values_min = IX_min ;    IX_values_max = IX_max;   axis_chopt = "CS";
02962     }
02963   if( DeeNumber == 3 )  //  xmin -> xmax <=>  left->right
02964     {
02965       axis_x_inf    = 0; axis_y_inf  = 0;  axis_x_sup    = size_IX*MatSize;  axis_y_sup    = 0;
02966       axis_nb_div   = size_IX;
02967       IX_values_min = IX_min ;    IX_values_max = IX_max;   axis_chopt = "CS";
02968     }
02969   if( DeeNumber == 4 )  //  -xmin -> -xmax <=> right->left
02970     {
02971       axis_x_inf    = 0; axis_y_inf  = 0;  axis_x_sup    = size_IX*MatSize;  axis_y_sup    = 0;
02972       axis_nb_div   = size_IX;
02973       IX_values_min = -IX_min ;   IX_values_max = -IX_max; axis_chopt = "CS";
02974     }
02975 
02976   TF1 *f1 = new TF1("f1", x_direction.Data(), IX_values_min, IX_values_max);    fCnewRoot++;
02977   sup_axis_x = new TGaxis( axis_x_inf, axis_y_inf, axis_x_sup, axis_y_sup,
02978                            "f1", axis_nb_div, axis_chopt , 0.);   fCnewRoot++;
02979 
02980   sup_axis_x->SetTitle(x_var_name);
02981   sup_axis_x->SetTitleSize(tit_siz_x);
02982   sup_axis_x->SetTitleOffset(tit_off_x);
02983   sup_axis_x->SetLabelSize(lab_siz_x);
02984   sup_axis_x->SetLabelOffset(lab_off_x);
02985   sup_axis_x->SetTickSize(tic_siz_x);     // <===== NE MARCHE QU'AVEC L'OPTION "S"
02986   sup_axis_x->Draw("SAME");
02987   f1 = 0;
02988 
02989   //...................................................... Axe j(IY) (ViewSCGrid)
02990 
02991   Float_t tit_siz_y = fCnaParHistos->AxisTitleSize();
02992   Float_t lab_siz_y = fCnaParHistos->AxisLabelSize();
02993   Float_t tic_siz_y = fCnaParHistos->AxisTickSize();
02994   Float_t tit_off_y = fCnaParHistos->AxisTitleOffset("SCy");
02995   Float_t lab_off_y = fCnaParHistos->AxisLabelOffset("SCy");
02996 
02997   Double_t j_IY_min = fEcalNumbering->GetJIYMin(DeeNumber, n1DeeSCEcna) - 0.5;
02998   Double_t j_IY_max = fEcalNumbering->GetJIYMax(DeeNumber, n1DeeSCEcna) + 0.5;
02999 
03000   TString  jy_var_name  = GetIXIYAxisTitle("jIYSC");
03001   TString  jy_direction = fEcalNumbering->GetJYDirectionEE(DeeNumber);
03002 
03003   TF1 *f2 = new TF1("f2", jy_direction.Data(), j_IY_min, j_IY_max);             fCnewRoot++;
03004 
03005   TGaxis* sup_axis_jy = new TGaxis( (Float_t)0., (Float_t)0.,
03006                             (Float_t)0., (Float_t)(size_IY*MatSize),
03007                             "f2", size_IY, "CS", 0.);                     fCnewRoot++;
03008 
03009   sup_axis_jy->SetTitle(jy_var_name);
03010   sup_axis_jy->SetTitleSize(tit_siz_y);
03011   sup_axis_jy->SetTitleOffset(tit_off_y);
03012   sup_axis_jy->SetLabelSize(lab_siz_y);
03013   sup_axis_jy->SetLabelOffset(lab_off_y);
03014   sup_axis_jy->SetTickSize(tic_siz_y);     // <===== NE MARCHE QU'AVEC L'OPTION "S"
03015   sup_axis_jy->Draw();
03016   f2 = 0;
03017 
03018 } // end of ViewSCGrid
03019 
03020 //=======================================================================================
03021 //
03022 //                              ViewStex(***)     
03023 //
03024 //           (Hoco,Veco) matrices for all the Stins of a Stex             
03025 //
03026 //     arg_read_histo:    1D array containing the quantity for each channel in the Stex
03027 //                        (dim = MaxCrysInStex())
03028 //     arg_AlreadyRead:   =1 <=> arg_read_histo 
03029 //                        =0 <=> read the 1D array in this method with TEcnaRead
03030 //     
03031 //      HistoCode:        code for the plotted quantity
03032 //
03033 //=======================================================================================
03034 void TEcnaHistos::ViewStex(const TVectorD& arg_read_histo, const Int_t& arg_AlreadyRead,
03035                            const TString   HistoCode)
03036 {
03037 // (Hoco, Veco) matrices for all the Stins of a Stex
03038 
03039   Bool_t OKFileExists = kFALSE;
03040   Bool_t OKData  = kFALSE;
03041 
03042   Int_t n1StexStin = -1;
03043 
03044   if( arg_AlreadyRead == fTobeRead )
03045     {
03046       fMyRootFile->PrintNoComment();
03047       fMyRootFile->FileParameters(fFapAnaType,          fFapNbOfSamples,
03048                                   fFapRunNumber,        fFapFirstReqEvtNumber,
03049                                   fFapLastReqEvtNumber, fFapReqNbOfEvts,
03050                                   fFapStexNumber,       fCfgResultsRootFilePath.Data());
03051       
03052       if( fMyRootFile->LookAtRootFile() == kTRUE ){OKFileExists = kTRUE;}
03053 
03054       if( OKFileExists == kTRUE )
03055         {
03056           fFapNbOfEvts = fMyRootFile->GetNumberOfEvents(fFapReqNbOfEvts);
03057           TString fp_name_short = fMyRootFile->GetRootFileNameShort();
03058           // cout << "*TEcnaHistos::ViewStex(...)> Data are analyzed from file ----> "
03059           //      << fp_name_short << endl;
03060           
03061           fStartDate = fMyRootFile->GetStartDate();
03062           fStopDate  = fMyRootFile->GetStopDate();
03063           fRunType   = fMyRootFile->GetRunType();
03064         }
03065     }
03066   if( arg_AlreadyRead >= 1 )
03067     {
03068       OKFileExists = kTRUE;
03069     }
03070 
03071   if( OKFileExists == kTRUE ) 
03072     {
03073       fStatusFileFound = kTRUE;
03074 
03075       //......................... matrix title    (ViewStex)
03076       char* f_in_mat_tit = new char[fgMaxCar];               fCnew++;
03077       sprintf(f_in_mat_tit, "?");
03078 
03079       if (HistoCode == "D_NOE_ChNb") {sprintf(f_in_mat_tit, "Number of events");}
03080       if (HistoCode == "D_Ped_ChNb") {sprintf(f_in_mat_tit, "Pedestals");}
03081       if (HistoCode == "D_TNo_ChNb") {sprintf(f_in_mat_tit, "Total noise");}
03082       if (HistoCode == "D_MCs_ChNb") {sprintf(f_in_mat_tit, "Mean cor(s,s')");}
03083       if (HistoCode == "D_LFN_ChNb") {sprintf(f_in_mat_tit, "Low frequency noise");}
03084       if (HistoCode == "D_HFN_ChNb") {sprintf(f_in_mat_tit, "High frequency noise");}
03085       if (HistoCode == "D_SCs_ChNb") {sprintf(f_in_mat_tit, "Sigma of cor(s,s')");}
03086       
03087       //................................. Axis parameters
03088       Int_t  GeoBidSizeHoco = fEcal->MaxStinHocoInStex()*fEcal->MaxCrysHocoInStin();
03089       Int_t  GeoBidSizeVeco = fEcal->MaxStinVecoInStex()*fEcal->MaxCrysVecoInStin();
03090 
03091       Int_t  nb_binx  = GeoBidSizeHoco;
03092       Int_t  nb_biny  = GeoBidSizeVeco;
03093       Axis_t xinf_bid = (Axis_t)0.;
03094       Axis_t xsup_bid = (Axis_t)GeoBidSizeHoco;
03095       Axis_t yinf_bid = (Axis_t)0.;
03096       Axis_t ysup_bid = (Axis_t)GeoBidSizeVeco;   
03097       
03098       TString axis_x_var_name = "  #Hoco  ";
03099       TString axis_y_var_name = "  #Veco  ";
03100       
03101       //............. matrices reading and histogram filling   (ViewStex)
03102       
03103       TH2D* h_geo_bid = new TH2D("geobidim_ViewStex", f_in_mat_tit,
03104                                  nb_binx, xinf_bid,  xsup_bid,
03105                                  nb_biny, yinf_bid,  ysup_bid);     fCnewRoot++;
03106 
03107       h_geo_bid->Reset();
03108 
03109       //............................................... 1D histo reading  (ViewStex)
03110       TVectorD partial_histp(fEcal->MaxCrysEcnaInStex());
03111       for(Int_t i=0; i<fEcal->MaxCrysEcnaInStex(); i++){partial_histp(i)=(Double_t)0.;}
03112 
03113       if( arg_AlreadyRead == fTobeRead )
03114         {
03115           if (HistoCode == "D_NOE_ChNb" ){partial_histp = fMyRootFile->ReadNumberOfEvents(fEcal->MaxCrysEcnaInStex());}
03116           if (HistoCode == "D_Ped_ChNb" ){
03117             partial_histp = fMyRootFile->ReadPedestals(fEcal->MaxCrysEcnaInStex());}
03118           if (HistoCode == "D_TNo_ChNb" ){
03119             partial_histp = fMyRootFile->ReadTotalNoise(fEcal->MaxCrysEcnaInStex());}
03120           if (HistoCode == "D_MCs_ChNb" ){
03121             partial_histp = fMyRootFile->ReadMeanCorrelationsBetweenSamples(fEcal->MaxCrysEcnaInStex());}
03122           if (HistoCode == "D_LFN_ChNb" ){
03123             partial_histp = fMyRootFile->ReadLowFrequencyNoise(fEcal->MaxCrysEcnaInStex());}
03124           if (HistoCode == "D_HFN_ChNb" ){
03125             partial_histp = fMyRootFile->ReadHighFrequencyNoise(fEcal->MaxCrysEcnaInStex());}
03126           if (HistoCode == "D_SCs_ChNb" ){
03127             partial_histp = fMyRootFile->ReadSigmaOfCorrelationsBetweenSamples(fEcal->MaxCrysEcnaInStex());}
03128 
03129           OKData = fMyRootFile->DataExist();
03130         }
03131 
03132       if( arg_AlreadyRead >= 1 )
03133         {
03134           partial_histp = arg_read_histo;
03135           OKData = kTRUE;
03136         }
03137 
03138       //------------------------------- Build 2D matrix to be ploted from 1D read histo  (ViewStex)
03139       TMatrixD read_matrix(nb_binx, nb_biny);
03140       for(Int_t i=0; i<nb_binx; i++)
03141         {for(Int_t j=0; j<nb_biny; j++){read_matrix(i,j)=(Double_t)0.;}}
03142 
03143       if ( OKData == kTRUE )
03144         {
03145           fStatusDataExist = kTRUE;
03146 
03147           for(Int_t i0StexStinEcna=0; i0StexStinEcna<fEcal->MaxStinEcnaInStex(); i0StexStinEcna++)
03148             {
03149               if( arg_AlreadyRead == fTobeRead )              
03150                 {n1StexStin = fMyRootFile->GetStexStinFromIndex(i0StexStinEcna);}
03151               if( arg_AlreadyRead >= 1 )
03152                 {n1StexStin = i0StexStinEcna+1;}
03153 
03154               if (n1StexStin != -1)
03155                 {
03156                   //------------------ Geographical bidim filling   (ViewStex)
03157                   for(Int_t i0StinEcha=0; i0StinEcha<fEcal->MaxCrysInStin(); i0StinEcha++)
03158                     {
03159                       Int_t iStexEcha = (n1StexStin-1)*fEcal->MaxCrysInStin() + i0StinEcha;
03160                       Int_t i_xgeo = GetXCrysInStex(fFapStexNumber, n1StexStin, i0StinEcha);
03161                       Int_t i_ygeo = GetYCrysInStex(fFapStexNumber, n1StexStin, i0StinEcha);
03162                       
03163                       if(i_xgeo >=0 && i_xgeo < nb_binx && i_ygeo >=0 && i_ygeo < nb_biny)
03164                         {
03165                           read_matrix(i_xgeo, i_ygeo) = partial_histp(iStexEcha);
03166                           h_geo_bid->Fill((Double_t)i_xgeo, (Double_t)i_ygeo,
03167                                           (Double_t)read_matrix(i_xgeo, i_ygeo));
03168                         }          
03169                     }
03170                 }
03171             }
03172           
03173           //===============  H I S T O   M I N / M A X   M A N A G E M E N T ============  (ViewStex)
03174           
03175           //................................ Put histo min max values
03176           //.......... default if flag not set to "ON"
03177           SetYminMemoFromValue(HistoCode.Data(), fCnaParHistos->GetYminDefaultValue(HistoCode.Data()));
03178           SetYmaxMemoFromValue(HistoCode.Data(), fCnaParHistos->GetYmaxDefaultValue(HistoCode.Data()));
03179           
03180           if( fUserHistoMin == fUserHistoMax ){fFlagUserHistoMin = "AUTO"; fFlagUserHistoMax = "AUTO";}
03181           //.......... user's value if flag set to "ON"
03182           if( fFlagUserHistoMin == "ON" )
03183             {SetYminMemoFromValue(HistoCode.Data(), fUserHistoMin); fFlagUserHistoMin = "OFF";}
03184           if( fFlagUserHistoMax == "ON" )
03185             {SetYmaxMemoFromValue(HistoCode.Data(), fUserHistoMax); fFlagUserHistoMax = "OFF";}
03186           //................................. automatic min and/or max
03187           if( fFlagUserHistoMin == "AUTO" )
03188             {SetYminMemoFromValue(HistoCode.Data(), h_geo_bid->GetMinimum()); fFlagUserHistoMin = "OFF";}
03189           if( fFlagUserHistoMax == "AUTO" )
03190             {SetYmaxMemoFromValue(HistoCode.Data(), h_geo_bid->GetMaximum()); fFlagUserHistoMax = "OFF";}
03191           //...................................... histo set ymin and ymax
03192           Int_t  xFlagAutoYsupMargin = 0;      
03193           xFlagAutoYsupMargin = SetHistoFrameYminYmaxFromMemo((TH1D*)h_geo_bid, HistoCode);
03194           
03195           // ************************** A GARDER EN RESERVE *******************************
03196           //............. special contour level for correlations (square root wise scale)
03197           //if ( HistoCode == "D_MCs_ChNb" )
03198           //{
03199           //  Int_t nb_niv  = 9;
03200           //  Double_t* cont_niv = new Double_t[nb_niv];           fCnew++;
03201           //  SqrtContourLevels(nb_niv, &cont_niv[0]);      
03202           //  h_geo_bid->SetContour(nb_niv, &cont_niv[0]);            
03203           //  delete [] cont_niv;                                  fCdelete++;
03204           //}
03205           // ******************************** (FIN RESERVE) *******************************
03206           
03207           // =================================== P L O T S ========================   (ViewStex) 
03208           
03209           char* f_in = new char[fgMaxCar];                           fCnew++;
03210 
03211           //...................... Taille/format canvas
03212           UInt_t canv_h = fCnaParHistos->CanvasFormatH("petit");
03213           UInt_t canv_w = fCnaParHistos->CanvasFormatW("petit");
03214 
03215           if( fFlagSubDet == "EB")
03216           {canv_h = fCnaParHistos->CanvasFormatH("etaphiSM");
03217           canv_w = fCnaParHistos->CanvasFormatW("etaphiSM");}
03218           if( fFlagSubDet == "EE")        
03219           {canv_h = fCnaParHistos->CanvasFormatH("IXIYDee");
03220           canv_w = fCnaParHistos->CanvasFormatW("IXIYDee");}
03221 
03222           //............................................... paves commentaires (ViewStex)
03223           SetAllPavesViewStex(fFapStexNumber);
03224           
03225           //------------------------------------ Canvas name ----------------- (ViewStex)  
03226           TString name_cov_cor;
03227           Int_t MaxCar = fgMaxCar;
03228           name_cov_cor.Resize(MaxCar);
03229           name_cov_cor = "?";
03230 
03231           if( HistoCode == "D_NOE_ChNb"){name_cov_cor = "Nb_Of_D_Adc_EvDs";}
03232           if( HistoCode == "D_Ped_ChNb"){name_cov_cor = "Pedestals";}
03233           if( HistoCode == "D_TNo_ChNb"){name_cov_cor = "Total_noise";}
03234           if( HistoCode == "D_MCs_ChNb"){name_cov_cor = "Mean_Corss";}
03235           if( HistoCode == "D_LFN_ChNb"){name_cov_cor = "Low_Fq_Noise";}
03236           if( HistoCode == "D_HFN_ChNb"){name_cov_cor = "High_Fq_Noise";}
03237           if( HistoCode == "D_SCs_ChNb"){name_cov_cor = "Sigma_Corss";}
03238           
03239           TString name_visu;
03240           MaxCar = fgMaxCar;
03241           name_visu.Resize(MaxCar);
03242           name_visu = "colz";
03243           
03244           TString flag_already_read;
03245           MaxCar = fgMaxCar;
03246           flag_already_read.Resize(MaxCar);
03247           flag_already_read = "?";
03248           sprintf(f_in,"M%d", arg_AlreadyRead); flag_already_read = f_in;
03249 
03250           sprintf(f_in, "%s_%s_S1_%d_R%d_%d_%d_%s%d_%s_HocoVeco_R%s",
03251                   name_cov_cor.Data(), fFapAnaType.Data(), fFapNbOfSamples, fFapRunNumber,
03252                   fFapFirstReqEvtNumber, fFapLastReqEvtNumber, fFapStexName.Data(), fFapStexNumber,
03253                   name_visu.Data(), flag_already_read.Data());
03254           
03255           if( fFlagSubDet == "EB" ){SetHistoPresentation((TH1D*)h_geo_bid, "Stex2DEB");}
03256           if( fFlagSubDet == "EE" ){SetHistoPresentation((TH1D*)h_geo_bid, "Stex2DEE");}
03257           
03258           TCanvas *MainCanvas = new TCanvas(f_in, f_in, canv_w, canv_h);   fCnewRoot++;
03259           fCurrentCanvas = MainCanvas; fCurrentCanvasName = f_in;
03260 
03261           // cout << "*TEcnaHistos::ViewStex(...)> Plot is displayed on canvas ----> " << f_in << endl;
03262           
03263           delete [] f_in; f_in = 0;                                 fCdelete++;
03264           
03265           //------------------------ Canvas draw and update ------------ (ViewStex)  
03266           if( fPavComGeneralTitle != 0 ){fPavComGeneralTitle->Draw();}
03267           fPavComStex->Draw();
03268           fPavComAnaRun->Draw();
03269           fPavComNbOfEvts->Draw();
03270 
03271           //----------------------------------------------------------- pad margins
03272           Double_t x_low = fCnaParHistos->BoxLeftX("bottom_left_box")    - 0.005;
03273           Double_t y_low = fCnaParHistos->BoxTopY("bottom_left_box")     + 0.005;
03274           Double_t x_margin = x_low;
03275           Double_t y_margin = y_low;      
03276           MainCanvas->Divide( 1,  1, x_margin, y_margin);
03277           //           Divide(nx, ny, x_margin, y_margin,    color);      
03278           gPad->cd(1);
03279           //........................... specific EE
03280           if( fFlagSubDet == "EE" )
03281             {Double_t x_up  = fCnaParHistos->BoxRightX("bottom_right_box")  + 0.005;
03282             Double_t y_up  = fCnaParHistos->BoxBottomY("top_left_box_Dee") - 0.005;
03283             TVirtualPad* main_subpad = gPad;
03284             main_subpad->SetPad(x_low, y_low, x_up, y_up);}
03285           
03286           //------------------------------------------------------------
03287           h_geo_bid->GetXaxis()->SetTitle(axis_x_var_name);
03288           h_geo_bid->GetYaxis()->SetTitle(axis_y_var_name);
03289           
03290           h_geo_bid->DrawCopy("COLZ");
03291           
03292           // trace de la grille: un rectangle = une tour ou un SC ---------------- (ViewStex) 
03293           ViewStexGrid(fFapStexNumber, " ");
03294           gPad->Draw();
03295           gPad->Update();
03296 
03297           //..................... retour aux options standard
03298           Bool_t b_true = 1;
03299           h_geo_bid->SetStats(b_true);    
03300           h_geo_bid->Delete();  h_geo_bid = 0;              fCdeleteRoot++;
03301 
03302           //      delete MainCanvas;              fCdeleteRoot++;
03303         }  // end of if OKData == kTRUE )
03304       delete [] f_in_mat_tit;    f_in_mat_tit = 0;                        fCdelete++;
03305     } // end of if OKFileExists == kTRUE )
03306   else
03307     {
03308       fStatusFileFound = kFALSE;
03309 
03310       cout << "!TEcnaHistos::ViewStex(...)> *ERROR* =====> "
03311            << " ROOT file not found" << fTTBELL << endl;
03312     }
03313 }  // end of ViewStex(...)
03314 
03315 //===========================================================================
03316 //
03317 //                       StexHocoVecoLHFCorcc(***)
03318 //
03319 //     Geographical view of the cor(c,c) matrices (mean over samples) of
03320 //     all (Stin_A,Stin_A) [case A=B only] of a given Stex (BIG MATRIX)
03321 //
03322 //===========================================================================  
03323 void TEcnaHistos::StexHocoVecoLHFCorcc(const TString Freq)
03324 {
03325 // (Hoco, Veco) matrices for all the Stins of a Stex
03326 
03327   fMyRootFile->PrintNoComment();
03328   fMyRootFile->FileParameters(fFapAnaType,          fFapNbOfSamples,
03329                               fFapRunNumber,        fFapFirstReqEvtNumber,
03330                               fFapLastReqEvtNumber, fFapReqNbOfEvts,
03331                               fFapStexNumber,       fCfgResultsRootFilePath.Data());
03332   
03333   if ( fMyRootFile->LookAtRootFile() == kTRUE )                 // (StexHocoVecoLHFCorcc)
03334     {
03335       fStatusFileFound = kTRUE;
03336 
03337       fFapNbOfEvts = fMyRootFile->GetNumberOfEvents(fFapReqNbOfEvts);
03338       TString fp_name_short = fMyRootFile->GetRootFileNameShort(); 
03339       //cout << "*TEcnaHistos::StexHocoVecoLHFCorcc(...)> Data are analyzed from file ----> "
03340       //     << fp_name_short << endl;
03341 
03342       fStartDate = fMyRootFile->GetStartDate();
03343       fStopDate  = fMyRootFile->GetStopDate();
03344       fRunType   = fMyRootFile->GetRunType();
03345       
03346       //......................... matrix title  
03347       char* f_in_mat_tit = new char[fgMaxCar];               fCnew++;
03348       
03349       if( fFlagSubDet == "EB" && Freq == "LF" )
03350         {sprintf(f_in_mat_tit, "LF Cor(Xtal,Xtal') for each tower in SM");}
03351       if( fFlagSubDet == "EB" && Freq == "HF" )
03352         {sprintf(f_in_mat_tit, "HF Cor(Xtal,Xtal') for each tower in SM");}
03353       if( fFlagSubDet == "EE" && Freq == "LF"  )
03354         {sprintf(f_in_mat_tit, "LF Cor(Xtal,Xtal') for each SC in Dee");}
03355       if( fFlagSubDet == "EE" && Freq == "HF"  )
03356         {sprintf(f_in_mat_tit, "HF Cor(Xtal,Xtal') for each SC in Dee");}
03357 
03358       //................................. Axis parameters
03359       Int_t  GeoBidSizeHoco = fEcal->MaxStinHocoInStex()*fEcal->MaxCrysInStin();
03360       Int_t  GeoBidSizeVeco = fEcal->MaxStinVecoInStex()*fEcal->MaxCrysInStin();
03361 
03362       Int_t  nb_binx  = GeoBidSizeHoco;
03363       Int_t  nb_biny  = GeoBidSizeVeco;
03364       Axis_t xinf_bid = (Axis_t)0.;
03365       Axis_t xsup_bid = (Axis_t)GeoBidSizeHoco;
03366       Axis_t yinf_bid = (Axis_t)0.;
03367       Axis_t ysup_bid = (Axis_t)GeoBidSizeVeco;   
03368       
03369       TString axis_x_var_name = "  #Hoco  ";
03370       TString axis_y_var_name = "  #varVeco  ";
03371 
03372       //======================================================== (StexHocoVecoLHFCorcc)
03373       TVectorD Stin_numbers(fEcal->MaxStinEcnaInStex());
03374       for(Int_t i=0; i<fEcal->MaxStinEcnaInStex(); i++){Stin_numbers(i)=(Double_t)0.;}
03375       Stin_numbers = fMyRootFile->ReadStinNumbers(fEcal->MaxStinEcnaInStex());
03376 
03377       if ( fMyRootFile->DataExist() == kTRUE )
03378         {
03379           fStatusDataExist = kTRUE;
03380 
03381           //............. matrices reading and histogram filling
03382           TMatrixD partial_matrix(fEcal->MaxCrysEcnaInStex(), fEcal->MaxCrysEcnaInStex());
03383           for(Int_t i=0; i<fEcal->MaxCrysEcnaInStex(); i++)
03384             {for(Int_t j=0; j<fEcal->MaxCrysEcnaInStex(); j++){partial_matrix(i,j)=(Double_t)0.;}}
03385 
03386           if( Freq == "LF")
03387             {
03388               partial_matrix = fMyRootFile->ReadLowFrequencyCorrelationsBetweenChannels(fEcal->MaxCrysEcnaInStex());
03389             }
03390           if( Freq == "HF")
03391             {
03392               partial_matrix = fMyRootFile->ReadHighFrequencyCorrelationsBetweenChannels(fEcal->MaxCrysEcnaInStex());
03393             }
03394 
03395           if ( fMyRootFile->DataExist() == kTRUE )
03396             {
03397               fStatusDataExist = kTRUE;
03398               
03399               //............................... 2D histo booking
03400               TH2D* h_geo_bid = new TH2D("geobidim_HocoVecoLHFCorcc", f_in_mat_tit,
03401                                          nb_binx, xinf_bid,  xsup_bid,
03402                                          nb_biny, yinf_bid,  ysup_bid);     fCnewRoot++;
03403               h_geo_bid->Reset();
03404 
03405               fFapStexBarrel = fEcalNumbering->GetStexHalfStas(fFapStexNumber);
03406               
03407               for(Int_t i0StexStinEcna=0; i0StexStinEcna<fEcal->MaxStinEcnaInStex(); i0StexStinEcna++)
03408                 {
03409                   Int_t n1StexStin = (Int_t)Stin_numbers(i0StexStinEcna);
03410                   Int_t offset_x = ((n1StexStin-1)/fEcal->MaxStinVecoInStex())*fEcal->MaxCrysInStin();
03411                   Int_t offset_y = ((n1StexStin-1)%fEcal->MaxStinVecoInStex())*fEcal->MaxCrysInStin();
03412                   
03413                   if (n1StexStin != -1)
03414                     {
03415                       //================================================= (StexHocoVecoLHFCorcc)
03416                       //------------------ Geographical bidim filling
03417                       for(Int_t i0StinEcha=0; i0StinEcha<fEcal->MaxCrysInStin(); i0StinEcha++)
03418                         {
03419                           for(Int_t j0StinEcha=0; j0StinEcha<fEcal->MaxCrysInStin(); j0StinEcha++)
03420                             {
03421                               Int_t i_xgeo = offset_x + i0StinEcha;
03422                               Int_t i_ygeo = offset_y + j0StinEcha;
03423                               
03424                               if(i_xgeo >=0 && i_xgeo < nb_binx && i_ygeo >=0 && i_ygeo < nb_biny)
03425                                 {
03426                                   Int_t iEcha = (n1StexStin-1)*fEcal->MaxCrysInStin() + i0StinEcha;
03427                                   Int_t jEcha = (n1StexStin-1)*fEcal->MaxCrysInStin() + j0StinEcha;
03428                                   
03429                                   h_geo_bid->Fill((Double_t)i_xgeo, (Double_t)i_ygeo,
03430                                                   (Double_t)partial_matrix(iEcha, jEcha));
03431                                 }
03432                             }      
03433                         }
03434                     }
03435                 }
03436               
03437               //===============  H I S T O   M I N / M A X   M A N A G E M E N T ============  (StexHocoVecoLHFCorcc)
03438               
03439               TString HistoCode = "H2CorccInStins";
03440               
03441               //................................ Put histo min max values
03442               //.......... default if flag not set to "ON"
03443               SetYminMemoFromValue(HistoCode.Data(), fCnaParHistos->GetYminDefaultValue(HistoCode.Data()));
03444               SetYmaxMemoFromValue(HistoCode.Data(), fCnaParHistos->GetYmaxDefaultValue(HistoCode.Data()));
03445               
03446               if( fUserHistoMin == fUserHistoMax ){fFlagUserHistoMin = "AUTO"; fFlagUserHistoMax = "AUTO";}
03447               //.......... user's value if flag set to "ON"
03448               if( fFlagUserHistoMin == "ON" )
03449                 {SetYminMemoFromValue(HistoCode.Data(), fUserHistoMin); fFlagUserHistoMin = "OFF";}
03450               if( fFlagUserHistoMax == "ON" )
03451                 {SetYmaxMemoFromValue(HistoCode.Data(), fUserHistoMax); fFlagUserHistoMax = "OFF";}
03452               //................................. automatic min and/or max
03453               if( fFlagUserHistoMin == "AUTO" )
03454                 {SetYminMemoFromValue(HistoCode.Data(), h_geo_bid->GetMinimum()); fFlagUserHistoMin = "OFF";}
03455               if( fFlagUserHistoMax == "AUTO" )
03456                 {SetYmaxMemoFromValue(HistoCode.Data(), h_geo_bid->GetMaximum()); fFlagUserHistoMax = "OFF";}
03457               //...................................... histo set ymin and ymax
03458               Int_t  xFlagAutoYsupMargin = 0;      
03459               xFlagAutoYsupMargin = SetHistoFrameYminYmaxFromMemo((TH1D*)h_geo_bid, HistoCode);
03460               
03461               // ----------------------------------- P L O T S   (StexHocoVecoLHFCorcc)
03462               
03463               char* f_in = new char[fgMaxCar];                           fCnew++;
03464               
03465               //...................... Taille/format canvas
03466               
03467               UInt_t canv_h = fCnaParHistos->CanvasFormatH("petit");
03468               UInt_t canv_w = fCnaParHistos->CanvasFormatW("petit");
03469               
03470               if( fFlagSubDet == "EB")
03471                 {canv_h = fCnaParHistos->CanvasFormatH("etaphiSM");
03472                 canv_w = fCnaParHistos->CanvasFormatW("etaphiSM");}
03473               if( fFlagSubDet == "EE")    
03474                 {canv_h = fCnaParHistos->CanvasFormatH("IXIYDee");
03475                 canv_w = fCnaParHistos->CanvasFormatW("IXIYDee");}
03476               
03477               //..................................... paves commentaires (StexHocoVecoLHFCorcc)
03478               SetAllPavesViewStex(fFapStexNumber);        
03479               
03480               //----------------- Canvas name ------- (StexHocoVecoLHFCorcc)
03481               TString name_cov_cor;
03482               Int_t MaxCar = fgMaxCar;
03483               name_cov_cor.Resize(MaxCar);
03484               if( Freq == "LF" ){name_cov_cor = "StexLFCorcc";}
03485               if( Freq == "HF" ){name_cov_cor = "StexHFCorcc";}
03486               
03487               TString name_visu;
03488               MaxCar = fgMaxCar;
03489               name_visu.Resize(MaxCar);
03490               name_visu = "colz";
03491               
03492               sprintf(f_in, "%s_%s_S1_%d_R%d_%d_%d_Stex%s%d_%s_HocoVeco",
03493                       name_cov_cor.Data(), fFapAnaType.Data(), fFapNbOfSamples, fFapRunNumber,
03494                       fFapFirstReqEvtNumber, fFapLastReqEvtNumber, fFapStexName.Data(), fFapStexNumber,
03495                       name_visu.Data());
03496               
03497               if( fFlagSubDet == "EB" ){SetHistoPresentation((TH1D*)h_geo_bid, "Stex2DEB");}
03498               if( fFlagSubDet == "EE" ){SetHistoPresentation((TH1D*)h_geo_bid, "Stex2DEE");}
03499               
03500               TCanvas *MainCanvas = new TCanvas(f_in, f_in, canv_w, canv_h);   fCnewRoot++;
03501               fCurrentCanvas = MainCanvas; fCurrentCanvasName = f_in;
03502 
03503               // cout << "*TEcnaHistos::StexHocoVecoLHFCorcc(...)> Plot is displayed on canvas ----> "
03504               //      << f_in << endl;
03505               
03506               delete [] f_in; f_in = 0;                                 fCdelete++;
03507              
03508               //------------ Canvas draw and update ------ (StexHocoVecoLHFCorcc)  
03509               if( fPavComGeneralTitle != 0 ){fPavComGeneralTitle->Draw();}
03510               fPavComStex->Draw();
03511               fPavComAnaRun->Draw();
03512               fPavComNbOfEvts->Draw();
03513 
03514               //----------------------------------------------------------- pad margins
03515               Double_t x_low = fCnaParHistos->BoxLeftX("bottom_left_box")    - 0.005;
03516               Double_t y_low = fCnaParHistos->BoxTopY("bottom_left_box")     + 0.005;
03517               Double_t x_margin = x_low;
03518               Double_t y_margin = y_low;          
03519               MainCanvas->Divide( 1,  1, x_margin, y_margin);
03520               //           Divide(nx, ny, x_margin, y_margin,    color);          
03521               gPad->cd(1);
03522               //........................... specific EE
03523               if( fFlagSubDet == "EE" )
03524                 {
03525                   Double_t x_up  = fCnaParHistos->BoxRightX("bottom_right_box")  + 0.005;
03526                   Double_t y_up  = fCnaParHistos->BoxBottomY("top_left_box_Dee") - 0.005;
03527                   TVirtualPad* main_subpad = gPad;
03528                   main_subpad->SetPad(x_low, y_low, x_up, y_up);
03529                 }
03530               
03531               h_geo_bid->GetXaxis()->SetTitle(axis_x_var_name);
03532               h_geo_bid->GetYaxis()->SetTitle(axis_y_var_name);
03533               
03534               h_geo_bid->DrawCopy("COLZ");
03535               
03536               // trace de la grille: un rectangle = une tour (StexHocoVecoLHFCorcc) 
03537               ViewStexGrid(fFapStexNumber, "corcc");
03538               gPad->Draw();
03539               gPad->Update();
03540 
03541               //..................... retour aux options standard
03542               Bool_t b_true = 1;
03543               h_geo_bid->SetStats(b_true);    
03544               h_geo_bid->Delete();   h_geo_bid = 0;             fCdeleteRoot++;
03545                       
03546               //      delete MainCanvas;              fCdeleteRoot++;
03547             }
03548         }
03549       delete [] f_in_mat_tit;   f_in_mat_tit = 0;               fCdelete++;
03550     } // end of if ( fMyRootFile->LookAtRootFile() == kTRUE )
03551   else
03552     {
03553       fStatusFileFound = kFALSE;
03554 
03555       cout << "!TEcnaHistos::StexHocoVecoLHFCorcc(...)> *ERROR* =====> "
03556            << " ROOT file not found" << fTTBELL << endl;
03557     }
03558 } // end of StexHocoVecoLHFCorcc
03559 
03560 //==================================================================================
03561 //
03562 //                          GetXCrysInStex, GetYCrysInStex
03563 //
03564 //==================================================================================
03565 Int_t TEcnaHistos::GetXCrysInStex(const Int_t&  StexNumber,  const Int_t& n1StexStin,
03566                                   const Int_t&  i0StinEcha) 
03567 {
03568 //Gives the X crystal coordinate in the geographic view of one Stex
03569 // (X = 0 to MaxStinHocoInStex*NbCrysHocoInStin - 1)
03570 
03571   Int_t ix_geo = 0;
03572 
03573   if( fFlagSubDet == "EB")
03574     {TString ctype = fEcalNumbering->GetStexHalfStas(StexNumber);
03575     Int_t n1StexCrys = fEcalNumbering->Get1StexCrysFrom1StexStinAnd0StinEcha(n1StexStin, i0StinEcha, StexNumber);  
03576     ix_geo = (n1StexCrys-1)/fEcal->MaxCrysVecoInStex();  // ix_geo for EB+
03577     if( ctype == "EB-"){ix_geo = fEcal->MaxCrysHocoInStex() - ix_geo - 1;}}
03578 
03579   if( fFlagSubDet == "EE")
03580     {TString DeeDir = fEcalNumbering->GetDeeDirViewedFromIP(StexNumber);  
03581     ix_geo = 0;
03582     if( DeeDir == "right" )
03583       {ix_geo = fEcalNumbering->GetIXCrysInDee(StexNumber, n1StexStin, i0StinEcha) - 1;}
03584     if( DeeDir == "left"  )
03585       {ix_geo = fEcal->MaxCrysIXInDee() - fEcalNumbering->GetIXCrysInDee(StexNumber, n1StexStin, i0StinEcha);}}
03586 
03587   return ix_geo;
03588 }
03589 
03590 Int_t TEcnaHistos::GetYCrysInStex(const Int_t& StexNumber, const Int_t& n1StexStin,
03591                                   const Int_t& j0StinEcha) 
03592 {
03593 //Gives the Y crystal coordinate in the geographic view of one Stex
03594 // (Y = 0 to MaxStinVecoInStex*NbCrysVecoInStin - 1)
03595 
03596   Int_t iy_geo = 0;
03597 
03598   if( fFlagSubDet == "EB")
03599     {TString ctype    = fEcalNumbering->GetStexHalfStas(StexNumber);
03600     Int_t n1StexCrys = fEcalNumbering->Get1StexCrysFrom1StexStinAnd0StinEcha(n1StexStin, j0StinEcha, StexNumber);
03601     Int_t ix_geo = (n1StexCrys-1)/fEcal->MaxCrysVecoInStex();     // ix_geo for EB+
03602     iy_geo = n1StexCrys - 1 - ix_geo*fEcal->MaxCrysVecoInStex();  // iy_geo for EB+
03603     if( ctype == "EB-"){iy_geo = fEcal->MaxCrysVecoInStex() - iy_geo - 1;}}
03604   
03605   if( fFlagSubDet == "EE")
03606     {iy_geo = fEcalNumbering->GetJYCrysInDee(StexNumber, n1StexStin, j0StinEcha) - 1;}
03607   
03608   return iy_geo;
03609 }
03610 
03611 //===========================================================================
03612 //
03613 //     StexStinNumbering, ViewStexStinNumberingPad
03614 //
03615 //              independent of the ROOT file => StexNumber as argument
03616 //
03617 //===========================================================================  
03618 void TEcnaHistos::StexStinNumbering(const Int_t& StexNumber)
03619 {
03620 //display the Stin numbering of the Stex
03621 
03622   if( fFlagSubDet == "EB" ){SMTowerNumbering(StexNumber);}
03623   if( fFlagSubDet == "EE" ){DeeSCNumbering(StexNumber);}
03624 }
03625 // end of StexStinNumbering
03626 
03627 //=============================================================================
03628 //
03629 //                   ViewStexStinNumberingPad
03630 //            independent of the ROOT file => StexNumber as argument
03631 //
03632 //=============================================================================
03633 void TEcnaHistos::ViewStexStinNumberingPad(const Int_t& StexNumber)
03634 {
03635 //display the Stin numbering of the Stex in a Pad
03636 
03637   if( fFlagSubDet ==  "EB"){ViewSMTowerNumberingPad(StexNumber);}
03638   if( fFlagSubDet ==  "EE"){ViewDeeSCNumberingPad(StexNumber);}
03639 }
03640 //---------------->  end of ViewStexStinNumberingPad()
03641 
03642 //==========================================================================
03643 //
03644 //                       ViewStexGrid
03645 //              independent of the ROOT file => StexNumber as argument
03646 //
03647 //==========================================================================
03648 void TEcnaHistos::ViewStexGrid(const Int_t& StexNumber, const TString  c_option)
03649 {
03650  //Grid of one Stex with axis Hoco and Veco
03651 
03652   if( fFlagSubDet ==  "EB"){ViewSMGrid(StexNumber, c_option);}
03653   if( fFlagSubDet ==  "EE"){ViewDeeGrid(StexNumber, c_option);}
03654 
03655 } // end of ViewStexGrid
03656 
03657 //&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&  S P E C I F I C  &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
03658 
03659 //=======================================      BARREL       ===============================
03660 void TEcnaHistos::SMTowerNumbering(const Int_t& SMNumber)
03661 {
03662   //display the tower numbering of the super-module
03663 
03664   if( (SMNumber > 0) && (SMNumber <= fEcal->MaxSMInEB()) )
03665     {
03666       Int_t  GeoBidSizeEta = fEcal->MaxTowEtaInSM()*fEcal->MaxCrysEtaInTow();
03667       Int_t  GeoBidSizePhi = fEcal->MaxTowPhiInSM()*fEcal->MaxCrysPhiInTow();
03668 
03669       Int_t  nb_binx  = GeoBidSizeEta;
03670       Int_t  nb_biny  = GeoBidSizePhi;
03671       Axis_t xinf_bid = (Axis_t)0.;
03672       Axis_t xsup_bid = (Axis_t)GeoBidSizeEta;
03673       Axis_t yinf_bid = (Axis_t)0.;
03674       Axis_t ysup_bid = (Axis_t)GeoBidSizePhi;   
03675   
03676       TString axis_x_var_name = "  #eta  ";
03677       TString axis_y_var_name = "  #varphi  ";
03678 
03679       //------------------------------------------------------------------- SMTowerNumbering
03680   
03681       //............. matrices reading and histogram filling
03682       char* f_in_mat_tit = new char[fgMaxCar];                           fCnew++;
03683 
03684       sprintf(f_in_mat_tit, "SM tower numbering");
03685 
03686       // il faut tracer un bidim vide pour pouvoir tracer la grille et les axes
03687 
03688       TH2D* h_empty_bid = new TH2D("grid_bidim_eta_phi", f_in_mat_tit,
03689                                    nb_binx, xinf_bid, xsup_bid,
03690                                    nb_biny, yinf_bid, ysup_bid);     fCnewRoot++; 
03691       h_empty_bid->Reset();
03692   
03693       h_empty_bid->GetXaxis()->SetTitle(axis_x_var_name);
03694       h_empty_bid->GetYaxis()->SetTitle(axis_y_var_name);
03695 
03696       // ------------------------------------------------ P L O T S   (SMTowerNumbering)
03697   
03698       char* f_in = new char[fgMaxCar];                           fCnew++;
03699   
03700       //...................... Taille/format canvas
03701   
03702       UInt_t canv_h = fCnaParHistos->CanvasFormatH("etaphiSM");
03703       UInt_t canv_w = fCnaParHistos->CanvasFormatW("etaphiSM");
03704   
03705       //............................................... options generales
03706 
03707       fFapStexBarrel = fEcalNumbering->GetSMHalfBarrel(SMNumber);
03708 
03709       //............................................... paves commentaires (SMTowerNumbering)
03710       SetAllPavesViewStex("Numbering", SMNumber);         
03711 
03712       //------------------------------------ Canvas name ----------------- (SMTowerNumbering)  
03713 
03714       sprintf(f_in, "tower_numbering_for_SuperModule_SM%d", SMNumber);
03715   
03716       SetHistoPresentation((TH1D*)h_empty_bid,"Stex2DEB");
03717 
03718       TCanvas *MainCanvas = new TCanvas(f_in, f_in, canv_w, canv_h);   fCnewRoot++;
03719       fCurrentCanvas = MainCanvas; fCurrentCanvasName = f_in;
03720 
03721       // cout << "*TEcnaHistosEB::ViewSM(...)> Plot is displayed on canvas ----> " << f_in << endl;
03722   
03723       delete [] f_in; f_in = 0;                                 fCdelete++;
03724 
03725       //------------------------ Canvas draw and update ------------ (SMTowerNumbering)  
03726       fPavComStex->Draw();
03727   
03728       Double_t x_margin = fCnaParHistos->BoxLeftX("bottom_left_box") - 0.005;
03729       Double_t y_margin = fCnaParHistos->BoxTopY("bottom_right_box") + 0.005; 
03730       MainCanvas->Divide(1, 1, x_margin, y_margin);
03731       gPad->cd(1);
03732 
03733       h_empty_bid->DrawCopy("COL");   // il faut tracer un bidim vide pour pouvoir tracer la grille et les axes
03734 
03735       ViewSMTowerNumberingPad(SMNumber);
03736       gPad->Update();
03737   
03738       //..................... retour aux options standard
03739       Bool_t b_true = 1;
03740       h_empty_bid->SetStats(b_true);    
03741   
03742       h_empty_bid->Delete();  h_empty_bid = 0;            fCdeleteRoot++;      
03743   
03744       //      delete MainCanvas;              fCdeleteRoot++;
03745   
03746       delete [] f_in_mat_tit;  f_in_mat_tit = 0;         fCdelete++;
03747     }
03748   else
03749     {
03750       cout << "!TEcnaHistos::SMTowerNumbering(...)> SM = " << SMNumber
03751            << ". Out of range ( range = [1," << fEcal->MaxSMInEB() << "] )" << fTTBELL << endl;
03752     }
03753 }
03754 // end of SMTowerNumbering
03755 
03756 void TEcnaHistos::ViewSMTowerNumberingPad(const Int_t& SMNumber)
03757 {
03758   //display the tower numbering of the super-module in a Pad
03759 
03760   gStyle->SetTitleW(0.2);        // taille titre histos
03761   gStyle->SetTitleH(0.07);
03762 
03763   ViewSMGrid(SMNumber, " ");
03764 
03765   Color_t couleur_rouge      = fCnaParHistos->SetColorsForNumbers("lvrb_top");
03766   Color_t couleur_bleu_fonce = fCnaParHistos->SetColorsForNumbers("lvrb_bottom");
03767 
03768   //..... Ecriture des numeros de tours dans la grille..... (ViewSMTowerNumberingPad)
03769 
03770   char* f_in = new char[fgMaxCar];                           fCnew++;
03771   gStyle->SetTextSize(0.075);
03772 
03773   // x_channel, y_channel: coordinates of the text "Txx"
03774   Int_t y_channel = 12;
03775   Int_t x_channel = 12;
03776 
03777   Int_t max_tow_phi = fEcal->MaxTowPhiInSM()*fEcal->MaxCrysPhiInTow();
03778 
03779   //------------------ LOOP ON THE SM_TOWER NUMBER   (ViewSMTowerNumberingPad)
03780 
03781   TText *text_SMtow_num = new TText();        fCnewRoot++;
03782 
03783   for (Int_t i_SMtow = 1; i_SMtow <= fEcal->MaxTowInSM(); i_SMtow++)
03784     {
03785       if(fEcalNumbering->GetTowerLvrbType(i_SMtow) == "top")
03786         {text_SMtow_num->SetTextColor(couleur_rouge);}
03787       if(fEcalNumbering->GetTowerLvrbType(i_SMtow) == "bottom")
03788         {text_SMtow_num->SetTextColor(couleur_bleu_fonce);}
03789 
03790       //................................ x from eta
03791       Double_t x_from_eta = fEcalNumbering->GetEta(SMNumber, i_SMtow, x_channel) - (Double_t)1;
03792       if(fEcalNumbering->GetSMHalfBarrel(SMNumber) == "EB-")
03793       {x_from_eta = fEcal->MaxTowEtaInSM()*fEcal->MaxCrysEtaInTow() + x_from_eta + (Double_t)1;}
03794 
03795       //................................ y from phi
03796       Double_t y_from_phi = max_tow_phi - 1
03797         - (fEcalNumbering->GetPhi(SMNumber, i_SMtow, y_channel) - fEcalNumbering->GetPhiMin(SMNumber));
03798       if( fEcalNumbering->GetSMHalfBarrel(SMNumber) == "EB-")
03799         {y_from_phi = - y_from_phi + fEcal->MaxTowPhiInSM()*fEcal->MaxCrysPhiInTow() - (Double_t)1;}
03800 
03801       sprintf(f_in, "%d", i_SMtow);
03802       text_SMtow_num->DrawText(x_from_eta, y_from_phi, f_in);  // <=== prend du temps si on mets "T%d" dans le sprintf
03803     }
03804 
03805   text_SMtow_num->Delete();    text_SMtow_num = 0;         fCdeleteRoot++;
03806 
03807   //.................................................... legende (ViewSMTowerNumberingPad)
03808   Double_t offset_tow_tex_eta = (Double_t)8.;
03809   Double_t offset_tow_tex_phi = (Double_t)15.;
03810 
03811   Color_t couleur_noir = fCnaParHistos->ColorDefinition("noir");
03812   Double_t x_legend    = (Double_t)0.;
03813   Double_t y_legend    = (Double_t)0.;
03814 
03815   Int_t ref_tower = fEcal->MaxTowInSM();
03816 
03817   //.................................................  LVRB TOP (ViewSMTowerNumberingPad)
03818   gStyle->SetTextSize(0.075);  
03819   gStyle->SetTextColor(couleur_rouge);
03820   x_legend = fEcalNumbering->GetEta(SMNumber, ref_tower, x_channel);
03821   y_legend = fEcalNumbering->GetPhi(SMNumber, ref_tower, y_channel) - fEcalNumbering->GetPhiMin(SMNumber);
03822 
03823   if( fEcalNumbering->GetSMHalfBarrel(SMNumber) == "EB+" )
03824     {
03825       x_legend = x_legend + offset_tow_tex_eta;
03826       y_legend = y_legend + offset_tow_tex_phi;
03827     }
03828   if( fEcalNumbering->GetSMHalfBarrel(SMNumber) == "EB-" )
03829     {
03830       x_legend = -x_legend + offset_tow_tex_eta;
03831       y_legend =  y_legend + offset_tow_tex_phi;
03832     }
03833 
03834   sprintf( f_in, "xx");
03835   TText *text_legend_rouge = new TText(x_legend, y_legend, f_in);        fCnewRoot++;
03836   text_legend_rouge->Draw();
03837   gStyle->SetTextSize(0.05);
03838   x_legend = x_legend - (Double_t)3.5;
03839   y_legend = y_legend - (Double_t)2.;
03840   sprintf(f_in, "       LVRB     ");
03841   TText *text_legend_rouge_expl = new TText(x_legend, y_legend, f_in);        fCnewRoot++;
03842   text_legend_rouge_expl->Draw();
03843   y_legend = y_legend - (Double_t)1.75;
03844   if( fEcalNumbering->GetSMHalfBarrel(SMNumber) == "EB+" ){sprintf(f_in, "        <---  ");}
03845   if( fEcalNumbering->GetSMHalfBarrel(SMNumber) == "EB-" ){sprintf(f_in, "        --->  ");}
03846   TText *text_legend_rouge_expm = new TText(x_legend, y_legend, f_in);        fCnewRoot++;
03847   text_legend_rouge_expm->Draw();
03848   //text_legend_rouge_expl->Delete();   text_legend_rouge_expl = 0;          fCdeleteRoot++;
03849   
03850   //.................................................  LVRB BOTTOM (ViewSMTowerNumberingPad)
03851   gStyle->SetTextSize(0.075);  
03852   gStyle->SetTextColor(couleur_bleu_fonce);
03853   x_legend = fEcalNumbering->GetEta(SMNumber, ref_tower, x_channel);
03854   y_legend = fEcalNumbering->GetPhi(SMNumber, ref_tower, y_channel) - fEcalNumbering->GetPhiMin(SMNumber); 
03855 
03856   if( fEcalNumbering->GetSMHalfBarrel(SMNumber) == "EB+" )
03857     {
03858       x_legend = x_legend + offset_tow_tex_eta;
03859       y_legend = y_legend + offset_tow_tex_phi/3;
03860     }
03861   if( fEcalNumbering->GetSMHalfBarrel(SMNumber) == "EB-" )
03862     {
03863       x_legend = -x_legend + offset_tow_tex_eta;
03864       y_legend =  y_legend + offset_tow_tex_phi/3;
03865     }
03866 
03867   sprintf(f_in, "xx");
03868   TText *text_legend_bleu = new TText(x_legend, y_legend, f_in);        fCnewRoot++;
03869   text_legend_bleu->Draw();
03870   //text_legend_bleu->Delete();   text_legend_bleu = 0;          fCdeleteRoot++;
03871   gStyle->SetTextSize(0.05);
03872   x_legend = x_legend - (Double_t)3.5;
03873   y_legend = y_legend - (Double_t)2.;
03874   sprintf( f_in, "       LVRB     ");
03875   TText *text_legend_bleu_expl = new TText(x_legend, y_legend, f_in);        fCnewRoot++;
03876   text_legend_bleu_expl->Draw();
03877   y_legend = y_legend - (Double_t)1.75;
03878   if( fEcalNumbering->GetSMHalfBarrel(SMNumber) == "EB+" ){sprintf( f_in, "        --->  ");}
03879   if( fEcalNumbering->GetSMHalfBarrel(SMNumber) == "EB-" ){sprintf( f_in, "        <---  ");}
03880   TText *text_legend_bleu_expm = new TText(x_legend, y_legend, f_in);        fCnewRoot++;
03881   text_legend_bleu_expm->Draw();
03882   //text_legend_bleu_expl->Delete();   text_legend_bleu_expl = 0;          fCdeleteRoot++;
03883   
03884   delete [] f_in;   f_in = 0;                                    fCdelete++;
03885 
03886   gStyle->SetTextColor(couleur_noir);
03887 }
03888 //---------------->  end of ViewSMTowerNumberingPad()
03889 
03890 void TEcnaHistos::ViewSMGrid(const Int_t& SMNumber, const TString c_option)
03891 {
03892  //Grid of one supermodule with axis eta and phi
03893 
03894   Int_t  GeoBidSizeEta = fEcal->MaxTowEtaInSM()*fEcal->MaxCrysEtaInTow();
03895   Int_t  GeoBidSizePhi = fEcal->MaxTowPhiInSM()*fEcal->MaxCrysPhiInTow();
03896 
03897   if ( c_option == "corcc")
03898     {
03899       GeoBidSizeEta = fEcal->MaxTowEtaInSM()*fEcal->MaxCrysInTow();
03900       GeoBidSizePhi = fEcal->MaxTowPhiInSM()*fEcal->MaxCrysInTow();
03901     }
03902 
03903   Int_t  nb_binx  = GeoBidSizeEta;
03904   Int_t  nb_biny  = GeoBidSizePhi;
03905   Axis_t xinf_bid = (Axis_t)0.;
03906   Axis_t xsup_bid = (Axis_t)GeoBidSizeEta;
03907   Axis_t yinf_bid = (Axis_t)0.;
03908   Axis_t ysup_bid = (Axis_t)GeoBidSizePhi;   
03909   
03910   //---------------- trace de la grille: un rectangle = une tour
03911 
03912   Int_t size_eta = fEcal->MaxCrysEtaInTow();
03913   Int_t size_phi = fEcal->MaxCrysPhiInTow();
03914   if ( c_option == "corcc")
03915     {
03916       size_eta = fEcal->MaxCrysInTow();
03917       size_phi = fEcal->MaxCrysInTow();
03918     }
03919   Int_t max_x = nb_binx/size_eta;
03920   Int_t max_y = nb_biny/size_phi;
03921 
03922   //............................. lignes horizontales
03923   Double_t yline = (Double_t)yinf_bid;
03924 
03925   Double_t xline_left  = (Double_t)xinf_bid;
03926   Double_t xline_right = (Double_t)xsup_bid;
03927   
03928   for( Int_t j = 0 ; j < max_y ; j++)
03929     {
03930       yline = yline + (Double_t)size_phi;
03931       TLine *lin;
03932       lin = new TLine(xline_left, yline, xline_right, yline); fCnewRoot++;
03933       lin->Draw();
03934       // delete lin;             fCdeleteRoot++;
03935     }
03936 
03937   //.......................... lignes verticales
03938   Double_t xline = (Double_t)xinf_bid - (Double_t)size_eta;
03939   
03940   Double_t yline_bot = (Double_t)yinf_bid;
03941   Double_t yline_top = (Double_t)ysup_bid;
03942   
03943   Color_t coul_surligne = fCnaParHistos->ColorDefinition("noir");
03944   Color_t coul_textmodu = fCnaParHistos->ColorDefinition("vert36");
03945 
03946   //............................ Mj text
03947   gStyle->SetTextColor(coul_textmodu);
03948   gStyle->SetTextSize(0.075);
03949 
03950   char* f_in = new char[fgMaxCar];                           fCnew++;
03951 
03952   for( Int_t i = 0 ; i < max_x ; i++)
03953     {  
03954       xline = xline + (Double_t)size_eta;
03955       TLine *lin;
03956       lin = new TLine(xline, yline_bot, xline, yline_top); fCnewRoot++;
03957       
03958       //............. Surlignage separateur des modules
03959       if( (fEcalNumbering->GetSMHalfBarrel(SMNumber) == "EB-") && (i == 4 || i == 8 || i == 12) )
03960         {lin->SetLineWidth(2); lin->SetLineColor(coul_surligne);}      
03961       if( (fEcalNumbering->GetSMHalfBarrel(SMNumber) == "EB+") && (i == 5 || i == 9 || i == 13) )
03962         {lin->SetLineWidth(2); lin->SetLineColor(coul_surligne);}
03963        
03964       lin->Draw();
03965       // delete lin;             fCdeleteRoot++;
03966 
03967       //............. Numeros des modules
03968       if( (fEcalNumbering->GetSMHalfBarrel(SMNumber) == "EB-") && (i == 2 || i == 6 || i == 10 || i == 14)  )
03969         {
03970           if( i ==  2 ){sprintf( f_in, "M4");}
03971           if( i ==  6 ){sprintf( f_in, "M3");}
03972           if( i == 10 ){sprintf( f_in, "M2");}
03973           if( i == 14 ){sprintf( f_in, "M1");}
03974 
03975           TText *text_num_module = new TText(xline + 1, yline_top + 1, f_in);        fCnewRoot++;
03976           text_num_module->Draw();
03977           //text_num_module->Delete(); text_num_module = 0;      fCdeleteRoot++;      
03978         }      
03979       if( (fEcalNumbering->GetSMHalfBarrel(SMNumber) == "EB+") && (i == 3 || i == 7 || i == 11 || i == 15)  )
03980         {
03981           if( i ==  3 ){sprintf( f_in, "M1");}
03982           if( i ==  7 ){sprintf( f_in, "M2");}
03983           if( i == 11 ){sprintf( f_in, "M3");}
03984           if( i == 15 ){sprintf( f_in, "M4");}
03985          
03986           TText *text_num_module = new TText(xline, yline_top + 1, f_in);        fCnewRoot++;
03987           text_num_module->Draw();
03988           //text_num_module->Delete();  text_num_module = 0;    fCdeleteRoot++;     
03989         }
03990     }
03991   delete [] f_in;   f_in = 0;    fCdelete++;
03992 
03993   //------------------ trace axes en eta et phi --------------- ViewSMGrid
03994 
03995   Int_t MatSize      = fEcal->MaxCrysEtaInTow();
03996   if ( c_option == "corcc"){MatSize = fEcal->MaxCrysInTow();}
03997 
03998   Int_t size_eta_sm  = fEcal->MaxTowEtaInSM();
03999   Int_t size_phi_sm  = fEcal->MaxTowPhiInSM();
04000 
04001   //...................................................... Axe i(eta) (bottom x) ViewSMGrid
04002   Double_t eta_min = fEcalNumbering->GetIEtaMin(SMNumber);
04003   Double_t eta_max = fEcalNumbering->GetIEtaMax(SMNumber);
04004 
04005   TString  x_var_name  = GetHocoVecoAxisTitle("ietaSM");;
04006   TString  x_direction = fEcalNumbering->GetXDirectionEB(SMNumber);
04007 
04008   Float_t tit_siz_x = fCnaParHistos->AxisTitleSize();
04009   Float_t lab_siz_x = fCnaParHistos->AxisLabelSize("SMx");
04010   Float_t tic_siz_x = fCnaParHistos->AxisTickSize("SMx");
04011   Float_t tit_off_x = fCnaParHistos->AxisTitleOffset("SMx");
04012   Float_t lab_off_x = fCnaParHistos->AxisLabelOffset("SMx");
04013 
04014   TF1 *f1 = new TF1("f1", x_direction.Data(), eta_min, eta_max);          fCnewRoot++;
04015     TGaxis* sup_axis_x = 0;
04016 
04017   if( x_direction == "-x" ) // NEVER  IN THIS CASE: xmin->xmax <=> right->left ("-x") direction
04018     {sup_axis_x = new TGaxis( (Float_t)0., (Float_t)0., (Float_t)(size_eta_sm*MatSize), (Float_t)0.,
04019                               "f1", size_eta_sm, "SC" , 0.);   fCnewRoot++;}
04020 
04021   if( x_direction == "x" )  // ALWAYS IN THIS CASE: xmin->xmax <=> left->right ("x") direction    
04022     {sup_axis_x = new TGaxis( (Float_t)0., (Float_t)0., (Float_t)(size_eta_sm*MatSize), (Float_t)0.,
04023                               "f1", size_eta_sm, "SC" , 0.);   fCnewRoot++;}
04024   
04025   sup_axis_x->SetTitle(x_var_name);
04026   sup_axis_x->SetTitleSize(tit_siz_x);
04027   sup_axis_x->SetTitleOffset(tit_off_x);
04028   sup_axis_x->SetLabelSize(lab_siz_x);
04029   sup_axis_x->SetLabelOffset(lab_off_x);
04030   sup_axis_x->SetTickSize(tic_siz_x);
04031   sup_axis_x->Draw("SAME");
04032 
04033   //...................................................... Axe phi (y) ViewSMGrid
04034   Double_t phi_min = fEcalNumbering->GetPhiMin(SMNumber);
04035   Double_t phi_max = fEcalNumbering->GetPhiMax(SMNumber);
04036 
04037   TString  y_var_name  = GetHocoVecoAxisTitle("phi");
04038   TString  y_direction = fEcalNumbering->GetYDirectionEB(SMNumber);
04039 
04040   Float_t tit_siz_y = fCnaParHistos->AxisTitleSize();
04041   Float_t lab_siz_y = fCnaParHistos->AxisLabelSize("SMy");
04042   Float_t tic_siz_y = fCnaParHistos->AxisTickSize("SMy");
04043   Float_t tit_off_y = fCnaParHistos->AxisTitleOffset("SMy");
04044   Float_t lab_off_y = fCnaParHistos->AxisLabelOffset("SMy");
04045 
04046   TF1 *f2 = new TF1("f2", y_direction.Data(), phi_min, phi_max);           fCnewRoot++;
04047   TGaxis* sup_axis_y = 0;
04048   
04049   if ( y_direction == "-x" ) // ALWAYS IN THIS CASE: ymin->ymax <=> top->bottom ("-x") direction
04050     {sup_axis_y = new TGaxis(-(Float_t)1.5*(Float_t)size_eta, (Float_t)0.,
04051                              -(Float_t)1.5*(Float_t)size_eta, (Float_t)(size_phi_sm*MatSize),
04052                              "f2", (Int_t)size_phi_sm, "SC", 0.);   fCnewRoot++;}
04053   
04054   if ( y_direction == "x" )  // NEVER  IN THIS CASE: ymin->ymax <=> bottom->top ("x") direction
04055     {sup_axis_y = new TGaxis(-(Float_t)1.5*(Float_t)size_eta, (Float_t)0.,
04056                              -(Float_t)1.5*(Float_t)size_eta, (Float_t)(size_phi_sm*MatSize),
04057                              "f2", (Int_t)size_phi_sm, "SC", 0.);   fCnewRoot++;}
04058   
04059   sup_axis_y->SetTitle(y_var_name);
04060   sup_axis_y->SetTitleSize(tit_siz_y);
04061   sup_axis_y->SetTitleOffset(tit_off_y);
04062   sup_axis_y->SetLabelSize(lab_siz_y);
04063   sup_axis_y->SetLabelOffset(lab_off_y);
04064   sup_axis_y->SetTickSize(tic_siz_y);
04065   sup_axis_y->Draw("SAME");
04066 
04067   //...................................................... Axe jphi (jy) ViewSMGrid
04068   Double_t jphi_min     = fEcalNumbering->GetJPhiMin(SMNumber);
04069   Double_t jphi_max     = fEcalNumbering->GetJPhiMax(SMNumber);
04070 
04071   TString  jy_var_name  = " ";
04072   TString  jy_direction = fEcalNumbering->GetJYDirectionEB(SMNumber);
04073 
04074   TF1 *f3 = new TF1("f3", jy_direction.Data(), jphi_min, jphi_max);           fCnewRoot++;
04075   TGaxis* sup_axis_jy = 0;
04076   
04077   //............; essai
04078   sup_axis_jy = new TGaxis((Float_t)0., (Float_t)0.,
04079                            (Float_t)0., (Float_t)(size_phi_sm*MatSize),
04080                            "f3", (Int_t)size_phi_sm, "SC", 0.);   fCnewRoot++;
04081   
04082   if ( jy_direction == "-x" ) // IN THIS CASE FOR EB+: ymin->ymax <=> top->bottom ("-x") direction
04083     {jy_var_name  = GetEtaPhiAxisTitle("jphiSMB+");}
04084   
04085   if ( jy_direction == "x" )  // IN THIS CASE FOR EB-: ymin->ymax <=> bottom->top ("x") direction
04086     {jy_var_name  = GetEtaPhiAxisTitle("jphiSMB-");}
04087   
04088   lab_off_y = fCnaParHistos->AxisLabelOffset("SMyInEB");
04089 
04090   sup_axis_jy->SetTitle(jy_var_name);
04091   sup_axis_jy->SetTitleSize(tit_siz_y);
04092   sup_axis_jy->SetTitleOffset(tit_off_y);
04093   sup_axis_jy->SetLabelSize(lab_siz_y);
04094   sup_axis_jy->SetLabelOffset(lab_off_y);
04095   sup_axis_jy->SetTickSize(tic_siz_y);
04096   sup_axis_jy->Draw("SAME");
04097 
04098   //--------------------------- ViewSMGrid
04099           
04100   f1 = 0;
04101   f2 = 0;
04102   f3 = 0;
04103 
04104   gStyle->SetTextColor(fCnaParHistos->ColorDefinition("noir"));
04105 
04106 } // end of ViewSMGrid
04107 
04108 //=======================================      ENDCAP       ===============================
04109 void TEcnaHistos::DeeSCNumbering(const Int_t& DeeNumber)
04110 {
04111   //display the SC numbering of the Dee
04112 
04113   if( (DeeNumber > 0) && (DeeNumber <= fEcal->MaxDeeInEE()) )
04114     {
04115       Int_t  GeoBidSizeIX = fEcal->MaxSCIXInDee()*fEcal->MaxCrysIXInSC();
04116       Int_t  GeoBidSizeIY = fEcal->MaxSCIYInDee()*fEcal->MaxCrysIYInSC();
04117 
04118       Int_t  nb_binx  = GeoBidSizeIX;
04119       Int_t  nb_biny  = GeoBidSizeIY;
04120       Axis_t xinf_bid = (Axis_t)0.;
04121       Axis_t xsup_bid = (Axis_t)GeoBidSizeIX;
04122       Axis_t yinf_bid = (Axis_t)0.;
04123       Axis_t ysup_bid = (Axis_t)GeoBidSizeIY;   
04124   
04125       TString axis_x_var_name = "  IX  ";
04126       TString axis_y_var_name = "  IY  ";
04127 
04128       //------------------------------------------------------------------- DeeSCNumbering
04129       //........................................... empty histogram filling
04130       char* f_in_mat_tit = new char[fgMaxCar];                           fCnew++;
04131 
04132       sprintf(f_in_mat_tit, " Dee SC numbering ");
04133 
04134       // il faut tracer un bidim vide pour pouvoir tracer la grille et les axes
04135 
04136       TH2D* h_empty_bid = new TH2D("grid_bidim_IX_IY", f_in_mat_tit,
04137                                    nb_binx, xinf_bid,  xsup_bid,
04138                                    nb_biny, yinf_bid,  ysup_bid);     fCnewRoot++;
04139       h_empty_bid->Reset();
04140   
04141       h_empty_bid->GetXaxis()->SetTitle(axis_x_var_name);
04142       h_empty_bid->GetYaxis()->SetTitle(axis_y_var_name);
04143 
04144       // ------------------------------------------------ P L O T S   (DeeSCNumbering)
04145   
04146       char* f_in = new char[fgMaxCar];                           fCnew++;
04147   
04148       //...................... Taille/format canvas
04149   
04150       UInt_t canv_h = fCnaParHistos->CanvasFormatH("IXIYDee");
04151       UInt_t canv_w = fCnaParHistos->CanvasFormatW("IXIYDee");
04152   
04153       //............................................... options generales
04154       fFapStexType = fEcalNumbering->GetEEDeeType(DeeNumber);
04155 
04156       //............................................... paves commentaires (DeeSCNumbering)
04157       SetAllPavesViewStex("Numbering", DeeNumber);
04158 
04159       //------------------------------------ Canvas name ----------------- (DeeSCNumbering)  
04160 
04161       sprintf(f_in, "SC_numbering_for_Dee_Dee%d", DeeNumber);
04162       SetHistoPresentation((TH1D*)h_empty_bid,"Stex2DEENb");
04163       TCanvas *MainCanvas = new TCanvas(f_in, f_in, canv_w, canv_h);   fCnewRoot++;
04164       fCurrentCanvas = MainCanvas; fCurrentCanvasName = f_in;
04165 
04166       // cout << "*TEcnaHistosEE::ViewDee(...)> Plot is displayed on canvas ----> " << f_in << endl;
04167   
04168       delete [] f_in; f_in = 0;                                 fCdelete++;
04169 
04170       //------------------------ Canvas draw and update ------------ (DeeSCNumbering)  
04171       fPavComStex->Draw();
04172       fPavComCxyz->Draw();
04173   
04174       Double_t x_low = fCnaParHistos->BoxLeftX("bottom_left_box")    - 0.005;
04175       Double_t x_up  = fCnaParHistos->BoxRightX("bottom_right_box")  + 0.005;
04176       Double_t y_low = fCnaParHistos->BoxTopY("bottom_left_box")     + 0.005;
04177       Double_t y_up  = fCnaParHistos->BoxBottomY("top_left_box_Dee") - 0.005;
04178   
04179       Double_t x_margin = x_low;
04180       Double_t y_margin = y_low;
04181   
04182       MainCanvas->Divide( 1,  1, x_margin, y_margin);
04183       //           Divide(nx, ny, x_margin, y_margin,    color);
04184   
04185       gPad->cd(1);
04186       TVirtualPad* main_subpad = gPad;
04187       main_subpad->SetPad(x_low, y_low, x_up, y_up);
04188   
04189       h_empty_bid->DrawCopy("COL");   // il faut tracer un bidim vide pour pouvoir tracer la grille et les axes
04190       ViewDeeSCNumberingPad(DeeNumber);
04191       gPad->Update();   // prend beaucoup de temps...
04192   
04193       //..................... retour aux options standard
04194       Bool_t b_true = 1;
04195       h_empty_bid->SetStats(b_true);    
04196   
04197       h_empty_bid->Delete(); h_empty_bid = 0;             fCdeleteRoot++;      
04198 
04199       //      delete MainCanvas;              fCdeleteRoot++;
04200   
04201       delete [] f_in_mat_tit;  f_in_mat_tit = 0;         fCdelete++;
04202     }
04203   else
04204     {
04205       cout << "!TEcnaHistos::DeeSCNumbering(...)> Dee = " << DeeNumber
04206            << ". Out of range ( range = [1," << fEcal->MaxDeeInEE() << "] )" << fTTBELL << endl;
04207     }
04208 }
04209 // end of DeeSCNumbering
04210 
04211 void TEcnaHistos::ViewDeeSCNumberingPad(const Int_t&   DeeNumber)
04212 {
04213 //display the SC numbering of the Dee in a Pad
04214 
04215   gStyle->SetTitleW(0.4);        // taille titre histos
04216   gStyle->SetTitleH(0.08);
04217 
04218   ViewDeeGrid(DeeNumber, " ");
04219 
04220   //..... SC numbers writing in the grid .... (ViewDeeSCNumberingPad)
04221 
04222   char* f_in = new char[fgMaxCar];                           fCnew++;
04223   gStyle->SetTextSize(0.0325);
04224 
04225   //------------------ LOOP ON THE Dee_SC NUMBER   (ViewDeeSCNumberingPad)
04226   Int_t x_channel =  0;    // => defined here after according to DeeDir and SCQuadType
04227   TText *text_DSSC_num      = new TText();        fCnewRoot++;
04228   TText *text_DeeSCCons_num = new TText();        fCnewRoot++;
04229 
04230   for (Int_t n1DeeSCEcna = 1; n1DeeSCEcna <= fEcal->MaxSCEcnaInDee(); n1DeeSCEcna++)
04231     {
04232       TString DeeDir     = fEcalNumbering->GetDeeDirViewedFromIP(DeeNumber);
04233       TString SCQuadType = fEcalNumbering->GetSCQuadFrom1DeeSCEcna(n1DeeSCEcna);
04234       if( SCQuadType == "top"    &&  DeeDir == "right"){x_channel = 13;}
04235       if( SCQuadType == "top"    &&  DeeDir == "left" ){x_channel =  7;}
04236       if( SCQuadType == "bottom" &&  DeeDir == "left" ){x_channel = 11;}  
04237       if( SCQuadType == "bottom" &&  DeeDir == "right"){x_channel = 17;}
04238       Int_t i_SCEcha = (Int_t)x_channel;
04239 
04240       Double_t x_from_IX = (Double_t)GetXCrysInStex(DeeNumber, n1DeeSCEcna, i_SCEcha);
04241       Double_t y_from_IY = (Double_t)GetYCrysInStex(DeeNumber, n1DeeSCEcna, i_SCEcha);
04242       Double_t y_from_IYp = y_from_IY + (Double_t)1.;
04243       Double_t y_from_IYm = y_from_IY - (Double_t)1.;
04244 
04245       TString DeeEndcap  = fEcalNumbering->GetEEDeeEndcap(DeeNumber);
04246       Color_t couleur_SC = GetSCColor(DeeEndcap, DeeDir, SCQuadType);
04247       text_DSSC_num->SetTextColor(couleur_SC);
04248       text_DeeSCCons_num->SetTextColor((Color_t)1);
04249 
04250       Int_t i_DSSC      = fEcalNumbering->GetDSSCFrom1DeeSCEcna(DeeNumber, n1DeeSCEcna);
04251       Int_t i_DeeSCCons = fEcalNumbering->GetDeeSCConsFrom1DeeSCEcna(DeeNumber, n1DeeSCEcna);
04252       if( i_DSSC > 0 )
04253         {
04254           if(
04255              //.................................................... (D2,S9) , (D4,S1)
04256               !(i_DeeSCCons ==  33 && n1DeeSCEcna ==  60) &&
04257               !(i_DeeSCCons ==  33 && n1DeeSCEcna == 119) &&
04258               //................................................... (D2,S8) , (D4,S2)
04259               !(i_DeeSCCons ==  29 && n1DeeSCEcna ==  32) &&   // !(29c and 58c)
04260               !(i_DeeSCCons ==  29 && n1DeeSCEcna == 138) &&
04261               !(i_DeeSCCons ==  29 && n1DeeSCEcna == 157) &&
04262               !(i_DeeSCCons ==  58 && n1DeeSCEcna == 176) &&
04263               !(i_DeeSCCons ==  58 && n1DeeSCEcna == 193) &&
04264               //.................................................... (D2,S7) , (D4,S3)
04265               !(i_DeeSCCons == 149 && n1DeeSCEcna == 188) &&
04266               //.................................................... (D2,S6) , (D4,S4)
04267               !(i_DeeSCCons == 112 && n1DeeSCEcna ==  29) &&
04268               !(i_DeeSCCons == 112 && n1DeeSCEcna == 144) &&
04269               !(i_DeeSCCons == 112 && n1DeeSCEcna == 165) &&
04270               !(i_DeeSCCons == 119 && n1DeeSCEcna == 102) &&
04271               !(i_DeeSCCons == 119 && n1DeeSCEcna == 123) &&
04272               //.................................................... (D2,S5) , (D4,S5)
04273               !(i_DeeSCCons == 132 && n1DeeSCEcna ==  41) &&
04274               //----------------------------------------------------------------------
04275               //.................................................... (D1,S1) , (D3,S9)
04276               !(i_DeeSCCons == 182 && n1DeeSCEcna ==  60) &&
04277               !(i_DeeSCCons == 182 && n1DeeSCEcna == 119) &&
04278               //.................................................... (D1,S2) , (D3,S8)
04279               !(i_DeeSCCons == 178 && n1DeeSCEcna ==  32) &&   // !(178c and 207c)
04280               !(i_DeeSCCons == 178 && n1DeeSCEcna == 138) &&
04281               !(i_DeeSCCons == 178 && n1DeeSCEcna == 157) &&
04282               !(i_DeeSCCons == 207 && n1DeeSCEcna == 176) &&
04283               !(i_DeeSCCons == 207 && n1DeeSCEcna == 193) &&
04284               //.................................................... (D1,S3) , (D3,S7)
04285               !(i_DeeSCCons == 298 && n1DeeSCEcna == 188) &&
04286               //.................................................... (D1,S4) , (D3,S6)
04287               !(i_DeeSCCons == 261 && n1DeeSCEcna ==  29) &&   // !(261a and 268a)
04288               !(i_DeeSCCons == 261 && n1DeeSCEcna == 144) &&
04289               !(i_DeeSCCons == 261 && n1DeeSCEcna == 165) &&
04290               !(i_DeeSCCons == 268 && n1DeeSCEcna == 102) &&
04291               !(i_DeeSCCons == 268 && n1DeeSCEcna == 123) &&
04292               //.................................................... (D1,S5) , (D3,S5)
04293               !(i_DeeSCCons == 281 && n1DeeSCEcna ==  41) 
04294               )
04295             {
04296               sprintf(f_in, "%d", i_DSSC);
04297               text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);      // <=== DrawText: prend du temps
04298               sprintf(f_in, "%d", i_DeeSCCons);
04299               text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in); // <=== DrawText: prend du temps
04300             }
04301 
04302           //.................................................... (D2,S9) , (D4,S1)
04303 
04304           if( i_DeeSCCons ==  33 && n1DeeSCEcna ==  60 )
04305             {
04306               sprintf(f_in, "30a");
04307               text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);
04308               sprintf(f_in, "33a");
04309               text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in);
04310             }
04311           if( i_DeeSCCons ==  33 && n1DeeSCEcna == 119 )
04312             {
04313               sprintf(f_in, "30b");
04314               text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);
04315               sprintf(f_in, "33b");
04316               text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in);
04317             }
04318           //.................................................... (D2,S8) , (D4,S2)
04319           if( i_DeeSCCons ==  29 && n1DeeSCEcna == 32 )
04320             {
04321               sprintf(f_in, " 3c-25c");
04322               text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);
04323               sprintf(f_in, "29c-58c");
04324               text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in);
04325             }
04326           if( i_DeeSCCons ==  29 && n1DeeSCEcna == 138 )
04327             {
04328               sprintf(f_in, "3a");
04329               text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);
04330               sprintf(f_in, "29a");
04331               text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in);
04332             }
04333           if( i_DeeSCCons ==  29 && n1DeeSCEcna == 157 )
04334             {
04335               sprintf(f_in, "3b");
04336               text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);
04337               sprintf(f_in, "29b");
04338               text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in);
04339             }
04340 
04341           if( i_DeeSCCons ==  58 && n1DeeSCEcna == 176 )
04342             {
04343               sprintf(f_in, "25a");
04344               text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);
04345               sprintf(f_in, "58a");
04346               text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in);
04347             }
04348           if( i_DeeSCCons ==  58 && n1DeeSCEcna == 193 )
04349             {
04350               sprintf(f_in, "25b");
04351               text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);
04352               sprintf(f_in, "58b");
04353               text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in);
04354             }
04355           //.................................................... (D2,S7) , (D4,S3)
04356           if( i_DeeSCCons == 149 && n1DeeSCEcna == 188 )
04357             {
04358               sprintf(f_in, "34a");
04359               text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);
04360               sprintf(f_in, "149a");
04361               text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in);
04362             }
04363           //.................................................... (D2,S6) , (D4,S4)
04364           if( i_DeeSCCons == 112 && n1DeeSCEcna == 29 )
04365             {
04366               sprintf(f_in, " 14a-21a");
04367               text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);
04368               sprintf(f_in, "112a-119a");
04369               text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in);
04370             }
04371           if( i_DeeSCCons == 112 && n1DeeSCEcna == 144 )
04372             {
04373               sprintf(f_in, "14c");
04374               text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);
04375               sprintf(f_in, "112c");
04376               text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in);
04377             }
04378           if( i_DeeSCCons == 112 && n1DeeSCEcna == 165 )
04379             {
04380               sprintf(f_in, "14a");
04381               text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);
04382               sprintf(f_in, "112b");
04383               text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in);
04384             }
04385 
04386           if( i_DeeSCCons == 119 && n1DeeSCEcna == 102 )
04387             {
04388               sprintf(f_in, "21c");
04389               text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);
04390               sprintf(f_in, "119c");
04391               text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in);
04392             }
04393           if( i_DeeSCCons == 119 && n1DeeSCEcna == 123 )
04394             {
04395               sprintf(f_in, "21b");
04396               text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);
04397               sprintf(f_in, "119b");
04398               text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in);
04399             }
04400           //.................................................... (D2,S5) , (D4,S5)
04401           if( i_DeeSCCons == 132 && n1DeeSCEcna ==  41 )
04402             {
04403               sprintf(f_in, "3a");
04404               text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);
04405               sprintf(f_in, "132a");
04406               text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in);
04407             }
04408 
04409           //.................................................... (D1,S1) , (D3,S9)
04410           if( i_DeeSCCons == 182 && n1DeeSCEcna ==  60 )
04411             {
04412               sprintf(f_in, "30a");
04413               text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);
04414               sprintf(f_in, "182a");
04415               text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in);
04416             }
04417           if( i_DeeSCCons == 182 && n1DeeSCEcna == 119 )
04418             {
04419               sprintf(f_in, "30b");
04420               text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);
04421               sprintf(f_in, "182b");
04422               text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in);
04423             }
04424           //.................................................... (D1,S2) , (D3,S8)
04425           if( i_DeeSCCons == 178 && n1DeeSCEcna == 32 )
04426             {
04427               sprintf(f_in, "  3c-25c");
04428               text_DSSC_num->DrawText(x_from_IX-6, y_from_IYp, f_in);
04429               sprintf(f_in, "178c-207c");
04430               text_DeeSCCons_num->DrawText(x_from_IX-6, y_from_IYm, f_in);
04431             }
04432           if( i_DeeSCCons == 178 && n1DeeSCEcna == 138 )
04433             {
04434               sprintf(f_in, "3a");
04435               text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);
04436               sprintf(f_in, "178a");
04437               text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in);
04438             }
04439           if( i_DeeSCCons == 178 && n1DeeSCEcna == 157 )
04440             {
04441               sprintf(f_in, "3b");
04442               text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);
04443               sprintf(f_in, "178b");
04444               text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in);
04445             }
04446 
04447           if( i_DeeSCCons == 207 && n1DeeSCEcna == 176 )
04448             {
04449               sprintf(f_in, "25a");
04450               text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);
04451               sprintf(f_in, "207a");
04452               text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in);
04453             }
04454           if( i_DeeSCCons == 207 && n1DeeSCEcna == 193 )
04455             {
04456               sprintf(f_in, "25b");
04457               text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);
04458               sprintf(f_in, "207b");
04459               text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in);
04460             }
04461           //.................................................... (D1,S3) , (D3,S7)
04462           if( i_DeeSCCons == 298 && n1DeeSCEcna == 188 )
04463             {
04464               sprintf(f_in, "34a");
04465               text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);
04466               sprintf(f_in, "298a");
04467               text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in);
04468             }
04469           //.................................................... (D1,S4) , (D3,S6)
04470           if( i_DeeSCCons == 261 && n1DeeSCEcna == 29 )
04471             {
04472               sprintf(f_in, " 14a-21a");
04473               text_DSSC_num->DrawText(x_from_IX-6, y_from_IYp, f_in);
04474               sprintf(f_in, "261a-268a");
04475               text_DeeSCCons_num->DrawText(x_from_IX-6, y_from_IYm, f_in);
04476             }
04477           if( i_DeeSCCons == 261 && n1DeeSCEcna == 144 )
04478             {
04479               sprintf(f_in, "14a");
04480               text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);
04481               sprintf(f_in, "261c");
04482               text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in);
04483             }
04484           if( i_DeeSCCons == 261 && n1DeeSCEcna == 165 )
04485             {
04486               sprintf(f_in, "14b");
04487               text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);
04488               sprintf(f_in, "261b");
04489               text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in);
04490             }
04491 
04492           if( i_DeeSCCons == 268 && n1DeeSCEcna == 102 )
04493             {
04494               sprintf(f_in, "21c");
04495               text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);
04496               sprintf(f_in, "268c");
04497               text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in);
04498             }
04499           if( i_DeeSCCons == 268 && n1DeeSCEcna == 123 )
04500             {
04501               sprintf(f_in, "21b");
04502               text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);
04503               sprintf(f_in, "268b");
04504               text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in);
04505             }
04506           //.................................................... (D1,S5) , (D3,S5)
04507           if( i_DeeSCCons == 281 && n1DeeSCEcna ==  41 )
04508             {
04509               sprintf(f_in, "20a");
04510               text_DSSC_num->DrawText(x_from_IX, y_from_IYp, f_in);
04511               sprintf(f_in, "281a");
04512               text_DeeSCCons_num->DrawText(x_from_IX, y_from_IYm, f_in);
04513             }
04514         }
04515     }
04516 
04517   // delete text_DSSC_num;             fCdeleteRoot++;
04518  
04519   //......................... mention "color, black"  
04520   Color_t coul_textcolors = fCnaParHistos->ColorDefinition("noir");
04521   sprintf( f_in, "color: nb in Data Sector, black: nb for construction");
04522   Int_t x_colors = 3;
04523   Int_t y_colors = -14;
04524 
04525   TText *text_colors = new TText(x_colors, y_colors, f_in);        fCnewRoot++;
04526   text_colors->SetTextSize(0.03);
04527   text_colors->SetTextColor(coul_textcolors);
04528   text_colors->Draw();
04529 
04530   delete [] f_in;  f_in = 0;                                     fCdelete++;
04531 
04532   Color_t couleur_noir = fCnaParHistos->ColorDefinition("noir");
04533   gStyle->SetTextColor(couleur_noir);
04534 }
04535 //---------------->  end of ViewDeeSCNumberingPad()
04536 
04537 void TEcnaHistos::ViewDeeGrid(const Int_t& DeeNumber, const TString c_option)
04538 {
04539  //Grid of one Dee with axis IX and IY
04540 
04541   Int_t  GeoBidSizeIX = fEcal->MaxSCIXInDee()*fEcal->MaxCrysIXInSC();
04542   Int_t  GeoBidSizeIY = fEcal->MaxSCIYInDee()*fEcal->MaxCrysIYInSC();
04543 
04544   if ( c_option == "corcc")
04545     {
04546       GeoBidSizeIX = fEcal->MaxSCIXInDee()*fEcal->MaxCrysInSC();
04547       GeoBidSizeIY = fEcal->MaxSCIYInDee()*fEcal->MaxCrysInSC();
04548     }
04549 
04550   Int_t  nb_binx  = GeoBidSizeIX;
04551   Int_t  nb_biny  = GeoBidSizeIY;
04552   Axis_t xinf_bid = (Axis_t)0.;
04553   Axis_t xsup_bid = (Axis_t)GeoBidSizeIX;
04554  
04555   Axis_t   yinf_bid = (Axis_t)0.;
04556   Axis_t   ysup_bid = (Axis_t)GeoBidSizeIY;
04557   Double_t ymid_bid = (Double_t)(ysup_bid-yinf_bid)/2.;
04558  
04559   //---------------- trace de la grille: un rectangle = un super-cristal
04560 
04561   Int_t size_IX = fEcal->MaxCrysIXInSC();
04562   Int_t size_IY = fEcal->MaxCrysIYInSC();
04563 
04564   if ( c_option == "corcc"){size_IX = fEcal->MaxCrysInSC(); size_IY = fEcal->MaxCrysInSC();}
04565 
04566   Int_t max_x  = nb_binx/size_IX;
04567   Int_t max_y  = nb_biny/size_IY;
04568   Int_t max_yd = max_y/2;
04569 
04570   //= SURLIGNAGES (unite de coordonnees: le cristal ou 5 fois le cristal si option corcc)
04571   //........................... multplicative coefficient for corcc option
04572   Int_t coefcc_x = 1;
04573   Int_t coefcc_y = 1;
04574   if ( c_option == "corcc"){coefcc_x = fEcal->MaxCrysIXInSC(); coefcc_y = fEcal->MaxCrysIYInSC();}
04575 
04576   //............................. lignes horizontales
04577   Double_t yline = (Double_t)yinf_bid - (Double_t)size_IY;
04578 
04579   Double_t xline_beg = (Double_t)xinf_bid;
04580   Double_t xline_end = (Double_t)xsup_bid;
04581 
04582   //           k  =   0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10
04583   Int_t x_min[11] = {11,11, 7, 0, 0, 0, 0, 0, 0, 0, 0};
04584   Int_t x_max[11] = {50,50,47,45,45,42,37,35,30,15,50}; 
04585   for(Int_t i=0;i<11;i++){x_min[i] = coefcc_x*x_min[i]; x_max[i] = coefcc_x*x_max[i];}
04586   
04587   for( Int_t j = 0 ; j < max_y ; j++)
04588     {
04589       if( j < max_yd )  // j = 0,1,2,3,4,5,6,7,8,9
04590         {
04591           if( DeeNumber == 1 || DeeNumber == 3 ) 
04592             {
04593               xline_beg = xinf_bid + (Double_t)x_min[10-j];
04594               xline_end = xinf_bid + (Double_t)x_max[10-j];
04595             }
04596           if( DeeNumber == 2 || DeeNumber == 4 ) 
04597             {
04598               xline_beg = xsup_bid - (Double_t)x_max[10-j];
04599               xline_end = xsup_bid - (Double_t)x_min[10-j];
04600             }
04601         }
04602 
04603       if( j == max_yd ) // j = 10
04604         {
04605           if( DeeNumber == 1 || DeeNumber == 3 ) 
04606             {
04607               xline_beg = xinf_bid + (Double_t)x_min[0];
04608               xline_end = xinf_bid + (Double_t)x_max[0];
04609             }
04610           if( DeeNumber == 2 || DeeNumber == 4 ) 
04611             {
04612               xline_beg = xsup_bid - (Double_t)x_max[0];
04613               xline_end = xsup_bid - (Double_t)x_min[0];
04614             }
04615         }
04616 
04617       if( j > max_yd ) // j = 11,12,13,14,15,16,17,18,19,20
04618         {
04619           if( DeeNumber == 1 || DeeNumber == 3 ) 
04620             {
04621               xline_beg = xinf_bid + (Double_t)x_min[j-10];
04622               xline_end = xinf_bid + (Double_t)x_max[j-10];
04623             }
04624           if( DeeNumber == 2 || DeeNumber == 4 ) 
04625             {
04626               xline_beg = xsup_bid - (Double_t)x_max[j-10];
04627               xline_end = xsup_bid - (Double_t)x_min[j-10];
04628             }
04629         }
04630 
04631       yline = yline + (Double_t)size_IY;
04632       TLine *lin;
04633       lin = new TLine(xline_beg, yline, xline_end, yline); fCnewRoot++;
04634       lin->Draw();
04635       //lin->Delete();   // => si on delete, pas de trace de la ligne
04636       // delete lin;             fCdeleteRoot++;
04637     }
04638 
04639   //.......................... lignes verticales
04640   Double_t xline = (Double_t)xinf_bid - (Double_t)size_IX;
04641   
04642   Double_t yline_haut_bot = (Double_t)ymid_bid;
04643   Double_t yline_haut_top = (Double_t)ysup_bid;
04644 
04645   Double_t yline_bas_bot = (Double_t)yinf_bid;
04646   Double_t yline_bas_top = (Double_t)ymid_bid;
04647 
04648   // coordonnees demi-lignes 
04649   //           l  =   0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10
04650   Int_t y_min[11] = { 0,11, 7, 0, 0, 0, 0, 0, 0, 0, 0};
04651   Int_t y_max[11] = {50,50,47,45,45,42,38,35,30,15,10};
04652   for(Int_t i=0;i<11;i++){y_min[i] = coefcc_y*y_min[i]; y_max[i] = coefcc_y*y_max[i];}
04653 
04654   gStyle->SetTextSize(0.075);   //  ===> pourquoi pas avant?
04655 
04656   for( Int_t i = 0 ; i <= max_x ; i++)
04657     {
04658       if( DeeNumber == 1 || DeeNumber == 3 ) 
04659         {
04660           yline_haut_bot = ymid_bid + (Double_t)y_min[i];
04661           yline_haut_top = ymid_bid + (Double_t)y_max[i];
04662         }
04663       if( DeeNumber == 2 || DeeNumber == 4 ) 
04664         {
04665           yline_haut_bot = ymid_bid + (Double_t)y_min[10-i];
04666           yline_haut_top = ymid_bid + (Double_t)y_max[10-i];
04667         }
04668       yline_bas_bot  = ysup_bid - yline_haut_top;
04669       yline_bas_top  = ysup_bid - yline_haut_bot;
04670       
04671       xline = xline + (Double_t)size_IX;
04672       TLine *lin_haut;
04673       lin_haut = new TLine(xline, yline_haut_bot, xline, yline_haut_top); fCnewRoot++;
04674       lin_haut->Draw();
04675       // delete lin_haut;             fCdeleteRoot++;
04676       TLine *lin_bas;
04677       lin_bas = new TLine(xline, yline_bas_bot, xline, yline_bas_top); fCnewRoot++;
04678       lin_bas->Draw();
04679       // delete lin_bas;             fCdeleteRoot++;
04680     }
04681 
04682   EEDataSectors(coefcc_x, coefcc_y, DeeNumber, "Dee");
04683   EEGridAxis(coefcc_x, coefcc_y, DeeNumber, "Dee", c_option);
04684 
04685 } // end of ViewDeeGrid
04686 
04687 //=================================================================================
04688 //
04689 //             SqrtContourLevels(const Int_t& nb_niv, Double_t* cont_niv)
04690 //
04691 //=================================================================================
04692 void TEcnaHistos::SqrtContourLevels(const Int_t& nb_niv, Double_t* cont_niv)
04693 {
04694 //Calculation of levels in z coordinate for 3D plots. Square root scale
04695   
04696   Int_t nb_niv2 = (nb_niv+1)/2;
04697   
04698   for (Int_t num_niv = 0; num_niv < nb_niv2; num_niv++)
04699     {
04700       Int_t ind_niv = num_niv + nb_niv2 - 1;
04701       if ( ind_niv < 0 || ind_niv > nb_niv )
04702         {
04703           cout << "!TEcnaHistos::ContourLevels(...)> *** ERROR *** "
04704                << "wrong contour levels for correlation matrix"
04705                << fTTBELL << endl;
04706         }
04707       else
04708         {
04709           cont_niv[ind_niv] =
04710             (Double_t)(num_niv*num_niv)/
04711             ((Double_t)((nb_niv2-1)*(nb_niv2-1)));
04712         }
04713     }
04714   for (Int_t num_niv = -1; num_niv > -nb_niv2; num_niv--)
04715     {
04716       Int_t ind_niv = num_niv + nb_niv2 - 1;
04717       if ( ind_niv < 0 || ind_niv > nb_niv )
04718         {
04719           cout << "!TEcnaHistos::ContourLevels(...)> *** ERROR *** "
04720                << "wrong contour levels for correlation matrix"
04721                << fTTBELL << endl;
04722         }
04723       else
04724         {
04725           cont_niv[ind_niv] =
04726             -(Double_t)(num_niv*num_niv)/
04727             ((Double_t)((nb_niv2-1)*(nb_niv2-1)));
04728         }
04729     }
04730 }
04731 
04732 //==========================================================================
04733 //
04734 //                    GetHocoVecoAxisTitle
04735 //
04736 //==========================================================================
04737 TString TEcnaHistos::GetHocoVecoAxisTitle(const TString chcode)
04738 {
04739   TString xname = " ";
04740 
04741   if ( fFlagSubDet == "EB" ){xname = GetEtaPhiAxisTitle(chcode);}
04742   if ( fFlagSubDet == "EE" ){xname = GetIXIYAxisTitle(chcode);}
04743 
04744   return xname;
04745 }
04746 
04747 TString TEcnaHistos::GetEtaPhiAxisTitle(const TString chcode)
04748 {
04749   TString xname = " ";
04750 
04751   if ( chcode == "ietaEB" ){xname = "i#eta Xtal ";}
04752   if ( chcode == "ietaSM" ){xname = "i#eta Xtal ";}
04753   if ( chcode == "ietaTow"){xname = "i#eta Xtal        ";}
04754 
04755   if ( chcode == "iphiEB"   ){xname = "         i#varphi Xtal";}
04756   if ( chcode == "jphiEB+"  ){xname = "         i#varphi Xtal";}
04757   if ( chcode == "jphiEB-"  ){xname = "         i#varphi Xtal";}
04758   if ( chcode == "jphiSMB+" ){xname = "         i#varphi Xtal";}
04759   if ( chcode == "jphiSMB-" ){xname = "i#varphi Xtal    ";}
04760   if ( chcode == "jphiTow"  ){xname = "i#varphi Xtal in SM        ";}
04761   if ( chcode == "phi"      ){xname = "i#varphi Xtal in EB  ";}
04762 
04763   return xname;
04764 }
04765 
04766 TString TEcnaHistos::GetIXIYAxisTitle(const TString chcode)
04767 {
04768   TString xname = " ";
04769 
04770   if ( chcode == "iIXDee"  ){xname = "IX(SC)";}
04771 
04772   if ( chcode == "iIXDee1" ){xname = "                                                    -IX Xtal";}
04773   if ( chcode == "iIXDee2" ){xname = " IX Xtal                                                     ";}
04774   if ( chcode == "iIXDee3" ){xname = " IX Xtal";}
04775   if ( chcode == "iIXDee4" ){xname = "-IX Xtal                                                             ";}
04776 
04777   if ( chcode == "iIXEE"   ){xname = "                      IX Xtal";}
04778 
04779   if ( chcode == "iIXSC"  ){xname = "IX Xtal";}
04780 
04781   if ( chcode == "jIYDee" ){xname = "IY Xtal";}
04782   if ( chcode == "jIYSC"  ){xname = "IY Xtal";}
04783   if ( chcode == "IY"     ){xname = "IY";}
04784 
04785   return xname;
04786 }
04787 
04788 //=======================================================================================
04789 //
04790 //                              ViewStas(***)     
04791 //
04792 //           (Hoco,Veco) matrices for all the Stex's of a Stas             
04793 //                        Stas = EB or EE
04794 //
04795 //=======================================================================================
04796 void TEcnaHistos::ViewStas(const TVectorD& arg_read_histo, const Int_t& arg_AlreadyRead,
04797                            const TString   HistoCode)
04798 {
04799 // (Hoco, Veco) matrices for all the Stex's of a Stas
04800 
04801   //......................... matrix title  
04802   char* f_in_mat_tit = new char[fgMaxCar];               fCnew++;
04803           
04804   if (HistoCode == "D_NOE_ChNb"){sprintf(f_in_mat_tit, "Number of Events");}
04805   if (HistoCode == "D_Ped_ChNb"){sprintf(f_in_mat_tit, "Pedestals");}
04806   if (HistoCode == "D_TNo_ChNb"){sprintf(f_in_mat_tit, "Total noise");}
04807   if (HistoCode == "D_MCs_ChNb"){sprintf(f_in_mat_tit, "Mean cor(s,s')");}
04808   if (HistoCode == "D_LFN_ChNb"){sprintf(f_in_mat_tit, "Low frequency noise");}
04809   if (HistoCode == "D_HFN_ChNb"){sprintf(f_in_mat_tit, "High frequency noise");}
04810   if (HistoCode == "D_SCs_ChNb"){sprintf(f_in_mat_tit, "Sigma of cor(s,s')");}
04811           
04812   //.... Axis parameters: *** WARNING *** EB ===>  x (Bid Hoco) = phi (StinVeco),  y (Bid Veco) = eta (StinHoco)
04813   Int_t GeoBidSizeHoco = fEcal->MaxStinVecoInStas();
04814   Int_t GeoBidSizeVeco = fEcal->MaxStinHocoInStas();
04815 
04816   Int_t vertic_empty_strips  = 3;
04817   Int_t vertic_empty_strip_1 = 1;
04818 
04819   if ( fFlagSubDet == "EE" )
04820     {
04821       // for empty vertical strips: before EE-, between EE- and EE+, after EE+ on plot
04822       GeoBidSizeHoco = fEcal->MaxStinHocoInStas() + vertic_empty_strips; 
04823       GeoBidSizeVeco = fEcal->MaxStinVecoInStas();
04824     }
04825 
04826   Int_t  nb_binx  = GeoBidSizeHoco;
04827   Int_t  nb_biny  = GeoBidSizeVeco;
04828   Axis_t xinf_bid = (Axis_t)0.;
04829   Axis_t xsup_bid = (Axis_t)GeoBidSizeHoco;
04830   Axis_t yinf_bid = (Axis_t)0.;
04831   Axis_t ysup_bid = (Axis_t)GeoBidSizeVeco;   
04832       
04833   TString axis_x_var_name = "  #Hoco  ";
04834   TString axis_y_var_name = "  #varVeco  ";
04835 
04836   //............. matrices reading and histogram filling   (ViewStas)
04837 
04838   TH2D* h_geo_bid = new TH2D("geobidim_ViewStas", f_in_mat_tit,
04839                              nb_binx, xinf_bid,   xsup_bid,
04840                              nb_biny, yinf_bid,   ysup_bid);     fCnewRoot++;
04841   h_geo_bid->Reset();
04842 
04843   Int_t CounterExistingFile = 0;
04844   Int_t CounterDataExist = 0;
04845 
04846   Int_t* xFapNbOfEvts = new Int_t[fEcal->MaxStexInStas()];      fCnew++;
04847   for(Int_t i=0; i<fEcal->MaxStexInStas(); i++){xFapNbOfEvts[i]=0;}
04848 
04849   //Int_t* NOFE_int = new Int_t[fEcal->MaxCrysEcnaInStex()];      fCnew++;
04850 
04851   //......................................................................... (ViewStas)
04852   for(Int_t iStasStex=0; iStasStex<fEcal->MaxStexInStas(); iStasStex++)
04853     {
04854       TVectorD partial_histp(fEcal->MaxStinEcnaInStex());
04855       for(Int_t i=0; i<fEcal->MaxStinEcnaInStex(); i++){partial_histp(i)=(Double_t)0.;}
04856 
04857       Bool_t OKFileExists = kFALSE;
04858       Bool_t OKDataExist  = kFALSE;
04859 
04860       if( arg_AlreadyRead == fTobeRead )
04861         {
04862           fMyRootFile->PrintNoComment();
04863           Int_t n1StasStex = iStasStex+1;
04864           fMyRootFile->FileParameters(fFapAnaType,          fFapNbOfSamples,
04865                                       fFapRunNumber,        fFapFirstReqEvtNumber,
04866                                       fFapLastReqEvtNumber, fFapReqNbOfEvts,
04867                                       n1StasStex,           fCfgResultsRootFilePath.Data());
04868           
04869           if ( fMyRootFile->LookAtRootFile() == kTRUE ){OKFileExists = kTRUE;}       //   (ViewStas)
04870 
04871           if( OKFileExists == kTRUE )
04872             {
04873               xFapNbOfEvts[iStasStex] = fMyRootFile->GetNumberOfEvents(fFapReqNbOfEvts);
04874               TString fp_name_short = fMyRootFile->GetRootFileNameShort();
04875               // cout << "*TEcnaHistos::ViewStas(...)> Data are analyzed from file ----> "
04876               //      << fp_name_short << endl;
04877               
04878               //....................... search for first and last dates
04879               if( iStasStex == 0 )
04880                 {
04881                   fStartTime = fMyRootFile->GetStartTime();
04882                   fStopTime  = fMyRootFile->GetStopTime();
04883                   fStartDate = fMyRootFile->GetStartDate();
04884                   fStopDate  = fMyRootFile->GetStopDate();
04885                 }
04886               
04887               time_t  xStartTime = fMyRootFile->GetStartTime();
04888               time_t  xStopTime  = fMyRootFile->GetStopTime();
04889               TString xStartDate = fMyRootFile->GetStartDate();
04890               TString xStopDate  = fMyRootFile->GetStopDate();
04891 
04892               if( xStartTime < fStartTime ){fStartTime = xStartTime; fStartDate = xStartDate;}
04893               if( xStopTime  > fStopTime  ){fStopTime  = xStopTime;  fStopDate  = xStopDate;}
04894               
04895               fRunType = fMyRootFile->GetRunType();
04896 
04897               //----------------------------------------------------------------------------- file reading   (ViewStas)
04898               if( HistoCode == "D_NOE_ChNb" ){
04899                 partial_histp = fMyRootFile->ReadAverageNumberOfEvents(fEcal->MaxStinEcnaInStex());}
04900               if( HistoCode == "D_Ped_ChNb" ){
04901                  partial_histp = fMyRootFile->ReadAveragePedestals(fEcal->MaxStinEcnaInStex());}
04902               if (HistoCode == "D_TNo_ChNb" ){
04903                 partial_histp = fMyRootFile->ReadAverageTotalNoise(fEcal->MaxStinEcnaInStex());}
04904               if( HistoCode == "D_MCs_ChNb" ){
04905                 partial_histp = fMyRootFile->ReadAverageMeanCorrelationsBetweenSamples(fEcal->MaxStinEcnaInStex());}
04906               if( HistoCode == "D_LFN_ChNb" ){
04907                 partial_histp = fMyRootFile->ReadAverageLowFrequencyNoise(fEcal->MaxStinEcnaInStex());}
04908               if( HistoCode == "D_HFN_ChNb" ){
04909                 partial_histp = fMyRootFile->ReadAverageHighFrequencyNoise(fEcal->MaxStinEcnaInStex());}
04910               if( HistoCode == "D_SCs_ChNb" ){
04911                 partial_histp = fMyRootFile->ReadAverageSigmaOfCorrelationsBetweenSamples(fEcal->MaxStinEcnaInStex());}
04912           
04913               if ( fMyRootFile->DataExist() == kTRUE ){OKDataExist = kTRUE;}
04914             }
04915           else
04916             {
04917               fStatusFileFound = kFALSE;
04918               cout << "!TEcnaHistos::ViewStas(...)> *ERROR* =====> "
04919                    << " ROOT file not found" << fTTBELL << endl;
04920             }
04921         }
04922 
04923       if( arg_AlreadyRead == 1 )
04924         {
04925           OKDataExist = kTRUE;
04926           for(Int_t i0Stin=0; i0Stin<fEcal->MaxStinEcnaInStex(); i0Stin++)
04927             {
04928               partial_histp(i0Stin) = arg_read_histo(fEcal->MaxStinEcnaInStex()*iStasStex+i0Stin);
04929             }
04930         }
04931       
04932       if( OKDataExist == kTRUE)
04933         {
04934           fStatusFileFound = kTRUE;
04935           CounterExistingFile++;
04936 
04937           //.................................................................     (ViewStas)
04938           TMatrixD read_matrix(nb_binx, nb_biny);
04939           for(Int_t i=0; i<nb_binx; i++)
04940             {for(Int_t j=0; j<nb_biny; j++){read_matrix(i,j)=(Double_t)0.;}}
04941 
04942           if ( OKDataExist == kTRUE )
04943             {
04944               fStatusDataExist = kTRUE;
04945               CounterDataExist++;
04946 
04947               for(Int_t i0StexStinEcna=0; i0StexStinEcna<fEcal->MaxStinEcnaInStex(); i0StexStinEcna++)
04948                 {
04949                   //-------------------------------------- Geographical bidim filling   (ViewStas)
04950                   Int_t i_xgeo = GetXStinInStas(iStasStex, i0StexStinEcna, vertic_empty_strip_1);
04951                   Int_t i_ygeo = GetYStinInStas(iStasStex, i0StexStinEcna);
04952 
04953                   if(i_xgeo >=0 && i_xgeo < nb_binx && i_ygeo >=0 && i_ygeo < nb_biny)
04954                     {
04955                       Int_t n1StexStinEcna = i0StexStinEcna+1;
04956 
04957                       if( fFlagSubDet == "EB" )
04958                         {            
04959                           read_matrix(i_xgeo, i_ygeo) = partial_histp(i0StexStinEcna);
04960                           h_geo_bid->Fill((Double_t)i_xgeo, (Double_t)i_ygeo,
04961                                           (Double_t)read_matrix(i_xgeo, i_ygeo));
04962                         }
04963 
04964                       if( fFlagSubDet == "EE" )
04965                         {
04966                           //---------------------> do not draw bin for SCEcna = 10 or 11          (ViewStas)
04967                           if( !( (n1StexStinEcna == 10 || n1StexStinEcna == 11 ||
04968                                   n1StexStinEcna == 29 || n1StexStinEcna == 32) ) )
04969                             {
04970                               read_matrix(i_xgeo, i_ygeo) = partial_histp(i0StexStinEcna);
04971                               h_geo_bid->Fill((Double_t)i_xgeo, (Double_t)i_ygeo,
04972                                               (Double_t)read_matrix(i_xgeo, i_ygeo));
04973                             }
04974                           if( n1StexStinEcna == 29 )
04975                             {
04976                               //----------------------------------------------------------------- (ViewStas)
04977                               //   Average on SCEcna 29 (x1+x2+x3+x6+x7) and SCEcna 10: (x11)
04978                               //   (x = Xtal# in SC; see CMS NOTE 2006/027, p.10)
04979                               // 
04980                               //   (x1+x2+x3+x6+x7)/5 = partial_histp(29-1)   ;   x11 = partial_histp(10-1) 
04981                               //
04982                               //    => (x1+x2+x3+x6+x7+x11)/6 = partial_histp(29-1)*5/6 + partial_histp(10-1)/6
04983                               //
04984                               //   //  except for "D_NOE_ChNb" because average done in ReadAverageNumberOfEvents
04985                               //   //  (no averaged NbOfEvts in root file)
04986                               //---------------------------------------------------------------------------------
04987                               read_matrix(i_xgeo, i_ygeo) =
04988                                 partial_histp(i0StexStinEcna)*(Double_t)(5./6.) + partial_histp(9)/(Double_t)6.;
04989                               h_geo_bid->Fill((Double_t)i_xgeo, (Double_t)i_ygeo,
04990                                               (Double_t)read_matrix(i_xgeo, i_ygeo));
04991                             }
04992                           //if( n1StexStinEcna == 32 && HistoCode != "D_NOE_ChNb" )       (ViewStas)
04993                           if( n1StexStinEcna == 32 )
04994                             {
04995                               //---- same as previous case: replace SCEcna 29 by 32 AND SCEcna 10 by 11
04996                               //---->  (x1+x2+x3+x6+x7+x11)/6 = partial_histp(32-1)*5/6 + partial_histp(11-1)/6
04997                               read_matrix(i_xgeo, i_ygeo) =
04998                                 partial_histp(i0StexStinEcna)*(Double_t)(5./6.) + partial_histp(10)/(Double_t)6.;
04999                               h_geo_bid->Fill((Double_t)i_xgeo, (Double_t)i_ygeo,
05000                                               (Double_t)read_matrix(i_xgeo, i_ygeo));
05001                             }
05002                         } // end of if( fFlagSubDet == "EE" )
05003                     } // end of if(i_xgeo >=0 && i_xgeo < nb_binx && i_ygeo >=0 && i_ygeo < nb_biny)
05004                 }  // end of for(Int_t i0StexStinEcna=0; i0StexStinEcna<fEcal->MaxStinEcnaInStex(); i0StexStinEcna++)
05005             } // end of if ( fMyRootFile->DataExist() == kTRUE )
05006           else
05007             {
05008               fStatusDataExist = kFALSE;
05009 
05010               cout << "!TEcnaHistos::ViewStas(...)>  "
05011                    << " Data not available for " << fFapStexName << " " << iStasStex+1
05012                    << " (Quantity not present in the ROOT file)" << fTTBELL << endl;
05013             }
05014         } // end of if( fMyRootFile->LookAtRootFile() == kTRUE )          (ViewStas)
05015       else
05016         {
05017           fStatusFileFound = kFALSE;
05018 
05019           cout << "!TEcnaHistos::ViewStas(...)>  "
05020                << " Data not available for " << fFapStexName << " " << iStasStex+1
05021                << " (ROOT file not found)"  << fTTBELL << endl;
05022         }
05023 
05024       if( fFapNbOfEvts <= xFapNbOfEvts[iStasStex] ){fFapNbOfEvts = xFapNbOfEvts[iStasStex];}
05025 
05026     } // end of for(Int_t iStasStex=0; iStasStex<fEcal->MaxStexInStas(); iStasStex++)
05027 
05028   //delete [] NOFE_int;     NOFE_int = 0;       fCdelete++;
05029   delete [] xFapNbOfEvts; xFapNbOfEvts = 0;   fCdelete++;
05030 
05031   if( CounterExistingFile > 0 && CounterDataExist > 0 )
05032     {
05033       //===============  H I S T O   M I N / M A X   M A N A G E M E N T ============  (ViewStas)
05034       //................................ Put histo min max values
05035       //.......... default if flag not set to "ON"
05036       SetYminMemoFromValue(HistoCode.Data(), fCnaParHistos->GetYminDefaultValue(HistoCode.Data()));
05037       SetYmaxMemoFromValue(HistoCode.Data(), fCnaParHistos->GetYmaxDefaultValue(HistoCode.Data()));
05038           
05039       if( fUserHistoMin == fUserHistoMax ){fFlagUserHistoMin = "AUTO"; fFlagUserHistoMax = "AUTO";}
05040       //.......... user's value if flag set to "ON"
05041       if( fFlagUserHistoMin == "ON" )
05042         {SetYminMemoFromValue(HistoCode.Data(), fUserHistoMin); fFlagUserHistoMin = "OFF";}
05043       if( fFlagUserHistoMax == "ON" )
05044         {SetYmaxMemoFromValue(HistoCode.Data(), fUserHistoMax); fFlagUserHistoMax = "OFF";}
05045       //................................. automatic min and/or max
05046       if( fFlagUserHistoMin == "AUTO" )
05047         {SetYminMemoFromValue(HistoCode.Data(), h_geo_bid->GetMinimum()); fFlagUserHistoMin = "OFF";}
05048       if( fFlagUserHistoMax == "AUTO" )
05049         {SetYmaxMemoFromValue(HistoCode.Data(), h_geo_bid->GetMaximum()); fFlagUserHistoMax = "OFF";}
05050       //...................................... histo set ymin and ymax
05051       Int_t  xFlagAutoYsupMargin = 0;      
05052       xFlagAutoYsupMargin = SetHistoFrameYminYmaxFromMemo((TH1D*)h_geo_bid, HistoCode);
05053           
05054       // ************************** A GARDER EN RESERVE *******************************
05055       //............. special contour level for correlations (square root wise scale)
05056       //if ( HistoCode == "D_MCs_ChNb" )
05057       //{
05058       //  Int_t nb_niv  = 9;
05059       //  Double_t* cont_niv = new Double_t[nb_niv];           fCnew++;
05060       //  SqrtContourLevels(nb_niv, &cont_niv[0]);      
05061       //  h_geo_bid->SetContour(nb_niv, &cont_niv[0]);        
05062       //  delete [] cont_niv;                                  fCdelete++;
05063       //}
05064       // ******************************** (FIN RESERVE) *******************************
05065 
05066       // =================================== P L O T S ========================   (ViewStas) 
05067           
05068       char* f_in = new char[fgMaxCar];                           fCnew++;
05069 
05070       //...................... Taille/format canvas
05071       UInt_t canv_h = fCnaParHistos->CanvasFormatH("petit");
05072       UInt_t canv_w = fCnaParHistos->CanvasFormatW("petit");
05073 
05074       if( fFlagSubDet == "EB")
05075         {canv_w = fCnaParHistos->CanvasFormatW("phietaEB");
05076         canv_h = fCnaParHistos->CanvasFormatH("phietaEB");}
05077       if( fFlagSubDet == "EE")    
05078         {canv_w = fCnaParHistos->CanvasFormatW("IYIXEE");
05079         canv_h = fCnaParHistos->CanvasFormatH("IYIXEE");}
05080 
05081       //............................................... paves commentaires (ViewStas)
05082       SetAllPavesViewStas();
05083 
05084       //------------------------------------ Canvas name ----------------- (ViewStas)  
05085       TString name_cov_cor;
05086       Int_t MaxCar = fgMaxCar;
05087       name_cov_cor.Resize(MaxCar);
05088       name_cov_cor = "?";
05089           
05090       if( HistoCode == "D_NOE_ChNb"){name_cov_cor = "Number_of_Events";}
05091       if( HistoCode == "D_Ped_ChNb"){name_cov_cor = "Pedestals";}
05092       if( HistoCode == "D_TNo_ChNb"){name_cov_cor = "Total_noise";}
05093       if( HistoCode == "D_MCs_ChNb"){name_cov_cor = "Mean_Corss";}
05094       if( HistoCode == "D_LFN_ChNb"){name_cov_cor = "Low_Fq_Noise";}
05095       if( HistoCode == "D_HFN_ChNb"){name_cov_cor = "High_Fq_Noise";}
05096       if( HistoCode == "D_SCs_ChNb"){name_cov_cor = "Sigma_Corss";}
05097           
05098       TString name_visu;
05099       MaxCar = fgMaxCar;
05100       name_visu.Resize(MaxCar);
05101       name_visu = "colz";
05102           
05103       sprintf(f_in, "%s_%s_S1_%d_R%d_%d_%d_%s_%s_HocoVeco_R%d",
05104               name_cov_cor.Data(),   fFapAnaType.Data(),   fFapNbOfSamples, fFapRunNumber,
05105               fFapFirstReqEvtNumber, fFapLastReqEvtNumber, fFlagSubDet.Data(),
05106               name_visu.Data(),      arg_AlreadyRead);
05107           
05108       if( fFlagSubDet == "EB" ){SetHistoPresentation((TH1D*)h_geo_bid, "Stas2DEB");}
05109       if( fFlagSubDet == "EE" ){SetHistoPresentation((TH1D*)h_geo_bid, "Stas2DEE");}
05110 
05111       TCanvas *MainCanvas = new TCanvas(f_in, f_in, canv_w, canv_h);   fCnewRoot++;
05112       fCurrentCanvas = MainCanvas; fCurrentCanvasName = f_in;
05113 
05114       // cout << "*TEcnaHistos::ViewStas(...)> Plot is displayed on canvas ----> " << f_in << endl;
05115           
05116       delete [] f_in; f_in = 0;                                 fCdelete++;
05117 
05118       //------------------------ Canvas draw and update ------------ (ViewStas)  
05119       if( fPavComGeneralTitle != 0 ){fPavComGeneralTitle->Draw();}
05120 
05121       fPavComStas->Draw();
05122       fPavComAnaRun->Draw();
05123       fPavComNbOfEvts->Draw();
05124 
05125       //----------------------------------------------------------- pad margins
05126       Double_t x_low = fCnaParHistos->BoxLeftX("bottom_left_box") - 0.005;
05127       Double_t y_low = fCnaParHistos->BoxTopY("bottom_left_box")  + 0.005;
05128       Double_t x_margin = x_low;
05129       Double_t y_margin = y_low;          
05130       MainCanvas->Divide( 1,  1, x_margin, y_margin);
05131       //           Divide(nx, ny, x_margin, y_margin,    color);          
05132       gPad->cd(1);
05133       //........................... specific EE
05134       if( fFlagSubDet == "EE" ){
05135         Double_t x_up  = fCnaParHistos->BoxRightX("bottom_right_box")  + 0.005;
05136         Double_t y_up  = fCnaParHistos->BoxBottomY("top_left_box_EE") - 0.005;
05137         TVirtualPad* main_subpad = gPad;
05138         main_subpad->SetPad(x_low, y_low, x_up, y_up);}
05139           
05140       //------------------------------------------------------------
05141       h_geo_bid->GetXaxis()->SetTitle(axis_x_var_name);
05142       h_geo_bid->GetYaxis()->SetTitle(axis_y_var_name);
05143           
05144       h_geo_bid->DrawCopy("COLZ");
05145           
05146       // trace de la grille  ---------------- (ViewStas) 
05147       ViewStasGrid(vertic_empty_strips);
05148       gPad->Draw();
05149       gPad->Update();
05150 
05151       //      delete MainCanvas;              fCdeleteRoot++;
05152     }
05153   //..................... retour aux options standard
05154 
05155   Bool_t b_true = 1;
05156   h_geo_bid->SetStats(b_true);    
05157   h_geo_bid->Delete();  h_geo_bid = 0;              fCdeleteRoot++;
05158   
05159   delete [] f_in_mat_tit;    f_in_mat_tit = 0;             fCdelete++;
05160 
05161 }  // end of ViewStas(...)
05162 
05163 //==================================================================================
05164 //
05165 //                         GetXStinInStas , GetYStinInStas
05166 //
05167 //==================================================================================
05168 Int_t TEcnaHistos::GetXStinInStas(const Int_t& iStasStex, const Int_t& StexStinEcna,
05169                                   const Int_t& vertic_empty_strip_1) 
05170 {
05171 //Gives the X Stin coordinate in the geographic view of the Stas
05172 // (X = 0 to MaxStexHocoInStas*MaxStinHocoInStex - 1 + vertic_empty_strips(EE only))
05173 
05174   Int_t ix_geo = 0;
05175   Int_t n1StasStex = iStasStex+1;
05176   TString ctype = fEcalNumbering->GetStexHalfStas(n1StasStex);
05177 
05178   if( fFlagSubDet == "EB")
05179     {
05180       if( ctype == "EB-")
05181         {
05182           ix_geo = (iStasStex - fEcal->MaxStexInStasMinus())*fEcal->MaxStinVecoInStex()
05183             + StexStinEcna%fEcal->MaxStinVecoInStex();
05184         }
05185       if( ctype == "EB+")
05186         {
05187           ix_geo = iStasStex*fEcal->MaxStinVecoInStex()
05188             + fEcal->MaxStinVecoInStex()- 1 - StexStinEcna%fEcal->MaxStinVecoInStex();
05189         }
05190     }
05191 
05192   if( fFlagSubDet == "EE")
05193     {
05194       TString LeftRightFromIP = fEcalNumbering->GetDeeDirViewedFromIP(n1StasStex);
05195 
05196       if( ctype == "EE-" && LeftRightFromIP == "left"  )
05197         {
05198           ix_geo = fEcal->MaxStinHocoInStex() - StexStinEcna/fEcal->MaxStinVecoInStex() - 1 + vertic_empty_strip_1;
05199         }
05200       if( ctype == "EE-" && LeftRightFromIP == "right" )
05201         {
05202           ix_geo = fEcal->MaxStinHocoInStex() + StexStinEcna/fEcal->MaxStinVecoInStex() + vertic_empty_strip_1;
05203         }
05204       if( ctype == "EE+" && LeftRightFromIP == "left"  )
05205         {
05206           ix_geo = (Int_t)fCnaParHistos->DeeOffsetX(fFlagSubDet, n1StasStex)
05207             + fEcal->MaxStinHocoInStex() - StexStinEcna/fEcal->MaxStinVecoInStex() - 1;
05208         }
05209       if( ctype == "EE+" && LeftRightFromIP == "right" )
05210         {
05211           ix_geo = (Int_t)fCnaParHistos->DeeOffsetX(fFlagSubDet, n1StasStex)
05212             + StexStinEcna/fEcal->MaxStinVecoInStex();
05213         }
05214     }
05215   return ix_geo;
05216 }
05217 
05218 Int_t TEcnaHistos::GetYStinInStas(const Int_t& iStasStex, const Int_t& StexStinEcna) 
05219 {
05220 //Gives the Y crystal coordinate in the geographic view of one Stex
05221 // (Y = 0 to MaxStexVecoInStas*MaxStinVecoInStex - 1)
05222 
05223   Int_t iy_geo = 0;
05224   
05225   if( fFlagSubDet == "EB")
05226     {
05227       Int_t n1StasStex = iStasStex+1;
05228       TString ctype = fEcalNumbering->GetStexHalfStas(n1StasStex);
05229       if( ctype == "EB+")
05230         {iy_geo = StexStinEcna/fEcal->MaxStinVecoInStex() + fEcal->MaxStinHocoInStex(); }
05231       if( ctype == "EB-")
05232         {iy_geo = fEcal->MaxStinHocoInStex() - 1 - StexStinEcna/fEcal->MaxStinVecoInStex();}
05233     }
05234   
05235   if( fFlagSubDet == "EE")
05236     {iy_geo = StexStinEcna%fEcal->MaxStinVecoInStex();} 
05237   return iy_geo;
05238 }
05239 
05240 //==========================================================================
05241 //
05242 //                       ViewStasGrid
05243 //              independent of the ROOT file
05244 //
05245 //==========================================================================
05246 void TEcnaHistos::ViewStasGrid(const Int_t & vertic_empty_strips)
05247 {
05248  //Grid of Stas with axis Hoco and Veco
05249 
05250   if( fFlagSubDet ==  "EB"){ViewEBGrid();}
05251   if( fFlagSubDet ==  "EE"){ViewEEGrid(vertic_empty_strips);}
05252 
05253 } // end of ViewStasGrid
05254 
05255 void TEcnaHistos::ViewEBGrid()
05256 {
05257  //Grid of EB with axis Hoco and Veco
05258 
05259   Int_t  GeoBidSizeEta = fEcal->MaxSMEtaInEB()*fEcal->MaxTowEtaInSM();
05260   Int_t  GeoBidSizePhi = fEcal->MaxSMPhiInEB()*fEcal->MaxTowPhiInSM();
05261 
05262   Int_t size_y = fEcal->MaxTowEtaInSM();
05263   Int_t size_x = fEcal->MaxTowPhiInSM();
05264 
05265   Int_t  nb_binx  = GeoBidSizePhi;
05266   Int_t  nb_biny  = GeoBidSizeEta;
05267   Axis_t xinf_bid = (Axis_t)0.;
05268   Axis_t xsup_bid = (Axis_t)nb_binx;
05269   Axis_t yinf_bid = (Axis_t)0.;
05270   Axis_t ysup_bid = (Axis_t)nb_biny;   
05271   
05272   //---------------- trace de la grille: un rectangle = un SM
05273 
05274   Int_t max_x = nb_binx/size_x;  // = fEcal->MaxSMPhiInEB()
05275   Int_t max_y = nb_biny/size_y;  // = fEcal->MaxSMEtaInEB()
05276 
05277   //............................. lignes horizontales  (ViewEBGrid)
05278   Double_t yline = (Double_t)yinf_bid;
05279 
05280   Double_t xline_left  = (Double_t)xinf_bid;
05281   Double_t xline_right = (Double_t)xsup_bid;
05282   
05283   for( Int_t j = 0 ; j < max_y ; j++)
05284     {
05285       yline = yline + (Double_t)size_y;
05286       TLine *lin;
05287       lin = new TLine(xline_left, yline, xline_right, yline); fCnewRoot++;
05288       lin->Draw();
05289       // delete lin;             fCdeleteRoot++;
05290     }
05291 
05292   //-------------------------------- lignes verticales
05293   Double_t xline = (Double_t)xinf_bid - (Double_t)size_x;
05294   
05295   Double_t yline_bot = (Double_t)yinf_bid;
05296   Double_t yline_top = (Double_t)ysup_bid;
05297 
05298   for( Int_t i = 0 ; i < max_x ; i++)
05299     {  
05300       xline = xline + (Double_t)size_x;
05301       TLine *lin;
05302       lin = new TLine(xline, yline_bot, xline, yline_top); fCnewRoot++;
05303       lin->Draw();
05304     }
05305 
05306   //-------------------------------- Numeros des SM
05307   Double_t yTextBot = yline_bot - (yline_top - yline_bot)/25.;
05308   Double_t yTextTop = yline_top + (yline_top - yline_bot)/120.;
05309   xline = (Double_t)xinf_bid - (Double_t)size_x;
05310 
05311   char* f_in = new char[fgMaxCar];                  fCnew++;
05312   TText *text_SM = new TText();              fCnewRoot++;
05313   for( Int_t i = 0 ; i < max_x ; i++)
05314     {  
05315       xline = xline + (Double_t)size_x;
05316       text_SM->SetTextColor(fCnaParHistos->ColorDefinition("bleu_fonce"));
05317       text_SM->SetTextSize((Double_t)0.03);
05318       sprintf( f_in, "  +%d", i+1 );
05319       text_SM->DrawText(xline, yTextTop, f_in);
05320       sprintf( f_in, "  %d", -i-1 );
05321       text_SM->DrawText(xline, yTextBot, f_in);
05322     }
05323   delete [] f_in;                                   fCdelete++;
05324 
05325   //------------------ trace axes en eta et phi --------------- ViewEBGrid
05326 
05327   Int_t SMNumber = 1;
05328 
05329   //...................................................... Axe i(phi) (bottom x) ViewEBGrid
05330   Int_t MatSize    = fEcal->MaxTowPhiInSM();
05331   Int_t size_x_eb  = fEcal->MaxSMPhiInEB();
05332   Double_t phi_min =   0;
05333   Double_t phi_max = 360;
05334 
05335   TString  x_var_name  = GetHocoVecoAxisTitle("iphiEB");;
05336   TString  x_direction = fEcalNumbering->GetXDirectionEB(SMNumber);
05337 
05338   TF1 *f1 = new TF1("f1", x_direction.Data(), phi_min, phi_max);          fCnewRoot++;
05339     TGaxis* sup_axis_x = 0;
05340 
05341   if( x_direction == "-x" ) // NEVER  IN THIS CASE: xmin->xmax <=> right->left ("-x") direction
05342     {sup_axis_x = new TGaxis( (Float_t)0., (Float_t)0., (Float_t)(size_x_eb*MatSize), (Float_t)0.,
05343                               "f1", size_x_eb, "SC" , 0.);   fCnewRoot++;}
05344 
05345   if( x_direction == "x" )  // ALWAYS IN THIS CASE: xmin->xmax <=> left->right ("x") direction    
05346     {sup_axis_x = new TGaxis( (Float_t)0., (Float_t)0., (Float_t)(size_x_eb*MatSize), (Float_t)0.,
05347                               "f1", size_x_eb, "SC" , 0.);   fCnewRoot++;} 
05348 
05349   Float_t tit_siz_x = fCnaParHistos->AxisTitleSize();
05350   Float_t lab_siz_x = fCnaParHistos->AxisLabelSize("EBx");
05351   Float_t tic_siz_x = fCnaParHistos->AxisTickSize("SMx");
05352   Float_t tit_off_x = fCnaParHistos->AxisTitleOffset("EBx");
05353   Float_t lab_off_x = fCnaParHistos->AxisLabelOffset("EBx");
05354  
05355   sup_axis_x->SetTitle(x_var_name);
05356   sup_axis_x->SetTitleSize(tit_siz_x);
05357   sup_axis_x->SetTitleOffset(tit_off_x);
05358   sup_axis_x->SetLabelSize(lab_siz_x);
05359   sup_axis_x->SetLabelOffset(lab_off_x);
05360   sup_axis_x->SetTickSize(tic_siz_x);
05361   sup_axis_x->Draw("SAME");
05362 
05363   f1 = 0;
05364 
05365   //...................................................... Axe eta (y) ViewEBGrid
05366   MatSize = fEcal->MaxTowEtaInSM();
05367   Int_t size_y_eb = fEcal->MaxSMEtaInEB(); 
05368 
05369   Double_t eta_min = (Double_t)(-85.); 
05370   Double_t eta_max = (Double_t)85.; 
05371 
05372   TString y_var_name = GetHocoVecoAxisTitle("ietaEB");
05373 
05374   TGaxis* sup_axis_y = 0;
05375   sup_axis_y = new TGaxis((Float_t)0., (Float_t)0.,
05376                           (Float_t)0., (Float_t)(size_y_eb*MatSize),
05377                           eta_min, eta_max, MatSize/2, "SC", 0.);         fCnewRoot++;
05378 
05379   Float_t tit_siz_y = fCnaParHistos->AxisTitleSize();
05380   Float_t lab_siz_y = fCnaParHistos->AxisLabelSize("EBy");
05381   Float_t tic_siz_y = fCnaParHistos->AxisTickSize("SMy");
05382   Float_t tit_off_y = fCnaParHistos->AxisTitleOffset("EBy");
05383   Float_t lab_off_y = fCnaParHistos->AxisLabelOffset("EBy");
05384   
05385   sup_axis_y->SetTitle(y_var_name);
05386   sup_axis_y->SetTitleSize(tit_siz_y);
05387   sup_axis_y->SetTitleOffset(tit_off_y);
05388   sup_axis_y->SetLabelColor(1);
05389   sup_axis_y->SetLabelSize(lab_siz_y);
05390   sup_axis_y->SetLabelOffset(lab_off_y);
05391   sup_axis_y->SetTickSize(tic_siz_y);
05392   sup_axis_y->Draw("SAME");
05393 
05394   //f2 = 0;
05395 
05396   gStyle->SetTextColor(fCnaParHistos->ColorDefinition("noir"));
05397 
05398 } // end of ViewEBGrid
05399 //---------------------------------------------------------------------
05400 void TEcnaHistos::ViewEEGrid(const Int_t& vertic_empty_strips)
05401 {
05402  //Grid of EE with axis Hoco and Veco
05403 
05404   Float_t coefcc_x = (Float_t)1./(Float_t)5.;
05405   Float_t coefcc_y = (Float_t)1./(Float_t)5.;
05406   
05407   for( Int_t DeeNumber = 1; DeeNumber <= 4; DeeNumber++)
05408     {
05409       EEDataSectors(coefcc_x, coefcc_y, DeeNumber, "EE");
05410       EEGridAxis(coefcc_x, coefcc_y, DeeNumber, "EE", " "); 
05411     }
05412 
05413   // vertical line between the two endcaps
05414   Double_t xline = coefcc_x*( 2*fEcal->MaxCrysIXInDee()
05415                               + ((Double_t)vertic_empty_strips)/2.*fEcal->MaxCrysIXInSC() );
05416   
05417   Double_t yline_bot = coefcc_y*(Double_t)0.;
05418   Double_t yline_top = coefcc_y*(Double_t)fEcal->MaxCrysIYInDee();
05419 
05420   TLine *lin;
05421   lin = new TLine(xline, yline_bot, xline, yline_top); fCnewRoot++;
05422   lin->Draw();
05423 
05424   // vertical line in the midles of the two endcaps
05425   //  xline = xline + coefcc_x*( fEcal->MaxCrysIXInDee()+ 0.5*fEcal->MaxCrysIXInSC() );
05426   xline = coefcc_x*(3*fEcal->MaxCrysIXInDee()
05427                     + ((Double_t)vertic_empty_strips-1.)*fEcal->MaxCrysIXInSC() );
05428   TLine *lin12;
05429   lin12 = new TLine(xline, yline_bot, xline, yline_top); fCnewRoot++;
05430   lin12->SetLineStyle(2);
05431   lin12->Draw();
05432 
05433   xline = coefcc_x*(fEcal->MaxCrysIXInDee()
05434                      + ((Double_t)vertic_empty_strips)/3.*fEcal->MaxCrysIXInSC() );
05435   TLine *lin34;
05436   lin34 = new TLine(xline, yline_bot, xline, yline_top); fCnewRoot++;
05437   lin34->SetLineStyle(2);
05438   lin34->Draw();
05439 
05440   // horizontal line at IY = 50
05441   Double_t xline_end = coefcc_x*( 4*fEcal->MaxCrysIXInDee() + vertic_empty_strips*fEcal->MaxCrysIXInSC());
05442   Double_t yline_mid = coefcc_x*fEcal->MaxCrysIYInDee()/2;
05443 
05444   TLine *linh;
05445   linh = new TLine( 0., yline_mid, xline_end, yline_mid); fCnewRoot++;
05446   linh->SetLineStyle(2);
05447   linh->Draw();
05448 
05449 } // end of ViewEEGrid
05450 
05451 //==================================================================================================
05452 void TEcnaHistos::EEDataSectors(const Float_t& coefcc_x,  const Float_t& coefcc_y,
05453                                 const Int_t&   DeeNumber, const TString opt_plot)
05454 {
05455   //Surlignage des bords du Dee et des Data Sectors. Numeros des secteurs.
05456 
05457   // Epaisseur du trait selon option
05458   Int_t LineWidth = 2;   // DEFAULT => option "EE"
05459   if( opt_plot == "Dee" ){LineWidth = 3;}
05460 
05461   Int_t ngmax = 0;
05462   // surlignage du bord interne du Dee (unite de coordonnees: le cristal)
05463   ngmax = 13;
05464   Float_t xg_dee_int_bot[13] = { 0, 5, 5, 7, 7, 8, 8, 9, 9,10,10,11,11};
05465   Float_t yg_dee_int_bot[13] = {39,39,40,40,41,41,42,42,43,43,45,45,50};
05466   for(Int_t i=0;i<ngmax;i++){
05467     xg_dee_int_bot[i] = coefcc_x*xg_dee_int_bot[i];
05468     yg_dee_int_bot[i] = coefcc_y*yg_dee_int_bot[i];}
05469   
05470   Float_t XgDeeIntBotRight[13]; Float_t YgDeeIntBotRight[13];
05471   Float_t XgDeeIntTopRight[13]; Float_t YgDeeIntTopRight[13];
05472   
05473   for( Int_t i=0; i<ngmax; i++)
05474     {
05475       XgDeeIntBotRight[i] = xg_dee_int_bot[i];
05476       YgDeeIntBotRight[i] = yg_dee_int_bot[i];
05477       XgDeeIntTopRight[i] = XgDeeIntBotRight[i];
05478       YgDeeIntTopRight[i] = coefcc_y*fEcal->MaxCrysIYInDee() - YgDeeIntBotRight[i];
05479       if ( DeeNumber == 2 || DeeNumber == 4 )
05480         {
05481           XgDeeIntBotRight[i] = -XgDeeIntBotRight[i] + coefcc_x*fEcal->MaxCrysIXInDee();
05482           XgDeeIntTopRight[i] = -XgDeeIntTopRight[i] + coefcc_x*fEcal->MaxCrysIXInDee();
05483         }
05484       XgDeeIntBotRight[i] += fCnaParHistos->DeeOffsetX(opt_plot, DeeNumber);
05485       XgDeeIntTopRight[i] += fCnaParHistos->DeeOffsetX(opt_plot, DeeNumber);
05486     }
05487 
05488   TGraph *BDeeIntBotRight = new TGraph(ngmax, XgDeeIntBotRight, YgDeeIntBotRight);
05489   BDeeIntBotRight->SetLineWidth(LineWidth);
05490   BDeeIntBotRight->Draw();
05491   
05492   TGraph *BDeeIntTopRight = new TGraph(ngmax, XgDeeIntTopRight, YgDeeIntTopRight);
05493   BDeeIntTopRight->SetLineWidth(LineWidth);
05494   BDeeIntTopRight->Draw();
05495 
05496   // surlignage du bord externe du Dee  (unite de coordonnees: le cristal)
05497   ngmax = 21;
05498   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};
05499   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};
05500   for(Int_t i=0;i<ngmax;i++){
05501     xg_dee_ext_bot[i] = coefcc_x*xg_dee_ext_bot[i];
05502     yg_dee_ext_bot[i] = coefcc_y*yg_dee_ext_bot[i];}
05503   
05504   Float_t XgDeeExtBotRight[21]; Float_t YgDeeExtBotRight[21];
05505   Float_t XgDeeExtTopRight[21]; Float_t YgDeeExtTopRight[21];
05506   
05507   for( Int_t i=0; i<ngmax; i++)
05508     {
05509       XgDeeExtBotRight[i] = xg_dee_ext_bot[i];
05510       YgDeeExtBotRight[i] = yg_dee_ext_bot[i];
05511       XgDeeExtTopRight[i] = XgDeeExtBotRight[i];
05512       YgDeeExtTopRight[i] = coefcc_y*fEcal->MaxCrysIYInDee() - YgDeeExtBotRight[i];
05513       if ( DeeNumber == 2 || DeeNumber == 4 )
05514         {
05515           XgDeeExtBotRight[i] = -XgDeeExtBotRight[i] + coefcc_x*fEcal->MaxCrysIXInDee();
05516           XgDeeExtTopRight[i] = -XgDeeExtTopRight[i] + coefcc_x*fEcal->MaxCrysIXInDee();
05517         }
05518       XgDeeExtBotRight[i] += fCnaParHistos->DeeOffsetX(opt_plot, DeeNumber);
05519       XgDeeExtTopRight[i] += fCnaParHistos->DeeOffsetX(opt_plot, DeeNumber);
05520     }
05521   
05522   TGraph *BDeeExtBotRight = new TGraph(ngmax, XgDeeExtBotRight, YgDeeExtBotRight);
05523   BDeeExtBotRight->SetLineWidth(LineWidth);
05524   BDeeExtBotRight->Draw();
05525   
05526   TGraph *BDeeExtTopRight = new TGraph(ngmax, XgDeeExtTopRight, YgDeeExtTopRight);
05527   BDeeExtTopRight->SetLineWidth(LineWidth);
05528   BDeeExtTopRight->Draw();
05529 
05530   char* f_in = new char[fgMaxCar];                           fCnew++;
05531   
05532   //............. Surlignage separateurs des secteurs en phi (Data sectors)
05533 
05534   //================== S9 -> S1 (EE-) option "EE" seulement
05535   if( opt_plot == "EE" )
05536     {
05537       ngmax = 2;
05538       Float_t xg_dee_data_sec9[2] = { 0,  0};
05539       Float_t yg_dee_data_sec9[2] = {61,100};
05540       for(Int_t i=0;i<ngmax;i++){
05541         xg_dee_data_sec9[i] = coefcc_x*xg_dee_data_sec9[i];
05542         yg_dee_data_sec9[i] = coefcc_y*yg_dee_data_sec9[i];}
05543       
05544       Float_t XgDeeDataSec9[11]; Float_t YgDeeDataSec9[11];
05545       for( Int_t i=0; i<ngmax; i++)
05546         {
05547           XgDeeDataSec9[i] = xg_dee_data_sec9[i]; YgDeeDataSec9[i] = yg_dee_data_sec9[i];
05548           if ( DeeNumber == 2 || DeeNumber == 4 )
05549             {
05550               XgDeeDataSec9[i] = -XgDeeDataSec9[i] + coefcc_x*fEcal->MaxCrysIXInDee();
05551             }
05552           XgDeeDataSec9[i] += fCnaParHistos->DeeOffsetX(opt_plot, DeeNumber);
05553         }      
05554       TGraph *BDeeDataSec9 = new TGraph(ngmax, XgDeeDataSec9, YgDeeDataSec9);
05555       BDeeDataSec9->SetLineWidth(LineWidth);
05556       BDeeDataSec9->Draw();      
05557     }
05558 
05559   //================= S1->S2(EE-)
05560   ngmax = 11;
05561   Float_t xg_dee_data_sec1[11] = { 7,10,10,15,15,20,20,25,25,30,30};
05562   Float_t yg_dee_data_sec1[11] = {60,60,65,65,70,70,75,75,85,85,87};
05563   for(Int_t i=0;i<ngmax;i++){
05564     xg_dee_data_sec1[i] = coefcc_x*xg_dee_data_sec1[i];
05565     yg_dee_data_sec1[i] = coefcc_y*yg_dee_data_sec1[i];}
05566   
05567   Float_t XgDeeDataSec1[11]; Float_t YgDeeDataSec1[11];
05568   for( Int_t i=0; i<ngmax; i++)
05569     {
05570       XgDeeDataSec1[i] = xg_dee_data_sec1[i]; YgDeeDataSec1[i] = yg_dee_data_sec1[i];
05571       if ( DeeNumber == 2 || DeeNumber == 4 )
05572         {
05573           XgDeeDataSec1[i] = -XgDeeDataSec1[i] + coefcc_x*fEcal->MaxCrysIXInDee();
05574         }
05575       XgDeeDataSec1[i] += fCnaParHistos->DeeOffsetX(opt_plot, DeeNumber);
05576     }
05577 
05578   TGraph *BDeeDataSec1 = new TGraph(ngmax, XgDeeDataSec1, YgDeeDataSec1);
05579   BDeeDataSec1->SetLineWidth(LineWidth);
05580   BDeeDataSec1->Draw();
05581 
05582   //================= S2->S3(EE-)
05583   ngmax = 6;
05584   Float_t xg_dee_data_sec2[6] = {11,15,15,40,40,47};
05585   Float_t yg_dee_data_sec2[6] = {50,50,55,55,60,60};
05586   for(Int_t i=0;i<ngmax;i++){
05587     xg_dee_data_sec2[i] = coefcc_x*xg_dee_data_sec2[i];
05588     yg_dee_data_sec2[i] = coefcc_y*yg_dee_data_sec2[i];}
05589   
05590   Float_t XgDeeDataSec2[6]; Float_t YgDeeDataSec2[6];
05591   for( Int_t i=0; i<ngmax; i++)
05592     {
05593       XgDeeDataSec2[i] = xg_dee_data_sec2[i]; YgDeeDataSec2[i] = yg_dee_data_sec2[i];
05594       if ( DeeNumber == 2 || DeeNumber == 4 )
05595         {
05596           XgDeeDataSec2[i] = -XgDeeDataSec2[i] + coefcc_x*fEcal->MaxCrysIXInDee();
05597         }
05598       XgDeeDataSec2[i] += fCnaParHistos->DeeOffsetX(opt_plot, DeeNumber);
05599     }
05600   TGraph *BDeeDataSec2 = new TGraph(ngmax, XgDeeDataSec2, YgDeeDataSec2);
05601   BDeeDataSec2->SetLineWidth(LineWidth);
05602   BDeeDataSec2->Draw();
05603  
05604   //================= S3->S4(EE-)
05605   ngmax = 10;
05606   Float_t xg_dee_data_sec3[10] = {10,15,15,20,20,30,30,40,40,42};
05607   Float_t yg_dee_data_sec3[10] = {45,45,40,40,35,35,30,30,25,25};
05608   for(Int_t i=0;i<ngmax;i++){
05609     xg_dee_data_sec3[i] = coefcc_x*xg_dee_data_sec3[i];
05610     yg_dee_data_sec3[i] = coefcc_y*yg_dee_data_sec3[i];}
05611   
05612   Float_t XgDeeDataSec3[10]; Float_t YgDeeDataSec3[10];
05613   for( Int_t i=0; i<ngmax; i++)
05614     {
05615       XgDeeDataSec3[i] = xg_dee_data_sec3[i]; YgDeeDataSec3[i] = yg_dee_data_sec3[i];
05616       if ( DeeNumber == 2 || DeeNumber == 4 )
05617         {
05618           XgDeeDataSec3[i] = -XgDeeDataSec3[i] + coefcc_x*fEcal->MaxCrysIXInDee();
05619         }
05620       XgDeeDataSec3[i] += fCnaParHistos->DeeOffsetX(opt_plot, DeeNumber);
05621     }
05622   TGraph *BDeeDataSec3 = new TGraph(ngmax, XgDeeDataSec3, YgDeeDataSec3);
05623   BDeeDataSec3->SetLineWidth(LineWidth);
05624   BDeeDataSec3->Draw();
05625  
05626   //================= S4->S5(EE-)
05627   ngmax = 6;
05628   Float_t xg_dee_data_sec4[6] = { 5, 5,10,10,15,15};
05629   Float_t yg_dee_data_sec4[6] = {40,30,30,15,15, 5};
05630   for(Int_t i=0;i<ngmax;i++){
05631     xg_dee_data_sec4[i] = coefcc_x*xg_dee_data_sec4[i];
05632     yg_dee_data_sec4[i] = coefcc_y*yg_dee_data_sec4[i];}
05633   
05634   Float_t XgDeeDataSec4[6]; Float_t YgDeeDataSec4[6];
05635   for( Int_t i=0; i<ngmax; i++)
05636     {
05637       XgDeeDataSec4[i] = xg_dee_data_sec4[i]; YgDeeDataSec4[i] = yg_dee_data_sec4[i];
05638       if ( DeeNumber == 2 || DeeNumber == 4 )
05639         {
05640           XgDeeDataSec4[i] = -XgDeeDataSec4[i] + coefcc_x*fEcal->MaxCrysIXInDee();
05641         }
05642       XgDeeDataSec4[i] += fCnaParHistos->DeeOffsetX(opt_plot, DeeNumber);
05643     }
05644   TGraph *BDeeDataSec4 = new TGraph(ngmax, XgDeeDataSec4, YgDeeDataSec4);
05645   BDeeDataSec4->SetLineWidth(LineWidth);
05646   BDeeDataSec4->Draw();
05647   
05648 
05649   //..................................... Numeros des secteurs S_i (option "Dee" seulement)
05650   if( opt_plot == "Dee" || opt_plot == "EE" )
05651     {
05652       //............. Coordonnees des numeros de secteurs
05653       ngmax = 5;
05654       Float_t  xg_coord_sector[5] = { 16, 41, 45, 33, -2};
05655       Float_t  yg_coord_sector[5] = { 96, 83, 30,  5, -8};
05656 
05657       //....... Reprise secteurs 3 et 7
05658       if(opt_plot == "Dee" && (DeeNumber == 1) ){xg_coord_sector[2] += 0.5;}
05659       if(opt_plot == "Dee" && (DeeNumber == 2) ){xg_coord_sector[2] -= 1. ;}
05660       if(opt_plot == "Dee" && (DeeNumber == 3) ){xg_coord_sector[2] += 0.7;}
05661       if(opt_plot == "Dee" && (DeeNumber == 4) ){xg_coord_sector[2] -= 1.2;}
05662 
05663       if(opt_plot == "EE"  && (DeeNumber == 2 || DeeNumber == 3) ){xg_coord_sector[2] += 0.55;}
05664       if(opt_plot == "EE"  && (DeeNumber == 4 ) ){xg_coord_sector[2] -= 0.2;}
05665 
05666       for(Int_t i=0;i<ngmax;i++){
05667         xg_coord_sector[i] = coefcc_x*xg_coord_sector[i];
05668         yg_coord_sector[i] = coefcc_y*yg_coord_sector[i];}
05669 
05670       Float_t  xg_sector[9];
05671       Float_t  yg_sector[9];
05672       Int_t ns1 = 1;
05673       Int_t ns2 = 5;
05674       Float_t xinv_d2d4 = coefcc_x*44;
05675       
05676       if( DeeNumber == 1 )
05677         {
05678           ns1 = 1; ns2 = 5;
05679           xg_sector[1-ns1] = xg_coord_sector[1-ns1];  yg_sector[1-ns1] = yg_coord_sector[1-ns1];
05680           xg_sector[2-ns1] = xg_coord_sector[2-ns1];  yg_sector[2-ns1] = yg_coord_sector[2-ns1];
05681           xg_sector[3-ns1] = xg_coord_sector[3-ns1];  yg_sector[3-ns1] = yg_coord_sector[3-ns1];
05682           xg_sector[4-ns1] = xg_coord_sector[4-ns1];  yg_sector[4-ns1] = yg_coord_sector[4-ns1];
05683           xg_sector[5-ns1] = xg_coord_sector[5-ns1];  yg_sector[5-ns1] = yg_coord_sector[5-ns1];
05684         }
05685       
05686       if( DeeNumber == 2 )
05687         {
05688           ns1 = 5; ns2 = 9;
05689           xg_sector[ns2-1] = xinv_d2d4-xg_coord_sector[1-1];  yg_sector[ns2-1] = yg_coord_sector[1-1];
05690           xg_sector[ns2-2] = xinv_d2d4-xg_coord_sector[2-1];  yg_sector[ns2-2] = yg_coord_sector[2-1];
05691           xg_sector[ns2-3] = xinv_d2d4-xg_coord_sector[3-1];  yg_sector[ns2-3] = yg_coord_sector[3-1];
05692           xg_sector[ns2-4] = xinv_d2d4-xg_coord_sector[4-1];  yg_sector[ns2-4] = yg_coord_sector[4-1];
05693           xg_sector[ns2-5] = xinv_d2d4-xg_coord_sector[5-1];  yg_sector[ns2-5] = yg_coord_sector[5-1];
05694         }
05695       if( DeeNumber == 3 )
05696         {
05697           ns1 = 5; ns2 = 9;
05698           xg_sector[ns2-1]= xg_coord_sector[1-1];  yg_sector[ns2-1] = yg_coord_sector[1-1];
05699           xg_sector[ns2-2]= xg_coord_sector[2-1];  yg_sector[ns2-2] = yg_coord_sector[2-1];
05700           xg_sector[ns2-3]= xg_coord_sector[3-1];  yg_sector[ns2-3] = yg_coord_sector[3-1];
05701           xg_sector[ns2-4]= xg_coord_sector[4-1];  yg_sector[ns2-4] = yg_coord_sector[4-1];
05702           xg_sector[ns2-5]= xg_coord_sector[5-1];  yg_sector[ns2-5] = yg_coord_sector[5-1];
05703         }
05704       if( DeeNumber == 4 )
05705         {
05706           ns1 = 1; ns2 = 5;
05707           xg_sector[1-ns1]= xinv_d2d4-xg_coord_sector[1-ns1];  yg_sector[1-ns1] = yg_coord_sector[1-ns1];
05708           xg_sector[2-ns1]= xinv_d2d4-xg_coord_sector[2-ns1];  yg_sector[2-ns1] = yg_coord_sector[2-ns1];
05709           xg_sector[3-ns1]= xinv_d2d4-xg_coord_sector[3-ns1];  yg_sector[3-ns1] = yg_coord_sector[3-ns1];
05710           xg_sector[4-ns1]= xinv_d2d4-xg_coord_sector[4-ns1];  yg_sector[4-ns1] = yg_coord_sector[4-ns1];
05711           xg_sector[5-ns1]= xinv_d2d4-xg_coord_sector[5-ns1];  yg_sector[5-ns1] = yg_coord_sector[5-ns1];
05712         }
05713       
05714       Color_t coul_textsector = fCnaParHistos->ColorDefinition("vert37");
05715       for(Int_t ns=ns1; ns<= ns2; ns++)
05716         {
05717           xg_sector[ns-1] += fCnaParHistos->DeeOffsetX(opt_plot, DeeNumber);
05718           if( DeeNumber == 1 || DeeNumber == 2 ){sprintf( f_in, "+%d", ns);}
05719           if( DeeNumber == 3 || DeeNumber == 4 ){sprintf( f_in, "-%d", ns);}
05720           TText *text_num_module = new TText(xg_sector[ns-1], yg_sector[ns-1], f_in);        fCnewRoot++;
05721           if(opt_plot == "Dee"){text_num_module->SetTextSize(0.065);}
05722           if(opt_plot == "EE" ){text_num_module->SetTextSize(0.045);}
05723           text_num_module->SetTextColor(coul_textsector);
05724           if( opt_plot == "Dee" ||
05725               ( opt_plot == "EE" && !( (DeeNumber == 3 && ns == 5) || (DeeNumber == 1 && ns == 5) ) ) )
05726             {text_num_module->Draw();}
05727 
05728           // text_num_module->Delete(); text_num_module = 0;     fCdeleteRoot++;     
05729         }
05730       
05731       //............................ numeros des dee's
05732       ngmax = 4;
05733       Float_t  xg_coord_dee[4] = { 0,  0,  0,  0};
05734       Float_t  yg_coord_dee[4] = {48, 48, 48, 48};
05735       
05736       xg_coord_dee[DeeNumber-1] = coefcc_x*xg_coord_dee[DeeNumber-1];
05737       yg_coord_dee[DeeNumber-1] = coefcc_y*yg_coord_dee[DeeNumber-1];
05738 
05739       Float_t  xg_dee = xg_coord_dee[DeeNumber-1];
05740       Float_t  yg_dee = yg_coord_dee[DeeNumber-1];
05741 
05742       Color_t coul_textdee = fCnaParHistos->ColorDefinition("noir");
05743    
05744       xg_dee += fCnaParHistos->DeeOffsetX(opt_plot, DeeNumber)
05745         + fCnaParHistos->DeeNumberOffsetX(opt_plot, DeeNumber);
05746 
05747       if( DeeNumber == 1 ){sprintf( f_in, "D1");}
05748       if( DeeNumber == 2 ){sprintf( f_in, "D2");}
05749       if( DeeNumber == 3 ){sprintf( f_in, "D3");}
05750       if( DeeNumber == 4 ){sprintf( f_in, "D4");}
05751 
05752       TText *text_num_module = new TText(xg_dee, yg_dee, f_in);        fCnewRoot++;
05753       if( opt_plot == "EE" ){text_num_module->SetTextSize(0.045);}
05754       if( opt_plot == "Dee"){text_num_module->SetTextSize(0.085);}
05755       text_num_module->SetTextColor(coul_textdee);
05756       text_num_module->Draw();
05757     }
05758 
05759   //..................................... Numeros des Dee et indication EE+- (option "EE" seulement)
05760   if( opt_plot == "EE" )
05761     {
05762       //............................ indication EE+-
05763       ngmax = 4;
05764       Float_t  xg_coord_eepm[4] = { 0,  0,  0,  0};
05765       Float_t  yg_coord_eepm[4] = {95, 95, 95, 95};
05766      
05767       xg_coord_eepm[DeeNumber-1] = coefcc_x*xg_coord_eepm[DeeNumber-1];
05768       yg_coord_eepm[DeeNumber-1] = coefcc_y*yg_coord_eepm[DeeNumber-1];
05769 
05770       Float_t  xg_eepm = xg_coord_eepm[DeeNumber-1];
05771       Float_t  yg_eepm = yg_coord_eepm[DeeNumber-1];
05772 
05773       Color_t coul_texteepm = fCnaParHistos->ColorDefinition("noir");
05774    
05775       xg_eepm += fCnaParHistos->DeeOffsetX(opt_plot, DeeNumber)
05776         + fCnaParHistos->DeeNameOffsetX(DeeNumber);
05777 
05778       if( DeeNumber == 1 ){sprintf( f_in, "EE+F");}
05779       if( DeeNumber == 2 ){sprintf( f_in, "EE+N");}
05780       if( DeeNumber == 3 ){sprintf( f_in, "EE-N");}
05781       if( DeeNumber == 4 ){sprintf( f_in, "EE-F");}
05782 
05783       TText *text_num_eepm = new TText(xg_eepm, yg_eepm, f_in);        fCnewRoot++;
05784       text_num_eepm->SetTextSize(0.04);
05785       text_num_eepm->SetTextColor(coul_texteepm);
05786       text_num_eepm->Draw();
05787     }
05788 
05789   //......................... mention "viewed from IP"
05790   Color_t coul_textfromIP = fCnaParHistos->ColorDefinition("rouge49");
05791   sprintf( f_in, "viewed from IP");
05792   Float_t x_from_ip = 15.;
05793   Float_t y_from_ip = -10.;
05794   if( opt_plot == "EE" ){y_from_ip = -16.;}
05795   x_from_ip = coefcc_x*x_from_ip;
05796   y_from_ip = coefcc_x*y_from_ip;
05797   if( opt_plot == "EE" && DeeNumber == 3 ){x_from_ip += 1.4*fCnaParHistos->DeeOffsetX(opt_plot, DeeNumber);}
05798   TText *text_from_ip = new TText(x_from_ip, y_from_ip, f_in);        fCnewRoot++;
05799   text_from_ip->SetTextSize(0.045);
05800   if( opt_plot == "EE" ){text_from_ip->SetTextSize(0.035);}
05801   text_from_ip->SetTextColor(coul_textfromIP);
05802   if( opt_plot == "Dee" || (opt_plot == "EE" && DeeNumber == 3) ){text_from_ip->Draw();}
05803 
05804   delete [] f_in;      f_in = 0;                                 fCdelete++;
05805 
05806 }  // ------ end of EEDataSectors() ------
05807 
05808 //==========================================================================================
05809 
05810 void TEcnaHistos::EEGridAxis(const Float_t& coefcc_x,  const Float_t& coefcc_y,
05811                              const Int_t&   DeeNumber, const TString opt_plot,  const TString c_option)
05812 {
05813   //------------------ trace axes en IX et IY --------------- EEGridAxis
05814   //=============================================================================== Axe IX
05815   Int_t size_IX_dee  = fEcal->MaxSCIXInDee();
05816 
05817   Double_t IX_min = fEcalNumbering->GetIIXMin(1) - 0.5;                        // IX_min = 0.5  pour les 4 dee's
05818   Double_t IX_max = fEcalNumbering->GetIIXMax()*fEcal->MaxCrysIXInSC() + 0.5;  // IX_max = 50.5 pour les 4 dee's
05819 
05820   Int_t MatSize = 1;
05821   if( opt_plot == "Dee" && c_option == "corcc" )
05822     {
05823       MatSize = fEcal->MaxCrysInSC();
05824       IX_min = fEcalNumbering->GetIIXMin() - 0.5;
05825       IX_max = fEcalNumbering->GetIIXMax() + 0.5;
05826     }
05827   if( opt_plot == "EE"  && c_option == "corcc" ){return;}     // => a voir...
05828 
05829   if( opt_plot == "Dee" && c_option != "corcc" ){MatSize = fEcal->MaxCrysIXInSC();}
05830   if( opt_plot == "EE"  && c_option != "corcc" ){MatSize = 1;}
05831 
05832   TString  x_var_name  = " ";
05833 
05834   Float_t axis_x_inf  = 0;
05835   Float_t axis_x_sup  = 0;
05836   Float_t axis_y_inf  = 0;
05837   Float_t axis_y_sup  = 0;
05838   Int_t   axis_nb_div = 205;   // DEFAULT: option "EE"
05839   Double_t IX_values_min = 0;
05840   Double_t IX_values_max = 0;
05841   Option_t* chopt = "C";
05842 
05843   //........................................................................EEGridAxis
05844   if( DeeNumber == 1 ) //  xmin -> xmax <=> right->left
05845     {
05846       //.....axis min->max/left->right: first draw axis with -ticksize and no label
05847       axis_x_inf    = size_IX_dee*MatSize;
05848       axis_x_sup    = 0;
05849       axis_y_inf    = 0; 
05850       axis_y_sup    = 0;
05851       IX_values_min = -IX_max;   // -50.5 right
05852       IX_values_max = -IX_min;   // - 0.5 left
05853       if( opt_plot == "Dee" ){x_var_name = GetIXIYAxisTitle("iIXDee1");}
05854       if( opt_plot == "EE"  ){x_var_name = GetIXIYAxisTitle("iIXEE");}
05855       if( opt_plot == "Dee" ){axis_nb_div = size_IX_dee;} 
05856       chopt         = "-CSU";
05857     }
05858   if( DeeNumber == 2 ) //  xmin -> xmax <=> right->left
05859     {
05860       //.....axis min->max/left->right: first draw axis with -ticksize and no label
05861       axis_x_inf    = size_IX_dee*MatSize;
05862       axis_x_sup    = 0;
05863       axis_y_inf    = 0;
05864       axis_y_sup    = 0;
05865       IX_values_min = IX_min;   // + 0.5 right
05866       IX_values_max = IX_max;   // +50.5 left
05867       if( opt_plot == "Dee" ){x_var_name = GetIXIYAxisTitle("iIXDee2");}
05868       if( opt_plot == "EE"  ){x_var_name = " ";}
05869       if( opt_plot == "Dee" ){axis_nb_div = size_IX_dee;}  
05870       chopt         = "-CSU";
05871     }
05872   if( DeeNumber == 3 )  //  xmin -> xmax <=> left->right
05873     {
05874       axis_x_inf    = 0;
05875       axis_x_sup    = size_IX_dee*MatSize;
05876       axis_y_inf    = 0; 
05877       axis_y_sup    = 0;
05878       IX_values_min = IX_min;   // + 0.5 left
05879       IX_values_max = IX_max;   // +50.5 right
05880       if( opt_plot == "Dee" ){x_var_name = GetIXIYAxisTitle("iIXDee3");}
05881       if( opt_plot == "EE"  ){x_var_name = " ";}
05882       if( opt_plot == "Dee" ){axis_nb_div = size_IX_dee;} 
05883       chopt         = "CS";
05884     }
05885   if( DeeNumber == 4 )  //  xmin -> xmax <=> left->right
05886     {
05887       axis_x_inf    = 0;
05888       axis_x_sup    = size_IX_dee*MatSize;
05889       axis_y_inf    = 0; 
05890       axis_y_sup    = 0;
05891       IX_values_min = -IX_max;   // -50.5 left
05892       IX_values_max = -IX_min;   // - 0.5 right
05893       if( opt_plot == "Dee" ){x_var_name = GetIXIYAxisTitle("iIXDee4");}
05894       if( opt_plot == "EE"  ){x_var_name = " ";}
05895       if( opt_plot == "Dee" ){axis_nb_div = size_IX_dee;} 
05896       chopt         = "CS"; 
05897     }
05898 
05899   //.................................................................... EEGridAxis
05900   axis_x_inf += fCnaParHistos->DeeOffsetX(opt_plot, DeeNumber);
05901   axis_x_sup += fCnaParHistos->DeeOffsetX(opt_plot, DeeNumber);
05902 
05903   TGaxis* sup_axis_x = 0;
05904   sup_axis_x = new TGaxis(axis_x_inf, axis_y_inf, axis_x_sup, axis_y_sup,
05905                           IX_values_min, IX_values_max, axis_nb_div, chopt, 0.);   fCnewRoot++;
05906 
05907   Float_t tit_siz_x = fCnaParHistos->AxisTitleSize();
05908   Float_t lab_siz_x = fCnaParHistos->AxisLabelSize();
05909 
05910   Float_t tic_siz_x = fCnaParHistos->AxisTickSize("Deex");
05911   if(opt_plot == "EE"){tic_siz_x = fCnaParHistos->AxisTickSize("EEx");}
05912 
05913   Float_t tit_off_x = fCnaParHistos->AxisTitleOffset("Deex");
05914   if(opt_plot == "EE"){tit_off_x = fCnaParHistos->AxisTitleOffset("EEx");}
05915 
05916   Float_t lab_off_x = fCnaParHistos->AxisLabelOffset("Deex");
05917   if(opt_plot == "EE"){lab_off_x = fCnaParHistos->AxisLabelOffset("EEx");}
05918 
05919   sup_axis_x->SetTitle(x_var_name);
05920   sup_axis_x->SetTitleSize(tit_siz_x);
05921   sup_axis_x->SetTitleOffset(tit_off_x);
05922   sup_axis_x->SetLabelSize(lab_siz_x);
05923   sup_axis_x->SetLabelOffset(lab_off_x);
05924   sup_axis_x->SetTickSize(tic_siz_x);
05925   sup_axis_x->Draw("SAME");
05926 
05927   //.....axis min->max/right->left: redraw axis with ticksize = 0 and with -labelOffset
05928   if( DeeNumber == 1 || DeeNumber == 2 )
05929     {
05930       chopt = "CS";
05931       TGaxis* sup_axis_x_bis = 0;
05932       sup_axis_x_bis = new TGaxis(axis_x_inf, axis_y_inf, axis_x_sup, axis_y_sup,
05933                                   IX_values_min, IX_values_max, axis_nb_div, chopt, 0.);   fCnewRoot++;
05934       sup_axis_x_bis->SetTickSize(0.);
05935       lab_siz_x = sup_axis_x->GetLabelSize();
05936       sup_axis_x_bis->SetLabelSize(lab_siz_x);
05937       lab_off_x = sup_axis_x->GetLabelOffset();
05938       sup_axis_x_bis->SetLabelOffset(-lab_off_x);
05939       sup_axis_x_bis->Draw("SAME");
05940     }
05941 
05942   //================================================================== Axe IY  EEGridAxis
05943 
05944   if( opt_plot == "Dee" || (opt_plot == "EE" && DeeNumber == 4) )
05945     {
05946       Int_t size_IY_dee  = fEcal->MaxSCIYInDee();
05947       Int_t size_IY_axis = size_IY_dee;
05948 
05949       if( opt_plot == "Dee" ){axis_nb_div = size_IY_axis;}
05950       if( opt_plot == "EE"  ){axis_nb_div = 210;}
05951 
05952       Double_t jIY_min = fEcalNumbering->GetJIYMin(DeeNumber, 1) - 0.5;
05953       Double_t jIY_max = fEcalNumbering->GetJIYMax(DeeNumber)*fEcal->MaxCrysIYInSC() + 0.5;
05954 
05955       TString  jy_var_name  = " ";
05956       TString  jy_direction = "x";
05957 
05958       Float_t tit_siz_y = fCnaParHistos->AxisTitleSize();
05959       Float_t lab_siz_y = fCnaParHistos->AxisLabelSize();
05960 
05961       Float_t tic_siz_y = fCnaParHistos->AxisTickSize("Deey");
05962       if(opt_plot == "EE"){tic_siz_y = fCnaParHistos->AxisTickSize("EEy");}
05963 
05964       Float_t tit_off_y = fCnaParHistos->AxisTitleOffset("Deey");
05965       if(opt_plot == "EE"){tit_off_y = fCnaParHistos->AxisTitleOffset("EEy");}
05966 
05967       Float_t lab_off_y = fCnaParHistos->AxisLabelOffset("Deey");
05968       if(opt_plot == "EE"){lab_off_y = fCnaParHistos->AxisLabelOffset("EEy");}
05969 
05970       TGaxis* axis_jy_plus = 0;
05971       axis_jy_plus = new TGaxis((Float_t)0., (Float_t)0.,
05972                                 (Float_t)0., (Float_t)(size_IY_axis*MatSize),
05973                                 jIY_min, jIY_max, axis_nb_div, "SC", 0.);   fCnewRoot++;
05974 
05975       jy_var_name  = GetIXIYAxisTitle("jIYDee");  
05976       axis_jy_plus->SetTitle(jy_var_name);
05977       axis_jy_plus->SetTitleSize(tit_siz_y);
05978       axis_jy_plus->SetTitleOffset(tit_off_y);
05979       axis_jy_plus->SetLabelSize(lab_siz_y);
05980       axis_jy_plus->SetLabelOffset(lab_off_y);
05981       axis_jy_plus->SetTickSize(tic_siz_y);
05982       axis_jy_plus->Draw("SAME");
05983     }
05984 
05985 //---------------------------------- 2 axes (0,50) et (0,-50)
05986 #define IYAX
05987 #ifndef IYAX
05988   if( opt_plot == "Dee" || (opt_plot == "EE" && DeeNumber == 4) )
05989     {
05990       Int_t size_IY_dee  = fEcal->MaxSCIYInDee();
05991       Int_t size_IY_axis = size_IY_dee/2;
05992 
05993       if( opt_plot == "Dee" ){axis_nb_div = (Int_t)size_IY_axis;}
05994       if( opt_plot == "EE"  ){axis_nb_div = 5;}
05995 
05996       Double_t jIY_min = fEcalNumbering->GetJIYMin(DeeNumber, 1) - 0.5;
05997       Double_t jIY_max = (fEcalNumbering->GetJIYMax(DeeNumber)/2)*fEcal->MaxCrysIYInSC() + 0.5;
05998 
05999       TString  jy_var_name  = " ";
06000       TString  jy_direction = "x";
06001 
06002       Float_t tit_siz_y = fCnaParHistos->AxisTitleSize();
06003       Float_t lab_siz_y = fCnaParHistos->AxisLabelSize();
06004 
06005       Float_t tic_siz_y = fCnaParHistos->AxisTickSize("Deey");
06006       if(opt_plot == "EE"){tic_siz_y = fCnaParHistos->AxisTickSize("EEy");}
06007 
06008       Float_t tit_off_y = fCnaParHistos->AxisTitleOffset("Deey");
06009       if(opt_plot == "EE"){tit_off_y = fCnaParHistos->AxisTitleOffset("EEy");}
06010 
06011       Float_t lab_off_y = fCnaParHistos->AxisLabelOffset("Deey");
06012       if(opt_plot == "EE"){lab_off_y = fCnaParHistos->AxisLabelOffset("EEy");}
06013 
06014       TGaxis* axis_jy_plus = 0;
06015       axis_jy_plus = new TGaxis((Float_t)0., (Float_t)(size_IY_dee*MatSize/2),
06016                                 (Float_t)0., (Float_t)(2*size_IY_dee*MatSize/2),
06017                                 jIY_min, jIY_max, axis_nb_div, "SC", 0.);   fCnewRoot++;
06018 
06019       jy_var_name  = GetIXIYAxisTitle("jIYDee");  
06020       axis_jy_plus->SetTitle(jy_var_name);
06021       axis_jy_plus->SetTitleSize(tit_siz_y);
06022       axis_jy_plus->SetTitleOffset(tit_off_y);
06023       axis_jy_plus->SetLabelSize(lab_siz_y);
06024       axis_jy_plus->SetLabelOffset(lab_off_y);
06025       axis_jy_plus->SetTickSize(tic_siz_y);
06026       axis_jy_plus->Draw("SAME");
06027 
06028       TGaxis* axis_jy_minus = 0;
06029       axis_jy_minus = new TGaxis((Float_t)0., (Float_t)(size_IY_dee*MatSize/2),
06030                                  (Float_t)0., (Float_t)0.,
06031                                  -jIY_min, -jIY_max, axis_nb_div, "-SC", 0.);   fCnewRoot++;
06032 
06033       jy_var_name  = GetIXIYAxisTitle("jIYDee");  
06034       axis_jy_minus->SetTitle(jy_var_name);
06035       axis_jy_minus->SetTitleSize(tit_siz_y);
06036       axis_jy_minus->SetTitleOffset(tit_off_y);
06037       axis_jy_minus->SetLabelSize(lab_siz_y);
06038       axis_jy_minus->SetLabelOffset(lab_off_y);
06039       axis_jy_minus->SetTickSize(tic_siz_y);
06040       axis_jy_minus->Draw("SAME");
06041     }
06042 #endif // IYAX
06043 
06044 } // ------------- end of EEGridAxis(...) --------------
06045 
06046 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
06047 //
06048 //                               ViewHisto(***)
06049 // 
06050 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
06051 //======================== D_MSp_SpNb
06052 void TEcnaHistos::XtalSamplesEv(const TVectorD& arg_read_histo, const Int_t& arg_AlreadyRead,
06053                                 const Int_t&    n1StexStin,     const Int_t& i0StinEcha)
06054 {XtalSamplesEv(arg_read_histo, arg_AlreadyRead, n1StexStin, i0StinEcha, "ONLYONE");}
06055 void TEcnaHistos::XtalSamplesEv(const TVectorD& arg_read_histo, const Int_t& arg_AlreadyRead,
06056                                 const Int_t&    n1StexStin,     const Int_t& i0StinEcha,
06057                                 const TString   PlotOption)
06058 {
06059   if( fFapStexNumber > 0 )
06060     {
06061       if( PlotOption == fAllXtalsInStinPlot )
06062         {
06063           Int_t StexStin_A = n1StexStin;
06064           if( fFlagSubDet == "EE" )
06065             {StexStin_A = fEcalNumbering->Get1DeeSCEcnaFromDeeSCCons(fFapStexNumber, n1StexStin);}
06066 
06067           Bool_t aOKData = kFALSE;
06068           TVectorD read_histo(fEcal->MaxCrysInStin()*fEcal->MaxSampADC());
06069 
06070           if( arg_AlreadyRead == fTobeRead )
06071             {
06072               fMyRootFile->PrintNoComment();
06073               fMyRootFile->FileParameters(fFapAnaType,          fFapNbOfSamples,
06074                                           fFapRunNumber,        fFapFirstReqEvtNumber,
06075                                           fFapLastReqEvtNumber, fFapReqNbOfEvts,
06076                                           fFapStexNumber,       fCfgResultsRootFilePath.Data());
06077               
06078               if ( fMyRootFile->LookAtRootFile() == kTRUE )
06079                 {
06080                   fStatusFileFound = kTRUE;
06081                   read_histo = fMyRootFile->ReadSampleMeans(StexStin_A, fEcal->MaxCrysInStin()*fEcal->MaxSampADC());
06082                   if( fMyRootFile->DataExist() == kTRUE ){fStatusDataExist = kTRUE;}
06083                 }
06084               else
06085                 {
06086                   fStatusFileFound = kFALSE;
06087                   cout << "!TEcnaHistos::XtalSamplesEv(...)> Data not available (ROOT file not found)." << endl;
06088                 }
06089               if( fStatusFileFound == kTRUE && fStatusDataExist == kTRUE ){aOKData = kTRUE;}
06090             }
06091           if( arg_AlreadyRead >= 1 )
06092             {
06093               for(Int_t i=0; i<fEcal->MaxCrysInStin()*fEcal->MaxSampADC(); i++){read_histo[i] = arg_read_histo[i];}
06094               fStatusDataExist = kTRUE;
06095               aOKData = kTRUE;
06096             }
06097 
06098           if( aOKData == kTRUE )
06099             {
06100               TVectorD read_histo_samps(fFapNbOfSamples);
06101               
06102               Int_t xAlreadyRead = 1;
06103               for( Int_t i0_stin_echa=0; i0_stin_echa<fEcal->MaxCrysInStin(); i0_stin_echa++)
06104                 {
06105                   if( fFapStexName == "SM" )
06106                     {cout << "*TEcnaHistos::XtalSamplesEv(...)> channel " << setw(2) << i0_stin_echa << ": ";}
06107                   if( fFapStexName == "Dee" )
06108                     {cout << "*TEcnaHistos::XtalSamplesEv(...)> Xtal " << setw(2) << i0_stin_echa+1 << ": ";}
06109                   
06110                   for( Int_t i0_samp=0; i0_samp<fFapNbOfSamples; i0_samp++ )
06111                     {
06112                       read_histo_samps(i0_samp) = read_histo(i0_stin_echa*fFapNbOfSamples+i0_samp);
06113                       cout << setprecision(4) << setw(8) << read_histo_samps(i0_samp) << ", " ;
06114                     }
06115                   cout << endl;
06116                   ViewHisto(read_histo_samps, xAlreadyRead,
06117                             StexStin_A, i0_stin_echa, fZerv, "D_MSp_SpNb", fAllXtalsInStinPlot);
06118                   xAlreadyRead++;
06119                 }
06120               xAlreadyRead = 0;
06121             }
06122           else
06123             {
06124               cout << "!TEcnaHistos::XtalSamplesEv(...)> Data not available." << endl;
06125             }
06126         }
06127       
06128       if( !(PlotOption == fAllXtalsInStinPlot) )      
06129         {
06130           Int_t StexStin_A = n1StexStin;
06131           if( fFlagSubDet == "EE" )
06132             {StexStin_A = fEcalNumbering->Get1DeeSCEcnaFromDeeSCCons(fFapStexNumber, n1StexStin);}
06133           ViewHisto(fReadHistoDummy, fTobeRead, StexStin_A, i0StinEcha, fZerv, "D_MSp_SpNb", PlotOption);
06134         }
06135     }
06136   else
06137     {
06138       cout << "!TEcnaHistos::XtalSamplesEv(...)> " << fFapStexName.Data() << " number = " << fFapStexNumber
06139            << " out of range (range = [1," << fEcal->MaxStexInStas() << "])" << fTTBELL << endl;
06140     }
06141 }
06142 
06143 //======================== D_MSp_SpDs
06144 void TEcnaHistos::EvSamplesXtals(const TVectorD& arg_read_histo, const Int_t& arg_AlreadyRead,
06145                                  const Int_t&    n1StexStin,     const Int_t& i0StinEcha)
06146 {EvSamplesXtals(arg_read_histo, arg_AlreadyRead, n1StexStin, i0StinEcha, "ONLYONE");}
06147 void TEcnaHistos::EvSamplesXtals(const TVectorD& arg_read_histo, const Int_t& arg_AlreadyRead,
06148                                  const Int_t&    n1StexStin,     const Int_t& i0StinEcha,
06149                                  const TString   PlotOption)
06150 {
06151   if( fFapStexNumber > 0 )
06152     {
06153       if( PlotOption == fAllXtalsInStinPlot )
06154         {
06155           Int_t StexStin_A = n1StexStin;
06156           if( fFlagSubDet == "EE" )
06157             {StexStin_A = fEcalNumbering->Get1DeeSCEcnaFromDeeSCCons(fFapStexNumber, n1StexStin);}
06158 
06159           Bool_t aOKData = kFALSE;
06160           TVectorD read_histo(fEcal->MaxCrysInStin()*fEcal->MaxSampADC());
06161 
06162           if( arg_AlreadyRead == fTobeRead )
06163             {
06164               fMyRootFile->PrintNoComment();
06165               fMyRootFile->FileParameters(fFapAnaType,          fFapNbOfSamples,
06166                                           fFapRunNumber,        fFapFirstReqEvtNumber,
06167                                           fFapLastReqEvtNumber, fFapReqNbOfEvts,
06168                                           fFapStexNumber,       fCfgResultsRootFilePath.Data());
06169 
06170               if ( fMyRootFile->LookAtRootFile() == kTRUE )
06171                 {
06172                   fStatusFileFound = kTRUE;
06173                   read_histo = fMyRootFile->ReadSampleMeans(StexStin_A, fEcal->MaxCrysInStin()*fEcal->MaxSampADC());
06174                   if( fMyRootFile->DataExist() == kTRUE ){fStatusDataExist = kTRUE;}
06175                 }
06176               else
06177                 {
06178                   fStatusFileFound = kFALSE;
06179                   cout << "!TEcnaHistos::EvSamplesXtals(...)> Data not available (ROOT file not found)." << endl;
06180                 }
06181               if( fStatusFileFound == kTRUE && fStatusDataExist == kTRUE ){aOKData = kTRUE;}
06182             }
06183           if( arg_AlreadyRead >= 1 )
06184             {
06185               for(Int_t i=0; i<fEcal->MaxCrysInStin()*fEcal->MaxSampADC(); i++){read_histo[i] = arg_read_histo[i];}
06186               fStatusDataExist = kTRUE;
06187               aOKData = kTRUE;
06188             }
06189           if( aOKData == kTRUE )
06190             {
06191               TVectorD read_histo_samps(fFapNbOfSamples);
06192               
06193               Int_t xAlreadyRead = 1;
06194               for( Int_t i0_stin_echa=0; i0_stin_echa<fEcal->MaxCrysInStin(); i0_stin_echa++)
06195                 {
06196                   if( fFapStexName == "SM" )
06197                     {cout << "*TEcnaHistos::EvSamplesXtals(...)> channel " << setw(2) << i0_stin_echa << ": ";}
06198                   if( fFapStexName == "Dee" )
06199                     {cout << "*TEcnaHistos::EvSamplesXtals(...)> Xtal " << setw(2) << i0_stin_echa+1 << ": ";}
06200                   
06201                   for( Int_t i0_samp=0; i0_samp<fFapNbOfSamples; i0_samp++ )
06202                     {
06203                       read_histo_samps(i0_samp) = read_histo(i0_stin_echa*fFapNbOfSamples+i0_samp);
06204                       cout << setprecision(4) << setw(8) << read_histo_samps(i0_samp) << ", " ;
06205                     }
06206                   cout << endl;
06207                   ViewHisto(read_histo_samps, xAlreadyRead,
06208                             StexStin_A, i0_stin_echa, fZerv, "D_MSp_SpDs", fAllXtalsInStinPlot);
06209                   xAlreadyRead++;
06210                 }
06211               xAlreadyRead = 0;
06212             }
06213           else
06214             {
06215               cout << "!TEcnaHistos::EvSamplesXtals(...)> Data not available." << endl;
06216             }
06217         }
06218       
06219       if( !(PlotOption == fAllXtalsInStinPlot) )      
06220         {
06221           Int_t StexStin_A = n1StexStin;
06222           if( fFlagSubDet == "EE" )
06223             {StexStin_A = fEcalNumbering->Get1DeeSCEcnaFromDeeSCCons(fFapStexNumber, n1StexStin);}
06224           ViewHisto(fReadHistoDummy, fTobeRead, StexStin_A, i0StinEcha, fZerv, "D_MSp_SpDs", PlotOption);
06225         }
06226     }
06227   else
06228     {
06229       cout << "!TEcnaHistos::EvSamplesXtals(...)> " << fFapStexName.Data() << " number = " << fFapStexNumber
06230            << " out of range (range = [1," << fEcal->MaxStexInStas() << "])" << fTTBELL << endl;
06231     }
06232 } // end of EvSamplesXtals(...)
06233 
06234 //======================== D_SSp_SpNb
06235 void TEcnaHistos::XtalSamplesSigma(const TVectorD& arg_read_histo, const Int_t& arg_AlreadyRead,
06236                                    const Int_t&    n1StexStin,     const Int_t& i0StinEcha)
06237 {XtalSamplesSigma(arg_read_histo, arg_AlreadyRead, n1StexStin, i0StinEcha, "ONLYONE");}
06238 void TEcnaHistos::XtalSamplesSigma(const TVectorD& arg_read_histo, const Int_t& arg_AlreadyRead,
06239                                    const Int_t&    n1StexStin,     const Int_t& i0StinEcha,
06240                                    const TString   PlotOption)
06241 {
06242   if( fFapStexNumber > 0 )
06243     {  
06244       if( PlotOption == fAllXtalsInStinPlot )
06245         {
06246           Int_t StexStin_A = n1StexStin;
06247           if( fFlagSubDet == "EE" )
06248             {StexStin_A = fEcalNumbering->Get1DeeSCEcnaFromDeeSCCons(fFapStexNumber, n1StexStin);}
06249           
06250           Bool_t aOKData = kFALSE;
06251           TVectorD read_histo(fEcal->MaxCrysInStin()*fEcal->MaxSampADC());
06252           
06253           if( arg_AlreadyRead == fTobeRead )
06254             {
06255               fMyRootFile->PrintNoComment();
06256               fMyRootFile->FileParameters(fFapAnaType,          fFapNbOfSamples,
06257                                           fFapRunNumber,        fFapFirstReqEvtNumber,
06258                                           fFapLastReqEvtNumber, fFapReqNbOfEvts,
06259                                           fFapStexNumber,       fCfgResultsRootFilePath.Data());
06260               
06261               if ( fMyRootFile->LookAtRootFile() == kTRUE )
06262                 {
06263                   fStatusFileFound = kTRUE;
06264                   read_histo = fMyRootFile->ReadSampleSigmas(StexStin_A, fEcal->MaxCrysInStin()*fEcal->MaxSampADC());
06265                   if( fMyRootFile->DataExist() == kTRUE ){fStatusDataExist = kTRUE;}
06266                 }
06267               else
06268                 {
06269                   fStatusFileFound = kFALSE;
06270                   cout << "!TEcnaHistos::XtalSamplesSigma(...)> Data not available (ROOT file not found)." << endl;
06271                 }
06272               if( fStatusFileFound == kTRUE && fStatusDataExist == kTRUE ){aOKData = kTRUE;}
06273             }
06274           if( arg_AlreadyRead >= 1 )
06275             {
06276               for(Int_t i=0; i<fEcal->MaxCrysInStin()*fEcal->MaxSampADC(); i++){read_histo[i] = arg_read_histo[i];}
06277               fStatusDataExist = kTRUE;
06278               aOKData = kTRUE;
06279             }
06280           if( aOKData == kTRUE )
06281             {
06282               TVectorD read_histo_samps(fFapNbOfSamples);
06283               
06284               Int_t xAlreadyRead = 1;
06285               for( Int_t i0_stin_echa=0; i0_stin_echa<fEcal->MaxCrysInStin(); i0_stin_echa++)
06286                 {
06287                   if( fFapStexName == "SM" )
06288                     {cout << "*TEcnaHistos::XtalSamplesSigma(...)> channel " << setw(2) << i0_stin_echa << ": ";}
06289                   if( fFapStexName == "Dee" )
06290                     {cout << "*TEcnaHistos::XtalSamplesSigma(...)> Xtal " << setw(2) << i0_stin_echa+1 << ": ";}
06291                   
06292                   for( Int_t i0_samp=0; i0_samp<fFapNbOfSamples; i0_samp++ )
06293                     {
06294                       read_histo_samps(i0_samp) = read_histo(i0_stin_echa*fFapNbOfSamples+i0_samp);
06295                       cout << setprecision(3) << setw(6) << read_histo_samps(i0_samp) << ", " ;
06296                     }
06297                   cout << endl;
06298                   ViewHisto(read_histo_samps, xAlreadyRead,
06299                             StexStin_A, i0StinEcha, fZerv, "D_SSp_SpNb", fAllXtalsInStinPlot);
06300                   xAlreadyRead++;    
06301                 }
06302               xAlreadyRead = 0;
06303             }
06304           else
06305             {
06306               cout << "!TEcnaHistos::XtalSamplesSigma(...)> Data not available." << endl;
06307             }
06308         }
06309 
06310       if( !(PlotOption == fAllXtalsInStinPlot) )      
06311         {
06312           Int_t StexStin_A = n1StexStin;
06313           if( fFlagSubDet == "EE" )
06314             {StexStin_A = fEcalNumbering->Get1DeeSCEcnaFromDeeSCCons(fFapStexNumber, n1StexStin);}
06315           ViewHisto(fReadHistoDummy, fTobeRead, StexStin_A, i0StinEcha, fZerv, "D_SSp_SpNb", PlotOption);
06316         } 
06317     }
06318   else
06319     {
06320       cout << "!TEcnaHistos::XtalSamplesSigma(...)> " << fFapStexName.Data() << " number = " << fFapStexNumber
06321            << " out of range (range = [1," << fEcal->MaxStexInStas() << "])" << fTTBELL << endl;
06322     }
06323 }
06324 
06325 
06326 //======================== D_SSp_SpDs
06327 void TEcnaHistos::SigmaSamplesXtals(const TVectorD& arg_read_histo, const Int_t& arg_AlreadyRead,
06328                                     const Int_t&    n1StexStin,     const Int_t& i0StinEcha)
06329 {SigmaSamplesXtals(arg_read_histo, arg_AlreadyRead, n1StexStin, i0StinEcha, "ONLYONE");}
06330 void TEcnaHistos::SigmaSamplesXtals(const TVectorD& arg_read_histo, const Int_t& arg_AlreadyRead,
06331                                     const Int_t&    n1StexStin,     const Int_t& i0StinEcha,
06332                                     const TString   PlotOption)
06333 {
06334   if( fFapStexNumber > 0 )
06335     {  
06336       if( PlotOption == fAllXtalsInStinPlot )
06337         {
06338           Int_t StexStin_A = n1StexStin;
06339           if( fFlagSubDet == "EE" )
06340             {StexStin_A = fEcalNumbering->Get1DeeSCEcnaFromDeeSCCons(fFapStexNumber, n1StexStin);}
06341                   
06342           Bool_t aOKData = kFALSE;
06343           TVectorD read_histo(fEcal->MaxCrysInStin()*fEcal->MaxSampADC());
06344           
06345           if( arg_AlreadyRead == fTobeRead )
06346             {
06347               fMyRootFile->PrintNoComment();
06348               fMyRootFile->FileParameters(fFapAnaType,          fFapNbOfSamples,
06349                                           fFapRunNumber,        fFapFirstReqEvtNumber,
06350                                           fFapLastReqEvtNumber, fFapReqNbOfEvts,
06351                                           fFapStexNumber,       fCfgResultsRootFilePath.Data());
06352               if ( fMyRootFile->LookAtRootFile() == kTRUE )
06353                 {
06354                   fStatusFileFound = kTRUE;
06355                   read_histo = fMyRootFile->ReadSampleSigmas(StexStin_A, fEcal->MaxCrysInStin()*fEcal->MaxSampADC());
06356                   if( fMyRootFile->DataExist() == kTRUE ){fStatusDataExist = kTRUE;}
06357                 }
06358               else
06359                 {
06360                   fStatusFileFound = kFALSE;
06361                   cout << "!TEcnaHistos::SigmaSamplesXtals(...)> Data not available (ROOT file not found)." << endl;
06362                 }
06363               if( fStatusFileFound == kTRUE && fStatusDataExist == kTRUE ){aOKData = kTRUE;}
06364             }
06365           
06366           if( arg_AlreadyRead >= 1 )
06367             {
06368               for(Int_t i=0; i<fEcal->MaxCrysInStin()*fEcal->MaxSampADC(); i++){read_histo[i] = arg_read_histo[i];}
06369               fStatusDataExist = kTRUE;
06370               aOKData = kTRUE;
06371             }
06372           if( aOKData == kTRUE )
06373             {
06374               TVectorD read_histo_samps(fFapNbOfSamples);
06375               
06376               Int_t xAlreadyRead = 1;
06377               for( Int_t i0_stin_echa=0; i0_stin_echa<fEcal->MaxCrysInStin(); i0_stin_echa++)
06378                 {
06379                   if( fFapStexName == "SM" )
06380                     {cout << "*TEcnaHistos::SigmaSamplesXtals(...)> channel " << setw(2) << i0_stin_echa << ": ";}
06381                   if( fFapStexName == "Dee" )
06382                     {cout << "*TEcnaHistos::SigmaSamplesXtals(...)> Xtal " << setw(2) << i0_stin_echa+1 << ": ";}
06383                   
06384                   for( Int_t i0_samp=0; i0_samp<fFapNbOfSamples; i0_samp++ )
06385                     {
06386                       read_histo_samps(i0_samp) = read_histo(i0_stin_echa*fFapNbOfSamples+i0_samp);
06387                       cout << setprecision(3) << setw(6) << read_histo_samps(i0_samp) << ", " ;
06388                     }
06389                   cout << endl;
06390                   ViewHisto(read_histo_samps, xAlreadyRead,
06391                             StexStin_A, i0StinEcha, fZerv, "D_SSp_SpDs", fAllXtalsInStinPlot);
06392                   xAlreadyRead++;    
06393                 }
06394               xAlreadyRead = 0;
06395             }
06396           else
06397             {
06398               cout << "!TEcnaHistos::SigmaSamplesXtals(...)> Data not available." << endl;
06399             }
06400         }
06401       
06402       if( !(PlotOption == fAllXtalsInStinPlot) )      
06403         {
06404           Int_t StexStin_A = n1StexStin;
06405           if( fFlagSubDet == "EE" )
06406             {StexStin_A = fEcalNumbering->Get1DeeSCEcnaFromDeeSCCons(fFapStexNumber, n1StexStin);}
06407           ViewHisto(fReadHistoDummy, fTobeRead, StexStin_A, i0StinEcha, fZerv, "D_SSp_SpDs", PlotOption);
06408         } 
06409     }
06410   else
06411     {
06412       cout << "!TEcnaHistos::SigmaSamplesXtals(...)> " << fFapStexName.Data() << " number = " << fFapStexNumber
06413            << " out of range (range = [1," << fEcal->MaxStexInStas() << "])" << fTTBELL << endl;
06414     }
06415 } // end of SigmaSamplesXtals(...)
06416 
06417 //==========================================================================================
06418 //
06419 //                         ViewHisto
06420 //
06421 //    arg_read_histo  = array containing the values
06422 //    arg_AlreadyRead = histo flag: =1 => arg_read_histo exists,
06423 //                                  =0 => values will be read by internal
06424 //                                        call to TEcnaRead inside ViewHisto
06425 //    StexStin_A      = [1,68] or [1,150]  ==> tower# if EB,  SC# if EE
06426 //    i0StinEcha      = [0,24] = Electronic channel# in tower (if EB) or SC (if EE) 
06427 //    i0Sample        = [0,9]  = sample#
06428 //    HistoCode       = String for histo type (pedestal, total noise, mean cor(s,s), ...)  
06429 //    opt_plot_arg    = String for plot option (SAME or not SAME)
06430 //
06431 //===========================================================================================
06432 void TEcnaHistos::ViewHisto(const TVectorD& arg_read_histo, const Int_t&  arg_AlreadyRead,
06433                             const Int_t&    StexStin_A,     const Int_t&  i0StinEcha,
06434                             const Int_t&    i0Sample,       const TString HistoCode,
06435                             const TString   opt_plot_arg)
06436 {
06437   //Histogram of the quantities (one run)
06438 
06439   TString opt_plot  = opt_plot_arg;
06440   fPlotAllXtalsInStin = 0;
06441 
06442   if( opt_plot_arg == fAllXtalsInStinPlot ){opt_plot = fOnlyOnePlot; fPlotAllXtalsInStin = 1;}
06443 
06444   TString HistoType = fCnaParHistos->GetHistoType(HistoCode.Data());
06445 
06446   Int_t OKHisto = 0;
06447 
06448   //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Canvas already closed in option SAME %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
06449   Int_t xCanvasExists = 1; // a priori ==> Canvas exists                                   // (ViewHisto)
06450   if( opt_plot != fOnlyOnePlot && GetMemoFlag(HistoCode, opt_plot) == "Busy" )
06451     {
06452       TVirtualPad* main_subpad = 0; 
06453       //---------------- Call to ActivePad
06454       //if( (TRootCanvas*)fCanv<HISTOCODE>->GetCanvasImp() == fImp<HISTOCODE> ){
06455       // main_subpad = fPad<HISTOCODE>;} (return main_subpad)
06456       main_subpad = ActivePad(HistoCode.Data(), opt_plot.Data());  // => return 0 if canvas has been closed
06457       if( main_subpad == 0 )
06458         {
06459           cout << "*TEcnaHistos::ViewHisto(...)> WARNING ===> Canvas has been closed in option SAME or SAME n."
06460                << endl
06461                << "                              Please, restart with a new canvas."
06462                << fTTBELL << endl;
06463           
06464           ReInitCanvas(HistoCode, opt_plot);
06465           xCanvasExists = 0;
06466         }
06467     }
06468   //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
06469 
06470   //%%%%%%%%%%%%%%%%%%%%%%%% Change of X variable in option SAME n with no proj %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
06471   Int_t SameXVarMemo = 1;   //  a priori ==> SAME n option: X variable OK                     (ViewHisto)
06472   if( !(HistoType == "Proj" || HistoType == "SampProj" || HistoType == "EvolProj") && 
06473       !(arg_AlreadyRead >= 1) )
06474     {
06475       TString XVarHisto = fCnaParHistos->GetXVarHisto(HistoCode.Data(), fFlagSubDet.Data(), fFapStexNumber);
06476       TString YVarHisto = fCnaParHistos->GetYVarHisto(HistoCode.Data(), fFlagSubDet.Data(), fFapStexNumber);
06477       if( (opt_plot == fSameOnePlot ) && GetMemoFlag(HistoCode, opt_plot) == "Free" )
06478         {
06479           SetXVarMemo(HistoCode, opt_plot, XVarHisto);  SetYVarMemo(HistoCode, opt_plot, YVarHisto); SameXVarMemo = 1;
06480         }
06481       if( (opt_plot == fSameOnePlot ) && GetMemoFlag(HistoCode, opt_plot) == "Busy" )
06482         {
06483           TString XVariableMemo = GetXVarFromMemo(HistoCode, opt_plot);
06484           TString YVariableMemo = GetYVarFromMemo(HistoCode, opt_plot);
06485           
06486           if( XVarHisto != XVariableMemo )
06487             {
06488               cout << "!TEcnaHistos::ViewHisto(...)> *** ERROR *** ===> X coordinate changed in option SAME n." << endl
06489                    << "                              Present  X = " << XVarHisto << endl
06490                    << "                              Present  Y = " << YVarHisto << endl
06491                    << "                              Previous X = " << XVariableMemo << endl
06492                    << "                              Previous Y = " << YVariableMemo 
06493                    << fTTBELL << endl;
06494               SameXVarMemo = 0;
06495             }
06496           else
06497             {SetYVarMemo(HistoCode, opt_plot, YVarHisto);}
06498         }
06499     }
06500   //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
06501 
06502   //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Change of Y variable in option SAME n %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
06503   Int_t SameYVarMemo = 1;   //  a priori ==> SAME n option: Y variable OK                     (ViewHisto)
06504   if( (HistoType == "Proj" || HistoType == "SampProj" || HistoType == "EvolProj") && 
06505       !(arg_AlreadyRead >= 1) )
06506     {
06507       TString XVarHisto = fCnaParHistos->GetXVarHisto(HistoCode.Data(), fFlagSubDet.Data(), fFapStexNumber);
06508       TString YVarHisto = fCnaParHistos->GetYVarHisto(HistoCode.Data(), fFlagSubDet.Data(), fFapStexNumber);
06509       if( (opt_plot == fSameOnePlot ) && GetMemoFlag(HistoCode, opt_plot) == "Free" )
06510         {
06511           SetYVarMemo(HistoCode, opt_plot, YVarHisto);  SetYVarMemo(HistoCode, opt_plot, YVarHisto); SameYVarMemo = 1;
06512         }
06513       if( (opt_plot == fSameOnePlot ) && GetMemoFlag(HistoCode, opt_plot) == "Busy" )
06514         {
06515           TString XVariableMemo = GetXVarFromMemo(HistoCode, opt_plot);
06516           TString YVariableMemo = GetYVarFromMemo(HistoCode, opt_plot);
06517           
06518           if( YVarHisto != YVariableMemo )
06519             {
06520               cout << "!TEcnaHistos::ViewHisto(...)> *** ERROR *** ===> Y coordinate changed in option SAME n." << endl
06521                    << "                              Present  X = " << XVarHisto << endl
06522                    << "                              Present  Y = " << YVarHisto << endl
06523                    << "                              Previous X = " << XVariableMemo << endl
06524                    << "                              Previous Y = " << YVariableMemo 
06525                    << fTTBELL << endl;
06526               SameYVarMemo = 0;
06527             }
06528           else
06529             {SetYVarMemo(HistoCode, opt_plot, YVarHisto);}
06530         }
06531     }
06532   //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
06533 
06534   //%%%%%%%%%%%%%%%%%%%%%%%%%%% Number of bins change in option SAME or SAME n %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
06535   Int_t OkBinsMemoSameOne = 1;   //  a priori ==> SAME n option: Nb bins OK                     (ViewHisto)
06536 
06537   Int_t SizeForPlot = GetHistoSize(HistoCode.Data(), "plot");
06538   Int_t xNbBins = GetHistoNumberOfBins(HistoCode.Data(), SizeForPlot);  
06539 
06540   if( (opt_plot == fSameOnePlot || opt_plot == fSeveralPlot) && GetMemoFlag(HistoCode, opt_plot) == "Free" )
06541     {
06542       SetNbBinsMemo(HistoCode, opt_plot, xNbBins); OkBinsMemoSameOne = 1;
06543     }
06544 
06545   if( (opt_plot == fSameOnePlot || opt_plot == fSeveralPlot) && GetMemoFlag(HistoCode, opt_plot) == "Busy" )
06546     {
06547       Int_t NbBinsMemo = GetNbBinsFromMemo(HistoCode, opt_plot);
06548       if( xNbBins != NbBinsMemo )
06549         {
06550           cout << "!TEcnaHistos::ViewHisto(...)> *** ERROR *** ===> Number of bins changed in option SAME or SAME n."
06551                << " Present number = " << xNbBins << ", requested number = " << NbBinsMemo << fTTBELL << endl;
06552           OkBinsMemoSameOne = 0;
06553         }
06554     }
06555 
06556   //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
06557 
06558   if( xCanvasExists == 1 && SameXVarMemo == 1 && SameYVarMemo == 1 && OkBinsMemoSameOne == 1 ){OKHisto = 1;}
06559 
06560   //======================== Histo accepted                                                       (ViewHisto)
06561   if( OKHisto == 1 )
06562     {
06563       Int_t opt_scale_x = fOptScaleLinx;
06564       if (fFlagScaleX == "LIN" ){opt_scale_x = fOptScaleLinx;}
06565       if (fFlagScaleX == "LOG" ){opt_scale_x = fOptScaleLogx;}
06566 
06567       Int_t opt_scale_y = fOptScaleLiny;
06568       if (fFlagScaleY == "LIN" ){opt_scale_y = fOptScaleLiny;}
06569       if (fFlagScaleY == "LOG" ){opt_scale_y = fOptScaleLogy;}
06570 
06571       fCnaParHistos->SetColorPalette(fFlagColPal);
06572       TString fp_name_short = " ";
06573   
06574       //-------------------- read_histo size
06575       Int_t SizeForRead = GetHistoSize(HistoCode.Data(), "read");
06576 
06577       //............................................... allocation/init_histo
06578       TVectorD histo_for_plot(SizeForPlot);
06579       for(Int_t i=0; i<SizeForPlot; i++){histo_for_plot[i]=(Double_t)0;}
06580 
06581       TVectorD histo_for_plot_memo(SizeForPlot);
06582       for(Int_t i=0; i<SizeForPlot; i++){histo_for_plot_memo[i]=(Double_t)0;}
06583 
06584       Int_t i_data_exist = 0;
06585       Int_t OKPlot = 0;
06586 
06587       //------------------------------------- histos Global, (Global)Proj, SampGlobal and SampProj
06588       if( HistoType == "Global"   || HistoType == "Proj" || HistoType == "SampGlobal" ||
06589           HistoType == "SampProj" )
06590         {     
06591           if( fFapStexNumber == 0 )
06592             {
06593               Bool_t ok_view_histo  = kFALSE;
06594 
06595               //--------------------------------------------------------------------- Stas Histo      (ViewHisto)
06596               Int_t CounterExistingFile = 0;
06597               Int_t CounterDataExist = 0;
06598 
06599               Int_t* xFapNbOfEvts = new Int_t[fEcal->MaxStexInStas()];     fCnew++;
06600               for(Int_t i=0; i<fEcal->MaxStexInStas(); i++){xFapNbOfEvts[i]=0;}
06601 
06602               //Int_t* NOFE_int = new Int_t[fEcal->MaxCrysEcnaInStex()];     fCnew++;
06603 
06604               for(Int_t iStasStex=0; iStasStex<fEcal->MaxStexInStas(); iStasStex++)
06605                 {
06606                   Bool_t OKFileExists   = kFALSE;
06607                   Bool_t ok_data_exists = kFALSE;
06608 
06609                   TVectorD read_histo(fEcal->MaxStinEcnaInStex());
06610                   for(Int_t i=0; i<fEcal->MaxStinEcnaInStex(); i++){read_histo(i)=(Double_t)0.;}
06611 
06612                   if( arg_AlreadyRead == 0 )
06613                     {
06614                       //----------------------------------------------------------------------------- file reading
06615                       fMyRootFile->PrintNoComment();
06616                       Int_t n1StasStex = iStasStex+1;
06617                       fMyRootFile->FileParameters(fFapAnaType,          fFapNbOfSamples,
06618                                                   fFapRunNumber,        fFapFirstReqEvtNumber,
06619                                                   fFapLastReqEvtNumber, fFapReqNbOfEvts,
06620                                                   n1StasStex,           fCfgResultsRootFilePath.Data());
06621                       
06622                       if( fMyRootFile->LookAtRootFile() == kTRUE ){OKFileExists = kTRUE;}            //   (ViewHisto, Stas)
06623                       if( OKFileExists == kTRUE )
06624                         {
06625                           xFapNbOfEvts[iStasStex] = fMyRootFile->GetNumberOfEvents(fFapReqNbOfEvts);
06626                           fp_name_short = fMyRootFile->GetRootFileNameShort();
06627                           // cout << "*TEcnaHistos::ViewHisto(...)> Data are analyzed from file ----> "
06628                           //      << fp_name_short << endl;
06629                           //....................... search for first and last dates
06630                           if( iStasStex == 0 )
06631                             {
06632                               fStartTime = fMyRootFile->GetStartTime();
06633                               fStopTime  = fMyRootFile->GetStopTime();
06634                               fStartDate = fMyRootFile->GetStartDate();
06635                               fStopDate  = fMyRootFile->GetStopDate();
06636                             }
06637 
06638                           time_t xStartTime = fMyRootFile->GetStartTime();
06639                           time_t xStopTime  = fMyRootFile->GetStopTime();
06640                           TString xStartDate = fMyRootFile->GetStartDate();
06641                           TString xStopDate  = fMyRootFile->GetStopDate();
06642 
06643                           if( xStartTime < fStartTime ){fStartTime = xStartTime; fStartDate = xStartDate;}
06644                           if( xStopTime  > fStopTime  ){fStopTime  = xStopTime;  fStopDate  = xStopDate;}
06645 
06646                           fRunType = fMyRootFile->GetRunType();
06647                           ok_view_histo =
06648                             GetOkViewHisto(fMyRootFile, StexStin_A, i0StinEcha, i0Sample, HistoCode.Data());
06649 
06650                           if( ok_view_histo == kTRUE )
06651                             {
06652                               //............................................... histo reading   (ViewHisto, Stas)
06653                               if( HistoCode == "D_NOE_ChNb" || HistoCode == "D_NOE_ChDs" ){
06654                                 read_histo = fMyRootFile->ReadAverageNumberOfEvents(fEcal->MaxStinEcnaInStex());}
06655                               if( HistoCode == "D_Ped_ChNb" || HistoCode == "D_Ped_ChDs" ){
06656                                 read_histo = fMyRootFile->ReadAveragePedestals(fEcal->MaxStinEcnaInStex());}
06657                               if( HistoCode == "D_TNo_ChNb" || HistoCode == "D_TNo_ChDs" ){
06658                                 read_histo = fMyRootFile->ReadAverageTotalNoise(fEcal->MaxStinEcnaInStex());}
06659                               if( HistoCode == "D_MCs_ChNb" || HistoCode == "D_MCs_ChDs" ){
06660                                 read_histo = fMyRootFile->ReadAverageMeanCorrelationsBetweenSamples(fEcal->MaxStinEcnaInStex());}
06661                               if( HistoCode == "D_LFN_ChNb" || HistoCode == "D_LFN_ChDs" ){
06662                                 read_histo = fMyRootFile->ReadAverageLowFrequencyNoise(fEcal->MaxStinEcnaInStex());}
06663                               if( HistoCode == "D_HFN_ChNb" || HistoCode == "D_HFN_ChDs" ){
06664                                 read_histo = fMyRootFile->ReadAverageHighFrequencyNoise(fEcal->MaxStinEcnaInStex());}
06665                               if( HistoCode == "D_SCs_ChNb" || HistoCode == "D_SCs_ChDs" ){
06666                                 read_histo = fMyRootFile->ReadAverageSigmaOfCorrelationsBetweenSamples(fEcal->MaxStinEcnaInStex());}
06667                               if( fMyRootFile->DataExist() == kTRUE ){ok_data_exists = kTRUE;}
06668                             }
06669                         }
06670                     }
06671                   
06672                   if( arg_AlreadyRead >= 1 )
06673                     {
06674                       ok_data_exists = kTRUE;
06675                       for(Int_t i0Stin=0; i0Stin<fEcal->MaxStinEcnaInStex(); i0Stin++ )
06676                         {read_histo(i0Stin) = arg_read_histo(fEcal->MaxStinEcnaInStex()*iStasStex+i0Stin);}
06677                     }
06678 
06679                   if( ok_data_exists == kTRUE )
06680                     {
06681                       fStatusFileFound = kTRUE;
06682                       CounterExistingFile++;
06683 
06684 
06685                       //...........................................................
06686                       if( ok_data_exists == kTRUE )
06687                         {
06688                           fStatusDataExist = kTRUE;
06689                           CounterDataExist++;
06690 
06691                           for(Int_t i0StexStinEcna=0; i0StexStinEcna<fEcal->MaxStinEcnaInStex(); i0StexStinEcna++)
06692                             {
06693                               //Int_t n1StexStinEcna = i0StexStinEcna+1;
06694                               //-------------------------------------- Stas histo filling   (ViewHisto, Stas)
06695                               Int_t i_xgeo = -1;
06696                               //...................................... EB
06697                               if( fFlagSubDet == "EB" )
06698                                 {
06699                                   i_xgeo = iStasStex*fEcal->MaxStinEcnaInStex() + i0StexStinEcna;
06700                                   if( i_xgeo >= 0 && i_xgeo < SizeForPlot )
06701                                     {
06702                                       histo_for_plot[i_xgeo] = read_histo[i0StexStinEcna];
06703                                     }
06704                                   else
06705                                     {
06706                                       cout << "!TEcnaHistos::ViewHisto(...)> <EB> i_xgeo = " << i_xgeo
06707                                            << ". OUT OF RANGE ( range = [0,"<< SizeForPlot << "] " << endl;
06708                                     }  
06709                                 }
06710                               //...................................... EE    (ViewHisto)
06711                               //-------> Dee order: D4, D3, D2, D1                    
06712                               if( fFlagSubDet == "EE" )
06713                                 {
06714                                   Int_t DeeOffset = 0;
06715                                   Int_t DSOffset  = 0;
06716                               
06717                                   Int_t DeeNumber = iStasStex+1;
06718                                   Int_t n1DeeSCEcna = i0StexStinEcna+1;
06719                               
06720                                   //................................................ Dee offset
06721                                   if( DeeNumber == 3 ){DeeOffset +=   fEcal->MaxSCForConsInDee();}     // 149
06722                                   if( DeeNumber == 2 ){DeeOffset += 3*fEcal->MaxSCForConsInDee()-1;}   // 446
06723                                   if( DeeNumber == 1 ){DeeOffset += 4*fEcal->MaxSCForConsInDee()-1;}   // 595
06724                               
06725                                   //................................................ Data Sector offset   (ViewHisto, Stas)
06726                                   Int_t StexDataSector = fEcalNumbering->GetDSFrom1DeeSCEcna(DeeNumber, n1DeeSCEcna);
06727                                   //.... returns 0 if n1DeeSCEcna corresponds to an empty "ECNA-SC"
06728                                   
06729                                   //................................................ SC final coordinate   (ViewHisto, Stas)
06730                                   Int_t StexDSStin = fEcalNumbering->GetDSSCFrom1DeeSCEcna(DeeNumber, n1DeeSCEcna);
06731                                   //--> return StexDSStin = 25 (not  3) for n1DeeSCEcna = 32
06732                                   //--> return StexDSStin = 14 (not 21) for n1DeeSCEcna = 29
06733                                   //--> return StexDSStin = -1 for n1DeeSCEcna = 10 and n1DeeSCEcna = 11 
06734 
06735                                   if( StexDataSector >= 1 && StexDataSector <= 9 )
06736                                     {
06737                                       if( DeeNumber == 4 ) // Sectors 1,2,3,4,5a
06738                                         {
06739                                           for(Int_t is=2; is<=5; is++)
06740                                             { if( StexDataSector >= is )
06741                                                 {Int_t ism = is-1; DSOffset += fEcalNumbering->GetMaxSCInDS(ism);}}
06742                                         }
06743                                   
06744                                       if( DeeNumber == 3 ) // Sectors 5b,6,7,8,9
06745                                         {
06746                                           if( StexDataSector >= 6 )
06747                                             {DSOffset += fEcalNumbering->GetMaxSCInDS(5)/2;}
06748                                           for(Int_t is=7; is<=9; is++)
06749                                             { if( StexDataSector >= is )
06750                                               {Int_t ism = is-1; DSOffset += fEcalNumbering->GetMaxSCInDS(ism);}}
06751                                         }
06752                                   
06753                                       if( DeeNumber == 2 ) // Sectors 9,8,7,6,5a
06754                                         {
06755                                           if( StexDataSector >= 6 )
06756                                             {DSOffset -= fEcalNumbering->GetMaxSCInDS(5)/2;}
06757                                           for(Int_t is=7; is<=9; is++)
06758                                             {if( StexDataSector >= is )
06759                                               {Int_t ism = is-1; DSOffset -= fEcalNumbering->GetMaxSCInDS(ism);}}
06760                                         }
06761                                   
06762                                       if( DeeNumber == 1 ) // Sectors 5b,4,3,2,1
06763                                         {
06764                                           for(Int_t is=2; is<=5; is++)
06765                                             { if( StexDataSector >= is )
06766                                               {Int_t ism = is-1; DSOffset -= fEcalNumbering->GetMaxSCInDS(ism);}}
06767                                         }
06768                                   
06769                                       if( StexDSStin >=1 && StexDSStin <= fEcalNumbering->GetMaxSCInDS(StexDataSector) )
06770                                         {
06771                                           if( DeeNumber == 4 ) // Sectors 1,2,3,4,5a
06772                                             {
06773                                               if(StexDataSector != 5)
06774                                                 {i_xgeo = DeeOffset + DSOffset + (StexDSStin - 1);}
06775                                               if( StexDataSector == 5)
06776                                                 {i_xgeo = DeeOffset + DSOffset + (StexDSStin - 1);}
06777                                             }
06778                                           if( DeeNumber == 3 ) // Sectors 5b,6,7,8,9
06779                                             {
06780                                               if(StexDataSector != 5)
06781                                                 {i_xgeo = DeeOffset + DSOffset + (StexDSStin - 1);}
06782                                               if( StexDataSector == 5)
06783                                                 {i_xgeo = DeeOffset + DSOffset + (StexDSStin-17) - 1;}
06784                                             }
06785                                           if( DeeNumber == 2 ) // Sectors 5a,6,7,8,9
06786                                             {
06787                                               if(StexDataSector != 5)
06788                                                 {i_xgeo = DeeOffset + DSOffset
06789                                                    - fEcalNumbering->GetMaxSCInDS(StexDataSector) + StexDSStin;}
06790                                               if( StexDataSector == 5)
06791                                                 {i_xgeo = DeeOffset + DSOffset
06792                                                    - fEcalNumbering->GetMaxSCInDS(StexDataSector)/2 + StexDSStin;}
06793                                             }
06794                                           if( DeeNumber == 1 ) // Sectors 1,2,3,4,5b
06795                                             {
06796                                               if(StexDataSector != 5)
06797                                                 {i_xgeo = DeeOffset + DSOffset
06798                                                    - fEcalNumbering->GetMaxSCInDS(StexDataSector) + StexDSStin;}
06799                                               if( StexDataSector == 5)
06800                                                 {i_xgeo = DeeOffset + DSOffset
06801                                                    - fEcalNumbering->GetMaxSCInDS(StexDataSector)/2 +(StexDSStin-17);}
06802                                             }
06803                                           
06804                                         }// end of if(StexDSStin >=1 && StexDSStin <= fEcalNumbering->GetMaxSCInDS(StexDataSector))
06805                                       else
06806                                         {
06807                                           cout << "!TEcnaHistos::ViewHisto(...)> <EE>  StexDSStin = " << StexDSStin
06808                                                << ". OUT OF RANGE ( range = [1,"
06809                                                << fEcalNumbering->GetMaxSCInDS(StexDataSector)
06810                                                << "]. DeeNumber =  " << DeeNumber
06811                                                << ", n1DeeSCEcna = " << n1DeeSCEcna
06812                                                << ", StexDataSector = "  << StexDataSector 
06813                                                << ", i_xgeo = "  << i_xgeo << endl;
06814                                         }
06815                                     }// end of if( StexDataSector >= 1 && StexDataSector <= 9 )
06816                                   else
06817                                     {
06818                                       //cout << "!TEcnaHistos::ViewHisto(...)> <EE>  StexDataSector = " << StexDataSector
06819                                       //     << ". OUT OF RANGE ( range = [1,9]. DeeNumber = " << DeeNumber
06820                                       //     << ", n1DeeSCEcna = " << n1DeeSCEcna
06821                                       //     << ", i_xgeo = "  << i_xgeo << endl;
06822                                     }
06823                                   //......................................... transfert read_histo -> histo_for_plot
06824                                   if( i_xgeo >= -1 && i_xgeo < SizeForPlot )
06825                                     {
06826                                       // special treatement for not connected & mixed SC's
06827                                       if( n1DeeSCEcna ==  29 || n1DeeSCEcna ==  32 ||   //  261a, 207c, 268a, 178c 
06828                                                                                         // [ 14a,  25c,  21a,   3c]
06829                                           n1DeeSCEcna == 144 || n1DeeSCEcna == 165 ||   //  261c, 261b [14c, 14b]
06830                                           n1DeeSCEcna == 176 || n1DeeSCEcna == 193 ||   //  207a, 207b [25a, 25b]
06831                                           n1DeeSCEcna ==  60 || n1DeeSCEcna == 119 ||   //  182a, 182b [30a, 30b]
06832                                           n1DeeSCEcna == 102 || n1DeeSCEcna == 123 ||   //  268c, 268b [21c, 21b]
06833                                           n1DeeSCEcna == 138 || n1DeeSCEcna == 157 )    //  178a, 178b [ 3a,  3b] 
06834                                         {
06835                                           //--------------- DSSC 14
06836                                           if( n1DeeSCEcna ==  29 && i_xgeo >= 0 )
06837                                             {histo_for_plot[i_xgeo] += read_histo[i0StexStinEcna]/(Double_t)5.;}
06838                                           if( (n1DeeSCEcna ==  144 || n1DeeSCEcna == 165) && i_xgeo >= 0 )
06839                                             {histo_for_plot[i_xgeo] +=
06840                                                read_histo[i0StexStinEcna]*(Double_t)10./(Double_t)25.;}
06841                                           
06842                                           //--------------- DSSC 25
06843                                           if( n1DeeSCEcna ==  32 && i_xgeo >= 0 )
06844                                             {histo_for_plot[i_xgeo] += read_histo[i0StexStinEcna]/(Double_t)5.;}
06845                                           if( (n1DeeSCEcna ==  176 || n1DeeSCEcna == 193) && i_xgeo >= 0 )
06846                                             {histo_for_plot[i_xgeo] +=
06847                                                read_histo[i0StexStinEcna]*(Double_t)10./(Double_t)25.;}
06848                                           
06849                                           //--------------- DSSC 30 
06850                                           if( (n1DeeSCEcna == 60 || n1DeeSCEcna == 119) && i_xgeo >= 0 )
06851                                             {histo_for_plot[i_xgeo] += read_histo[i0StexStinEcna]/(Double_t)2.;}
06852                                           
06853                                           //--------------- DSSC 21 (Add SC translated at 10-1 only once, i_xgeo = -1 accepted)
06854                                           if( n1DeeSCEcna == 102 )
06855                                             {histo_for_plot[i_xgeo] += read_histo[9]/(Double_t)21.
06856                                                + read_histo[i0StexStinEcna]*(Double_t)10./(Double_t)21.;}
06857                                           if( n1DeeSCEcna == 123 && i_xgeo >= 0 )
06858                                             {histo_for_plot[i_xgeo] +=
06859                                                read_histo[i0StexStinEcna]*(Double_t)10./(Double_t)21.;}
06860                                           
06861                                           //--------------- DSSC 3 (Add SC translated at 11-1 only once, i_xgeo = -1 accepted)
06862                                           if( n1DeeSCEcna == 138 )
06863                                             {histo_for_plot[i_xgeo] += read_histo[10]/(Double_t)21.
06864                                                + read_histo[i0StexStinEcna]*(Double_t)10./(Double_t)21.;}
06865                                           if( n1DeeSCEcna == 157 && i_xgeo >= 0 )
06866                                             {histo_for_plot[i_xgeo] +=
06867                                                read_histo[i0StexStinEcna]*(Double_t)10./(Double_t)21.;}
06868                                         }
06869                                       else
06870                                         {
06871                                           if( i_xgeo >= 0 )
06872                                             {histo_for_plot[i_xgeo] += read_histo[i0StexStinEcna];} // standard treatment
06873                                         }
06874                                     } // end of if( i_xgeo >= -1 && i_xgeo < SizeForPlot )
06875                                   else
06876                                     {
06877                                       //cout << "!TEcnaHistos::ViewHisto(...)> <EE>  i_xgeo = " << i_xgeo
06878                                       //     << ". OUT OF RANGE ( range = [0,"<< SizeForPlot << "] " << endl;
06879                                     }
06880                                 }// end of if( fFlagSubDet == "EE" )
06881                             }// end of for(Int_t i0StexStinEcna=0; i0StexStinEcna<fEcal->MaxStinEcnaInStex(); i0StexStinEcna++)
06882                         }
06883                       else
06884                         {
06885                           cout << "!TEcnaHistos::ViewHisto(...)>  "
06886                                << " Data not available for " << fFapStexName << " " << iStasStex+1
06887                                << " (Quantity not present in the ROOT file)" << endl;
06888                         }
06889                     } // end of if ( fMyRootFile->LookAtRootFile() == kTRUE )   (ViewHisto/Stas)
06890                   else
06891                     {
06892                       fStatusFileFound = kFALSE;
06893 
06894                       cout << "!TEcnaHistos::ViewHisto(...)>  "
06895                            << " Data not available for " << fFapStexName << " " << iStasStex+1
06896                            << " (ROOT file not found)" << endl;
06897                     }
06898 
06899                   if( fFapNbOfEvts <= xFapNbOfEvts[iStasStex] ){fFapNbOfEvts = xFapNbOfEvts[iStasStex];}
06900 
06901                 } // end of for(Int_t iStasStex=0; iStasStex<fEcal->MaxStexInStas(); iStasStex++)
06902 
06903               //delete [] NOFE_int; NOFE_int = 0;               fCdelete++;
06904               delete [] xFapNbOfEvts; xFapNbOfEvts = 0;       fCdelete++;
06905             
06906               if( CounterExistingFile > 0 && CounterDataExist > 0 ){OKPlot = 1;} 
06907           
06908             } // end of if( fFapStexNumber == 0 )
06909         
06910           //---------------------------------------------------------------------------- (ViewHisto [Stex])
06911 
06912           if( fFapStexNumber > 0 )
06913             {
06914               Bool_t OKFileExists  = kFALSE ;
06915               Bool_t ok_view_histo = kFALSE;
06916 
06917               if( arg_AlreadyRead == 0 )
06918                 {
06919                   fMyRootFile->PrintNoComment();
06920                   fMyRootFile->FileParameters(fFapAnaType,          fFapNbOfSamples,
06921                                               fFapRunNumber,        fFapFirstReqEvtNumber,
06922                                               fFapLastReqEvtNumber, fFapReqNbOfEvts,
06923                                               fFapStexNumber,       fCfgResultsRootFilePath.Data());
06924                   
06925                   if ( fMyRootFile->LookAtRootFile() == kTRUE ){OKFileExists = kTRUE;}       //   (ViewHisto, Stex)            
06926                   
06927                   if( OKFileExists == kTRUE )
06928                     {
06929                       fFapNbOfEvts = fMyRootFile->GetNumberOfEvents(fFapReqNbOfEvts);
06930                       fp_name_short = fMyRootFile->GetRootFileNameShort();
06931                       // cout << "*TEcnaHistos::ViewHisto(...)> Data are analyzed from file ----> "
06932                       //      << fp_name_short << endl;
06933                       
06934                       fStartDate = fMyRootFile->GetStartDate();
06935                       fStopDate  = fMyRootFile->GetStopDate();
06936                       fRunType   = fMyRootFile->GetRunType();
06937 
06938                       ok_view_histo =
06939                         GetOkViewHisto(fMyRootFile, StexStin_A, i0StinEcha, i0Sample, HistoCode.Data());
06940                     }
06941                 }
06942               
06943               if( arg_AlreadyRead >= 1 )
06944                 {
06945                   OKFileExists = kTRUE; ok_view_histo = kTRUE;
06946                 }
06947               
06948               if( OKFileExists == kTRUE ) 
06949                 {
06950                   fStatusFileFound = kTRUE;
06951                   //---------------------------------------------------------------------------- (ViewHisto [Stex])
06952               
06953                   if( ok_view_histo == kTRUE )
06954                     {
06955                       //------------ EB or EE with SampGlobal or SampProj (histo_for_plot = read_histo)
06956                       if( fFlagSubDet == "EB" || 
06957                           ( fFlagSubDet == "EE" && ( HistoType == "SampGlobal" || HistoType == "SampProj" )  )  )
06958                         {
06959                           histo_for_plot = GetHistoValues(arg_read_histo, arg_AlreadyRead, fMyRootFile, HistoCode.Data(),
06960                                                           SizeForPlot, SizeForRead,
06961                                                           StexStin_A,  i0StinEcha, i0Sample, i_data_exist);
06962                           if( i_data_exist > 0 ){OKPlot = 1;}
06963                           if( OKPlot == 1 && opt_plot == "ASCII" && ( HistoType == "Global" || HistoType == "Proj" ) )
06964                             {WriteHistoAscii(HistoCode.Data(), SizeForPlot, histo_for_plot);}
06965                         }
06966                   
06967                       //------------ EE  except for SampGlobal and SampProj) (histo_for_plot # read_histo)
06968                       if( fFlagSubDet == "EE" && !( HistoType == "SampGlobal" || HistoType == "SampProj" ) )
06969                         {
06970                           TVectorD read_histo(SizeForRead);
06971                           for(Int_t i=0; i<SizeForRead; i++){read_histo(i)=(Double_t)0.;}
06972 
06973                           read_histo = GetHistoValues(arg_read_histo, arg_AlreadyRead, fMyRootFile, HistoCode.Data(),
06974                                                       SizeForRead, SizeForRead,
06975                                                       StexStin_A, i0StinEcha, i0Sample, i_data_exist);
06976                           if( i_data_exist > 0 ){OKPlot = 1;}
06977                           if( OKPlot == 1 && opt_plot == "ASCII" )
06978                             {
06979                               WriteHistoAscii(HistoCode.Data(), fEcal->MaxCrysEcnaInDee(), read_histo);
06980                             }
06981                           if( OKPlot == 1 && opt_plot != "ASCII" )
06982                             {
06983                               //..................... Build histo_for_plot from read_histo (ViewHisto [Stex])
06984                               Int_t DeeNumber = fFapStexNumber;
06985                               TString DeeDir  = fEcalNumbering->GetDeeDirViewedFromIP(DeeNumber);
06986                           
06987                               //%%%%%%%%%%%%%%%%%%%%%%%%%%%% LOOP ON Echa (Ecna) %%%%%%%%%%%%%%%%%%%%%%%%%% (ViewHisto [Stex])
06988                               for(Int_t i0DeeEcha=0; i0DeeEcha<fEcal->MaxCrysEcnaInDee(); i0DeeEcha++)
06989                                 {
06990                                   Int_t n1SCEcha    = fEcalNumbering->Get1SCEchaFrom0DeeEcha(i0DeeEcha);
06991                                   Int_t n1DeeSCEcna = i0DeeEcha/fEcal->MaxCrysInSC()+1;
06992                               
06993                                   Int_t DataSector = fEcalNumbering->GetDSFrom1DeeSCEcna(DeeNumber, n1DeeSCEcna);
06994                                   Int_t SC_in_DS   = fEcalNumbering->GetDSSCFrom1DeeSCEcna(DeeNumber, n1DeeSCEcna, n1SCEcha);
06995                               
06996                                   Int_t i_xgeo = -1;                  
06997                               
06998                                   if( n1SCEcha >= 1 && n1SCEcha <= fEcal->MaxCrysInSC() )
06999                                     {
07000                                       if( n1DeeSCEcna >= 1 && n1DeeSCEcna <= fEcal->MaxSCEcnaInDee() )
07001                                         {
07002                                           if( DataSector >= 1 && DataSector <= 9 )
07003                                             {
07004                                               if( SC_in_DS >= 1 && SC_in_DS <= fEcalNumbering->GetMaxSCInDS(DataSector) )
07005                                                 {
07006                                                   if( read_histo[i0DeeEcha] != 0 )
07007                                                     {
07008                                                       //................................... Data Sector offset
07009                                                       Int_t DSOffset = GetDSOffset(DeeNumber, DataSector);
07010                                               
07011                                                       //........................ Super-Crystal (SC) offset (ViewHisto [Stex])
07012                                                       Int_t SCOffset = GetSCOffset(DeeNumber, DataSector, SC_in_DS);
07013                                               
07014                                                       //........................ Xtal final bin
07015                                                       Int_t nSCCons = fEcalNumbering->
07016                                                         GetDeeSCConsFrom1DeeSCEcna(DeeNumber, n1DeeSCEcna, n1SCEcha);
07017 
07018                                                       Int_t n1FinalSCEcha = n1SCEcha;
07019                                                       
07020                                                       if( fEcalNumbering->GetSCType(nSCCons) == "NotConnected" || 
07021                                                           fEcalNumbering->GetSCType(nSCCons) == "NotComplete"  )
07022                                                         { //----- not complete and not connected SC's
07023                                                           // no i_xgeo value if SC = 14 or 25 and channel 11
07024                                                           if( !( (SC_in_DS == 14 || SC_in_DS == 25 ) && n1SCEcha == 11 )  )
07025                                                             {
07026                                                               n1FinalSCEcha =
07027                                                                 ModifiedSCEchaForNotConnectedSCs(DeeNumber, nSCCons, SC_in_DS,
07028                                                                                                  n1DeeSCEcna, n1SCEcha);
07029                                                               i_xgeo = DSOffset + SCOffset + (n1FinalSCEcha-1);
07030                                                             }
07031                                                           // change SC 14 -> 21 and channel 11 -> 21
07032                                                           if( SC_in_DS ==  14 && n1SCEcha == 11 )
07033                                                             {
07034                                                               SCOffset = GetSCOffset(DeeNumber, DataSector, 21);
07035                                                               n1FinalSCEcha = 21;
07036                                                               i_xgeo = DSOffset + SCOffset + (n1FinalSCEcha-1);
07037                                                             }
07038                                                           // change SC 25 -> 3 for channel 11 -> 21
07039                                                           if( SC_in_DS ==  25 && n1SCEcha == 11 )
07040                                                             {
07041                                                               SCOffset = GetSCOffset(DeeNumber, DataSector, 3);
07042                                                               n1FinalSCEcha = 21;
07043                                                               i_xgeo = DSOffset + SCOffset + (n1FinalSCEcha-1);
07044                                                             }
07045                                                         }
07046                                                       else
07047                                                         { //----------- Complete SCs
07048                                                           i_xgeo = DSOffset + SCOffset + (n1FinalSCEcha-1);
07049                                                         }
07050 
07051                                                       histo_for_plot_memo[i_xgeo]++;
07052                                                       if( histo_for_plot_memo[i_xgeo] >= 2 )
07053                                                         {
07054                                                           cout << "! histo_memo[" << i_xgeo
07055                                                                << "] = " << histo_for_plot_memo[i_xgeo]
07056                                                                << ", nSCCons = " <<  nSCCons
07057                                                                << ", SC_in_DS = " << SC_in_DS
07058                                                                << ", DSOffset = " << DSOffset
07059                                                                << ", SCOffset = " << SCOffset
07060                                                                << ", n1DeeSCEcna = " << n1DeeSCEcna
07061                                                                << ", n1SCEcha = " << n1SCEcha
07062                                                                << ", n1FinalSCEcha = " << n1FinalSCEcha << endl;
07063                                                         }
07064                                                       //.............................. transfert read_histo -> histo_for_plot
07065                                                       if( i_xgeo >= 0 && i_xgeo < SizeForPlot )
07066                                                         {
07067                                                           if( n1FinalSCEcha > 0 )
07068                                                             {histo_for_plot[i_xgeo] += read_histo[i0DeeEcha];}
07069                                                         }
07070                                                       else
07071                                                         {
07072                                                           cout << "!TEcnaHistos::ViewHisto(...)> <EE>  i_xgeo = " << i_xgeo
07073                                                                << ". OUT OF RANGE ( range = [0,"<< SizeForPlot << "] " << endl;
07074                                                         }
07075                                                     } // end of  if( read_histo[i0DeeEcha] > 0 )
07076                                                 } // end of if( SC_in_DS >= 1 && SC_in_DS <= fEcalNumbering->GetMaxSCInDS(DataSector) )
07077                                               else
07078                                                 {
07079                                                   cout << "!TEcnaHistos::ViewHisto(...)> <EE>  SC_in_DS = " << SC_in_DS
07080                                                        << ". OUT OF RANGE ( range = [1,"
07081                                                        << fEcalNumbering->GetMaxSCInDS(DataSector) << "] "
07082                                                        << ", DataSector = " << DataSector
07083                                                        << ", n1DeeSCEcna = " << n1DeeSCEcna
07084                                                        << ", n1SCEcha = " << n1SCEcha
07085                                                        << ", i0DeeEcha = " << i0DeeEcha
07086                                                        << endl;
07087                                                 }
07088                                             } // end of if( DataSector >= 1 && DataSector <= 9 )
07089                                           else
07090                                             {
07091                                               if( DataSector != 0 )
07092                                                 {
07093                                                   cout << "!TEcnaHistos::ViewHisto(...)> <EE>  DataSector = " << DataSector
07094                                                        << ". OUT OF RANGE ( range = [1,9] "
07095                                                        << ", n1DeeSCEcna = " << n1DeeSCEcna
07096                                                        << ", n1SCEcha = " << n1SCEcha
07097                                                        << ", i0DeeEcha = " << i0DeeEcha
07098                                                        << endl;
07099                                                 }
07100                                             }
07101                                         } // end of if( n1DeeSCEcna >= 1 && n1DeeSCEcna <= fEcal->MaxSCEcnaInDee() )
07102                                       else
07103                                         {
07104                                           cout << "!TEcnaHistos::ViewHisto(...)> <EE>  n1DeeSCEcna = " << n1DeeSCEcna
07105                                                << ". OUT OF RANGE ( range = [1,"<< fEcal->MaxSCEcnaInDee() << "] "
07106                                                << ", n1SCEcha = " << n1SCEcha
07107                                                << ", i0DeeEcha = " << i0DeeEcha
07108                                                << endl;
07109                                         }
07110                                     } // end of if(n1SCEcha >= 1 && n1SCEcha <= fEcal->MaxCrysInSC() )
07111                                   else
07112                                     {
07113                                       cout << "!TEcnaHistos::ViewHisto(...)> <EE>  n1SCEcha = " << n1SCEcha
07114                                            << ". OUT OF RANGE ( range = [1,"<< fEcal->MaxCrysInSC() << "] "
07115                                            << ", i0DeeEcha = " << i0DeeEcha
07116                                            << endl;
07117                                     }
07118                                 }
07119                             } // end of if( OKPlot == 1 && opt_plot != "ASCII" )
07120                         } // end of if(fFlagSubDet == "EE")
07121                     } // end of if(ok_view_histo == kTRUE)
07122                   else
07123                     {
07124                       cout << "!TEcnaHistos::ViewHisto(...)> *ERROR* =====> "
07125                            << " ok_view_histo != kTRUE " << fTTBELL << endl;
07126                     }
07127                 } // end of if(fMyRootFile->LookAtRootFile() == kTRUE)
07128               else
07129                 {
07130                   fStatusFileFound = kFALSE;
07131 
07132                   cout << "!TEcnaHistos::ViewHisto(...)> *ERROR* =====> "
07133                        << " ROOT file not found" << fTTBELL << endl;
07134                 }
07135             } // end of if(fFapStexNumber > 0)
07136         } // end of if( HistoType == "Global" || HistoType == "Proj" || HistoType == "SampGlobal" || HistoType == "SampProj" )
07137       else        
07138         {
07139           //--------------------------------------------------------------------- not Global-Proj Histo
07140           if( (fFapStexNumber > 0) && (fFapStexNumber <= fEcal->MaxStexInStas()) )
07141             {
07142               Bool_t OKFileExists = kFALSE;
07143 
07144               if( !(arg_AlreadyRead > 1) )
07145                 {
07146                   fMyRootFile->PrintNoComment();
07147                   fMyRootFile->FileParameters(fFapAnaType,          fFapNbOfSamples,
07148                                               fFapRunNumber,        fFapFirstReqEvtNumber,
07149                                               fFapLastReqEvtNumber, fFapReqNbOfEvts,
07150                                               fFapStexNumber,       fCfgResultsRootFilePath.Data());
07151                   OKFileExists = fMyRootFile->LookAtRootFile();
07152                   if( OKFileExists == kTRUE ){fFapNbOfEvts = fMyRootFile->GetNumberOfEvents(fFapReqNbOfEvts);}
07153                 }
07154               else
07155                 {
07156                   OKFileExists = kTRUE;
07157                 }
07158               
07159               if( OKFileExists == kTRUE )    //   (ViewHisto, not Global-Proj)
07160                 {
07161                   fStatusFileFound = kTRUE;
07162 
07163                   for(Int_t i=0; i<SizeForPlot; i++){histo_for_plot[i]=(Double_t)0;}
07164 
07165                   histo_for_plot = GetHistoValues(arg_read_histo, arg_AlreadyRead, fMyRootFile, HistoCode.Data(),
07166                                                   SizeForPlot, SizeForRead,
07167                                                   StexStin_A, i0StinEcha, i0Sample, i_data_exist);
07168 
07169                   fFapNbOfEvts = fMyRootFile->GetNumberOfEvents(fFapReqNbOfEvts);
07170                   fStartDate = fMyRootFile->GetStartDate();
07171                   fStopDate  = fMyRootFile->GetStopDate();
07172                   fRunType   = fMyRootFile->GetRunType();
07173                   
07174                   if( i_data_exist > 0 ){OKPlot = 1;}
07175                 }
07176               else
07177                 {
07178                   cout << "!TEcnaHistos::ViewHisto(...)> *ERROR* =====> "
07179                        << " ROOT file not found" << fTTBELL << endl;
07180                 }
07181             }
07182           else
07183             {
07184               cout << "!TEcnaHistos::ViewHisto(...)> " << fFapStexName.Data()
07185                    << " = " << fFapStexNumber << ". Out of range (range = [1,"
07186                    << fEcal->MaxStexInStas() << "]) " << fTTBELL << endl;
07187             }
07188         }
07189 
07190       //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PLOT accepted 
07191 
07192       if( (    HistoType == "Global"     || HistoType == "Proj" ||
07193                HistoType == "SampGlobal" || HistoType == "SampProj" || 
07194                HistoType == "H1Basic"    || HistoType == "H1BasicProj" ) ||
07195           ( !( HistoType == "Global"     || HistoType == "Proj" ||
07196                HistoType == "SampGlobal" || HistoType == "SampProj" || 
07197                HistoType == "H1Basic"    || HistoType == "H1BasicProj" ) &&
07198             ( (fFapStexNumber > 0) && (fFapStexNumber <= fEcal->MaxStexInStas()) ) ) )
07199         {
07200           if( opt_plot != "ASCII" )
07201             {
07202               if( OKPlot > 0 )
07203                 {
07204                   //... Ymin and ymax default values will be taken if fFlagUserHistoMin/Max = "OFF"
07205                   //    and if "Free" for "SAME" and "SAME n" options
07206                   if( (opt_plot == fOnlyOnePlot && ( arg_AlreadyRead == 0 || arg_AlreadyRead == 1 ) ) ||
07207                       (opt_plot == fSeveralPlot && GetMemoFlag(HistoCode, opt_plot) == "Free") ||
07208                       (opt_plot == fSameOnePlot && GetMemoFlag(HistoCode, opt_plot) == "Free") )
07209                     {
07210                       SetYminMemoFromValue(HistoCode.Data(), fCnaParHistos->GetYminDefaultValue(HistoCode.Data()));
07211                       SetYmaxMemoFromValue(HistoCode.Data(), fCnaParHistos->GetYmaxDefaultValue(HistoCode.Data()));
07212                     }
07213                   
07214                   //====  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)
07215                   //
07216                   //  must be done before booking because of the x <-> y permutation in case of "Proj"
07217                   //
07218                   //-----------------------------------------------------------------------------------------
07219                   //
07220                   //        CASE:    HistoType == "Proj"   OR   HistoType == "SampProj"
07221                   //
07222                   //                 Xinf and Xsup must be calculated from ymin and ymax
07223                   //                 of the direct ("Global") histo
07224                   //
07225                   //-----------------------------------------------------------------------------------------
07226                   if( HistoType == "Proj" || HistoType == "SampProj" || HistoType == "H1BasicProj" )
07227                     {
07228                       TString HistoCodi = HistoCode;     // HistoCodi = direct histo
07229 
07230                       if( HistoCode == "D_NOE_ChDs" ){HistoCodi = "D_NOE_ChNb";}
07231                       if( HistoCode == "D_Ped_ChDs" ){HistoCodi = "D_Ped_ChNb";}
07232                       if( HistoCode == "D_TNo_ChDs" ){HistoCodi = "D_TNo_ChNb";}
07233                       if( HistoCode == "D_MCs_ChDs" ){HistoCodi = "D_MCs_ChNb";}
07234                       if( HistoCode == "D_LFN_ChDs" ){HistoCodi = "D_LFN_ChNb";}
07235                       if( HistoCode == "D_HFN_ChDs" ){HistoCodi = "D_HFN_ChNb";}
07236                       if( HistoCode == "D_SCs_ChDs" ){HistoCodi = "D_SCs_ChNb";}
07237                       if( HistoCode == "D_MSp_SpDs" ){HistoCodi = "D_MSp_SpNb";}
07238                       if( HistoCode == "D_SSp_SpDs" ){HistoCodi = "D_SSp_SpNb";}
07239                       if( HistoCode == "D_Adc_EvDs" ){HistoCodi = "D_Adc_EvNb";}                      
07240 
07241                       TString TitleHisto = ";";
07242                       if( opt_plot != fSameOnePlot )
07243                         {TitleHisto = fCnaParHistos->GetQuantityName(HistoCodi);}                     
07244 
07245                       if( fUserHistoMin >= fUserHistoMax ){fFlagUserHistoMin = "AUTO"; fFlagUserHistoMax = "AUTO";}
07246 
07247                       //--------------------------------------------------------------------------- (ViewHisto)
07248                       //
07249                       //    fOnlyOnePlot => compute Xinf and Xsup at each time
07250                       //    fSeveralPlot => compute Xinf and Xsup once when flag = "Free" for each HistoCode
07251                       //    fSameOnePlot => compute Xinf and Xsup once
07252                       //
07253                       //--------------------------------------------------------------------------------------
07254                       if( (opt_plot == fOnlyOnePlot && ( arg_AlreadyRead == 0 || arg_AlreadyRead == 1 ) ) ||
07255                           (opt_plot == fSeveralPlot && GetMemoFlag(HistoCode, fSeveralPlot) == "Free" ) ||
07256                           (opt_plot == fSameOnePlot && GetMemoFlag(HistoCode, fSameOnePlot) == "Free" ) )
07257                         {
07258                           Double_t XinfProj =(Double_t)0;
07259                           Double_t XsupProj =(Double_t)0;
07260 
07261                           //...................................................................... (ViewHisto)
07262                           if( fFlagUserHistoMin == "AUTO" || fFlagUserHistoMax == "AUTO" )
07263                             {
07264                               Int_t HisSiza = GetHistoSize(HistoCodi.Data(), "plot");
07265                               Int_t ReadHisSiza = HisSiza;
07266                               //..............................  prepa direct histogram booking (ViewHisto)
07267                               Axis_t xinf_hisa = GetHistoXinf(HistoCodi.Data(), HisSiza, opt_plot);
07268                               Axis_t xsup_hisa = GetHistoXsup(HistoCodi.Data(), HisSiza, opt_plot);
07269                               Int_t nb_binxa   = GetHistoNumberOfBins(HistoCodi.Data(), HisSiza);
07270                               //..............................  direct ("Global") histogram booking (ViewHisto)
07271                               TH1D* h_hisa =
07272                                 new TH1D("histoa", TitleHisto.Data(), nb_binxa, xinf_hisa, xsup_hisa); fCnewRoot++;
07273                               h_hisa->Reset();
07274                               //.... direct histogram filling to get its ymin (=> xminProj) and ymax (=> xmaxProj)
07275                               FillHisto(h_hisa, histo_for_plot, HistoCodi.Data(), ReadHisSiza);
07276                               //... Get direct histo ymin and/or ymax and keep them as xinf and xsup
07277                               //    in memo for the plotted histo 
07278                               XinfProj = fUserHistoMin;
07279                               XsupProj = fUserHistoMax;
07280                               if( fFlagUserHistoMin == "AUTO" ){XinfProj = h_hisa->GetMinimum();}
07281                               if( fFlagUserHistoMax == "AUTO" ){XsupProj = h_hisa->GetMaximum();}
07282                               XsupProj += (XsupProj-XinfProj)*fCnaParHistos->GetMarginAutoMinMax(); // to see the last bin
07283                               h_hisa->Delete();  h_hisa = 0;     fCdeleteRoot++;
07284                             } // end of  if( fFlagUserHistoMin == "AUTO" || fFlagUserHistoMax == "AUTO" )
07285                           else
07286                             {
07287                               if( fFlagUserHistoMin == "OFF" )
07288                                 {
07289                                   SetYminMemoFromValue(HistoCode.Data(),
07290                                                        fCnaParHistos->GetYminDefaultValue(HistoCode.Data()));
07291                                   XinfProj = GetYminValueFromMemo(HistoCode.Data());
07292                                 }
07293 
07294                               if( fFlagUserHistoMax == "OFF" )
07295                                 {
07296                                   SetYmaxMemoFromValue(HistoCode.Data(),
07297                                                        fCnaParHistos->GetYmaxDefaultValue(HistoCode.Data()));
07298                                   XsupProj = GetYmaxValueFromMemo(HistoCode.Data());      
07299                                 }
07300                               if( fFlagUserHistoMin == "ON" ){XinfProj = fUserHistoMin;}
07301                               if( fFlagUserHistoMax == "ON" ){XsupProj = fUserHistoMax;}
07302                             }
07303 
07304                           if( opt_plot == fOnlyOnePlot || opt_plot == fSeveralPlot )
07305                             {
07306                               SetXinfMemoFromValue(HistoCode.Data(), XinfProj);
07307                               SetXsupMemoFromValue(HistoCode.Data(), XsupProj);                   
07308                             }
07309                           else
07310                             {
07311                               SetXinfMemoFromValue(XinfProj);
07312                               SetXsupMemoFromValue(XsupProj);
07313                             }
07314                         } // end of if( (opt_plot == fOnlyOnePlot) || 
07315                           // (opt_plot == fSeveralPlot  && GetMemoFlag(HistoCode, opt_plot) == "Free") ||
07316                           // (opt_plot == fSameOnePlot  && GetMemoFlag(HistoCode, opt_plot) == "Free") )
07317                     } // end of  if( HistoType == "Proj" || HistoType == "SampProj" || HistoType == "H1BasicProj" )
07318 
07319                   //===============  H I S T O   B O O K I N G   A N D   F I L L I N G  ========  (ViewHisto)
07320                   //..............................  prepa histogram booking (ViewHisto)
07321                   
07322                   //.......... Set number of bins: forcing to fNbBinsProj if "HistoType" == "Proj"
07323                   Int_t xNbBins = GetHistoNumberOfBins(HistoCode.Data(), SizeForPlot);
07324                   
07325                   Double_t cXinf = (Double_t)0.;
07326                   Double_t cXsup = (Double_t)0.;
07327 
07328                   //.......... Set Xinf and Xsup at each time because of simultaneous SAME options
07329                   if( HistoType == "Proj" || HistoType == "SampProj" || HistoType == "H1BasicProj")
07330                     {
07331                       if( opt_plot == fOnlyOnePlot || opt_plot == fSeveralPlot )
07332                         {
07333                           cXinf = GetXinfValueFromMemo(HistoCode.Data());
07334                           cXsup = GetXsupValueFromMemo(HistoCode.Data());
07335                         }
07336                       else
07337                         {
07338                           cXinf = GetXinfValueFromMemo();
07339                           cXsup = GetXsupValueFromMemo();
07340                         }
07341                     }
07342                   else
07343                     {
07344                       cXinf = GetHistoXinf(HistoCode.Data(), SizeForPlot, opt_plot);
07345                       cXsup = GetHistoXsup(HistoCode.Data(), SizeForPlot, opt_plot);
07346                     }
07347 
07348                   //..............................  histogram booking (ViewHisto)
07349                   Axis_t xinf_his = cXinf;  // ancillary variables since no const in arguments of TH1D
07350                   Axis_t xsup_his = cXsup;
07351                   Int_t   nb_binx = xNbBins;
07352 
07353                   TString TitleHisto = ";";
07354                   if( opt_plot != fSameOnePlot )
07355                     {TitleHisto = fCnaParHistos->GetQuantityName(HistoCode.Data());}
07356                   TH1D* h_his0 = new TH1D("histo", TitleHisto.Data(), nb_binx, xinf_his, xsup_his); fCnewRoot++;
07357                   h_his0->Reset();
07358                   //............................... histogram filling
07359                   FillHisto(h_his0, histo_for_plot, HistoCode.Data(), SizeForPlot);
07360                   
07361                   //===============  H I S T O   Y M I N / Y M A X   M A N A G E M E N T  ===========  (ViewHisto)
07362                   if( opt_plot == fOnlyOnePlot ||
07363                       (opt_plot == fSeveralPlot && GetMemoFlag(HistoCode, opt_plot) == "Free") || 
07364                       (opt_plot == fSameOnePlot && GetMemoFlag(HistoCode, opt_plot) == "Free") )
07365                     {
07366                       if( opt_plot == fSameOnePlot ){fHistoCodeFirst = HistoCode;} // registration of first HistoCode
07367                       //................................. Automatic min and/or max for other options than "Proj" 
07368                       if( HistoType != "Proj" && HistoType != "SampProj" && HistoType != "H1BasicProj" )
07369                         {
07370                           if( fUserHistoMin >= fUserHistoMax ){fFlagUserHistoMin = "AUTO"; fFlagUserHistoMax = "AUTO";}
07371                           //................................. user's min and/or max
07372                           if( fFlagUserHistoMin == "ON" )
07373                             {SetYminMemoFromValue(HistoCode.Data(), fUserHistoMin); fFlagUserHistoMin = "OFF";}
07374                           if( fFlagUserHistoMax == "ON" )
07375                             {SetYmaxMemoFromValue(HistoCode.Data(), fUserHistoMax); fFlagUserHistoMax = "OFF";}
07376                           //................................. automatic min and/or max
07377                           if( fFlagUserHistoMin == "AUTO" )
07378                             {
07379                               //.............. no bottom margin if ymin = 0
07380                               Double_t ymin = GetYminFromHistoFrameAndMarginValue(h_his0, (Double_t)0.);
07381                               if( ymin != (Double_t)0. )
07382                                 {ymin =
07383                                    GetYminFromHistoFrameAndMarginValue(h_his0, fCnaParHistos->GetMarginAutoMinMax());}
07384                               SetYminMemoFromValue(HistoCode.Data(),ymin);
07385                               fFlagUserHistoMin = "OFF";
07386                             }
07387                           if( fFlagUserHistoMax == "AUTO" )
07388                             {
07389                               Double_t ymax =
07390                                 GetYmaxFromHistoFrameAndMarginValue(h_his0,fCnaParHistos->GetMarginAutoMinMax());
07391                               SetYmaxMemoFromValue(HistoCode.Data(),ymax);
07392                               fFlagUserHistoMax = "OFF";
07393                             }
07394                           //................................. Set YMin and YMax of histo (ViewHisto)
07395                           SetYminMemoFromPreviousMemo(HistoCode);
07396                           SetYmaxMemoFromPreviousMemo(HistoCode);
07397                         } // end of if( HistoType != "Proj" && HistoType != "SampProj" && HistoType != "H1BasicProj" )
07398 
07399                       //.......... Find maximum in case of Proj (LIN scale only) // PS: EvolProj => in ViewHistime
07400                       if( ( HistoType == "Proj" || HistoType == "SampProj" ||
07401                             HistoType == "H1BasicProj" ) && fFlagScaleY == "LIN" )
07402                         {
07403                           SetYmaxMemoFromValue
07404                             (HistoCode.Data(),
07405                              GetYmaxFromHistoFrameAndMarginValue(h_his0, fCnaParHistos->GetMarginAutoMinMax()));
07406                         }
07407                     } // end of  if( opt_plot == fOnlyOnePlot ||
07408                   // (opt_plot == fSeveralPlot && GetMemoFlag(HistoCode, opt_plot) == "Free") || 
07409                   // (opt_plot == fSameOnePlot && GetMemoFlag(HistoCode, opt_plot) == "Free") )
07410                   
07411                   //--- Set ymin and ymax to the first HistoCode values for option SAME n
07412                   if( opt_plot == fSameOnePlot && GetMemoFlag(HistoCode, opt_plot) == "Busy" )            
07413                     {
07414                       Double_t ymin = GetYminValueFromMemo(fHistoCodeFirst.Data());
07415                       SetYminMemoFromValue(HistoCode.Data(), ymin);
07416 
07417                       Double_t ymax = GetYmaxValueFromMemo(fHistoCodeFirst.Data());
07418                       SetYmaxMemoFromValue(HistoCode.Data(), ymax);
07419                     }
07420 
07421                   //... histogram set ymin and ymax and consequently margin at top of the plot
07422                   Int_t  xFlagAutoYsupMargin = SetHistoFrameYminYmaxFromMemo(h_his0, HistoCode);
07423 
07424                   //==================================== P L O T ==============================  (ViewHisto)
07425                   HistoPlot(h_his0,           SizeForPlot,   xinf_his, xsup_his,
07426                             HistoCode.Data(), HistoType.Data(),
07427                             StexStin_A,       i0StinEcha,    i0Sample,
07428                             opt_scale_x,      opt_scale_y,   opt_plot, arg_AlreadyRead,
07429                             xFlagAutoYsupMargin);
07430                   h_his0->Delete();   h_his0 = 0;             fCdeleteRoot++;
07431                   //===========================================================================
07432 
07433                   //--- Recover ymin and ymax from user's values in option SAME n
07434                   if( (opt_plot == fSameOnePlot && GetMemoFlag(HistoCode, opt_plot) == "Busy") )                  
07435                     {
07436                       SetYminMemoFromValue(HistoCode.Data(), fUserHistoMin);
07437                       SetYmaxMemoFromValue(HistoCode.Data(), fUserHistoMax);
07438                     }
07439                 } // end of if( OKPlot > 0 )
07440               else
07441                 {
07442                   cout << "!TEcnaHistos::ViewHisto(...)> Histo not available."
07443                        << fTTBELL << endl;
07444                 }
07445             }
07446         }
07447     } // end of  if( OKHisto == 1 )
07448 
07449 }  // end of ViewHisto(...)
07450 
07451 //------------------------------------------------------------------------------------
07452 Int_t TEcnaHistos::GetDSOffset(const Int_t& DeeNumber, const Int_t& DataSector)
07453 {
07454   // gives the DataSector Offset on 1D histos for option "Global"
07455 
07456   Int_t DSOffset = 0;
07457 
07458   if( DeeNumber == 4 )
07459     {
07460       if( DataSector >= 1 ){}
07461       if( DataSector >= 2 ){DSOffset += fEcalNumbering->GetMaxSCInDS(1)*fEcal->MaxCrysInSC();}
07462       if( DataSector >= 3 ){DSOffset += fEcalNumbering->GetMaxSCInDS(2)*fEcal->MaxCrysInSC();}
07463       if( DataSector >= 4 ){DSOffset += fEcalNumbering->GetMaxSCInDS(3)*fEcal->MaxCrysInSC();}
07464       if( DataSector >= 5 ){DSOffset += fEcalNumbering->GetMaxSCInDS(4)*fEcal->MaxCrysInSC();}
07465     }
07466   if( DeeNumber == 3 )
07467     {
07468       if( DataSector >= 5 ){}
07469       if( DataSector >= 6 ){DSOffset += (fEcalNumbering->GetMaxSCInDS(5)/2)*fEcal->MaxCrysInSC();}
07470       if( DataSector >= 7 ){DSOffset += fEcalNumbering->GetMaxSCInDS(6)*fEcal->MaxCrysInSC();}
07471       if( DataSector >= 8 ){DSOffset += fEcalNumbering->GetMaxSCInDS(7)*fEcal->MaxCrysInSC();}
07472       if( DataSector >= 9 ){DSOffset += fEcalNumbering->GetMaxSCInDS(8)*fEcal->MaxCrysInSC();}
07473     }
07474   if( DeeNumber == 2 )
07475     {
07476       if( DataSector <= 9 ){}
07477       if( DataSector <= 8 ){DSOffset += fEcalNumbering->GetMaxSCInDS(9)*fEcal->MaxCrysInSC();}
07478       if( DataSector <= 7 ){DSOffset += fEcalNumbering->GetMaxSCInDS(8)*fEcal->MaxCrysInSC();}
07479       if( DataSector <= 6 ){DSOffset += fEcalNumbering->GetMaxSCInDS(7)*fEcal->MaxCrysInSC();}
07480       if( DataSector <= 5 ){DSOffset += fEcalNumbering->GetMaxSCInDS(6)*fEcal->MaxCrysInSC();}
07481     }
07482   if( DeeNumber == 1 )
07483     {
07484       if( DataSector <= 5 ){}
07485       if( DataSector <= 4 ){DSOffset += (fEcalNumbering->GetMaxSCInDS(5)/2)*fEcal->MaxCrysInSC();}
07486       if( DataSector <= 3 ){DSOffset += fEcalNumbering->GetMaxSCInDS(4)*fEcal->MaxCrysInSC();}
07487       if( DataSector <= 2 ){DSOffset += fEcalNumbering->GetMaxSCInDS(3)*fEcal->MaxCrysInSC();}
07488       if( DataSector <= 1 ){DSOffset += fEcalNumbering->GetMaxSCInDS(2)*fEcal->MaxCrysInSC();}
07489     }
07490   return DSOffset;                            
07491 }
07492 //------------------------------------------------------------------------------------
07493 Int_t TEcnaHistos::GetSCOffset(const Int_t& DeeNumber, const Int_t& DataSector, const Int_t& SC_in_DS)
07494 {
07495   // gives the SC (Super-Crystal) Offset on 1D histos for option "Global"
07496 
07497   Int_t SCOffset = 0;
07498 
07499   if( DeeNumber == 1 || DeeNumber == 3 )
07500     {
07501       if( DataSector == 5 ){SCOffset += ((SC_in_DS-17)-1)*fEcal->MaxCrysInSC();}
07502       if( DataSector != 5 ){SCOffset += (SC_in_DS-1)*fEcal->MaxCrysInSC();}
07503     }
07504 
07505   if( DeeNumber == 2 || DeeNumber == 4 ){SCOffset += (SC_in_DS-1)*fEcal->MaxCrysInSC();}
07506 
07507   return SCOffset;      
07508 }
07509 //------------------------------------------------------------------------------------
07510 Int_t TEcnaHistos::ModifiedSCEchaForNotConnectedSCs(const Int_t& n1DeeNumber,
07511                                                    const Int_t& nSCCons,     const Int_t& SC_in_DS,
07512                                                    const Int_t& n1DeeSCEcna, const Int_t& n1SCEcha)
07513 {
07514   //------------------------ Modification of n1SCEcha number for not connected SC's
07515 
07516   Int_t ModifiedSCEcha = -1;
07517   TString SCQuad = fEcalNumbering->GetSCQuadFrom1DeeSCEcna(n1DeeSCEcna);  // SCQuad = top  OR bottom
07518   TString DeeDir = fEcalNumbering->GetDeeDirViewedFromIP(n1DeeNumber);    // DeeDir = left OR right
07519 
07520   TString TypQuad = "?";
07521   if( SCQuad == "top"    && DeeDir == "right" ){TypQuad = "TR";}
07522   if( SCQuad == "top"    && DeeDir == "left"  ){TypQuad = "TL";}
07523   if( SCQuad == "bottom" && DeeDir == "left"  ){TypQuad = "BL";}
07524   if( SCQuad == "bottom" && DeeDir == "right" ){TypQuad = "BR";}
07525 
07526   //------------------------------------------------------------------------------------------- top
07527 
07528   //..... (D1,S1), (D3,S9) SC_in_DS = 30, n1DeeSCEcna =  60 -> 182a for construction top/right
07529   //..... (D1,S2), (D3,S8) SC_in_DS =  3, n1DeeSCEcna = 138 -> 178a for construction top/right
07530   if( (SC_in_DS == 30 && n1DeeSCEcna ==  60 && TypQuad == "TR") ||
07531       (SC_in_DS ==  3 && n1DeeSCEcna == 138 && TypQuad == "TR") ){if(n1SCEcha > 15){ModifiedSCEcha = n1SCEcha - 15;}}
07532 
07533   //..... (D4,S1), (D2,S9) SC_in_DS = 30, n1DeeSCEcna =  60 ->  33a for construction top/left
07534   //..... (D4,S2), (D2,S8) SC_in_DS =  3, n1DeeSCEcna = 138 ->  29a for construction top/left
07535   if( (SC_in_DS == 30 && n1DeeSCEcna ==  60 && TypQuad == "TL") ||
07536       (SC_in_DS ==  3 && n1DeeSCEcna == 138 && TypQuad == "TL") )
07537     {
07538       if(n1SCEcha ==  4){ModifiedSCEcha =  1;}
07539       if(n1SCEcha ==  5){ModifiedSCEcha =  2;}
07540       if(n1SCEcha ==  9){ModifiedSCEcha =  3;}
07541       if(n1SCEcha == 10){ModifiedSCEcha =  4;}
07542       if(n1SCEcha == 14){ModifiedSCEcha =  5;}
07543       if(n1SCEcha == 15){ModifiedSCEcha =  6;}
07544       if(n1SCEcha == 19){ModifiedSCEcha =  7;}
07545       if(n1SCEcha == 20){ModifiedSCEcha =  8;}
07546       if(n1SCEcha == 24){ModifiedSCEcha =  9;}
07547       if(n1SCEcha == 25){ModifiedSCEcha = 10;}
07548     }
07549 
07550   //..... (D1,S1), (D3,S9) SC_in_DS = 30, n1DeeSCEcna = 119 -> 182b for construction top/right
07551   if( SC_in_DS == 30 && n1DeeSCEcna == 119 && TypQuad == "TR" ){if(n1SCEcha > 5){ModifiedSCEcha = n1SCEcha - 5;}}
07552 
07553   //..... (D4,S1), (D2,S9) SC_in_DS = 30, n1DeeSCEcna = 119 ->  33b for construction top/left
07554   if( SC_in_DS == 30 && n1DeeSCEcna == 119 && TypQuad == "TL" )
07555     {
07556       if(n1SCEcha ==  4){ModifiedSCEcha = 11;}
07557       if(n1SCEcha ==  5){ModifiedSCEcha = 12;}
07558       if(n1SCEcha ==  9){ModifiedSCEcha = 13;}
07559       if(n1SCEcha == 10){ModifiedSCEcha = 14;}
07560       if(n1SCEcha == 14){ModifiedSCEcha = 15;}
07561       if(n1SCEcha == 15){ModifiedSCEcha = 16;}
07562       if(n1SCEcha == 19){ModifiedSCEcha = 17;}
07563       if(n1SCEcha == 20){ModifiedSCEcha = 18;}
07564       if(n1SCEcha == 24){ModifiedSCEcha = 19;}
07565       if(n1SCEcha == 25){ModifiedSCEcha = 20;}
07566     }
07567 
07568   //..... (D1,S1), (D3,S9) SC_in_DS = 12, n1DeeSCEcna =  13 -> 161  for construction top/right
07569   //..... (D4,S1), (D2,S9) SC_in_DS = 12, n1DeeSCEcna =  13 ->  12  for construction top/left
07570   if( SC_in_DS == 12 && n1DeeSCEcna ==  13 && TypQuad == "TR" )
07571     {
07572       ModifiedSCEcha = n1SCEcha;
07573     } 
07574   if( SC_in_DS == 12 && n1DeeSCEcna ==  13 && TypQuad == "TL" )
07575     {
07576       if( n1SCEcha >=  1 &&  n1SCEcha <=  4 ){ModifiedSCEcha = n1SCEcha;}
07577       if( n1SCEcha >=  6 &&  n1SCEcha <=  9 ){ModifiedSCEcha = n1SCEcha-1;}
07578       if( n1SCEcha >= 11 &&  n1SCEcha <= 14 ){ModifiedSCEcha = n1SCEcha-2;}
07579       if( n1SCEcha >= 16 &&  n1SCEcha <= 19 ){ModifiedSCEcha = n1SCEcha-3;}
07580       if( n1SCEcha >= 21 &&  n1SCEcha <= 24 ){ModifiedSCEcha = n1SCEcha-4;}
07581     }
07582 
07583   //..... (D1,S2), (D3,S8) SC_in_DS = 25, n1DeeSCEcna = 176 -> 207a for construction top/right
07584   if( SC_in_DS == 25 && n1DeeSCEcna == 176 && TypQuad == "TR" )
07585     {
07586       if(n1SCEcha ==  4){ModifiedSCEcha =  1;}
07587       if(n1SCEcha ==  5){ModifiedSCEcha =  2;}
07588       if(n1SCEcha ==  9){ModifiedSCEcha =  3;}
07589       if(n1SCEcha == 10){ModifiedSCEcha =  4;}
07590       if(n1SCEcha == 14){ModifiedSCEcha =  5;}
07591       if(n1SCEcha == 15){ModifiedSCEcha =  6;}
07592       if(n1SCEcha == 19){ModifiedSCEcha =  7;}
07593       if(n1SCEcha == 20){ModifiedSCEcha =  8;}
07594       if(n1SCEcha == 24){ModifiedSCEcha =  9;}
07595       if(n1SCEcha == 25){ModifiedSCEcha = 10;}
07596     }
07597 
07598   //..... (D4,S2), (D2,S8) SC_in_DS = 25, n1DeeSCEcna = 176 ->  58a for construction top/left
07599   if( SC_in_DS == 25 && n1DeeSCEcna == 176 && TypQuad == "TL" )
07600     {
07601       if(n1SCEcha == 16){ModifiedSCEcha =  1;}
07602       if(n1SCEcha == 21){ModifiedSCEcha =  2;}
07603       if(n1SCEcha == 17){ModifiedSCEcha =  3;}
07604       if(n1SCEcha == 22){ModifiedSCEcha =  4;}
07605       if(n1SCEcha == 18){ModifiedSCEcha =  5;}
07606       if(n1SCEcha == 23){ModifiedSCEcha =  6;}
07607       if(n1SCEcha == 19){ModifiedSCEcha =  7;}
07608       if(n1SCEcha == 24){ModifiedSCEcha =  8;}
07609       if(n1SCEcha == 20){ModifiedSCEcha =  9;}
07610       if(n1SCEcha == 25){ModifiedSCEcha = 10;}
07611     }
07612 
07613   //..... (D1,S2), (D3,S8) SC_in_DS =  3, n1DeeSCEcna = 157 -> 178b for construction top/right
07614   //..... (D1,S2), (D3,S8) SC_in_DS = 25, n1DeeSCEcna = 193 -> 207b for construction top/right
07615   if( (SC_in_DS ==  3 && n1DeeSCEcna == 157 && TypQuad == "TR") ||
07616       (SC_in_DS == 25 && n1DeeSCEcna == 193 && TypQuad == "TR") )
07617     {
07618       if(n1SCEcha ==  4){ModifiedSCEcha = 11;}
07619       if(n1SCEcha ==  5){ModifiedSCEcha = 12;}
07620       if(n1SCEcha ==  9){ModifiedSCEcha = 13;}
07621       if(n1SCEcha == 10){ModifiedSCEcha = 14;}
07622       if(n1SCEcha == 14){ModifiedSCEcha = 15;}
07623       if(n1SCEcha == 15){ModifiedSCEcha = 16;}
07624       if(n1SCEcha == 19){ModifiedSCEcha = 17;}
07625       if(n1SCEcha == 20){ModifiedSCEcha = 18;}
07626       if(n1SCEcha == 24){ModifiedSCEcha = 19;}
07627       if(n1SCEcha == 25){ModifiedSCEcha = 20;}
07628     }
07629 
07630   //..... (D4,S2), (D2,S8) SC_in_DS =  3, n1DeeSCEcna = 157 ->  29b for construction top/left
07631   //..... (D4,S2), (D2,S8) SC_in_DS = 25, n1DeeSCEcna = 193 ->  58b for construction top/left
07632   if( (SC_in_DS ==  3 && n1DeeSCEcna == 157 && TypQuad == "TL") ||
07633       (SC_in_DS == 25 && n1DeeSCEcna == 193 && TypQuad == "TL") )
07634     {
07635       if(n1SCEcha == 16){ModifiedSCEcha = 11;}
07636       if(n1SCEcha == 21){ModifiedSCEcha = 12;}
07637       if(n1SCEcha == 17){ModifiedSCEcha = 13;}
07638       if(n1SCEcha == 22){ModifiedSCEcha = 14;}
07639       if(n1SCEcha == 18){ModifiedSCEcha = 15;}
07640       if(n1SCEcha == 23){ModifiedSCEcha = 16;}
07641       if(n1SCEcha == 19){ModifiedSCEcha = 17;}
07642       if(n1SCEcha == 24){ModifiedSCEcha = 18;}
07643       if(n1SCEcha == 20){ModifiedSCEcha = 19;}
07644       if(n1SCEcha == 25){ModifiedSCEcha = 20;}
07645     }
07646 
07647   //..... (D1,S2), (D3,S8) SC_in_DS = 32, n1DeeSCEcna =  51 -> 216  for construction top/right
07648   if( SC_in_DS == 32 && n1DeeSCEcna ==  51 && TypQuad == "TR" )
07649     {
07650       if( n1SCEcha >=  1 && n1SCEcha <=  4 ){ModifiedSCEcha = n1SCEcha;}
07651       if( n1SCEcha >=  6 && n1SCEcha <=  9 ){ModifiedSCEcha = n1SCEcha-1;}
07652       if( n1SCEcha >= 11 && n1SCEcha <= 14 ){ModifiedSCEcha = n1SCEcha-2;}
07653       if( n1SCEcha >= 16 && n1SCEcha <= 19 ){ModifiedSCEcha = n1SCEcha-3;}
07654       if( n1SCEcha >= 21 && n1SCEcha <= 24 ){ModifiedSCEcha = n1SCEcha-4;}
07655     }
07656 
07657   //..... (D4,S2), (D2,S8) SC_in_DS = 32, n1DeeSCEcna =  51 ->  67  for construction top/left
07658   if( SC_in_DS == 32 && n1DeeSCEcna ==  51 && TypQuad == "TL" )
07659     {
07660       ModifiedSCEcha = n1SCEcha;
07661     }
07662 
07663   // **************************** Special case: TWO SC's IN THE SAME SC-Ecna place *************************
07664   //========================================================================================== D1,D3 ======
07665   //      (D1,S2), (D3,S8) SC_in_DS =  3, n1DeeSCEcna =  32 -> 178c for construction top/right
07666   //      (D1,S2), (D3,S8) SC_in_DS = 25, n1DeeSCEcna =  32 -> 207c for construction top/right
07667   //       For  n1DeeSCEcna =  32: ONLY "25" IN ARRAY fT2d_DSSC[][] (see TEcnaNumbering.cc)
07668   //       fT2d_DSSC[dee-1][32-1] =  25;  // also 3;  // ( (207c, 58c) also (178c, 29c) for construction)
07669   //       is recovered from number for construction
07670   //=======================================================================================================
07671   if( n1DeeSCEcna ==  32 && TypQuad == "TR" )
07672     {
07673       if( nSCCons == 207 )
07674         {
07675           if(n1SCEcha ==  1){ModifiedSCEcha = 21;}
07676           if(n1SCEcha ==  2){ModifiedSCEcha = 22;}
07677           if(n1SCEcha ==  3){ModifiedSCEcha = 23;}
07678           if(n1SCEcha ==  6){ModifiedSCEcha = 24;}
07679           if(n1SCEcha ==  7){ModifiedSCEcha = 25;}
07680         }
07681       if( nSCCons == 178 )
07682         {
07683           if(n1SCEcha == 11){ModifiedSCEcha = 21;}
07684         }
07685     }
07686 
07687   //========================================================================================== D2,D4 ======
07688   //      (D4,S2), (D2,S8) SC_in_DS =  3, n1DeeSCEcna =  32 ->  29c for construction top/left
07689   //      (D4,S2), (D2,S8) SC_in_DS = 25, n1DeeSCEcna =  32 ->  58c for construction top/left
07690   //       For  n1DeeSCEcna =  32: ONLY "25" IN ARRAY fT2d_DSSC[][] (see TEcnaNumbering.cc)
07691   //       fT2d_DSSC[dee-1][32-1] =  25;  // also 3;  // ( (207c, 58c) also (178c, 29c) for construction)
07692   //       is recovered from number for construction
07693   //=======================================================================================================
07694   if( n1DeeSCEcna ==  32 && TypQuad == "TL" )
07695     {
07696       if( nSCCons == 58 )
07697         {
07698           if(n1SCEcha ==  1){ModifiedSCEcha = 21;}
07699           if(n1SCEcha ==  2){ModifiedSCEcha = 22;}
07700           if(n1SCEcha ==  3){ModifiedSCEcha = 23;}
07701           if(n1SCEcha ==  6){ModifiedSCEcha = 24;}
07702           if(n1SCEcha ==  7){ModifiedSCEcha = 25;}
07703         }
07704       if( nSCCons == 29 )
07705         {
07706           if(n1SCEcha == 11){ModifiedSCEcha = 21;}
07707         }
07708     }
07709   //****************************************************************************************************
07710 
07711   //------------------------------------------------------------------------------------------- bottom
07712 
07713   // **************************** Special case: TWO SC's IN THE SAME SC-Ecna place *************************
07714   //========================================================================================== D1,D3 ======
07715   //      (D1,S4), (D3,S6) SC_in_DS = 14, n1DeeSCEcna =  29 -> 261a for construction bottom/right
07716   //      (D1,S4), (D3,S6) SC_in_DS = 21, n1DeeSCEcna =  29 -> 268a for construction bottom/right
07717   //       For  n1DeeSCEcna =  29: ONLY "14" IN ARRAY fT2d_DSSC[][] (see TEcnaNumbering.cc)
07718   //       fT2d_DSSC[dee-1][29-1] = 14; // also 21;  //  ( (261a, 112a) also (268a, 119a) for construction)
07719   //       is recovered from number for construction
07720   //=======================================================================================================
07721   if( n1DeeSCEcna ==  29 && TypQuad == "BR" )
07722     {
07723       if( nSCCons == 261 )
07724         {
07725           if(n1SCEcha ==  1){ModifiedSCEcha = 21;}
07726           if(n1SCEcha ==  2){ModifiedSCEcha = 22;}
07727           if(n1SCEcha ==  3){ModifiedSCEcha = 23;}
07728           if(n1SCEcha ==  6){ModifiedSCEcha = 24;}
07729           if(n1SCEcha ==  7){ModifiedSCEcha = 25;}
07730         }
07731       if( nSCCons == 268 )
07732         {
07733           if(n1SCEcha == 11){ModifiedSCEcha = 21;}
07734         }
07735     }
07736 
07737   //========================================================================================== D2,D4 ======
07738   //      (D4,S4), (D2,S6) SC_in_DS = 14, n1DeeSCEcna =  29 -> 112a for construction bottom/left
07739   //      (D4,S4), (D2,S6) SC_in_DS = 21, n1DeeSCEcna =  29 -> 119a for construction bottom/left
07740   //       For  n1DeeSCEcna =  29: ONLY "14" IN ARRAY fT2d_DSSC[][] (see TEcnaNumbering.cc)
07741   //       fT2d_DSSC[dee-1][29-1] = 14; // also 21;  //  ( (261a, 112a) also (268a, 119a) for construction)
07742   //       is recovered from number for construction
07743   //======================================================================================================= 
07744   if( n1DeeSCEcna ==  29 && TypQuad == "BL" )
07745     {
07746       if( nSCCons == 119 )
07747         {
07748           if(n1SCEcha == 11){ModifiedSCEcha = 21;}
07749         }
07750       if( nSCCons == 112 )
07751         {
07752           if(n1SCEcha ==  1){ModifiedSCEcha = 21;}
07753           if(n1SCEcha ==  2){ModifiedSCEcha = 22;}
07754           if(n1SCEcha ==  3){ModifiedSCEcha = 23;}
07755           if(n1SCEcha ==  6){ModifiedSCEcha = 24;}
07756           if(n1SCEcha ==  7){ModifiedSCEcha = 25;}
07757         }
07758     }
07759 
07760   // ****************************************************************************************************
07761 
07762   //..... (D1,S3), (D3,S7) SC_in_DS = 34, n1DeeSCEcna = 188 -> 298a for construction bottom/right
07763   //..... (D1,S4), (D3,S6) SC_in_DS = 14, n1DeeSCEcna = 165 -> 261b for construction bottom/right
07764   if( (SC_in_DS == 34 && n1DeeSCEcna == 188 && TypQuad == "BR") || 
07765       (SC_in_DS == 14 && n1DeeSCEcna == 165 && TypQuad == "BR") ){if(n1SCEcha > 15){ModifiedSCEcha = n1SCEcha - 15;}}
07766 
07767   //..... (D4,S3), (D2,S7) SC_in_DS = 34, n1DeeSCEcna = 188 -> 149a for construction bottom/left
07768   //..... (D4,S4), (D2,S6) SC_in_DS = 14, n1DeeSCEcna = 165 -> 112b for construction bottom/left
07769   if( (SC_in_DS == 34 && n1DeeSCEcna == 188 && TypQuad == "BL") ||
07770       (SC_in_DS == 14 && n1DeeSCEcna == 165 && TypQuad == "BL") )
07771     {
07772       if(n1SCEcha ==  4){ModifiedSCEcha =  1;}
07773       if(n1SCEcha ==  5){ModifiedSCEcha =  2;}
07774       if(n1SCEcha ==  9){ModifiedSCEcha =  3;}
07775       if(n1SCEcha == 10){ModifiedSCEcha =  4;}
07776       if(n1SCEcha == 14){ModifiedSCEcha =  5;}
07777       if(n1SCEcha == 15){ModifiedSCEcha =  6;}
07778       if(n1SCEcha == 19){ModifiedSCEcha =  7;}
07779       if(n1SCEcha == 20){ModifiedSCEcha =  8;}
07780       if(n1SCEcha == 24){ModifiedSCEcha =  9;}
07781       if(n1SCEcha == 25){ModifiedSCEcha = 10;}
07782     }
07783 
07784   //..... (D1,S3), (D3,S7) SC_in_DS = 10, n1DeeSCEcna =  50 -> 224  for construction bottom/right
07785   if( SC_in_DS == 10 && n1DeeSCEcna ==  50 && TypQuad == "BR" )
07786     {
07787       ModifiedSCEcha = n1SCEcha;
07788     }
07789 
07790   //..... (D4,S3), (D2,S7) SC_in_DS = 10, n1DeeSCEcna =  50 ->  75  for construction bottom/left 
07791   if( SC_in_DS == 10 && n1DeeSCEcna ==  50 && TypQuad == "BL")
07792     {
07793       if( n1SCEcha >=  1 &&  n1SCEcha <=  4 ){ModifiedSCEcha = n1SCEcha;}
07794       if( n1SCEcha >=  6 &&  n1SCEcha <=  9 ){ModifiedSCEcha = n1SCEcha-1;}
07795       if( n1SCEcha >= 11 &&  n1SCEcha <= 14 ){ModifiedSCEcha = n1SCEcha-2;}
07796       if( n1SCEcha >= 16 &&  n1SCEcha <= 19 ){ModifiedSCEcha = n1SCEcha-3;}
07797       if( n1SCEcha >= 21 &&  n1SCEcha <= 24 ){ModifiedSCEcha = n1SCEcha-4;}
07798     }
07799   
07800   //..... (D1,S4), (D3,S6) SC_in_DS = 14, n1DeeSCEcna = 144 -> 261c for construction bottom/right
07801   if( SC_in_DS == 14 && n1DeeSCEcna == 144 && TypQuad == "BR" ){if(n1SCEcha > 5){ModifiedSCEcha = n1SCEcha - 5;}}
07802 
07803   //..... (D4,S4), (D2,S6) SC_in_DS = 14, n1DeeSCEcna = 144 -> 112c for construction bottom/left
07804   if( SC_in_DS == 14 && n1DeeSCEcna == 144 && TypQuad == "BL" )
07805     {
07806       if(n1SCEcha ==  4){ModifiedSCEcha = 11;}
07807       if(n1SCEcha ==  5){ModifiedSCEcha = 12;}
07808       if(n1SCEcha ==  9){ModifiedSCEcha = 13;}
07809       if(n1SCEcha == 10){ModifiedSCEcha = 14;}
07810       if(n1SCEcha == 14){ModifiedSCEcha = 15;}
07811       if(n1SCEcha == 15){ModifiedSCEcha = 16;}
07812       if(n1SCEcha == 19){ModifiedSCEcha = 17;}
07813       if(n1SCEcha == 20){ModifiedSCEcha = 18;}
07814       if(n1SCEcha == 24){ModifiedSCEcha = 19;}
07815       if(n1SCEcha == 25){ModifiedSCEcha = 20;}
07816     }
07817 
07818   //..... (D1,S4), (D3,S6) SC_in_DS = 21, n1DeeSCEcna = 123 -> 268b for construction bottom/right
07819   //..... (D1,S5), (D3,S5) SC_in_DS = 20, n1DeeSCEcna =  21 -> 281a for construction bottom/right
07820   if( (SC_in_DS == 21 && n1DeeSCEcna == 123 && TypQuad == "BR") ||
07821       (SC_in_DS == 20 && n1DeeSCEcna ==  41 && TypQuad == "BR") )
07822     {
07823       if(n1SCEcha ==  4){ModifiedSCEcha =  1;}
07824       if(n1SCEcha ==  5){ModifiedSCEcha =  2;}
07825       if(n1SCEcha ==  9){ModifiedSCEcha =  3;}
07826       if(n1SCEcha == 10){ModifiedSCEcha =  4;}
07827       if(n1SCEcha == 14){ModifiedSCEcha =  5;}
07828       if(n1SCEcha == 15){ModifiedSCEcha =  6;}
07829       if(n1SCEcha == 19){ModifiedSCEcha =  7;}
07830       if(n1SCEcha == 20){ModifiedSCEcha =  8;}
07831       if(n1SCEcha == 24){ModifiedSCEcha =  9;}
07832       if(n1SCEcha == 25){ModifiedSCEcha = 10;}
07833     }
07834 
07835   //..... (D4,S4), (D2,S6) SC_in_DS = 21, n1DeeSCEcna = 123 -> 119b for construction bottom/left
07836   //..... (D4,S5), (D2,S5) SC_in_DS =  3, n1DeeSCEcna =  41 -> 132a for construction bottom/left
07837   if( (SC_in_DS == 21 && n1DeeSCEcna == 123 && TypQuad == "BL") ||
07838       (SC_in_DS ==  3 && n1DeeSCEcna ==  41 && TypQuad == "BL") ){if(n1SCEcha > 15){ModifiedSCEcha = n1SCEcha - 15;}}
07839 
07840 
07841   //..... (D1,S4), (D3,S6) SC_in_DS = 21, n1DeeSCEcna = 102 -> 268c for construction bottom/right
07842   if( SC_in_DS == 21 && n1DeeSCEcna == 102 && TypQuad == "BR" )
07843     {
07844       if(n1SCEcha ==  4){ModifiedSCEcha = 11;}
07845       if(n1SCEcha ==  5){ModifiedSCEcha = 12;}
07846       if(n1SCEcha ==  9){ModifiedSCEcha = 13;}
07847       if(n1SCEcha == 10){ModifiedSCEcha = 14;}
07848       if(n1SCEcha == 14){ModifiedSCEcha = 15;}
07849       if(n1SCEcha == 15){ModifiedSCEcha = 16;}
07850       if(n1SCEcha == 19){ModifiedSCEcha = 17;}
07851       if(n1SCEcha == 20){ModifiedSCEcha = 18;}
07852       if(n1SCEcha == 24){ModifiedSCEcha = 19;}
07853       if(n1SCEcha == 25){ModifiedSCEcha = 20;}
07854     }
07855 
07856   //..... (D4,S4), (D2,S6) SC_in_DS = 21, n1DeeSCEcna = 102 -> 119c for construction bottom/left
07857   if( SC_in_DS == 21 && n1DeeSCEcna == 102 && TypQuad == "BL" )
07858     {
07859       if(n1SCEcha == 16){ModifiedSCEcha = 11;}
07860       if(n1SCEcha == 21){ModifiedSCEcha = 12;}
07861       if(n1SCEcha == 17){ModifiedSCEcha = 13;}
07862       if(n1SCEcha == 22){ModifiedSCEcha = 14;}
07863       if(n1SCEcha == 18){ModifiedSCEcha = 15;}
07864       if(n1SCEcha == 23){ModifiedSCEcha = 16;}
07865       if(n1SCEcha == 19){ModifiedSCEcha = 17;}
07866       if(n1SCEcha == 24){ModifiedSCEcha = 18;}
07867       if(n1SCEcha == 20){ModifiedSCEcha = 19;}
07868       if(n1SCEcha == 25){ModifiedSCEcha = 20;}
07869     }
07870 
07871   //..... (D1,S5), (D3,S5) SC_in_DS = 23, n1DeeSCEcna =   8 -> 286 for construction bottom/right
07872   if( SC_in_DS == 23 && n1DeeSCEcna ==   8 && TypQuad == "BR" )
07873     {
07874       if( n1SCEcha >=  1 &&  n1SCEcha <=  4 ){ModifiedSCEcha = n1SCEcha;}
07875       if( n1SCEcha >=  6 &&  n1SCEcha <=  9 ){ModifiedSCEcha = n1SCEcha-1;}
07876       if( n1SCEcha >= 11 &&  n1SCEcha <= 14 ){ModifiedSCEcha = n1SCEcha-2;}
07877       if( n1SCEcha >= 16 &&  n1SCEcha <= 19 ){ModifiedSCEcha = n1SCEcha-3;}
07878       if( n1SCEcha >= 21 &&  n1SCEcha <= 24 ){ModifiedSCEcha = n1SCEcha-4;}
07879     }
07880 
07881   //..... (D4,S5), (D2,S5) SC_in_DS =  6, n1DeeSCEcna =   8 -> 137 for construction bottom/left
07882   if( SC_in_DS ==  6 && n1DeeSCEcna ==   8 && TypQuad == "BL" )
07883     {
07884       ModifiedSCEcha = n1SCEcha;
07885     }
07886      
07887      //======================= ERROR message if ModifiedSCEcha is not correct
07888   if( ModifiedSCEcha < 1 || ModifiedSCEcha > fEcal->MaxCrysInSC() )
07889     {
07890       cout << "! *** ERROR *** > ModifiedSCEcha = " << ModifiedSCEcha
07891            << ", SC_in_DS = " << SC_in_DS
07892            << ", nSCCons = " << nSCCons
07893            << ", n1DeeSCEcna = " << n1DeeSCEcna
07894            << ", n1SCEcha = " << n1SCEcha
07895            << ", ModifiedSCEcha = " << ModifiedSCEcha
07896            << ", TypQuad = " << TypQuad
07897            << fTTBELL << endl;
07898     }
07899 
07900  
07901   return ModifiedSCEcha;
07902 }
07903 // end of ModifiedSCEchaForNotConnectedSCs(...)
07904 
07905 //======================================================================================
07906 //
07907 //                          ViewHistime: evolution in time
07908 //
07909 //======================================================================================
07910 
07911 //======================================================================================
07912 //
07913 //                          ViewHistime: time evolution
07914 //
07915 //======================================================================================
07916 void TEcnaHistos::ViewHistime(const TString list_of_run_file_name, 
07917                               const Int_t&  StexStin_A, const Int_t& i0StinEcha,
07918                               const TString HistoCode,  const TString opt_plot_arg)
07919 {
07920   //Histogram of the quantities as a function of time (several runs)
07921 
07922   TString opt_plot  = opt_plot_arg;
07923   TString HistoType = fCnaParHistos->GetHistoType(HistoCode);
07924 
07925   if( opt_plot_arg == "ONLYONE" ){opt_plot = fOnlyOnePlot;}
07926   if( opt_plot_arg == "SEVERAL" ){opt_plot = fSeveralPlot;}
07927   if( opt_plot_arg == "SAMEONE" ){opt_plot = fSameOnePlot;}
07928 
07929   Int_t OKHisto = 0;
07930 
07931   //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Canvas already closed in option SAME %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
07932   Int_t xCanvasExists = 1; // a priori ==> SAME plot                                  //   (ViewHistime)
07933   if( opt_plot != fOnlyOnePlot && GetMemoFlag(HistoCode, opt_plot) == "Busy" )
07934     {
07935       TVirtualPad* main_subpad = 0; 
07936       //---------------- Call to ActivePad
07937       //if( (TRootCanvas*)fCanv<HISTOCODE>->GetCanvasImp() == fImp<HISTOCODE> ){
07938       // main_subpad = fPad<HISTOCODE>;} (return main_subpad)
07939       main_subpad = ActivePad(HistoCode.Data(), opt_plot.Data());  // => return 0 if canvas has been closed
07940       if( main_subpad == 0 )
07941         {
07942           cout << "*TEcnaHistos::ViewHistime(...)> WARNING ===> Canvas has been closed in option SAME or SAME n."
07943                << endl
07944                << "                               Please, restart with a new canvas."
07945                << fTTBELL << endl;
07946           
07947           ReInitCanvas(HistoCode, opt_plot);
07948           xCanvasExists = 0;
07949         }
07950     }
07951   //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
07952 
07953   //%%%%%%%%%%%%%%%%%%%%% Change of X variable in option SAME n with no proj %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
07954   Int_t SameXVarMemo = 1;   //  a priori ==> SAME n option: X variable OK                     (ViewHistime)
07955   if( !( HistoType == "Proj" || HistoType == "SampProj" || HistoType == "H1BasicProj" || HistoType == "EvolProj" ) )
07956     {
07957       TString XVarHisto = fCnaParHistos->GetXVarHisto(HistoCode.Data(), fFlagSubDet.Data(), fFapStexNumber);
07958       TString YVarHisto = fCnaParHistos->GetYVarHisto(HistoCode.Data(), fFlagSubDet.Data(), fFapStexNumber);
07959 
07960       if( (opt_plot == fSameOnePlot ) && GetMemoFlag(HistoCode, opt_plot) == "Free" )
07961         {
07962           SetXVarMemo(HistoCode, opt_plot, XVarHisto);  SetYVarMemo(HistoCode, opt_plot, YVarHisto); SameXVarMemo = 1;
07963         }
07964       if( (opt_plot == fSameOnePlot ) && GetMemoFlag(HistoCode, opt_plot) == "Busy" )
07965         {
07966           TString XVariableMemo = GetXVarFromMemo(HistoCode, opt_plot);
07967           TString YVariableMemo = GetYVarFromMemo(HistoCode, opt_plot);
07968           
07969           if( XVarHisto != XVariableMemo )
07970             {
07971               cout << "!TEcnaHistos::ViewHistime(...)> *** ERROR *** ===> X coordinate changed in option SAME n." << endl
07972                    << "                               Present  X = " << XVarHisto << endl
07973                    << "                               Present  Y = " << YVarHisto << endl
07974                    << "                               Previous X = " << XVariableMemo << endl
07975                    << "                               Previous Y = " << YVariableMemo 
07976                    << fTTBELL << endl;
07977               SameXVarMemo = 0;
07978             }
07979           else
07980             {SetYVarMemo(HistoCode, opt_plot, YVarHisto);}
07981         }
07982     }
07983   //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
07984 
07985   //%%%%%%%%%%%%%%%%%%%%%%% Change of Y variable in option SAME n with proj %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
07986   Int_t SameYVarMemo = 1;   //  a priori ==> SAME n option: Y variable OK                     (ViewHistime)
07987   if(  HistoType == "Proj" || HistoType == "SampProj" || HistoType == "H1BasicProj" || HistoType == "EvolProj" )
07988     {
07989       TString XVarHisto = fCnaParHistos->GetXVarHisto(HistoCode.Data(), fFlagSubDet.Data(), fFapStexNumber);
07990       TString YVarHisto = fCnaParHistos->GetYVarHisto(HistoCode.Data(), fFlagSubDet.Data(), fFapStexNumber);
07991 
07992       if( (opt_plot == fSameOnePlot ) && GetMemoFlag(HistoCode, opt_plot) == "Free" )
07993         {
07994           SetYVarMemo(HistoCode, opt_plot, YVarHisto);  SetYVarMemo(HistoCode, opt_plot, YVarHisto); SameYVarMemo = 1;
07995         }
07996       if( (opt_plot == fSameOnePlot ) && GetMemoFlag(HistoCode, opt_plot) == "Busy" )
07997         {
07998           TString XVariableMemo = GetXVarFromMemo(HistoCode, opt_plot);
07999           TString YVariableMemo = GetYVarFromMemo(HistoCode, opt_plot);
08000           
08001           if( YVarHisto != YVariableMemo )
08002             {
08003               cout << "!TEcnaHistos::ViewHistime(...)> *** ERROR *** ===> Y coordinate changed in option SAME n." << endl
08004                    << "                               Present  X = " << XVarHisto << endl
08005                    << "                               Present  Y = " << YVarHisto << endl
08006                    << "                               Previous X = " << XVariableMemo << endl
08007                    << "                               Previous Y = " << YVariableMemo 
08008                    << fTTBELL << endl;
08009               SameYVarMemo = 0;
08010             }
08011           else
08012             {SetYVarMemo(HistoCode, opt_plot, YVarHisto);}
08013         }
08014     }
08015   //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
08016   if( xCanvasExists == 1 && SameXVarMemo == 1 && SameYVarMemo == 1 ){OKHisto = 1;}
08017 
08018   //======================== Histime accepted
08019   if( OKHisto == 1 )
08020     {
08021       // fMyRootFile->PrintNoComment();
08022 
08023       fCnaParHistos->SetColorPalette(fFlagColPal);
08024 
08025       //................................. Init YMin and YMax of histo         //   (ViewHistime)
08026       if((opt_plot == fOnlyOnePlot) ||
08027          (opt_plot == fSeveralPlot && GetMemoFlag(HistoCode, opt_plot) == "Free") ||
08028          (opt_plot == fSameOnePlot && GetMemoFlag(HistoCode, opt_plot) == "Free"))
08029         {SetYminMemoFromPreviousMemo(HistoCode); SetYmaxMemoFromPreviousMemo(HistoCode);}
08030 
08031       //........ GetHistoryRunListParameters(...) : performs the allocation of the array fT1DRunNumber[]
08032       //         at first call of the present method ViewHistime
08033       //         increments the number of read file (fNbOfListFileEvolXXX) for option SAME
08034       //         and read the values fT1DRunNumber[0 to max] from the file list_of_run_file_name
08035       //         return the number of runs in the list of the file
08036       //............... Get the run parameters
08037 
08038       Int_t nb_of_runs_in_list = GetHistoryRunListParameters(list_of_run_file_name.Data(), HistoCode);
08039 
08040       if( nb_of_runs_in_list > 0 )
08041         {
08042           //..............................  prepa x axis: time in hours
08043           //Double_t sec_in_day   = (Double_t)86400.;          //===> (number of seconds in a day)
08044           Double_t margin_frame_xaxis = (Double_t)25.;       //===> margin in x coordinates 
08045 
08046           Double_t thstart_evol = (Double_t)0.;
08047           Double_t thstop_evol  = (Double_t)0.;
08048 
08049           Int_t* exist_indic  = new Int_t[nb_of_runs_in_list];    fCnew++;
08050 
08051           //===================================== FIRST LOOP BEGINNING ===================================
08052           //-------------------------------------------------------------------------------- (ViewHistime)
08053           //
08054           //     FIRST LOOP: read the "HistoryRunList" file. Check the existence of the runs
08055           //                 and determine the number of existing runs.
08056           //
08057           //--------------------------------------------------------------------------------
08058 
08059           fNbOfExistingRuns = (Int_t)0;
08060 
08061           if( fFapStexNumber > 0 )
08062             {
08063               for(Int_t i_run = 0; i_run < nb_of_runs_in_list; i_run++)
08064                 {
08065                   exist_indic[i_run] = 0;
08066                   // ==> set the attribute value relative to the run (fFapRunNumber)
08067                   SetRunNumberFromList(i_run, nb_of_runs_in_list);
08068 
08069                   fMyRootFile->PrintNoComment();
08070                   fMyRootFile->FileParameters(fFapAnaType.Data(),   fFapNbOfSamples,
08071                                               fT1DRunNumber[i_run], fFapFirstReqEvtNumber,
08072                                               fFapLastReqEvtNumber, fFapReqNbOfEvts,
08073                                               fFapStexNumber,       fCfgResultsRootFilePath.Data());
08074                   
08075                   if ( fMyRootFile->LookAtRootFile() == kTRUE )             //   (ViewHistime, 1rst loop)
08076                     {
08077                       fStatusFileFound = kTRUE;
08078 
08079                       //------ At first HistoryRunList file: set fStartEvol... and fStopEvol... quantities
08080                       if( GetListFileNumber(HistoCode) == 1 )
08081                         {
08082                           if( fNbOfExistingRuns == 0 ) 
08083                             {  
08084                               // start time of the first existing run of the list
08085                               fStartEvolTime = fMyRootFile->GetStartTime();
08086                               fStartEvolDate = fMyRootFile->GetStartDate();
08087                               fStartEvolRun  = fT1DRunNumber[i_run];
08088                               // start time of the last existing run of the list
08089                               // (in case of only one existing run in the list)
08090                               fStopEvolTime = fMyRootFile->GetStartTime(); 
08091                               fStopEvolDate = fMyRootFile->GetStartDate();
08092                               fStopEvolRun  = fT1DRunNumber[i_run];
08093                             }
08094                           else
08095                             {
08096                               // start time of the last existing run of the list
08097                               fStopEvolTime = fMyRootFile->GetStartTime();
08098                               fStopEvolDate = fMyRootFile->GetStartDate();
08099                               fStopEvolRun  = fT1DRunNumber[i_run];
08100                             }
08101                         }
08102                       //---- set flag of run existence and increase number of existing runs 
08103                       //     (for the first HistoryRunList file)
08104                       exist_indic[i_run] = 1;
08105                       fNbOfExistingRuns++;
08106                     } // end of if ( fMyRootFile->LookAtRootFile() == kTRUE )
08107                   else
08108                     {
08109                       fStatusFileFound = kFALSE;
08110 
08111                       cout << "!TEcnaHistos::ViewHistime(...)> *ERROR* =====> "
08112                            << " ROOT file not found for run " << fT1DRunNumber[i_run]
08113                            << fTTBELL << endl << endl;
08114                     }
08115                 } // end of for(Int_t i_run = 0; i_run < nb_of_runs_in_list; i_run++)
08116 
08117               //===================================== FIRST LOOP END ===========================     (ViewHistime) 
08118               if( fNbOfExistingRuns > 0 )
08119                 {
08120                   //-------------------- recover the array after removing non existing ROOT files
08121                   Int_t i_existing_run = (Int_t)0;
08122 
08123                   for( Int_t i_run = 0; i_run < nb_of_runs_in_list;  i_run++)
08124                     {
08125                       if( exist_indic[i_run] == 1 )
08126                         {
08127                           fT1DRunNumber[i_existing_run] = fT1DRunNumber[i_run];
08128                           i_existing_run++;
08129                         }
08130                     }    
08131 
08132                   //---------------------- Get start and stop time values to set the axis limits        (ViewHistime)
08133 
08134                   thstart_evol = (Double_t)fStartEvolTime;
08135                   thstop_evol  = (Double_t)fStopEvolTime;
08136 
08137                   Double_t xinf_lim = thstart_evol-(thstop_evol-thstart_evol)/margin_frame_xaxis;
08138                   Double_t xsup_lim = thstop_evol +(thstop_evol-thstart_evol)/margin_frame_xaxis;
08139 
08140                   Axis_t xinf_his = (Axis_t)(xinf_lim);
08141                   Axis_t xsup_his = (Axis_t)(xsup_lim);
08142 
08143                   //............................. i0StexEcha, i0Sample
08144                   Int_t i0StexEcha = fEcalNumbering->Get0StexEchaFrom1StexStinAnd0StinEcha(StexStin_A, i0StinEcha);
08145                   Int_t i0Sample = 0;
08146          
08147                   Double_t* time_coordx  = new Double_t[fNbOfExistingRuns];   fCnew++;
08148                   Double_t* hval_coordy  = new Double_t[fNbOfExistingRuns];   fCnew++;
08149          
08150                   //........... Set values to -1 
08151 
08152                   for( Int_t i_run = 0; i_run < fNbOfExistingRuns;  i_run++)
08153                     {
08154                       time_coordx[i_run] = (Double_t)(-1);
08155                       hval_coordy[i_run] = (Double_t)(-1);
08156                     }    
08157  
08158                   //========================== SECOND LOOP BEGINNING =====================================
08159                   //----------------------------------------------------------------------- (ViewHistime)
08160                   //
08161                   //      SECOND LOOP OVER THE EXISTING RUNS : FILL THE GRAPH COORDINATES
08162                   //
08163                   //-----------------------------------------------------------------------
08164                   for (Int_t i_run = 0; i_run < fNbOfExistingRuns; i_run++)
08165                     {
08166                       // => set the attribute value relative to the run (fFapRunNumber)
08167                       SetRunNumberFromList(i_run, fNbOfExistingRuns);
08168 
08169                       fMyRootFile->PrintNoComment();
08170                       fMyRootFile->FileParameters(fFapAnaType.Data(),   fFapNbOfSamples,
08171                                                   fT1DRunNumber[i_run], fFapFirstReqEvtNumber,
08172                                                   fFapLastReqEvtNumber, fFapReqNbOfEvts,
08173                                                   fFapStexNumber,       fCfgResultsRootFilePath.Data());
08174           
08175                       if ( fMyRootFile->LookAtRootFile() == kTRUE )    //  (ViewHistime, 2nd loop) 
08176                         {
08177                           fStatusFileFound = kTRUE;
08178 
08179                           Bool_t ok_view_histo = GetOkViewHisto(fMyRootFile, StexStin_A, i0StinEcha, i0Sample, HistoCode);
08180 
08181                           //............... F I L L   G R A P H   C O O R D I N A T E S   (ViewHistime)           
08182                           if( ok_view_histo == kTRUE )
08183                             {
08184                               //................................................. x coordinate
08185                               time_t xStartTime = fMyRootFile->GetStartTime();
08186                               Double_t thstart  = (Double_t)xStartTime;
08187                               time_coordx[i_run] = (Double_t)(thstart - xinf_lim);
08188                               //................................................. y coordinate
08189                               TVectorD read_histo(fEcal->MaxCrysEcnaInStex());
08190                               for(Int_t i=0; i<fEcal->MaxCrysEcnaInStex(); i++){read_histo(i)=(Double_t)0.;}
08191                              
08192                               if(HistoCode == "H_Ped_Date" || HistoCode == "H_Ped_RuDs")
08193                                 {read_histo = fMyRootFile->ReadPedestals(fEcal->MaxCrysEcnaInStex());}
08194                               if(HistoCode == "H_TNo_Date" || HistoCode == "H_TNo_RuDs")
08195                                 {read_histo = fMyRootFile->ReadTotalNoise(fEcal->MaxCrysEcnaInStex());}
08196                               if(HistoCode == "H_MCs_Date" || HistoCode == "H_MCs_RuDs")
08197                                 {read_histo = fMyRootFile->ReadMeanCorrelationsBetweenSamples(fEcal->MaxCrysEcnaInStex());}
08198                              
08199                               if(HistoCode == "H_LFN_Date" || HistoCode == "H_LFN_RuDs")
08200                                 {read_histo = fMyRootFile->ReadLowFrequencyNoise(fEcal->MaxCrysEcnaInStex());}
08201                               if(HistoCode == "H_HFN_Date" || HistoCode == "H_HFN_RuDs")
08202                                 {read_histo = fMyRootFile->ReadHighFrequencyNoise(fEcal->MaxCrysEcnaInStex());}
08203                               if(HistoCode == "H_SCs_Date" || HistoCode == "H_SCs_RuDs")
08204                                 {read_histo = fMyRootFile->ReadSigmaOfCorrelationsBetweenSamples(fEcal->MaxCrysEcnaInStex());}
08205                               hval_coordy[i_run] = (Double_t)read_histo(i0StexEcha);
08206                             }
08207                           else
08208                             {
08209                               cout << "!TEcnaHistos::ViewHistime(...)> Histo not available. "
08210                                    << fTTBELL << endl;
08211                             }
08212                         } // end of if ( fMyRootFile->LookAtRootFile() == kTRUE )
08213                       else
08214                         {
08215                           fStatusFileFound = kFALSE;
08216                         }
08217                     }
08218                   //========================== END OF SECOND LOOP ===========================================
08219 
08220                   //.................................................................... SCALE x and y
08221                   Int_t opt_scale_x = fOptScaleLinx;
08222                   if (fFlagScaleX == "LIN" ){opt_scale_x = fOptScaleLinx;}
08223                   if (fFlagScaleX == "LOG" ){opt_scale_x = fOptScaleLogx;}
08224 
08225                   Int_t opt_scale_y = fOptScaleLiny;
08226                   if (fFlagScaleY == "LIN" ){opt_scale_y = fOptScaleLiny;}
08227                   if (fFlagScaleY == "LOG" ){opt_scale_y = fOptScaleLogy;}
08228 
08229                   //------------------------------------------------- G R A P H    (ViewHistime)
08230                   TGraph* g_graph0 = new TGraph(fNbOfExistingRuns, time_coordx, hval_coordy); fCnewRoot++;
08231                   if( opt_plot == fOnlyOnePlot || opt_plot == fSeveralPlot)
08232                     {g_graph0->SetTitle(fCnaParHistos->GetQuantityName(HistoCode));}
08233                   if( opt_plot == fSameOnePlot )
08234                     {g_graph0->SetTitle(";");} 
08235 
08236                   //... Ymin and ymax default values will be taken if fFlagUserHistoMin/Max = "OFF"
08237                   //    (and if "Free" for "SAME" and "SAME n" options)
08238                   if((opt_plot == fOnlyOnePlot) ||
08239                      (opt_plot == fSeveralPlot && GetMemoFlag(HistoCode, opt_plot) == "Free") ||
08240                      (opt_plot == fSameOnePlot && GetMemoFlag(HistoCode, opt_plot) == "Free") )
08241                     {
08242                       SetYminMemoFromValue(HistoCode.Data(), fCnaParHistos->GetYminDefaultValue(HistoCode.Data()));
08243                       SetYmaxMemoFromValue(HistoCode.Data(), fCnaParHistos->GetYmaxDefaultValue(HistoCode.Data()));
08244                     }
08245               
08246                   //................................ Put min max values       (ViewHistime)
08247                   //.......... default if flag not set to "ON"
08248                   //SetYminMemoFromValue(HistoCode.Data(), fCnaParHistos->GetYminDefaultValue(HistoCode.Data()));
08249                   //SetYmaxMemoFromValue(HistoCode.Data(), fCnaParHistos->GetYmaxDefaultValue(HistoCode.Data()));
08250 
08251                   g_graph0->Set(fNbOfExistingRuns);
08252                   Double_t graph_ymin =
08253                     GetYminFromGraphFrameAndMarginValue(g_graph0, fCnaParHistos->GetMarginAutoMinMax());
08254                   Double_t graph_ymax =
08255                     GetYmaxFromGraphFrameAndMarginValue(g_graph0, fCnaParHistos->GetMarginAutoMinMax());
08256 
08257                   //---------------------------------- G R A P H   P L O T  ---------------------------- (ViewHistime)
08258                   if( HistoType == "Evol" )
08259                     {
08260                       //----------------- G R A P H  Y M I N / Y M A X    M A N A G E M E N T
08261                       if((opt_plot == fOnlyOnePlot) ||
08262                          (opt_plot == fSeveralPlot && GetMemoFlag(HistoCode, opt_plot) == "Free") ||
08263                          (opt_plot == fSameOnePlot && GetMemoFlag(HistoCode, opt_plot) == "Free") )
08264                         {
08265                           if( opt_plot == fSameOnePlot ){fHistoCodeFirst = HistoCode;} // registration of first HistoCode
08266 
08267                           if( fUserHistoMin >= fUserHistoMax ){fFlagUserHistoMin = "AUTO"; fFlagUserHistoMax = "AUTO";}
08268                           //.......... user's value if flag set to "ON"
08269                           if( fFlagUserHistoMin == "ON" )
08270                             {SetYminMemoFromValue(HistoCode.Data(), fUserHistoMin); fFlagUserHistoMin = "OFF";}
08271                           if( fFlagUserHistoMax == "ON" )
08272                             {SetYmaxMemoFromValue(HistoCode.Data(), fUserHistoMax); fFlagUserHistoMax = "OFF";}
08273                           //................................. automatic min and/or max
08274                           if( fFlagUserHistoMin == "AUTO" )
08275                             {SetYminMemoFromValue(HistoCode.Data(), graph_ymin); fFlagUserHistoMin = "OFF";}
08276                           if( fFlagUserHistoMax == "AUTO" )
08277                             {SetYmaxMemoFromValue(HistoCode.Data(), graph_ymax); fFlagUserHistoMax = "OFF";}
08278                       
08279                           //................................. Init Ymin and Ymax for graph
08280                           SetYminMemoFromPreviousMemo(HistoCode);
08281                           SetYmaxMemoFromPreviousMemo(HistoCode);
08282                         }
08283                       //--- Set ymin and ymax to the first HistoCode values for option SAME n
08284                       if( opt_plot == fSameOnePlot && GetMemoFlag(HistoCode, opt_plot) == "Busy" )                
08285                         {
08286                           Double_t ymin = GetYminValueFromMemo(fHistoCodeFirst.Data());
08287                           SetYminMemoFromValue(HistoCode.Data(), ymin);
08288                       
08289                           Double_t ymax = GetYmaxValueFromMemo(fHistoCodeFirst.Data());
08290                           SetYmaxMemoFromValue(HistoCode.Data(), ymax);
08291                         }
08292                   
08293                       //..... graph set ymin and ymax and consequently margin at top of the plot  
08294                       Int_t  xFlagAutoYsupMargin = SetGraphFrameYminYmaxFromMemo(g_graph0, HistoCode);
08295                   
08296                       HistimePlot(g_graph0,         xinf_his,         xsup_his,
08297                                   HistoCode.Data(), HistoType.Data(),
08298                                   StexStin_A,       i0StinEcha,       i0Sample,
08299                                   opt_scale_x,      opt_scale_y,      opt_plot, xFlagAutoYsupMargin);
08300                       //  g_graph0->Delete();   fCdeleteRoot++;  // *===> NE PAS DELETER LE GRAPH SINON CA EFFACE TOUT!
08301                   
08302                       //--- Recover ymin and ymax from user's values in option SAME n
08303                       if( opt_plot == fSameOnePlot && GetMemoFlag(HistoCode, opt_plot) == "Busy" )                
08304                         {
08305                           SetYminMemoFromValue(HistoCode.Data(), fUserHistoMin);
08306                           SetYmaxMemoFromValue(HistoCode.Data(), fUserHistoMax);
08307                         }
08308                     }
08309               
08310                   //---------- H I S T O    Y    P R O J E C T I O N     P L O T  ---------------------- (ViewHistime)
08311               
08312                   //======  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)
08313                   //
08314                   //  must be done before booking because of the x <-> y permutation in case of "Proj"
08315                   //
08316                   //-----------------------------------------------------------------------------------------
08317                   //
08318                   //        CASE:    HistoType == "Proj"   OR   HistoType == "SampProj"
08319                   //
08320                   //                 Xinf and Xsup must be calculated from ymin and ymax
08321                   //                 of the direct graph
08322                   //
08323                   //-----------------------------------------------------------------------------------------
08324               
08325                   if( HistoType == "EvolProj" )
08326                     {
08327                       Int_t HisSizeEvolProj = fNbBinsProj;
08328                       TVectorD histo_for_plot(HisSizeEvolProj);
08329                       for(Int_t i=0; i<HisSizeEvolProj; i++){histo_for_plot[i]=(Double_t)0.;}
08330 
08331                       //graph_ymin = GetYminValueFromMemo(HistoCode.Data());
08332                       //graph_ymax = GetYmaxValueFromMemo(HistoCode.Data());
08333 
08334                       TString HistoCodi = HistoCode;     // HistoCodi = direct histo
08335 
08336                       if( HistoCode == "H_Ped_RuDs" ){HistoCodi = "H_Ped_Date";}
08337                       if( HistoCode == "H_TNo_RuDs" ){HistoCodi = "H_TNo_Date";}
08338                       if( HistoCode == "H_LFN_RuDs" ){HistoCodi = "H_LFN_Date";}
08339                       if( HistoCode == "H_HFN_RuDs" ){HistoCodi = "H_HFN_Date";}
08340                       if( HistoCode == "H_MCs_RuDs" ){HistoCodi = "H_MCs_Date";}
08341                       if( HistoCode == "H_SCs_RuDs" ){HistoCodi = "H_SCs_Date";}              
08342 
08343                       if( fUserHistoMin >= fUserHistoMax ){fFlagUserHistoMin = "AUTO"; fFlagUserHistoMax = "AUTO";}
08344 
08345                       //--------------------------------------------------------------------------- (ViewHistime)
08346                       //
08347                       //    fOnlyOnePlot => compute Xinf and Xsup at each time
08348                       //    fSeveralPlot => compute Xinf and Xsup once when flag = "Free" for each HistoCode
08349                       //    fSameOnePlot => compute Xinf and Xsup once
08350                       //
08351                       //--------------------------------------------------------------------------------------
08352                       if( (opt_plot == fOnlyOnePlot) ||
08353                           ( (opt_plot == fSeveralPlot && GetMemoFlag(HistoCode, fSeveralPlot) == "Free" ) ||
08354                             (opt_plot == fSameOnePlot && GetMemoFlag(HistoCode, fSameOnePlot) == "Free" ) ) )
08355                         {
08356                           Double_t XinfProj =(Double_t)0;
08357                           Double_t XsupProj =(Double_t)0;
08358 
08359                           //...................................................................... (ViewHistime)
08360                           if( fFlagUserHistoMin == "AUTO" || fFlagUserHistoMax == "AUTO" )
08361                             {
08362                               //... Get direct graph ymin and/or ymax and keep them as xinf and xsup
08363                               //    in memo for the plotted histo 
08364                               XinfProj = fUserHistoMin;
08365                               XsupProj = fUserHistoMax;
08366                               if( fFlagUserHistoMin == "AUTO" ){XinfProj = GetYminValueFromMemo(HistoCodi.Data());}
08367                               if( fFlagUserHistoMax == "AUTO" ){XsupProj = GetYmaxValueFromMemo(HistoCodi.Data());}
08368                             } // end of  if( fFlagUserHistoMin == "AUTO" || fFlagUserHistoMax == "AUTO" )
08369                           else
08370                             {
08371                               if( fFlagUserHistoMin == "OFF" )
08372                                 {
08373                                   SetYminMemoFromValue(HistoCode.Data(),
08374                                                        fCnaParHistos->GetYminDefaultValue(HistoCode.Data()));
08375                                   XinfProj = GetYminValueFromMemo(HistoCode.Data());
08376                                 }
08377 
08378                               if( fFlagUserHistoMax == "OFF" )
08379                                 {
08380                                   SetYmaxMemoFromValue(HistoCode.Data(),
08381                                                        fCnaParHistos->GetYmaxDefaultValue(HistoCode.Data()));
08382                                   XsupProj = GetYmaxValueFromMemo(HistoCode.Data());      
08383                                 }
08384                               if( fFlagUserHistoMin == "ON" ){XinfProj = fUserHistoMin;}
08385                               if( fFlagUserHistoMax == "ON" ){XsupProj = fUserHistoMax;}
08386                             }
08387 
08388                           if( opt_plot == fOnlyOnePlot || opt_plot == fSeveralPlot )
08389                             {
08390                               SetXinfMemoFromValue(HistoCode.Data(), XinfProj);
08391                               SetXsupMemoFromValue(HistoCode.Data(), XsupProj);                   
08392                             }
08393                           else
08394                             {
08395                               SetXinfMemoFromValue(XinfProj);
08396                               SetXsupMemoFromValue(XsupProj);
08397                             }
08398                         } // end of if( (opt_plot == fOnlyOnePlot) || 
08399                       // (opt_plot == fSeveralPlot  && GetMemoFlag(HistoCode, opt_plot) == "Free") ||
08400                       // (opt_plot == fSameOnePlot  && GetMemoFlag(HistoCode, opt_plot) == "Free") )
08401 
08402                       Double_t cXinf = (Double_t)0.;
08403                       Double_t cXsup = (Double_t)0.;
08404 
08405                       //.......... Set Xinf and Xsup at each time because of simultaneous SAME options    (ViewHistime)
08406                       if( opt_plot == fOnlyOnePlot || opt_plot == fSeveralPlot )
08407                         {
08408                           cXinf = GetXinfValueFromMemo(HistoCode.Data());
08409                           cXsup = GetXsupValueFromMemo(HistoCode.Data());
08410                         }
08411                       else
08412                         {
08413                           cXinf = GetXinfValueFromMemo();
08414                           cXsup = GetXsupValueFromMemo();
08415                         }
08416                       //....... In case of only one run: in order to have cXinf < cXsup for "EvolProj" plot
08417                       if( cXinf >= cXsup ){cXinf -= 1.; cXsup +=1.;}
08418 
08419                       //..............................  histogram booking (ViewHisto)
08420                       Axis_t xinf_his = cXinf;  // ancillary variables since no const in arguments of TH1D
08421                       Axis_t xsup_his = cXsup;
08422 
08423                       TString TitleHisto = ";";
08424                       if( opt_plot != fSameOnePlot )
08425                         {TitleHisto = fCnaParHistos->GetQuantityName(HistoCode.Data());}
08426 
08427                       //........ fill array histo_for_plot from hval_coordy                    (ViewHistime)
08428                       for(Int_t i_run=0; i_run<fNbOfExistingRuns; i_run++)
08429                         {
08430                           Double_t XFromYGraph = hval_coordy[i_run];
08431                           Double_t binXProjY = (Double_t)HisSizeEvolProj*(XFromYGraph - cXinf)/(cXsup - cXinf);
08432                           Int_t ibinXProjY = (Int_t)binXProjY;
08433                           if( ibinXProjY >= 0 && ibinXProjY<HisSizeEvolProj ){histo_for_plot[ibinXProjY]++;}
08434                         }
08435 
08436                       TH1D* h_his_evol_proj = new TH1D("histevolproj", TitleHisto.Data(),
08437                                                        HisSizeEvolProj, xinf_his, xsup_his); fCnewRoot++;
08438 
08439                       h_his_evol_proj->Reset();
08440 
08441                       //.... direct histogram filling                                                 (ViewHistime)
08442                       for(Int_t i=0; i<HisSizeEvolProj; i++)
08443                         {
08444                           Double_t yi = (Double_t)i/(Double_t)HisSizeEvolProj*(cXsup-cXinf) + cXinf;
08445                           Double_t his_val = (Double_t)histo_for_plot[i];
08446                           h_his_evol_proj->Fill(yi, his_val);
08447                         }
08448 
08449                       //------- 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
08450                       if( fUserHistoMin >= fUserHistoMax ){fFlagUserHistoMin = "AUTO"; fFlagUserHistoMax = "AUTO";}
08451                       //.......... user's value if flag set to "ON"
08452                       if( fFlagUserHistoMin == "ON" )
08453                         {SetYminMemoFromValue(HistoCode.Data(), fUserHistoMin); fFlagUserHistoMin = "OFF";}
08454                       if( fFlagUserHistoMax == "ON" )
08455                         {SetYmaxMemoFromValue(HistoCode.Data(), fUserHistoMax); fFlagUserHistoMax = "OFF";}
08456                       //................................. automatic min and/or max
08457                       if( fFlagUserHistoMin == "AUTO" )
08458                         {SetYminMemoFromValue(HistoCode.Data(), graph_ymin); fFlagUserHistoMin = "OFF";}
08459                       if( fFlagUserHistoMax == "AUTO" )
08460                         {SetYmaxMemoFromValue(HistoCode.Data(), graph_ymax); fFlagUserHistoMax = "OFF";}
08461 
08462                       //................................. Init Ymin and Ymax for graph
08463                       SetYminMemoFromPreviousMemo(HistoCode);
08464                       SetYmaxMemoFromPreviousMemo(HistoCode);
08465 
08466                       //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
08467                       //.......... Find maximum in case of Proj (LIN scale only) // PS: EvolProj => in ViewHistime
08468                       if( fFlagScaleY == "LIN" )
08469                         {
08470                           SetYmaxMemoFromValue
08471                             (HistoCode.Data(),
08472                              GetYmaxFromHistoFrameAndMarginValue(h_his_evol_proj, fCnaParHistos->GetMarginAutoMinMax()));
08473                         }
08474                       
08475                       //--- Set ymin and ymax to the first HistoCode values for option SAME n
08476                       if( opt_plot == fSameOnePlot && GetMemoFlag(HistoCode, opt_plot) == "Busy" )                
08477                         {
08478                           Double_t ymin = GetYminValueFromMemo(fHistoCodeFirst.Data());
08479                           SetYminMemoFromValue(HistoCode.Data(), ymin);
08480                           
08481                           Double_t ymax = GetYmaxValueFromMemo(fHistoCodeFirst.Data());
08482                           SetYmaxMemoFromValue(HistoCode.Data(), ymax);
08483                         }
08484                       //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
08485                       
08486                       //..... graph set ymin and ymax and consequently margin at top of the plot  
08487                       Int_t  xFlagAutoYsupMargin = SetGraphFrameYminYmaxFromMemo(g_graph0, HistoCode);
08488                       Int_t  arg_AlreadyRead = 0;
08489 
08490                       HistoPlot(h_his_evol_proj,  HisSizeEvolProj,
08491                                 xinf_his,         xsup_his,
08492                                 HistoCode.Data(), HistoType.Data(),
08493                                 StexStin_A,       i0StinEcha,       i0Sample,
08494                                 opt_scale_x,      opt_scale_y,      opt_plot, arg_AlreadyRead,
08495                                 xFlagAutoYsupMargin);
08496 
08497                       h_his_evol_proj->Delete();   h_his_evol_proj = 0;                         fCdeleteRoot++;
08498                       //*===> deleter l'histo sinon "Replacing existing histo (potential memory leak)" a l'execution
08499 
08500                     } // end of if( HistoType == "EvolProj" )
08501                   //---------------------------------------------------------------------------------- (ViewHistime)
08502 
08503                   delete [] time_coordx;   time_coordx = 0;      fCdelete++;   
08504                   delete [] hval_coordy;   hval_coordy = 0;      fCdelete++;  
08505                 }
08506               else
08507                 {
08508                   cout << "!TEcnaHistos::ViewHistime(...)> The list of runs in file: " << list_of_run_file_name 
08509                        << " has " << nb_of_runs_in_list << " run numbers" << endl
08510                        << " but none of them correspond to an existing ROOT file."
08511                        << fTTBELL << endl;
08512                 }
08513             } // end of if( fFapStexNumber > 0 )
08514           else
08515             {
08516               cout << "!TEcnaHistos::ViewHistime(...)> *ERROR* =====> "
08517                    << fFapStexName << " number = " << fFapStexNumber << ". "
08518                    << fFapStexName << " number must be in range [1," << fEcal->MaxStexInStas() << "] ";
08519               if( fFlagSubDet == "EB" ){cout << " (or [-18,+18])";}
08520                 cout << fTTBELL << endl;
08521             }
08522           delete [] exist_indic;  exist_indic = 0;         fCdelete++;
08523         } // end of if( nb_of_runs_in_list > 0 )
08524       else
08525         {
08526           if( nb_of_runs_in_list == 0 )
08527             {
08528               cout << "!TEcnaHistos::ViewHistime(...)> The list of runs in file: " << list_of_run_file_name
08529                    << " is empty !" << fTTBELL << endl;
08530             }
08531           if( nb_of_runs_in_list < 0 )
08532             {
08533               cout << "!TEcnaHistos::ViewHistime(...)> " << list_of_run_file_name
08534                    << ": file not found in directory: " << fCfgHistoryRunListFilePath.Data() << fTTBELL << endl;
08535             }
08536         }
08537     }  // end of if( OKHisto == 1 )
08538 } // end of ViewHistime
08539 
08540 //------------------------------------------------------------------------------------
08541 //
08542 //      GetHistoryRunListParameters(...), AllocArraysForEvol(), GetListFileNumber(...)
08543 //
08544 //------------------------------------------------------------------------------------
08545 
08546 Int_t TEcnaHistos::GetHistoryRunListParameters(const TString list_of_run_file_name, const TString HistoCode)
08547 {
08548   // Build the array of run numbers from the list-of-runs .ascii file.
08549   // Return the list size
08550   // *=====> list_of_run_file_name is the name of the ASCII file containing the list of the runs
08551   //
08552   // SYNTAX OF THE FILE:
08553   //
08554   // HistoryRunList_EB_SM6_Analysis_1.ascii    <- 1rst line: comment (file name for example)
08555   // 73677                                 <- 2nd  line and others: run numbers (empty lines accepted)
08556   // 73688          
08557   // 73689
08558   //
08559   // 73690
08560   // 73692 
08561   //
08562   // In option SAME (of TEcnaHistos), several lists of runs can be called and these lists can have
08563   // DIFFERENT sizes (here the "size" is the number of runs of the list). In addition,
08564   // some runs in some lists may not exist in reality. So, we must adopt a convention which is
08565   // the following: the number of runs corresponds to the number of EXISTING runs
08566   // of the FIRST read list. Let be N1 this number.
08567   // If another list has more runs than N1 runs, we read only the first N1 runs.
08568   // If another list has less runs than N1 runs, we read all the runs of this list. 
08569   //
08570   //--------------------------------------------------------------------------------------------------
08571 
08572   Int_t nb_of_runs_in_list = 0;
08573   
08574   //========= immediate return if file name is an empty string
08575   if( list_of_run_file_name.Data() == '\0' )
08576     {
08577       cout << "!TEcnaHistos::GetHistoryRunListParameters(...)> *** ERROR *** =====> "
08578            << " EMPTY STRING for list of run file name." << fTTBELL << endl;
08579     }
08580   else
08581     {
08582       // ===> increase the HistoryRunList file number
08583       if ( HistoCode == "H_Ped_Date" ){fNbOfListFileH_Ped_Date++;}
08584       if ( HistoCode == "H_TNo_Date" ){fNbOfListFileH_TNo_Date++;}
08585       if ( HistoCode == "H_MCs_Date" ){fNbOfListFileH_MCs_Date++;}
08586       if ( HistoCode == "H_LFN_Date" ){fNbOfListFileH_LFN_Date++;}
08587       if ( HistoCode == "H_HFN_Date" ){fNbOfListFileH_HFN_Date++;}
08588       if ( HistoCode == "H_SCs_Date" ){fNbOfListFileH_SCs_Date++;}
08589 
08590       if ( HistoCode == "H_Ped_RuDs" ){fNbOfListFileH_Ped_RuDs++;}
08591       if ( HistoCode == "H_TNo_RuDs" ){fNbOfListFileH_TNo_RuDs++;}
08592       if ( HistoCode == "H_MCs_RuDs" ){fNbOfListFileH_MCs_RuDs++;}
08593       if ( HistoCode == "H_LFN_RuDs" ){fNbOfListFileH_LFN_RuDs++;}
08594       if ( HistoCode == "H_HFN_RuDs" ){fNbOfListFileH_HFN_RuDs++;}
08595       if ( HistoCode == "H_SCs_RuDs" ){fNbOfListFileH_SCs_RuDs++;}
08596       
08597       fFapFileRuns = list_of_run_file_name.Data();    // (short name)
08598       
08599       //........... Add the path to the file name           ( GetHistoryRunListParameters )
08600       TString xFileNameRunList = list_of_run_file_name.Data();
08601       const Text_t *t_file_name = (const Text_t *)xFileNameRunList.Data();
08602 
08603       //.............. replace the string "$HOME" by the true $HOME path
08604       if(fCfgHistoryRunListFilePath.BeginsWith("$HOME"))
08605         {
08606           fCfgHistoryRunListFilePath.Remove(0,5);
08607           const Text_t *t_file_nohome = (const Text_t *)fCfgHistoryRunListFilePath.Data(); //  /scratch0/cna/...
08608           
08609           TString home_path = gSystem->Getenv("HOME");
08610           fCfgHistoryRunListFilePath = home_path;             //  /afs/cern.ch/u/USER
08611           fCfgHistoryRunListFilePath.Append(t_file_nohome);   //  /afs/cern.ch/u/USER/scratch0/cna/...
08612         }
08613      
08614       xFileNameRunList = fCfgHistoryRunListFilePath.Data();
08615       
08616       xFileNameRunList.Append('/');
08617       xFileNameRunList.Append(t_file_name);
08618       
08619       fFcin_f.open(xFileNameRunList.Data());
08620 
08621       //.......................................           ( GetHistoryRunListParameters )
08622       if( fFcin_f.fail() == kFALSE )
08623         {   
08624           //...................................... first reading to get the number of runs in the list
08625           fFcin_f.clear();
08626           string xHeadComment;
08627           fFcin_f >> xHeadComment;
08628           Int_t cRunNumber;
08629           Int_t list_size_read = 0;
08630           
08631           while( !fFcin_f.eof() ){fFcin_f >> cRunNumber; list_size_read++;}
08632           fFapNbOfRuns = list_size_read - 1;
08633 
08634           //...................................... second reading to get the run numbers
08635 
08636           //====== Return to the beginning of the file =====
08637           fFcin_f.clear();
08638           fFcin_f.seekg(0, ios::beg);
08639           //================================================
08640 
08641           string yHeadComment;
08642           fFcin_f >> yHeadComment;
08643 
08644           //....................... Set fFapMaxNbOfRuns to -1 at first call (first read file)
08645           //
08646           //                        fNbOfListFileEvolXXX is initialized to 0 in Init()
08647           //                        It is incremented once here above
08648           //                        So, at first call fNbOfListFileEvolXXX = 1
08649           //                        then fFapMaxNbOfRuns = -1
08650           //..........................................................................   (GetHistoryRunListParameters)
08651           if( (HistoCode == "H_Ped_Date" && fNbOfListFileH_Ped_Date == 1) || 
08652               (HistoCode == "H_TNo_Date" && fNbOfListFileH_TNo_Date == 1) ||
08653               (HistoCode == "H_MCs_Date" && fNbOfListFileH_MCs_Date == 1) ||
08654               (HistoCode == "H_LFN_Date" && fNbOfListFileH_LFN_Date == 1) || 
08655               (HistoCode == "H_HFN_Date" && fNbOfListFileH_HFN_Date == 1) ||
08656               (HistoCode == "H_SCs_Date" && fNbOfListFileH_SCs_Date == 1) ||
08657               (HistoCode == "H_Ped_RuDs" && fNbOfListFileH_Ped_RuDs == 1) || 
08658               (HistoCode == "H_TNo_RuDs" && fNbOfListFileH_TNo_RuDs == 1) ||
08659               (HistoCode == "H_MCs_RuDs" && fNbOfListFileH_MCs_RuDs == 1) ||
08660               (HistoCode == "H_LFN_RuDs" && fNbOfListFileH_LFN_RuDs == 1) || 
08661               (HistoCode == "H_HFN_RuDs" && fNbOfListFileH_HFN_RuDs == 1) ||
08662               (HistoCode == "H_SCs_RuDs" && fNbOfListFileH_SCs_RuDs == 1)){fFapMaxNbOfRuns = -1;}
08663           
08664           // first call: fFapMaxNbOfRuns = fFapNbOfRuns = nb of run from the first reading 
08665           if( fFapMaxNbOfRuns == -1 ){fFapMaxNbOfRuns = fFapNbOfRuns;}
08666           // next calls: fFapNbOfRuns must not be greater than fFapMaxNbOfRuns found at first time
08667           else{if( fFapNbOfRuns > fFapMaxNbOfRuns ){fFapNbOfRuns = fFapMaxNbOfRuns;}}
08668 
08669           // Allocation and initialization of the array fT1DRunNumber[].
08670           //................. check maximum value for allocation
08671           if( fFapMaxNbOfRuns > fCnaParHistos->MaxNbOfRunsInLists() )
08672             {
08673               cout << "TEcnaHistos::GetHistoryRunListParameters(...)> Max number of runs in HistoryRunList = "
08674                    << fFapMaxNbOfRuns
08675                    << " too large, forced to parameter TEcnaParHistos->fMaxNbOfRunsInLists value (= "
08676                    << fCnaParHistos->MaxNbOfRunsInLists()
08677                    << "). Please, set this parameter to a larger value than " << fFapMaxNbOfRuns
08678                    << fTTBELL << endl;
08679               fFapMaxNbOfRuns = fCnaParHistos->MaxNbOfRunsInLists();
08680             }
08681           //................................. Alloc of the array and init
08682           if( fT1DRunNumber == 0 )
08683             {
08684               if( fFapMaxNbOfRuns > 0 )
08685                 {
08686                   fT1DRunNumber = new Int_t[fFapMaxNbOfRuns];               fCnew++;
08687                 }
08688               else
08689                 {
08690                   cout << "!TEcnaHistos::GetHistoryRunListParameters(...)> *** ERROR *** =====> fFapMaxNbOfRuns = "
08691                        << fFapMaxNbOfRuns << ". Forced to 1." << fTTBELL << endl;
08692                   fFapMaxNbOfRuns = 1;
08693                   fT1DRunNumber = new Int_t[fFapMaxNbOfRuns];               fCnew++;
08694                 }
08695             }
08696 
08697 
08698           //.................................... Init the list of runs    
08699           for ( Int_t i_run = 0; i_run < fFapMaxNbOfRuns; i_run++ ){fT1DRunNumber[i_run] = -1;}
08700           //.................................... read the list of runs
08701           for (Int_t i_list = 0; i_list < fFapNbOfRuns; i_list++)
08702             {
08703               fFcin_f >> cRunNumber;
08704               fT1DRunNumber[i_list] = cRunNumber;
08705             }
08706           //........................................           ( GetHistoryRunListParameters )
08707           nb_of_runs_in_list = fFapNbOfRuns;
08708           fFcin_f.close();
08709         }
08710       else
08711         {
08712           fFcin_f.clear();
08713           cout << "!TEcnaHistos::GetHistoryRunListParameters(...)> *** ERROR *** =====> "
08714                << xFileNameRunList.Data() << " : file not found." << fTTBELL << endl;
08715           nb_of_runs_in_list = -1;
08716         }
08717     }
08718   return nb_of_runs_in_list;
08719 }
08720 //   end of GetHistoryRunListParameters(...)
08721 
08722 //------------------------------------------------------------------------------------------------
08723 
08724 Int_t TEcnaHistos::GetListFileNumber(const TString HistoCode)
08725 {
08726 // Get the number of the read list file
08727   
08728   Int_t number = 0;
08729 
08730   if ( HistoCode == "H_Ped_Date"){number = fNbOfListFileH_Ped_Date;}
08731   if ( HistoCode == "H_TNo_Date"){number = fNbOfListFileH_TNo_Date;}
08732   if ( HistoCode == "H_MCs_Date"){number = fNbOfListFileH_MCs_Date;}
08733   if ( HistoCode == "H_LFN_Date"){number = fNbOfListFileH_LFN_Date;}
08734   if ( HistoCode == "H_HFN_Date"){number = fNbOfListFileH_HFN_Date;}
08735   if ( HistoCode == "H_SCs_Date"){number = fNbOfListFileH_SCs_Date;}
08736   if ( HistoCode == "H_Ped_RuDs"){number = fNbOfListFileH_Ped_RuDs;}
08737   if ( HistoCode == "H_TNo_RuDs"){number = fNbOfListFileH_TNo_RuDs;}
08738   if ( HistoCode == "H_MCs_RuDs"){number = fNbOfListFileH_MCs_RuDs;}
08739   if ( HistoCode == "H_LFN_RuDs"){number = fNbOfListFileH_LFN_RuDs;}
08740   if ( HistoCode == "H_HFN_RuDs"){number = fNbOfListFileH_HFN_RuDs;}
08741   if ( HistoCode == "H_SCs_RuDs"){number = fNbOfListFileH_SCs_RuDs;}
08742   return number;
08743 }
08744 
08745 //--------------------------------------------------------------------------------------------------
08746 void TEcnaHistos::SetRunNumberFromList(const Int_t& xArgIndexRun, const Int_t& MaxNbOfRuns)
08747 {
08748   // Set run number for the xArgIndexRun_th run in the list of runs (evolution plots)
08749   //     The array fT1DRunNumber[] have been obtained from a previous call
08750   //     to GetHistoryRunListParameters(xFileNameRunList, HistoCode)
08751   
08752   if( xArgIndexRun >= 0 && xArgIndexRun < MaxNbOfRuns)
08753     {
08754       fFapRunNumber  = fT1DRunNumber[xArgIndexRun];
08755       if( xArgIndexRun == 0 ){InitSpecParBeforeFileReading();} // SpecPar = Special Parameters (dates, times, run types)
08756     }
08757   else
08758     {
08759       cout << "!TEcnaHistos::SetRunNumberFromList(...)> **** ERROR **** Run index out of range in list of runs. xArgIndexRun = "
08760            << xArgIndexRun << " (MaxNbOfRuns = "<< MaxNbOfRuns << ")" << endl;
08761     }
08762 }
08763 
08764 //--------------------------------------------------------------------------------------------------
08765 void TEcnaHistos::InitSpecParBeforeFileReading()
08766 {
08767   // Init parameters that will be set by reading the info which are in the results ROOT file
08768   // SpecPar = Special Parameters (dates, times, run types)
08769 
08770   Int_t MaxCar = fgMaxCar;
08771   fStartDate.Resize(MaxCar);
08772   fStartDate = "(date not found)";
08773 
08774   MaxCar = fgMaxCar;
08775   fStopDate.Resize(MaxCar);
08776   fStopDate  = "(date not found)";
08777 
08778   fStartTime = (time_t)0;
08779   fStopTime  = (time_t)0;
08780 
08781   fRunType   = "(run type not found)";
08782 
08783 } // ------------- ( end of InitSpecParBeforeFileReading() ) -------------
08784 
08785 //======================================================================================
08786 //
08787 //           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 
08788 //
08789 //======================================================================================
08790 
08791 Bool_t TEcnaHistos::GetOkViewHisto(TEcnaRead*    aMyRootFile,
08792                                    const Int_t&  StexStin_A, const Int_t& i0StinEcha, const Int_t& i0Sample,
08793                                    const TString HistoCode)
08794 {
08795 // Check possibility to plot the histo
08796 
08797   Bool_t ok_view_histo = kFALSE;
08798 
08799   TString HistoType = fCnaParHistos->GetHistoType(HistoCode);
08800 
08801   TString root_file_name = aMyRootFile->GetRootFileNameShort();
08802 
08803   TVectorD  vStin(fEcal->MaxStinEcnaInStex());
08804   for(Int_t i=0; i<fEcal->MaxStinEcnaInStex() ; i++){vStin(i)=(Double_t)0.;}
08805   vStin = aMyRootFile->ReadStinNumbers(fEcal->MaxStinEcnaInStex());
08806 
08807   if( aMyRootFile->DataExist() == kTRUE )
08808     {
08809       fStatusDataExist = kTRUE;
08810 
08811       Int_t Stin_ok = 0;
08812       for (Int_t index_Stin = 0; index_Stin < fEcal->MaxStinEcnaInStex(); index_Stin++)
08813         {
08814           if ( vStin(index_Stin) == StexStin_A ){Stin_ok++;};
08815         }
08816       
08817       //.............................................. ok_view   
08818       Int_t ok_view    = 1;
08819       
08820       if( !( HistoType == "Global" || HistoType == "Proj" )  )
08821         {
08822           if( Stin_ok != 1)
08823           {
08824             Int_t StinNumber = StexStin_A;
08825             if( fFlagSubDet == "EE" )
08826               {StinNumber = fEcalNumbering->GetDeeSCConsFrom1DeeSCEcna(fFapStexNumber, StexStin_A);}
08827             cout << "!TEcnaHistos::GetOkViewHisto(...)> *ERROR* =====> " << "File: " << root_file_name
08828                  << ", " << fFapStinName.Data() << " "
08829                  << StinNumber
08830                  << " not found. Available numbers = ";
08831             for(Int_t i = 0; i < fEcal->MaxStinEcnaInStex(); i++)
08832               {
08833                 if( vStin(i) > 0 )
08834                   {
08835                     if( fFlagSubDet == "EB" ){cout << vStin(i) << ", ";}
08836                     if( fFlagSubDet == "EE" )
08837                       {cout << fEcalNumbering->GetDeeSCConsFrom1DeeSCEcna(fFapStexNumber, (Int_t)vStin(i)) << ", ";}
08838                   }
08839               }
08840             cout << fTTBELL << endl;
08841             ok_view = -1;
08842           }
08843           else 
08844             { 
08845               ok_view = 1;
08846             }
08847         }
08848       
08849       //.............................................. ok_max_elt   ( GetOkViewHisto(...) )
08850       Int_t ok_max_elt  = 1;
08851       
08852       if( ( ( (HistoType == "H1Basic") || (HistoType == "Evol") || (HistoType == "EvolProj") )
08853             && (i0StinEcha >= 0) && (i0StinEcha<fEcal->MaxCrysInStin()) 
08854             && (i0Sample  >= 0) && (i0Sample <fFapNbOfSamples ) ) ||
08855           !( (HistoType == "H1Basic") || (HistoType == "Evol") || (HistoType == "EvolProj") ))
08856         {ok_max_elt = 1;} 
08857       else
08858         {
08859           Int_t Choffset = 0;
08860           if( fFlagSubDet == "EE" ){Choffset = 1;}
08861           if( ( (HistoType == "H1Basic") || (HistoType == "Evol") || (HistoType == "EvolProj") )
08862               && !( (i0StinEcha >= 0) && (i0StinEcha<fEcal->MaxCrysInStin()) ) )
08863             {cout << "!TEcnaHistos::GetOkViewHisto(...)> *ERROR* =====> " << "File: " << root_file_name
08864                   << ". Wrong channel number. Value = " << i0StinEcha << " (required range: [" << Choffset << ", "
08865                   << fEcal->MaxCrysInStin()-1+Choffset << "] )"
08866                   << fTTBELL << endl;}
08867           if( (HistoCode == "D_Adc_EvDs" || HistoCode == "D_Adc_EvNb") &&
08868               !((i0Sample >= 0) && (i0Sample <fFapNbOfSamples)) )
08869             {cout << "!TEcnaHistos::GetOkViewHisto(...)> *ERROR* =====> " << "File: " << root_file_name
08870                   << ". Wrong sample index. Value = " << i0Sample << " (required range: [0, "
08871                   << fFapNbOfSamples-1 << "] )"
08872                   << fTTBELL << endl;}
08873           ok_max_elt = -1;
08874         }
08875       
08876       if( (ok_view == 1) && (ok_max_elt == 1) )
08877         {
08878           ok_view_histo = kTRUE;
08879         }
08880       else
08881         {
08882           cout << "!TEcnaHistos::GetOkViewHisto(...)> At least one ERROR has been detected. ok_view = " << ok_view
08883                << ", ok_max_elt = " << ok_max_elt << fTTBELL << endl;
08884         }
08885     }
08886   else
08887     {
08888       fStatusDataExist = kFALSE;
08889 
08890       cout << "!TEcnaHistos::GetOkViewHisto(...)> No data in ROOT file "
08891            << ", aMyRootFile->DataExist() = " << aMyRootFile->DataExist() << fTTBELL << endl;
08892     }
08893   return ok_view_histo;
08894 }
08895 //..............................................................................................
08896 
08897 Int_t TEcnaHistos::SetHistoFrameYminYmaxFromMemo(TH1D* h_his0, const TString HistoCode)
08898 {
08899 // Set min and max according to HistoCode
08900   
08901   // if Ymin = Ymax (or Ymin > Ymax): nothing done here
08902   // return xFlagAutoYsupMargin = 1
08903   //
08904   // if Ymin < Ymax: min and max calculated by h_his0->SetMinimum() and h_his0->SetMaximum()
08905   // return xFlagAutoYsupMargin = 0
08906 
08907   Int_t xFlagAutoYsupMargin = 1;                             //  (SetHistoFrameYminYmaxFromMemo)
08908   
08909   if(HistoCode == "D_NOE_ChNb"){ 
08910     if(fD_NOE_ChNbYmin < fD_NOE_ChNbYmax){xFlagAutoYsupMargin = 0;
08911     h_his0->SetMinimum(fD_NOE_ChNbYmin);  h_his0->SetMaximum(fD_NOE_ChNbYmax);}}
08912   
08913   if(HistoCode == "D_NOE_ChDs"){
08914     if(fD_NOE_ChDsYmin < fD_NOE_ChDsYmax){xFlagAutoYsupMargin = 0;
08915     h_his0->SetMinimum(fD_NOE_ChDsYmin); h_his0->SetMaximum(fD_NOE_ChDsYmax);}}
08916   
08917   if(HistoCode == "D_Ped_ChNb"){
08918     if(fD_Ped_ChNbYmin < fD_Ped_ChNbYmax){xFlagAutoYsupMargin = 0;
08919         h_his0->SetMinimum(fD_Ped_ChNbYmin);  h_his0->SetMaximum(fD_Ped_ChNbYmax);}}
08920   
08921   if(HistoCode == "D_Ped_ChDs"){
08922     if(fD_Ped_ChDsYmin < fD_Ped_ChDsYmax){xFlagAutoYsupMargin = 0;
08923     h_his0->SetMinimum(fD_Ped_ChDsYmin); h_his0->SetMaximum(fD_Ped_ChDsYmax);}}
08924   
08925   if(HistoCode == "D_TNo_ChNb"){
08926     if(fD_TNo_ChNbYmin < fD_TNo_ChNbYmax){xFlagAutoYsupMargin = 0;
08927     h_his0->SetMinimum(fD_TNo_ChNbYmin); h_his0->SetMaximum(fD_TNo_ChNbYmax);}}
08928   
08929   if(HistoCode == "D_TNo_ChDs"){
08930     if(fD_TNo_ChDsYmin < fD_TNo_ChDsYmax){xFlagAutoYsupMargin = 0;
08931     h_his0->SetMinimum(fD_TNo_ChDsYmin); h_his0->SetMaximum(fD_TNo_ChDsYmax);}}
08932   
08933   if(HistoCode == "D_MCs_ChNb"){
08934     if(fD_MCs_ChNbYmin < fD_MCs_ChNbYmax){xFlagAutoYsupMargin = 0;
08935     h_his0->SetMinimum(fD_MCs_ChNbYmin); h_his0->SetMaximum(fD_MCs_ChNbYmax);}}
08936   
08937   if(HistoCode == "D_MCs_ChDs"){
08938     if(fD_MCs_ChDsYmin < fD_MCs_ChDsYmax){xFlagAutoYsupMargin = 0;
08939     h_his0->SetMinimum(fD_MCs_ChDsYmin); h_his0->SetMaximum(fD_MCs_ChDsYmax);}}
08940   
08941   if(HistoCode == "D_LFN_ChNb"){
08942     if(fD_LFN_ChNbYmin < fD_LFN_ChNbYmax){xFlagAutoYsupMargin = 0;
08943     h_his0->SetMinimum(fD_LFN_ChNbYmin); h_his0->SetMaximum(fD_LFN_ChNbYmax);}}
08944   
08945   if(HistoCode == "D_LFN_ChDs"){
08946     if(fD_LFN_ChDsYmin < fD_LFN_ChDsYmax){xFlagAutoYsupMargin = 0;
08947     h_his0->SetMinimum(fD_LFN_ChDsYmin); h_his0->SetMaximum(fD_LFN_ChDsYmax);}}
08948   
08949   if(HistoCode == "D_HFN_ChNb"){
08950     if(fD_HFN_ChNbYmin < fD_HFN_ChNbYmax){xFlagAutoYsupMargin = 0;
08951     h_his0->SetMinimum(fD_HFN_ChNbYmin); h_his0->SetMaximum(fD_HFN_ChNbYmax);}}
08952   
08953   if(HistoCode == "D_HFN_ChDs"){
08954     if(fD_HFN_ChDsYmin < fD_HFN_ChDsYmax){xFlagAutoYsupMargin = 0;
08955     h_his0->SetMinimum(fD_HFN_ChDsYmin); h_his0->SetMaximum(fD_HFN_ChDsYmax);}}
08956 
08957   if(HistoCode == "D_SCs_ChNb"){
08958     if(fD_SCs_ChNbYmin < fD_SCs_ChNbYmax){xFlagAutoYsupMargin = 0;
08959     h_his0->SetMinimum(fD_SCs_ChNbYmin); h_his0->SetMaximum(fD_SCs_ChNbYmax);}}
08960   
08961   if(HistoCode == "D_SCs_ChDs"){
08962     if(fD_SCs_ChDsYmin < fD_SCs_ChDsYmax){xFlagAutoYsupMargin = 0;
08963     h_his0->SetMinimum(fD_SCs_ChDsYmin); h_his0->SetMaximum(fD_SCs_ChDsYmax);}}
08964   
08965   if(HistoCode == "D_MSp_SpNb"){
08966     if(fD_MSp_SpNbYmin < fD_MSp_SpNbYmax){xFlagAutoYsupMargin = 0;
08967     h_his0->SetMinimum(fD_MSp_SpNbYmin); h_his0->SetMaximum(fD_MSp_SpNbYmax);}}
08968    
08969   if(HistoCode == "D_MSp_SpDs"){
08970     if(fD_MSp_SpDsYmin < fD_MSp_SpDsYmax){xFlagAutoYsupMargin = 0;
08971     h_his0->SetMinimum(fD_MSp_SpDsYmin); h_his0->SetMaximum(fD_MSp_SpDsYmax);}}
08972    
08973   if(HistoCode == "D_SSp_SpNb"){
08974     if(fD_SSp_SpNbYmin < fD_SSp_SpNbYmax){xFlagAutoYsupMargin = 0;
08975     h_his0->SetMinimum(fD_SSp_SpNbYmin); h_his0->SetMaximum(fD_SSp_SpNbYmax);}}
08976    
08977   if(HistoCode == "D_SSp_SpDs"){
08978     if(fD_SSp_SpDsYmin < fD_SSp_SpDsYmax){xFlagAutoYsupMargin = 0;
08979     h_his0->SetMinimum(fD_SSp_SpDsYmin); h_his0->SetMaximum(fD_SSp_SpDsYmax);}}
08980   
08981   if(HistoCode == "D_Adc_EvNb"){
08982     if(fD_Adc_EvNbYmin < fD_Adc_EvNbYmax){xFlagAutoYsupMargin = 0;
08983     h_his0->SetMinimum(fD_Adc_EvNbYmin); h_his0->SetMaximum(fD_Adc_EvNbYmax);}}
08984 
08985   if(HistoCode == "D_Adc_EvDs"){
08986     if(fD_Adc_EvDsYmin < fD_Adc_EvDsYmax){xFlagAutoYsupMargin = 0;
08987     h_his0->SetMinimum(fD_Adc_EvDsYmin); h_his0->SetMaximum(fD_Adc_EvDsYmax);}}
08988 
08989   if(HistoCode == "H2CorccInStins"){
08990     if(fH2CorccInStinsYmin < fH2CorccInStinsYmax){xFlagAutoYsupMargin = 0;
08991     h_his0->SetMinimum(fH2CorccInStinsYmin); h_his0->SetMaximum(fH2CorccInStinsYmax);}}
08992 
08993   if(HistoCode == "H2LFccMosMatrix"){
08994     if(fH2LFccMosMatrixYmin < fH2LFccMosMatrixYmax){xFlagAutoYsupMargin = 0;
08995     h_his0->SetMinimum(fH2LFccMosMatrixYmin); h_his0->SetMaximum(fH2LFccMosMatrixYmax);}}
08996 
08997   if(HistoCode == "H2HFccMosMatrix"){
08998     if(fH2HFccMosMatrixYmin < fH2HFccMosMatrixYmax){xFlagAutoYsupMargin = 0;
08999     h_his0->SetMinimum(fH2HFccMosMatrixYmin); h_his0->SetMaximum(fH2HFccMosMatrixYmax);}}
09000 
09001   if(HistoCode == "H_Ped_RuDs"){
09002     if(fH_Ped_RuDsYmin < fH_Ped_RuDsYmax){xFlagAutoYsupMargin = 0;
09003     h_his0->SetMinimum(fH_Ped_RuDsYmin); h_his0->SetMaximum(fH_Ped_RuDsYmax);}}
09004 
09005   if(HistoCode == "H_TNo_RuDs"){
09006     if(fH_TNo_RuDsYmin < fH_TNo_RuDsYmax){xFlagAutoYsupMargin = 0;
09007     h_his0->SetMinimum(fH_TNo_RuDsYmin); h_his0->SetMaximum(fH_TNo_RuDsYmax);}}
09008 
09009   if(HistoCode == "H_MCs_RuDs"){
09010     if(fH_MCs_RuDsYmin < fH_MCs_RuDsYmax){xFlagAutoYsupMargin = 0;
09011     h_his0->SetMinimum(fH_MCs_RuDsYmin); h_his0->SetMaximum(fH_MCs_RuDsYmax);}}
09012 
09013   if(HistoCode == "H_LFN_RuDs"){
09014     if(fH_LFN_RuDsYmin < fH_LFN_RuDsYmax){xFlagAutoYsupMargin = 0;
09015     h_his0->SetMinimum(fH_LFN_RuDsYmin); h_his0->SetMaximum(fH_LFN_RuDsYmax);}}
09016 
09017   if(HistoCode == "H_HFN_RuDs"){
09018     if(fH_HFN_RuDsYmin < fH_HFN_RuDsYmax){xFlagAutoYsupMargin = 0;
09019     h_his0->SetMinimum(fH_HFN_RuDsYmin); h_his0->SetMaximum(fH_HFN_RuDsYmax);}}
09020 
09021   if(HistoCode == "H_SCs_RuDs"){
09022     if(fH_SCs_RuDsYmin < fH_SCs_RuDsYmax){xFlagAutoYsupMargin = 0;
09023     h_his0->SetMinimum(fH_SCs_RuDsYmin); h_his0->SetMaximum(fH_SCs_RuDsYmax);}}
09024 
09025   return xFlagAutoYsupMargin;  
09026 } // end of  SetHistoFrameYminYmaxFromMemo
09027 
09028 Int_t TEcnaHistos::SetGraphFrameYminYmaxFromMemo(TGraph* g_graph0, const TString HistoCode)
09029 {
09030 // Set min and max according to HistoCode
09031   
09032   Int_t xFlagAutoYsupMargin = 1;    // DEFAULT: 1 = min and max calulated by ROOT, 0 = by this code 
09033 
09034   if(HistoCode == "H_Ped_Date"){
09035     if(fH_Ped_DateYmin < fH_Ped_DateYmax){xFlagAutoYsupMargin = 0;
09036     g_graph0->SetMinimum(fH_Ped_DateYmin); g_graph0->SetMaximum(fH_Ped_DateYmax);}}
09037 
09038   if(HistoCode == "H_TNo_Date"){
09039     if(fH_TNo_DateYmin < fH_TNo_DateYmax){xFlagAutoYsupMargin = 0;
09040     g_graph0->SetMinimum(fH_TNo_DateYmin); g_graph0->SetMaximum(fH_TNo_DateYmax);}}
09041 
09042   if(HistoCode == "H_MCs_Date"){
09043     if(fH_MCs_DateYmin < fH_MCs_DateYmax){xFlagAutoYsupMargin = 0;
09044     g_graph0->SetMinimum(fH_MCs_DateYmin); g_graph0->SetMaximum(fH_MCs_DateYmax);}}
09045 
09046   if(HistoCode == "H_LFN_Date"){
09047     if(fH_LFN_DateYmin < fH_LFN_DateYmax){xFlagAutoYsupMargin = 0;
09048     g_graph0->SetMinimum(fH_LFN_DateYmin); g_graph0->SetMaximum(fH_LFN_DateYmax);}}
09049 
09050   if(HistoCode == "H_HFN_Date"){
09051     if(fH_HFN_DateYmin < fH_HFN_DateYmax){xFlagAutoYsupMargin = 0;
09052     g_graph0->SetMinimum(fH_HFN_DateYmin); g_graph0->SetMaximum(fH_HFN_DateYmax);}}
09053 
09054   if(HistoCode == "H_SCs_Date"){
09055     if(fH_SCs_DateYmin < fH_SCs_DateYmax){xFlagAutoYsupMargin = 0;
09056     g_graph0->SetMinimum(fH_SCs_DateYmin); g_graph0->SetMaximum(fH_SCs_DateYmax);}}
09057 
09058   return xFlagAutoYsupMargin;  
09059 } // end of SetGraphFrameYminYmaxFromMemo
09060 
09061 //..............................................................................................
09062 Double_t TEcnaHistos::GetYminFromHistoFrameAndMarginValue(TH1D* h_his0, const Double_t margin_factor)
09063 {
09064 //Calculation for automatic minimum with margin
09065   Double_t minproj = h_his0->GetMinimum();
09066   Double_t maxproj = h_his0->GetMaximum();
09067   minproj = minproj - (maxproj-minproj)*margin_factor;
09068   return minproj;
09069 }
09070 
09071 Double_t TEcnaHistos::GetYmaxFromHistoFrameAndMarginValue(TH1D* h_his0, const Double_t margin_factor)
09072 {
09073 //Calculation for automatic maximum with margin
09074   Double_t minproj = h_his0->GetMinimum();
09075   Double_t maxproj = h_his0->GetMaximum();
09076   maxproj = maxproj + (maxproj-minproj)*margin_factor;
09077   return maxproj;
09078 }
09079 
09080 Double_t TEcnaHistos::GetYminFromGraphFrameAndMarginValue(TGraph* g_graph0, const Double_t margin_factor)
09081 {
09082 //Calculation for automatic minimum with margin
09083   Double_t graph_ymin = g_graph0->GetY()[0];
09084   for(Int_t i=1; i<g_graph0->GetN(); i++)
09085     {if( g_graph0->GetY()[i] < graph_ymin ){graph_ymin = g_graph0->GetY()[i];}}
09086 
09087   Double_t graph_ymax = g_graph0->GetY()[0];
09088   for(Int_t i=1; i<g_graph0->GetN(); i++)
09089     {if( g_graph0->GetY()[i] > graph_ymax ){graph_ymax = g_graph0->GetY()[i];}}
09090 
09091   graph_ymin = graph_ymin - (graph_ymax-graph_ymin)*margin_factor;
09092   return graph_ymin;
09093 }
09094 Double_t TEcnaHistos::GetYmaxFromGraphFrameAndMarginValue(TGraph* g_graph0, const Double_t margin_factor)
09095 {
09096 //Calculation for automatic maximum 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_ymax = graph_ymax + (graph_ymax-graph_ymin)*margin_factor;
09106   return graph_ymax;
09107 }
09108 //----------------------------------------------- HistoPlot
09109 
09110 void TEcnaHistos::HistoPlot(TH1D* h_his0,               const Int_t&   HisSize,  
09111                             const Axis_t& xinf_his,     const Axis_t&  xsup_his,
09112                             const TString HistoCode,    const TString  HistoType,
09113                             const Int_t&  StexStin_A,   const Int_t&   i0StinEcha,  const Int_t& i0Sample, 
09114                             const Int_t&  opt_scale_x,  const Int_t&   opt_scale_y,
09115                             const TString opt_plot,     const Int_t&   arg_AlreadyRead,
09116                             const Int_t&  xFlagAutoYsupMargin)
09117 {
09118   // Plot 1D histogram
09119 
09120   UInt_t canv_w = fCnaParHistos->SetCanvasWidth(HistoCode.Data(), opt_plot);
09121   UInt_t canv_h = fCnaParHistos->SetCanvasHeight(HistoCode.Data(), opt_plot);
09122 
09123   TString QuantityName = "                                ";
09124   Int_t MaxCar = fgMaxCar;
09125   QuantityName.Resize(MaxCar);
09126   QuantityName = fCnaParHistos->GetQuantityName(HistoCode.Data());
09127 
09128 
09129   if( arg_AlreadyRead == 0 || arg_AlreadyRead == 1 )
09130     {
09131       SetHistoPresentation(h_his0, HistoType.Data(), opt_plot);    // (gStyle parameters)
09132       //.................................................. prepa paves commentaires (HistoPlot)
09133       SetAllPavesViewHisto(HistoCode.Data(), StexStin_A, i0StinEcha, i0Sample, opt_plot.Data(), arg_AlreadyRead);
09134     }
09135   
09136   //..................................................... Canvas name (HistoPlot) 
09137   TString canvas_name = SetCanvasName(HistoCode.Data(), opt_scale_x, opt_scale_y,
09138                                       opt_plot.Data(),  arg_AlreadyRead, 
09139                                       StexStin_A,       i0StinEcha,  i0Sample);
09140   //..................................................... Canvas allocations (HistoPlot)
09141   TCanvas* MainCanvas = 0;
09142 
09143   if(opt_plot == fOnlyOnePlot && (arg_AlreadyRead == 0 || arg_AlreadyRead == 1 ) )
09144     {
09145       MainCanvas = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w , canv_h);   fCnewRoot++;
09146       fCurrentPad = gPad; fCurrentCanvas = MainCanvas; fCurrentCanvasName = canvas_name.Data();
09147     }
09148   
09149   if( opt_plot == fSeveralPlot ||  opt_plot == fSameOnePlot)
09150     {if(GetMemoFlag(HistoCode, opt_plot) == "Free")
09151       {MainCanvas = CreateCanvas(HistoCode, opt_plot, canvas_name, canv_w, canv_h);
09152       fCurrentPad = gPad; fCurrentCanvas = MainCanvas; fCurrentCanvasName = canvas_name.Data();}}
09153 
09154   // cout << "*TEcnaHistos::HistoPlot(...)> Plot is displayed on canvas ----> " << canvas_name.Data() << endl;
09155 
09156   //--------------- EE => SC for construction, EB => Xtal in SM (default: Stin ECNA number, i0StinEcha)
09157   Int_t Stex_StinCons = StexStin_A;   // Stex_StinCons = Tower for EB, SC for construction for EE
09158   Int_t n1StexCrys    = i0StinEcha+1; // n1StexCrys = Crys in SM for EB, ECNA
09159 
09160   if( StexStin_A >= 1 && StexStin_A <= fEcal->MaxStinEcnaInStex() )
09161     {
09162       if( fFlagSubDet == "EB" )
09163         {n1StexCrys  = fEcalNumbering->Get1StexCrysFrom1StexStinAnd0StinEcha(StexStin_A, i0StinEcha, fFapStexNumber);}
09164       if( fFlagSubDet == "EE" )
09165         {Stex_StinCons = fEcalNumbering->GetDeeSCConsFrom1DeeSCEcna(fFapStexNumber, StexStin_A);}
09166     }
09167 
09168   //------ String for StexNumber ( to display "EB" or "EE" if Stex = 0 )
09169   TString sFapStexNumber = StexNumberToString(fFapStexNumber);
09170 
09171   //============================================================================= (HistoPlot)
09172   //
09173   //     1st  OPERATIONS:  Pave texts preparation and first Draw.
09174   //                       SetParametersCanvas
09175   //                       Set Memo Flags.
09176   //                       Set main_subpad and main_pavtxt
09177   //
09178   //=============================================================================
09179   TVirtualPad* main_subpad = 0; // main_subpad: Pad for the histo
09180   TPaveText*   main_pavtxt = 0; // Pave for the "Several Changing" parameters (options SAME and SAME n)
09181 
09182   Int_t xMemoPlotSame = 1; // a priori ==> SAME plot
09183 
09184   //========================================= Option ONLYONE    (HistoPlot)
09185   if( opt_plot == fOnlyOnePlot )
09186     {
09187       if( arg_AlreadyRead == 0 || arg_AlreadyRead == 1 )
09188         {
09189           //.................................... Draw titles and paves (pad = main canvas)
09190           if( fPavComGeneralTitle != 0 ){fPavComGeneralTitle->Draw();}
09191           fPavComStex->Draw();
09192           if( !( HistoType == "Global" || HistoType == "Proj" ) ){fPavComStin->Draw(); fPavComXtal->Draw();}
09193 
09194           if( HistoType == "EvolProj" )
09195             {
09196               fPavComEvolRuns->Draw();
09197               fPavComEvolNbOfEvtsAna->Draw();
09198             }
09199           else
09200             {
09201               fPavComAnaRun->Draw();
09202               fPavComNbOfEvts->Draw();
09203             }
09204 
09205           Double_t x_low = fCnaParHistos->BoxLeftX("bottom_left_box")    - 0.005;
09206           Double_t x_up  = fCnaParHistos->BoxRightX("bottom_right_box")  + 0.005;
09207           Double_t y_low = fCnaParHistos->BoxTopY("bottom_right_box")    + 0.005;
09208           Double_t y_up  = fCnaParHistos->BoxBottomY("top_right_box_EB") - 0.005;
09209           Color_t  fond_pad = fCnaParHistos->ColorDefinition("blanc");
09210 
09211           Double_t x_margin = x_low;
09212           Double_t y_margin = y_low;
09213           MainCanvas->Divide( 1,  1, x_margin, y_margin, fond_pad);
09214           //           Divide(nx, ny, x_margin, y_margin,    color);
09215 
09216           gPad->cd(1);
09217           main_subpad = gPad;
09218           main_subpad->SetPad(x_low, y_low, x_up, y_up);
09219         
09220           xMemoPlotSame = 0;
09221         }
09222       if (arg_AlreadyRead > 1 )
09223         {main_subpad = fCurrentPad;}
09224 
09225     } // end of if(opt_plot == fOnlyOnePlot && (arg_AlreadyRead == 0 || arg_AlreadyRead == 1 ) )
09226 
09227   //========================================= Options SAME and SAME n  (HistoPlot)
09228   if( (opt_plot == fSeveralPlot) || (opt_plot == fSameOnePlot) )
09229     {
09230       //..................... First call in options SAME and SAME n
09231       if( GetMemoFlag(HistoCode, opt_plot) == "Free" )
09232         {
09233           //Call to SetParametersPavTxt
09234           //fPavTxt<HISTOCODE> = fPavComSeveralChanging;  => come from SetAllPavesViewHisto
09235           SetParametersPavTxt(HistoCode, opt_plot);
09236 
09237           //---------------- Call to ActivePavTxt
09238           // main_pavtxt = fPavTxt<HISTOCODE>;} (return main_pavtxt)
09239           main_pavtxt = ActivePavTxt(HistoCode.Data(), opt_plot.Data());
09240 
09241           //---------------------------- Set texts for pave "several changing", options SAME and SAME n
09242           if( fPavComGeneralTitle != 0 ){fPavComGeneralTitle->Draw();}
09243 
09244           main_pavtxt->SetTextAlign(fTextPaveAlign);
09245           main_pavtxt->SetTextFont(fTextPaveFont);
09246           main_pavtxt->SetBorderSize(fTextBorderSize);
09247           Float_t cTextPaveSize  = 0.025;
09248           if( HistoType == "H1Basic" || HistoType == "SampProj" || HistoType == "H1BasicProj" ||
09249               HistoType == "Proj"    || HistoType == "EvolProj"  )
09250             {cTextPaveSize = 0.025;}
09251           main_pavtxt->SetTextSize(cTextPaveSize);
09252 
09253           char* f_in = new char[fgMaxCar];                            fCnew++;
09254 
09255           //------------------------------------------------------------ titles pave "several" (HistoPlot)
09256           TString DecalStexName = "";
09257           if( fFlagSubDet == "EB" ){DecalStexName = " ";}
09258           TString DecalStinName = "";
09259           if( fFlagSubDet == "EE" ){DecalStinName = "   ";}
09260 
09261           TString sStexOrStasName = "";
09262           if( fFapStexNumber == 0 ){sStexOrStasName = "  ";}
09263           if( fFapStexNumber != 0 ){sStexOrStasName = fFapStexName;}
09264 
09265           if( opt_plot == fSeveralPlot || opt_plot == fSameOnePlot )
09266             {
09267               if( HistoType == "SampGlobal" )
09268                 {sprintf(f_in, "Analysis   Samp   RUN# (run type            )  Evts range  Nb Evts   %s%s %s%s %s %s Sample",
09269                          DecalStexName.Data(), sStexOrStasName.Data(),
09270                          DecalStinName.Data(), fFapStinName.Data(), fFapXtalName.Data(), fFapEchaName.Data());}
09271               if( HistoType == "SampProj" )
09272                 {sprintf(f_in, "Analysis   Samp   RUN# (run type            )  Evts range  Nb Evts   %s%s %s%s %s %s Sample",
09273                          DecalStexName.Data(), sStexOrStasName.Data(),
09274                          DecalStinName.Data(), fFapStinName.Data(), fFapXtalName.Data(), fFapEchaName.Data());}
09275               if( HistoType == "H1Basic" || HistoType == "H1BasicProj" )
09276                 {sprintf(f_in, "Analysis   Samp   RUN# (run type            )  Evts range  Nb Evts   %s%s %s%s %s %s",
09277                          DecalStexName.Data(), sStexOrStasName.Data(),
09278                          DecalStinName.Data(), fFapStinName.Data(), fFapXtalName.Data(), fFapEchaName.Data());}
09279               if((HistoType == "Global") || (HistoType == "Proj") )
09280                 {sprintf(f_in, "Analysis   Samp   RUN# (run type            )  Evts range  Nb Evts   %s%s",
09281                          DecalStexName.Data(), sStexOrStasName.Data());}
09282 
09283               if( HistoType == "EvolProj" )
09284                 {sprintf(f_in, "Analysis   Samp   Evts range  Nb Evts   %s%s  %s%s %s %s",
09285                          DecalStexName.Data(), sStexOrStasName.Data(),
09286                          DecalStinName.Data(), fFapStinName.Data(), fFapXtalName.Data(), fFapEchaName.Data());}
09287             }
09288 
09289           TText* ttit = main_pavtxt->AddText(f_in);
09290           ttit->SetTextColor(fCnaParHistos->ColorDefinition("noir"));
09291           
09292           //------------------------------------------------------------ values pave "several"  (HistoPlot)
09293 
09294           //.................................... option SAME n only  (HistoPlot)
09295           if( opt_plot == fSameOnePlot)
09296             {
09297               if( (HistoType == "Global") || (HistoType == "Proj") || (HistoType == "H1BasicProj") )
09298                 {
09299                   sprintf(f_in, "%-10s 1-%2d%7d (%-20s) %5d-%5d  %7d  %4s %-25s",
09300                           fFapAnaType.Data(), fFapNbOfSamples, fFapRunNumber, fRunType.Data(),
09301                           fFapFirstReqEvtNumber, fFapLastReqEvtNumber, fFapReqNbOfEvts,
09302                           sFapStexNumber.Data(), QuantityName.Data());
09303                 }
09304 
09305               if( HistoType == "EvolProj" )
09306                 {
09307                   sprintf(f_in, "%-10s 1-%2d %5d-%5d  %7d %5s%6d%7d%7d %-25s",
09308                           fFapAnaType.Data(), fFapNbOfSamples, fFapFirstReqEvtNumber, fFapLastReqEvtNumber, fFapReqNbOfEvts,
09309                           sFapStexNumber.Data(), Stex_StinCons, n1StexCrys, i0StinEcha, QuantityName.Data());
09310                 }
09311               
09312             } // end of if for option SAME n only
09313 
09314           //..................................... option SAME (HistoPlot)
09315           if( opt_plot == fSeveralPlot )
09316             {
09317               Int_t kSample = i0Sample+1;  // Sample number range = [1,n<=10]
09318 
09319               if( HistoType == "SampGlobal" )
09320                 {
09321                   sprintf(f_in, "%-10s 1-%2d%7d (%-20s) %5d-%5d  %7d  %4s%6d%5d%5d%6d",
09322                           fFapAnaType.Data(), fFapNbOfSamples, fFapRunNumber, fRunType.Data(),
09323                           fFapFirstReqEvtNumber, fFapLastReqEvtNumber, fFapReqNbOfEvts,sFapStexNumber.Data(),
09324                           Stex_StinCons, n1StexCrys, i0StinEcha, kSample);
09325                 }
09326               if( HistoType == "SampProj"  )
09327                 {
09328                   sprintf(f_in, "%-10s 1-%2d%7d (%-20s) %5d-%5d  %7d  %4s%6d%5d%5d%6d",
09329                           fFapAnaType.Data(), fFapNbOfSamples, fFapRunNumber, fRunType.Data(),
09330                           fFapFirstReqEvtNumber, fFapLastReqEvtNumber, fFapReqNbOfEvts, sFapStexNumber.Data(),
09331                           Stex_StinCons, n1StexCrys, i0StinEcha, kSample);
09332                 }             
09333               if( HistoType == "H1Basic" || HistoType == "H1BasicProj" )
09334                 {
09335                   sprintf(f_in, "%-10s 1-%2d%7d (%-20s) %5d-%5d  %7d  %4s%6d%5d%5d",
09336                           fFapAnaType.Data(), fFapNbOfSamples, fFapRunNumber, fRunType.Data(),
09337                           fFapFirstReqEvtNumber, fFapLastReqEvtNumber, fFapReqNbOfEvts, sFapStexNumber.Data(),
09338                           Stex_StinCons, n1StexCrys, i0StinEcha);
09339                 }             
09340               if( (HistoType == "Global") || (HistoType == "Proj")  )
09341                 {
09342                   sprintf(f_in, "%-10s 1-%2d%7d (%-20s) %5d-%5d  %7d  %4s",
09343                           fFapAnaType.Data(), fFapNbOfSamples, fFapRunNumber,  fRunType.Data(),
09344                           fFapFirstReqEvtNumber, fFapLastReqEvtNumber, fFapReqNbOfEvts, sFapStexNumber.Data());
09345                 }
09346               
09347               if( HistoType == "EvolProj" )
09348                 {
09349                   sprintf(f_in, "%-10s 1-%2d  %5d-%5d  %7d  %4s%7d%5d%5d",
09350                           fFapAnaType.Data(), fFapNbOfSamples,
09351                           fFapFirstReqEvtNumber, fFapLastReqEvtNumber, fFapReqNbOfEvts, sFapStexNumber.Data(), 
09352                           Stex_StinCons, n1StexCrys, i0StinEcha);
09353                 }
09354             }
09355           
09356           TText* tt = main_pavtxt->AddText(f_in);
09357           tt->SetTextColor(GetViewHistoColor(HistoCode, opt_plot));
09358           
09359           delete [] f_in;   f_in = 0;                                          fCdelete++;
09360 
09361           //---------------- Draw the "several changing" pave with its text in the Canvas (AT FIRST TIME)
09362           main_pavtxt->Draw();
09363           //---------------- Draw evol run pave if "EvolProj" (AT FIRST TIME)  
09364           if( HistoType == "EvolProj" ){fPavComEvolRuns->Draw();}
09365 
09366           //---------------- Call to SetParametersCanvas
09367           //fImp<HISTOCODE> = (TRootCanvas*)fCanv<HISTOCODE>->GetCanvasImp();
09368           //fCanv<HISTOCODE>->Divide(1, 1, x_margin_factor , y_margin_factor); gPad->cd(1);
09369           //fPad<HISTOCODE> = gPad;
09370           //fMemoPlot<HISTOCODE> = 1;          =======>  set MemoFlag to "Buzy"
09371           //fMemoColor<HISTOCODE> = 0;
09372           SetParametersCanvas(HistoCode, opt_plot);       
09373 
09374           //---------------- Set xMemoPlotSame to 0
09375           xMemoPlotSame = 0;
09376         }
09377       //-------- end of if( GetMemoFlag(HistoCode, opt_plot) == "Free" ) ----------  (HistoPlot)
09378       //.......... First and further calls in options SAME and SAME n (fMemoPlot<HISTOCODE> = 1)
09379       if(GetMemoFlag(HistoCode, opt_plot) == "Busy")
09380         {
09381           //---------------- Call to ActivePavTxt
09382           // main_pavtxt = fPavTxt<HISTOCODE>;} (return main_pavtxt)
09383           main_pavtxt = ActivePavTxt(HistoCode.Data(), opt_plot.Data());
09384           
09385           //---------------- Call to ActivePad
09386           //if( (TRootCanvas*)fCanv<HISTOCODE>->GetCanvasImp() == fImp<HISTOCODE> ){
09387           // main_subpad = fPad<HISTOCODE>;} (return main_subpad)
09388           main_subpad = ActivePad(HistoCode.Data(), opt_plot.Data());  // => return 0 if canvas has been closed
09389 
09390           //---------------- Recover pointer to the current canvas
09391           MainCanvas = GetCurrentCanvas(HistoCode.Data(), opt_plot.Data());
09392         }
09393     } // end of if( (opt_plot == fSeveralPlot) || (opt_plot == fSameOnePlot) )
09394 
09395 
09396 
09397   //============================================================================= (HistoPlot)
09398   //
09399   //     2nd  OPERATIONS: Write and Draw the parameter values in the
09400   //                      "several changing" pave (options SAME and SAME n)
09401   //                      and Draw Histo
09402   //=============================================================================
09403   if(main_subpad != 0)
09404     { 
09405       if( (opt_plot == fSeveralPlot) || (opt_plot == fSameOnePlot) )
09406         {
09407           //------------------------------------------------------------ values  
09408           if(xMemoPlotSame != 0)
09409             {
09410               // main_pavtxt = fPavComSeveralChanging = fPavTxt<HISTOCODE>
09411               main_pavtxt->SetTextAlign(fTextPaveAlign);
09412               main_pavtxt->SetTextFont(fTextPaveFont);
09413               main_pavtxt->SetBorderSize(fTextBorderSize);
09414               Float_t cTextPaveSize  = 0.025;
09415               if( HistoType == "H1Basic" || HistoType == "SampProj"
09416                   || HistoType == "Proj" || HistoType == "EvolProj" || HistoType == "H1BasicProj" )
09417                 {cTextPaveSize = 0.025;}
09418               main_pavtxt->SetTextSize(cTextPaveSize);
09419               
09420               char* f_in = new char[fgMaxCar];                            fCnew++;
09421               
09422               if( opt_plot == fSameOnePlot )
09423                 {
09424                   if( (HistoType == "Global") || (HistoType == "Proj") )
09425                     {
09426                       sprintf(f_in, "%-10s 1-%2d%7d (%-20s) %5d-%5d  %7d  %4s %-25s",
09427                               fFapAnaType.Data(), fFapNbOfSamples, fFapRunNumber, fRunType.Data(),
09428                               fFapFirstReqEvtNumber, fFapLastReqEvtNumber, fFapReqNbOfEvts,
09429                               sFapStexNumber.Data(), QuantityName.Data());
09430                     }
09431 
09432                   if( HistoType == "EvolProj" )
09433                     {
09434                       sprintf(f_in, "%-10s 1-%2d %5d-%5d  %7d %5s%6d%7d%7d %-25s",
09435                               fFapAnaType.Data(), fFapNbOfSamples,
09436                               fFapFirstReqEvtNumber, fFapLastReqEvtNumber, fFapReqNbOfEvts, sFapStexNumber.Data(),
09437                               Stex_StinCons, n1StexCrys, i0StinEcha, QuantityName.Data());
09438                     }
09439                 }
09440 
09441               if( opt_plot == fOnlyOnePlot || opt_plot == fSeveralPlot )
09442                 {
09443                   Int_t kSample = i0Sample+1;  // Sample number range = [1,n<=10] (HistoPlot)
09444 
09445                   if(HistoType == "SampGlobal" )
09446                     {
09447                       sprintf(f_in, "%-10s 1-%2d%7d (%-20s) %5d-%5d  %7d  %4s%6d%5d%5d%6d",
09448                               fFapAnaType.Data(), fFapNbOfSamples, fFapRunNumber, fRunType.Data(),
09449                               fFapFirstReqEvtNumber, fFapLastReqEvtNumber, fFapReqNbOfEvts, sFapStexNumber.Data(),
09450                               Stex_StinCons, n1StexCrys, i0StinEcha, kSample);
09451                     }
09452                   if( HistoType == "SampProj" )
09453                     {
09454                       sprintf(f_in, "%-10s 1-%2d%7d (%-20s) %5d-%5d  %7d  %4s%6d%5d%5d%6d",
09455                               fFapAnaType.Data(), fFapNbOfSamples, fFapRunNumber, fRunType.Data(),
09456                               fFapFirstReqEvtNumber, fFapLastReqEvtNumber, fFapReqNbOfEvts, sFapStexNumber.Data(),
09457                               Stex_StinCons, n1StexCrys, i0StinEcha, kSample);
09458                     }             
09459                   if( HistoType == "H1Basic" || HistoType == "H1BasicProj")
09460                     {
09461                       sprintf(f_in, "%-10s 1-%2d%7d (%-20s) %5d-%5d  %7d  %4s%6d%5d%5d",
09462                               fFapAnaType.Data(), fFapNbOfSamples, fFapRunNumber, fRunType.Data(),
09463                               fFapFirstReqEvtNumber, fFapLastReqEvtNumber, fFapReqNbOfEvts, sFapStexNumber.Data(),
09464                               Stex_StinCons, n1StexCrys, i0StinEcha);
09465                     }
09466                   if( (HistoType == "Global") || (HistoType == "Proj") )
09467                     {
09468                       sprintf(f_in, "%-10s 1-%2d%7d (%-20s) %5d-%5d  %7d  %4s",
09469                               fFapAnaType.Data(), fFapNbOfSamples, fFapRunNumber, fRunType.Data(),
09470                               fFapFirstReqEvtNumber, fFapLastReqEvtNumber, fFapReqNbOfEvts, sFapStexNumber.Data());
09471                     }
09472                   
09473                   if( HistoType == "EvolProj" )
09474                     {
09475                       sprintf(f_in, "%-10s 1-%2d  %5d-%5d  %7d  %4s%7d%5d%5d",
09476                               fFapAnaType.Data(), fFapNbOfSamples,
09477                               fFapFirstReqEvtNumber, fFapLastReqEvtNumber, fFapReqNbOfEvts,
09478                               sFapStexNumber.Data(), Stex_StinCons, n1StexCrys, i0StinEcha);
09479                     }
09480                 }
09481                
09482               TText *tt = main_pavtxt->AddText(f_in);
09483               tt->SetTextColor(GetViewHistoColor(HistoCode, opt_plot));
09484               MainCanvas->cd(); gStyle->SetOptDate(0);
09485               main_pavtxt->Draw();
09486 
09487               delete [] f_in;   f_in = 0;                      fCdelete++;
09488             }
09489           
09490           main_subpad->cd();
09491           Double_t x_low = fCnaParHistos->BoxLeftX("bottom_left_box")   - 0.005;
09492           Double_t x_up  = fCnaParHistos->BoxRightX("bottom_right_box") + 0.005;
09493           Double_t y_low = fCnaParHistos->BoxTopY("several_plots_box")  + 0.005;
09494           Double_t y_up  = fCnaParHistos->BoxBottomY("general_comment") - 0.005;
09495           if( opt_plot == fSameOnePlot && HistoType == "EvolProj" )
09496             {y_up = fCnaParHistos->BoxBottomY("top_left_box_EB") - 0.005;}
09497           main_subpad->SetPad(x_low, y_low, x_up, y_up);          
09498         } // end of if( (opt_plot == fSeveralPlot) || (opt_plot == fSameOnePlot) )
09499 
09500       //............................................ Style      (HistoPlot)
09501       SetViewHistoColors(h_his0, HistoCode.Data(), opt_plot, arg_AlreadyRead);
09502 
09503       //................................. Set axis titles
09504       TString axis_x_var_name = SetHistoXAxisTitle(HistoCode);
09505       TString axis_y_var_name = SetHistoYAxisTitle(HistoCode);
09506       h_his0->GetXaxis()->SetTitle(axis_x_var_name);
09507       h_his0->GetYaxis()->SetTitle(axis_y_var_name);
09508 
09509       Int_t lin_scale = 0;
09510       Int_t log_scale = 1;
09511       
09512       if(opt_scale_x == fOptScaleLinx){gPad->SetLogx(lin_scale);}
09513       if(opt_scale_x == fOptScaleLogx){gPad->SetLogx(log_scale);}
09514       if(opt_scale_y == fOptScaleLiny){gPad->SetLogy(lin_scale);}
09515       if(opt_scale_y == fOptScaleLogy){gPad->SetLogy(log_scale);}             
09516 
09517       //---------------------------------------------------------------- Draw histo     (HistoPlot)
09518       if(opt_plot == fOnlyOnePlot && arg_AlreadyRead == 0 ){h_his0->DrawCopy();}
09519       if(opt_plot == fOnlyOnePlot && arg_AlreadyRead == 1 ){h_his0->DrawCopy();}
09520       if(opt_plot == fOnlyOnePlot && arg_AlreadyRead >  1 ){h_his0->DrawCopy("AHSAME");}
09521 
09522       if(opt_plot == fSeveralPlot || opt_plot == fSameOnePlot)
09523         {
09524           if(xMemoPlotSame == 0){h_his0->DrawCopy();}
09525           if(xMemoPlotSame != 0){h_his0->DrawCopy("SAME");}
09526         }
09527       //----------------------------------------------------------------
09528 
09529       //.................... Horizontal line at y=0     (HistoPlot)
09530       if( !(  HistoCode == "D_Adc_EvDs" || HistoCode == "D_Adc_EvNb" ||
09531               HistoType == "Proj"       || HistoType == "SampProj" ||
09532               HistoType == "EvolProj"   || HistoType == "H1BasicProj"  ) &&
09533           !( HistoType == "H1Basic" && arg_AlreadyRead == 0 ) )
09534         {
09535           Double_t yinf = h_his0->GetMinimum();
09536           Double_t ysup = h_his0->GetMaximum();
09537           if( yinf <= (Double_t)0. && ysup >= (Double_t)0. )
09538             {TLine* lin =  new TLine(0.,0.,(Double_t)HisSize, 0.);   fCnewRoot++;
09539             lin->Draw();}
09540         }
09541 
09542       if( ( opt_plot == fOnlyOnePlot )
09543           || ( (opt_plot == fSeveralPlot || opt_plot == fSameOnePlot) && xMemoPlotSame == 0 ) )
09544         {
09545           Double_t yinf = (Double_t)h_his0->GetMinimum();
09546           Double_t ysup = (Double_t)h_his0->GetMaximum();
09547 
09548           if(xFlagAutoYsupMargin == 1)
09549             {
09550               if( yinf >= ysup ){yinf = (Double_t)0.; ysup += ysup;}  // ROOT default if ymin >= ymax
09551               Double_t MaxMarginFactor = (Double_t)0.05;    // frame top line = 5% above the maximum
09552               ysup += (ysup-yinf)*MaxMarginFactor;       // ROOT default if ymin < ymax
09553             }
09554 
09555           char* f_in = new char[fgMaxCar];               fCnew++;
09556 
09557           //.................... Vertical lines for Data sectors (EE Global plot only)
09558           if( fFlagSubDet == "EE" && fFapStexNumber == 0 )
09559             {
09560               //............................................................. Data Sectors      (HistoPlot)
09561               Color_t coul_DS = fCnaParHistos->ColorDefinition("noir");
09562               Int_t DeeOffset = 0;
09563               for(Int_t n1Dee=1; n1Dee<=4; n1Dee++)
09564                 {
09565                   if( n1Dee == 4 ){DeeOffset = 0;}
09566                   if( n1Dee == 3 ){DeeOffset =   fEcal->MaxSCForConsInDee();}   // 149
09567                   if( n1Dee == 2 ){DeeOffset = 2*fEcal->MaxSCForConsInDee();}   // 446
09568                   if( n1Dee == 1 ){DeeOffset = 3*fEcal->MaxSCForConsInDee();}   // 595
09569 
09570                   Double_t ydee = ysup + (ysup-yinf)/(Double_t)15.;
09571                   Double_t xBinDee = DeeOffset + fEcal->MaxSCForConsInDee()/(Double_t)2.;
09572                   sprintf( f_in, "D%d", n1Dee );
09573                   TText *text_Dee = new TText(xBinDee, ydee, f_in);  fCnewRoot++;
09574                   text_Dee->SetTextColor(coul_DS);
09575                   text_Dee->SetTextSize((Double_t)0.04);
09576                   text_Dee->Draw("SAME");
09577 
09578                   Double_t DSLabelOffset = (Double_t)12;
09579 
09580                   for(Int_t i=1; i<5; i++)
09581                     {
09582                       Int_t iDS = 0;
09583                       if( n1Dee == 1 ){iDS = i;}
09584                       if( n1Dee == 2 ){iDS = i+4;}
09585                       if( n1Dee == 3 ){iDS = i+5;}
09586                       if( n1Dee == 4 ){iDS = i+1;}
09587 
09588                       Double_t xBinDS = DeeOffset + (Double_t)GetDSOffset(n1Dee, iDS)/fEcal->MaxCrysInSC();
09589                       TLine* lin_DS = new TLine(xBinDS, yinf, xBinDS, ysup);   fCnewRoot++;
09590                       lin_DS->SetLineColor(coul_DS);
09591                       lin_DS->SetLineWidth(1);
09592                       lin_DS->SetLineStyle(2);
09593                       lin_DS->Draw();
09594 
09595                       if( n1Dee == 2 && i == 4 )
09596                         {
09597                           TLine* lin_DSp = new TLine(DeeOffset, yinf, DeeOffset, ysup);   fCnewRoot++;
09598                           lin_DSp->SetLineColor(coul_DS);
09599                           lin_DSp->SetLineWidth(1);
09600                           lin_DSp->SetLineStyle(2);
09601                           lin_DSp->Draw();
09602                         }
09603 
09604                       Double_t yds = ysup + (ysup-yinf)/(Double_t)50.;
09605                       Double_t xBinDSp = xBinDS + DSLabelOffset;
09606                       Int_t nDS = iDS;
09607 
09608                       sprintf( f_in, "S%d", nDS );
09609                       TText *text_DS = new TText(xBinDSp, yds, f_in);  fCnewRoot++;
09610                       text_DS->SetTextColor(coul_DS);
09611                       text_DS->SetTextSize((Double_t)0.03);
09612                       text_DS->Draw("SAME");
09613                       if( (n1Dee == 4 && i == 1) || (n1Dee == 2 && i == 4) )
09614                         {
09615                           if(n1Dee == 4){nDS = iDS-1;}
09616                           if(n1Dee == 2){nDS = iDS+1;}
09617                           sprintf( f_in, "S%d", nDS );
09618                           TText *text_DS = new TText(xBinDS-1.75*DSLabelOffset, yds, f_in);  fCnewRoot++;
09619                           text_DS->SetTextColor(coul_DS);
09620                           text_DS->SetTextSize((Double_t)0.03);
09621                           text_DS->Draw("SAME");
09622                         }
09623                     }
09624                 }
09625             }
09626 
09627           //........... Vertical lines for Data sectors and special SC's (EE only, Dee's Global plots)  (HistoPlot)
09628           if( fFlagSubDet == "EE" && fFapStexNumber > 0 )
09629             {
09630               if( HistoType == "Global" )
09631                 {
09632                   Double_t ytext = yinf - (ysup-yinf)/8.5;                
09633                   //............................................................. Data Sectors
09634                   Color_t coul_DS = fCnaParHistos->ColorDefinition("noir");
09635                   for(Int_t i=1; i<5; i++)
09636                     {
09637                       Int_t iDS = 0;
09638                       if( fFapStexNumber == 1 ){iDS = i;}
09639                       if( fFapStexNumber == 2 ){iDS = i+4;}
09640                       if( fFapStexNumber == 3 ){iDS = i+5;}
09641                       if( fFapStexNumber == 4 ){iDS = i+1;}
09642                       
09643                       Double_t xBinDS = (Double_t)GetDSOffset(fFapStexNumber, iDS);
09644                       TLine* lin_DS = new TLine(xBinDS, yinf, xBinDS, ysup);   fCnewRoot++;
09645                       lin_DS->SetLineColor(coul_DS);
09646                       lin_DS->SetLineWidth(2);
09647                       lin_DS->SetLineStyle(2);
09648                       lin_DS->Draw();
09649                       Double_t ytextds = ysup + (ysup-yinf)/30.;
09650                       Double_t xBinDSNumber =
09651                         xBinDS + fEcalNumbering->GetMaxSCInDS(iDS)*fEcal->MaxCrysInSC()/(Double_t)2.25;
09652                       sprintf( f_in, "S%d", iDS );
09653                       TText *text_DS = new TText(xBinDSNumber, ytextds, f_in);  fCnewRoot++;
09654                       text_DS->SetTextColor(coul_DS);
09655                       text_DS->SetTextSize((Double_t)0.04);
09656                       text_DS->Draw("SAME");
09657                       if( ( (fFapStexNumber == 1 || fFapStexNumber == 2 ) && i == 4 ) ||
09658                           ( (fFapStexNumber == 3 || fFapStexNumber == 4 ) && i == 1 ) )
09659                         {
09660                           Int_t iDSp = iDS;
09661                           if( i == 4 ){iDSp = iDS+1;}
09662                           if( i == 1 ){iDSp = iDS-1;}
09663                           sprintf( f_in, "S%d", iDSp);
09664                           Double_t xBinpDSNumber =
09665                             xBinDSNumber - fEcalNumbering->GetMaxSCInDS(iDS)*fEcal->MaxCrysInSC();
09666                           TText *text_DSp = new TText(xBinpDSNumber, ytextds, f_in);  fCnewRoot++;
09667                           text_DSp->SetTextColor(coul_DS);
09668                           text_DSp->SetTextSize((Double_t)0.04);
09669                           text_DSp->Draw("SAME");
09670                         }
09671                     }
09672                   //.............................................................. Vertical lines for SC's
09673                   //                                                       Trop serre. A garder en reserve.
09674                   //for(Int_t i=0; i<fEcal->MaxSCForConsInDee(); i++)
09675                   //  {
09676                   //    Double_t xBinSC =(Double_t)(fEcal->MaxCrysInSC()*i);
09677                   //    TLine* lin_SC = new TLine(xBinSC, yinf, xBinSC, ysup);  fCnewRoot++;
09678                   //    lin_SC->SetLineColor(coul_DS);
09679                   //    lin_SC->SetLineStyle(3);
09680                   //    lin_SC->Draw();
09681                   //  }
09682                   //............................................................... Not connected SC's
09683                   Color_t coul_notconnected = fCnaParHistos->ColorDefinition("bleu_fonce");
09684                   for(Int_t i=1; i<=fEcal->NumberOfNotConnectedSCs(); i++)
09685                     {
09686                       Int_t index = 0;
09687                       if( fFapStexNumber == 1 || fFapStexNumber == 3 ){index = 2*i - 1;}
09688                       if( fFapStexNumber == 2 || fFapStexNumber == 4 ){index = 2*i;}
09689                       //................. display of the not connected SC's numbers (+ vertical line)
09690                       Double_t xBinNotConnectedSC = NotConnectedSCH1DBin(index);
09691                       TLine* lin_notconnected =
09692                         new TLine(xBinNotConnectedSC, yinf, xBinNotConnectedSC, ysup);  fCnewRoot++;
09693                       lin_notconnected->SetLineColor(coul_notconnected);
09694                       lin_notconnected->SetLineStyle(3);
09695                       lin_notconnected->Draw();
09696                       
09697                       Double_t xBinNotConnectedSCEnd = NotConnectedSCH1DBin(index)+fEcal->MaxCrysInSC();
09698                       TLine* lin_notconnected_end =
09699                         new TLine(xBinNotConnectedSCEnd, yinf, xBinNotConnectedSCEnd, ysup); fCnewRoot++;
09700                       lin_notconnected_end->SetLineColor(coul_notconnected);
09701                       lin_notconnected_end->SetLineStyle(3);
09702                       lin_notconnected_end->Draw();
09703                       
09704                       //sprintf( f_in, "%d", GetNotConnectedSCForConsFromIndex(index) );
09705                       sprintf( f_in, "%d", GetNotConnectedDSSCFromIndex(index) );
09706                       TText *text_SC_NotConnected = new TText(xBinNotConnectedSC, ytext, f_in);  fCnewRoot++;
09707                       text_SC_NotConnected->SetTextAngle((Double_t)45.);
09708                       text_SC_NotConnected->SetTextColor(coul_notconnected);
09709                       text_SC_NotConnected->SetTextFont(42);
09710                       text_SC_NotConnected->SetTextSize((Double_t)0.03);
09711                       text_SC_NotConnected->Draw("SAME");
09712                     }
09713                   //Double_t xtext = xinf_his - (xsup_his-xinf_his)/8.;
09714                   //Double_t ytextp = yinf - (ysup-yinf)/6.;
09715                   //sprintf( f_in, "Special SC => ");
09716                   //TText *text_legend_NotConnected = new TText(xtext, ytext, f_in);  fCnewRoot++;
09717                   //text_legend_NotConnected->SetTextColor(coul_notconnected);
09718                   //text_legend_NotConnected->SetTextSize((Double_t)0.03);
09719                   //text_legend_NotConnected->Draw("SAME");
09720                   
09721                   //............................................................... Not complete SC's
09722                   Color_t coul_notcomplete = fCnaParHistos->ColorDefinition("rouge40");
09723                   for(Int_t i=1; i<=fEcal->NumberOfNotCompleteSCs(); i++)
09724                     {
09725                       Int_t index = 0;
09726                       if( fFapStexNumber == 1 || fFapStexNumber == 3 ){index = 2*i - 1;}
09727                       if( fFapStexNumber == 2 || fFapStexNumber == 4 ){index = 2*i;}
09728                       //................. display of the not complete SC's numbers (+ vertical line)
09729                       Double_t xBinNotCompleteSC = NotCompleteSCH1DBin(index);
09730                       TLine* lin_notcomplete =
09731                         new TLine(xBinNotCompleteSC, yinf, xBinNotCompleteSC, ysup);   fCnewRoot++;
09732                       lin_notcomplete->SetLineColor(coul_notcomplete);
09733                       lin_notcomplete->SetLineStyle(3);
09734                       lin_notcomplete->Draw();
09735                       
09736                       Double_t xBinNotCompleteSCEnd = NotCompleteSCH1DBin(index)+fEcal->MaxCrysInSC();;
09737                       TLine* lin_notcomplete_end =
09738                         new TLine(xBinNotCompleteSCEnd, yinf, xBinNotCompleteSCEnd, ysup);   fCnewRoot++;
09739                       lin_notcomplete_end->SetLineColor(coul_notcomplete);
09740                       lin_notcomplete_end->SetLineStyle(3);
09741                       lin_notcomplete_end->Draw();
09742 
09743                       sprintf( f_in, "%d", GetNotCompleteDSSCFromIndex(index) );
09744                       // sprintf( f_in, "%d", GetNotCompleteSCForConsFromIndex(index) );
09745                       TText *text_SC_NotComplete = new TText(xBinNotCompleteSC, ytext, f_in);  fCnewRoot++;
09746                       text_SC_NotComplete->SetTextAngle((Double_t)45.);
09747                       text_SC_NotComplete->SetTextColor(coul_notcomplete);
09748                       text_SC_NotComplete->SetTextFont(42);
09749                       text_SC_NotComplete->SetTextSize((Double_t)0.03);
09750                       text_SC_NotComplete->Draw("SAME");
09751                     }
09752                   //Double_t xtextp = xinf_his + (xsup_his-xinf_his)/15.;
09753                   //sprintf( f_in, "Not complete SC");
09754                   //TText *text_legend_NotComplete = new TText(xtextp, ytextp, f_in);  fCnewRoot++;
09755                   //text_legend_NotComplete->SetTextColor(coul_notcomplete);
09756                   //text_legend_NotComplete->SetTextSize((Double_t)0.03);
09757                   //text_legend_NotComplete->Draw("SAME");
09758                 }
09759             }
09760           delete [] f_in;   f_in = 0;                      fCdelete++;
09761         } // end of if( ( opt_plot == fOnlyOnePlot )
09762           // || ( (opt_plot == fSeveralPlot || opt_plot == fSameOnePlot) && xMemoPlotSame == 0 ) )
09763 
09764       //..............................................Top Axis (HistoPlot)
09765       Int_t min_value = 0;
09766       Int_t max_value = 0;
09767       if(HistoType == "Global")
09768         {
09769           if( fFapStexNumber > 0 )
09770             {
09771               //.......................... Axis for the Stin numbers and Data sectors (EE) numbers
09772               if( fFlagSubDet == "EB" )
09773                 {
09774                   min_value = 0;
09775                   max_value = fEcal->MaxStinEcnaInStex() - 1;
09776                 }
09777               if( fFlagSubDet == "EE" )
09778                 {
09779                   if( fFapStexNumber == 1 ){min_value = 1; max_value = 5;}
09780                   if( fFapStexNumber == 2 ){min_value = 5; max_value = 9;}
09781                   if( fFapStexNumber == 3 ){min_value = 5; max_value = 9;}
09782                   if( fFapStexNumber == 4 ){min_value = 1; max_value = 5;}
09783                 }
09784             }
09785           if( fFapStexNumber == 0 )
09786             {
09787               //.......................... Axis for the SM (EB) and Dee numbers (EE)
09788               if( fFlagSubDet == "EB" )
09789                 {
09790                   min_value = 0; 
09791                   max_value = fEcal->MaxStexInStas() - 1;
09792                 }
09793               if( fFlagSubDet == "EE" )
09794                 {
09795                   min_value = 1; 
09796                   max_value = fEcal->MaxStexInStas();
09797                 }
09798             }
09799           TopAxisForHistos(h_his0, opt_plot, xMemoPlotSame, min_value, max_value,
09800                            xFlagAutoYsupMargin, HisSize);
09801         } // end of if (HistoType == "Global")
09802 
09803       if( !( (HistoType == "H1Basic" || HistoType == "H1BasicProj")
09804              && ( arg_AlreadyRead > 1 && arg_AlreadyRead < fEcal->MaxCrysInStin() ) ) )
09805         {
09806           gPad->Update();
09807         }
09808     }
09809   else    // else du if(main_subpad !=0)
09810     {
09811       cout << "*TEcnaHistos::HistoPlot(...)> Canvas not found. Previously closed in option SAME."
09812            << fTTBELL << endl;
09813 
09814       ReInitCanvas(HistoCode, opt_plot);
09815       xMemoPlotSame = 0;
09816     }
09817 
09818   //  delete MainCanvas;                  fCdeleteRoot++;
09819 
09820 } // end of HistoPlot
09821 
09822 
09823 TString TEcnaHistos::StexNumberToString(const Int_t& StexNumber)
09824 {
09825   // Convert Int_t StexNumber into TString: "StexNumber" if StexNumber in [-18,36]
09826   // or into TString: "EB" or "EE" if StexNumber = 0. 
09827 
09828   TString sFapStexNumber = "?";
09829   if( StexNumber ==  -1 ){sFapStexNumber = " -1";}
09830   if( StexNumber ==  -2 ){sFapStexNumber = " -2";}
09831   if( StexNumber ==  -3 ){sFapStexNumber = " -3";}
09832   if( StexNumber ==  -4 ){sFapStexNumber = " -4";}
09833   if( StexNumber ==  -5 ){sFapStexNumber = " -5";}
09834   if( StexNumber ==  -6 ){sFapStexNumber = " -6";}
09835   if( StexNumber ==  -7 ){sFapStexNumber = " -7";}
09836   if( StexNumber ==  -8 ){sFapStexNumber = " -8";}
09837   if( StexNumber ==  -9 ){sFapStexNumber = " -9";}
09838   if( StexNumber == -10 ){sFapStexNumber = "-10";}
09839   if( StexNumber == -11 ){sFapStexNumber = "-11";}
09840   if( StexNumber == -12 ){sFapStexNumber = "-12";}
09841   if( StexNumber == -13 ){sFapStexNumber = "-13";}
09842   if( StexNumber == -14 ){sFapStexNumber = "-14";}
09843   if( StexNumber == -15 ){sFapStexNumber = "-15";}
09844   if( StexNumber == -16 ){sFapStexNumber = "-16";}
09845   if( StexNumber == -17 ){sFapStexNumber = "-17";}
09846   if( StexNumber == -18 ){sFapStexNumber = "-18";}
09847   if( StexNumber ==  0 ){sFapStexNumber = fFlagSubDet;}
09848   if( StexNumber ==  1 ){sFapStexNumber = "  1";}
09849   if( StexNumber ==  2 ){sFapStexNumber = "  2";}
09850   if( StexNumber ==  3 ){sFapStexNumber = "  3";}
09851   if( StexNumber ==  4 ){sFapStexNumber = "  4";}
09852   if( StexNumber ==  5 ){sFapStexNumber = "  5";}
09853   if( StexNumber ==  6 ){sFapStexNumber = "  6";}
09854   if( StexNumber ==  7 ){sFapStexNumber = "  7";}
09855   if( StexNumber ==  8 ){sFapStexNumber = "  8";}
09856   if( StexNumber ==  9 ){sFapStexNumber = "  9";}
09857   if( StexNumber == 10 ){sFapStexNumber = " 10";}
09858   if( StexNumber == 11 ){sFapStexNumber = " 11";}
09859   if( StexNumber == 12 ){sFapStexNumber = " 12";}
09860   if( StexNumber == 13 ){sFapStexNumber = " 13";}
09861   if( StexNumber == 14 ){sFapStexNumber = " 14";}
09862   if( StexNumber == 15 ){sFapStexNumber = " 15";}
09863   if( StexNumber == 16 ){sFapStexNumber = " 16";}
09864   if( StexNumber == 17 ){sFapStexNumber = " 17";}
09865   if( StexNumber == 18 ){sFapStexNumber = " 18";}
09866   if( StexNumber == 19 ){sFapStexNumber = " -1";}
09867   if( StexNumber == 20 ){sFapStexNumber = " -2";}
09868   if( StexNumber == 21 ){sFapStexNumber = " -3";}
09869   if( StexNumber == 22 ){sFapStexNumber = " -4";}
09870   if( StexNumber == 23 ){sFapStexNumber = " -5";}
09871   if( StexNumber == 24 ){sFapStexNumber = " -6";}
09872   if( StexNumber == 25 ){sFapStexNumber = " -7";}
09873   if( StexNumber == 26 ){sFapStexNumber = " -8";}
09874   if( StexNumber == 27 ){sFapStexNumber = " -9";}
09875   if( StexNumber == 28 ){sFapStexNumber = "-10";}
09876   if( StexNumber == 29 ){sFapStexNumber = "-11";}
09877   if( StexNumber == 30 ){sFapStexNumber = "-12";}
09878   if( StexNumber == 31 ){sFapStexNumber = "-13";}
09879   if( StexNumber == 32 ){sFapStexNumber = "-14";}
09880   if( StexNumber == 33 ){sFapStexNumber = "-15";}
09881   if( StexNumber == 34 ){sFapStexNumber = "-16";}
09882   if( StexNumber == 35 ){sFapStexNumber = "-17";}
09883   if( StexNumber == 36 ){sFapStexNumber = "-18";}
09884   return sFapStexNumber;
09885 }
09886 
09887 Double_t TEcnaHistos::NotConnectedSCH1DBin(const Int_t& index)
09888 {
09889   // gives the x coordinate for the i_th NotConnected SC
09890   // GetDSOffset(DeeNumber, DataSector) , GetSCOffset(DeeNumber, DataSector, SC_in_DS)
09891 
09892   Double_t xbin = (Double_t)(-1);
09893 
09894   if( index ==  1 ){xbin = GetDSOffset(1,1)+GetSCOffset(1,1, 30);}  // nb_for_cons == 182  (D1,S1) (D3,S9)
09895   if( index ==  2 ){xbin = GetDSOffset(2,9)+GetSCOffset(2,9, 30);}  // nb_for_cons ==  33  (D2,S9) (D4,S1)
09896 
09897   if( index ==  3 ){xbin = GetDSOffset(1,2)+GetSCOffset(1,2,  3);}  // nb_for_cons == 178  (D1,S2) (D3,S8)
09898   if( index ==  4 ){xbin = GetDSOffset(2,8)+GetSCOffset(2,8,  3);}  // nb_for_cons ==  29  (D2,S8) (D4,S2)
09899 
09900   if( index ==  5 ){xbin = GetDSOffset(1,2)+GetSCOffset(1,2, 25);}  // nb_for_cons == 207  (D1,S2) (D3,S8)
09901   if( index ==  6 ){xbin = GetDSOffset(2,8)+GetSCOffset(2,8, 25);}  // nb_for_cons ==  58  (D2,S8) (D4,S2)
09902 
09903   if( index ==  7 ){xbin = GetDSOffset(1,3)+GetSCOffset(1,3, 34);}  // nb_for_cons == 298  (D1,S3) (D3,S7) 
09904   if( index ==  8 ){xbin = GetDSOffset(2,7)+GetSCOffset(2,7, 34);}  // nb_for_cons == 149  (D2,S7) (D4,S3)
09905 
09906   if( index ==  9 ){xbin = GetDSOffset(1,4)+GetSCOffset(1,4, 14);}  // nb_for_cons == 261  (D1,S4) (D3,S6)
09907   if( index == 10 ){xbin = GetDSOffset(2,6)+GetSCOffset(2,6, 14);}  // nb_for_cons == 112  (D2,S6) (D4,S4)
09908   if( index == 11 ){xbin = GetDSOffset(1,4)+GetSCOffset(1,4, 21);}  // nb_for_cons == 268  (D1,S4) (D3,S6)
09909   if( index == 12 ){xbin = GetDSOffset(2,6)+GetSCOffset(2,6, 21);}  // nb_for_cons == 119  (D2,S6) (D4,S4)
09910 
09911   if( index == 13 ){xbin = GetDSOffset(1,5)+GetSCOffset(1,5, 20);}  // nb_for_cons == 281  (D1,S5) (D3,S5)
09912   if( index == 14 ){xbin = GetDSOffset(2,5)+GetSCOffset(2,5,  3);}  // nb_for_cons == 132  (D2,S5) (D4,S5)
09913 
09914   return xbin;
09915 }
09916 
09917 Double_t TEcnaHistos::NotCompleteSCH1DBin(const Int_t& index)
09918 {
09919   // gives the x coordinate for the i_th NotConnected SC
09920 
09921   Double_t xbin = (Double_t)(-1);
09922 
09923   if( index ==  1 ){xbin = GetDSOffset(1,1)+GetSCOffset(1,1, 12);}  // nb_for_cons == 161  (D1,S1) (D3,S9)
09924   if( index ==  2 ){xbin = GetDSOffset(2,9)+GetSCOffset(2,9, 12);}  // nb_for_cons ==  12  (D2,S9) (D4,S1)
09925 
09926   if( index ==  3 ){xbin = GetDSOffset(1,2)+GetSCOffset(1,2, 32);}  // nb_for_cons == 216  (D1,S2) (D3,S8)
09927   if( index ==  4 ){xbin = GetDSOffset(2,8)+GetSCOffset(2,8, 32);}  // nb_for_cons ==  67  (D2,S8) (D4,S2)
09928 
09929   if( index ==  5 ){xbin = GetDSOffset(1,3)+GetSCOffset(1,3, 10);}  // nb_for_cons == 224  (D1,S3) (D3,S7) 
09930   if( index ==  6 ){xbin = GetDSOffset(2,7)+GetSCOffset(2,7, 10);}  // nb_for_cons ==  75  (D2,S7) (D4,S3)
09931 
09932   if( index ==  7 ){xbin = GetDSOffset(1,5)+GetSCOffset(1,5, 23);}  // nb_for_cons == 286  (D1,S5) (D3,S5)
09933   if( index ==  8 ){xbin = GetDSOffset(2,5)+GetSCOffset(2,5,  6);}  // nb_for_cons == 137  (D2,S5) (D4,S5)
09934 
09935   return xbin;
09936 }
09937 
09938 Int_t TEcnaHistos::GetNotConnectedSCForConsFromIndex(const Int_t& index)
09939 {
09940 
09941   Int_t SCForCons = 0;
09942   if( index ==  1 ){SCForCons = 182;} // (D1,S1) (D3,S9)
09943   if( index ==  2 ){SCForCons =  33;} // (D2,S9) (D4,S1)
09944 
09945   if( index ==  3 ){SCForCons = 178;} // (D1,S2) (D3,S8)
09946   if( index ==  4 ){SCForCons =  29;} // (D2,S8) (D4,S2)
09947   if( index ==  5 ){SCForCons = 207;} // (D1,S2) (D3,S8)
09948   if( index ==  6 ){SCForCons =  58;} // (D2,S8) (D4,S2)
09949 
09950   if( index ==  7 ){SCForCons = 298;} // (D1,S3) (D3,S7) 
09951   if( index ==  8 ){SCForCons = 149;} // (D2,S7) (D4,S3)
09952 
09953   if( index ==  9 ){SCForCons = 261;} // (D1,S4) (D3,S6)
09954   if( index == 10 ){SCForCons = 112;} // (D2,S6) (D4,S4)
09955   if( index == 11 ){SCForCons = 268;} // (D1,S4) (D3,S6)
09956   if( index == 12 ){SCForCons = 119;} // (D2,S6) (D4,S4)
09957 
09958   if( index == 13 ){SCForCons = 281;} // (D1,S5) (D3,S5)
09959   if( index == 14 ){SCForCons = 132;} // (D2,S5) (D4,S5)
09960   return SCForCons;
09961 }
09962 
09963 Int_t TEcnaHistos::GetNotConnectedDSSCFromIndex(const Int_t& index)
09964 {
09965 
09966   Int_t DSSC = 0;
09967   if( index ==  1 ){DSSC =  30;} // (D1,S1) (D3,S9)
09968   if( index ==  2 ){DSSC =  30;} // (D2,S9) (D4,S1)
09969 
09970   if( index ==  3 ){DSSC =   3;} // (D1,S2) (D3,S8)
09971   if( index ==  4 ){DSSC =   3;} // (D2,S8) (D4,S2)
09972   if( index ==  5 ){DSSC =  25;} // (D1,S2) (D3,S8)
09973   if( index ==  6 ){DSSC =  25;} // (D2,S8) (D4,S2)
09974 
09975   if( index ==  7 ){DSSC =  34;} // (D1,S3) (D3,S7) 
09976   if( index ==  8 ){DSSC =  34;} // (D2,S7) (D4,S3)
09977 
09978   if( index ==  9 ){DSSC =  14;} // (D1,S4) (D3,S6)
09979   if( index == 10 ){DSSC =  14;} // (D2,S6) (D4,S4)
09980   if( index == 11 ){DSSC =  21;} // (D1,S4) (D3,S6)
09981   if( index == 12 ){DSSC =  21;} // (D2,S6) (D4,S4)
09982 
09983   if( index == 13 ){DSSC =  20;} // (D1,S5) (D3,S5)
09984   if( index == 14 ){DSSC =   3;} // (D2,S5) (D4,S5)
09985   return DSSC;
09986 }
09987 
09988 
09989 Int_t TEcnaHistos::GetNotCompleteSCForConsFromIndex(const Int_t& index)
09990 {
09991 
09992   Int_t DSSC = 0;
09993   if( index ==  1 ){DSSC =  161;} // (D1,S1) (D3,S9)
09994   if( index ==  2 ){DSSC =   12;} // (D2,S9) (D4,S1)
09995 
09996   if( index ==  3 ){DSSC =  216;} // (D1,S2) (D3,S8)
09997   if( index ==  4 ){DSSC =   67;} // (D2,S8) (D4,S2)
09998 
09999   if( index ==  5 ){DSSC =  224;} // (D1,S3) (D3,S7) 
10000   if( index ==  6 ){DSSC =   75;} // (D2,S7) (D4,S3)
10001 
10002   if( index ==  7 ){DSSC =  286;} // (D1,S5) (D3,S5)
10003   if( index ==  8 ){DSSC =  137;} // (D2,S5) (D4,S5)
10004   return DSSC;
10005 }
10006 
10007 Int_t TEcnaHistos::GetNotCompleteDSSCFromIndex(const Int_t& index)
10008 {
10009 
10010   Int_t DSSC = 0;
10011   if( index ==  1 ){DSSC =  12;} // (D1,S1) (D3,S9)
10012   if( index ==  2 ){DSSC =  12;} // (D2,S9) (D4,S1)
10013 
10014   if( index ==  3 ){DSSC =  32;} // (D1,S2) (D3,S8)
10015   if( index ==  4 ){DSSC =  32;} // (D2,S8) (D4,S2)
10016 
10017   if( index ==  5 ){DSSC =  10;} // (D1,S3) (D3,S7) 
10018   if( index ==  6 ){DSSC =  10;} // (D2,S7) (D4,S3)
10019 
10020   if( index ==  7 ){DSSC =  23;} // (D1,S5) (D3,S5)
10021   if( index ==  8 ){DSSC =   6;} // (D2,S5) (D4,S5)
10022   return DSSC;
10023 }
10024 //----------------------------------------------- HistimePlot
10025 void TEcnaHistos::HistimePlot(TGraph*       g_graph0, 
10026                               Axis_t        xinf,        Axis_t        xsup,
10027                               const TString HistoCode,   const TString HistoType,
10028                               const Int_t&  StexStin_A,  const Int_t&  i0StinEcha, const Int_t& i0Sample, 
10029                               const Int_t&  opt_scale_x, const Int_t& opt_scale_y,
10030                               const TString opt_plot,    const Int_t&  xFlagAutoYsupMargin)
10031 {
10032   // Plot 1D histogram for evolution in time
10033 
10034   UInt_t canv_w = fCnaParHistos->SetCanvasWidth(HistoCode, opt_plot);
10035   UInt_t canv_h = fCnaParHistos->SetCanvasHeight(HistoCode, opt_plot);
10036 
10037   SetGraphPresentation(g_graph0, HistoType.Data(), opt_plot.Data());   // (gStyle parameters)}
10038   
10039   //...................................................... paves commentaires (HistimePlot)      
10040   SetAllPavesViewHisto(HistoCode, StexStin_A, i0StinEcha, i0Sample, opt_plot);
10041   
10042   //..................................................... Canvas name (HistimePlot)
10043   Int_t arg_AlreadyRead = 0;
10044   TString canvas_name = SetCanvasName(HistoCode.Data(), opt_scale_x, opt_scale_y, opt_plot, arg_AlreadyRead,
10045                                       StexStin_A,       i0StinEcha,  i0Sample);
10046           
10047   //------------------------------------------------ Canvas allocation  (HistimePlot)
10048   //......................................... declarations canvas et pad
10049   TCanvas*  MainCanvas = 0;
10050 
10051   if( opt_plot == fOnlyOnePlot )
10052     {MainCanvas = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w , canv_h);   fCnewRoot++;
10053     fCurrentPad = gPad; fCurrentCanvas = MainCanvas; fCurrentCanvasName = canvas_name.Data();}
10054   
10055   if( opt_plot == fSeveralPlot )
10056     {
10057       if(GetMemoFlag(HistoCode, opt_plot) == "Free")
10058         {
10059           MainCanvas = CreateCanvas(HistoCode, opt_plot, canvas_name, canv_w, canv_h);
10060           fCurrentPad = gPad; fCurrentCanvas = MainCanvas; fCurrentCanvasName = canvas_name.Data();
10061         }
10062     }
10063   
10064   if( opt_plot == fSameOnePlot )
10065     {
10066       if(GetMemoFlag(HistoCode, opt_plot) == "Free")
10067         {
10068           MainCanvas = CreateCanvas(HistoCode, opt_plot, canvas_name, canv_w, canv_h);
10069           fCurrentPad = gPad; fCurrentCanvas = MainCanvas; fCurrentCanvasName = canvas_name.Data();
10070         }
10071     }
10072   
10073   // cout << "*TEcnaHistos::HistimePlot(...)> Plot is displayed on canvas ----> " << canvas_name.Data() << endl;
10074 
10075   //--------------- EE => SC for construction, EB => Xtal in SM (default: Stin ECNA number, i0StinEcha)
10076   Int_t Stex_StinCons = StexStin_A;   // Stex_StinCons = Tower for EB, SC for construction for EE
10077   Int_t n1StexCrys    = i0StinEcha+1; // n1StexCrys = Crys in SM for EB
10078 
10079   if( StexStin_A >= 1 && StexStin_A <= fEcal->MaxStinEcnaInStex() )
10080     {
10081       if( fFlagSubDet == "EB" )
10082         {n1StexCrys  = fEcalNumbering->Get1StexCrysFrom1StexStinAnd0StinEcha(StexStin_A, i0StinEcha, fFapStexNumber);}
10083       if( fFlagSubDet == "EE" )
10084         {Stex_StinCons = fEcalNumbering->GetDeeSCConsFrom1DeeSCEcna(fFapStexNumber, StexStin_A);}
10085     }
10086 
10087   //------ String for StexNumber ( to display "EB" or "EE" if Stex = 0 )
10088   TString sFapStexNumber = StexNumberToString(fFapStexNumber);
10089 
10090   //============================================================================= (HistimePlot)
10091   //
10092   //     1st  OPERATIONS:  Pave texts preparation and first Draw.
10093   //                       SetParametersCanvas
10094   //                       Set Memo Flags.
10095   //                       Set main_subpad and main_pavtxt
10096   //
10097   //=============================================================================
10098   TVirtualPad* main_subpad = 0;  //      main_subpad: Pad for the histo
10099   TPaveText*   main_pavtxt = 0;  //      main_pavtxt: pave for changing parameters
10100 
10101   Int_t xMemoPlotSame = 1;   // a priori ==> SAME plot 
10102 
10103   TString QuantityName = fCnaParHistos->GetQuantityName(HistoCode.Data());
10104 
10105   //========================================= Option ONLYONE    (HistimePlot)
10106   if( opt_plot == fOnlyOnePlot )
10107     {
10108       //................................. Draw titles and paves (pad = main canvas)
10109       if( fPavComGeneralTitle != 0 ){fPavComGeneralTitle->Draw();}
10110       fPavComStex->Draw();
10111 
10112       if( !( HistoType == "Global"  || HistoType == "Proj" ) )
10113         {
10114           fPavComStin->Draw();
10115           fPavComXtal->Draw();
10116         }
10117       fPavComEvolNbOfEvtsAna->Draw();
10118       fPavComEvolRuns->Draw();
10119 
10120       Double_t x_low = fCnaParHistos->BoxLeftX("bottom_left_box")   - 0.005;
10121       Double_t x_up  = fCnaParHistos->BoxRightX("bottom_right_box") + 0.005;
10122       Double_t y_low = fCnaParHistos->BoxTopY("bottom_right_box")   + 0.005;
10123       Double_t y_up  = fCnaParHistos->BoxBottomY("top_left_box_EB") - 0.005;
10124 
10125       Double_t x_margin = x_low;
10126       Double_t y_margin = y_low;
10127 
10128       Color_t  fond_pad = fCnaParHistos->ColorDefinition("gris18");
10129 
10130       MainCanvas->Divide( 1,  1, x_margin, y_margin, fond_pad);
10131       //           Divide(nx, ny, x_margin, y_margin,    color);
10132 
10133       gPad->cd(1);
10134       main_subpad = gPad;
10135       main_subpad->SetPad(x_low, y_low, x_up, y_up);
10136 
10137       xMemoPlotSame = 0;
10138     }
10139   //========================================= Options SAME and SAME n   (HistimePlot)
10140   if(opt_plot == fSeveralPlot || opt_plot == fSameOnePlot)
10141     {
10142       if(GetMemoFlag(HistoCode, opt_plot) == "Free")
10143         {
10144           if( fPavComGeneralTitle != 0 ){fPavComGeneralTitle->Draw();}
10145           fPavComSeveralChanging->Draw();
10146 
10147           fPavComEvolRuns->Draw();
10148 
10149           if( !( HistoType == "Global"     || HistoType == "Proj"       ||
10150                  HistoCode == "H_Ped_Date" || HistoCode == "H_TNo_Date" || HistoCode == "H_MCs_Date" ||
10151                  HistoCode == "H_LFN_Date" || HistoCode == "H_HFN_Date" || HistoCode == "H_SCs_Date") )
10152             {
10153               fPavComStin->Draw();
10154               fPavComXtal->Draw();
10155             } 
10156           
10157           if( !( HistoCode == "H_Ped_Date" || HistoCode == "H_TNo_Date" || HistoCode == "H_MCs_Date" ||
10158                  HistoCode == "H_LFN_Date" || HistoCode == "H_HFN_Date" || HistoCode == "H_SCs_Date" ) )
10159             {
10160               fPavComXtal->Draw();
10161             } 
10162           //Call to SetParametersPavTxt
10163           //fPavTxt<HISTOCODE> = fPavComSeveralChanging;  => come from SetAllPavesViewHisto
10164           SetParametersPavTxt(HistoCode, opt_plot);
10165           
10166           //---------------- Call to ActivePavTxt
10167           // main_pavtxt = fPavTxt<HISTOCODE>;} (return main_pavtxt)
10168           main_pavtxt = ActivePavTxt(HistoCode.Data(), opt_plot.Data());
10169           
10170           //-------------------- Set texts for pave "several changing", options SAME and SAME n (HistimePlot)
10171           main_pavtxt->SetTextAlign(fTextPaveAlign);
10172           main_pavtxt->SetTextFont(fTextPaveFont);
10173           main_pavtxt->SetTextSize(fTextPaveSize);
10174           main_pavtxt->SetBorderSize(fTextBorderSize);
10175 
10176           char* f_in = new char[fgMaxCar];                            fCnew++;
10177 
10178           TString DecalStexName = "";
10179           if( fFlagSubDet == "EB" ){DecalStexName = " ";}
10180           TString DecalStinName = "";
10181           if( fFlagSubDet == "EE" ){DecalStinName = "   ";}
10182 
10183           TString sStexOrStasName = "";
10184           if( fFapStexNumber == 0 ){sStexOrStasName = "  ";}
10185           if( fFapStexNumber != 0 ){sStexOrStasName = fFapStexName;}
10186 
10187 
10188           //-----------------------------> HistoType = "EvolProj" => treated in HistoPlot, not here.
10189           if(opt_plot == fSeveralPlot)
10190             {
10191               sprintf(f_in, "Analysis   Samp  Evts range  Nb Evts   %s%s %s%s   %s  %s",
10192                       DecalStexName.Data(), sStexOrStasName.Data(),
10193                       DecalStinName.Data(), fFapStinName.Data(), fFapXtalName.Data(), fFapEchaName.Data());
10194             }
10195           if(opt_plot == fSameOnePlot)
10196             {
10197               sprintf(f_in, "Analysis   Samp  Evts range  Nb Evts   %s%s %s%s   %s  %s",
10198                       DecalStexName.Data(), sStexOrStasName.Data(),
10199                       DecalStinName.Data(), fFapStinName.Data(), fFapXtalName.Data(), fFapEchaName.Data());
10200             }
10201 
10202           //................................................................... (HistimePlot)
10203           TText* ttit = main_pavtxt->AddText(f_in);
10204           ttit->SetTextColor(fCnaParHistos->ColorDefinition("noir"));
10205           
10206           if(opt_plot == fSeveralPlot)
10207             {
10208               sprintf(f_in, "%-10s 1-%2d %5d-%5d  %7d %5s%6d%7d%6d",
10209                       fFapAnaType.Data(), fFapNbOfSamples,
10210                       fFapFirstReqEvtNumber, fFapLastReqEvtNumber, fFapReqNbOfEvts, sFapStexNumber.Data(),
10211                       Stex_StinCons, n1StexCrys, i0StinEcha);
10212             }
10213           if(opt_plot == fSameOnePlot)
10214             {
10215               sprintf(f_in, "%-10s 1-%2d %5d-%5d  %7d %5s%6d%7d%6d %-25s",
10216                       fFapAnaType.Data(), fFapNbOfSamples,
10217                       fFapFirstReqEvtNumber, fFapLastReqEvtNumber, fFapReqNbOfEvts, sFapStexNumber.Data(),
10218                       Stex_StinCons, n1StexCrys, i0StinEcha, QuantityName.Data());
10219             }
10220 
10221           TText* tt = main_pavtxt->AddText(f_in);
10222           tt->SetTextColor(GetViewHistoColor(HistoCode, opt_plot));
10223 
10224           delete [] f_in;      f_in = 0;                                       fCdelete++;
10225 
10226           //---------- Draw the "several changing" pave with its text in the Canvas (FIRST TIME)        (HistimePlot)
10227           main_pavtxt->Draw();
10228 
10229           //---------------- Call to SetParametersCanvas
10230           //fImp<HISTOCODE> = (TRootCanvas*)fCanv<HISTOCODE>->GetCanvasImp();
10231           //fCanv<HISTOCODE>->Divide(1, 1, x_margin_factor , y_margin_factor); gPad->cd(1);
10232           //fPad<HISTOCODE> = gPad;
10233           //fMemoPlot<HISTOCODE> = 1;          =======>  set MemoFlag to "Buzy"
10234           //fMemoColor<HISTOCODE> = 0;
10235           SetParametersCanvas(HistoCode, opt_plot);
10236 
10237           //---------------- Set xMemoPlotSame to 0
10238           xMemoPlotSame = 0;
10239         }
10240 
10241       //............................ cases fMemoPlotxxx = 1            (HistimePlot)
10242       if(GetMemoFlag(HistoCode, opt_plot) == "Busy")
10243         {
10244           //---------------- Call to ActivePavTxt
10245           // main_pavtxt = fPavTxt<HISTOCODE>;} (return main_pavtxt)
10246           main_pavtxt = ActivePavTxt(HistoCode.Data(), opt_plot.Data());
10247           
10248           //---------------- Call to ActivePad
10249           //if( (TRootCanvas*)fCanv<HISTOCODE>->GetCanvasImp() == fImp<HISTOCODE> ){
10250           // main_subpad = fPad<HISTOCODE>;} (return main_subpad)
10251           main_subpad = ActivePad(HistoCode.Data(), opt_plot.Data());  // => return 0 if canvas has been closed
10252 
10253           //---------------- Recover pointer to the current canvas
10254           MainCanvas = GetCurrentCanvas(HistoCode.Data(), opt_plot.Data());
10255         }
10256     }
10257 
10258   //============================================================================= (HistimePlot)
10259   //
10260   //     2nd  OPERATIONS: Write and Draw the parameter values in the
10261   //                      "several changing" pave (options SAME and SAME n)
10262   //                      Draw Histo
10263   //=============================================================================
10264   if(main_subpad != 0)
10265     {
10266       if(opt_plot == fSeveralPlot || opt_plot == fSameOnePlot)
10267         {
10268           if(xMemoPlotSame != 0)
10269             {
10270               main_pavtxt->SetTextAlign(fTextPaveAlign);
10271               main_pavtxt->SetTextFont(fTextPaveFont);
10272               main_pavtxt->SetTextSize(fTextPaveSize);
10273               main_pavtxt->SetBorderSize(fTextBorderSize);
10274 
10275               char* f_in = new char[fgMaxCar];                            fCnew++;
10276               
10277               if(opt_plot == fSeveralPlot )
10278                 {sprintf(f_in, "%-10s 1-%2d %5d-%5d  %7d %5s%6d%7d%6d",
10279                          fFapAnaType.Data(), fFapNbOfSamples, fFapFirstReqEvtNumber, fFapLastReqEvtNumber, fFapReqNbOfEvts,
10280                          sFapStexNumber.Data(), Stex_StinCons, n1StexCrys, i0StinEcha);}
10281               if(opt_plot == fSameOnePlot )
10282                 {sprintf(f_in, "%-10s 1-%2d %5d-%5d  %7d %5s%6d%7d%6d %-25s",
10283                          fFapAnaType.Data(), fFapNbOfSamples, fFapFirstReqEvtNumber, fFapLastReqEvtNumber, fFapReqNbOfEvts,
10284                          sFapStexNumber.Data(), Stex_StinCons, n1StexCrys, i0StinEcha, QuantityName.Data());}
10285               
10286               TText *tt = main_pavtxt->AddText(f_in);
10287               tt->SetTextColor(GetViewHistoColor(HistoCode, opt_plot));
10288               MainCanvas->cd(); gStyle->SetOptDate(0);
10289               main_pavtxt->Draw();
10290 
10291               delete [] f_in;    f_in = 0;                          fCdelete++;
10292             }
10293           main_subpad->cd();
10294           Double_t x_low = fCnaParHistos->BoxLeftX("bottom_left_box")   - 0.005;
10295           Double_t x_up  = fCnaParHistos->BoxRightX("bottom_right_box") + 0.005;
10296           Double_t y_low = fCnaParHistos->BoxTopY("several_evol_box")   + 0.005;
10297           Double_t y_up  = fCnaParHistos->BoxBottomY("general_comment") - 0.005;
10298           if( opt_plot == fSameOnePlot ){y_up = fCnaParHistos->BoxBottomY("top_left_box_EB") - 0.005;}
10299           main_subpad->SetPad(x_low, y_low, x_up, y_up); 
10300         }
10301               
10302       //............................................ Style      (HistimePlot)
10303       SetViewGraphColors(g_graph0, HistoCode, opt_plot);
10304 
10305       //................................. Set axis titles
10306       TString axis_x_var_name = SetHistoXAxisTitle(HistoCode);
10307       TString axis_y_var_name = SetHistoYAxisTitle(HistoCode);
10308       g_graph0->GetXaxis()->SetTitle(axis_x_var_name);
10309       g_graph0->GetYaxis()->SetTitle(axis_y_var_name);
10310 
10311       //................................. Xaxis is a time axis
10312       g_graph0->GetXaxis()->SetTimeDisplay(1);
10313       g_graph0->GetXaxis()->SetTimeFormat("%d %b-%Hh");
10314  
10315       g_graph0->GetXaxis()->SetTimeOffset(xinf);
10316 
10317       Int_t nb_displayed = fCnaParHistos->GetNbOfRunsDisplayed();      // max nb of run numbers displayed
10318 
10319       //...........................................................................     (HistimePlot)
10320       Int_t liny = 0;
10321       Int_t logy = 1;
10322               
10323       if(opt_plot == fOnlyOnePlot)
10324         {
10325           fXinf = (Double_t)xinf;
10326           fXsup = (Double_t)xsup;
10327           fYinf = (Double_t)GetYminValueFromMemo(HistoCode);
10328           fYsup = (Double_t)GetYmaxValueFromMemo(HistoCode);
10329 
10330           gPad->RangeAxis(fXinf, fYinf, fXsup, fYsup);
10331 
10332           //if(opt_scale_y == fOptScaleLiny){gPad->SetLogy(liny);}
10333           if(opt_scale_y == fOptScaleLogy){gPad->SetLogy(logy); g_graph0->Draw("ALP");}
10334 
10335           if(opt_scale_y == fOptScaleLiny)
10336             {
10337               gPad->SetLogy(liny);
10338               g_graph0->Draw("ALP");
10339               Int_t     nb_pts  = g_graph0->GetN();
10340               Double_t* coord_x = g_graph0->GetX();
10341               Double_t* coord_y = g_graph0->GetY();
10342 
10343               char* f_in = new char[fgMaxCar];                            fCnew++;
10344 
10345               //................. display of the run numbers                                         (HistimePlot)
10346               Double_t interv_displayed = (coord_x[nb_pts-1] - coord_x[0])/(Double_t)nb_displayed;
10347               Double_t last_drawn_coordx = coord_x[0] - 1.5*interv_displayed;
10348 
10349               for(Int_t i_run=0; i_run<nb_pts; i_run++)
10350                 {
10351                   if ( (coord_x[i_run] - last_drawn_coordx) > interv_displayed )
10352                     {
10353                       Double_t joinYinf = fYinf;
10354                       Double_t joinYsup = fYsup;
10355                       if( joinYsup <= joinYinf )
10356                         {
10357                           joinYinf =
10358                             GetYminFromGraphFrameAndMarginValue(g_graph0, fCnaParHistos->GetMarginAutoMinMax());
10359                           joinYsup =
10360                             GetYmaxFromGraphFrameAndMarginValue(g_graph0, fCnaParHistos->GetMarginAutoMinMax());
10361                           joinYsup = joinYsup + (joinYsup-joinYinf)/20.;
10362                         }
10363 
10364                       sprintf( f_in, "R%d",  fT1DRunNumber[i_run]);
10365                       TText *text_run_num = new TText(coord_x[i_run], joinYsup, f_in);  fCnewRoot++;
10366                       text_run_num->SetTextAngle((Double_t)45.);
10367                       text_run_num->SetTextSize((Double_t)0.035);
10368                       text_run_num->Draw("SAME");
10369                       // delete text_StexStin_num;             fCdeleteRoot++;
10370 
10371                       TLine *jointlign;
10372                       jointlign = new TLine(coord_x[i_run], joinYsup, coord_x[i_run], coord_y[i_run]); fCnewRoot++;
10373                       jointlign->SetLineWidth(1);
10374                       jointlign->SetLineStyle(2);
10375                       jointlign->Draw("SAME");
10376                       // delete jointlign;                  fCdeleteRoot++;
10377 
10378                       last_drawn_coordx = coord_x[i_run];                           //        (HistimePlot)
10379                     }
10380                 }
10381 
10382               delete [] f_in;      f_in = 0;                                         fCdelete++;
10383 
10384             }
10385           if(opt_scale_y == fOptScaleLogy)
10386             {
10387               gPad->SetLogy(logy);
10388               g_graph0->Draw("ALP");
10389             }
10390         }
10391 
10392       //......................................................................  (HistimePlot)
10393       if(opt_plot == fSeveralPlot || opt_plot == fSameOnePlot)
10394         {
10395           if(xMemoPlotSame == 0)
10396             {
10397               if(opt_scale_y == fOptScaleLiny){gPad->SetLogy(liny);}
10398               if(opt_scale_y == fOptScaleLogy){gPad->SetLogy(logy);
10399 }
10400               g_graph0->Draw("ALP");
10401 
10402               fXinf = (Double_t)xinf;
10403               fXsup = (Double_t)xsup;
10404               fYinf = (Double_t)GetYminValueFromMemo(HistoCode);
10405               fYsup = (Double_t)GetYmaxValueFromMemo(HistoCode); 
10406 
10407               gPad->RangeAxis(fXinf, fYinf, fXsup, fYsup);
10408             }
10409           
10410           if(xMemoPlotSame != 0)                                          //        (HistimePlot)
10411             {
10412               if(opt_scale_y == fOptScaleLiny){gPad->SetLogy(liny);}
10413               if(opt_scale_y == fOptScaleLogy){gPad->SetLogy(logy);}
10414 
10415               g_graph0->Draw("LP");
10416             }
10417         }
10418       gPad->Update();
10419     }
10420   else    // else du if(main_subpad !=0)
10421     {
10422       cout << "*TEcnaHistos::HistimePlot(...)> Canvas not found. Previously closed in option SAME."
10423            << fTTBELL << endl;
10424 
10425       ReInitCanvas(HistoCode, opt_plot);
10426       xMemoPlotSame = 0;
10427     }
10428 
10429   //  delete MainCanvas;                  fCdeleteRoot++;
10430  
10431 } // end of HistimePlot
10432 
10433 //------------------------------------------------------------------------------------------------------
10434 void TEcnaHistos::TopAxisForHistos(TH1D*        h_his0,              const TString opt_plot,
10435                                    const Int_t& xMemoPlotSame,       const Int_t&  min_value, const Int_t&  max_value,
10436                                    const Int_t& xFlagAutoYsupMargin, const Int_t&  HisSize)
10437 {
10438 // Axis on top of the plot to indicate the Stin numbers
10439 
10440   if( opt_plot == fOnlyOnePlot ||
10441       ( (opt_plot == fSeveralPlot) && (xMemoPlotSame == 0) ) ||
10442       ( (opt_plot == fSameOnePlot) && (xMemoPlotSame == 0) ) )
10443     {   
10444       Double_t Maxih = (Double_t)h_his0->GetMaximum();
10445       Double_t Minih = (Double_t)h_his0->GetMinimum();
10446 
10447       if(xFlagAutoYsupMargin == 1)
10448         {
10449           if( Minih >= Maxih ){Minih = (Double_t)0.; Maxih += Maxih;}  // ROOT default if ymin >= ymax
10450           Double_t MaxMarginFactor = (Double_t)0.05;    // frame top line = 5% above the maximum
10451           Maxih += (Maxih-Minih)*MaxMarginFactor;       // ROOT default if ymin < ymax
10452         }
10453 
10454       Double_t v_min = min_value;
10455       Double_t v_max = max_value+(Double_t)1.;
10456       Double_t v_min_p = v_min+(Double_t)1.;
10457       Double_t v_max_p = v_max+(Double_t)1.;
10458 
10459       Int_t ndiv = 50207;
10460       TString opt = "B-";
10461       Double_t Xbegin = 0.;
10462       Double_t Xend   = (Double_t)HisSize;
10463       Double_t ticks  = 0.05;
10464 
10465       if( fFapStexNumber == 0 && fFlagSubDet == "EE" )
10466         {
10467           v_min = 0;
10468           v_max = max_value;
10469           ndiv = 4;
10470           opt = "CSU";                  // first draw axis with ticksize and no label
10471           Xbegin = (Double_t)HisSize;
10472           Xend = 0.;
10473         }
10474 
10475       if( fFapStexNumber > 0 && fFlagSubDet == "EE" )
10476         {
10477           ticks = 0;
10478           if( fFapStexNumber == 1 )
10479             {
10480               v_min = min_value;
10481               v_max = max_value+0.5;
10482               Xbegin = (Double_t)HisSize;
10483               Xend   = 0.;
10484               opt = "CSU";                // first draw axis with no ticksize and no label
10485             }
10486           if( fFapStexNumber == 2 )
10487             {
10488               v_min = min_value+0.5;
10489               v_max = max_value+1.;
10490               Xbegin = (Double_t)HisSize;
10491               Xend   = 0.;
10492               opt = "CSU";                // first draw axis with no ticksize and no label
10493             }
10494           if( fFapStexNumber == 3 )
10495             {
10496               v_min = min_value+0.5;
10497               v_max = max_value+1.;
10498               Xbegin = 0.;
10499               Xend   = (Double_t)HisSize;
10500               opt = "-CSU";                // first draw axis with no ticksize and no label
10501             }
10502           if( fFapStexNumber == 4 )
10503             {
10504               v_min = min_value;
10505               v_max = max_value+0.5;
10506               Xbegin = 0.;
10507               Xend   = (Double_t)HisSize;
10508               opt = "-CSU";                // first draw axis with no ticksize and no label
10509             }
10510           v_min -= 1;
10511           v_max -= 1;
10512           ndiv = 5;
10513         }
10514 
10515       TGaxis* top_axis_x = 0;
10516 
10517       top_axis_x = new TGaxis(Xbegin, Maxih, Xend, Maxih,
10518                                v_min, v_max, ndiv, opt, 0.);         fCnewRoot++;
10519 
10520       top_axis_x->SetTickSize(ticks);
10521       top_axis_x->SetTitleOffset((Float_t)(1.2));
10522       top_axis_x->SetLabelOffset((Float_t)(0.005));
10523 
10524       TString  x_var_name  = "?";
10525       Int_t MaxCar = fgMaxCar;
10526       x_var_name.Resize(MaxCar);
10527       if( fFapStexNumber >  0 )
10528         {
10529           if( fFlagSubDet == "EB"){x_var_name = "Tower number";}
10530           if( fFlagSubDet == "EE")
10531             {
10532               x_var_name = " ";
10533              // x_var_name = "                                                                                                            Data sector"; // don't remove the space characters !
10534             }
10535         }
10536       if( fFapStexNumber == 0 )
10537         {
10538           if( fFlagSubDet == "EB"){x_var_name = "SM number";}
10539           if( fFlagSubDet == "EE"){x_var_name = " ";}
10540         } 
10541       top_axis_x->SetTitle(x_var_name);
10542       top_axis_x->Draw("SAME");
10543       
10544       if( fFlagSubDet == "EE" )
10545         {
10546           // redraw axis with ticksize = 0, with labelOffset<0 or >0 and div centered in middle division
10547           opt = "-MS";
10548           if(fFapStexNumber == 1 || fFapStexNumber == 2 ){opt = "-MS";}
10549           if(fFapStexNumber == 3 || fFapStexNumber == 4 ){opt = "MS";} 
10550           ndiv = 4;
10551           if( fFapStexNumber > 0 ){ndiv = 5;}
10552           TGaxis* top_axis_x_bis = 0;
10553           top_axis_x_bis = new TGaxis(Xbegin, Maxih, Xend, Maxih,
10554                                       v_min_p, v_max_p, ndiv, opt, 0.);   fCnewRoot++;
10555           top_axis_x_bis->SetTickSize(0.);
10556           Float_t lab_siz_x = top_axis_x->GetLabelSize();
10557           top_axis_x_bis->SetLabelSize(lab_siz_x);
10558           top_axis_x_bis->SetLabelOffset(-0.1);
10559 
10560           top_axis_x_bis->SetLabelOffset((Float_t)(9999.));
10561           // if(fFapStexNumber == 1 || fFapStexNumber == 2 ){top_axis_x_bis->SetLabelOffset(-0.07);}
10562           // if(fFapStexNumber == 3 || fFapStexNumber == 4 ){top_axis_x_bis->SetLabelOffset(-0.05);}  
10563           // if(fFapStexNumber == 0 )
10564              //  {top_axis_x_bis->SetLabelOffset((Float_t)(9999.));}  // keep the tick and remove the value
10565           top_axis_x_bis->Draw("SAME");
10566         }
10567     } 
10568 } // end of TopAxisForHistos
10569 
10570 //............................................................................................
10571 void TEcnaHistos::SetAllPavesViewMatrix(const TString   BetweenWhat,
10572                                         const Int_t&    StexStin_A,  const Int_t&  StexStin_B,
10573                                         const Int_t&    i0StinEcha)
10574 {
10575 // Put all the paves of a matrix view
10576 
10577   fPavComGeneralTitle = fCnaParHistos->SetPaveGeneralComment(fFlagGeneralTitle);
10578 
10579   fPavComStex = fCnaParHistos->SetPaveStex("standard", fFapStexNumber);
10580   
10581   if(BetweenWhat == fLFBetweenChannels || BetweenWhat == fHFBetweenChannels)
10582     {fPavComStin = fCnaParHistos->SetPaveStinsXY(StexStin_A, StexStin_B);}
10583   if(BetweenWhat == fBetweenSamples)
10584     {
10585       fPavComStin = fCnaParHistos->SetPaveStin(StexStin_A, fFapStexNumber);
10586       
10587       if( fFlagSubDet == "EB" )
10588         {Int_t n1StexCrys = fEcalNumbering->Get1StexCrysFrom1StexStinAnd0StinEcha(StexStin_A, i0StinEcha, fFapStexNumber);
10589         fPavComXtal = fCnaParHistos->SetPaveCrystal(n1StexCrys, StexStin_A, i0StinEcha);}
10590       if( fFlagSubDet == "EE" )
10591         {TString Dir = fEcalNumbering->GetDeeDirViewedFromIP(fFapStexNumber);
10592         Int_t n1StexCrys = fEcalNumbering->Get1StexCrysFrom1StexStinAnd0StinEcha(StexStin_A, i0StinEcha, fFapStexNumber);
10593         fPavComXtal = fCnaParHistos->SetPaveCrystal(n1StexCrys, StexStin_A, i0StinEcha);}
10594     }
10595 
10596   fPavComAnaRun  = fCnaParHistos->SetPaveAnalysisRun(fFapAnaType,  fFapNbOfSamples, fFapRunNumber, fRunType,
10597                                                      fFapFirstReqEvtNumber, fFapLastReqEvtNumber, "OneCol");
10598   fPavComNbOfEvts = fCnaParHistos->SetPaveNbOfEvts(fFapNbOfEvts, fStartDate, fStopDate, "OneCol");
10599 }
10600 
10601 void TEcnaHistos::SetAllPavesViewStin(const Int_t& StexStin_A)
10602 {
10603 // Put all the paves of a Stin view
10604 
10605   fPavComGeneralTitle = fCnaParHistos->SetPaveGeneralComment(fFlagGeneralTitle);
10606   fPavComStex = fCnaParHistos->SetPaveStex("standard", fFapStexNumber);
10607 
10608   fPavComStin   = fCnaParHistos->SetPaveStin(StexStin_A, fFapStexNumber);
10609 
10610   fPavComAnaRun  = fCnaParHistos->SetPaveAnalysisRun(fFapAnaType, fFapNbOfSamples, fFapRunNumber, fRunType,
10611                                                      fFapFirstReqEvtNumber, fFapLastReqEvtNumber, "OneCol");
10612   fPavComNbOfEvts = fCnaParHistos->SetPaveNbOfEvts(fFapNbOfEvts, fStartDate, fStopDate, "OneCol");
10613 }
10614 
10615 void TEcnaHistos::SetAllPavesViewStinCrysNb(const Int_t& StexNumber, const Int_t& StexStin_A)
10616 {
10617 // Put all the paves of a crystal numbering Stin view
10618 
10619   fPavComStex  = fCnaParHistos->SetPaveStex("standard", StexNumber);
10620   fPavComStin  = fCnaParHistos->SetPaveStin(StexStin_A, StexNumber);
10621 
10622   if( fFlagSubDet == "EB")
10623     {fPavComLVRB   = fCnaParHistos->SetPaveLVRB(StexNumber, StexStin_A);}
10624   if( fFlagSubDet == "EE")
10625     {fPavComCxyz   = fCnaParHistos->SetPaveCxyz(StexNumber);}
10626 }
10627 
10628 void TEcnaHistos::SetAllPavesViewStex(const TString chopt, const Int_t& StexNumber)
10629 {
10630   if( chopt == "Numbering" )
10631     {
10632       fCnaParHistos->SetViewHistoStyle("Stex2DEENb");
10633       gStyle->SetTextColor(fCnaParHistos->ColorDefinition("noir"));
10634       fPavComStex = fCnaParHistos->SetPaveStex("standStex", StexNumber);
10635       if( fFlagSubDet == "EE" ){fPavComCxyz = fCnaParHistos->SetPaveCxyz(StexNumber);}
10636     }
10637   else
10638     {
10639       SetAllPavesViewStex(StexNumber);
10640     }
10641 }
10642 // end of SetAllPavesViewStex(...,...)
10643 
10644 void TEcnaHistos::SetAllPavesViewStex(const Int_t& StexNumber)
10645 {
10646   gStyle->SetTextColor(fCnaParHistos->ColorDefinition("noir"));
10647   fPavComGeneralTitle = fCnaParHistos->SetPaveGeneralComment(fFlagGeneralTitle);
10648   fPavComStex = fCnaParHistos->SetPaveStex("standStex", StexNumber);
10649 
10650   TString opt_pave_nbcol = "OneCol";
10651   if( fFapStexName == "SM"){opt_pave_nbcol = "TwoCol";}
10652     
10653   fPavComAnaRun  = fCnaParHistos->SetPaveAnalysisRun(fFapAnaType, fFapNbOfSamples, fFapRunNumber, fRunType,
10654                                                      fFapFirstReqEvtNumber, fFapLastReqEvtNumber,opt_pave_nbcol);
10655   fPavComNbOfEvts = fCnaParHistos->SetPaveNbOfEvts(fFapNbOfEvts, fStartDate, fStopDate, opt_pave_nbcol); 
10656 }
10657 // end of SetAllPavesViewStex(...)
10658 
10659 void TEcnaHistos::SetAllPavesViewStas()
10660 {
10661   gStyle->SetTextColor(fCnaParHistos->ColorDefinition("noir"));
10662   fPavComGeneralTitle = fCnaParHistos->SetPaveGeneralComment(fFlagGeneralTitle);
10663   fPavComStas = fCnaParHistos->SetPaveStas();
10664 
10665   fPavComAnaRun  = fCnaParHistos->SetPaveAnalysisRun(fFapAnaType, fFapNbOfSamples, fFapRunNumber, fRunType,
10666                                                      fFapFirstReqEvtNumber, fFapLastReqEvtNumber, "OneCol");
10667   fPavComNbOfEvts = fCnaParHistos->SetPaveNbOfEvts(fFapNbOfEvts, fStartDate, fStopDate, "OneCol");
10668 }
10669 // end of SetAllPavesViewStas
10670 
10671 void TEcnaHistos::SetAllPavesViewHisto(const TString HistoCode,  const Int_t&  StexStin_A,
10672                                        const Int_t&  i0StinEcha, const Int_t&  i0Sample,  
10673                                        const TString opt_plot)
10674 {
10675   Int_t arg_AlreadyRead = 0;
10676   SetAllPavesViewHisto(HistoCode, StexStin_A, i0StinEcha, i0Sample, opt_plot, arg_AlreadyRead);
10677 }
10678 
10679 void TEcnaHistos::SetAllPavesViewHisto(const TString HistoCode,  const Int_t&  StexStin_A,
10680                                        const Int_t&  i0StinEcha, const Int_t&  i0Sample,  
10681                                        const TString opt_plot,   const Int_t&  arg_AlreadyRead)
10682 {
10683 // Put all the paves of a histo view according to HistoCode
10684 
10685   gStyle->SetTextColor(fCnaParHistos->ColorDefinition("noir"));
10686 
10687   TString HistoType = fCnaParHistos->GetHistoType(HistoCode.Data());
10688 
10689   fPavComGeneralTitle = fCnaParHistos->SetPaveGeneralComment(fFlagGeneralTitle);
10690 
10691   if(opt_plot == fOnlyOnePlot)
10692     {      
10693       if( !( HistoCode == "D_NOE_ChNb" || HistoCode == "D_NOE_ChDs" ||
10694              HistoCode == "D_Ped_ChNb" || HistoCode == "D_Ped_ChDs" ||
10695              HistoCode == "D_LFN_ChNb" || HistoCode == "D_LFN_ChDs" ||
10696              HistoCode == "D_TNo_ChNb" || HistoCode == "D_TNo_ChDs" || 
10697              HistoCode == "D_HFN_ChNb" || HistoCode == "D_HFN_ChDs" || 
10698              HistoCode == "D_MCs_ChNb" || HistoCode == "D_MCs_ChDs" || 
10699              HistoCode == "D_SCs_ChNb" || HistoCode == "D_SCs_ChDs" ) )
10700         {
10701           fPavComStex = fCnaParHistos->SetPaveStex("standard", fFapStexNumber);
10702           fPavComStin = fCnaParHistos->SetPaveStin(StexStin_A, fFapStexNumber);
10703         }
10704       else
10705         {
10706           if( HistoCode == "D_NOE_ChNb" ||
10707               HistoCode == "D_Ped_ChNb" || HistoCode == "D_TNo_ChNb" ||
10708               HistoCode == "D_MCs_ChNb" || HistoCode == "D_LFN_ChNb" ||
10709               HistoCode == "D_HFN_ChNb" || HistoCode == "D_SCs_ChNb" )
10710             {fPavComStex = fCnaParHistos->SetPaveStex("standGH", fFapStexNumber);}
10711           else
10712             {fPavComStex = fCnaParHistos->SetPaveStex("standard", fFapStexNumber);}
10713         }
10714   //.................................................... (SetAllPavesViewHisto)
10715      
10716       if( HistoCode == "H_Ped_Date" || HistoCode == "H_TNo_Date" || HistoCode == "H_MCs_Date" ||
10717           HistoCode == "H_LFN_Date" || HistoCode == "H_HFN_Date" || HistoCode == "H_SCs_Date" ||
10718           HistoCode == "H_Ped_RuDs" || HistoCode == "H_TNo_RuDs" || HistoCode == "H_MCs_RuDs" ||
10719           HistoCode == "H_LFN_RuDs" || HistoCode == "H_HFN_RuDs" || HistoCode == "H_SCs_RuDs" )
10720         {
10721           Int_t n1StexCrys  =
10722             fEcalNumbering->Get1StexCrysFrom1StexStinAnd0StinEcha(StexStin_A, i0StinEcha, fFapStexNumber);
10723           fPavComXtal = fCnaParHistos->SetPaveCrystal(n1StexCrys, StexStin_A, i0StinEcha);
10724         }
10725 
10726       if( HistoCode == "D_MSp_SpNb" || HistoCode == "D_SSp_SpNb" ||
10727           HistoCode == "D_MSp_SpDs" || HistoCode == "D_SSp_SpDs" )
10728         {
10729           Int_t n1StexCrys  =
10730             fEcalNumbering->Get1StexCrysFrom1StexStinAnd0StinEcha(StexStin_A, i0StinEcha, fFapStexNumber);
10731           fPavComXtal =
10732             fCnaParHistos->SetPaveCrystal(n1StexCrys, StexStin_A, i0StinEcha, arg_AlreadyRead, fPlotAllXtalsInStin);
10733         }
10734 
10735       if( HistoCode == "D_Adc_EvDs" || HistoCode == "D_Adc_EvNb")
10736         {
10737           Int_t n1StexCrys  =
10738             fEcalNumbering->Get1StexCrysFrom1StexStinAnd0StinEcha(StexStin_A, i0StinEcha, fFapStexNumber);
10739           fPavComXtal = fCnaParHistos->SetPaveCrystalSample(n1StexCrys, StexStin_A, i0StinEcha, i0Sample);
10740         }
10741       
10742       if( HistoCode == "H_Ped_Date" || HistoCode == "H_TNo_Date" || HistoCode == "H_MCs_Date" ||
10743           HistoCode == "H_LFN_Date" || HistoCode == "H_HFN_Date" || HistoCode == "H_SCs_Date" ||
10744           HistoCode == "H_Ped_RuDs" || HistoCode == "H_TNo_RuDs" || HistoCode == "H_MCs_RuDs" ||
10745           HistoCode == "H_LFN_RuDs" || HistoCode == "H_HFN_RuDs" || HistoCode == "H_SCs_RuDs" )
10746         {
10747           fPavComEvolNbOfEvtsAna =
10748             fCnaParHistos->SetPaveEvolNbOfEvtsAna(fFapAnaType, fFapNbOfSamples,
10749                                                   fFapFirstReqEvtNumber, fFapLastReqEvtNumber, HistoType);
10750           fPavComEvolRuns = fCnaParHistos->SetPaveEvolRuns(fStartEvolRun, fStartEvolDate,
10751                                                            fStopEvolRun,  fStopEvolDate, opt_plot, HistoType);
10752         }
10753       else
10754         {
10755           fPavComAnaRun = fCnaParHistos->SetPaveAnalysisRun(fFapAnaType, fFapNbOfSamples, fFapRunNumber, fRunType,
10756                                                             fFapFirstReqEvtNumber, fFapLastReqEvtNumber, "OneCol");
10757           fPavComNbOfEvts = fCnaParHistos->SetPaveNbOfEvts(fFapNbOfEvts, fStartDate, fStopDate, "OneCol");
10758         }
10759     }
10760 
10761   //.................................................... (SetAllPavesViewHisto)
10762 
10763   if( opt_plot == fSeveralPlot && GetMemoFlag(HistoCode, opt_plot) == "Free" )
10764     {
10765       if( HistoCode == "H_Ped_Date" || HistoCode == "H_TNo_Date" || HistoCode == "H_MCs_Date" ||
10766           HistoCode == "H_LFN_Date" || HistoCode == "H_HFN_Date" || HistoCode == "H_SCs_Date" ||
10767           HistoCode == "H_Ped_RuDs" || HistoCode == "H_TNo_RuDs" || HistoCode == "H_MCs_RuDs" ||
10768           HistoCode == "H_LFN_RuDs" || HistoCode == "H_HFN_RuDs" || HistoCode == "H_SCs_RuDs" )
10769         {
10770           fPavComSeveralChanging = fCnaParHistos->SetOptionSamePaveBorder("sevevol", HistoType);
10771           fPavComEvolRuns = fCnaParHistos->SetPaveEvolRuns(fStartEvolRun, fStartEvolDate,
10772                                                            fStopEvolRun,  fStopEvolDate, opt_plot, HistoType);
10773         }
10774       else
10775         {
10776           fPavComSeveralChanging = fCnaParHistos->SetOptionSamePaveBorder("several", HistoType);
10777         }
10778     } 
10779 
10780   if( opt_plot == fSameOnePlot && GetMemoFlag(HistoCode, opt_plot) == "Free" )
10781     {
10782       fPavComSeveralChanging = fCnaParHistos->SetOptionSamePaveBorder("several", HistoType);
10783       fPavComEvolRuns = fCnaParHistos->SetPaveEvolRuns(fStartEvolRun, fStartEvolDate,
10784                                                        fStopEvolRun,  fStopEvolDate, opt_plot, HistoType);
10785     } 
10786 
10787 }
10788 // end of SetAllPavesViewHisto
10789 
10790 TString TEcnaHistos::SetCanvasName(const TString HistoCode,
10791                                    const Int_t&  opt_scale_x, const Int_t& opt_scale_y,
10792                                    const TString opt_plot,    const Int_t& arg_AlreadyRead,
10793                                    const Int_t& StexStin_A,   const Int_t& i0StinEcha,  const Int_t& i0Sample)
10794 {
10795   //......... Set Canvas name *===> FOR 1D HISTO ONLY 
10796   //          (for 2D histos, see inside ViewMatrix, ViewStex,...)
10797 
10798   TString canvas_name;
10799   Int_t MaxCar = fgMaxCar;
10800   canvas_name.Resize(MaxCar);
10801   canvas_name = "?";
10802 
10803   char* f_in = new char[fgMaxCar];               fCnew++;
10804 
10805   //......................... name_ opt_plot  (Set Canvas name)
10806   TString  name_opt_plot;
10807   MaxCar = fgMaxCar;
10808   name_opt_plot.Resize(MaxCar);
10809   name_opt_plot = "?";
10810 
10811   //if(opt_plot == fOnlyOnePlot && arg_AlreadyRead == 0){name_opt_plot = "P0";}  // Only one plot
10812   //if(opt_plot == fOnlyOnePlot && arg_AlreadyRead == 1){name_opt_plot = "P1";}  // SAME in Stin plot
10813   //if(opt_plot == fOnlyOnePlot && arg_AlreadyRead >= 1){name_opt_plot = "Pn";}  // SAME in Stin plot
10814 
10815   if( opt_plot == fOnlyOnePlot ){sprintf(f_in,"P%d", arg_AlreadyRead); name_opt_plot = f_in;}
10816 
10817   if(opt_plot == fSeveralPlot)
10818     {
10819       name_opt_plot = "SAME_N";
10820       //...................................... name_same (opt_plot = fSeveralPlot)
10821       Int_t name_same = -1;
10822       
10823       if(HistoCode == "D_NOE_ChNb"){name_same = fCanvSameD_NOE_ChNb;}
10824       if(HistoCode == "D_NOE_ChDs"){name_same = fCanvSameD_NOE_ChDs;}
10825       if(HistoCode == "D_Ped_ChNb"){name_same = fCanvSameD_Ped_ChNb;}
10826       if(HistoCode == "D_Ped_ChDs"){name_same = fCanvSameD_Ped_ChDs;}
10827       if(HistoCode == "D_TNo_ChNb"){name_same = fCanvSameD_TNo_ChNb;}
10828       if(HistoCode == "D_TNo_ChDs"){name_same = fCanvSameD_TNo_ChDs;}
10829       if(HistoCode == "D_MCs_ChNb"){name_same = fCanvSameD_MCs_ChNb;}
10830       if(HistoCode == "D_MCs_ChDs"){name_same = fCanvSameD_MCs_ChDs;}
10831       if(HistoCode == "D_LFN_ChNb"){name_same = fCanvSameD_LFN_ChNb;}
10832       if(HistoCode == "D_LFN_ChDs"){name_same = fCanvSameD_LFN_ChDs;}
10833       if(HistoCode == "D_HFN_ChNb"){name_same = fCanvSameD_HFN_ChNb;}
10834       if(HistoCode == "D_HFN_ChDs"){name_same = fCanvSameD_HFN_ChDs;}
10835       if(HistoCode == "D_SCs_ChNb"){name_same = fCanvSameD_SCs_ChNb;}
10836       if(HistoCode == "D_SCs_ChDs"){name_same = fCanvSameD_SCs_ChDs;}
10837       if(HistoCode == "D_MSp_SpNb"){name_same = fCanvSameD_MSp_SpNb;}
10838       if(HistoCode == "D_MSp_SpDs"){name_same = fCanvSameD_MSp_SpDs;}
10839       if(HistoCode == "D_SSp_SpNb"){name_same = fCanvSameD_SSp_SpNb;}
10840       if(HistoCode == "D_SSp_SpDs"){name_same = fCanvSameD_SSp_SpDs;}
10841       if(HistoCode == "D_Adc_EvDs"){name_same = fCanvSameD_Adc_EvDs;}
10842       if(HistoCode == "D_Adc_EvNb"){name_same = fCanvSameD_Adc_EvNb;}     
10843       if(HistoCode == "H_Ped_Date"){name_same = fCanvSameH_Ped_Date;}
10844       if(HistoCode == "H_TNo_Date"){name_same = fCanvSameH_TNo_Date;}
10845       if(HistoCode == "H_MCs_Date"){name_same = fCanvSameH_MCs_Date;}
10846       if(HistoCode == "H_LFN_Date"){name_same = fCanvSameH_LFN_Date;}
10847       if(HistoCode == "H_HFN_Date"){name_same = fCanvSameH_HFN_Date;}
10848       if(HistoCode == "H_SCs_Date"){name_same = fCanvSameH_SCs_Date;}
10849       if(HistoCode == "H_Ped_RuDs"){name_same = fCanvSameH_Ped_RuDs;}
10850       if(HistoCode == "H_TNo_RuDs"){name_same = fCanvSameH_TNo_RuDs;}
10851       if(HistoCode == "H_MCs_RuDs"){name_same = fCanvSameH_MCs_RuDs;}
10852       if(HistoCode == "H_LFN_RuDs"){name_same = fCanvSameH_LFN_RuDs;}
10853       if(HistoCode == "H_HFN_RuDs"){name_same = fCanvSameH_HFN_RuDs;}
10854       if(HistoCode == "H_SCs_RuDs"){name_same = fCanvSameH_SCs_RuDs;}   
10855 
10856       sprintf(f_in,"%d", name_same);
10857       TString s_name_same = f_in;     
10858       const Text_t *t_name_same = (const Text_t *)s_name_same.Data();
10859       name_opt_plot.Append(t_name_same);
10860     } 
10861   if(opt_plot == fSameOnePlot)
10862     {
10863       name_opt_plot = "SAME_Plus_N";
10864       //...................................... name_same (opt_plot = fSeveralPlot)
10865       Int_t name_same = fCanvSameH1SamePlus;
10866       sprintf(f_in,"%d", name_same);
10867       TString s_name_same = f_in;     
10868       const Text_t *t_name_same = (const Text_t *)s_name_same.Data();
10869       name_opt_plot.Append(t_name_same);
10870     }
10871 
10872   //......................... name_visu (Set Canvas name)
10873   TString name_visu;
10874   MaxCar = fgMaxCar;
10875   name_visu.Resize(MaxCar);
10876   name_visu = "";
10877           
10878   TString name_line;
10879   MaxCar = fgMaxCar;
10880   name_line.Resize(MaxCar);
10881   name_line = "Line_";
10882   TString HistoType = fCnaParHistos->GetHistoType(HistoCode.Data());
10883   if( HistoType == "Global" && (opt_plot == fSeveralPlot || opt_plot == fSameOnePlot) ){name_line = "Polm_";}
10884 
10885   // if(opt_visu == fOptVisLine){name_line = "Line_";}
10886   // if(opt_visu == fOptVisPolm){name_line = "Poly_";}
10887 
10888   const Text_t *t_line = (const Text_t *)name_line.Data();
10889   name_visu.Append(t_line);
10890 
10891   TString name_scale_x;
10892   MaxCar = fgMaxCar;
10893   name_scale_x.Resize(MaxCar);
10894   name_scale_x = "?";
10895   if(opt_scale_x == fOptScaleLinx){name_scale_x = "LinX_";}
10896   if(opt_scale_x == fOptScaleLogx){name_scale_x = "LogX_";}
10897   const Text_t *t_scale_x = (const Text_t *)name_scale_x.Data();
10898   name_visu.Append(t_scale_x);
10899 
10900   TString name_scale_y;
10901   MaxCar = fgMaxCar;
10902   name_scale_y.Resize(MaxCar);
10903   name_scale_y = "?";
10904   if(opt_scale_y == fOptScaleLiny){name_scale_y = "LinY";}
10905   if(opt_scale_y == fOptScaleLogy){name_scale_y = "LogY";}
10906   const Text_t *t_scale_y = (const Text_t *)name_scale_y.Data();
10907   name_visu.Append(t_scale_y);
10908 
10909   //...................................... name quantity (Set Canvas name)
10910   TString  name_quantity;
10911   MaxCar = fgMaxCar;
10912   name_quantity.Resize(MaxCar);
10913   name_quantity = "?";
10914 
10915   if(HistoCode == "D_NOE_ChNb"){name_quantity = "Nb_of_evts_as_func_of_Xtal";}
10916   if(HistoCode == "D_NOE_ChDs"){name_quantity = "Nb_of_evts_Xtal_distrib";}
10917   if(HistoCode == "D_Ped_ChNb"){name_quantity = "Pedestals_as_func_of_Xtal";}
10918   if(HistoCode == "D_Ped_ChDs"){name_quantity = "Pedestals_Xtal_distrib";}
10919   if(HistoCode == "D_TNo_ChNb"){name_quantity = "Total_Noise_as_func_of_Xtal";}
10920   if(HistoCode == "D_TNo_ChDs"){name_quantity = "Total_Noise_Xtal_distrib";}
10921   if(HistoCode == "D_MCs_ChNb"){name_quantity = "Mean_Corss_as_func_of_Xtal";}
10922   if(HistoCode == "D_MCs_ChDs"){name_quantity = "Mean_Corss_Xtal_distrib";}
10923   if(HistoCode == "D_LFN_ChNb"){name_quantity = "Low_Fq_Noise_as_func_of_Xtal";}
10924   if(HistoCode == "D_LFN_ChDs"){name_quantity = "Low_Fq_Noise_Xtal_distrib";}
10925   if(HistoCode == "D_HFN_ChNb"){name_quantity = "High_Fq_Noise_as_func_of_Xtal";}
10926   if(HistoCode == "D_HFN_ChDs"){name_quantity = "High_Fq_Noise_Xtal_distrib";}
10927   if(HistoCode == "D_SCs_ChNb"){name_quantity = "Sigma_Corss_as_func_of_Xtal";}
10928   if(HistoCode == "D_SCs_ChDs"){name_quantity = "Sigma_Corss_Xtal_distrib";}
10929   if(HistoCode == "D_MSp_SpNb"){name_quantity = "ExpValue_of_samples";}
10930   if(HistoCode == "D_MSp_SpDs"){name_quantity = "ExpValue_of_samples_distrib";}
10931   if(HistoCode == "D_SSp_SpNb"){name_quantity = "Sigma_of_samples";}
10932   if(HistoCode == "D_SSp_SpDs"){name_quantity = "Sigma_of_samples_distrib";}
10933   if(HistoCode == "D_Adc_EvDs"){name_quantity = "hevt";}
10934   if(HistoCode == "D_Adc_EvNb"){name_quantity = "ADC_as_func_of_Event";}          
10935   if(HistoCode == "H_Ped_Date"){name_quantity = "Pedestal_history";}
10936   if(HistoCode == "H_TNo_Date"){name_quantity = "Total_Noise_history";}
10937   if(HistoCode == "H_MCs_Date"){name_quantity = "Mean_Corss_history";}
10938   if(HistoCode == "H_LFN_Date"){name_quantity = "Low_Fq_Noise_history";}
10939   if(HistoCode == "H_HFN_Date"){name_quantity = "High_Fq_Noise_history";}
10940   if(HistoCode == "H_SCs_Date"){name_quantity = "Sigma_Corss_history";}
10941   if(HistoCode == "H_Ped_RuDs"){name_quantity = "Pedestal_run_distribution";}
10942   if(HistoCode == "H_TNo_RuDs"){name_quantity = "Total_Noise_run_distribution";}
10943   if(HistoCode == "H_MCs_RuDs"){name_quantity = "Mean_Corss_run_distribution";}
10944   if(HistoCode == "H_LFN_RuDs"){name_quantity = "Low_Fq_Noise_run_distribution";}
10945   if(HistoCode == "H_HFN_RuDs"){name_quantity = "High_Fq_Noise_run_distribution";}
10946   if(HistoCode == "H_SCs_RuDs"){name_quantity = "Sigma_Corss_run_distribution";}
10947 
10948   Int_t num_crys = -1;
10949   if(HistoCode == "D_MSp_SpNb"){num_crys = i0StinEcha;}
10950   if(HistoCode == "D_MSp_SpDs"){num_crys = i0StinEcha;}
10951   if(HistoCode == "D_SSp_SpNb"){num_crys = i0StinEcha;}
10952   if(HistoCode == "D_SSp_SpDs"){num_crys = i0StinEcha;}
10953   if(HistoCode == "D_Adc_EvDs"){num_crys = i0StinEcha;}
10954   if(HistoCode == "D_Adc_EvNb"){num_crys = i0StinEcha;}   
10955   if(HistoCode == "H_Ped_Date"){num_crys = i0StinEcha;}
10956   if(HistoCode == "H_TNo_Date"){num_crys = i0StinEcha;}
10957   if(HistoCode == "H_MCs_Date"){num_crys = i0StinEcha;}
10958   if(HistoCode == "H_LFN_Date"){num_crys = i0StinEcha;}
10959   if(HistoCode == "H_HFN_Date"){num_crys = i0StinEcha;}
10960   if(HistoCode == "H_SCs_Date"){num_crys = i0StinEcha;}
10961   if(HistoCode == "H_Ped_RuDs"){num_crys = i0StinEcha;}
10962   if(HistoCode == "H_TNo_RuDs"){num_crys = i0StinEcha;}
10963   if(HistoCode == "H_MCs_RuDs"){num_crys = i0StinEcha;}
10964   if(HistoCode == "H_LFN_RuDs"){num_crys = i0StinEcha;}
10965   if(HistoCode == "H_HFN_RuDs"){num_crys = i0StinEcha;}
10966   if(HistoCode == "H_SCs_RuDs"){num_crys = i0StinEcha;}
10967 
10968   Int_t num_samp = -1;
10969   if(HistoCode == "D_Adc_EvDs"){num_samp = i0Sample;}
10970   if(HistoCode == "D_Adc_EvNb"){num_samp = i0Sample;}
10971 
10972   //........................................................... (Set Canvas name)
10973   
10974   if (HistoCode == "D_NOE_ChNb" || HistoCode == "D_NOE_ChDs" || 
10975       HistoCode == "D_Ped_ChNb" || HistoCode == "D_Ped_ChDs" ||
10976       HistoCode == "D_TNo_ChNb" || HistoCode == "D_TNo_ChDs" ||
10977       HistoCode == "D_MCs_ChNb" || HistoCode == "D_MCs_ChDs" ||
10978       HistoCode == "D_LFN_ChNb" || HistoCode == "D_LFN_ChDs" || 
10979       HistoCode == "D_HFN_ChNb" || HistoCode == "D_HFN_ChDs" ||
10980       HistoCode == "D_SCs_ChNb" || HistoCode == "D_SCs_ChDs" )
10981     {
10982       sprintf(f_in, "%s_%s_S1_%d_R%d_%d_%d_%d_%s%d_%s_%s",
10983               name_quantity.Data(), fFapAnaType.Data(),
10984               fFapNbOfSamples, fFapRunNumber, fFapFirstReqEvtNumber, fFapLastReqEvtNumber, fFapReqNbOfEvts,
10985               fFapStexName.Data(), fFapStexNumber,
10986               name_opt_plot.Data(), name_visu.Data());
10987     }
10988   
10989   if (HistoCode == "D_MSp_SpNb" || HistoCode == "D_SSp_SpNb" ||
10990       HistoCode == "H_Ped_Date" || HistoCode == "H_TNo_Date" || HistoCode == "H_MCs_Date" ||
10991       HistoCode == "H_LFN_Date" || HistoCode == "H_HFN_Date" || HistoCode == "H_SCs_Date" ||
10992       HistoCode == "D_MSp_SpDs" || HistoCode == "D_SSp_SpDs" ||
10993       HistoCode == "H_Ped_RuDs" || HistoCode == "H_TNo_RuDs" || HistoCode == "H_MCs_RuDs" ||
10994       HistoCode == "H_LFN_RuDs" || HistoCode == "H_HFN_RuDs" || HistoCode == "H_SCs_RuDs")
10995     {
10996       sprintf(f_in, "%s_%s_S1_%d_R%d_%d_%d_%d_%s%d_%s%d_Xtal%d_%s_%s",
10997               name_quantity.Data(), fFapAnaType.Data(), 
10998               fFapNbOfSamples, fFapRunNumber, fFapFirstReqEvtNumber, fFapLastReqEvtNumber, fFapReqNbOfEvts,
10999               fFapStexName.Data(), fFapStexNumber, fFapStinName.Data(), StexStin_A, num_crys,
11000               name_opt_plot.Data(), name_visu.Data()); 
11001     }
11002   
11003   if (HistoCode == "D_Adc_EvNb" || HistoCode == "D_Adc_EvDs")
11004     {
11005       sprintf(f_in, "%s_%s_S1_%d_R%d_%d_%d_%d_%s%d_%s%d_Xtal%d_Samp%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, num_samp,
11009               name_opt_plot.Data(), name_visu.Data());
11010     }
11011   
11012   canvas_name = f_in;
11013   delete [] f_in;    f_in = 0;              fCdelete++;
11014   return canvas_name.Data();
11015   
11016 }  // end of CanvasName()
11017 
11018 //-----------------------------------------------------------------------------
11019 //
11020 //        M I S C E L L A N E O U S     P A R A M E T E R S
11021 //
11022 //        C O N C E R N I N G    T H E    D I S P L A Y   
11023 //
11024 //-----------------------------------------------------------------------------
11025 
11026 //===========================================================================
11027 //
11028 //  GetHistoSize, GetHistoValues, SetHistoXAxisTitle,   SetHistoYAxisTitle,
11029 //  GetHistoXinf, GetHistoXsup,   GetHistoNumberOfBins, FillHisto
11030 //
11031 //===========================================================================
11032 Int_t TEcnaHistos::GetHistoSize(const TString chqcode, const TString opt_plot_read)
11033 {
11034 // Histo size as a function of the quantity code
11035 
11036 // VERY IMPORTANT: in some cases the number of bins must be strictly related to the parameters values
11037 //                 (number of crystals, number of samples, etc...). See below comments "===> ONE BIN BY..."
11038 
11039   Int_t HisSize = fNbBinsProj;   // default value
11040 
11041   //............ histo with sample number as x coordinate => HisSize depends on option "plot" or "read"
11042   //             because of nb of samples in file: size for plot = 10 even if nb of samples in file < 10
11043   if( chqcode == "D_MSp_SpNb" ||  chqcode == "D_SSp_SpNb" ||
11044       chqcode == "D_MSp_SpDs" ||  chqcode == "D_SSp_SpDs" )
11045     {
11046       if( opt_plot_read == "read" ){HisSize = fFapNbOfSamples;}
11047       if( opt_plot_read == "plot" ){HisSize = fEcal->MaxSampADC();}
11048     }   // ===> ONE BIN BY SAMPLE
11049 
11050   //............ histo with event number as x coordinate.  (==> "D_Adc_EvDs" option: obsolete, to be confirmed)
11051   if(chqcode == "D_Adc_EvNb" || chqcode == "D_Adc_EvDs"){HisSize = fFapReqNbOfEvts;}   // ===> ONE BIN BY EVENT
11052   
11053   //............ 
11054   if(chqcode == "D_NOE_ChNb" ||
11055      chqcode == "D_Ped_ChNb" || chqcode == "D_TNo_ChNb" || chqcode == "D_MCs_ChNb" ||
11056      chqcode == "D_LFN_ChNb" || chqcode == "D_HFN_ChNb" || chqcode == "D_SCs_ChNb" ||
11057      chqcode == "D_NOE_ChDs" ||
11058      chqcode == "D_Ped_ChDs" || chqcode == "D_TNo_ChDs" || chqcode == "D_MCs_ChDs" || 
11059      chqcode == "D_LFN_ChDs" || chqcode == "D_HFN_ChDs" || chqcode == "D_SCs_ChDs" )
11060     {
11061       if( fFlagSubDet == "EB" )
11062         {
11063           if( fFapStexNumber >  0 ){HisSize = fEcal->MaxCrysEcnaInStex();}             // ===> ONE BIN BY Xtal
11064           if( fFapStexNumber == 0 ){HisSize = fEcal->MaxSMInEB()*fEcal->MaxTowInSM();} // ===> ONE BIN BY Tower
11065         }
11066       if( fFlagSubDet == "EE" )
11067         {
11068           if( fFapStexNumber >  0 )
11069             {
11070               if( opt_plot_read == "read" ){HisSize = fEcal->MaxCrysEcnaInDee();}
11071               if( opt_plot_read == "plot" ){HisSize = fEcal->MaxCrysForConsInDee();}
11072             }                                                           // ===> ONE BIN BY Xtal
11073           if( fFapStexNumber == 0 )
11074             {HisSize = fEcal->MaxDeeInEE()*fEcal->MaxSCForConsInDee();} // ===> ONE BIN BY SC
11075         }
11076     }
11077 
11078   if( chqcode == "H_Ped_RuDs" || chqcode == "H_TNo_RuDs" || chqcode == "H_MCs_RuDs" || 
11079       chqcode == "H_LFN_RuDs" || chqcode == "H_HFN_RuDs" || chqcode == "H_SCs_RuDs" )
11080     {
11081       HisSize = fNbBinsProj;
11082     }
11083 
11084   return HisSize;
11085 }
11086 
11087 TVectorD TEcnaHistos::GetHistoValues(const TVectorD& arg_read_histo, const Int_t&  arg_AlreadyRead,
11088                                      TEcnaRead*      aMyRootFile,    const TString HistoCode,
11089                                      const Int_t&    HisSizePlot,    const Int_t&  HisSizeRead,
11090                                      const Int_t&    StexStin_A,     const Int_t&  i0StinEcha,
11091                                      const Int_t&    i0Sample,       Int_t&  i_data_exist)
11092 {
11093   // Histo values in a TVectorD. i_data_exist entry value = 0. Incremented in this method.
11094 
11095   TVectorD plot_histo(HisSizePlot); for(Int_t i=0; i<HisSizePlot; i++){plot_histo(i)=(Double_t)0.;}
11096 
11097   fStatusDataExist = kFALSE;
11098 
11099   if( arg_AlreadyRead >= 1 )
11100     {
11101       //cout << "*TEcnaHistos::GetHistoValues(...)> arg_AlreadyRead = " << arg_AlreadyRead << endl;
11102       for(Int_t i=0; i<HisSizeRead; i++){plot_histo(i)=arg_read_histo(i);}
11103       fStatusDataExist = kTRUE; i_data_exist++;
11104     }
11105 
11106   if( arg_AlreadyRead == 0 )
11107     {
11108       //cout << "*TEcnaHistos::GetHistoValues(...)> arg_AlreadyRead = " << arg_AlreadyRead << endl;
11109       TVectorD read_histo(HisSizeRead); for(Int_t i=0; i<HisSizeRead; i++){read_histo(i)=(Double_t)0.;}
11110 
11111       if( HistoCode == "D_MSp_SpNb" || HistoCode == "D_MSp_SpDs" ||
11112           HistoCode == "D_SSp_SpNb" || HistoCode == "D_SSp_SpDs" )
11113         {
11114           //====> For plots as a function of Sample# (read10->plot10, read3->plot10)
11115           if( HisSizeRead <= HisSizePlot )
11116             {
11117               if (HistoCode == "D_MSp_SpNb" || HistoCode == "D_MSp_SpDs" )
11118                 {
11119                   read_histo = aMyRootFile->ReadSampleMeans(StexStin_A, i0StinEcha, HisSizeRead);
11120                   if( aMyRootFile->DataExist() == kTRUE ){fStatusDataExist = kTRUE; i_data_exist++;}
11121                   for(Int_t i=0; i<HisSizeRead; i++){plot_histo(i)=read_histo(i);}
11122                 }
11123           
11124               if (HistoCode == "D_SSp_SpNb" || HistoCode == "D_SSp_SpDs" )
11125                 {
11126                   read_histo = aMyRootFile->ReadSampleSigmas(StexStin_A, i0StinEcha, HisSizeRead);
11127                   if( aMyRootFile->DataExist() == kTRUE ){fStatusDataExist = kTRUE; i_data_exist++;}
11128                   for(Int_t i=0; i<HisSizeRead; i++){plot_histo(i)=read_histo(i);}
11129                 }
11130             }
11131           else
11132             {
11133               cout << "!TEcnaHistos::GetHistoValues(...)> *** ERROR *** > HisSizeRead greater than HisSizePlot"
11134                    << " for plot as a function of sample#. HisSizeRead = " << HisSizeRead
11135                    << ", HisSizePlot = " << HisSizePlot << fTTBELL << endl;
11136             }
11137         } // end of if( HistoCode == "D_MSp_SpNb" || HistoCode == "D_SSp_SpNb" " ||
11138           //            HistoCode == "D_SSp_SpNb" || HistoCode == "D_SSp_SpDs" )
11139 
11140       if( !(HistoCode == "D_MSp_SpNb" || HistoCode == "D_SSp_SpNb" ||
11141             HistoCode == "D_MSp_SpDs" || HistoCode == "D_SSp_SpDs" ) )  // = else of previous if
11142         {
11143           //====> For other plots
11144           if( HisSizeRead == HisSizePlot )
11145             {
11146               //========> for EE, HisSizeRead > HisSizePlot but readEcna#->plotForCons# will be build in the calling method
11147               //          HisSizeRead = fEcal->MaxCrysEcnaInStex() (GetHistoValues)
11148 
11149               if( HistoCode == "D_Adc_EvNb" || HistoCode == "D_Adc_EvDs" )
11150                 {
11151                   read_histo = aMyRootFile->ReadSampleAdcValues(StexStin_A, i0StinEcha, i0Sample, HisSizeRead);
11152                   if( aMyRootFile->DataExist() == kTRUE ){fStatusDataExist = kTRUE; i_data_exist++;}
11153                 }
11154 
11155               if( HistoCode == "D_NOE_ChNb" || HistoCode == "D_NOE_ChDs" )
11156                 {
11157                   read_histo = aMyRootFile->ReadNumberOfEvents(HisSizeRead);
11158                   if( aMyRootFile->DataExist() == kTRUE ){fStatusDataExist = kTRUE; i_data_exist++;}
11159                 }
11160       
11161               if( HistoCode == "D_Ped_ChNb" || HistoCode == "D_Ped_ChDs" )
11162                 {
11163                   read_histo = aMyRootFile->ReadPedestals(HisSizeRead);
11164                   if( aMyRootFile->DataExist() == kTRUE ){fStatusDataExist = kTRUE; i_data_exist++;}
11165                 }
11166       
11167               //...................................................... (GetHistoValues)
11168               if( HistoCode == "D_TNo_ChNb" || HistoCode == "D_TNo_ChDs")
11169                 {
11170                   read_histo = aMyRootFile->ReadTotalNoise(HisSizeRead);
11171                   if( aMyRootFile->DataExist() == kTRUE ){fStatusDataExist = kTRUE; i_data_exist++;}
11172                 }
11173       
11174               if( HistoCode == "D_LFN_ChNb" || HistoCode == "D_LFN_ChDs" )
11175                 {
11176                   read_histo = aMyRootFile->ReadLowFrequencyNoise(HisSizeRead);
11177                   if( aMyRootFile->DataExist() == kTRUE ){fStatusDataExist = kTRUE; i_data_exist++;}
11178                 
11179                 }
11180       
11181               if( HistoCode == "D_HFN_ChNb" || HistoCode == "D_HFN_ChDs" )
11182                 {
11183                   read_histo = aMyRootFile->ReadHighFrequencyNoise(HisSizeRead);
11184                   if( aMyRootFile->DataExist() == kTRUE ){fStatusDataExist = kTRUE; i_data_exist++;}
11185                 
11186                 }
11187 
11188               if( HistoCode == "D_MCs_ChNb" || HistoCode == "D_MCs_ChDs" )
11189                 {
11190                   read_histo = aMyRootFile->ReadMeanCorrelationsBetweenSamples(HisSizeRead);
11191                   if( aMyRootFile->DataExist() == kTRUE ){fStatusDataExist = kTRUE; i_data_exist++;}
11192                 }
11193 
11194               if( HistoCode == "D_SCs_ChNb" || HistoCode == "D_SCs_ChDs"  )
11195                 {
11196                   read_histo = aMyRootFile->ReadSigmaOfCorrelationsBetweenSamples(HisSizeRead);
11197                   if( aMyRootFile->DataExist() == kTRUE ){fStatusDataExist = kTRUE; i_data_exist++;}
11198                 }
11199 
11200               for(Int_t i=0; i<HisSizeRead; i++){plot_histo(i)=read_histo(i);}
11201             
11202             }
11203           else
11204             {
11205               cout << "!TEcnaHistos::GetHistoValues(...)> *** ERROR *** > HisSizeRead not equal to HisSizePlot."
11206                    << " HisSizeRead = " << HisSizeRead
11207                    << ", HisSizePlot = " << HisSizePlot << fTTBELL << endl;
11208             }
11209         }  // end of if( !(HistoCode == "D_MSp_SpNb" || HistoCode == "D_SSp_SpNb") )
11210     }  // end of if( arg_AlreadyRead == 0 )
11211 
11212   if( i_data_exist == 0 )
11213     {
11214       cout << "!TEcnaHistos::GetHistoValues(...)> Histo not found." << fTTBELL << endl;
11215     }
11216 
11217   return plot_histo;
11218 }
11219 //------- (end of GetHistoValues) -------------
11220 
11221 TString  TEcnaHistos::SetHistoXAxisTitle(const TString HistoCode)
11222 {
11223   // Set histo X axis title
11224 
11225   TString axis_x_var_name;
11226   
11227   if(HistoCode == "D_NOE_ChNb" || HistoCode == "D_Ped_ChNb" ||
11228      HistoCode == "D_TNo_ChNb" || HistoCode == "D_MCs_ChNb" ||
11229      HistoCode == "D_LFN_ChNb" || HistoCode == "D_HFN_ChNb" ||
11230      HistoCode == "D_SCs_ChNb" )
11231     {
11232       if( fFapStexNumber >  0 )
11233         {
11234           if( fFlagSubDet == "EB" ){axis_x_var_name = "Xtal (electronic channel number)";}
11235           if( fFlagSubDet == "EE" ){axis_x_var_name = "Xtal";}
11236         }
11237       if( fFapStexNumber ==  0 )
11238         {
11239           if( fFlagSubDet == "EB" ){axis_x_var_name = "Tower number";}
11240           if( fFlagSubDet == "EE" ){axis_x_var_name = "SC number";}
11241         }
11242     }
11243 
11244   if(HistoCode == "D_NOE_ChDs"){axis_x_var_name = "Number of events";}
11245   if(HistoCode == "D_Ped_ChDs"){axis_x_var_name = "Pedestal";}
11246   if(HistoCode == "D_TNo_ChDs"){axis_x_var_name = "Total noise";}
11247   if(HistoCode == "D_MCs_ChDs"){axis_x_var_name = "Mean cor(s,s')";}
11248   if(HistoCode == "D_LFN_ChDs"){axis_x_var_name = "Low frequency noise";} 
11249   if(HistoCode == "D_HFN_ChDs"){axis_x_var_name = "High frequency noise";}
11250   if(HistoCode == "D_SCs_ChDs"){axis_x_var_name = "Sigmas cor(s,s')";}
11251   if(HistoCode == "D_MSp_SpNb"){axis_x_var_name = "Sample";}
11252   if(HistoCode == "D_MSp_SpDs"){axis_x_var_name = "Pedestal";}
11253   if(HistoCode == "D_SSp_SpNb"){axis_x_var_name = "Sample";}
11254   if(HistoCode == "D_SSp_SpDs"){axis_x_var_name = "Total noise";}
11255   if(HistoCode == "D_Adc_EvDs"){axis_x_var_name = "ADC";}
11256   if(HistoCode == "D_Adc_EvNb"){axis_x_var_name = "Event number";}
11257   if(HistoCode == "H_Ped_Date" || HistoCode == "H_TNo_Date" || HistoCode == "H_MCs_Date" ||
11258      HistoCode == "H_LFN_Date" || HistoCode == "H_HFN_Date" || HistoCode == "H_SCs_Date")
11259     {axis_x_var_name = "Time";}
11260   if(HistoCode == "H_Ped_RuDs"){axis_x_var_name = "Pedestal";}
11261   if(HistoCode == "H_TNo_RuDs"){axis_x_var_name = "Total noise";}
11262   if(HistoCode == "H_MCs_RuDs"){axis_x_var_name = "Mean cor(s,s')";}
11263   if(HistoCode == "H_LFN_RuDs"){axis_x_var_name = "Low frequency noise";} 
11264   if(HistoCode == "H_HFN_RuDs"){axis_x_var_name = "High frequency noise";}
11265   if(HistoCode == "H_SCs_RuDs"){axis_x_var_name = "Sigmas cor(s,s')";} 
11266 
11267   return axis_x_var_name; 
11268 }
11269 
11270 TString  TEcnaHistos::SetHistoYAxisTitle(const TString HistoCode)
11271 {
11272 // Set histo Y axis title
11273 
11274   TString axis_y_var_name;
11275 
11276   if(HistoCode == "D_NOE_ChNb"){axis_y_var_name = "Number of events";}
11277   if(HistoCode == "D_Ped_ChNb"){axis_y_var_name = "Pedestal";}
11278   if(HistoCode == "D_TNo_ChNb"){axis_y_var_name = "Total noise";}
11279   if(HistoCode == "D_MCs_ChNb"){axis_y_var_name = "Mean cor(s,s')";}
11280   if(HistoCode == "D_LFN_ChNb"){axis_y_var_name = "Low frequency noise";} 
11281   if(HistoCode == "D_HFN_ChNb"){axis_y_var_name = "High frequency noise";}  
11282   if(HistoCode == "D_SCs_ChNb"){axis_y_var_name = "Sigma of cor(s,s')";}
11283   
11284   if(HistoCode == "D_NOE_ChDs" ||
11285      HistoCode == "D_Ped_ChDs" || HistoCode == "D_TNo_ChDs" || HistoCode == "D_MCs_ChDs" ||
11286      HistoCode == "D_LFN_ChDs" || HistoCode == "D_HFN_ChDs" || HistoCode == "D_SCs_ChDs" )  
11287     {
11288       if( fFapStexNumber >  0 ){axis_y_var_name = "number of crystals";}
11289       if( fFapStexNumber == 0 )
11290         {
11291           if( fFlagSubDet == "EB" ){axis_y_var_name = "number of towers";}
11292           if( fFlagSubDet == "EE" ){axis_y_var_name = "number of SC's";}
11293         }
11294     }
11295 
11296   if(HistoCode == "D_MSp_SpNb"){axis_y_var_name = "Sample mean";}
11297   if(HistoCode == "D_MSp_SpDs"){axis_y_var_name = "Number of samples";}
11298   if(HistoCode == "D_SSp_SpNb"){axis_y_var_name = "Sample sigma";}
11299   if(HistoCode == "D_SSp_SpDs"){axis_y_var_name = "Number of samples";}
11300   if(HistoCode == "D_Adc_EvNb"){axis_y_var_name = "Sample ADC value";}
11301   if(HistoCode == "D_Adc_EvDs"){axis_y_var_name = "Number of events";}
11302   if(HistoCode == "H_Ped_Date"){axis_y_var_name = "Pedestal";}
11303   if(HistoCode == "H_TNo_Date"){axis_y_var_name = "Total noise";}
11304   if(HistoCode == "H_MCs_Date"){axis_y_var_name = "Mean cor(s,s')";}
11305   if(HistoCode == "H_LFN_Date"){axis_y_var_name = "Low frequency noise";}
11306   if(HistoCode == "H_HFN_Date"){axis_y_var_name = "High frequency noise";}
11307   if(HistoCode == "H_SCs_Date"){axis_y_var_name = "Sigma cor(s,s')";}
11308 
11309   if(HistoCode == "H_Ped_RuDs" || HistoCode == "H_TNo_RuDs" || HistoCode == "H_MCs_RuDs" ||
11310      HistoCode == "H_LFN_RuDs" || HistoCode == "H_HFN_RuDs" ||  HistoCode == "H_SCs_RuDs" ) 
11311     {axis_y_var_name = "number of runs";}
11312 
11313   return axis_y_var_name;
11314 }
11315 //-------------------------------------------------------------------------------
11316 Axis_t TEcnaHistos::GetHistoXinf(const TString HistoCode, const Int_t& HisSize, const TString opt_plot)
11317 {
11318 // Set histo Xinf
11319 
11320   Axis_t xinf_his = (Axis_t)0;
11321 
11322   if(HistoCode == "D_NOE_ChNb"){xinf_his = (Axis_t)0.;}
11323   if(HistoCode == "D_Ped_ChNb"){xinf_his = (Axis_t)0.;}
11324   if(HistoCode == "D_TNo_ChNb"){xinf_his = (Axis_t)0.;}
11325   if(HistoCode == "D_MCs_ChNb"){xinf_his = (Axis_t)0.;}
11326   if(HistoCode == "D_LFN_ChNb"){xinf_his = (Axis_t)0.;} 
11327   if(HistoCode == "D_HFN_ChNb"){xinf_his = (Axis_t)0.;}  
11328   if(HistoCode == "D_SCs_ChNb"){xinf_his = (Axis_t)0.;}
11329   if(HistoCode == "D_MSp_SpNb"){xinf_his = (Axis_t)0.;}
11330   if(HistoCode == "D_SSp_SpNb"){xinf_his = (Axis_t)0.;}
11331   if(HistoCode == "D_Adc_EvNb"){xinf_his = (Axis_t)0.;}
11332 
11333   if(HistoCode == "D_NOE_ChDs"){xinf_his = (Axis_t)fD_NOE_ChNbYmin;}  // D_XXX_YYDs = projection of D_XXX_YYNb
11334   if(HistoCode == "D_Ped_ChDs"){xinf_his = (Axis_t)fD_Ped_ChNbYmin;}
11335   if(HistoCode == "D_TNo_ChDs"){xinf_his = (Axis_t)fD_TNo_ChNbYmin;}
11336   if(HistoCode == "D_MCs_ChDs"){xinf_his = (Axis_t)fD_MCs_ChNbYmin;}
11337   if(HistoCode == "D_LFN_ChDs"){xinf_his = (Axis_t)fD_LFN_ChNbYmin;}
11338   if(HistoCode == "D_HFN_ChDs"){xinf_his = (Axis_t)fD_HFN_ChNbYmin;}
11339   if(HistoCode == "D_SCs_ChDs"){xinf_his = (Axis_t)fD_SCs_ChNbYmin;}
11340   if(HistoCode == "D_MSp_SpDs"){xinf_his = (Axis_t)fD_MSp_SpNbYmin;}
11341   if(HistoCode == "D_SSp_SpDs"){xinf_his = (Axis_t)fD_SSp_SpNbYmin;}
11342   if(HistoCode == "D_Adc_EvDs"){xinf_his = (Axis_t)fD_Adc_EvNbYmin;}
11343 
11344   if(HistoCode == "H_Ped_Date"){xinf_his = (Axis_t)0.;}
11345   if(HistoCode == "H_TNo_Date"){xinf_his = (Axis_t)0.;}
11346   if(HistoCode == "H_MCs_Date"){xinf_his = (Axis_t)0.;}
11347   if(HistoCode == "H_LFN_Date"){xinf_his = (Axis_t)0.;}
11348   if(HistoCode == "H_HFN_Date"){xinf_his = (Axis_t)0.;}
11349   if(HistoCode == "H_SCs_Date"){xinf_his = (Axis_t)0.;}
11350 
11351   if(HistoCode == "H_Ped_RuDs"){xinf_his = (Axis_t)fH_Ped_RuDsYmin;}
11352   if(HistoCode == "H_TNo_RuDs"){xinf_his = (Axis_t)fH_TNo_RuDsYmin;}
11353   if(HistoCode == "H_MCs_RuDs"){xinf_his = (Axis_t)fH_MCs_RuDsYmin;}
11354   if(HistoCode == "H_LFN_RuDs"){xinf_his = (Axis_t)fH_LFN_RuDsYmin;}
11355   if(HistoCode == "H_HFN_RuDs"){xinf_his = (Axis_t)fH_HFN_RuDsYmin;}
11356   if(HistoCode == "H_SCs_RuDs"){xinf_his = (Axis_t)fH_SCs_RuDsYmin;}
11357 
11358   return xinf_his;
11359 }
11360 
11361 Axis_t TEcnaHistos::GetHistoXsup(const TString HistoCode, const Int_t& HisSize, const TString opt_plot)
11362 {
11363 // Set histo Xsup
11364 
11365   Axis_t xsup_his = (Axis_t)0; 
11366 
11367   if(HistoCode == "D_NOE_ChNb"){xsup_his = (Axis_t)HisSize;}
11368   if(HistoCode == "D_Ped_ChNb"){xsup_his = (Axis_t)HisSize;}
11369   if(HistoCode == "D_TNo_ChNb"){xsup_his = (Axis_t)HisSize;}
11370   if(HistoCode == "D_MCs_ChNb"){xsup_his = (Axis_t)HisSize;}
11371   if(HistoCode == "D_LFN_ChNb"){xsup_his = (Axis_t)HisSize;} 
11372   if(HistoCode == "D_HFN_ChNb"){xsup_his = (Axis_t)HisSize;}  
11373   if(HistoCode == "D_SCs_ChNb"){xsup_his = (Axis_t)HisSize;}
11374   if(HistoCode == "D_MSp_SpNb"){xsup_his = (Axis_t)HisSize;}
11375   if(HistoCode == "D_SSp_SpNb"){xsup_his = (Axis_t)HisSize;}
11376   if(HistoCode == "D_Adc_EvNb"){xsup_his = (Axis_t)(fFapReqNbOfEvts);}
11377 
11378   if(HistoCode == "D_NOE_ChDs"){xsup_his = (Axis_t)fD_NOE_ChNbYmax;}
11379   if(HistoCode == "D_Ped_ChDs"){xsup_his = (Axis_t)fD_Ped_ChNbYmax;}
11380   if(HistoCode == "D_TNo_ChDs"){xsup_his = (Axis_t)fD_TNo_ChNbYmax;}
11381   if(HistoCode == "D_MCs_ChDs"){xsup_his = (Axis_t)fD_MCs_ChNbYmax;}
11382   if(HistoCode == "D_LFN_ChDs"){xsup_his = (Axis_t)fD_LFN_ChNbYmax;}
11383   if(HistoCode == "D_HFN_ChDs"){xsup_his = (Axis_t)fD_HFN_ChNbYmax;}
11384   if(HistoCode == "D_SCs_ChDs"){xsup_his = (Axis_t)fD_SCs_ChNbYmax;}
11385   if(HistoCode == "D_MSp_SpDs"){xsup_his = (Axis_t)fD_MSp_SpNbYmax;}
11386   if(HistoCode == "D_SSp_SpDs"){xsup_his = (Axis_t)fD_SSp_SpNbYmax;}
11387   if(HistoCode == "D_Adc_EvDs"){xsup_his = (Axis_t)fD_Adc_EvNbYmax;}
11388 
11389   if(HistoCode == "H_Ped_Date"){xsup_his = (Axis_t)0.;}
11390   if(HistoCode == "H_TNo_Date"){xsup_his = (Axis_t)0.;}
11391   if(HistoCode == "H_MCs_Date"){xsup_his = (Axis_t)0.;}
11392   if(HistoCode == "H_LFN_Date"){xsup_his = (Axis_t)0.;}
11393   if(HistoCode == "H_HFN_Date"){xsup_his = (Axis_t)0.;}
11394   if(HistoCode == "H_SCs_Date"){xsup_his = (Axis_t)0.;}
11395 
11396   if(HistoCode == "H_Ped_RuDs"){xsup_his = (Axis_t)fH_Ped_RuDsYmax;}
11397   if(HistoCode == "H_TNo_RuDs"){xsup_his = (Axis_t)fH_TNo_RuDsYmax;}
11398   if(HistoCode == "H_MCs_RuDs"){xsup_his = (Axis_t)fH_MCs_RuDsYmax;}
11399   if(HistoCode == "H_LFN_RuDs"){xsup_his = (Axis_t)fH_LFN_RuDsYmax;}
11400   if(HistoCode == "H_HFN_RuDs"){xsup_his = (Axis_t)fH_HFN_RuDsYmax;}
11401   if(HistoCode == "H_SCs_RuDs"){xsup_his = (Axis_t)fH_SCs_RuDsYmax;}
11402 
11403   return xsup_his;
11404 }
11405 //-----------------------------------------------------------------------------------
11406 Int_t TEcnaHistos::GetHistoNumberOfBins(const TString HistoCode, const Int_t& HisSize)
11407 {
11408 // Set histo number of bins
11409 
11410   Int_t nb_binx = HisSize;
11411   TString HistoType = fCnaParHistos->GetHistoType(HistoCode.Data());
11412   if ( HistoType == "Proj"     ||  HistoType == "SampProj" ||
11413        HistoType == "EvolProj" || HistoType == "H1BasicProj" )
11414     {nb_binx = fNbBinsProj;}
11415 
11416   return nb_binx;
11417 }
11418 //-----------------------------------------------------------------------------------
11419 void TEcnaHistos::FillHisto(TH1D* h_his0, const TVectorD& read_histo, const TString HistoCode,
11420                             const Int_t&  HisSize)
11421 {
11422 // Fill histo
11423 
11424   h_his0->Reset();
11425 
11426   for(Int_t i=0; i<HisSize; i++)
11427     {
11428       Double_t his_val = (Double_t)0;
11429       Double_t xi      = (Double_t)0;
11430       //................................................... Basic + Global
11431       if (HistoCode == "D_NOE_ChNb" || HistoCode == "D_Ped_ChNb" ||
11432           HistoCode == "D_LFN_ChNb" || HistoCode == "D_TNo_ChNb" ||
11433           HistoCode == "D_HFN_ChNb" || HistoCode == "D_MCs_ChNb" ||
11434           HistoCode == "D_SCs_ChNb" || HistoCode == "D_MSp_SpNb" || HistoCode == "D_SSp_SpNb" )
11435         {
11436           xi = (Double_t)i;
11437           his_val = (Double_t)read_histo[i];
11438           h_his0->Fill(xi, his_val);
11439         }
11440 
11441       //................................................... D_Adc_EvNb option
11442       if (HistoCode == "D_Adc_EvNb" )
11443         {
11444           xi = (Double_t)i;
11445           his_val = (Double_t)read_histo[i];
11446           h_his0->Fill(xi, his_val);
11447         }
11448       //................................................... Proj
11449       if (HistoCode == "D_NOE_ChDs" ||
11450           HistoCode == "D_Ped_ChDs" || HistoCode == "D_LFN_ChDs" ||
11451           HistoCode == "D_TNo_ChDs" || HistoCode == "D_HFN_ChDs" ||
11452           HistoCode == "D_MCs_ChDs" || HistoCode == "D_SCs_ChDs" ||
11453           HistoCode == "D_MSp_SpDs" || HistoCode == "D_SSp_SpDs" ||
11454           HistoCode == "D_Adc_EvDs" )
11455         {
11456           his_val = (Double_t)read_histo[i];
11457           Double_t increment = (Double_t)1;
11458           h_his0->Fill(his_val, increment);
11459         }
11460 
11461       //................................................... EvolProj
11462       //
11463       //    *=======> direct Fill in ViewHistime(...)
11464       //
11465     }
11466 }
11467 
11468 //===========================================================================
11469 //
11470 //          SetXinfMemoFromValue(...), SetXsupMemoFromValue(...)
11471 //          GetXsupValueFromMemo(...), GetXsupValueFromMemo(...)
11472 //
11473 //===========================================================================
11474 void TEcnaHistos::SetXinfMemoFromValue(const TString HistoCode, const Double_t& value)
11475 {
11476   if( HistoCode == "D_NOE_ChNb"){fD_NOE_ChNbXinf = value;}
11477   if( HistoCode == "D_NOE_ChDs"){fD_NOE_ChDsXinf = value;}  
11478   if( HistoCode == "D_Ped_ChNb"){fD_Ped_ChNbXinf = value;} 
11479   if( HistoCode == "D_Ped_ChDs"){fD_Ped_ChDsXinf = value;} 
11480   if( HistoCode == "D_TNo_ChNb"){fD_TNo_ChNbXinf = value;}
11481   if( HistoCode == "D_TNo_ChDs"){fD_TNo_ChDsXinf = value;} 
11482   if( HistoCode == "D_MCs_ChNb"){fD_MCs_ChNbXinf = value;} 
11483   if( HistoCode == "D_MCs_ChDs"){fD_MCs_ChDsXinf = value;} 
11484   if( HistoCode == "D_LFN_ChNb"){fD_LFN_ChNbXinf = value;} 
11485   if( HistoCode == "D_LFN_ChDs"){fD_LFN_ChDsXinf = value;}
11486   if( HistoCode == "D_HFN_ChNb"){fD_HFN_ChNbXinf = value;} 
11487   if( HistoCode == "D_HFN_ChDs"){fD_HFN_ChDsXinf = value;} 
11488   if( HistoCode == "D_SCs_ChNb"){fD_SCs_ChNbXinf = value;}
11489   if( HistoCode == "D_SCs_ChDs"){fD_SCs_ChDsXinf = value;}
11490   if( HistoCode == "D_MSp_SpNb"){fD_Ped_ChNbXinf = value;}
11491   if( HistoCode == "D_MSp_SpDs"){fD_Ped_ChDsXinf = value;}
11492   if( HistoCode == "D_SSp_SpNb"){fD_TNo_ChNbXinf = value;}
11493   if( HistoCode == "D_SSp_SpDs"){fD_TNo_ChDsXinf = value;}
11494   if( HistoCode == "D_Adc_EvNb"){fD_Ped_ChNbXinf = value;}
11495   if( HistoCode == "D_Adc_EvDs"){fD_Adc_EvDsXinf = value;}
11496   if( HistoCode == "H_Ped_Date"){fH_Ped_DateXinf = value;}
11497   if( HistoCode == "H_TNo_Date"){fH_TNo_DateXinf = value;}
11498   if( HistoCode == "H_MCs_Date"){fH_MCs_DateXinf = value;}
11499   if( HistoCode == "H_LFN_Date"){fH_LFN_DateXinf = value;}
11500   if( HistoCode == "H_HFN_Date"){fH_HFN_DateXinf = value;}
11501   if( HistoCode == "H_SCs_Date"){fH_SCs_DateXinf = value;}
11502   if( HistoCode == "H_Ped_RuDs"){fH_Ped_RuDsXinf = value;}
11503   if( HistoCode == "H_TNo_RuDs"){fH_TNo_RuDsXinf = value;}
11504   if( HistoCode == "H_MCs_RuDs"){fH_MCs_RuDsXinf = value;}
11505   if( HistoCode == "H_LFN_RuDs"){fH_LFN_RuDsXinf = value;}
11506   if( HistoCode == "H_HFN_RuDs"){fH_HFN_RuDsXinf = value;}
11507   if( HistoCode == "H_SCs_RuDs"){fH_SCs_RuDsXinf = value;}
11508 }// end of SetXinfMemoFromValue(...)
11509 
11510 void TEcnaHistos::SetXinfMemoFromValue(const Double_t& value)
11511 {fH1SameOnePlotXinf = value;}
11512 
11513 void TEcnaHistos::SetXsupMemoFromValue(const TString HistoCode, const Double_t& value)
11514 {
11515   if( HistoCode == "D_NOE_ChNb"){fD_NOE_ChNbXsup = value;}
11516   if( HistoCode == "D_NOE_ChDs"){fD_NOE_ChDsXsup = value;}  
11517   if( HistoCode == "D_Ped_ChNb"){fD_Ped_ChNbXsup = value;} 
11518   if( HistoCode == "D_Ped_ChDs"){fD_Ped_ChDsXsup = value;} 
11519   if( HistoCode == "D_TNo_ChNb"){fD_TNo_ChNbXsup = value;}
11520   if( HistoCode == "D_TNo_ChDs"){fD_TNo_ChDsXsup = value;} 
11521   if( HistoCode == "D_MCs_ChNb"){fD_MCs_ChNbXsup = value;} 
11522   if( HistoCode == "D_MCs_ChDs"){fD_MCs_ChDsXsup = value;} 
11523   if( HistoCode == "D_LFN_ChNb"){fD_LFN_ChNbXsup = value;} 
11524   if( HistoCode == "D_LFN_ChDs"){fD_LFN_ChDsXsup = value;}
11525   if( HistoCode == "D_HFN_ChNb"){fD_HFN_ChNbXsup = value;} 
11526   if( HistoCode == "D_HFN_ChDs"){fD_HFN_ChDsXsup = value;} 
11527   if( HistoCode == "D_SCs_ChNb"){fD_SCs_ChNbXsup = value;}
11528   if( HistoCode == "D_SCs_ChDs"){fD_SCs_ChDsXsup = value;}
11529   if( HistoCode == "D_MSp_SpNb"){fD_Ped_ChNbXsup = value;}
11530   if( HistoCode == "D_MSp_SpDs"){fD_Ped_ChDsXsup = value;}
11531   if( HistoCode == "D_SSp_SpNb"){fD_TNo_ChNbXsup = value;}
11532   if( HistoCode == "D_SSp_SpDs"){fD_TNo_ChDsXsup = value;}
11533   if( HistoCode == "D_Adc_EvNb"){fD_Ped_ChNbXsup = value;}
11534   if( HistoCode == "D_Adc_EvDs"){fD_Adc_EvDsXsup = value;}
11535   if( HistoCode == "H_Ped_Date"){fH_Ped_DateXsup = value;}
11536   if( HistoCode == "H_TNo_Date"){fH_TNo_DateXsup = value;}
11537   if( HistoCode == "H_MCs_Date"){fH_MCs_DateXsup = value;}
11538   if( HistoCode == "H_LFN_Date"){fH_LFN_DateXsup = value;}
11539   if( HistoCode == "H_HFN_Date"){fH_HFN_DateXsup = value;}
11540   if( HistoCode == "H_SCs_Date"){fH_SCs_DateXsup = value;}
11541   if( HistoCode == "H_Ped_RuDs"){fH_Ped_RuDsXsup = value;}
11542   if( HistoCode == "H_TNo_RuDs"){fH_TNo_RuDsXsup = value;}
11543   if( HistoCode == "H_MCs_RuDs"){fH_MCs_RuDsXsup = value;}
11544   if( HistoCode == "H_LFN_RuDs"){fH_LFN_RuDsXsup = value;}
11545   if( HistoCode == "H_HFN_RuDs"){fH_HFN_RuDsXsup = value;}
11546   if( HistoCode == "H_SCs_RuDs"){fH_SCs_RuDsXsup = value;}
11547 }// end of SetXsupMemoFromValue(...)
11548 
11549 void TEcnaHistos::SetXsupMemoFromValue(const Double_t& value)
11550 {fH1SameOnePlotXsup = value;}
11551 
11552 Double_t TEcnaHistos::GetXinfValueFromMemo(const TString HistoCode)
11553 {
11554   Double_t val_inf      = (Double_t)0.;
11555 
11556    if( HistoCode == "D_NOE_ChNb"){val_inf = fD_NOE_ChNbXinf;}
11557    if( HistoCode == "D_NOE_ChDs"){val_inf = fD_NOE_ChDsXinf;}  
11558    if( HistoCode == "D_Ped_ChNb"){val_inf = fD_Ped_ChNbXinf;} 
11559    if( HistoCode == "D_Ped_ChDs"){val_inf = fD_Ped_ChDsXinf;} 
11560    if( HistoCode == "D_TNo_ChNb"){val_inf = fD_TNo_ChNbXinf;}
11561    if( HistoCode == "D_TNo_ChDs"){val_inf = fD_TNo_ChDsXinf;} 
11562    if( HistoCode == "D_MCs_ChNb"){val_inf = fD_MCs_ChNbXinf;} 
11563    if( HistoCode == "D_MCs_ChDs"){val_inf = fD_MCs_ChDsXinf;} 
11564    if( HistoCode == "D_LFN_ChNb"){val_inf = fD_LFN_ChNbXinf;} 
11565    if( HistoCode == "D_LFN_ChDs"){val_inf = fD_LFN_ChDsXinf;}
11566    if( HistoCode == "D_HFN_ChNb"){val_inf = fD_HFN_ChNbXinf;} 
11567    if( HistoCode == "D_HFN_ChDs"){val_inf = fD_HFN_ChDsXinf;} 
11568    if( HistoCode == "D_SCs_ChNb"){val_inf = fD_SCs_ChNbXinf;}
11569    if( HistoCode == "D_SCs_ChDs"){val_inf = fD_SCs_ChDsXinf;}
11570    if( HistoCode == "D_MSp_SpNb"){val_inf = fD_Ped_ChNbXinf;}
11571    if( HistoCode == "D_MSp_SpDs"){val_inf = fD_Ped_ChDsXinf;}
11572    if( HistoCode == "D_SSp_SpNb"){val_inf = fD_TNo_ChNbXinf;}
11573    if( HistoCode == "D_SSp_SpDs"){val_inf = fD_TNo_ChDsXinf;}
11574    if( HistoCode == "D_Adc_EvNb"){val_inf = fD_Adc_EvNbXinf;}
11575    if( HistoCode == "D_Adc_EvDs"){val_inf = fD_Adc_EvDsXinf;}
11576    if( HistoCode == "H_Ped_Date"){val_inf = fH_Ped_DateXinf;}
11577    if( HistoCode == "H_TNo_Date"){val_inf = fH_TNo_DateXinf;}
11578    if( HistoCode == "H_MCs_Date"){val_inf = fH_MCs_DateXinf;}
11579    if( HistoCode == "H_LFN_Date"){val_inf = fH_LFN_DateXinf;}
11580    if( HistoCode == "H_HFN_Date"){val_inf = fH_HFN_DateXinf;}
11581    if( HistoCode == "H_SCs_Date"){val_inf = fH_SCs_DateXinf;}
11582    if( HistoCode == "H_Ped_RuDs"){val_inf = fH_Ped_RuDsXinf;}
11583    if( HistoCode == "H_TNo_RuDs"){val_inf = fH_TNo_RuDsXinf;}
11584    if( HistoCode == "H_MCs_RuDs"){val_inf = fH_MCs_RuDsXinf;}
11585    if( HistoCode == "H_LFN_RuDs"){val_inf = fH_LFN_RuDsXinf;}
11586    if( HistoCode == "H_HFN_RuDs"){val_inf = fH_HFN_RuDsXinf;}
11587    if( HistoCode == "H_SCs_RuDs"){val_inf = fH_SCs_RuDsXinf;}
11588   return val_inf;
11589 }// end of GetXinfValueFromMemo(...)
11590 
11591 Double_t TEcnaHistos::GetXinfValueFromMemo()
11592 {return fH1SameOnePlotXinf;}
11593 
11594 Double_t TEcnaHistos::GetXsupValueFromMemo(const TString HistoCode)
11595 {
11596   Double_t val_sup      = (Double_t)0.;
11597 
11598    if( HistoCode == "D_NOE_ChNb"){val_sup = fD_NOE_ChNbXsup;}
11599    if( HistoCode == "D_NOE_ChDs"){val_sup = fD_NOE_ChDsXsup;}  
11600    if( HistoCode == "D_Ped_ChNb"){val_sup = fD_Ped_ChNbXsup;} 
11601    if( HistoCode == "D_Ped_ChDs"){val_sup = fD_Ped_ChDsXsup;} 
11602    if( HistoCode == "D_TNo_ChNb"){val_sup = fD_TNo_ChNbXsup;}
11603    if( HistoCode == "D_TNo_ChDs"){val_sup = fD_TNo_ChDsXsup;} 
11604    if( HistoCode == "D_MCs_ChNb"){val_sup = fD_MCs_ChNbXsup;} 
11605    if( HistoCode == "D_MCs_ChDs"){val_sup = fD_MCs_ChDsXsup;} 
11606    if( HistoCode == "D_LFN_ChNb"){val_sup = fD_LFN_ChNbXsup;} 
11607    if( HistoCode == "D_LFN_ChDs"){val_sup = fD_LFN_ChDsXsup;}
11608    if( HistoCode == "D_HFN_ChNb"){val_sup = fD_HFN_ChNbXsup;} 
11609    if( HistoCode == "D_HFN_ChDs"){val_sup = fD_HFN_ChDsXsup;} 
11610    if( HistoCode == "D_SCs_ChNb"){val_sup = fD_SCs_ChNbXsup;}
11611    if( HistoCode == "D_SCs_ChDs"){val_sup = fD_SCs_ChDsXsup;}
11612    if( HistoCode == "D_MSp_SpNb"){val_sup = fD_Ped_ChNbXsup;}
11613    if( HistoCode == "D_MSp_SpDs"){val_sup = fD_Ped_ChDsXsup;}
11614    if( HistoCode == "D_SSp_SpNb"){val_sup = fD_TNo_ChNbXsup;}
11615    if( HistoCode == "D_SSp_SpDs"){val_sup = fD_TNo_ChDsXsup;}
11616    if( HistoCode == "D_Adc_EvNb"){val_sup = fD_Adc_EvNbXsup;}
11617    if( HistoCode == "D_Adc_EvDs"){val_sup = fD_Adc_EvDsXsup;}
11618    if( HistoCode == "H_Ped_Date"){val_sup = fH_Ped_DateXsup;}
11619    if( HistoCode == "H_TNo_Date"){val_sup = fH_TNo_DateXsup;}
11620    if( HistoCode == "H_MCs_Date"){val_sup = fH_MCs_DateXsup;}
11621    if( HistoCode == "H_LFN_Date"){val_sup = fH_LFN_DateXsup;}
11622    if( HistoCode == "H_HFN_Date"){val_sup = fH_HFN_DateXsup;}
11623    if( HistoCode == "H_SCs_Date"){val_sup = fH_SCs_DateXsup;}
11624    if( HistoCode == "H_Ped_RuDs"){val_sup = fH_Ped_RuDsXsup;}
11625    if( HistoCode == "H_TNo_RuDs"){val_sup = fH_TNo_RuDsXsup;}
11626    if( HistoCode == "H_MCs_RuDs"){val_sup = fH_MCs_RuDsXsup;}
11627    if( HistoCode == "H_LFN_RuDs"){val_sup = fH_LFN_RuDsXsup;}
11628    if( HistoCode == "H_HFN_RuDs"){val_sup = fH_HFN_RuDsXsup;}
11629    if( HistoCode == "H_SCs_RuDs"){val_sup = fH_SCs_RuDsXsup;}
11630   return val_sup;
11631 }// end of GetXsupValueFromMemo(...)
11632 
11633 Double_t TEcnaHistos::GetXsupValueFromMemo()
11634 {return fH1SameOnePlotXsup;}
11635 
11636 //-------------------------------------------------------------------------------------------
11637 //
11638 //           SetHistoMin, SetHistoMax, SetAllYminYmaxMemoFromDefaultValues
11639 //
11640 //-------------------------------------------------------------------------------------------
11641 void TEcnaHistos::SetHistoMin(const Double_t& value){fUserHistoMin = value; fFlagUserHistoMin = "ON";}
11642 void TEcnaHistos::SetHistoMax(const Double_t& value){fUserHistoMax = value; fFlagUserHistoMax = "ON";}
11643 
11644 void TEcnaHistos::SetHistoMin(){fFlagUserHistoMin = "AUTO";}
11645 void TEcnaHistos::SetHistoMax(){fFlagUserHistoMax = "AUTO";}
11646 
11647 void TEcnaHistos::SetAllYminYmaxMemoFromDefaultValues()
11648 {
11649 //.......... Default values for histo min and max
11650 
11651   SetYminMemoFromValue("D_NOE_ChNb", fCnaParHistos->GetYminDefaultValue("D_NOE_ChNb"));
11652   SetYmaxMemoFromValue("D_NOE_ChNb", fCnaParHistos->GetYmaxDefaultValue("D_NOE_ChNb"));
11653 
11654   SetYminMemoFromValue("D_NOE_ChDs", fCnaParHistos->GetYminDefaultValue("D_NOE_ChDs"));
11655   SetYmaxMemoFromValue("D_NOE_ChDs", fCnaParHistos->GetYmaxDefaultValue("D_NOE_ChDs"));
11656 
11657   SetYminMemoFromValue("D_Ped_ChNb", fCnaParHistos->GetYminDefaultValue("D_Ped_ChNb"));
11658   SetYmaxMemoFromValue("D_Ped_ChNb", fCnaParHistos->GetYmaxDefaultValue("D_Ped_ChNb"));
11659 
11660   SetYminMemoFromValue("D_Ped_ChDs", fCnaParHistos->GetYminDefaultValue("D_Ped_ChDs"));
11661   SetYmaxMemoFromValue("D_Ped_ChDs", fCnaParHistos->GetYmaxDefaultValue("D_Ped_ChDs"));
11662 
11663   SetYminMemoFromValue("D_TNo_ChNb", fCnaParHistos->GetYminDefaultValue("D_TNo_ChNb"));
11664   SetYmaxMemoFromValue("D_TNo_ChNb", fCnaParHistos->GetYmaxDefaultValue("D_TNo_ChNb"));
11665 
11666   SetYminMemoFromValue("D_TNo_ChDs", fCnaParHistos->GetYminDefaultValue("D_TNo_ChDs"));
11667   SetYmaxMemoFromValue("D_TNo_ChDs", fCnaParHistos->GetYmaxDefaultValue("D_TNo_ChDs"));
11668 
11669   SetYminMemoFromValue("D_MCs_ChNb", fCnaParHistos->GetYminDefaultValue("D_MCs_ChNb"));
11670   SetYmaxMemoFromValue("D_MCs_ChNb", fCnaParHistos->GetYmaxDefaultValue("D_MCs_ChNb"));
11671 
11672   SetYminMemoFromValue("D_MCs_ChDs", fCnaParHistos->GetYminDefaultValue("D_MCs_ChDs"));
11673   SetYmaxMemoFromValue("D_MCs_ChDs", fCnaParHistos->GetYmaxDefaultValue("D_MCs_ChDs"));
11674 
11675   SetYminMemoFromValue("D_LFN_ChNb", fCnaParHistos->GetYminDefaultValue("D_LFN_ChNb"));
11676   SetYmaxMemoFromValue("D_LFN_ChNb", fCnaParHistos->GetYmaxDefaultValue("D_LFN_ChNb"));
11677 
11678   SetYminMemoFromValue("D_LFN_ChDs", fCnaParHistos->GetYminDefaultValue("D_LFN_ChDs"));
11679   SetYmaxMemoFromValue("D_LFN_ChDs", fCnaParHistos->GetYmaxDefaultValue("D_LFN_ChDs"));
11680 
11681   SetYminMemoFromValue("D_HFN_ChNb", fCnaParHistos->GetYminDefaultValue("D_HFN_ChNb"));
11682   SetYmaxMemoFromValue("D_HFN_ChNb", fCnaParHistos->GetYmaxDefaultValue("D_HFN_ChNb"));
11683 
11684   SetYminMemoFromValue("D_HFN_ChDs", fCnaParHistos->GetYminDefaultValue("D_HFN_ChDs"));
11685   SetYmaxMemoFromValue("D_HFN_ChDs", fCnaParHistos->GetYmaxDefaultValue("D_HFN_ChDs"));
11686 
11687   SetYminMemoFromValue("D_SCs_ChNb", fCnaParHistos->GetYminDefaultValue("D_SCs_ChNb"));
11688   SetYmaxMemoFromValue("D_SCs_ChNb", fCnaParHistos->GetYmaxDefaultValue("D_SCs_ChNb"));
11689 
11690   SetYminMemoFromValue("D_SCs_ChDs", fCnaParHistos->GetYminDefaultValue("D_SCs_ChDs"));
11691   SetYmaxMemoFromValue("D_SCs_ChDs", fCnaParHistos->GetYmaxDefaultValue("D_SCs_ChDs"));
11692 
11693   SetYminMemoFromValue("D_MSp_SpNb", fCnaParHistos->GetYminDefaultValue("D_MSp_SpNb"));
11694   SetYmaxMemoFromValue("D_MSp_SpNb", fCnaParHistos->GetYmaxDefaultValue("D_MSp_SpNb"));
11695 
11696   SetYminMemoFromValue("D_MSp_SpDs", fCnaParHistos->GetYminDefaultValue("D_MSp_SpDs"));
11697   SetYmaxMemoFromValue("D_MSp_SpDs", fCnaParHistos->GetYmaxDefaultValue("D_MSp_SpDs"));
11698 
11699   SetYminMemoFromValue("D_SSp_SpNb", fCnaParHistos->GetYminDefaultValue("D_SSp_SpNb"));
11700   SetYmaxMemoFromValue("D_SSp_SpNb", fCnaParHistos->GetYmaxDefaultValue("D_SSp_SpNb"));
11701 
11702   SetYminMemoFromValue("D_SSp_SpDs", fCnaParHistos->GetYminDefaultValue("D_SSp_SpDs"));
11703   SetYmaxMemoFromValue("D_SSp_SpDs", fCnaParHistos->GetYmaxDefaultValue("D_SSp_SpDs"));
11704 
11705   SetYminMemoFromValue("D_Adc_EvDs", fCnaParHistos->GetYminDefaultValue("D_Adc_EvDs"));
11706   SetYmaxMemoFromValue("D_Adc_EvDs", fCnaParHistos->GetYmaxDefaultValue("D_Adc_EvDs"));
11707 
11708   SetYminMemoFromValue("D_Adc_EvNb", fCnaParHistos->GetYminDefaultValue("D_Adc_EvNb"));
11709   SetYmaxMemoFromValue("D_Adc_EvNb", fCnaParHistos->GetYmaxDefaultValue("D_Adc_EvNb"));
11710 
11711   SetYminMemoFromValue("H_Ped_Date", fCnaParHistos->GetYminDefaultValue("H_Ped_Date"));
11712   SetYmaxMemoFromValue("H_Ped_Date", fCnaParHistos->GetYmaxDefaultValue("H_Ped_Date"));
11713 
11714   SetYminMemoFromValue("H_TNo_Date", fCnaParHistos->GetYminDefaultValue("H_TNo_Date"));
11715   SetYmaxMemoFromValue("H_TNo_Date", fCnaParHistos->GetYmaxDefaultValue("H_TNo_Date"));
11716 
11717   SetYminMemoFromValue("H_LFN_Date", fCnaParHistos->GetYminDefaultValue("H_LFN_Date"));
11718   SetYmaxMemoFromValue("H_LFN_Date", fCnaParHistos->GetYmaxDefaultValue("H_LFN_Date"));
11719 
11720   SetYminMemoFromValue("H_HFN_Date", fCnaParHistos->GetYminDefaultValue("H_HFN_Date"));
11721   SetYmaxMemoFromValue("H_HFN_Date", fCnaParHistos->GetYmaxDefaultValue("H_HFN_Date"));
11722 
11723   SetYminMemoFromValue("H_MCs_Date", fCnaParHistos->GetYminDefaultValue("H_MCs_Date"));
11724   SetYmaxMemoFromValue("H_MCs_Date", fCnaParHistos->GetYmaxDefaultValue("H_MCs_Date"));
11725 
11726   SetYminMemoFromValue("H_SCs_Date", fCnaParHistos->GetYminDefaultValue("H_SCs_Date"));
11727   SetYmaxMemoFromValue("H_SCs_Date", fCnaParHistos->GetYmaxDefaultValue("H_SCs_Date"));
11728 
11729   SetYminMemoFromValue("H_Ped_RuDs", fCnaParHistos->GetYminDefaultValue("H_Ped_RuDs"));
11730   SetYmaxMemoFromValue("H_Ped_RuDs", fCnaParHistos->GetYmaxDefaultValue("H_Ped_RuDs"));
11731 
11732   SetYminMemoFromValue("H_TNo_RuDs", fCnaParHistos->GetYminDefaultValue("H_TNo_RuDs"));
11733   SetYmaxMemoFromValue("H_TNo_RuDs", fCnaParHistos->GetYmaxDefaultValue("H_TNo_RuDs"));
11734 
11735   SetYminMemoFromValue("H_LFN_RuDs", fCnaParHistos->GetYminDefaultValue("H_LFN_RuDs"));
11736   SetYmaxMemoFromValue("H_LFN_RuDs", fCnaParHistos->GetYmaxDefaultValue("H_LFN_RuDs"));
11737 
11738   SetYminMemoFromValue("H_HFN_RuDs", fCnaParHistos->GetYminDefaultValue("H_HFN_RuDs"));
11739   SetYmaxMemoFromValue("H_HFN_RuDs", fCnaParHistos->GetYmaxDefaultValue("H_HFN_RuDs"));
11740 
11741   SetYminMemoFromValue("H_MCs_RuDs", fCnaParHistos->GetYminDefaultValue("H_MCs_RuDs"));
11742   SetYmaxMemoFromValue("H_MCs_RuDs", fCnaParHistos->GetYmaxDefaultValue("H_MCs_RuDs"));
11743 
11744   SetYminMemoFromValue("H_SCs_RuDs", fCnaParHistos->GetYminDefaultValue("H_SCs_RuDs"));
11745   SetYmaxMemoFromValue("H_SCs_RuDs", fCnaParHistos->GetYmaxDefaultValue("H_SCs_RuDs"));
11746 
11747   SetYminMemoFromValue("H2LFccMosMatrix", fCnaParHistos->GetYminDefaultValue("H2LFccMosMatrix"));
11748   SetYmaxMemoFromValue("H2LFccMosMatrix", fCnaParHistos->GetYmaxDefaultValue("H2LFccMosMatrix"));
11749 
11750   SetYminMemoFromValue("H2HFccMosMatrix", fCnaParHistos->GetYminDefaultValue("H2HFccMosMatrix"));
11751   SetYmaxMemoFromValue("H2HFccMosMatrix", fCnaParHistos->GetYmaxDefaultValue("H2HFccMosMatrix"));
11752 
11753   SetYminMemoFromValue("H2CorccInStins",  fCnaParHistos->GetYminDefaultValue("H2CorccInStins"));
11754   SetYmaxMemoFromValue("H2CorccInStins",  fCnaParHistos->GetYmaxDefaultValue("H2CorccInStins"));
11755 
11756   //........... set user's min and max flags to "OFF" and values to -1 and +1 (just to have fUserHistoMin < fUserHistoMax)
11757   fUserHistoMin = -1.; fFlagUserHistoMin = "OFF";
11758   fUserHistoMax =  1.; fFlagUserHistoMax = "OFF";
11759 } // end of SetAllYminYmaxMemoFromDefaultValues()
11760 
11761 //===========================================================================
11762 //
11763 //          SetYminMemoFromValue(...), SetYmaxMemoFromValue(...)
11764 //          GetYminValueFromMemo(...), GetYmaxValueFromMemo(...)
11765 //
11766 //===========================================================================
11767 void TEcnaHistos::SetYminMemoFromValue(const TString HistoCode, const Double_t& value)
11768 {
11769   if( HistoCode == "D_NOE_ChNb" ){fD_NOE_ChNbYmin = value;}
11770   if( HistoCode == "D_NOE_ChDs" ){fD_NOE_ChDsYmin = value;}  
11771   if( HistoCode == "D_Ped_ChNb" ){fD_Ped_ChNbYmin = value;} 
11772   if( HistoCode == "D_Ped_ChDs" ){fD_Ped_ChDsYmin = value;} 
11773   if( HistoCode == "D_TNo_ChNb" ){fD_TNo_ChNbYmin = value;}
11774   if( HistoCode == "D_TNo_ChDs" ){fD_TNo_ChDsYmin = value;} 
11775   if( HistoCode == "D_MCs_ChNb" ){fD_MCs_ChNbYmin = value;} 
11776   if( HistoCode == "D_MCs_ChDs" ){fD_MCs_ChDsYmin = value;} 
11777   if( HistoCode == "D_LFN_ChNb" ){fD_LFN_ChNbYmin = value;} 
11778   if( HistoCode == "D_LFN_ChDs" ){fD_LFN_ChDsYmin = value;}
11779   if( HistoCode == "D_HFN_ChNb" ){fD_HFN_ChNbYmin = value;} 
11780   if( HistoCode == "D_HFN_ChDs" ){fD_HFN_ChDsYmin = value;} 
11781   if( HistoCode == "D_SCs_ChNb" ){fD_SCs_ChNbYmin = value;}
11782   if( HistoCode == "D_SCs_ChDs" ){fD_SCs_ChDsYmin = value;}
11783   if( HistoCode == "D_MSp_SpNb" ){fD_Ped_ChNbYmin = value;}
11784   if( HistoCode == "D_MSp_SpDs" ){fD_Ped_ChDsYmin = value;}
11785   if( HistoCode == "D_SSp_SpNb" ){fD_TNo_ChNbYmin = value;}
11786   if( HistoCode == "D_SSp_SpDs" ){fD_TNo_ChDsYmin = value;}
11787   if( HistoCode == "D_Adc_EvNb" ){fD_Ped_ChNbYmin = value;}
11788   if( HistoCode == "D_Adc_EvDs" ){fD_Adc_EvDsYmin = value;}
11789   if( HistoCode == "H_Ped_Date" ){fH_Ped_DateYmin = value;}
11790   if( HistoCode == "H_TNo_Date" ){fH_TNo_DateYmin = value;}
11791   if( HistoCode == "H_MCs_Date" ){fH_MCs_DateYmin = value;}
11792   if( HistoCode == "H_LFN_Date" ){fH_LFN_DateYmin = value;}
11793   if( HistoCode == "H_HFN_Date" ){fH_HFN_DateYmin = value;}
11794   if( HistoCode == "H_SCs_Date" ){fH_SCs_DateYmin = value;}
11795   if( HistoCode == "H_Ped_RuDs" ){fH_Ped_RuDsYmin = value;}
11796   if( HistoCode == "H_TNo_RuDs" ){fH_TNo_RuDsYmin = value;}
11797   if( HistoCode == "H_MCs_RuDs" ){fH_MCs_RuDsYmin = value;}
11798   if( HistoCode == "H_LFN_RuDs" ){fH_LFN_RuDsYmin = value;}
11799   if( HistoCode == "H_HFN_RuDs" ){fH_HFN_RuDsYmin = value;}
11800   if( HistoCode == "H_SCs_RuDs" ){fH_SCs_RuDsYmin = value;}
11801   if( HistoCode == "H2LFccMosMatrix" ){fH2LFccMosMatrixYmin = value;}
11802   if( HistoCode == "H2HFccMosMatrix" ){fH2HFccMosMatrixYmin = value;}
11803   if( HistoCode == "H2CorccInStins"  ){fH2CorccInStinsYmin  = value;}
11804 }// end of SetYminMemoFromValue(...)
11805 
11806 void TEcnaHistos::SetYmaxMemoFromValue(const TString HistoCode, const Double_t& value)
11807 {
11808   if( HistoCode == "D_NOE_ChNb" ){fD_NOE_ChNbYmax = value;}
11809   if( HistoCode == "D_NOE_ChDs" ){fD_NOE_ChDsYmax = value;}  
11810   if( HistoCode == "D_Ped_ChNb" ){fD_Ped_ChNbYmax = value;} 
11811   if( HistoCode == "D_Ped_ChDs" ){fD_Ped_ChDsYmax = value;} 
11812   if( HistoCode == "D_TNo_ChNb" ){fD_TNo_ChNbYmax = value;}
11813   if( HistoCode == "D_TNo_ChDs" ){fD_TNo_ChDsYmax = value;} 
11814   if( HistoCode == "D_MCs_ChNb" ){fD_MCs_ChNbYmax = value;} 
11815   if( HistoCode == "D_MCs_ChDs" ){fD_MCs_ChDsYmax = value;} 
11816   if( HistoCode == "D_LFN_ChNb" ){fD_LFN_ChNbYmax = value;} 
11817   if( HistoCode == "D_LFN_ChDs" ){fD_LFN_ChDsYmax = value;}
11818   if( HistoCode == "D_HFN_ChNb" ){fD_HFN_ChNbYmax = value;} 
11819   if( HistoCode == "D_HFN_ChDs" ){fD_HFN_ChDsYmax = value;} 
11820   if( HistoCode == "D_SCs_ChNb" ){fD_SCs_ChNbYmax = value;}
11821   if( HistoCode == "D_SCs_ChDs" ){fD_SCs_ChDsYmax = value;}
11822   if( HistoCode == "D_MSp_SpNb" ){fD_Ped_ChNbYmax = value;}
11823   if( HistoCode == "D_MSp_SpDs" ){fD_Ped_ChDsYmax = value;}
11824   if( HistoCode == "D_SSp_SpNb" ){fD_TNo_ChNbYmax = value;}
11825   if( HistoCode == "D_SSp_SpDs" ){fD_TNo_ChDsYmax = value;}
11826   if( HistoCode == "D_Adc_EvNb" ){fD_Ped_ChNbYmax = value;}
11827   if( HistoCode == "D_Adc_EvDs" ){fD_Ped_ChDsYmax = value;}
11828   if( HistoCode == "H_Ped_Date" ){fH_Ped_DateYmax = value;}
11829   if( HistoCode == "H_TNo_Date" ){fH_TNo_DateYmax = value;}
11830   if( HistoCode == "H_MCs_Date" ){fH_MCs_DateYmax = value;}
11831   if( HistoCode == "H_LFN_Date" ){fH_LFN_DateYmax = value;}
11832   if( HistoCode == "H_HFN_Date" ){fH_HFN_DateYmax = value;}
11833   if( HistoCode == "H_SCs_Date" ){fH_SCs_DateYmax = value;}
11834   if( HistoCode == "H_Ped_RuDs" ){fH_Ped_RuDsYmax = value;}
11835   if( HistoCode == "H_TNo_RuDs" ){fH_TNo_RuDsYmax = value;}
11836   if( HistoCode == "H_MCs_RuDs" ){fH_MCs_RuDsYmax = value;}
11837   if( HistoCode == "H_LFN_RuDs" ){fH_LFN_RuDsYmax = value;}
11838   if( HistoCode == "H_HFN_RuDs" ){fH_HFN_RuDsYmax = value;}
11839   if( HistoCode == "H_SCs_RuDs" ){fH_SCs_RuDsYmax = value;}
11840   if( HistoCode == "H2LFccMosMatrix" ){fH2LFccMosMatrixYmax = value;}
11841   if( HistoCode == "H2HFccMosMatrix" ){fH2HFccMosMatrixYmax = value;}
11842   if( HistoCode == "H2CorccInStins"  ){fH2CorccInStinsYmax  = value;}
11843 }// end of SetYmaxMemoFromValue(...)
11844 
11845 Double_t TEcnaHistos::GetYminValueFromMemo(const TString HistoCode)
11846 {
11847   Double_t val_min      = (Double_t)0.;
11848   Double_t val_min_proj = (Double_t)0.1;
11849 
11850    if( HistoCode == "D_NOE_ChNb" ){val_min = fD_NOE_ChNbYmin;}
11851    if( HistoCode == "D_NOE_ChDs" ){val_min = val_min_proj;}  
11852    if( HistoCode == "D_Ped_ChNb" ){val_min = fD_Ped_ChNbYmin;} 
11853    if( HistoCode == "D_Ped_ChDs" ){val_min = val_min_proj;} 
11854    if( HistoCode == "D_TNo_ChNb" ){val_min = fD_TNo_ChNbYmin;}
11855    if( HistoCode == "D_TNo_ChDs" ){val_min = val_min_proj;} 
11856    if( HistoCode == "D_MCs_ChNb" ){val_min = fD_MCs_ChNbYmin;} 
11857    if( HistoCode == "D_MCs_ChDs" ){val_min = val_min_proj;} 
11858    if( HistoCode == "D_LFN_ChNb" ){val_min = fD_LFN_ChNbYmin;} 
11859    if( HistoCode == "D_LFN_ChDs" ){val_min = val_min_proj;}
11860    if( HistoCode == "D_HFN_ChNb" ){val_min = fD_HFN_ChNbYmin;} 
11861    if( HistoCode == "D_HFN_ChDs" ){val_min = val_min_proj;} 
11862    if( HistoCode == "D_SCs_ChNb" ){val_min = fD_SCs_ChNbYmin;}
11863    if( HistoCode == "D_SCs_ChDs" ){val_min = val_min_proj;}
11864    if( HistoCode == "D_MSp_SpNb" ){val_min = fD_Ped_ChNbYmin;}
11865    if( HistoCode == "D_MSp_SpDs" ){val_min = val_min_proj;}
11866    if( HistoCode == "D_SSp_SpNb" ){val_min = fD_TNo_ChNbYmin;}
11867    if( HistoCode == "D_SSp_SpDs" ){val_min = val_min_proj;}
11868    if( HistoCode == "D_Adc_EvNb" ){val_min = fD_Ped_ChNbYmin;}
11869    if( HistoCode == "D_Adc_EvDs" ){val_min = val_min_proj;}
11870    if( HistoCode == "H_Ped_Date" ){val_min = fH_Ped_DateYmin;}
11871    if( HistoCode == "H_TNo_Date" ){val_min = fH_TNo_DateYmin;}
11872    if( HistoCode == "H_MCs_Date" ){val_min = fH_MCs_DateYmin;}
11873    if( HistoCode == "H_LFN_Date" ){val_min = fH_LFN_DateYmin;}
11874    if( HistoCode == "H_HFN_Date" ){val_min = fH_HFN_DateYmin;}
11875    if( HistoCode == "H_SCs_Date" ){val_min = fH_SCs_DateYmin;}
11876    if( HistoCode == "H_Ped_RuDs" ){val_min = fH_Ped_RuDsYmin;}
11877    if( HistoCode == "H_TNo_RuDs" ){val_min = fH_TNo_RuDsYmin;}
11878    if( HistoCode == "H_MCs_RuDs" ){val_min = fH_MCs_RuDsYmin;}
11879    if( HistoCode == "H_LFN_RuDs" ){val_min = fH_LFN_RuDsYmin;}
11880    if( HistoCode == "H_HFN_RuDs" ){val_min = fH_HFN_RuDsYmin;}
11881    if( HistoCode == "H_SCs_RuDs" ){val_min = fH_SCs_RuDsYmin;}
11882    if( HistoCode == "H2LFccMosMatrix" ){val_min = fH2LFccMosMatrixYmin;}
11883    if( HistoCode == "H2HFccMosMatrix" ){val_min = fH2HFccMosMatrixYmin;}
11884    if( HistoCode == "H2CorccInStins"  ){val_min = fH2CorccInStinsYmin;}
11885   return val_min;
11886 }// end of GetYminValueFromMemo(...)
11887 
11888 Double_t TEcnaHistos::GetYmaxValueFromMemo(const TString HistoCode)
11889 {
11890   Double_t val_max      = (Double_t)0.;
11891   Double_t val_max_proj = (Double_t)2000.;
11892 
11893    if( HistoCode == "D_NOE_ChNb" ){val_max = fD_NOE_ChNbYmax;}
11894    if( HistoCode == "D_NOE_ChDs" ){val_max = val_max_proj;} 
11895    if( HistoCode == "D_Ped_ChNb" ){val_max = fD_Ped_ChNbYmax;} 
11896    if( HistoCode == "D_Ped_ChDs" ){val_max = val_max_proj;}  
11897    if( HistoCode == "D_TNo_ChNb" ){val_max = fD_TNo_ChNbYmax;}   
11898    if( HistoCode == "D_TNo_ChDs" ){val_max = val_max_proj;} 
11899    if( HistoCode == "D_MCs_ChNb" ){val_max = fD_MCs_ChNbYmax;}
11900    if( HistoCode == "D_MCs_ChDs" ){val_max = val_max_proj;} 
11901    if( HistoCode == "D_LFN_ChNb" ){val_max = fD_LFN_ChNbYmax;} 
11902    if( HistoCode == "D_LFN_ChDs" ){val_max = val_max_proj;} 
11903    if( HistoCode == "D_HFN_ChNb" ){val_max = fD_HFN_ChNbYmax;}  
11904    if( HistoCode == "D_HFN_ChDs" ){val_max = val_max_proj;} 
11905    if( HistoCode == "D_SCs_ChNb" ){val_max = fD_SCs_ChNbYmax;} 
11906    if( HistoCode == "D_SCs_ChDs" ){val_max = val_max_proj;}
11907    if( HistoCode == "D_MSp_SpNb" ){val_max = fD_Ped_ChNbYmax;}
11908    if( HistoCode == "D_MSp_SpDs" ){val_max = val_max_proj;}
11909    if( HistoCode == "D_SSp_SpNb" ){val_max = fD_TNo_ChNbYmax;}
11910    if( HistoCode == "D_SSp_SpDs" ){val_max = val_max_proj;}
11911    if( HistoCode == "D_Adc_EvNb" ){val_max = fD_Ped_ChNbYmax;}
11912    if( HistoCode == "D_Adc_EvDs" ){val_max = val_max_proj;}
11913    if( HistoCode == "H_Ped_Date" ){val_max = fH_Ped_DateYmax;}
11914    if( HistoCode == "H_TNo_Date" ){val_max = fH_TNo_DateYmax;}
11915    if( HistoCode == "H_MCs_Date" ){val_max = fH_MCs_DateYmax;}
11916    if( HistoCode == "H_LFN_Date" ){val_max = fH_LFN_DateYmax;}
11917    if( HistoCode == "H_HFN_Date" ){val_max = fH_HFN_DateYmax;}
11918    if( HistoCode == "H_SCs_Date" ){val_max = fH_SCs_DateYmax;}
11919    if( HistoCode == "H_Ped_RuDs" ){val_max = fH_Ped_RuDsYmax;}
11920    if( HistoCode == "H_TNo_RuDs" ){val_max = fH_TNo_RuDsYmax;}
11921    if( HistoCode == "H_MCs_RuDs" ){val_max = fH_MCs_RuDsYmax;}
11922    if( HistoCode == "H_LFN_RuDs" ){val_max = fH_LFN_RuDsYmax;}
11923    if( HistoCode == "H_HFN_RuDs" ){val_max = fH_HFN_RuDsYmax;}
11924    if( HistoCode == "H_SCs_RuDs" ){val_max = fH_SCs_RuDsYmax;}
11925    if( HistoCode == "H2LFccMosMatrix" ){val_max = fH2LFccMosMatrixYmax;}
11926    if( HistoCode == "H2HFccMosMatrix" ){val_max = fH2HFccMosMatrixYmax;}
11927    if( HistoCode == "H2CorccInStins"  ){val_max = fH2CorccInStinsYmax;}
11928   return val_max;
11929 }// end of GetYmaxValueFromMemo(...)
11930 
11931 void TEcnaHistos::SetYminMemoFromPreviousMemo(const TString  HistoCode)
11932 {
11933 // InitQuantity Ymin
11934 
11935   if( HistoCode == "D_NOE_ChNb" ){fD_NOE_ChNbYmin = GetYminValueFromMemo("D_NOE_ChNb");}
11936   if( HistoCode == "D_NOE_ChDs" ){fD_NOE_ChDsYmin = GetYminValueFromMemo("D_NOE_ChDs");}
11937   if( HistoCode == "D_Ped_ChNb" ){fD_Ped_ChNbYmin = GetYminValueFromMemo("D_Ped_ChNb");}
11938   if( HistoCode == "D_Ped_ChDs" ){fD_Ped_ChDsYmin = GetYminValueFromMemo("D_Ped_ChDs");}
11939   if( HistoCode == "D_TNo_ChNb" ){fD_TNo_ChNbYmin = GetYminValueFromMemo("D_TNo_ChNb");}
11940   if( HistoCode == "D_TNo_ChDs" ){fD_TNo_ChDsYmin = GetYminValueFromMemo("D_TNo_ChDs");}
11941   if( HistoCode == "D_MCs_ChNb" ){fD_MCs_ChNbYmin = GetYminValueFromMemo("D_MCs_ChNb");}
11942   if( HistoCode == "D_MCs_ChDs" ){fD_MCs_ChDsYmin = GetYminValueFromMemo("D_MCs_ChDs");}
11943   if( HistoCode == "D_LFN_ChNb" ){fD_LFN_ChNbYmin = GetYminValueFromMemo("D_LFN_ChNb");}
11944   if( HistoCode == "D_LFN_ChDs" ){fD_LFN_ChDsYmin = GetYminValueFromMemo("D_LFN_ChDs");}
11945   if( HistoCode == "D_HFN_ChNb" ){fD_HFN_ChNbYmin = GetYminValueFromMemo("D_HFN_ChNb");}
11946   if( HistoCode == "D_HFN_ChDs" ){fD_HFN_ChDsYmin = GetYminValueFromMemo("D_HFN_ChDs");}
11947   if( HistoCode == "D_SCs_ChNb" ){fD_SCs_ChNbYmin = GetYminValueFromMemo("D_SCs_ChNb");}
11948   if( HistoCode == "D_SCs_ChDs" ){fD_SCs_ChDsYmin = GetYminValueFromMemo("D_SCs_ChDs");}
11949   if( HistoCode == "D_MSp_SpNb" ){fD_MSp_SpNbYmin = GetYminValueFromMemo("D_MSp_SpNb");}
11950   if( HistoCode == "D_MSp_SpDs" ){fD_MSp_SpDsYmin = GetYminValueFromMemo("D_MSp_SpDs");}
11951   if( HistoCode == "D_SSp_SpNb" ){fD_SSp_SpNbYmin = GetYminValueFromMemo("D_SSp_SpNb");}
11952   if( HistoCode == "D_SSp_SpDs" ){fD_SSp_SpDsYmin = GetYminValueFromMemo("D_SSp_SpDs");}
11953   if( HistoCode == "D_Adc_EvNb" ){fD_Adc_EvNbYmin = GetYminValueFromMemo("D_Adc_EvNb");}
11954   if( HistoCode == "D_Adc_EvDs" ){fD_Adc_EvDsYmin = GetYminValueFromMemo("D_Adc_EvDs");}
11955   if( HistoCode == "H_Ped_Date" ){fH_Ped_DateYmin = GetYminValueFromMemo("H_Ped_Date");}
11956   if( HistoCode == "H_TNo_Date" ){fH_TNo_DateYmin = GetYminValueFromMemo("H_TNo_Date");}
11957   if( HistoCode == "H_MCs_Date" ){fH_MCs_DateYmin = GetYminValueFromMemo("H_MCs_Date");}
11958   if( HistoCode == "H_LFN_Date" ){fH_LFN_DateYmin = GetYminValueFromMemo("H_LFN_Date");}
11959   if( HistoCode == "H_HFN_Date" ){fH_HFN_DateYmin = GetYminValueFromMemo("H_HFN_Date");}
11960   if( HistoCode == "H_SCs_Date" ){fH_SCs_DateYmin = GetYminValueFromMemo("H_SCs_Date");}
11961   if( HistoCode == "H_Ped_RuDs" ){fH_Ped_RuDsYmin = GetYminValueFromMemo("H_Ped_RuDs");}
11962   if( HistoCode == "H_TNo_RuDs" ){fH_TNo_RuDsYmin = GetYminValueFromMemo("H_TNo_RuDs");}
11963   if( HistoCode == "H_MCs_RuDs" ){fH_MCs_RuDsYmin = GetYminValueFromMemo("H_MCs_RuDs");}
11964   if( HistoCode == "H_LFN_RuDs" ){fH_LFN_RuDsYmin = GetYminValueFromMemo("H_LFN_RuDs");}
11965   if( HistoCode == "H_HFN_RuDs" ){fH_HFN_RuDsYmin = GetYminValueFromMemo("H_HFN_RuDs");}
11966   if( HistoCode == "H_SCs_RuDs" ){fH_SCs_RuDsYmin = GetYminValueFromMemo("H_SCs_RuDs");}
11967   if( HistoCode == "H2LFccMosMatrix" ){fH2LFccMosMatrixYmin = GetYminValueFromMemo("H2LFccMosMatrix");}
11968   if( HistoCode == "H2HFccMosMatrix" ){fH2HFccMosMatrixYmin = GetYminValueFromMemo("H2HFccMosMatrix");}
11969   if( HistoCode == "H2CorccInStins"  ){fH2CorccInStinsYmin  = GetYminValueFromMemo("H2CorccInStins");}
11970 }// end of SetYminMemoFromPreviousMemo(...)
11971 
11972 void TEcnaHistos::SetYmaxMemoFromPreviousMemo(const TString  HistoCode)
11973 {
11974 // InitQuantity Ymax
11975 
11976   if( HistoCode == "D_NOE_ChNb" ){fD_NOE_ChNbYmax = GetYmaxValueFromMemo("D_NOE_ChNb");}
11977   if( HistoCode == "D_NOE_ChDs" ){fD_NOE_ChDsYmax = GetYmaxValueFromMemo("D_NOE_ChDs");}
11978   if( HistoCode == "D_Ped_ChNb" ){fD_Ped_ChNbYmax = GetYmaxValueFromMemo("D_Ped_ChNb");}
11979   if( HistoCode == "D_Ped_ChDs" ){fD_Ped_ChDsYmax = GetYmaxValueFromMemo("D_Ped_ChDs");}
11980   if( HistoCode == "D_TNo_ChNb" ){fD_TNo_ChNbYmax = GetYmaxValueFromMemo("D_TNo_ChNb");}
11981   if( HistoCode == "D_TNo_ChDs" ){fD_TNo_ChDsYmax = GetYmaxValueFromMemo("D_TNo_ChDs");}
11982   if( HistoCode == "D_MCs_ChNb" ){fD_MCs_ChNbYmax = GetYmaxValueFromMemo("D_MCs_ChNb");}
11983   if( HistoCode == "D_MCs_ChDs" ){fD_MCs_ChDsYmax = GetYmaxValueFromMemo("D_MCs_ChDs");}
11984   if( HistoCode == "D_LFN_ChNb" ){fD_LFN_ChNbYmax = GetYmaxValueFromMemo("D_LFN_ChNb");}
11985   if( HistoCode == "D_LFN_ChDs" ){fD_LFN_ChDsYmax = GetYmaxValueFromMemo("D_LFN_ChDs");}
11986   if( HistoCode == "D_HFN_ChNb" ){fD_HFN_ChNbYmax = GetYmaxValueFromMemo("D_HFN_ChNb");}
11987   if( HistoCode == "D_HFN_ChDs" ){fD_HFN_ChDsYmax = GetYmaxValueFromMemo("D_HFN_ChDs");}
11988   if( HistoCode == "D_SCs_ChNb" ){fD_SCs_ChNbYmax = GetYmaxValueFromMemo("D_SCs_ChNb");}
11989   if( HistoCode == "D_SCs_ChDs" ){fD_SCs_ChDsYmax = GetYmaxValueFromMemo("D_SCs_ChDs");}
11990   if( HistoCode == "D_MSp_SpNb" ){fD_MSp_SpNbYmax = GetYmaxValueFromMemo("D_MSp_SpNb");}
11991   if( HistoCode == "D_MSp_SpDs" ){fD_MSp_SpDsYmax = GetYmaxValueFromMemo("D_MSp_SpDs");}
11992   if( HistoCode == "D_SSp_SpNb" ){fD_SSp_SpNbYmax = GetYmaxValueFromMemo("D_SSp_SpNb");}
11993   if( HistoCode == "D_SSp_SpDs" ){fD_SSp_SpDsYmax = GetYmaxValueFromMemo("D_SSp_SpDs");}
11994   if( HistoCode == "D_Adc_EvNb" ){fD_Adc_EvNbYmax = GetYmaxValueFromMemo("D_Adc_EvNb");}
11995   if( HistoCode == "D_Adc_EvDs" ){fD_Adc_EvDsYmax = GetYmaxValueFromMemo("D_Adc_EvDs");}
11996   if( HistoCode == "H_Ped_Date" ){fH_Ped_DateYmax = GetYmaxValueFromMemo("H_Ped_Date");}
11997   if( HistoCode == "H_TNo_Date" ){fH_TNo_DateYmax = GetYmaxValueFromMemo("H_TNo_Date");}
11998   if( HistoCode == "H_MCs_Date" ){fH_MCs_DateYmax = GetYmaxValueFromMemo("H_MCs_Date");}
11999   if( HistoCode == "H_LFN_Date" ){fH_LFN_DateYmax = GetYmaxValueFromMemo("H_LFN_Date");}
12000   if( HistoCode == "H_HFN_Date" ){fH_HFN_DateYmax = GetYmaxValueFromMemo("H_HFN_Date");}
12001   if( HistoCode == "H_SCs_Date" ){fH_SCs_DateYmax = GetYmaxValueFromMemo("H_SCs_Date");}
12002   if( HistoCode == "H_Ped_RuDs" ){fH_Ped_RuDsYmax = GetYmaxValueFromMemo("H_Ped_RuDs");}
12003   if( HistoCode == "H_TNo_RuDs" ){fH_TNo_RuDsYmax = GetYmaxValueFromMemo("H_TNo_RuDs");}
12004   if( HistoCode == "H_MCs_RuDs" ){fH_MCs_RuDsYmax = GetYmaxValueFromMemo("H_MCs_RuDs");}
12005   if( HistoCode == "H_LFN_RuDs" ){fH_LFN_RuDsYmax = GetYmaxValueFromMemo("H_LFN_RuDs");}
12006   if( HistoCode == "H_HFN_RuDs" ){fH_HFN_RuDsYmax = GetYmaxValueFromMemo("H_HFN_RuDs");}
12007   if( HistoCode == "H_SCs_RuDs" ){fH_SCs_RuDsYmax = GetYmaxValueFromMemo("H_SCs_RuDs");}
12008   if( HistoCode == "H2LFccMosMatrix" ){fH2LFccMosMatrixYmax = GetYmaxValueFromMemo("H2LFccMosMatrix");}
12009   if( HistoCode == "H2HFccMosMatrix" ){fH2HFccMosMatrixYmax = GetYmaxValueFromMemo("H2HFccMosMatrix");}
12010   if( HistoCode == "H2CorccInStins"  ){fH2CorccInStinsYmax  = GetYmaxValueFromMemo("H2CorccInStins");}
12011 }// end of SetYmaxMemoFromPreviousMemo(...)
12012 
12013 //------------------------------------------------------------------------------------------------------
12014 void TEcnaHistos::SetXVarMemo(const TString HistoCode, const TString opt_plot, const TString xvar)
12015 {
12016 
12017   if( opt_plot == fSameOnePlot ){fXMemoH1SamePlus = xvar;}
12018 
12019   if( opt_plot == fOnlyOnePlot || opt_plot == fSeveralPlot )
12020     {
12021       if( HistoCode == "D_NOE_ChNb"){fXMemoD_NOE_ChNb = xvar;}
12022       if( HistoCode == "D_NOE_ChDs"){fXMemoD_NOE_ChDs = xvar;}  
12023       if( HistoCode == "D_Ped_ChNb"){fXMemoD_Ped_ChNb = xvar;} 
12024       if( HistoCode == "D_Ped_ChDs"){fXMemoD_Ped_ChDs = xvar;} 
12025       if( HistoCode == "D_TNo_ChNb"){fXMemoD_TNo_ChNb = xvar;}
12026       if( HistoCode == "D_TNo_ChDs"){fXMemoD_TNo_ChDs = xvar;} 
12027       if( HistoCode == "D_MCs_ChNb"){fXMemoD_MCs_ChNb = xvar;} 
12028       if( HistoCode == "D_MCs_ChDs"){fXMemoD_MCs_ChDs = xvar;} 
12029       if( HistoCode == "D_LFN_ChNb"){fXMemoD_LFN_ChNb = xvar;} 
12030       if( HistoCode == "D_LFN_ChDs"){fXMemoD_LFN_ChDs = xvar;}
12031       if( HistoCode == "D_HFN_ChNb"){fXMemoD_HFN_ChNb = xvar;} 
12032       if( HistoCode == "D_HFN_ChDs"){fXMemoD_HFN_ChDs = xvar;} 
12033       if( HistoCode == "D_SCs_ChNb"){fXMemoD_SCs_ChNb = xvar;}
12034       if( HistoCode == "D_SCs_ChDs"){fXMemoD_SCs_ChDs = xvar;}
12035       if( HistoCode == "D_MSp_SpNb"){fXMemoD_MSp_SpNb = xvar;}
12036       if( HistoCode == "D_MSp_SpDs"){fXMemoD_MSp_SpDs = xvar;}
12037       if( HistoCode == "D_SSp_SpNb"){fXMemoD_SSp_SpNb = xvar;}
12038       if( HistoCode == "D_SSp_SpDs"){fXMemoD_SSp_SpDs = xvar;}
12039       if( HistoCode == "D_Adc_EvNb"){fXMemoD_Adc_EvNb = xvar;}
12040       if( HistoCode == "D_Adc_EvDs"){fXMemoD_Adc_EvDs = xvar;}
12041       if( HistoCode == "H_Ped_Date"){fXMemoH_Ped_Date = xvar;}
12042       if( HistoCode == "H_TNo_Date"){fXMemoH_TNo_Date = xvar;}
12043       if( HistoCode == "H_MCs_Date"){fXMemoH_MCs_Date = xvar;}
12044       if( HistoCode == "H_LFN_Date"){fXMemoH_LFN_Date = xvar;}
12045       if( HistoCode == "H_HFN_Date"){fXMemoH_HFN_Date = xvar;}
12046       if( HistoCode == "H_SCs_Date"){fXMemoH_SCs_Date = xvar;}
12047       if( HistoCode == "H_Ped_RuDs"){fXMemoH_Ped_RuDs = xvar;}
12048       if( HistoCode == "H_TNo_RuDs"){fXMemoH_TNo_RuDs = xvar;}
12049       if( HistoCode == "H_MCs_RuDs"){fXMemoH_MCs_RuDs = xvar;}
12050       if( HistoCode == "H_LFN_RuDs"){fXMemoH_LFN_RuDs = xvar;}
12051       if( HistoCode == "H_HFN_RuDs"){fXMemoH_HFN_RuDs = xvar;}
12052       if( HistoCode == "H_SCs_RuDs"){fXMemoH_SCs_RuDs = xvar;}
12053     }
12054 }// end of SetXVarMemo(...)
12055 
12056 TString TEcnaHistos::GetXVarFromMemo(const TString HistoCode, const TString opt_plot)
12057 {
12058   TString xvar = "(xvar not found)";
12059   
12060   if( opt_plot == fSameOnePlot ){xvar = fXMemoH1SamePlus;}
12061 
12062   if( opt_plot == fOnlyOnePlot || opt_plot == fSeveralPlot )
12063     {
12064       if( HistoCode == "D_NOE_ChNb"){xvar = fXMemoD_NOE_ChNb;}
12065       if( HistoCode == "D_NOE_ChDs"){xvar = fXMemoD_NOE_ChDs;}  
12066       if( HistoCode == "D_Ped_ChNb"){xvar = fXMemoD_Ped_ChNb;} 
12067       if( HistoCode == "D_Ped_ChDs"){xvar = fXMemoD_Ped_ChDs;} 
12068       if( HistoCode == "D_TNo_ChNb"){xvar = fXMemoD_TNo_ChNb;}
12069       if( HistoCode == "D_TNo_ChDs"){xvar = fXMemoD_TNo_ChDs;} 
12070       if( HistoCode == "D_MCs_ChNb"){xvar = fXMemoD_MCs_ChNb;} 
12071       if( HistoCode == "D_MCs_ChDs"){xvar = fXMemoD_MCs_ChDs;} 
12072       if( HistoCode == "D_LFN_ChNb"){xvar = fXMemoD_LFN_ChNb;} 
12073       if( HistoCode == "D_LFN_ChDs"){xvar = fXMemoD_LFN_ChDs;}
12074       if( HistoCode == "D_HFN_ChNb"){xvar = fXMemoD_HFN_ChNb;} 
12075       if( HistoCode == "D_HFN_ChDs"){xvar = fXMemoD_HFN_ChDs;} 
12076       if( HistoCode == "D_SCs_ChNb"){xvar = fXMemoD_SCs_ChNb;}
12077       if( HistoCode == "D_SCs_ChDs"){xvar = fXMemoD_SCs_ChDs;}
12078       if( HistoCode == "D_MSp_SpNb"){xvar = fXMemoD_MSp_SpNb;}
12079       if( HistoCode == "D_MSp_SpDs"){xvar = fXMemoD_MSp_SpDs;}
12080       if( HistoCode == "D_SSp_SpNb"){xvar = fXMemoD_SSp_SpNb;}
12081       if( HistoCode == "D_SSp_SpDs"){xvar = fXMemoD_SSp_SpDs;}
12082       if( HistoCode == "D_Adc_EvNb"){xvar = fXMemoD_Adc_EvNb;}
12083       if( HistoCode == "D_Adc_EvDs"){xvar = fXMemoD_Adc_EvDs;}
12084       if( HistoCode == "H_Ped_Date"){xvar = fXMemoH_Ped_Date;}
12085       if( HistoCode == "H_TNo_Date"){xvar = fXMemoH_TNo_Date;}
12086       if( HistoCode == "H_MCs_Date"){xvar = fXMemoH_MCs_Date;}
12087       if( HistoCode == "H_LFN_Date"){xvar = fXMemoH_LFN_Date;}
12088       if( HistoCode == "H_HFN_Date"){xvar = fXMemoH_HFN_Date;}
12089       if( HistoCode == "H_SCs_Date"){xvar = fXMemoH_SCs_Date;}
12090       if( HistoCode == "H_Ped_RuDs"){xvar = fXMemoH_Ped_RuDs;}
12091       if( HistoCode == "H_TNo_RuDs"){xvar = fXMemoH_TNo_RuDs;}
12092       if( HistoCode == "H_MCs_RuDs"){xvar = fXMemoH_MCs_RuDs;}
12093       if( HistoCode == "H_LFN_RuDs"){xvar = fXMemoH_LFN_RuDs;}
12094       if( HistoCode == "H_HFN_RuDs"){xvar = fXMemoH_HFN_RuDs;}
12095       if( HistoCode == "H_SCs_RuDs"){xvar = fXMemoH_SCs_RuDs;}
12096     }
12097   return xvar;
12098 }// end of GetXVarFromMemo(...)
12099 
12100 
12101 void TEcnaHistos::SetYVarMemo(const TString HistoCode, const TString opt_plot, const TString yvar)
12102 {
12103   if( opt_plot == fSameOnePlot ){fYMemoH1SamePlus = yvar;}
12104 
12105   if( opt_plot == fOnlyOnePlot || opt_plot == fSeveralPlot )
12106     {
12107       if( HistoCode == "D_NOE_ChNb"){fYMemoD_NOE_ChNb = yvar;}
12108       if( HistoCode == "D_NOE_ChDs"){fYMemoD_NOE_ChDs = yvar;}  
12109       if( HistoCode == "D_Ped_ChNb"){fYMemoD_Ped_ChNb = yvar;} 
12110       if( HistoCode == "D_Ped_ChDs"){fYMemoD_Ped_ChDs = yvar;} 
12111       if( HistoCode == "D_TNo_ChNb"){fYMemoD_TNo_ChNb = yvar;}
12112       if( HistoCode == "D_TNo_ChDs"){fYMemoD_TNo_ChDs = yvar;} 
12113       if( HistoCode == "D_MCs_ChNb"){fYMemoD_MCs_ChNb = yvar;} 
12114       if( HistoCode == "D_MCs_ChDs"){fYMemoD_MCs_ChDs = yvar;} 
12115       if( HistoCode == "D_LFN_ChNb"){fYMemoD_LFN_ChNb = yvar;} 
12116       if( HistoCode == "D_LFN_ChDs"){fYMemoD_LFN_ChDs = yvar;}
12117       if( HistoCode == "D_HFN_ChNb"){fYMemoD_HFN_ChNb = yvar;} 
12118       if( HistoCode == "D_HFN_ChDs"){fYMemoD_HFN_ChDs = yvar;} 
12119       if( HistoCode == "D_SCs_ChNb"){fYMemoD_SCs_ChNb = yvar;}
12120       if( HistoCode == "D_SCs_ChDs"){fYMemoD_SCs_ChDs = yvar;}
12121       if( HistoCode == "D_MSp_SpNb"){fYMemoD_MSp_SpNb = yvar;}
12122       if( HistoCode == "D_MSp_SpDs"){fYMemoD_MSp_SpDs = yvar;}
12123       if( HistoCode == "D_SSp_SpNb"){fYMemoD_SSp_SpNb = yvar;}
12124       if( HistoCode == "D_Adc_EvDs"){fYMemoD_Adc_EvDs = yvar;}
12125       if( HistoCode == "D_SSp_SpDs"){fYMemoD_SSp_SpDs = yvar;}
12126       if( HistoCode == "D_Adc_EvNb"){fYMemoD_Adc_EvNb = yvar;}
12127       if( HistoCode == "H_Ped_Date"){fYMemoH_Ped_Date = yvar;}
12128       if( HistoCode == "H_TNo_Date"){fYMemoH_TNo_Date = yvar;}
12129       if( HistoCode == "H_MCs_Date"){fYMemoH_MCs_Date = yvar;}
12130       if( HistoCode == "H_LFN_Date"){fYMemoH_LFN_Date = yvar;}
12131       if( HistoCode == "H_HFN_Date"){fYMemoH_HFN_Date = yvar;}
12132       if( HistoCode == "H_SCs_Date"){fYMemoH_SCs_Date = yvar;}
12133       if( HistoCode == "H_Ped_RuDs"){fYMemoH_Ped_RuDs = yvar;}
12134       if( HistoCode == "H_TNo_RuDs"){fYMemoH_TNo_RuDs = yvar;}
12135       if( HistoCode == "H_MCs_RuDs"){fYMemoH_MCs_RuDs = yvar;}
12136       if( HistoCode == "H_LFN_RuDs"){fYMemoH_LFN_RuDs = yvar;}
12137       if( HistoCode == "H_HFN_RuDs"){fYMemoH_HFN_RuDs = yvar;}
12138       if( HistoCode == "H_SCs_RuDs"){fYMemoH_SCs_RuDs = yvar;}
12139     }
12140 }// end of SetYVarMemo(...)
12141 
12142 TString TEcnaHistos::GetYVarFromMemo(const TString HistoCode, const TString opt_plot)
12143 {
12144   TString yvar = "(yvar not found)";
12145 
12146   if( opt_plot == fSameOnePlot ){yvar = fYMemoH1SamePlus;}
12147 
12148   if( opt_plot == fOnlyOnePlot || opt_plot == fSeveralPlot )
12149     {  
12150       if( HistoCode == "D_NOE_ChNb"){yvar = fYMemoD_NOE_ChNb;}
12151       if( HistoCode == "D_NOE_ChDs"){yvar = fYMemoD_NOE_ChDs;}
12152       if( HistoCode == "D_Ped_ChNb"){yvar = fYMemoD_Ped_ChNb;}
12153       if( HistoCode == "D_Ped_ChDs"){yvar = fYMemoD_Ped_ChDs;}
12154       if( HistoCode == "D_TNo_ChNb"){yvar = fYMemoD_TNo_ChNb;}
12155       if( HistoCode == "D_TNo_ChDs"){yvar = fYMemoD_TNo_ChDs;}
12156       if( HistoCode == "D_MCs_ChNb"){yvar = fYMemoD_MCs_ChNb;}
12157       if( HistoCode == "D_MCs_ChDs"){yvar = fYMemoD_MCs_ChDs;}
12158       if( HistoCode == "D_LFN_ChNb"){yvar = fYMemoD_LFN_ChNb;}
12159       if( HistoCode == "D_LFN_ChDs"){yvar = fYMemoD_LFN_ChDs;}
12160       if( HistoCode == "D_HFN_ChNb"){yvar = fYMemoD_HFN_ChNb;}
12161       if( HistoCode == "D_HFN_ChDs"){yvar = fYMemoD_HFN_ChDs;}
12162       if( HistoCode == "D_SCs_ChNb"){yvar = fYMemoD_SCs_ChNb;}
12163       if( HistoCode == "D_SCs_ChDs"){yvar = fYMemoD_SCs_ChDs;}
12164       if( HistoCode == "D_MSp_SpNb"){yvar = fYMemoD_MSp_SpNb;}
12165       if( HistoCode == "D_MSp_SpDs"){yvar = fYMemoD_MSp_SpDs;}
12166       if( HistoCode == "D_SSp_SpNb"){yvar = fYMemoD_SSp_SpNb;}
12167       if( HistoCode == "D_SSp_SpDs"){yvar = fYMemoD_SSp_SpDs;}
12168       if( HistoCode == "D_Adc_EvNb"){yvar = fYMemoD_Adc_EvNb;}
12169       if( HistoCode == "D_Adc_EvDs"){yvar = fYMemoD_Adc_EvDs;}
12170       if( HistoCode == "H_Ped_Date"){yvar = fYMemoH_Ped_Date;}
12171       if( HistoCode == "H_TNo_Date"){yvar = fYMemoH_TNo_Date;}
12172       if( HistoCode == "H_MCs_Date"){yvar = fYMemoH_MCs_Date;}
12173       if( HistoCode == "H_LFN_Date"){yvar = fYMemoH_LFN_Date;}
12174       if( HistoCode == "H_HFN_Date"){yvar = fYMemoH_HFN_Date;}
12175       if( HistoCode == "H_SCs_Date"){yvar = fYMemoH_SCs_Date;}
12176       if( HistoCode == "H_Ped_RuDs"){yvar = fYMemoH_Ped_RuDs;}
12177       if( HistoCode == "H_TNo_RuDs"){yvar = fYMemoH_TNo_RuDs;}
12178       if( HistoCode == "H_MCs_RuDs"){yvar = fYMemoH_MCs_RuDs;}
12179       if( HistoCode == "H_LFN_RuDs"){yvar = fYMemoH_LFN_RuDs;}
12180       if( HistoCode == "H_HFN_RuDs"){yvar = fYMemoH_HFN_RuDs;}
12181       if( HistoCode == "H_SCs_RuDs"){yvar = fYMemoH_SCs_RuDs;}
12182     }
12183   return yvar;
12184 }// end of GetYVarFromMemo(...)
12185 
12186 void TEcnaHistos::SetNbBinsMemo(const TString HistoCode, const TString opt_plot, const Int_t& nb_bins)
12187 {
12188 
12189   if( opt_plot == fSameOnePlot ){fNbBinsMemoH1SamePlus = nb_bins;}
12190 
12191   if( opt_plot == fOnlyOnePlot || opt_plot == fSeveralPlot )
12192     {
12193       if( HistoCode == "D_NOE_ChNb"){fNbBinsMemoD_NOE_ChNb = nb_bins;}
12194       if( HistoCode == "D_NOE_ChDs"){fNbBinsMemoD_NOE_ChDs = nb_bins;}  
12195       if( HistoCode == "D_Ped_ChNb"){fNbBinsMemoD_Ped_ChNb = nb_bins;} 
12196       if( HistoCode == "D_Ped_ChDs"){fNbBinsMemoD_Ped_ChDs = nb_bins;} 
12197       if( HistoCode == "D_TNo_ChNb"){fNbBinsMemoD_TNo_ChNb = nb_bins;}
12198       if( HistoCode == "D_TNo_ChDs"){fNbBinsMemoD_TNo_ChDs = nb_bins;} 
12199       if( HistoCode == "D_MCs_ChNb"){fNbBinsMemoD_MCs_ChNb = nb_bins;} 
12200       if( HistoCode == "D_MCs_ChDs"){fNbBinsMemoD_MCs_ChDs = nb_bins;} 
12201       if( HistoCode == "D_LFN_ChNb"){fNbBinsMemoD_LFN_ChNb = nb_bins;} 
12202       if( HistoCode == "D_LFN_ChDs"){fNbBinsMemoD_LFN_ChDs = nb_bins;}
12203       if( HistoCode == "D_HFN_ChNb"){fNbBinsMemoD_HFN_ChNb = nb_bins;} 
12204       if( HistoCode == "D_HFN_ChDs"){fNbBinsMemoD_HFN_ChDs = nb_bins;} 
12205       if( HistoCode == "D_SCs_ChNb"){fNbBinsMemoD_SCs_ChNb = nb_bins;}
12206       if( HistoCode == "D_SCs_ChDs"){fNbBinsMemoD_SCs_ChDs = nb_bins;}
12207       if( HistoCode == "D_MSp_SpNb"){fNbBinsMemoD_MSp_SpNb = nb_bins;}
12208       if( HistoCode == "D_MSp_SpDs"){fNbBinsMemoD_MSp_SpDs = nb_bins;}
12209       if( HistoCode == "D_SSp_SpNb"){fNbBinsMemoD_SSp_SpNb = nb_bins;}
12210       if( HistoCode == "D_SSp_SpDs"){fNbBinsMemoD_SSp_SpDs = nb_bins;}
12211       if( HistoCode == "D_Adc_EvNb"){fNbBinsMemoD_Adc_EvNb = nb_bins;}
12212       if( HistoCode == "D_Adc_EvDs"){fNbBinsMemoD_Adc_EvDs = nb_bins;}
12213       if( HistoCode == "H_Ped_Date"){fNbBinsMemoH_Ped_Date = nb_bins;}
12214       if( HistoCode == "H_TNo_Date"){fNbBinsMemoH_TNo_Date = nb_bins;}
12215       if( HistoCode == "H_MCs_Date"){fNbBinsMemoH_MCs_Date = nb_bins;}
12216       if( HistoCode == "H_LFN_Date"){fNbBinsMemoH_LFN_Date = nb_bins;}
12217       if( HistoCode == "H_HFN_Date"){fNbBinsMemoH_HFN_Date = nb_bins;}
12218       if( HistoCode == "H_SCs_Date"){fNbBinsMemoH_SCs_Date = nb_bins;}
12219       if( HistoCode == "H_Ped_RuDs"){fNbBinsMemoH_Ped_RuDs = nb_bins;}
12220       if( HistoCode == "H_TNo_RuDs"){fNbBinsMemoH_TNo_RuDs = nb_bins;}
12221       if( HistoCode == "H_MCs_RuDs"){fNbBinsMemoH_MCs_RuDs = nb_bins;}
12222       if( HistoCode == "H_LFN_RuDs"){fNbBinsMemoH_LFN_RuDs = nb_bins;}
12223       if( HistoCode == "H_HFN_RuDs"){fNbBinsMemoH_HFN_RuDs = nb_bins;}
12224       if( HistoCode == "H_SCs_RuDs"){fNbBinsMemoH_SCs_RuDs = nb_bins;}
12225     }
12226 }// end of SetNbBinsMemo(...)
12227 
12228 Int_t TEcnaHistos::GetNbBinsFromMemo(const TString HistoCode, const TString opt_plot)
12229 {
12230   Int_t nb_bins = 0;
12231 
12232   if( opt_plot == fSameOnePlot ){nb_bins = fNbBinsMemoH1SamePlus;}
12233 
12234   if( opt_plot == fOnlyOnePlot || opt_plot == fSeveralPlot )
12235     {
12236       if( HistoCode == "D_NOE_ChNb"){nb_bins = fNbBinsMemoD_NOE_ChNb;}
12237       if( HistoCode == "D_NOE_ChDs"){nb_bins = fNbBinsMemoD_NOE_ChDs;}  
12238       if( HistoCode == "D_Ped_ChNb"){nb_bins = fNbBinsMemoD_Ped_ChNb;} 
12239       if( HistoCode == "D_Ped_ChDs"){nb_bins = fNbBinsMemoD_Ped_ChDs;} 
12240       if( HistoCode == "D_TNo_ChNb"){nb_bins = fNbBinsMemoD_TNo_ChNb;}
12241       if( HistoCode == "D_TNo_ChDs"){nb_bins = fNbBinsMemoD_TNo_ChDs;} 
12242       if( HistoCode == "D_MCs_ChNb"){nb_bins = fNbBinsMemoD_MCs_ChNb;} 
12243       if( HistoCode == "D_MCs_ChDs"){nb_bins = fNbBinsMemoD_MCs_ChDs;} 
12244       if( HistoCode == "D_LFN_ChNb"){nb_bins = fNbBinsMemoD_LFN_ChNb;} 
12245       if( HistoCode == "D_LFN_ChDs"){nb_bins = fNbBinsMemoD_LFN_ChDs;}
12246       if( HistoCode == "D_HFN_ChNb"){nb_bins = fNbBinsMemoD_HFN_ChNb;} 
12247       if( HistoCode == "D_HFN_ChDs"){nb_bins = fNbBinsMemoD_HFN_ChDs;} 
12248       if( HistoCode == "D_SCs_ChNb"){nb_bins = fNbBinsMemoD_SCs_ChNb;}
12249       if( HistoCode == "D_SCs_ChDs"){nb_bins = fNbBinsMemoD_SCs_ChDs;}
12250       if( HistoCode == "D_MSp_SpNb"){nb_bins = fNbBinsMemoD_MSp_SpNb;}
12251       if( HistoCode == "D_MSp_SpDs"){nb_bins = fNbBinsMemoD_MSp_SpDs;}
12252       if( HistoCode == "D_SSp_SpNb"){nb_bins = fNbBinsMemoD_SSp_SpNb;}
12253       if( HistoCode == "D_SSp_SpDs"){nb_bins = fNbBinsMemoD_SSp_SpDs;}
12254       if( HistoCode == "D_Adc_EvNb"){nb_bins = fNbBinsMemoD_Adc_EvNb;}
12255       if( HistoCode == "D_Adc_EvDs"){nb_bins = fNbBinsMemoD_Adc_EvDs;}
12256       if( HistoCode == "H_Ped_Date"){nb_bins = fNbBinsMemoH_Ped_Date;}
12257       if( HistoCode == "H_TNo_Date"){nb_bins = fNbBinsMemoH_TNo_Date;}
12258       if( HistoCode == "H_MCs_Date"){nb_bins = fNbBinsMemoH_MCs_Date;}
12259       if( HistoCode == "H_LFN_Date"){nb_bins = fNbBinsMemoH_LFN_Date;}
12260       if( HistoCode == "H_HFN_Date"){nb_bins = fNbBinsMemoH_HFN_Date;}
12261       if( HistoCode == "H_SCs_Date"){nb_bins = fNbBinsMemoH_SCs_Date;}
12262       if( HistoCode == "H_Ped_RuDs"){nb_bins = fNbBinsMemoH_Ped_RuDs;}
12263       if( HistoCode == "H_TNo_RuDs"){nb_bins = fNbBinsMemoH_TNo_RuDs;}
12264       if( HistoCode == "H_MCs_RuDs"){nb_bins = fNbBinsMemoH_MCs_RuDs;}
12265       if( HistoCode == "H_LFN_RuDs"){nb_bins = fNbBinsMemoH_LFN_RuDs;}
12266       if( HistoCode == "H_HFN_RuDs"){nb_bins = fNbBinsMemoH_HFN_RuDs;}
12267       if( HistoCode == "H_SCs_RuDs"){nb_bins = fNbBinsMemoH_SCs_RuDs;}
12268     }
12269   return nb_bins;
12270 }// end of GetNbBinsFromMemo(...)
12271 
12272 TString TEcnaHistos::GetMemoFlag(const TString opt_plot)
12273 {
12274   TString memo_flag;
12275   Int_t MaxCar = fgMaxCar;
12276   memo_flag.Resize(MaxCar);
12277   memo_flag = "(no memo_flag info)";
12278 
12279   Int_t memo_flag_number = -1;
12280 
12281   if( opt_plot == fSameOnePlot ){memo_flag_number = fMemoPlotH1SamePlus;}
12282 
12283   if( opt_plot == fOnlyOnePlot || opt_plot == fSeveralPlot )
12284     {
12285       memo_flag_number = fMemoPlotD_TNo_ChDs+fMemoPlotD_MCs_ChDs
12286         +fMemoPlotD_LFN_ChDs+fMemoPlotD_HFN_ChDs+fMemoPlotD_SCs_ChDs;
12287     }
12288 
12289   if(memo_flag_number == 0){memo_flag = "Free";}
12290   if(memo_flag_number >= 1){memo_flag = "Busy";}
12291 
12292   return memo_flag;
12293 }
12294 
12295 TString TEcnaHistos::GetMemoFlag(const TString HistoCode, const TString opt_plot)
12296 {
12297 // Get Memo Flag
12298 
12299   TString memo_flag;
12300   Int_t MaxCar = fgMaxCar;
12301   memo_flag.Resize(MaxCar);
12302   memo_flag = "(no memo_flag info)";
12303 
12304   Int_t memo_flag_number = -1;
12305 
12306   if( opt_plot == fSameOnePlot ){memo_flag_number = fMemoPlotH1SamePlus;}
12307 
12308   if( opt_plot == fOnlyOnePlot || opt_plot == fSeveralPlot )
12309     {
12310       if(HistoCode == "D_NOE_ChNb"){memo_flag_number = fMemoPlotD_NOE_ChNb;}
12311       if(HistoCode == "D_NOE_ChDs"){memo_flag_number = fMemoPlotD_NOE_ChDs;}
12312       if(HistoCode == "D_Ped_ChNb"){memo_flag_number = fMemoPlotD_Ped_ChNb;}
12313       if(HistoCode == "D_Ped_ChDs"){memo_flag_number = fMemoPlotD_Ped_ChDs;}
12314       if(HistoCode == "D_TNo_ChNb"){memo_flag_number = fMemoPlotD_TNo_ChNb;}
12315       if(HistoCode == "D_TNo_ChDs"){memo_flag_number = fMemoPlotD_TNo_ChDs;}
12316       if(HistoCode == "D_MCs_ChNb"){memo_flag_number = fMemoPlotD_MCs_ChNb;}
12317       if(HistoCode == "D_MCs_ChDs"){memo_flag_number = fMemoPlotD_MCs_ChDs;}
12318       if(HistoCode == "D_LFN_ChNb"){memo_flag_number = fMemoPlotD_LFN_ChNb;}
12319       if(HistoCode == "D_LFN_ChDs"){memo_flag_number = fMemoPlotD_LFN_ChDs;} 
12320       if(HistoCode == "D_HFN_ChNb"){memo_flag_number = fMemoPlotD_HFN_ChNb;} 
12321       if(HistoCode == "D_HFN_ChDs"){memo_flag_number = fMemoPlotD_HFN_ChDs;}
12322       if(HistoCode == "D_SCs_ChNb"){memo_flag_number = fMemoPlotD_SCs_ChNb;}
12323       if(HistoCode == "D_SCs_ChDs"){memo_flag_number = fMemoPlotD_SCs_ChDs;}
12324       if(HistoCode == "D_MSp_SpNb"){memo_flag_number = fMemoPlotD_MSp_SpNb;}
12325       if(HistoCode == "D_MSp_SpDs"){memo_flag_number = fMemoPlotD_MSp_SpDs;}
12326       if(HistoCode == "D_SSp_SpNb"){memo_flag_number = fMemoPlotD_SSp_SpNb;}
12327       if(HistoCode == "D_SSp_SpDs"){memo_flag_number = fMemoPlotD_SSp_SpDs;}
12328       if(HistoCode == "D_Adc_EvNb"){memo_flag_number = fMemoPlotD_Adc_EvNb;}
12329       if(HistoCode == "D_Adc_EvDs"){memo_flag_number = fMemoPlotD_Adc_EvDs;}
12330       if(HistoCode == "H_Ped_Date"){memo_flag_number = fMemoPlotH_Ped_Date;}
12331       if(HistoCode == "H_TNo_Date"){memo_flag_number = fMemoPlotH_TNo_Date;}
12332       if(HistoCode == "H_MCs_Date"){memo_flag_number = fMemoPlotH_MCs_Date;}
12333       if(HistoCode == "H_LFN_Date"){memo_flag_number = fMemoPlotH_LFN_Date;}
12334       if(HistoCode == "H_HFN_Date"){memo_flag_number = fMemoPlotH_HFN_Date;}
12335       if(HistoCode == "H_SCs_Date"){memo_flag_number = fMemoPlotH_SCs_Date;}
12336       if(HistoCode == "H_Ped_RuDs"){memo_flag_number = fMemoPlotH_Ped_RuDs;}
12337       if(HistoCode == "H_TNo_RuDs"){memo_flag_number = fMemoPlotH_TNo_RuDs;}
12338       if(HistoCode == "H_MCs_RuDs"){memo_flag_number = fMemoPlotH_MCs_RuDs;}
12339       if(HistoCode == "H_LFN_RuDs"){memo_flag_number = fMemoPlotH_LFN_RuDs;}
12340       if(HistoCode == "H_HFN_RuDs"){memo_flag_number = fMemoPlotH_HFN_RuDs;}
12341       if(HistoCode == "H_SCs_RuDs"){memo_flag_number = fMemoPlotH_SCs_RuDs;}
12342     }
12343 
12344   if(memo_flag_number == 0){memo_flag = "Free";}
12345   if(memo_flag_number == 1){memo_flag = "Busy";}
12346 
12347   return memo_flag;
12348 }
12349 
12350 TCanvas* TEcnaHistos::CreateCanvas(const TString HistoCode, const TString opt_plot, const TString canvas_name,
12351                                  UInt_t canv_w, UInt_t canv_h)
12352 {
12353 // Create canvas according to HistoCode
12354 
12355   TCanvas* main_canvas = 0;
12356  
12357   if( opt_plot == fSameOnePlot )
12358     {
12359       fCanvH1SamePlus = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h); fCnewRoot++;
12360       main_canvas = fCanvH1SamePlus;
12361     }
12362   if( opt_plot == fSeveralPlot || opt_plot == fOnlyOnePlot )
12363     {
12364       if(HistoCode == "D_NOE_ChNb"){
12365         fCanvD_NOE_ChNb = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h); fCnewRoot++;
12366         main_canvas = fCanvD_NOE_ChNb;}
12367       if(HistoCode == "D_NOE_ChDs"){
12368         fCanvD_NOE_ChDs = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h); fCnewRoot++;
12369         main_canvas = fCanvD_NOE_ChDs;}
12370       if(HistoCode == "D_Ped_ChNb"){
12371         fCanvD_Ped_ChNb = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h); fCnewRoot++;
12372         main_canvas = fCanvD_Ped_ChNb;}
12373       if(HistoCode == "D_Ped_ChDs"){
12374         fCanvD_Ped_ChDs = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h); fCnewRoot++;
12375         main_canvas = fCanvD_Ped_ChDs;}
12376       if(HistoCode == "D_TNo_ChNb"){
12377         fCanvD_TNo_ChNb = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h); fCnewRoot++;
12378         main_canvas = fCanvD_TNo_ChNb;}
12379       if(HistoCode == "D_TNo_ChDs"){
12380         fCanvD_TNo_ChDs = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h); fCnewRoot++;
12381         main_canvas = fCanvD_TNo_ChDs;}
12382       if(HistoCode == "D_MCs_ChNb"){
12383         fCanvD_MCs_ChNb = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h); fCnewRoot++;
12384         main_canvas = fCanvD_MCs_ChNb;}
12385       if(HistoCode == "D_MCs_ChDs"){
12386         fCanvD_MCs_ChDs = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h); fCnewRoot++;
12387         main_canvas = fCanvD_MCs_ChDs;}
12388       if(HistoCode == "D_LFN_ChNb"){
12389         fCanvD_LFN_ChNb = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h); fCnewRoot++;
12390         main_canvas = fCanvD_LFN_ChNb;}
12391       if(HistoCode == "D_LFN_ChDs"){
12392         fCanvD_LFN_ChDs = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h); fCnewRoot++;
12393         main_canvas = fCanvD_LFN_ChDs;}
12394       if(HistoCode == "D_HFN_ChNb"){
12395         fCanvD_HFN_ChNb = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h); fCnewRoot++;
12396         main_canvas = fCanvD_HFN_ChNb;}
12397       if(HistoCode == "D_HFN_ChDs"){
12398         fCanvD_HFN_ChDs = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h); fCnewRoot++;
12399         main_canvas = fCanvD_HFN_ChDs;}
12400       if(HistoCode == "D_SCs_ChNb"){
12401         fCanvD_SCs_ChNb = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h); fCnewRoot++;
12402         main_canvas = fCanvD_SCs_ChNb;}
12403       if(HistoCode == "D_SCs_ChDs"){
12404         fCanvD_SCs_ChDs = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h); fCnewRoot++;
12405         main_canvas = fCanvD_SCs_ChDs;}
12406 
12407       if(HistoCode == "D_MSp_SpNb"        ){
12408         fCanvD_MSp_SpNb = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h); fCnewRoot++;
12409         main_canvas = fCanvD_MSp_SpNb;}
12410       if(HistoCode == "D_MSp_SpDs"        ){
12411         fCanvD_MSp_SpDs = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h); fCnewRoot++;
12412         main_canvas = fCanvD_MSp_SpDs;}
12413       if(HistoCode =="D_SSp_SpNb"      ){
12414         fCanvD_SSp_SpNb = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h); fCnewRoot++;
12415         main_canvas = fCanvD_SSp_SpNb;}
12416       if(HistoCode =="D_SSp_SpDs"      ){
12417         fCanvD_SSp_SpDs = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h); fCnewRoot++;
12418         main_canvas = fCanvD_SSp_SpDs;}
12419 
12420       if(HistoCode == "D_Adc_EvNb"){
12421         fCanvD_Adc_EvNb = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h); fCnewRoot++;
12422         main_canvas = fCanvD_Adc_EvNb;}
12423       if(HistoCode == "D_Adc_EvDs"){
12424         fCanvD_Adc_EvDs = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h); fCnewRoot++;
12425         main_canvas = fCanvD_Adc_EvDs;}
12426 
12427       if(HistoCode == "H_Ped_Date"){
12428         fCanvH_Ped_Date = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h); fCnewRoot++;
12429         main_canvas = fCanvH_Ped_Date;}
12430       if(HistoCode == "H_TNo_Date"){
12431         fCanvH_TNo_Date = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h); fCnewRoot++;
12432         main_canvas = fCanvH_TNo_Date;}
12433       if(HistoCode == "H_MCs_Date"){
12434         fCanvH_MCs_Date = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h); fCnewRoot++;
12435         main_canvas = fCanvH_MCs_Date;}
12436       if(HistoCode == "H_LFN_Date"){
12437         fCanvH_LFN_Date = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h); fCnewRoot++;
12438         main_canvas = fCanvH_LFN_Date;}
12439       if(HistoCode == "H_HFN_Date"){
12440         fCanvH_HFN_Date = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h); fCnewRoot++;
12441         main_canvas = fCanvH_HFN_Date;}
12442       if(HistoCode == "H_SCs_Date"){
12443         fCanvH_SCs_Date = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h); fCnewRoot++;
12444         main_canvas = fCanvH_SCs_Date;}
12445 
12446       if(HistoCode == "H_Ped_RuDs"){
12447         fCanvH_Ped_RuDs = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h); fCnewRoot++;
12448         main_canvas = fCanvH_Ped_RuDs;}
12449       if(HistoCode == "H_TNo_RuDs"){
12450         fCanvH_TNo_RuDs = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h); fCnewRoot++;
12451         main_canvas = fCanvH_TNo_RuDs;}
12452       if(HistoCode == "H_MCs_RuDs"){
12453         fCanvH_MCs_RuDs = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h); fCnewRoot++;
12454         main_canvas = fCanvH_MCs_RuDs;}
12455       if(HistoCode == "H_LFN_RuDs"){
12456         fCanvH_LFN_RuDs = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h); fCnewRoot++;
12457         main_canvas = fCanvH_LFN_RuDs;}
12458       if(HistoCode == "H_HFN_RuDs"){
12459         fCanvH_HFN_RuDs = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h); fCnewRoot++;
12460         main_canvas = fCanvH_HFN_RuDs;}
12461       if(HistoCode == "H_SCs_RuDs"){
12462         fCanvH_SCs_RuDs = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h); fCnewRoot++;
12463         main_canvas = fCanvH_SCs_RuDs;}
12464 
12465     }
12466   return main_canvas;
12467 }
12468 // end of CreateCanvas
12469 
12470 void TEcnaHistos::SetParametersCanvas(const TString HistoCode, const TString opt_plot)
12471 {
12472 // Set parameters canvas according to HistoCode
12473   
12474   Double_t x_margin_factor = fCnaParHistos->BoxLeftX("bottom_left_box") - 0.005;
12475   Double_t y_margin_factor = fCnaParHistos->BoxTopY("bottom_right_box") + 0.005;
12476 
12477   if( opt_plot == fSameOnePlot )
12478     {
12479       fImpH1SamePlus = (TRootCanvas*)fCanvH1SamePlus->GetCanvasImp();
12480       fCanvH1SamePlus->Divide(1, 1, x_margin_factor , y_margin_factor); gPad->cd(1);
12481       fPadH1SamePlus = gPad;
12482       fMemoPlotH1SamePlus = 1; fMemoColorH1SamePlus = 0;
12483     }
12484 
12485   if( opt_plot == fOnlyOnePlot ||  opt_plot == fSeveralPlot)
12486     {
12487       if(HistoCode == "D_NOE_ChNb")
12488         {
12489           fImpD_NOE_ChNb = (TRootCanvas*)fCanvD_NOE_ChNb->GetCanvasImp();
12490           fCanvD_NOE_ChNb->Divide(1, 1, x_margin_factor , y_margin_factor); gPad->cd(1);
12491           fPadD_NOE_ChNb = gPad;
12492           fMemoPlotD_NOE_ChNb = 1; fMemoColorD_NOE_ChNb = 0;
12493         }
12494       
12495       if(HistoCode == "D_NOE_ChDs")                                               // (SetParametersCanvas)
12496         {
12497           fImpD_NOE_ChDs = (TRootCanvas*)fCanvD_NOE_ChDs->GetCanvasImp();
12498           fCanvD_NOE_ChDs->Divide(1, 1, x_margin_factor , y_margin_factor); gPad->cd(1);
12499           fPadD_NOE_ChDs = gPad;
12500           fMemoPlotD_NOE_ChDs = 1; fMemoColorD_NOE_ChDs = 0;
12501         }
12502       
12503       if(HistoCode == "D_Ped_ChNb")
12504         {
12505           fImpD_Ped_ChNb = (TRootCanvas*)fCanvD_Ped_ChNb->GetCanvasImp();
12506           fCanvD_Ped_ChNb->Divide(1, 1, x_margin_factor , y_margin_factor); gPad->cd(1);
12507           fPadD_Ped_ChNb = gPad;
12508           fMemoPlotD_Ped_ChNb = 1; fMemoColorD_Ped_ChNb = 0;
12509         }
12510       
12511       if(HistoCode == "D_Ped_ChDs")
12512         {
12513           fImpD_Ped_ChDs = (TRootCanvas*)fCanvD_Ped_ChDs->GetCanvasImp();
12514           fCanvD_Ped_ChDs->Divide(1, 1, x_margin_factor , y_margin_factor); gPad->cd(1);
12515           fPadD_Ped_ChDs = gPad;
12516           fMemoPlotD_Ped_ChDs = 1; fMemoColorD_Ped_ChDs = 0;
12517         }
12518       
12519       if(HistoCode == "D_TNo_ChNb")
12520         {
12521           fImpD_TNo_ChNb = (TRootCanvas*)fCanvD_TNo_ChNb->GetCanvasImp();
12522           fCanvD_TNo_ChNb->Divide(1, 1, x_margin_factor , y_margin_factor); gPad->cd(1);
12523           fPadD_TNo_ChNb = gPad; 
12524           fMemoPlotD_TNo_ChNb = 1; fMemoColorD_TNo_ChNb = 0;
12525         }
12526       
12527       if(HistoCode == "D_TNo_ChDs")                                               // (SetParametersCanvas)
12528         {
12529           fImpD_TNo_ChDs = (TRootCanvas*)fCanvD_TNo_ChDs->GetCanvasImp();
12530           fCanvD_TNo_ChDs->Divide(1, 1, x_margin_factor , y_margin_factor); gPad->cd(1);
12531           fPadD_TNo_ChDs = gPad;
12532           fMemoPlotD_TNo_ChDs = 1; fMemoColorD_TNo_ChDs = 0;
12533         }
12534       
12535       if(HistoCode == "D_MCs_ChNb")
12536         {
12537           fImpD_MCs_ChNb = (TRootCanvas*)fCanvD_MCs_ChNb->GetCanvasImp();
12538           fCanvD_MCs_ChNb->Divide(1, 1, x_margin_factor , y_margin_factor); gPad->cd(1);
12539           fPadD_MCs_ChNb = gPad;
12540           fMemoPlotD_MCs_ChNb = 1; fMemoColorD_MCs_ChNb = 0;
12541         }
12542       
12543       if(HistoCode == "D_MCs_ChDs")
12544         {
12545           fImpD_MCs_ChDs = (TRootCanvas*)fCanvD_MCs_ChDs->GetCanvasImp();
12546           fCanvD_MCs_ChDs->Divide(1, 1, x_margin_factor , y_margin_factor); gPad->cd(1);
12547           fPadD_MCs_ChDs = gPad;
12548           fMemoPlotD_MCs_ChDs = 1; fMemoColorD_MCs_ChDs = 0;
12549         }
12550       
12551       if(HistoCode == "D_LFN_ChNb")                                               // (SetParametersCanvas)
12552         {
12553           fImpD_LFN_ChNb = (TRootCanvas*)fCanvD_LFN_ChNb->GetCanvasImp();
12554           fCanvD_LFN_ChNb->Divide(1, 1, x_margin_factor , y_margin_factor); gPad->cd(1);
12555           fPadD_LFN_ChNb = gPad;
12556           fMemoPlotD_LFN_ChNb = 1; fMemoColorD_LFN_ChNb = 0;
12557         }
12558       
12559       if(HistoCode == "D_LFN_ChDs")
12560         {
12561           fImpD_LFN_ChDs = (TRootCanvas*)fCanvD_LFN_ChDs->GetCanvasImp();
12562           fCanvD_LFN_ChDs->Divide(1, 1, x_margin_factor , y_margin_factor); gPad->cd(1);
12563           fPadD_LFN_ChDs = gPad;
12564           fMemoPlotD_LFN_ChDs = 1; fMemoColorD_LFN_ChDs = 0;
12565         }
12566       
12567       if(HistoCode == "D_HFN_ChNb")
12568         {
12569           fImpD_HFN_ChNb = (TRootCanvas*)fCanvD_HFN_ChNb->GetCanvasImp();
12570           fCanvD_HFN_ChNb->Divide(1, 1, x_margin_factor , y_margin_factor); gPad->cd(1);
12571           fPadD_HFN_ChNb = gPad;
12572           fMemoPlotD_HFN_ChNb = 1; fMemoColorD_HFN_ChNb = 0;
12573         }
12574       
12575       if(HistoCode == "D_HFN_ChDs")
12576         {
12577           fImpD_HFN_ChDs = (TRootCanvas*)fCanvD_HFN_ChDs->GetCanvasImp();
12578           fCanvD_HFN_ChDs->Divide(1, 1, x_margin_factor , y_margin_factor); gPad->cd(1);
12579           fPadD_HFN_ChDs = gPad;
12580           fMemoPlotD_HFN_ChDs = 1; fMemoColorD_HFN_ChDs = 0;
12581         }
12582       
12583       if(HistoCode == "D_SCs_ChNb")                                               // (SetParametersCanvas)
12584         {
12585           fImpD_SCs_ChNb = (TRootCanvas*)fCanvD_SCs_ChNb->GetCanvasImp();
12586           fCanvD_SCs_ChNb->Divide(1, 1, x_margin_factor , y_margin_factor); gPad->cd(1);
12587           fPadD_SCs_ChNb = gPad;
12588           fMemoPlotD_SCs_ChNb = 1; fMemoColorD_SCs_ChNb = 0;
12589         }
12590       
12591       if(HistoCode == "D_SCs_ChDs")
12592         {
12593           fImpD_SCs_ChDs = (TRootCanvas*)fCanvD_SCs_ChDs->GetCanvasImp();
12594           fCanvD_SCs_ChDs->Divide(1, 1, x_margin_factor , y_margin_factor); gPad->cd(1);
12595           fPadD_SCs_ChDs = gPad;
12596           fMemoPlotD_SCs_ChDs = 1; fMemoColorD_SCs_ChDs = 0;
12597         }
12598       
12599       if(HistoCode == "D_MSp_SpNb")
12600         {
12601           fImpD_MSp_SpNb = (TRootCanvas*)fCanvD_MSp_SpNb->GetCanvasImp();
12602           fCanvD_MSp_SpNb->Divide(1, 1, x_margin_factor , y_margin_factor); gPad->cd(1);
12603           fPadD_MSp_SpNb = gPad;
12604           fMemoPlotD_MSp_SpNb = 1; fMemoColorD_MSp_SpNb = 0;
12605         }
12606       
12607       if(HistoCode == "D_MSp_SpDs")
12608         {
12609           fImpD_MSp_SpDs = (TRootCanvas*)fCanvD_MSp_SpDs->GetCanvasImp();
12610           fCanvD_MSp_SpDs->Divide(1, 1, x_margin_factor , y_margin_factor); gPad->cd(1);
12611           fPadD_MSp_SpDs = gPad;
12612           fMemoPlotD_MSp_SpDs = 1; fMemoColorD_MSp_SpDs = 0;
12613         }
12614       
12615       if(HistoCode == "D_SSp_SpNb")                                               // (SetParametersCanvas)
12616         {
12617           fImpD_SSp_SpNb = (TRootCanvas*)fCanvD_SSp_SpNb->GetCanvasImp();
12618           fCanvD_SSp_SpNb->Divide(1, 1, x_margin_factor , y_margin_factor); gPad->cd(1);
12619           fPadD_SSp_SpNb = gPad;
12620           fMemoPlotD_SSp_SpNb = 1; fMemoColorD_SSp_SpNb = 0;
12621         }
12622       
12623       if(HistoCode == "D_SSp_SpDs")                                               // (SetParametersCanvas)
12624         {
12625           fImpD_SSp_SpDs = (TRootCanvas*)fCanvD_SSp_SpDs->GetCanvasImp();
12626           fCanvD_SSp_SpDs->Divide(1, 1, x_margin_factor , y_margin_factor); gPad->cd(1);
12627           fPadD_SSp_SpDs = gPad;
12628           fMemoPlotD_SSp_SpDs = 1; fMemoColorD_SSp_SpDs = 0;
12629         }
12630       
12631       if(HistoCode == "D_Adc_EvDs")
12632         {
12633           fImpD_Adc_EvDs = (TRootCanvas*)fCanvD_Adc_EvDs->GetCanvasImp();
12634           fCanvD_Adc_EvDs->Divide(1, 1, x_margin_factor , y_margin_factor); gPad->cd(1);
12635           fPadD_Adc_EvDs = gPad;
12636           fMemoPlotD_Adc_EvDs = 1; fMemoColorD_Adc_EvDs = 0;              
12637         }
12638       
12639       if(HistoCode == "D_Adc_EvNb")
12640         {
12641           fImpD_Adc_EvNb = (TRootCanvas*)fCanvD_Adc_EvNb->GetCanvasImp();
12642           fCanvD_Adc_EvNb->Divide(1, 1, x_margin_factor , y_margin_factor); gPad->cd(1);
12643           fPadD_Adc_EvNb = gPad;
12644           fMemoPlotD_Adc_EvNb = 1; fMemoColorD_Adc_EvNb = 0;
12645         }
12646       
12647       if(HistoCode == "H_Ped_Date")                                               // (SetParametersCanvas)
12648         {
12649           fImpH_Ped_Date = (TRootCanvas*)fCanvH_Ped_Date->GetCanvasImp();
12650           fCanvH_Ped_Date->Divide(1, 1, x_margin_factor , y_margin_factor); gPad->cd(1);
12651           fPadH_Ped_Date = gPad;
12652           fMemoPlotH_Ped_Date = 1; fMemoColorH_Ped_Date = 0;
12653         }
12654       if(HistoCode == "H_TNo_Date")
12655         {
12656           fImpH_TNo_Date = (TRootCanvas*)fCanvH_TNo_Date->GetCanvasImp();
12657           fCanvH_TNo_Date->Divide(1, 1, x_margin_factor , y_margin_factor); gPad->cd(1);
12658           fPadH_TNo_Date = gPad;
12659           fMemoPlotH_TNo_Date = 1; fMemoColorH_TNo_Date = 0;
12660         }
12661       if(HistoCode == "H_MCs_Date")
12662         {
12663           fImpH_MCs_Date = (TRootCanvas*)fCanvH_MCs_Date->GetCanvasImp();
12664           fCanvH_MCs_Date->Divide(1, 1, x_margin_factor , y_margin_factor); gPad->cd(1);
12665           fPadH_MCs_Date = gPad;
12666           fMemoPlotH_MCs_Date = 1; fMemoColorH_MCs_Date = 0;
12667         }
12668 
12669       if(HistoCode == "H_LFN_Date")                                               // (SetParametersCanvas)
12670         {
12671           fImpH_LFN_Date = (TRootCanvas*)fCanvH_LFN_Date->GetCanvasImp();
12672           fCanvH_LFN_Date->Divide(1, 1, x_margin_factor , y_margin_factor); gPad->cd(1);
12673           fPadH_LFN_Date = gPad;
12674           fMemoPlotH_LFN_Date = 1; fMemoColorH_LFN_Date = 0;
12675         }
12676       if(HistoCode == "H_HFN_Date")
12677         {
12678           fImpH_HFN_Date = (TRootCanvas*)fCanvH_HFN_Date->GetCanvasImp();
12679           fCanvH_HFN_Date->Divide(1, 1, x_margin_factor , y_margin_factor); gPad->cd(1);
12680           fPadH_HFN_Date = gPad;
12681           fMemoPlotH_HFN_Date = 1; fMemoColorH_HFN_Date = 0;
12682         }
12683       if(HistoCode == "H_SCs_Date")
12684         {
12685           fImpH_SCs_Date = (TRootCanvas*)fCanvH_SCs_Date->GetCanvasImp();
12686           fCanvH_SCs_Date->Divide(1, 1, x_margin_factor , y_margin_factor); gPad->cd(1);
12687           fPadH_SCs_Date = gPad;
12688           fMemoPlotH_SCs_Date = 1; fMemoColorH_SCs_Date = 0;
12689         }
12690 
12691       if(HistoCode == "H_Ped_RuDs")                                               // (SetParametersCanvas)
12692         {
12693           fImpH_Ped_RuDs = (TRootCanvas*)fCanvH_Ped_RuDs->GetCanvasImp();
12694           fCanvH_Ped_RuDs->Divide(1, 1, x_margin_factor , y_margin_factor); gPad->cd(1);
12695           fPadH_Ped_RuDs = gPad;
12696           fMemoPlotH_Ped_RuDs = 1; fMemoColorH_Ped_RuDs = 0;
12697         }
12698       if(HistoCode == "H_TNo_RuDs")
12699         {
12700           fImpH_TNo_RuDs = (TRootCanvas*)fCanvH_TNo_RuDs->GetCanvasImp();
12701           fCanvH_TNo_RuDs->Divide(1, 1, x_margin_factor , y_margin_factor); gPad->cd(1);
12702           fPadH_TNo_RuDs = gPad;
12703           fMemoPlotH_TNo_RuDs = 1; fMemoColorH_TNo_RuDs = 0;
12704         }
12705       if(HistoCode == "H_MCs_RuDs")
12706         {
12707           fImpH_MCs_RuDs = (TRootCanvas*)fCanvH_MCs_RuDs->GetCanvasImp();
12708           fCanvH_MCs_RuDs->Divide(1, 1, x_margin_factor , y_margin_factor); gPad->cd(1);
12709           fPadH_MCs_RuDs = gPad;
12710           fMemoPlotH_MCs_RuDs = 1; fMemoColorH_MCs_RuDs = 0;
12711         }
12712 
12713       if(HistoCode == "H_LFN_RuDs")                                               // (SetParametersCanvas)
12714         {
12715           fImpH_LFN_RuDs = (TRootCanvas*)fCanvH_LFN_RuDs->GetCanvasImp();
12716           fCanvH_LFN_RuDs->Divide(1, 1, x_margin_factor , y_margin_factor); gPad->cd(1);
12717           fPadH_LFN_RuDs = gPad;
12718           fMemoPlotH_LFN_RuDs = 1; fMemoColorH_LFN_RuDs = 0;
12719         }
12720       if(HistoCode == "H_HFN_RuDs")
12721         {
12722           fImpH_HFN_RuDs = (TRootCanvas*)fCanvH_HFN_RuDs->GetCanvasImp();
12723           fCanvH_HFN_RuDs->Divide(1, 1, x_margin_factor , y_margin_factor); gPad->cd(1);
12724           fPadH_HFN_RuDs = gPad;
12725           fMemoPlotH_HFN_RuDs = 1; fMemoColorH_HFN_RuDs = 0;
12726         }
12727       if(HistoCode == "H_SCs_RuDs")
12728         {
12729           fImpH_SCs_RuDs = (TRootCanvas*)fCanvH_SCs_RuDs->GetCanvasImp();
12730           fCanvH_SCs_RuDs->Divide(1, 1, x_margin_factor , y_margin_factor); gPad->cd(1);
12731           fPadH_SCs_RuDs = gPad;
12732           fMemoPlotH_SCs_RuDs = 1; fMemoColorH_SCs_RuDs = 0;
12733         }
12734     }
12735 }
12736 // end of SetParametersCanvas
12737 
12738 TCanvas* TEcnaHistos::GetCurrentCanvas(const TString HistoCode, const TString opt_plot)
12739 {
12740   TCanvas* main_canvas = 0;
12741 
12742   if( opt_plot == fSameOnePlot ){main_canvas = fCanvH1SamePlus;}
12743 
12744   if( opt_plot == fOnlyOnePlot ||  opt_plot == fSeveralPlot)
12745     {
12746       if(HistoCode == "D_NOE_ChNb"){main_canvas = fCanvD_NOE_ChNb;}
12747       if(HistoCode == "D_NOE_ChDs"){main_canvas = fCanvD_NOE_ChDs;}
12748       if(HistoCode == "D_Ped_ChNb"){main_canvas = fCanvD_Ped_ChNb;}
12749       if(HistoCode == "D_Ped_ChDs"){main_canvas = fCanvD_Ped_ChDs;}
12750       if(HistoCode == "D_TNo_ChNb"){main_canvas = fCanvD_TNo_ChNb;}
12751       if(HistoCode == "D_TNo_ChDs"){main_canvas = fCanvD_TNo_ChDs;}
12752       if(HistoCode == "D_MCs_ChNb"){main_canvas = fCanvD_MCs_ChNb;}
12753       if(HistoCode == "D_MCs_ChDs"){main_canvas = fCanvD_MCs_ChDs;}
12754       if(HistoCode == "D_LFN_ChNb"){main_canvas = fCanvD_LFN_ChNb;}
12755       if(HistoCode == "D_LFN_ChDs"){main_canvas = fCanvD_LFN_ChDs;}
12756       if(HistoCode == "D_HFN_ChNb"){main_canvas = fCanvD_HFN_ChNb;}
12757       if(HistoCode == "D_HFN_ChDs"){main_canvas = fCanvD_HFN_ChDs;}
12758       if(HistoCode == "D_SCs_ChNb"){main_canvas = fCanvD_SCs_ChNb;}
12759       if(HistoCode == "D_SCs_ChDs"){main_canvas = fCanvD_SCs_ChDs;}
12760       if(HistoCode == "D_MSp_SpNb"){main_canvas = fCanvD_MSp_SpNb;}
12761       if(HistoCode == "D_MSp_SpDs"){main_canvas = fCanvD_MSp_SpDs;}
12762       if(HistoCode == "D_SSp_SpNb"){main_canvas = fCanvD_SSp_SpNb;}
12763       if(HistoCode == "D_SSp_SpDs"){main_canvas = fCanvD_SSp_SpDs;}
12764       if(HistoCode == "D_Adc_EvNb"){main_canvas = fCanvD_Adc_EvNb;}
12765       if(HistoCode == "D_Adc_EvDs"){main_canvas = fCanvD_Adc_EvDs;}
12766       if(HistoCode == "H_Ped_Date"){main_canvas = fCanvH_Ped_Date;}
12767       if(HistoCode == "H_TNo_Date"){main_canvas = fCanvH_TNo_Date;}
12768       if(HistoCode == "H_MCs_Date"){main_canvas = fCanvH_MCs_Date;}
12769       if(HistoCode == "H_LFN_Date"){main_canvas = fCanvH_LFN_Date;}
12770       if(HistoCode == "H_HFN_Date"){main_canvas = fCanvH_HFN_Date;}
12771       if(HistoCode == "H_SCs_Date"){main_canvas = fCanvH_SCs_Date;}
12772       if(HistoCode == "H_Ped_RuDs"){main_canvas = fCanvH_Ped_RuDs;}
12773       if(HistoCode == "H_TNo_RuDs"){main_canvas = fCanvH_TNo_RuDs;}
12774       if(HistoCode == "H_MCs_RuDs"){main_canvas = fCanvH_MCs_RuDs;}
12775       if(HistoCode == "H_LFN_RuDs"){main_canvas = fCanvH_LFN_RuDs;}
12776       if(HistoCode == "H_HFN_RuDs"){main_canvas = fCanvH_HFN_RuDs;}
12777       if(HistoCode == "H_SCs_RuDs"){main_canvas = fCanvH_SCs_RuDs;}
12778     }
12779   return main_canvas;
12780 }
12781 // end of GetCurrentCanvas(...)
12782 
12783 TCanvas* TEcnaHistos::GetCurrentCanvas(){return fCurrentCanvas;}
12784 TString  TEcnaHistos::GetCurrentCanvasName(){return fCurrentCanvasName;}
12785 
12786 void TEcnaHistos::PlotCloneOfCurrentCanvas()
12787 {
12788   if( fCurrentCanvas != 0)
12789     {
12790       if( (TRootCanvas*)fCurrentCanvas->GetCanvasImp() != 0 )
12791         {
12792           (TCanvas*)fCurrentCanvas->DrawClone();
12793         }
12794       else
12795         {
12796           cout << "TEcnaHistos::PlotCloneOfCurrentCanvas()> Last canvas has been removed. No clone can be done."
12797                << endl << "                                        Please, display the canvas again."
12798                << fTTBELL << endl;
12799         }
12800     }
12801   else
12802     {
12803       cout << "TEcnaHistos::PlotCloneOfCurrentCanvas()> No canvas has been created. No clone can be done."
12804            << fTTBELL << endl;
12805     }
12806 }
12807 
12808 //--------------------------------------------------------------------------------------------
12809 TVirtualPad* TEcnaHistos::ActivePad(const TString HistoCode, const TString opt_plot)
12810 {
12811 // Active Pad for Same plot option
12812 
12813   TVirtualPad* main_subpad = 0;
12814 
12815   if( opt_plot == fSameOnePlot )
12816     {
12817       if( (TRootCanvas*)fCanvH1SamePlus->GetCanvasImp() == fImpH1SamePlus ){
12818         main_subpad = fPadH1SamePlus;}
12819     }
12820 
12821   if( opt_plot == fOnlyOnePlot || opt_plot == fSeveralPlot)
12822     {
12823       if(HistoCode == "D_NOE_ChNb"){
12824         if( (TRootCanvas*)fCanvD_NOE_ChNb->GetCanvasImp() == fImpD_NOE_ChNb ){
12825           main_subpad = fPadD_NOE_ChNb;}}
12826       
12827       if(HistoCode == "D_NOE_ChDs"){
12828         if( (TRootCanvas*)fCanvD_NOE_ChDs->GetCanvasImp() == fImpD_NOE_ChDs ){
12829           main_subpad = fPadD_NOE_ChDs;}}
12830       
12831       if(HistoCode == "D_Ped_ChNb"){
12832         if( (TRootCanvas*)fCanvD_Ped_ChNb->GetCanvasImp() == fImpD_Ped_ChNb ){
12833           main_subpad = fPadD_Ped_ChNb;}}
12834 
12835       if(HistoCode == "D_Ped_ChDs"){
12836         if( (TRootCanvas*)fCanvD_Ped_ChDs->GetCanvasImp() == fImpD_Ped_ChDs ){
12837           main_subpad = fPadD_Ped_ChDs;}}
12838       
12839       if(HistoCode == "D_TNo_ChNb"){
12840         if((TRootCanvas*)fCanvD_TNo_ChNb->GetCanvasImp() == fImpD_TNo_ChNb){
12841           main_subpad = fPadD_TNo_ChNb;}}
12842 
12843       if(HistoCode == "D_TNo_ChDs"){
12844         if( (TRootCanvas*)fCanvD_TNo_ChDs->GetCanvasImp() == fImpD_TNo_ChDs ){
12845           main_subpad = fPadD_TNo_ChDs;}}
12846       
12847       if(HistoCode == "D_MCs_ChNb"){
12848         if( (TRootCanvas*)fCanvD_MCs_ChNb->GetCanvasImp() == fImpD_MCs_ChNb ){
12849           main_subpad = fPadD_MCs_ChNb;}}
12850       
12851       if(HistoCode == "D_MCs_ChDs"){
12852         if( (TRootCanvas*)fCanvD_MCs_ChDs->GetCanvasImp() == fImpD_MCs_ChDs ){
12853           main_subpad = fPadD_MCs_ChDs;}}
12854       
12855       if(HistoCode == "D_LFN_ChNb"){
12856         if( (TRootCanvas*)fCanvD_LFN_ChNb->GetCanvasImp() == fImpD_LFN_ChNb ){
12857           main_subpad = fPadD_LFN_ChNb;}}
12858       
12859       if(HistoCode == "D_LFN_ChDs"){
12860         if( (TRootCanvas*)fCanvD_LFN_ChDs->GetCanvasImp() == fImpD_LFN_ChDs ){
12861           main_subpad = fPadD_LFN_ChDs;}}
12862       
12863       if(HistoCode == "D_HFN_ChNb"){
12864         if( (TRootCanvas*)fCanvD_HFN_ChNb->GetCanvasImp() == fImpD_HFN_ChNb ){
12865           main_subpad = fPadD_HFN_ChNb;}}
12866       
12867       if(HistoCode == "D_HFN_ChDs"){
12868         if( (TRootCanvas*)fCanvD_HFN_ChDs->GetCanvasImp() == fImpD_HFN_ChDs ){
12869           main_subpad = fPadD_HFN_ChDs;}}
12870       
12871       if(HistoCode == "D_SCs_ChNb"){
12872         if( (TRootCanvas*)fCanvD_SCs_ChNb->GetCanvasImp() == fImpD_SCs_ChNb ){
12873           main_subpad = fPadD_SCs_ChNb;}}
12874       
12875       if(HistoCode == "D_SCs_ChDs"){
12876         if( (TRootCanvas*)fCanvD_SCs_ChDs->GetCanvasImp() == fImpD_SCs_ChDs ){
12877           main_subpad = fPadD_SCs_ChDs;}}
12878       
12879       if(HistoCode == "D_MSp_SpNb"        ){
12880         if( (TRootCanvas*)fCanvD_MSp_SpNb->GetCanvasImp() == fImpD_MSp_SpNb ){
12881           main_subpad = fPadD_MSp_SpNb;}}
12882       
12883       if(HistoCode == "D_MSp_SpDs"        ){
12884         if( (TRootCanvas*)fCanvD_MSp_SpDs->GetCanvasImp() == fImpD_MSp_SpDs ){
12885           main_subpad = fPadD_MSp_SpDs;}}
12886       
12887       if(HistoCode == "D_SSp_SpNb"     ){
12888         if( (TRootCanvas*)fCanvD_SSp_SpNb->GetCanvasImp() == fImpD_SSp_SpNb ){
12889           main_subpad = fPadD_SSp_SpNb;}}
12890   
12891       if(HistoCode == "D_SSp_SpDs"     ){
12892         if( (TRootCanvas*)fCanvD_SSp_SpDs->GetCanvasImp() == fImpD_SSp_SpDs ){
12893           main_subpad = fPadD_SSp_SpDs;}}
12894 
12895       if(HistoCode == "D_Adc_EvNb"){
12896         if( (TRootCanvas*)fCanvD_Adc_EvNb->GetCanvasImp() == fImpD_Adc_EvNb ){
12897           main_subpad = fPadD_Adc_EvNb;}}
12898       
12899       if(HistoCode == "D_Adc_EvDs"){
12900         if( (TRootCanvas*)fCanvD_Adc_EvDs->GetCanvasImp() == fImpD_Adc_EvDs ){
12901           main_subpad = fPadD_Adc_EvDs;}}
12902       
12903       if(HistoCode == "H_Ped_Date"){
12904         if( (TRootCanvas*)fCanvH_Ped_Date->GetCanvasImp() == fImpH_Ped_Date ){
12905           main_subpad = fPadH_Ped_Date;}}
12906 
12907       if(HistoCode == "H_TNo_Date"){
12908         if( (TRootCanvas*)fCanvH_TNo_Date->GetCanvasImp() == fImpH_TNo_Date ){
12909           main_subpad = fPadH_TNo_Date;}}
12910       
12911       if(HistoCode == "H_MCs_Date"){
12912         if( (TRootCanvas*)fCanvH_MCs_Date->GetCanvasImp() == fImpH_MCs_Date ){
12913           main_subpad = fPadH_MCs_Date;}}
12914 
12915       if(HistoCode == "H_LFN_Date"){
12916         if( (TRootCanvas*)fCanvH_LFN_Date->GetCanvasImp() == fImpH_LFN_Date ){
12917           main_subpad = fPadH_LFN_Date;}}
12918       
12919       if(HistoCode == "H_HFN_Date"){
12920         if( (TRootCanvas*)fCanvH_HFN_Date->GetCanvasImp() == fImpH_HFN_Date ){
12921           main_subpad = fPadH_HFN_Date;}}
12922       
12923       if(HistoCode == "H_SCs_Date"){
12924         if( (TRootCanvas*)fCanvH_SCs_Date->GetCanvasImp() == fImpH_SCs_Date ){
12925           main_subpad = fPadH_SCs_Date;}}
12926 
12927       if(HistoCode == "H_Ped_RuDs"){
12928         if( (TRootCanvas*)fCanvH_Ped_RuDs->GetCanvasImp() == fImpH_Ped_RuDs ){
12929           main_subpad = fPadH_Ped_RuDs;}}
12930       
12931       if(HistoCode == "H_TNo_RuDs"){
12932         if( (TRootCanvas*)fCanvH_TNo_RuDs->GetCanvasImp() == fImpH_TNo_RuDs ){
12933           main_subpad = fPadH_TNo_RuDs;}}
12934       
12935       if(HistoCode == "H_MCs_RuDs"){
12936         if( (TRootCanvas*)fCanvH_MCs_RuDs->GetCanvasImp() == fImpH_MCs_RuDs ){
12937           main_subpad = fPadH_MCs_RuDs;}}
12938 
12939       if(HistoCode == "H_LFN_RuDs"){
12940         if( (TRootCanvas*)fCanvH_LFN_RuDs->GetCanvasImp() == fImpH_LFN_RuDs ){
12941           main_subpad = fPadH_LFN_RuDs;}}
12942       
12943       if(HistoCode == "H_HFN_RuDs"){
12944         if( (TRootCanvas*)fCanvH_HFN_RuDs->GetCanvasImp() == fImpH_HFN_RuDs ){
12945           main_subpad = fPadH_HFN_RuDs;}}
12946       
12947       if(HistoCode == "H_SCs_RuDs"){
12948         if( (TRootCanvas*)fCanvH_SCs_RuDs->GetCanvasImp() == fImpH_SCs_RuDs ){
12949           main_subpad = fPadH_SCs_RuDs;}}
12950     }
12951     
12952   if( main_subpad == 0 )
12953     {cout << "*TEcnaHistos::ActivePad(...)> main_subpad = "
12954           << main_subpad << ". This canvas has been closed." << endl;}
12955 
12956   return main_subpad;
12957 }
12958 // end of ActivePad
12959 
12960 void TEcnaHistos::SetParametersPavTxt(const TString HistoCode, const TString opt_plot)
12961 {
12962 // Set parameters pave "sevearl changing" according to HistoCode
12963 
12964   if( opt_plot == fSameOnePlot ){fPavTxtH1SamePlus = fPavComSeveralChanging;}
12965 
12966   if( opt_plot == fOnlyOnePlot ||  opt_plot == fSeveralPlot)
12967     {
12968       if(HistoCode == "D_NOE_ChNb"){fPavTxtD_NOE_ChNb = fPavComSeveralChanging;}
12969       if(HistoCode == "D_NOE_ChDs"){fPavTxtD_NOE_ChDs = fPavComSeveralChanging;}
12970       if(HistoCode == "D_Ped_ChNb"){fPavTxtD_Ped_ChNb = fPavComSeveralChanging;}
12971       if(HistoCode == "D_Ped_ChDs"){fPavTxtD_Ped_ChDs = fPavComSeveralChanging;}
12972       if(HistoCode == "D_TNo_ChNb"){fPavTxtD_TNo_ChNb = fPavComSeveralChanging;}
12973       if(HistoCode == "D_TNo_ChDs"){fPavTxtD_TNo_ChDs = fPavComSeveralChanging;}
12974       if(HistoCode == "D_MCs_ChNb"){fPavTxtD_MCs_ChNb = fPavComSeveralChanging;}
12975       if(HistoCode == "D_MCs_ChDs"){fPavTxtD_MCs_ChDs = fPavComSeveralChanging;}
12976       if(HistoCode == "D_LFN_ChNb"){fPavTxtD_LFN_ChNb = fPavComSeveralChanging;}
12977       if(HistoCode == "D_LFN_ChDs"){fPavTxtD_LFN_ChDs = fPavComSeveralChanging;}
12978       if(HistoCode == "D_HFN_ChNb"){fPavTxtD_HFN_ChNb = fPavComSeveralChanging;}
12979       if(HistoCode == "D_HFN_ChDs"){fPavTxtD_HFN_ChDs = fPavComSeveralChanging;}
12980       if(HistoCode == "D_SCs_ChNb"){fPavTxtD_SCs_ChNb = fPavComSeveralChanging;}
12981       if(HistoCode == "D_SCs_ChDs"){fPavTxtD_SCs_ChDs = fPavComSeveralChanging;}
12982       if(HistoCode == "D_MSp_SpNb"){fPavTxtD_MSp_SpNb = fPavComSeveralChanging;}
12983       if(HistoCode == "D_MSp_SpDs"){fPavTxtD_MSp_SpDs = fPavComSeveralChanging;}
12984       if(HistoCode == "D_SSp_SpNb"){fPavTxtD_SSp_SpNb = fPavComSeveralChanging;}
12985       if(HistoCode == "D_SSp_SpDs"){fPavTxtD_SSp_SpDs = fPavComSeveralChanging;}
12986       if(HistoCode == "D_Adc_EvNb"){fPavTxtD_Adc_EvNb = fPavComSeveralChanging;}
12987       if(HistoCode == "D_Adc_EvDs"){fPavTxtD_Adc_EvDs = fPavComSeveralChanging;}
12988       if(HistoCode == "H_Ped_Date"){fPavTxtH_Ped_Date = fPavComSeveralChanging;}
12989       if(HistoCode == "H_TNo_Date"){fPavTxtH_TNo_Date = fPavComSeveralChanging;}
12990       if(HistoCode == "H_MCs_Date"){fPavTxtH_MCs_Date = fPavComSeveralChanging;}
12991       if(HistoCode == "H_LFN_Date"){fPavTxtH_LFN_Date = fPavComSeveralChanging;}
12992       if(HistoCode == "H_HFN_Date"){fPavTxtH_HFN_Date = fPavComSeveralChanging;}
12993       if(HistoCode == "H_SCs_Date"){fPavTxtH_SCs_Date = fPavComSeveralChanging;}
12994       if(HistoCode == "H_Ped_RuDs"){fPavTxtH_Ped_RuDs = fPavComSeveralChanging;}
12995       if(HistoCode == "H_TNo_RuDs"){fPavTxtH_TNo_RuDs = fPavComSeveralChanging;}
12996       if(HistoCode == "H_MCs_RuDs"){fPavTxtH_MCs_RuDs = fPavComSeveralChanging;}
12997       if(HistoCode == "H_LFN_RuDs"){fPavTxtH_LFN_RuDs = fPavComSeveralChanging;}
12998       if(HistoCode == "H_HFN_RuDs"){fPavTxtH_HFN_RuDs = fPavComSeveralChanging;}
12999       if(HistoCode == "H_SCs_RuDs"){fPavTxtH_SCs_RuDs = fPavComSeveralChanging;}
13000     }
13001 }
13002 // end of SetParametersPavTxt
13003 
13004 
13005 TPaveText* TEcnaHistos::ActivePavTxt(const TString HistoCode, const TString opt_plot)
13006 {
13007   // Active Pad for Same plot option
13008 
13009   TPaveText* main_pavtxt = 0;
13010   
13011   if( opt_plot == fSameOnePlot )
13012     {
13013       //if( (TRootCanvas*)fCanvH1SamePlus->GetCanvasImp() == fImpH1SamePlus )
13014       {main_pavtxt = fPavTxtH1SamePlus;}
13015     }
13016   
13017   if( opt_plot == fOnlyOnePlot || opt_plot == fSeveralPlot)
13018     {
13019       if(HistoCode == "D_NOE_ChNb"){main_pavtxt = fPavTxtD_NOE_ChNb;}
13020       if(HistoCode == "D_NOE_ChDs"){main_pavtxt = fPavTxtD_NOE_ChDs;}
13021       if(HistoCode == "D_Ped_ChNb"){main_pavtxt = fPavTxtD_Ped_ChNb;}
13022       if(HistoCode == "D_Ped_ChDs"){main_pavtxt = fPavTxtD_Ped_ChDs;}
13023       if(HistoCode == "D_TNo_ChNb"){main_pavtxt = fPavTxtD_TNo_ChNb;}
13024       if(HistoCode == "D_TNo_ChDs"){main_pavtxt = fPavTxtD_TNo_ChDs;}
13025       if(HistoCode == "D_MCs_ChNb"){main_pavtxt = fPavTxtD_MCs_ChNb;}     
13026       if(HistoCode == "D_MCs_ChDs"){main_pavtxt = fPavTxtD_MCs_ChDs;}
13027       if(HistoCode == "D_LFN_ChNb"){main_pavtxt = fPavTxtD_LFN_ChNb;}
13028       if(HistoCode == "D_LFN_ChDs"){main_pavtxt = fPavTxtD_LFN_ChDs;}
13029       if(HistoCode == "D_HFN_ChNb"){main_pavtxt = fPavTxtD_HFN_ChNb;}
13030       if(HistoCode == "D_HFN_ChDs"){main_pavtxt = fPavTxtD_HFN_ChDs;}
13031       if(HistoCode == "D_SCs_ChNb"){main_pavtxt = fPavTxtD_SCs_ChNb;}
13032       if(HistoCode == "D_SCs_ChDs"){main_pavtxt = fPavTxtD_SCs_ChDs;}
13033       if(HistoCode == "D_MSp_SpNb"){main_pavtxt = fPavTxtD_MSp_SpNb;}
13034       if(HistoCode == "D_MSp_SpDs"){main_pavtxt = fPavTxtD_MSp_SpDs;}
13035       if(HistoCode == "D_SSp_SpNb"){main_pavtxt = fPavTxtD_SSp_SpNb;}
13036       if(HistoCode == "D_SSp_SpDs"){main_pavtxt = fPavTxtD_SSp_SpDs;}
13037       if(HistoCode == "D_Adc_EvNb"){main_pavtxt = fPavTxtD_Adc_EvNb;}
13038       if(HistoCode == "D_Adc_EvDs"){main_pavtxt = fPavTxtD_Adc_EvDs;}
13039       if(HistoCode == "H_Ped_Date"){main_pavtxt = fPavTxtH_Ped_Date;}
13040       if(HistoCode == "H_TNo_Date"){main_pavtxt = fPavTxtH_TNo_Date;}
13041       if(HistoCode == "H_MCs_Date"){main_pavtxt = fPavTxtH_MCs_Date;}
13042       if(HistoCode == "H_LFN_Date"){main_pavtxt = fPavTxtH_LFN_Date;}
13043       if(HistoCode == "H_HFN_Date"){main_pavtxt = fPavTxtH_HFN_Date;}
13044       if(HistoCode == "H_SCs_Date"){main_pavtxt = fPavTxtH_SCs_Date;}
13045       if(HistoCode == "H_Ped_RuDs"){main_pavtxt = fPavTxtH_Ped_RuDs;}
13046       if(HistoCode == "H_TNo_RuDs"){main_pavtxt = fPavTxtH_TNo_RuDs;}
13047       if(HistoCode == "H_MCs_RuDs"){main_pavtxt = fPavTxtH_MCs_RuDs;}
13048       if(HistoCode == "H_LFN_RuDs"){main_pavtxt = fPavTxtH_LFN_RuDs;}
13049       if(HistoCode == "H_HFN_RuDs"){main_pavtxt = fPavTxtH_HFN_RuDs;}
13050       if(HistoCode == "H_SCs_RuDs"){main_pavtxt = fPavTxtH_SCs_RuDs;}
13051     }
13052   
13053   if( main_pavtxt == 0 )
13054     {cout << "*TEcnaHistos::ActivePavTxt(...)> ERROR: main_pavtxt = " << main_pavtxt << endl;}
13055 
13056   return main_pavtxt;
13057 }
13058 // end of ActivePavTxt
13059 
13060 //void TEcnaHistos::SetViewHistoMarkerAndLine(TH1D* h_his0, const TString HistoCode, const TString opt_plot)
13061 //{
13063 //
13064 //  TString HistoType = fCnaParHistos->GetHistoType(HistoCode.Data());
13065 //
13066 //  //............................... Marker
13067 //  h_his0->SetMarkerStyle(1);        // default
13068 //  
13069 //  if( HistoType == "Global" && ( opt_plot == fSeveralPlot || opt_plot == fSameOnePlot ) )
13070 //    {h_his0->SetMarkerStyle(7); }
13071 //  
13072 //  //............................... Line
13073 //  h_his0->SetLineWidth(1);        // default
13074 //
13075 //  if( HistoType == "Global" && ( opt_plot == fSeveralPlot || opt_plot == fSameOnePlot ) )
13076 //    {h_his0->SetLineWidth(0);}
13077 //
13078 //}
13079 
13080 void TEcnaHistos::SetViewHistoColors(TH1D* h_his0,           const TString HistoCode,
13081                                      const TString opt_plot, const Int_t&  arg_AlreadyRead)
13082 {
13083 // Set colors, fill, marker, line style for histo view
13084 
13085   TString HistoType = fCnaParHistos->GetHistoType(HistoCode.Data());
13086   if( HistoType == "Global" ){h_his0->SetMarkerStyle(1);}
13087 
13088   Int_t MaxNbOfColors = fCnaParHistos->GetMaxNbOfColors();
13089 
13090   if( opt_plot == fSameOnePlot )
13091     {
13092       h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorH1SamePlus));
13093       h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorH1SamePlus));
13094       fMemoColorH1SamePlus++;
13095       if(fMemoColorH1SamePlus>MaxNbOfColors){fMemoColorH1SamePlus = 0;}
13096     }
13097 
13098   if( opt_plot == fOnlyOnePlot || opt_plot == fSeveralPlot)
13099     {
13100       if(HistoCode == "D_NOE_ChNb")
13101         {
13102           if(opt_plot == fOnlyOnePlot){h_his0->SetFillColor(fCnaParHistos->ColorDefinition("rose"));}
13103           if(opt_plot == fSeveralPlot )
13104             {h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorD_NOE_ChNb));
13105             h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorD_NOE_ChNb));
13106             fMemoColorD_NOE_ChNb++;
13107             if(fMemoColorD_NOE_ChNb>MaxNbOfColors){fMemoColorD_NOE_ChNb = 0;}}
13108         }
13109       if(HistoCode == "D_NOE_ChDs")
13110         {
13111           if(opt_plot == fOnlyOnePlot){h_his0->SetFillColor(fCnaParHistos->ColorDefinition("rose"));}
13112           if(opt_plot == fSeveralPlot )
13113             {h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorD_NOE_ChDs));
13114             h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorD_NOE_ChDs));
13115            fMemoColorD_NOE_ChDs++;
13116             if(fMemoColorD_NOE_ChDs>MaxNbOfColors){fMemoColorD_NOE_ChDs = 0;}}
13117         }
13118       if(HistoCode == "D_Ped_ChNb")
13119         {
13120           if(opt_plot == fOnlyOnePlot){h_his0->SetFillColor(fCnaParHistos->ColorDefinition("bleu38"));}
13121           if(opt_plot == fSeveralPlot )
13122             {h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorD_Ped_ChNb));
13123             h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorD_Ped_ChNb));
13124             fMemoColorD_Ped_ChNb++;
13125             if(fMemoColorD_Ped_ChNb>MaxNbOfColors){fMemoColorD_Ped_ChNb = 0;}}
13126         }
13127       if(HistoCode == "D_Ped_ChDs")
13128         {
13129           if(opt_plot == fOnlyOnePlot){h_his0->SetFillColor(fCnaParHistos->ColorDefinition("bleu38"));}
13130           if(opt_plot == fSeveralPlot )
13131             {h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorD_Ped_ChDs));
13132             h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorD_Ped_ChDs));
13133             fMemoColorD_Ped_ChDs++;
13134             if(fMemoColorD_Ped_ChDs>MaxNbOfColors){fMemoColorD_Ped_ChDs = 0;}}
13135         }
13136       if(HistoCode == "D_TNo_ChNb")
13137         {
13138           if(opt_plot == fOnlyOnePlot){h_his0->SetFillColor(fCnaParHistos->ColorDefinition("rouge48"));}
13139           if(opt_plot == fSeveralPlot )
13140             {h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorD_TNo_ChNb));
13141             h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorD_TNo_ChNb));
13142             fMemoColorD_TNo_ChNb++;
13143             if(fMemoColorD_TNo_ChNb>MaxNbOfColors){fMemoColorD_TNo_ChNb = 0;}}
13144         }
13145       if(HistoCode == "D_TNo_ChDs")
13146         {
13147           if(opt_plot == fOnlyOnePlot){h_his0->SetFillColor(fCnaParHistos->ColorDefinition("rouge48"));}
13148           if(opt_plot == fSeveralPlot )
13149             {h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorD_TNo_ChDs));
13150             h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorD_TNo_ChDs));
13151             fMemoColorD_TNo_ChDs++;
13152             if(fMemoColorD_TNo_ChDs>MaxNbOfColors){fMemoColorD_TNo_ChDs = 0;}}
13153         }
13154               
13155       if(HistoCode == "D_MCs_ChNb")
13156         {
13157           if(opt_plot == fOnlyOnePlot){h_his0->SetFillColor(fCnaParHistos->ColorDefinition("vert31"));}
13158           if(opt_plot == fSeveralPlot )
13159             {h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorD_MCs_ChNb));
13160             h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorD_MCs_ChNb));
13161             fMemoColorD_MCs_ChNb++;
13162             if(fMemoColorD_MCs_ChNb>MaxNbOfColors){fMemoColorD_MCs_ChNb = 0;}}
13163         }
13164       if(HistoCode == "D_MCs_ChDs")
13165         {
13166           if(opt_plot == fOnlyOnePlot){h_his0->SetFillColor(fCnaParHistos->ColorDefinition("vert31"));}
13167           if(opt_plot == fSeveralPlot )
13168             {h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorD_MCs_ChDs));
13169             h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorD_MCs_ChDs));
13170             fMemoColorD_MCs_ChDs++;
13171             if(fMemoColorD_MCs_ChDs>MaxNbOfColors){fMemoColorD_MCs_ChDs = 0;}}
13172         }
13173       if(HistoCode == "D_LFN_ChNb")
13174         {
13175           if(opt_plot == fOnlyOnePlot){h_his0->SetFillColor(fCnaParHistos->ColorDefinition("rouge44"));}
13176           if(opt_plot == fSeveralPlot )
13177             {h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorD_LFN_ChNb));
13178             h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorD_LFN_ChNb));
13179             fMemoColorD_LFN_ChNb++;
13180             if(fMemoColorD_LFN_ChNb>MaxNbOfColors){fMemoColorD_LFN_ChNb = 0;}}
13181         }
13182       if(HistoCode == "D_LFN_ChDs")
13183         {
13184           if(opt_plot == fOnlyOnePlot){h_his0->SetFillColor(fCnaParHistos->ColorDefinition("rouge44"));}
13185           if(opt_plot == fSeveralPlot )
13186             {h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorD_LFN_ChDs));
13187             h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorD_LFN_ChDs));
13188             fMemoColorD_LFN_ChDs++;
13189             if(fMemoColorD_LFN_ChDs>MaxNbOfColors){fMemoColorD_LFN_ChDs = 0;}}
13190         }
13191       if(HistoCode == "D_HFN_ChNb")
13192         {
13193           if(opt_plot == fOnlyOnePlot){h_his0->SetFillColor(fCnaParHistos->ColorDefinition("rouge50"));}
13194           if(opt_plot == fSeveralPlot )
13195             {h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorD_HFN_ChNb));
13196             h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorD_HFN_ChNb));
13197             fMemoColorD_HFN_ChNb++;
13198             if(fMemoColorD_HFN_ChNb>MaxNbOfColors){fMemoColorD_HFN_ChNb = 0;}}
13199         }
13200       if(HistoCode == "D_HFN_ChDs")
13201         {
13202           if(opt_plot == fOnlyOnePlot){h_his0->SetFillColor(fCnaParHistos->ColorDefinition("rouge50"));}
13203           if(opt_plot == fSeveralPlot )
13204             {h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorD_HFN_ChDs));
13205             h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorD_HFN_ChDs));
13206             fMemoColorD_HFN_ChDs++;
13207             if(fMemoColorD_HFN_ChDs>MaxNbOfColors){fMemoColorD_HFN_ChDs = 0;}}
13208         }
13209 
13210       if(HistoCode == "D_SCs_ChNb")
13211         {
13212           if(opt_plot == fOnlyOnePlot){h_his0->SetFillColor(fCnaParHistos->ColorDefinition("marron23"));}
13213           if(opt_plot == fSeveralPlot )
13214             {h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorD_SCs_ChNb));
13215             h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorD_SCs_ChNb));
13216             fMemoColorD_SCs_ChNb++;
13217             if(fMemoColorD_SCs_ChNb>MaxNbOfColors){fMemoColorD_SCs_ChNb = 0;}}
13218         }
13219       if(HistoCode == "D_SCs_ChDs")
13220         {
13221           if(opt_plot == fOnlyOnePlot){h_his0->SetFillColor(fCnaParHistos->ColorDefinition("marron23"));}
13222           if(opt_plot == fSeveralPlot )
13223             {h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorD_SCs_ChDs));
13224             h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorD_SCs_ChDs));
13225             fMemoColorD_SCs_ChDs++;
13226             if(fMemoColorD_SCs_ChDs>MaxNbOfColors){fMemoColorD_SCs_ChDs = 0;}}
13227         }
13228               
13229       if(HistoCode == "D_MSp_SpNb")
13230         {
13231           if( (opt_plot == fOnlyOnePlot && arg_AlreadyRead == 0) ||
13232               (opt_plot == fOnlyOnePlot && arg_AlreadyRead >= 1 && fPlotAllXtalsInStin == 0 ) )
13233             {h_his0->SetFillColor(fCnaParHistos->ColorDefinition("bleu38"));}
13234 
13235           if( opt_plot == fOnlyOnePlot && arg_AlreadyRead >= 0 && fPlotAllXtalsInStin == 1 )
13236             {h_his0->SetFillColor((Color_t)0);}
13237 
13238           if(opt_plot == fSeveralPlot )
13239             {h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorD_MSp_SpNb));
13240             h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorD_MSp_SpNb));
13241             fMemoColorD_MSp_SpNb++;
13242             if(fMemoColorD_MSp_SpNb>MaxNbOfColors){fMemoColorD_MSp_SpNb = 0;}}
13243         }
13244 
13245       if(HistoCode == "D_MSp_SpDs")
13246         {
13247           if( (opt_plot == fOnlyOnePlot && arg_AlreadyRead == 0) ||
13248               (opt_plot == fOnlyOnePlot && arg_AlreadyRead >= 1 && fPlotAllXtalsInStin == 0 ) )
13249             {h_his0->SetFillColor(fCnaParHistos->ColorDefinition("bleu38"));}
13250 
13251           if( opt_plot == fOnlyOnePlot && arg_AlreadyRead >= 0 && fPlotAllXtalsInStin == 1 )
13252             {h_his0->SetFillColor((Color_t)0);}
13253 
13254           if(opt_plot == fSeveralPlot )
13255             {h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorD_MSp_SpDs));
13256             h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorD_MSp_SpDs));
13257             fMemoColorD_MSp_SpDs++;
13258             if(fMemoColorD_MSp_SpDs>MaxNbOfColors){fMemoColorD_MSp_SpDs = 0;}}
13259         }
13260               
13261       if(HistoCode == "D_SSp_SpNb")
13262         {
13263           if( (opt_plot == fOnlyOnePlot && arg_AlreadyRead == 0) ||
13264               (opt_plot == fOnlyOnePlot && arg_AlreadyRead >= 1 && fPlotAllXtalsInStin == 0 ) )
13265             {h_his0->SetFillColor(fCnaParHistos->ColorDefinition("rouge50"));}
13266 
13267           if(opt_plot == fOnlyOnePlot && arg_AlreadyRead >= 0 && fPlotAllXtalsInStin == 1 )
13268             {h_his0->SetFillColor((Color_t)0);}
13269 
13270           if(opt_plot == fSeveralPlot )
13271             {h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorD_SSp_SpNb));
13272             h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorD_SSp_SpNb));
13273             fMemoColorD_SSp_SpNb++;
13274             if(fMemoColorD_SSp_SpNb>MaxNbOfColors){fMemoColorD_SSp_SpNb = 0;}}
13275         }
13276 
13277       if(HistoCode == "D_SSp_SpDs")
13278         {
13279           if( (opt_plot == fOnlyOnePlot && arg_AlreadyRead == 0) ||
13280               (opt_plot == fOnlyOnePlot && arg_AlreadyRead >= 1 && fPlotAllXtalsInStin == 0 ) )
13281             {h_his0->SetFillColor(fCnaParHistos->ColorDefinition("rouge50"));}
13282 
13283           if(opt_plot == fOnlyOnePlot && arg_AlreadyRead >= 0 && fPlotAllXtalsInStin == 1 )
13284             {h_his0->SetFillColor((Color_t)0);}
13285 
13286           if(opt_plot == fSeveralPlot )
13287             {h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorD_SSp_SpDs));
13288             h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorD_SSp_SpDs));
13289             fMemoColorD_SSp_SpDs++;
13290             if(fMemoColorD_SSp_SpDs>MaxNbOfColors){fMemoColorD_SSp_SpDs = 0;}}
13291         }
13292 
13293       if(HistoCode == "D_Adc_EvNb")
13294         {
13295           if(opt_plot == fOnlyOnePlot){h_his0->SetFillColor(fCnaParHistos->ColorDefinition("orange42"));}
13296           if(opt_plot == fSeveralPlot )
13297             {h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorD_Adc_EvNb));
13298             h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorD_Adc_EvNb));
13299             fMemoColorD_Adc_EvNb++;
13300             if(fMemoColorD_Adc_EvNb>MaxNbOfColors){fMemoColorD_Adc_EvNb = 0;}}
13301           gPad->SetGrid(1,0);
13302         }
13303 
13304       if(HistoCode == "D_Adc_EvDs")
13305         {
13306           if(opt_plot == fOnlyOnePlot){h_his0->SetFillColor(fCnaParHistos->ColorDefinition("orange42"));}
13307           if(opt_plot == fSeveralPlot )
13308             {h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorD_Adc_EvDs));
13309             h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorD_Adc_EvDs));
13310             fMemoColorD_Adc_EvDs++;
13311             if(fMemoColorD_Adc_EvDs>MaxNbOfColors){fMemoColorD_Adc_EvDs = 0;}}
13312         }
13313 
13314       if(HistoCode == "H_Ped_RuDs")
13315         {
13316           if(opt_plot == fOnlyOnePlot){h_his0->SetFillColor(fCnaParHistos->ColorDefinition("bleu38"));}
13317           if(opt_plot == fSeveralPlot )
13318             {h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorH_Ped_RuDs));
13319             h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorH_Ped_RuDs));
13320             fMemoColorH_Ped_RuDs++;
13321             if(fMemoColorH_Ped_RuDs>MaxNbOfColors){fMemoColorH_Ped_RuDs = 0;}}
13322           gPad->SetGrid(1,1);
13323         }
13324 
13325       if(HistoCode == "H_TNo_RuDs")
13326         {
13327           if(opt_plot == fOnlyOnePlot){h_his0->SetFillColor(fCnaParHistos->ColorDefinition("rouge48"));}
13328           if(opt_plot == fSeveralPlot )
13329             {h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorH_TNo_RuDs));
13330             h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorH_TNo_RuDs));
13331             fMemoColorH_TNo_RuDs++;
13332             if(fMemoColorH_TNo_RuDs>MaxNbOfColors){fMemoColorH_TNo_RuDs = 0;}}
13333           gPad->SetGrid(1,1);
13334         }
13335 
13336       if(HistoCode == "H_MCs_RuDs")
13337         {
13338           if(opt_plot == fOnlyOnePlot){h_his0->SetFillColor(fCnaParHistos->ColorDefinition("vert31"));}
13339           if(opt_plot == fSeveralPlot )
13340             {h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorH_MCs_RuDs));
13341             h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorH_MCs_RuDs));
13342             fMemoColorH_MCs_RuDs++;
13343             if(fMemoColorH_MCs_RuDs>MaxNbOfColors){fMemoColorH_MCs_RuDs = 0;}}
13344           gPad->SetGrid(1,1);
13345         }
13346 
13347       if(HistoCode == "H_LFN_RuDs")
13348         {
13349           if(opt_plot == fOnlyOnePlot){h_his0->SetFillColor(fCnaParHistos->ColorDefinition("rouge44"));}
13350           if(opt_plot == fSeveralPlot )
13351             {h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorH_LFN_RuDs));
13352             h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorH_LFN_RuDs));
13353             fMemoColorH_LFN_RuDs++;
13354             if(fMemoColorH_LFN_RuDs>MaxNbOfColors){fMemoColorH_LFN_RuDs = 0;}}
13355           gPad->SetGrid(1,1);
13356         }
13357 
13358       if(HistoCode == "H_HFN_RuDs")
13359         {
13360           if(opt_plot == fOnlyOnePlot){h_his0->SetFillColor(fCnaParHistos->ColorDefinition("rouge50"));}
13361           if(opt_plot == fSeveralPlot )
13362             {h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorH_HFN_RuDs));
13363             h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorH_HFN_RuDs));
13364             fMemoColorH_HFN_RuDs++;
13365             if(fMemoColorH_HFN_RuDs>MaxNbOfColors){fMemoColorH_HFN_RuDs = 0;}}
13366           gPad->SetGrid(1,1);
13367         }
13368 
13369       if(HistoCode == "H_SCs_RuDs")
13370         {
13371           if(opt_plot == fOnlyOnePlot){h_his0->SetFillColor(fCnaParHistos->ColorDefinition("marron23"));}
13372           if(opt_plot == fSeveralPlot )
13373             {h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorH_SCs_RuDs));
13374             h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorH_SCs_RuDs));
13375             fMemoColorH_SCs_RuDs++;
13376             if(fMemoColorH_SCs_RuDs>MaxNbOfColors){fMemoColorH_SCs_RuDs = 0;}}
13377           gPad->SetGrid(1,1);
13378         }
13379     }
13380 
13381   // if(opt_plot == fSeveralPlot || opt_plot == fSameOnePlot){h_his0->SetLineWidth(2);}
13382 }
13383 // end of SetViewHistoColors
13384 
13385 void TEcnaHistos::SetViewGraphColors(TGraph* g_graph0, const TString HistoCode, const TString opt_plot)
13386 {
13387 // Set colors for histo view
13388 
13389   Int_t MaxNbOfColors = fCnaParHistos->GetMaxNbOfColors();
13390 
13391   if( opt_plot == fSameOnePlot )
13392     {
13393       g_graph0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorH1SamePlus));
13394       g_graph0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorH1SamePlus));
13395       fMemoColorH1SamePlus++;
13396       if(fMemoColorH1SamePlus>MaxNbOfColors){fMemoColorH1SamePlus = 0;}
13397       gPad->SetGrid(1,1);
13398     }
13399 
13400   if( opt_plot == fOnlyOnePlot || opt_plot == fSeveralPlot)
13401     {
13402       if(HistoCode == "H_Ped_Date")
13403         {
13404           if(opt_plot == fOnlyOnePlot){g_graph0->SetMarkerColor(fCnaParHistos->ColorDefinition("bleu38"));}
13405           if(opt_plot == fSeveralPlot )
13406             {g_graph0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorH_Ped_Date));
13407             g_graph0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorH_Ped_Date));
13408             fMemoColorH_Ped_Date++;
13409             if(fMemoColorH_Ped_Date>MaxNbOfColors){fMemoColorH_Ped_Date = 0;}}
13410           gPad->SetGrid(1,1);
13411         }
13412       
13413       if(HistoCode == "H_TNo_Date")
13414         {
13415           if(opt_plot == fOnlyOnePlot){g_graph0->SetMarkerColor(fCnaParHistos->ColorDefinition("rouge48"));}
13416           if(opt_plot == fSeveralPlot)
13417             {g_graph0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorH_TNo_Date));
13418             g_graph0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorH_TNo_Date));
13419             fMemoColorH_TNo_Date++;
13420             if(fMemoColorH_TNo_Date>MaxNbOfColors){fMemoColorH_TNo_Date = 0;}}
13421           gPad->SetGrid(1,1);
13422         }
13423       
13424       if(HistoCode == "H_MCs_Date")
13425         {
13426           if(opt_plot == fOnlyOnePlot){g_graph0->SetMarkerColor(fCnaParHistos->ColorDefinition("vert31"));}
13427           if(opt_plot == fSeveralPlot)
13428             {g_graph0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorH_MCs_Date));
13429             g_graph0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorH_MCs_Date));
13430             fMemoColorH_MCs_Date++;
13431             if(fMemoColorH_MCs_Date>MaxNbOfColors){fMemoColorH_MCs_Date = 0;}}
13432           gPad->SetGrid(1,1);
13433         }
13434 
13435       if(HistoCode == "H_LFN_Date")
13436         {
13437           if(opt_plot == fOnlyOnePlot){g_graph0->SetMarkerColor(fCnaParHistos->ColorDefinition("bleu38"));}
13438           if(opt_plot == fSeveralPlot )
13439             {g_graph0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorH_LFN_Date));
13440             g_graph0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorH_LFN_Date));
13441             fMemoColorH_LFN_Date++;
13442             if(fMemoColorH_LFN_Date>MaxNbOfColors){fMemoColorH_LFN_Date = 0;}}
13443           gPad->SetGrid(1,1);
13444         }
13445       
13446       if(HistoCode == "H_HFN_Date")
13447         {
13448           if(opt_plot == fOnlyOnePlot){g_graph0->SetMarkerColor(fCnaParHistos->ColorDefinition("rouge48"));}
13449           if(opt_plot == fSeveralPlot)
13450             {g_graph0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorH_HFN_Date));
13451             g_graph0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorH_HFN_Date));
13452             fMemoColorH_HFN_Date++;
13453             if(fMemoColorH_HFN_Date>MaxNbOfColors){fMemoColorH_HFN_Date = 0;}}
13454           gPad->SetGrid(1,1);
13455         }
13456       
13457       if(HistoCode == "H_SCs_Date")
13458         {
13459           if(opt_plot == fOnlyOnePlot){g_graph0->SetMarkerColor(fCnaParHistos->ColorDefinition("vert31"));}
13460           if(opt_plot == fSeveralPlot)
13461             {g_graph0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorH_SCs_Date));
13462             g_graph0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorH_SCs_Date));
13463             fMemoColorH_SCs_Date++;
13464             if(fMemoColorH_SCs_Date>MaxNbOfColors){fMemoColorH_SCs_Date = 0;}}
13465           gPad->SetGrid(1,1);
13466         }
13467     }
13468   //if(opt_plot == fSeveralPlot){g_graph0->SetLineWidth(2);}
13469 }
13470 // end of SetViewGraphColors
13471 
13472 Color_t TEcnaHistos::GetViewHistoColor(const TString HistoCode, const TString opt_plot)
13473 {
13474   Color_t couleur = fCnaParHistos->ColorDefinition("noir");        // a priori = "noir"
13475 
13476   if( opt_plot == fSameOnePlot ){couleur = fCnaParHistos->ColorTab(fMemoColorH1SamePlus);}
13477 
13478   if( opt_plot == fOnlyOnePlot || opt_plot == fSeveralPlot )
13479     {
13480       if(HistoCode == "D_NOE_ChNb"){couleur = fCnaParHistos->ColorTab(fMemoColorD_NOE_ChNb);}
13481       if(HistoCode == "D_NOE_ChDs"){couleur = fCnaParHistos->ColorTab(fMemoColorD_NOE_ChDs);}
13482       if(HistoCode == "D_Ped_ChNb"){couleur = fCnaParHistos->ColorTab(fMemoColorD_Ped_ChNb);}
13483       if(HistoCode == "D_Ped_ChDs"){couleur = fCnaParHistos->ColorTab(fMemoColorD_Ped_ChDs);}
13484       if(HistoCode == "D_TNo_ChNb"){couleur = fCnaParHistos->ColorTab(fMemoColorD_TNo_ChNb);}
13485       if(HistoCode == "D_TNo_ChDs"){couleur = fCnaParHistos->ColorTab(fMemoColorD_TNo_ChDs);}
13486       if(HistoCode == "D_MCs_ChNb"){couleur = fCnaParHistos->ColorTab(fMemoColorD_MCs_ChNb);}
13487       if(HistoCode == "D_MCs_ChDs"){couleur = fCnaParHistos->ColorTab(fMemoColorD_MCs_ChDs);}
13488       if(HistoCode == "D_LFN_ChNb"){couleur = fCnaParHistos->ColorTab(fMemoColorD_LFN_ChNb);}
13489       if(HistoCode == "D_LFN_ChDs"){couleur = fCnaParHistos->ColorTab(fMemoColorD_LFN_ChDs);} 
13490       if(HistoCode == "D_HFN_ChNb"){couleur = fCnaParHistos->ColorTab(fMemoColorD_HFN_ChNb);} 
13491       if(HistoCode == "D_HFN_ChDs"){couleur = fCnaParHistos->ColorTab(fMemoColorD_HFN_ChDs);}
13492       if(HistoCode == "D_SCs_ChNb"){couleur = fCnaParHistos->ColorTab(fMemoColorD_SCs_ChNb);}
13493       if(HistoCode == "D_SCs_ChDs"){couleur = fCnaParHistos->ColorTab(fMemoColorD_SCs_ChDs);}
13494       if(HistoCode == "D_MSp_SpNb"){couleur = fCnaParHistos->ColorTab(fMemoColorD_MSp_SpNb);}
13495       if(HistoCode == "D_MSp_SpDs"){couleur = fCnaParHistos->ColorTab(fMemoColorD_MSp_SpDs);}
13496       if(HistoCode == "D_SSp_SpNb"){couleur = fCnaParHistos->ColorTab(fMemoColorD_SSp_SpNb);}
13497       if(HistoCode == "D_SSp_SpDs"){couleur = fCnaParHistos->ColorTab(fMemoColorD_SSp_SpDs);}
13498       if(HistoCode == "D_Adc_EvNb"){couleur = fCnaParHistos->ColorTab(fMemoColorD_Adc_EvNb);}
13499       if(HistoCode == "D_Adc_EvDs"){couleur = fCnaParHistos->ColorTab(fMemoColorD_Adc_EvDs);}
13500       if(HistoCode == "H_Ped_Date"){couleur = fCnaParHistos->ColorTab(fMemoColorH_Ped_Date);}
13501       if(HistoCode == "H_TNo_Date"){couleur = fCnaParHistos->ColorTab(fMemoColorH_TNo_Date);}
13502       if(HistoCode == "H_MCs_Date"){couleur = fCnaParHistos->ColorTab(fMemoColorH_MCs_Date);}
13503       if(HistoCode == "H_LFN_Date"){couleur = fCnaParHistos->ColorTab(fMemoColorH_LFN_Date);}
13504       if(HistoCode == "H_HFN_Date"){couleur = fCnaParHistos->ColorTab(fMemoColorH_HFN_Date);}
13505       if(HistoCode == "H_SCs_Date"){couleur = fCnaParHistos->ColorTab(fMemoColorH_SCs_Date);}
13506       if(HistoCode == "H_Ped_RuDs"){couleur = fCnaParHistos->ColorTab(fMemoColorH_Ped_RuDs);}
13507       if(HistoCode == "H_TNo_RuDs"){couleur = fCnaParHistos->ColorTab(fMemoColorH_TNo_RuDs);}
13508       if(HistoCode == "H_MCs_RuDs"){couleur = fCnaParHistos->ColorTab(fMemoColorH_MCs_RuDs);}
13509       if(HistoCode == "H_LFN_RuDs"){couleur = fCnaParHistos->ColorTab(fMemoColorH_LFN_RuDs);}
13510       if(HistoCode == "H_HFN_RuDs"){couleur = fCnaParHistos->ColorTab(fMemoColorH_HFN_RuDs);}
13511       if(HistoCode == "H_SCs_RuDs"){couleur = fCnaParHistos->ColorTab(fMemoColorH_SCs_RuDs);}
13512     }
13513   return couleur;
13514 }
13515 // end of GetViewHistoColor
13516 
13517 Color_t TEcnaHistos::GetSCColor(const TString DeeEndcap, const TString DeeDir, const TString QuadType)
13518 {
13519  //gives the SC color for the numbering plots
13520   TColor* my_color = new TColor();
13521   Color_t couleur = fCnaParHistos->ColorDefinition("noir");        // default = "noir"
13522 
13523   if( DeeEndcap == "EE+" )
13524     {
13525       if ( DeeDir == "right" && QuadType == "top"    ){couleur=fCnaParHistos->ColorDefinition("rouge");}
13526       if ( DeeDir == "right" && QuadType == "bottom" ){couleur=fCnaParHistos->ColorDefinition("bleu_fonce");}
13527       if ( DeeDir == "left"  && QuadType == "top"    ){couleur=(Color_t)my_color->GetColor("#006600");}
13528       if ( DeeDir == "left"  && QuadType == "bottom" ){couleur=(Color_t)my_color->GetColor("#CC3300");}
13529     }
13530   if( DeeEndcap == "EE-" )
13531     {
13532       if ( DeeDir == "right"  && QuadType == "top"    ){couleur=(Color_t)my_color->GetColor("#008800");}
13533       if ( DeeDir == "right"  && QuadType == "bottom" ){couleur=(Color_t)my_color->GetColor("#EE5500");}
13534       if ( DeeDir == "left"   && QuadType == "top"    ){couleur=fCnaParHistos->ColorDefinition("rouge");}
13535       if ( DeeDir == "left"   && QuadType == "bottom" ){couleur=fCnaParHistos->ColorDefinition("bleu_fonce");}
13536     }
13537 
13538   return couleur;
13539 }
13540 void TEcnaHistos::SetHistoPresentation(TH1D* histo, const TString HistoType)
13541 {
13542   // Set presentation (axis title offsets, title size, label size, etc... 
13543 
13544   fCnaParHistos->SetViewHistoStyle(HistoType.Data());
13545   fCnaParHistos->SetViewHistoPadMargins(HistoType.Data(), " ");
13546   fCnaParHistos->SetViewHistoOffsets(histo, HistoType.Data(), " ");
13547   fCnaParHistos->SetViewHistoStats(histo, HistoType.Data());
13548 }
13549 void TEcnaHistos::SetHistoPresentation(TH1D* histo, const TString HistoType, const TString opt_plot)
13550 {
13551 // Set presentation (axis title offsets, title size, label size, etc... 
13552 
13553   fCnaParHistos->SetViewHistoStyle(HistoType.Data());
13554   fCnaParHistos->SetViewHistoPadMargins(HistoType.Data(), opt_plot.Data());
13555   fCnaParHistos->SetViewHistoOffsets(histo, HistoType.Data(), opt_plot.Data());
13556   fCnaParHistos->SetViewHistoStats(histo, HistoType.Data());
13557 }
13558 
13559 void TEcnaHistos::SetGraphPresentation(TGraph* graph, const TString HistoType, const TString opt_plot)
13560 {
13561 // Set presentation (axis title offsets, title size, label size, etc... 
13562 
13563   fCnaParHistos->SetViewHistoStyle(HistoType.Data());
13564   fCnaParHistos->SetViewHistoPadMargins(HistoType.Data(), opt_plot);
13565   fCnaParHistos->SetViewGraphOffsets(graph, HistoType.Data());
13566   
13567   //............................... Graph marker
13568   graph->SetMarkerStyle(1);
13569   if( HistoType == "Evol" ){graph->SetMarkerStyle(20);}
13570 }
13571 
13572 //=====================================================================
13573 //
13574 //                 NewCanvas, ReInitCanvas
13575 //
13576 //=====================================================================
13577 void TEcnaHistos::NewCanvas(const TString opt_plot)   
13578 {
13579 // ReInit canvas in option SAME n in order to restart a new SAME n plot
13580 // (called by user only for option Same n)
13581 
13582   if( opt_plot == fSameOnePlot )
13583     {
13584       fImpH1SamePlus = 0;       fCanvH1SamePlus = 0;
13585       fPadH1SamePlus = 0;       fMemoPlotH1SamePlus = 0;
13586       fMemoColorH1SamePlus = 0; fCanvSameH1SamePlus++;
13587       fPavTxtH1SamePlus = 0;
13588     }
13589   else
13590     {
13591       cout << "TEcnaHistos::NewCanvas(...)> *** ERROR *** " << opt_plot.Data() << ": "
13592            << "unknown option for NewCanvas. Only " << fSameOnePlot << " option is accepted."
13593            << fTTBELL << endl;
13594     }
13595 }
13596 
13597 void TEcnaHistos::ReInitCanvas(const TString HistoCode, const TString opt_plot)
13598 {
13599 // ReInit canvas in option SAME and SAME n
13600 
13601   if( opt_plot == fSameOnePlot )
13602     {
13603       fImpH1SamePlus = 0;       fCanvH1SamePlus = 0;
13604       fPadH1SamePlus = 0;       fMemoPlotH1SamePlus = 0;
13605       fMemoColorH1SamePlus = 0; fCanvSameH1SamePlus++;
13606       fPavTxtH1SamePlus = 0;
13607     }
13608 
13609   if( opt_plot == fOnlyOnePlot ||  opt_plot == fSeveralPlot)
13610     {
13611       if(HistoCode == "D_NOE_ChNb")
13612         {             
13613           fImpD_NOE_ChNb = 0;       fCanvD_NOE_ChNb = 0;
13614           fPadD_NOE_ChNb = 0;       fMemoPlotD_NOE_ChNb = 0;
13615           fMemoColorD_NOE_ChNb = 0; fCanvSameD_NOE_ChNb++;
13616           fPavTxtD_NOE_ChNb = 0; 
13617         }
13618       
13619       if(HistoCode == "D_NOE_ChDs")
13620         {             
13621           fImpD_NOE_ChDs = 0;       fCanvD_NOE_ChDs = 0;
13622           fPadD_NOE_ChDs = 0;       fMemoPlotD_NOE_ChDs = 0;
13623           fMemoColorD_NOE_ChDs = 0; fCanvSameD_NOE_ChDs++;
13624           fPavTxtD_NOE_ChDs = 0;
13625         }
13626       
13627       if(HistoCode == "D_Ped_ChNb")                            // (ReInitCanvas)
13628         {             
13629           fImpD_Ped_ChNb = 0;       fCanvD_Ped_ChNb = 0;
13630           fPadD_Ped_ChNb = 0;       fMemoPlotD_Ped_ChNb = 0;
13631           fMemoColorD_Ped_ChNb = 0; fCanvSameD_Ped_ChNb++;
13632           fPavTxtD_Ped_ChNb = 0;   
13633         }
13634       
13635       if(HistoCode == "D_Ped_ChDs")
13636         {             
13637           fImpD_Ped_ChDs = 0;       fCanvD_Ped_ChDs = 0;
13638           fPadD_Ped_ChDs = 0;       fMemoPlotD_Ped_ChDs = 0;
13639           fMemoColorD_Ped_ChDs = 0; fCanvSameD_Ped_ChDs++;
13640           fPavTxtD_Ped_ChDs = 0; 
13641         }
13642       
13643       if(HistoCode == "D_TNo_ChNb")
13644         {             
13645           fImpD_TNo_ChNb = 0;       fCanvD_TNo_ChNb = 0;
13646           fPadD_TNo_ChNb = 0;       fMemoPlotD_TNo_ChNb = 0;
13647           fMemoColorD_TNo_ChNb = 0; fCanvSameD_TNo_ChNb++;
13648           fPavTxtD_TNo_ChNb = 0; 
13649         }
13650       
13651       if(HistoCode == "D_TNo_ChDs") 
13652         {             
13653           fImpD_TNo_ChDs = 0;       fCanvD_TNo_ChDs = 0;
13654           fPadD_TNo_ChDs = 0;       fMemoPlotD_TNo_ChDs = 0;
13655           fMemoColorD_TNo_ChDs = 0; fCanvSameD_TNo_ChDs++;
13656           fPavTxtD_TNo_ChDs = 0;
13657         }
13658       
13659       if(HistoCode == "D_MCs_ChNb")                           // (ReInitCanvas)
13660         {             
13661           fImpD_MCs_ChNb = 0;       fCanvD_MCs_ChNb = 0;
13662           fPadD_MCs_ChNb = 0;       fMemoPlotD_MCs_ChNb = 0;
13663           fMemoColorD_MCs_ChNb = 0; fCanvSameD_MCs_ChNb++;
13664           fPavTxtD_MCs_ChNb = 0;
13665         }
13666       
13667       if(HistoCode == "D_MCs_ChDs")
13668         {             
13669           fImpD_MCs_ChDs = 0;       fCanvD_MCs_ChDs = 0;
13670           fPadD_MCs_ChDs = 0;       fMemoPlotD_MCs_ChDs = 0;
13671           fMemoColorD_MCs_ChDs = 0; fCanvSameD_MCs_ChDs++;
13672           fPavTxtD_MCs_ChDs = 0;
13673         }
13674       
13675       if(HistoCode == "D_LFN_ChNb")
13676         {             
13677           fImpD_LFN_ChNb = 0;       fCanvD_LFN_ChNb = 0;
13678           fPadD_LFN_ChNb = 0;       fMemoPlotD_LFN_ChNb = 0;
13679           fMemoColorD_LFN_ChNb = 0; fCanvSameD_LFN_ChNb++;
13680           fPavTxtD_LFN_ChNb = 0;
13681         }
13682       
13683       if(HistoCode == "D_LFN_ChDs")                            // (ReInitCanvas)
13684         {             
13685           fImpD_LFN_ChDs = 0;       fCanvD_LFN_ChDs = 0;
13686           fPadD_LFN_ChDs= 0;        fMemoPlotD_LFN_ChDs = 0;
13687           fMemoColorD_LFN_ChDs = 0; fCanvSameD_LFN_ChDs++;
13688           fPavTxtD_LFN_ChDs= 0;
13689         }
13690       
13691       if(HistoCode == "D_HFN_ChNb")
13692         {             
13693           fImpD_HFN_ChNb = 0;       fCanvD_HFN_ChNb = 0;
13694           fPadD_HFN_ChNb = 0;       fMemoPlotD_HFN_ChNb = 0;
13695           fMemoColorD_HFN_ChNb = 0; fCanvSameD_HFN_ChNb++;
13696           fPavTxtD_HFN_ChNb = 0;
13697         }
13698       
13699       if(HistoCode == "D_HFN_ChDs")
13700         {             
13701           fImpD_HFN_ChDs = 0;       fCanvD_HFN_ChDs = 0;
13702           fPadD_HFN_ChDs = 0;       fMemoPlotD_HFN_ChDs = 0;
13703           fMemoColorD_HFN_ChDs = 0; fCanvSameD_HFN_ChDs++;
13704           fPavTxtD_HFN_ChDs = 0;
13705         }
13706       
13707       if(HistoCode == "D_SCs_ChNb")
13708         {             
13709           fImpD_SCs_ChNb = 0;       fCanvD_SCs_ChNb = 0;
13710           fPadD_SCs_ChNb = 0;       fMemoPlotD_SCs_ChNb = 0;
13711           fMemoColorD_SCs_ChNb = 0; fCanvSameD_SCs_ChNb++;
13712           fPavTxtD_SCs_ChNb = 0;
13713         }
13714       
13715       if(HistoCode == "D_SCs_ChDs")                            // (ReInitCanvas)
13716         {             
13717           fImpD_SCs_ChDs = 0;       fCanvD_SCs_ChDs = 0;
13718           fPadD_SCs_ChDs = 0;       fMemoPlotD_SCs_ChDs = 0;
13719           fMemoColorD_SCs_ChDs = 0; fCanvSameD_SCs_ChDs++;
13720           fPavTxtD_SCs_ChDs = 0;
13721         }
13722       
13723       if(HistoCode == "D_MSp_SpNb")
13724         {             
13725           fImpD_MSp_SpNb = 0;       fCanvD_MSp_SpNb = 0;
13726           fPadD_MSp_SpNb = 0;       fMemoPlotD_MSp_SpNb = 0; 
13727           fMemoColorD_MSp_SpNb = 0; fCanvSameD_MSp_SpNb++;
13728           fPavTxtD_MSp_SpNb = 0;
13729         }
13730             
13731       if(HistoCode == "D_MSp_SpDs")
13732         {             
13733           fImpD_MSp_SpDs = 0;       fCanvD_MSp_SpDs = 0;
13734           fPadD_MSp_SpDs = 0;       fMemoPlotD_MSp_SpDs = 0; 
13735           fMemoColorD_MSp_SpDs = 0; fCanvSameD_MSp_SpDs++;
13736           fPavTxtD_MSp_SpDs = 0;
13737         }
13738       
13739       if(HistoCode == "D_SSp_SpNb")
13740         {             
13741           fImpD_SSp_SpNb = 0;       fCanvD_SSp_SpNb = 0;
13742           fPadD_SSp_SpNb = 0;       fMemoPlotD_SSp_SpNb= 0;
13743           fMemoColorD_SSp_SpNb = 0; fCanvSameD_SSp_SpNb++;
13744           fPavTxtD_SSp_SpNb = 0;
13745         }
13746 
13747       if(HistoCode == "D_SSp_SpDs")
13748         {             
13749           fImpD_SSp_SpDs = 0;       fCanvD_SSp_SpDs = 0;
13750           fPadD_SSp_SpDs = 0;       fMemoPlotD_SSp_SpDs= 0;
13751           fMemoColorD_SSp_SpDs = 0; fCanvSameD_SSp_SpDs++;
13752           fPavTxtD_SSp_SpDs = 0;
13753         }
13754 
13755       if(HistoCode == "D_Adc_EvNb")                            // (ReInitCanvas)
13756         {             
13757           fImpD_Adc_EvNb = 0;       fCanvD_Adc_EvNb = 0;
13758           fPadD_Adc_EvNb = 0;       fMemoPlotD_Adc_EvNb = 0;
13759           fMemoColorD_Adc_EvNb = 0; fCanvSameD_Adc_EvNb++;
13760           fPavTxtD_Adc_EvNb = 0;
13761         }
13762        
13763       if(HistoCode == "D_Adc_EvDs")
13764         {             
13765           fImpD_Adc_EvDs = 0;       fCanvD_Adc_EvDs = 0;
13766           fPadD_Adc_EvDs = 0;       fMemoPlotD_Adc_EvDs = 0;
13767           fMemoColorD_Adc_EvDs = 0; fCanvSameD_Adc_EvDs++;
13768           fPavTxtD_Adc_EvDs = 0;
13769         }
13770            
13771       if(HistoCode == "H_Ped_Date")
13772         {             
13773           fImpH_Ped_Date = 0;       fCanvH_Ped_Date = 0;
13774           fPadH_Ped_Date = 0;       fMemoPlotH_Ped_Date = 0;
13775           fMemoColorH_Ped_Date = 0; fCanvSameH_Ped_Date++;
13776           fNbOfListFileH_Ped_Date = 0;
13777         }
13778 
13779       if(HistoCode == "H_TNo_Date")
13780         {             
13781           fImpH_TNo_Date = 0;       fCanvH_TNo_Date = 0;
13782           fPadH_TNo_Date = 0;       fMemoPlotH_TNo_Date = 0;
13783           fMemoColorH_TNo_Date = 0; fCanvSameH_TNo_Date++;
13784           fNbOfListFileH_TNo_Date = 0;
13785         }
13786 
13787       if(HistoCode == "H_MCs_Date")                            // (ReInitCanvas)
13788         {             
13789           fImpH_MCs_Date = 0;       fCanvH_MCs_Date = 0;
13790           fPadH_MCs_Date = 0;       fMemoPlotH_MCs_Date = 0;
13791           fMemoColorH_MCs_Date = 0; fCanvSameH_MCs_Date++;
13792           fNbOfListFileH_MCs_Date = 0;
13793         }
13794 
13795       
13796       if(HistoCode == "H_LFN_Date")
13797         {             
13798           fImpH_LFN_Date = 0;       fCanvH_LFN_Date = 0;
13799           fPadH_LFN_Date = 0;       fMemoPlotH_LFN_Date = 0;
13800           fMemoColorH_LFN_Date = 0; fCanvSameH_LFN_Date++;
13801           fNbOfListFileH_LFN_Date = 0;
13802         }
13803 
13804       if(HistoCode == "H_HFN_Date")
13805         {             
13806           fImpH_HFN_Date = 0;       fCanvH_HFN_Date = 0;
13807           fPadH_HFN_Date = 0;       fMemoPlotH_HFN_Date = 0;
13808           fMemoColorH_HFN_Date = 0; fCanvSameH_HFN_Date++;
13809           fNbOfListFileH_HFN_Date = 0;
13810         }
13811 
13812       if(HistoCode == "H_SCs_Date")
13813         {             
13814           fImpH_SCs_Date = 0;       fCanvH_SCs_Date = 0;
13815           fPadH_SCs_Date = 0;       fMemoPlotH_SCs_Date = 0;
13816           fMemoColorH_SCs_Date = 0; fCanvSameH_SCs_Date++;
13817           fNbOfListFileH_SCs_Date = 0;
13818         }
13819 
13820       if(HistoCode == "H_Ped_RuDs")
13821         {             
13822           fImpH_Ped_RuDs = 0;       fCanvH_Ped_RuDs = 0;
13823           fPadH_Ped_RuDs = 0;       fMemoPlotH_Ped_RuDs = 0;
13824           fMemoColorH_Ped_RuDs = 0; fCanvSameH_Ped_RuDs++;
13825           fNbOfListFileH_Ped_RuDs = 0;
13826         }
13827 
13828       if(HistoCode == "H_TNo_RuDs")
13829         {             
13830           fImpH_TNo_RuDs = 0;       fCanvH_TNo_RuDs = 0;
13831           fPadH_TNo_RuDs = 0;       fMemoPlotH_TNo_RuDs = 0;
13832           fMemoColorH_TNo_RuDs = 0; fCanvSameH_TNo_RuDs++;
13833           fNbOfListFileH_TNo_RuDs = 0;
13834         }
13835 
13836       if(HistoCode == "H_MCs_RuDs")                            // (ReInitCanvas)
13837         {             
13838           fImpH_MCs_RuDs = 0;       fCanvH_MCs_RuDs = 0;
13839           fPadH_MCs_RuDs = 0;       fMemoPlotH_MCs_RuDs = 0;
13840           fMemoColorH_MCs_RuDs = 0; fCanvSameH_MCs_RuDs++;
13841           fNbOfListFileH_MCs_RuDs = 0;
13842         }
13843 
13844       
13845       if(HistoCode == "H_LFN_RuDs")
13846         {             
13847           fImpH_LFN_RuDs = 0;       fCanvH_LFN_RuDs = 0;
13848           fPadH_LFN_RuDs = 0;       fMemoPlotH_LFN_RuDs = 0;
13849           fMemoColorH_LFN_RuDs = 0; fCanvSameH_LFN_RuDs++;
13850           fNbOfListFileH_LFN_RuDs = 0;
13851         }
13852 
13853       if(HistoCode == "H_HFN_RuDs")
13854         {             
13855           fImpH_HFN_RuDs = 0;       fCanvH_HFN_RuDs = 0;
13856           fPadH_HFN_RuDs = 0;       fMemoPlotH_HFN_RuDs = 0;
13857           fMemoColorH_HFN_RuDs = 0; fCanvSameH_HFN_RuDs++;
13858           fNbOfListFileH_HFN_RuDs = 0;
13859         }
13860 
13861       if(HistoCode == "H_SCs_RuDs")
13862         {             
13863           fImpH_SCs_RuDs = 0;       fCanvH_SCs_RuDs = 0;
13864           fPadH_SCs_RuDs = 0;       fMemoPlotH_SCs_RuDs = 0;
13865           fMemoColorH_SCs_RuDs = 0; fCanvSameH_SCs_RuDs++;
13866           fNbOfListFileH_SCs_RuDs = 0;
13867         }
13868     }
13869 } 
13870 // ------- end of ReInitCanvas(...) ------------
13871 
13872 //==========================================================================================
13873 void TEcnaHistos::WriteMatrixAscii(const TString BetweenWhat,  const TString   CorOrCov,
13874                                    const Int_t&  StexStinEcna, const Int_t&    MatrixBinIndex,
13875                                    const Int_t&  MatSize,      const TMatrixD& read_matrix)
13876 {   
13877 // write matrix in ascii file
13878 
13879   Int_t ChanNumber = MatrixBinIndex;
13880 
13881   fCnaWrite->RegisterFileParameters(fFapAnaType,    fFapNbOfSamples, 
13882                                     fFapRunNumber,  fFapFirstReqEvtNumber, fFapLastReqEvtNumber, fFapReqNbOfEvts,
13883                                     fFapStexNumber, fStartDate, fStopDate, fStartTime, fStopTime);
13884 
13885   if( BetweenWhat == fBetweenSamples && CorOrCov == fCorrelationMatrix )
13886     {
13887       fCnaWrite->WriteAsciiCorrelationsBetweenSamples(StexStinEcna, ChanNumber, MatSize, read_matrix);
13888       fAsciiFileName = fCnaWrite->GetAsciiFileName();
13889     }
13890 
13891   if( BetweenWhat == fBetweenSamples && CorOrCov == fCovarianceMatrix )
13892     {
13893       fCnaWrite->WriteAsciiCovariancesBetweenSamples(StexStinEcna, ChanNumber, MatSize, read_matrix);
13894       fAsciiFileName = fCnaWrite->GetAsciiFileName();
13895     }
13896 }
13897 //...............................................................................................
13898 void TEcnaHistos::WriteHistoAscii(const TString   HistoCode, const Int_t& HisSize,
13899                                  const TVectorD& read_histo)
13900 {
13901 // write matrix in ascii file
13902 
13903   fCnaWrite->RegisterFileParameters(fFapAnaType,    fFapNbOfSamples, 
13904                                     fFapRunNumber,  fFapFirstReqEvtNumber, fFapLastReqEvtNumber, fFapReqNbOfEvts,
13905                                     fFapStexNumber, fStartDate, fStopDate,
13906                                     fStartTime,     fStopTime);
13907 
13908   fCnaWrite->WriteAsciiHisto(HistoCode, HisSize, read_histo);
13909   fAsciiFileName = fCnaWrite->GetAsciiFileName();
13910 }
13911 
13912 TString TEcnaHistos::AsciiFileName(){return fAsciiFileName.Data();}
13913 
13914 //---------------> messages de rappel pour l'auteur: 
13915 //
13916 //======= 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 ==============!!!!
13917 //      A EVITER ABSOLUMENT quand on est sous TEcnaGui CAR LE cin >> BLOQUE X11
13918 //      puisqu'on n'a pas la main dans la fenetre de compte-rendu de la CNA
13919 //     {Int_t cintoto; cout << "taper 0 pour continuer" << endl; cin >> cintoto;}
13920 //                         *=================================================*
13921 //                         |                                                 |
13922 //++++++++++++++++++++++++|  A T T E N T I O N:  PAS DE TEST "cintoto" ici! |+++++++++++++++++++++!!!!
13923 //                         |                                                 |
13924 //                         *=================================================*
13925 //
13926 // INFO: When "new" fails to allocate the memory for an object, or "new[]" fails to allocate the memory
13927 // for an object array, a std::bad_alloc object is thrown.
13928 // "In GCC, the RTTI mangled name of std::bad_alloc is, I'm guessing, St9bad_alloc."