CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/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: 08/04/2010
00004 
00005 #include "CalibCalorimetry/EcalCorrelatedNoiseAnalysisAlgos/interface/TEcnaHistos.h"
00006 
00007 ClassImp(TEcnaHistos)
00008 //______________________________________________________________________________
00009 //
00010 // TEcnaHistos.
00011 //
00012 //==============> INTRODUCTION
00013 //
00014 //    This class provides methods for displaying plots of various types:
00015 //    1D, 2D and 3D histograms for different quantities (pedestals, noises,
00016 //    correlations, .etc..). The data are read from files which has been
00017 //    previously written by using the class TEcnaRun (.root result files).
00018 //    The reading is performed by appropriate methods of the class TEcnaRead.
00019 //
00020 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00021 //
00022 //      Class TEcnaHistos       ***   I N S T R U C T I O N S   F O R   U S E   ***
00023 //
00024 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00025 //
00026 //   // (A) --> Object declarations:
00027 //
00028 //      TEcnaHistos* MyHistosEB = new TEcnaHistos("EB");
00029 //      TEcnaHistos* MyHistosEE = new TEcnaHistos("EE");
00030 //      
00031 //   // (B) --> Specification of the file which has to be read.
00032 //   //         This file is a .root result file which has previously been written by means of
00033 //   //         the class TEcnaRun (see documentation of this class)
00034 //
00035 //   //  1) specify the parameter values of the file name:
00036 //
00037 //      TString AnalysisName      = "StdPed12"; (AnalysisName -> explanation in TEcnaRun documentation)
00038 //      Int_t   NbOfSamples       = 10;
00039 //      Int_t   RunNumber         = 112206;
00040 //      Int_t   FirstReqEvtNumber = 1;
00041 //      Int_t   LastReqEvtNumber  = 150;
00042 //      Int_t   ReqNbOfEvts       = 150;
00043 //      Int_t   SM or Dee Number  = 2;
00044 //
00045 //   //  2) call method "FileParameters" to say that the file to be read is the file
00046 //   //     which name parameters are those specified above:
00047 // 
00048 //      MyHistosEB->FileParameters(AnalysisName, NbOfSamples, RunNumber,
00049 //                                 FirstReqEvtNumber, LastReqEvtNumber, ReqNbOfEvts, SMNumber); 
00050 //
00051 //   //  Now, the class TEcnaHistos knowns that it has to work
00052 //   //  with the file StdPed12_S1_10_R16467_0_150_SM6.root
00053 //
00054 //   // (C) -->  E X A M P L E S   O F   U S E 
00055 // 
00056 //   //--> Plot correlation matrices between samples
00057 //   //    for channel 21 (electronic channel number in Tower)
00058 //   //    and for the two towers 10 and 33
00059 //
00060 //      Int_t TowEcha = 21;     // (Electronic channel number in tower)
00061 //      MyHistosEB->CorrelationsBetweenSamples(SMTower_X, TowEcha, "SURF1Z");
00062 //      MyHistosEB->CorrelationsBetweenSamples(SMTower_Y, TowEcha, "SURF1Z");
00063 //
00064 //    //--> Plot Pedestals as a function of SC number for Dee 4 
00065 //
00066 //      TString AnalysisName      = "StdPed12";
00067 //      Int_t   NbOfSamples       = 10;
00068 //      Int_t   RunNumber         = 112592;
00069 //      Int_t   FirstReqEvtNumber = 1;
00070 //      Int_t   LastReqEvtNumber  = 150;
00071 //      Int_t   ReqNbOfEvts       = 150;
00072 //
00073 //      Int_t   DeeNumber = 4;
00074 //      MyHistosEE->FileParameters(AnalysisName, NbOfSamples, RunNumber,
00075 //                                 FirstReqEvtNumber, LastReqEvtNumber, ReqNbOfEvts, DeeNumber); 
00076 //      MyHistosEE->DeeXtalsPedestals();
00077 //
00078 //    //--> Plot total noise history for channel 12 of tower 38
00079 //    //    (electronic channel number in tower)
00080 //
00081 //      MyHistosEB->FileParameters(AnalysisName, NbOfSamples, RunNumber,
00082 //                                 FirstReqEvtNumber, LastReqEvtNumber, ReqNbOfEvts, SMNumber);
00083 //      Int_t SMTower = 38;
00084 //      Int_t TowEcha = 12;
00085 //      TString list_of_run_file_name = "HistoryRunList_SM6.ascii";
00086 //      MyHistoEB->XtalTimeTotalNoise(list_of_run_file_name, SMTower, TowEcha, "SAME");
00087 //      
00088 //    // the .ascii file "HistoryRunList_SM6.ascii" must contain a list of
00089 //    // the run numbers according to the following syntax:
00090 //
00091 //   //.......... SYNTAX OF THE FILE "HistoryRunList_SM6.ascii" ("runlist history plot" file):
00092 //
00093 //   HistoryRunList_SM6.ascii  <- 1rst line: comment (name of the file, for example)
00094 //
00095 //   73677                <- other lines: run numbers
00096 //   73688
00097 //                        <- (empty lines can be used)
00098 //   73689
00099 //   73690
00100 //   73692
00101 //
00102 //
00103 //      etc...
00104 //
00105 //
00106 //------------------------------------------- LIST OF METHODS ------------------------------------------
00107 //
00108 //######################################################################################################
00109 //
00110 //             Examples for use are in file TEcnaHistosTest.cc (in directory test)
00111 //                                          =================
00112 //
00113 //######################################################################################################
00114 
00115 //  //==================================================================================================
00116 //  //   method to set the result file name parameters (from values in argument)
00117 //  //   FileParameters(AnaType, NbOfSamples, Run#,
00118 //  //                  FirstRequestedEvt#, LastRequestedEvt#, ReqNbOfEvts#, SM# or Dee#)
00119 //  //   RunNumber = 0 => history plots, SM or Dee number = 0 => Plots for EB or EE
00120 //  //==================================================================================================
00121 //
00122 //  void FileParameters(const TString Analysis,         
00123 //                      const Int_t&  NbOfSamples,
00124 //                      const Int_t&  Run#,               // RunNumber = 0 => history plots
00125 //                      const Int_t&  FirstRequestedEvt#,
00126 //                      const Int_t&  LastRequestedEvt#,
00127 //                      const Int_t&  ReqNbOfEvts#,
00128 //                      const Int_t&  SMOrDee#);          // SM or Dee number = 0 => Plots for EB or EE
00129 //
00130 //        -----------------------------------------------------------------------------------
00131 //        In the following:
00132 //
00133 //        TowOrSC# = Tower number in case of EB  or  SC number FOR CONSTRUCTION in case of EE
00134 //
00135 //        -----------------------------------------------------------------------------------
00136 //
00137 //  //==================================================================================================
00138 //  //                  methods for displaying the correlations and covariances matrices
00139 //  //                  DrawOption = ROOT DrawOption ("SAME", "LEGO", "COLZ", etc...)
00140 //  //                               + option "ASCII": write histo in ASCII file 
00141 //  //==================================================================================================
00142 //  void LowFrequencyMeanCorrelationsBetweenTowers (const TString DrawOption); // SubDet: specific EB
00143 //  void LowFrequencyMeanCorrelationsBetweenSCs    (const TString DrawOption); // SubDet: specific EE
00144 //  void HighFrequencyMeanCorrelationsBetweenTowers(const TString DrawOption); // SubDet: specific EB
00145 //  void HighFrequencyMeanCorrelationsBetweenSCs   (const TString DrawOption); // SubDet: specific EE
00146 //
00147 //  void LowFrequencyCorrelationsBetweenChannels
00148 //       (const Int_t& TowOrSC#, const Int_t& Tow'OrSC'#, const TString DrawOption); // SubDet: EB or EE
00149 //  void LowFrequencyCovariancesBetweenChannels
00150 //       (const Int_t& TowOrSC#, const Int_t& Tow'OrSC'#, const TString DrawOption); // SubDet: EB or EE
00151 //  void HighFrequencyCorrelationsBetweenChannels
00152 //       (const Int_t& TowOrSC#, const Int_t& Tow'OrSC'#, const TString DrawOption); // SubDet: EB or EE
00153 //  void HighFrequencyCovariancesBetweenChannels
00154 //       (const Int_t& TowOrSC#, const Int_t& Tow'OrSC'#, const TString DrawOption); // SubDet: EB or EE
00155 //
00156 //  void CorrelationsBetweenSamples
00157 //       (const Int_t& TowOrSC#, const Int_t& Channel#inTowOrSC, const TString DrawOption); // SubDet: EB or EE
00158 //  void CovariancesBetweenSamples 
00159 //       (const Int_t& TowOrSC#, const Int_t& Channel#inTowOrSC, const TString DrawOption); // SubDet: EB or EE
00160 //
00161 //  //==================================================================================================
00162 //  //     methods for displaying 2D view of the whole subdetector; (eta,Phi) for EB, (IX,IY) for EE
00163 //  //==================================================================================================
00164 //  void EBEtaPhiAveragedNumberOfEvents();     // SubDet: specific EB
00165 //  void EBEtaPhiAveragedPedestals();          // SubDet: specific EB
00166 //  void EBEtaPhiAveragedTotalNoise();         // SubDet: specific EB
00167 //  void EBEtaPhiAveragedMeanOfCorss();        // SubDet: specific EB
00168 //  void EBEtaPhiAveragedLowFrequencyNoise();  // SubDet: specific EB
00169 //  void EBEtaPhiAveragedHighFrequencyNoise(); // SubDet: specific EB
00170 //  void EBEtaPhiAveragedSigmaOfCorss();       // SubDet: specific EB
00171 //
00172 //  void EEIXIYAveragedNumberOfEvents();     // SubDet: specific EE
00173 //  void EEIXIYAveragedPedestals();          // SubDet: specific EE
00174 //  void EEIXIYAveragedTotalNoise();         // SubDet: specific EE
00175 //  void EEIXIYAveragedMeanOfCorss();        // SubDet: specific EE
00176 //  void EEIXIYAveragedLowFrequencyNoise();  // SubDet: specific EE
00177 //  void EEIXIYAveragedHighFrequencyNoise(); // SubDet: specific EE
00178 //  void EEIXIYAveragedSigmaOfCorss();       // SubDet: specific EE
00179 //
00180 //  //==================================================================================================
00181 //  //        methods for displaying SM 2D(eta,phi) and Dee 2D(IX,IY) view
00182 //  //==================================================================================================
00183 //  void SMEtaPhiNumberOfEvents();       // SubDet: specific EB
00184 //  void SMEtaPhiPedestals();            // SubDet: specific EB
00185 //  void SMEtaPhiTotalNoise();           // SubDet: specific EB
00186 //  void SMEtaPhiMeanOfCorss();          // SubDet: specific EB
00187 //  void SMEtaPhiLowFrequencyNoise();    // SubDet: specific EB
00188 //  void SMEtaPhiHighFrequencyNoise();   // SubDet: specific EB
00189 //  void SMEtaPhiSigmaOfCorss();         // SubDet: specific EB
00190 //
00191 //  void SMEtaPhiLowFrequencyCorcc();    // SubDet: specific EB
00192 //  void SMEtaPhiHighFrequencyCorcc();   // SubDet: specific EB
00193 //
00194 //  void DeeIXIYNumberOfEvents();        // SubDet: specific EE
00195 //  void DeeIXIYPedestals();             // SubDet: specific EE
00196 //  void DeeIXIYTotalNoise();            // SubDet: specific EE
00197 //  void DeeIXIYMeanOfCorss();           // SubDet: specific EE
00198 //  void DeeIXIYLowFrequencyNoise();     // SubDet: specific EE
00199 //  void DeeIXIYHighFrequencyNoise();    // SubDet: specific EE
00200 //  void DeeIXIYSigmaOfCorss();          // SubDet: specific EE
00201 //
00202 //  void DeeIXIYLowFrequencyCorcc();     // SubDet: specific EE
00203 //  void DeeIXIYHighFrequencyCorcc();    // SubDet: specific EE
00204 //
00205 //  //==================================================================================================
00206 //  //                             methods for displaying 1D histos
00207 //  //
00208 //  //     PlotOption: optional argument ("ONLYONE", "SAME","SAME n"  or "ASCII")
00209 //  //      
00210 //  //  "ONLYONE" :  display only one histo (default; same as without argument)
00211 //  //  "SAME"    :  Same as Draw Option "SAME" in ROOT: superimpose on previous picture in the same pad
00212 //  //               1D histos of only one quantity
00213 //  //  "SAME n"  :  Same as Draw Option "SAME" in ROOT: superimpose on previous picture in the same pad
00214 //  //               1D histos of possibly several quantities
00215 //  //  "ASCII"   :  write histo contents in ASCII file
00216 //  //
00217 //  //   Codification for the method names:  [part of detector][X axis][Y axis](...)
00218 //  //
00219 //  //   Examples: SMXtalsTotalNoise(...)         : Total noise as a function of Xtal number for one SM
00220 //  //             XtalSamplesSigma(...)          : Sigma as a function of sample number for one Xtal
00221 //  //             DeeLowFrequencyNoiseXtals(...) : Low Fq noise distribution over the Xtals for one Dee
00222 //  //             XtalTimePedestals(...)         : Pedestal evolution in time for one Xtal (history plot)
00223 //  //             XtalTimePedestalsRuns(...)     : Pedestal distribution over runs for one Xtal
00224 //  //                                              (projection of the history plot on Y axis)
00225 //  //             etc...
00226 //  //
00227 //  //==================================================================================================
00228 //  void SMXtalsNumberOfEvents    ([const TString PlotOption]); // SubDet: specific EB
00229 //  void SMXtalsPedestals         ([const TString PlotOption]); // SubDet: specific EB
00230 //  void SMXtalsTotalNoise        ([const TString PlotOption]); // SubDet: specific EB
00231 //  void SMXtalsMeanOfCorss       ([const TString PlotOption]); // SubDet: specific EB
00232 //  void SMXtalsLowFrequencyNoise ([const TString PlotOption]); // SubDet: specific EB
00233 //  void SMXtalsHighFrequencyNoise([const TString PlotOption]); // SubDet: specific EB
00234 //  void SMXtalsSigmaOfCorss      ([const TString PlotOption]); // SubDet: specific EB
00235 //
00236 //  void SMNumberOfEventsXtals    ([const TString PlotOption]); // SubDet: specific EB
00237 //  void SMPedestalsXtals         ([const TString PlotOption]); // SubDet: specific EB
00238 //  void SMTotalNoiseXtals        ([const TString PlotOption]); // SubDet: specific EB
00239 //  void SMMeanOfCorssXtals       ([const TString PlotOption]); // SubDet: specific EB
00240 //  void SMLowFrequencyNoiseXtals ([const TString PlotOption]); // SubDet: specific EB
00241 //  void SMHighFrequencyNoiseXtals([const TString PlotOption]); // SubDet: specific EB
00242 //  void SMSigmaOfCorssXtals      ([const TString PlotOption]); // SubDet: specific EB
00243 // 
00244 //  void DeeXtalsNumberOfEvents    ([const TString PlotOption]); // SubDet: specific EE
00245 //  void DeeXtalsPedestals         ([const TString PlotOption]); // SubDet: specific EE
00246 //  void DeeXtalsTotalNoise        ([const TString PlotOption]); // SubDet: specific EE
00247 //  void DeeXtalsMeanOfCorss       ([const TString PlotOption]); // SubDet: specific EE
00248 //  void DeeXtalsLowFrequencyNoise ([const TString PlotOption]); // SubDet: specific EE
00249 //  void DeeXtalsHighFrequencyNoise([const TString PlotOption]); // SubDet: specific EE
00250 //  void DeeXtalsSigmaOfCorss      ([const TString PlotOption]); // SubDet: specific EE
00251 //
00252 //  void DeeNumberOfEventsXtals    ([const TString PlotOption]); // SubDet: specific EE
00253 //  void DeePedestalsXtals         ([const TString PlotOption]); // SubDet: specific EE
00254 //  void DeeTotalNoiseXtals        ([const TString PlotOption]); // SubDet: specific EE
00255 //  void DeeMeanOfCorssXtals       ([const TString PlotOption]); // SubDet: specific EE
00256 //  void DeeLowFrequencyNoiseXtals ([const TString PlotOption]); // SubDet: specific EE
00257 //  void DeeHighFrequencyNoiseXtals([const TString PlotOption]); // SubDet: specific EE
00258 //  void DeeSigmaOfCorssXtals      ([const TString PlotOption]); // SubDet: specific EE
00259 //
00260 //  void XtalSamplesEv(const Int_t& TowOrSC#, const Int_t& Channel#inTowOrSC,
00261 //                        [const TString PlotOption]);                              // SubDet: EB or EE
00262 //  void XtalSamplesSigma(const Int_t& TowOrSC#, const Int_t& Channel#inTowOrSC,
00263 //                        [const TString PlotOption]);                              // SubDet: EB or EE
00264 //  void XtalSampleValues(const Int_t& TowOrSC#, const Int_t&  Channel#inTowOrSC,
00265 //                        const Int_t& Sample#,  [const TString PlotOption]);       // SubDet: EB or EE
00266 //  void SampleADCEvents(const Int_t& TowOrSC#, const Int_t&  Channel#inTowOrSC,
00267 //                       const Int_t& Sample#,  [const TString PlotOption]);        // SubDet: EB or EE
00268 //
00269 //  //==================================================================================================
00270 //  //                     methods for displaying 1D history plots
00271 //  //==================================================================================================
00272 //  void XtalTimePedestals(const TString ListOfRunFileName, const Int_t& TowOrSC#,
00273 //                         const Int_t& Channel#inTowOrSC,  [const TString PlotOption]);          // SubDet: EB or EE
00274 //
00275 //  void XtalTimeTotalNoise(const TString ListOfRunFileName, const Int_t& TowOrSC#,
00276 //                          const Int_t& Channel#inTowOrSC,  [const TString PlotOption]);         // SubDet: EB or EE
00277 //
00278 //  void XtalTimeMeanOfCorss(const TString ListOfRunFileName, const Int_t& TowOrSC#,
00279 //                           const Int_t& Channel#inTowOrSC,  [const TString PlotOption]);        // SubDet: EB or EE
00280 //
00281 //  void XtalTimeLowFrequencyNoise(const TString ListOfRunFileName, const Int_t& TowOrSC#,
00282 //                                 const Int_t& Channel#inTowOrSC,  [const TString PlotOption]);  // SubDet: EB or EE
00283 //
00284 //  void XtalTimeHighFrequencyNoise(const TString ListOfRunFileName, const Int_t& TowOrSC#,
00285 //                                  const Int_t& Channel#inTowOrSC,  [const TString PlotOption]); // SubDet: EB or EE
00286 //
00287 //  void XtalTimeSigmaOfCorss(const TString ListOfRunFileName, const Int_t& TowOrSC#,
00288 //                            const Int_t& Channel#inTowOrSC,  [const TString PlotOption]);       // SubDet: EB or EE
00289 //
00290 //  //==================================================================================================
00291 //  //        methods for displaying Nb of run distribution plots (1D history plot Y projection)
00292 //  //==================================================================================================
00293 //  void XtalPedestalsRuns(const TString ListOfRunFileName, const Int_t& TowOrSC#,
00294 //                         const Int_t& Channel#inTowOrSC,  [const TString PlotOption]);          // SubDet: EB or EE
00295 //
00296 //  void XtalTotalNoiseRuns(const TString ListOfRunFileName, const Int_t& TowOrSC#,
00297 //                          const Int_t& Channel#inTowOrSC,  [const TString PlotOption]);         // SubDet: EB or EE
00298 //
00299 //  void XtalMeanOfCorssRuns(const TString ListOfRunFileName, const Int_t& TowOrSC#,
00300 //                           const Int_t& Channel#inTowOrSC,  [const TString PlotOption]);        // SubDet: EB or EE
00301 //
00302 //  void XtalLowFrequencyNoiseRuns(const TString ListOfRunFileName, const Int_t& TowOrSC#,
00303 //                                 const Int_t& Channel#inTowOrSC,  [const TString PlotOption]);  // SubDet: EB or EE
00304 //
00305 //  void XtalHighFrequencyNoiseRuns(const TString ListOfRunFileName, const Int_t& TowOrSC#,
00306 //                                  const Int_t& Channel#inTowOrSC,  [const TString PlotOption]); // SubDet: EB or EE
00307 //
00308 //  void XtalSigmaOfCorssRuns(const TString ListOfRunFileName, const Int_t& TowOrSC#,
00309 //                            const Int_t& Channel#inTowOrSC,  [const TString PlotOption]);       // SubDet: EB or EE
00310 //
00311 //  //==================================================================================================
00312 //  //             methods for displaying Tower, SC, crystal numbering
00313 //  //==================================================================================================
00314 //
00315 //  void SMTowerNumbering(const Int_t& SM#);  // SubDet: specific EB
00316 //  void DeeSCNumbering  (const Int_t& Dee#); // SubDet: specific EE
00317 //
00318 //  void TowerCrystalNumbering(const Int_t& SM#,  const Int_t& Tow#); // SubDet: specific EB
00319 //  void SCCrystalNumbering   (const Int_t& Dee#, const Int_t& SC#);  // SubDet: specific EE
00320 //                                                                    //         (SC# for construction)
00321 //
00322 //  //==================================================================================================
00323 //  //                General title
00324 //  //==================================================================================================
00325 //  void GeneralTitle(const TString Title); // SubDet: EB or EE
00326 //
00327 //  //==================================================================================================
00328 //  //                        Lin:Log scale (SCALE = "LIN" or "LOG") 
00329 //  //==================================================================================================
00330 //  void SetHistoScaleX(const TString SCALE); // SubDet: EB or EE
00331 //  void SetHistoScaleY(const TString SCALE); // SubDet: EB or EE
00332 //
00333 //  //==================================================================================================
00334 //  //                   ColorPalette (OPTION = "ECNAColor" or "Rainbow")
00335 //  //==================================================================================================
00336 //  void SetHistoColorPalette(const TString OPTION); // SubDet: EB or EE
00337 //
00338 //  //==================================================================================================
00339 //  //                            histo ymin, ymax management
00340 //  //==================================================================================================
00341 //
00342 //  //  These methods must be called before calls to the display methods
00343 //
00344 //  //.................................. 1D and 2D histo ymin,ymax forced to user's values
00345 //  void SetHistoMin(const Double_t& YminValue); // SubDet: EB or EE
00346 //  void SetHistoMax(const Double_t& YmaxValue); // SubDet: EB or EE
00347 //
00348 //  //.................................. 1D and 2D histo ymin,ymax calculated from histo values
00349 //  void SetHistoMin(); // SubDet: EB or EE
00350 //  void SetHistoMax(); // SubDet: EB or EE
00351 //
00352 //  if SetHistoMin and SetHistoMax are not called, default values are applied. These default values
00353 //  are in methods GetYminDefaultValue(...) and GetYmaxDefaultValue(...) of class TEcnaParHistos
00354 //
00355 //------------------------------------------------------------------------------------------------------
00356 
00357 //-----------------------------------------------------------------------------------------------------
00358 //
00359 //   Location of the ECNA web page:
00360 //
00361 //   https://cms-fabbro.web.cern.ch/cms-fabbro/cna_new/Correlated_Noise_Analysis/ECNA_main_page.htm
00362 //
00363 //------------------------------ TEcnaHistos.cc ---------------------------
00364 //  
00365 //   Creation (first version): 18 April 2005
00366 //
00367 //   For questions or comments, please send e-mail to Bernard Fabbro:
00368 //             
00369 //   fabbro@hep.saclay.cea.fr 
00370 //
00371 //------------------------------------------------------------------------
00372 
00373 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
00374 //
00375 //       (attributes) ===> TEcnaParPaths --->|
00376 //                         TEcnaParEcal --->|
00377 //                         TEcnaWrite ---> TEcnaParPaths --->| 
00378 //                                         TEcnaParCout --->| 
00379 //                                         TEcnaParEcal --->|
00380 //                                         TEcnaNumbering ---> TEcnaParEcal --->|
00381 //                         TEcnaParHistos ---> TEcnaParEcal --->|
00382 //                                             TEcnaNumbering ---> TEcnaParEcal --->|
00383 //                         TEcnaNumbering ---> TEcnaParEcal --->|
00384 //
00385 //                         TEcnaRead ---> TEcnaParCout --->|  
00386 //                                        TEcnaParPaths --->|
00387 //                                        TEcnaHeader --->|
00388 //                                        TEcnaParEcal --->|
00389 //                                        TEcnaWrite ---> TEcnaParPaths --->|
00390 //                                                        TEcnaParCout --->| 
00391 //                                                        TEcnaParEcal --->|
00392 //                                                        TEcnaNumbering ---> TEcnaParEcal --->|
00393 //                                       TEcnaNumbering ---> TEcnaParEcal --->|
00394 //
00395 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 
00396 TEcnaHistos::~TEcnaHistos()
00397 {
00398   //destructor
00399 
00400   if (fT1DRunNumber != 0){delete [] fT1DRunNumber; fCdelete++;}
00401   
00402   //if (fCnaParHistos  != 0){delete fCnaParHistos;  fCdelete++;}
00403   //if (fCnaParPaths   != 0){delete fCnaParPaths;   fCdelete++;}
00404   //if (fCnaParCout    != 0){delete fCnaParCout;    fCdelete++;}
00405   //if (fCnaWrite      != 0){delete fCnaWrite;      fCdelete++;}
00406   //if (fEcal          != 0){delete fEcal;          fCdelete++;}
00407   //if (fEcalNumbering != 0){delete fEcalNumbering; fCdelete++;}
00408 
00409   if (fMyRootFile     != 0){delete fMyRootFile;      fCdelete++;}
00410 
00411 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00412 
00413   if ( fCnew != fCdelete )
00414     {
00415       cout << "*TEcnaHistos> WRONG MANAGEMENT OF ALLOCATIONS: fCnew = "
00416            << fCnew << ", fCdelete = " << fCdelete << fTTBELL << endl;
00417     }
00418   else
00419     {
00420      //  cout << "*TEcnaHistos> BRAVO! GOOD MANAGEMENT OF ALLOCATIONS: fCnew = "
00421      //       << fCnew << ", fCdelete = " << fCdelete << endl;
00422     }
00423 
00424 #define MGRA
00425 #ifndef MGRA
00426   if ( fCnewRoot != fCdeleteRoot )
00427     {
00428       cout << "*TEcnaHistos> WRONG MANAGEMENT OF ROOT ALLOCATIONS: fCnewRoot = "
00429            << fCnewRoot << ", fCdeleteRoot = " << fCdeleteRoot << endl;
00430     }
00431   else
00432     {
00433       cout << "*TEcnaHistos> BRAVO! GOOD MANAGEMENT OF ROOT ALLOCATIONS:"
00434            << " fCnewRoot = " << fCnewRoot <<", fCdeleteRoot = "
00435            << fCdeleteRoot << endl;
00436     }
00437 #endif // MGRA
00438 
00439   // cout << "TEcnaHistos> Leaving destructor" << endl;
00440   // cout << "            fCnew = " << fCnew << ", fCdelete = " << fCdelete << endl;
00441 
00442  // cout << "[Info Management] CLASS: TEcnaHistos.        DESTROY OBJECT: this = " << this << endl;
00443 
00444 }
00445 
00446 //===================================================================
00447 //
00448 //                   Constructors 
00449 //
00450 //===================================================================
00451 TEcnaHistos::TEcnaHistos(){
00452 // Constructor without argument. Call to Init() 
00453 
00454  // cout << "[Info Management] CLASS: TEcnaHistos.        CREATE OBJECT: this = " << this << endl;
00455 
00456   Init();
00457 }
00458 TEcnaHistos::TEcnaHistos(const TString SubDet)
00459 {
00460 
00461  // cout << "[Info Management] CLASS: TEcnaHistos.        CREATE OBJECT: this = " << this << endl;
00462 
00463   Init();
00464 
00465   //----------------------- Object management
00466   fCnaParCout = 0;  fCnaParCout  = new TEcnaParCout();  /*fCnew++*/
00467 
00468   fCnaParPaths = 0; fCnaParPaths = new TEcnaParPaths(); /*fCnew++*/
00469   fCfgResultsRootFilePath    = fCnaParPaths->ResultsRootFilePath();
00470   fCfgHistoryRunListFilePath = fCnaParPaths->HistoryRunListFilePath();
00471 
00472   //......... Set SubDetector ("EB" or "EE")
00473   TEcnaParEcal* pEcal          = 0;
00474   TEcnaParHistos*   pCnaParHistos  = 0;
00475   TEcnaNumbering*  pEcalNumbering = 0;
00476   TEcnaWrite*       pCnaWrite      = 0;
00477   
00478   SetEcalSubDetector(SubDet.Data(), pEcal, pCnaParHistos, pEcalNumbering, pCnaWrite);
00479   //......... init ymin,ymax histos -> Default values for Ymin and Ymax
00480   SetAllYminYmaxMemoFromDefaultValues();
00481 }
00482 
00483 TEcnaHistos::TEcnaHistos(const TString SubDet,
00484                          const TEcnaParPaths*  pCnaParPaths,
00485                          const TEcnaParCout*   pCnaParCout,
00486                          const TEcnaParEcal*   pEcal, 
00487                          const TEcnaParHistos* pCnaParHistos,
00488                          const TEcnaNumbering* pEcalNumbering,
00489                          const TEcnaWrite*     pCnaWrite)
00490 {
00491 // Constructor with argument. Call to Init() and set the subdetector flag
00492 
00493  // cout << "[Info Management] CLASS: TEcnaHistos.        CREATE OBJECT: this = " << this << endl;
00494 
00495   Init();
00496 
00497   //----------------------- Object management
00498   fCnaParCout = 0;
00499   if( pCnaParCout == 0 )
00500     {fCnaParCout = new TEcnaParCout();  /*fCnew++*/ ;}
00501   else
00502     {fCnaParCout = (TEcnaParCout*)pCnaParCout;}
00503 
00504   fCnaParPaths = 0;
00505   if( pCnaParPaths == 0 )
00506     {fCnaParPaths = new TEcnaParPaths(); /*fCnew++*/ ;}
00507   else
00508     {fCnaParPaths = (TEcnaParPaths*)pCnaParPaths;}
00509 
00510   fCfgResultsRootFilePath    = fCnaParPaths->ResultsRootFilePath();
00511   fCfgHistoryRunListFilePath = fCnaParPaths->HistoryRunListFilePath();
00512 
00513   //......... Set SubDetector ("EB" or "EE")
00514   SetEcalSubDetector(SubDet.Data(), pEcal, pCnaParHistos, pEcalNumbering, pCnaWrite);
00515   //......... init ymin,ymax histos -> Default values for Ymin and Ymax
00516   SetAllYminYmaxMemoFromDefaultValues();
00517 }
00518 
00519 void TEcnaHistos::Init()
00520 {
00521 //========================= GENERAL INITIALISATION 
00522   fCnew        = 0;
00523   fCdelete     = 0;
00524   fCnewRoot    = 0;
00525   fCdeleteRoot = 0;
00526 
00527   fCnaCommand  = 0;
00528   fCnaError    = 0;
00529 
00530   fgMaxCar = 512;
00531   fZerv    =   0;
00532 
00533   //------------------------------ initialisations ----------------------
00534   fTTBELL = '\007';
00535 
00536   fT1DRunNumber = 0;
00537 
00538   //........................ init code plot type                      (Init)
00539   Int_t MaxCar = fgMaxCar;
00540   fOnlyOnePlot.Resize(MaxCar);
00541   fOnlyOnePlot = "ONLYONE";
00542 
00543   MaxCar = fgMaxCar;
00544   fSeveralPlot.Resize(MaxCar);
00545   fSeveralPlot = "SAME";
00546 
00547   MaxCar = fgMaxCar;
00548   fSameOnePlot.Resize(MaxCar);
00549   fSameOnePlot = "SAME n";
00550 
00551   //.......... init flags Same plot
00552   fMemoPlotH1SamePlus = 0;
00553   fMemoPlotD_NOE_ChNb = 0; fMemoPlotD_NOE_ChDs = 0;
00554   fMemoPlotD_Ped_ChNb = 0; fMemoPlotD_Ped_ChDs = 0;
00555   fMemoPlotD_TNo_ChNb = 0; fMemoPlotD_TNo_ChDs = 0; 
00556   fMemoPlotD_MCs_ChNb = 0; fMemoPlotD_MCs_ChDs = 0;
00557   fMemoPlotD_LFN_ChNb = 0; fMemoPlotD_LFN_ChDs = 0; 
00558   fMemoPlotD_HFN_ChNb = 0; fMemoPlotD_HFN_ChDs = 0; 
00559   fMemoPlotD_SCs_ChNb = 0; fMemoPlotD_SCs_ChDs = 0; 
00560   fMemoPlotD_MSp_Samp = 0; fMemoPlotD_SSp_Samp = 0;
00561   fMemoPlotD_Adc_EvDs = 0; fMemoPlotD_Adc_EvNb = 0;
00562   fMemoPlotH_Ped_Date = 0; fMemoPlotH_TNo_Date = 0;
00563   fMemoPlotH_MCs_Date = 0; fMemoPlotH_LFN_Date = 0;
00564   fMemoPlotH_HFN_Date = 0; fMemoPlotH_SCs_Date = 0;
00565   fMemoPlotH_Ped_RuDs = 0; fMemoPlotH_TNo_RuDs = 0;
00566   fMemoPlotH_MCs_RuDs = 0; fMemoPlotH_LFN_RuDs = 0;
00567   fMemoPlotH_HFN_RuDs = 0; fMemoPlotH_SCs_RuDs = 0;
00568   //.......... init flags colors                                       (Init)
00569   fMemoColorH1SamePlus = 0;
00570   fMemoColorD_NOE_ChNb = 0; fMemoColorD_NOE_ChDs = 0;
00571   fMemoColorD_Ped_ChNb = 0; fMemoColorD_Ped_ChDs = 0;
00572   fMemoColorD_TNo_ChNb = 0; fMemoColorD_TNo_ChDs = 0; 
00573   fMemoColorD_MCs_ChNb = 0; fMemoColorD_MCs_ChDs = 0;
00574   fMemoColorD_LFN_ChNb = 0; fMemoColorD_LFN_ChDs = 0; 
00575   fMemoColorD_HFN_ChNb = 0; fMemoColorD_HFN_ChDs = 0; 
00576   fMemoColorD_SCs_ChNb = 0; fMemoColorD_SCs_ChDs = 0; 
00577   fMemoColorD_MSp_Samp = 0; fMemoColorD_SSp_Samp = 0;
00578   fMemoColorD_Adc_EvDs = 0; fMemoColorD_Adc_EvNb = 0;
00579   fMemoColorH_Ped_Date = 0; fMemoColorH_TNo_Date = 0;
00580   fMemoColorH_MCs_Date = 0; fMemoColorH_LFN_Date = 0;
00581   fMemoColorH_HFN_Date = 0; fMemoColorH_SCs_Date = 0;
00582   fMemoColorH_Ped_RuDs = 0; fMemoColorH_TNo_RuDs = 0;
00583   fMemoColorH_MCs_RuDs = 0; fMemoColorH_LFN_RuDs = 0;
00584   fMemoColorH_HFN_RuDs = 0; fMemoColorH_SCs_RuDs = 0;
00585   //.......... init counter Same canvas
00586   fCanvSameH1SamePlus = 0;
00587   fCanvSameD_NOE_ChNb = 0; fCanvSameD_NOE_ChDs = 0;
00588   fCanvSameD_Ped_ChNb = 0; fCanvSameD_Ped_ChDs = 0;
00589   fCanvSameD_TNo_ChNb = 0; fCanvSameD_TNo_ChDs = 0; 
00590   fCanvSameD_MCs_ChNb = 0; fCanvSameD_MCs_ChDs = 0;
00591   fCanvSameD_LFN_ChNb = 0; fCanvSameD_LFN_ChDs = 0; 
00592   fCanvSameD_HFN_ChNb = 0; fCanvSameD_HFN_ChDs = 0; 
00593   fCanvSameD_SCs_ChNb = 0; fCanvSameD_SCs_ChDs = 0; 
00594   fCanvSameD_MSp_Samp = 0; fCanvSameD_SSp_Samp = 0;
00595   fCanvSameD_Adc_EvDs = 0; fCanvSameD_Adc_EvNb = 0;
00596   fCanvSameH_Ped_Date = 0; fCanvSameH_TNo_Date = 0;
00597   fCanvSameH_MCs_Date = 0; fCanvSameH_LFN_Date = 0;
00598   fCanvSameH_HFN_Date = 0; fCanvSameH_SCs_Date = 0;
00599   fCanvSameH_Ped_RuDs = 0; fCanvSameH_TNo_RuDs = 0;
00600   fCanvSameH_MCs_RuDs = 0; fCanvSameH_LFN_RuDs = 0;
00601   fCanvSameH_HFN_RuDs = 0; fCanvSameH_SCs_RuDs = 0;
00602   //................. Flag Scale X anf Y set to "LIN" and flag color palete set to "Black/Red/Blue"
00603 
00604   MaxCar = fgMaxCar;
00605   fFlagScaleX.Resize(MaxCar);
00606   fFlagScaleX = "LIN";
00607 
00608   MaxCar = fgMaxCar;                                     //   (Init)
00609   fFlagScaleY.Resize(MaxCar);
00610   fFlagScaleY = "LIN";
00611 
00612   MaxCar = fgMaxCar;
00613   fFlagColPal.Resize(MaxCar);
00614   fFlagColPal = "Black/Red/Blue";
00615 
00616   //................. Flag General Title set to empty string
00617   MaxCar = fgMaxCar;
00618   fFlagGeneralTitle.Resize(MaxCar);
00619   fFlagGeneralTitle = "";
00620 
00621   //................. Init codes Options
00622   fOptScaleLinx = 31400;
00623   fOptScaleLogx = 31401;
00624   fOptScaleLiny = 31402;
00625   fOptScaleLogy = 31403;
00626 
00627   fOptVisLine = 1101; 
00628   fOptVisPolm = 1102;
00629 
00630   //............................                                       (Init)
00631   MaxCar = fgMaxCar;
00632   fCovarianceMatrix.Resize(MaxCar);
00633   fCovarianceMatrix = "Cov";
00634   MaxCar = fgMaxCar;
00635   fCorrelationMatrix.Resize(MaxCar);
00636   fCorrelationMatrix = "Cor";
00637 
00638   MaxCar = fgMaxCar;
00639   fLFBetweenChannels.Resize(MaxCar);
00640   fLFBetweenChannels = "MccLow";
00641   MaxCar = fgMaxCar;
00642   fHFBetweenChannels.Resize(MaxCar);
00643   fHFBetweenChannels = "MccHigh";
00644 
00645   MaxCar = fgMaxCar;
00646   fBetweenSamples.Resize(MaxCar);
00647   fBetweenSamples = "Mss";
00648 
00649   MaxCar = fgMaxCar;
00650   fLFBetweenStins.Resize(MaxCar);
00651   fLFBetweenStins = "MttLow";
00652   MaxCar = fgMaxCar;
00653   fHFBetweenStins.Resize(MaxCar);
00654   fHFBetweenStins = "MttHigh";
00655 
00656   //.................................. text pave alignement for pave "SeveralChanging" (HistimePlot)
00657   fTextPaveAlign  = 12;              // 1 = left adjusted, 2 = vertically centered
00658   fTextPaveFont   = 100;             // 10*10 = 10*(ID10 = Courier New)
00659   fTextPaveSize   = (Float_t)0.025;  // 0.0xxx = xxx% of the pave size
00660   fTextBorderSize = 1;               // Pave Border (=>Shadow)
00661 
00662   //................................. Init Xvar, Yvar, NbBins management for options SAME and SAME n
00663   fXMemoH1SamePlus = "";
00664   fXMemoD_NOE_ChNb = "";
00665   fXMemoD_NOE_ChDs = "";
00666   fXMemoD_Ped_ChNb = "";
00667   fXMemoD_Ped_ChDs = "";
00668   fXMemoD_TNo_ChNb = "";   
00669   fXMemoD_TNo_ChDs = ""; 
00670   fXMemoD_MCs_ChNb = ""; 
00671   fXMemoD_MCs_ChDs = "";
00672   fXMemoD_LFN_ChNb = "";
00673   fXMemoD_LFN_ChDs = ""; 
00674   fXMemoD_HFN_ChNb = "";   
00675   fXMemoD_HFN_ChDs = ""; 
00676   fXMemoD_SCs_ChNb = ""; 
00677   fXMemoD_SCs_ChDs = ""; 
00678   fXMemoD_MSp_Samp = "";
00679   fXMemoD_SSp_Samp = "";  
00680   fXMemoD_Adc_EvDs = "";     
00681   fXMemoD_Adc_EvNb = "";
00682   fXMemoH_Ped_Date = "";
00683   fXMemoH_TNo_Date = "";
00684   fXMemoH_MCs_Date = "";
00685   fXMemoH_LFN_Date = "";
00686   fXMemoH_HFN_Date = "";
00687   fXMemoH_SCs_Date = "";
00688   fXMemoH_Ped_RuDs = "";
00689   fXMemoH_TNo_RuDs = "";
00690   fXMemoH_MCs_RuDs = "";
00691   fXMemoH_LFN_RuDs = "";
00692   fXMemoH_HFN_RuDs = "";
00693   fXMemoH_SCs_RuDs = "";
00694 
00695   fYMemoH1SamePlus = "";
00696   fYMemoD_NOE_ChNb = "";
00697   fYMemoD_NOE_ChDs = "";
00698   fYMemoD_Ped_ChNb = "";
00699   fYMemoD_Ped_ChDs = "";
00700   fYMemoD_TNo_ChNb = "";
00701   fYMemoD_TNo_ChDs = "";
00702   fYMemoD_MCs_ChNb = "";
00703   fYMemoD_MCs_ChDs = "";
00704   fYMemoD_LFN_ChNb = "";
00705   fYMemoD_LFN_ChDs = "";
00706   fYMemoD_HFN_ChNb = "";
00707   fYMemoD_HFN_ChDs = "";
00708   fYMemoD_SCs_ChNb = "";
00709   fYMemoD_SCs_ChDs = "";
00710   fYMemoD_MSp_Samp = "";
00711   fYMemoD_SSp_Samp = "";  
00712   fYMemoD_Adc_EvDs = "";     
00713   fYMemoD_Adc_EvNb = "";
00714   fYMemoH_Ped_Date = "";
00715   fYMemoH_TNo_Date = "";
00716   fYMemoH_MCs_Date = "";
00717   fYMemoH_LFN_Date = "";
00718   fYMemoH_HFN_Date = "";
00719   fYMemoH_SCs_Date = "";
00720   fYMemoH_Ped_RuDs = "";
00721   fYMemoH_TNo_RuDs = "";
00722   fYMemoH_MCs_RuDs = "";
00723   fYMemoH_LFN_RuDs = "";
00724   fYMemoH_HFN_RuDs = "";
00725   fYMemoH_SCs_RuDs = "";
00726 
00727   fNbBinsMemoH1SamePlus = 0;
00728   fNbBinsMemoD_NOE_ChNb = 0;
00729   fNbBinsMemoD_NOE_ChDs = 0;
00730   fNbBinsMemoD_Ped_ChNb = 0;
00731   fNbBinsMemoD_Ped_ChDs = 0;
00732   fNbBinsMemoD_TNo_ChNb = 0;   
00733   fNbBinsMemoD_TNo_ChDs = 0; 
00734   fNbBinsMemoD_MCs_ChNb = 0; 
00735   fNbBinsMemoD_MCs_ChDs = 0;
00736   fNbBinsMemoD_LFN_ChNb = 0;
00737   fNbBinsMemoD_LFN_ChDs = 0; 
00738   fNbBinsMemoD_HFN_ChNb = 0;   
00739   fNbBinsMemoD_HFN_ChDs = 0; 
00740   fNbBinsMemoD_SCs_ChNb = 0; 
00741   fNbBinsMemoD_SCs_ChDs = 0; 
00742   fNbBinsMemoD_MSp_Samp = 0;
00743   fNbBinsMemoD_SSp_Samp = 0;  
00744   fNbBinsMemoD_Adc_EvDs = 0;     
00745   fNbBinsMemoD_Adc_EvNb = 0;
00746   fNbBinsMemoH_Ped_Date = 0;
00747   fNbBinsMemoH_TNo_Date = 0;
00748   fNbBinsMemoH_MCs_Date = 0;
00749   fNbBinsMemoH_LFN_Date = 0;
00750   fNbBinsMemoH_HFN_Date = 0;
00751   fNbBinsMemoH_SCs_Date = 0;
00752   fNbBinsMemoH_Ped_RuDs = 0;
00753   fNbBinsMemoH_TNo_RuDs = 0;
00754   fNbBinsMemoH_MCs_RuDs = 0;
00755   fNbBinsMemoH_LFN_RuDs = 0;
00756   fNbBinsMemoH_HFN_RuDs = 0;
00757   fNbBinsMemoH_SCs_RuDs = 0;
00758 
00759   //.................................. Init canvas/pad pointers                (Init)
00760   fCurrentCanvas         = 0;
00761 
00762   fCurrentCanvasName     = "?";
00763 
00764   fCanvH1SamePlus = 0; 
00765   fCanvD_NOE_ChNb = 0;
00766   fCanvD_NOE_ChDs = 0;
00767   fCanvD_Ped_ChNb = 0;
00768   fCanvD_Ped_ChDs = 0;
00769   fCanvD_TNo_ChNb = 0;   
00770   fCanvD_TNo_ChDs = 0; 
00771   fCanvD_MCs_ChNb = 0; 
00772   fCanvD_MCs_ChDs = 0;
00773   fCanvD_LFN_ChNb = 0;
00774   fCanvD_LFN_ChDs = 0; 
00775   fCanvD_HFN_ChNb = 0;   
00776   fCanvD_HFN_ChDs = 0; 
00777   fCanvD_SCs_ChNb = 0; 
00778   fCanvD_SCs_ChDs = 0; 
00779   fCanvD_MSp_Samp = 0;
00780   fCanvD_SSp_Samp = 0;  
00781   fCanvD_Adc_EvDs = 0;     
00782   fCanvD_Adc_EvNb = 0;
00783   fCanvH_Ped_Date = 0;
00784   fCanvH_TNo_Date = 0;
00785   fCanvH_MCs_Date = 0;
00786   fCanvH_LFN_Date = 0;
00787   fCanvH_HFN_Date = 0;
00788   fCanvH_SCs_Date = 0;
00789   fCanvH_Ped_RuDs = 0;
00790   fCanvH_TNo_RuDs = 0;
00791   fCanvH_MCs_RuDs = 0;
00792   fCanvH_LFN_RuDs = 0;
00793   fCanvH_HFN_RuDs = 0;
00794   fCanvH_SCs_RuDs = 0;
00795   
00796   fCurrentPad = 0;                                    //   (Init)
00797 
00798   fPadH1SamePlus = 0;
00799   fPadD_NOE_ChNb = 0;
00800   fPadD_NOE_ChDs = 0;
00801   fPadD_Ped_ChNb = 0;
00802   fPadD_Ped_ChDs = 0;
00803   fPadD_TNo_ChNb = 0;   
00804   fPadD_TNo_ChDs = 0; 
00805   fPadD_MCs_ChNb = 0; 
00806   fPadD_MCs_ChDs = 0;
00807   fPadD_LFN_ChNb = 0;
00808   fPadD_LFN_ChDs = 0; 
00809   fPadD_HFN_ChNb = 0;   
00810   fPadD_HFN_ChDs = 0; 
00811   fPadD_SCs_ChNb = 0; 
00812   fPadD_SCs_ChDs = 0; 
00813   fPadD_MSp_Samp = 0;
00814   fPadD_SSp_Samp = 0;
00815   fPadD_Adc_EvDs = 0;
00816   fPadD_Adc_EvNb = 0;
00817   fPadH_Ped_Date = 0;
00818   fPadH_TNo_Date = 0;
00819   fPadH_MCs_Date = 0;
00820   fPadH_LFN_Date = 0;
00821   fPadH_HFN_Date = 0;
00822   fPadH_SCs_Date = 0;
00823   fPadH_Ped_RuDs = 0;
00824   fPadH_TNo_RuDs = 0;
00825   fPadH_MCs_RuDs = 0;
00826   fPadH_LFN_RuDs = 0;
00827   fPadH_HFN_RuDs = 0;
00828   fPadH_SCs_RuDs = 0;
00829 
00830   fPavTxtH1SamePlus = 0;                                    //   (Init)
00831   fPavTxtD_NOE_ChNb = 0;
00832   fPavTxtD_NOE_ChDs = 0;
00833   fPavTxtD_Ped_ChNb = 0;
00834   fPavTxtD_Ped_ChDs = 0;
00835   fPavTxtD_TNo_ChNb = 0;   
00836   fPavTxtD_TNo_ChDs = 0; 
00837   fPavTxtD_MCs_ChNb = 0; 
00838   fPavTxtD_MCs_ChDs = 0;
00839   fPavTxtD_LFN_ChNb = 0;
00840   fPavTxtD_LFN_ChDs = 0; 
00841   fPavTxtD_HFN_ChNb = 0;   
00842   fPavTxtD_HFN_ChDs = 0; 
00843   fPavTxtD_SCs_ChNb = 0; 
00844   fPavTxtD_SCs_ChDs = 0; 
00845   fPavTxtD_MSp_Samp = 0;
00846   fPavTxtD_SSp_Samp = 0;
00847   fPavTxtD_Adc_EvDs = 0;
00848   fPavTxtD_Adc_EvNb = 0;
00849   fPavTxtH_Ped_Date = 0;
00850   fPavTxtH_TNo_Date = 0;
00851   fPavTxtH_MCs_Date = 0;
00852   fPavTxtH_LFN_Date = 0;
00853   fPavTxtH_HFN_Date = 0;
00854   fPavTxtH_SCs_Date = 0;
00855   fPavTxtH_Ped_RuDs = 0;
00856   fPavTxtH_TNo_RuDs = 0;
00857   fPavTxtH_MCs_RuDs = 0;
00858   fPavTxtH_LFN_RuDs = 0;
00859   fPavTxtH_HFN_RuDs = 0;
00860   fPavTxtH_SCs_RuDs = 0;
00861 
00862   fImpH1SamePlus = 0;                                    //   (Init)
00863   fImpD_NOE_ChNb = 0;
00864   fImpD_NOE_ChDs = 0;
00865   fImpD_Ped_ChNb = 0;
00866   fImpD_Ped_ChDs = 0;
00867   fImpD_TNo_ChNb = 0;   
00868   fImpD_TNo_ChDs = 0; 
00869   fImpD_MCs_ChNb = 0; 
00870   fImpD_MCs_ChDs = 0;
00871   fImpD_LFN_ChNb = 0;
00872   fImpD_LFN_ChDs = 0; 
00873   fImpD_HFN_ChNb = 0;   
00874   fImpD_HFN_ChDs = 0; 
00875   fImpD_SCs_ChNb = 0; 
00876   fImpD_SCs_ChDs = 0; 
00877   fImpD_MSp_Samp = 0;
00878   fImpD_SSp_Samp = 0;  
00879   fImpD_Adc_EvDs = 0;     
00880   fImpD_Adc_EvNb = 0;
00881   fImpH_Ped_Date = 0;
00882   fImpH_TNo_Date = 0;
00883   fImpH_MCs_Date = 0;
00884   fImpH_LFN_Date = 0;
00885   fImpH_HFN_Date = 0;
00886   fImpH_SCs_Date = 0;
00887   fImpH_Ped_RuDs = 0;
00888   fImpH_TNo_RuDs = 0;
00889   fImpH_MCs_RuDs = 0;
00890   fImpH_LFN_RuDs = 0;
00891   fImpH_HFN_RuDs = 0;
00892   fImpH_SCs_RuDs = 0;
00893 
00894   fNbBinsProj = 100;       // number of bins for histos in option Projection
00895 
00896   //.................................... Miscellaneous parameters                (Init)
00897 
00898   fNbOfListFileH_Ped_Date     = 0;
00899   fNbOfListFileH_TNo_Date    = 0;
00900   fNbOfListFileH_MCs_Date  = 0;
00901   fNbOfListFileH_LFN_Date    = 0;
00902   fNbOfListFileH_HFN_Date   = 0;
00903   fNbOfListFileH_SCs_Date = 0;
00904 
00905   fNbOfListFileH_Ped_RuDs     = 0;
00906   fNbOfListFileH_TNo_RuDs    = 0;
00907   fNbOfListFileH_MCs_RuDs  = 0;
00908   fNbOfListFileH_LFN_RuDs    = 0;
00909   fNbOfListFileH_HFN_RuDs   = 0;
00910   fNbOfListFileH_SCs_RuDs = 0;
00911 
00912   fNbOfExistingRuns = 0;
00913 
00914   fFapNbOfRuns    = -1;      // INIT NUMBER OF RUNS: set to -1
00915   fFapMaxNbOfRuns = -1;      // INIT MAXIMUM NUMBER OF RUNS: set to -1 
00916 
00917   MaxCar = fgMaxCar;
00918   fFapFileRuns.Resize(MaxCar);
00919   fFapFileRuns = "(file with list of runs parameters: no info)";
00920 
00921   fStartEvolTime = 0;
00922   fStopEvolTime  = 0;
00923   fStartEvolDate = "Start date: not known";
00924   fStopEvolDate  = "Stop date:  not known";
00925 
00926   fStartEvolRun  = 0;
00927   fStopEvolRun   = 0;
00928 
00929   fRunType       = "Run type: not known";
00930 
00931   fFapNbOfEvts = 0;
00932 
00933   MaxCar = fgMaxCar;
00934   fMyRootFileName.Resize(MaxCar);
00935   fMyRootFileName = "No ROOT file name available (fMyRootFileName).";
00936 
00937   fFapAnaType           = "Analysis name: not known"; // Init Type of analysis
00938   fFapNbOfSamples       = 0; // Init Nb of required samples
00939   fFapRunNumber         = 0; // Init Run number
00940   fFapFirstReqEvtNumber = 0; // Init First requested event number
00941   fFapLastReqEvtNumber  = 0; // Init Last requested event number
00942   fFapReqNbOfEvts       = 0; // Init Requested number of events
00943   fFapStexNumber        = 0; // Init Stex number
00944 
00945   //------------------ Init pointer fMyRootFile
00946   fMyRootFile = 0;
00947   //------------------ Init fAsciiFileName
00948   fAsciiFileName = "?";
00949 
00950 } // end of Init()
00951 
00952 //----------------------------------------------------------------------------------------
00953 void TEcnaHistos::SetEcalSubDetector(const TString SubDet,
00954                                      const TEcnaParEcal*   pEcal,
00955                                      const TEcnaParHistos* pCnaParHistos,
00956                                      const TEcnaNumbering* pEcalNumbering,
00957                                      const TEcnaWrite*     pCnaWrite)
00958 {
00959  // Set Subdetector (EB or EE)
00960 
00961   fEcal = 0;
00962   if( pEcal == 0 )
00963     {fEcal = new TEcnaParEcal(SubDet.Data()); /*fCnew++*/ ;}
00964   else
00965     {fEcal = (TEcnaParEcal*)pEcal;}
00966 
00967   Int_t MaxCar = fgMaxCar;
00968   fFlagSubDet.Resize(MaxCar);
00969   fFlagSubDet = fEcal->GetEcalSubDetector();      // fFlagSubDet = "EB" or "EE"
00970 
00971   fEcalNumbering = 0;
00972   if( pEcalNumbering == 0 )
00973     {fEcalNumbering = new TEcnaNumbering(fFlagSubDet.Data(), fEcal); /*fCnew++*/ ;}
00974   else
00975     {fEcalNumbering = (TEcnaNumbering*)pEcalNumbering;}
00976 
00977   fCnaParHistos = 0;
00978   if( pCnaParHistos == 0 )
00979     {fCnaParHistos = new TEcnaParHistos(fFlagSubDet.Data(), fEcal, fEcalNumbering); /* fCnew++*/ ;}
00980   else
00981     {fCnaParHistos = (TEcnaParHistos*)pCnaParHistos;}
00982 
00983   fCnaWrite = 0;
00984   if( pCnaWrite == 0 )
00985     {fCnaWrite =
00986        new TEcnaWrite(fFlagSubDet.Data(), fCnaParPaths, fCnaParCout, fEcal, fEcalNumbering);  /*fCnew++*/ ;}
00987   else
00988     {fCnaWrite = (TEcnaWrite*)pCnaWrite;}
00989 
00990   //------------------- creation objet TEcnaRead fMyRootFile (a reprendre plus clairement)
00991   fFileHeader = 0;
00992   fMyRootFile = new TEcnaRead(fFlagSubDet.Data(), fCnaParPaths, fCnaParCout,
00993                               fFileHeader, fEcalNumbering, fCnaWrite);           fCnew++;
00994   fMyRootFile->PrintNoComment();
00995 
00996   //.................................. Init specific EB/EE parameters ( SetEcalSubDetector(...) )
00997   MaxCar = fgMaxCar;
00998   fFapStexName.Resize(MaxCar);
00999   fFapStexName = "no info for Stex";
01000   MaxCar = fgMaxCar;
01001   fFapStinName.Resize(MaxCar);
01002   fFapStinName = "no info for Stin";
01003   MaxCar = fgMaxCar;
01004   fFapEchaName.Resize(MaxCar);
01005   fFapEchaName = "no info for Echa";
01006 
01007   if( fFlagSubDet == "EB" )
01008     {
01009       fFapStexName   = "SM";
01010       fFapStinName   = "Tower";
01011       fFapEchaName   = "Xtal";
01012       fFapStexBarrel = fEcalNumbering->GetSMHalfBarrel(fFapStexNumber);
01013     }
01014 
01015   if( fFlagSubDet == "EE" )
01016     {
01017       fFapStexName     = "Dee";
01018       fFapStinName     = "SC";
01019       fFapEchaName     = "Xtal";
01020       fFapStexType     = fEcalNumbering->GetEEDeeType(fFapStexNumber);
01021       fFapStexDir      = "right";
01022       fFapStinQuadType = "top";
01023     }
01024 
01025 } // ---------------- end of  SetEcalSubDetector(...) ----------------
01026 
01027 //=============================================================================================
01028 //
01029 //                 Set lin or log scale on X or Y axis
01030 //                 Set Color Palette
01031 //
01032 //=============================================================================================
01033 void TEcnaHistos::SetHistoScaleX(const TString  option_scale)
01034 {
01035   fFlagScaleX = "LIN";
01036   if ( option_scale == "LOG" ){fFlagScaleX = "LOG";}
01037 }
01038 void TEcnaHistos::SetHistoScaleY(const TString  option_scale)
01039 {
01040   fFlagScaleY = "LIN";
01041   if ( option_scale == "LOG" ){fFlagScaleY = "LOG";}
01042 }
01043 void TEcnaHistos::SetHistoColorPalette (const TString  option_palette)
01044 {
01045   fFlagColPal = "Black/Red/Blue";
01046   if ( !(option_palette == "Rainbow" || option_palette == "rainbow") ){fFlagColPal = "Black/Red/Blue";}
01047   if (   option_palette == "Rainbow" || option_palette == "rainbow"  ){fFlagColPal = "Rainbow";}
01048 }
01049 
01050 void TEcnaHistos::SetGeneralTitle(const TString title)
01051 {
01052   fFlagGeneralTitle = title.Data();
01053 }
01054 
01055 //====================== return status for root file and data existence
01056 Bool_t TEcnaHistos::StatusFileFound(){return fStatusFileFound;}
01057 Bool_t TEcnaHistos::StatusDataExist(){return fStatusDataExist;}
01058 
01059 //=============================================================================================
01060 //
01061 //           View matrices
01062 //
01063 //=============================================================================================
01064 
01065 //------------------------------------------------------------------------------ Stin x Stin
01066 void TEcnaHistos::LowFrequencyMeanCorrelationsBetweenTowers(const TString  PlotOption)
01067                {LowFrequencyMeanCorrelationsBetweenStins(PlotOption);}
01068 void TEcnaHistos::LowFrequencyMeanCorrelationsBetweenSCs(const TString  PlotOption)
01069                {LowFrequencyMeanCorrelationsBetweenStins(PlotOption);}
01070 void TEcnaHistos::LowFrequencyMeanCorrelationsBetweenStins(const TString  PlotOption)
01071 {
01072 //Plot low frequency mean correlation matrix between Stins
01073 
01074   Int_t StexStin_A = 0;
01075   Int_t StexStin_B = 0;
01076   Int_t MatrixBinIndex = 0;
01077 
01078   TString MatrixProbaNature = fCorrelationMatrix;
01079   TString MatrixElement = fLFBetweenStins;
01080 
01081   ViewMatrix(StexStin_A, StexStin_B, MatrixBinIndex, MatrixProbaNature, MatrixElement, PlotOption);
01082 }
01083 
01084 void TEcnaHistos::HighFrequencyMeanCorrelationsBetweenTowers(const TString  PlotOption)
01085                {HighFrequencyMeanCorrelationsBetweenStins(PlotOption);}
01086 void TEcnaHistos::HighFrequencyMeanCorrelationsBetweenSCs(const TString  PlotOption)
01087                {HighFrequencyMeanCorrelationsBetweenStins(PlotOption);}
01088 void TEcnaHistos::HighFrequencyMeanCorrelationsBetweenStins(const TString  PlotOption)
01089 {
01090 //Plot low frequency mean correlation matrix between Stins
01091 
01092   Int_t StexStin_A = 0;
01093   Int_t StexStin_B = 0;
01094   Int_t MatrixBinIndex = 0;
01095 
01096   TString MatrixProbaNature = fCorrelationMatrix;
01097   TString MatrixElement  = fHFBetweenStins;
01098 
01099   ViewMatrix(StexStin_A, StexStin_B, MatrixBinIndex, MatrixProbaNature, MatrixElement, PlotOption);
01100 }
01101 
01102 //------------------------------------------------------------------------------ Crystal x Crystal
01103 void TEcnaHistos::LowFrequencyCorrelationsBetweenChannels(const Int_t&  aStexStin_A, const Int_t& aStexStin_B,
01104                                                           const TString PlotOption)
01105 {
01106   //Plot correlation matrix between crystals of two Stins (mean over samples)
01107   
01108   Int_t StexStin_A = aStexStin_A;
01109   Int_t StexStin_B = aStexStin_B;
01110   if( fFlagSubDet == "EE" )
01111     {
01112       StexStin_A = fEcalNumbering->Get1DeeSCEcnaFromDeeSCCons(fFapStexNumber, aStexStin_A);
01113       StexStin_B = fEcalNumbering->Get1DeeSCEcnaFromDeeSCCons(fFapStexNumber, aStexStin_B);
01114     }
01115 
01116   Int_t   MatrixBinIndex    = 0;
01117   TString MatrixProbaNature = fCorrelationMatrix;
01118   TString MatrixElement     = fLFBetweenChannels;
01119   ViewMatrix(StexStin_A, StexStin_B, MatrixBinIndex, MatrixProbaNature, MatrixElement, PlotOption);
01120 }
01121 
01122 void TEcnaHistos::LowFrequencyCovariancesBetweenChannels(const Int_t&  aStexStin_A, const Int_t& aStexStin_B,
01123                                                          const TString PlotOption)
01124 {
01125   //Plot covariance matrix between crystals of two Stins (mean over samples)
01126 
01127   Int_t StexStin_A = aStexStin_A;
01128   Int_t StexStin_B = aStexStin_B;
01129   if( fFlagSubDet == "EE" )
01130     {
01131       StexStin_A = fEcalNumbering->Get1DeeSCEcnaFromDeeSCCons(fFapStexNumber, aStexStin_A);
01132       StexStin_B = fEcalNumbering->Get1DeeSCEcnaFromDeeSCCons(fFapStexNumber, aStexStin_B);
01133     }
01134   
01135   Int_t   MatrixBinIndex     = 0;
01136   TString MatrixProbaNature  = fCovarianceMatrix;
01137   TString MatrixElement      = fLFBetweenChannels;
01138   ViewMatrix(StexStin_A, StexStin_B, MatrixBinIndex, MatrixProbaNature, MatrixElement, PlotOption);
01139 }
01140 
01141 void TEcnaHistos::HighFrequencyCorrelationsBetweenChannels(const Int_t&  aStexStin_A, const Int_t& aStexStin_B,
01142                                                            const TString PlotOption)
01143 {
01144   //Plot correlation matrix between crystals of two Stins (mean over samples)
01145 
01146   Int_t StexStin_A = aStexStin_A;
01147   Int_t StexStin_B = aStexStin_B;
01148   if( fFlagSubDet == "EE" )
01149     {
01150       StexStin_A = fEcalNumbering->Get1DeeSCEcnaFromDeeSCCons(fFapStexNumber, aStexStin_A);
01151       StexStin_B = fEcalNumbering->Get1DeeSCEcnaFromDeeSCCons(fFapStexNumber, aStexStin_B);
01152     }
01153   
01154   Int_t   MatrixBinIndex    = 0;
01155   TString MatrixProbaNature = fCorrelationMatrix;
01156   TString MatrixElement     = fHFBetweenChannels;
01157   ViewMatrix(StexStin_A, StexStin_B, MatrixBinIndex, MatrixProbaNature, MatrixElement, PlotOption);
01158 }
01159 
01160 void TEcnaHistos::HighFrequencyCovariancesBetweenChannels(const Int_t&  aStexStin_A, const Int_t& aStexStin_B,
01161                                                           const TString PlotOption)
01162 {
01163   //Plot covariance matrix between crystals of two Stins (mean over samples)
01164 
01165   Int_t StexStin_A = aStexStin_A;
01166   Int_t StexStin_B = aStexStin_B;
01167   if( fFlagSubDet == "EE" )
01168     {
01169       StexStin_A = fEcalNumbering->Get1DeeSCEcnaFromDeeSCCons(fFapStexNumber, aStexStin_A);
01170       StexStin_B = fEcalNumbering->Get1DeeSCEcnaFromDeeSCCons(fFapStexNumber, aStexStin_B);
01171     }
01172   
01173   Int_t   MatrixBinIndex    = 0;
01174   TString MatrixProbaNature = fCovarianceMatrix;
01175   TString MatrixElement     = fHFBetweenChannels;
01176   ViewMatrix(StexStin_A, StexStin_B, MatrixBinIndex, MatrixProbaNature, MatrixElement, PlotOption);
01177 }
01178 
01179 //------------------------------------------------------------------------------ Sample x Sample
01180 
01181 void TEcnaHistos::CorrelationsBetweenSamples(const Int_t&  aStexStin_A, const Int_t& i0StinEcha,
01182                                              const TString PlotOption)
01183 {
01184 //Plot correlation matrix between samples for a given i0StinEcha in a given StexStin
01185 
01186   Int_t StexStin_A = aStexStin_A;
01187   if( fFlagSubDet == "EE" )
01188     {StexStin_A = fEcalNumbering->Get1DeeSCEcnaFromDeeSCCons(fFapStexNumber, aStexStin_A);}
01189 
01190   Int_t   StexStin_B        = 0;
01191   TString MatrixProbaNature = fCorrelationMatrix;
01192   TString MatrixElement     = fBetweenSamples;
01193 
01194   ViewMatrix(StexStin_A, StexStin_B, i0StinEcha, MatrixProbaNature, MatrixElement, PlotOption);
01195 }
01196 
01197 //.............................................................................. Covariances
01198 void TEcnaHistos::CovariancesBetweenSamples(const Int_t&  aStexStin_A, const Int_t& i0StinEcha,
01199                                             const TString PlotOption)
01200 {
01201 //Plot covariance matrix between samples for a given i0StinEcha
01202 
01203   Int_t StexStin_A = aStexStin_A;
01204   if( fFlagSubDet == "EE" )
01205     {StexStin_A = fEcalNumbering->Get1DeeSCEcnaFromDeeSCCons(fFapStexNumber, aStexStin_A);}
01206 
01207   Int_t   StexStin_B        = 0;
01208   TString MatrixProbaNature = fCovarianceMatrix;
01209   TString MatrixElement     = fBetweenSamples;
01210 
01211   ViewMatrix(StexStin_A,  StexStin_B, i0StinEcha, MatrixProbaNature, MatrixElement, PlotOption);
01212 }
01213 //=============================================================================================================
01214 //
01215 //                                       ViewMatrix
01216 //     
01217 //      MatrixBinIndex:  = i0StinEcha if cov(s,s'), cor(s,s')
01218 //                       = 0          if cov(c,c'), cor(c,c'), cov(Stin,Stin'), cor(Stin,Stin')
01219 //
01220 //     ViewMatrix(StexStin_A , StexStin_B, MatrixBinIndex, MatrixProbaNature, MatrixElement, PlotOption)
01221 //     ViewMatrix(StexStin_A ,          0, i0StinEcha    , MatrixProbaNature, MatrixElement, PlotOption)      
01222 //     Output:
01223 //     Plot of cov(s,s') or cor(s,s') matrix for i0StinEcha of StexStin_A              
01224 //
01225 //     ViewMatrix(StexStin_A , StexStin_B, MatrixBinIndex, MatrixProbaNature, MatrixElement, PlotOption)
01226 //     ViewMatrix(StexStin_A , StexStin_B, 0             , MatrixProbaNature, MatrixElement, PlotOption)
01227 //     Output:
01228 //     Plot of (i0StinEcha of StexStin_A, i0StinEcha of StexStin_B) matrix
01229 //
01230 //=============================================================================================================
01231 void TEcnaHistos::ViewMatrix(const Int_t&  StexStin_A,     const Int_t&  StexStin_B,
01232                              const Int_t&  MatrixBinIndex, const TString MatrixProbaNature,
01233                              const TString MatrixElement,  const TString PlotOption)
01234 {
01235   //Plot correlation or covariance matrix between samples or channels or Stins
01236 
01237   if( (fFapStexNumber > 0) &&  (fFapStexNumber <= fEcal->MaxStexInStas()) )
01238     {
01239       fMyRootFile->PrintNoComment();
01240       fMyRootFile->GetReadyToReadRootFile(fFapAnaType,          fFapNbOfSamples,
01241                                           fFapRunNumber,        fFapFirstReqEvtNumber,
01242                                           fFapLastReqEvtNumber, fFapReqNbOfEvts,
01243                                           fFapStexNumber,       fCfgResultsRootFilePath.Data());
01244   
01245       if ( fMyRootFile->LookAtRootFile() == kTRUE )                         //  (ViewMatrix) 
01246         {
01247           fStatusFileFound = kTRUE;
01248 
01249           fFapNbOfEvts = GetNumberOfEvents(fMyRootFile, fFapReqNbOfEvts);
01250           TString fp_name_short = fMyRootFile->GetRootFileNameShort();
01251 
01252           // cout << "*TEcnaHistos::ViewMatrix(...)> Data are analyzed from file ----> "
01253           //      << fp_name_short << endl;
01254           //...................................................................... (ViewMatrix) 
01255           TVectorD  vStin(fEcal->MaxStinEcnaInStex());
01256           for(Int_t i=0; i<fEcal->MaxStinEcnaInStex(); i++){vStin(i)=(Double_t)0.;}
01257           vStin = fMyRootFile->ReadStinNumbers(fEcal->MaxStinEcnaInStex());
01258       
01259           if( fMyRootFile->DataExist() == kTRUE )
01260             {
01261               fStatusDataExist = kTRUE;
01262 
01263               Int_t Stin_X_ok = 0;
01264               Int_t Stin_Y_ok = 0;
01265           
01266               if( (MatrixElement == fLFBetweenStins) || (MatrixElement == fHFBetweenStins) )
01267                 {Stin_X_ok = 1; Stin_Y_ok = 1;}
01268               if( MatrixElement == fBetweenSamples )
01269                 {Stin_Y_ok = 1;}
01270           
01271               for (Int_t index_Stin = 0; index_Stin < fEcal->MaxStinEcnaInStex(); index_Stin++)
01272                 {
01273                   if ( vStin(index_Stin) == StexStin_A ){Stin_X_ok = 1;}
01274                   if ( vStin(index_Stin) == StexStin_B ){Stin_Y_ok = 1;}
01275                 }
01276               //................................................................. (ViewMatrix)
01277               if( Stin_X_ok == 1 && Stin_Y_ok == 1 )
01278                 {
01279                   fStartDate = fMyRootFile->GetStartDate();
01280                   fStopDate  = fMyRootFile->GetStopDate();
01281                   fRunType   = fMyRootFile->GetRunType();
01282 
01283                   Int_t MatSize      = -1; 
01284                   Int_t ReadMatSize  = -1; 
01285                   Int_t i0StinEcha   = -1;
01286               
01287                   //-------------------------- Set values of ReadMatSize, MatSize, i0StinEcha
01288                   if( MatrixElement == fBetweenSamples )
01289                     {ReadMatSize = fFapNbOfSamples; MatSize = fEcal->MaxSampADC(); i0StinEcha=(Int_t)MatrixBinIndex;}
01290 
01291                   if( MatrixElement == fLFBetweenChannels || MatrixElement == fHFBetweenChannels )
01292                     {ReadMatSize = fEcal->MaxCrysInStin(); MatSize = fEcal->MaxCrysInStin(); /*i0Sample=MatrixBinIndex;*/}
01293 
01294                   if( (MatrixElement == fLFBetweenStins) || (MatrixElement == fHFBetweenStins) )
01295                     {ReadMatSize = fEcal->MaxStinEcnaInStex(); MatSize = fEcal->MaxStinInStex();}
01296  
01297                   //------------------------------------------------------------------------------------- (ViewMatrix)
01298                   if( ( MatrixElement == fLFBetweenStins    || MatrixElement == fHFBetweenStins    ) ||
01299                       ( MatrixElement == fLFBetweenChannels || MatrixElement == fHFBetweenChannels 
01300                         /* && (i0Sample  >= 0) && (i0Sample  < fFapNbOfSamples ) */ ) ||
01301                       ( (MatrixElement == fBetweenSamples) && (i0StinEcha >= 0) && (i0StinEcha < fEcal->MaxCrysInStin()) ) )
01302                     {
01303                       TMatrixD read_matrix(ReadMatSize, ReadMatSize);
01304                       for(Int_t i=0; i<ReadMatSize; i++)
01305                         {for(Int_t j=0; j<ReadMatSize; j++){read_matrix(i,j)=(Double_t)0.;}}
01306                  
01307                       if ( MatrixElement == fBetweenSamples && MatrixProbaNature == fCovarianceMatrix )
01308                         {read_matrix =
01309                            fMyRootFile->ReadCovariancesBetweenSamples(StexStin_A, i0StinEcha, ReadMatSize);}
01310                       if ( MatrixElement == fBetweenSamples && MatrixProbaNature == fCorrelationMatrix )
01311                         {read_matrix =
01312                            fMyRootFile->ReadCorrelationsBetweenSamples(StexStin_A, i0StinEcha, ReadMatSize);}
01313 
01314                       if ( MatrixElement == fLFBetweenChannels && MatrixProbaNature == fCovarianceMatrix )
01315                         {read_matrix =
01316                            fMyRootFile->ReadLowFrequencyCovariancesBetweenChannels(StexStin_A, StexStin_B, ReadMatSize);}
01317                       if ( MatrixElement == fLFBetweenChannels && MatrixProbaNature == fCorrelationMatrix )
01318                         {read_matrix =
01319                            fMyRootFile->ReadLowFrequencyCorrelationsBetweenChannels(StexStin_A, StexStin_B, ReadMatSize);}
01320 
01321                       if ( MatrixElement == fHFBetweenChannels && MatrixProbaNature == fCovarianceMatrix )
01322                         {read_matrix =
01323                            fMyRootFile->ReadHighFrequencyCovariancesBetweenChannels(StexStin_A, StexStin_B, ReadMatSize);}
01324                       if ( MatrixElement == fHFBetweenChannels && MatrixProbaNature == fCorrelationMatrix )
01325                         {read_matrix =
01326                            fMyRootFile->ReadHighFrequencyCorrelationsBetweenChannels(StexStin_A, StexStin_B, ReadMatSize);}
01327 
01328                       if ( MatrixElement == fLFBetweenStins && MatrixProbaNature == fCorrelationMatrix )
01329                         {read_matrix =
01330                            fMyRootFile->ReadLowFrequencyMeanCorrelationsBetweenStins(ReadMatSize);}
01331                       if ( MatrixElement == fHFBetweenStins && MatrixProbaNature == fCorrelationMatrix )
01332                         {read_matrix =
01333                            fMyRootFile->ReadHighFrequencyMeanCorrelationsBetweenStins(ReadMatSize);}
01334 
01335                       //.......................................................... (ViewMatrix)
01336                       if( fMyRootFile->DataExist() == kTRUE )
01337                         {
01338                           fStatusDataExist = kTRUE;
01339 
01340                           if( PlotOption == "ASCII" )
01341                             {
01342                               WriteMatrixAscii(MatrixElement, MatrixProbaNature, 
01343                                                StexStin_A, MatrixBinIndex, ReadMatSize, read_matrix);
01344                             }
01345                           else
01346                             {
01347                               //......................... matrix title  (ViewMatrix)
01348                               char* f_in_mat_tit = new char[fgMaxCar];               fCnew++;
01349                           
01350                               if( MatrixElement == fBetweenSamples && MatrixProbaNature == fCovarianceMatrix )
01351                                 {sprintf(f_in_mat_tit, "Covariance(Sample, Sample')");}
01352                               if( MatrixElement == fBetweenSamples && MatrixProbaNature == fCorrelationMatrix )
01353                                 {sprintf(f_in_mat_tit, "Correlation(Sample, Sample')");}
01354 
01355                               if(fFlagSubDet == "EB" )
01356                                 {
01357                                   if( MatrixElement == fLFBetweenStins && MatrixProbaNature == fCorrelationMatrix )
01358                                     {sprintf(f_in_mat_tit,
01359                                              "Mean LF |Cor(Xtal,Xtal')| for each (Tower,Tower')");}
01360                                   if( MatrixElement == fHFBetweenStins && MatrixProbaNature == fCorrelationMatrix )
01361                                     {sprintf(f_in_mat_tit,
01362                                              "Mean HF |Cor(Xtal,Xtal')| for each (Tower,Tower')");}
01363                                 }
01364                               if(fFlagSubDet == "EE" )
01365                                 {
01366                                   if( MatrixElement == fLFBetweenStins && MatrixProbaNature == fCorrelationMatrix )
01367                                     {sprintf(f_in_mat_tit,
01368                                              "Mean LF |Cor(Xtal,Xtal')| for each (SC,SC')");}
01369                                   if( MatrixElement == fHFBetweenStins && MatrixProbaNature == fCorrelationMatrix )
01370                                     {sprintf(f_in_mat_tit,
01371                                              "Mean HF |Cor(Xtal,Xtal')| for each (SC,SC')");}
01372                                 }
01373 
01374                               if( MatrixElement == fLFBetweenChannels && MatrixProbaNature == fCorrelationMatrix )
01375                                 {
01376                                   if( fFlagSubDet == "EB" )
01377                                     {sprintf(f_in_mat_tit, "LF Cor(Xtal,Xtal') matrix elts for (Tow,Tow')");}
01378                                   if( fFlagSubDet == "EE" )
01379                                     {sprintf(f_in_mat_tit, "LF Cor(Xtal,Xtal') matrix elts for (SC,SC')");}
01380                                 }
01381                               if( MatrixElement == fHFBetweenChannels && MatrixProbaNature == fCorrelationMatrix )
01382                                 {
01383                                   if( fFlagSubDet == "EB" )
01384                                     {sprintf(f_in_mat_tit, "HF Cor(Xtal,Xtal') matrix elts for (Tow,Tow')");}
01385                                   if( fFlagSubDet == "EE" )
01386                                     {sprintf(f_in_mat_tit, "LF Cor(Xtal,Xtal') matrix elts for (SC,SC')");}
01387                                 }
01388                           
01389                               //................................. Axis parameters (ViewMatrix)
01390                               TString axis_x_var_name;
01391                               TString axis_y_var_name;
01392                           
01393                               char* f_in_axis_x = new char[fgMaxCar];               fCnew++;
01394                               char* f_in_axis_y = new char[fgMaxCar];               fCnew++;
01395                           
01396                               if( MatrixElement == fLFBetweenStins || MatrixElement == fHFBetweenStins )
01397                                 {
01398                                   if( fFlagSubDet == "EB" )
01399                                     {sprintf(f_in_axis_x, " %s number  ", fFapStinName.Data());}
01400                                   if( fFlagSubDet == "EE" )
01401                                     {sprintf(f_in_axis_x, " %s number for construction ", fFapStinName.Data());}
01402 
01403                                   axis_x_var_name = f_in_axis_x; axis_y_var_name = f_in_axis_x;
01404                                 }      
01405                               if( MatrixElement == fBetweenSamples)
01406                                 {
01407                                   axis_x_var_name = " Sample      "; axis_y_var_name = "    Sample ";
01408                                 }
01409                               if( MatrixElement == fLFBetweenChannels || MatrixElement == fHFBetweenChannels ){
01410                                 sprintf(f_in_axis_x, " Crystal %s %d   ", fFapStinName.Data(), StexStin_A);
01411                                 sprintf(f_in_axis_y, " Crystal %s %d   ", fFapStinName.Data(),StexStin_B);
01412                                 axis_x_var_name = f_in_axis_x; axis_y_var_name = f_in_axis_y;}
01413                           
01414                               Int_t  nb_binx  = MatSize;
01415                               Int_t  nb_biny  = MatSize;
01416                               Axis_t xinf_bid = (Axis_t)0.;
01417                               Axis_t xsup_bid = (Axis_t)MatSize;
01418                               Axis_t yinf_bid = (Axis_t)0.;
01419                               Axis_t ysup_bid = (Axis_t)MatSize;   
01420                           
01421                               if( (fFlagSubDet == "EE") &&
01422                                   (MatrixElement == fLFBetweenStins || MatrixElement == fHFBetweenStins) )
01423                                 {
01424                                   if( fFapStexNumber == 1 || fFapStexNumber == 3 )
01425                                     {
01426                                       xinf_bid += fEcal->MaxStinInStex();
01427                                       xsup_bid += fEcal->MaxStinInStex();
01428                                       yinf_bid += fEcal->MaxStinInStex();
01429                                       ysup_bid += fEcal->MaxStinInStex();
01430                                     }
01431                                 }
01432                               //...................................................  histogram booking (ViewMatrix)
01433                               TH2D* h_fbid0 = new TH2D("bidim", f_in_mat_tit,
01434                                                        nb_binx, xinf_bid, xsup_bid,
01435                                                        nb_biny, yinf_bid, ysup_bid);     fCnewRoot++;
01436                               h_fbid0->Reset();
01437                           
01438                               h_fbid0->GetXaxis()->SetTitle(axis_x_var_name);
01439                               h_fbid0->GetYaxis()->SetTitle(axis_y_var_name);
01440                           
01441                               //------------------------------------------------  F I L L    H I S T O
01442                               if( (fFlagSubDet == "EE") &&
01443                                   (MatrixElement == fLFBetweenStins || MatrixElement == fHFBetweenStins) )
01444                                 {
01445                                   for(Int_t i = 0 ; i < ReadMatSize ; i++)
01446                                     {
01447                                       for(Int_t j = 0 ; j < ReadMatSize ; j++)
01448                                         {
01449                                           Double_t xi_bid =
01450                                             (Double_t)fEcalNumbering->GetDeeSCConsFrom1DeeSCEcna(fFapStexNumber, i+1);
01451                                           Double_t xj_bid =
01452                                             (Double_t)fEcalNumbering->GetDeeSCConsFrom1DeeSCEcna(fFapStexNumber, j+1);
01453                                           if( xi_bid > 0 && xj_bid > 0 )
01454                                             {h_fbid0->Fill(xi_bid-1, xj_bid-1, read_matrix(i,j));}
01455                                         }
01456                                     }
01457                                 }
01458                               else
01459                                 {
01460                                   for(Int_t i = 0 ; i < ReadMatSize ; i++)
01461                                     {
01462                                       Double_t xi = (Double_t)i;
01463                                       for(Int_t j = 0 ; j < ReadMatSize ; j++)
01464                                         {
01465                                           Double_t xj      = (Double_t)j;
01466                                           Double_t mat_val = (Double_t)read_matrix(i,j);
01467                                           h_fbid0->Fill(xi, xj, (Double_t)mat_val);
01468                                         }
01469                                     }
01470                                 }
01471                               //--------------- H I S T O   M I N / M A X   M A N A G E M E N T   (ViewMatrix)
01472                           
01473                               //................................ Put histo min max values
01474                               TString quantity_code = "D_MCs_ChNb";
01475                               if ( MatrixProbaNature == fCorrelationMatrix )
01476                                 {
01477                                   if( MatrixElement == fBetweenSamples ){quantity_code = "D_MCs_ChNb";}
01478 
01479                                   if( MatrixElement == fLFBetweenChannels  ){quantity_code = "H2LFccMosMatrix";}
01480                                   if( MatrixElement == fHFBetweenChannels ){quantity_code = "H2HFccMosMatrix";}
01481 
01482                                   if( MatrixElement == fLFBetweenStins  ){quantity_code = "H2LFccMosMatrix";}
01483                                   if( MatrixElement == fHFBetweenStins ){quantity_code = "H2HFccMosMatrix";}
01484                                 }
01485                               if( MatrixProbaNature == fCovarianceMatrix ){quantity_code = "H2HFccMosMatrix";}
01486                               //.......... default if flag not set to "ON"
01487                               SetYminMemoFromValue(quantity_code, fCnaParHistos->GetYminDefaultValue(quantity_code));
01488                               SetYmaxMemoFromValue(quantity_code, fCnaParHistos->GetYmaxDefaultValue(quantity_code));
01489 
01490                               if( fUserHistoMin == fUserHistoMax ){fFlagUserHistoMin = "AUTO"; fFlagUserHistoMax = "AUTO";}
01491                               //................................. User's min and/or max
01492                               if( fFlagUserHistoMin == "ON" )
01493                                 {SetYminMemoFromValue(quantity_code, fUserHistoMin); fFlagUserHistoMin = "OFF";}
01494                               if( fFlagUserHistoMax == "ON" )
01495                                 {SetYmaxMemoFromValue(quantity_code, fUserHistoMax); fFlagUserHistoMax = "OFF";}
01496                               //................................. automatic min and/or max
01497                               if( fFlagUserHistoMin == "AUTO" )
01498                                 {SetYminMemoFromValue(quantity_code, h_fbid0->GetMinimum()); fFlagUserHistoMin = "OFF";}
01499                               if( fFlagUserHistoMax == "AUTO" )
01500                                 {SetYmaxMemoFromValue(quantity_code, h_fbid0->GetMaximum()); fFlagUserHistoMax = "OFF";}
01501                               //...................................... histo set ymin and ymax  (ViewMatrix)    
01502                               Int_t  xFlagAutoYsupMargin = 0;
01503                           
01504                               if( MatrixProbaNature == fCorrelationMatrix )
01505                                 {
01506                                   if(MatrixElement == fBetweenSamples)
01507                                     {xFlagAutoYsupMargin = SetHistoFrameYminYmaxFromMemo((TH1D*)h_fbid0, "D_MCs_ChNb");}
01508                                   if( MatrixElement == fLFBetweenStins  || MatrixElement == fLFBetweenChannels  )
01509                                     {xFlagAutoYsupMargin = SetHistoFrameYminYmaxFromMemo((TH1D*)h_fbid0, "H2LFccMosMatrix");}
01510                                   if( MatrixElement == fHFBetweenStins || MatrixElement == fHFBetweenChannels )
01511                                     {xFlagAutoYsupMargin = SetHistoFrameYminYmaxFromMemo((TH1D*)h_fbid0, "H2HFccMosMatrix");}
01512                                   //************************** A GARDER EN RESERVE ******************************
01513                                   //............. special contour level for correlations (square root wise scale)
01514                                   // Int_t nb_niv  = 9;
01515                                   // Double_t* cont_niv = new Double_t[nb_niv];                  fCnew++;
01516                                   // SqrtContourLevels(nb_niv, &cont_niv[0]);
01517                                   // h_fbid0->SetContour(nb_niv, &cont_niv[0]);           
01518                                   // delete [] cont_niv;                                  fCdelete++;
01519                                   //******************************** (FIN RESERVE) ****************************** 
01520                                 }
01521                               if( MatrixProbaNature == fCovarianceMatrix )
01522                                 {
01523                                   if (MatrixElement == fBetweenSamples)
01524                                     {SetYminMemoFromPreviousMemo("D_TNo_ChNb");   // covariance => same level as sigmas
01525                                     SetYmaxMemoFromPreviousMemo("D_TNo_ChNb");
01526                                     xFlagAutoYsupMargin = SetHistoFrameYminYmaxFromMemo((TH1D*)h_fbid0, "D_TNo_ChNb");}
01527                                   if ( MatrixElement == fLFBetweenStins || MatrixElement == fHFBetweenStins ||
01528                                        MatrixElement == fLFBetweenChannels || MatrixElement == fHFBetweenChannels )
01529                                     {xFlagAutoYsupMargin = SetHistoFrameYminYmaxFromMemo((TH1D*)h_fbid0, "H2HFccMosMatrix");}
01530                                 }
01531                           
01532                               // ----------------------------------------------- P L O T S  (ViewMatrix)
01533                               char* f_in = new char[fgMaxCar];          fCnew++;
01534                           
01535                               //...................... Taille/format canvas
01536                           
01537                               UInt_t canv_w = fCnaParHistos->CanvasFormatW("petit");
01538                               UInt_t canv_h = fCnaParHistos->CanvasFormatH("petit");
01539                           
01540                               //............................. options generales 
01541                               TString HistoType;
01542                               Int_t MaxCar = fgMaxCar;
01543                               HistoType.Resize(MaxCar);
01544                               HistoType = "(no quantity type info)";
01545                           
01546                               if (PlotOption == "COLZ"  ){HistoType = "colz";}
01547                               if (PlotOption == "BOX"   ){HistoType = "colz";}
01548                               if (PlotOption == "TEXT"  ){HistoType = "colz";}
01549                               if (PlotOption == "CONTZ" ){HistoType = "colz";}
01550                               if (PlotOption == "LEGO2Z"){HistoType = "lego";}
01551                               if (PlotOption == "SURF1Z"){HistoType = "surf";}
01552                               if (PlotOption == "SURF2Z"){HistoType = "surf";}
01553                               if (PlotOption == "SURF3Z"){HistoType = "surf";}
01554                               if (PlotOption == "SURF4" ){HistoType = "surf";}
01555 
01556                               if( fFlagSubDet == "EB" )
01557                                 {
01558                                   fFapStexBarrel = fEcalNumbering->GetSMHalfBarrel(fFapStexNumber);
01559                                   SetAllPavesViewMatrix(MatrixElement.Data(), StexStin_A, StexStin_B, i0StinEcha);
01560                                 }
01561                               if( fFlagSubDet == "EE" )
01562                                 {
01563                                   fFapStexType = fEcalNumbering->GetEEDeeType(fFapStexNumber);
01564                                   fFapStinQuadType = fEcalNumbering->GetSCQuadFrom1DeeSCEcna(StexStin_A);
01565                                   SetAllPavesViewMatrix(MatrixElement.Data(), StexStin_A, StexStin_B, i0StinEcha);
01566                                 }
01567 
01568                               //---------------------------------------- Canvas name (ViewMatrix)
01569                               TString  name_cov_cor;
01570                               MaxCar = fgMaxCar;
01571                               name_cov_cor.Resize(MaxCar);
01572                               name_cov_cor = "?";
01573                               if( MatrixProbaNature == fCovarianceMatrix){name_cov_cor = "Covariance";}
01574                               if( MatrixProbaNature == fCorrelationMatrix){name_cov_cor = "Correlation";}
01575                           
01576                               TString name_chan_samp;
01577                               MaxCar = fgMaxCar;
01578                               name_chan_samp.Resize(MaxCar);
01579                               name_chan_samp = "?";
01580                           
01581                               if( MatrixElement == fLFBetweenStins ){name_chan_samp = "LFccMos";}
01582                               if( MatrixElement == fHFBetweenStins ){name_chan_samp = "HFccMos"; }
01583 
01584                               if( MatrixElement == fLFBetweenChannels ){name_chan_samp = "LF_cc";}
01585                               if( MatrixElement == fHFBetweenChannels ){name_chan_samp = "HF_cc";}
01586                 
01587                               if(MatrixElement == fBetweenSamples)
01588                                 {
01589                                   name_chan_samp = "Between_Samples";  // MatrixBinIndex = i0StinEcha
01590                                 }
01591 
01592                               TString name_visu;
01593                               MaxCar = fgMaxCar;
01594                               name_visu.Resize(MaxCar);
01595                               name_visu = "?";
01596                           
01597                               name_visu = PlotOption;
01598                           
01599                               if( (MatrixElement == fLFBetweenStins) || (MatrixElement == fHFBetweenStins) ){
01600                                 sprintf(f_in, "%s_%s_%s_S1_%d_R%d_%d_%d_%s%d_%s",
01601                                         name_cov_cor.Data(), name_chan_samp.Data(),
01602                                         fFapAnaType.Data(), fFapNbOfSamples, fFapRunNumber,
01603                                         fFapFirstReqEvtNumber, fFapLastReqEvtNumber,
01604                                         fFapStexName.Data(), fFapStexNumber,
01605                                         name_visu.Data());}
01606 
01607                               if( MatrixElement == fLFBetweenChannels || MatrixElement == fHFBetweenChannels ){
01608                                 sprintf(f_in, "%s_%s_%s_S1_%d_R%d_%d_%d_%s%d_%sX%d_%sY%d_%s",
01609                                         name_cov_cor.Data(), name_chan_samp.Data(),
01610                                         fFapAnaType.Data(), fFapNbOfSamples, fFapRunNumber,
01611                                         fFapFirstReqEvtNumber, fFapLastReqEvtNumber,
01612                                         fFapStexName.Data(), fFapStexNumber,
01613                                         fFapStexName.Data(), StexStin_A, fFapStexName.Data(), StexStin_B,
01614                                         name_visu.Data());}
01615                                                   
01616                               if( MatrixElement == fBetweenSamples ){
01617                                 sprintf(f_in, "%s_%s_%s_S1_%d_R%d_%d_%d_%s%d_%sX%d_%sY%d_ElecChannel_%d_%s",
01618                                         name_cov_cor.Data(), name_chan_samp.Data(),
01619                                         fFapAnaType.Data(), fFapNbOfSamples, fFapRunNumber,
01620                                         fFapFirstReqEvtNumber, fFapLastReqEvtNumber,
01621                                         fFapStexName.Data(), fFapStexNumber,
01622                                         fFapStexName.Data(), StexStin_A,  fFapStexName.Data(), StexStin_B,
01623                                         MatrixBinIndex,
01624                                         name_visu.Data());}
01625                           
01626                               //----------------------------------------------------------      (ViewMatrix)
01627 
01628                               SetHistoPresentation((TH1D*)h_fbid0, HistoType);
01629                               TCanvas *MainCanvas = new TCanvas(f_in, f_in, canv_w , canv_h);   fCnewRoot++;
01630                               fCurrentCanvas = MainCanvas; fCurrentCanvasName = f_in;
01631                           
01632                               // cout << "*TEcnaHistos::ViewMatrix(...)> Plot is displayed on canvas ----> "
01633                               //      << fCurrentCanvasName << endl;
01634                               // cout << "*TEcnaHistos::ViewMatrix(...)> fCurrentCanvas = " << fCurrentCanvas << endl;
01635                           
01636                               delete [] f_in; f_in = 0;                         fCdelete++;
01637 
01638                               if( fPavComGeneralTitle != 0 ){fPavComGeneralTitle->Draw();}
01639                               fPavComStex->Draw();
01640 
01641                               if(MatrixElement == fLFBetweenChannels || MatrixElement == fHFBetweenChannels)
01642                                 {fPavComStin->Draw();}
01643                               if(MatrixElement == fBetweenSamples)
01644                                 {fPavComStin->Draw(); fPavComXtal->Draw();}
01645 
01646                               fPavComAnaRun->Draw();
01647                               fPavComNbOfEvts->Draw();
01648 
01649                               Double_t x_margin = fCnaParHistos->BoxLeftX("bottom_left_box") - 0.005;
01650                               Double_t y_margin = fCnaParHistos->BoxTopY("bottom_right_box") + 0.005;
01651                               MainCanvas->Divide(1, 1, x_margin, y_margin);
01652                               gPad->cd(1);
01653 
01654                               //----------------------------------------------------------      (ViewMatrix)      
01655                               Int_t logy = 0;  
01656                               gPad->SetLogy(logy);
01657                               if( (MatrixElement == fLFBetweenStins) ||
01658                                   (MatrixElement == fHFBetweenStins) ){gPad->SetGrid(1,1);}
01659                               h_fbid0->DrawCopy(PlotOption);
01660                               h_fbid0->SetStats((Bool_t)1);    
01661                               gPad->Update();
01662                               h_fbid0->Delete();  h_fbid0 = 0;              fCdeleteRoot++;
01663                           
01664                               //MainCanvas->Delete();                 fCdeleteRoot++;
01665                               delete [] f_in_axis_x;  f_in_axis_x  = 0;       fCdelete++;
01666                               delete [] f_in_axis_y;  f_in_axis_y  = 0;       fCdelete++;
01667                               delete [] f_in_mat_tit; f_in_mat_tit = 0;       fCdelete++;
01668                             }
01669                         } // end of if ( fMyRootFile->DataExist() == kTRUE )
01670                       else
01671                         {
01672                           fStatusDataExist = kFALSE;
01673                         }
01674                     } // end of if ((MatrixElement == fLFBetweenStins) || (MatrixElement == fHFBetweenStins)  ) ||
01675                       //( (MatrixElement == fBetweenSamples) && (i0StinEcha>= 0) && (i0StinEcha<fEcal->MaxCrysInStin())) ||
01676                       //( (MatrixElement == fLFBetweenChannels || MatrixElement == fHFBetweenChannels)
01677                       // /* && (i0Sample  >= 0) && (i0Sample  < fFapNbOfSamples ) */ ) )
01678                   else
01679                     {
01680                       if(MatrixElement == fBetweenSamples)
01681                         {
01682                           cout << "*TEcnaHistos::ViewMatrix(...)> *ERROR* ==> Wrong channel number in "
01683                                << fFapStinName.Data() << ". Value = "
01684                                << i0StinEcha << " (required range: [0, "
01685                                << fEcal->MaxCrysInStin()-1 << "] )"
01686                                << fTTBELL << endl;
01687                         }
01688 
01689                      // if( MatrixElement == fLFBetweenChannels || MatrixElement == fHFBetweenChannels )
01690                      // {
01691                          // cout << "*TEcnaHistos::ViewMatrix(...)> *ERROR* ==> Wrong sample index. Value = "
01692                          //      << i0Sample << " (required range: [0, "
01693                          //      << fFapNbOfSamples-1 << "] )"
01694                          //      << fTTBELL << endl;
01695                         //}
01696                     }
01697                 }
01698               else    // else of the if ( Stin_X_ok ==1 && Stin_Y_ok ==1 )
01699                 {
01700                   //----------------------------------------------------------  (ViewMatrix)
01701                   if ( Stin_X_ok != 1 )
01702                     {
01703                       cout << "*TEcnaHistos::ViewMatrix(...)> *ERROR* =====> "
01704                            << fFapStinName.Data() << " "
01705                            << fEcalNumbering->GetDeeSCConsFrom1DeeSCEcna(fFapStexNumber, StexStin_A) << ", "
01706                            << fFapStinName.Data() << " not found. Available numbers = ";
01707                       for(Int_t i = 0; i < fEcal->MaxStinEcnaInStex(); i++)
01708                         {
01709                           if( vStin(i) > 0 )
01710                             {
01711                               cout << fEcalNumbering->GetDeeSCConsFrom1DeeSCEcna(fFapStexNumber, (Int_t)vStin(i)) << ", ";
01712                             }
01713                         }
01714                       cout << fTTBELL << endl;
01715                     }
01716                   if ( Stin_Y_ok != 1 )
01717                     {
01718                       cout << "*TEcnaHistos::ViewMatrix(...)> *ERROR* =====> "
01719                            << fFapStinName.Data() << " "
01720                            << fEcalNumbering->GetDeeSCConsFrom1DeeSCEcna(fFapStexNumber, StexStin_B) << ", "
01721                            << fFapStinName.Data() << " not found. Available numbers = ";
01722                       for(Int_t i = 0; i < fEcal->MaxStinEcnaInStex(); i++)
01723                         {
01724                           if( vStin(i) > 0 )
01725                             {
01726                               cout << fEcalNumbering->GetDeeSCConsFrom1DeeSCEcna(fFapStexNumber, (Int_t)vStin(i)) << ", ";
01727                             }
01728                         }
01729                       cout << fTTBELL << endl;
01730                     }
01731                 }
01732             } // end of if ( fMyRootFile->DataExist() == kTRUE )
01733           else
01734             {
01735               fStatusDataExist = kFALSE;
01736             }
01737         } // end of if ( fMyRootFile->LookAtRootFile() == kTRUE )
01738       else
01739         {
01740           fStatusFileFound = kFALSE;
01741           cout  << "!TEcnaHistos::ViewMatrix(...)> *ERROR* =====> "
01742                 << " ROOT file not found" << fTTBELL << endl;
01743         }
01744     } // ---- end of if( (fFapStexNumber > 0) &&  (fFapStexNumber <= fEcal->MaxStexInStas()) ) -----
01745   else
01746     {
01747       cout << "!TEcnaHistos::ViewMatrix(...)> " << fFapStexName.Data()
01748            << " = " << fFapStexNumber << ". Out of range (range = [1,"
01749            << fEcal->MaxStexInStas() << "]) " << fTTBELL << endl;
01750     }
01751 }  // end of ViewMatrix(...)
01752 
01753 //==========================================================================
01754 //
01755 //                         ViewStin   ( => option COLZ )
01756 //   
01757 //==========================================================================
01758 
01759 void TEcnaHistos::CorrelationsBetweenSamples(const Int_t& StinNumber)
01760 {
01761   TString   MatrixProbaNature = fCorrelationMatrix;
01762   ViewStin(StinNumber, MatrixProbaNature);
01763 }
01764 
01765 void TEcnaHistos::CovariancesBetweenSamples(const Int_t& StinNumber)
01766 {
01767   TString   MatrixProbaNature = fCovarianceMatrix;
01768   ViewStin(StinNumber, MatrixProbaNature);
01769 }
01770 
01771 //==========================================================================
01772 //
01773 //                         ViewStin   ( => option COLZ )   
01774 //
01775 //  StexStin ==>
01776 //  (sample,sample) cor or cov matrices for all the crystal of StexStin              
01777 //
01778 //
01779 //==========================================================================
01780 void TEcnaHistos::ViewStin(const Int_t& cStexStin, const TString MatrixProbaNature)
01781 {
01782   //cor(s,s') or cov(s,s') matrices for all the crystals of one given Stin. Option COLZ mandatory.
01783 
01784   // cStexStin = number for cons (in case of EE)
01785   // StexStin   = ECNA number
01786 
01787   if( (fFapStexNumber > 0) &&  fFapStexNumber <= fEcal->MaxStexInStas() )
01788     {
01789       Int_t StexStin =  cStexStin; 
01790       if(fFlagSubDet == "EE" )
01791         {StexStin = fEcalNumbering->Get1DeeSCEcnaFromDeeSCCons(fFapStexNumber, cStexStin);}
01792 
01793       fMyRootFile->PrintNoComment();
01794       fMyRootFile->GetReadyToReadRootFile(fFapAnaType,          fFapNbOfSamples,
01795                                           fFapRunNumber,        fFapFirstReqEvtNumber,
01796                                           fFapLastReqEvtNumber, fFapReqNbOfEvts,
01797                                           fFapStexNumber,       fCfgResultsRootFilePath.Data());
01798 
01799       if ( fMyRootFile->LookAtRootFile() == kTRUE )              //  (ViewStin)
01800         {
01801           fStatusFileFound = kTRUE;
01802 
01803           fFapNbOfEvts = GetNumberOfEvents(fMyRootFile, fFapReqNbOfEvts);
01804           TString fp_name_short = fMyRootFile->GetRootFileNameShort(); 
01805           // cout << "*TEcnaHistos::ViewStin(...)> Data are analyzed from file ----> "
01806           //      << fp_name_short << endl;
01807 
01808           TVectorD vStin(fEcal->MaxStinEcnaInStex());
01809           for(Int_t i=0; i<fEcal->MaxStinEcnaInStex(); i++){vStin(i)=(Double_t)0.;}
01810           vStin = fMyRootFile->ReadStinNumbers(fEcal->MaxStinEcnaInStex());
01811 
01812           if ( fMyRootFile->DataExist() == kTRUE )
01813             {
01814               fStatusDataExist = kTRUE;
01815 
01816               Int_t Stin_ok = 0;
01817               for (Int_t index_Stin = 0; index_Stin < fEcal->MaxStinEcnaInStex(); index_Stin++)
01818                 {
01819                   if ( vStin(index_Stin) == StexStin ){Stin_ok++;}
01820                 }
01821 
01822               if( Stin_ok == 1)
01823                 {
01824                   fStartDate = fMyRootFile->GetStartDate();
01825                   fStopDate  = fMyRootFile->GetStopDate();
01826                   fRunType   = fMyRootFile->GetRunType();
01827               
01828                   //......................... matrix title                              (ViewStin)
01829                   char* f_in_mat_tit = new char[fgMaxCar];               fCnew++;
01830               
01831                   if ( MatrixProbaNature == fCovarianceMatrix )
01832                     {sprintf(f_in_mat_tit, "Xtal's Cov(s,s') matrices in %s.",
01833                              fFapStinName.Data());}
01834                   if ( MatrixProbaNature == fCorrelationMatrix )
01835                     {sprintf(f_in_mat_tit, "Xtal's Cor(s,s') matrices in %s.",
01836                              fFapStinName.Data());}
01837 
01838                   //................................. Bidim parameters
01839                   Int_t  GeoBidSize = fEcal->MaxSampADC()*fEcal->MaxCrysHocoInStin(); 
01840                   Int_t  nb_binx  = GeoBidSize;
01841                   Int_t  nb_biny  = GeoBidSize;
01842                   Axis_t xinf_bid = (Axis_t)0.;
01843                   Axis_t xsup_bid = (Axis_t)GeoBidSize;
01844                   Axis_t yinf_bid = (Axis_t)0.;
01845                   Axis_t ysup_bid = (Axis_t)GeoBidSize;   
01846       
01847                   //--------------------------------------------------------- (ViewStin)
01848                   //............. matrices reading and histogram filling
01849       
01850                   TH2D* h_geo_bid = new TH2D("geobidim", f_in_mat_tit,
01851                                              nb_binx, xinf_bid, xsup_bid,
01852                                              nb_biny, yinf_bid, ysup_bid);     fCnewRoot++;
01853           
01854                   h_geo_bid->Reset();
01855 
01856                   //======================================================== (ViewStin)
01857           
01858                   //----------------------------------------------- Geographical bidim filling
01859                   Int_t  ReadMatSize = fFapNbOfSamples;
01860                   Int_t  MatSize     = fEcal->MaxSampADC();
01861                   TMatrixD read_matrix(ReadMatSize, ReadMatSize);
01862                   for(Int_t i=0; i<ReadMatSize; i++){for(Int_t j=0; j<ReadMatSize; j++)
01863                     {read_matrix(i,j)=(Double_t)0.;}}
01864 
01865                   Int_t i_data_exist = 0;
01866 
01867                   for(Int_t n_crys = 0; n_crys < fEcal->MaxCrysInStin(); n_crys++)
01868                     {
01869                       if( MatrixProbaNature == fCovarianceMatrix )
01870                         {read_matrix = fMyRootFile->ReadCovariancesBetweenSamples(StexStin, n_crys, ReadMatSize);}
01871                       if ( MatrixProbaNature == fCorrelationMatrix )
01872                         {read_matrix = fMyRootFile->ReadCorrelationsBetweenSamples(StexStin, n_crys, ReadMatSize);}
01873 
01874                       if( fMyRootFile->DataExist() == kFALSE )
01875                         {
01876                           fStatusDataExist = kFALSE;
01877 
01878                           cout << "*TEcnaHistos::ViewStin> Exiting loop over the channels." << endl;
01879                           break;
01880                         }
01881                       else
01882                         {
01883                           fStatusDataExist = kTRUE;
01884 
01885                           i_data_exist++;
01886 
01887                           for(Int_t i_samp = 0 ; i_samp < ReadMatSize ; i_samp++)
01888                             {
01889                               Int_t i_xgeo = GetXSampInStin(fFapStexNumber,
01890                                                             StexStin,     n_crys, i_samp);
01891                               for(Int_t j_samp = 0; j_samp < ReadMatSize ; j_samp++)
01892                                 {
01893                                   Int_t j_ygeo = GetYSampInStin(fFapStexNumber,
01894                                                                 StexStin,     n_crys, j_samp);
01895                                   h_geo_bid->Fill((Double_t)i_xgeo, (Double_t)j_ygeo,
01896                                                   (Double_t)read_matrix(i_samp, j_samp));
01897                                 }
01898                             }
01899                         }
01900                     }
01901 
01902                   //===========  H I S T O   M I N / M A X   M A N A G E M E N T  ========  (ViewStin)
01903                   //................................ Put histo min max values
01904                   TString quantity_code = "D_MCs_ChNb";
01905                   if( MatrixProbaNature == fCorrelationMatrix ){quantity_code = "D_MCs_ChNb";}
01906                   if( MatrixProbaNature == fCovarianceMatrix ){quantity_code = "H2HFccMosMatrix";}
01907               
01908                   //.......... default if flag not set to "ON"
01909                   SetYminMemoFromValue(quantity_code, fCnaParHistos->GetYminDefaultValue(quantity_code));
01910                   SetYmaxMemoFromValue(quantity_code, fCnaParHistos->GetYmaxDefaultValue(quantity_code));
01911               
01912                   if( fUserHistoMin == fUserHistoMax ){fFlagUserHistoMin = "AUTO"; fFlagUserHistoMax = "AUTO";}
01913                   //.......... user's min and/or max values
01914                   if( fFlagUserHistoMin == "ON" )
01915                     {SetYminMemoFromValue(quantity_code, fUserHistoMin); fFlagUserHistoMin = "OFF";}
01916                   if( fFlagUserHistoMax == "ON" )
01917                     {SetYmaxMemoFromValue(quantity_code, fUserHistoMax); fFlagUserHistoMax = "OFF";}
01918                   //................................. automatic min and/or max
01919                   if( fFlagUserHistoMin == "AUTO" )
01920                     {SetYminMemoFromValue(quantity_code, h_geo_bid->GetMinimum()); fFlagUserHistoMin = "OFF";}
01921                   if( fFlagUserHistoMax == "AUTO" )
01922                     {SetYmaxMemoFromValue(quantity_code, h_geo_bid->GetMaximum()); fFlagUserHistoMax = "OFF";}
01923                   //...................................... histo set ymin and ymax   (ViewStin)
01924                   Int_t  xFlagAutoYsupMargin = 0; 
01925                   if ( MatrixProbaNature == fCorrelationMatrix )
01926                     {xFlagAutoYsupMargin = SetHistoFrameYminYmaxFromMemo((TH1D*)h_geo_bid, "D_MCs_ChNb");
01927                 
01928                     // ************************** A GARDER EN RESERVE *******************************
01929                     //............. special  contour level for correlations (square root wise scale)
01930                     //Int_t nb_niv  = 9;
01931                     //Double_t* cont_niv = new Double_t[nb_niv];                  fCnew++;
01932                     //SqrtContourLevels(nb_niv, &cont_niv[0]);
01933                     //h_geo_bid->SetContour(nb_niv, &cont_niv[0]);            
01934                     //delete [] cont_niv;                                  fCdelete++;
01935                     // ******************************** (FIN RESERVE) *******************************
01936                     }
01937                   if ( MatrixProbaNature == fCovarianceMatrix )
01938                     {xFlagAutoYsupMargin = SetHistoFrameYminYmaxFromMemo((TH1D*)h_geo_bid, "D_TNo_ChNb");}
01939 
01940                   // =================================== P L O T S ========================  (ViewStin)
01941                   if( i_data_exist > 0 )
01942                     {             
01943                       char* f_in = new char[fgMaxCar];                           fCnew++;
01944 
01945                       //...................... Taille/format canvas  
01946                       UInt_t canv_w = fCnaParHistos->CanvasFormatW("petit");
01947                       UInt_t canv_h = fCnaParHistos->CanvasFormatH("petit");
01948                   
01949                       //.................................................. paves commentaires (ViewStin)          
01950                       SetAllPavesViewStin(StexStin);
01951                   
01952                       //------------------------------------ Canvas name ----------------- (ViewStin)  
01953                       TString name_cov_cor;
01954                       Int_t MaxCar = fgMaxCar;
01955                       name_cov_cor.Resize(MaxCar);
01956                       name_cov_cor = "?";
01957                       if( MatrixProbaNature == fCovarianceMatrix ){name_cov_cor = "CovSS_Matrices_in_";}
01958                       if( MatrixProbaNature == fCorrelationMatrix){name_cov_cor = "CorSS_Matrices_in_";}
01959                   
01960                       TString name_visu;
01961                       MaxCar = fgMaxCar;
01962                       name_visu.Resize(MaxCar);
01963                       name_visu = "colz";
01964                   
01965                       sprintf(f_in, "%s_%s_%s_S1_%d_R%d_%d_%d_%s%d_%s%d_%s",
01966                               name_cov_cor.Data(), fFapStinName.Data(),
01967                               fFapAnaType.Data(), fFapNbOfSamples, fFapRunNumber,
01968                               fFapFirstReqEvtNumber, fFapLastReqEvtNumber,
01969                               fFapStexName.Data(), fFapStexNumber,
01970                               fFapStinName.Data(), StexStin, name_visu.Data()); 
01971                   
01972                       SetHistoPresentation((TH1D*)h_geo_bid, "Stin");
01973                   
01974                       TCanvas *MainCanvas = new TCanvas(f_in, f_in, canv_w, canv_h);   fCnewRoot++;
01975                       fCurrentCanvas = MainCanvas; fCurrentCanvasName = f_in;
01976                   
01977                       // cout << "*TEcnaHistos::ViewStin(...)> Plot is displayed on canvas ----> " << f_in << endl;
01978                   
01979                       delete [] f_in; f_in = 0;                                 fCdelete++;
01980                   
01981                       //------------------------ Canvas draw and update ------------ (ViewStin)  
01982                       if( fPavComGeneralTitle != 0 ){fPavComGeneralTitle->Draw();}
01983                       fPavComStex->Draw();
01984                       fPavComStin->Draw();
01985                       fPavComAnaRun->Draw();
01986                       fPavComNbOfEvts->Draw();
01987 
01988                       Double_t x_margin = fCnaParHistos->BoxLeftX("bottom_left_box") - 0.005;
01989                       Double_t y_margin = fCnaParHistos->BoxTopY("bottom_right_box") + 0.005;             
01990                       MainCanvas->Divide(1, 1, x_margin, y_margin);
01991                       gPad->cd(1);
01992 
01993                       Int_t logy = 0;  
01994                       gPad->SetLogy(logy);
01995                   
01996                       h_geo_bid->DrawCopy("COLZ");
01997                   
01998                       //--------------------------------------------------------------------------- (ViewStin)       
01999                       Int_t size_Hoco    = fEcal->MaxCrysHocoInStin();
02000                       Int_t size_Veco    = fEcal->MaxCrysVecoInStin();
02001                   
02002                       ViewStinGrid(fFapStexNumber, StexStin, MatSize, size_Hoco, size_Veco, " ");
02003                   
02004                       gPad->Update();
02005                   
02006                       h_geo_bid->SetStats((Bool_t)1);    
02007 
02008                       //      delete MainCanvas;              fCdeleteRoot++;
02009                     }
02010                   delete [] f_in_mat_tit;   f_in_mat_tit = 0;        fCdelete++;
02011                   
02012                   h_geo_bid->Delete();   h_geo_bid = 0;             fCdeleteRoot++;
02013                 }
02014               else
02015                 {
02016                   cout << "!TEcnaHistos::ViewStin(...)> *ERROR* =====> "
02017                        << fFapStinName.Data() << " "
02018                        << cStexStin << " not found."
02019                        << " Available numbers = ";
02020                   for(Int_t i = 0; i < fEcal->MaxStinEcnaInStex(); i++)
02021                     {
02022                       if( vStin(i) > 0 )
02023                         {
02024                           if( fFlagSubDet == "EB" ){cout << (Int_t)vStin(i) << ", ";}
02025                           if( fFlagSubDet == "EE" )
02026                             {cout << fEcalNumbering->GetDeeSCConsFrom1DeeSCEcna(fFapStexNumber, (Int_t)vStin(i)) << ", ";}
02027                         }
02028                     }
02029                   cout << fTTBELL << endl;  
02030                 }
02031             }  // end of if ( myRootFile->DataExist() == kTRUE )
02032           else
02033             {
02034               fStatusDataExist = kFALSE;
02035             }
02036         } // end of if ( fMyRootFile->LookAtRootFile() == kTRUE )
02037       else
02038         {
02039           fStatusFileFound = kFALSE;
02040 
02041           cout << "!TEcnaHistos::ViewStin(...)> *ERROR* =====> "
02042                << " ROOT file not found" << fTTBELL << endl;
02043         }
02044     }
02045   else
02046     {
02047       cout << "!TEcnaHistos::ViewStin(...)> " << fFapStexName.Data()
02048            << " = " << fFapStexNumber << ". Out of range (range = [1,"
02049            << fEcal->MaxStexInStas() << "]) " << fTTBELL << endl;
02050     }
02051 }  // end of ViewStin(...)
02052 
02053 //====================================================================================
02054 //
02055 //                         StinCrystalNumbering
02056 //              independent of the ROOT file => StexNumber as argument
02057 //
02058 //====================================================================================  
02059 void TEcnaHistos::StinCrystalNumbering(const Int_t& StexNumber, const Int_t& cStexStin)
02060 {
02061 //display the crystal numbering of one Stin
02062 // cStexStin = Tower number in case of EB or SC number for construction in case of EE
02063 
02064   if( fFlagSubDet == "EB" ){TowerCrystalNumbering(StexNumber, cStexStin);}
02065   if( fFlagSubDet == "EE" ){SCCrystalNumbering(StexNumber, cStexStin);}
02066 }
02067 //---------------->  end of StinCrystalNumbering()
02068 
02069 //====================================================================================
02070 //
02071 //                         TowerCrystalNumbering
02072 //              independent of the ROOT file => SMNumber as argument
02073 //
02074 //====================================================================================  
02075 void TEcnaHistos::TowerCrystalNumbering(const Int_t& SMNumber, const Int_t& n1SMTow)
02076 {
02077   //display the crystal numbering of one tower
02078 
02079   if( (SMNumber > 0) && (SMNumber <= fEcal->MaxSMInEB()) )
02080     {
02081       fFapStexBarrel = fEcalNumbering->GetSMHalfBarrel(SMNumber);
02082 
02083       Int_t MatSize   = fEcal->MaxSampADC();
02084       Int_t size_eta  = fEcal->MaxCrysEtaInTow();
02085       Int_t size_phi  = fEcal->MaxCrysPhiInTow();
02086 
02087       //---------------------------------- bidim
02088 
02089       Int_t nb_bins  = fEcal->MaxSampADC();
02090       Int_t nx_gbins = nb_bins*size_eta;
02091       Int_t ny_gbins = nb_bins*size_phi;
02092 
02093       Axis_t xinf_gbid = (Axis_t)0.;
02094       Axis_t xsup_gbid = (Axis_t)fEcal->MaxSampADC()*size_eta;
02095       Axis_t yinf_gbid = (Axis_t)0.;
02096       Axis_t ysup_gbid = (Axis_t)fEcal->MaxSampADC()*size_phi;
02097 
02098       TString fg_name = "M0' crystals";
02099       TString fg_tit  = "Xtal numbering (chan. in tow, chan. in SM, Xtal in SM, hashed)"; 
02100  
02101       //----------------------- empty 2D histo for pave coordinates registration
02102       TH2D *h_gbid;
02103       h_gbid = new TH2D(fg_name.Data(),  fg_tit.Data(),
02104                         nx_gbins, xinf_gbid, xsup_gbid,
02105                         ny_gbins, yinf_gbid, ysup_gbid);    fCnewRoot++;
02106       h_gbid->Reset();
02107 
02108       //-----------------  T R A C E  D E S   P L O T S ------ (TowerCrystalNumbering)
02109 
02110       char* f_in = new char[fgMaxCar];                           fCnew++;
02111           
02112       //...................... Taille/format canvas
02113   
02114       UInt_t canv_w = fCnaParHistos->CanvasFormatW("petit");
02115       UInt_t canv_h = fCnaParHistos->CanvasFormatH("petit");
02116 
02117       //........................................ couleurs
02118       Color_t couleur_noir       = fCnaParHistos->SetColorsForNumbers("crystal");
02119       Color_t couleur_rouge      = fCnaParHistos->SetColorsForNumbers("lvrb_top");
02120       Color_t couleur_bleu_fonce = fCnaParHistos->SetColorsForNumbers("lvrb_bottom");
02121 
02122       gStyle->SetPalette(1,0);          // Rainbow spectrum
02123 
02124       //.................................... options generales
02125       fCnaParHistos->SetViewHistoStyle("Stin");
02126           
02127       //.................................... paves commentaires (TowerCrystalNumbering)
02128   
02129       SetAllPavesViewStinCrysNb(SMNumber, n1SMTow);
02130  
02131       //---------------------------------------------- (TowerCrystalNumbering)
02132 
02133       //..................... Canvas name
02134       sprintf(f_in, "Crystal_Numbering_for_%s_X_%d_%s%d",
02135               fFapStinName.Data(), n1SMTow, fFapStexName.Data(), SMNumber);
02136   
02137       SetHistoPresentation((TH1D*)h_gbid, "Stin");
02138 
02139       TCanvas *MainCanvas = new TCanvas(f_in, f_in, canv_w , canv_h);    fCnewRoot++;
02140       fCurrentCanvas = MainCanvas; fCurrentCanvasName = f_in;
02141 
02142       // cout << "*TEcnaHistosEB::TowerCrystalNumbering(...)> Plot is displayed on canvas ----> "
02143       //      << f_in << endl;
02144 
02145       Double_t x_margin = fCnaParHistos->BoxLeftX("bottom_left_box") - 0.005;
02146       Double_t y_margin = fCnaParHistos->BoxTopY("bottom_right_box") + 0.005;  
02147       MainCanvas->Divide(1, 1, x_margin, y_margin);
02148 
02149       fPavComStex->Draw();
02150       fPavComStin->Draw();
02151       fPavComLVRB->Draw();
02152   
02153       Bool_t b_true = 1; 
02154       Bool_t b_false = 0;
02155       gPad->cd(1);
02156 
02157       gStyle->SetMarkerColor(couleur_rouge);
02158   
02159       Int_t logy = 0;
02160       gPad->SetLogy(logy);
02161   
02162       //............................... bidim .......... (TowerCrystalNumbering)   
02163 
02164       h_gbid->SetStats(b_false);
02165       h_gbid->DrawCopy("COLZ");
02166     
02167       //..... Ecriture des numeros de channels dans la grille..... (TowerCrystalNumbering)
02168       //      et des numeros SM des cristaux
02169 
02170       //............... prepa arguments fixes appels [TText]->DrawText()
02171       char* f_in_elec = new char[fgMaxCar];                                         fCnew++;
02172       TString TowerLvrbType = fEcalNumbering->GetTowerLvrbType(n1SMTow) ;
02173       TText *text_elec_num = new TText();                                           fCnewRoot++;
02174       if ( TowerLvrbType == "top"    ){text_elec_num->SetTextColor(couleur_rouge);}
02175       if ( TowerLvrbType == "bottom" ){text_elec_num->SetTextColor(couleur_bleu_fonce);}
02176       text_elec_num->SetTextSize(0.04);
02177 
02178       char* f_in_sme = new char[fgMaxCar];                                         fCnew++;
02179       TText *text_sme_num = new TText();                                           fCnewRoot++;
02180       if ( TowerLvrbType == "top"    ){text_sme_num->SetTextColor(couleur_rouge);}
02181       if ( TowerLvrbType == "bottom" ){text_sme_num->SetTextColor(couleur_bleu_fonce);}
02182       text_sme_num->SetTextSize(0.03);
02183 
02184       char* f_in_sm = new char[fgMaxCar];                                             fCnew++;
02185       TText *text_sm_num = new TText();                                               fCnewRoot++;
02186       text_sm_num->SetTextColor(couleur_noir);
02187       text_sm_num->SetTextSize(0.03);
02188 
02189       char* f_in_hsd = new char[fgMaxCar];                                             fCnew++;
02190       TText *text_hsd_num = new TText();                                               fCnewRoot++;
02191       text_hsd_num->SetTextColor(couleur_noir);
02192       text_hsd_num->SetTextSize(0.03);
02193 
02194       //............... prepa arguments fixes appels GetXGeo(...) et GetYGeo(...)
02195       Int_t    i_samp  = 0;
02196       //Double_t off_set = (Double_t)(fEcal->MaxSampADC()/4);
02197       Double_t off_set = (Double_t)1.;
02198 
02199       //------------------ LOOP ON THE CRYSTAL ELECTRONIC CHANNEL NUMBER  (TowerCrystalNumbering)
02200 
02201       for (Int_t i_chan = 0; i_chan < fEcal->MaxCrysInTow(); i_chan++)
02202         {
02203           Int_t i_xgeo = GetXSampInStin(SMNumber, n1SMTow, i_chan, i_samp);
02204           Int_t i_ygeo = GetYSampInStin(SMNumber, n1SMTow, i_chan, i_samp);
02205 
02206           Double_t xgi     =  i_xgeo + 3.*off_set;
02207           Double_t ygj     =  i_ygeo + 7.*off_set;
02208 
02209           Double_t xgi_sme =  i_xgeo + 3.*off_set;
02210           Double_t ygj_sme =  i_ygeo + 5.*off_set;
02211 
02212           Double_t xgi_sm  =  i_xgeo + 3.*off_set;
02213           Double_t ygj_sm  =  i_ygeo + 3.*off_set;
02214 
02215           Double_t xgi_hsd =  i_xgeo + 3.*off_set;
02216           Double_t ygj_hsd =  i_ygeo + 1.*off_set;
02217 
02218           Int_t i_crys_sme = fEcalNumbering->Get0SMEchaFrom1SMTowAnd0TowEcha(n1SMTow, i_chan);
02219 
02220           Int_t i_crys_sm  = fEcalNumbering->Get1SMCrysFrom1SMTowAnd0TowEcha(n1SMTow, i_chan);
02221 
02222           Double_t Eta = fEcalNumbering->GetEta(SMNumber, n1SMTow, i_chan);
02223           Double_t Phi = fEcalNumbering->GetPhi(SMNumber, n1SMTow, i_chan);
02224 
02225           Int_t i_crys_hsd = fEcalNumbering->GetHashedNumberFromIEtaAndIPhi((Int_t)Eta, (Int_t)Phi);
02226 
02227           //------------------------------------------------------- TowerCrystalNumbering
02228 
02229           sprintf(f_in_elec, "%d", i_chan);
02230           text_elec_num->DrawText(xgi, ygj, f_in_elec);
02231 
02232           sprintf(f_in_sme, "%d", i_crys_sme);
02233           text_sme_num->DrawText(xgi_sme, ygj_sme, f_in_sme);
02234 
02235           sprintf(f_in_sm, "%d", i_crys_sm);
02236           text_sm_num->DrawText(xgi_sm, ygj_sm, f_in_sm);
02237 
02238           sprintf(f_in_hsd, "%d", i_crys_hsd);
02239           text_sm_num->DrawText(xgi_hsd, ygj_hsd, f_in_hsd);
02240         }
02241       text_sm_num->Delete();   text_sm_num   = 0;        fCdeleteRoot++;
02242       text_sme_num->Delete();  text_sme_num  = 0;        fCdeleteRoot++;
02243       text_elec_num->Delete(); text_elec_num = 0;        fCdeleteRoot++;
02244       text_hsd_num->Delete();  text_hsd_num  = 0;        fCdeleteRoot++;
02245 
02246       ViewStinGrid(SMNumber, n1SMTow, MatSize, size_eta, size_phi, "CrystalNumbering");
02247 
02248       gPad->Update();
02249       h_gbid->SetStats(b_true);
02250 
02251       h_gbid->Delete();     h_gbid = 0;             fCdeleteRoot++;
02252 
02253       delete [] f_in;       f_in      = 0;          fCdelete++; 
02254       delete [] f_in_sm;    f_in_sm   = 0;          fCdelete++;
02255       delete [] f_in_sme;   f_in_sme  = 0;          fCdelete++;
02256       delete [] f_in_elec;  f_in_elec = 0;          fCdelete++;
02257     }
02258   else
02259     {
02260       cout << "!TEcnaHistos::TowerCrystalNumbering(...)> SM = " << SMNumber
02261            << ". Out of range ( range = [1," << fEcal->MaxSMInEB() << "] )" << fTTBELL << endl;
02262     }
02263 }
02264 //---------------->  end of TowerCrystalNumbering()
02265 
02266 //====================================================================================
02267 //
02268 //                         SCCrystalNumbering
02269 //              independent of the ROOT file => DeeNumber and n1DeeSCEcna as argument
02270 //
02271 //====================================================================================  
02272 void TEcnaHistos::SCCrystalNumbering(const Int_t& DeeNumber, const Int_t& n1DeeSCCons)
02273 {
02274   //display the crystal numbering of one SC
02275 
02276   if( (DeeNumber > 0) && (DeeNumber <= fEcal->MaxDeeInEE()) )
02277     {
02278       Int_t n1DeeSCEcna = fEcalNumbering->Get1DeeSCEcnaFromDeeSCCons(DeeNumber, n1DeeSCCons);
02279       fFapStexType      = fEcalNumbering->GetEEDeeType(DeeNumber);
02280       fFapStinQuadType  = fEcalNumbering->GetSCQuadFrom1DeeSCEcna(n1DeeSCEcna);
02281 
02282       Int_t MatSize  = fEcal->MaxSampADC();
02283       Int_t size_IX  = fEcal->MaxCrysIXInSC();
02284       Int_t size_IY  = fEcal->MaxCrysIYInSC();
02285 
02286       //---------------------------------- bidim
02287 
02288       Int_t nb_bins  = fEcal->MaxSampADC();
02289       Int_t nx_gbins = nb_bins*size_IX;
02290       Int_t ny_gbins = nb_bins*size_IY;
02291 
02292       Axis_t xinf_gbid = (Axis_t)0.;
02293       Axis_t xsup_gbid = (Axis_t)fEcal->MaxSampADC()*size_IX;
02294       Axis_t yinf_gbid = (Axis_t)0.;
02295       Axis_t ysup_gbid = (Axis_t)fEcal->MaxSampADC()*size_IY;
02296 
02297       TString fg_name = "crystalnbring";
02298       TString fg_tit  = "Xtal numbering for construction"; 
02299   
02300       TH2D *h_gbid;
02301       h_gbid = new TH2D(fg_name.Data(),  fg_tit.Data(),
02302                         nx_gbins, xinf_gbid, xsup_gbid,
02303                         ny_gbins, yinf_gbid, ysup_gbid);    fCnewRoot++;
02304       h_gbid->Reset();
02305 
02306       //-----------------  T R A C E  D E S   P L O T S ------ (SCCrystalNumbering)
02307 
02308       char* f_in = new char[fgMaxCar];                           fCnew++;
02309           
02310       //...................... Taille/format canvas
02311   
02312       UInt_t canv_w = fCnaParHistos->CanvasFormatW("petit");
02313       UInt_t canv_h = fCnaParHistos->CanvasFormatH("petit");
02314       //........................................ couleurs
02315       // Color_t couleur_noir       = fCnaParHistos->ColorDefinition("noir");
02316       Color_t couleur_rouge      = fCnaParHistos->ColorDefinition("rouge");
02317       // Color_t couleur_bleu_fonce = fCnaParHistos->ColorDefinition("bleu_fonce");
02318 
02319       gStyle->SetPalette(1,0);          // Rainbow spectrum
02320       //.................................... options generales
02321       fCnaParHistos->SetViewHistoStyle("Stin");
02322           
02323       //.................................... paves commentaires (SCCrystalNumbering)
02324 
02325       SetAllPavesViewStinCrysNb(DeeNumber, n1DeeSCEcna);
02326 
02327       //---------------------------------------------- (SCCrystalNumbering)
02328 
02329       //..................... Canvas name
02330       sprintf(f_in, "Crystal_Numbering_for_%s_X_%d_%s%d",
02331               fFapStinName.Data(), n1DeeSCEcna,  fFapStexName.Data(), DeeNumber);
02332 
02333       SetHistoPresentation((TH1D*)h_gbid, "Stin");
02334 
02335       TCanvas *MainCanvas = new TCanvas(f_in, f_in, canv_w , canv_h);    fCnewRoot++;
02336       fCurrentCanvas = MainCanvas; fCurrentCanvasName = f_in;
02337 
02338       // cout << "*TEcnaHistosEE::SCCrystalNumbering(...)> Plot is displayed on canvas ----> "
02339       //      << f_in << endl;
02340 
02341       Double_t x_margin = fCnaParHistos->BoxLeftX("bottom_left_box") - 0.005;
02342       Double_t y_margin = fCnaParHistos->BoxTopY("bottom_right_box") + 0.005;
02343 
02344       MainCanvas->Divide(1, 1, x_margin, y_margin);
02345 
02346       fPavComStex->Draw();
02347       fPavComStin->Draw();
02348       fPavComCxyz->Draw();
02349 
02350       Bool_t b_true  = 1; 
02351       Bool_t b_false = 0;
02352       gPad->cd(1);
02353 
02354       gStyle->SetMarkerColor(couleur_rouge);
02355   
02356       Int_t logy = 0;
02357       gPad->SetLogy(logy);
02358   
02359       //............................... bidim .......... (SCCrystalNumbering)   
02360 
02361       h_gbid->SetStats(b_false); 
02362 
02363       fCnaParHistos->SetViewHistoOffsets((TH1D*)h_gbid, "Stin", " ");
02364 
02365       h_gbid->DrawCopy("COLZ");
02366     
02367       //..... Ecriture des numeros de channels dans la grille..... (SCCrystalNumbering)
02368       //      et des numeros Dee des cristaux
02369       TString SCQuadType = fEcalNumbering->GetSCQuadFrom1DeeSCEcna(n1DeeSCEcna);
02370       TString DeeDir     = fEcalNumbering->GetDeeDirViewedFromIP(DeeNumber);
02371       TString DeeEndcap  = fEcalNumbering->GetEEDeeEndcap(DeeNumber);
02372       Color_t couleur_SC = GetSCColor(DeeEndcap, DeeDir, SCQuadType);
02373       //............... prepa arguments fixes appels [TText]->DrawText()
02374       char* f_in_elec = new char[fgMaxCar];                                           fCnew++;
02375       TText *text_elec_num   = new TText();                                           fCnewRoot++;
02376       text_elec_num->SetTextColor(couleur_SC);
02377       text_elec_num->SetTextSize(0.06);
02378 
02379       //............... prepa arguments fixes appels GetXGeo(...) et GetYGeo(...)
02380       Int_t    i_samp  = 0;
02381       Double_t off_set = (Double_t)(fEcal->MaxSampADC()/3);
02382 
02383       //------------------ LOOP ON THE CRYSTAL ELECTRONIC CHANNEL NUMBER  (SCCrystalNumbering)
02384 
02385       for (Int_t i_chan = 0; i_chan < fEcal->MaxCrysInSC(); i_chan++)
02386         {
02387           Int_t i_xgeo = GetXSampInStin(DeeNumber, n1DeeSCEcna, i_chan, i_samp);
02388           Int_t i_ygeo = GetYSampInStin(DeeNumber, n1DeeSCEcna, i_chan, i_samp);
02389 
02390           Double_t xgi = i_xgeo + off_set;
02391           Double_t ygj = i_ygeo + 2*off_set;
02392 
02393           TString Dir = fEcalNumbering->GetDeeDirViewedFromIP(DeeNumber);
02394 
02395           //------------------------------------------------------- SCCrystalNumbering
02396 
02397           sprintf(f_in_elec, "%d", i_chan+1);   // offset = +1 (Xtal for construction numbering, CMS NOTE 2006/027)
02398           text_elec_num->DrawText(xgi, ygj, f_in_elec);
02399         }
02400       text_elec_num->Delete();   text_elec_num = 0;           fCdeleteRoot++;
02401 
02402       ViewStinGrid(DeeNumber, n1DeeSCEcna, MatSize, size_IX, size_IY, "CrystalNumbering");
02403 
02404       gPad->Update();
02405       h_gbid->SetStats(b_true);
02406 
02407       h_gbid->Delete();     h_gbid = 0;                         fCdeleteRoot++;
02408 
02409       delete [] f_in;       f_in      = 0;          fCdelete++; 
02410       delete [] f_in_elec;  f_in_elec = 0;          fCdelete++;
02411     }
02412   else
02413     {
02414       cout << "!TEcnaHistos::SCCrystalNumbering(...)> Dee = " << DeeNumber
02415            << ". Out of range ( range = [1," << fEcal->MaxDeeInEE() << "] )" << fTTBELL << endl;
02416     }
02417 }
02418 //---------------->  end of SCCrystalNumbering()
02419               
02420 //==================================================================================
02421 //
02422 //                       GetXSampInStin, GetYSampInStin
02423 //
02424 //==================================================================================
02425 Int_t TEcnaHistos::GetXSampInStin(const Int_t& StexNumber,  const Int_t& StexStin,
02426                                   const Int_t& i0StinEcha,  const Int_t& i_samp) 
02427 {
02428 //Gives the X coordinate in the geographic view of one Stin
02429 
02430   Int_t ix_geo = -1;
02431 
02432   if( fFlagSubDet == "EB" )
02433     {TString ctype = fEcalNumbering->GetStinLvrbType(StexStin);
02434     TString btype = fEcalNumbering->GetStexHalfStas(StexNumber);
02435     if( (btype == "EB+" && ctype == "bottom")  || (btype == "EB-" && ctype == "top") )
02436       {ix_geo = ( (fEcal->MaxCrysHocoInStin()-1)-(i0StinEcha/fEcal->MaxCrysHocoInStin()) )
02437          *fEcal->MaxSampADC() + i_samp;}
02438     if( (btype == "EB+" &&  ctype  == "top")   || (btype == "EB-" && ctype == "bottom") )
02439       {ix_geo = ( i0StinEcha/fEcal->MaxCrysHocoInStin() )*fEcal->MaxSampADC() + i_samp;}}
02440   
02441   if( fFlagSubDet == "EE" )
02442     {  TString DeeDir = fEcalNumbering->GetDeeDirViewedFromIP(StexNumber);
02443     if( DeeDir == "right" )
02444       {ix_geo = (fEcalNumbering->GetIXCrysInSC(StexNumber, StexStin, i0StinEcha)-1)*fEcal->MaxSampADC() + i_samp;}
02445     if( DeeDir == "left"  )
02446       {ix_geo = (fEcal->MaxCrysHocoInStin() - fEcalNumbering->GetIXCrysInSC(StexNumber, StexStin, i0StinEcha))*
02447          fEcal->MaxSampADC() + i_samp;}}
02448 
02449   return ix_geo;
02450 }
02451 //--------------------------------------------------------------------------------------------
02452 Int_t TEcnaHistos::GetYSampInStin(const Int_t& StexNumber, const Int_t& StexStin,
02453                                   const Int_t& i0StinEcha, const Int_t& j_samp)
02454 {
02455 //Gives the Y coordinate in the geographic view of one Stin
02456 
02457   Int_t jy_geo = -1;
02458 
02459   if( fFlagSubDet == "EB" )
02460     {
02461       TString ctype = fEcalNumbering->GetStinLvrbType(StexStin);
02462       TString btype = fEcalNumbering->GetStexHalfStas(StexNumber);
02463       
02464       //.......................... jy_geo for the EB+ (and beginning for the EB-)
02465       
02466       if( (btype == "EB+" && ctype == "top")    ||  (btype == "EB-" && ctype == "bottom") )
02467         {
02468           if( i0StinEcha >=  0 && i0StinEcha <=  4 ) {jy_geo =  (i0StinEcha -  0)*fEcal->MaxSampADC() + j_samp;}
02469           if( i0StinEcha >=  5 && i0StinEcha <=  9 ) {jy_geo = -(i0StinEcha -  9)*fEcal->MaxSampADC() + j_samp;}
02470           if( i0StinEcha >= 10 && i0StinEcha <= 14 ) {jy_geo =  (i0StinEcha - 10)*fEcal->MaxSampADC() + j_samp;}
02471           if( i0StinEcha >= 15 && i0StinEcha <= 19 ) {jy_geo = -(i0StinEcha - 19)*fEcal->MaxSampADC() + j_samp;}
02472           if( i0StinEcha >= 20 && i0StinEcha <= 24 ) {jy_geo =  (i0StinEcha - 20)*fEcal->MaxSampADC() + j_samp;}
02473         }
02474       
02475       if( (btype == "EB+" && ctype == "bottom") ||  (btype == "EB-" && ctype == "top") )
02476         {
02477           if( i0StinEcha >=  0 && i0StinEcha <=  4 )
02478             {jy_geo = ( (fEcal->MaxCrysVecoInStin()-1) - (i0StinEcha- 0))*fEcal->MaxSampADC() + j_samp;}  
02479           if( i0StinEcha >=  5 && i0StinEcha <=  9 )
02480             {jy_geo = ( (fEcal->MaxCrysVecoInStin()-1) + (i0StinEcha- 9))*fEcal->MaxSampADC() + j_samp;}
02481           if( i0StinEcha >= 10 && i0StinEcha <= 14 )
02482             {jy_geo = ( (fEcal->MaxCrysVecoInStin()-1) - (i0StinEcha-10))*fEcal->MaxSampADC() + j_samp;}
02483           if( i0StinEcha >= 15 && i0StinEcha <= 19 )
02484             {jy_geo = ( (fEcal->MaxCrysVecoInStin()-1) + (i0StinEcha-19))*fEcal->MaxSampADC() + j_samp;}
02485           if( i0StinEcha >= 20 && i0StinEcha <= 24 )
02486             {jy_geo = ( (fEcal->MaxCrysVecoInStin()-1) - (i0StinEcha-20))*fEcal->MaxSampADC() + j_samp;}
02487         }
02488     }
02489   
02490   if( fFlagSubDet == "EE" )
02491     {jy_geo =
02492     (fEcalNumbering->GetJYCrysInSC(StexNumber, StexStin, i0StinEcha) - 1)*fEcal->MaxSampADC() + j_samp;}
02493 
02494   return jy_geo;
02495 }
02496 
02497 //===============================================================================
02498 //
02499 //                           ViewStinGrid
02500 //              independent of the ROOT file => StexNumber as argument
02501 //
02502 //===============================================================================
02503 void TEcnaHistos::ViewStinGrid(const Int_t& StexNumber, 
02504                                const Int_t&  StexStin,   const Int_t& MatSize,
02505                                const Int_t&  size_Hoco,  const Int_t& size_Veco,
02506                                const TString chopt)
02507 {
02508   //Grid of one Stin with axis Hoco and Veco
02509 
02510   if( fFlagSubDet == "EB"){ViewTowerGrid(StexNumber, StexStin, MatSize,
02511                                          size_Hoco,   size_Veco,  chopt);}
02512   if( fFlagSubDet == "EE"){ViewSCGrid(StexNumber, StexStin, MatSize,
02513                                       size_Hoco,   size_Veco,  chopt);}
02514 
02515 } // end of ViewStinGrid
02516 
02517 //===============================================================================
02518 //
02519 //                           ViewTowerGrid
02520 //              independent of the ROOT file => SMNumber as argument
02521 //
02522 //===============================================================================
02523 void TEcnaHistos::ViewTowerGrid(const Int_t&  SMNumber, 
02524                                 const Int_t&  n1SMTow,  const Int_t& MatSize,
02525                                 const Int_t&  size_eta, const Int_t& size_phi,
02526                                 const TString chopt)
02527 {
02528   //Grid of one tower with axis eta and phi
02529   //.......................... lignes verticales
02530   Double_t xline = 0.;
02531   
02532   Double_t yline_bot = 0.;
02533   Double_t yline_top = (Double_t)(MatSize*size_eta);
02534   
02535   for( Int_t i = 0 ; i < size_eta ; i++)
02536     {  
02537       xline = xline + (Double_t)MatSize;
02538       TLine *lin;
02539       lin = new TLine(xline, yline_bot, xline, yline_top); fCnewRoot++;
02540       lin->Draw();
02541       // delete lin;             fCdeleteRoot++;
02542     }
02543   //............................. lignes horizontales
02544   Double_t xline_left  = 0;
02545   Double_t xline_right = (Double_t)(MatSize*size_eta);
02546   
02547   Double_t yline = -(Double_t)MatSize;
02548   
02549   for( Int_t j = 0 ; j < size_eta+1 ; j++)
02550     {
02551       yline = yline + (Double_t)MatSize;
02552       TLine *lin;
02553       lin = new TLine(xline_left, yline, xline_right, yline); fCnewRoot++;
02554       lin->Draw();
02555       // delete lin;             fCdeleteRoot++;
02556     }
02557  
02558   //------------------ trace axes en eta et phi --------------- ViewTowerGrid
02559 
02560   //...................................................... Axe i(eta) (x bottom)  (ViewTowerGrid)
02561 
02562   Double_t eta_min = fEcalNumbering->GetIEtaMin(SMNumber, n1SMTow);
02563   Double_t eta_max = fEcalNumbering->GetIEtaMax(SMNumber, n1SMTow);
02564 
02565   TString  x_var_name  = GetEtaPhiAxisTitle("ietaTow");
02566   TString  x_direction = fEcalNumbering->GetXDirectionEB(SMNumber);
02567 
02568   Float_t tit_siz_x = fCnaParHistos->AxisTitleSize();
02569   Float_t lab_siz_x = fCnaParHistos->AxisLabelSize();
02570   Float_t tic_siz_x = fCnaParHistos->AxisTickSize();
02571   Float_t tit_off_x = fCnaParHistos->AxisTitleOffset("Towx");
02572   Float_t lab_off_x = fCnaParHistos->AxisLabelOffset("Towx");
02573   
02574   TF1 *f1 = new TF1("f1", x_direction.Data(), eta_min, eta_max);                fCnewRoot++;
02575 
02576   TGaxis* sup_axis_x = 0;
02577 
02578   if ( x_direction == "-x" )   // NEVER  IN THIS CASE: xmin->xmax <=> right->left ("-x") direction
02579     {sup_axis_x = new TGaxis( -(Float_t)MatSize, (Float_t)0, (Float_t)(size_eta*MatSize), (Float_t)0.,
02580                               "f1", size_eta, "BCS" , 0.);                                fCnewRoot++;
02581     cout << "TEcnaHistosEB::ViewTowerGrid()> non foreseen case. eta with -x direction." << fTTBELL << endl;}
02582 
02583   if ( x_direction == "x" )    // ALWAYS IN THIS CASE: xmin->xmax <=> left->right ("x") direction
02584     {sup_axis_x = new TGaxis( (Float_t)0.      , (Float_t)0., (Float_t)(size_eta*MatSize), (Float_t)0.,
02585                               "f1", size_eta, "CS" , 0.);                                fCnewRoot++;}
02586   
02587   sup_axis_x->SetTitle(x_var_name);
02588   sup_axis_x->SetTitleSize(tit_siz_x);
02589   sup_axis_x->SetTitleOffset(tit_off_x);
02590   sup_axis_x->SetLabelSize(lab_siz_x);
02591   sup_axis_x->SetLabelOffset(lab_off_x);
02592   sup_axis_x->SetTickSize(tic_siz_x);
02593   sup_axis_x->Draw("SAME");
02594   f1 = 0;
02595 
02596   //...................................................... Axe phi (y right)  (ViewTowerGrid)
02597   Float_t tit_siz_y = fCnaParHistos->AxisTitleSize();
02598   Float_t lab_siz_y = fCnaParHistos->AxisLabelSize();
02599   Float_t tic_siz_y = fCnaParHistos->AxisTickSize();
02600   Float_t tit_off_y = fCnaParHistos->AxisTitleOffset("Towy");
02601   Float_t lab_off_y = fCnaParHistos->AxisLabelOffset("Towy");
02602 
02603   if( chopt == "CrystalNumbering" )
02604     {
02605       Double_t phi_min     = fEcalNumbering->GetPhiMin(SMNumber, n1SMTow);
02606       Double_t phi_max     = fEcalNumbering->GetPhiMax(SMNumber, n1SMTow);
02607       
02608       TString  y_var_name  = GetEtaPhiAxisTitle("phi");
02609       TString  y_direction = fEcalNumbering->GetYDirectionEB(SMNumber);
02610   
02611       TF1 *f2 = new TF1("f2", y_direction.Data(), phi_min, phi_max);               fCnewRoot++;
02612       TGaxis* sup_axis_y = 0;
02613       
02614       if ( y_direction == "-x" )  // ALWAYS IN THIS CASE: ymin->ymax <=> top->bottom ("-x") direction
02615         {sup_axis_y = new TGaxis( (Float_t)(size_eta*MatSize), (Float_t)0.,
02616                                   (Float_t)(size_eta*MatSize), (Float_t)(size_phi*MatSize),
02617                                   "f2", size_phi, "+CS", 0.);                fCnewRoot++;}
02618       
02619       if ( y_direction == "x" )   // NEVER  IN THIS CASE: ymin->ymax <=> bottom->top ("x") direction
02620         {sup_axis_y = new TGaxis( (Float_t)0.,  (Float_t)0., (Float_t) 0., (Float_t)(size_phi*MatSize),
02621                                   "f2", size_phi, "BCS", 0.);                fCnewRoot++;}
02622       
02623       sup_axis_y->SetTitle(y_var_name);
02624       sup_axis_y->SetTitleSize(tit_siz_y);
02625       sup_axis_y->SetTitleOffset(tit_off_y);
02626       sup_axis_y->SetLabelSize(lab_siz_y);
02627       sup_axis_y->SetLabelOffset(lab_off_y);
02628       sup_axis_y->SetTickSize(tic_siz_y);
02629       sup_axis_y->Draw("SAME");
02630       f2 = 0;
02631     }
02632   //...................................................... Axe j(phi) (y left)  (ViewTowerGrid)
02633 
02634   Double_t j_phi_min = fEcalNumbering->GetJPhiMin(SMNumber, n1SMTow);
02635   Double_t j_phi_max = fEcalNumbering->GetJPhiMax(SMNumber, n1SMTow);
02636 
02637   TString  jy_var_name  = GetEtaPhiAxisTitle("jphiTow");
02638   TString  jy_direction = fEcalNumbering->GetJYDirectionEB(SMNumber);
02639 
02640   TF1 *f3 = new TF1("f3", jy_direction.Data(), j_phi_min, j_phi_max);               fCnewRoot++;
02641   TGaxis* sup_axis_jy = 0;
02642 
02643   sup_axis_jy = new TGaxis( (Float_t)0., (Float_t)0.,
02644                             (Float_t)0., (Float_t)(size_phi*MatSize),
02645                             "f3", size_phi, "SC", 0.);                fCnewRoot++;
02646   
02647   sup_axis_jy->SetTitle(jy_var_name);
02648   sup_axis_jy->SetTitleSize(tit_siz_y);
02649   sup_axis_jy->SetTitleOffset(tit_off_y);
02650   sup_axis_jy->SetLabelSize(lab_siz_y);
02651   sup_axis_jy->SetLabelOffset(lab_off_y);
02652   sup_axis_jy->SetTickSize(tic_siz_y);
02653   sup_axis_jy->Draw("SAME");
02654   f3 = 0;
02655 
02656 } // end of ViewTowerGrid
02657 
02658 //===============================================================================
02659 //
02660 //                           ViewSCGrid
02661 //              independent of the ROOT file => DeeNumber as argument
02662 //
02663 //===============================================================================
02664 void TEcnaHistos::ViewSCGrid(const Int_t& DeeNumber, const Int_t&  n1DeeSCEcna,
02665                              const Int_t& MatSize,   const Int_t&  size_IX,
02666                              const Int_t& size_IY,   const TString chopt)
02667 {
02668   //Grid of one SC with axis IX and IY
02669   //.......................... lignes verticales
02670   Double_t xline = 0.;
02671   
02672   Double_t yline_bot = 0.;
02673   Double_t yline_top = (Double_t)(MatSize*size_IX);
02674   
02675   for( Int_t i = 0 ; i < size_IX ; i++)
02676     {  
02677       xline = xline + (Double_t)MatSize;
02678       TLine *lin;
02679       lin = new TLine(xline, yline_bot, xline, yline_top); fCnewRoot++;
02680       lin->Draw();
02681       // delete lin;             fCdeleteRoot++;
02682     }
02683   //............................. lignes horizontales
02684   Double_t xline_left  = 0;
02685   Double_t xline_right = (Double_t)(MatSize*size_IX);
02686   
02687   Double_t yline = -(Double_t)MatSize;
02688   
02689   for( Int_t j = 0 ; j < size_IX+1 ; j++)
02690     {
02691       yline = yline + (Double_t)MatSize;
02692       TLine *lin;
02693       lin = new TLine(xline_left, yline, xline_right, yline); fCnewRoot++;
02694       lin->Draw();
02695       // delete lin;             fCdeleteRoot++;
02696     }
02697  
02698   //------------------ trace axes en IX et IY --------------- ViewSCGrid
02699 
02700   //...................................................... Axe i(IX) (x bottom)  (ViewSCGrid)
02701 
02702   Double_t IX_min = fEcalNumbering->GetIIXMin(n1DeeSCEcna) - 0.5;
02703   Double_t IX_max = fEcalNumbering->GetIIXMax(n1DeeSCEcna) + 0.5;
02704 
02705   Float_t axis_x_inf  = 0;
02706   Float_t axis_x_sup  = 0;
02707   Float_t axis_y_inf  = 0;
02708   Float_t axis_y_sup  = 0;
02709   Int_t   axis_nb_div = 1;
02710   Double_t IX_values_min = 0;
02711   Double_t IX_values_max = 0;
02712   Option_t* axis_chopt = "CS";
02713 
02714   Float_t tit_siz_x = fCnaParHistos->AxisTitleSize();
02715   Float_t lab_siz_x = fCnaParHistos->AxisLabelSize();
02716   Float_t tic_siz_x = fCnaParHistos->AxisTickSize();
02717   Float_t tit_off_x = fCnaParHistos->AxisTitleOffset("SCx");
02718   Float_t lab_off_x = fCnaParHistos->AxisLabelOffset("SCx");
02719 
02720   TString StrDee = "iIXSC";
02721   if( DeeNumber == 1 ){StrDee = "iIXDee1";}
02722   if( DeeNumber == 2 ){StrDee = "iIXDee2";}
02723   if( DeeNumber == 3 ){StrDee = "iIXDee3";}
02724   if( DeeNumber == 4 ){StrDee = "iIXDee4";}
02725 
02726   TString  x_var_name  = GetIXIYAxisTitle(StrDee.Data());
02727   TString  x_direction = fEcalNumbering->GetXDirectionEE(DeeNumber);
02728 
02729   TGaxis* sup_axis_x = 0;
02730 
02731   if( DeeNumber == 1 ) //  -xmin -> -xmax <=> left->right
02732     {
02733       axis_x_inf    = 0; axis_y_inf  = 0;  axis_x_sup    = size_IX*MatSize;  axis_y_sup    = 0;
02734       axis_nb_div   = size_IX;
02735       IX_values_min = -IX_min ;   IX_values_max = -IX_max; axis_chopt = "CS";
02736     }
02737   if( DeeNumber == 2 ) //  xmin -> xmax <=> right->left
02738     {
02739       axis_x_inf    = 0; axis_y_inf  = 0;  axis_x_sup    = size_IX*MatSize;  axis_y_sup    = 0;
02740       axis_nb_div   = size_IX;
02741       IX_values_min = IX_min ;    IX_values_max = IX_max;   axis_chopt = "CS";
02742     }
02743   if( DeeNumber == 3 )  //  xmin -> xmax <=>  left->right
02744     {
02745       axis_x_inf    = 0; axis_y_inf  = 0;  axis_x_sup    = size_IX*MatSize;  axis_y_sup    = 0;
02746       axis_nb_div   = size_IX;
02747       IX_values_min = IX_min ;    IX_values_max = IX_max;   axis_chopt = "CS";
02748     }
02749   if( DeeNumber == 4 )  //  -xmin -> -xmax <=> right->left
02750     {
02751       axis_x_inf    = 0; axis_y_inf  = 0;  axis_x_sup    = size_IX*MatSize;  axis_y_sup    = 0;
02752       axis_nb_div   = size_IX;
02753       IX_values_min = -IX_min ;   IX_values_max = -IX_max; axis_chopt = "CS";
02754     }
02755 
02756   TF1 *f1 = new TF1("f1", x_direction.Data(), IX_values_min, IX_values_max);    fCnewRoot++;
02757   sup_axis_x = new TGaxis( axis_x_inf, axis_y_inf, axis_x_sup, axis_y_sup,
02758                            "f1", axis_nb_div, axis_chopt , 0.);   fCnewRoot++;
02759 
02760   sup_axis_x->SetTitle(x_var_name);
02761   sup_axis_x->SetTitleSize(tit_siz_x);
02762   sup_axis_x->SetTitleOffset(tit_off_x);
02763   sup_axis_x->SetLabelSize(lab_siz_x);
02764   sup_axis_x->SetLabelOffset(lab_off_x);
02765   sup_axis_x->SetTickSize(tic_siz_x);     // <===== NE MARCHE QU'AVEC L'OPTION "S"
02766   sup_axis_x->Draw("SAME");
02767   f1 = 0;
02768 
02769   //...................................................... Axe j(IY) (ViewSCGrid)
02770 
02771   Float_t tit_siz_y = fCnaParHistos->AxisTitleSize();
02772   Float_t lab_siz_y = fCnaParHistos->AxisLabelSize();
02773   Float_t tic_siz_y = fCnaParHistos->AxisTickSize();
02774   Float_t tit_off_y = fCnaParHistos->AxisTitleOffset("SCy");
02775   Float_t lab_off_y = fCnaParHistos->AxisLabelOffset("SCy");
02776 
02777   Double_t j_IY_min = fEcalNumbering->GetJIYMin(DeeNumber, n1DeeSCEcna) - 0.5;
02778   Double_t j_IY_max = fEcalNumbering->GetJIYMax(DeeNumber, n1DeeSCEcna) + 0.5;
02779 
02780   TString  jy_var_name  = GetIXIYAxisTitle("jIYSC");
02781   TString  jy_direction = fEcalNumbering->GetJYDirectionEE(DeeNumber);
02782 
02783   TF1 *f2 = new TF1("f2", jy_direction.Data(), j_IY_min, j_IY_max);             fCnewRoot++;
02784 
02785   TGaxis* sup_axis_jy = new TGaxis( (Float_t)0., (Float_t)0.,
02786                             (Float_t)0., (Float_t)(size_IY*MatSize),
02787                             "f2", size_IY, "CS", 0.);                     fCnewRoot++;
02788 
02789   sup_axis_jy->SetTitle(jy_var_name);
02790   sup_axis_jy->SetTitleSize(tit_siz_y);
02791   sup_axis_jy->SetTitleOffset(tit_off_y);
02792   sup_axis_jy->SetLabelSize(lab_siz_y);
02793   sup_axis_jy->SetLabelOffset(lab_off_y);
02794   sup_axis_jy->SetTickSize(tic_siz_y);     // <===== NE MARCHE QU'AVEC L'OPTION "S"
02795   sup_axis_jy->Draw();
02796   f2 = 0;
02797 
02798 } // end of ViewSCGrid
02799 
02800 //=======================================================================================
02801 //
02802 //                                 Stex view (StexHocoVeco)
02803 //
02804 //=======================================================================================
02805 void TEcnaHistos::SMEtaPhiNumberOfEvents(){StexHocoVecoNumberOfEvents();}
02806 void TEcnaHistos::SMEtaPhiPedestals(){StexHocoVecoPedestals();}
02807 void TEcnaHistos::SMEtaPhiTotalNoise(){StexHocoVecoTotalNoise();}
02808 void TEcnaHistos::SMEtaPhiMeanOfCorss(){StexHocoVecoMeanOfCorss();}
02809 void TEcnaHistos::SMEtaPhiLowFrequencyNoise(){StexHocoVecoLowFrequencyNoise();}
02810 void TEcnaHistos::SMEtaPhiHighFrequencyNoise(){StexHocoVecoHighFrequencyNoise();}
02811 void TEcnaHistos::SMEtaPhiSigmaOfCorss(){StexHocoVecoSigmaOfCorss();}
02812 
02813 void TEcnaHistos::DeeIXIYNumberOfEvents(){StexHocoVecoNumberOfEvents();}
02814 void TEcnaHistos::DeeIXIYPedestals(){StexHocoVecoPedestals();}
02815 void TEcnaHistos::DeeIXIYTotalNoise(){StexHocoVecoTotalNoise();}
02816 void TEcnaHistos::DeeIXIYMeanOfCorss(){StexHocoVecoMeanOfCorss();}
02817 void TEcnaHistos::DeeIXIYLowFrequencyNoise(){StexHocoVecoLowFrequencyNoise();}
02818 void TEcnaHistos::DeeIXIYHighFrequencyNoise(){StexHocoVecoHighFrequencyNoise();}
02819 void TEcnaHistos::DeeIXIYSigmaOfCorss(){StexHocoVecoSigmaOfCorss();}
02820 
02821 void TEcnaHistos::StexHocoVecoNumberOfEvents(){ViewStex("D_NOE_ChNb");}
02822 void TEcnaHistos::StexHocoVecoPedestals(){ViewStex("D_Ped_ChNb");}
02823 void TEcnaHistos::StexHocoVecoTotalNoise(){ViewStex("D_TNo_ChNb");}
02824 void TEcnaHistos::StexHocoVecoMeanOfCorss(){ViewStex("D_MCs_ChNb");}
02825 void TEcnaHistos::StexHocoVecoLowFrequencyNoise(){ViewStex("D_LFN_ChNb");}
02826 void TEcnaHistos::StexHocoVecoHighFrequencyNoise(){ViewStex("D_HFN_ChNb");}
02827 void TEcnaHistos::StexHocoVecoSigmaOfCorss(){ViewStex("D_SCs_ChNb");}
02828 //=======================================================================================
02829 //
02830 //                              ViewStex      
02831 //
02832 //           (Hoco,Veco) matrices for all the Stins of a Stex             
02833 //
02834 //
02835 //=======================================================================================
02836 void TEcnaHistos::ViewStex(const TString HistoCode)
02837 {
02838 // (Hoco, Veco) matrices for all the Stins of a Stex
02839 
02840   fMyRootFile->PrintNoComment();
02841   fMyRootFile->GetReadyToReadRootFile(fFapAnaType,          fFapNbOfSamples,
02842                                       fFapRunNumber,        fFapFirstReqEvtNumber,
02843                                       fFapLastReqEvtNumber, fFapReqNbOfEvts,
02844                                       fFapStexNumber,       fCfgResultsRootFilePath.Data());
02845   
02846   if ( fMyRootFile->LookAtRootFile() == kTRUE )          //    (ViewStex)
02847     {
02848       fStatusFileFound = kTRUE;
02849 
02850       fFapNbOfEvts = GetNumberOfEvents(fMyRootFile, fFapReqNbOfEvts);
02851       TString fp_name_short = fMyRootFile->GetRootFileNameShort();
02852       // cout << "*TEcnaHistos::ViewStex(...)> Data are analyzed from file ----> "
02853       //      << fp_name_short << endl;
02854 
02855       fStartDate = fMyRootFile->GetStartDate();
02856       fStopDate  = fMyRootFile->GetStopDate();
02857       fRunType   = fMyRootFile->GetRunType();
02858       
02859       //......................... matrix title  
02860       char* f_in_mat_tit = new char[fgMaxCar];               fCnew++;
02861       
02862       if (HistoCode == "D_NOE_ChNb") {sprintf(f_in_mat_tit, "Number of events");}
02863       if (HistoCode == "D_Ped_ChNb") {sprintf(f_in_mat_tit, "Pedestals");}
02864       if (HistoCode == "D_TNo_ChNb") {sprintf(f_in_mat_tit, "Total Noise");}
02865       if (HistoCode == "D_MCs_ChNb") {sprintf(f_in_mat_tit, "Mean Cor(s,s')");}
02866       if (HistoCode == "D_LFN_ChNb") {sprintf(f_in_mat_tit, "Low Frequency Noise");}
02867       if (HistoCode == "D_HFN_ChNb") {sprintf(f_in_mat_tit, "High Frequency Noise");}
02868       if (HistoCode == "D_SCs_ChNb") {sprintf(f_in_mat_tit, "Sigma Cor(s,s')");}
02869       
02870       //................................. Axis parameters
02871       Int_t  GeoBidSizeHoco = fEcal->MaxStinHocoInStex()*fEcal->MaxCrysHocoInStin();
02872       Int_t  GeoBidSizeVeco = fEcal->MaxStinVecoInStex()*fEcal->MaxCrysVecoInStin();
02873 
02874       Int_t  nb_binx  = GeoBidSizeHoco;
02875       Int_t  nb_biny  = GeoBidSizeVeco;
02876       Axis_t xinf_bid = (Axis_t)0.;
02877       Axis_t xsup_bid = (Axis_t)GeoBidSizeHoco;
02878       Axis_t yinf_bid = (Axis_t)0.;
02879       Axis_t ysup_bid = (Axis_t)GeoBidSizeVeco;   
02880       
02881       TString axis_x_var_name = "  #Hoco  ";
02882       TString axis_y_var_name = "  #varVeco  ";
02883 
02884       //............. matrices reading and histogram filling   (ViewStex)
02885       
02886       TH2D* h_geo_bid = new TH2D("geobidim_Hoco_Veco", f_in_mat_tit,
02887                                  nb_binx, xinf_bid,  xsup_bid,
02888                                  nb_biny, yinf_bid,  ysup_bid);     fCnewRoot++;
02889 
02890       h_geo_bid->Reset();
02891 
02892       //............................................... matrices reading
02893       TVectorD partial_histp(fEcal->MaxCrysEcnaInStex());
02894       for(Int_t i=0; i<fEcal->MaxCrysEcnaInStex(); i++){partial_histp(i)=(Double_t)0.;}
02895 
02896       TMatrixD read_matrix(nb_binx, nb_biny);
02897       for(Int_t i=0; i<nb_binx; i++)
02898         {for(Int_t j=0; j<nb_biny; j++){read_matrix(i,j)=(Double_t)0.;}}
02899 
02900       if (HistoCode == "D_NOE_ChNb" ){
02901         partial_histp = fMyRootFile->ReadNumberOfEvents(fEcal->MaxCrysEcnaInStex());}
02902       if (HistoCode == "D_Ped_ChNb" ){
02903         partial_histp = fMyRootFile->ReadPedestals(fEcal->MaxCrysEcnaInStex());}
02904       if (HistoCode == "D_TNo_ChNb" ){
02905         partial_histp = fMyRootFile->ReadTotalNoise(fEcal->MaxCrysEcnaInStex());}
02906       if (HistoCode == "D_MCs_ChNb" ){
02907         partial_histp = fMyRootFile->ReadMeanOfCorrelationsBetweenSamples(fEcal->MaxCrysEcnaInStex());}
02908       if (HistoCode == "D_LFN_ChNb" ){
02909         partial_histp = fMyRootFile->ReadLowFrequencyNoise(fEcal->MaxCrysEcnaInStex());}
02910       if (HistoCode == "D_HFN_ChNb" ){
02911         partial_histp = fMyRootFile->ReadHighFrequencyNoise(fEcal->MaxCrysEcnaInStex());}
02912       if (HistoCode == "D_SCs_ChNb" ){
02913         partial_histp = fMyRootFile->ReadSigmaOfCorrelationsBetweenSamples(fEcal->MaxCrysEcnaInStex());}
02914 
02915       if ( fMyRootFile->DataExist() == kTRUE )
02916         {
02917           fStatusDataExist = kTRUE;
02918 
02919           for(Int_t i0StexStinEcna=0; i0StexStinEcna<fEcal->MaxStinEcnaInStex(); i0StexStinEcna++)
02920             {
02921               Int_t StexStin = fMyRootFile->GetStexStinFromIndex(i0StexStinEcna);
02922               
02923               if (StexStin != -1)
02924                 {
02925                   //------------------ Geographical bidim filling   (ViewStex)
02926                   for(Int_t i0StinEcha=0; i0StinEcha<fEcal->MaxCrysInStin(); i0StinEcha++)
02927                     {
02928                       Int_t iStexEcha = (StexStin-1)*fEcal->MaxCrysInStin() + i0StinEcha;
02929                       Int_t i_xgeo = GetXCrysInStex(fFapStexNumber, StexStin, i0StinEcha);
02930                       Int_t i_ygeo = GetYCrysInStex(fFapStexNumber, StexStin, i0StinEcha);
02931                       
02932                       if(i_xgeo >=0 && i_xgeo < nb_binx && i_ygeo >=0 && i_ygeo < nb_biny)
02933                         {
02934                           read_matrix(i_xgeo, i_ygeo) = partial_histp(iStexEcha);
02935                           h_geo_bid->Fill((Double_t)i_xgeo, (Double_t)i_ygeo,
02936                                           (Double_t)read_matrix(i_xgeo, i_ygeo));
02937                         }          
02938                     }
02939                 }
02940             }
02941           
02942           //===============  H I S T O   M I N / M A X   M A N A G E M E N T ============  (ViewStex)
02943           
02944           //................................ Put histo min max values
02945           //.......... default if flag not set to "ON"
02946           SetYminMemoFromValue(HistoCode.Data(), fCnaParHistos->GetYminDefaultValue(HistoCode.Data()));
02947           SetYmaxMemoFromValue(HistoCode.Data(), fCnaParHistos->GetYmaxDefaultValue(HistoCode.Data()));
02948           
02949           if( fUserHistoMin == fUserHistoMax ){fFlagUserHistoMin = "AUTO"; fFlagUserHistoMax = "AUTO";}
02950           //.......... user's value if flag set to "ON"
02951           if( fFlagUserHistoMin == "ON" )
02952             {SetYminMemoFromValue(HistoCode.Data(), fUserHistoMin); fFlagUserHistoMin = "OFF";}
02953           if( fFlagUserHistoMax == "ON" )
02954             {SetYmaxMemoFromValue(HistoCode.Data(), fUserHistoMax); fFlagUserHistoMax = "OFF";}
02955           //................................. automatic min and/or max
02956           if( fFlagUserHistoMin == "AUTO" )
02957             {SetYminMemoFromValue(HistoCode.Data(), h_geo_bid->GetMinimum()); fFlagUserHistoMin = "OFF";}
02958           if( fFlagUserHistoMax == "AUTO" )
02959             {SetYmaxMemoFromValue(HistoCode.Data(), h_geo_bid->GetMaximum()); fFlagUserHistoMax = "OFF";}
02960           //...................................... histo set ymin and ymax
02961           Int_t  xFlagAutoYsupMargin = 0;      
02962           xFlagAutoYsupMargin = SetHistoFrameYminYmaxFromMemo((TH1D*)h_geo_bid, HistoCode);
02963           
02964           // ************************** A GARDER EN RESERVE *******************************
02965           //............. special contour level for correlations (square root wise scale)
02966           //if ( HistoCode == "D_MCs_ChNb" )
02967           //{
02968           //  Int_t nb_niv  = 9;
02969           //  Double_t* cont_niv = new Double_t[nb_niv];           fCnew++;
02970           //  SqrtContourLevels(nb_niv, &cont_niv[0]);      
02971           //  h_geo_bid->SetContour(nb_niv, &cont_niv[0]);            
02972           //  delete [] cont_niv;                                  fCdelete++;
02973           //}
02974           // ******************************** (FIN RESERVE) *******************************
02975           
02976           // =================================== P L O T S ========================   (ViewStex) 
02977           
02978           char* f_in = new char[fgMaxCar];                           fCnew++;
02979 
02980           //...................... Taille/format canvas
02981           UInt_t canv_h = fCnaParHistos->CanvasFormatH("petit");
02982           UInt_t canv_w = fCnaParHistos->CanvasFormatW("petit");
02983 
02984           if( fFlagSubDet == "EB")
02985           {canv_h = fCnaParHistos->CanvasFormatH("etaphiSM");
02986           canv_w = fCnaParHistos->CanvasFormatW("etaphiSM");}
02987           if( fFlagSubDet == "EE")        
02988           {canv_h = fCnaParHistos->CanvasFormatH("IXIYDee");
02989           canv_w = fCnaParHistos->CanvasFormatW("IXIYDee");}
02990 
02991           //............................................... paves commentaires (ViewStex)
02992           SetAllPavesViewStex(fFapStexNumber);
02993           
02994           //------------------------------------ Canvas name ----------------- (ViewStex)  
02995           TString name_cov_cor;
02996           Int_t MaxCar = fgMaxCar;
02997           name_cov_cor.Resize(MaxCar);
02998           name_cov_cor = "?";
02999           
03000           if( HistoCode == "D_NOE_ChNb"){name_cov_cor = "Nb_Of_D_Adc_EvDs";}
03001           if( HistoCode == "D_Ped_ChNb"){name_cov_cor = "Pedestals";}
03002           if( HistoCode == "D_TNo_ChNb"){name_cov_cor = "Total_noise";}
03003           if( HistoCode == "D_MCs_ChNb"){name_cov_cor = "Mean_Corss";}
03004           if( HistoCode == "D_LFN_ChNb"){name_cov_cor = "Low_Fq_Noise";}
03005           if( HistoCode == "D_HFN_ChNb"){name_cov_cor = "High_Fq_Noise";}
03006           if( HistoCode == "D_SCs_ChNb"){name_cov_cor = "Sigma_Corss";}
03007           
03008           TString name_visu;
03009           MaxCar = fgMaxCar;
03010           name_visu.Resize(MaxCar);
03011           name_visu = "colz";
03012           
03013           sprintf(f_in, "%s_%s_S1_%d_R%d_%d_%d_%s%d_%s_HocoVeco",
03014                   name_cov_cor.Data(), fFapAnaType.Data(), fFapNbOfSamples, fFapRunNumber,
03015                   fFapFirstReqEvtNumber, fFapLastReqEvtNumber, fFapStexName.Data(), fFapStexNumber,
03016                   name_visu.Data());
03017           
03018           if( fFlagSubDet == "EB" ){SetHistoPresentation((TH1D*)h_geo_bid, "Stex2DEB");}
03019           if( fFlagSubDet == "EE" ){SetHistoPresentation((TH1D*)h_geo_bid, "Stex2DEE");}
03020           
03021           TCanvas *MainCanvas = new TCanvas(f_in, f_in, canv_w, canv_h);   fCnewRoot++;
03022           fCurrentCanvas = MainCanvas; fCurrentCanvasName = f_in;
03023 
03024           // cout << "*TEcnaHistos::ViewStex(...)> Plot is displayed on canvas ----> " << f_in << endl;
03025           
03026           delete [] f_in; f_in = 0;                                 fCdelete++;
03027           
03028           //------------------------ Canvas draw and update ------------ (ViewStex)  
03029           if( fPavComGeneralTitle != 0 ){fPavComGeneralTitle->Draw();}
03030           fPavComStex->Draw();
03031           fPavComAnaRun->Draw();
03032           fPavComNbOfEvts->Draw();
03033 
03034           //----------------------------------------------------------- pad margins
03035           Double_t x_low = fCnaParHistos->BoxLeftX("bottom_left_box")    - 0.005;
03036           Double_t y_low = fCnaParHistos->BoxTopY("bottom_left_box")     + 0.005;
03037           Double_t x_margin = x_low;
03038           Double_t y_margin = y_low;      
03039           MainCanvas->Divide( 1,  1, x_margin, y_margin);
03040           //           Divide(nx, ny, x_margin, y_margin,    color);      
03041           gPad->cd(1);
03042           //........................... specific EE
03043           if( fFlagSubDet == "EE" )
03044             {Double_t x_up  = fCnaParHistos->BoxRightX("bottom_right_box")  + 0.005;
03045             Double_t y_up  = fCnaParHistos->BoxBottomY("top_left_box_Dee") - 0.005;
03046             TVirtualPad* main_subpad = gPad;
03047             main_subpad->SetPad(x_low, y_low, x_up, y_up);}
03048           
03049           //------------------------------------------------------------
03050           h_geo_bid->GetXaxis()->SetTitle(axis_x_var_name);
03051           h_geo_bid->GetYaxis()->SetTitle(axis_y_var_name);
03052           
03053           h_geo_bid->DrawCopy("COLZ");
03054           
03055           // trace de la grille: un rectangle = une tour ou un SC ---------------- (ViewStex) 
03056           ViewStexGrid(fFapStexNumber, " ");
03057           gPad->Draw();
03058           gPad->Update();
03059 
03060           //..................... retour aux options standard
03061           Bool_t b_true = 1;
03062           h_geo_bid->SetStats(b_true);    
03063           h_geo_bid->Delete();  h_geo_bid = 0;              fCdeleteRoot++;
03064 
03065           //      delete MainCanvas;              fCdeleteRoot++;
03066         }
03067       delete [] f_in_mat_tit;    f_in_mat_tit = 0;                        fCdelete++;
03068     } // end of if ( fMyRootFile->LookAtRootFile() == kTRUE )
03069   else
03070     {
03071       fStatusFileFound = kFALSE;
03072 
03073       cout << "!TEcnaHistos::ViewStex(...)> *ERROR* =====> "
03074            << " ROOT file not found" << fTTBELL << endl;
03075     }
03076 }  // end of ViewStex(...)
03077 
03078 //===========================================================================
03079 //
03080 //     StexHocoVecoLHFCorcc():
03081 //     Geographical view of the cor(c,c) (mean over samples) for a
03082 //     given Stex   (BIG MATRIX)
03083 //
03084 //===========================================================================  
03085 void TEcnaHistos::SMEtaPhiLowFrequencyCorcc(){StexHocoVecoLHFCorcc("LF");}
03086 void TEcnaHistos::SMEtaPhiHighFrequencyCorcc(){StexHocoVecoLHFCorcc("HF");}
03087 
03088 void TEcnaHistos::DeeIXIYLowFrequencyCorcc(){StexHocoVecoLHFCorcc("LF");}
03089 void TEcnaHistos::DeeIXIYHighFrequencyCorcc(){StexHocoVecoLHFCorcc("HF");}
03090 
03091 void TEcnaHistos::StexHocoVecoLHFCorcc(const TString Freq)
03092 {
03093 // (Hoco, Veco) matrices for all the Stins of a Stex
03094 
03095   fMyRootFile->PrintNoComment();
03096   fMyRootFile->GetReadyToReadRootFile(fFapAnaType,          fFapNbOfSamples,
03097                                       fFapRunNumber,        fFapFirstReqEvtNumber,
03098                                       fFapLastReqEvtNumber, fFapReqNbOfEvts,
03099                                       fFapStexNumber,       fCfgResultsRootFilePath.Data());
03100   
03101   if ( fMyRootFile->LookAtRootFile() == kTRUE )                 // (StexHocoVecoLHFCorcc)
03102     {
03103       fStatusFileFound = kTRUE;
03104 
03105       fFapNbOfEvts = GetNumberOfEvents(fMyRootFile, fFapReqNbOfEvts);
03106       TString fp_name_short = fMyRootFile->GetRootFileNameShort(); 
03107       //cout << "*TEcnaHistos::StexHocoVecoLHFCorcc(...)> Data are analyzed from file ----> "
03108       //     << fp_name_short << endl;
03109 
03110       fStartDate = fMyRootFile->GetStartDate();
03111       fStopDate  = fMyRootFile->GetStopDate();
03112       fRunType   = fMyRootFile->GetRunType();
03113       
03114       //......................... matrix title  
03115       char* f_in_mat_tit = new char[fgMaxCar];               fCnew++;
03116       
03117       if( fFlagSubDet == "EB" && Freq == "LF" )
03118         {sprintf(f_in_mat_tit, "LF Cor(Xtal,Xtal') for each tower in SM");}
03119       if( fFlagSubDet == "EB" && Freq == "HF" )
03120         {sprintf(f_in_mat_tit, "HF Cor(Xtal,Xtal') for each tower in SM");}
03121       if( fFlagSubDet == "EE" && Freq == "LF"  )
03122         {sprintf(f_in_mat_tit, "LF Cor(Xtal,Xtal') for each SC in Dee");}
03123       if( fFlagSubDet == "EE" && Freq == "HF"  )
03124         {sprintf(f_in_mat_tit, "HF Cor(Xtal,Xtal') for each SC in Dee");}
03125 
03126       //................................. Axis parameters
03127       Int_t  GeoBidSizeHoco = fEcal->MaxStinHocoInStex()*fEcal->MaxCrysInStin();
03128       Int_t  GeoBidSizeVeco = fEcal->MaxStinVecoInStex()*fEcal->MaxCrysInStin();
03129 
03130       Int_t  nb_binx  = GeoBidSizeHoco;
03131       Int_t  nb_biny  = GeoBidSizeVeco;
03132       Axis_t xinf_bid = (Axis_t)0.;
03133       Axis_t xsup_bid = (Axis_t)GeoBidSizeHoco;
03134       Axis_t yinf_bid = (Axis_t)0.;
03135       Axis_t ysup_bid = (Axis_t)GeoBidSizeVeco;   
03136       
03137       TString axis_x_var_name = "  #Hoco  ";
03138       TString axis_y_var_name = "  #varVeco  ";
03139 
03140       //--------------------------------------------------------- (StexHocoVecoLHFCorcc)
03141 
03142       //............. matrices reading and histogram filling
03143       
03144       TH2D* h_geo_bid = new TH2D("geobidim_Hoco_Veco", f_in_mat_tit,
03145                                  nb_binx, xinf_bid,  xsup_bid,
03146                                  nb_biny, yinf_bid,  ysup_bid);     fCnewRoot++;
03147       h_geo_bid->Reset();
03148 
03149       //======================================================== (StexHocoVecoLHFCorcc)
03150       TVectorD Stin_numbers(fEcal->MaxStinEcnaInStex());
03151       for(Int_t i=0; i<fEcal->MaxStinEcnaInStex(); i++){Stin_numbers(i)=(Double_t)0.;}
03152       Stin_numbers = fMyRootFile->ReadStinNumbers(fEcal->MaxStinEcnaInStex());
03153 
03154       if ( fMyRootFile->DataExist() == kTRUE )
03155         {
03156           fStatusDataExist = kTRUE;
03157 
03158           TMatrixD partial_matrix(fEcal->MaxCrysEcnaInStex(), fEcal->MaxCrysEcnaInStex());
03159           for(Int_t i=0; i<fEcal->MaxCrysEcnaInStex(); i++)
03160             {for(Int_t j=0; j<fEcal->MaxCrysEcnaInStex(); j++){partial_matrix(i,j)=(Double_t)0.;}}
03161 
03162           if( Freq == "LF")
03163             {partial_matrix = fMyRootFile->ReadLowFrequencyCorrelationsBetweenChannels(fEcal->MaxCrysEcnaInStex());}
03164           if( Freq == "HF")
03165             {partial_matrix = fMyRootFile->ReadHighFrequencyCorrelationsBetweenChannels(fEcal->MaxCrysEcnaInStex());}
03166 
03167           if ( fMyRootFile->DataExist() == kTRUE )
03168             {
03169               fStatusDataExist = kTRUE;
03170 
03171               fFapStexBarrel = fEcalNumbering->GetStexHalfStas(fFapStexNumber);
03172               
03173               for(Int_t i0StexStinEcna=0; i0StexStinEcna<fEcal->MaxStinEcnaInStex(); i0StexStinEcna++)
03174                 {
03175                   Int_t StexStin = (Int_t)Stin_numbers(i0StexStinEcna);
03176                   Int_t offset_x = ((StexStin-1)/fEcal->MaxStinVecoInStex())*fEcal->MaxCrysInStin();
03177                   Int_t offset_y = ((StexStin-1)%fEcal->MaxStinVecoInStex())*fEcal->MaxCrysInStin();
03178                   
03179                   if (StexStin != -1)
03180                     {
03181                       //================================================= (StexHocoVecoLHFCorcc)
03182                       //------------------ Geographical bidim filling
03183                       for(Int_t i0StinEcha=0; i0StinEcha<fEcal->MaxCrysInStin(); i0StinEcha++)
03184                         {
03185                           for(Int_t j0StinEcha=0; j0StinEcha<fEcal->MaxCrysInStin(); j0StinEcha++)
03186                             {
03187                               Int_t i_xgeo = offset_x + i0StinEcha;
03188                               Int_t i_ygeo = offset_y + j0StinEcha;
03189                               
03190                               if(i_xgeo >=0 && i_xgeo < nb_binx && i_ygeo >=0 && i_ygeo < nb_biny)
03191                                 {
03192                                   Int_t iEcha = (StexStin-1)*fEcal->MaxCrysInStin() + i0StinEcha;
03193                                   Int_t jEcha = (StexStin-1)*fEcal->MaxCrysInStin() + j0StinEcha;
03194                                   
03195                                   h_geo_bid->Fill((Double_t)i_xgeo, (Double_t)i_ygeo,
03196                                                   (Double_t)partial_matrix(iEcha, jEcha));
03197                                 }
03198                             }      
03199                         }
03200                     }
03201                 }
03202               
03203               //===============  H I S T O   M I N / M A X   M A N A G E M E N T ============  (StexHocoVecoLHFCorcc)
03204               
03205               TString HistoCode = "H2CorccInStins";
03206               
03207               //................................ Put histo min max values
03208               //.......... default if flag not set to "ON"
03209               SetYminMemoFromValue(HistoCode.Data(), fCnaParHistos->GetYminDefaultValue(HistoCode.Data()));
03210               SetYmaxMemoFromValue(HistoCode.Data(), fCnaParHistos->GetYmaxDefaultValue(HistoCode.Data()));
03211               
03212               if( fUserHistoMin == fUserHistoMax ){fFlagUserHistoMin = "AUTO"; fFlagUserHistoMax = "AUTO";}
03213               //.......... user's value if flag set to "ON"
03214               if( fFlagUserHistoMin == "ON" )
03215                 {SetYminMemoFromValue(HistoCode.Data(), fUserHistoMin); fFlagUserHistoMin = "OFF";}
03216               if( fFlagUserHistoMax == "ON" )
03217                 {SetYmaxMemoFromValue(HistoCode.Data(), fUserHistoMax); fFlagUserHistoMax = "OFF";}
03218               //................................. automatic min and/or max
03219               if( fFlagUserHistoMin == "AUTO" )
03220                 {SetYminMemoFromValue(HistoCode.Data(), h_geo_bid->GetMinimum()); fFlagUserHistoMin = "OFF";}
03221               if( fFlagUserHistoMax == "AUTO" )
03222                 {SetYmaxMemoFromValue(HistoCode.Data(), h_geo_bid->GetMaximum()); fFlagUserHistoMax = "OFF";}
03223               //...................................... histo set ymin and ymax
03224               Int_t  xFlagAutoYsupMargin = 0;      
03225               xFlagAutoYsupMargin = SetHistoFrameYminYmaxFromMemo((TH1D*)h_geo_bid, HistoCode);
03226               
03227               // ----------------------------------- P L O T S   (StexHocoVecoLHFCorcc)
03228               
03229               char* f_in = new char[fgMaxCar];                           fCnew++;
03230               
03231               //...................... Taille/format canvas
03232               
03233               UInt_t canv_h = fCnaParHistos->CanvasFormatH("petit");
03234               UInt_t canv_w = fCnaParHistos->CanvasFormatW("petit");
03235               
03236               if( fFlagSubDet == "EB")
03237                 {canv_h = fCnaParHistos->CanvasFormatH("etaphiSM");
03238                 canv_w = fCnaParHistos->CanvasFormatW("etaphiSM");}
03239               if( fFlagSubDet == "EE")    
03240                 {canv_h = fCnaParHistos->CanvasFormatH("IXIYDee");
03241                 canv_w = fCnaParHistos->CanvasFormatW("IXIYDee");}
03242               
03243               //..................................... paves commentaires (StexHocoVecoLHFCorcc)
03244               SetAllPavesViewStex(fFapStexNumber);        
03245               
03246               //----------------- Canvas name ------- (StexHocoVecoLHFCorcc)
03247               TString name_cov_cor;
03248               Int_t MaxCar = fgMaxCar;
03249               name_cov_cor.Resize(MaxCar);
03250               if( Freq == "LF" ){name_cov_cor = "StexLFCorcc";}
03251               if( Freq == "HF" ){name_cov_cor = "StexHFCorcc";}
03252               
03253               TString name_visu;
03254               MaxCar = fgMaxCar;
03255               name_visu.Resize(MaxCar);
03256               name_visu = "colz";
03257               
03258               sprintf(f_in, "%s_%s_S1_%d_R%d_%d_%d_Stex%s%d_%s_HocoVeco",
03259                       name_cov_cor.Data(), fFapAnaType.Data(), fFapNbOfSamples, fFapRunNumber,
03260                       fFapFirstReqEvtNumber, fFapLastReqEvtNumber, fFapStexName.Data(), fFapStexNumber,
03261                       name_visu.Data());
03262               
03263               if( fFlagSubDet == "EB" ){SetHistoPresentation((TH1D*)h_geo_bid, "Stex2DEB");}
03264               if( fFlagSubDet == "EE" ){SetHistoPresentation((TH1D*)h_geo_bid, "Stex2DEE");}
03265               
03266               TCanvas *MainCanvas = new TCanvas(f_in, f_in, canv_w, canv_h);   fCnewRoot++;
03267               fCurrentCanvas = MainCanvas; fCurrentCanvasName = f_in;
03268 
03269               // cout << "*TEcnaHistos::StexHocoVecoLHFCorcc(...)> Plot is displayed on canvas ----> "
03270               //      << f_in << endl;
03271               
03272               delete [] f_in; f_in = 0;                                 fCdelete++;
03273              
03274               //------------ Canvas draw and update ------ (StexHocoVecoLHFCorcc)  
03275               if( fPavComGeneralTitle != 0 ){fPavComGeneralTitle->Draw();}
03276               fPavComStex->Draw();
03277               fPavComAnaRun->Draw();
03278               fPavComNbOfEvts->Draw();
03279 
03280               //----------------------------------------------------------- pad margins
03281               Double_t x_low = fCnaParHistos->BoxLeftX("bottom_left_box")    - 0.005;
03282               Double_t y_low = fCnaParHistos->BoxTopY("bottom_left_box")     + 0.005;
03283               Double_t x_margin = x_low;
03284               Double_t y_margin = y_low;          
03285               MainCanvas->Divide( 1,  1, x_margin, y_margin);
03286               //           Divide(nx, ny, x_margin, y_margin,    color);          
03287               gPad->cd(1);
03288               //........................... specific EE
03289               if( fFlagSubDet == "EE" )
03290                 {Double_t x_up  = fCnaParHistos->BoxRightX("bottom_right_box")  + 0.005;
03291                 Double_t y_up  = fCnaParHistos->BoxBottomY("top_left_box_Dee") - 0.005;
03292                 TVirtualPad* main_subpad = gPad;
03293                 main_subpad->SetPad(x_low, y_low, x_up, y_up);}
03294 
03295               // Double_t x_margin = fCnaParHistos->BoxLeftX("bottom_left_box") - 0.005;
03296               // Double_t y_margin = fCnaParHistos->BoxTopY("bottom_right_box") + 0.005;              
03297               // MainCanvas->Divide(1, 1, x_margin, y_margin);
03298               // gPad->cd(1);
03299 
03300               h_geo_bid->GetXaxis()->SetTitle(axis_x_var_name);
03301               h_geo_bid->GetYaxis()->SetTitle(axis_y_var_name);
03302               
03303               h_geo_bid->DrawCopy("COLZ");
03304               
03305               // trace de la grille: un rectangle = une tour (StexHocoVecoLHFCorcc) 
03306               ViewStexGrid(fFapStexNumber, "corcc");
03307               gPad->Draw();
03308               gPad->Update();
03309 
03310               //..................... retour aux options standard
03311               Bool_t b_true = 1;
03312               h_geo_bid->SetStats(b_true);    
03313               h_geo_bid->Delete();   h_geo_bid = 0;             fCdeleteRoot++;
03314                       
03315               //      delete MainCanvas;              fCdeleteRoot++;
03316             }
03317         }
03318       delete [] f_in_mat_tit;   f_in_mat_tit = 0;               fCdelete++;
03319     } // end of if ( fMyRootFile->LookAtRootFile() == kTRUE )
03320   else
03321     {
03322       fStatusFileFound = kFALSE;
03323 
03324       cout << "!TEcnaHistos::StexHocoVecoLHFCorcc(...)> *ERROR* =====> "
03325            << " ROOT file not found" << fTTBELL << endl;
03326     }
03327 } // end of StexHocoVecoLHFCorcc
03328 
03329 //==================================================================================
03330 //
03331 //                          GetXCrysInStex, GetYCrysInStex
03332 //
03333 //==================================================================================
03334 
03335 Int_t TEcnaHistos::GetXCrysInStex(const Int_t&  StexNumber,  const Int_t& StexStin,
03336                                   const Int_t&  i0StinEcha) 
03337 {
03338 //Gives the X crystal coordinate in the geographic view of one Stex
03339 // (X = 0 to MaxStinHocoInStex*NbCrysHocoInStin - 1)
03340 
03341   Int_t ix_geo = 0;
03342 
03343   if( fFlagSubDet == "EB")
03344     {TString ctype = fEcalNumbering->GetStexHalfStas(StexNumber);
03345     Int_t n1StexCrys = fEcalNumbering->Get1StexCrysFrom1StexStinAnd0StinEcha(StexStin, i0StinEcha, StexNumber);  
03346     ix_geo = (n1StexCrys-1)/fEcal->MaxCrysVecoInStex();  // ix_geo for EB+
03347     if( ctype == "EB-"){ix_geo = fEcal->MaxCrysHocoInStex() - ix_geo - 1;}}
03348 
03349   if( fFlagSubDet == "EE")
03350     {TString DeeDir = fEcalNumbering->GetDeeDirViewedFromIP(StexNumber);  
03351     ix_geo = 0;
03352     if( DeeDir == "right" )
03353       {ix_geo = fEcalNumbering->GetIXCrysInDee(StexNumber, StexStin, i0StinEcha) - 1;}
03354     if( DeeDir == "left"  )
03355       {ix_geo = fEcal->MaxCrysIXInDee() - fEcalNumbering->GetIXCrysInDee(StexNumber, StexStin, i0StinEcha);}}
03356 
03357   return ix_geo;
03358 }
03359 
03360 Int_t TEcnaHistos::GetYCrysInStex(const Int_t& StexNumber, const Int_t& StexStin,
03361                                   const Int_t& j0StinEcha) 
03362 {
03363 //Gives the Y crystal coordinate in the geographic view of one Stex
03364 // (Y = 0 to MaxStinVecoInStex*NbCrysVecoInStin - 1)
03365 
03366   Int_t iy_geo = 0;
03367 
03368   if( fFlagSubDet == "EB")
03369     {TString ctype    = fEcalNumbering->GetStexHalfStas(StexNumber);
03370     Int_t n1StexCrys = fEcalNumbering->Get1StexCrysFrom1StexStinAnd0StinEcha(StexStin, j0StinEcha, StexNumber);
03371     Int_t ix_geo = (n1StexCrys-1)/fEcal->MaxCrysVecoInStex();     // ix_geo for EB+
03372     iy_geo = n1StexCrys - 1 - ix_geo*fEcal->MaxCrysVecoInStex();  // iy_geo for EB+
03373     if( ctype == "EB-"){iy_geo = fEcal->MaxCrysVecoInStex() - iy_geo - 1;}}
03374   
03375   if( fFlagSubDet == "EE")
03376     {iy_geo = fEcalNumbering->GetJYCrysInDee(StexNumber, StexStin, j0StinEcha) - 1;}
03377   
03378   return iy_geo;
03379 }
03380 
03381 //===========================================================================
03382 //
03383 //     StexStinNumbering, ViewStexStinNumberingPad
03384 //
03385 //              independent of the ROOT file => StexNumber as argument
03386 //
03387 //===========================================================================  
03388 void TEcnaHistos::StexStinNumbering(const Int_t& StexNumber)
03389 {
03390 //display the Stin numbering of the Stex
03391 
03392   if( fFlagSubDet == "EB" ){SMTowerNumbering(StexNumber);}
03393   if( fFlagSubDet == "EE" ){DeeSCNumbering(StexNumber);}
03394 }
03395 // end of StexStinNumbering
03396 
03397 //=============================================================================
03398 //
03399 //                   ViewStexStinNumberingPad
03400 //            independent of the ROOT file => StexNumber as argument
03401 //
03402 //=============================================================================
03403 void TEcnaHistos::ViewStexStinNumberingPad(const Int_t& StexNumber)
03404 {
03405 //display the Stin numbering of the Stex in a Pad
03406 
03407   if( fFlagSubDet ==  "EB"){ViewSMTowerNumberingPad(StexNumber);}
03408   if( fFlagSubDet ==  "EE"){ViewDeeSCNumberingPad(StexNumber);}
03409 }
03410 //---------------->  end of ViewStexStinNumberingPad()
03411 
03412 //==========================================================================
03413 //
03414 //                       ViewStexGrid
03415 //              independent of the ROOT file => StexNumber as argument
03416 //
03417 //==========================================================================
03418 void TEcnaHistos::ViewStexGrid(const Int_t& StexNumber, const TString  c_option)
03419 {
03420  //Grid of one Stex with axis Hoco and Veco
03421 
03422   if( fFlagSubDet ==  "EB"){ViewSMGrid(StexNumber, c_option);}
03423   if( fFlagSubDet ==  "EE"){ViewDeeGrid(StexNumber, c_option);}
03424 
03425 } // end of ViewStexGrid
03426 
03427 //&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&  S P E C I F I C  &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
03428 
03429 //=======================================      BARREL       ===============================
03430 void TEcnaHistos::SMTowerNumbering(const Int_t& SMNumber)
03431 {
03432   //display the tower numbering of the super-module
03433 
03434   if( (SMNumber > 0) && (SMNumber <= fEcal->MaxSMInEB()) )
03435     {
03436       Int_t  GeoBidSizeEta = fEcal->MaxTowEtaInSM()*fEcal->MaxCrysEtaInTow();
03437       Int_t  GeoBidSizePhi = fEcal->MaxTowPhiInSM()*fEcal->MaxCrysPhiInTow();
03438 
03439       Int_t  nb_binx  = GeoBidSizeEta;
03440       Int_t  nb_biny  = GeoBidSizePhi;
03441       Axis_t xinf_bid = (Axis_t)0.;
03442       Axis_t xsup_bid = (Axis_t)GeoBidSizeEta;
03443       Axis_t yinf_bid = (Axis_t)0.;
03444       Axis_t ysup_bid = (Axis_t)GeoBidSizePhi;   
03445   
03446       TString axis_x_var_name = "  #eta  ";
03447       TString axis_y_var_name = "  #varphi  ";
03448 
03449       //------------------------------------------------------------------- SMTowerNumbering
03450   
03451       //............. matrices reading and histogram filling
03452       char* f_in_mat_tit = new char[fgMaxCar];                           fCnew++;
03453 
03454       sprintf(f_in_mat_tit, "SM tower numbering");
03455 
03456       // il faut tracer un bidim vide pour pouvoir tracer la grille et les axes
03457 
03458       TH2D* h_empty_bid = new TH2D("grid_bidim_eta_phi", f_in_mat_tit,
03459                                    nb_binx, xinf_bid, xsup_bid,
03460                                    nb_biny, yinf_bid, ysup_bid);     fCnewRoot++; 
03461       h_empty_bid->Reset();
03462   
03463       h_empty_bid->GetXaxis()->SetTitle(axis_x_var_name);
03464       h_empty_bid->GetYaxis()->SetTitle(axis_y_var_name);
03465 
03466       // ------------------------------------------------ P L O T S   (SMTowerNumbering)
03467   
03468       char* f_in = new char[fgMaxCar];                           fCnew++;
03469   
03470       //...................... Taille/format canvas
03471   
03472       UInt_t canv_h = fCnaParHistos->CanvasFormatH("etaphiSM");
03473       UInt_t canv_w = fCnaParHistos->CanvasFormatW("etaphiSM");
03474   
03475       //............................................... options generales
03476 
03477       fFapStexBarrel = fEcalNumbering->GetSMHalfBarrel(SMNumber);
03478 
03479       //............................................... paves commentaires (SMTowerNumbering)
03480       SetAllPavesViewStex("Numbering", SMNumber);         
03481 
03482       //------------------------------------ Canvas name ----------------- (SMTowerNumbering)  
03483 
03484       sprintf(f_in, "tower_numbering_for_SuperModule_SM%d", SMNumber);
03485   
03486       SetHistoPresentation((TH1D*)h_empty_bid,"Stex2DEB");
03487 
03488       TCanvas *MainCanvas = new TCanvas(f_in, f_in, canv_w, canv_h);   fCnewRoot++;
03489       fCurrentCanvas = MainCanvas; fCurrentCanvasName = f_in;
03490 
03491       // cout << "*TEcnaHistosEB::ViewSM(...)> Plot is displayed on canvas ----> " << f_in << endl;
03492   
03493       delete [] f_in; f_in = 0;                                 fCdelete++;
03494 
03495       //------------------------ Canvas draw and update ------------ (SMTowerNumbering)  
03496       fPavComStex->Draw();
03497   
03498       Double_t x_margin = fCnaParHistos->BoxLeftX("bottom_left_box") - 0.005;
03499       Double_t y_margin = fCnaParHistos->BoxTopY("bottom_right_box") + 0.005; 
03500       MainCanvas->Divide(1, 1, x_margin, y_margin);
03501       gPad->cd(1);
03502 
03503       h_empty_bid->DrawCopy("COL");   // il faut tracer un bidim vide pour pouvoir tracer la grille et les axes
03504 
03505       ViewSMTowerNumberingPad(SMNumber);
03506       gPad->Update();
03507   
03508       //..................... retour aux options standard
03509       Bool_t b_true = 1;
03510       h_empty_bid->SetStats(b_true);    
03511   
03512       h_empty_bid->Delete();  h_empty_bid = 0;            fCdeleteRoot++;      
03513   
03514       //      delete MainCanvas;              fCdeleteRoot++;
03515   
03516       delete [] f_in_mat_tit;  f_in_mat_tit = 0;         fCdelete++;
03517     }
03518   else
03519     {
03520       cout << "!TEcnaHistos::SMTowerNumbering(...)> SM = " << SMNumber
03521            << ". Out of range ( range = [1," << fEcal->MaxSMInEB() << "] )" << fTTBELL << endl;
03522     }
03523 }
03524 // end of SMTowerNumbering
03525 
03526 void TEcnaHistos::ViewSMTowerNumberingPad(const Int_t& SMNumber)
03527 {
03528   //display the tower numbering of the super-module in a Pad
03529 
03530   gStyle->SetTitleW(0.2);        // taille titre histos
03531   gStyle->SetTitleH(0.07);
03532 
03533   ViewSMGrid(SMNumber, " ");
03534 
03535   Color_t couleur_rouge      = fCnaParHistos->SetColorsForNumbers("lvrb_top");
03536   Color_t couleur_bleu_fonce = fCnaParHistos->SetColorsForNumbers("lvrb_bottom");
03537 
03538   //..... Ecriture des numeros de tours dans la grille..... (ViewSMTowerNumberingPad)
03539 
03540   char* f_in = new char[fgMaxCar];                           fCnew++;
03541   gStyle->SetTextSize(0.075);
03542 
03543   // x_channel, y_channel: coordinates of the text "Txx"
03544   Int_t y_channel = 12;
03545   Int_t x_channel = 12;
03546 
03547   Int_t max_tow_phi = fEcal->MaxTowPhiInSM()*fEcal->MaxCrysPhiInTow();
03548 
03549   //------------------ LOOP ON THE SM_TOWER NUMBER   (ViewSMTowerNumberingPad)
03550 
03551   TText *text_SMtow_num = new TText();        fCnewRoot++;
03552 
03553   for (Int_t i_SMtow = 1; i_SMtow <= fEcal->MaxTowInSM(); i_SMtow++)
03554     {
03555       if(fEcalNumbering->GetTowerLvrbType(i_SMtow) == "top")
03556         {text_SMtow_num->SetTextColor(couleur_rouge);}
03557       if(fEcalNumbering->GetTowerLvrbType(i_SMtow) == "bottom")
03558         {text_SMtow_num->SetTextColor(couleur_bleu_fonce);}
03559 
03560       //................................ x from eta
03561       Double_t x_from_eta = fEcalNumbering->GetEta(SMNumber, i_SMtow, x_channel) - (Double_t)1;
03562       if(fEcalNumbering->GetSMHalfBarrel(SMNumber) == "EB-")
03563       {x_from_eta = fEcal->MaxTowEtaInSM()*fEcal->MaxCrysEtaInTow() + x_from_eta + (Double_t)1;}
03564 
03565       //................................ y from phi
03566       Double_t y_from_phi = max_tow_phi - 1
03567         - (fEcalNumbering->GetPhi(SMNumber, i_SMtow, y_channel) - fEcalNumbering->GetPhiMin(SMNumber));
03568       if( fEcalNumbering->GetSMHalfBarrel(SMNumber) == "EB-")
03569         {y_from_phi = - y_from_phi + fEcal->MaxTowPhiInSM()*fEcal->MaxCrysPhiInTow() - (Double_t)1;}
03570 
03571       sprintf(f_in, "%d", i_SMtow);
03572       text_SMtow_num->DrawText(x_from_eta, y_from_phi, f_in);  // <=== prend du temps si on mets "T%d" dans le sprintf
03573     }
03574 
03575   text_SMtow_num->Delete();    text_SMtow_num = 0;         fCdeleteRoot++;
03576 
03577   //.................................................... legende (ViewSMTowerNumberingPad)
03578   Double_t offset_tow_tex_eta = (Double_t)8.;
03579   Double_t offset_tow_tex_phi = (Double_t)15.;
03580 
03581   Color_t couleur_noir = fCnaParHistos->ColorDefinition("noir");
03582   Double_t x_legend    = (Double_t)0.;
03583   Double_t y_legend    = (Double_t)0.;
03584 
03585   Int_t ref_tower = fEcal->MaxTowInSM();
03586 
03587   //.................................................  LVRB TOP (ViewSMTowerNumberingPad)
03588   gStyle->SetTextSize(0.075);  
03589   gStyle->SetTextColor(couleur_rouge);
03590   x_legend = fEcalNumbering->GetEta(SMNumber, ref_tower, x_channel);
03591   y_legend = fEcalNumbering->GetPhi(SMNumber, ref_tower, y_channel) - fEcalNumbering->GetPhiMin(SMNumber);
03592 
03593   if( fEcalNumbering->GetSMHalfBarrel(SMNumber) == "EB+" )
03594     {
03595       x_legend = x_legend + offset_tow_tex_eta;
03596       y_legend = y_legend + offset_tow_tex_phi;
03597     }
03598   if( fEcalNumbering->GetSMHalfBarrel(SMNumber) == "EB-" )
03599     {
03600       x_legend = -x_legend + offset_tow_tex_eta;
03601       y_legend =  y_legend + offset_tow_tex_phi;
03602     }
03603 
03604   sprintf( f_in, "xx");
03605   TText *text_legend_rouge = new TText(x_legend, y_legend, f_in);        fCnewRoot++;
03606   text_legend_rouge->Draw();
03607   gStyle->SetTextSize(0.05);
03608   x_legend = x_legend - (Double_t)3.5;
03609   y_legend = y_legend - (Double_t)2.;
03610   sprintf(f_in, "       LVRB     ");
03611   TText *text_legend_rouge_expl = new TText(x_legend, y_legend, f_in);        fCnewRoot++;
03612   text_legend_rouge_expl->Draw();
03613   y_legend = y_legend - (Double_t)1.75;
03614   if( fEcalNumbering->GetSMHalfBarrel(SMNumber) == "EB+" ){sprintf(f_in, "        <---  ");}
03615   if( fEcalNumbering->GetSMHalfBarrel(SMNumber) == "EB-" ){sprintf(f_in, "        --->  ");}
03616   TText *text_legend_rouge_expm = new TText(x_legend, y_legend, f_in);        fCnewRoot++;
03617   text_legend_rouge_expm->Draw();
03618   //text_legend_rouge_expl->Delete();   text_legend_rouge_expl = 0;          fCdeleteRoot++;
03619   
03620   //.................................................  LVRB BOTTOM (ViewSMTowerNumberingPad)
03621   gStyle->SetTextSize(0.075);  
03622   gStyle->SetTextColor(couleur_bleu_fonce);
03623   x_legend = fEcalNumbering->GetEta(SMNumber, ref_tower, x_channel);
03624   y_legend = fEcalNumbering->GetPhi(SMNumber, ref_tower, y_channel) - fEcalNumbering->GetPhiMin(SMNumber); 
03625 
03626   if( fEcalNumbering->GetSMHalfBarrel(SMNumber) == "EB+" )
03627     {
03628       x_legend = x_legend + offset_tow_tex_eta;
03629       y_legend = y_legend + offset_tow_tex_phi/3;
03630     }
03631   if( fEcalNumbering->GetSMHalfBarrel(SMNumber) == "EB-" )
03632     {
03633       x_legend = -x_legend + offset_tow_tex_eta;
03634       y_legend =  y_legend + offset_tow_tex_phi/3;
03635     }
03636 
03637   sprintf(f_in, "xx");
03638   TText *text_legend_bleu = new TText(x_legend, y_legend, f_in);        fCnewRoot++;
03639   text_legend_bleu->Draw();
03640   //text_legend_bleu->Delete();   text_legend_bleu = 0;          fCdeleteRoot++;
03641   gStyle->SetTextSize(0.05);
03642   x_legend = x_legend - (Double_t)3.5;
03643   y_legend = y_legend - (Double_t)2.;
03644   sprintf( f_in, "       LVRB     ");
03645   TText *text_legend_bleu_expl = new TText(x_legend, y_legend, f_in);        fCnewRoot++;
03646   text_legend_bleu_expl->Draw();
03647   y_legend = y_legend - (Double_t)1.75;
03648   if( fEcalNumbering->GetSMHalfBarrel(SMNumber) == "EB+" ){sprintf( f_in, "        --->  ");}
03649   if( fEcalNumbering->GetSMHalfBarrel(SMNumber) == "EB-" ){sprintf( f_in, "        <---  ");}
03650   TText *text_legend_bleu_expm = new TText(x_legend, y_legend, f_in);        fCnewRoot++;
03651   text_legend_bleu_expm->Draw();
03652   //text_legend_bleu_expl->Delete();   text_legend_bleu_expl = 0;          fCdeleteRoot++;
03653   
03654   delete [] f_in;   f_in = 0;                                    fCdelete++;
03655 
03656   gStyle->SetTextColor(couleur_noir);
03657 }
03658 //---------------->  end of ViewSMTowerNumberingPad()
03659 
03660 void TEcnaHistos::ViewSMGrid(const Int_t& SMNumber, const TString c_option)
03661 {
03662  //Grid of one supermodule with axis eta and phi
03663 
03664   Int_t  GeoBidSizeEta = fEcal->MaxTowEtaInSM()*fEcal->MaxCrysEtaInTow();
03665   Int_t  GeoBidSizePhi = fEcal->MaxTowPhiInSM()*fEcal->MaxCrysPhiInTow();
03666 
03667   if ( c_option == "corcc")
03668     {
03669       GeoBidSizeEta = fEcal->MaxTowEtaInSM()*fEcal->MaxCrysInTow();
03670       GeoBidSizePhi = fEcal->MaxTowPhiInSM()*fEcal->MaxCrysInTow();
03671     }
03672 
03673   Int_t  nb_binx  = GeoBidSizeEta;
03674   Int_t  nb_biny  = GeoBidSizePhi;
03675   Axis_t xinf_bid = (Axis_t)0.;
03676   Axis_t xsup_bid = (Axis_t)GeoBidSizeEta;
03677   Axis_t yinf_bid = (Axis_t)0.;
03678   Axis_t ysup_bid = (Axis_t)GeoBidSizePhi;   
03679   
03680   //---------------- trace de la grille: un rectangle = une tour
03681 
03682   Int_t size_eta = fEcal->MaxCrysEtaInTow();
03683   Int_t size_phi = fEcal->MaxCrysPhiInTow();
03684   if ( c_option == "corcc")
03685     {
03686       size_eta = fEcal->MaxCrysInTow();
03687       size_phi = fEcal->MaxCrysInTow();
03688     }
03689   Int_t max_x = nb_binx/size_eta;
03690   Int_t max_y = nb_biny/size_phi;
03691 
03692   //............................. lignes horizontales
03693   Double_t yline = (Double_t)yinf_bid;
03694 
03695   Double_t xline_left  = (Double_t)xinf_bid;
03696   Double_t xline_right = (Double_t)xsup_bid;
03697   
03698   for( Int_t j = 0 ; j < max_y ; j++)
03699     {
03700       yline = yline + (Double_t)size_phi;
03701       TLine *lin;
03702       lin = new TLine(xline_left, yline, xline_right, yline); fCnewRoot++;
03703       lin->Draw();
03704       // delete lin;             fCdeleteRoot++;
03705     }
03706 
03707   //.......................... lignes verticales
03708   Double_t xline = (Double_t)xinf_bid - (Double_t)size_eta;
03709   
03710   Double_t yline_bot = (Double_t)yinf_bid;
03711   Double_t yline_top = (Double_t)ysup_bid;
03712   
03713   Color_t coul_surligne = fCnaParHistos->ColorDefinition("noir");
03714   Color_t coul_textmodu = fCnaParHistos->ColorDefinition("vert36");
03715 
03716   //............................ Mj text
03717   gStyle->SetTextColor(coul_textmodu);
03718   gStyle->SetTextSize(0.075);
03719 
03720   char* f_in = new char[fgMaxCar];                           fCnew++;
03721 
03722   for( Int_t i = 0 ; i < max_x ; i++)
03723     {  
03724       xline = xline + (Double_t)size_eta;
03725       TLine *lin;
03726       lin = new TLine(xline, yline_bot, xline, yline_top); fCnewRoot++;
03727       
03728       //............. Surlignage separateur des modules
03729       if( (fEcalNumbering->GetSMHalfBarrel(SMNumber) == "EB-") && (i == 4 || i == 8 || i == 12) )
03730         {lin->SetLineWidth(2); lin->SetLineColor(coul_surligne);}      
03731       if( (fEcalNumbering->GetSMHalfBarrel(SMNumber) == "EB+") && (i == 5 || i == 9 || i == 13) )
03732         {lin->SetLineWidth(2); lin->SetLineColor(coul_surligne);}
03733        
03734       lin->Draw();
03735       // delete lin;             fCdeleteRoot++;
03736 
03737       //............. Numeros des modules
03738       if( (fEcalNumbering->GetSMHalfBarrel(SMNumber) == "EB-") && (i == 2 || i == 6 || i == 10 || i == 14)  )
03739         {
03740           if( i ==  2 ){sprintf( f_in, "M4");}
03741           if( i ==  6 ){sprintf( f_in, "M3");}
03742           if( i == 10 ){sprintf( f_in, "M2");}
03743           if( i == 14 ){sprintf( f_in, "M1");}
03744 
03745           TText *text_num_module = new TText(xline + 1, yline_top + 1, f_in);        fCnewRoot++;
03746           text_num_module->Draw();
03747           //text_num_module->Delete(); text_num_module = 0;      fCdeleteRoot++;      
03748         }      
03749       if( (fEcalNumbering->GetSMHalfBarrel(SMNumber) == "EB+") && (i == 3 || i == 7 || i == 11 || i == 15)  )
03750         {
03751           if( i ==  3 ){sprintf( f_in, "M1");}
03752           if( i ==  7 ){sprintf( f_in, "M2");}
03753           if( i == 11 ){sprintf( f_in, "M3");}
03754           if( i == 15 ){sprintf( f_in, "M4");}
03755          
03756           TText *text_num_module = new TText(xline, yline_top + 1, f_in);        fCnewRoot++;
03757           text_num_module->Draw();
03758           //text_num_module->Delete();  text_num_module = 0;    fCdeleteRoot++;     
03759         }
03760     }
03761   delete [] f_in;   f_in = 0;    fCdelete++;
03762 
03763   //------------------ trace axes en eta et phi --------------- ViewSMGrid
03764 
03765   Int_t MatSize      = fEcal->MaxCrysEtaInTow();
03766   if ( c_option == "corcc"){MatSize = fEcal->MaxCrysInTow();}
03767 
03768   Int_t size_eta_sm  = fEcal->MaxTowEtaInSM();
03769   Int_t size_phi_sm  = fEcal->MaxTowPhiInSM();
03770 
03771   //...................................................... Axe i(eta) (bottom x) ViewSMGrid
03772   Double_t eta_min = fEcalNumbering->GetIEtaMin(SMNumber);
03773   Double_t eta_max = fEcalNumbering->GetIEtaMax(SMNumber);
03774 
03775   TString  x_var_name  = GetHocoVecoAxisTitle("ietaSM");;
03776   TString  x_direction = fEcalNumbering->GetXDirectionEB(SMNumber);
03777 
03778   Float_t tit_siz_x = fCnaParHistos->AxisTitleSize();
03779   Float_t lab_siz_x = fCnaParHistos->AxisLabelSize("SMx");
03780   Float_t tic_siz_x = fCnaParHistos->AxisTickSize("SMx");
03781   Float_t tit_off_x = fCnaParHistos->AxisTitleOffset("SMx");
03782   Float_t lab_off_x = fCnaParHistos->AxisLabelOffset("SMx");
03783 
03784   TF1 *f1 = new TF1("f1", x_direction.Data(), eta_min, eta_max);          fCnewRoot++;
03785     TGaxis* sup_axis_x = 0;
03786 
03787   if( x_direction == "-x" ) // NEVER  IN THIS CASE: xmin->xmax <=> right->left ("-x") direction
03788     {sup_axis_x = new TGaxis( (Float_t)0., (Float_t)0., (Float_t)(size_eta_sm*MatSize), (Float_t)0.,
03789                               "f1", size_eta_sm, "SC" , 0.);   fCnewRoot++;}
03790 
03791   if( x_direction == "x" )  // ALWAYS IN THIS CASE: xmin->xmax <=> left->right ("x") direction    
03792     {sup_axis_x = new TGaxis( (Float_t)0., (Float_t)0., (Float_t)(size_eta_sm*MatSize), (Float_t)0.,
03793                               "f1", size_eta_sm, "SC" , 0.);   fCnewRoot++;}
03794   
03795   sup_axis_x->SetTitle(x_var_name);
03796   sup_axis_x->SetTitleSize(tit_siz_x);
03797   sup_axis_x->SetTitleOffset(tit_off_x);
03798   sup_axis_x->SetLabelSize(lab_siz_x);
03799   sup_axis_x->SetLabelOffset(lab_off_x);
03800   sup_axis_x->SetTickSize(tic_siz_x);
03801   sup_axis_x->Draw("SAME");
03802 
03803   //...................................................... Axe phi (y) ViewSMGrid
03804   Double_t phi_min = fEcalNumbering->GetPhiMin(SMNumber);
03805   Double_t phi_max = fEcalNumbering->GetPhiMax(SMNumber);
03806 
03807   TString  y_var_name  = GetHocoVecoAxisTitle("phi");
03808   TString  y_direction = fEcalNumbering->GetYDirectionEB(SMNumber);
03809 
03810   Float_t tit_siz_y = fCnaParHistos->AxisTitleSize();
03811   Float_t lab_siz_y = fCnaParHistos->AxisLabelSize("SMy");
03812   Float_t tic_siz_y = fCnaParHistos->AxisTickSize("SMy");
03813   Float_t tit_off_y = fCnaParHistos->AxisTitleOffset("SMy");
03814   Float_t lab_off_y = fCnaParHistos->AxisLabelOffset("SMy");
03815 
03816   TF1 *f2 = new TF1("f2", y_direction.Data(), phi_min, phi_max);           fCnewRoot++;
03817   TGaxis* sup_axis_y = 0;
03818   
03819   if ( y_direction == "-x" ) // ALWAYS IN THIS CASE: ymin->ymax <=> top->bottom ("-x") direction
03820     {sup_axis_y = new TGaxis(-(Float_t)1.5*(Float_t)size_eta, (Float_t)0.,
03821                              -(Float_t)1.5*(Float_t)size_eta, (Float_t)(size_phi_sm*MatSize),
03822                              "f2", (Int_t)size_phi_sm, "SC", 0.);   fCnewRoot++;}
03823   
03824   if ( y_direction == "x" )  // NEVER  IN THIS CASE: ymin->ymax <=> bottom->top ("x") direction
03825     {sup_axis_y = new TGaxis(-(Float_t)1.5*(Float_t)size_eta, (Float_t)0.,
03826                              -(Float_t)1.5*(Float_t)size_eta, (Float_t)(size_phi_sm*MatSize),
03827                              "f2", (Int_t)size_phi_sm, "SC", 0.);   fCnewRoot++;}
03828   
03829   sup_axis_y->SetTitle(y_var_name);
03830   sup_axis_y->SetTitleSize(tit_siz_y);
03831   sup_axis_y->SetTitleOffset(tit_off_y);
03832   sup_axis_y->SetLabelSize(lab_siz_y);
03833   sup_axis_y->SetLabelOffset(lab_off_y);
03834   sup_axis_y->SetTickSize(tic_siz_y);
03835   sup_axis_y->Draw("SAME");
03836 
03837   //...................................................... Axe jphi (jy) ViewSMGrid
03838   Double_t jphi_min     = fEcalNumbering->GetJPhiMin(SMNumber);
03839   Double_t jphi_max     = fEcalNumbering->GetJPhiMax(SMNumber);
03840 
03841   TString  jy_var_name  = " ";
03842   TString  jy_direction = fEcalNumbering->GetJYDirectionEB(SMNumber);
03843 
03844   TF1 *f3 = new TF1("f3", jy_direction.Data(), jphi_min, jphi_max);           fCnewRoot++;
03845   TGaxis* sup_axis_jy = 0;
03846   
03847   //............; essai
03848   sup_axis_jy = new TGaxis((Float_t)0., (Float_t)0.,
03849                            (Float_t)0., (Float_t)(size_phi_sm*MatSize),
03850                            "f3", (Int_t)size_phi_sm, "SC", 0.);   fCnewRoot++;
03851   
03852   if ( jy_direction == "-x" ) // IN THIS CASE FOR EB+: ymin->ymax <=> top->bottom ("-x") direction
03853     {jy_var_name  = GetEtaPhiAxisTitle("jphiSMB+");}
03854   
03855   if ( jy_direction == "x" )  // IN THIS CASE FOR EB-: ymin->ymax <=> bottom->top ("x") direction
03856     {jy_var_name  = GetEtaPhiAxisTitle("jphiSMB-");}
03857   
03858   lab_off_y = fCnaParHistos->AxisLabelOffset("SMyInEB");
03859 
03860   sup_axis_jy->SetTitle(jy_var_name);
03861   sup_axis_jy->SetTitleSize(tit_siz_y);
03862   sup_axis_jy->SetTitleOffset(tit_off_y);
03863   sup_axis_jy->SetLabelSize(lab_siz_y);
03864   sup_axis_jy->SetLabelOffset(lab_off_y);
03865   sup_axis_jy->SetTickSize(tic_siz_y);
03866   sup_axis_jy->Draw("SAME");
03867 
03868   //--------------------------- ViewSMGrid
03869           
03870   f1 = 0;
03871   f2 = 0;
03872   f3 = 0;
03873 
03874   gStyle->SetTextColor(fCnaParHistos->ColorDefinition("noir"));
03875 
03876 } // end of ViewSMGrid
03877 
03878 //=======================================      ENDCAP       ===============================
03879 void TEcnaHistos::DeeSCNumbering(const Int_t& DeeNumber)
03880 {
03881   //display the SC numbering of the Dee
03882 
03883   if( (DeeNumber > 0) && (DeeNumber <= fEcal->MaxDeeInEE()) )
03884     {
03885       Int_t  GeoBidSizeIX = fEcal->MaxSCIXInDee()*fEcal->MaxCrysIXInSC();
03886       Int_t  GeoBidSizeIY = fEcal->MaxSCIYInDee()*fEcal->MaxCrysIYInSC();
03887 
03888       Int_t  nb_binx  = GeoBidSizeIX;
03889       Int_t  nb_biny  = GeoBidSizeIY;
03890       Axis_t xinf_bid = (Axis_t)0.;
03891       Axis_t xsup_bid = (Axis_t)GeoBidSizeIX;
03892       Axis_t yinf_bid = (Axis_t)0.;
03893       Axis_t ysup_bid = (Axis_t)GeoBidSizeIY;   
03894   
03895       TString axis_x_var_name = "  IX  ";
03896       TString axis_y_var_name = "  IY  ";
03897 
03898       //------------------------------------------------------------------- DeeSCNumbering
03899       //........................................... empty histogram filling
03900       char* f_in_mat_tit = new char[fgMaxCar];                           fCnew++;
03901 
03902       sprintf(f_in_mat_tit, " Dee SC numbering ");
03903 
03904       // il faut tracer un bidim vide pour pouvoir tracer la grille et les axes
03905 
03906       TH2D* h_empty_bid = new TH2D("grid_bidim_IX_IY", f_in_mat_tit,
03907                                    nb_binx, xinf_bid,  xsup_bid,
03908                                    nb_biny, yinf_bid,  ysup_bid);     fCnewRoot++;
03909       h_empty_bid->Reset();
03910   
03911       h_empty_bid->GetXaxis()->SetTitle(axis_x_var_name);
03912       h_empty_bid->GetYaxis()->SetTitle(axis_y_var_name);
03913 
03914       // ------------------------------------------------ P L O T S   (DeeSCNumbering)
03915   
03916       char* f_in = new char[fgMaxCar];                           fCnew++;
03917   
03918       //...................... Taille/format canvas
03919   
03920       UInt_t canv_h = fCnaParHistos->CanvasFormatH("IXIYDee");
03921       UInt_t canv_w = fCnaParHistos->CanvasFormatW("IXIYDee");
03922   
03923       //............................................... options generales
03924       fFapStexType = fEcalNumbering->GetEEDeeType(DeeNumber);
03925 
03926       //............................................... paves commentaires (DeeSCNumbering)
03927       SetAllPavesViewStex("Numbering", DeeNumber);
03928 
03929       //------------------------------------ Canvas name ----------------- (DeeSCNumbering)  
03930 
03931       sprintf(f_in, "SC_numbering_for_Dee_Dee%d", DeeNumber);
03932       SetHistoPresentation((TH1D*)h_empty_bid,"Stex2DEENb");
03933       TCanvas *MainCanvas = new TCanvas(f_in, f_in, canv_w, canv_h);   fCnewRoot++;
03934       fCurrentCanvas = MainCanvas; fCurrentCanvasName = f_in;
03935 
03936       // cout << "*TEcnaHistosEE::ViewDee(...)> Plot is displayed on canvas ----> " << f_in << endl;
03937   
03938       delete [] f_in; f_in = 0;                                 fCdelete++;
03939 
03940       //------------------------ Canvas draw and update ------------ (DeeSCNumbering)  
03941       fPavComStex->Draw();
03942       fPavComCxyz->Draw();
03943   
03944       Double_t x_low = fCnaParHistos->BoxLeftX("bottom_left_box")    - 0.005;
03945       Double_t x_up  = fCnaParHistos->BoxRightX("bottom_right_box")  + 0.005;
03946       Double_t y_low = fCnaParHistos->BoxTopY("bottom_left_box")     + 0.005;
03947       Double_t y_up  = fCnaParHistos->BoxBottomY("top_left_box_Dee") - 0.005;
03948   
03949       Double_t x_margin = x_low;
03950       Double_t y_margin = y_low;
03951   
03952       MainCanvas->Divide( 1,  1, x_margin, y_margin);
03953       //           Divide(nx, ny, x_margin, y_margin,    color);
03954   
03955       gPad->cd(1);
03956       TVirtualPad* main_subpad = gPad;
03957       main_subpad->SetPad(x_low, y_low, x_up, y_up);
03958   
03959       h_empty_bid->DrawCopy("COL");   // il faut tracer un bidim vide pour pouvoir tracer la grille et les axes
03960       ViewDeeSCNumberingPad(DeeNumber);
03961       gPad->Update();
03962   
03963       //..................... retour aux options standard
03964       Bool_t b_true = 1;
03965       h_empty_bid->SetStats(b_true);    
03966   
03967       h_empty_bid->Delete(); h_empty_bid = 0;             fCdeleteRoot++;      
03968 
03969       //      delete MainCanvas;              fCdeleteRoot++;
03970   
03971       delete [] f_in_mat_tit;  f_in_mat_tit = 0;         fCdelete++;
03972     }
03973   else
03974     {
03975       cout << "!TEcnaHistos::DeeSCNumbering(...)> Dee = " << DeeNumber
03976            << ". Out of range ( range = [1," << fEcal->MaxDeeInEE() << "] )" << fTTBELL << endl;
03977     }
03978 }
03979 // end of DeeSCNumbering
03980 
03981 void TEcnaHistos::ViewDeeSCNumberingPad(const Int_t&   DeeNumber)
03982 {
03983 //display the SC numbering of the Dee in a Pad
03984 
03985   gStyle->SetTitleW(0.4);        // taille titre histos
03986   gStyle->SetTitleH(0.08);
03987 
03988   ViewDeeGrid(DeeNumber, " ");
03989 
03990   //..... SC numbers writing in the grid .... (ViewDeeSCNumberingPad)
03991 
03992   char* f_in = new char[fgMaxCar];                           fCnew++;
03993   gStyle->SetTextSize(0.0325);
03994 
03995   //------------------ LOOP ON THE Dee_SC NUMBER   (ViewDeeSCNumberingPad)
03996   Int_t x_channel =  0;    // => defined here after according to DeeDir and SCQuadType
03997   TText *text_DSSC_num      = new TText();        fCnewRoot++;
03998   TText *text_DeeSCCons_num = new TText();        fCnewRoot++;
03999 
04000   for (Int_t n1DeeSCEcna = 1; n1DeeSCEcna <= fEcal->MaxSCEcnaInDee(); n1DeeSCEcna++)
04001     {
04002       TString DeeDir     = fEcalNumbering->GetDeeDirViewedFromIP(DeeNumber);
04003       TString SCQuadType = fEcalNumbering->GetSCQuadFrom1DeeSCEcna(n1DeeSCEcna);
04004       if( SCQuadType == "top"    &&  DeeDir == "right"){x_channel = 13;}
04005       if( SCQuadType == "top"    &&  DeeDir == "left" ){x_channel =  7;}
04006       if( SCQuadType == "bottom" &&  DeeDir == "left" ){x_channel = 11;}  
04007       if( SCQuadType == "bottom" &&  DeeDir == "right"){x_channel = 17;}
04008       Int_t i_SCEcha = (Int_t)x_channel;
04009       Double_t x_from_IX = (Double_t)GetXCrysInStex(DeeNumber, n1DeeSCEcna, i_SCEcha);
04010       Double_t y_from_IY = (Double_t)GetYCrysInStex(DeeNumber, n1DeeSCEcna, i_SCEcha);
04011       TString DeeEndcap  = fEcalNumbering->GetEEDeeEndcap(DeeNumber);
04012       Color_t couleur_SC = GetSCColor(DeeEndcap, DeeDir, SCQuadType);
04013       text_DSSC_num->SetTextColor(couleur_SC);
04014       text_DeeSCCons_num->SetTextColor((Color_t)1);
04015 
04016       Int_t i_DSSC      = fEcalNumbering->GetDSSCFrom1DeeSCEcna(DeeNumber, n1DeeSCEcna);
04017       Int_t i_DeeSCCons = fEcalNumbering->GetDeeSCConsFrom1DeeSCEcna(DeeNumber, n1DeeSCEcna);
04018       if( i_DSSC > 0 )
04019         {
04020           if(
04021              //.................................................... (D2,S9) , (D4,S1)
04022               !(i_DeeSCCons ==  33 && n1DeeSCEcna ==  60) &&
04023               !(i_DeeSCCons ==  33 && n1DeeSCEcna == 119) &&
04024               //................................................... (D2,S8) , (D4,S2)
04025               !(i_DeeSCCons ==  29 && n1DeeSCEcna ==  32) &&   // !(29c and 58c)
04026               !(i_DeeSCCons ==  29 && n1DeeSCEcna == 138) &&
04027               !(i_DeeSCCons ==  29 && n1DeeSCEcna == 157) &&
04028               !(i_DeeSCCons ==  58 && n1DeeSCEcna == 176) &&
04029               !(i_DeeSCCons ==  58 && n1DeeSCEcna == 193) &&
04030               //.................................................... (D2,S7) , (D4,S3)
04031               !(i_DeeSCCons == 149 && n1DeeSCEcna == 188) &&
04032               //.................................................... (D2,S6) , (D4,S4)
04033               !(i_DeeSCCons == 112 && n1DeeSCEcna ==  29) &&
04034               !(i_DeeSCCons == 112 && n1DeeSCEcna == 144) &&
04035               !(i_DeeSCCons == 112 && n1DeeSCEcna == 165) &&
04036               !(i_DeeSCCons == 119 && n1DeeSCEcna == 102) &&
04037               !(i_DeeSCCons == 119 && n1DeeSCEcna == 123) &&
04038               //.................................................... (D2,S5) , (D4,S5)
04039               !(i_DeeSCCons == 132 && n1DeeSCEcna ==  41) &&
04040               //----------------------------------------------------------------------
04041               //.................................................... (D1,S1) , (D3,S9)
04042               !(i_DeeSCCons == 182 && n1DeeSCEcna ==  60) &&
04043               !(i_DeeSCCons == 182 && n1DeeSCEcna == 119) &&
04044               //.................................................... (D1,S2) , (D3,S8)
04045               !(i_DeeSCCons == 178 && n1DeeSCEcna ==  32) &&   // !(178c and 207c)
04046               !(i_DeeSCCons == 178 && n1DeeSCEcna == 138) &&
04047               !(i_DeeSCCons == 178 && n1DeeSCEcna == 157) &&
04048               !(i_DeeSCCons == 207 && n1DeeSCEcna == 176) &&
04049               !(i_DeeSCCons == 207 && n1DeeSCEcna == 193) &&
04050               //.................................................... (D1,S3) , (D3,S7)
04051               !(i_DeeSCCons == 298 && n1DeeSCEcna == 188) &&
04052               //.................................................... (D1,S4) , (D3,S6)
04053               !(i_DeeSCCons == 261 && n1DeeSCEcna ==  29) &&   // !(261a and 268a)
04054               !(i_DeeSCCons == 261 && n1DeeSCEcna == 144) &&
04055               !(i_DeeSCCons == 261 && n1DeeSCEcna == 165) &&
04056               !(i_DeeSCCons == 268 && n1DeeSCEcna == 102) &&
04057               !(i_DeeSCCons == 268 && n1DeeSCEcna == 123) &&
04058               //.................................................... (D1,S5) , (D3,S5)
04059               !(i_DeeSCCons == 281 && n1DeeSCEcna ==  41) 
04060               )
04061             {
04062               sprintf(f_in, "%d", i_DSSC);
04063               text_DSSC_num->DrawText(x_from_IX, y_from_IY+1, f_in);      // <=== DrawText: prend du temps
04064               sprintf(f_in, "%d", i_DeeSCCons);
04065               text_DeeSCCons_num->DrawText(x_from_IX, y_from_IY-1, f_in); // <=== DrawText: prend du temps
04066             }
04067 
04068           //.................................................... (D2,S9) , (D4,S1)
04069           if( i_DeeSCCons ==  33 && n1DeeSCEcna ==  60 )
04070             {
04071               sprintf(f_in, "30a");
04072               text_DSSC_num->DrawText(x_from_IX, y_from_IY+1, f_in);
04073               sprintf(f_in, "33a");
04074               text_DeeSCCons_num->DrawText(x_from_IX, y_from_IY-1, f_in);
04075             }
04076           if( i_DeeSCCons ==  33 && n1DeeSCEcna == 119 )
04077             {
04078               sprintf(f_in, "30b");
04079               text_DSSC_num->DrawText(x_from_IX, y_from_IY+1, f_in);
04080               sprintf(f_in, "33b");
04081               text_DeeSCCons_num->DrawText(x_from_IX, y_from_IY-1, f_in);
04082             }
04083           //.................................................... (D2,S8) , (D4,S2)
04084           if( i_DeeSCCons ==  29 && n1DeeSCEcna == 32 )
04085             {
04086               sprintf(f_in, " 3c-25c");
04087               text_DSSC_num->DrawText(x_from_IX, y_from_IY+1, f_in);
04088               sprintf(f_in, "29c-58c");
04089               text_DeeSCCons_num->DrawText(x_from_IX, y_from_IY-1, f_in);
04090             }
04091           if( i_DeeSCCons ==  29 && n1DeeSCEcna == 138 )
04092             {
04093               sprintf(f_in, "3a");
04094               text_DSSC_num->DrawText(x_from_IX, y_from_IY+1, f_in);
04095               sprintf(f_in, "29a");
04096               text_DeeSCCons_num->DrawText(x_from_IX, y_from_IY-1, f_in);
04097             }
04098           if( i_DeeSCCons ==  29 && n1DeeSCEcna == 157 )
04099             {
04100               sprintf(f_in, "3b");
04101               text_DSSC_num->DrawText(x_from_IX, y_from_IY+1, f_in);
04102               sprintf(f_in, "29b");
04103               text_DeeSCCons_num->DrawText(x_from_IX, y_from_IY-1, f_in);
04104             }
04105 
04106           if( i_DeeSCCons ==  58 && n1DeeSCEcna == 176 )
04107             {
04108               sprintf(f_in, "25a");
04109               text_DSSC_num->DrawText(x_from_IX, y_from_IY+1, f_in);
04110               sprintf(f_in, "58a");
04111               text_DeeSCCons_num->DrawText(x_from_IX, y_from_IY-1, f_in);
04112             }
04113           if( i_DeeSCCons ==  58 && n1DeeSCEcna == 193 )
04114             {
04115               sprintf(f_in, "25b");
04116               text_DSSC_num->DrawText(x_from_IX, y_from_IY+1, f_in);
04117               sprintf(f_in, "58b");
04118               text_DeeSCCons_num->DrawText(x_from_IX, y_from_IY-1, f_in);
04119             }
04120           //.................................................... (D2,S7) , (D4,S3)
04121           if( i_DeeSCCons == 149 && n1DeeSCEcna == 188 )
04122             {
04123               sprintf(f_in, "34a");
04124               text_DSSC_num->DrawText(x_from_IX, y_from_IY+1, f_in);
04125               sprintf(f_in, "149a");
04126               text_DeeSCCons_num->DrawText(x_from_IX, y_from_IY-1, f_in);
04127             }
04128           //.................................................... (D2,S6) , (D4,S4)
04129           if( i_DeeSCCons == 112 && n1DeeSCEcna == 29 )
04130             {
04131               sprintf(f_in, " 14a-21a");
04132               text_DSSC_num->DrawText(x_from_IX, y_from_IY+1, f_in);
04133               sprintf(f_in, "112a-119a");
04134               text_DeeSCCons_num->DrawText(x_from_IX, y_from_IY-1, f_in);
04135             }
04136           if( i_DeeSCCons == 112 && n1DeeSCEcna == 144 )
04137             {
04138               sprintf(f_in, "14c");
04139               text_DSSC_num->DrawText(x_from_IX, y_from_IY+1, f_in);
04140               sprintf(f_in, "112c");
04141               text_DeeSCCons_num->DrawText(x_from_IX, y_from_IY-1, f_in);
04142             }
04143           if( i_DeeSCCons == 112 && n1DeeSCEcna == 165 )
04144             {
04145               sprintf(f_in, "14a");
04146               text_DSSC_num->DrawText(x_from_IX, y_from_IY+1, f_in);
04147               sprintf(f_in, "112b");
04148               text_DeeSCCons_num->DrawText(x_from_IX, y_from_IY-1, f_in);
04149             }
04150 
04151           if( i_DeeSCCons == 119 && n1DeeSCEcna == 102 )
04152             {
04153               sprintf(f_in, "21c");
04154               text_DSSC_num->DrawText(x_from_IX, y_from_IY+1, f_in);
04155               sprintf(f_in, "119c");
04156               text_DeeSCCons_num->DrawText(x_from_IX, y_from_IY-1, f_in);
04157             }
04158           if( i_DeeSCCons == 119 && n1DeeSCEcna == 123 )
04159             {
04160               sprintf(f_in, "21b");
04161               text_DSSC_num->DrawText(x_from_IX, y_from_IY+1, f_in);
04162               sprintf(f_in, "119b");
04163               text_DeeSCCons_num->DrawText(x_from_IX, y_from_IY-1, f_in);
04164             }
04165           //.................................................... (D2,S5) , (D4,S5)
04166           if( i_DeeSCCons == 132 && n1DeeSCEcna ==  41 )
04167             {
04168               sprintf(f_in, "3a");
04169               text_DSSC_num->DrawText(x_from_IX, y_from_IY+1, f_in);
04170               sprintf(f_in, "132a");
04171               text_DeeSCCons_num->DrawText(x_from_IX, y_from_IY-1, f_in);
04172             }
04173 
04174           //.................................................... (D1,S1) , (D3,S9)
04175           if( i_DeeSCCons == 182 && n1DeeSCEcna ==  60 )
04176             {
04177               sprintf(f_in, "30a");
04178               text_DSSC_num->DrawText(x_from_IX, y_from_IY+1, f_in);
04179               sprintf(f_in, "182a");
04180               text_DeeSCCons_num->DrawText(x_from_IX, y_from_IY-1, f_in);
04181             }
04182           if( i_DeeSCCons == 182 && n1DeeSCEcna == 119 )
04183             {
04184               sprintf(f_in, "30b");
04185               text_DSSC_num->DrawText(x_from_IX, y_from_IY+1, f_in);
04186               sprintf(f_in, "182b");
04187               text_DeeSCCons_num->DrawText(x_from_IX, y_from_IY-1, f_in);
04188             }
04189           //.................................................... (D1,S2) , (D3,S8)
04190           if( i_DeeSCCons == 178 && n1DeeSCEcna == 32 )
04191             {
04192               sprintf(f_in, "  3c-25c");
04193               text_DSSC_num->DrawText(x_from_IX-6, y_from_IY+1, f_in);
04194               sprintf(f_in, "178c-207c");
04195               text_DeeSCCons_num->DrawText(x_from_IX-6, y_from_IY-1, f_in);
04196             }
04197           if( i_DeeSCCons == 178 && n1DeeSCEcna == 138 )
04198             {
04199               sprintf(f_in, "3a");
04200               text_DSSC_num->DrawText(x_from_IX, y_from_IY+1, f_in);
04201               sprintf(f_in, "178a");
04202               text_DeeSCCons_num->DrawText(x_from_IX, y_from_IY-1, f_in);
04203             }
04204           if( i_DeeSCCons == 178 && n1DeeSCEcna == 157 )
04205             {
04206               sprintf(f_in, "3b");
04207               text_DSSC_num->DrawText(x_from_IX, y_from_IY+1, f_in);
04208               sprintf(f_in, "178b");
04209               text_DeeSCCons_num->DrawText(x_from_IX, y_from_IY-1, f_in);
04210             }
04211 
04212           if( i_DeeSCCons == 207 && n1DeeSCEcna == 176 )
04213             {
04214               sprintf(f_in, "25a");
04215               text_DSSC_num->DrawText(x_from_IX, y_from_IY+1, f_in);
04216               sprintf(f_in, "207a");
04217               text_DeeSCCons_num->DrawText(x_from_IX, y_from_IY-1, f_in);
04218             }
04219           if( i_DeeSCCons == 207 && n1DeeSCEcna == 193 )
04220             {
04221               sprintf(f_in, "25b");
04222               text_DSSC_num->DrawText(x_from_IX, y_from_IY+1, f_in);
04223               sprintf(f_in, "207b");
04224               text_DeeSCCons_num->DrawText(x_from_IX, y_from_IY-1, f_in);
04225             }
04226           //.................................................... (D1,S3) , (D3,S7)
04227           if( i_DeeSCCons == 298 && n1DeeSCEcna == 188 )
04228             {
04229               sprintf(f_in, "34a");
04230               text_DSSC_num->DrawText(x_from_IX, y_from_IY+1, f_in);
04231               sprintf(f_in, "298a");
04232               text_DeeSCCons_num->DrawText(x_from_IX, y_from_IY-1, f_in);
04233             }
04234           //.................................................... (D1,S4) , (D3,S6)
04235           if( i_DeeSCCons == 261 && n1DeeSCEcna == 29 )
04236             {
04237               sprintf(f_in, " 14a-21a");
04238               text_DSSC_num->DrawText(x_from_IX-6, y_from_IY+1, f_in);
04239               sprintf(f_in, "261a-268a");
04240               text_DeeSCCons_num->DrawText(x_from_IX-6, y_from_IY-1, f_in);
04241             }
04242           if( i_DeeSCCons == 261 && n1DeeSCEcna == 144 )
04243             {
04244               sprintf(f_in, "14a");
04245               text_DSSC_num->DrawText(x_from_IX, y_from_IY+1, f_in);
04246               sprintf(f_in, "261c");
04247               text_DeeSCCons_num->DrawText(x_from_IX, y_from_IY-1, f_in);
04248             }
04249           if( i_DeeSCCons == 261 && n1DeeSCEcna == 165 )
04250             {
04251               sprintf(f_in, "14b");
04252               text_DSSC_num->DrawText(x_from_IX, y_from_IY+1, f_in);
04253               sprintf(f_in, "261b");
04254               text_DeeSCCons_num->DrawText(x_from_IX, y_from_IY-1, f_in);
04255             }
04256 
04257           if( i_DeeSCCons == 268 && n1DeeSCEcna == 102 )
04258             {
04259               sprintf(f_in, "21c");
04260               text_DSSC_num->DrawText(x_from_IX, y_from_IY+1, f_in);
04261               sprintf(f_in, "268c");
04262               text_DeeSCCons_num->DrawText(x_from_IX, y_from_IY-1, f_in);
04263             }
04264           if( i_DeeSCCons == 268 && n1DeeSCEcna == 123 )
04265             {
04266               sprintf(f_in, "21b");
04267               text_DSSC_num->DrawText(x_from_IX, y_from_IY+1, f_in);
04268               sprintf(f_in, "268b");
04269               text_DeeSCCons_num->DrawText(x_from_IX, y_from_IY-1, f_in);
04270             }
04271           //.................................................... (D1,S5) , (D3,S5)
04272           if( i_DeeSCCons == 281 && n1DeeSCEcna ==  41 )
04273             {
04274               sprintf(f_in, "20a");
04275               text_DSSC_num->DrawText(x_from_IX, y_from_IY+1, f_in);
04276               sprintf(f_in, "281a");
04277               text_DeeSCCons_num->DrawText(x_from_IX, y_from_IY-1, f_in);
04278             }
04279         }
04280     }
04281 
04282   // delete text_DSSC_num;             fCdeleteRoot++;
04283  
04284   //......................... mention "color, black"  
04285   Color_t coul_textcolors = fCnaParHistos->ColorDefinition("noir");
04286   sprintf( f_in, "color: nb in Data Sector, black: nb for construction");
04287   Int_t x_colors = 3;
04288   Int_t y_colors = -14;
04289 
04290   TText *text_colors = new TText(x_colors, y_colors, f_in);        fCnewRoot++;
04291   text_colors->SetTextSize(0.03);
04292   text_colors->SetTextColor(coul_textcolors);
04293   text_colors->Draw();
04294 
04295   delete [] f_in;  f_in = 0;                                     fCdelete++;
04296 
04297   Color_t couleur_noir = fCnaParHistos->ColorDefinition("noir");
04298   gStyle->SetTextColor(couleur_noir);
04299 }
04300 //---------------->  end of ViewDeeSCNumberingPad()
04301 
04302 void TEcnaHistos::ViewDeeGrid(const Int_t& DeeNumber, const TString c_option)
04303 {
04304  //Grid of one Dee with axis IX and IY
04305 
04306   Int_t  GeoBidSizeIX = fEcal->MaxSCIXInDee()*fEcal->MaxCrysIXInSC();
04307   Int_t  GeoBidSizeIY = fEcal->MaxSCIYInDee()*fEcal->MaxCrysIYInSC();
04308 
04309   if ( c_option == "corcc")
04310     {
04311       GeoBidSizeIX = fEcal->MaxSCIXInDee()*fEcal->MaxCrysInSC();
04312       GeoBidSizeIY = fEcal->MaxSCIYInDee()*fEcal->MaxCrysInSC();
04313     }
04314 
04315   Int_t  nb_binx  = GeoBidSizeIX;
04316   Int_t  nb_biny  = GeoBidSizeIY;
04317   Axis_t xinf_bid = (Axis_t)0.;
04318   Axis_t xsup_bid = (Axis_t)GeoBidSizeIX;
04319  
04320   Axis_t   yinf_bid = (Axis_t)0.;
04321   Axis_t   ysup_bid = (Axis_t)GeoBidSizeIY;
04322   Double_t ymid_bid = (Double_t)(ysup_bid-yinf_bid)/2.;
04323  
04324   //---------------- trace de la grille: un rectangle = un super-cristal
04325 
04326   Int_t size_IX = fEcal->MaxCrysIXInSC();
04327   Int_t size_IY = fEcal->MaxCrysIYInSC();
04328 
04329   if ( c_option == "corcc"){size_IX = fEcal->MaxCrysInSC(); size_IY = fEcal->MaxCrysInSC();}
04330 
04331   Int_t max_x  = nb_binx/size_IX;
04332   Int_t max_y  = nb_biny/size_IY;
04333   Int_t max_yd = max_y/2;
04334 
04335   //= SURLIGNAGES (unite de coordonnees: le cristal ou 5 fois le cristal si option corcc)
04336   //........................... multplicative coefficient for corcc option
04337   Int_t coefcc_x = 1;
04338   Int_t coefcc_y = 1;
04339   if ( c_option == "corcc"){coefcc_x = fEcal->MaxCrysIXInSC(); coefcc_y = fEcal->MaxCrysIYInSC();}
04340 
04341   //............................. lignes horizontales
04342   Double_t yline = (Double_t)yinf_bid - (Double_t)size_IY;
04343 
04344   Double_t xline_beg = (Double_t)xinf_bid;
04345   Double_t xline_end = (Double_t)xsup_bid;
04346 
04347   //           k  =   0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10
04348   Int_t x_min[11] = {11,11, 7, 0, 0, 0, 0, 0, 0, 0, 0};
04349   Int_t x_max[11] = {50,50,47,45,45,42,37,35,30,15,50}; 
04350   for(Int_t i=0;i<11;i++){x_min[i] = coefcc_x*x_min[i]; x_max[i] = coefcc_x*x_max[i];}
04351   
04352   for( Int_t j = 0 ; j < max_y ; j++)
04353     {
04354       if( j < max_yd )  // j = 0,1,2,3,4,5,6,7,8,9
04355         {
04356           if( DeeNumber == 1 || DeeNumber == 3 ) 
04357             {
04358               xline_beg = xinf_bid + (Double_t)x_min[10-j];
04359               xline_end = xinf_bid + (Double_t)x_max[10-j];
04360             }
04361           if( DeeNumber == 2 || DeeNumber == 4 ) 
04362             {
04363               xline_beg = xsup_bid - (Double_t)x_max[10-j];
04364               xline_end = xsup_bid - (Double_t)x_min[10-j];
04365             }
04366         }
04367 
04368       if( j == max_yd ) // j = 10
04369         {
04370           if( DeeNumber == 1 || DeeNumber == 3 ) 
04371             {
04372               xline_beg = xinf_bid + (Double_t)x_min[0];
04373               xline_end = xinf_bid + (Double_t)x_max[0];
04374             }
04375           if( DeeNumber == 2 || DeeNumber == 4 ) 
04376             {
04377               xline_beg = xsup_bid - (Double_t)x_max[0];
04378               xline_end = xsup_bid - (Double_t)x_min[0];
04379             }
04380         }
04381 
04382       if( j > max_yd ) // j = 11,12,13,14,15,16,17,18,19,20
04383         {
04384           if( DeeNumber == 1 || DeeNumber == 3 ) 
04385             {
04386               xline_beg = xinf_bid + (Double_t)x_min[j-10];
04387               xline_end = xinf_bid + (Double_t)x_max[j-10];
04388             }
04389           if( DeeNumber == 2 || DeeNumber == 4 ) 
04390             {
04391               xline_beg = xsup_bid - (Double_t)x_max[j-10];
04392               xline_end = xsup_bid - (Double_t)x_min[j-10];
04393             }
04394         }
04395 
04396       yline = yline + (Double_t)size_IY;
04397       TLine *lin;
04398       lin = new TLine(xline_beg, yline, xline_end, yline); fCnewRoot++;
04399       lin->Draw();
04400       //lin->Delete();   // => si on delete, pas de trace de la ligne
04401       // delete lin;             fCdeleteRoot++;
04402     }
04403 
04404   //.......................... lignes verticales
04405   Double_t xline = (Double_t)xinf_bid - (Double_t)size_IX;
04406   
04407   Double_t yline_haut_bot = (Double_t)ymid_bid;
04408   Double_t yline_haut_top = (Double_t)ysup_bid;
04409 
04410   Double_t yline_bas_bot = (Double_t)yinf_bid;
04411   Double_t yline_bas_top = (Double_t)ymid_bid;
04412 
04413   // coordonnees demi-lignes 
04414   //           l  =   0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10
04415   Int_t y_min[11] = { 0,11, 7, 0, 0, 0, 0, 0, 0, 0, 0};
04416   Int_t y_max[11] = {50,50,47,45,45,42,38,35,30,15,10};
04417   for(Int_t i=0;i<11;i++){y_min[i] = coefcc_y*y_min[i]; y_max[i] = coefcc_y*y_max[i];}
04418 
04419   gStyle->SetTextSize(0.075);   //  ===> pourquoi pas avant?
04420 
04421   for( Int_t i = 0 ; i <= max_x ; i++)
04422     {
04423       if( DeeNumber == 1 || DeeNumber == 3 ) 
04424         {
04425           yline_haut_bot = ymid_bid + (Double_t)y_min[i];
04426           yline_haut_top = ymid_bid + (Double_t)y_max[i];
04427         }
04428       if( DeeNumber == 2 || DeeNumber == 4 ) 
04429         {
04430           yline_haut_bot = ymid_bid + (Double_t)y_min[10-i];
04431           yline_haut_top = ymid_bid + (Double_t)y_max[10-i];
04432         }
04433       yline_bas_bot  = ysup_bid - yline_haut_top;
04434       yline_bas_top  = ysup_bid - yline_haut_bot;
04435       
04436       xline = xline + (Double_t)size_IX;
04437       TLine *lin_haut;
04438       lin_haut = new TLine(xline, yline_haut_bot, xline, yline_haut_top); fCnewRoot++;
04439       lin_haut->Draw();
04440       // delete lin_haut;             fCdeleteRoot++;
04441       TLine *lin_bas;
04442       lin_bas = new TLine(xline, yline_bas_bot, xline, yline_bas_top); fCnewRoot++;
04443       lin_bas->Draw();
04444       // delete lin_bas;             fCdeleteRoot++;
04445     }
04446 
04447   EEDataSectors(coefcc_x, coefcc_y, DeeNumber, "Dee");
04448   EEGridAxis(coefcc_x, coefcc_y, DeeNumber, "Dee", c_option);
04449 
04450 } // end of ViewDeeGrid
04451 
04452 //=================================================================================
04453 //
04454 //             SqrtContourLevels(const Int_t& nb_niv, Double_t* cont_niv)
04455 //
04456 //=================================================================================
04457 void TEcnaHistos::SqrtContourLevels(const Int_t& nb_niv, Double_t* cont_niv)
04458 {
04459 //Calculation of levels in z coordinate for 3D plots. Square root scale
04460   
04461   Int_t nb_niv2 = (nb_niv+1)/2;
04462   
04463   for (Int_t num_niv = 0; num_niv < nb_niv2; num_niv++)
04464     {
04465       Int_t ind_niv = num_niv + nb_niv2 - 1;
04466       if ( ind_niv < 0 || ind_niv > nb_niv )
04467         {
04468           cout << "!TEcnaHistos::ContourLevels(...)> *** ERROR *** "
04469                << "wrong contour levels for correlation matrix"
04470                << fTTBELL << endl;
04471         }
04472       else
04473         {
04474           cont_niv[ind_niv] =
04475             (Double_t)(num_niv*num_niv)/
04476             ((Double_t)((nb_niv2-1)*(nb_niv2-1)));
04477         }
04478     }
04479   for (Int_t num_niv = -1; num_niv > -nb_niv2; num_niv--)
04480     {
04481       Int_t ind_niv = num_niv + nb_niv2 - 1;
04482       if ( ind_niv < 0 || ind_niv > nb_niv )
04483         {
04484           cout << "!TEcnaHistos::ContourLevels(...)> *** ERROR *** "
04485                << "wrong contour levels for correlation matrix"
04486                << fTTBELL << endl;
04487         }
04488       else
04489         {
04490           cont_niv[ind_niv] =
04491             -(Double_t)(num_niv*num_niv)/
04492             ((Double_t)((nb_niv2-1)*(nb_niv2-1)));
04493         }
04494     }
04495 }
04496 
04497 //==========================================================================
04498 //
04499 //                    GetHocoVecoAxisTitle
04500 //
04501 //==========================================================================
04502 TString TEcnaHistos::GetHocoVecoAxisTitle(const TString chcode)
04503 {
04504   TString xname = " ";
04505 
04506   if ( fFlagSubDet == "EB" ){xname = GetEtaPhiAxisTitle(chcode);}
04507   if ( fFlagSubDet == "EE" ){xname = GetIXIYAxisTitle(chcode);}
04508 
04509   return xname;
04510 }
04511 
04512 TString TEcnaHistos::GetEtaPhiAxisTitle(const TString chcode)
04513 {
04514   TString xname = " ";
04515 
04516   if ( chcode == "ietaEB" ){xname = "i#eta Xtal ";}
04517   if ( chcode == "ietaSM" ){xname = "i#eta Xtal ";}
04518   if ( chcode == "ietaTow"){xname = "i#eta Xtal        ";}
04519 
04520   if ( chcode == "iphiEB"   ){xname = "         i#varphi Xtal";}
04521   if ( chcode == "jphiEB+"  ){xname = "         i#varphi Xtal";}
04522   if ( chcode == "jphiEB-"  ){xname = "         i#varphi Xtal";}
04523   if ( chcode == "jphiSMB+" ){xname = "         i#varphi Xtal";}
04524   if ( chcode == "jphiSMB-" ){xname = "i#varphi Xtal    ";}
04525   if ( chcode == "jphiTow"  ){xname = "i#varphi Xtal in SM        ";}
04526   if ( chcode == "phi"      ){xname = "i#varphi Xtal in EB  ";}
04527 
04528   return xname;
04529 }
04530 
04531 TString TEcnaHistos::GetIXIYAxisTitle(const TString chcode)
04532 {
04533   TString xname = " ";
04534 
04535   if ( chcode == "iIXDee"  ){xname = "IX(SC)";}
04536 
04537   if ( chcode == "iIXDee1" ){xname = "                                                    -IX Xtal";}
04538   if ( chcode == "iIXDee2" ){xname = " IX Xtal                                                     ";}
04539   if ( chcode == "iIXDee3" ){xname = " IX Xtal";}
04540   if ( chcode == "iIXDee4" ){xname = "-IX Xtal                                                             ";}
04541 
04542   if ( chcode == "iIXEE"   ){xname = "                      IX Xtal";}
04543 
04544   if ( chcode == "iIXSC"  ){xname = "IX Xtal";}
04545 
04546   if ( chcode == "jIYDee" ){xname = "IY Xtal";}
04547   if ( chcode == "jIYSC"  ){xname = "IY Xtal";}
04548   if ( chcode == "IY"     ){xname = "IY";}
04549 
04550   return xname;
04551 }
04552 //=======================================================================================
04553 //
04554 //                                 Stas view (StasHocoVeco)
04555 //
04556 //=======================================================================================
04557 void TEcnaHistos::EBEtaPhiAveragedNumberOfEvents(){StasHocoVecoAveragedNumberOfEvents();}
04558 void TEcnaHistos::EEIXIYAveragedNumberOfEvents(){StasHocoVecoAveragedNumberOfEvents();}
04559 void TEcnaHistos::StasHocoVecoAveragedNumberOfEvents(){ViewStas("D_NOE_ChNb");}
04560 
04561 void TEcnaHistos::EBEtaPhiAveragedPedestals(){StasHocoVecoAveragedPedestals();}
04562 void TEcnaHistos::EEIXIYAveragedPedestals(){StasHocoVecoAveragedPedestals();}
04563 void TEcnaHistos::StasHocoVecoAveragedPedestals(){ViewStas("D_Ped_ChNb");}
04564 
04565 void TEcnaHistos::EBEtaPhiAveragedTotalNoise(){StasHocoVecoAveragedTotalNoise();}
04566 void TEcnaHistos::EEIXIYAveragedTotalNoise(){StasHocoVecoAveragedTotalNoise();}
04567 void TEcnaHistos::StasHocoVecoAveragedTotalNoise(){ViewStas("D_TNo_ChNb");}
04568 
04569 void TEcnaHistos::EBEtaPhiAveragedMeanOfCorss(){StasHocoVecoAveragedMeanOfCorss();}
04570 void TEcnaHistos::EEIXIYAveragedMeanOfCorss(){StasHocoVecoAveragedMeanOfCorss();}
04571 void TEcnaHistos::StasHocoVecoAveragedMeanOfCorss(){ViewStas("D_MCs_ChNb");}
04572 
04573 void TEcnaHistos::EBEtaPhiAveragedLowFrequencyNoise(){StasHocoVecoAveragedLowFrequencyNoise();}
04574 void TEcnaHistos::EEIXIYAveragedLowFrequencyNoise(){StasHocoVecoAveragedLowFrequencyNoise();}
04575 void TEcnaHistos::StasHocoVecoAveragedLowFrequencyNoise(){ViewStas("D_LFN_ChNb");}
04576 
04577 void TEcnaHistos::EBEtaPhiAveragedHighFrequencyNoise(){StasHocoVecoAveragedHighFrequencyNoise();}
04578 void TEcnaHistos::EEIXIYAveragedHighFrequencyNoise(){StasHocoVecoAveragedHighFrequencyNoise();}
04579 void TEcnaHistos::StasHocoVecoAveragedHighFrequencyNoise(){ViewStas("D_HFN_ChNb");}
04580 
04581 void TEcnaHistos::EBEtaPhiAveragedSigmaOfCorss(){StasHocoVecoAveragedSigmaOfCorss();}
04582 void TEcnaHistos::EEIXIYAveragedSigmaOfCorss(){StasHocoVecoAveragedSigmaOfCorss();}
04583 void TEcnaHistos::StasHocoVecoAveragedSigmaOfCorss(){ViewStas("D_SCs_ChNb");}
04584 
04585 //=======================================================================================
04586 //
04587 //                              ViewStas     
04588 //
04589 //           (Hoco,Veco) matrices for all the Stex's of a Stas             
04590 //                        Stas = EB or EE
04591 //
04592 //=======================================================================================
04593 void TEcnaHistos::ViewStas(const TString HistoCode)
04594 {
04595 // (Hoco, Veco) matrices for all the Stex's of a Stas
04596 
04597   //......................... matrix title  
04598   char* f_in_mat_tit = new char[fgMaxCar];               fCnew++;
04599           
04600   if (HistoCode == "D_NOE_ChNb"){sprintf(f_in_mat_tit, "Number of Events");}
04601   if (HistoCode == "D_Ped_ChNb"){sprintf(f_in_mat_tit, "Pedestals");}
04602   if (HistoCode == "D_TNo_ChNb"){sprintf(f_in_mat_tit, "Total Noise");}
04603   if (HistoCode == "D_MCs_ChNb"){sprintf(f_in_mat_tit, "Mean Cor(s,s')");}
04604   if (HistoCode == "D_LFN_ChNb"){sprintf(f_in_mat_tit, "Low Frequency Noise");}
04605   if (HistoCode == "D_HFN_ChNb"){sprintf(f_in_mat_tit, "High Frequency Noise");}
04606   if (HistoCode == "D_SCs_ChNb"){sprintf(f_in_mat_tit, "Sigma Cor(s,s')");}
04607           
04608   //.... Axis parameters: *** WARNING *** EB ===>  x (Bid Hoco) = phi (StinVeco),  y (Bid Veco) = eta (StinHoco)
04609   Int_t GeoBidSizeHoco = fEcal->MaxStinVecoInStas();
04610   Int_t GeoBidSizeVeco = fEcal->MaxStinHocoInStas();
04611 
04612   Int_t vertic_empty_strips  = 3;
04613   Int_t vertic_empty_strip_1 = 1;
04614 
04615   if ( fFlagSubDet == "EE" )
04616     {
04617       // for empty vertical strips: before EE-, between EE- and EE+, after EE+ on plot
04618       GeoBidSizeHoco = fEcal->MaxStinHocoInStas() + vertic_empty_strips; 
04619       GeoBidSizeVeco = fEcal->MaxStinVecoInStas();
04620     }
04621 
04622   Int_t  nb_binx  = GeoBidSizeHoco;
04623   Int_t  nb_biny  = GeoBidSizeVeco;
04624   Axis_t xinf_bid = (Axis_t)0.;
04625   Axis_t xsup_bid = (Axis_t)GeoBidSizeHoco;
04626   Axis_t yinf_bid = (Axis_t)0.;
04627   Axis_t ysup_bid = (Axis_t)GeoBidSizeVeco;   
04628       
04629   TString axis_x_var_name = "  #Hoco  ";
04630   TString axis_y_var_name = "  #varVeco  ";
04631 
04632   //............. matrices reading and histogram filling   (ViewStas)
04633 
04634   TH2D* h_geo_bid = new TH2D("geobidim_Hoco_Veco", f_in_mat_tit,
04635                              nb_binx, xinf_bid,    xsup_bid,
04636                              nb_biny, yinf_bid,    ysup_bid);     fCnewRoot++;
04637   h_geo_bid->Reset();
04638 
04639   Int_t CounterExistingFile = 0;
04640   Int_t CounterDataExist = 0;
04641 
04642   Int_t* xFapNbOfEvts = new Int_t[fEcal->MaxStexInStas()];      fCnew++;
04643   for(Int_t i=0; i<fEcal->MaxStexInStas(); i++){xFapNbOfEvts[i]=0;}
04644   Int_t* NOFE_int = new Int_t[fEcal->MaxCrysEcnaInStex()];      fCnew++;
04645 
04646   //......................................................................... (ViewStas)
04647   for(Int_t iStasStex=0; iStasStex<fEcal->MaxStexInStas(); iStasStex++)
04648     {
04649       fMyRootFile->PrintNoComment();
04650       fMyRootFile->GetReadyToReadRootFile(fFapAnaType,          fFapNbOfSamples,
04651                                           fFapRunNumber,        fFapFirstReqEvtNumber,
04652                                           fFapLastReqEvtNumber, fFapReqNbOfEvts,
04653                                           iStasStex+1,          fCfgResultsRootFilePath.Data());
04654       
04655       if ( fMyRootFile->LookAtRootFile() == kTRUE )       //   (ViewStas)
04656         {
04657           fStatusFileFound = kTRUE;
04658 
04659           CounterExistingFile++;
04660           xFapNbOfEvts[iStasStex] = GetNumberOfEvents(fMyRootFile, fFapReqNbOfEvts);
04661           //----------------------------------------------------------------------------- file reading
04662           TString fp_name_short = fMyRootFile->GetRootFileNameShort();
04663           // cout << "*TEcnaHistos::ViewStas(...)> Data are analyzed from file ----> "
04664           //      << fp_name_short << endl;
04665           
04666           //....................... search for first and last dates
04667           if( iStasStex == 0 )
04668             {
04669               fStartTime = fMyRootFile->GetStartTime();
04670               fStopTime  = fMyRootFile->GetStopTime();
04671               fStartDate = fMyRootFile->GetStartDate();
04672               fStopDate  = fMyRootFile->GetStopDate();
04673             }
04674           else
04675             {
04676               time_t xStartTime = fMyRootFile->GetStartTime();
04677               time_t xStopTime  = fMyRootFile->GetStopTime();
04678               TString xStartDate = fMyRootFile->GetStartDate();
04679               TString xStopDate  = fMyRootFile->GetStopDate();
04680               if( xStartTime < fStartTime ){fStartTime = xStartTime; fStartDate = xStartDate;}
04681               if( xStopTime  > fStopTime  ){fStopTime  = xStopTime;  fStopDate  = xStopDate;}
04682             }
04683 
04684           fRunType   = fMyRootFile->GetRunType();
04685 
04686           //............................................... matrices reading      (ViewStas)
04687           TVectorD partial_histp(fEcal->MaxStinEcnaInStex());
04688           for(Int_t i=0; i<fEcal->MaxStinEcnaInStex(); i++){partial_histp(i)=(Double_t)0.;}
04689           
04690           TMatrixD read_matrix(nb_binx, nb_biny);
04691           for(Int_t i=0; i<nb_binx; i++)
04692             {for(Int_t j=0; j<nb_biny; j++){read_matrix(i,j)=(Double_t)0.;}}
04693           
04694           if( HistoCode == "D_NOE_ChNb" ){
04695             partial_histp = fMyRootFile->ReadAveragedNumberOfEvents(fEcal->MaxStinEcnaInStex());}
04696           if( HistoCode == "D_Ped_ChNb" ){
04697             partial_histp = fMyRootFile->ReadAveragedPedestals(fEcal->MaxStinEcnaInStex());}
04698           if (HistoCode == "D_TNo_ChNb" ){
04699             partial_histp = fMyRootFile->ReadAveragedTotalNoise(fEcal->MaxStinEcnaInStex());}
04700           if( HistoCode == "D_MCs_ChNb" ){
04701             partial_histp = fMyRootFile->ReadAveragedMeanOfCorrelationsBetweenSamples(fEcal->MaxStinEcnaInStex());}
04702           if( HistoCode == "D_LFN_ChNb" ){
04703             partial_histp = fMyRootFile->ReadAveragedLowFrequencyNoise(fEcal->MaxStinEcnaInStex());}
04704           if( HistoCode == "D_HFN_ChNb" ){
04705             partial_histp = fMyRootFile->ReadAveragedHighFrequencyNoise(fEcal->MaxStinEcnaInStex());}
04706           if( HistoCode == "D_SCs_ChNb" ){
04707             partial_histp = fMyRootFile->ReadAveragedSigmaOfCorrelationsBetweenSamples(fEcal->MaxStinEcnaInStex());}
04708           
04709           if ( fMyRootFile->DataExist() == kTRUE )
04710             {
04711               fStatusDataExist = kTRUE;
04712 
04713               CounterDataExist++;
04714               for(Int_t i0StexStinEcna=0; i0StexStinEcna<fEcal->MaxStinEcnaInStex(); i0StexStinEcna++)
04715                 {
04716                   //-------------------------------------- Geographical bidim filling   (ViewStas)
04717                   Int_t i_xgeo = GetXStinInStas(iStasStex, i0StexStinEcna, vertic_empty_strip_1);
04718                   Int_t i_ygeo = GetYStinInStas(iStasStex, i0StexStinEcna);
04719 
04720                   if(i_xgeo >=0 && i_xgeo < nb_binx && i_ygeo >=0 && i_ygeo < nb_biny)
04721                     {
04722                       Int_t n1StexStinEcna = i0StexStinEcna+1;
04723 
04724                       if( fFlagSubDet == "EB" )
04725                         {
04726                           read_matrix(i_xgeo, i_ygeo) = partial_histp(i0StexStinEcna);
04727                           h_geo_bid->Fill((Double_t)i_xgeo, (Double_t)i_ygeo,
04728                                           (Double_t)read_matrix(i_xgeo, i_ygeo));
04729                         }
04730 
04731                       if( fFlagSubDet == "EE" )
04732                         {
04733                           //---------------------> do not draw bin for SCEcna = 10 or 11
04734                           if( !( (n1StexStinEcna == 10 || n1StexStinEcna == 11 ||
04735                                   n1StexStinEcna == 29 || n1StexStinEcna == 32) ) )
04736                             {
04737                               read_matrix(i_xgeo, i_ygeo) = partial_histp(i0StexStinEcna);
04738                               h_geo_bid->Fill((Double_t)i_xgeo, (Double_t)i_ygeo,
04739                                               (Double_t)read_matrix(i_xgeo, i_ygeo));
04740                             }
04741                           if( n1StexStinEcna == 29 )
04742                             {
04743                               //---------------------------------------------------------------------------------
04744                               //   Average on SCEcna 29 (x1+x2+x3+x6+x7) and SCEcna 10: (x11)
04745                               //   (x = Xtal# in SC; see CMS NOTE 2006/027, p.10)
04746                               // 
04747                               //   (x1+x2+x3+x6+x7)/5 = partial_histp(29-1)   ;   x11 = partial_histp(10-1) 
04748                               //
04749                               //    => (x1+x2+x3+x6+x7+x11)/6 = partial_histp(29-1)*5/6 + partial_histp(10-1)/6
04750                               //
04751                               //   //  except for "D_NOE_ChNb" because average done in ReadAveragedNumberOfEvents
04752                               //   //  (no averaged NbOfEvts in root file)
04753                               //---------------------------------------------------------------------------------
04754                               read_matrix(i_xgeo, i_ygeo) =
04755                                 partial_histp(i0StexStinEcna)*(Double_t)(5./6.) + partial_histp(9)/(Double_t)6.;
04756                               h_geo_bid->Fill((Double_t)i_xgeo, (Double_t)i_ygeo,
04757                                               (Double_t)read_matrix(i_xgeo, i_ygeo));
04758                             }
04759                           //if( n1StexStinEcna == 32 && HistoCode != "D_NOE_ChNb" )
04760                           if( n1StexStinEcna == 32 )
04761                             {
04762                               //---- same as previous case: replace SCEcna 29 by 32 AND SCEcna 10 by 11
04763                               //---->  (x1+x2+x3+x6+x7+x11)/6 = partial_histp(32-1)*5/6 + partial_histp(11-1)/6
04764                               read_matrix(i_xgeo, i_ygeo) =
04765                                 partial_histp(i0StexStinEcna)*(Double_t)(5./6.) + partial_histp(10)/(Double_t)6.;
04766                               h_geo_bid->Fill((Double_t)i_xgeo, (Double_t)i_ygeo,
04767                                               (Double_t)read_matrix(i_xgeo, i_ygeo));
04768                             }
04769                         } // end of if( fFlagSubDet == "EE" )
04770                     } // end of if(i_xgeo >=0 && i_xgeo < nb_binx && i_ygeo >=0 && i_ygeo < nb_biny)
04771                 }  // end of for(Int_t i0StexStinEcna=0; i0StexStinEcna<fEcal->MaxStinEcnaInStex(); i0StexStinEcna++)
04772             } // end of if ( fMyRootFile->DataExist() == kTRUE )
04773           else
04774             {
04775               fStatusDataExist = kFALSE;
04776 
04777               cout << "!TEcnaHistos::ViewStas(...)>  "
04778                    << " Data not available for " << fFapStexName << " " << iStasStex+1
04779                    << " (Quantity not present in the ROOT file)" << fTTBELL << endl;
04780             }
04781         } // end of if( fMyRootFile->LookAtRootFile() == kTRUE )
04782       else
04783         {
04784           fStatusFileFound = kFALSE;
04785 
04786           cout << "!TEcnaHistos::ViewStas(...)>  "
04787                << " Data not available for " << fFapStexName << " " << iStasStex+1
04788                << " (ROOT file not found)"  << fTTBELL << endl;
04789         }
04790 
04791       if( fFapNbOfEvts <= xFapNbOfEvts[iStasStex] ){fFapNbOfEvts = xFapNbOfEvts[iStasStex];}
04792 
04793     } // end of for(Int_t iStasStex=0; iStasStex<fEcal->MaxStexInStas(); iStasStex++)
04794 
04795   delete [] NOFE_int;     NOFE_int = 0;       fCdelete++;
04796   delete [] xFapNbOfEvts; xFapNbOfEvts = 0;   fCdelete++;
04797 
04798   if( CounterExistingFile > 0 && CounterDataExist > 0 )
04799     {
04800       //===============  H I S T O   M I N / M A X   M A N A G E M E N T ============  (ViewStas)
04801       //................................ Put histo min max values
04802       //.......... default if flag not set to "ON"
04803       SetYminMemoFromValue(HistoCode.Data(), fCnaParHistos->GetYminDefaultValue(HistoCode.Data()));
04804       SetYmaxMemoFromValue(HistoCode.Data(), fCnaParHistos->GetYmaxDefaultValue(HistoCode.Data()));
04805           
04806       if( fUserHistoMin == fUserHistoMax ){fFlagUserHistoMin = "AUTO"; fFlagUserHistoMax = "AUTO";}
04807       //.......... user's value if flag set to "ON"
04808       if( fFlagUserHistoMin == "ON" )
04809         {SetYminMemoFromValue(HistoCode.Data(), fUserHistoMin); fFlagUserHistoMin = "OFF";}
04810       if( fFlagUserHistoMax == "ON" )
04811         {SetYmaxMemoFromValue(HistoCode.Data(), fUserHistoMax); fFlagUserHistoMax = "OFF";}
04812       //................................. automatic min and/or max
04813       if( fFlagUserHistoMin == "AUTO" )
04814         {SetYminMemoFromValue(HistoCode.Data(), h_geo_bid->GetMinimum()); fFlagUserHistoMin = "OFF";}
04815       if( fFlagUserHistoMax == "AUTO" )
04816         {SetYmaxMemoFromValue(HistoCode.Data(), h_geo_bid->GetMaximum()); fFlagUserHistoMax = "OFF";}
04817       //...................................... histo set ymin and ymax
04818       Int_t  xFlagAutoYsupMargin = 0;      
04819       xFlagAutoYsupMargin = SetHistoFrameYminYmaxFromMemo((TH1D*)h_geo_bid, HistoCode);
04820           
04821       // ************************** A GARDER EN RESERVE *******************************
04822       //............. special contour level for correlations (square root wise scale)
04823       //if ( HistoCode == "D_MCs_ChNb" )
04824       //{
04825       //  Int_t nb_niv  = 9;
04826       //  Double_t* cont_niv = new Double_t[nb_niv];           fCnew++;
04827       //  SqrtContourLevels(nb_niv, &cont_niv[0]);      
04828       //  h_geo_bid->SetContour(nb_niv, &cont_niv[0]);        
04829       //  delete [] cont_niv;                                  fCdelete++;
04830       //}
04831       // ******************************** (FIN RESERVE) *******************************
04832           
04833       // =================================== P L O T S ========================   (ViewStas) 
04834           
04835       char* f_in = new char[fgMaxCar];                           fCnew++;
04836 
04837       //...................... Taille/format canvas
04838       UInt_t canv_h = fCnaParHistos->CanvasFormatH("petit");
04839       UInt_t canv_w = fCnaParHistos->CanvasFormatW("petit");
04840 
04841       if( fFlagSubDet == "EB")
04842         {canv_w = fCnaParHistos->CanvasFormatW("phietaEB");
04843         canv_h = fCnaParHistos->CanvasFormatH("phietaEB");}
04844       if( fFlagSubDet == "EE")    
04845         {canv_w = fCnaParHistos->CanvasFormatW("IYIXEE");
04846         canv_h = fCnaParHistos->CanvasFormatH("IYIXEE");}
04847 
04848       //............................................... paves commentaires (ViewStas)
04849       SetAllPavesViewStas();
04850 
04851       //------------------------------------ Canvas name ----------------- (ViewStas)  
04852       TString name_cov_cor;
04853       Int_t MaxCar = fgMaxCar;
04854       name_cov_cor.Resize(MaxCar);
04855       name_cov_cor = "?";
04856           
04857       if( HistoCode == "D_NOE_ChNb"){name_cov_cor = "Number_of_Events";}
04858       if( HistoCode == "D_Ped_ChNb"){name_cov_cor = "Pedestals";}
04859       if( HistoCode == "D_TNo_ChNb"){name_cov_cor = "Total_noise";}
04860       if( HistoCode == "D_MCs_ChNb"){name_cov_cor = "Mean_Corss";}
04861       if( HistoCode == "D_LFN_ChNb"){name_cov_cor = "Low_Fq_Noise";}
04862       if( HistoCode == "D_HFN_ChNb"){name_cov_cor = "High_Fq_Noise";}
04863       if( HistoCode == "D_SCs_ChNb"){name_cov_cor = "Sigma_Corss";}
04864           
04865       TString name_visu;
04866       MaxCar = fgMaxCar;
04867       name_visu.Resize(MaxCar);
04868       name_visu = "colz";
04869           
04870       sprintf(f_in, "%s_%s_S1_%d_R%d_%d_%d_%s_%s_HocoVeco",
04871               name_cov_cor.Data(), fFapAnaType.Data(), fFapNbOfSamples, fFapRunNumber,
04872               fFapFirstReqEvtNumber, fFapLastReqEvtNumber, fFlagSubDet.Data(), name_visu.Data());
04873           
04874       if( fFlagSubDet == "EB" ){SetHistoPresentation((TH1D*)h_geo_bid, "Stas2DEB");}
04875       if( fFlagSubDet == "EE" ){SetHistoPresentation((TH1D*)h_geo_bid, "Stas2DEE");}
04876           
04877       TCanvas *MainCanvas = new TCanvas(f_in, f_in, canv_w, canv_h);   fCnewRoot++;
04878       fCurrentCanvas = MainCanvas; fCurrentCanvasName = f_in;
04879 
04880       // cout << "*TEcnaHistos::ViewStas(...)> Plot is displayed on canvas ----> " << f_in << endl;
04881           
04882       delete [] f_in; f_in = 0;                                 fCdelete++;
04883 
04884       //------------------------ Canvas draw and update ------------ (ViewStas)  
04885       if( fPavComGeneralTitle != 0 ){fPavComGeneralTitle->Draw();}
04886 
04887       fPavComStas->Draw();
04888       fPavComAnaRun->Draw();
04889       fPavComNbOfEvts->Draw();
04890 
04891       //----------------------------------------------------------- pad margins
04892       Double_t x_low = fCnaParHistos->BoxLeftX("bottom_left_box") - 0.005;
04893       Double_t y_low = fCnaParHistos->BoxTopY("bottom_left_box")  + 0.005;
04894       Double_t x_margin = x_low;
04895       Double_t y_margin = y_low;          
04896       MainCanvas->Divide( 1,  1, x_margin, y_margin);
04897       //           Divide(nx, ny, x_margin, y_margin,    color);          
04898       gPad->cd(1);
04899       //........................... specific EE
04900       if( fFlagSubDet == "EE" ){
04901         Double_t x_up  = fCnaParHistos->BoxRightX("bottom_right_box")  + 0.005;
04902         Double_t y_up  = fCnaParHistos->BoxBottomY("top_left_box_EE") - 0.005;
04903         TVirtualPad* main_subpad = gPad;
04904         main_subpad->SetPad(x_low, y_low, x_up, y_up);}
04905           
04906       //------------------------------------------------------------
04907       h_geo_bid->GetXaxis()->SetTitle(axis_x_var_name);
04908       h_geo_bid->GetYaxis()->SetTitle(axis_y_var_name);
04909           
04910       h_geo_bid->DrawCopy("COLZ");
04911           
04912       // trace de la grille  ---------------- (ViewStas) 
04913       ViewStasGrid(vertic_empty_strips);
04914       gPad->Draw();
04915       gPad->Update();
04916 
04917       //      delete MainCanvas;              fCdeleteRoot++;
04918     }
04919   //..................... retour aux options standard
04920   Bool_t b_true = 1;
04921   h_geo_bid->SetStats(b_true);    
04922   h_geo_bid->Delete();  h_geo_bid = 0;              fCdeleteRoot++;
04923   
04924   delete [] f_in_mat_tit;    f_in_mat_tit = 0;             fCdelete++;
04925 
04926 }  // end of ViewStas(...)
04927 
04928 //==================================================================================
04929 //
04930 //                         GetXStinInStas , GetYStinInStas
04931 //
04932 //==================================================================================
04933 Int_t TEcnaHistos::GetXStinInStas(const Int_t& iStasStex, const Int_t& StexStinEcna,
04934                                   const Int_t& vertic_empty_strip_1) 
04935 {
04936 //Gives the X Stin coordinate in the geographic view of the Stas
04937 // (X = 0 to MaxStexHocoInStas*MaxStinHocoInStex - 1 + vertic_empty_strips(EE only))
04938 
04939   Int_t ix_geo = 0;
04940   TString ctype = fEcalNumbering->GetStexHalfStas(iStasStex+1);
04941 
04942   if( fFlagSubDet == "EB")
04943     {
04944       if( ctype == "EB-")
04945         {
04946           ix_geo = (iStasStex - fEcal->MaxStexInStasMinus())*fEcal->MaxStinVecoInStex()
04947             + StexStinEcna%fEcal->MaxStinVecoInStex();
04948         }
04949       if( ctype == "EB+")
04950         {
04951           ix_geo = iStasStex*fEcal->MaxStinVecoInStex()
04952             + fEcal->MaxStinVecoInStex()- 1 - StexStinEcna%fEcal->MaxStinVecoInStex();
04953         }
04954     }
04955 
04956   if( fFlagSubDet == "EE")
04957     {
04958       TString LeftRightFromIP = fEcalNumbering->GetDeeDirViewedFromIP(iStasStex+1);
04959 
04960       if( ctype == "EE-" && LeftRightFromIP == "left"  )
04961         {
04962           ix_geo = fEcal->MaxStinHocoInStex() - StexStinEcna/fEcal->MaxStinVecoInStex() - 1 + vertic_empty_strip_1;
04963         }
04964       if( ctype == "EE-" && LeftRightFromIP == "right" )
04965         {
04966           ix_geo = fEcal->MaxStinHocoInStex() + StexStinEcna/fEcal->MaxStinVecoInStex() + vertic_empty_strip_1;
04967         }
04968       if( ctype == "EE+" && LeftRightFromIP == "left"  )
04969         {
04970           ix_geo = (Int_t)fCnaParHistos->DeeOffsetX(fFlagSubDet, iStasStex+1)
04971             + fEcal->MaxStinHocoInStex() - StexStinEcna/fEcal->MaxStinVecoInStex() - 1;
04972         }
04973       if( ctype == "EE+" && LeftRightFromIP == "right" )
04974         {
04975           ix_geo = (Int_t)fCnaParHistos->DeeOffsetX(fFlagSubDet, iStasStex+1)
04976             + StexStinEcna/fEcal->MaxStinVecoInStex();
04977         }
04978     }
04979   return ix_geo;
04980 }
04981 
04982 Int_t TEcnaHistos::GetYStinInStas(const Int_t& iStasStex, const Int_t& StexStinEcna) 
04983 {
04984 //Gives the Y crystal coordinate in the geographic view of one Stex
04985 // (Y = 0 to MaxStexVecoInStas*MaxStinVecoInStex - 1)
04986 
04987   Int_t iy_geo = 0;
04988   
04989   if( fFlagSubDet == "EB")
04990     {
04991       TString ctype = fEcalNumbering->GetStexHalfStas(iStasStex+1);
04992       if( ctype == "EB+")
04993         {iy_geo = StexStinEcna/fEcal->MaxStinVecoInStex() + fEcal->MaxStinHocoInStex(); }
04994       if( ctype == "EB-")
04995         {iy_geo = fEcal->MaxStinHocoInStex() - 1 - StexStinEcna/fEcal->MaxStinVecoInStex();}
04996     }
04997   
04998   if( fFlagSubDet == "EE")
04999     {iy_geo = StexStinEcna%fEcal->MaxStinVecoInStex();} 
05000   return iy_geo;
05001 }
05002 
05003 //==========================================================================
05004 //
05005 //                       ViewStasGrid
05006 //              independent of the ROOT file
05007 //
05008 //==========================================================================
05009 void TEcnaHistos::ViewStasGrid(const Int_t & vertic_empty_strips)
05010 {
05011  //Grid of Stas with axis Hoco and Veco
05012 
05013   if( fFlagSubDet ==  "EB"){ViewEBGrid();}
05014   if( fFlagSubDet ==  "EE"){ViewEEGrid(vertic_empty_strips);}
05015 
05016 } // end of ViewStasGrid
05017 
05018 void TEcnaHistos::ViewEBGrid()
05019 {
05020  //Grid of EB with axis Hoco and Veco
05021 
05022   Int_t  GeoBidSizeEta = fEcal->MaxSMEtaInEB()*fEcal->MaxTowEtaInSM();
05023   Int_t  GeoBidSizePhi = fEcal->MaxSMPhiInEB()*fEcal->MaxTowPhiInSM();
05024 
05025   Int_t size_y = fEcal->MaxTowEtaInSM();
05026   Int_t size_x = fEcal->MaxTowPhiInSM();
05027 
05028   Int_t  nb_binx  = GeoBidSizePhi;
05029   Int_t  nb_biny  = GeoBidSizeEta;
05030   Axis_t xinf_bid = (Axis_t)0.;
05031   Axis_t xsup_bid = (Axis_t)nb_binx;
05032   Axis_t yinf_bid = (Axis_t)0.;
05033   Axis_t ysup_bid = (Axis_t)nb_biny;   
05034   
05035   //---------------- trace de la grille: un rectangle = un SM
05036 
05037   Int_t max_x = nb_binx/size_x;  // = fEcal->MaxSMPhiInEB()
05038   Int_t max_y = nb_biny/size_y;  // = fEcal->MaxSMEtaInEB()
05039 
05040   //............................. lignes horizontales  (ViewEBGrid)
05041   Double_t yline = (Double_t)yinf_bid;
05042 
05043   Double_t xline_left  = (Double_t)xinf_bid;
05044   Double_t xline_right = (Double_t)xsup_bid;
05045   
05046   for( Int_t j = 0 ; j < max_y ; j++)
05047     {
05048       yline = yline + (Double_t)size_y;
05049       TLine *lin;
05050       lin = new TLine(xline_left, yline, xline_right, yline); fCnewRoot++;
05051       lin->Draw();
05052       // delete lin;             fCdeleteRoot++;
05053     }
05054 
05055   //-------------------------------- lignes verticales
05056   Double_t xline = (Double_t)xinf_bid - (Double_t)size_x;
05057   
05058   Double_t yline_bot = (Double_t)yinf_bid;
05059   Double_t yline_top = (Double_t)ysup_bid;
05060 
05061   for( Int_t i = 0 ; i < max_x ; i++)
05062     {  
05063       xline = xline + (Double_t)size_x;
05064       TLine *lin;
05065       lin = new TLine(xline, yline_bot, xline, yline_top); fCnewRoot++;
05066       lin->Draw();
05067     }
05068 
05069   //-------------------------------- Numeros des SM
05070   Double_t yTextBot = yline_bot - (yline_top - yline_bot)/25.;
05071   Double_t yTextTop = yline_top + (yline_top - yline_bot)/120.;
05072   xline = (Double_t)xinf_bid - (Double_t)size_x;
05073 
05074   char* f_in = new char[fgMaxCar];                  fCnew++;
05075   TText *text_SM = new TText();              fCnewRoot++;
05076   for( Int_t i = 0 ; i < max_x ; i++)
05077     {  
05078       xline = xline + (Double_t)size_x;
05079       text_SM->SetTextColor(fCnaParHistos->ColorDefinition("bleu_fonce"));
05080       text_SM->SetTextSize((Double_t)0.03);
05081       sprintf( f_in, "  +%d", i+1 );
05082       text_SM->DrawText(xline, yTextTop, f_in);
05083       sprintf( f_in, "  %d", -i-1 );
05084       text_SM->DrawText(xline, yTextBot, f_in);
05085     }
05086   delete [] f_in;                                   fCdelete++;
05087 
05088   //------------------ trace axes en eta et phi --------------- ViewEBGrid
05089 
05090   Int_t SMNumber = 1;
05091 
05092   //...................................................... Axe i(phi) (bottom x) ViewEBGrid
05093   Int_t MatSize    = fEcal->MaxTowPhiInSM();
05094   Int_t size_x_eb  = fEcal->MaxSMPhiInEB();
05095   Double_t phi_min =   0;
05096   Double_t phi_max = 360;
05097 
05098   TString  x_var_name  = GetHocoVecoAxisTitle("iphiEB");;
05099   TString  x_direction = fEcalNumbering->GetXDirectionEB(SMNumber);
05100 
05101   TF1 *f1 = new TF1("f1", x_direction.Data(), phi_min, phi_max);          fCnewRoot++;
05102     TGaxis* sup_axis_x = 0;
05103 
05104   if( x_direction == "-x" ) // NEVER  IN THIS CASE: xmin->xmax <=> right->left ("-x") direction
05105     {sup_axis_x = new TGaxis( (Float_t)0., (Float_t)0., (Float_t)(size_x_eb*MatSize), (Float_t)0.,
05106                               "f1", size_x_eb, "SC" , 0.);   fCnewRoot++;}
05107 
05108   if( x_direction == "x" )  // ALWAYS IN THIS CASE: xmin->xmax <=> left->right ("x") direction    
05109     {sup_axis_x = new TGaxis( (Float_t)0., (Float_t)0., (Float_t)(size_x_eb*MatSize), (Float_t)0.,
05110                               "f1", size_x_eb, "SC" , 0.);   fCnewRoot++;} 
05111 
05112   Float_t tit_siz_x = fCnaParHistos->AxisTitleSize();
05113   Float_t lab_siz_x = fCnaParHistos->AxisLabelSize("EBx");
05114   Float_t tic_siz_x = fCnaParHistos->AxisTickSize("SMx");
05115   Float_t tit_off_x = fCnaParHistos->AxisTitleOffset("EBx");
05116   Float_t lab_off_x = fCnaParHistos->AxisLabelOffset("EBx");
05117  
05118   sup_axis_x->SetTitle(x_var_name);
05119   sup_axis_x->SetTitleSize(tit_siz_x);
05120   sup_axis_x->SetTitleOffset(tit_off_x);
05121   sup_axis_x->SetLabelSize(lab_siz_x);
05122   sup_axis_x->SetLabelOffset(lab_off_x);
05123   sup_axis_x->SetTickSize(tic_siz_x);
05124   sup_axis_x->Draw("SAME");
05125 
05126   f1 = 0;
05127 
05128   //...................................................... Axe eta (y) ViewEBGrid
05129   MatSize = fEcal->MaxTowEtaInSM();
05130   Int_t size_y_eb = fEcal->MaxSMEtaInEB(); 
05131 
05132   Double_t eta_min = (Double_t)(-85.); 
05133   Double_t eta_max = (Double_t)85.; 
05134 
05135   TString y_var_name = GetHocoVecoAxisTitle("ietaEB");
05136 
05137   TGaxis* sup_axis_y = 0;
05138   sup_axis_y = new TGaxis((Float_t)0., (Float_t)0.,
05139                           (Float_t)0., (Float_t)(size_y_eb*MatSize),
05140                           eta_min, eta_max, MatSize/2, "SC", 0.);         fCnewRoot++;
05141 
05142   Float_t tit_siz_y = fCnaParHistos->AxisTitleSize();
05143   Float_t lab_siz_y = fCnaParHistos->AxisLabelSize("EBy");
05144   Float_t tic_siz_y = fCnaParHistos->AxisTickSize("SMy");
05145   Float_t tit_off_y = fCnaParHistos->AxisTitleOffset("EBy");
05146   Float_t lab_off_y = fCnaParHistos->AxisLabelOffset("EBy");
05147   
05148   sup_axis_y->SetTitle(y_var_name);
05149   sup_axis_y->SetTitleSize(tit_siz_y);
05150   sup_axis_y->SetTitleOffset(tit_off_y);
05151   sup_axis_y->SetLabelColor(1);
05152   sup_axis_y->SetLabelSize(lab_siz_y);
05153   sup_axis_y->SetLabelOffset(lab_off_y);
05154   sup_axis_y->SetTickSize(tic_siz_y);
05155   sup_axis_y->Draw("SAME");
05156 
05157   //f2 = 0;
05158 
05159   gStyle->SetTextColor(fCnaParHistos->ColorDefinition("noir"));
05160 
05161 } // end of ViewEBGrid
05162 //---------------------------------------------------------------------
05163 void TEcnaHistos::ViewEEGrid(const Int_t& vertic_empty_strips)
05164 {
05165  //Grid of EE with axis Hoco and Veco
05166 
05167   Float_t coefcc_x = (Float_t)1./(Float_t)5.;
05168   Float_t coefcc_y = (Float_t)1./(Float_t)5.;
05169   
05170   for( Int_t DeeNumber = 1; DeeNumber <= 4; DeeNumber++)
05171     {
05172       EEDataSectors(coefcc_x, coefcc_y, DeeNumber, "EE");
05173       EEGridAxis(coefcc_x, coefcc_y, DeeNumber, "EE", " "); 
05174     }
05175 
05176   // vertical line between the two endcaps
05177   Double_t xline = coefcc_x*( 2*fEcal->MaxCrysIXInDee()
05178                               + ((Double_t)vertic_empty_strips)/2.*fEcal->MaxCrysIXInSC() );
05179   
05180   Double_t yline_bot = coefcc_y*(Double_t)0.;
05181   Double_t yline_top = coefcc_y*(Double_t)fEcal->MaxCrysIYInDee();
05182 
05183   TLine *lin;
05184   lin = new TLine(xline, yline_bot, xline, yline_top); fCnewRoot++;
05185   lin->Draw();
05186 
05187   // vertical line in the midles of the two endcaps
05188   //  xline = xline + coefcc_x*( fEcal->MaxCrysIXInDee()+ 0.5*fEcal->MaxCrysIXInSC() );
05189   xline = coefcc_x*(3*fEcal->MaxCrysIXInDee()
05190                     + ((Double_t)vertic_empty_strips-1.)*fEcal->MaxCrysIXInSC() );
05191   TLine *lin12;
05192   lin12 = new TLine(xline, yline_bot, xline, yline_top); fCnewRoot++;
05193   lin12->SetLineStyle(2);
05194   lin12->Draw();
05195 
05196   xline = coefcc_x*(fEcal->MaxCrysIXInDee()
05197                      + ((Double_t)vertic_empty_strips)/3.*fEcal->MaxCrysIXInSC() );
05198   TLine *lin34;
05199   lin34 = new TLine(xline, yline_bot, xline, yline_top); fCnewRoot++;
05200   lin34->SetLineStyle(2);
05201   lin34->Draw();
05202 
05203   // horizontal line at IY = 50
05204   Double_t xline_end = coefcc_x*( 4*fEcal->MaxCrysIXInDee() + vertic_empty_strips*fEcal->MaxCrysIXInSC());
05205   Double_t yline_mid = coefcc_x*fEcal->MaxCrysIYInDee()/2;
05206 
05207   TLine *linh;
05208   linh = new TLine( 0., yline_mid, xline_end, yline_mid); fCnewRoot++;
05209   linh->SetLineStyle(2);
05210   linh->Draw();
05211 
05212 } // end of ViewEEGrid
05213 
05214 //==================================================================================================
05215 void TEcnaHistos::EEDataSectors(const Float_t& coefcc_x,  const Float_t& coefcc_y,
05216                                 const Int_t&   DeeNumber, const TString opt_plot)
05217 {
05218   //Surlignage des bords du Dee et des Data Sectors. Numeros des secteurs.
05219 
05220   // Epaisseur du trait selon option
05221   Int_t LineWidth = 2;   // DEFAULT => option "EE"
05222   if( opt_plot == "Dee" ){LineWidth = 3;}
05223 
05224   Int_t ngmax = 0;
05225   // surlignage du bord interne du Dee (unite de coordonnees: le cristal)
05226   ngmax = 13;
05227   Float_t xg_dee_int_bot[13] = { 0, 5, 5, 7, 7, 8, 8, 9, 9,10,10,11,11};
05228   Float_t yg_dee_int_bot[13] = {39,39,40,40,41,41,42,42,43,43,45,45,50};
05229   for(Int_t i=0;i<ngmax;i++){
05230     xg_dee_int_bot[i] = coefcc_x*xg_dee_int_bot[i];
05231     yg_dee_int_bot[i] = coefcc_y*yg_dee_int_bot[i];}
05232   
05233   Float_t XgDeeIntBotRight[13]; Float_t YgDeeIntBotRight[13];
05234   Float_t XgDeeIntTopRight[13]; Float_t YgDeeIntTopRight[13];
05235   
05236   for( Int_t i=0; i<ngmax; i++)
05237     {
05238       XgDeeIntBotRight[i] = xg_dee_int_bot[i];
05239       YgDeeIntBotRight[i] = yg_dee_int_bot[i];
05240       XgDeeIntTopRight[i] = XgDeeIntBotRight[i];
05241       YgDeeIntTopRight[i] = coefcc_y*fEcal->MaxCrysIYInDee() - YgDeeIntBotRight[i];
05242       if ( DeeNumber == 2 || DeeNumber == 4 )
05243         {
05244           XgDeeIntBotRight[i] = -XgDeeIntBotRight[i] + coefcc_x*fEcal->MaxCrysIXInDee();
05245           XgDeeIntTopRight[i] = -XgDeeIntTopRight[i] + coefcc_x*fEcal->MaxCrysIXInDee();
05246         }
05247       XgDeeIntBotRight[i] += fCnaParHistos->DeeOffsetX(opt_plot, DeeNumber);
05248       XgDeeIntTopRight[i] += fCnaParHistos->DeeOffsetX(opt_plot, DeeNumber);
05249     }
05250 
05251   TGraph *BDeeIntBotRight = new TGraph(ngmax, XgDeeIntBotRight, YgDeeIntBotRight);
05252   BDeeIntBotRight->SetLineWidth(LineWidth);
05253   BDeeIntBotRight->Draw();
05254   
05255   TGraph *BDeeIntTopRight = new TGraph(ngmax, XgDeeIntTopRight, YgDeeIntTopRight);
05256   BDeeIntTopRight->SetLineWidth(LineWidth);
05257   BDeeIntTopRight->Draw();
05258 
05259   // surlignage du bord externe du Dee  (unite de coordonnees: le cristal)
05260   ngmax = 21;
05261   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};
05262   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};
05263   for(Int_t i=0;i<ngmax;i++){
05264     xg_dee_ext_bot[i] = coefcc_x*xg_dee_ext_bot[i];
05265     yg_dee_ext_bot[i] = coefcc_y*yg_dee_ext_bot[i];}
05266   
05267   Float_t XgDeeExtBotRight[21]; Float_t YgDeeExtBotRight[21];
05268   Float_t XgDeeExtTopRight[21]; Float_t YgDeeExtTopRight[21];
05269   
05270   for( Int_t i=0; i<ngmax; i++)
05271     {
05272       XgDeeExtBotRight[i] = xg_dee_ext_bot[i];
05273       YgDeeExtBotRight[i] = yg_dee_ext_bot[i];
05274       XgDeeExtTopRight[i] = XgDeeExtBotRight[i];
05275       YgDeeExtTopRight[i] = coefcc_y*fEcal->MaxCrysIYInDee() - YgDeeExtBotRight[i];
05276       if ( DeeNumber == 2 || DeeNumber == 4 )
05277         {
05278           XgDeeExtBotRight[i] = -XgDeeExtBotRight[i] + coefcc_x*fEcal->MaxCrysIXInDee();
05279           XgDeeExtTopRight[i] = -XgDeeExtTopRight[i] + coefcc_x*fEcal->MaxCrysIXInDee();
05280         }
05281       XgDeeExtBotRight[i] += fCnaParHistos->DeeOffsetX(opt_plot, DeeNumber);
05282       XgDeeExtTopRight[i] += fCnaParHistos->DeeOffsetX(opt_plot, DeeNumber);
05283     }
05284   
05285   TGraph *BDeeExtBotRight = new TGraph(ngmax, XgDeeExtBotRight, YgDeeExtBotRight);
05286   BDeeExtBotRight->SetLineWidth(LineWidth);
05287   BDeeExtBotRight->Draw();
05288   
05289   TGraph *BDeeExtTopRight = new TGraph(ngmax, XgDeeExtTopRight, YgDeeExtTopRight);
05290   BDeeExtTopRight->SetLineWidth(LineWidth);
05291   BDeeExtTopRight->Draw();
05292 
05293   char* f_in = new char[fgMaxCar];                           fCnew++;
05294   
05295   //............. Surlignage separateurs des secteurs en phi (Data sectors)
05296 
05297   //================== S9 -> S1 (EE-) option "EE" seulement
05298   if( opt_plot == "EE" )
05299     {
05300       ngmax = 2;
05301       Float_t xg_dee_data_sec9[2] = { 0,  0};
05302       Float_t yg_dee_data_sec9[2] = {61,100};
05303       for(Int_t i=0;i<ngmax;i++){
05304         xg_dee_data_sec9[i] = coefcc_x*xg_dee_data_sec9[i];
05305         yg_dee_data_sec9[i] = coefcc_y*yg_dee_data_sec9[i];}
05306       
05307       Float_t XgDeeDataSec9[11]; Float_t YgDeeDataSec9[11];
05308       for( Int_t i=0; i<ngmax; i++)
05309         {
05310           XgDeeDataSec9[i] = xg_dee_data_sec9[i]; YgDeeDataSec9[i] = yg_dee_data_sec9[i];
05311           if ( DeeNumber == 2 || DeeNumber == 4 )
05312             {
05313               XgDeeDataSec9[i] = -XgDeeDataSec9[i] + coefcc_x*fEcal->MaxCrysIXInDee();
05314             }
05315           XgDeeDataSec9[i] += fCnaParHistos->DeeOffsetX(opt_plot, DeeNumber);
05316         }      
05317       TGraph *BDeeDataSec9 = new TGraph(ngmax, XgDeeDataSec9, YgDeeDataSec9);
05318       BDeeDataSec9->SetLineWidth(LineWidth);
05319       BDeeDataSec9->Draw();      
05320     }
05321 
05322   //================= S1->S2(EE-)
05323   ngmax = 11;
05324   Float_t xg_dee_data_sec1[11] = { 7,10,10,15,15,20,20,25,25,30,30};
05325   Float_t yg_dee_data_sec1[11] = {60,60,65,65,70,70,75,75,85,85,87};
05326   for(Int_t i=0;i<ngmax;i++){
05327     xg_dee_data_sec1[i] = coefcc_x*xg_dee_data_sec1[i];
05328     yg_dee_data_sec1[i] = coefcc_y*yg_dee_data_sec1[i];}
05329   
05330   Float_t XgDeeDataSec1[11]; Float_t YgDeeDataSec1[11];
05331   for( Int_t i=0; i<ngmax; i++)
05332     {
05333       XgDeeDataSec1[i] = xg_dee_data_sec1[i]; YgDeeDataSec1[i] = yg_dee_data_sec1[i];
05334       if ( DeeNumber == 2 || DeeNumber == 4 )
05335         {
05336           XgDeeDataSec1[i] = -XgDeeDataSec1[i] + coefcc_x*fEcal->MaxCrysIXInDee();
05337         }
05338       XgDeeDataSec1[i] += fCnaParHistos->DeeOffsetX(opt_plot, DeeNumber);
05339     }
05340 
05341   TGraph *BDeeDataSec1 = new TGraph(ngmax, XgDeeDataSec1, YgDeeDataSec1);
05342   BDeeDataSec1->SetLineWidth(LineWidth);
05343   BDeeDataSec1->Draw();
05344 
05345   //================= S2->S3(EE-)
05346   ngmax = 6;
05347   Float_t xg_dee_data_sec2[6] = {11,15,15,40,40,47};
05348   Float_t yg_dee_data_sec2[6] = {50,50,55,55,60,60};
05349   for(Int_t i=0;i<ngmax;i++){
05350     xg_dee_data_sec2[i] = coefcc_x*xg_dee_data_sec2[i];
05351     yg_dee_data_sec2[i] = coefcc_y*yg_dee_data_sec2[i];}
05352   
05353   Float_t XgDeeDataSec2[6]; Float_t YgDeeDataSec2[6];
05354   for( Int_t i=0; i<ngmax; i++)
05355     {
05356       XgDeeDataSec2[i] = xg_dee_data_sec2[i]; YgDeeDataSec2[i] = yg_dee_data_sec2[i];
05357       if ( DeeNumber == 2 || DeeNumber == 4 )
05358         {
05359           XgDeeDataSec2[i] = -XgDeeDataSec2[i] + coefcc_x*fEcal->MaxCrysIXInDee();
05360         }
05361       XgDeeDataSec2[i] += fCnaParHistos->DeeOffsetX(opt_plot, DeeNumber);
05362     }
05363   TGraph *BDeeDataSec2 = new TGraph(ngmax, XgDeeDataSec2, YgDeeDataSec2);
05364   BDeeDataSec2->SetLineWidth(LineWidth);
05365   BDeeDataSec2->Draw();
05366  
05367   //================= S3->S4(EE-)
05368   ngmax = 10;
05369   Float_t xg_dee_data_sec3[10] = {10,15,15,20,20,30,30,40,40,42};
05370   Float_t yg_dee_data_sec3[10] = {45,45,40,40,35,35,30,30,25,25};
05371   for(Int_t i=0;i<ngmax;i++){
05372     xg_dee_data_sec3[i] = coefcc_x*xg_dee_data_sec3[i];
05373     yg_dee_data_sec3[i] = coefcc_y*yg_dee_data_sec3[i];}
05374   
05375   Float_t XgDeeDataSec3[10]; Float_t YgDeeDataSec3[10];
05376   for( Int_t i=0; i<ngmax; i++)
05377     {
05378       XgDeeDataSec3[i] = xg_dee_data_sec3[i]; YgDeeDataSec3[i] = yg_dee_data_sec3[i];
05379       if ( DeeNumber == 2 || DeeNumber == 4 )
05380         {
05381           XgDeeDataSec3[i] = -XgDeeDataSec3[i] + coefcc_x*fEcal->MaxCrysIXInDee();
05382         }
05383       XgDeeDataSec3[i] += fCnaParHistos->DeeOffsetX(opt_plot, DeeNumber);
05384     }
05385   TGraph *BDeeDataSec3 = new TGraph(ngmax, XgDeeDataSec3, YgDeeDataSec3);
05386   BDeeDataSec3->SetLineWidth(LineWidth);
05387   BDeeDataSec3->Draw();
05388  
05389   //================= S4->S5(EE-)
05390   ngmax = 6;
05391   Float_t xg_dee_data_sec4[6] = { 5, 5,10,10,15,15};
05392   Float_t yg_dee_data_sec4[6] = {40,30,30,15,15, 5};
05393   for(Int_t i=0;i<ngmax;i++){
05394     xg_dee_data_sec4[i] = coefcc_x*xg_dee_data_sec4[i];
05395     yg_dee_data_sec4[i] = coefcc_y*yg_dee_data_sec4[i];}
05396   
05397   Float_t XgDeeDataSec4[6]; Float_t YgDeeDataSec4[6];
05398   for( Int_t i=0; i<ngmax; i++)
05399     {
05400       XgDeeDataSec4[i] = xg_dee_data_sec4[i]; YgDeeDataSec4[i] = yg_dee_data_sec4[i];
05401       if ( DeeNumber == 2 || DeeNumber == 4 )
05402         {
05403           XgDeeDataSec4[i] = -XgDeeDataSec4[i] + coefcc_x*fEcal->MaxCrysIXInDee();
05404         }
05405       XgDeeDataSec4[i] += fCnaParHistos->DeeOffsetX(opt_plot, DeeNumber);
05406     }
05407   TGraph *BDeeDataSec4 = new TGraph(ngmax, XgDeeDataSec4, YgDeeDataSec4);
05408   BDeeDataSec4->SetLineWidth(LineWidth);
05409   BDeeDataSec4->Draw();
05410   
05411 
05412   //..................................... Numeros des secteurs S_i (option "Dee" seulement)
05413   if( opt_plot == "Dee" || opt_plot == "EE" )
05414     {
05415       //............. Coordonnees des numeros de secteurs
05416       ngmax = 5;
05417       Float_t  xg_coord_sector[5] = { 16, 41, 45, 33, -2};
05418       Float_t  yg_coord_sector[5] = { 96, 83, 30,  5, -8};
05419 
05420       //....... Reprise secteurs 3 et 7
05421       if(opt_plot == "Dee" && (DeeNumber == 1) ){xg_coord_sector[2] += 0.5;}
05422       if(opt_plot == "Dee" && (DeeNumber == 2) ){xg_coord_sector[2] -= 1. ;}
05423       if(opt_plot == "Dee" && (DeeNumber == 3) ){xg_coord_sector[2] += 0.7;}
05424       if(opt_plot == "Dee" && (DeeNumber == 4) ){xg_coord_sector[2] -= 1.2;}
05425 
05426       if(opt_plot == "EE"  && (DeeNumber == 2 || DeeNumber == 3) ){xg_coord_sector[2] += 0.55;}
05427       if(opt_plot == "EE"  && (DeeNumber == 4 ) ){xg_coord_sector[2] -= 0.2;}
05428 
05429       for(Int_t i=0;i<ngmax;i++){
05430         xg_coord_sector[i] = coefcc_x*xg_coord_sector[i];
05431         yg_coord_sector[i] = coefcc_y*yg_coord_sector[i];}
05432 
05433       Float_t  xg_sector[9];
05434       Float_t  yg_sector[9];
05435       Int_t ns1 = 1;
05436       Int_t ns2 = 5;
05437       Float_t xinv_d2d4 = coefcc_x*44;
05438       
05439       if( DeeNumber == 1 )
05440         {
05441           ns1 = 1; ns2 = 5;
05442           xg_sector[1-ns1] = xg_coord_sector[1-ns1];  yg_sector[1-ns1] = yg_coord_sector[1-ns1];
05443           xg_sector[2-ns1] = xg_coord_sector[2-ns1];  yg_sector[2-ns1] = yg_coord_sector[2-ns1];
05444           xg_sector[3-ns1] = xg_coord_sector[3-ns1];  yg_sector[3-ns1] = yg_coord_sector[3-ns1];
05445           xg_sector[4-ns1] = xg_coord_sector[4-ns1];  yg_sector[4-ns1] = yg_coord_sector[4-ns1];
05446           xg_sector[5-ns1] = xg_coord_sector[5-ns1];  yg_sector[5-ns1] = yg_coord_sector[5-ns1];
05447         }
05448       
05449       if( DeeNumber == 2 )
05450         {
05451           ns1 = 5; ns2 = 9;
05452           xg_sector[ns2-1] = xinv_d2d4-xg_coord_sector[1-1];  yg_sector[ns2-1] = yg_coord_sector[1-1];
05453           xg_sector[ns2-2] = xinv_d2d4-xg_coord_sector[2-1];  yg_sector[ns2-2] = yg_coord_sector[2-1];
05454           xg_sector[ns2-3] = xinv_d2d4-xg_coord_sector[3-1];  yg_sector[ns2-3] = yg_coord_sector[3-1];
05455           xg_sector[ns2-4] = xinv_d2d4-xg_coord_sector[4-1];  yg_sector[ns2-4] = yg_coord_sector[4-1];
05456           xg_sector[ns2-5] = xinv_d2d4-xg_coord_sector[5-1];  yg_sector[ns2-5] = yg_coord_sector[5-1];
05457         }
05458       if( DeeNumber == 3 )
05459         {
05460           ns1 = 5; ns2 = 9;
05461           xg_sector[ns2-1]= xg_coord_sector[1-1];  yg_sector[ns2-1] = yg_coord_sector[1-1];
05462           xg_sector[ns2-2]= xg_coord_sector[2-1];  yg_sector[ns2-2] = yg_coord_sector[2-1];
05463           xg_sector[ns2-3]= xg_coord_sector[3-1];  yg_sector[ns2-3] = yg_coord_sector[3-1];
05464           xg_sector[ns2-4]= xg_coord_sector[4-1];  yg_sector[ns2-4] = yg_coord_sector[4-1];
05465           xg_sector[ns2-5]= xg_coord_sector[5-1];  yg_sector[ns2-5] = yg_coord_sector[5-1];
05466         }
05467       if( DeeNumber == 4 )
05468         {
05469           ns1 = 1; ns2 = 5;
05470           xg_sector[1-ns1]= xinv_d2d4-xg_coord_sector[1-ns1];  yg_sector[1-ns1] = yg_coord_sector[1-ns1];
05471           xg_sector[2-ns1]= xinv_d2d4-xg_coord_sector[2-ns1];  yg_sector[2-ns1] = yg_coord_sector[2-ns1];
05472           xg_sector[3-ns1]= xinv_d2d4-xg_coord_sector[3-ns1];  yg_sector[3-ns1] = yg_coord_sector[3-ns1];
05473           xg_sector[4-ns1]= xinv_d2d4-xg_coord_sector[4-ns1];  yg_sector[4-ns1] = yg_coord_sector[4-ns1];
05474           xg_sector[5-ns1]= xinv_d2d4-xg_coord_sector[5-ns1];  yg_sector[5-ns1] = yg_coord_sector[5-ns1];
05475         }
05476       
05477       Color_t coul_textsector = fCnaParHistos->ColorDefinition("vert37");
05478       for(Int_t ns=ns1; ns<= ns2; ns++)
05479         {
05480           xg_sector[ns-1] += fCnaParHistos->DeeOffsetX(opt_plot, DeeNumber);
05481           if( DeeNumber == 1 || DeeNumber == 2 ){sprintf( f_in, "+%d", ns);}
05482           if( DeeNumber == 3 || DeeNumber == 4 ){sprintf( f_in, "-%d", ns);}
05483           TText *text_num_module = new TText(xg_sector[ns-1], yg_sector[ns-1], f_in);        fCnewRoot++;
05484           if(opt_plot == "Dee"){text_num_module->SetTextSize(0.065);}
05485           if(opt_plot == "EE" ){text_num_module->SetTextSize(0.045);}
05486           text_num_module->SetTextColor(coul_textsector);
05487           if( opt_plot == "Dee" ||
05488               ( opt_plot == "EE" && !( (DeeNumber == 3 && ns == 5) || (DeeNumber == 1 && ns == 5) ) ) )
05489             {text_num_module->Draw();}
05490 
05491           // text_num_module->Delete(); text_num_module = 0;     fCdeleteRoot++;     
05492         }
05493       
05494       //............................ numeros des dee's
05495       ngmax = 4;
05496       Float_t  xg_coord_dee[4] = { 0,  0,  0,  0};
05497       Float_t  yg_coord_dee[4] = {48, 48, 48, 48};
05498       
05499       xg_coord_dee[DeeNumber-1] = coefcc_x*xg_coord_dee[DeeNumber-1];
05500       yg_coord_dee[DeeNumber-1] = coefcc_y*yg_coord_dee[DeeNumber-1];
05501 
05502       Float_t  xg_dee = xg_coord_dee[DeeNumber-1];
05503       Float_t  yg_dee = yg_coord_dee[DeeNumber-1];
05504 
05505       Color_t coul_textdee = fCnaParHistos->ColorDefinition("noir");
05506    
05507       xg_dee += fCnaParHistos->DeeOffsetX(opt_plot, DeeNumber)
05508         + fCnaParHistos->DeeNumberOffsetX(opt_plot, DeeNumber);
05509 
05510       if( DeeNumber == 1 ){sprintf( f_in, "D1");}
05511       if( DeeNumber == 2 ){sprintf( f_in, "D2");}
05512       if( DeeNumber == 3 ){sprintf( f_in, "D3");}
05513       if( DeeNumber == 4 ){sprintf( f_in, "D4");}
05514 
05515       TText *text_num_module = new TText(xg_dee, yg_dee, f_in);        fCnewRoot++;
05516       if( opt_plot == "EE" ){text_num_module->SetTextSize(0.045);}
05517       if( opt_plot == "Dee"){text_num_module->SetTextSize(0.085);}
05518       text_num_module->SetTextColor(coul_textdee);
05519       text_num_module->Draw();
05520     }
05521 
05522   //..................................... Numeros des Dee et indication EE+- (option "EE" seulement)
05523   if( opt_plot == "EE" )
05524     {
05525       //............................ indication EE+-
05526       ngmax = 4;
05527       Float_t  xg_coord_eepm[4] = { 0,  0,  0,  0};
05528       Float_t  yg_coord_eepm[4] = {95, 95, 95, 95};
05529      
05530       xg_coord_eepm[DeeNumber-1] = coefcc_x*xg_coord_eepm[DeeNumber-1];
05531       yg_coord_eepm[DeeNumber-1] = coefcc_y*yg_coord_eepm[DeeNumber-1];
05532 
05533       Float_t  xg_eepm = xg_coord_eepm[DeeNumber-1];
05534       Float_t  yg_eepm = yg_coord_eepm[DeeNumber-1];
05535 
05536       Color_t coul_texteepm = fCnaParHistos->ColorDefinition("noir");
05537    
05538       xg_eepm += fCnaParHistos->DeeOffsetX(opt_plot, DeeNumber)
05539         + fCnaParHistos->DeeNameOffsetX(DeeNumber);
05540 
05541       if( DeeNumber == 1 ){sprintf( f_in, "EE+F");}
05542       if( DeeNumber == 2 ){sprintf( f_in, "EE+N");}
05543       if( DeeNumber == 3 ){sprintf( f_in, "EE-N");}
05544       if( DeeNumber == 4 ){sprintf( f_in, "EE-F");}
05545 
05546       TText *text_num_eepm = new TText(xg_eepm, yg_eepm, f_in);        fCnewRoot++;
05547       text_num_eepm->SetTextSize(0.04);
05548       text_num_eepm->SetTextColor(coul_texteepm);
05549       text_num_eepm->Draw();
05550     }
05551 
05552   //......................... mention "viewed from IP"
05553   Color_t coul_textfromIP = fCnaParHistos->ColorDefinition("rouge49");
05554   sprintf( f_in, "viewed from IP");
05555   Float_t x_from_ip = 15.;
05556   Float_t y_from_ip = -10.;
05557   if( opt_plot == "EE" ){y_from_ip = -16.;}
05558   x_from_ip = coefcc_x*x_from_ip;
05559   y_from_ip = coefcc_x*y_from_ip;
05560   if( opt_plot == "EE" && DeeNumber == 3 ){x_from_ip += 1.4*fCnaParHistos->DeeOffsetX(opt_plot, DeeNumber);}
05561   TText *text_from_ip = new TText(x_from_ip, y_from_ip, f_in);        fCnewRoot++;
05562   text_from_ip->SetTextSize(0.045);
05563   if( opt_plot == "EE" ){text_from_ip->SetTextSize(0.035);}
05564   text_from_ip->SetTextColor(coul_textfromIP);
05565   if( opt_plot == "Dee" || (opt_plot == "EE" && DeeNumber == 3) ){text_from_ip->Draw();}
05566 
05567   delete [] f_in;      f_in = 0;                                 fCdelete++;
05568 
05569 }  // ------ end of EEDataSectors() ------
05570 
05571 //==========================================================================================
05572 
05573 void TEcnaHistos::EEGridAxis(const Float_t& coefcc_x,  const Float_t& coefcc_y,
05574                              const Int_t&   DeeNumber, const TString opt_plot,  const TString c_option)
05575 {
05576   //------------------ trace axes en IX et IY --------------- EEGridAxis
05577   //=============================================================================== Axe IX
05578   Int_t size_IX_dee  = fEcal->MaxSCIXInDee();
05579 
05580   Double_t IX_min = fEcalNumbering->GetIIXMin(1) - 0.5;                        // IX_min = 0.5  pour les 4 dee's
05581   Double_t IX_max = fEcalNumbering->GetIIXMax()*fEcal->MaxCrysIXInSC() + 0.5;  // IX_max = 50.5 pour les 4 dee's
05582 
05583   Int_t MatSize = 1;
05584   if( opt_plot == "Dee" && c_option == "corcc" )
05585     {
05586       MatSize = fEcal->MaxCrysInSC();
05587       IX_min = fEcalNumbering->GetIIXMin() - 0.5;
05588       IX_max = fEcalNumbering->GetIIXMax() + 0.5;
05589     }
05590   if( opt_plot == "EE"  && c_option == "corcc" ){return;}     // => a voir...
05591 
05592   if( opt_plot == "Dee" && c_option != "corcc" ){MatSize = fEcal->MaxCrysIXInSC();}
05593   if( opt_plot == "EE"  && c_option != "corcc" ){MatSize = 1;}
05594 
05595   TString  x_var_name  = " ";
05596 
05597   Float_t axis_x_inf  = 0;
05598   Float_t axis_x_sup  = 0;
05599   Float_t axis_y_inf  = 0;
05600   Float_t axis_y_sup  = 0;
05601   Int_t   axis_nb_div = 205;   // DEFAULT: option "EE"
05602   Double_t IX_values_min = 0;
05603   Double_t IX_values_max = 0;
05604   Option_t* chopt = "C";
05605 
05606   //........................................................................EEGridAxis
05607   if( DeeNumber == 1 ) //  xmin -> xmax <=> right->left
05608     {
05609       //.....axis min->max/left->right: first draw axis with -ticksize and no label
05610       axis_x_inf    = size_IX_dee*MatSize;
05611       axis_x_sup    = 0;
05612       axis_y_inf    = 0; 
05613       axis_y_sup    = 0;
05614       IX_values_min = -IX_max;   // -50.5 right
05615       IX_values_max = -IX_min;   // - 0.5 left
05616       if( opt_plot == "Dee" ){x_var_name = GetIXIYAxisTitle("iIXDee1");}
05617       if( opt_plot == "EE"  ){x_var_name = GetIXIYAxisTitle("iIXEE");}
05618       if( opt_plot == "Dee" ){axis_nb_div = size_IX_dee;} 
05619       chopt         = "-CSU";
05620     }
05621   if( DeeNumber == 2 ) //  xmin -> xmax <=> right->left
05622     {
05623       //.....axis min->max/left->right: first draw axis with -ticksize and no label
05624       axis_x_inf    = size_IX_dee*MatSize;
05625       axis_x_sup    = 0;
05626       axis_y_inf    = 0;
05627       axis_y_sup    = 0;
05628       IX_values_min = IX_min;   // + 0.5 right
05629       IX_values_max = IX_max;   // +50.5 left
05630       if( opt_plot == "Dee" ){x_var_name = GetIXIYAxisTitle("iIXDee2");}
05631       if( opt_plot == "EE"  ){x_var_name = " ";}
05632       if( opt_plot == "Dee" ){axis_nb_div = size_IX_dee;}  
05633       chopt         = "-CSU";
05634     }
05635   if( DeeNumber == 3 )  //  xmin -> xmax <=> left->right
05636     {
05637       axis_x_inf    = 0;
05638       axis_x_sup    = size_IX_dee*MatSize;
05639       axis_y_inf    = 0; 
05640       axis_y_sup    = 0;
05641       IX_values_min = IX_min;   // + 0.5 left
05642       IX_values_max = IX_max;   // +50.5 right
05643       if( opt_plot == "Dee" ){x_var_name = GetIXIYAxisTitle("iIXDee3");}
05644       if( opt_plot == "EE"  ){x_var_name = " ";}
05645       if( opt_plot == "Dee" ){axis_nb_div = size_IX_dee;} 
05646       chopt         = "CS";
05647     }
05648   if( DeeNumber == 4 )  //  xmin -> xmax <=> left->right
05649     {
05650       axis_x_inf    = 0;
05651       axis_x_sup    = size_IX_dee*MatSize;
05652       axis_y_inf    = 0; 
05653       axis_y_sup    = 0;
05654       IX_values_min = -IX_max;   // -50.5 left
05655       IX_values_max = -IX_min;   // - 0.5 right
05656       if( opt_plot == "Dee" ){x_var_name = GetIXIYAxisTitle("iIXDee4");}
05657       if( opt_plot == "EE"  ){x_var_name = " ";}
05658       if( opt_plot == "Dee" ){axis_nb_div = size_IX_dee;} 
05659       chopt         = "CS"; 
05660     }
05661 
05662   //.................................................................... EEGridAxis
05663   axis_x_inf += fCnaParHistos->DeeOffsetX(opt_plot, DeeNumber);
05664   axis_x_sup += fCnaParHistos->DeeOffsetX(opt_plot, DeeNumber);
05665 
05666   TGaxis* sup_axis_x = 0;
05667   sup_axis_x = new TGaxis(axis_x_inf, axis_y_inf, axis_x_sup, axis_y_sup,
05668                           IX_values_min, IX_values_max, axis_nb_div, chopt, 0.);   fCnewRoot++;
05669 
05670   Float_t tit_siz_x = fCnaParHistos->AxisTitleSize();
05671   Float_t lab_siz_x = fCnaParHistos->AxisLabelSize();
05672 
05673   Float_t tic_siz_x = fCnaParHistos->AxisTickSize("Deex");
05674   if(opt_plot == "EE"){tic_siz_x = fCnaParHistos->AxisTickSize("EEx");}
05675 
05676   Float_t tit_off_x = fCnaParHistos->AxisTitleOffset("Deex");
05677   if(opt_plot == "EE"){tit_off_x = fCnaParHistos->AxisTitleOffset("EEx");}
05678 
05679   Float_t lab_off_x = fCnaParHistos->AxisLabelOffset("Deex");
05680   if(opt_plot == "EE"){lab_off_x = fCnaParHistos->AxisLabelOffset("EEx");}
05681 
05682   sup_axis_x->SetTitle(x_var_name);
05683   sup_axis_x->SetTitleSize(tit_siz_x);
05684   sup_axis_x->SetTitleOffset(tit_off_x);
05685   sup_axis_x->SetLabelSize(lab_siz_x);
05686   sup_axis_x->SetLabelOffset(lab_off_x);
05687   sup_axis_x->SetTickSize(tic_siz_x);
05688   sup_axis_x->Draw("SAME");
05689 
05690   //.....axis min->max/right->left: redraw axis with ticksize = 0 and with -labelOffset
05691   if( DeeNumber == 1 || DeeNumber == 2 )
05692     {
05693       chopt = "CS";
05694       TGaxis* sup_axis_x_bis = 0;
05695       sup_axis_x_bis = new TGaxis(axis_x_inf, axis_y_inf, axis_x_sup, axis_y_sup,
05696                                   IX_values_min, IX_values_max, axis_nb_div, chopt, 0.);   fCnewRoot++;
05697       sup_axis_x_bis->SetTickSize(0.);
05698       lab_siz_x = sup_axis_x->GetLabelSize();
05699       sup_axis_x_bis->SetLabelSize(lab_siz_x);
05700       lab_off_x = sup_axis_x->GetLabelOffset();
05701       sup_axis_x_bis->SetLabelOffset(-lab_off_x);
05702       sup_axis_x_bis->Draw("SAME");
05703     }
05704 
05705   //================================================================== Axe IY  EEGridAxis
05706 
05707   if( opt_plot == "Dee" || (opt_plot == "EE" && DeeNumber == 4) )
05708     {
05709       Int_t size_IY_dee  = fEcal->MaxSCIYInDee();
05710       Int_t size_IY_axis = size_IY_dee;
05711 
05712       if( opt_plot == "Dee" ){axis_nb_div = size_IY_axis;}
05713       if( opt_plot == "EE"  ){axis_nb_div = 210;}
05714 
05715       Double_t jIY_min = fEcalNumbering->GetJIYMin(DeeNumber, 1) - 0.5;
05716       Double_t jIY_max = fEcalNumbering->GetJIYMax(DeeNumber)*fEcal->MaxCrysIYInSC() + 0.5;
05717 
05718       TString  jy_var_name  = " ";
05719       TString  jy_direction = "x";
05720 
05721       Float_t tit_siz_y = fCnaParHistos->AxisTitleSize();
05722       Float_t lab_siz_y = fCnaParHistos->AxisLabelSize();
05723 
05724       Float_t tic_siz_y = fCnaParHistos->AxisTickSize("Deey");
05725       if(opt_plot == "EE"){tic_siz_y = fCnaParHistos->AxisTickSize("EEy");}
05726 
05727       Float_t tit_off_y = fCnaParHistos->AxisTitleOffset("Deey");
05728       if(opt_plot == "EE"){tit_off_y = fCnaParHistos->AxisTitleOffset("EEy");}
05729 
05730       Float_t lab_off_y = fCnaParHistos->AxisLabelOffset("Deey");
05731       if(opt_plot == "EE"){lab_off_y = fCnaParHistos->AxisLabelOffset("EEy");}
05732 
05733       TGaxis* axis_jy_plus = 0;
05734       axis_jy_plus = new TGaxis((Float_t)0., (Float_t)0.,
05735                                 (Float_t)0., (Float_t)(size_IY_axis*MatSize),
05736                                 jIY_min, jIY_max, axis_nb_div, "SC", 0.);   fCnewRoot++;
05737 
05738       jy_var_name  = GetIXIYAxisTitle("jIYDee");  
05739       axis_jy_plus->SetTitle(jy_var_name);
05740       axis_jy_plus->SetTitleSize(tit_siz_y);
05741       axis_jy_plus->SetTitleOffset(tit_off_y);
05742       axis_jy_plus->SetLabelSize(lab_siz_y);
05743       axis_jy_plus->SetLabelOffset(lab_off_y);
05744       axis_jy_plus->SetTickSize(tic_siz_y);
05745       axis_jy_plus->Draw("SAME");
05746     }
05747 
05748 //---------------------------------- 2 axes (0,50) et (0,-50)
05749 #define IYAX
05750 #ifndef IYAX
05751   if( opt_plot == "Dee" || (opt_plot == "EE" && DeeNumber == 4) )
05752     {
05753       Int_t size_IY_dee  = fEcal->MaxSCIYInDee();
05754       Int_t size_IY_axis = size_IY_dee/2;
05755 
05756       if( opt_plot == "Dee" ){axis_nb_div = (Int_t)size_IY_axis;}
05757       if( opt_plot == "EE"  ){axis_nb_div = 5;}
05758 
05759       Double_t jIY_min = fEcalNumbering->GetJIYMin(DeeNumber, 1) - 0.5;
05760       Double_t jIY_max = (fEcalNumbering->GetJIYMax(DeeNumber)/2)*fEcal->MaxCrysIYInSC() + 0.5;
05761 
05762       TString  jy_var_name  = " ";
05763       TString  jy_direction = "x";
05764 
05765       Float_t tit_siz_y = fCnaParHistos->AxisTitleSize();
05766       Float_t lab_siz_y = fCnaParHistos->AxisLabelSize();
05767 
05768       Float_t tic_siz_y = fCnaParHistos->AxisTickSize("Deey");
05769       if(opt_plot == "EE"){tic_siz_y = fCnaParHistos->AxisTickSize("EEy");}
05770 
05771       Float_t tit_off_y = fCnaParHistos->AxisTitleOffset("Deey");
05772       if(opt_plot == "EE"){tit_off_y = fCnaParHistos->AxisTitleOffset("EEy");}
05773 
05774       Float_t lab_off_y = fCnaParHistos->AxisLabelOffset("Deey");
05775       if(opt_plot == "EE"){lab_off_y = fCnaParHistos->AxisLabelOffset("EEy");}
05776 
05777       TGaxis* axis_jy_plus = 0;
05778       axis_jy_plus = new TGaxis((Float_t)0., (Float_t)(size_IY_dee*MatSize/2),
05779                                 (Float_t)0., (Float_t)(2*size_IY_dee*MatSize/2),
05780                                 jIY_min, jIY_max, axis_nb_div, "SC", 0.);   fCnewRoot++;
05781 
05782       jy_var_name  = GetIXIYAxisTitle("jIYDee");  
05783       axis_jy_plus->SetTitle(jy_var_name);
05784       axis_jy_plus->SetTitleSize(tit_siz_y);
05785       axis_jy_plus->SetTitleOffset(tit_off_y);
05786       axis_jy_plus->SetLabelSize(lab_siz_y);
05787       axis_jy_plus->SetLabelOffset(lab_off_y);
05788       axis_jy_plus->SetTickSize(tic_siz_y);
05789       axis_jy_plus->Draw("SAME");
05790 
05791       TGaxis* axis_jy_minus = 0;
05792       axis_jy_minus = new TGaxis((Float_t)0., (Float_t)(size_IY_dee*MatSize/2),
05793                                  (Float_t)0., (Float_t)0.,
05794                                  -jIY_min, -jIY_max, axis_nb_div, "-SC", 0.);   fCnewRoot++;
05795 
05796       jy_var_name  = GetIXIYAxisTitle("jIYDee");  
05797       axis_jy_minus->SetTitle(jy_var_name);
05798       axis_jy_minus->SetTitleSize(tit_siz_y);
05799       axis_jy_minus->SetTitleOffset(tit_off_y);
05800       axis_jy_minus->SetLabelSize(lab_siz_y);
05801       axis_jy_minus->SetLabelOffset(lab_off_y);
05802       axis_jy_minus->SetTickSize(tic_siz_y);
05803       axis_jy_minus->Draw("SAME");
05804     }
05805 #endif // IYAX
05806 
05807 } // ------------- end of EEGridAxis(...) --------------
05808 
05809 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
05810 //
05811 //                               ViewHisto
05812 // 
05813 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
05814 //======================== D_NOE_ChNb
05815 void TEcnaHistos::EBXtalsAveragedNumberOfEvents(){StexXtalsNumberOfEvents();}
05816 void TEcnaHistos::SMXtalsNumberOfEvents(){StexXtalsNumberOfEvents();}
05817 void TEcnaHistos::EBXtalsAveragedNumberOfEvents(const TString PlotOption)
05818 {StexXtalsNumberOfEvents(PlotOption);}
05819 void TEcnaHistos::SMXtalsNumberOfEvents(const TString PlotOption)
05820 {StexXtalsNumberOfEvents(PlotOption);}
05821 
05822 void TEcnaHistos::EEXtalsAveragedNumberOfEvents(){StexXtalsNumberOfEvents();}
05823 void TEcnaHistos::DeeXtalsNumberOfEvents(){StexXtalsNumberOfEvents();}
05824 void TEcnaHistos::EEXtalsAveragedNumberOfEvents(const TString PlotOption)
05825 {StexXtalsNumberOfEvents(PlotOption);}
05826 void TEcnaHistos::DeeXtalsNumberOfEvents(const TString PlotOption)
05827 {StexXtalsNumberOfEvents(PlotOption);}
05828 
05829 void TEcnaHistos::StexXtalsNumberOfEvents(){StexXtalsNumberOfEvents("ONLYONE");}
05830 void TEcnaHistos::StexXtalsNumberOfEvents(const TString PlotOption)
05831 {ViewHisto(fZerv, fZerv, fZerv, "D_NOE_ChNb", PlotOption);}
05832 
05833 //....................
05834 void TEcnaHistos::EBAveragedNumberOfEventsXtals(){StexNumberOfEventsXtals();}
05835 void TEcnaHistos::SMNumberOfEventsXtals(){StexNumberOfEventsXtals();}
05836 void TEcnaHistos::EBAveragedNumberOfEventsXtals(const TString PlotOption)
05837 {StexNumberOfEventsXtals(PlotOption);}
05838 void TEcnaHistos::SMNumberOfEventsXtals(const TString PlotOption)
05839 {StexNumberOfEventsXtals(PlotOption);}
05840 
05841 void TEcnaHistos::EEAveragedNumberOfEventsXtals(){StexNumberOfEventsXtals();}
05842 void TEcnaHistos::DeeNumberOfEventsXtals(){StexNumberOfEventsXtals();}
05843 void TEcnaHistos::EEAveragedNumberOfEventsXtals(const TString PlotOption)
05844 {StexNumberOfEventsXtals(PlotOption);}
05845 void TEcnaHistos::DeeNumberOfEventsXtals(const TString PlotOption)
05846 {StexNumberOfEventsXtals(PlotOption);}
05847 
05848 void TEcnaHistos::StexNumberOfEventsXtals(){StexNumberOfEventsXtals("ONLYONE");}
05849 void TEcnaHistos::StexNumberOfEventsXtals(const TString PlotOption)
05850 {ViewHisto(fZerv, fZerv, fZerv, "D_NOE_ChDs", PlotOption);}
05851 
05852 //======================== D_Ped_ChDs
05853 void TEcnaHistos::EBXtalsAveragedPedestals(){StexXtalsPedestals();}
05854 void TEcnaHistos::SMXtalsPedestals(){StexXtalsPedestals();}
05855 void TEcnaHistos::EBXtalsAveragedPedestals(const TString PlotOption)
05856 {StexXtalsPedestals(PlotOption);}
05857 void TEcnaHistos::SMXtalsPedestals(const TString PlotOption)
05858 {StexXtalsPedestals(PlotOption);}
05859 
05860 void TEcnaHistos::EEXtalsAveragedPedestals(){StexXtalsPedestals();}
05861 void TEcnaHistos::DeeXtalsPedestals(){StexXtalsPedestals();}
05862 void TEcnaHistos::EEXtalsAveragedPedestals(const TString PlotOption)
05863 {StexXtalsPedestals(PlotOption);}
05864 void TEcnaHistos::DeeXtalsPedestals(const TString PlotOption)
05865 {StexXtalsPedestals(PlotOption);}
05866 
05867 void TEcnaHistos::StexXtalsPedestals(){StexXtalsPedestals("ONLYONE");}
05868 void TEcnaHistos::StexXtalsPedestals(const TString PlotOption)
05869 {ViewHisto(fZerv, fZerv, fZerv, "D_Ped_ChNb", PlotOption);}
05870 
05871 //............................
05872 void TEcnaHistos::EBAveragedPedestalsXtals(){StexPedestalsXtals();}
05873 void TEcnaHistos::SMPedestalsXtals(){StexPedestalsXtals();}
05874 void TEcnaHistos::EBAveragedPedestalsXtals(const TString PlotOption)
05875 {StexPedestalsXtals(PlotOption);}
05876 void TEcnaHistos::SMPedestalsXtals(const TString PlotOption)
05877 {StexPedestalsXtals(PlotOption);}
05878 
05879 void TEcnaHistos::EEAveragedPedestalsXtals(){StexPedestalsXtals();}
05880 void TEcnaHistos::DeePedestalsXtals(){StexPedestalsXtals();}
05881 void TEcnaHistos::EEAveragedPedestalsXtals(const TString PlotOption)
05882 {StexPedestalsXtals(PlotOption);}
05883 void TEcnaHistos::DeePedestalsXtals(const TString PlotOption)
05884 {StexPedestalsXtals(PlotOption);}
05885 
05886 void TEcnaHistos::StexPedestalsXtals(){StexPedestalsXtals("ONLYONE");}
05887 void TEcnaHistos::StexPedestalsXtals(const TString PlotOption)
05888 {ViewHisto(fZerv, fZerv, fZerv, "D_Ped_ChDs", PlotOption);}
05889 
05890 //======================== D_TNo_ChNb
05891 void TEcnaHistos::EBXtalsAveragedTotalNoise(){StexXtalsTotalNoise();}
05892 void TEcnaHistos::SMXtalsTotalNoise(){StexXtalsTotalNoise();}
05893 void TEcnaHistos::EBXtalsAveragedTotalNoise(const TString PlotOption)
05894 {StexXtalsTotalNoise(PlotOption);}
05895 void TEcnaHistos::SMXtalsTotalNoise(const TString PlotOption)
05896 {StexXtalsTotalNoise(PlotOption);}
05897 
05898 void TEcnaHistos::EEXtalsAveragedTotalNoise(){StexXtalsTotalNoise();}
05899 void TEcnaHistos::DeeXtalsTotalNoise(){StexXtalsTotalNoise();}
05900 void TEcnaHistos::EEXtalsAveragedTotalNoise(const TString PlotOption)
05901 {StexXtalsTotalNoise(PlotOption);}
05902 void TEcnaHistos::DeeXtalsTotalNoise(const TString PlotOption)
05903 {StexXtalsTotalNoise(PlotOption);}
05904 
05905 void TEcnaHistos::StexXtalsTotalNoise(){StexXtalsTotalNoise("ONLYONE");}
05906 void TEcnaHistos::StexXtalsTotalNoise(const TString PlotOption)
05907 {ViewHisto(fZerv, fZerv, fZerv, "D_TNo_ChNb", PlotOption);}
05908 
05909 //...............................
05910 void TEcnaHistos::EBAveragedTotalNoiseXtals(){StexTotalNoiseXtals();}
05911 void TEcnaHistos::SMTotalNoiseXtals(){StexTotalNoiseXtals();}
05912 void TEcnaHistos::EBAveragedTotalNoiseXtals(const TString PlotOption)
05913 {StexTotalNoiseXtals(PlotOption);}
05914 void TEcnaHistos::SMTotalNoiseXtals(const TString PlotOption)
05915 {StexTotalNoiseXtals(PlotOption);}
05916 
05917 void TEcnaHistos::EEAveragedTotalNoiseXtals(){StexTotalNoiseXtals();}
05918 void TEcnaHistos::DeeTotalNoiseXtals(){StexTotalNoiseXtals();}
05919 void TEcnaHistos::EEAveragedTotalNoiseXtals(const TString PlotOption)
05920 {StexTotalNoiseXtals(PlotOption);}
05921 void TEcnaHistos::DeeTotalNoiseXtals(const TString PlotOption)
05922 {StexTotalNoiseXtals(PlotOption);}
05923 
05924 void TEcnaHistos::StexTotalNoiseXtals(){StexTotalNoiseXtals("ONLYONE");}
05925 void TEcnaHistos::StexTotalNoiseXtals(const TString PlotOption)
05926 {ViewHisto(fZerv, fZerv, fZerv, "D_TNo_ChDs", PlotOption);}
05927 
05928 //======================== D_MCs_ChNb
05929 void TEcnaHistos::EBXtalsAveragedMeanOfCorss(){StexXtalsMeanOfCorss();}
05930 void TEcnaHistos::SMXtalsMeanOfCorss(){StexXtalsMeanOfCorss();}
05931 void TEcnaHistos::EBXtalsAveragedMeanOfCorss(const TString PlotOption)
05932                 {StexXtalsMeanOfCorss(PlotOption);}
05933 void TEcnaHistos::SMXtalsMeanOfCorss(const TString PlotOption)
05934                 {StexXtalsMeanOfCorss(PlotOption);}
05935 
05936 void TEcnaHistos::EEXtalsAveragedMeanOfCorss(){StexXtalsMeanOfCorss();}
05937 void TEcnaHistos::DeeXtalsMeanOfCorss(){StexXtalsMeanOfCorss();}
05938 void TEcnaHistos::EEXtalsAveragedMeanOfCorss(const TString PlotOption)
05939                 {StexXtalsMeanOfCorss(PlotOption);}
05940 void TEcnaHistos::DeeXtalsMeanOfCorss(const TString PlotOption)
05941                 {StexXtalsMeanOfCorss(PlotOption);}
05942 
05943 void TEcnaHistos::StexXtalsMeanOfCorss(){StexXtalsMeanOfCorss("ONLYONE");}
05944 void TEcnaHistos::StexXtalsMeanOfCorss(const TString PlotOption)
05945 {ViewHisto(fZerv, fZerv, fZerv, "D_MCs_ChNb", PlotOption);}
05946 
05947 //.......................... 
05948 void TEcnaHistos::EBAveragedMeanOfCorssXtals(){StexMeanOfCorssXtals();}
05949 void TEcnaHistos::SMMeanOfCorssXtals(){StexMeanOfCorssXtals();}
05950 void TEcnaHistos::EBAveragedMeanOfCorssXtals(const TString PlotOption)
05951                 {StexMeanOfCorssXtals(PlotOption);}
05952 void TEcnaHistos::SMMeanOfCorssXtals(const TString PlotOption)
05953                 {StexMeanOfCorssXtals(PlotOption);}
05954 
05955 void TEcnaHistos::EEAveragedMeanOfCorssXtals(){StexMeanOfCorssXtals();}
05956 void TEcnaHistos::DeeMeanOfCorssXtals(){StexMeanOfCorssXtals();}
05957 void TEcnaHistos::EEAveragedMeanOfCorssXtals(const TString PlotOption)
05958                 {StexMeanOfCorssXtals(PlotOption);}
05959 void TEcnaHistos::DeeMeanOfCorssXtals(const TString PlotOption)
05960                 {StexMeanOfCorssXtals(PlotOption);}
05961 
05962 void TEcnaHistos::StexMeanOfCorssXtals(){StexMeanOfCorssXtals("ONLYONE");}
05963 void TEcnaHistos::StexMeanOfCorssXtals(const TString PlotOption)
05964 {ViewHisto(fZerv, fZerv, fZerv, "D_MCs_ChDs", PlotOption);}
05965 
05966 //======================== D_LFN_ChDs
05967 void TEcnaHistos::EBXtalsAveragedLowFrequencyNoise(){StexXtalsLowFrequencyNoise();}
05968 void TEcnaHistos::SMXtalsLowFrequencyNoise(){StexXtalsLowFrequencyNoise();}
05969 void TEcnaHistos::EBXtalsAveragedLowFrequencyNoise(const TString PlotOption)
05970                 {StexXtalsLowFrequencyNoise(PlotOption);}
05971 void TEcnaHistos::SMXtalsLowFrequencyNoise(const TString PlotOption)
05972                 {StexXtalsLowFrequencyNoise(PlotOption);}
05973 
05974 void TEcnaHistos::EEXtalsAveragedLowFrequencyNoise(){StexXtalsLowFrequencyNoise();}
05975 void TEcnaHistos::DeeXtalsLowFrequencyNoise(){StexXtalsLowFrequencyNoise();}
05976 void TEcnaHistos::EEXtalsAveragedLowFrequencyNoise(const TString PlotOption)
05977                 {StexXtalsLowFrequencyNoise(PlotOption);}
05978 void TEcnaHistos::DeeXtalsLowFrequencyNoise(const TString PlotOption)
05979                 {StexXtalsLowFrequencyNoise(PlotOption);}
05980 
05981 void TEcnaHistos::StexXtalsLowFrequencyNoise(){StexXtalsLowFrequencyNoise("ONLYONE");}
05982 void TEcnaHistos::StexXtalsLowFrequencyNoise(const TString PlotOption)
05983 {ViewHisto(fZerv, fZerv, fZerv, "D_LFN_ChNb", PlotOption);}
05984 
05985 //.....................................
05986 void TEcnaHistos::EBAveragedLowFrequencyNoiseXtals(){StexLowFrequencyNoiseXtals();}
05987 void TEcnaHistos::SMLowFrequencyNoiseXtals(){StexLowFrequencyNoiseXtals();}
05988 void TEcnaHistos::EBAveragedLowFrequencyNoiseXtals(const TString PlotOption)
05989                 {StexLowFrequencyNoiseXtals(PlotOption);}
05990 void TEcnaHistos::SMLowFrequencyNoiseXtals(const TString PlotOption)
05991                 {StexLowFrequencyNoiseXtals(PlotOption);}
05992 
05993 void TEcnaHistos::EEAveragedLowFrequencyNoiseXtals(){StexLowFrequencyNoiseXtals();}
05994 void TEcnaHistos::DeeLowFrequencyNoiseXtals(){StexLowFrequencyNoiseXtals();}
05995 void TEcnaHistos::EEAveragedLowFrequencyNoiseXtals(const TString PlotOption)
05996                 {StexLowFrequencyNoiseXtals(PlotOption);}
05997 void TEcnaHistos::DeeLowFrequencyNoiseXtals(const TString PlotOption)
05998                 {StexLowFrequencyNoiseXtals(PlotOption);}
05999 
06000 void TEcnaHistos::StexLowFrequencyNoiseXtals(){StexLowFrequencyNoiseXtals("ONLYONE");}
06001 void TEcnaHistos::StexLowFrequencyNoiseXtals(const TString PlotOption)
06002 {ViewHisto(fZerv, fZerv, fZerv, "D_LFN_ChDs", PlotOption);}
06003 
06004 //======================== D_HFN_ChNb
06005 void TEcnaHistos::EBXtalsAveragedHighFrequencyNoise(){StexXtalsHighFrequencyNoise();}
06006 void TEcnaHistos::SMXtalsHighFrequencyNoise(){StexXtalsHighFrequencyNoise();}
06007 void TEcnaHistos::EBXtalsAveragedHighFrequencyNoise(const TString PlotOption)
06008                 {StexXtalsHighFrequencyNoise(PlotOption);}
06009 void TEcnaHistos::SMXtalsHighFrequencyNoise(const TString PlotOption)
06010                 {StexXtalsHighFrequencyNoise(PlotOption);}
06011 
06012 void TEcnaHistos::EEXtalsAveragedHighFrequencyNoise(){StexXtalsHighFrequencyNoise();}
06013 void TEcnaHistos::DeeXtalsHighFrequencyNoise(){StexXtalsHighFrequencyNoise();}
06014 void TEcnaHistos::EEXtalsAveragedHighFrequencyNoise(const TString PlotOption)
06015                 {StexXtalsHighFrequencyNoise(PlotOption);}
06016 void TEcnaHistos::DeeXtalsHighFrequencyNoise(const TString PlotOption)
06017                 {StexXtalsHighFrequencyNoise(PlotOption);}
06018 
06019 void TEcnaHistos::StexXtalsHighFrequencyNoise(){StexXtalsHighFrequencyNoise("ONLYONE");}
06020 void TEcnaHistos::StexXtalsHighFrequencyNoise(const TString PlotOption)
06021 {ViewHisto(fZerv, fZerv, fZerv, "D_HFN_ChNb", PlotOption);}
06022 
06023 //....................................
06024 void TEcnaHistos::EBAveragedHighFrequencyNoiseXtals(){StexHighFrequencyNoiseXtals();}
06025 void TEcnaHistos::SMHighFrequencyNoiseXtals(){StexHighFrequencyNoiseXtals();}
06026 void TEcnaHistos::EBAveragedHighFrequencyNoiseXtals(const TString PlotOption)
06027                 {StexHighFrequencyNoiseXtals(PlotOption);}
06028 void TEcnaHistos::SMHighFrequencyNoiseXtals(const TString PlotOption)
06029                 {StexHighFrequencyNoiseXtals(PlotOption);}
06030 
06031 void TEcnaHistos::EEAveragedHighFrequencyNoiseXtals(){StexHighFrequencyNoiseXtals();}
06032 void TEcnaHistos::DeeHighFrequencyNoiseXtals(){StexHighFrequencyNoiseXtals();}
06033 void TEcnaHistos::EEAveragedHighFrequencyNoiseXtals(const TString PlotOption)
06034                 {StexHighFrequencyNoiseXtals(PlotOption);}
06035 void TEcnaHistos::DeeHighFrequencyNoiseXtals(const TString PlotOption)
06036                 {StexHighFrequencyNoiseXtals(PlotOption);}
06037 
06038 void TEcnaHistos::StexHighFrequencyNoiseXtals(){StexHighFrequencyNoiseXtals("ONLYONE");}
06039 void TEcnaHistos::StexHighFrequencyNoiseXtals(const TString PlotOption)
06040 {ViewHisto(fZerv, fZerv, fZerv, "D_HFN_ChDs", PlotOption);}
06041 
06042 //======================== D_SCs_ChNb
06043 void TEcnaHistos::EBXtalsAveragedSigmaOfCorss(){StexXtalsSigmaOfCorss();}
06044 void TEcnaHistos::SMXtalsSigmaOfCorss(){StexXtalsSigmaOfCorss();}
06045 void TEcnaHistos::EBXtalsAveragedSigmaOfCorss(const TString PlotOption)
06046                 {StexXtalsSigmaOfCorss(PlotOption);}
06047 void TEcnaHistos::SMXtalsSigmaOfCorss(const TString PlotOption)
06048                 {StexXtalsSigmaOfCorss(PlotOption);}
06049 
06050 void TEcnaHistos::EEXtalsAveragedSigmaOfCorss(){StexXtalsSigmaOfCorss();}
06051 void TEcnaHistos::DeeXtalsSigmaOfCorss(){StexXtalsSigmaOfCorss();}
06052 void TEcnaHistos::EEXtalsAveragedSigmaOfCorss(const TString PlotOption)
06053                 {StexXtalsSigmaOfCorss(PlotOption);}
06054 void TEcnaHistos::DeeXtalsSigmaOfCorss(const TString PlotOption)
06055                 {StexXtalsSigmaOfCorss(PlotOption);}
06056 
06057 void TEcnaHistos::StexXtalsSigmaOfCorss(){StexXtalsSigmaOfCorss("ONLYONE");}
06058 void TEcnaHistos::StexXtalsSigmaOfCorss(const TString PlotOption)
06059 {ViewHisto(fZerv, fZerv, fZerv, "D_SCs_ChNb", PlotOption);}
06060 
06061 //......................................
06062 void TEcnaHistos::EBAveragedSigmaOfCorssXtals(){StexSigmaOfCorssXtals();}
06063 void TEcnaHistos::SMSigmaOfCorssXtals(){StexSigmaOfCorssXtals();}
06064 void TEcnaHistos::EBAveragedSigmaOfCorssXtals(const TString PlotOption)
06065                 {StexSigmaOfCorssXtals(PlotOption);}
06066 void TEcnaHistos::SMSigmaOfCorssXtals(const TString PlotOption)
06067                 {StexSigmaOfCorssXtals(PlotOption);}
06068 
06069 void TEcnaHistos::EEAveragedSigmaOfCorssXtals(){StexSigmaOfCorssXtals();}
06070 void TEcnaHistos::DeeSigmaOfCorssXtals(){StexSigmaOfCorssXtals();}
06071 void TEcnaHistos::EEAveragedSigmaOfCorssXtals(const TString PlotOption)
06072                 {StexSigmaOfCorssXtals(PlotOption);}
06073 void TEcnaHistos::DeeSigmaOfCorssXtals(const TString PlotOption)
06074                 {StexSigmaOfCorssXtals(PlotOption);}
06075 
06076 void TEcnaHistos::StexSigmaOfCorssXtals(){StexSigmaOfCorssXtals("ONLYONE");}
06077 void TEcnaHistos::StexSigmaOfCorssXtals(const TString PlotOption)
06078 {ViewHisto(fZerv, fZerv, fZerv, "D_SCs_ChDs", PlotOption);}
06079 
06080 //======================== D_MSp_Samp
06081 void TEcnaHistos::XtalSamplesEv(const Int_t&  aStexStin_A,       const Int_t& i0StinEcha)
06082                 {XtalSamplesEv(aStexStin_A, i0StinEcha, "ONLYONE");}
06083 void TEcnaHistos::XtalSamplesEv(const Int_t&  aStexStin_A,       const Int_t& i0StinEcha,
06084                                const TString PlotOption)
06085 {
06086   if( fFapStexNumber != 0 )
06087     {
06088       Int_t StexStin_A = aStexStin_A;
06089       if( fFlagSubDet == "EE" )
06090         {StexStin_A = fEcalNumbering->Get1DeeSCEcnaFromDeeSCCons(fFapStexNumber, aStexStin_A);}
06091       ViewHisto(StexStin_A, i0StinEcha, fZerv, "D_MSp_Samp", PlotOption);
06092     }
06093   else
06094     {
06095       cout << "!TEcnaHistos::XtalSamplesEv(...)> " << fFapStexName.Data() << " number = " << fFapStexNumber
06096            << " out of range (range = [1," << fEcal->MaxStexInStas() << "])" << fTTBELL << endl;
06097     }
06098 }
06099 
06100 //======================== D_SSp_Samp
06101 void TEcnaHistos::XtalSamplesSigma(const Int_t&  aStexStin_A,       const Int_t& i0StinEcha)
06102                 {XtalSamplesSigma(aStexStin_A, i0StinEcha, "ONLYONE");}
06103 void TEcnaHistos::XtalSamplesSigma(const Int_t&  aStexStin_A,       const Int_t& i0StinEcha,
06104                                   const TString PlotOption)
06105 {
06106   if( fFapStexNumber != 0 )
06107     {
06108       Int_t StexStin_A = aStexStin_A;
06109       if( fFlagSubDet == "EE" )
06110         {StexStin_A = fEcalNumbering->Get1DeeSCEcnaFromDeeSCCons(fFapStexNumber, aStexStin_A);}
06111       ViewHisto(StexStin_A, i0StinEcha, fZerv, "D_SSp_Samp", PlotOption);
06112     }
06113   else
06114     {
06115       cout << "!TEcnaHistos::XtalSamplesSigma(...)> " << fFapStexName.Data() << " number = " << fFapStexNumber
06116            << " out of range (range = [1," << fEcal->MaxStexInStas() << "])" << fTTBELL << endl;
06117     }
06118 }
06119 
06120 //======================== D_Adc_EvNb
06121 void TEcnaHistos::XtalSampleValues(const Int_t& aStexStin_A, const Int_t& i0StinEcha, const Int_t& iSample)
06122                 {XtalSampleValues(aStexStin_A, i0StinEcha, iSample, "ONLYONE");}
06123 void TEcnaHistos::XtalSampleValues(const Int_t& aStexStin_A, const Int_t& i0StinEcha, const Int_t& iSample,
06124                                   const TString PlotOption)
06125 {
06126   if( fFapStexNumber != 0 )
06127     {
06128       Int_t StexStin_A = aStexStin_A;
06129       if( fFlagSubDet == "EE" )
06130         {StexStin_A = fEcalNumbering->Get1DeeSCEcnaFromDeeSCCons(fFapStexNumber, aStexStin_A);}
06131       ViewHisto(StexStin_A, i0StinEcha, iSample, "D_Adc_EvNb", PlotOption);
06132     }
06133   else
06134     {
06135       cout << "!TEcnaHistos::XtalSampleValues(...)> " << fFapStexName.Data() << " number = " << fFapStexNumber
06136            << " out of range (range = [1," << fEcal->MaxStexInStas() << "])" << fTTBELL << endl;
06137     }
06138 }
06139 
06140 //======================== D_Adc_EvDs
06141 void TEcnaHistos::SampleADCEvents(const Int_t& aStexStin_A, const Int_t& i0StinEcha, const Int_t& iSample)
06142                 {SampleADCEvents(aStexStin_A, i0StinEcha, iSample, "ONLYONE");}
06143 void TEcnaHistos::SampleADCEvents(const Int_t& aStexStin_A, const Int_t&  i0StinEcha,
06144                                  const Int_t& iSample,     const TString PlotOption)
06145 {
06146   if( fFapStexNumber != 0 )
06147     {
06148       Int_t StexStin_A = aStexStin_A;
06149       if( fFlagSubDet == "EE" )
06150         {StexStin_A = fEcalNumbering->Get1DeeSCEcnaFromDeeSCCons(fFapStexNumber, aStexStin_A);}
06151       ViewHisto(StexStin_A, i0StinEcha, iSample, "D_Adc_EvDs", PlotOption);
06152     }
06153   else
06154     {
06155       cout << "!TEcnaHistos::SampleADCEvents(...)> " << fFapStexName.Data() << " number = " << fFapStexNumber
06156            << " out of range (range = [1," << fEcal->MaxStexInStas() << "])" << fTTBELL << endl;
06157     }
06158 }
06159 
06160 //==========================================================================================
06161 //
06162 //                         ViewHisto
06163 //       
06164 //     ViewHisto( StexStin_A, i0StinEcha, iSample,  opt_quantity, opt_plot)
06165 //
06166 //     (StexStin_A, i0StinEcha, iSample (NOT USED), fOptHisEv, lin/log, opt_plot) ==> 
06167 //     exp values of the samples for i0StinEcha of StexStin_A 
06168 //
06169 //     (StexStin_A, i0StinEcha, iSample (NOT USED), fOptHisSigma, lin/log, opt_plot) ==> 
06170 //     sigmas of the samples for i0StinEcha of StexStin_A
06171 //
06172 //     (StexStin_A, i0StinEcha, iSample, fOptHisD_Adc_EvDs, lin/log, opt_plot) ==>
06173 //     ADC event distribution for i0StinEcha of StexStin_A and for sample              
06174 //
06175 //     (StexStin_A, i0StinEcha, iSample (NOT USED), fOptHisD_Adc_EvNb, lin/log, opt_plot) ==>
06176 //     Pedestal as a function of event number for i0StinEcha of StexStin_A              
06177 //
06178 //===========================================================================================
06179 void TEcnaHistos::ViewHisto(const Int_t& StexStin_A, const Int_t&  i0StinEcha,
06180                            const Int_t& iSample,    const TString HistoCode,
06181                            const TString opt_plot_arg)
06182 {
06183 //Histogram of the quantities (one run)
06184 
06185   //.......................................
06186   TString opt_plot = opt_plot_arg;
06187 
06188   Int_t OKHisto = 0;
06189 
06190   //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Canvas already closed in option SAME %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
06191   Int_t xCanvasExists = 1; // a priori ==> Canvas exists                                   // (ViewHisto)
06192   if( opt_plot != fOnlyOnePlot && GetMemoFlag(HistoCode, opt_plot) == "Busy" )
06193     {
06194       TVirtualPad* main_subpad = 0; 
06195       //---------------- Call to ActivePad
06196       //if( (TRootCanvas*)fCanv<HISTOCODE>->GetCanvasImp() == fImp<HISTOCODE> ){
06197       // main_subpad = fPad<HISTOCODE>;} (return main_subpad)
06198       main_subpad = ActivePad(HistoCode.Data(), opt_plot.Data());  // => return 0 if canvas has been closed
06199       if( main_subpad == 0 )
06200         {
06201           cout << "*TEcnaHistos::ViewHisto(...)> WARNING ===> Canvas has been closed in option SAME or SAME n."
06202                << endl
06203                << "                             Please, restart with a new canvas."
06204                << fTTBELL << endl;
06205           
06206           ReInitCanvas(HistoCode, opt_plot);
06207           xCanvasExists = 0;
06208         }
06209     }
06210   //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
06211 
06212   TString XVarHisto = fCnaParHistos->GetXVarHisto(HistoCode.Data(), fFlagSubDet.Data(), fFapStexNumber);
06213   TString YVarHisto = fCnaParHistos->GetYVarHisto(HistoCode.Data(), fFlagSubDet.Data(), fFapStexNumber);
06214 
06215   TString HistoType = fCnaParHistos->GetHistoType(HistoCode.Data());
06216 
06217   //%%%%%%%%%%%%%%%%%%%%%%%% Change of X variable in option SAME n with no proj %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
06218   Int_t SameXVarMemo = 1;   //  a priori ==> SAME n option: X variable OK                     (ViewHisto)
06219   if( !( HistoType == "Proj" || HistoType == "SampProj" || HistoType == "EvolProj") )
06220     {
06221       if( (opt_plot == fSameOnePlot ) && GetMemoFlag(HistoCode, opt_plot) == "Free" )
06222         {
06223           SetXVarMemo(HistoCode, opt_plot, XVarHisto);  SetYVarMemo(HistoCode, opt_plot, YVarHisto); SameXVarMemo = 1;
06224         }
06225       if( (opt_plot == fSameOnePlot ) && GetMemoFlag(HistoCode, opt_plot) == "Busy" )
06226         {
06227           TString XVariableMemo = GetXVarFromMemo(HistoCode, opt_plot);
06228           TString YVariableMemo = GetYVarFromMemo(HistoCode, opt_plot);
06229           
06230           if( XVarHisto != XVariableMemo )
06231             {
06232               cout << "!TEcnaHistos::ViewHisto(...)> *** ERROR *** ===> X coordinate changed in option SAME n." << endl
06233                    << "                             Present  X = " << XVarHisto << endl
06234                    << "                             Present  Y = " << YVarHisto << endl
06235                    << "                             Previous X = " << XVariableMemo << endl
06236                    << "                             Previous Y = " << YVariableMemo 
06237                    << fTTBELL << endl;
06238               SameXVarMemo = 0;
06239             }
06240           else
06241             {SetYVarMemo(HistoCode, opt_plot, YVarHisto);}
06242         }
06243     }
06244   //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
06245 
06246   //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Change of Y variable in option SAME n %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
06247   Int_t SameYVarMemo = 1;   //  a priori ==> SAME n option: Y variable OK                     (ViewHisto)
06248   if( HistoType == "Proj" || HistoType == "SampProj" || HistoType == "EvolProj" )
06249     {
06250       if( (opt_plot == fSameOnePlot ) && GetMemoFlag(HistoCode, opt_plot) == "Free" )
06251         {
06252           SetYVarMemo(HistoCode, opt_plot, YVarHisto);  SetYVarMemo(HistoCode, opt_plot, YVarHisto); SameYVarMemo = 1;
06253         }
06254       if( (opt_plot == fSameOnePlot ) && GetMemoFlag(HistoCode, opt_plot) == "Busy" )
06255         {
06256           TString XVariableMemo = GetXVarFromMemo(HistoCode, opt_plot);
06257           TString YVariableMemo = GetYVarFromMemo(HistoCode, opt_plot);
06258           
06259           if( YVarHisto != YVariableMemo )
06260             {
06261               cout << "!TEcnaHistos::ViewHisto(...)> *** ERROR *** ===> Y coordinate changed in option SAME n." << endl
06262                    << "                             Present  X = " << XVarHisto << endl
06263                    << "                             Present  Y = " << YVarHisto << endl
06264                    << "                             Previous X = " << XVariableMemo << endl
06265                    << "                             Previous Y = " << YVariableMemo 
06266                    << fTTBELL << endl;
06267               SameYVarMemo = 0;
06268             }
06269           else
06270             {SetYVarMemo(HistoCode, opt_plot, YVarHisto);}
06271         }
06272     }
06273   //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
06274 
06275   //%%%%%%%%%%%%%%%%%%%%%%%%%%% Number of bins change in option SAME or SAME n %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
06276   Int_t OkBinsMemoSameOne = 1;   //  a priori ==> SAME n option: Nb bins OK                     (ViewHisto)
06277 
06278   Int_t SizeForPlot = GetHistoSize(HistoCode.Data(), "plot");
06279   Int_t xNbBins = GetHistoNumberOfBins(HistoCode.Data(), SizeForPlot);  
06280 
06281   if( (opt_plot == fSameOnePlot || opt_plot == fSeveralPlot) && GetMemoFlag(HistoCode, opt_plot) == "Free" )
06282     {
06283       SetNbBinsMemo(HistoCode, opt_plot, xNbBins); OkBinsMemoSameOne = 1;
06284     }
06285   if( (opt_plot == fSameOnePlot || opt_plot == fSeveralPlot) && GetMemoFlag(HistoCode, opt_plot) == "Busy" )
06286     {
06287       Int_t NbBinsMemo = GetNbBinsFromMemo(HistoCode, opt_plot);
06288       if( xNbBins != NbBinsMemo )
06289         {
06290           cout << "!TEcnaHistos::ViewHisto(...)> *** ERROR *** ===> Number of bins changed in option SAME or SAME n."
06291                << " Present number = " << xNbBins << ", requested number = " << NbBinsMemo << fTTBELL << endl;
06292           OkBinsMemoSameOne = 0;
06293         }
06294     }
06295 
06296   //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
06297 
06298   if( xCanvasExists == 1 && SameXVarMemo == 1 && SameYVarMemo == 1 && OkBinsMemoSameOne == 1 ){OKHisto = 1;}
06299 
06300   //======================== Histo accepted                                                       (ViewHisto)
06301   if( OKHisto == 1 )
06302     {
06303       Int_t opt_scale_x = fOptScaleLinx;
06304       if (fFlagScaleX == "LIN" ){opt_scale_x = fOptScaleLinx;}
06305       if (fFlagScaleX == "LOG" ){opt_scale_x = fOptScaleLogx;}
06306 
06307       Int_t opt_scale_y = fOptScaleLiny;
06308       if (fFlagScaleY == "LIN" ){opt_scale_y = fOptScaleLiny;}
06309       if (fFlagScaleY == "LOG" ){opt_scale_y = fOptScaleLogy;}
06310 
06311       fCnaParHistos->SetColorPalette(fFlagColPal);
06312       TString fp_name_short = " ";
06313   
06314       //-------------------- read_histo size
06315       Int_t SizeForRead = GetHistoSize(HistoCode.Data(), "read");
06316 
06317       //............................................... allocation/init read_histo
06318       TVectorD histo_for_plot(SizeForPlot);
06319       for(Int_t i=0; i<SizeForPlot; i++){histo_for_plot[i]=(Double_t)0;}
06320 
06321       TVectorD histo_for_plot_memo(SizeForPlot);
06322       for(Int_t i=0; i<SizeForPlot; i++){histo_for_plot_memo[i]=(Double_t)0;}
06323 
06324       Int_t i_data_exist = 0;
06325       Int_t OKPlot = 0;
06326 
06327       //-------------------------------------------------------- histos Global and Proj
06328       if( HistoType == "Global" || HistoType == "Proj" || HistoType == "SampGlobal" || HistoType == "SampProj" )
06329         {     
06330           if( (fFapStexNumber == 0) )
06331             {
06332               //--------------------------------------------------------------------- Stas Histo      (ViewHisto)
06333               Int_t CounterExistingFile = 0;
06334               Int_t CounterDataExist = 0;
06335 
06336               Int_t* xFapNbOfEvts = new Int_t[fEcal->MaxStexInStas()];     fCnew++;
06337               for(Int_t i=0; i<fEcal->MaxStexInStas(); i++){xFapNbOfEvts[i]=0;}
06338 
06339               Int_t* NOFE_int = new Int_t[fEcal->MaxCrysEcnaInStex()];     fCnew++;
06340 
06341               for(Int_t iStasStex=0; iStasStex<fEcal->MaxStexInStas(); iStasStex++)
06342                 {
06343                   fMyRootFile->PrintNoComment();
06344                   fMyRootFile->GetReadyToReadRootFile(fFapAnaType,          fFapNbOfSamples,
06345                                                       fFapRunNumber,        fFapFirstReqEvtNumber,
06346                                                       fFapLastReqEvtNumber, fFapReqNbOfEvts,
06347                                                       iStasStex+1,          fCfgResultsRootFilePath.Data());
06348 
06349                   if ( fMyRootFile->LookAtRootFile() == kTRUE )        //   (ViewHisto, Stas)
06350                     {
06351                       fStatusFileFound = kTRUE;
06352 
06353                       CounterExistingFile++;
06354                       xFapNbOfEvts[iStasStex] = GetNumberOfEvents(fMyRootFile, fFapReqNbOfEvts);
06355                       //----------------------------------------------------------------------------- file reading
06356                       fp_name_short = fMyRootFile->GetRootFileNameShort();
06357                       // cout << "*TEcnaHistos::ViewHisto(...)> Data are analyzed from file ----> "
06358                       //      << fp_name_short << endl;
06359                       
06360                       //....................... search for first and last dates
06361                       if( iStasStex == 0 )
06362                         {
06363                           fStartTime = fMyRootFile->GetStartTime();
06364                           fStopTime  = fMyRootFile->GetStopTime();
06365                           fStartDate = fMyRootFile->GetStartDate();
06366                           fStopDate  = fMyRootFile->GetStopDate();
06367                         }
06368                       else
06369                         {
06370                           time_t xStartTime = fMyRootFile->GetStartTime();
06371                           time_t xStopTime  = fMyRootFile->GetStopTime();
06372                           TString xStartDate = fMyRootFile->GetStartDate();
06373                           TString xStopDate  = fMyRootFile->GetStopDate();
06374                           if( xStartTime < fStartTime ){fStartTime = xStartTime; fStartDate = xStartDate;}
06375                           if( xStopTime  > fStopTime  ){fStopTime  = xStopTime;  fStopDate  = xStopDate;}
06376                         }
06377 
06378                       fRunType   = fMyRootFile->GetRunType();
06379 
06380                       //............................................... histo reading   (ViewHisto, Stas)
06381                       TVectorD read_histo(fEcal->MaxStinEcnaInStex());
06382                       for(Int_t i=0; i<fEcal->MaxStinEcnaInStex(); i++){read_histo(i)=(Double_t)0.;}
06383                   
06384                       if( HistoCode == "D_NOE_ChNb" || HistoCode == "D_NOE_ChDs" ){
06385                         read_histo = fMyRootFile->ReadAveragedNumberOfEvents(fEcal->MaxStinEcnaInStex());}
06386                       if( HistoCode == "D_Ped_ChNb" || HistoCode == "D_Ped_ChDs" ){
06387                         read_histo = fMyRootFile->ReadAveragedPedestals(fEcal->MaxStinEcnaInStex());}
06388                       if( HistoCode == "D_TNo_ChNb" || HistoCode == "D_TNo_ChDs" ){
06389                         read_histo = fMyRootFile->ReadAveragedTotalNoise(fEcal->MaxStinEcnaInStex());}
06390                       if( HistoCode == "D_MCs_ChNb" || HistoCode == "D_MCs_ChDs" ){
06391                         read_histo = fMyRootFile->ReadAveragedMeanOfCorrelationsBetweenSamples(fEcal->MaxStinEcnaInStex());}
06392                       if( HistoCode == "D_LFN_ChNb" || HistoCode == "D_LFN_ChDs" ){
06393                         read_histo = fMyRootFile->ReadAveragedLowFrequencyNoise(fEcal->MaxStinEcnaInStex());}
06394                       if( HistoCode == "D_HFN_ChNb" || HistoCode == "D_HFN_ChDs" ){
06395                         read_histo = fMyRootFile->ReadAveragedHighFrequencyNoise(fEcal->MaxStinEcnaInStex());}
06396                       if( HistoCode == "D_SCs_ChNb" || HistoCode == "D_SCs_ChDs" ){
06397                         read_histo = fMyRootFile->ReadAveragedSigmaOfCorrelationsBetweenSamples(fEcal->MaxStinEcnaInStex());}
06398                   
06399                       //...........................................................
06400                       if( fMyRootFile->DataExist() == kTRUE )
06401                         {
06402                           fStatusDataExist = kTRUE;
06403 
06404                           CounterDataExist++;
06405 
06406                           for(Int_t i0StexStinEcna=0; i0StexStinEcna<fEcal->MaxStinEcnaInStex(); i0StexStinEcna++)
06407                             {
06408                               //Int_t n1StexStinEcna = i0StexStinEcna+1;
06409                               //-------------------------------------- Stas histo filling   (ViewHisto, Stas)
06410                               Int_t i_xgeo = -1;
06411                               //...................................... EB
06412                               if( fFlagSubDet == "EB" )
06413                                 {
06414                                   i_xgeo = iStasStex*fEcal->MaxStinEcnaInStex() + i0StexStinEcna;
06415                                   if( i_xgeo >= 0 && i_xgeo < SizeForPlot )
06416                                     {
06417                                       histo_for_plot[i_xgeo] = read_histo[i0StexStinEcna];
06418                                     }
06419                                   else
06420                                     {
06421                                       cout << "!TEcnaHistos::ViewHisto(...)> <EB> i_xgeo = " << i_xgeo
06422                                            << ". OUT OF RANGE ( range = [0,"<< SizeForPlot << "] " << endl;
06423                                     }  
06424                                 }
06425                               //...................................... EE    (ViewHisto)
06426                               //-------> Dee order: D4, D3, D2, D1                    
06427                               if( fFlagSubDet == "EE" )
06428                                 {
06429                                   Int_t DeeOffset = 0;
06430                                   Int_t DSOffset  = 0;
06431                               
06432                                   Int_t DeeNumber = iStasStex+1;
06433                                   Int_t n1DeeSCEcna = i0StexStinEcna+1;
06434                               
06435                                   //................................................ Dee offset
06436                                   if( DeeNumber == 3 ){DeeOffset +=   fEcal->MaxSCForConsInDee();}     // 149
06437                                   if( DeeNumber == 2 ){DeeOffset += 3*fEcal->MaxSCForConsInDee()-1;}   // 446
06438                                   if( DeeNumber == 1 ){DeeOffset += 4*fEcal->MaxSCForConsInDee()-1;}   // 595
06439                               
06440                                   //................................................ Data Sector offset   (ViewHisto)
06441                                   Int_t StexDataSector = fEcalNumbering->GetDSFrom1DeeSCEcna(DeeNumber, n1DeeSCEcna);
06442                                   //.... returns 0 if n1DeeSCEcna corresponds to an empty "ECNA-SC"
06443                                   
06444                                   //................................................ SC final coordinate   (ViewHisto)
06445                                   Int_t StexDSStin = fEcalNumbering->GetDSSCFrom1DeeSCEcna(DeeNumber, n1DeeSCEcna);
06446                                   //--> return StexDSStin = 25 (not  3) for n1DeeSCEcna = 32
06447                                   //--> return StexDSStin = 14 (not 21) for n1DeeSCEcna = 29
06448                                   //--> return StexDSStin = -1 for n1DeeSCEcna = 10 and n1DeeSCEcna = 11 
06449 
06450                                   if( StexDataSector >= 1 && StexDataSector <= 9 )
06451                                     {
06452                                       if( DeeNumber == 4 ) // Sectors 1,2,3,4,5a
06453                                         {
06454                                           for(Int_t is=2; is<=5; is++)
06455                                             { if( StexDataSector >= is )
06456                                               {DSOffset += fEcalNumbering->GetMaxSCInDS(is-1);}}
06457                                         }
06458                                   
06459                                       if( DeeNumber == 3 ) // Sectors 5b,6,7,8,9
06460                                         {
06461                                           if( StexDataSector >= 6 )
06462                                             {DSOffset += fEcalNumbering->GetMaxSCInDS(5)/2;}
06463                                           for(Int_t is=7; is<=9; is++)
06464                                             { if( StexDataSector >= is )
06465                                               {DSOffset += fEcalNumbering->GetMaxSCInDS(is-1);}}
06466                                         }
06467                                   
06468                                       if( DeeNumber == 2 ) // Sectors 9,8,7,6,5a
06469                                         {
06470                                           if( StexDataSector >= 6 )
06471                                             {DSOffset -= fEcalNumbering->GetMaxSCInDS(5)/2;}
06472                                           for(Int_t is=7; is<=9; is++)
06473                                             {if( StexDataSector >= is )
06474                                               {DSOffset -= fEcalNumbering->GetMaxSCInDS(is-1);}}
06475                                         }
06476                                   
06477                                       if( DeeNumber == 1 ) // Sectors 5b,4,3,2,1
06478                                         {
06479                                           for(Int_t is=2; is<=5; is++)
06480                                             { if( StexDataSector >= is )
06481                                               {DSOffset -= fEcalNumbering->GetMaxSCInDS(is-1);}}
06482                                         }
06483                                   
06484                                       if( StexDSStin >=1 && StexDSStin <= fEcalNumbering->GetMaxSCInDS(StexDataSector) )
06485                                         {
06486                                           if( DeeNumber == 4 ) // Sectors 1,2,3,4,5a
06487                                             {
06488                                               if(StexDataSector != 5)
06489                                                 {i_xgeo = DeeOffset + DSOffset + (StexDSStin - 1);}
06490                                               if( StexDataSector == 5)
06491                                                 {i_xgeo = DeeOffset + DSOffset + (StexDSStin - 1);}
06492                                             }
06493                                           if( DeeNumber == 3 ) // Sectors 5b,6,7,8,9
06494                                             {
06495                                               if(StexDataSector != 5)
06496                                                 {i_xgeo = DeeOffset + DSOffset + (StexDSStin - 1);}
06497                                               if( StexDataSector == 5)
06498                                                 {i_xgeo = DeeOffset + DSOffset + (StexDSStin-17) - 1;}
06499                                             }
06500                                           if( DeeNumber == 2 ) // Sectors 5a,6,7,8,9
06501                                             {
06502                                               if(StexDataSector != 5)
06503                                                 {i_xgeo = DeeOffset + DSOffset
06504                                                    - fEcalNumbering->GetMaxSCInDS(StexDataSector) + StexDSStin;}
06505                                               if( StexDataSector == 5)
06506                                                 {i_xgeo = DeeOffset + DSOffset
06507                                                    - fEcalNumbering->GetMaxSCInDS(StexDataSector)/2 + StexDSStin;}
06508                                             }
06509                                           if( DeeNumber == 1 ) // Sectors 1,2,3,4,5b
06510                                             {
06511                                               if(StexDataSector != 5)
06512                                                 {i_xgeo = DeeOffset + DSOffset
06513                                                    - fEcalNumbering->GetMaxSCInDS(StexDataSector) + StexDSStin;}
06514                                               if( StexDataSector == 5)
06515                                                 {i_xgeo = DeeOffset + DSOffset
06516                                                    - fEcalNumbering->GetMaxSCInDS(StexDataSector)/2 +(StexDSStin-17);}
06517                                             }
06518                                           
06519                                         }// end of if(StexDSStin >=1 && StexDSStin <= fEcalNumbering->GetMaxSCInDS(StexDataSector))
06520                                       else
06521                                         {
06522                                           cout << "!TEcnaHistos::ViewHisto(...)> <EE>  StexDSStin = " << StexDSStin
06523                                                << ". OUT OF RANGE ( range = [1,"
06524                                                << fEcalNumbering->GetMaxSCInDS(StexDataSector)
06525                                                << "]. DeeNumber =  " << DeeNumber
06526                                                << ", n1DeeSCEcna = " << n1DeeSCEcna
06527                                                << ", StexDataSector = "  << StexDataSector 
06528                                                << ", i_xgeo = "  << i_xgeo << endl;
06529                                         }
06530                                     }// end of if( StexDataSector >= 1 && StexDataSector <= 9 )
06531                                   else
06532                                     {
06533                                       //cout << "!TEcnaHistos::ViewHisto(...)> <EE>  StexDataSector = " << StexDataSector
06534                                       //     << ". OUT OF RANGE ( range = [1,9]. DeeNumber = " << DeeNumber
06535                                       //     << ", n1DeeSCEcna = " << n1DeeSCEcna
06536                                       //     << ", i_xgeo = "  << i_xgeo << endl;
06537                                     }
06538                                   //......................................... transfert read_histo -> histo_for_plot
06539                                   if( i_xgeo >= -1 && i_xgeo < SizeForPlot )
06540                                     {
06541                                       // special treatement for not connected & mixed SC's
06542                                       if( n1DeeSCEcna ==  29 || n1DeeSCEcna ==  32 ||   //  261a, 207c, 268a, 178c 
06543                                                                                         // [ 14a,  25c,  21a,   3c]
06544                                           n1DeeSCEcna == 144 || n1DeeSCEcna == 165 ||   //  261c, 261b [14c, 14b]
06545                                           n1DeeSCEcna == 176 || n1DeeSCEcna == 193 ||   //  207a, 207b [25a, 25b]
06546                                           n1DeeSCEcna ==  60 || n1DeeSCEcna == 119 ||   //  182a, 182b [30a, 30b]
06547                                           n1DeeSCEcna == 102 || n1DeeSCEcna == 123 ||   //  268c, 268b [21c, 21b]
06548                                           n1DeeSCEcna == 138 || n1DeeSCEcna == 157 )    //  178a, 178b [ 3a,  3b] 
06549                                         {
06550                                           //--------------- DSSC 14
06551                                           if( n1DeeSCEcna ==  29 && i_xgeo >= 0 )
06552                                             {histo_for_plot[i_xgeo] += read_histo[i0StexStinEcna]/(Double_t)5.;}
06553                                           if( (n1DeeSCEcna ==  144 || n1DeeSCEcna == 165) && i_xgeo >= 0 )
06554                                             {histo_for_plot[i_xgeo] +=
06555                                                read_histo[i0StexStinEcna]*(Double_t)10./(Double_t)25.;}
06556                                           
06557                                           //--------------- DSSC 25
06558                                           if( n1DeeSCEcna ==  32 && i_xgeo >= 0 )
06559                                             {histo_for_plot[i_xgeo] += read_histo[i0StexStinEcna]/(Double_t)5.;}
06560                                           if( (n1DeeSCEcna ==  176 || n1DeeSCEcna == 193) && i_xgeo >= 0 )
06561                                             {histo_for_plot[i_xgeo] +=
06562                                                read_histo[i0StexStinEcna]*(Double_t)10./(Double_t)25.;}
06563                                           
06564                                           //--------------- DSSC 30 
06565                                           if( (n1DeeSCEcna == 60 || n1DeeSCEcna == 119) && i_xgeo >= 0 )
06566                                             {histo_for_plot[i_xgeo] += read_histo[i0StexStinEcna]/(Double_t)2.;}
06567                                           
06568                                           //--------------- DSSC 21 (Add SC translated at 10-1 only once, i_xgeo = -1 accepted)
06569                                           if( n1DeeSCEcna == 102 )
06570                                             {histo_for_plot[i_xgeo] += read_histo[9]/(Double_t)21.
06571                                                + read_histo[i0StexStinEcna]*(Double_t)10./(Double_t)21.;}
06572                                           if( n1DeeSCEcna == 123 && i_xgeo >= 0 )
06573                                             {histo_for_plot[i_xgeo] +=
06574                                                read_histo[i0StexStinEcna]*(Double_t)10./(Double_t)21.;}
06575                                           
06576                                           //--------------- DSSC 3 (Add SC translated at 11-1 only once, i_xgeo = -1 accepted)
06577                                           if( n1DeeSCEcna == 138 )
06578                                             {histo_for_plot[i_xgeo] += read_histo[10]/(Double_t)21.
06579                                                + read_histo[i0StexStinEcna]*(Double_t)10./(Double_t)21.;}
06580                                           if( n1DeeSCEcna == 157 && i_xgeo >= 0 )
06581                                             {histo_for_plot[i_xgeo] +=
06582                                                read_histo[i0StexStinEcna]*(Double_t)10./(Double_t)21.;}
06583                                         }
06584                                       else
06585                                         {
06586                                           if( i_xgeo >= 0 )
06587                                             {histo_for_plot[i_xgeo] += read_histo[i0StexStinEcna];} // standard treatment
06588                                         }
06589                                     } // end of if( i_xgeo >= -1 && i_xgeo < SizeForPlot )
06590                                   else
06591                                     {
06592                                       //cout << "!TEcnaHistos::ViewHisto(...)> <EE>  i_xgeo = " << i_xgeo
06593                                       //     << ". OUT OF RANGE ( range = [0,"<< SizeForPlot << "] " << endl;
06594                                     }
06595                                 }// end of if( fFlagSubDet == "EE" )
06596                             }// end of for(Int_t i0StexStinEcna=0; i0StexStinEcna<fEcal->MaxStinEcnaInStex(); i0StexStinEcna++)
06597                         }
06598                       else
06599                         {
06600                           cout << "!TEcnaHistos::ViewHisto(...)>  "
06601                                << " Data not available for " << fFapStexName << " " << iStasStex+1
06602                                << " (Quantity not present in the ROOT file)" << endl;
06603                         }
06604                     } // end of if ( fMyRootFile->LookAtRootFile() == kTRUE )   (ViewHisto/Stas)
06605                   else
06606                     {
06607                       fStatusFileFound = kFALSE;
06608 
06609                       cout << "!TEcnaHistos::ViewHisto(...)>  "
06610                            << " Data not available for " << fFapStexName << " " << iStasStex+1
06611                            << " (ROOT file not found)" << endl;
06612                     }
06613 
06614                   if( fFapNbOfEvts <= xFapNbOfEvts[iStasStex] ){fFapNbOfEvts = xFapNbOfEvts[iStasStex];}
06615 
06616                 } // end of for(Int_t iStasStex=0; iStasStex<fEcal->MaxStexInStas(); iStasStex++)
06617 
06618               delete [] NOFE_int; NOFE_int = 0;               fCdelete++;
06619               delete [] xFapNbOfEvts; xFapNbOfEvts = 0;       fCdelete++;
06620             
06621               if( CounterExistingFile > 0 && CounterDataExist > 0 ){OKPlot = 1;} 
06622           
06623             } // end of if( fFapStexNumber == 0 )
06624         
06625           //---------------------------------------------------------------------------- (ViewHisto [Stex])      
06626           if( fFapStexNumber > 0 )
06627             {
06628               fMyRootFile->PrintNoComment();
06629               fMyRootFile->GetReadyToReadRootFile(fFapAnaType,          fFapNbOfSamples,
06630                                                   fFapRunNumber,        fFapFirstReqEvtNumber,
06631                                                   fFapLastReqEvtNumber, fFapReqNbOfEvts,
06632                                                   fFapStexNumber,       fCfgResultsRootFilePath.Data());
06633           
06634               if ( fMyRootFile->LookAtRootFile() == kTRUE )       //   (ViewHisto, Stex)
06635                 {
06636                   fStatusFileFound = kTRUE;
06637                   //---------------------------------------------------------------------------- (ViewHisto [Stex])
06638                   fFapNbOfEvts = GetNumberOfEvents(fMyRootFile, fFapReqNbOfEvts);
06639                   fp_name_short = fMyRootFile->GetRootFileNameShort();
06640                   // cout << "*TEcnaHistos::ViewHisto(...)> Data are analyzed from file ----> "
06641                   //      << fp_name_short << endl;
06642               
06643                   Bool_t ok_view_histo =
06644                     GetOkViewHisto(fMyRootFile, StexStin_A, i0StinEcha, iSample, HistoCode.Data());
06645               
06646                   if( ok_view_histo == kTRUE )
06647                     {
06648                       //------------ EB or EE with SampGlobal or SampProj (histo_for_plot = read_histo)
06649                       if( fFlagSubDet == "EB" || 
06650                           ( fFlagSubDet == "EE" && ( HistoType == "SampGlobal" || HistoType == "SampProj" )  )  )
06651                         {
06652                           histo_for_plot = GetHistoValues(fMyRootFile, HistoCode.Data(), SizeForPlot, SizeForRead,
06653                                                           StexStin_A, i0StinEcha, iSample, i_data_exist);
06654                           if( i_data_exist > 0 ){OKPlot = 1;}
06655                           if( OKPlot == 1 && opt_plot == "ASCII" && ( HistoType == "Global" || HistoType == "Proj" ) )
06656                             {WriteHistoAscii(HistoCode.Data(), SizeForPlot, histo_for_plot);}
06657                         }
06658                   
06659                       //------------ EE  except for SampGlobal and SampProj) (histo_for_plot # read_histo)
06660                       if( fFlagSubDet == "EE" && !( HistoType == "SampGlobal" || HistoType == "SampProj" ) )
06661                         {
06662                           TVectorD read_histo(SizeForRead);
06663                           for(Int_t i=0; i<SizeForRead; i++){read_histo(i)=(Double_t)0.;}
06664 
06665                           read_histo = GetHistoValues(fMyRootFile, HistoCode.Data(), SizeForRead, SizeForRead,
06666                                                       StexStin_A, i0StinEcha, iSample, i_data_exist);
06667                           if( i_data_exist > 0 ){OKPlot = 1;}
06668                           if( OKPlot == 1 && opt_plot == "ASCII" )
06669                             {
06670                               WriteHistoAscii(HistoCode.Data(), fEcal->MaxCrysEcnaInDee(), read_histo);
06671                             }
06672                           if( OKPlot == 1 && opt_plot != "ASCII" )
06673                             {
06674                               //..................... Build histo_for_plot from read_histo (ViewHisto [Stex])
06675                               Int_t DeeNumber = fFapStexNumber;
06676                               TString DeeDir  = fEcalNumbering->GetDeeDirViewedFromIP(DeeNumber);
06677                           
06678                               //%%%%%%%%%%%%%%%%%%%%%%%%%%%% LOOP ON Echa (Ecna) %%%%%%%%%%%%%%%%%%%%%%%%%% (ViewHisto [Stex])
06679                               for(Int_t i0DeeEcha=0; i0DeeEcha<fEcal->MaxCrysEcnaInDee(); i0DeeEcha++)
06680                                 {
06681                                   Int_t n1SCEcha    = fEcalNumbering->Get1SCEchaFrom0DeeEcha(i0DeeEcha);
06682                                   Int_t n1DeeSCEcna = i0DeeEcha/fEcal->MaxCrysInSC()+1;
06683                               
06684                                   Int_t DataSector = fEcalNumbering->GetDSFrom1DeeSCEcna(DeeNumber, n1DeeSCEcna);
06685                                   Int_t SC_in_DS   = fEcalNumbering->GetDSSCFrom1DeeSCEcna(DeeNumber, n1DeeSCEcna, n1SCEcha);
06686                               
06687                                   Int_t i_xgeo = -1;                  
06688                               
06689                                   if( n1SCEcha >= 1 && n1SCEcha <= fEcal->MaxCrysInSC() )
06690                                     {
06691                                       if( n1DeeSCEcna >= 1 && n1DeeSCEcna <= fEcal->MaxSCEcnaInDee() )
06692                                         {
06693                                           if( DataSector >= 1 && DataSector <= 9 )
06694                                             {
06695                                               if( SC_in_DS >= 1 && SC_in_DS <= fEcalNumbering->GetMaxSCInDS(DataSector) )
06696                                                 {
06697                                                   if( read_histo[i0DeeEcha] != 0 )
06698                                                     {
06699                                                       //................................... Data Sector offset
06700                                                       Int_t DSOffset = GetDSOffset(DeeNumber, DataSector);
06701                                               
06702                                                       //........................ Super-Crystal (SC) offset (ViewHisto [Stex])
06703                                                       Int_t SCOffset = GetSCOffset(DeeNumber, DataSector, SC_in_DS);
06704                                               
06705                                                       //........................ Xtal final bin
06706                                                       Int_t nSCCons = fEcalNumbering->
06707                                                         GetDeeSCConsFrom1DeeSCEcna(DeeNumber, n1DeeSCEcna, n1SCEcha);
06708 
06709                                                       Int_t n1FinalSCEcha = n1SCEcha;
06710                                                       
06711                                                       if( fEcalNumbering->GetSCType(nSCCons) == "NotConnected" || 
06712                                                           fEcalNumbering->GetSCType(nSCCons) == "NotComplete"  )
06713                                                         { //----- not complete and not connected SC's
06714                                                           // no i_xgeo value if SC = 14 or 25 and channel 11
06715                                                           if( !( (SC_in_DS == 14 || SC_in_DS == 25 ) && n1SCEcha == 11 )  )
06716                                                             {
06717                                                               n1FinalSCEcha =
06718                                                                 ModifiedSCEchaForNotConnectedSCs(DeeNumber, nSCCons, SC_in_DS,
06719                                                                                                  n1DeeSCEcna, n1SCEcha);
06720                                                               i_xgeo = DSOffset + SCOffset + (n1FinalSCEcha-1);
06721                                                             }
06722                                                           // change SC 14 -> 21 and channel 11 -> 21
06723                                                           if( SC_in_DS ==  14 && n1SCEcha == 11 )
06724                                                             {
06725                                                               SCOffset = GetSCOffset(DeeNumber, DataSector, 21);
06726                                                               n1FinalSCEcha = 21;
06727                                                               i_xgeo = DSOffset + SCOffset + (n1FinalSCEcha-1);
06728                                                             }
06729                                                           // change SC 25 -> 3 for channel 11 -> 21
06730                                                           if( SC_in_DS ==  25 && n1SCEcha == 11 )
06731                                                             {
06732                                                               SCOffset = GetSCOffset(DeeNumber, DataSector, 3);
06733                                                               n1FinalSCEcha = 21;
06734                                                               i_xgeo = DSOffset + SCOffset + (n1FinalSCEcha-1);
06735                                                             }
06736                                                         }
06737                                                       else
06738                                                         { //----------- Complete SCs
06739                                                           i_xgeo = DSOffset + SCOffset + (n1FinalSCEcha-1);
06740                                                         }
06741 
06742                                                       histo_for_plot_memo[i_xgeo]++;
06743                                                       if( histo_for_plot_memo[i_xgeo] >= 2 )
06744                                                         {
06745                                                           cout << "! histo_memo[" << i_xgeo
06746                                                                << "] = " << histo_for_plot_memo[i_xgeo]
06747                                                                << ", nSCCons = " <<  nSCCons
06748                                                                << ", SC_in_DS = " << SC_in_DS
06749                                                                << ", DSOffset = " << DSOffset
06750                                                                << ", SCOffset = " << SCOffset
06751                                                                << ", n1DeeSCEcna = " << n1DeeSCEcna
06752                                                                << ", n1SCEcha = " << n1SCEcha
06753                                                                << ", n1FinalSCEcha = " << n1FinalSCEcha << endl;
06754                                                         }
06755                                                       //.............................. transfert read_histo -> histo_for_plot
06756                                                       if( i_xgeo >= 0 && i_xgeo < SizeForPlot )
06757                                                         {
06758                                                           if( n1FinalSCEcha > 0 )
06759                                                             {histo_for_plot[i_xgeo] += read_histo[i0DeeEcha];}
06760                                                         }
06761                                                       else
06762                                                         {
06763                                                           cout << "!TEcnaHistos::ViewHisto(...)> <EE>  i_xgeo = " << i_xgeo
06764                                                                << ". OUT OF RANGE ( range = [0,"<< SizeForPlot << "] " << endl;
06765                                                         }
06766                                                     } // end of  if( read_histo[i0DeeEcha] > 0 )
06767                                                 } // end of if( SC_in_DS >= 1 && SC_in_DS <= fEcalNumbering->GetMaxSCInDS(DataSector) )
06768                                               else
06769                                                 {
06770                                                   cout << "!TEcnaHistos::ViewHisto(...)> <EE>  SC_in_DS = " << SC_in_DS
06771                                                        << ". OUT OF RANGE ( range = [1,"
06772                                                        << fEcalNumbering->GetMaxSCInDS(DataSector) << "] "
06773                                                        << ", DataSector = " << DataSector
06774                                                        << ", n1DeeSCEcna = " << n1DeeSCEcna
06775                                                        << ", n1SCEcha = " << n1SCEcha
06776                                                        << ", i0DeeEcha = " << i0DeeEcha
06777                                                        << endl;
06778                                                 }
06779                                             } // end of if( DataSector >= 1 && DataSector <= 9 )
06780                                           else
06781                                             {
06782                                               if( DataSector != 0 )
06783                                                 {
06784                                                   cout << "!TEcnaHistos::ViewHisto(...)> <EE>  DataSector = " << DataSector
06785                                                        << ". OUT OF RANGE ( range = [1,9] "
06786                                                        << ", n1DeeSCEcna = " << n1DeeSCEcna
06787                                                        << ", n1SCEcha = " << n1SCEcha
06788                                                        << ", i0DeeEcha = " << i0DeeEcha
06789                                                        << endl;
06790                                                 }
06791                                             }
06792                                         } // end of if( n1DeeSCEcna >= 1 && n1DeeSCEcna <= fEcal->MaxSCEcnaInDee() )
06793                                       else
06794                                         {
06795                                           cout << "!TEcnaHistos::ViewHisto(...)> <EE>  n1DeeSCEcna = " << n1DeeSCEcna
06796                                                << ". OUT OF RANGE ( range = [1,"<< fEcal->MaxSCEcnaInDee() << "] "
06797                                                << ", n1SCEcha = " << n1SCEcha
06798                                                << ", i0DeeEcha = " << i0DeeEcha
06799                                                << endl;
06800                                         }
06801                                     } // end of if(n1SCEcha >= 1 && n1SCEcha <= fEcal->MaxCrysInSC() )
06802                                   else
06803                                     {
06804                                       cout << "!TEcnaHistos::ViewHisto(...)> <EE>  n1SCEcha = " << n1SCEcha
06805                                            << ". OUT OF RANGE ( range = [1,"<< fEcal->MaxCrysInSC() << "] "
06806                                            << ", i0DeeEcha = " << i0DeeEcha
06807                                            << endl;
06808                                     }
06809                                 }
06810                             } // end of if( OKPlot == 1 && opt_plot != "ASCII" )
06811                         } // end of if(fFlagSubDet == "EE")
06812                     } // end of if(ok_view_histo == kTRUE)
06813                   else
06814                     {
06815                       cout << "!TEcnaHistos::ViewHisto(...)> *ERROR* =====> "
06816                            << " ok_view_histo != kTRUE " << fTTBELL << endl;
06817                     }
06818                 } // end of if(fMyRootFile->LookAtRootFile() == kTRUE)
06819               else
06820                 {
06821                   fStatusFileFound = kFALSE;
06822 
06823                   cout << "!TEcnaHistos::ViewHisto(...)> *ERROR* =====> "
06824                        << " ROOT file not found" << fTTBELL << endl;
06825                 }
06826             } // end of if(fFapStexNumber > 0)
06827         } // end of if( HistoType == "Global" || HistoType == "Proj" || HistoType == "SampGlobal" || HistoType == "SampProj" )
06828       else        
06829         {
06830           //--------------------------------------------------------------------- not Global-Proj Histo
06831           if( (fFapStexNumber > 0) && (fFapStexNumber <= fEcal->MaxStexInStas()) )
06832             {
06833               fMyRootFile->PrintNoComment();
06834               fMyRootFile->GetReadyToReadRootFile(fFapAnaType,          fFapNbOfSamples,
06835                                                   fFapRunNumber,        fFapFirstReqEvtNumber,
06836                                                   fFapLastReqEvtNumber, fFapReqNbOfEvts,
06837                                                   fFapStexNumber,       fCfgResultsRootFilePath.Data());
06838           
06839               if ( fMyRootFile->LookAtRootFile() == kTRUE )    //   (ViewHisto, not Global-Proj)
06840                 {
06841                   fStatusFileFound = kTRUE;
06842 
06843                   fFapNbOfEvts = GetNumberOfEvents(fMyRootFile, fFapReqNbOfEvts);
06844 
06845                   for(Int_t i=0; i<SizeForPlot; i++){histo_for_plot[i]=(Double_t)0;}
06846                   histo_for_plot = GetHistoValues(fMyRootFile, HistoCode.Data(), SizeForPlot, SizeForRead,
06847                                                   StexStin_A, i0StinEcha, iSample, i_data_exist);
06848                   if( i_data_exist > 0 ){OKPlot = 1;}
06849                 }
06850               else
06851                 {
06852                   cout << "!TEcnaHistos::ViewHisto(...)> *ERROR* =====> "
06853                        << " ROOT file not found" << fTTBELL << endl;
06854                 }
06855             }
06856           else
06857             {
06858               cout << "!TEcnaHistos::ViewHisto(...)> " << fFapStexName.Data()
06859                    << " = " << fFapStexNumber << ". Out of range (range = [1,"
06860                    << fEcal->MaxStexInStas() << "]) " << fTTBELL << endl;
06861             }
06862         }
06863 
06864       //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PLOT accepted 
06865     
06866       if( (    HistoType == "Global" || HistoType == "Proj" || HistoType == "SampGlobal" || HistoType == "SampProj") ||
06867           ( !( HistoType == "Global" || HistoType == "Proj" || HistoType == "SampGlobal" || HistoType == "SampProj") &&
06868             ( (fFapStexNumber > 0) && (fFapStexNumber <= fEcal->MaxStexInStas()) ) ) )
06869         {
06870           if( opt_plot != "ASCII" )
06871             {
06872               if( OKPlot > 0 )
06873                 {
06874                   //... Ymin and ymax default values will be taken if fFlagUserHistoMin/Max = "OFF"
06875                   //    and if "Free" for "SAME" and "SAME n" options
06876                   if((opt_plot == fOnlyOnePlot) ||
06877                      (opt_plot == fSeveralPlot && GetMemoFlag(HistoCode, opt_plot) == "Free") ||
06878                      (opt_plot == fSameOnePlot && GetMemoFlag(HistoCode, opt_plot) == "Free") )
06879                     {
06880                       SetYminMemoFromValue(HistoCode.Data(), fCnaParHistos->GetYminDefaultValue(HistoCode.Data()));
06881                       SetYmaxMemoFromValue(HistoCode.Data(), fCnaParHistos->GetYmaxDefaultValue(HistoCode.Data()));
06882                     }
06883                   
06884                   //====  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)
06885                   //
06886                   //  must be done before booking because of the x <-> y permutation in case of "Proj"
06887                   //
06888                   //-----------------------------------------------------------------------------------------
06889                   //
06890                   //        CASE:    HistoType == "Proj"   OR   HistoType == "SampProj"
06891                   //
06892                   //                 Xinf and Xsup must be calculated from ymin and ymax
06893                   //                 of the direct ("Global") histo
06894                   //
06895                   //-----------------------------------------------------------------------------------------
06896                   if( HistoType == "Proj" || HistoType == "SampProj" )
06897                     {
06898                       TString HistoCodi = HistoCode;     // HistoCodi = direct histo
06899 
06900                       if( HistoCode == "D_NOE_ChDs" ){HistoCodi = "D_NOE_ChNb";}
06901                       if( HistoCode == "D_Ped_ChDs" ){HistoCodi = "D_Ped_ChNb";}
06902                       if( HistoCode == "D_TNo_ChDs" ){HistoCodi = "D_TNo_ChNb";}
06903                       if( HistoCode == "D_MCs_ChDs" ){HistoCodi = "D_MCs_ChNb";}
06904                       if( HistoCode == "D_LFN_ChDs" ){HistoCodi = "D_LFN_ChNb";}
06905                       if( HistoCode == "D_HFN_ChDs" ){HistoCodi = "D_HFN_ChNb";}
06906                       if( HistoCode == "D_SCs_ChDs" ){HistoCodi = "D_SCs_ChNb";}
06907                       if( HistoCode == "D_Adc_EvDs" ){HistoCodi = "D_Adc_EvNb";}                      
06908 
06909                       TString TitleHisto = ";";
06910                       if( opt_plot != fSameOnePlot )
06911                         {TitleHisto = fCnaParHistos->GetQuantityName(HistoCodi);}                     
06912 
06913                       if( fUserHistoMin >= fUserHistoMax ){fFlagUserHistoMin = "AUTO"; fFlagUserHistoMax = "AUTO";}
06914 
06915                       //--------------------------------------------------------------------------- (ViewHisto)
06916                       //
06917                       //    fOnlyOnePlot => compute Xinf and Xsup at each time
06918                       //    fSeveralPlot => compute Xinf and Xsup once when flag = "Free" for each HistoCode
06919                       //    fSameOnePlot => compute Xinf and Xsup once
06920                       //
06921                       //--------------------------------------------------------------------------------------
06922                       if( (opt_plot == fOnlyOnePlot) ||
06923                           ( (opt_plot == fSeveralPlot && GetMemoFlag(HistoCode, fSeveralPlot) == "Free" ) ||
06924                             (opt_plot == fSameOnePlot && GetMemoFlag(HistoCode, fSameOnePlot) == "Free" ) ) )
06925                         {
06926                           Double_t XinfProj =(Double_t)0;
06927                           Double_t XsupProj =(Double_t)0;
06928 
06929                           //...................................................................... (ViewHisto)
06930                           if( fFlagUserHistoMin == "AUTO" || fFlagUserHistoMax == "AUTO" )
06931                             {
06932                               Int_t HisSiza = GetHistoSize(HistoCodi.Data(), "plot");
06933                               Int_t ReadHisSiza = HisSiza;
06934                               //..............................  prepa direct histogram booking (ViewHisto)
06935                               Axis_t xinf_hisa = GetHistoXinf(HistoCodi.Data(), HisSiza, opt_plot);
06936                               Axis_t xsup_hisa = GetHistoXsup(HistoCodi.Data(), HisSiza, opt_plot);
06937                               Int_t nb_binxa   = GetHistoNumberOfBins(HistoCodi.Data(), HisSiza);
06938                               //..............................  direct ("Global") histogram booking (ViewHisto)
06939                               TH1D* h_hisa =
06940                                 new TH1D("histoa", TitleHisto.Data(), nb_binxa, xinf_hisa, xsup_hisa); fCnewRoot++;
06941                               h_hisa->Reset();
06942                               //.... direct histogram filling to get its ymin (=> xminProj) and ymax (=> xmaxProj)
06943                               FillHisto(h_hisa, histo_for_plot, HistoCodi.Data(), ReadHisSiza);
06944                               //... Get direct histo ymin and/or ymax and keep them as xinf and xsup
06945                               //    in memo for the plotted histo 
06946                               XinfProj = fUserHistoMin;
06947                               XsupProj = fUserHistoMax;
06948                               if( fFlagUserHistoMin == "AUTO" ){XinfProj = h_hisa->GetMinimum();}
06949                               if( fFlagUserHistoMax == "AUTO" ){XsupProj = h_hisa->GetMaximum();}
06950                               h_hisa->Delete();  h_hisa = 0;     fCdeleteRoot++;
06951                             } // end of  if( fFlagUserHistoMin == "AUTO" || fFlagUserHistoMax == "AUTO" )
06952                           else
06953                             {
06954                               if( fFlagUserHistoMin == "OFF" )
06955                                 {
06956                                   SetYminMemoFromValue(HistoCode.Data(),
06957                                                        fCnaParHistos->GetYminDefaultValue(HistoCode.Data()));
06958                                   XinfProj = GetYminValueFromMemo(HistoCode.Data());
06959                                 }
06960 
06961                               if( fFlagUserHistoMax == "OFF" )
06962                                 {
06963                                   SetYmaxMemoFromValue(HistoCode.Data(),
06964                                                        fCnaParHistos->GetYmaxDefaultValue(HistoCode.Data()));
06965                                   XsupProj = GetYmaxValueFromMemo(HistoCode.Data());      
06966                                 }
06967                               if( fFlagUserHistoMin == "ON" ){XinfProj = fUserHistoMin;}
06968                               if( fFlagUserHistoMax == "ON" ){XsupProj = fUserHistoMax;}
06969                             }
06970 
06971                           if( opt_plot == fOnlyOnePlot || opt_plot == fSeveralPlot )
06972                             {
06973                               SetXinfMemoFromValue(HistoCode.Data(), XinfProj);
06974                               SetXsupMemoFromValue(HistoCode.Data(), XsupProj);                   
06975                             }
06976                           else
06977                             {
06978                               SetXinfMemoFromValue(XinfProj);
06979                               SetXsupMemoFromValue(XsupProj);
06980                             }
06981                         } // end of if( (opt_plot == fOnlyOnePlot) || 
06982                           // (opt_plot == fSeveralPlot  && GetMemoFlag(HistoCode, opt_plot) == "Free") ||
06983                           // (opt_plot == fSameOnePlot  && GetMemoFlag(HistoCode, opt_plot) == "Free") )
06984                     } // end of  if( HistoType == "Proj" || HistoType == "SampProj" )
06985 
06986 
06987                   //===============  H I S T O   B O O K I N G   A N D   F I L L I N G  ========  (ViewHisto)
06988                   //..............................  prepa histogram booking (ViewHisto)
06989                   
06990                   //.......... Set number of bins: forcing to fNbBinsProj if "HistoType" == "Proj"
06991                   Int_t xNbBins = GetHistoNumberOfBins(HistoCode.Data(), SizeForPlot);
06992                   
06993                   Double_t cXinf = (Double_t)0.;
06994                   Double_t cXsup = (Double_t)0.;
06995 
06996                   //.......... Set Xinf and Xsup at each time because of simultaneous SAME options
06997                   if( HistoType == "Proj" || HistoType == "SampProj" )
06998                     {
06999                       if( opt_plot == fOnlyOnePlot || opt_plot == fSeveralPlot )
07000                         {
07001                           cXinf = GetXinfValueFromMemo(HistoCode.Data());
07002                           cXsup = GetXsupValueFromMemo(HistoCode.Data());
07003                         }
07004                       else
07005                         {
07006                           cXinf = GetXinfValueFromMemo();
07007                           cXsup = GetXsupValueFromMemo();
07008                         }
07009                     }
07010                   else
07011                     {
07012                       cXinf = GetHistoXinf(HistoCode.Data(), SizeForPlot, opt_plot);
07013                       cXsup = GetHistoXsup(HistoCode.Data(), SizeForPlot, opt_plot);
07014                     }
07015 
07016                   //..............................  histogram booking (ViewHisto)
07017                   Axis_t xinf_his = cXinf;  // ancillary variables since no const in arguments of TH1D
07018                   Axis_t xsup_his = cXsup;
07019                   Int_t   nb_binx = xNbBins;
07020 
07021                   TString TitleHisto = ";";
07022                   if( opt_plot != fSameOnePlot )
07023                     {TitleHisto = fCnaParHistos->GetQuantityName(HistoCode.Data());}
07024                   TH1D* h_his0 = new TH1D("histo", TitleHisto.Data(), nb_binx, xinf_his, xsup_his); fCnewRoot++;
07025                   h_his0->Reset();
07026                   //............................... histogram filling
07027                   FillHisto(h_his0, histo_for_plot, HistoCode.Data(), SizeForPlot);
07028                   
07029                   //===============  H I S T O   Y M I N / Y M A X   M A N A G E M E N T  ===========  (ViewHisto)
07030                   if( opt_plot == fOnlyOnePlot ||
07031                       (opt_plot == fSeveralPlot && GetMemoFlag(HistoCode, opt_plot) == "Free") || 
07032                       (opt_plot == fSameOnePlot && GetMemoFlag(HistoCode, opt_plot) == "Free") )
07033                     {
07034                       if( opt_plot == fSameOnePlot ){fHistoCodeFirst = HistoCode;} // registration of first HistoCode
07035                       //................................. Automatic min and/or max for other options than "Proj" 
07036                       if( HistoType != "Proj" && HistoType != "SampProj" )
07037                         {
07038                           if( fUserHistoMin >= fUserHistoMax ){fFlagUserHistoMin = "AUTO"; fFlagUserHistoMax = "AUTO";}
07039                           //................................. user's min and/or max
07040                           if( fFlagUserHistoMin == "ON" )
07041                             {SetYminMemoFromValue(HistoCode.Data(), fUserHistoMin); fFlagUserHistoMin = "OFF";}
07042                           if( fFlagUserHistoMax == "ON" )
07043                             {SetYmaxMemoFromValue(HistoCode.Data(), fUserHistoMax); fFlagUserHistoMax = "OFF";}
07044                           //................................. automatic min and/or max
07045                           if( fFlagUserHistoMin == "AUTO" )
07046                             {
07047                               //.............. no bottom margin if ymin = 0
07048                               Double_t ymin = GetYminFromHistoFrameAndMarginValue(h_his0, (Double_t)0.);
07049                               if( ymin != (Double_t)0. )
07050                                 {ymin =
07051                                    GetYminFromHistoFrameAndMarginValue(h_his0, fCnaParHistos->GetMarginAutoMinMax());}
07052                               SetYminMemoFromValue(HistoCode.Data(),ymin);
07053                               fFlagUserHistoMin = "OFF";
07054                             }
07055                           if( fFlagUserHistoMax == "AUTO" )
07056                             {
07057                               Double_t ymax =
07058                                 GetYmaxFromHistoFrameAndMarginValue(h_his0,fCnaParHistos->GetMarginAutoMinMax());
07059                               SetYmaxMemoFromValue(HistoCode.Data(),ymax);
07060                               fFlagUserHistoMax = "OFF";
07061                             }
07062                           //................................. Set YMin and YMax of histo (ViewHisto)
07063                           SetYminMemoFromPreviousMemo(HistoCode);
07064                           SetYmaxMemoFromPreviousMemo(HistoCode);
07065                         } // end of if( HistoType != "Proj" && HistoType != "SampProj" )
07066 
07067                       //.......... Find maximum in case of Proj (LIN scale only) // PS: EvolProj => in ViewHistime
07068                       if( ( HistoType == "Proj" || HistoType == "SampProj" ) && fFlagScaleY == "LIN" )
07069                         {
07070                           SetYmaxMemoFromValue
07071                             (HistoCode.Data(),
07072                              GetYmaxFromHistoFrameAndMarginValue(h_his0, fCnaParHistos->GetMarginAutoMinMax()));
07073                         }
07074                     } // end of  if( opt_plot == fOnlyOnePlot ||
07075                   // (opt_plot == fSeveralPlot && GetMemoFlag(HistoCode, opt_plot) == "Free") || 
07076                   // (opt_plot == fSameOnePlot && GetMemoFlag(HistoCode, opt_plot) == "Free") )
07077                   
07078                   //--- Set ymin and ymax to the first HistoCode values for option SAME n
07079                   if( opt_plot == fSameOnePlot && GetMemoFlag(HistoCode, opt_plot) == "Busy" )            
07080                     {
07081                       Double_t ymin = GetYminValueFromMemo(fHistoCodeFirst.Data());
07082                       SetYminMemoFromValue(HistoCode.Data(), ymin);
07083 
07084                       Double_t ymax = GetYmaxValueFromMemo(fHistoCodeFirst.Data());
07085                       SetYmaxMemoFromValue(HistoCode.Data(), ymax);
07086                     }
07087 
07088                   //... histogram set ymin and ymax and consequently margin at top of the plot
07089                   Int_t  xFlagAutoYsupMargin = SetHistoFrameYminYmaxFromMemo(h_his0, HistoCode);
07090                   
07091                   //==================================== P L O T ==============================  (ViewHisto)
07092                   HistoPlot(h_his0,           SizeForPlot,   xinf_his, xsup_his,
07093                             HistoCode.Data(), HistoType.Data(),
07094                             StexStin_A,       i0StinEcha,    iSample,
07095                             opt_scale_x,      opt_scale_y,   opt_plot, xFlagAutoYsupMargin);
07096 
07097                   h_his0->Delete();   h_his0 = 0;             fCdeleteRoot++;
07098                   //===========================================================================
07099 
07100                   //--- Recover ymin and ymax from user's values in option SAME n
07101                   if( opt_plot == fSameOnePlot && GetMemoFlag(HistoCode, opt_plot) == "Busy" )            
07102                     {
07103                       SetYminMemoFromValue(HistoCode.Data(), fUserHistoMin);
07104                       SetYmaxMemoFromValue(HistoCode.Data(), fUserHistoMax);
07105                     }
07106                 } // end of if( OKPlot > 0 )
07107               else
07108                 {
07109                   cout << "!TEcnaHistos::ViewHisto(...)> Histo not available."
07110                        << fTTBELL << endl;
07111                 }
07112             }
07113         }
07114     } // end of  if( OKHisto == 1 )
07115 }  // end of ViewHisto(...)
07116 
07117 //------------------------------------------------------------------------------------
07118 Int_t TEcnaHistos::GetDSOffset(const Int_t& DeeNumber, const Int_t& DataSector)
07119 {
07120   // gives the DataSector Offset on 1D histos for option "Global"
07121 
07122   Int_t DSOffset = 0;
07123 
07124   if( DeeNumber == 4 )
07125     {
07126       if( DataSector >= 1 ){}
07127       if( DataSector >= 2 ){DSOffset += fEcalNumbering->GetMaxSCInDS(1)*fEcal->MaxCrysInSC();}
07128       if( DataSector >= 3 ){DSOffset += fEcalNumbering->GetMaxSCInDS(2)*fEcal->MaxCrysInSC();}
07129       if( DataSector >= 4 ){DSOffset += fEcalNumbering->GetMaxSCInDS(3)*fEcal->MaxCrysInSC();}
07130       if( DataSector >= 5 ){DSOffset += fEcalNumbering->GetMaxSCInDS(4)*fEcal->MaxCrysInSC();}
07131     }
07132   if( DeeNumber == 3 )
07133     {
07134       if( DataSector >= 5 ){}
07135       if( DataSector >= 6 ){DSOffset += (fEcalNumbering->GetMaxSCInDS(5)/2)*fEcal->MaxCrysInSC();}
07136       if( DataSector >= 7 ){DSOffset += fEcalNumbering->GetMaxSCInDS(6)*fEcal->MaxCrysInSC();}
07137       if( DataSector >= 8 ){DSOffset += fEcalNumbering->GetMaxSCInDS(7)*fEcal->MaxCrysInSC();}
07138       if( DataSector >= 9 ){DSOffset += fEcalNumbering->GetMaxSCInDS(8)*fEcal->MaxCrysInSC();}
07139     }
07140   if( DeeNumber == 2 )
07141     {
07142       if( DataSector <= 9 ){}
07143       if( DataSector <= 8 ){DSOffset += fEcalNumbering->GetMaxSCInDS(9)*fEcal->MaxCrysInSC();}
07144       if( DataSector <= 7 ){DSOffset += fEcalNumbering->GetMaxSCInDS(8)*fEcal->MaxCrysInSC();}
07145       if( DataSector <= 6 ){DSOffset += fEcalNumbering->GetMaxSCInDS(7)*fEcal->MaxCrysInSC();}
07146       if( DataSector <= 5 ){DSOffset += fEcalNumbering->GetMaxSCInDS(6)*fEcal->MaxCrysInSC();}
07147     }
07148   if( DeeNumber == 1 )
07149     {
07150       if( DataSector <= 5 ){}
07151       if( DataSector <= 4 ){DSOffset += (fEcalNumbering->GetMaxSCInDS(5)/2)*fEcal->MaxCrysInSC();}
07152       if( DataSector <= 3 ){DSOffset += fEcalNumbering->GetMaxSCInDS(4)*fEcal->MaxCrysInSC();}
07153       if( DataSector <= 2 ){DSOffset += fEcalNumbering->GetMaxSCInDS(3)*fEcal->MaxCrysInSC();}
07154       if( DataSector <= 1 ){DSOffset += fEcalNumbering->GetMaxSCInDS(2)*fEcal->MaxCrysInSC();}
07155     }
07156   return DSOffset;                            
07157 }
07158 //------------------------------------------------------------------------------------
07159 Int_t TEcnaHistos::GetSCOffset(const Int_t& DeeNumber, const Int_t& DataSector, const Int_t& SC_in_DS)
07160 {
07161   // gives the SC (Super-Crystal) Offset on 1D histos for option "Global"
07162 
07163   Int_t SCOffset = 0;
07164 
07165   if( DeeNumber == 1 || DeeNumber == 3 )
07166     {
07167       if( DataSector == 5 ){SCOffset += ((SC_in_DS-17)-1)*fEcal->MaxCrysInSC();}
07168       if( DataSector != 5 ){SCOffset += (SC_in_DS-1)*fEcal->MaxCrysInSC();}
07169     }
07170 
07171   if( DeeNumber == 2 || DeeNumber == 4 ){SCOffset += (SC_in_DS-1)*fEcal->MaxCrysInSC();}
07172 
07173   return SCOffset;      
07174 }
07175 //------------------------------------------------------------------------------------
07176 Int_t TEcnaHistos::ModifiedSCEchaForNotConnectedSCs(const Int_t& n1DeeNumber,
07177                                                    const Int_t& nSCCons,     const Int_t& SC_in_DS,
07178                                                    const Int_t& n1DeeSCEcna, const Int_t& n1SCEcha)
07179 {
07180   //------------------------ Modification of n1SCEcha number for not connected SC's
07181 
07182   Int_t ModifiedSCEcha = -1;
07183   TString SCQuad = fEcalNumbering->GetSCQuadFrom1DeeSCEcna(n1DeeSCEcna);  // SCQuad = top  OR bottom
07184   TString DeeDir = fEcalNumbering->GetDeeDirViewedFromIP(n1DeeNumber);    // DeeDir = left OR right
07185 
07186   TString TypQuad = "?";
07187   if( SCQuad == "top"    && DeeDir == "right" ){TypQuad = "TR";}
07188   if( SCQuad == "top"    && DeeDir == "left"  ){TypQuad = "TL";}
07189   if( SCQuad == "bottom" && DeeDir == "left"  ){TypQuad = "BL";}
07190   if( SCQuad == "bottom" && DeeDir == "right" ){TypQuad = "BR";}
07191 
07192   //------------------------------------------------------------------------------------------- top
07193 
07194   //..... (D1,S1), (D3,S9) SC_in_DS = 30, n1DeeSCEcna =  60 -> 182a for construction top/right
07195   //..... (D1,S2), (D3,S8) SC_in_DS =  3, n1DeeSCEcna = 138 -> 178a for construction top/right
07196   if( (SC_in_DS == 30 && n1DeeSCEcna ==  60 && TypQuad == "TR") ||
07197       (SC_in_DS ==  3 && n1DeeSCEcna == 138 && TypQuad == "TR") ){if(n1SCEcha > 15){ModifiedSCEcha = n1SCEcha - 15;}}
07198 
07199   //..... (D4,S1), (D2,S9) SC_in_DS = 30, n1DeeSCEcna =  60 ->  33a for construction top/left
07200   //..... (D4,S2), (D2,S8) SC_in_DS =  3, n1DeeSCEcna = 138 ->  29a for construction top/left
07201   if( (SC_in_DS == 30 && n1DeeSCEcna ==  60 && TypQuad == "TL") ||
07202       (SC_in_DS ==  3 && n1DeeSCEcna == 138 && TypQuad == "TL") )
07203     {
07204       if(n1SCEcha ==  4){ModifiedSCEcha =  1;}
07205       if(n1SCEcha ==  5){ModifiedSCEcha =  2;}
07206       if(n1SCEcha ==  9){ModifiedSCEcha =  3;}
07207       if(n1SCEcha == 10){ModifiedSCEcha =  4;}
07208       if(n1SCEcha == 14){ModifiedSCEcha =  5;}
07209       if(n1SCEcha == 15){ModifiedSCEcha =  6;}
07210       if(n1SCEcha == 19){ModifiedSCEcha =  7;}
07211       if(n1SCEcha == 20){ModifiedSCEcha =  8;}
07212       if(n1SCEcha == 24){ModifiedSCEcha =  9;}
07213       if(n1SCEcha == 25){ModifiedSCEcha = 10;}
07214     }
07215 
07216   //..... (D1,S1), (D3,S9) SC_in_DS = 30, n1DeeSCEcna = 119 -> 182b for construction top/right
07217   if( SC_in_DS == 30 && n1DeeSCEcna == 119 && TypQuad == "TR" ){if(n1SCEcha > 5){ModifiedSCEcha = n1SCEcha - 5;}}
07218 
07219   //..... (D4,S1), (D2,S9) SC_in_DS = 30, n1DeeSCEcna = 119 ->  33b for construction top/left
07220   if( SC_in_DS == 30 && n1DeeSCEcna == 119 && TypQuad == "TL" )
07221     {
07222       if(n1SCEcha ==  4){ModifiedSCEcha = 11;}
07223       if(n1SCEcha ==  5){ModifiedSCEcha = 12;}
07224       if(n1SCEcha ==  9){ModifiedSCEcha = 13;}
07225       if(n1SCEcha == 10){ModifiedSCEcha = 14;}
07226       if(n1SCEcha == 14){ModifiedSCEcha = 15;}
07227       if(n1SCEcha == 15){ModifiedSCEcha = 16;}
07228       if(n1SCEcha == 19){ModifiedSCEcha = 17;}
07229       if(n1SCEcha == 20){ModifiedSCEcha = 18;}
07230       if(n1SCEcha == 24){ModifiedSCEcha = 19;}
07231       if(n1SCEcha == 25){ModifiedSCEcha = 20;}
07232     }
07233 
07234   //..... (D1,S1), (D3,S9) SC_in_DS = 12, n1DeeSCEcna =  13 -> 161  for construction top/right
07235   //..... (D4,S1), (D2,S9) SC_in_DS = 12, n1DeeSCEcna =  13 ->  12  for construction top/left
07236   if( SC_in_DS == 12 && n1DeeSCEcna ==  13 && TypQuad == "TR" )
07237     {
07238       ModifiedSCEcha = n1SCEcha;
07239     } 
07240   if( SC_in_DS == 12 && n1DeeSCEcna ==  13 && TypQuad == "TL" )
07241     {
07242       if( n1SCEcha >=  1 &&  n1SCEcha <=  4 ){ModifiedSCEcha = n1SCEcha;}
07243       if( n1SCEcha >=  6 &&  n1SCEcha <=  9 ){ModifiedSCEcha = n1SCEcha-1;}
07244       if( n1SCEcha >= 11 &&  n1SCEcha <= 14 ){ModifiedSCEcha = n1SCEcha-2;}
07245       if( n1SCEcha >= 16 &&  n1SCEcha <= 19 ){ModifiedSCEcha = n1SCEcha-3;}
07246       if( n1SCEcha >= 21 &&  n1SCEcha <= 24 ){ModifiedSCEcha = n1SCEcha-4;}
07247     }
07248 
07249   //..... (D1,S2), (D3,S8) SC_in_DS = 25, n1DeeSCEcna = 176 -> 207a for construction top/right
07250   if( SC_in_DS == 25 && n1DeeSCEcna == 176 && TypQuad == "TR" )
07251     {
07252       if(n1SCEcha ==  4){ModifiedSCEcha =  1;}
07253       if(n1SCEcha ==  5){ModifiedSCEcha =  2;}
07254       if(n1SCEcha ==  9){ModifiedSCEcha =  3;}
07255       if(n1SCEcha == 10){ModifiedSCEcha =  4;}
07256       if(n1SCEcha == 14){ModifiedSCEcha =  5;}
07257       if(n1SCEcha == 15){ModifiedSCEcha =  6;}
07258       if(n1SCEcha == 19){ModifiedSCEcha =  7;}
07259       if(n1SCEcha == 20){ModifiedSCEcha =  8;}
07260       if(n1SCEcha == 24){ModifiedSCEcha =  9;}
07261       if(n1SCEcha == 25){ModifiedSCEcha = 10;}
07262     }
07263 
07264   //..... (D4,S2), (D2,S8) SC_in_DS = 25, n1DeeSCEcna = 176 ->  58a for construction top/left
07265   if( SC_in_DS == 25 && n1DeeSCEcna == 176 && TypQuad == "TL" )
07266     {
07267       if(n1SCEcha == 16){ModifiedSCEcha =  1;}
07268       if(n1SCEcha == 21){ModifiedSCEcha =  2;}
07269       if(n1SCEcha == 17){ModifiedSCEcha =  3;}
07270       if(n1SCEcha == 22){ModifiedSCEcha =  4;}
07271       if(n1SCEcha == 18){ModifiedSCEcha =  5;}
07272       if(n1SCEcha == 23){ModifiedSCEcha =  6;}
07273       if(n1SCEcha == 19){ModifiedSCEcha =  7;}
07274       if(n1SCEcha == 24){ModifiedSCEcha =  8;}
07275       if(n1SCEcha == 20){ModifiedSCEcha =  9;}
07276       if(n1SCEcha == 25){ModifiedSCEcha = 10;}
07277     }
07278 
07279   //..... (D1,S2), (D3,S8) SC_in_DS =  3, n1DeeSCEcna = 157 -> 178b for construction top/right
07280   //..... (D1,S2), (D3,S8) SC_in_DS = 25, n1DeeSCEcna = 193 -> 207b for construction top/right
07281   if( (SC_in_DS ==  3 && n1DeeSCEcna == 157 && TypQuad == "TR") ||
07282       (SC_in_DS == 25 && n1DeeSCEcna == 193 && TypQuad == "TR") )
07283     {
07284       if(n1SCEcha ==  4){ModifiedSCEcha = 11;}
07285       if(n1SCEcha ==  5){ModifiedSCEcha = 12;}
07286       if(n1SCEcha ==  9){ModifiedSCEcha = 13;}
07287       if(n1SCEcha == 10){ModifiedSCEcha = 14;}
07288       if(n1SCEcha == 14){ModifiedSCEcha = 15;}
07289       if(n1SCEcha == 15){ModifiedSCEcha = 16;}
07290       if(n1SCEcha == 19){ModifiedSCEcha = 17;}
07291       if(n1SCEcha == 20){ModifiedSCEcha = 18;}
07292       if(n1SCEcha == 24){ModifiedSCEcha = 19;}
07293       if(n1SCEcha == 25){ModifiedSCEcha = 20;}
07294     }
07295 
07296   //..... (D4,S2), (D2,S8) SC_in_DS =  3, n1DeeSCEcna = 157 ->  29b for construction top/left
07297   //..... (D4,S2), (D2,S8) SC_in_DS = 25, n1DeeSCEcna = 193 ->  58b for construction top/left
07298   if( (SC_in_DS ==  3 && n1DeeSCEcna == 157 && TypQuad == "TL") ||
07299       (SC_in_DS == 25 && n1DeeSCEcna == 193 && TypQuad == "TL") )
07300     {
07301       if(n1SCEcha == 16){ModifiedSCEcha = 11;}
07302       if(n1SCEcha == 21){ModifiedSCEcha = 12;}
07303       if(n1SCEcha == 17){ModifiedSCEcha = 13;}
07304       if(n1SCEcha == 22){ModifiedSCEcha = 14;}
07305       if(n1SCEcha == 18){ModifiedSCEcha = 15;}
07306       if(n1SCEcha == 23){ModifiedSCEcha = 16;}
07307       if(n1SCEcha == 19){ModifiedSCEcha = 17;}
07308       if(n1SCEcha == 24){ModifiedSCEcha = 18;}
07309       if(n1SCEcha == 20){ModifiedSCEcha = 19;}
07310       if(n1SCEcha == 25){ModifiedSCEcha = 20;}
07311     }
07312 
07313   //..... (D1,S2), (D3,S8) SC_in_DS = 32, n1DeeSCEcna =  51 -> 216  for construction top/right
07314   if( SC_in_DS == 32 && n1DeeSCEcna ==  51 && TypQuad == "TR" )
07315     {
07316       if( n1SCEcha >=  1 && n1SCEcha <=  4 ){ModifiedSCEcha = n1SCEcha;}
07317       if( n1SCEcha >=  6 && n1SCEcha <=  9 ){ModifiedSCEcha = n1SCEcha-1;}
07318       if( n1SCEcha >= 11 && n1SCEcha <= 14 ){ModifiedSCEcha = n1SCEcha-2;}
07319       if( n1SCEcha >= 16 && n1SCEcha <= 19 ){ModifiedSCEcha = n1SCEcha-3;}
07320       if( n1SCEcha >= 21 && n1SCEcha <= 24 ){ModifiedSCEcha = n1SCEcha-4;}
07321     }
07322 
07323   //..... (D4,S2), (D2,S8) SC_in_DS = 32, n1DeeSCEcna =  51 ->  67  for construction top/left
07324   if( SC_in_DS == 32 && n1DeeSCEcna ==  51 && TypQuad == "TL" )
07325     {
07326       ModifiedSCEcha = n1SCEcha;
07327     }
07328 
07329   // **************************** Special case: TWO SC's IN THE SAME SC-Ecna place *************************
07330   //========================================================================================== D1,D3 ======
07331   //      (D1,S2), (D3,S8) SC_in_DS =  3, n1DeeSCEcna =  32 -> 178c for construction top/right
07332   //      (D1,S2), (D3,S8) SC_in_DS = 25, n1DeeSCEcna =  32 -> 207c for construction top/right
07333   //       For  n1DeeSCEcna =  32: ONLY "25" IN ARRAY fT2d_DSSC[][] (see TEcnaNumbering.cc)
07334   //       fT2d_DSSC[dee-1][32-1] =  25;  // also 3;  // ( (207c, 58c) also (178c, 29c) for construction)
07335   //       is recovered from number for construction
07336   //=======================================================================================================
07337   if( n1DeeSCEcna ==  32 && TypQuad == "TR" )
07338     {
07339       if( nSCCons == 207 )
07340         {
07341           if(n1SCEcha ==  1){ModifiedSCEcha = 21;}
07342           if(n1SCEcha ==  2){ModifiedSCEcha = 22;}
07343           if(n1SCEcha ==  3){ModifiedSCEcha = 23;}
07344           if(n1SCEcha ==  6){ModifiedSCEcha = 24;}
07345           if(n1SCEcha ==  7){ModifiedSCEcha = 25;}
07346         }
07347       if( nSCCons == 178 )
07348         {
07349           if(n1SCEcha == 11){ModifiedSCEcha = 21;}
07350         }
07351     }
07352 
07353   //========================================================================================== D2,D4 ======
07354   //      (D4,S2), (D2,S8) SC_in_DS =  3, n1DeeSCEcna =  32 ->  29c for construction top/left
07355   //      (D4,S2), (D2,S8) SC_in_DS = 25, n1DeeSCEcna =  32 ->  58c for construction top/left
07356   //       For  n1DeeSCEcna =  32: ONLY "25" IN ARRAY fT2d_DSSC[][] (see TEcnaNumbering.cc)
07357   //       fT2d_DSSC[dee-1][32-1] =  25;  // also 3;  // ( (207c, 58c) also (178c, 29c) for construction)
07358   //       is recovered from number for construction
07359   //=======================================================================================================
07360   if( n1DeeSCEcna ==  32 && TypQuad == "TL" )
07361     {
07362       if( nSCCons == 58 )
07363         {
07364           if(n1SCEcha ==  1){ModifiedSCEcha = 21;}
07365           if(n1SCEcha ==  2){ModifiedSCEcha = 22;}
07366           if(n1SCEcha ==  3){ModifiedSCEcha = 23;}
07367           if(n1SCEcha ==  6){ModifiedSCEcha = 24;}
07368           if(n1SCEcha ==  7){ModifiedSCEcha = 25;}
07369         }
07370       if( nSCCons == 29 )
07371         {
07372           if(n1SCEcha == 11){ModifiedSCEcha = 21;}
07373         }
07374     }
07375   //****************************************************************************************************
07376 
07377   //------------------------------------------------------------------------------------------- bottom
07378 
07379   // **************************** Special case: TWO SC's IN THE SAME SC-Ecna place *************************
07380   //========================================================================================== D1,D3 ======
07381   //      (D1,S4), (D3,S6) SC_in_DS = 14, n1DeeSCEcna =  29 -> 261a for construction bottom/right
07382   //      (D1,S4), (D3,S6) SC_in_DS = 21, n1DeeSCEcna =  29 -> 268a for construction bottom/right
07383   //       For  n1DeeSCEcna =  29: ONLY "14" IN ARRAY fT2d_DSSC[][] (see TEcnaNumbering.cc)
07384   //       fT2d_DSSC[dee-1][29-1] = 14; // also 21;  //  ( (261a, 112a) also (268a, 119a) for construction)
07385   //       is recovered from number for construction
07386   //=======================================================================================================
07387   if( n1DeeSCEcna ==  29 && TypQuad == "BR" )
07388     {
07389       if( nSCCons == 261 )
07390         {
07391           if(n1SCEcha ==  1){ModifiedSCEcha = 21;}
07392           if(n1SCEcha ==  2){ModifiedSCEcha = 22;}
07393           if(n1SCEcha ==  3){ModifiedSCEcha = 23;}
07394           if(n1SCEcha ==  6){ModifiedSCEcha = 24;}
07395           if(n1SCEcha ==  7){ModifiedSCEcha = 25;}
07396         }
07397       if( nSCCons == 268 )
07398         {
07399           if(n1SCEcha == 11){ModifiedSCEcha = 21;}
07400         }
07401     }
07402 
07403   //========================================================================================== D2,D4 ======
07404   //      (D4,S4), (D2,S6) SC_in_DS = 14, n1DeeSCEcna =  29 -> 112a for construction bottom/left
07405   //      (D4,S4), (D2,S6) SC_in_DS = 21, n1DeeSCEcna =  29 -> 119a for construction bottom/left
07406   //       For  n1DeeSCEcna =  29: ONLY "14" IN ARRAY fT2d_DSSC[][] (see TEcnaNumbering.cc)
07407   //       fT2d_DSSC[dee-1][29-1] = 14; // also 21;  //  ( (261a, 112a) also (268a, 119a) for construction)
07408   //       is recovered from number for construction
07409   //======================================================================================================= 
07410   if( n1DeeSCEcna ==  29 && TypQuad == "BL" )
07411     {
07412       if( nSCCons == 119 )
07413         {
07414           if(n1SCEcha == 11){ModifiedSCEcha = 21;}
07415         }
07416       if( nSCCons == 112 )
07417         {
07418           if(n1SCEcha ==  1){ModifiedSCEcha = 21;}
07419           if(n1SCEcha ==  2){ModifiedSCEcha = 22;}
07420           if(n1SCEcha ==  3){ModifiedSCEcha = 23;}
07421           if(n1SCEcha ==  6){ModifiedSCEcha = 24;}
07422           if(n1SCEcha ==  7){ModifiedSCEcha = 25;}
07423         }
07424     }
07425 
07426   // ****************************************************************************************************
07427 
07428   //..... (D1,S3), (D3,S7) SC_in_DS = 34, n1DeeSCEcna = 188 -> 298a for construction bottom/right
07429   //..... (D1,S4), (D3,S6) SC_in_DS = 14, n1DeeSCEcna = 165 -> 261b for construction bottom/right
07430   if( (SC_in_DS == 34 && n1DeeSCEcna == 188 && TypQuad == "BR") || 
07431       (SC_in_DS == 14 && n1DeeSCEcna == 165 && TypQuad == "BR") ){if(n1SCEcha > 15){ModifiedSCEcha = n1SCEcha - 15;}}
07432 
07433   //..... (D4,S3), (D2,S7) SC_in_DS = 34, n1DeeSCEcna = 188 -> 149a for construction bottom/left
07434   //..... (D4,S4), (D2,S6) SC_in_DS = 14, n1DeeSCEcna = 165 -> 112b for construction bottom/left
07435   if( (SC_in_DS == 34 && n1DeeSCEcna == 188 && TypQuad == "BL") ||
07436       (SC_in_DS == 14 && n1DeeSCEcna == 165 && TypQuad == "BL") )
07437     {
07438       if(n1SCEcha ==  4){ModifiedSCEcha =  1;}
07439       if(n1SCEcha ==  5){ModifiedSCEcha =  2;}
07440       if(n1SCEcha ==  9){ModifiedSCEcha =  3;}
07441       if(n1SCEcha == 10){ModifiedSCEcha =  4;}
07442       if(n1SCEcha == 14){ModifiedSCEcha =  5;}
07443       if(n1SCEcha == 15){ModifiedSCEcha =  6;}
07444       if(n1SCEcha == 19){ModifiedSCEcha =  7;}
07445       if(n1SCEcha == 20){ModifiedSCEcha =  8;}
07446       if(n1SCEcha == 24){ModifiedSCEcha =  9;}
07447       if(n1SCEcha == 25){ModifiedSCEcha = 10;}
07448     }
07449 
07450   //..... (D1,S3), (D3,S7) SC_in_DS = 10, n1DeeSCEcna =  50 -> 224  for construction bottom/right
07451   if( SC_in_DS == 10 && n1DeeSCEcna ==  50 && TypQuad == "BR" )
07452     {
07453       ModifiedSCEcha = n1SCEcha;
07454     }
07455 
07456   //..... (D4,S3), (D2,S7) SC_in_DS = 10, n1DeeSCEcna =  50 ->  75  for construction bottom/left 
07457   if( SC_in_DS == 10 && n1DeeSCEcna ==  50 && TypQuad == "BL")
07458     {
07459       if( n1SCEcha >=  1 &&  n1SCEcha <=  4 ){ModifiedSCEcha = n1SCEcha;}
07460       if( n1SCEcha >=  6 &&  n1SCEcha <=  9 ){ModifiedSCEcha = n1SCEcha-1;}
07461       if( n1SCEcha >= 11 &&  n1SCEcha <= 14 ){ModifiedSCEcha = n1SCEcha-2;}
07462       if( n1SCEcha >= 16 &&  n1SCEcha <= 19 ){ModifiedSCEcha = n1SCEcha-3;}
07463       if( n1SCEcha >= 21 &&  n1SCEcha <= 24 ){ModifiedSCEcha = n1SCEcha-4;}
07464     }
07465   
07466   //..... (D1,S4), (D3,S6) SC_in_DS = 14, n1DeeSCEcna = 144 -> 261c for construction bottom/right
07467   if( SC_in_DS == 14 && n1DeeSCEcna == 144 && TypQuad == "BR" ){if(n1SCEcha > 5){ModifiedSCEcha = n1SCEcha - 5;}}
07468 
07469   //..... (D4,S4), (D2,S6) SC_in_DS = 14, n1DeeSCEcna = 144 -> 112c for construction bottom/left
07470   if( SC_in_DS == 14 && n1DeeSCEcna == 144 && TypQuad == "BL" )
07471     {
07472       if(n1SCEcha ==  4){ModifiedSCEcha = 11;}
07473       if(n1SCEcha ==  5){ModifiedSCEcha = 12;}
07474       if(n1SCEcha ==  9){ModifiedSCEcha = 13;}
07475       if(n1SCEcha == 10){ModifiedSCEcha = 14;}
07476       if(n1SCEcha == 14){ModifiedSCEcha = 15;}
07477       if(n1SCEcha == 15){ModifiedSCEcha = 16;}
07478       if(n1SCEcha == 19){ModifiedSCEcha = 17;}
07479       if(n1SCEcha == 20){ModifiedSCEcha = 18;}
07480       if(n1SCEcha == 24){ModifiedSCEcha = 19;}
07481       if(n1SCEcha == 25){ModifiedSCEcha = 20;}
07482     }
07483 
07484   //..... (D1,S4), (D3,S6) SC_in_DS = 21, n1DeeSCEcna = 123 -> 268b for construction bottom/right
07485   //..... (D1,S5), (D3,S5) SC_in_DS = 20, n1DeeSCEcna =  21 -> 281a for construction bottom/right
07486   if( (SC_in_DS == 21 && n1DeeSCEcna == 123 && TypQuad == "BR") ||
07487       (SC_in_DS == 20 && n1DeeSCEcna ==  41 && TypQuad == "BR") )
07488     {
07489       if(n1SCEcha ==  4){ModifiedSCEcha =  1;}
07490       if(n1SCEcha ==  5){ModifiedSCEcha =  2;}
07491       if(n1SCEcha ==  9){ModifiedSCEcha =  3;}
07492       if(n1SCEcha == 10){ModifiedSCEcha =  4;}
07493       if(n1SCEcha == 14){ModifiedSCEcha =  5;}
07494       if(n1SCEcha == 15){ModifiedSCEcha =  6;}
07495       if(n1SCEcha == 19){ModifiedSCEcha =  7;}
07496       if(n1SCEcha == 20){ModifiedSCEcha =  8;}
07497       if(n1SCEcha == 24){ModifiedSCEcha =  9;}
07498       if(n1SCEcha == 25){ModifiedSCEcha = 10;}
07499     }
07500 
07501   //..... (D4,S4), (D2,S6) SC_in_DS = 21, n1DeeSCEcna = 123 -> 119b for construction bottom/left
07502   //..... (D4,S5), (D2,S5) SC_in_DS =  3, n1DeeSCEcna =  41 -> 132a for construction bottom/left
07503   if( (SC_in_DS == 21 && n1DeeSCEcna == 123 && TypQuad == "BL") ||
07504       (SC_in_DS ==  3 && n1DeeSCEcna ==  41 && TypQuad == "BL") ){if(n1SCEcha > 15){ModifiedSCEcha = n1SCEcha - 15;}}
07505 
07506 
07507   //..... (D1,S4), (D3,S6) SC_in_DS = 21, n1DeeSCEcna = 102 -> 268c for construction bottom/right
07508   if( SC_in_DS == 21 && n1DeeSCEcna == 102 && TypQuad == "BR" )
07509     {
07510       if(n1SCEcha ==  4){ModifiedSCEcha = 11;}
07511       if(n1SCEcha ==  5){ModifiedSCEcha = 12;}
07512       if(n1SCEcha ==  9){ModifiedSCEcha = 13;}
07513       if(n1SCEcha == 10){ModifiedSCEcha = 14;}
07514       if(n1SCEcha == 14){ModifiedSCEcha = 15;}
07515       if(n1SCEcha == 15){ModifiedSCEcha = 16;}
07516       if(n1SCEcha == 19){ModifiedSCEcha = 17;}
07517       if(n1SCEcha == 20){ModifiedSCEcha = 18;}
07518       if(n1SCEcha == 24){ModifiedSCEcha = 19;}
07519       if(n1SCEcha == 25){ModifiedSCEcha = 20;}
07520     }
07521 
07522   //..... (D4,S4), (D2,S6) SC_in_DS = 21, n1DeeSCEcna = 102 -> 119c for construction bottom/left
07523   if( SC_in_DS == 21 && n1DeeSCEcna == 102 && TypQuad == "BL" )
07524     {
07525       if(n1SCEcha == 16){ModifiedSCEcha = 11;}
07526       if(n1SCEcha == 21){ModifiedSCEcha = 12;}
07527       if(n1SCEcha == 17){ModifiedSCEcha = 13;}
07528       if(n1SCEcha == 22){ModifiedSCEcha = 14;}
07529       if(n1SCEcha == 18){ModifiedSCEcha = 15;}
07530       if(n1SCEcha == 23){ModifiedSCEcha = 16;}
07531       if(n1SCEcha == 19){ModifiedSCEcha = 17;}
07532       if(n1SCEcha == 24){ModifiedSCEcha = 18;}
07533       if(n1SCEcha == 20){ModifiedSCEcha = 19;}
07534       if(n1SCEcha == 25){ModifiedSCEcha = 20;}
07535     }
07536 
07537   //..... (D1,S5), (D3,S5) SC_in_DS = 23, n1DeeSCEcna =   8 -> 286 for construction bottom/right
07538   if( SC_in_DS == 23 && n1DeeSCEcna ==   8 && TypQuad == "BR" )
07539     {
07540       if( n1SCEcha >=  1 &&  n1SCEcha <=  4 ){ModifiedSCEcha = n1SCEcha;}
07541       if( n1SCEcha >=  6 &&  n1SCEcha <=  9 ){ModifiedSCEcha = n1SCEcha-1;}
07542       if( n1SCEcha >= 11 &&  n1SCEcha <= 14 ){ModifiedSCEcha = n1SCEcha-2;}
07543       if( n1SCEcha >= 16 &&  n1SCEcha <= 19 ){ModifiedSCEcha = n1SCEcha-3;}
07544       if( n1SCEcha >= 21 &&  n1SCEcha <= 24 ){ModifiedSCEcha = n1SCEcha-4;}
07545     }
07546 
07547   //..... (D4,S5), (D2,S5) SC_in_DS =  6, n1DeeSCEcna =   8 -> 137 for construction bottom/left
07548   if( SC_in_DS ==  6 && n1DeeSCEcna ==   8 && TypQuad == "BL" )
07549     {
07550       ModifiedSCEcha = n1SCEcha;
07551     }
07552      
07553      //======================= ERROR message if ModifiedSCEcha is not correct
07554   if( ModifiedSCEcha < 1 || ModifiedSCEcha > fEcal->MaxCrysInSC() )
07555     {
07556       cout << "! *** ERROR *** > ModifiedSCEcha = " << ModifiedSCEcha
07557            << ", SC_in_DS = " << SC_in_DS
07558            << ", nSCCons = " << nSCCons
07559            << ", n1DeeSCEcna = " << n1DeeSCEcna
07560            << ", n1SCEcha = " << n1SCEcha
07561            << ", ModifiedSCEcha = " << ModifiedSCEcha
07562            << ", TypQuad = " << TypQuad
07563            << fTTBELL << endl;
07564     }
07565 
07566   return ModifiedSCEcha;
07567 }
07568 // end of ModifiedSCEchaForNotConnectedSCs(...)
07569 
07570 //======================================================================================
07571 //
07572 //                          ViewHistime: evolution in time
07573 //
07574 //======================================================================================
07575 void TEcnaHistos::XtalTimePedestals(const TString  list_of_run_file_name,
07576                                     const Int_t&   aStexStin_A,      const Int_t& i0StinEcha)
07577 {XtalTimePedestals(list_of_run_file_name, aStexStin_A, i0StinEcha, "ONLYONE");}
07578 void TEcnaHistos::XtalTimePedestals(const TString  list_of_run_file_name,
07579                                     const Int_t&   aStexStin_A,      const Int_t& i0StinEcha,
07580                                     const TString  PlotOption)
07581 {
07582   Int_t StexStin_A = aStexStin_A;
07583   if( fFlagSubDet == "EE" )
07584     {StexStin_A = fEcalNumbering->Get1DeeSCEcnaFromDeeSCCons(fFapStexNumber, aStexStin_A);}
07585 
07586   ViewHistime(list_of_run_file_name, StexStin_A, i0StinEcha, "H_Ped_Date", PlotOption);
07587 }
07588 
07589 void TEcnaHistos::XtalPedestalsRuns(const TString  list_of_run_file_name,
07590                                     const Int_t&   aStexStin_A,      const Int_t& i0StinEcha)
07591 {XtalPedestalsRuns(list_of_run_file_name, aStexStin_A, i0StinEcha, "ONLYONE");}
07592 void TEcnaHistos::XtalPedestalsRuns(const TString  list_of_run_file_name,
07593                                     const Int_t&   aStexStin_A,      const Int_t& i0StinEcha,
07594                                     const TString  PlotOption)
07595 {
07596   Int_t StexStin_A = aStexStin_A;
07597   if( fFlagSubDet == "EE" )
07598     {StexStin_A = fEcalNumbering->Get1DeeSCEcnaFromDeeSCCons(fFapStexNumber, aStexStin_A);}
07599 
07600   ViewHistime(list_of_run_file_name, StexStin_A, i0StinEcha, "H_Ped_RuDs", PlotOption);
07601 }
07602 
07603 
07604 //.....................................................................................
07605 void TEcnaHistos::XtalTimeTotalNoise(const TString  list_of_run_file_name,
07606                                      const Int_t&   aStexStin_A,      const Int_t& i0StinEcha)
07607 {XtalTimeTotalNoise(list_of_run_file_name, aStexStin_A, i0StinEcha, "ONLYONE");}
07608 void TEcnaHistos::XtalTimeTotalNoise(const TString  list_of_run_file_name,
07609                                      const Int_t&   aStexStin_A,      const Int_t& i0StinEcha,
07610                                      const TString  PlotOption)
07611 {
07612   Int_t StexStin_A = aStexStin_A;
07613   if( fFlagSubDet == "EE" )
07614     {StexStin_A = fEcalNumbering->Get1DeeSCEcnaFromDeeSCCons(fFapStexNumber, aStexStin_A);}
07615 
07616   ViewHistime(list_of_run_file_name, StexStin_A, i0StinEcha, "H_TNo_Date", PlotOption);
07617 }
07618 
07619 void TEcnaHistos::XtalTotalNoiseRuns(const TString  list_of_run_file_name,
07620                                      const Int_t&   aStexStin_A,      const Int_t& i0StinEcha)
07621 {XtalTotalNoiseRuns(list_of_run_file_name, aStexStin_A, i0StinEcha, "ONLYONE");}
07622 void TEcnaHistos::XtalTotalNoiseRuns(const TString  list_of_run_file_name,
07623                                      const Int_t&   aStexStin_A,      const Int_t& i0StinEcha,
07624                                      const TString  PlotOption)
07625 {
07626   Int_t StexStin_A = aStexStin_A;
07627   if( fFlagSubDet == "EE" )
07628     {StexStin_A = fEcalNumbering->Get1DeeSCEcnaFromDeeSCCons(fFapStexNumber, aStexStin_A);}
07629 
07630   ViewHistime(list_of_run_file_name, StexStin_A, i0StinEcha, "H_TNo_RuDs", PlotOption);
07631 }
07632 
07633 //.....................................................................................
07634 void TEcnaHistos::XtalTimeMeanOfCorss(const TString  list_of_run_file_name,
07635                                       const Int_t&   aStexStin_A,      const Int_t& i0StinEcha)
07636 {XtalTimeMeanOfCorss(list_of_run_file_name, aStexStin_A, i0StinEcha, "ONLYONE");}
07637 void TEcnaHistos::XtalTimeMeanOfCorss(const TString  list_of_run_file_name,
07638                                       const Int_t&   aStexStin_A,      const Int_t& i0StinEcha,
07639                                       const TString  PlotOption)
07640 {
07641   Int_t StexStin_A = aStexStin_A;
07642   if( fFlagSubDet == "EE" )
07643     {StexStin_A = fEcalNumbering->Get1DeeSCEcnaFromDeeSCCons(fFapStexNumber, aStexStin_A);}
07644 
07645  ViewHistime(list_of_run_file_name, StexStin_A, i0StinEcha, "H_MCs_Date", PlotOption);
07646 }
07647 
07648 void TEcnaHistos::XtalMeanOfCorssRuns(const TString  list_of_run_file_name,
07649                                      const Int_t&   aStexStin_A,      const Int_t& i0StinEcha)
07650 {XtalMeanOfCorssRuns(list_of_run_file_name, aStexStin_A, i0StinEcha, "ONLYONE");}
07651 void TEcnaHistos::XtalMeanOfCorssRuns(const TString  list_of_run_file_name,
07652                                       const Int_t&   aStexStin_A,      const Int_t& i0StinEcha,
07653                                       const TString  PlotOption)
07654 {
07655   Int_t StexStin_A = aStexStin_A;
07656   if( fFlagSubDet == "EE" )
07657     {StexStin_A = fEcalNumbering->Get1DeeSCEcnaFromDeeSCCons(fFapStexNumber, aStexStin_A);}
07658 
07659   ViewHistime(list_of_run_file_name, StexStin_A, i0StinEcha, "H_MCs_RuDs", PlotOption);
07660 }
07661 
07662 //.....................................................................................
07663 void TEcnaHistos::XtalTimeLowFrequencyNoise(const TString  list_of_run_file_name,
07664                                             const Int_t&   aStexStin_A,      const Int_t& i0StinEcha)
07665 {XtalTimeLowFrequencyNoise(list_of_run_file_name, aStexStin_A, i0StinEcha, "ONLYONE");}
07666 void TEcnaHistos::XtalTimeLowFrequencyNoise(const TString  list_of_run_file_name,
07667                                             const Int_t&   aStexStin_A,      const Int_t& i0StinEcha,
07668                                             const TString  PlotOption)
07669 {
07670   Int_t StexStin_A = aStexStin_A;
07671   if( fFlagSubDet == "EE" )
07672     {StexStin_A = fEcalNumbering->Get1DeeSCEcnaFromDeeSCCons(fFapStexNumber, aStexStin_A);}
07673 
07674   ViewHistime(list_of_run_file_name, StexStin_A, i0StinEcha, "H_LFN_Date", PlotOption);
07675 }
07676 
07677 void TEcnaHistos::XtalLowFrequencyNoiseRuns(const TString  list_of_run_file_name,
07678                                             const Int_t&   aStexStin_A,      const Int_t& i0StinEcha)
07679 {XtalLowFrequencyNoiseRuns(list_of_run_file_name, aStexStin_A, i0StinEcha, "ONLYONE");}
07680 void TEcnaHistos::XtalLowFrequencyNoiseRuns(const TString  list_of_run_file_name,
07681                                             const Int_t&   aStexStin_A,      const Int_t& i0StinEcha,
07682                                             const TString  PlotOption)
07683 {
07684   Int_t StexStin_A = aStexStin_A;
07685   if( fFlagSubDet == "EE" )
07686     {StexStin_A = fEcalNumbering->Get1DeeSCEcnaFromDeeSCCons(fFapStexNumber, aStexStin_A);}
07687 
07688   ViewHistime(list_of_run_file_name, StexStin_A, i0StinEcha, "H_LFN_RuDs", PlotOption);
07689 }
07690 
07691 
07692 //.....................................................................................
07693 void TEcnaHistos::XtalTimeHighFrequencyNoise(const TString  list_of_run_file_name,
07694                                              const Int_t&   aStexStin_A,      const Int_t& i0StinEcha)
07695 {XtalTimeHighFrequencyNoise(list_of_run_file_name, aStexStin_A, i0StinEcha, "ONLYONE");}
07696 void TEcnaHistos::XtalTimeHighFrequencyNoise(const TString  list_of_run_file_name,
07697                                              const Int_t&   aStexStin_A,      const Int_t& i0StinEcha,
07698                                              const TString  PlotOption)
07699 {
07700   Int_t StexStin_A = aStexStin_A;
07701   if( fFlagSubDet == "EE" )
07702     {StexStin_A = fEcalNumbering->Get1DeeSCEcnaFromDeeSCCons(fFapStexNumber, aStexStin_A);}
07703 
07704   ViewHistime(list_of_run_file_name, StexStin_A, i0StinEcha, "H_HFN_Date", PlotOption);
07705 }
07706 
07707 void TEcnaHistos::XtalHighFrequencyNoiseRuns(const TString  list_of_run_file_name,
07708                                              const Int_t&   aStexStin_A,      const Int_t& i0StinEcha)
07709 {XtalHighFrequencyNoiseRuns(list_of_run_file_name, aStexStin_A, i0StinEcha, "ONLYONE");}
07710 void TEcnaHistos::XtalHighFrequencyNoiseRuns(const TString  list_of_run_file_name,
07711                                              const Int_t&   aStexStin_A,      const Int_t& i0StinEcha,
07712                                              const TString  PlotOption)
07713 {
07714   Int_t StexStin_A = aStexStin_A;
07715   if( fFlagSubDet == "EE" )
07716     {StexStin_A = fEcalNumbering->Get1DeeSCEcnaFromDeeSCCons(fFapStexNumber, aStexStin_A);}
07717 
07718   ViewHistime(list_of_run_file_name, StexStin_A, i0StinEcha, "H_HFN_RuDs", PlotOption);
07719 }
07720 
07721 
07722 //.....................................................................................
07723 void TEcnaHistos::XtalTimeSigmaOfCorss(const TString  list_of_run_file_name,
07724                                        const Int_t&   aStexStin_A,      const Int_t& i0StinEcha)
07725 {XtalTimeSigmaOfCorss(list_of_run_file_name, aStexStin_A, i0StinEcha, "ONLYONE");}
07726 void TEcnaHistos::XtalTimeSigmaOfCorss(const TString  list_of_run_file_name,
07727                                        const Int_t&   aStexStin_A,      const Int_t& i0StinEcha,
07728                                        const TString  PlotOption)
07729 {
07730   Int_t StexStin_A = aStexStin_A;
07731   if( fFlagSubDet == "EE" )
07732     {StexStin_A = fEcalNumbering->Get1DeeSCEcnaFromDeeSCCons(fFapStexNumber, aStexStin_A);}
07733 
07734   ViewHistime(list_of_run_file_name, StexStin_A, i0StinEcha, "H_SCs_Date", PlotOption);
07735 }
07736 
07737 void TEcnaHistos::XtalSigmaOfCorssRuns(const TString  list_of_run_file_name,
07738                                       const Int_t&   aStexStin_A,      const Int_t& i0StinEcha)
07739 {XtalSigmaOfCorssRuns(list_of_run_file_name, aStexStin_A, i0StinEcha, "ONLYONE");}
07740 void TEcnaHistos::XtalSigmaOfCorssRuns(const TString  list_of_run_file_name,
07741                                        const Int_t&   aStexStin_A,      const Int_t& i0StinEcha,
07742                                        const TString  PlotOption)
07743 {
07744   Int_t StexStin_A = aStexStin_A;
07745   if( fFlagSubDet == "EE" )
07746     {StexStin_A = fEcalNumbering->Get1DeeSCEcnaFromDeeSCCons(fFapStexNumber, aStexStin_A);}
07747 
07748   ViewHistime(list_of_run_file_name, StexStin_A, i0StinEcha, "H_SCs_RuDs", PlotOption);
07749 }
07750 
07751 //======================================================================================
07752 //
07753 //                          ViewHistime: time evolution
07754 //
07755 //======================================================================================
07756 void TEcnaHistos::ViewHistime(const TString list_of_run_file_name, 
07757                               const Int_t&  StexStin_A, const Int_t& i0StinEcha,
07758                               const TString HistoCode,  const TString opt_plot_arg)
07759 {
07760   //Histogram of the quantities as a function of time (several runs)
07761 
07762   TString opt_plot = opt_plot_arg;
07763 
07764   if( opt_plot_arg == "ONLYONE" ){opt_plot = fOnlyOnePlot;}
07765   if( opt_plot_arg == "SEVERAL" ){opt_plot = fSeveralPlot;}
07766   if( opt_plot_arg == "SAMEONE" ){opt_plot = fSameOnePlot;}
07767 
07768   Int_t OKHisto = 0;
07769 
07770   //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Canvas already closed in option SAME %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
07771   Int_t xCanvasExists = 1; // a priori ==> SAME plot                                  //   (ViewHistime)
07772   if( opt_plot != fOnlyOnePlot && GetMemoFlag(HistoCode, opt_plot) == "Busy" )
07773     {
07774       TVirtualPad* main_subpad = 0; 
07775       //---------------- Call to ActivePad
07776       //if( (TRootCanvas*)fCanv<HISTOCODE>->GetCanvasImp() == fImp<HISTOCODE> ){
07777       // main_subpad = fPad<HISTOCODE>;} (return main_subpad)
07778       main_subpad = ActivePad(HistoCode.Data(), opt_plot.Data());  // => return 0 if canvas has been closed
07779       if( main_subpad == 0 )
07780         {
07781           cout << "*TEcnaHistos::ViewHistime(...)> WARNING ===> Canvas has been closed in option SAME or SAME n."
07782                << endl
07783                << "                               Please, restart with a new canvas."
07784                << fTTBELL << endl;
07785           
07786           ReInitCanvas(HistoCode, opt_plot);
07787           xCanvasExists = 0;
07788         }
07789     }
07790   //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
07791 
07792   TString XVarHisto = fCnaParHistos->GetXVarHisto(HistoCode.Data(), fFlagSubDet.Data(), fFapStexNumber);
07793   TString YVarHisto = fCnaParHistos->GetYVarHisto(HistoCode.Data(), fFlagSubDet.Data(), fFapStexNumber);
07794 
07795   TString HistoType = fCnaParHistos->GetHistoType(HistoCode);
07796 
07797   //%%%%%%%%%%%%%%%%%%%%% Change of X variable in option SAME n with no proj %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
07798   Int_t SameXVarMemo = 1;   //  a priori ==> SAME n option: X variable OK                     (ViewHistime)
07799   if( !( HistoType == "Proj" || HistoType == "SampProj" || HistoType == "EvolProj") )
07800     {
07801 
07802       
07803       if( (opt_plot == fSameOnePlot ) && GetMemoFlag(HistoCode, opt_plot) == "Free" )
07804         {
07805           SetXVarMemo(HistoCode, opt_plot, XVarHisto);  SetYVarMemo(HistoCode, opt_plot, YVarHisto); SameXVarMemo = 1;
07806         }
07807       if( (opt_plot == fSameOnePlot ) && GetMemoFlag(HistoCode, opt_plot) == "Busy" )
07808         {
07809           TString XVariableMemo = GetXVarFromMemo(HistoCode, opt_plot);
07810           TString YVariableMemo = GetYVarFromMemo(HistoCode, opt_plot);
07811           
07812           if( XVarHisto != XVariableMemo )
07813             {
07814               cout << "!TEcnaHistos::ViewHistime(...)> *** ERROR *** ===> X coordinate changed in option SAME n." << endl
07815                    << "                               Present  X = " << XVarHisto << endl
07816                    << "                               Present  Y = " << YVarHisto << endl
07817                    << "                               Previous X = " << XVariableMemo << endl
07818                    << "                               Previous Y = " << YVariableMemo 
07819                    << fTTBELL << endl;
07820               SameXVarMemo = 0;
07821             }
07822           else
07823             {SetYVarMemo(HistoCode, opt_plot, YVarHisto);}
07824         }
07825     }
07826   //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
07827 
07828   //%%%%%%%%%%%%%%%%%%%%%%% Change of Y variable in option SAME n with proj %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
07829   Int_t SameYVarMemo = 1;   //  a priori ==> SAME n option: Y variable OK                     (ViewHistime)
07830   if(  HistoType == "Proj" || HistoType == "SampProj" || HistoType == "EvolProj" )
07831     {
07832       if( (opt_plot == fSameOnePlot ) && GetMemoFlag(HistoCode, opt_plot) == "Free" )
07833         {
07834           SetYVarMemo(HistoCode, opt_plot, YVarHisto);  SetYVarMemo(HistoCode, opt_plot, YVarHisto); SameYVarMemo = 1;
07835         }
07836       if( (opt_plot == fSameOnePlot ) && GetMemoFlag(HistoCode, opt_plot) == "Busy" )
07837         {
07838           TString XVariableMemo = GetXVarFromMemo(HistoCode, opt_plot);
07839           TString YVariableMemo = GetYVarFromMemo(HistoCode, opt_plot);
07840           
07841           if( YVarHisto != YVariableMemo )
07842             {
07843               cout << "!TEcnaHistos::ViewHistime(...)> *** ERROR *** ===> Y coordinate changed in option SAME n." << endl
07844                    << "                               Present  X = " << XVarHisto << endl
07845                    << "                               Present  Y = " << YVarHisto << endl
07846                    << "                               Previous X = " << XVariableMemo << endl
07847                    << "                               Previous Y = " << YVariableMemo 
07848                    << fTTBELL << endl;
07849               SameYVarMemo = 0;
07850             }
07851           else
07852             {SetYVarMemo(HistoCode, opt_plot, YVarHisto);}
07853         }
07854     }
07855   //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
07856   if( xCanvasExists == 1 && SameXVarMemo == 1 && SameYVarMemo == 1 ){OKHisto = 1;}
07857 
07858   //======================== Histime accepted
07859   if( OKHisto == 1 )
07860     {
07861       // fMyRootFile->PrintNoComment();
07862 
07863       fCnaParHistos->SetColorPalette(fFlagColPal);
07864 
07865       //................................. Init YMin and YMax of histo         //   (ViewHistime)
07866       if((opt_plot == fOnlyOnePlot) ||
07867          (opt_plot == fSeveralPlot && GetMemoFlag(HistoCode, opt_plot) == "Free") ||
07868          (opt_plot == fSameOnePlot && GetMemoFlag(HistoCode, opt_plot) == "Free"))
07869         {SetYminMemoFromPreviousMemo(HistoCode); SetYmaxMemoFromPreviousMemo(HistoCode);}
07870 
07871       //........ GetHistoryRunListParameters(...) : performs the allocation of the array fT1DRunNumber[]
07872       //         at first call of the present method ViewHistime
07873       //         increments the number of read file (fNbOfListFileEvolXXX) for option SAME
07874       //         and read the values fT1DRunNumber[0 to max] from the file list_of_run_file_name
07875       //         return the number of runs in the list of the file
07876       //............... Get the run parameters
07877 
07878       Int_t nb_of_runs_in_list = GetHistoryRunListParameters(list_of_run_file_name.Data(), HistoCode);
07879 
07880       if( nb_of_runs_in_list > 0 )
07881         {
07882           //..............................  prepa x axis: time in hours
07883           //Double_t sec_in_day   = (Double_t)86400.;          //===> (number of seconds in a day)
07884           Double_t margin_frame_xaxis = (Double_t)25.;       //===> margin in x coordinates 
07885 
07886           Double_t thstart_evol = (Double_t)0.;
07887           Double_t thstop_evol  = (Double_t)0.;
07888 
07889           Int_t* exist_indic  = new Int_t[nb_of_runs_in_list];    fCnew++;
07890 
07891           //===================================== FIRST LOOP BEGINNING ===================================
07892           //-------------------------------------------------------------------------------- (ViewHistime)
07893           //
07894           //     FIRST LOOP: read the "HistoryRunList" file. Check the existence of the runs
07895           //                 and determine the number of existing runs.
07896           //
07897           //--------------------------------------------------------------------------------
07898 
07899           fNbOfExistingRuns = (Int_t)0;
07900 
07901           if( fFapStexNumber > 0 )
07902             {
07903               for(Int_t i_run = 0; i_run < nb_of_runs_in_list; i_run++)
07904                 {
07905                   exist_indic[i_run] = 0;
07906                   // ==> set the attribute value relative to the run (fFapRunNumber)
07907                   SetRunNumberFromList(i_run, nb_of_runs_in_list);
07908 
07909                   fMyRootFile->PrintNoComment();
07910                   fMyRootFile->GetReadyToReadRootFile(fFapAnaType.Data(),   fFapNbOfSamples,
07911                                                       fT1DRunNumber[i_run], fFapFirstReqEvtNumber,
07912                                                       fFapLastReqEvtNumber, fFapReqNbOfEvts,
07913                                                       fFapStexNumber,       fCfgResultsRootFilePath.Data());
07914                   
07915                   if ( fMyRootFile->LookAtRootFile() == kTRUE )             //   (ViewHistime, 1rst loop)
07916                     {
07917                       fStatusFileFound = kTRUE;
07918 
07919                       //------ At first HistoryRunList file: set fStartEvol... and fStopEvol... quantities
07920                       if( GetListFileNumber(HistoCode) == 1 )
07921                         {
07922                           if( fNbOfExistingRuns == 0 ) 
07923                             {  
07924                               // start time of the first existing run of the list
07925                               fStartEvolTime = fMyRootFile->GetStartTime();
07926                               fStartEvolDate = fMyRootFile->GetStartDate();
07927                               fStartEvolRun  = fT1DRunNumber[i_run];
07928                               // start time of the last existing run of the list
07929                               // (in case of only one existing run in the list)
07930                               fStopEvolTime = fMyRootFile->GetStartTime(); 
07931                               fStopEvolDate = fMyRootFile->GetStartDate();
07932                               fStopEvolRun  = fT1DRunNumber[i_run];
07933                             }
07934                           else
07935                             {
07936                               // start time of the last existing run of the list
07937                               fStopEvolTime = fMyRootFile->GetStartTime();
07938                               fStopEvolDate = fMyRootFile->GetStartDate();
07939                               fStopEvolRun  = fT1DRunNumber[i_run];
07940                             }
07941                         }
07942                       //---- set flag of run existence and increase number of existing runs 
07943                       //     (for the first HistoryRunList file)
07944                       exist_indic[i_run] = 1;
07945                       fNbOfExistingRuns++;
07946                     } // end of if ( fMyRootFile->LookAtRootFile() == kTRUE )
07947                   else
07948                     {
07949                       fStatusFileFound = kFALSE;
07950 
07951                       cout << "!TEcnaHistos::ViewHistime(...)> *ERROR* =====> "
07952                            << " ROOT file not found for run " << fT1DRunNumber[i_run]
07953                            << fTTBELL << endl << endl;
07954                     }
07955                 } // end of for(Int_t i_run = 0; i_run < nb_of_runs_in_list; i_run++)
07956 
07957               //===================================== FIRST LOOP END ===========================     (ViewHistime) 
07958               if( fNbOfExistingRuns > 0 )
07959                 {
07960                   //-------------------- recover the array after removing non existing ROOT files
07961                   Int_t i_existing_run = (Int_t)0;
07962 
07963                   for( Int_t i_run = 0; i_run < nb_of_runs_in_list;  i_run++)
07964                     {
07965                       if( exist_indic[i_run] == 1 )
07966                         {
07967                           fT1DRunNumber[i_existing_run] = fT1DRunNumber[i_run];
07968                           i_existing_run++;
07969                         }
07970                     }    
07971 
07972                   //---------------------- Get start and stop time values to set the axis limits        (ViewHistime)
07973 
07974                   thstart_evol = (Double_t)fStartEvolTime;
07975                   thstop_evol  = (Double_t)fStopEvolTime;
07976 
07977                   Double_t xinf_lim = thstart_evol-(thstop_evol-thstart_evol)/margin_frame_xaxis;
07978                   Double_t xsup_lim = thstop_evol +(thstop_evol-thstart_evol)/margin_frame_xaxis;
07979 
07980                   Axis_t xinf_his = (Axis_t)(xinf_lim);
07981                   Axis_t xsup_his = (Axis_t)(xsup_lim);
07982 
07983                   //............................. i0StexEcha, iSample
07984                   Int_t i0StexEcha = fEcalNumbering->Get0StexEchaFrom1StexStinAnd0StinEcha(StexStin_A, i0StinEcha);
07985                   Int_t iSample = 0;
07986          
07987                   Double_t* time_coordx  = new Double_t[fNbOfExistingRuns];   fCnew++;
07988                   Double_t* hval_coordy  = new Double_t[fNbOfExistingRuns];   fCnew++;
07989          
07990                   //........... Set values to -1 
07991 
07992                   for( Int_t i_run = 0; i_run < fNbOfExistingRuns;  i_run++)
07993                     {
07994                       time_coordx[i_run] = (Double_t)(-1);
07995                       hval_coordy[i_run] = (Double_t)(-1);
07996                     }    
07997  
07998                   //========================== SECOND LOOP BEGINNING =====================================
07999                   //----------------------------------------------------------------------- (ViewHistime)
08000                   //
08001                   //      SECOND LOOP OVER THE EXISTING RUNS : FILL THE GRAPH COORDINATES
08002                   //
08003                   //-----------------------------------------------------------------------
08004                   for (Int_t i_run = 0; i_run < fNbOfExistingRuns; i_run++)
08005                     {
08006                       // => set the attribute value relative to the run (fFapRunNumber)
08007                       SetRunNumberFromList(i_run, fNbOfExistingRuns);
08008 
08009                       fMyRootFile->PrintNoComment();
08010                       fMyRootFile->GetReadyToReadRootFile(fFapAnaType.Data(),   fFapNbOfSamples,
08011                                                           fT1DRunNumber[i_run], fFapFirstReqEvtNumber,
08012                                                           fFapLastReqEvtNumber, fFapReqNbOfEvts,
08013                                                           fFapStexNumber,       fCfgResultsRootFilePath.Data());
08014           
08015                       if ( fMyRootFile->LookAtRootFile() == kTRUE )    //  (ViewHistime, 2nd loop) 
08016                         {
08017                           fStatusFileFound = kTRUE;
08018 
08019                           Bool_t ok_view_histo = GetOkViewHisto(fMyRootFile, StexStin_A, i0StinEcha, iSample, HistoCode);
08020 
08021                           //............... F I L L   G R A P H   C O O R D I N A T E S   (ViewHistime)           
08022                           if( ok_view_histo == kTRUE )
08023                             {
08024                               //................................................. x coordinate
08025                               time_t xStartTime = fMyRootFile->GetStartTime();
08026                               Double_t thstart  = (Double_t)xStartTime;
08027                               time_coordx[i_run] = (Double_t)(thstart - xinf_lim);
08028                               //................................................. y coordinate
08029                               TVectorD read_histo(fEcal->MaxCrysEcnaInStex());
08030                               for(Int_t i=0; i<fEcal->MaxCrysEcnaInStex(); i++){read_histo(i)=(Double_t)0.;}
08031                              
08032                               if(HistoCode == "H_Ped_Date" || HistoCode == "H_Ped_RuDs")
08033                                 {read_histo = fMyRootFile->ReadPedestals(fEcal->MaxCrysEcnaInStex());}
08034                               if(HistoCode == "H_TNo_Date" || HistoCode == "H_TNo_RuDs")
08035                                 {read_histo = fMyRootFile->ReadTotalNoise(fEcal->MaxCrysEcnaInStex());}
08036                               if(HistoCode == "H_MCs_Date" || HistoCode == "H_MCs_RuDs")
08037                                 {read_histo = fMyRootFile->ReadMeanOfCorrelationsBetweenSamples(fEcal->MaxCrysEcnaInStex());}
08038                              
08039                               if(HistoCode == "H_LFN_Date" || HistoCode == "H_LFN_RuDs")
08040                                 {read_histo = fMyRootFile->ReadLowFrequencyNoise(fEcal->MaxCrysEcnaInStex());}
08041                               if(HistoCode == "H_HFN_Date" || HistoCode == "H_HFN_RuDs")
08042                                 {read_histo = fMyRootFile->ReadHighFrequencyNoise(fEcal->MaxCrysEcnaInStex());}
08043                               if(HistoCode == "H_SCs_Date" || HistoCode == "H_SCs_RuDs")
08044                                 {read_histo = fMyRootFile->ReadSigmaOfCorrelationsBetweenSamples(fEcal->MaxCrysEcnaInStex());}
08045                               hval_coordy[i_run] = (Double_t)read_histo(i0StexEcha);
08046                             }
08047                           else
08048                             {
08049                               cout << "!TEcnaHistos::ViewHistime(...)> Histo not available. "
08050                                    << fTTBELL << endl;
08051                             }
08052                         } // end of if ( fMyRootFile->LookAtRootFile() == kTRUE )
08053                       else
08054                         {
08055                           fStatusFileFound = kFALSE;
08056                         }
08057                     }
08058                   //========================== END OF SECOND LOOP ===========================================
08059 
08060                   //.................................................................... SCALE x and y
08061                   Int_t opt_scale_x = fOptScaleLinx;
08062                   if (fFlagScaleX == "LIN" ){opt_scale_x = fOptScaleLinx;}
08063                   if (fFlagScaleX == "LOG" ){opt_scale_x = fOptScaleLogx;}
08064 
08065                   Int_t opt_scale_y = fOptScaleLiny;
08066                   if (fFlagScaleY == "LIN" ){opt_scale_y = fOptScaleLiny;}
08067                   if (fFlagScaleY == "LOG" ){opt_scale_y = fOptScaleLogy;}
08068 
08069                   //------------------------------------------------- G R A P H    (ViewHistime)
08070                   TGraph* g_graph0 = new TGraph(fNbOfExistingRuns, time_coordx, hval_coordy); fCnewRoot++;
08071                   if( opt_plot == fOnlyOnePlot || opt_plot == fSeveralPlot)
08072                     {g_graph0->SetTitle(fCnaParHistos->GetQuantityName(HistoCode));}
08073                   if( opt_plot == fSameOnePlot )
08074                     {g_graph0->SetTitle(";");} 
08075 
08076                   //... Ymin and ymax default values will be taken if fFlagUserHistoMin/Max = "OFF"
08077                   //    (and if "Free" for "SAME" and "SAME n" options)
08078                   if((opt_plot == fOnlyOnePlot) ||
08079                      (opt_plot == fSeveralPlot && GetMemoFlag(HistoCode, opt_plot) == "Free") ||
08080                      (opt_plot == fSameOnePlot && GetMemoFlag(HistoCode, opt_plot) == "Free") )
08081                     {
08082                       SetYminMemoFromValue(HistoCode.Data(), fCnaParHistos->GetYminDefaultValue(HistoCode.Data()));
08083                       SetYmaxMemoFromValue(HistoCode.Data(), fCnaParHistos->GetYmaxDefaultValue(HistoCode.Data()));
08084                     }
08085               
08086                   //................................ Put min max values       (ViewHistime)
08087                   //.......... default if flag not set to "ON"
08088                   //SetYminMemoFromValue(HistoCode.Data(), fCnaParHistos->GetYminDefaultValue(HistoCode.Data()));
08089                   //SetYmaxMemoFromValue(HistoCode.Data(), fCnaParHistos->GetYmaxDefaultValue(HistoCode.Data()));
08090 
08091                   g_graph0->Set(fNbOfExistingRuns);
08092                   Double_t graph_ymin =
08093                     GetYminFromGraphFrameAndMarginValue(g_graph0, fCnaParHistos->GetMarginAutoMinMax());
08094                   Double_t graph_ymax =
08095                     GetYmaxFromGraphFrameAndMarginValue(g_graph0, fCnaParHistos->GetMarginAutoMinMax());
08096 
08097                   //---------------------------------- G R A P H   P L O T  ---------------------------- (ViewHistime)
08098                   if( HistoType == "Evol" )
08099                     {
08100                       //----------------- G R A P H  Y M I N / Y M A X    M A N A G E M E N T
08101                       if((opt_plot == fOnlyOnePlot) ||
08102                          (opt_plot == fSeveralPlot && GetMemoFlag(HistoCode, opt_plot) == "Free") ||
08103                          (opt_plot == fSameOnePlot && GetMemoFlag(HistoCode, opt_plot) == "Free") )
08104                         {
08105                           if( opt_plot == fSameOnePlot ){fHistoCodeFirst = HistoCode;} // registration of first HistoCode
08106 
08107                           if( fUserHistoMin >= fUserHistoMax ){fFlagUserHistoMin = "AUTO"; fFlagUserHistoMax = "AUTO";}
08108                           //.......... user's value if flag set to "ON"
08109                           if( fFlagUserHistoMin == "ON" )
08110                             {SetYminMemoFromValue(HistoCode.Data(), fUserHistoMin); fFlagUserHistoMin = "OFF";}
08111                           if( fFlagUserHistoMax == "ON" )
08112                             {SetYmaxMemoFromValue(HistoCode.Data(), fUserHistoMax); fFlagUserHistoMax = "OFF";}
08113                           //................................. automatic min and/or max
08114                           if( fFlagUserHistoMin == "AUTO" )
08115                             {SetYminMemoFromValue(HistoCode.Data(), graph_ymin); fFlagUserHistoMin = "OFF";}
08116                           if( fFlagUserHistoMax == "AUTO" )
08117                             {SetYmaxMemoFromValue(HistoCode.Data(), graph_ymax); fFlagUserHistoMax = "OFF";}
08118                       
08119                           //................................. Init Ymin and Ymax for graph
08120                           SetYminMemoFromPreviousMemo(HistoCode);
08121                           SetYmaxMemoFromPreviousMemo(HistoCode);
08122                         }
08123                       //--- Set ymin and ymax to the first HistoCode values for option SAME n
08124                       if( opt_plot == fSameOnePlot && GetMemoFlag(HistoCode, opt_plot) == "Busy" )                
08125                         {
08126                           Double_t ymin = GetYminValueFromMemo(fHistoCodeFirst.Data());
08127                           SetYminMemoFromValue(HistoCode.Data(), ymin);
08128                       
08129                           Double_t ymax = GetYmaxValueFromMemo(fHistoCodeFirst.Data());
08130                           SetYmaxMemoFromValue(HistoCode.Data(), ymax);
08131                         }
08132                   
08133                       //..... graph set ymin and ymax and consequently margin at top of the plot  
08134                       Int_t  xFlagAutoYsupMargin = SetGraphFrameYminYmaxFromMemo(g_graph0, HistoCode);
08135                   
08136                       HistimePlot(g_graph0,         xinf_his,         xsup_his,
08137                                   HistoCode.Data(), HistoType.Data(),
08138                                   StexStin_A,       i0StinEcha,       iSample,
08139                                   opt_scale_x,      opt_scale_y,      opt_plot, xFlagAutoYsupMargin);
08140                       //  g_graph0->Delete();   fCdeleteRoot++;  // *===> NE PAS DELETER LE GRAPH SINON CA EFFACE TOUT!
08141                   
08142                       //--- Recover ymin and ymax from user's values in option SAME n
08143                       if( opt_plot == fSameOnePlot && GetMemoFlag(HistoCode, opt_plot) == "Busy" )                
08144                         {
08145                           SetYminMemoFromValue(HistoCode.Data(), fUserHistoMin);
08146                           SetYmaxMemoFromValue(HistoCode.Data(), fUserHistoMax);
08147                         }
08148                     }
08149               
08150                   //---------- H I S T O    Y    P R O J E C T I O N     P L O T  ---------------------- (ViewHistime)
08151               
08152                   //======  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)
08153                   //
08154                   //  must be done before booking because of the x <-> y permutation in case of "Proj"
08155                   //
08156                   //-----------------------------------------------------------------------------------------
08157                   //
08158                   //        CASE:    HistoType == "Proj"   OR   HistoType == "SampProj"
08159                   //
08160                   //                 Xinf and Xsup must be calculated from ymin and ymax
08161                   //                 of the direct graph
08162                   //
08163                   //-----------------------------------------------------------------------------------------
08164               
08165                   if( HistoType == "EvolProj" )
08166                     {
08167                       Int_t HisSizeEvolProj = fNbBinsProj;
08168                       TVectorD histo_for_plot(HisSizeEvolProj);
08169                       for(Int_t i=0; i<HisSizeEvolProj; i++){histo_for_plot[i]=(Double_t)0.;}
08170 
08171                       //graph_ymin = GetYminValueFromMemo(HistoCode.Data());
08172                       //graph_ymax = GetYmaxValueFromMemo(HistoCode.Data());
08173 
08174                       TString HistoCodi = HistoCode;     // HistoCodi = direct histo
08175 
08176                       if( HistoCode == "H_Ped_RuDs" ){HistoCodi = "H_Ped_Date";}
08177                       if( HistoCode == "H_TNo_RuDs" ){HistoCodi = "H_TNo_Date";}
08178                       if( HistoCode == "H_LFN_RuDs" ){HistoCodi = "H_LFN_Date";}
08179                       if( HistoCode == "H_HFN_RuDs" ){HistoCodi = "H_HFN_Date";}
08180                       if( HistoCode == "H_MCs_RuDs" ){HistoCodi = "H_MCs_Date";}
08181                       if( HistoCode == "H_SCs_RuDs" ){HistoCodi = "H_SCs_Date";}              
08182 
08183                       if( fUserHistoMin >= fUserHistoMax ){fFlagUserHistoMin = "AUTO"; fFlagUserHistoMax = "AUTO";}
08184 
08185                       //--------------------------------------------------------------------------- (ViewHistime)
08186                       //
08187                       //    fOnlyOnePlot => compute Xinf and Xsup at each time
08188                       //    fSeveralPlot => compute Xinf and Xsup once when flag = "Free" for each HistoCode
08189                       //    fSameOnePlot => compute Xinf and Xsup once
08190                       //
08191                       //--------------------------------------------------------------------------------------
08192                       if( (opt_plot == fOnlyOnePlot) ||
08193                           ( (opt_plot == fSeveralPlot && GetMemoFlag(HistoCode, fSeveralPlot) == "Free" ) ||
08194                             (opt_plot == fSameOnePlot && GetMemoFlag(HistoCode, fSameOnePlot) == "Free" ) ) )
08195                         {
08196                           Double_t XinfProj =(Double_t)0;
08197                           Double_t XsupProj =(Double_t)0;
08198 
08199                           //...................................................................... (ViewHistime)
08200                           if( fFlagUserHistoMin == "AUTO" || fFlagUserHistoMax == "AUTO" )
08201                             {
08202                               //... Get direct graph ymin and/or ymax and keep them as xinf and xsup
08203                               //    in memo for the plotted histo 
08204                               XinfProj = fUserHistoMin;
08205                               XsupProj = fUserHistoMax;
08206                               if( fFlagUserHistoMin == "AUTO" ){XinfProj = GetYminValueFromMemo(HistoCodi.Data());}
08207                               if( fFlagUserHistoMax == "AUTO" ){XsupProj = GetYmaxValueFromMemo(HistoCodi.Data());}
08208                             } // end of  if( fFlagUserHistoMin == "AUTO" || fFlagUserHistoMax == "AUTO" )
08209                           else
08210                             {
08211                               if( fFlagUserHistoMin == "OFF" )
08212                                 {
08213                                   SetYminMemoFromValue(HistoCode.Data(),
08214                                                        fCnaParHistos->GetYminDefaultValue(HistoCode.Data()));
08215                                   XinfProj = GetYminValueFromMemo(HistoCode.Data());
08216                                 }
08217 
08218                               if( fFlagUserHistoMax == "OFF" )
08219                                 {
08220                                   SetYmaxMemoFromValue(HistoCode.Data(),
08221                                                        fCnaParHistos->GetYmaxDefaultValue(HistoCode.Data()));
08222                                   XsupProj = GetYmaxValueFromMemo(HistoCode.Data());      
08223                                 }
08224                               if( fFlagUserHistoMin == "ON" ){XinfProj = fUserHistoMin;}
08225                               if( fFlagUserHistoMax == "ON" ){XsupProj = fUserHistoMax;}
08226                             }
08227 
08228                           if( opt_plot == fOnlyOnePlot || opt_plot == fSeveralPlot )
08229                             {
08230                               SetXinfMemoFromValue(HistoCode.Data(), XinfProj);
08231                               SetXsupMemoFromValue(HistoCode.Data(), XsupProj);                   
08232                             }
08233                           else
08234                             {
08235                               SetXinfMemoFromValue(XinfProj);
08236                               SetXsupMemoFromValue(XsupProj);
08237                             }
08238                         } // end of if( (opt_plot == fOnlyOnePlot) || 
08239                       // (opt_plot == fSeveralPlot  && GetMemoFlag(HistoCode, opt_plot) == "Free") ||
08240                       // (opt_plot == fSameOnePlot  && GetMemoFlag(HistoCode, opt_plot) == "Free") )
08241 
08242                       Double_t cXinf = (Double_t)0.;
08243                       Double_t cXsup = (Double_t)0.;
08244 
08245                       //.......... Set Xinf and Xsup at each time because of simultaneous SAME options    (ViewHistime)
08246                       if( opt_plot == fOnlyOnePlot || opt_plot == fSeveralPlot )
08247                         {
08248                           cXinf = GetXinfValueFromMemo(HistoCode.Data());
08249                           cXsup = GetXsupValueFromMemo(HistoCode.Data());
08250                         }
08251                       else
08252                         {
08253                           cXinf = GetXinfValueFromMemo();
08254                           cXsup = GetXsupValueFromMemo();
08255                         }
08256                       //....... In case of only one run: in order to have cXinf < cXsup for "EvolProj" plot
08257                       if( cXinf >= cXsup ){cXinf -= 1.; cXsup +=1.;}
08258 
08259                       //..............................  histogram booking (ViewHisto)
08260                       Axis_t xinf_his = cXinf;  // ancillary variables since no const in arguments of TH1D
08261                       Axis_t xsup_his = cXsup;
08262 
08263                       TString TitleHisto = ";";
08264                       if( opt_plot != fSameOnePlot )
08265                         {TitleHisto = fCnaParHistos->GetQuantityName(HistoCode.Data());}
08266 
08267                       //........ fill array histo_for_plot from hval_coordy                    (ViewHistime)
08268                       for(Int_t i_run=0; i_run<fNbOfExistingRuns; i_run++)
08269                         {
08270                           Double_t XFromYGraph = hval_coordy[i_run];
08271                           Double_t binXProjY = (Double_t)HisSizeEvolProj*(XFromYGraph - cXinf)/(cXsup - cXinf);
08272                           Int_t ibinXProjY = (Int_t)binXProjY;
08273                           if( ibinXProjY >= 0 && ibinXProjY<HisSizeEvolProj ){histo_for_plot[ibinXProjY]++;}
08274                         }
08275 
08276                       TH1D* h_his_evol_proj = new TH1D("histevolproj", TitleHisto.Data(),
08277                                                        HisSizeEvolProj, xinf_his, xsup_his); fCnewRoot++;
08278 
08279                       h_his_evol_proj->Reset();
08280 
08281                       //.... direct histogram filling                                                 (ViewHistime)
08282                       for(Int_t i=0; i<HisSizeEvolProj; i++)
08283                         {
08284                           Double_t yi = (Double_t)i/(Double_t)HisSizeEvolProj*(cXsup-cXinf) + cXinf;
08285                           Double_t his_val = (Double_t)histo_for_plot[i];
08286                           h_his_evol_proj->Fill(yi, his_val);
08287                         }
08288 
08289                       //------- 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
08290                       if( fUserHistoMin >= fUserHistoMax ){fFlagUserHistoMin = "AUTO"; fFlagUserHistoMax = "AUTO";}
08291                       //.......... user's value if flag set to "ON"
08292                       if( fFlagUserHistoMin == "ON" )
08293                         {SetYminMemoFromValue(HistoCode.Data(), fUserHistoMin); fFlagUserHistoMin = "OFF";}
08294                       if( fFlagUserHistoMax == "ON" )
08295                         {SetYmaxMemoFromValue(HistoCode.Data(), fUserHistoMax); fFlagUserHistoMax = "OFF";}
08296                       //................................. automatic min and/or max
08297                       if( fFlagUserHistoMin == "AUTO" )
08298                         {SetYminMemoFromValue(HistoCode.Data(), graph_ymin); fFlagUserHistoMin = "OFF";}
08299                       if( fFlagUserHistoMax == "AUTO" )
08300                         {SetYmaxMemoFromValue(HistoCode.Data(), graph_ymax); fFlagUserHistoMax = "OFF";}
08301 
08302                       //................................. Init Ymin and Ymax for graph
08303                       SetYminMemoFromPreviousMemo(HistoCode);
08304                       SetYmaxMemoFromPreviousMemo(HistoCode);
08305 
08306                       //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
08307                       //.......... Find maximum in case of Proj (LIN scale only) // PS: EvolProj => in ViewHistime
08308                       if( fFlagScaleY == "LIN" )
08309                         {
08310                           SetYmaxMemoFromValue
08311                             (HistoCode.Data(),
08312                              GetYmaxFromHistoFrameAndMarginValue(h_his_evol_proj, fCnaParHistos->GetMarginAutoMinMax()));
08313                         }
08314                       
08315                       //--- Set ymin and ymax to the first HistoCode values for option SAME n
08316                       if( opt_plot == fSameOnePlot && GetMemoFlag(HistoCode, opt_plot) == "Busy" )                
08317                         {
08318                           Double_t ymin = GetYminValueFromMemo(fHistoCodeFirst.Data());
08319                           SetYminMemoFromValue(HistoCode.Data(), ymin);
08320                           
08321                           Double_t ymax = GetYmaxValueFromMemo(fHistoCodeFirst.Data());
08322                           SetYmaxMemoFromValue(HistoCode.Data(), ymax);
08323                         }
08324                       //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
08325                       
08326                       
08327                       //..... graph set ymin and ymax and consequently margin at top of the plot  
08328                       Int_t  xFlagAutoYsupMargin = SetGraphFrameYminYmaxFromMemo(g_graph0, HistoCode);
08329                       
08330                       HistoPlot(h_his_evol_proj,  HisSizeEvolProj,
08331                                 xinf_his,         xsup_his,
08332                                 HistoCode.Data(), HistoType.Data(),
08333                                 StexStin_A,       i0StinEcha,       iSample,
08334                                 opt_scale_x,      opt_scale_y,      opt_plot, xFlagAutoYsupMargin);
08335 
08336                       h_his_evol_proj->Delete();   h_his_evol_proj = 0;                         fCdeleteRoot++;
08337                       //*===> deleter l'histo sinon "Replacing existing histo (potential memory leak)" a l'execution
08338 
08339                     } // end of if( HistoType == "EvolProj" )
08340                   //---------------------------------------------------------------------------------- (ViewHistime)
08341 
08342                   delete [] time_coordx;   time_coordx = 0;      fCdelete++;   
08343                   delete [] hval_coordy;   hval_coordy = 0;      fCdelete++;  
08344                 }
08345               else
08346                 {
08347                   cout << "!TEcnaHistos::ViewHistime(...)> The list of runs in file: " << list_of_run_file_name 
08348                        << " has " << nb_of_runs_in_list << " run numbers" << endl
08349                        << " but none of them correspond to an existing ROOT file."
08350                        << fTTBELL << endl;
08351                 }
08352             } // end of if( fFapStexNumber > 0 )
08353           else
08354             {
08355               cout << "!TEcnaHistos::ViewHistime(...)> *ERROR* =====> "
08356                    << fFapStexName << " number = " << fFapStexNumber << ". "
08357                    << fFapStexName << " number must be in range [1," << fEcal->MaxStexInStas() << "] ";
08358               if( fFlagSubDet == "EB" ){cout << " (or [-18,+18])";}
08359                 cout << fTTBELL << endl;
08360             }
08361           delete [] exist_indic;  exist_indic = 0;         fCdelete++;
08362         } // end of if( nb_of_runs_in_list > 0 )
08363       else
08364         {
08365           if( nb_of_runs_in_list == 0 )
08366             {
08367               cout << "!TEcnaHistos::ViewHistime(...)> The list of runs in file: " << list_of_run_file_name
08368                    << " is empty !" << fTTBELL << endl;
08369             }
08370           if( nb_of_runs_in_list < 0 )
08371             {
08372               cout << "!TEcnaHistos::ViewHistime(...)> " << list_of_run_file_name
08373                    << ": file not found in directory: " << fCfgHistoryRunListFilePath.Data() << fTTBELL << endl;
08374             }
08375         }
08376     }  // end of if( OKHisto == 1 )
08377 } // end of ViewHistime
08378 
08379 //------------------------------------------------------------------------------------
08380 //
08381 //      GetHistoryRunListParameters(...), AllocArraysForEvol(), GetListFileNumber(...)
08382 //
08383 //------------------------------------------------------------------------------------
08384 
08385 Int_t TEcnaHistos::GetHistoryRunListParameters(const TString list_of_run_file_name, const TString HistoCode)
08386 {
08387   // Build the array of run numbers from the list-of-runs .ascii file.
08388   // Return the list size
08389   // *=====> list_of_run_file_name is the name of the ASCII file containing the list of the runs
08390   //
08391   // SYNTAX OF THE FILE:
08392   //
08393   // HistoryRunList_EB_SM6_Analysis_1.ascii    <- 1rst line: comment (file name for example)
08394   // 73677                                 <- 2nd  line and others: run numbers (empty lines accepted)
08395   // 73688          
08396   // 73689
08397   //
08398   // 73690
08399   // 73692 
08400   //
08401   // In option SAME (of TEcnaHistos), several lists of runs can be called and these lists can have
08402   // DIFFERENT sizes (here the "size" is the number of runs of the list). In addition,
08403   // some runs in some lists may not exist in reality. So, we must adopt a convention which is
08404   // the following: the number of runs corresponds to the number of EXISTING runs
08405   // of the FIRST read list. Let be N1 this number.
08406   // If another list has more runs than N1 runs, we read only the first N1 runs.
08407   // If another list has less runs than N1 runs, we read all the runs of this list. 
08408   //
08409   //--------------------------------------------------------------------------------------------------
08410 
08411   Int_t nb_of_runs_in_list = 0;
08412   
08413   //========= immediate return if file name is an empty string
08414   if( list_of_run_file_name.Data() == '\0' )
08415     {
08416       cout << "!TEcnaHistos::GetHistoryRunListParameters(...)> *** ERROR *** =====> "
08417            << " EMPTY STRING for list of run file name." << fTTBELL << endl;
08418     }
08419   else
08420     {
08421       // ===> increase the HistoryRunList file number
08422       if ( HistoCode == "H_Ped_Date" ){fNbOfListFileH_Ped_Date++;}
08423       if ( HistoCode == "H_TNo_Date" ){fNbOfListFileH_TNo_Date++;}
08424       if ( HistoCode == "H_MCs_Date" ){fNbOfListFileH_MCs_Date++;}
08425       if ( HistoCode == "H_LFN_Date" ){fNbOfListFileH_LFN_Date++;}
08426       if ( HistoCode == "H_HFN_Date" ){fNbOfListFileH_HFN_Date++;}
08427       if ( HistoCode == "H_SCs_Date" ){fNbOfListFileH_SCs_Date++;}
08428 
08429       if ( HistoCode == "H_Ped_RuDs" ){fNbOfListFileH_Ped_RuDs++;}
08430       if ( HistoCode == "H_TNo_RuDs" ){fNbOfListFileH_TNo_RuDs++;}
08431       if ( HistoCode == "H_MCs_RuDs" ){fNbOfListFileH_MCs_RuDs++;}
08432       if ( HistoCode == "H_LFN_RuDs" ){fNbOfListFileH_LFN_RuDs++;}
08433       if ( HistoCode == "H_HFN_RuDs" ){fNbOfListFileH_HFN_RuDs++;}
08434       if ( HistoCode == "H_SCs_RuDs" ){fNbOfListFileH_SCs_RuDs++;}
08435       
08436       fFapFileRuns = list_of_run_file_name.Data();    // (short name)
08437       
08438       //........... Add the path to the file name           ( GetHistoryRunListParameters )
08439       TString xFileNameRunList = list_of_run_file_name.Data();
08440       const Text_t *t_file_name = (const Text_t *)xFileNameRunList.Data();
08441  
08442       //.............. replace the string "$HOME" by the true $HOME path
08443       if(fCfgHistoryRunListFilePath.BeginsWith("$HOME"))
08444         {
08445           fCfgHistoryRunListFilePath.Remove(0,5);
08446           const Text_t *t_file_nohome = (const Text_t *)fCfgHistoryRunListFilePath.Data(); //  /scratch0/cna/...
08447           
08448           TString home_path = gSystem->Getenv("HOME");
08449           fCfgHistoryRunListFilePath = home_path;             //  /afs/cern.ch/u/USER
08450           fCfgHistoryRunListFilePath.Append(t_file_nohome);   //  /afs/cern.ch/u/USER/scratch0/cna/...
08451         }
08452      
08453       xFileNameRunList = fCfgHistoryRunListFilePath.Data();
08454       
08455       xFileNameRunList.Append('/');
08456       xFileNameRunList.Append(t_file_name);
08457       
08458       fFcin_f.open(xFileNameRunList.Data());
08459 
08460       //.......................................           ( GetHistoryRunListParameters )
08461       if( fFcin_f.fail() == kFALSE )
08462         {   
08463           //...................................... first reading to get the number of runs in the list
08464           fFcin_f.clear();
08465           string xHeadComment;
08466           fFcin_f >> xHeadComment;
08467           Int_t cRunNumber;
08468           Int_t list_size_read = 0;
08469           
08470           while( !fFcin_f.eof() ){fFcin_f >> cRunNumber; list_size_read++;}
08471           fFapNbOfRuns = list_size_read - 1;
08472 
08473           //...................................... second reading to get the run numbers
08474 
08475           //====== Return to the beginning of the file =====
08476           fFcin_f.clear();
08477           fFcin_f.seekg(0, ios::beg);
08478           //================================================
08479 
08480           string yHeadComment;
08481           fFcin_f >> yHeadComment;
08482 
08483           //....................... Set fFapMaxNbOfRuns to -1 at first call (first read file)
08484           //
08485           //                        fNbOfListFileEvolXXX is initialized to 0 in Init()
08486           //                        It is incremented once here above
08487           //                        So, at first call fNbOfListFileEvolXXX = 1
08488           //                        then fFapMaxNbOfRuns = -1
08489           //..........................................................................   (GetHistoryRunListParameters)
08490           if( (HistoCode == "H_Ped_Date" && fNbOfListFileH_Ped_Date == 1) || 
08491               (HistoCode == "H_TNo_Date" && fNbOfListFileH_TNo_Date == 1) ||
08492               (HistoCode == "H_MCs_Date" && fNbOfListFileH_MCs_Date == 1) ||
08493               (HistoCode == "H_LFN_Date" && fNbOfListFileH_LFN_Date == 1) || 
08494               (HistoCode == "H_HFN_Date" && fNbOfListFileH_HFN_Date == 1) ||
08495               (HistoCode == "H_SCs_Date" && fNbOfListFileH_SCs_Date == 1) ||
08496               (HistoCode == "H_Ped_RuDs" && fNbOfListFileH_Ped_RuDs == 1) || 
08497               (HistoCode == "H_TNo_RuDs" && fNbOfListFileH_TNo_RuDs == 1) ||
08498               (HistoCode == "H_MCs_RuDs" && fNbOfListFileH_MCs_RuDs == 1) ||
08499               (HistoCode == "H_LFN_RuDs" && fNbOfListFileH_LFN_RuDs == 1) || 
08500               (HistoCode == "H_HFN_RuDs" && fNbOfListFileH_HFN_RuDs == 1) ||
08501               (HistoCode == "H_SCs_RuDs" && fNbOfListFileH_SCs_RuDs == 1)){fFapMaxNbOfRuns = -1;}
08502           
08503           // first call: fFapMaxNbOfRuns = fFapNbOfRuns = nb of run from the first reading 
08504           if( fFapMaxNbOfRuns == -1 ){fFapMaxNbOfRuns = fFapNbOfRuns;}
08505           // next calls: fFapNbOfRuns must not be greater than fFapMaxNbOfRuns found at first time
08506           else{if( fFapNbOfRuns > fFapMaxNbOfRuns ){fFapNbOfRuns = fFapMaxNbOfRuns;}}
08507 
08508           // Allocation and initialization of the array fT1DRunNumber[].
08509           //................. check maximum value for allocation
08510           if( fFapMaxNbOfRuns > fCnaParHistos->MaxNbOfRunsInLists() )
08511             {
08512               cout << "TEcnaHistos::GetHistoryRunListParameters(...)> Max number of runs in HistoryRunList = "
08513                    << fFapMaxNbOfRuns
08514                    << " too large, forced to parameter TEcnaParHistos->fMaxNbOfRunsInLists value (= "
08515                    << fCnaParHistos->MaxNbOfRunsInLists()
08516                    << "). Please, set this parameter to a larger value than " << fFapMaxNbOfRuns
08517                    << fTTBELL << endl;
08518               fFapMaxNbOfRuns = fCnaParHistos->MaxNbOfRunsInLists();
08519             }
08520           //................................. Alloc of the array and init
08521           if( fT1DRunNumber == 0 )
08522             {
08523               if( fFapMaxNbOfRuns > 0 )
08524                 {
08525                   fT1DRunNumber = new Int_t[fFapMaxNbOfRuns];               fCnew++;
08526                 }
08527               else
08528                 {
08529                   cout << "!TEcnaHistos::GetHistoryRunListParameters(...)> *** ERROR *** =====> fFapMaxNbOfRuns = "
08530                        << fFapMaxNbOfRuns << ". Forced to 1." << fTTBELL << endl;
08531                   fFapMaxNbOfRuns = 1;
08532                   fT1DRunNumber = new Int_t[fFapMaxNbOfRuns];               fCnew++;
08533                 }
08534             }
08535 
08536 
08537           //.................................... Init the list of runs    
08538           for ( Int_t i_run = 0; i_run < fFapMaxNbOfRuns; i_run++ ){fT1DRunNumber[i_run] = -1;}
08539           //.................................... read the list of runs
08540           for (Int_t i_list = 0; i_list < fFapNbOfRuns; i_list++)
08541             {
08542               fFcin_f >> cRunNumber;
08543               fT1DRunNumber[i_list] = cRunNumber;
08544             }
08545           //........................................           ( GetHistoryRunListParameters )
08546           nb_of_runs_in_list = fFapNbOfRuns;
08547           fFcin_f.close();
08548         }
08549       else
08550         {
08551           fFcin_f.clear();
08552           cout << "!TEcnaHistos::GetHistoryRunListParameters(...)> *** ERROR *** =====> "
08553                << xFileNameRunList.Data() << " : file not found." << fTTBELL << endl;
08554           nb_of_runs_in_list = -1;
08555         }
08556     }
08557   return nb_of_runs_in_list;
08558 }
08559 //   end of GetHistoryRunListParameters(...)
08560 
08561 //------------------------------------------------------------------------------------------------
08562 
08563 Int_t TEcnaHistos::GetListFileNumber(const TString HistoCode)
08564 {
08565 // Get the number of the read list file
08566   
08567   Int_t number = 0;
08568 
08569   if ( HistoCode == "H_Ped_Date"){number = fNbOfListFileH_Ped_Date;}
08570   if ( HistoCode == "H_TNo_Date"){number = fNbOfListFileH_TNo_Date;}
08571   if ( HistoCode == "H_MCs_Date"){number = fNbOfListFileH_MCs_Date;}
08572   if ( HistoCode == "H_LFN_Date"){number = fNbOfListFileH_LFN_Date;}
08573   if ( HistoCode == "H_HFN_Date"){number = fNbOfListFileH_HFN_Date;}
08574   if ( HistoCode == "H_SCs_Date"){number = fNbOfListFileH_SCs_Date;}
08575   if ( HistoCode == "H_Ped_RuDs"){number = fNbOfListFileH_Ped_RuDs;}
08576   if ( HistoCode == "H_TNo_RuDs"){number = fNbOfListFileH_TNo_RuDs;}
08577   if ( HistoCode == "H_MCs_RuDs"){number = fNbOfListFileH_MCs_RuDs;}
08578   if ( HistoCode == "H_LFN_RuDs"){number = fNbOfListFileH_LFN_RuDs;}
08579   if ( HistoCode == "H_HFN_RuDs"){number = fNbOfListFileH_HFN_RuDs;}
08580   if ( HistoCode == "H_SCs_RuDs"){number = fNbOfListFileH_SCs_RuDs;}
08581   return number;
08582 }
08583 
08584 //--------------------------------------------------------------------------------------------
08585 //
08586 //          FileParameters(s)(...) 
08587 //
08588 //--------------------------------------------------------------------------------------------
08589 
08590 //===> DON'T SUPPRESS: THIS METHOD IS CALLED BY TEcnaGui and can be called by any other program
08591 void TEcnaHistos::FileParameters(const TString xArgAnaType,          const Int_t&  xArgNbOfSamples, 
08592                                  const Int_t&  xArgRunNumber,        const Int_t&  xArgFirstReqEvtNumber,
08593                                  const Int_t&  xArgLastReqEvtNumber, const Int_t&  xArgReqNbOfEvts, 
08594                                  const Int_t&  xArgStexNumber)
08595 {
08596 // Set parameters for reading the right CNA results file
08597 
08598   fFapAnaType           = xArgAnaType;
08599   fFapNbOfSamples       = xArgNbOfSamples;
08600   fFapRunNumber         = xArgRunNumber;
08601   fFapFirstReqEvtNumber = xArgFirstReqEvtNumber;
08602   fFapLastReqEvtNumber  = xArgLastReqEvtNumber;
08603   fFapReqNbOfEvts       = xArgReqNbOfEvts;
08604   fFapStexNumber        = xArgStexNumber;
08605 
08606   InitSpecParBeforeFileReading();
08607 }
08608 
08609 //--------------------------------------------------------------------------------------------------
08610 void TEcnaHistos::SetRunNumberFromList(const Int_t& xArgIndexRun, const Int_t& MaxNbOfRuns)
08611 {
08612   // Set run number for the xArgIndexRun_th run in the list of runs (evolution plots)
08613   //     The array fT1DRunNumber[] have been obtained from a previous call
08614   //     to GetHistoryRunListParameters(xFileNameRunList, HistoCode)
08615   
08616   if( xArgIndexRun >= 0 && xArgIndexRun < MaxNbOfRuns)
08617     {
08618       fFapRunNumber  = fT1DRunNumber[xArgIndexRun];
08619       if( xArgIndexRun == 0 ){InitSpecParBeforeFileReading();}
08620     }
08621   else
08622     {
08623       cout << "!TEcnaHistos::SetRunNumberFromList(...)> **** ERROR **** Run index out of range in list of runs. xArgIndexRun = "
08624            << xArgIndexRun << " (MaxNbOfRuns = "<< MaxNbOfRuns << ")" << endl;
08625     }
08626 }
08627 
08628 //--------------------------------------------------------------------------------------------------
08629 void TEcnaHistos::InitSpecParBeforeFileReading()
08630 {
08631   // Init parameters that will be set by reading the info which are in the results ROOT file
08632   Int_t MaxCar = fgMaxCar;
08633   fStartDate.Resize(MaxCar);
08634   fStartDate = "(date not found)";
08635 
08636   MaxCar = fgMaxCar;
08637   fStopDate.Resize(MaxCar);
08638   fStopDate  = "(date not found)";
08639 
08640   fStartTime = (time_t)0;
08641   fStopTime  = (time_t)0;
08642 
08643   fRunType   = "run type not found";
08644 
08645 } // ------------- ( end of InitSpecParBeforeFileReading() ) -------------
08646 
08647 Int_t TEcnaHistos::GetNumberOfEvents(TEcnaRead* xMyRootFile, const Int_t& xFapNbOfReqEvts)
08648 {
08649   //...... Calculate the number of found events  (file existence already tested in calling method)
08650   Int_t xFapNbOfEvts = 0; 
08651 
08652   TVectorD NOFE_histp(fEcal->MaxCrysEcnaInStex());
08653   for(Int_t i=0; i<fEcal->MaxCrysEcnaInStex(); i++){NOFE_histp(i)=(Double_t)0.;}
08654   NOFE_histp = xMyRootFile->ReadNumberOfEvents(fEcal->MaxCrysEcnaInStex());
08655 
08656   //... Call to fCnaWrite->NumberOfEvents(...) 1rst argument must be Int_t, not TVectorD,
08657   //    duplicate NOFE_histp to NOFE_int to obtain fFapNbOfEvts from fCnaWrite->NumberOfEvents(...)
08658   Int_t* NOFE_int = new Int_t[fEcal->MaxCrysEcnaInStex()];   fCnew++;
08659   for(Int_t i=0; i<fEcal->MaxCrysEcnaInStex(); i++){NOFE_int[i]=(Int_t)NOFE_histp(i);}
08660 
08661   xFapNbOfEvts = fCnaWrite->NumberOfEvents(NOFE_int, fEcal->MaxCrysEcnaInStex(), xFapNbOfReqEvts);
08662 
08663   delete [] NOFE_int; NOFE_int = 0;                          fCdelete++;
08664 
08665   return xFapNbOfEvts;
08666 }
08667 
08668 //======================================================================================
08669 //
08670 //           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 
08671 //
08672 //======================================================================================
08673 
08674 Bool_t TEcnaHistos::GetOkViewHisto(TEcnaRead*    aMyRootFile,
08675                                    const Int_t&  StexStin_A, const Int_t& i0StinEcha, const Int_t& iSample,
08676                                    const TString HistoCode)
08677 {
08678 // Check possibility to plot the histo
08679 
08680   Bool_t ok_view_histo = kFALSE;
08681 
08682   TString HistoType = fCnaParHistos->GetHistoType(HistoCode);
08683 
08684   TString root_file_name = aMyRootFile->GetRootFileNameShort();
08685 
08686   TVectorD  vStin(fEcal->MaxStinEcnaInStex());
08687   for(Int_t i=0; i<fEcal->MaxStinEcnaInStex() ; i++){vStin(i)=(Double_t)0.;}
08688   vStin = aMyRootFile->ReadStinNumbers(fEcal->MaxStinEcnaInStex());
08689 
08690   if( aMyRootFile->DataExist() == kTRUE )
08691     {
08692       fStatusDataExist = kTRUE;
08693 
08694       Int_t Stin_ok = 0;
08695       for (Int_t index_Stin = 0; index_Stin < fEcal->MaxStinEcnaInStex(); index_Stin++)
08696         {
08697           if ( vStin(index_Stin) == StexStin_A ){Stin_ok++;};
08698         }
08699       
08700       //.............................................. ok_view   
08701       Int_t ok_view    = 1;
08702       
08703       if( !( HistoType == "Global" || HistoType == "Proj" )  )
08704         {
08705           if( Stin_ok != 1)
08706           {
08707             Int_t StinNumber = StexStin_A;
08708             if( fFlagSubDet == "EE" )
08709               {StinNumber = fEcalNumbering->GetDeeSCConsFrom1DeeSCEcna(fFapStexNumber, StexStin_A);}
08710             cout << "!TEcnaHistos::GetOkViewHisto(...)> *ERROR* =====> " << "File: " << root_file_name
08711                  << ", " << fFapStinName.Data() << " "
08712                  << StinNumber
08713                  << " not found. Available numbers = ";
08714             for(Int_t i = 0; i < fEcal->MaxStinEcnaInStex(); i++)
08715               {
08716                 if( vStin(i) > 0 )
08717                   {
08718                     if( fFlagSubDet == "EB" ){cout << vStin(i) << ", ";}
08719                     if( fFlagSubDet == "EE" )
08720                       {cout << fEcalNumbering->GetDeeSCConsFrom1DeeSCEcna(fFapStexNumber, (Int_t)vStin(i)) << ", ";}
08721                   }
08722               }
08723             cout << fTTBELL << endl;
08724             ok_view = -1;
08725           }
08726           else 
08727             { 
08728               ok_view = 1;
08729             }
08730         }
08731       
08732       //.............................................. ok_max_elt   ( GetOkViewHisto(...) )
08733       Int_t ok_max_elt  = 1;
08734       
08735       if( ( ( (HistoType == "H1Basic") || (HistoType == "Evol") || (HistoType == "EvolProj") )
08736             && (i0StinEcha >= 0) && (i0StinEcha<fEcal->MaxCrysInStin()) 
08737             && (iSample  >= 0) && (iSample <fFapNbOfSamples ) ) ||
08738           !( (HistoType == "H1Basic") || (HistoType == "Evol") || (HistoType == "EvolProj") ))
08739         {ok_max_elt = 1;} 
08740       else
08741         {
08742           Int_t Choffset = 0;
08743           if( fFlagSubDet == "EE" ){Choffset = 1;}
08744           if( ( (HistoType == "H1Basic") || (HistoType == "Evol") || (HistoType == "EvolProj") )
08745               && !( (i0StinEcha >= 0) && (i0StinEcha<fEcal->MaxCrysInStin()) ) )
08746             {cout << "!TEcnaHistos::GetOkViewHisto(...)> *ERROR* =====> " << "File: " << root_file_name
08747                   << ". Wrong channel number. Value = " << i0StinEcha << " (required range: [" << Choffset << ", "
08748                   << fEcal->MaxCrysInStin()-1+Choffset << "] )"
08749                   << fTTBELL << endl;}
08750           if( (HistoCode == "D_Adc_EvDs" || HistoCode == "D_Adc_EvNb") &&
08751               !((iSample >= 0) && (iSample <fFapNbOfSamples)) )
08752             {cout << "!TEcnaHistos::GetOkViewHisto(...)> *ERROR* =====> " << "File: " << root_file_name
08753                   << ". Wrong sample index. Value = " << iSample << " (required range: [0, "
08754                   << fFapNbOfSamples-1 << "] )"
08755                   << fTTBELL << endl;}
08756           ok_max_elt = -1;
08757         }
08758       
08759       if( (ok_view == 1) && (ok_max_elt == 1) )
08760         {
08761           ok_view_histo = kTRUE;
08762         }
08763       else
08764         {
08765           cout << "!TEcnaHistos::GetOkViewHisto(...)> At least one ERROR has been detected. ok_view = " << ok_view
08766                << ", ok_max_elt = " << ok_max_elt << fTTBELL << endl;
08767         }
08768     }
08769   else
08770     {
08771       fStatusDataExist = kFALSE;
08772 
08773       cout << "!TEcnaHistos::GetOkViewHisto(...)> No data in ROOT file "
08774            << ", aMyRootFile->DataExist() = " << aMyRootFile->DataExist() << fTTBELL << endl;
08775     }
08776   return ok_view_histo;
08777 }
08778 //..............................................................................................
08779 
08780 Int_t TEcnaHistos::SetHistoFrameYminYmaxFromMemo(TH1D* h_his0, const TString HistoCode)
08781 {
08782 // Set min and max according to HistoCode
08783   
08784   // if Ymin = Ymax (or Ymin > Ymax): nothing done here
08785   // return xFlagAutoYsupMargin = 1
08786   //
08787   // if Ymin < Ymax: min and max calculated by h_his0->SetMinimum() and h_his0->SetMaximum()
08788   // return xFlagAutoYsupMargin = 0
08789 
08790   Int_t xFlagAutoYsupMargin = 1;                             //  (SetHistoFrameYminYmaxFromMemo)
08791   
08792   if(HistoCode == "D_NOE_ChNb"){ 
08793     if(fD_NOE_ChNbYmin < fD_NOE_ChNbYmax){xFlagAutoYsupMargin = 0;
08794     h_his0->SetMinimum(fD_NOE_ChNbYmin);  h_his0->SetMaximum(fD_NOE_ChNbYmax);}}
08795   
08796   if(HistoCode == "D_NOE_ChDs"){
08797     if(fD_NOE_ChDsYmin < fD_NOE_ChDsYmax){xFlagAutoYsupMargin = 0;
08798     h_his0->SetMinimum(fD_NOE_ChDsYmin); h_his0->SetMaximum(fD_NOE_ChDsYmax);}}
08799   
08800   if(HistoCode == "D_Ped_ChNb"){
08801     if(fD_Ped_ChNbYmin < fD_Ped_ChNbYmax){xFlagAutoYsupMargin = 0;
08802         h_his0->SetMinimum(fD_Ped_ChNbYmin);  h_his0->SetMaximum(fD_Ped_ChNbYmax);}}
08803   
08804   if(HistoCode == "D_Ped_ChDs"){
08805     if(fD_Ped_ChDsYmin < fD_Ped_ChDsYmax){xFlagAutoYsupMargin = 0;
08806     h_his0->SetMinimum(fD_Ped_ChDsYmin); h_his0->SetMaximum(fD_Ped_ChDsYmax);}}
08807   
08808   if(HistoCode == "D_TNo_ChNb"){
08809     if(fD_TNo_ChNbYmin < fD_TNo_ChNbYmax){xFlagAutoYsupMargin = 0;
08810     h_his0->SetMinimum(fD_TNo_ChNbYmin); h_his0->SetMaximum(fD_TNo_ChNbYmax);}}
08811   
08812   if(HistoCode == "D_TNo_ChDs"){
08813     if(fD_TNo_ChDsYmin < fD_TNo_ChDsYmax){xFlagAutoYsupMargin = 0;
08814     h_his0->SetMinimum(fD_TNo_ChDsYmin); h_his0->SetMaximum(fD_TNo_ChDsYmax);}}
08815   
08816   if(HistoCode == "D_MCs_ChNb"){
08817     if(fD_MCs_ChNbYmin < fD_MCs_ChNbYmax){xFlagAutoYsupMargin = 0;
08818     h_his0->SetMinimum(fD_MCs_ChNbYmin); h_his0->SetMaximum(fD_MCs_ChNbYmax);}}
08819   
08820   if(HistoCode == "D_MCs_ChDs"){
08821     if(fD_MCs_ChDsYmin < fD_MCs_ChDsYmax){xFlagAutoYsupMargin = 0;
08822     h_his0->SetMinimum(fD_MCs_ChDsYmin); h_his0->SetMaximum(fD_MCs_ChDsYmax);}}
08823   
08824   if(HistoCode == "D_LFN_ChNb"){
08825     if(fD_LFN_ChNbYmin < fD_LFN_ChNbYmax){xFlagAutoYsupMargin = 0;
08826     h_his0->SetMinimum(fD_LFN_ChNbYmin); h_his0->SetMaximum(fD_LFN_ChNbYmax);}}
08827   
08828   if(HistoCode == "D_LFN_ChDs"){
08829     if(fD_LFN_ChDsYmin < fD_LFN_ChDsYmax){xFlagAutoYsupMargin = 0;
08830     h_his0->SetMinimum(fD_LFN_ChDsYmin); h_his0->SetMaximum(fD_LFN_ChDsYmax);}}
08831   
08832   if(HistoCode == "D_HFN_ChNb"){
08833     if(fD_HFN_ChNbYmin < fD_HFN_ChNbYmax){xFlagAutoYsupMargin = 0;
08834     h_his0->SetMinimum(fD_HFN_ChNbYmin); h_his0->SetMaximum(fD_HFN_ChNbYmax);}}
08835   
08836   if(HistoCode == "D_HFN_ChDs"){
08837     if(fD_HFN_ChDsYmin < fD_HFN_ChDsYmax){xFlagAutoYsupMargin = 0;
08838     h_his0->SetMinimum(fD_HFN_ChDsYmin); h_his0->SetMaximum(fD_HFN_ChDsYmax);}}
08839 
08840   if(HistoCode == "D_SCs_ChNb"){
08841     if(fD_SCs_ChNbYmin < fD_SCs_ChNbYmax){xFlagAutoYsupMargin = 0;
08842     h_his0->SetMinimum(fD_SCs_ChNbYmin); h_his0->SetMaximum(fD_SCs_ChNbYmax);}}
08843   
08844   if(HistoCode == "D_SCs_ChDs"){
08845     if(fD_SCs_ChDsYmin < fD_SCs_ChDsYmax){xFlagAutoYsupMargin = 0;
08846     h_his0->SetMinimum(fD_SCs_ChDsYmin); h_his0->SetMaximum(fD_SCs_ChDsYmax);}}
08847   
08848   if(HistoCode == "D_MSp_Samp"){
08849     if(fD_MSp_SampYmin < fD_MSp_SampYmax){xFlagAutoYsupMargin = 0;
08850     h_his0->SetMinimum(fD_MSp_SampYmin); h_his0->SetMaximum(fD_MSp_SampYmax);}}
08851   
08852   if(HistoCode == "D_SSp_Samp"){
08853     if(fD_SSp_SampYmin < fD_SSp_SampYmax){xFlagAutoYsupMargin = 0;
08854     h_his0->SetMinimum(fD_SSp_SampYmin); h_his0->SetMaximum(fD_SSp_SampYmax);}}
08855   
08856   if(HistoCode == "D_Adc_EvNb"){
08857     if(fD_Adc_EvNbYmin < fD_Adc_EvNbYmax){xFlagAutoYsupMargin = 0;
08858     h_his0->SetMinimum(fD_Adc_EvNbYmin); h_his0->SetMaximum(fD_Adc_EvNbYmax);}}
08859 
08860   if(HistoCode == "D_Adc_EvDs"){
08861     if(fD_Adc_EvDsYmin < fD_Adc_EvDsYmax){xFlagAutoYsupMargin = 0;
08862     h_his0->SetMinimum(fD_Adc_EvDsYmin); h_his0->SetMaximum(fD_Adc_EvDsYmax);}}
08863 
08864   if(HistoCode == "H2CorccInStins"){
08865     if(fH2CorccInStinsYmin < fH2CorccInStinsYmax){xFlagAutoYsupMargin = 0;
08866     h_his0->SetMinimum(fH2CorccInStinsYmin); h_his0->SetMaximum(fH2CorccInStinsYmax);}}
08867 
08868   if(HistoCode == "H2LFccMosMatrix"){
08869     if(fH2LFccMosMatrixYmin < fH2LFccMosMatrixYmax){xFlagAutoYsupMargin = 0;
08870     h_his0->SetMinimum(fH2LFccMosMatrixYmin); h_his0->SetMaximum(fH2LFccMosMatrixYmax);}}
08871 
08872   if(HistoCode == "H2HFccMosMatrix"){
08873     if(fH2HFccMosMatrixYmin < fH2HFccMosMatrixYmax){xFlagAutoYsupMargin = 0;
08874     h_his0->SetMinimum(fH2HFccMosMatrixYmin); h_his0->SetMaximum(fH2HFccMosMatrixYmax);}}
08875 
08876   if(HistoCode == "H_Ped_RuDs"){
08877     if(fH_Ped_RuDsYmin < fH_Ped_RuDsYmax){xFlagAutoYsupMargin = 0;
08878     h_his0->SetMinimum(fH_Ped_RuDsYmin); h_his0->SetMaximum(fH_Ped_RuDsYmax);}}
08879 
08880   if(HistoCode == "H_TNo_RuDs"){
08881     if(fH_TNo_RuDsYmin < fH_TNo_RuDsYmax){xFlagAutoYsupMargin = 0;
08882     h_his0->SetMinimum(fH_TNo_RuDsYmin); h_his0->SetMaximum(fH_TNo_RuDsYmax);}}
08883 
08884   if(HistoCode == "H_MCs_RuDs"){
08885     if(fH_MCs_RuDsYmin < fH_MCs_RuDsYmax){xFlagAutoYsupMargin = 0;
08886     h_his0->SetMinimum(fH_MCs_RuDsYmin); h_his0->SetMaximum(fH_MCs_RuDsYmax);}}
08887 
08888   if(HistoCode == "H_LFN_RuDs"){
08889     if(fH_LFN_RuDsYmin < fH_LFN_RuDsYmax){xFlagAutoYsupMargin = 0;
08890     h_his0->SetMinimum(fH_LFN_RuDsYmin); h_his0->SetMaximum(fH_LFN_RuDsYmax);}}
08891 
08892   if(HistoCode == "H_HFN_RuDs"){
08893     if(fH_HFN_RuDsYmin < fH_HFN_RuDsYmax){xFlagAutoYsupMargin = 0;
08894     h_his0->SetMinimum(fH_HFN_RuDsYmin); h_his0->SetMaximum(fH_HFN_RuDsYmax);}}
08895 
08896   if(HistoCode == "H_SCs_RuDs"){
08897     if(fH_SCs_RuDsYmin < fH_SCs_RuDsYmax){xFlagAutoYsupMargin = 0;
08898     h_his0->SetMinimum(fH_SCs_RuDsYmin); h_his0->SetMaximum(fH_SCs_RuDsYmax);}}
08899 
08900   return xFlagAutoYsupMargin;  
08901 } // end of  SetHistoFrameYminYmaxFromMemo
08902 
08903 Int_t TEcnaHistos::SetGraphFrameYminYmaxFromMemo(TGraph* g_graph0, const TString HistoCode)
08904 {
08905 // Set min and max according to HistoCode
08906   
08907   Int_t xFlagAutoYsupMargin = 1;    // DEFAULT: 1 = min and max calulated by ROOT, 0 = by this code 
08908 
08909   if(HistoCode == "H_Ped_Date"){
08910     if(fH_Ped_DateYmin < fH_Ped_DateYmax){xFlagAutoYsupMargin = 0;
08911     g_graph0->SetMinimum(fH_Ped_DateYmin); g_graph0->SetMaximum(fH_Ped_DateYmax);}}
08912 
08913   if(HistoCode == "H_TNo_Date"){
08914     if(fH_TNo_DateYmin < fH_TNo_DateYmax){xFlagAutoYsupMargin = 0;
08915     g_graph0->SetMinimum(fH_TNo_DateYmin); g_graph0->SetMaximum(fH_TNo_DateYmax);}}
08916 
08917   if(HistoCode == "H_MCs_Date"){
08918     if(fH_MCs_DateYmin < fH_MCs_DateYmax){xFlagAutoYsupMargin = 0;
08919     g_graph0->SetMinimum(fH_MCs_DateYmin); g_graph0->SetMaximum(fH_MCs_DateYmax);}}
08920 
08921   if(HistoCode == "H_LFN_Date"){
08922     if(fH_LFN_DateYmin < fH_LFN_DateYmax){xFlagAutoYsupMargin = 0;
08923     g_graph0->SetMinimum(fH_LFN_DateYmin); g_graph0->SetMaximum(fH_LFN_DateYmax);}}
08924 
08925   if(HistoCode == "H_HFN_Date"){
08926     if(fH_HFN_DateYmin < fH_HFN_DateYmax){xFlagAutoYsupMargin = 0;
08927     g_graph0->SetMinimum(fH_HFN_DateYmin); g_graph0->SetMaximum(fH_HFN_DateYmax);}}
08928 
08929   if(HistoCode == "H_SCs_Date"){
08930     if(fH_SCs_DateYmin < fH_SCs_DateYmax){xFlagAutoYsupMargin = 0;
08931     g_graph0->SetMinimum(fH_SCs_DateYmin); g_graph0->SetMaximum(fH_SCs_DateYmax);}}
08932 
08933   return xFlagAutoYsupMargin;  
08934 } // end of SetGraphFrameYminYmaxFromMemo
08935 
08936 //..............................................................................................
08937 Double_t TEcnaHistos::GetYminFromHistoFrameAndMarginValue(TH1D* h_his0, const Double_t margin_factor)
08938 {
08939 //Calculation for automatic minimum with margin
08940   Double_t minproj = h_his0->GetMinimum();
08941   Double_t maxproj = h_his0->GetMaximum();
08942   minproj = minproj - (maxproj-minproj)*margin_factor;
08943   return minproj;
08944 }
08945 
08946 Double_t TEcnaHistos::GetYmaxFromHistoFrameAndMarginValue(TH1D* h_his0, const Double_t margin_factor)
08947 {
08948 //Calculation for automatic maximum with margin
08949   Double_t minproj = h_his0->GetMinimum();
08950   Double_t maxproj = h_his0->GetMaximum();
08951   maxproj = maxproj + (maxproj-minproj)*margin_factor;
08952   return maxproj;
08953 }
08954 
08955 Double_t TEcnaHistos::GetYminFromGraphFrameAndMarginValue(TGraph* g_graph0, const Double_t margin_factor)
08956 {
08957 //Calculation for automatic minimum with margin
08958   Double_t graph_ymin = g_graph0->GetY()[0];
08959   for(Int_t i=1; i<g_graph0->GetN(); i++)
08960     {if( g_graph0->GetY()[i] < graph_ymin ){graph_ymin = g_graph0->GetY()[i];}}
08961 
08962   Double_t graph_ymax = g_graph0->GetY()[0];
08963   for(Int_t i=1; i<g_graph0->GetN(); i++)
08964     {if( g_graph0->GetY()[i] > graph_ymax ){graph_ymax = g_graph0->GetY()[i];}}
08965 
08966   graph_ymin = graph_ymin - (graph_ymax-graph_ymin)*margin_factor;
08967   return graph_ymin;
08968 }
08969 Double_t TEcnaHistos::GetYmaxFromGraphFrameAndMarginValue(TGraph* g_graph0, const Double_t margin_factor)
08970 {
08971 //Calculation for automatic maximum with margin
08972   Double_t graph_ymin = g_graph0->GetY()[0];
08973   for(Int_t i=1; i<g_graph0->GetN(); i++)
08974     {if( g_graph0->GetY()[i] < graph_ymin ){graph_ymin = g_graph0->GetY()[i];}}
08975 
08976   Double_t graph_ymax = g_graph0->GetY()[0];
08977   for(Int_t i=1; i<g_graph0->GetN(); i++)
08978     {if( g_graph0->GetY()[i] > graph_ymax ){graph_ymax = g_graph0->GetY()[i];}}
08979 
08980   graph_ymax = graph_ymax + (graph_ymax-graph_ymin)*margin_factor;
08981   return graph_ymax;
08982 }
08983 //----------------------------------------------- HistoPlot
08984 
08985 void TEcnaHistos::HistoPlot(TH1D* h_his0,               const Int_t&   HisSize,  
08986                             const Axis_t& xinf_his,     const Axis_t&  xsup_his,
08987                             const TString HistoCode,    const TString  HistoType,
08988                             const Int_t&  StexStin_A,   const Int_t&   i0StinEcha,  const Int_t& iSample, 
08989                             const Int_t&  opt_scale_x,  const Int_t&   opt_scale_y,
08990                             const TString opt_plot,     const Int_t&   xFlagAutoYsupMargin)
08991 {
08992   // Plot 1D histogram
08993 
08994   UInt_t canv_w = fCnaParHistos->SetCanvasWidth(HistoCode.Data(), opt_plot);
08995   UInt_t canv_h = fCnaParHistos->SetCanvasHeight(HistoCode.Data(), opt_plot);
08996 
08997   TString QuantityName = "                                ";
08998   Int_t MaxCar = fgMaxCar;
08999   QuantityName.Resize(MaxCar);
09000   QuantityName = fCnaParHistos->GetQuantityName(HistoCode.Data());
09001   SetHistoPresentation(h_his0, HistoType.Data(), opt_plot);    // (gStyle parameters)}
09002 
09003   //.................................................. prepa paves commentaires (HistoPlot)
09004   SetAllPavesViewHisto(HistoCode.Data(), StexStin_A, i0StinEcha, iSample, opt_plot.Data());
09005   
09006   //..................................................... Canvas name (HistoPlot) 
09007   TString canvas_name = SetCanvasName(HistoCode.Data(), opt_scale_x, opt_scale_y,
09008                                       opt_plot.Data(),  StexStin_A,  i0StinEcha,  iSample);
09009 
09010   //.................................... Canvas allocations (HistoPlot)
09011   TCanvas* MainCanvas = 0;
09012 
09013   if(opt_plot == fOnlyOnePlot)
09014     {MainCanvas = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w , canv_h);   fCnewRoot++;
09015     fCurrentPad = gPad; fCurrentCanvas = MainCanvas; fCurrentCanvasName = canvas_name.Data();}
09016   
09017   if( opt_plot == fSeveralPlot ||  opt_plot == fSameOnePlot)
09018     {if(GetMemoFlag(HistoCode, opt_plot) == "Free")
09019       {MainCanvas = CreateCanvas(HistoCode, opt_plot, canvas_name, canv_w, canv_h);
09020       fCurrentPad = gPad; fCurrentCanvas = MainCanvas; fCurrentCanvasName = canvas_name.Data();}}
09021 
09022   // cout << "*TEcnaHistos::HistoPlot(...)> Plot is displayed on canvas ----> " << canvas_name.Data() << endl;
09023 
09024   //--------------- EE => SC for construction, EB => Xtal in SM (default: Stin ECNA number, i0StinEcha)
09025   Int_t Stex_StinCons = StexStin_A;   // Stex_StinCons = Tower for EB, SC for construction for EE
09026   Int_t n1StexCrys    = i0StinEcha+1; // n1StexCrys = Crys in SM for EB, ECNA
09027 
09028   if( StexStin_A >= 1 && StexStin_A <= fEcal->MaxStinEcnaInStex() )
09029     {
09030       if( fFlagSubDet == "EB" )
09031         {n1StexCrys  = fEcalNumbering->Get1StexCrysFrom1StexStinAnd0StinEcha(StexStin_A, i0StinEcha, fFapStexNumber);}
09032       if( fFlagSubDet == "EE" )
09033         {Stex_StinCons = fEcalNumbering->GetDeeSCConsFrom1DeeSCEcna(fFapStexNumber, StexStin_A);}
09034     }
09035 
09036   //------ String for StexNumber ( to display "EB" or "EE" if Stex = 0 )
09037   TString sFapStexNumber = StexNumberToString(fFapStexNumber);
09038 
09039   //============================================================================= (HistoPlot)
09040   //
09041   //     1st  OPERATIONS:  Pave texts preparation and first Draw.
09042   //                       SetParametersCanvas
09043   //                       Set Memo Flags.
09044   //                       Set main_subpad and main_pavtxt
09045   //
09046   //=============================================================================
09047   TVirtualPad* main_subpad = 0; // main_subpad: Pad for the histo
09048   TPaveText*   main_pavtxt = 0; // Pave for the "Several Changing" parameters (options SAME and SAME n)
09049 
09050   Int_t xMemoPlotSame = 1; // a priori ==> SAME plot
09051 
09052   //========================================= Option ONLYONE    (HistoPlot)
09053   if(opt_plot == fOnlyOnePlot)
09054     {
09055       //.................................... Draw titles and paves (pad = main canvas)
09056       if( fPavComGeneralTitle != 0 ){fPavComGeneralTitle->Draw();}
09057       fPavComStex->Draw();
09058       if( !( HistoType == "Global" || HistoType == "Proj" ) ){fPavComStin->Draw(); fPavComXtal->Draw();}
09059 
09060       if( HistoType == "EvolProj" )
09061         {
09062           fPavComEvolRuns->Draw();
09063           fPavComEvolNbOfEvtsAna->Draw();
09064         }
09065       else
09066         {
09067           fPavComAnaRun->Draw();
09068           fPavComNbOfEvts->Draw();
09069         }
09070 
09071       Double_t x_low = fCnaParHistos->BoxLeftX("bottom_left_box")    - 0.005;
09072       Double_t x_up  = fCnaParHistos->BoxRightX("bottom_right_box")  + 0.005;
09073       Double_t y_low = fCnaParHistos->BoxTopY("bottom_right_box")    + 0.005;
09074       Double_t y_up  = fCnaParHistos->BoxBottomY("top_right_box_EB") - 0.005;
09075       Color_t  fond_pad = fCnaParHistos->ColorDefinition("blanc");
09076 
09077       Double_t x_margin = x_low;
09078       Double_t y_margin = y_low;
09079       MainCanvas->Divide( 1,  1, x_margin, y_margin, fond_pad);
09080       //           Divide(nx, ny, x_margin, y_margin,    color);
09081 
09082       gPad->cd(1);
09083       main_subpad = gPad;
09084       main_subpad->SetPad(x_low, y_low, x_up, y_up);
09085 
09086       xMemoPlotSame = 0;
09087     } // end of if(opt_plot == fOnlyOnePlot)
09088 
09089   //========================================= Options SAME and SAME n  (HistoPlot)
09090   if( (opt_plot == fSeveralPlot) || (opt_plot == fSameOnePlot) )
09091     {
09092       //..................... First call in options SAME and SAME n
09093       if( GetMemoFlag(HistoCode, opt_plot) == "Free" )
09094         {
09095           //Call to SetParametersPavTxt
09096           //fPavTxt<HISTOCODE> = fPavComSeveralChanging;  => come from SetAllPavesViewHisto
09097           SetParametersPavTxt(HistoCode, opt_plot);
09098 
09099           //---------------- Call to ActivePavTxt
09100           // main_pavtxt = fPavTxt<HISTOCODE>;} (return main_pavtxt)
09101           main_pavtxt = ActivePavTxt(HistoCode.Data(), opt_plot.Data());
09102 
09103           //---------------------------- Set texts for pave "several changing", options SAME and SAME n
09104           if( fPavComGeneralTitle != 0 ){fPavComGeneralTitle->Draw();}
09105 
09106           main_pavtxt->SetTextAlign(fTextPaveAlign);
09107           main_pavtxt->SetTextFont(fTextPaveFont);
09108           main_pavtxt->SetBorderSize(fTextBorderSize);
09109           Float_t cTextPaveSize  = 0.025;
09110           if( HistoType == "H1Basic" || HistoType == "SampProj" ||
09111               HistoType == "Proj"    || HistoType == "EvolProj"  )
09112             {cTextPaveSize = 0.025;}
09113           main_pavtxt->SetTextSize(cTextPaveSize);
09114 
09115           char* f_in = new char[fgMaxCar];                            fCnew++;
09116 
09117           //------------------------------------------------------------ titles pave "several" (HistoPlot)
09118           TString DecalStexName = "";
09119           if( fFlagSubDet == "EB" ){DecalStexName = " ";}
09120           TString DecalStinName = "";
09121           if( fFlagSubDet == "EE" ){DecalStinName = "   ";}
09122 
09123           TString sStexOrStasName = "";
09124           if( fFapStexNumber == 0 ){sStexOrStasName = "  ";}
09125           if( fFapStexNumber != 0 ){sStexOrStasName = fFapStexName;}
09126 
09127           if( opt_plot == fSeveralPlot || opt_plot == fSameOnePlot )
09128             {
09129               if( HistoType == "SampGlobal" )
09130                 {sprintf(f_in, "Analysis   Samp   RUN# (run type            )  Evts range  Nb Evts   %s%s %s%s %s Sample",
09131                          DecalStexName.Data(), sStexOrStasName.Data(),
09132                          DecalStinName.Data(), fFapStinName.Data(), fFapEchaName.Data());}
09133               if( HistoType == "SampProj" )
09134                 {sprintf(f_in, "Analysis   Samp   RUN# (run type            )  Evts range  Nb Evts   %s%s %s%s %s Sample",
09135                          DecalStexName.Data(), sStexOrStasName.Data(),
09136                          DecalStinName.Data(), fFapStinName.Data(), fFapEchaName.Data());}
09137               if( HistoType == "H1Basic" )
09138                 {sprintf(f_in, "Analysis   Samp   RUN# (run type            )  Evts range  Nb Evts   %s%s %s%s %s",
09139                          DecalStexName.Data(), sStexOrStasName.Data(),
09140                          DecalStinName.Data(), fFapStinName.Data(), fFapEchaName.Data());}
09141               if((HistoType == "Global") ||(HistoType == "Proj") )
09142                 {sprintf(f_in, "Analysis   Samp   RUN# (run type            )  Evts range  Nb Evts   %s%s",
09143                          DecalStexName.Data(), sStexOrStasName.Data());}
09144 
09145               if( HistoType == "EvolProj" )
09146                 {sprintf(f_in, "Analysis   Samp   Evts range  Nb Evts   %s%s  %s%s   %s",
09147                          DecalStexName.Data(), sStexOrStasName.Data(),
09148                          DecalStinName.Data(), fFapStinName.Data(), fFapEchaName.Data());}
09149             }
09150 
09151           TText* ttit = main_pavtxt->AddText(f_in);
09152           ttit->SetTextColor(fCnaParHistos->ColorDefinition("noir"));
09153           
09154           //------------------------------------------------------------ values pave "several" 
09155 
09156           //.................................... option SAME n only  (HistoPlot)
09157           if( opt_plot == fSameOnePlot)
09158             {
09159               if( (HistoType == "Global") || (HistoType == "Proj")  )
09160                 {
09161                   sprintf(f_in, "%-10s 1-%2d%7d (%-20s) %5d-%5d  %7d  %4s %-25s",
09162                           fFapAnaType.Data(), fFapNbOfSamples, fFapRunNumber, fRunType.Data(),
09163                           fFapFirstReqEvtNumber, fFapLastReqEvtNumber, fFapReqNbOfEvts,
09164                           sFapStexNumber.Data(), QuantityName.Data());
09165                 }
09166 
09167               if( HistoType == "EvolProj" )
09168                 {
09169                   sprintf(f_in, "%-10s 1-%2d %5d-%5d  %7d %5s%6d%7d %-25s",
09170                           fFapAnaType.Data(), fFapNbOfSamples, fFapFirstReqEvtNumber, fFapLastReqEvtNumber, fFapReqNbOfEvts,
09171                           sFapStexNumber.Data(), Stex_StinCons, n1StexCrys, QuantityName.Data());
09172                 }
09173               
09174             } // end of if for option SAME n only
09175 
09176           //..................................... option SAME
09177           if( opt_plot == fSeveralPlot )
09178             {
09179               Int_t kSample = iSample+1;  // Sample number range = [1,n<=10]
09180 
09181               if( HistoType == "SampGlobal" )
09182                 {
09183                   sprintf(f_in, "%-10s 1-%2d%7d (%-20s) %5d-%5d  %7d  %4s%6d%5d%6d",
09184                           fFapAnaType.Data(), fFapNbOfSamples, fFapRunNumber, fRunType.Data(),
09185                           fFapFirstReqEvtNumber, fFapLastReqEvtNumber, fFapReqNbOfEvts,sFapStexNumber.Data(),
09186                           Stex_StinCons, n1StexCrys, kSample);
09187                 }
09188               if( HistoType == "SampProj"  )
09189                 {
09190                   sprintf(f_in, "%-10s 1-%2d%7d (%-20s) %5d-%5d  %7d  %4s%6d%5d%6d",
09191                           fFapAnaType.Data(), fFapNbOfSamples, fFapRunNumber, fRunType.Data(),
09192                           fFapFirstReqEvtNumber, fFapLastReqEvtNumber, fFapReqNbOfEvts, sFapStexNumber.Data(),
09193                           Stex_StinCons, n1StexCrys, kSample);
09194                 }             
09195               if( HistoType == "H1Basic" )
09196                 {
09197                   sprintf(f_in, "%-10s 1-%2d%7d (%-20s) %5d-%5d  %7d  %4s%6d%5d",
09198                           fFapAnaType.Data(), fFapNbOfSamples, fFapRunNumber, fRunType.Data(),
09199                           fFapFirstReqEvtNumber, fFapLastReqEvtNumber, fFapReqNbOfEvts, sFapStexNumber.Data(),
09200                           Stex_StinCons, n1StexCrys);
09201                 }             
09202               if( (HistoType == "Global") || (HistoType == "Proj")  )
09203                 {
09204                   sprintf(f_in, "%-10s 1-%2d%7d (%-20s) %5d-%5d  %7d  %4s",
09205                           fFapAnaType.Data(), fFapNbOfSamples, fFapRunNumber,  fRunType.Data(),
09206                           fFapFirstReqEvtNumber, fFapLastReqEvtNumber, fFapReqNbOfEvts, sFapStexNumber.Data());
09207                 }
09208               
09209               if( HistoType == "EvolProj" )
09210                 {
09211                   sprintf(f_in, "%-10s 1-%2d  %5d-%5d  %7d  %4s%7d%7d",
09212                           fFapAnaType.Data(), fFapNbOfSamples,
09213                           fFapFirstReqEvtNumber, fFapLastReqEvtNumber, fFapReqNbOfEvts, sFapStexNumber.Data(), 
09214                           Stex_StinCons, n1StexCrys);
09215                 }
09216             }
09217           
09218           TText* tt = main_pavtxt->AddText(f_in);
09219           tt->SetTextColor(GetViewHistoColor(HistoCode, opt_plot));
09220           
09221           delete [] f_in;   f_in = 0;                                          fCdelete++;
09222 
09223           //---------------- Draw the "several changing" pave with its text in the Canvas (AT FIRST TIME)
09224           main_pavtxt->Draw();
09225           //---------------- Draw evol run pave if "EvolProj" (AT FIRST TIME)  
09226           if( HistoType == "EvolProj" ){fPavComEvolRuns->Draw();}
09227 
09228           //---------------- Call to SetParametersCanvas
09229           //fImp<HISTOCODE> = (TRootCanvas*)fCanv<HISTOCODE>->GetCanvasImp();
09230           //fCanv<HISTOCODE>->Divide(1, 1, x_margin_factor , y_margin_factor); gPad->cd(1);
09231           //fPad<HISTOCODE> = gPad;
09232           //fMemoPlot<HISTOCODE> = 1;          =======>  set MemoFlag to "Buzy"
09233           //fMemoColor<HISTOCODE> = 0;
09234           SetParametersCanvas(HistoCode, opt_plot);       
09235 
09236           //---------------- Set xMemoPlotSame to 0
09237           xMemoPlotSame = 0;
09238         }
09239       //-------- end of if( GetMemoFlag(HistoCode, opt_plot) == "Free" ) ----------  (HistoPlot)
09240       //.......... First and further calls in options SAME and SAME n (fMemoPlot<HISTOCODE> = 1)
09241       if(GetMemoFlag(HistoCode, opt_plot) == "Busy")
09242         {
09243           //---------------- Call to ActivePavTxt
09244           // main_pavtxt = fPavTxt<HISTOCODE>;} (return main_pavtxt)
09245           main_pavtxt = ActivePavTxt(HistoCode.Data(), opt_plot.Data());
09246           
09247           //---------------- Call to ActivePad
09248           //if( (TRootCanvas*)fCanv<HISTOCODE>->GetCanvasImp() == fImp<HISTOCODE> ){
09249           // main_subpad = fPad<HISTOCODE>;} (return main_subpad)
09250           main_subpad = ActivePad(HistoCode.Data(), opt_plot.Data());  // => return 0 if canvas has been closed
09251 
09252           //---------------- Recover pointer to the current canvas
09253           MainCanvas = GetCurrentCanvas(HistoCode.Data(), opt_plot.Data());
09254 
09255         }
09256     } // end of if( (opt_plot == fSeveralPlot) || (opt_plot == fSameOnePlot) )
09257 
09258   //============================================================================= (HistoPlot)
09259   //
09260   //     2nd  OPERATIONS: Write and Draw the parameter values in the
09261   //                      "several changing" pave (options SAME and SAME n)
09262   //                      and Draw Histo
09263   //=============================================================================
09264   if(main_subpad != 0)
09265     { 
09266       if( (opt_plot == fSeveralPlot) || (opt_plot == fSameOnePlot) )
09267         {
09268           //------------------------------------------------------------ values  
09269           if(xMemoPlotSame != 0)
09270             {
09271               // main_pavtxt = fPavComSeveralChanging = fPavTxt<HISTOCODE>
09272               main_pavtxt->SetTextAlign(fTextPaveAlign);
09273               main_pavtxt->SetTextFont(fTextPaveFont);
09274               main_pavtxt->SetBorderSize(fTextBorderSize);
09275               Float_t cTextPaveSize  = 0.025;
09276               if( HistoType == "H1Basic" || HistoType == "SampProj"
09277                   || HistoType == "Proj" || HistoType == "EvolProj" )
09278                 {cTextPaveSize = 0.025;}
09279               main_pavtxt->SetTextSize(cTextPaveSize);
09280               
09281               char* f_in = new char[fgMaxCar];                            fCnew++;
09282               
09283               if( opt_plot == fSameOnePlot )
09284                 {
09285                   if( (HistoType == "Global") || (HistoType == "Proj") )
09286                     {
09287                       sprintf(f_in, "%-10s 1-%2d%7d (%-20s) %5d-%5d  %7d  %4s %-25s",
09288                               fFapAnaType.Data(), fFapNbOfSamples, fFapRunNumber, fRunType.Data(),
09289                               fFapFirstReqEvtNumber, fFapLastReqEvtNumber, fFapReqNbOfEvts,
09290                               sFapStexNumber.Data(), QuantityName.Data());
09291                     }
09292 
09293                   if( HistoType == "EvolProj" )
09294                     {
09295                       sprintf(f_in, "%-10s 1-%2d %5d-%5d  %7d %5s%6d%7d %-25s",
09296                               fFapAnaType.Data(), fFapNbOfSamples,
09297                               fFapFirstReqEvtNumber, fFapLastReqEvtNumber, fFapReqNbOfEvts, sFapStexNumber.Data(),
09298                               Stex_StinCons, n1StexCrys, QuantityName.Data());
09299                     }
09300                 }
09301 
09302               if( opt_plot == fOnlyOnePlot || opt_plot == fSeveralPlot )
09303                 {
09304                   Int_t kSample = iSample+1;  // Sample number range = [1,n<=10] (HistoPlot)
09305 
09306                   if(HistoType == "SampGlobal" )
09307                     {
09308                       sprintf(f_in, "%-10s 1-%2d%7d (%-20s) %5d-%5d  %7d  %4s%6d%5d%6d",
09309                               fFapAnaType.Data(), fFapNbOfSamples, fFapRunNumber, fRunType.Data(),
09310                               fFapFirstReqEvtNumber, fFapLastReqEvtNumber, fFapReqNbOfEvts, sFapStexNumber.Data(),
09311                               Stex_StinCons, n1StexCrys, kSample);
09312                     }
09313                   if( HistoType == "SampProj" )
09314                     {
09315                       sprintf(f_in, "%-10s 1-%2d%7d (%-20s) %5d-%5d  %7d  %4s%6d%5d%6d",
09316                               fFapAnaType.Data(), fFapNbOfSamples, fFapRunNumber, fRunType.Data(),
09317                               fFapFirstReqEvtNumber, fFapLastReqEvtNumber, fFapReqNbOfEvts, sFapStexNumber.Data(),
09318                               Stex_StinCons, n1StexCrys, kSample);
09319                     }             
09320                   if(HistoType == "H1Basic"  )
09321                     {
09322                       sprintf(f_in, "%-10s 1-%2d%7d (%-20s) %5d-%5d  %7d  %4s%6d%5d",
09323                               fFapAnaType.Data(), fFapNbOfSamples, fFapRunNumber, fRunType.Data(),
09324                               fFapFirstReqEvtNumber, fFapLastReqEvtNumber, fFapReqNbOfEvts, sFapStexNumber.Data(),
09325                               Stex_StinCons, n1StexCrys);
09326                     }
09327                   if( (HistoType == "Global") || (HistoType == "Proj") )
09328                     {
09329                       sprintf(f_in, "%-10s 1-%2d%7d (%-20s) %5d-%5d  %7d  %4s",
09330                               fFapAnaType.Data(), fFapNbOfSamples, fFapRunNumber, fRunType.Data(),
09331                               fFapFirstReqEvtNumber, fFapLastReqEvtNumber, fFapReqNbOfEvts, sFapStexNumber.Data());
09332                     }
09333                   
09334                   if( HistoType == "EvolProj" )
09335                     {
09336                       sprintf(f_in, "%-10s 1-%2d  %5d-%5d  %7d  %4s%7d%7d",
09337                               fFapAnaType.Data(), fFapNbOfSamples,
09338                               fFapFirstReqEvtNumber, fFapLastReqEvtNumber, fFapReqNbOfEvts,
09339                               sFapStexNumber.Data(), Stex_StinCons, n1StexCrys);
09340                     }
09341                 }
09342                
09343               TText *tt = main_pavtxt->AddText(f_in);
09344               tt->SetTextColor(GetViewHistoColor(HistoCode, opt_plot));
09345               MainCanvas->cd(); gStyle->SetOptDate(0);
09346               main_pavtxt->Draw();
09347 
09348               delete [] f_in;   f_in = 0;                      fCdelete++;
09349             }
09350           
09351           main_subpad->cd();
09352           Double_t x_low = fCnaParHistos->BoxLeftX("bottom_left_box")   - 0.005;
09353           Double_t x_up  = fCnaParHistos->BoxRightX("bottom_right_box") + 0.005;
09354           Double_t y_low = fCnaParHistos->BoxTopY("several_plots_box")  + 0.005;
09355           Double_t y_up  = fCnaParHistos->BoxBottomY("general_comment") - 0.005;
09356           if( opt_plot == fSameOnePlot && HistoType == "EvolProj" )
09357             {y_up = fCnaParHistos->BoxBottomY("top_left_box_EB") - 0.005;}
09358           main_subpad->SetPad(x_low, y_low, x_up, y_up);          
09359         } // end of if( (opt_plot == fSeveralPlot) || (opt_plot == fSameOnePlot) )
09360 
09361       //............................................ Style      (HistoPlot)
09362       SetViewHistoColors(h_his0, HistoCode.Data(), opt_plot);
09363       //SetViewHistoMarkerAndLine(h_his0, HistoCode.Data(), opt_plot);
09364 
09365       //................................. Set axis titles
09366       TString axis_x_var_name = SetHistoXAxisTitle(HistoCode);
09367       TString axis_y_var_name = SetHistoYAxisTitle(HistoCode);
09368       h_his0->GetXaxis()->SetTitle(axis_x_var_name);
09369       h_his0->GetYaxis()->SetTitle(axis_y_var_name);
09370 
09371       Int_t lin_scale = 0;
09372       Int_t log_scale = 1;
09373       
09374       if(opt_scale_x == fOptScaleLinx){gPad->SetLogx(lin_scale);}
09375       if(opt_scale_x == fOptScaleLogx){gPad->SetLogx(log_scale);}
09376       if(opt_scale_y == fOptScaleLiny){gPad->SetLogy(lin_scale);}
09377       if(opt_scale_y == fOptScaleLogy){gPad->SetLogy(log_scale);}             
09378 
09379       //---------------------------------------------------------------- Draw histo     (HistoPlot)
09380       if(opt_plot == fOnlyOnePlot){h_his0->DrawCopy();}
09381               
09382       if(opt_plot == fSeveralPlot || opt_plot == fSameOnePlot)
09383         {
09384           if(xMemoPlotSame == 0){h_his0->DrawCopy();}
09385           if(xMemoPlotSame != 0){h_his0->DrawCopy("SAME");}
09386         }
09387       //----------------------------------------------------------------
09388 
09389       //.................... Horizontal line at y=0     (HistoPlot)
09390       if( !(  HistoCode == "D_Adc_EvDs" || HistoCode == "D_Adc_EvNb" ||
09391               HistoType == "Proj" || HistoType == "SampProj" || HistoType == "EvolProj"  ) )
09392         {
09393           Double_t yinf = h_his0->GetMinimum();
09394           Double_t ysup = h_his0->GetMaximum();
09395           if( yinf <= (Double_t)0. && ysup >= (Double_t)0. )
09396             {TLine* lin =  new TLine(0.,0.,(Double_t)HisSize, 0.);   fCnewRoot++;
09397             lin->Draw();}
09398         }
09399 
09400       if( (opt_plot == fOnlyOnePlot)
09401           || ( (opt_plot == fSeveralPlot || opt_plot == fSameOnePlot) && xMemoPlotSame == 0 ) )
09402         {
09403           Double_t yinf = (Double_t)h_his0->GetMinimum();
09404           Double_t ysup = (Double_t)h_his0->GetMaximum();
09405 
09406           if(xFlagAutoYsupMargin == 1)
09407             {
09408               if( yinf >= ysup ){yinf = (Double_t)0.; ysup += ysup;}  // ROOT default if ymin >= ymax
09409               Double_t MaxMarginFactor = (Double_t)0.05;    // frame top line = 5% above the maximum
09410               ysup += (ysup-yinf)*MaxMarginFactor;       // ROOT default if ymin < ymax
09411             }
09412           
09413           char* f_in = new char[fgMaxCar];               fCnew++;
09414 
09415           //.................... Vertical lines for Data sectors (EE Global plot only)
09416           if( fFlagSubDet == "EE" && fFapStexNumber == 0 )
09417             {
09418               //............................................................. Data Sectors      (HistoPlot)
09419               Color_t coul_DS = fCnaParHistos->ColorDefinition("noir");
09420               Int_t DeeOffset = 0;
09421               for(Int_t n1Dee=1; n1Dee<=4; n1Dee++)
09422                 {
09423                   if( n1Dee == 4 ){DeeOffset = 0;}
09424                   if( n1Dee == 3 ){DeeOffset =   fEcal->MaxSCForConsInDee();}   // 149
09425                   if( n1Dee == 2 ){DeeOffset = 2*fEcal->MaxSCForConsInDee();}   // 446
09426                   if( n1Dee == 1 ){DeeOffset = 3*fEcal->MaxSCForConsInDee();}   // 595
09427 
09428                   Double_t ydee = ysup + (ysup-yinf)/(Double_t)15.;
09429                   Double_t xBinDee = DeeOffset + fEcal->MaxSCForConsInDee()/(Double_t)2.;
09430                   sprintf( f_in, "D%d", n1Dee );
09431                   TText *text_Dee = new TText(xBinDee, ydee, f_in);  fCnewRoot++;
09432                   text_Dee->SetTextColor(coul_DS);
09433                   text_Dee->SetTextSize((Double_t)0.04);
09434                   text_Dee->Draw("SAME");
09435 
09436                   Double_t DSLabelOffset = (Double_t)12;
09437 
09438                   for(Int_t i=1; i<5; i++)
09439                     {
09440                       Int_t iDS = 0;
09441                       if( n1Dee == 1 ){iDS = i;}
09442                       if( n1Dee == 2 ){iDS = i+4;}
09443                       if( n1Dee == 3 ){iDS = i+5;}
09444                       if( n1Dee == 4 ){iDS = i+1;}
09445 
09446                       Double_t xBinDS = DeeOffset + (Double_t)GetDSOffset(n1Dee, iDS)/fEcal->MaxCrysInSC();
09447                       TLine* lin_DS = new TLine(xBinDS, yinf, xBinDS, ysup);   fCnewRoot++;
09448                       lin_DS->SetLineColor(coul_DS);
09449                       lin_DS->SetLineWidth(1);
09450                       lin_DS->SetLineStyle(2);
09451                       lin_DS->Draw();
09452 
09453                       if( n1Dee == 2 && i == 4 )
09454                         {
09455                           TLine* lin_DSp = new TLine(DeeOffset, yinf, DeeOffset, ysup);   fCnewRoot++;
09456                           lin_DSp->SetLineColor(coul_DS);
09457                           lin_DSp->SetLineWidth(1);
09458                           lin_DSp->SetLineStyle(2);
09459                           lin_DSp->Draw();
09460                         }
09461 
09462                       Double_t yds = ysup + (ysup-yinf)/(Double_t)50.;
09463                       Double_t xBinDSp = xBinDS + DSLabelOffset;
09464                       Int_t nDS = iDS;
09465 
09466                       sprintf( f_in, "S%d", nDS );
09467                       TText *text_DS = new TText(xBinDSp, yds, f_in);  fCnewRoot++;
09468                       text_DS->SetTextColor(coul_DS);
09469                       text_DS->SetTextSize((Double_t)0.03);
09470                       text_DS->Draw("SAME");
09471                       if( (n1Dee == 4 && i == 1) || (n1Dee == 2 && i == 4) )
09472                         {
09473                           if(n1Dee == 4){nDS = iDS-1;}
09474                           if(n1Dee == 2){nDS = iDS+1;}
09475                           sprintf( f_in, "S%d", nDS );
09476                           TText *text_DS = new TText(xBinDS-1.75*DSLabelOffset, yds, f_in);  fCnewRoot++;
09477                           text_DS->SetTextColor(coul_DS);
09478                           text_DS->SetTextSize((Double_t)0.03);
09479                           text_DS->Draw("SAME");
09480                         }
09481                     }
09482                 }
09483             }
09484 
09485           //........... Vertical lines for Data sectors and special SC's (EE only, Dee's Global plots)  (HistoPlot)
09486           if( fFlagSubDet == "EE" && fFapStexNumber > 0 )
09487             {
09488               if( HistoType == "Global" )
09489                 {
09490                   Double_t ytext = yinf - (ysup-yinf)/8.5;                
09491                   //............................................................. Data Sectors
09492                   Color_t coul_DS = fCnaParHistos->ColorDefinition("noir");
09493                   for(Int_t i=1; i<5; i++)
09494                     {
09495                       Int_t iDS = 0;
09496                       if( fFapStexNumber == 1 ){iDS = i;}
09497                       if( fFapStexNumber == 2 ){iDS = i+4;}
09498                       if( fFapStexNumber == 3 ){iDS = i+5;}
09499                       if( fFapStexNumber == 4 ){iDS = i+1;}
09500                       
09501                       Double_t xBinDS = (Double_t)GetDSOffset(fFapStexNumber, iDS);
09502                       TLine* lin_DS = new TLine(xBinDS, yinf, xBinDS, ysup);   fCnewRoot++;
09503                       lin_DS->SetLineColor(coul_DS);
09504                       lin_DS->SetLineWidth(2);
09505                       lin_DS->SetLineStyle(2);
09506                       lin_DS->Draw();
09507                       Double_t ytextds = ysup + (ysup-yinf)/30.;
09508                       Double_t xBinDSNumber =
09509                         xBinDS + fEcalNumbering->GetMaxSCInDS(iDS)*fEcal->MaxCrysInSC()/(Double_t)2.25;
09510                       sprintf( f_in, "S%d", iDS );
09511                       TText *text_DS = new TText(xBinDSNumber, ytextds, f_in);  fCnewRoot++;
09512                       text_DS->SetTextColor(coul_DS);
09513                       text_DS->SetTextSize((Double_t)0.04);
09514                       text_DS->Draw("SAME");
09515                       if( ( (fFapStexNumber == 1 || fFapStexNumber == 2 ) && i == 4 ) ||
09516                           ( (fFapStexNumber == 3 || fFapStexNumber == 4 ) && i == 1 ) )
09517                         {
09518                           Int_t iDSp = iDS;
09519                           if( i == 4 ){iDSp = iDS+1;}
09520                           if( i == 1 ){iDSp = iDS-1;}
09521                           sprintf( f_in, "S%d", iDSp);
09522                           Double_t xBinpDSNumber =
09523                             xBinDSNumber - fEcalNumbering->GetMaxSCInDS(iDS)*fEcal->MaxCrysInSC();
09524                           TText *text_DSp = new TText(xBinpDSNumber, ytextds, f_in);  fCnewRoot++;
09525                           text_DSp->SetTextColor(coul_DS);
09526                           text_DSp->SetTextSize((Double_t)0.04);
09527                           text_DSp->Draw("SAME");
09528                         }
09529                     }
09530                   //.............................................................. Vertical lines for SC's
09531                   //                                                       Trop serre. A garder en reserve.
09532                   //for(Int_t i=0; i<fEcal->MaxSCForConsInDee(); i++)
09533                   //  {
09534                   //    Double_t xBinSC =(Double_t)(fEcal->MaxCrysInSC()*i);
09535                   //    TLine* lin_SC = new TLine(xBinSC, yinf, xBinSC, ysup);  fCnewRoot++;
09536                   //    lin_SC->SetLineColor(coul_DS);
09537                   //    lin_SC->SetLineStyle(3);
09538                   //    lin_SC->Draw();
09539                   //  }
09540                   //............................................................... Not connected SC's
09541                   Color_t coul_notconnected = fCnaParHistos->ColorDefinition("bleu_fonce");
09542                   for(Int_t i=1; i<=fEcal->NumberOfNotConnectedSCs(); i++)
09543                     {
09544                       Int_t index = 0;
09545                       if( fFapStexNumber == 1 || fFapStexNumber == 3 ){index = 2*i - 1;}
09546                       if( fFapStexNumber == 2 || fFapStexNumber == 4 ){index = 2*i;}
09547                       //................. display of the not connected SC's numbers (+ vertical line)
09548                       Double_t xBinNotConnectedSC = NotConnectedSCH1DBin(index);
09549                       TLine* lin_notconnected =
09550                         new TLine(xBinNotConnectedSC, yinf, xBinNotConnectedSC, ysup);  fCnewRoot++;
09551                       lin_notconnected->SetLineColor(coul_notconnected);
09552                       lin_notconnected->SetLineStyle(3);
09553                       lin_notconnected->Draw();
09554                       
09555                       Double_t xBinNotConnectedSCEnd = NotConnectedSCH1DBin(index)+fEcal->MaxCrysInSC();
09556                       TLine* lin_notconnected_end =
09557                         new TLine(xBinNotConnectedSCEnd, yinf, xBinNotConnectedSCEnd, ysup); fCnewRoot++;
09558                       lin_notconnected_end->SetLineColor(coul_notconnected);
09559                       lin_notconnected_end->SetLineStyle(3);
09560                       lin_notconnected_end->Draw();
09561                       
09562                       //sprintf( f_in, "%d", GetNotConnectedSCForConsFromIndex(index) );
09563                       sprintf( f_in, "%d", GetNotConnectedDSSCFromIndex(index) );
09564                       TText *text_SC_NotConnected = new TText(xBinNotConnectedSC, ytext, f_in);  fCnewRoot++;
09565                       text_SC_NotConnected->SetTextAngle((Double_t)45.);
09566                       text_SC_NotConnected->SetTextColor(coul_notconnected);
09567                       text_SC_NotConnected->SetTextFont(42);
09568                       text_SC_NotConnected->SetTextSize((Double_t)0.03);
09569                       text_SC_NotConnected->Draw("SAME");
09570                     }
09571                   //Double_t xtext = xinf_his - (xsup_his-xinf_his)/8.;
09572                   //Double_t ytextp = yinf - (ysup-yinf)/6.;
09573                   //sprintf( f_in, "Special SC => ");
09574                   //TText *text_legend_NotConnected = new TText(xtext, ytext, f_in);  fCnewRoot++;
09575                   //text_legend_NotConnected->SetTextColor(coul_notconnected);
09576                   //text_legend_NotConnected->SetTextSize((Double_t)0.03);
09577                   //text_legend_NotConnected->Draw("SAME");
09578                   
09579                   //............................................................... Not complete SC's
09580                   Color_t coul_notcomplete = fCnaParHistos->ColorDefinition("rouge40");
09581                   for(Int_t i=1; i<=fEcal->NumberOfNotCompleteSCs(); i++)
09582                     {
09583                       Int_t index = 0;
09584                       if( fFapStexNumber == 1 || fFapStexNumber == 3 ){index = 2*i - 1;}
09585                       if( fFapStexNumber == 2 || fFapStexNumber == 4 ){index = 2*i;}
09586                       //................. display of the not complete SC's numbers (+ vertical line)
09587                       Double_t xBinNotCompleteSC = NotCompleteSCH1DBin(index);
09588                       TLine* lin_notcomplete =
09589                         new TLine(xBinNotCompleteSC, yinf, xBinNotCompleteSC, ysup);   fCnewRoot++;
09590                       lin_notcomplete->SetLineColor(coul_notcomplete);
09591                       lin_notcomplete->SetLineStyle(3);
09592                       lin_notcomplete->Draw();
09593                       
09594                       Double_t xBinNotCompleteSCEnd = NotCompleteSCH1DBin(index)+fEcal->MaxCrysInSC();;
09595                       TLine* lin_notcomplete_end =
09596                         new TLine(xBinNotCompleteSCEnd, yinf, xBinNotCompleteSCEnd, ysup);   fCnewRoot++;
09597                       lin_notcomplete_end->SetLineColor(coul_notcomplete);
09598                       lin_notcomplete_end->SetLineStyle(3);
09599                       lin_notcomplete_end->Draw();
09600 
09601                       sprintf( f_in, "%d", GetNotCompleteDSSCFromIndex(index) );
09602                       // sprintf( f_in, "%d", GetNotCompleteSCForConsFromIndex(index) );
09603                       TText *text_SC_NotComplete = new TText(xBinNotCompleteSC, ytext, f_in);  fCnewRoot++;
09604                       text_SC_NotComplete->SetTextAngle((Double_t)45.);
09605                       text_SC_NotComplete->SetTextColor(coul_notcomplete);
09606                       text_SC_NotComplete->SetTextFont(42);
09607                       text_SC_NotComplete->SetTextSize((Double_t)0.03);
09608                       text_SC_NotComplete->Draw("SAME");
09609                     }
09610                   //Double_t xtextp = xinf_his + (xsup_his-xinf_his)/15.;
09611                   //sprintf( f_in, "Not complete SC");
09612                   //TText *text_legend_NotComplete = new TText(xtextp, ytextp, f_in);  fCnewRoot++;
09613                   //text_legend_NotComplete->SetTextColor(coul_notcomplete);
09614                   //text_legend_NotComplete->SetTextSize((Double_t)0.03);
09615                   //text_legend_NotComplete->Draw("SAME");
09616                 }
09617             }
09618           delete [] f_in;   f_in = 0;                      fCdelete++;
09619         }
09620 
09621       //..............................................Top Axis (HistoPlot)
09622       Int_t min_value = 0;
09623       Int_t max_value = 0;
09624       if(HistoType == "Global")
09625         {
09626           if( fFapStexNumber > 0 )
09627             {
09628               //.......................... Axis for the Stin numbers and Data sectors (EE) numbers
09629               if( fFlagSubDet == "EB" )
09630                 {
09631                   min_value = 0;
09632                   max_value = fEcal->MaxStinEcnaInStex() - 1;
09633                 }
09634               if( fFlagSubDet == "EE" )
09635                 {
09636                   if( fFapStexNumber == 1 ){min_value = 1; max_value = 5;}
09637                   if( fFapStexNumber == 2 ){min_value = 5; max_value = 9;}
09638                   if( fFapStexNumber == 3 ){min_value = 5; max_value = 9;}
09639                   if( fFapStexNumber == 4 ){min_value = 1; max_value = 5;}
09640                 }
09641             }
09642           if( fFapStexNumber == 0 )
09643             {
09644               //.......................... Axis for the SM (EB) and Dee numbers (EE)
09645               if( fFlagSubDet == "EB" )
09646                 {
09647                   min_value = 0; 
09648                   max_value = fEcal->MaxStexInStas() - 1;
09649                 }
09650               if( fFlagSubDet == "EE" )
09651                 {
09652                   min_value = 1; 
09653                   max_value = fEcal->MaxStexInStas();
09654                 }
09655             }
09656           TopAxisForHistos(h_his0, opt_plot, xMemoPlotSame, min_value, max_value,
09657                            xFlagAutoYsupMargin, HisSize);
09658         }
09659       gPad->Update();
09660     }
09661   else    // else du if(main_subpad !=0)
09662     {
09663       cout << "*TEcnaHistos::HistoPlot(...)> Canvas not found. Previously closed in option SAME."
09664            << fTTBELL << endl;
09665 
09666       ReInitCanvas(HistoCode, opt_plot);
09667       xMemoPlotSame = 0;
09668     }
09669 
09670   //  delete MainCanvas;                  fCdeleteRoot++;
09671 
09672 } // end of HistoPlot
09673 
09674 
09675 TString TEcnaHistos::StexNumberToString(const Int_t& StexNumber)
09676 {
09677   // Convert Int_t StexNumber into TString: "StexNumber" if StexNumber in [-18,36]
09678   // or into TString: "EB" or "EE" if StexNumber = 0. 
09679 
09680   TString sFapStexNumber = "?";
09681   if( StexNumber ==  -1 ){sFapStexNumber = " -1";}
09682   if( StexNumber ==  -2 ){sFapStexNumber = " -2";}
09683   if( StexNumber ==  -3 ){sFapStexNumber = " -3";}
09684   if( StexNumber ==  -4 ){sFapStexNumber = " -4";}
09685   if( StexNumber ==  -5 ){sFapStexNumber = " -5";}
09686   if( StexNumber ==  -6 ){sFapStexNumber = " -6";}
09687   if( StexNumber ==  -7 ){sFapStexNumber = " -7";}
09688   if( StexNumber ==  -8 ){sFapStexNumber = " -8";}
09689   if( StexNumber ==  -9 ){sFapStexNumber = " -9";}
09690   if( StexNumber == -10 ){sFapStexNumber = "-10";}
09691   if( StexNumber == -11 ){sFapStexNumber = "-11";}
09692   if( StexNumber == -12 ){sFapStexNumber = "-12";}
09693   if( StexNumber == -13 ){sFapStexNumber = "-13";}
09694   if( StexNumber == -14 ){sFapStexNumber = "-14";}
09695   if( StexNumber == -15 ){sFapStexNumber = "-15";}
09696   if( StexNumber == -16 ){sFapStexNumber = "-16";}
09697   if( StexNumber == -17 ){sFapStexNumber = "-17";}
09698   if( StexNumber == -18 ){sFapStexNumber = "-18";}
09699   if( StexNumber ==  0 ){sFapStexNumber = fFlagSubDet;}
09700   if( StexNumber ==  1 ){sFapStexNumber = "  1";}
09701   if( StexNumber ==  2 ){sFapStexNumber = "  2";}
09702   if( StexNumber ==  3 ){sFapStexNumber = "  3";}
09703   if( StexNumber ==  4 ){sFapStexNumber = "  4";}
09704   if( StexNumber ==  5 ){sFapStexNumber = "  5";}
09705   if( StexNumber ==  6 ){sFapStexNumber = "  6";}
09706   if( StexNumber ==  7 ){sFapStexNumber = "  7";}
09707   if( StexNumber ==  8 ){sFapStexNumber = "  8";}
09708   if( StexNumber ==  9 ){sFapStexNumber = "  9";}
09709   if( StexNumber == 10 ){sFapStexNumber = " 10";}
09710   if( StexNumber == 11 ){sFapStexNumber = " 11";}
09711   if( StexNumber == 12 ){sFapStexNumber = " 12";}
09712   if( StexNumber == 13 ){sFapStexNumber = " 13";}
09713   if( StexNumber == 14 ){sFapStexNumber = " 14";}
09714   if( StexNumber == 15 ){sFapStexNumber = " 15";}
09715   if( StexNumber == 16 ){sFapStexNumber = " 16";}
09716   if( StexNumber == 17 ){sFapStexNumber = " 17";}
09717   if( StexNumber == 18 ){sFapStexNumber = " 18";}
09718   if( StexNumber == 19 ){sFapStexNumber = " -1";}
09719   if( StexNumber == 20 ){sFapStexNumber = " -2";}
09720   if( StexNumber == 21 ){sFapStexNumber = " -3";}
09721   if( StexNumber == 22 ){sFapStexNumber = " -4";}
09722   if( StexNumber == 23 ){sFapStexNumber = " -5";}
09723   if( StexNumber == 24 ){sFapStexNumber = " -6";}
09724   if( StexNumber == 25 ){sFapStexNumber = " -7";}
09725   if( StexNumber == 26 ){sFapStexNumber = " -8";}
09726   if( StexNumber == 27 ){sFapStexNumber = " -9";}
09727   if( StexNumber == 28 ){sFapStexNumber = "-10";}
09728   if( StexNumber == 29 ){sFapStexNumber = "-11";}
09729   if( StexNumber == 30 ){sFapStexNumber = "-12";}
09730   if( StexNumber == 31 ){sFapStexNumber = "-13";}
09731   if( StexNumber == 32 ){sFapStexNumber = "-14";}
09732   if( StexNumber == 33 ){sFapStexNumber = "-15";}
09733   if( StexNumber == 34 ){sFapStexNumber = "-16";}
09734   if( StexNumber == 35 ){sFapStexNumber = "-17";}
09735   if( StexNumber == 36 ){sFapStexNumber = "-18";}
09736   return sFapStexNumber;
09737 }
09738 
09739 Double_t TEcnaHistos::NotConnectedSCH1DBin(const Int_t& index)
09740 {
09741   // gives the x coordinate for the i_th NotConnected SC
09742   // GetDSOffset(DeeNumber, DataSector) , GetSCOffset(DeeNumber, DataSector, SC_in_DS)
09743 
09744   Double_t xbin = (Double_t)(-1);
09745 
09746   if( index ==  1 ){xbin = GetDSOffset(1,1)+GetSCOffset(1,1, 30);}  // nb_for_cons == 182  (D1,S1) (D3,S9)
09747   if( index ==  2 ){xbin = GetDSOffset(2,9)+GetSCOffset(2,9, 30);}  // nb_for_cons ==  33  (D2,S9) (D4,S1)
09748 
09749   if( index ==  3 ){xbin = GetDSOffset(1,2)+GetSCOffset(1,2,  3);}  // nb_for_cons == 178  (D1,S2) (D3,S8)
09750   if( index ==  4 ){xbin = GetDSOffset(2,8)+GetSCOffset(2,8,  3);}  // nb_for_cons ==  29  (D2,S8) (D4,S2)
09751 
09752   if( index ==  5 ){xbin = GetDSOffset(1,2)+GetSCOffset(1,2, 25);}  // nb_for_cons == 207  (D1,S2) (D3,S8)
09753   if( index ==  6 ){xbin = GetDSOffset(2,8)+GetSCOffset(2,8, 25);}  // nb_for_cons ==  58  (D2,S8) (D4,S2)
09754 
09755   if( index ==  7 ){xbin = GetDSOffset(1,3)+GetSCOffset(1,3, 34);}  // nb_for_cons == 298  (D1,S3) (D3,S7) 
09756   if( index ==  8 ){xbin = GetDSOffset(2,7)+GetSCOffset(2,7, 34);}  // nb_for_cons == 149  (D2,S7) (D4,S3)
09757 
09758   if( index ==  9 ){xbin = GetDSOffset(1,4)+GetSCOffset(1,4, 14);}  // nb_for_cons == 261  (D1,S4) (D3,S6)
09759   if( index == 10 ){xbin = GetDSOffset(2,6)+GetSCOffset(2,6, 14);}  // nb_for_cons == 112  (D2,S6) (D4,S4)
09760   if( index == 11 ){xbin = GetDSOffset(1,4)+GetSCOffset(1,4, 21);}  // nb_for_cons == 268  (D1,S4) (D3,S6)
09761   if( index == 12 ){xbin = GetDSOffset(2,6)+GetSCOffset(2,6, 21);}  // nb_for_cons == 119  (D2,S6) (D4,S4)
09762 
09763   if( index == 13 ){xbin = GetDSOffset(1,5)+GetSCOffset(1,5, 20);}  // nb_for_cons == 281  (D1,S5) (D3,S5)
09764   if( index == 14 ){xbin = GetDSOffset(2,5)+GetSCOffset(2,5,  3);}  // nb_for_cons == 132  (D2,S5) (D4,S5)
09765 
09766   return xbin;
09767 }
09768 
09769 Double_t TEcnaHistos::NotCompleteSCH1DBin(const Int_t& index)
09770 {
09771   // gives the x coordinate for the i_th NotConnected SC
09772 
09773   Double_t xbin = (Double_t)(-1);
09774 
09775   if( index ==  1 ){xbin = GetDSOffset(1,1)+GetSCOffset(1,1, 12);}  // nb_for_cons == 161  (D1,S1) (D3,S9)
09776   if( index ==  2 ){xbin = GetDSOffset(2,9)+GetSCOffset(2,9, 12);}  // nb_for_cons ==  12  (D2,S9) (D4,S1)
09777 
09778   if( index ==  3 ){xbin = GetDSOffset(1,2)+GetSCOffset(1,2, 32);}  // nb_for_cons == 216  (D1,S2) (D3,S8)
09779   if( index ==  4 ){xbin = GetDSOffset(2,8)+GetSCOffset(2,8, 32);}  // nb_for_cons ==  67  (D2,S8) (D4,S2)
09780 
09781   if( index ==  5 ){xbin = GetDSOffset(1,3)+GetSCOffset(1,3, 10);}  // nb_for_cons == 224  (D1,S3) (D3,S7) 
09782   if( index ==  6 ){xbin = GetDSOffset(2,7)+GetSCOffset(2,7, 10);}  // nb_for_cons ==  75  (D2,S7) (D4,S3)
09783 
09784   if( index ==  7 ){xbin = GetDSOffset(1,5)+GetSCOffset(1,5, 23);}  // nb_for_cons == 286  (D1,S5) (D3,S5)
09785   if( index ==  8 ){xbin = GetDSOffset(2,5)+GetSCOffset(2,5,  6);}  // nb_for_cons == 137  (D2,S5) (D4,S5)
09786 
09787   return xbin;
09788 }
09789 
09790 Int_t TEcnaHistos::GetNotConnectedSCForConsFromIndex(const Int_t& index)
09791 {
09792 
09793   Int_t SCForCons = 0;
09794   if( index ==  1 ){SCForCons = 182;} // (D1,S1) (D3,S9)
09795   if( index ==  2 ){SCForCons =  33;} // (D2,S9) (D4,S1)
09796 
09797   if( index ==  3 ){SCForCons = 178;} // (D1,S2) (D3,S8)
09798   if( index ==  4 ){SCForCons =  29;} // (D2,S8) (D4,S2)
09799   if( index ==  5 ){SCForCons = 207;} // (D1,S2) (D3,S8)
09800   if( index ==  6 ){SCForCons =  58;} // (D2,S8) (D4,S2)
09801 
09802   if( index ==  7 ){SCForCons = 298;} // (D1,S3) (D3,S7) 
09803   if( index ==  8 ){SCForCons = 149;} // (D2,S7) (D4,S3)
09804 
09805   if( index ==  9 ){SCForCons = 261;} // (D1,S4) (D3,S6)
09806   if( index == 10 ){SCForCons = 112;} // (D2,S6) (D4,S4)
09807   if( index == 11 ){SCForCons = 268;} // (D1,S4) (D3,S6)
09808   if( index == 12 ){SCForCons = 119;} // (D2,S6) (D4,S4)
09809 
09810   if( index == 13 ){SCForCons = 281;} // (D1,S5) (D3,S5)
09811   if( index == 14 ){SCForCons = 132;} // (D2,S5) (D4,S5)
09812   return SCForCons;
09813 }
09814 
09815 Int_t TEcnaHistos::GetNotConnectedDSSCFromIndex(const Int_t& index)
09816 {
09817 
09818   Int_t DSSC = 0;
09819   if( index ==  1 ){DSSC =  30;} // (D1,S1) (D3,S9)
09820   if( index ==  2 ){DSSC =  30;} // (D2,S9) (D4,S1)
09821 
09822   if( index ==  3 ){DSSC =   3;} // (D1,S2) (D3,S8)
09823   if( index ==  4 ){DSSC =   3;} // (D2,S8) (D4,S2)
09824   if( index ==  5 ){DSSC =  25;} // (D1,S2) (D3,S8)
09825   if( index ==  6 ){DSSC =  25;} // (D2,S8) (D4,S2)
09826 
09827   if( index ==  7 ){DSSC =  34;} // (D1,S3) (D3,S7) 
09828   if( index ==  8 ){DSSC =  34;} // (D2,S7) (D4,S3)
09829 
09830   if( index ==  9 ){DSSC =  14;} // (D1,S4) (D3,S6)
09831   if( index == 10 ){DSSC =  14;} // (D2,S6) (D4,S4)
09832   if( index == 11 ){DSSC =  21;} // (D1,S4) (D3,S6)
09833   if( index == 12 ){DSSC =  21;} // (D2,S6) (D4,S4)
09834 
09835   if( index == 13 ){DSSC =  20;} // (D1,S5) (D3,S5)
09836   if( index == 14 ){DSSC =   3;} // (D2,S5) (D4,S5)
09837   return DSSC;
09838 }
09839 
09840 
09841 Int_t TEcnaHistos::GetNotCompleteSCForConsFromIndex(const Int_t& index)
09842 {
09843 
09844   Int_t DSSC = 0;
09845   if( index ==  1 ){DSSC =  161;} // (D1,S1) (D3,S9)
09846   if( index ==  2 ){DSSC =   12;} // (D2,S9) (D4,S1)
09847 
09848   if( index ==  3 ){DSSC =  216;} // (D1,S2) (D3,S8)
09849   if( index ==  4 ){DSSC =   67;} // (D2,S8) (D4,S2)
09850 
09851   if( index ==  5 ){DSSC =  224;} // (D1,S3) (D3,S7) 
09852   if( index ==  6 ){DSSC =   75;} // (D2,S7) (D4,S3)
09853 
09854   if( index ==  7 ){DSSC =  286;} // (D1,S5) (D3,S5)
09855   if( index ==  8 ){DSSC =  137;} // (D2,S5) (D4,S5)
09856   return DSSC;
09857 }
09858 
09859 Int_t TEcnaHistos::GetNotCompleteDSSCFromIndex(const Int_t& index)
09860 {
09861 
09862   Int_t DSSC = 0;
09863   if( index ==  1 ){DSSC =  12;} // (D1,S1) (D3,S9)
09864   if( index ==  2 ){DSSC =  12;} // (D2,S9) (D4,S1)
09865 
09866   if( index ==  3 ){DSSC =  32;} // (D1,S2) (D3,S8)
09867   if( index ==  4 ){DSSC =  32;} // (D2,S8) (D4,S2)
09868 
09869   if( index ==  5 ){DSSC =  10;} // (D1,S3) (D3,S7) 
09870   if( index ==  6 ){DSSC =  10;} // (D2,S7) (D4,S3)
09871 
09872   if( index ==  7 ){DSSC =  23;} // (D1,S5) (D3,S5)
09873   if( index ==  8 ){DSSC =   6;} // (D2,S5) (D4,S5)
09874   return DSSC;
09875 }
09876 //----------------------------------------------- HistimePlot
09877 void TEcnaHistos::HistimePlot(TGraph*       g_graph0, 
09878                               Axis_t        xinf,        Axis_t        xsup,
09879                               const TString HistoCode,   const TString HistoType,
09880                               const Int_t&  StexStin_A,  const Int_t&  i0StinEcha,    const Int_t& iSample, 
09881                               const Int_t&  opt_scale_x, const Int_t& opt_scale_y,
09882                               const TString opt_plot,    const Int_t&  xFlagAutoYsupMargin)
09883 {
09884   // Plot 1D histogram for evolution in time
09885 
09886   UInt_t canv_w = fCnaParHistos->SetCanvasWidth(HistoCode, opt_plot);
09887   UInt_t canv_h = fCnaParHistos->SetCanvasHeight(HistoCode, opt_plot);
09888 
09889   SetGraphPresentation(g_graph0, HistoType.Data(), opt_plot.Data());   // (gStyle parameters)}
09890   
09891   //...................................................... paves commentaires (HistimePlot)      
09892   SetAllPavesViewHisto(HistoCode, StexStin_A, i0StinEcha, iSample, opt_plot);
09893   
09894   //..................................................... Canvas name (HistimePlot) 
09895   TString canvas_name = SetCanvasName(HistoCode.Data(), opt_scale_x, opt_scale_y, opt_plot,
09896                                       StexStin_A,       i0StinEcha,  iSample);
09897           
09898   //------------------------------------------------ Canvas allocation  (HistimePlot)
09899   //......................................... declarations canvas et pad
09900   TCanvas*  MainCanvas = 0;
09901 
09902   if( opt_plot == fOnlyOnePlot )
09903     {MainCanvas = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w , canv_h);   fCnewRoot++;
09904     fCurrentPad = gPad; fCurrentCanvas = MainCanvas; fCurrentCanvasName = canvas_name.Data();}
09905   
09906   if( opt_plot == fSeveralPlot )
09907     {
09908       if(GetMemoFlag(HistoCode, opt_plot) == "Free")
09909         {
09910           MainCanvas = CreateCanvas(HistoCode, opt_plot, canvas_name, canv_w, canv_h);
09911           fCurrentPad = gPad; fCurrentCanvas = MainCanvas; fCurrentCanvasName = canvas_name.Data();
09912         }
09913     }
09914   
09915   if( opt_plot == fSameOnePlot )
09916     {
09917       if(GetMemoFlag(HistoCode, opt_plot) == "Free")
09918         {
09919           MainCanvas = CreateCanvas(HistoCode, opt_plot, canvas_name, canv_w, canv_h);
09920           fCurrentPad = gPad; fCurrentCanvas = MainCanvas; fCurrentCanvasName = canvas_name.Data();
09921         }
09922     }
09923   
09924   // cout << "*TEcnaHistos::HistimePlot(...)> Plot is displayed on canvas ----> " << canvas_name.Data() << endl;
09925 
09926   //--------------- EE => SC for construction, EB => Xtal in SM (default: Stin ECNA number, i0StinEcha)
09927   Int_t Stex_StinCons = StexStin_A;   // Stex_StinCons = Tower for EB, SC for construction for EE
09928   Int_t n1StexCrys    = i0StinEcha+1; // n1StexCrys = Crys in SM for EB
09929 
09930   if( StexStin_A >= 1 && StexStin_A <= fEcal->MaxStinEcnaInStex() )
09931     {
09932       if( fFlagSubDet == "EB" )
09933         {n1StexCrys  = fEcalNumbering->Get1StexCrysFrom1StexStinAnd0StinEcha(StexStin_A, i0StinEcha, fFapStexNumber);}
09934       if( fFlagSubDet == "EE" )
09935         {Stex_StinCons = fEcalNumbering->GetDeeSCConsFrom1DeeSCEcna(fFapStexNumber, StexStin_A);}
09936     }
09937 
09938   //------ String for StexNumber ( to display "EB" or "EE" if Stex = 0 )
09939   TString sFapStexNumber = StexNumberToString(fFapStexNumber);
09940 
09941   //============================================================================= (HistimePlot)
09942   //
09943   //     1st  OPERATIONS:  Pave texts preparation and first Draw.
09944   //                       SetParametersCanvas
09945   //                       Set Memo Flags.
09946   //                       Set main_subpad and main_pavtxt
09947   //
09948   //=============================================================================
09949   TVirtualPad* main_subpad = 0;  //      main_subpad: Pad for the histo
09950   TPaveText*   main_pavtxt = 0;  //      main_pavtxt: pave for changing parameters
09951 
09952   Int_t xMemoPlotSame = 1;   // a priori ==> SAME plot 
09953 
09954   TString QuantityName = fCnaParHistos->GetQuantityName(HistoCode.Data());
09955 
09956   //========================================= Option ONLYONE    (HistimePlot)
09957   if( opt_plot == fOnlyOnePlot )
09958     {
09959       //................................. Draw titles and paves (pad = main canvas)
09960       if( fPavComGeneralTitle != 0 ){fPavComGeneralTitle->Draw();}
09961       fPavComStex->Draw();
09962 
09963       if( !( HistoType == "Global"  || HistoType == "Proj" ) )
09964         {
09965           fPavComStin->Draw();
09966           fPavComXtal->Draw();
09967         }
09968       fPavComEvolNbOfEvtsAna->Draw();
09969       fPavComEvolRuns->Draw();
09970 
09971       Double_t x_low = fCnaParHistos->BoxLeftX("bottom_left_box")   - 0.005;
09972       Double_t x_up  = fCnaParHistos->BoxRightX("bottom_right_box") + 0.005;
09973       Double_t y_low = fCnaParHistos->BoxTopY("bottom_right_box")   + 0.005;
09974       Double_t y_up  = fCnaParHistos->BoxBottomY("top_left_box_EB") - 0.005;
09975 
09976       Double_t x_margin = x_low;
09977       Double_t y_margin = y_low;
09978 
09979       Color_t  fond_pad = fCnaParHistos->ColorDefinition("gris18");
09980 
09981       MainCanvas->Divide( 1,  1, x_margin, y_margin, fond_pad);
09982       //           Divide(nx, ny, x_margin, y_margin,    color);
09983 
09984       gPad->cd(1);
09985       main_subpad = gPad;
09986       main_subpad->SetPad(x_low, y_low, x_up, y_up);
09987 
09988       xMemoPlotSame = 0;
09989     }
09990   //========================================= Options SAME and SAME n   (HistimePlot)
09991   if(opt_plot == fSeveralPlot || opt_plot == fSameOnePlot)
09992     {
09993       if(GetMemoFlag(HistoCode, opt_plot) == "Free")
09994         {
09995           if( fPavComGeneralTitle != 0 ){fPavComGeneralTitle->Draw();}
09996           fPavComSeveralChanging->Draw();
09997 
09998           fPavComEvolRuns->Draw();
09999 
10000           if( !( HistoType == "Global"     || HistoType == "Proj"       ||
10001                  HistoCode == "H_Ped_Date" || HistoCode == "H_TNo_Date" || HistoCode == "H_MCs_Date" ||
10002                  HistoCode == "H_LFN_Date" || HistoCode == "H_HFN_Date" || HistoCode == "H_SCs_Date") )
10003             {
10004               fPavComStin->Draw();
10005               fPavComXtal->Draw();
10006             } 
10007           
10008           if( !( HistoCode == "H_Ped_Date" || HistoCode == "H_TNo_Date" || HistoCode == "H_MCs_Date" ||
10009                  HistoCode == "H_LFN_Date" || HistoCode == "H_HFN_Date" || HistoCode == "H_SCs_Date" ) )
10010             {
10011               fPavComXtal->Draw();
10012             } 
10013           //Call to SetParametersPavTxt
10014           //fPavTxt<HISTOCODE> = fPavComSeveralChanging;  => come from SetAllPavesViewHisto
10015           SetParametersPavTxt(HistoCode, opt_plot);
10016           
10017           //---------------- Call to ActivePavTxt
10018           // main_pavtxt = fPavTxt<HISTOCODE>;} (return main_pavtxt)
10019           main_pavtxt = ActivePavTxt(HistoCode.Data(), opt_plot.Data());
10020           
10021           //-------------------- Set texts for pave "several changing", options SAME and SAME n (HistimePlot)
10022           main_pavtxt->SetTextAlign(fTextPaveAlign);
10023           main_pavtxt->SetTextFont(fTextPaveFont);
10024           main_pavtxt->SetTextSize(fTextPaveSize);
10025           main_pavtxt->SetBorderSize(fTextBorderSize);
10026 
10027           char* f_in = new char[fgMaxCar];                            fCnew++;
10028 
10029           TString DecalStexName = "";
10030           if( fFlagSubDet == "EB" ){DecalStexName = " ";}
10031           TString DecalStinName = "";
10032           if( fFlagSubDet == "EE" ){DecalStinName = "   ";}
10033 
10034           TString sStexOrStasName = "";
10035           if( fFapStexNumber == 0 ){sStexOrStasName = "  ";}
10036           if( fFapStexNumber != 0 ){sStexOrStasName = fFapStexName;}
10037 
10038 
10039           //-----------------------------> HistoType = "EvolProj" => treated in HistoPlot, not here.
10040           if(opt_plot == fSeveralPlot)
10041             {
10042               sprintf(f_in, "Analysis   Samp  Evts range  Nb Evts   %s%s %s%s   %s",
10043                       DecalStexName.Data(), sStexOrStasName.Data(),
10044                       DecalStinName.Data(), fFapStinName.Data(), fFapEchaName.Data());
10045             }
10046           if(opt_plot == fSameOnePlot)
10047             {
10048               sprintf(f_in, "Analysis   Samp  Evts range  Nb Evts   %s%s %s%s   %s",
10049                       DecalStexName.Data(), sStexOrStasName.Data(),
10050                       DecalStinName.Data(), fFapStinName.Data(), fFapEchaName.Data());
10051             }
10052 
10053           //................................................................... (HistimePlot)
10054           TText* ttit = main_pavtxt->AddText(f_in);
10055           ttit->SetTextColor(fCnaParHistos->ColorDefinition("noir"));
10056           
10057           if(opt_plot == fSeveralPlot)
10058             {
10059               sprintf(f_in, "%-10s 1-%2d %5d-%5d  %7d %5s%6d%7d",
10060                       fFapAnaType.Data(), fFapNbOfSamples,
10061                       fFapFirstReqEvtNumber, fFapLastReqEvtNumber, fFapReqNbOfEvts, sFapStexNumber.Data(),
10062                       Stex_StinCons, n1StexCrys);
10063             }
10064           if(opt_plot == fSameOnePlot)
10065             {
10066               sprintf(f_in, "%-10s 1-%2d %5d-%5d  %7d %5s%6d%7d %-25s",
10067                       fFapAnaType.Data(), fFapNbOfSamples,
10068                       fFapFirstReqEvtNumber, fFapLastReqEvtNumber, fFapReqNbOfEvts, sFapStexNumber.Data(),
10069                       Stex_StinCons, n1StexCrys, QuantityName.Data());
10070             }
10071 
10072           TText* tt = main_pavtxt->AddText(f_in);
10073           tt->SetTextColor(GetViewHistoColor(HistoCode, opt_plot));
10074 
10075           delete [] f_in;      f_in = 0;                                       fCdelete++;
10076 
10077           //---------- Draw the "several changing" pave with its text in the Canvas (FIRST TIME)        (HistimePlot)
10078           main_pavtxt->Draw();
10079 
10080           //---------------- Call to SetParametersCanvas
10081           //fImp<HISTOCODE> = (TRootCanvas*)fCanv<HISTOCODE>->GetCanvasImp();
10082           //fCanv<HISTOCODE>->Divide(1, 1, x_margin_factor , y_margin_factor); gPad->cd(1);
10083           //fPad<HISTOCODE> = gPad;
10084           //fMemoPlot<HISTOCODE> = 1;          =======>  set MemoFlag to "Buzy"
10085           //fMemoColor<HISTOCODE> = 0;
10086           SetParametersCanvas(HistoCode, opt_plot);
10087 
10088           //---------------- Set xMemoPlotSame to 0
10089           xMemoPlotSame = 0;
10090         }
10091 
10092       //............................ cases fMemoPlotxxx = 1            (HistimePlot)
10093       if(GetMemoFlag(HistoCode, opt_plot) == "Busy")
10094         {
10095           //---------------- Call to ActivePavTxt
10096           // main_pavtxt = fPavTxt<HISTOCODE>;} (return main_pavtxt)
10097           main_pavtxt = ActivePavTxt(HistoCode.Data(), opt_plot.Data());
10098           
10099           //---------------- Call to ActivePad
10100           //if( (TRootCanvas*)fCanv<HISTOCODE>->GetCanvasImp() == fImp<HISTOCODE> ){
10101           // main_subpad = fPad<HISTOCODE>;} (return main_subpad)
10102           main_subpad = ActivePad(HistoCode.Data(), opt_plot.Data());  // => return 0 if canvas has been closed
10103 
10104           //---------------- Recover pointer to the current canvas
10105           MainCanvas = GetCurrentCanvas(HistoCode.Data(), opt_plot.Data());
10106         }
10107     }
10108 
10109   //============================================================================= (HistimePlot)
10110   //
10111   //     2nd  OPERATIONS: Write and Draw the parameter values in the
10112   //                      "several changing" pave (options SAME and SAME n)
10113   //                      Draw Histo
10114   //=============================================================================
10115   if(main_subpad != 0)
10116     {
10117       if(opt_plot == fSeveralPlot || opt_plot == fSameOnePlot)
10118         {
10119           if(xMemoPlotSame != 0)
10120             {
10121               main_pavtxt->SetTextAlign(fTextPaveAlign);
10122               main_pavtxt->SetTextFont(fTextPaveFont);
10123               main_pavtxt->SetTextSize(fTextPaveSize);
10124               main_pavtxt->SetBorderSize(fTextBorderSize);
10125 
10126               char* f_in = new char[fgMaxCar];                            fCnew++;
10127               
10128               if(opt_plot == fSeveralPlot )
10129                 {sprintf(f_in, "%-10s 1-%2d %5d-%5d  %7d %5s%6d%7d",
10130                          fFapAnaType.Data(), fFapNbOfSamples, fFapFirstReqEvtNumber, fFapLastReqEvtNumber, fFapReqNbOfEvts,
10131                          sFapStexNumber.Data(), Stex_StinCons, n1StexCrys);}
10132               if(opt_plot == fSameOnePlot )
10133                 {sprintf(f_in, "%-10s 1-%2d %5d-%5d  %7d %5s%6d%7d %-25s",
10134                          fFapAnaType.Data(), fFapNbOfSamples, fFapFirstReqEvtNumber, fFapLastReqEvtNumber, fFapReqNbOfEvts,
10135                          sFapStexNumber.Data(), Stex_StinCons, n1StexCrys, QuantityName.Data());}
10136               
10137               TText *tt = main_pavtxt->AddText(f_in);
10138               tt->SetTextColor(GetViewHistoColor(HistoCode, opt_plot));
10139               MainCanvas->cd(); gStyle->SetOptDate(0);
10140               main_pavtxt->Draw();
10141 
10142               delete [] f_in;    f_in = 0;                          fCdelete++;
10143             }
10144           main_subpad->cd();
10145           Double_t x_low = fCnaParHistos->BoxLeftX("bottom_left_box")   - 0.005;
10146           Double_t x_up  = fCnaParHistos->BoxRightX("bottom_right_box") + 0.005;
10147           Double_t y_low = fCnaParHistos->BoxTopY("several_evol_box")   + 0.005;
10148           Double_t y_up  = fCnaParHistos->BoxBottomY("general_comment") - 0.005;
10149           if( opt_plot == fSameOnePlot ){y_up = fCnaParHistos->BoxBottomY("top_left_box_EB") - 0.005;}
10150           main_subpad->SetPad(x_low, y_low, x_up, y_up); 
10151         }
10152               
10153       //............................................ Style      (HistimePlot)
10154       SetViewGraphColors(g_graph0, HistoCode, opt_plot);
10155 
10156       //................................. Set axis titles
10157       TString axis_x_var_name = SetHistoXAxisTitle(HistoCode);
10158       TString axis_y_var_name = SetHistoYAxisTitle(HistoCode);
10159       g_graph0->GetXaxis()->SetTitle(axis_x_var_name);
10160       g_graph0->GetYaxis()->SetTitle(axis_y_var_name);
10161 
10162       //................................. Xaxis is a time axis
10163       g_graph0->GetXaxis()->SetTimeDisplay(1);
10164       g_graph0->GetXaxis()->SetTimeFormat("%d %b-%Hh");
10165  
10166       g_graph0->GetXaxis()->SetTimeOffset(xinf);
10167 
10168       Int_t nb_displayed = fCnaParHistos->GetNbOfRunsDisplayed();      // max nb of run numbers displayed
10169 
10170       //...........................................................................     (HistimePlot)
10171       Int_t liny = 0;
10172       Int_t logy = 1;
10173               
10174       if(opt_plot == fOnlyOnePlot)
10175         {
10176           fXinf = (Double_t)xinf;
10177           fXsup = (Double_t)xsup;
10178           fYinf = (Double_t)GetYminValueFromMemo(HistoCode);
10179           fYsup = (Double_t)GetYmaxValueFromMemo(HistoCode);
10180 
10181           gPad->RangeAxis(fXinf, fYinf, fXsup, fYsup);
10182 
10183           //if(opt_scale_y == fOptScaleLiny){gPad->SetLogy(liny);}
10184           if(opt_scale_y == fOptScaleLogy){gPad->SetLogy(logy); g_graph0->Draw("ALP");}
10185 
10186           if(opt_scale_y == fOptScaleLiny)
10187             {
10188               gPad->SetLogy(liny);
10189               g_graph0->Draw("ALP");
10190               Int_t     nb_pts  = g_graph0->GetN();
10191               Double_t* coord_x = g_graph0->GetX();
10192               Double_t* coord_y = g_graph0->GetY();
10193 
10194               char* f_in = new char[fgMaxCar];                            fCnew++;
10195 
10196               //................. display of the run numbers                                         (HistimePlot)
10197               Double_t interv_displayed = (coord_x[nb_pts-1] - coord_x[0])/(Double_t)nb_displayed;
10198               Double_t last_drawn_coordx = coord_x[0] - 1.5*interv_displayed;
10199 
10200               for(Int_t i_run=0; i_run<nb_pts; i_run++)
10201                 {
10202                   if ( (coord_x[i_run] - last_drawn_coordx) > interv_displayed )
10203                     {
10204                       Double_t joinYinf = fYinf;
10205                       Double_t joinYsup = fYsup;
10206                       if( joinYsup <= joinYinf )
10207                         {
10208                           joinYinf =
10209                             GetYminFromGraphFrameAndMarginValue(g_graph0, fCnaParHistos->GetMarginAutoMinMax());
10210                           joinYsup =
10211                             GetYmaxFromGraphFrameAndMarginValue(g_graph0, fCnaParHistos->GetMarginAutoMinMax());
10212                           joinYsup = joinYsup + (joinYsup-joinYinf)/20.;
10213                         }
10214 
10215                       sprintf( f_in, "R%d",  fT1DRunNumber[i_run]);
10216                       TText *text_run_num = new TText(coord_x[i_run], joinYsup, f_in);  fCnewRoot++;
10217                       text_run_num->SetTextAngle((Double_t)45.);
10218                       text_run_num->SetTextSize((Double_t)0.035);
10219                       text_run_num->Draw("SAME");
10220                       // delete text_StexStin_num;             fCdeleteRoot++;
10221 
10222                       TLine *jointlign;
10223                       jointlign = new TLine(coord_x[i_run], joinYsup, coord_x[i_run], coord_y[i_run]); fCnewRoot++;
10224                       jointlign->SetLineWidth(1);
10225                       jointlign->SetLineStyle(2);
10226                       jointlign->Draw("SAME");
10227                       // delete jointlign;                  fCdeleteRoot++;
10228 
10229                       last_drawn_coordx = coord_x[i_run];                           //        (HistimePlot)
10230                     }
10231                 }
10232 
10233               delete [] f_in;      f_in = 0;                                         fCdelete++;
10234 
10235             }
10236           if(opt_scale_y == fOptScaleLogy)
10237             {
10238               gPad->SetLogy(logy);
10239               g_graph0->Draw("ALP");
10240             }
10241         }
10242 
10243       //......................................................................  (HistimePlot)
10244       if(opt_plot == fSeveralPlot || opt_plot == fSameOnePlot)
10245         {
10246           if(xMemoPlotSame == 0)
10247             {
10248               if(opt_scale_y == fOptScaleLiny){gPad->SetLogy(liny);}
10249               if(opt_scale_y == fOptScaleLogy){gPad->SetLogy(logy);
10250 }
10251               g_graph0->Draw("ALP");
10252 
10253               fXinf = (Double_t)xinf;
10254               fXsup = (Double_t)xsup;
10255               fYinf = (Double_t)GetYminValueFromMemo(HistoCode);
10256               fYsup = (Double_t)GetYmaxValueFromMemo(HistoCode); 
10257 
10258               gPad->RangeAxis(fXinf, fYinf, fXsup, fYsup);
10259             }
10260           
10261           if(xMemoPlotSame != 0)                                          //        (HistimePlot)
10262             {
10263               if(opt_scale_y == fOptScaleLiny){gPad->SetLogy(liny);}
10264               if(opt_scale_y == fOptScaleLogy){gPad->SetLogy(logy);}
10265 
10266               g_graph0->Draw("LP");
10267             }
10268         }
10269       gPad->Update();
10270     }
10271   else    // else du if(main_subpad !=0)
10272     {
10273       cout << "*TEcnaHistos::HistimePlot(...)> Canvas not found. Previously closed in option SAME."
10274            << fTTBELL << endl;
10275 
10276       ReInitCanvas(HistoCode, opt_plot);
10277       xMemoPlotSame = 0;
10278     }
10279 
10280   //  delete MainCanvas;                  fCdeleteRoot++;
10281  
10282 } // end of HistimePlot
10283 
10284 //------------------------------------------------------------------------------------------------------
10285 void TEcnaHistos::TopAxisForHistos(TH1D*        h_his0,              const TString opt_plot,
10286                                    const Int_t& xMemoPlotSame,       const Int_t&  min_value, const Int_t&  max_value,
10287                                    const Int_t& xFlagAutoYsupMargin, const Int_t&  HisSize)
10288 {
10289 // Axis on top of the plot to indicate the Stin numbers
10290 
10291   if( opt_plot == fOnlyOnePlot ||
10292       ( (opt_plot == fSeveralPlot) && (xMemoPlotSame == 0) ) ||
10293       ( (opt_plot == fSameOnePlot) && (xMemoPlotSame == 0) ) )
10294     {   
10295       Double_t Maxih = (Double_t)h_his0->GetMaximum();
10296       Double_t Minih = (Double_t)h_his0->GetMinimum();
10297 
10298       if(xFlagAutoYsupMargin == 1)
10299         {
10300           if( Minih >= Maxih ){Minih = (Double_t)0.; Maxih += Maxih;}  // ROOT default if ymin >= ymax
10301           Double_t MaxMarginFactor = (Double_t)0.05;    // frame top line = 5% above the maximum
10302           Maxih += (Maxih-Minih)*MaxMarginFactor;       // ROOT default if ymin < ymax
10303         }
10304 
10305       Double_t v_min = min_value;
10306       Double_t v_max = max_value+1;
10307       Int_t ndiv = 50207;
10308       TString opt = "B-";
10309       Double_t Xbegin = 0.;
10310       Double_t Xend   = (Double_t)HisSize;
10311       Double_t ticks  = 0.05;
10312 
10313       if( fFapStexNumber == 0 && fFlagSubDet == "EE" )
10314         {
10315           v_min = 0;
10316           v_max = max_value;
10317           ndiv = 4;
10318           opt = "CSU";                  // first draw axis with ticksize and no label
10319           Xbegin = (Double_t)HisSize;
10320           Xend = 0.;
10321         }
10322 
10323       if( fFapStexNumber > 0 && fFlagSubDet == "EE" )
10324         {
10325           ticks = 0;
10326           if( fFapStexNumber == 1 )
10327             {
10328               v_min = min_value;
10329               v_max = max_value+0.5;
10330               Xbegin = (Double_t)HisSize;
10331               Xend   = 0.;
10332               opt = "CSU";                // first draw axis with no ticksize and no label
10333             }
10334           if( fFapStexNumber == 2 )
10335             {
10336               v_min = min_value+0.5;
10337               v_max = max_value+1.;
10338               Xbegin = (Double_t)HisSize;
10339               Xend   = 0.;
10340               opt = "CSU";                // first draw axis with no ticksize and no label
10341             }
10342           if( fFapStexNumber == 3 )
10343             {
10344               v_min = min_value+0.5;
10345               v_max = max_value+1.;
10346               Xbegin = 0.;
10347               Xend   = (Double_t)HisSize;
10348               opt = "-CSU";                // first draw axis with no ticksize and no label
10349             }
10350           if( fFapStexNumber == 4 )
10351             {
10352               v_min = min_value;
10353               v_max = max_value+0.5;
10354               Xbegin = 0.;
10355               Xend   = (Double_t)HisSize;
10356               opt = "-CSU";                // first draw axis with no ticksize and no label
10357             }
10358           v_min -= 1;
10359           v_max -= 1;
10360           ndiv = 5;
10361         }
10362 
10363       TGaxis* top_axis_x = 0;
10364 
10365       top_axis_x = new TGaxis(Xbegin, Maxih, Xend, Maxih,
10366                                v_min, v_max, ndiv, opt, 0.);         fCnewRoot++;
10367 
10368       top_axis_x->SetTickSize(ticks);
10369       top_axis_x->SetTitleOffset((Float_t)(1.2));
10370       top_axis_x->SetLabelOffset((Float_t)(0.005));
10371 
10372       TString  x_var_name  = "?";
10373       Int_t MaxCar = fgMaxCar;
10374       x_var_name.Resize(MaxCar);
10375       if( fFapStexNumber >  0 )
10376         {
10377           if( fFlagSubDet == "EB"){x_var_name = "Tower number";}
10378           if( fFlagSubDet == "EE")
10379             {
10380               x_var_name = " ";
10381              // x_var_name = "                                                                                                            Data sector"; // don't remove the space characters !
10382             }
10383         }
10384       if( fFapStexNumber == 0 )
10385         {
10386           if( fFlagSubDet == "EB"){x_var_name = "SM number";}
10387           if( fFlagSubDet == "EE"){x_var_name = " ";}
10388         } 
10389       top_axis_x->SetTitle(x_var_name);
10390       top_axis_x->Draw("SAME");
10391       
10392       if( fFlagSubDet == "EE" )
10393         {
10394           // redraw axis with ticksize = 0, with labelOffset<0 or >0 and div centered in middle division
10395           opt = "-MS";
10396           if(fFapStexNumber == 1 || fFapStexNumber == 2 ){opt = "-MS";}
10397           if(fFapStexNumber == 3 || fFapStexNumber == 4 ){opt = "MS";} 
10398           ndiv = 4;
10399           if( fFapStexNumber > 0 ){ndiv = 5;}
10400           TGaxis* top_axis_x_bis = 0;
10401           top_axis_x_bis = new TGaxis(Xbegin, Maxih, Xend, Maxih,
10402                                       v_min+1, v_max+1, ndiv, opt, 0.);   fCnewRoot++;
10403           top_axis_x_bis->SetTickSize(0.);
10404           Float_t lab_siz_x = top_axis_x->GetLabelSize();
10405           top_axis_x_bis->SetLabelSize(lab_siz_x);
10406           top_axis_x_bis->SetLabelOffset(-0.1);
10407 
10408           top_axis_x_bis->SetLabelOffset((Float_t)(9999.));
10409           // if(fFapStexNumber == 1 || fFapStexNumber == 2 ){top_axis_x_bis->SetLabelOffset(-0.07);}
10410           // if(fFapStexNumber == 3 || fFapStexNumber == 4 ){top_axis_x_bis->SetLabelOffset(-0.05);}  
10411           // if(fFapStexNumber == 0 )
10412              //  {top_axis_x_bis->SetLabelOffset((Float_t)(9999.));}  // keep the tick and remove the value
10413           top_axis_x_bis->Draw("SAME");
10414         }
10415     } 
10416 } // end of TopAxisForHistos
10417 
10418 //............................................................................................ 
10419 void TEcnaHistos::GeneralTitle(const TString title)
10420 {
10421 // Put the general comment pave
10422 
10423   SetGeneralTitle(title);
10424 }
10425 //............................................................................................
10426 void TEcnaHistos::SetAllPavesViewMatrix(const TString   MatrixElement,
10427                                         const Int_t&    StexStin_A,  const Int_t&  StexStin_B,
10428                                         const Int_t&    i0StinEcha)
10429 {
10430 // Put all the paves of a matrix view
10431 
10432   fPavComGeneralTitle = fCnaParHistos->SetPaveGeneralComment(fFlagGeneralTitle);
10433 
10434   fPavComStex = fCnaParHistos->SetPaveStex("standard", fFapStexNumber);
10435   
10436   if(MatrixElement == fLFBetweenChannels || MatrixElement == fHFBetweenChannels)
10437     {fPavComStin = fCnaParHistos->SetPaveStinsXY(StexStin_A, StexStin_B);}
10438   if(MatrixElement == fBetweenSamples)
10439     {
10440       fPavComStin = fCnaParHistos->SetPaveStin(StexStin_A, fFapStexNumber);
10441       
10442       if( fFlagSubDet == "EB" )
10443         {Int_t n1StexCrys = fEcalNumbering->Get1StexCrysFrom1StexStinAnd0StinEcha(StexStin_A, i0StinEcha, fFapStexNumber);
10444         fPavComXtal = fCnaParHistos->SetPaveCrystal(n1StexCrys, StexStin_A, i0StinEcha);}
10445       if( fFlagSubDet == "EE" )
10446         {TString Dir = fEcalNumbering->GetDeeDirViewedFromIP(fFapStexNumber);
10447         Int_t n1StexCrys = fEcalNumbering->Get1StexCrysFrom1StexStinAnd0StinEcha(StexStin_A, i0StinEcha, fFapStexNumber);
10448         fPavComXtal = fCnaParHistos->SetPaveCrystal(n1StexCrys, StexStin_A, i0StinEcha);}
10449     }
10450 
10451   fPavComAnaRun  = fCnaParHistos->SetPaveAnalysisRun(fFapAnaType,  fFapNbOfSamples, fFapRunNumber, fRunType,
10452                                                      fFapFirstReqEvtNumber, fFapLastReqEvtNumber, "OneCol");
10453   fPavComNbOfEvts = fCnaParHistos->SetPaveNbOfEvts(fFapNbOfEvts, fStartDate, fStopDate, "OneCol");
10454 }
10455 
10456 void TEcnaHistos::SetAllPavesViewStin(const Int_t& StexStin_A)
10457 {
10458 // Put all the paves of a Stin view
10459 
10460   fPavComGeneralTitle = fCnaParHistos->SetPaveGeneralComment(fFlagGeneralTitle);
10461   fPavComStex = fCnaParHistos->SetPaveStex("standard", fFapStexNumber);
10462 
10463   fPavComStin   = fCnaParHistos->SetPaveStin(StexStin_A, fFapStexNumber);
10464 
10465   fPavComAnaRun  = fCnaParHistos->SetPaveAnalysisRun(fFapAnaType, fFapNbOfSamples, fFapRunNumber, fRunType,
10466                                                      fFapFirstReqEvtNumber, fFapLastReqEvtNumber, "OneCol");
10467   fPavComNbOfEvts = fCnaParHistos->SetPaveNbOfEvts(fFapNbOfEvts, fStartDate, fStopDate, "OneCol");
10468 }
10469 
10470 void TEcnaHistos::SetAllPavesViewStinCrysNb(const Int_t& StexNumber, const Int_t& StexStin_A)
10471 {
10472 // Put all the paves of a crystal numbering Stin view
10473 
10474   fPavComStex  = fCnaParHistos->SetPaveStex("standard", StexNumber);
10475   fPavComStin  = fCnaParHistos->SetPaveStin(StexStin_A, StexNumber);
10476 
10477   if( fFlagSubDet == "EB")
10478     {fPavComLVRB   = fCnaParHistos->SetPaveLVRB(StexNumber, StexStin_A);}
10479   if( fFlagSubDet == "EE")
10480     {fPavComCxyz   = fCnaParHistos->SetPaveCxyz(StexNumber);}
10481 }
10482 
10483 void TEcnaHistos::SetAllPavesViewStex(const TString chopt, const Int_t& StexNumber)
10484 {
10485   if( chopt == "Numbering" )
10486     {
10487       fCnaParHistos->SetViewHistoStyle("Stex2DEENb");
10488       gStyle->SetTextColor(fCnaParHistos->ColorDefinition("noir"));
10489       fPavComStex = fCnaParHistos->SetPaveStex("standStex", StexNumber);
10490       if( fFlagSubDet == "EE" ){fPavComCxyz = fCnaParHistos->SetPaveCxyz(StexNumber);}
10491     }
10492   else
10493     {
10494       SetAllPavesViewStex(StexNumber);
10495     }
10496 }
10497 // end of SetAllPavesViewStex(...,...)
10498 
10499 void TEcnaHistos::SetAllPavesViewStex(const Int_t& StexNumber)
10500 {
10501   gStyle->SetTextColor(fCnaParHistos->ColorDefinition("noir"));
10502   fPavComGeneralTitle = fCnaParHistos->SetPaveGeneralComment(fFlagGeneralTitle);
10503   fPavComStex = fCnaParHistos->SetPaveStex("standStex", StexNumber);
10504 
10505   TString opt_pave_nbcol = "OneCol";
10506   if( fFapStexName == "SM"){opt_pave_nbcol = "TwoCol";}
10507     
10508   fPavComAnaRun  = fCnaParHistos->SetPaveAnalysisRun(fFapAnaType, fFapNbOfSamples, fFapRunNumber, fRunType,
10509                                                      fFapFirstReqEvtNumber, fFapLastReqEvtNumber,opt_pave_nbcol);
10510   fPavComNbOfEvts = fCnaParHistos->SetPaveNbOfEvts(fFapNbOfEvts, fStartDate, fStopDate, opt_pave_nbcol); 
10511 }
10512 // end of SetAllPavesViewStex(...)
10513 
10514 void TEcnaHistos::SetAllPavesViewStas()
10515 {
10516   gStyle->SetTextColor(fCnaParHistos->ColorDefinition("noir"));
10517   fPavComGeneralTitle = fCnaParHistos->SetPaveGeneralComment(fFlagGeneralTitle);
10518   fPavComStas = fCnaParHistos->SetPaveStas();
10519 
10520   fPavComAnaRun  = fCnaParHistos->SetPaveAnalysisRun(fFapAnaType, fFapNbOfSamples, fFapRunNumber, fRunType,
10521                                                      fFapFirstReqEvtNumber, fFapLastReqEvtNumber, "OneCol");
10522   fPavComNbOfEvts = fCnaParHistos->SetPaveNbOfEvts(fFapNbOfEvts, fStartDate, fStopDate, "OneCol");
10523 }
10524 // end of SetAllPavesViewStas
10525 
10526 void TEcnaHistos::SetAllPavesViewHisto(const TString HistoCode,
10527                                        const Int_t&  StexStin_A,  const Int_t&  i0StinEcha,
10528                                        const Int_t&  iSample,     const TString opt_plot)
10529 {
10530 // Put all the paves of a histo view according to HistoCode
10531 
10532   gStyle->SetTextColor(fCnaParHistos->ColorDefinition("noir"));
10533 
10534   TString HistoType = fCnaParHistos->GetHistoType(HistoCode.Data());
10535 
10536   fPavComGeneralTitle = fCnaParHistos->SetPaveGeneralComment(fFlagGeneralTitle);
10537 
10538   if(opt_plot == fOnlyOnePlot)
10539     {      
10540       if( !( HistoCode == "D_NOE_ChNb" || HistoCode == "D_NOE_ChDs" ||
10541              HistoCode == "D_Ped_ChNb" || HistoCode == "D_Ped_ChDs" ||
10542              HistoCode == "D_LFN_ChNb" || HistoCode == "D_LFN_ChDs" ||
10543              HistoCode == "D_TNo_ChNb" || HistoCode == "D_TNo_ChDs" || 
10544              HistoCode == "D_HFN_ChNb" || HistoCode == "D_HFN_ChDs" || 
10545              HistoCode == "D_MCs_ChNb" || HistoCode == "D_MCs_ChDs" || 
10546              HistoCode == "D_SCs_ChNb" || HistoCode == "D_SCs_ChDs" ) )
10547         {
10548           fPavComStex = fCnaParHistos->SetPaveStex("standard", fFapStexNumber);
10549           fPavComStin = fCnaParHistos->SetPaveStin(StexStin_A, fFapStexNumber);
10550         }
10551       else
10552         {
10553           if( HistoCode == "D_NOE_ChNb" ||
10554               HistoCode == "D_Ped_ChNb" || HistoCode == "D_TNo_ChNb" ||
10555               HistoCode == "D_MCs_ChNb" || HistoCode == "D_LFN_ChNb" ||
10556               HistoCode == "D_HFN_ChNb" || HistoCode == "D_SCs_ChNb" )
10557             {fPavComStex = fCnaParHistos->SetPaveStex("standGH", fFapStexNumber);}
10558           else
10559             {fPavComStex = fCnaParHistos->SetPaveStex("standard", fFapStexNumber);}
10560         }
10561 
10562   //.................................................... (SetAllPavesViewHisto)
10563      
10564       if( HistoCode == "D_MSp_Samp" || HistoCode == "D_SSp_Samp" ||
10565           HistoCode == "H_Ped_Date" || HistoCode == "H_TNo_Date" || HistoCode == "H_MCs_Date" ||
10566           HistoCode == "H_LFN_Date" || HistoCode == "H_HFN_Date" || HistoCode == "H_SCs_Date" ||
10567           HistoCode == "H_Ped_RuDs" || HistoCode == "H_TNo_RuDs" || HistoCode == "H_MCs_RuDs" ||
10568           HistoCode == "H_LFN_RuDs" || HistoCode == "H_HFN_RuDs" || HistoCode == "H_SCs_RuDs" )
10569         {
10570           Int_t n1StexCrys  =
10571             fEcalNumbering->Get1StexCrysFrom1StexStinAnd0StinEcha(StexStin_A, i0StinEcha, fFapStexNumber);
10572           fPavComXtal = fCnaParHistos->SetPaveCrystal(n1StexCrys, StexStin_A, i0StinEcha);
10573         }
10574       if( HistoCode == "D_Adc_EvDs" || HistoCode == "D_Adc_EvNb")
10575         {
10576           Int_t n1StexCrys  =
10577             fEcalNumbering->Get1StexCrysFrom1StexStinAnd0StinEcha(StexStin_A, i0StinEcha, fFapStexNumber);
10578           fPavComXtal = fCnaParHistos->SetPaveCrystalSample(n1StexCrys, StexStin_A, i0StinEcha, iSample);
10579         }
10580       
10581       if( HistoCode == "H_Ped_Date" || HistoCode == "H_TNo_Date" || HistoCode == "H_MCs_Date" ||
10582           HistoCode == "H_LFN_Date" || HistoCode == "H_HFN_Date" || HistoCode == "H_SCs_Date" ||
10583           HistoCode == "H_Ped_RuDs" || HistoCode == "H_TNo_RuDs" || HistoCode == "H_MCs_RuDs" ||
10584           HistoCode == "H_LFN_RuDs" || HistoCode == "H_HFN_RuDs" || HistoCode == "H_SCs_RuDs" )
10585         {
10586           fPavComEvolNbOfEvtsAna =
10587             fCnaParHistos->SetPaveEvolNbOfEvtsAna(fFapAnaType, fFapNbOfSamples,
10588                                                   fFapFirstReqEvtNumber, fFapLastReqEvtNumber, HistoType);
10589           fPavComEvolRuns = fCnaParHistos->SetPaveEvolRuns(fStartEvolRun, fStartEvolDate,
10590                                                            fStopEvolRun,  fStopEvolDate, opt_plot, HistoType);
10591         }
10592       else
10593         {
10594           fPavComAnaRun = fCnaParHistos->SetPaveAnalysisRun(fFapAnaType, fFapNbOfSamples, fFapRunNumber, fRunType,
10595                                                             fFapFirstReqEvtNumber, fFapLastReqEvtNumber, "OneCol");
10596           fPavComNbOfEvts = fCnaParHistos->SetPaveNbOfEvts(fFapNbOfEvts, fStartDate, fStopDate, "OneCol");
10597         }
10598     }
10599 
10600   //.................................................... (SetAllPavesViewHisto)
10601 
10602   if( opt_plot == fSeveralPlot && GetMemoFlag(HistoCode, opt_plot) == "Free" )
10603     {
10604       if( HistoCode == "H_Ped_Date" || HistoCode == "H_TNo_Date" || HistoCode == "H_MCs_Date" ||
10605           HistoCode == "H_LFN_Date" || HistoCode == "H_HFN_Date" || HistoCode == "H_SCs_Date" ||
10606           HistoCode == "H_Ped_RuDs" || HistoCode == "H_TNo_RuDs" || HistoCode == "H_MCs_RuDs" ||
10607           HistoCode == "H_LFN_RuDs" || HistoCode == "H_HFN_RuDs" || HistoCode == "H_SCs_RuDs" )
10608         {
10609           fPavComSeveralChanging = fCnaParHistos->SetOptionSamePaveBorder("sevevol", HistoType);
10610           fPavComEvolRuns = fCnaParHistos->SetPaveEvolRuns(fStartEvolRun, fStartEvolDate,
10611                                                            fStopEvolRun,  fStopEvolDate, opt_plot, HistoType);
10612         }
10613       else
10614         {
10615           fPavComSeveralChanging = fCnaParHistos->SetOptionSamePaveBorder("several", HistoType);
10616         }
10617     } 
10618 
10619   if( opt_plot == fSameOnePlot && GetMemoFlag(HistoCode, opt_plot) == "Free" )
10620     {
10621       fPavComSeveralChanging = fCnaParHistos->SetOptionSamePaveBorder("several", HistoType);
10622       fPavComEvolRuns = fCnaParHistos->SetPaveEvolRuns(fStartEvolRun, fStartEvolDate,
10623                                                        fStopEvolRun,  fStopEvolDate, opt_plot, HistoType);
10624     } 
10625 
10626 }
10627 // end of SetAllPavesViewHisto
10628 
10629 TString TEcnaHistos::SetCanvasName(const TString HistoCode,
10630                                   const Int_t&  opt_scale_x, const Int_t& opt_scale_y,
10631                                   const TString opt_plot,    const Int_t& StexStin_A,
10632                                   const Int_t&  i0StinEcha,  const Int_t& iSample)
10633 {
10634   //......... Set Canvas name *===> FOR 1D HISTO ONLY 
10635   //          (for 2D histos, see inside ViewMatrix, ViewStex,...)
10636 
10637   TString canvas_name;
10638   Int_t MaxCar = fgMaxCar;
10639   canvas_name.Resize(MaxCar);
10640   canvas_name = "?";
10641 
10642   char* f_in = new char[fgMaxCar];               fCnew++;
10643 
10644   //......................... name_ opt_plot  (Set Canvas name)
10645   TString  name_opt_plot;
10646   MaxCar = fgMaxCar;
10647   name_opt_plot.Resize(MaxCar);
10648   name_opt_plot = "?";
10649   if(opt_plot == fOnlyOnePlot){name_opt_plot = "P1";}  // Only one plot
10650   if(opt_plot == fSeveralPlot)
10651     {
10652       name_opt_plot = "SAME_N";
10653       //...................................... name_same (opt_plot = fSeveralPlot)
10654       Int_t name_same = -1;
10655       
10656       if(HistoCode == "D_NOE_ChNb"){name_same = fCanvSameD_NOE_ChNb;}
10657       if(HistoCode == "D_NOE_ChDs"){name_same = fCanvSameD_NOE_ChDs;}
10658       if(HistoCode == "D_Ped_ChNb"){name_same = fCanvSameD_Ped_ChNb;}
10659       if(HistoCode == "D_Ped_ChDs"){name_same = fCanvSameD_Ped_ChDs;}
10660       if(HistoCode == "D_TNo_ChNb"){name_same = fCanvSameD_TNo_ChNb;}
10661       if(HistoCode == "D_TNo_ChDs"){name_same = fCanvSameD_TNo_ChDs;}
10662       if(HistoCode == "D_MCs_ChNb"){name_same = fCanvSameD_MCs_ChNb;}
10663       if(HistoCode == "D_MCs_ChDs"){name_same = fCanvSameD_MCs_ChDs;}
10664       if(HistoCode == "D_LFN_ChNb"){name_same = fCanvSameD_LFN_ChNb;}
10665       if(HistoCode == "D_LFN_ChDs"){name_same = fCanvSameD_LFN_ChDs;}
10666       if(HistoCode == "D_HFN_ChNb"){name_same = fCanvSameD_HFN_ChNb;}
10667       if(HistoCode == "D_HFN_ChDs"){name_same = fCanvSameD_HFN_ChDs;}
10668       if(HistoCode == "D_SCs_ChNb"){name_same = fCanvSameD_SCs_ChNb;}
10669       if(HistoCode == "D_SCs_ChDs"){name_same = fCanvSameD_SCs_ChDs;}
10670       if(HistoCode == "D_MSp_Samp"){name_same = fCanvSameD_MSp_Samp;}
10671       if(HistoCode == "D_SSp_Samp"){name_same = fCanvSameD_SSp_Samp;}
10672       if(HistoCode == "D_Adc_EvDs"){name_same = fCanvSameD_Adc_EvDs;}
10673       if(HistoCode == "D_Adc_EvNb"){name_same = fCanvSameD_Adc_EvNb;}     
10674       if(HistoCode == "H_Ped_Date"){name_same = fCanvSameH_Ped_Date;}
10675       if(HistoCode == "H_TNo_Date"){name_same = fCanvSameH_TNo_Date;}
10676       if(HistoCode == "H_MCs_Date"){name_same = fCanvSameH_MCs_Date;}
10677       if(HistoCode == "H_LFN_Date"){name_same = fCanvSameH_LFN_Date;}
10678       if(HistoCode == "H_HFN_Date"){name_same = fCanvSameH_HFN_Date;}
10679       if(HistoCode == "H_SCs_Date"){name_same = fCanvSameH_SCs_Date;}
10680       if(HistoCode == "H_Ped_RuDs"){name_same = fCanvSameH_Ped_RuDs;}
10681       if(HistoCode == "H_TNo_RuDs"){name_same = fCanvSameH_TNo_RuDs;}
10682       if(HistoCode == "H_MCs_RuDs"){name_same = fCanvSameH_MCs_RuDs;}
10683       if(HistoCode == "H_LFN_RuDs"){name_same = fCanvSameH_LFN_RuDs;}
10684       if(HistoCode == "H_HFN_RuDs"){name_same = fCanvSameH_HFN_RuDs;}
10685       if(HistoCode == "H_SCs_RuDs"){name_same = fCanvSameH_SCs_RuDs;}   
10686 
10687       sprintf(f_in,"%d", name_same);
10688       TString s_name_same = f_in;     
10689       const Text_t *t_name_same = (const Text_t *)s_name_same.Data();
10690       name_opt_plot.Append(t_name_same);
10691     } 
10692   if(opt_plot == fSameOnePlot)
10693     {
10694       name_opt_plot = "SAME_Plus_N";
10695       //...................................... name_same (opt_plot = fSeveralPlot)
10696       Int_t name_same = fCanvSameH1SamePlus;
10697       sprintf(f_in,"%d", name_same);
10698       TString s_name_same = f_in;     
10699       const Text_t *t_name_same = (const Text_t *)s_name_same.Data();
10700       name_opt_plot.Append(t_name_same);
10701     }
10702 
10703   //......................... name_visu (Set Canvas name)
10704   TString name_visu;
10705   MaxCar = fgMaxCar;
10706   name_visu.Resize(MaxCar);
10707   name_visu = "";
10708           
10709   TString name_line;
10710   MaxCar = fgMaxCar;
10711   name_line.Resize(MaxCar);
10712   name_line = "Line_";
10713   TString HistoType = fCnaParHistos->GetHistoType(HistoCode.Data());
10714   if( HistoType == "Global" && (opt_plot == fSeveralPlot || opt_plot == fSameOnePlot) ){name_line = "Polm_";}
10715 
10716   // if(opt_visu == fOptVisLine){name_line = "Line_";}
10717   // if(opt_visu == fOptVisPolm){name_line = "Poly_";}
10718 
10719   const Text_t *t_line = (const Text_t *)name_line.Data();
10720   name_visu.Append(t_line);
10721 
10722   TString name_scale_x;
10723   MaxCar = fgMaxCar;
10724   name_scale_x.Resize(MaxCar);
10725   name_scale_x = "?";
10726   if(opt_scale_x == fOptScaleLinx){name_scale_x = "LinX_";}
10727   if(opt_scale_x == fOptScaleLogx){name_scale_x = "LogX_";}
10728   const Text_t *t_scale_x = (const Text_t *)name_scale_x.Data();
10729   name_visu.Append(t_scale_x);
10730 
10731   TString name_scale_y;
10732   MaxCar = fgMaxCar;
10733   name_scale_y.Resize(MaxCar);
10734   name_scale_y = "?";
10735   if(opt_scale_y == fOptScaleLiny){name_scale_y = "LinY";}
10736   if(opt_scale_y == fOptScaleLogy){name_scale_y = "LogY";}
10737   const Text_t *t_scale_y = (const Text_t *)name_scale_y.Data();
10738   name_visu.Append(t_scale_y);
10739 
10740   //...................................... name quantity (Set Canvas name)
10741   TString  name_quantity;
10742   MaxCar = fgMaxCar;
10743   name_quantity.Resize(MaxCar);
10744   name_quantity = "?";
10745 
10746   if(HistoCode == "D_NOE_ChNb"){name_quantity = "Nb_of_evts_as_func_of_Xtal";}
10747   if(HistoCode == "D_NOE_ChDs"){name_quantity = "Nb_of_evts_Xtal_distrib";}
10748   if(HistoCode == "D_Ped_ChNb"){name_quantity = "Pedestals_as_func_of_Xtal";}
10749   if(HistoCode == "D_Ped_ChDs"){name_quantity = "Pedestals_Xtal_distrib";}
10750   if(HistoCode == "D_TNo_ChNb"){name_quantity = "Total_Noise_as_func_of_Xtal";}
10751   if(HistoCode == "D_TNo_ChDs"){name_quantity = "Total_Noise_Xtal_distrib";}
10752   if(HistoCode == "D_MCs_ChNb"){name_quantity = "Mean_Corss_as_func_of_Xtal";}
10753   if(HistoCode == "D_MCs_ChDs"){name_quantity = "Mean_Corss_Xtal_distrib";}
10754   if(HistoCode == "D_LFN_ChNb"){name_quantity = "Low_Fq_Noise_as_func_of_Xtal";}
10755   if(HistoCode == "D_LFN_ChDs"){name_quantity = "Low_Fq_Noise_Xtal_distrib";}
10756   if(HistoCode == "D_HFN_ChNb"){name_quantity = "High_Fq_Noise_as_func_of_Xtal";}
10757   if(HistoCode == "D_HFN_ChDs"){name_quantity = "High_Fq_Noise_Xtal_distrib";}
10758   if(HistoCode == "D_SCs_ChNb"){name_quantity = "Sigma_Corss_as_func_of_Xtal";}
10759   if(HistoCode == "D_SCs_ChDs"){name_quantity = "Sigma_Corss_Xtal_distrib";}
10760   if(HistoCode == "D_MSp_Samp"){name_quantity = "ExpValue_of_samples";}
10761   if(HistoCode == "D_SSp_Samp"){name_quantity = "Sigma_of_samples";}
10762   if(HistoCode == "D_Adc_EvDs"){name_quantity = "hevt";}
10763   if(HistoCode == "D_Adc_EvNb"){name_quantity = "ADC_as_func_of_Event";}          
10764   if(HistoCode == "H_Ped_Date"){name_quantity = "Pedestal_history";}
10765   if(HistoCode == "H_TNo_Date"){name_quantity = "Total_Noise_history";}
10766   if(HistoCode == "H_MCs_Date"){name_quantity = "Mean_Corss_history";}
10767   if(HistoCode == "H_LFN_Date"){name_quantity = "Low_Fq_Noise_history";}
10768   if(HistoCode == "H_HFN_Date"){name_quantity = "High_Fq_Noise_history";}
10769   if(HistoCode == "H_SCs_Date"){name_quantity = "Sigma_Corss_history";}
10770   if(HistoCode == "H_Ped_RuDs"){name_quantity = "Pedestal_run_distribution";}
10771   if(HistoCode == "H_TNo_RuDs"){name_quantity = "Total_Noise_run_distribution";}
10772   if(HistoCode == "H_MCs_RuDs"){name_quantity = "Mean_Corss_run_distribution";}
10773   if(HistoCode == "H_LFN_RuDs"){name_quantity = "Low_Fq_Noise_run_distribution";}
10774   if(HistoCode == "H_HFN_RuDs"){name_quantity = "High_Fq_Noise_run_distribution";}
10775   if(HistoCode == "H_SCs_RuDs"){name_quantity = "Sigma_Corss_run_distribution";}
10776 
10777   Int_t num_crys = -1;
10778   if(HistoCode == "D_MSp_Samp"){num_crys = i0StinEcha;}
10779   if(HistoCode == "D_SSp_Samp"){num_crys = i0StinEcha;}
10780   if(HistoCode == "D_Adc_EvDs"){num_crys = i0StinEcha;}
10781   if(HistoCode == "D_Adc_EvNb"){num_crys = i0StinEcha;}   
10782   if(HistoCode == "H_Ped_Date"){num_crys = i0StinEcha;}
10783   if(HistoCode == "H_TNo_Date"){num_crys = i0StinEcha;}
10784   if(HistoCode == "H_MCs_Date"){num_crys = i0StinEcha;}
10785   if(HistoCode == "H_LFN_Date"){num_crys = i0StinEcha;}
10786   if(HistoCode == "H_HFN_Date"){num_crys = i0StinEcha;}
10787   if(HistoCode == "H_SCs_Date"){num_crys = i0StinEcha;}
10788   if(HistoCode == "H_Ped_RuDs"){num_crys = i0StinEcha;}
10789   if(HistoCode == "H_TNo_RuDs"){num_crys = i0StinEcha;}
10790   if(HistoCode == "H_MCs_RuDs"){num_crys = i0StinEcha;}
10791   if(HistoCode == "H_LFN_RuDs"){num_crys = i0StinEcha;}
10792   if(HistoCode == "H_HFN_RuDs"){num_crys = i0StinEcha;}
10793   if(HistoCode == "H_SCs_RuDs"){num_crys = i0StinEcha;}
10794 
10795   Int_t num_samp = -1;
10796   if(HistoCode == "D_Adc_EvDs"){num_samp = iSample;}
10797   if(HistoCode == "D_Adc_EvNb"){num_samp = iSample;}
10798 
10799   //........................................................... (Set Canvas name)
10800   
10801   if (HistoCode == "D_NOE_ChNb" || HistoCode == "D_NOE_ChDs" || 
10802       HistoCode == "D_Ped_ChNb" || HistoCode == "D_Ped_ChDs" ||
10803       HistoCode == "D_TNo_ChNb" || HistoCode == "D_TNo_ChDs" ||
10804       HistoCode == "D_MCs_ChNb" || HistoCode == "D_MCs_ChDs" ||
10805       HistoCode == "D_LFN_ChNb" || HistoCode == "D_LFN_ChDs" || 
10806       HistoCode == "D_HFN_ChNb" || HistoCode == "D_HFN_ChDs" ||
10807       HistoCode == "D_SCs_ChNb" || HistoCode == "D_SCs_ChDs" )
10808     {
10809       sprintf(f_in, "%s_%s_S1_%d_R%d_%d_%d_%d_%s%d_%s_%s",
10810               name_quantity.Data(), fFapAnaType.Data(),
10811               fFapNbOfSamples, fFapRunNumber, fFapFirstReqEvtNumber, fFapLastReqEvtNumber, fFapReqNbOfEvts,
10812               fFapStexName.Data(), fFapStexNumber,
10813               name_opt_plot.Data(), name_visu.Data());
10814     }
10815   
10816   if (HistoCode == "D_MSp_Samp" || HistoCode == "D_SSp_Samp" ||
10817       HistoCode == "H_Ped_Date" || HistoCode == "H_TNo_Date" || HistoCode == "H_MCs_Date" ||
10818       HistoCode == "H_LFN_Date" || HistoCode == "H_HFN_Date" || HistoCode == "H_SCs_Date" ||
10819       HistoCode == "H_Ped_RuDs" || HistoCode == "H_TNo_RuDs" || HistoCode == "H_MCs_RuDs" ||
10820       HistoCode == "H_LFN_RuDs" || HistoCode == "H_HFN_RuDs" || HistoCode == "H_SCs_RuDs")
10821     {
10822       sprintf(f_in, "%s_%s_S1_%d_R%d_%d_%d_%d_%s%d_%s%d_Xtal%d_%s_%s",
10823               name_quantity.Data(), fFapAnaType.Data(), 
10824               fFapNbOfSamples, fFapRunNumber, fFapFirstReqEvtNumber, fFapLastReqEvtNumber, fFapReqNbOfEvts,
10825               fFapStexName.Data(), fFapStexNumber, fFapStinName.Data(), StexStin_A, num_crys,
10826               name_opt_plot.Data(), name_visu.Data()); 
10827     }
10828   
10829   if (HistoCode == "D_Adc_EvNb" || HistoCode == "D_Adc_EvDs")
10830     {
10831       sprintf(f_in, "%s_%s_S1_%d_R%d_%d_%d_%d_%s%d_%s%d_Xtal%d_Samp%d_%s_%s",
10832               name_quantity.Data(), fFapAnaType.Data(),
10833               fFapNbOfSamples, fFapRunNumber, fFapFirstReqEvtNumber, fFapLastReqEvtNumber, fFapReqNbOfEvts,
10834               fFapStexName.Data(), fFapStexNumber, fFapStinName.Data(), StexStin_A, num_crys, num_samp,
10835               name_opt_plot.Data(), name_visu.Data());
10836     }
10837   
10838   canvas_name = f_in;
10839   delete [] f_in;    f_in = 0;              fCdelete++;
10840   return canvas_name.Data();
10841   
10842 }  // end of CanvasName()
10843 
10844 //-----------------------------------------------------------------------------
10845 //
10846 //        M I S C E L L A N E O U S     P A R A M E T E R S
10847 //
10848 //        C O N C E R N I N G    T H E    D I S P L A Y   
10849 //
10850 //-----------------------------------------------------------------------------
10851 
10852 //===========================================================================
10853 //
10854 //  GetHistoSize, GetHistoValues, SetHistoXAxisTitle,   SetHistoYAxisTitle,
10855 //  GetHistoXinf, GetHistoXsup,   GetHistoNumberOfBins, FillHisto
10856 //
10857 //===========================================================================
10858 Int_t TEcnaHistos::GetHistoSize(const TString chqcode, const TString opt_plot_read)
10859 {
10860 // Histo size as a function of the quantity code
10861 
10862 // VERY IMPORTANT: in some cases the number of bins must be strictly related to the parameters values
10863 //                 (number of crystals, number of samples, etc...). See below comments "===> ONE BIN BY..."
10864 
10865   Int_t HisSize = fNbBinsProj;   // default value
10866 
10867   //............ histo with sample number as x coordinate => HisSize depends on option "plot" or "read"
10868   //             because of nb of samples in file: size for plot = 10 even if nb of samples in file < 10
10869   if( chqcode == "D_MSp_Samp" ||  chqcode == "D_SSp_Samp" )
10870     {
10871       if( opt_plot_read == "read" ){HisSize = fFapNbOfSamples;}
10872       if( opt_plot_read == "plot" ){HisSize = fEcal->MaxSampADC();}
10873     }   // ===> ONE BIN BY SAMPLE
10874 
10875   //............ histo with event number as x coordinate.  (==> "D_Adc_EvDs" option: obsolete, to be confirmed)
10876   if(chqcode == "D_Adc_EvNb" || chqcode == "D_Adc_EvDs"){HisSize = fFapReqNbOfEvts;}   // ===> ONE BIN BY EVENT
10877   
10878   //............ 
10879   if(chqcode == "D_NOE_ChNb" ||
10880      chqcode == "D_Ped_ChNb" || chqcode == "D_TNo_ChNb" || chqcode == "D_MCs_ChNb" ||
10881      chqcode == "D_LFN_ChNb" || chqcode == "D_HFN_ChNb" || chqcode == "D_SCs_ChNb" ||
10882      chqcode == "D_NOE_ChDs" ||
10883      chqcode == "D_Ped_ChDs" || chqcode == "D_TNo_ChDs" || chqcode == "D_MCs_ChDs" || 
10884      chqcode == "D_LFN_ChDs" || chqcode == "D_HFN_ChDs" || chqcode == "D_SCs_ChDs" )
10885     {
10886       if( fFlagSubDet == "EB" )
10887         {
10888           if( fFapStexNumber >  0 ){HisSize = fEcal->MaxCrysEcnaInStex();}             // ===> ONE BIN BY Xtal
10889           if( fFapStexNumber == 0 ){HisSize = fEcal->MaxSMInEB()*fEcal->MaxTowInSM();} // ===> ONE BIN BY Tower
10890         }
10891       if( fFlagSubDet == "EE" )
10892         {
10893           if( fFapStexNumber >  0 )
10894             {
10895               if( opt_plot_read == "read" ){HisSize = fEcal->MaxCrysEcnaInDee();}
10896               if( opt_plot_read == "plot" ){HisSize = fEcal->MaxCrysForConsInDee();}
10897             }                                                           // ===> ONE BIN BY Xtal
10898           if( fFapStexNumber == 0 )
10899             {HisSize = fEcal->MaxDeeInEE()*fEcal->MaxSCForConsInDee();} // ===> ONE BIN BY SC
10900         }
10901     }
10902 
10903   if( chqcode == "H_Ped_RuDs" || chqcode == "H_TNo_RuDs" || chqcode == "H_MCs_RuDs" || 
10904       chqcode == "H_LFN_RuDs" || chqcode == "H_HFN_RuDs" || chqcode == "H_SCs_RuDs" )
10905     {
10906       HisSize = fNbBinsProj;
10907     }
10908 
10909   return HisSize;
10910 }
10911 
10912 TVectorD TEcnaHistos::GetHistoValues(TEcnaRead*    aMyRootFile, const TString HistoCode,
10913                                     const Int_t& HisSizePlot, const Int_t&  HisSizeRead,
10914                                     const Int_t& StexStin_A,  const Int_t&  i0StinEcha, const Int_t& iSample,
10915                                     Int_t&       i_data_exist)
10916 {
10917 // Histo values in a TVectorD. i_data_exist entry value = 0. Incremented in this method.
10918 
10919   fStartDate = aMyRootFile->GetStartDate();
10920   fStopDate  = aMyRootFile->GetStopDate();
10921   fRunType   = aMyRootFile->GetRunType();
10922   
10923   TVectorD plot_histo(HisSizePlot); for(Int_t i=0; i<HisSizePlot; i++){plot_histo(i)=(Double_t)0.;}
10924   TVectorD read_histo(HisSizeRead); for(Int_t i=0; i<HisSizeRead; i++){read_histo(i)=(Double_t)0.;}
10925 
10926   fStatusDataExist = kFALSE;
10927 
10928   if( HistoCode == "D_MSp_Samp" || HistoCode == "D_SSp_Samp" )
10929     {
10930       //====> For plots as a function of Sample# (read10->plot10, read3->plot10)
10931       if( HisSizeRead <= HisSizePlot )
10932         {
10933           if (HistoCode == "D_MSp_Samp")
10934             {read_histo = aMyRootFile->ReadSampleMeans(StexStin_A, i0StinEcha, HisSizeRead);
10935             if( aMyRootFile->DataExist() == kTRUE ){fStatusDataExist = kTRUE; i_data_exist++;}}
10936           
10937           if (HistoCode == "D_SSp_Samp")
10938             {read_histo = aMyRootFile->ReadSampleSigmas(StexStin_A, i0StinEcha, HisSizeRead);
10939             if( aMyRootFile->DataExist() == kTRUE ){fStatusDataExist = kTRUE; i_data_exist++;}}
10940           
10941           for(Int_t i=0; i<HisSizeRead; i++){plot_histo(i)=read_histo(i);}
10942         }
10943       else
10944         {
10945           cout << "!TEcnaHistos::GetHistoValues(...)> *** ERROR *** > HisSizeRead greater than HisSizePlot"
10946                << " for plot as a function of sample#. HisSizeRead = " << HisSizeRead
10947                << ", HisSizePlot = " << HisSizePlot << fTTBELL << endl;
10948         }
10949     }
10950   else
10951     {
10952       //====> For other plots
10953       if( HisSizeRead == HisSizePlot )
10954         {
10955           //========> for EE, HisSizeRead > HisSizePlot but readEcna#->plotForCons# will be build in the calling method
10956           //          HisSizeRead = fEcal->MaxCrysEcnaInStex() (GetHistoValues)
10957 
10958           if( HistoCode == "D_Adc_EvNb" || HistoCode == "D_Adc_EvDs" )
10959             {Int_t i0StexEcha = fEcalNumbering->Get0StexEchaFrom1StexStinAnd0StinEcha(StexStin_A, i0StinEcha);
10960             read_histo = aMyRootFile->ReadSampleValues(i0StexEcha, iSample, HisSizeRead);
10961             if( aMyRootFile->DataExist() == kTRUE ){fStatusDataExist = kTRUE; i_data_exist++;}}
10962 
10963 
10964           if( HistoCode == "D_NOE_ChNb" || HistoCode == "D_NOE_ChDs" )
10965             {read_histo = aMyRootFile->ReadNumberOfEvents(HisSizeRead);
10966             if( aMyRootFile->DataExist() == kTRUE ){fStatusDataExist = kTRUE; i_data_exist++;}}
10967       
10968           if( HistoCode == "D_Ped_ChNb" || HistoCode == "D_Ped_ChDs" )
10969             {read_histo = aMyRootFile->ReadPedestals(HisSizeRead);
10970             if( aMyRootFile->DataExist() == kTRUE ){fStatusDataExist = kTRUE; i_data_exist++;}}
10971       
10972           //...................................................... (GetHistoValues)
10973           if( HistoCode == "D_TNo_ChNb" || HistoCode == "D_TNo_ChDs")
10974             {read_histo = aMyRootFile->ReadTotalNoise(HisSizeRead);
10975             if( aMyRootFile->DataExist() == kTRUE ){fStatusDataExist = kTRUE; i_data_exist++;}}
10976       
10977           if( HistoCode == "D_MCs_ChNb" || HistoCode == "D_MCs_ChDs" )
10978             {read_histo = aMyRootFile->ReadMeanOfCorrelationsBetweenSamples(HisSizeRead);
10979             if( aMyRootFile->DataExist() == kTRUE ){fStatusDataExist = kTRUE; i_data_exist++;}}
10980       
10981           if( HistoCode == "D_LFN_ChNb" || HistoCode == "D_LFN_ChDs" )
10982             {read_histo = aMyRootFile->ReadLowFrequencyNoise(HisSizeRead);
10983             if( aMyRootFile->DataExist() == kTRUE ){fStatusDataExist = kTRUE; i_data_exist++;}}
10984       
10985           if( HistoCode == "D_HFN_ChNb" || HistoCode == "D_HFN_ChDs" )
10986             {read_histo = aMyRootFile->ReadHighFrequencyNoise(HisSizeRead);
10987             if( aMyRootFile->DataExist() == kTRUE ){fStatusDataExist = kTRUE; i_data_exist++;}}
10988       
10989           if( HistoCode == "D_SCs_ChNb" || HistoCode == "D_SCs_ChDs"  )
10990             {read_histo = aMyRootFile->ReadSigmaOfCorrelationsBetweenSamples(HisSizeRead);
10991             if( aMyRootFile->DataExist() == kTRUE ){fStatusDataExist = kTRUE; i_data_exist++;}}
10992 
10993           for(Int_t i=0; i<HisSizeRead; i++){plot_histo(i)=read_histo(i);}
10994         }
10995       else
10996         {
10997           cout << "!TEcnaHistos::GetHistoValues(...)> *** ERROR *** > HisSizeRead not equal to HisSizePlot."
10998                << " HisSizeRead = " << HisSizeRead
10999                << ", HisSizePlot = " << HisSizePlot << fTTBELL << endl;
11000         }
11001     }
11002   return plot_histo;
11003 }
11004 //------- (end of GetHistoValues) -------------
11005 
11006 TString  TEcnaHistos::SetHistoXAxisTitle(const TString HistoCode)
11007 {
11008   // Set histo X axis title
11009 
11010   TString axis_x_var_name;
11011   
11012   if(HistoCode == "D_NOE_ChNb" || HistoCode == "D_Ped_ChNb" ||
11013      HistoCode == "D_TNo_ChNb" || HistoCode == "D_MCs_ChNb" ||
11014      HistoCode == "D_LFN_ChNb" || HistoCode == "D_HFN_ChNb" ||
11015      HistoCode == "D_SCs_ChNb" )
11016     {
11017       if( fFapStexNumber >  0 )
11018         {
11019           if( fFlagSubDet == "EB" ){axis_x_var_name = "Xtal (electronic channel number)";}
11020           if( fFlagSubDet == "EE" ){axis_x_var_name = "Xtal";}
11021         }
11022       if( fFapStexNumber ==  0 )
11023         {
11024           if( fFlagSubDet == "EB" ){axis_x_var_name = "Tower number";}
11025           if( fFlagSubDet == "EE" ){axis_x_var_name = "SC number";}
11026         }
11027     }
11028 
11029   if(HistoCode == "D_NOE_ChDs"){axis_x_var_name = "Number of events";}
11030   if(HistoCode == "D_Ped_ChDs"){axis_x_var_name = "Pedestal";}
11031   if(HistoCode == "D_TNo_ChDs"){axis_x_var_name = "Total Noise";}
11032   if(HistoCode == "D_MCs_ChDs"){axis_x_var_name = "Mean Cor(s,s')";}
11033   if(HistoCode == "D_LFN_ChDs"){axis_x_var_name = "Low Frequency Noise";} 
11034   if(HistoCode == "D_HFN_ChDs"){axis_x_var_name = "High Frequency Noise";}
11035   if(HistoCode == "D_SCs_ChDs"){axis_x_var_name = "Sigmas Cor(s,s')";}
11036   if(HistoCode == "D_MSp_Samp"){axis_x_var_name = "Sample";}
11037   if(HistoCode == "D_SSp_Samp"){axis_x_var_name = "Sample";}
11038   if(HistoCode == "D_Adc_EvDs"){axis_x_var_name = "ADC";}
11039   if(HistoCode == "D_Adc_EvNb"){axis_x_var_name = "Event number";}
11040   if(HistoCode == "H_Ped_Date" || HistoCode == "H_TNo_Date" || HistoCode == "H_MCs_Date" ||
11041      HistoCode == "H_LFN_Date" || HistoCode == "H_HFN_Date" || HistoCode == "H_SCs_Date")
11042     {axis_x_var_name = "Time";}
11043   if(HistoCode == "H_Ped_RuDs"){axis_x_var_name = "Pedestal";}
11044   if(HistoCode == "H_TNo_RuDs"){axis_x_var_name = "Total Noise";}
11045   if(HistoCode == "H_MCs_RuDs"){axis_x_var_name = "Mean Cor(s,s')";}
11046   if(HistoCode == "H_LFN_RuDs"){axis_x_var_name = "Low Frequency Noise";} 
11047   if(HistoCode == "H_HFN_RuDs"){axis_x_var_name = "High Frequency Noise";}
11048   if(HistoCode == "H_SCs_RuDs"){axis_x_var_name = "Sigmas Cor(s,s')";} 
11049 
11050   return axis_x_var_name; 
11051 }
11052 
11053 TString  TEcnaHistos::SetHistoYAxisTitle(const TString HistoCode)
11054 {
11055 // Set histo Y axis title
11056 
11057   TString axis_y_var_name;
11058 
11059   if(HistoCode == "D_NOE_ChNb"){axis_y_var_name = "number of found events";}
11060   if(HistoCode == "D_Ped_ChNb"){axis_y_var_name = "pedestal";}
11061   if(HistoCode == "D_TNo_ChNb"){axis_y_var_name = "total noise";}
11062   if(HistoCode == "D_MCs_ChNb"){axis_y_var_name = "mean of cor(s,s')";}
11063   if(HistoCode == "D_LFN_ChNb"){axis_y_var_name = "low frequency noise";} 
11064   if(HistoCode == "D_HFN_ChNb"){axis_y_var_name = "high frequency noise";}  
11065   if(HistoCode == "D_SCs_ChNb"){axis_y_var_name = "sigma of cor(s,s')";}
11066   
11067   if(HistoCode == "D_NOE_ChDs" ||
11068      HistoCode == "D_Ped_ChDs" || HistoCode == "D_TNo_ChDs" || HistoCode == "D_MCs_ChDs" ||
11069      HistoCode == "D_LFN_ChDs" || HistoCode == "D_HFN_ChDs" || HistoCode == "D_SCs_ChDs" )  
11070     {
11071       if( fFapStexNumber >  0 ){axis_y_var_name = "number of crystals";}
11072       if( fFapStexNumber == 0 )
11073         {
11074           if( fFlagSubDet == "EB" ){axis_y_var_name = "number of towers";}
11075           if( fFlagSubDet == "EE" ){axis_y_var_name = "number of SC's";}
11076         }
11077     }
11078 
11079   if(HistoCode == "D_MSp_Samp"){axis_y_var_name = "Sample mean";}
11080   if(HistoCode == "D_SSp_Samp"){axis_y_var_name = "Sample sigma";}
11081   if(HistoCode == "D_Adc_EvDs"){axis_y_var_name = "number of events";}
11082   if(HistoCode == "D_Adc_EvNb"){axis_y_var_name = "Sample ADC value";}
11083   if(HistoCode == "H_Ped_Date"){axis_y_var_name = "Pedestal";}
11084   if(HistoCode == "H_TNo_Date"){axis_y_var_name = "Total noise";}
11085   if(HistoCode == "H_MCs_Date"){axis_y_var_name = "Mean cor(s,s')";}
11086   if(HistoCode == "H_LFN_Date"){axis_y_var_name = "Low frequency noise";}
11087   if(HistoCode == "H_HFN_Date"){axis_y_var_name = "High frequency noise";}
11088   if(HistoCode == "H_SCs_Date"){axis_y_var_name = "Sigma cor(s,s')";}
11089 
11090   if(HistoCode == "H_Ped_RuDs" || HistoCode == "H_TNo_RuDs" || HistoCode == "H_MCs_RuDs" ||
11091      HistoCode == "H_LFN_RuDs" || HistoCode == "H_HFN_RuDs" ||  HistoCode == "H_SCs_RuDs" ) 
11092     {axis_y_var_name = "number of runs";}
11093 
11094   return axis_y_var_name;
11095 }
11096 //-------------------------------------------------------------------------------
11097 Axis_t TEcnaHistos::GetHistoXinf(const TString HistoCode, const Int_t& HisSize, const TString opt_plot)
11098 {
11099 // Set histo Xinf
11100 
11101   Axis_t xinf_his = (Axis_t)0;
11102 
11103   if(HistoCode == "D_NOE_ChNb"){xinf_his = (Axis_t)0.;}
11104   if(HistoCode == "D_Ped_ChNb"){xinf_his = (Axis_t)0.;}
11105   if(HistoCode == "D_TNo_ChNb"){xinf_his = (Axis_t)0.;}
11106   if(HistoCode == "D_MCs_ChNb"){xinf_his = (Axis_t)0.;}
11107   if(HistoCode == "D_LFN_ChNb"){xinf_his = (Axis_t)0.;} 
11108   if(HistoCode == "D_HFN_ChNb"){xinf_his = (Axis_t)0.;}  
11109   if(HistoCode == "D_SCs_ChNb"){xinf_his = (Axis_t)0.;}
11110 
11111   if(HistoCode == "D_NOE_ChDs"){xinf_his = (Axis_t)fD_NOE_ChNbYmin;}
11112   if(HistoCode == "D_Ped_ChDs"){xinf_his = (Axis_t)fD_Ped_ChNbYmin;}
11113   if(HistoCode == "D_TNo_ChDs"){xinf_his = (Axis_t)fD_TNo_ChNbYmin;}
11114   if(HistoCode == "D_MCs_ChDs"){xinf_his = (Axis_t)fD_MCs_ChNbYmin;}
11115   if(HistoCode == "D_LFN_ChDs"){xinf_his = (Axis_t)fD_LFN_ChNbYmin;}
11116   if(HistoCode == "D_HFN_ChDs"){xinf_his = (Axis_t)fD_HFN_ChNbYmin;}
11117   if(HistoCode == "D_SCs_ChDs"){xinf_his = (Axis_t)fD_SCs_ChNbYmin;}
11118   
11119   if(HistoCode == "D_MSp_Samp"){xinf_his = (Axis_t)0.;}
11120   if(HistoCode == "D_SSp_Samp"){xinf_his = (Axis_t)0.;}
11121 
11122   if(HistoCode == "D_Adc_EvNb"){xinf_his = (Axis_t)0.;}
11123   if(HistoCode == "D_Adc_EvDs"){xinf_his = (Axis_t)fD_Adc_EvNbYmin;}  // D_Adc_EvDs = projection of D_Adc_EvNb
11124 
11125   if(HistoCode == "H_Ped_Date"){xinf_his = (Axis_t)0.;}
11126   if(HistoCode == "H_TNo_Date"){xinf_his = (Axis_t)0.;}
11127   if(HistoCode == "H_MCs_Date"){xinf_his = (Axis_t)0.;}
11128   if(HistoCode == "H_LFN_Date"){xinf_his = (Axis_t)0.;}
11129   if(HistoCode == "H_HFN_Date"){xinf_his = (Axis_t)0.;}
11130   if(HistoCode == "H_SCs_Date"){xinf_his = (Axis_t)0.;}
11131 
11132   if(HistoCode == "H_Ped_RuDs"){xinf_his = (Axis_t)fH_Ped_RuDsYmin;}
11133   if(HistoCode == "H_TNo_RuDs"){xinf_his = (Axis_t)fH_TNo_RuDsYmin;}
11134   if(HistoCode == "H_MCs_RuDs"){xinf_his = (Axis_t)fH_MCs_RuDsYmin;}
11135   if(HistoCode == "H_LFN_RuDs"){xinf_his = (Axis_t)fH_LFN_RuDsYmin;}
11136   if(HistoCode == "H_HFN_RuDs"){xinf_his = (Axis_t)fH_HFN_RuDsYmin;}
11137   if(HistoCode == "H_SCs_RuDs"){xinf_his = (Axis_t)fH_SCs_RuDsYmin;}
11138 
11139   return xinf_his;
11140 }
11141 
11142 Axis_t TEcnaHistos::GetHistoXsup(const TString HistoCode, const Int_t& HisSize, const TString opt_plot)
11143 {
11144 // Set histo Xsup
11145 
11146   Axis_t xsup_his = (Axis_t)0; 
11147 
11148   if(HistoCode == "D_NOE_ChNb"){xsup_his = (Axis_t)HisSize;}
11149   if(HistoCode == "D_Ped_ChNb"){xsup_his = (Axis_t)HisSize;}
11150   if(HistoCode == "D_TNo_ChNb"){xsup_his = (Axis_t)HisSize;}
11151   if(HistoCode == "D_MCs_ChNb"){xsup_his = (Axis_t)HisSize;}
11152   if(HistoCode == "D_LFN_ChNb"){xsup_his = (Axis_t)HisSize;} 
11153   if(HistoCode == "D_HFN_ChNb"){xsup_his = (Axis_t)HisSize;}  
11154   if(HistoCode == "D_SCs_ChNb"){xsup_his = (Axis_t)HisSize;}
11155 
11156   if(HistoCode == "D_NOE_ChDs"){xsup_his = (Axis_t)fD_NOE_ChNbYmax;}
11157   if(HistoCode == "D_Ped_ChDs"){xsup_his = (Axis_t)fD_Ped_ChNbYmax;}
11158   if(HistoCode == "D_TNo_ChDs"){xsup_his = (Axis_t)fD_TNo_ChNbYmax;}
11159   if(HistoCode == "D_MCs_ChDs"){xsup_his = (Axis_t)fD_MCs_ChNbYmax;}
11160   if(HistoCode == "D_LFN_ChDs"){xsup_his = (Axis_t)fD_LFN_ChNbYmax;}
11161   if(HistoCode == "D_HFN_ChDs"){xsup_his = (Axis_t)fD_HFN_ChNbYmax;}
11162   if(HistoCode == "D_SCs_ChDs"){xsup_his = (Axis_t)fD_SCs_ChNbYmax;}
11163 
11164   if(HistoCode == "D_MSp_Samp"){xsup_his = (Axis_t)HisSize;}
11165   if(HistoCode == "D_SSp_Samp"){xsup_his = (Axis_t)HisSize;}
11166   
11167   if(HistoCode == "D_Adc_EvNb"){xsup_his = (Axis_t)(fFapReqNbOfEvts);}
11168   if(HistoCode == "D_Adc_EvDs"){xsup_his = (Axis_t)fD_Adc_EvNbYmax;}
11169 
11170   if(HistoCode == "H_Ped_Date"){xsup_his = (Axis_t)0.;}
11171   if(HistoCode == "H_TNo_Date"){xsup_his = (Axis_t)0.;}
11172   if(HistoCode == "H_MCs_Date"){xsup_his = (Axis_t)0.;}
11173   if(HistoCode == "H_LFN_Date"){xsup_his = (Axis_t)0.;}
11174   if(HistoCode == "H_HFN_Date"){xsup_his = (Axis_t)0.;}
11175   if(HistoCode == "H_SCs_Date"){xsup_his = (Axis_t)0.;}
11176 
11177   if(HistoCode == "H_Ped_RuDs"){xsup_his = (Axis_t)fH_Ped_RuDsYmax;}
11178   if(HistoCode == "H_TNo_RuDs"){xsup_his = (Axis_t)fH_TNo_RuDsYmax;}
11179   if(HistoCode == "H_MCs_RuDs"){xsup_his = (Axis_t)fH_MCs_RuDsYmax;}
11180   if(HistoCode == "H_LFN_RuDs"){xsup_his = (Axis_t)fH_LFN_RuDsYmax;}
11181   if(HistoCode == "H_HFN_RuDs"){xsup_his = (Axis_t)fH_HFN_RuDsYmax;}
11182   if(HistoCode == "H_SCs_RuDs"){xsup_his = (Axis_t)fH_SCs_RuDsYmax;}
11183 
11184   return xsup_his;
11185 }
11186 //-----------------------------------------------------------------------------------
11187 Int_t TEcnaHistos::GetHistoNumberOfBins(const TString HistoCode, const Int_t& HisSize)
11188 {
11189 // Set histo number of bins
11190 
11191   Int_t nb_binx = HisSize;
11192   TString HistoType = fCnaParHistos->GetHistoType(HistoCode.Data());
11193   if ( HistoType == "Proj" ||  HistoType == "SampProj" ||  HistoType == "EvolProj" )
11194     {nb_binx = fNbBinsProj;}
11195 
11196   return nb_binx;
11197 }
11198 //-----------------------------------------------------------------------------------
11199 void TEcnaHistos::FillHisto(TH1D* h_his0, const TVectorD& read_histo, const TString HistoCode,
11200                            const Int_t&  HisSize)
11201 {
11202 // Fill histo
11203 
11204   h_his0->Reset();
11205 
11206   for(Int_t i=0; i<HisSize; i++)
11207     {
11208       Double_t his_val = (Double_t)0;
11209       Double_t xi      = (Double_t)0;
11210       //................................................... Basic + Global
11211       if (HistoCode == "D_MSp_Samp" || HistoCode == "D_SSp_Samp" ||
11212           HistoCode == "D_NOE_ChNb" || HistoCode == "D_Ped_ChNb" ||
11213           HistoCode == "D_LFN_ChNb" || HistoCode == "D_TNo_ChNb" ||
11214           HistoCode == "D_HFN_ChNb" || HistoCode == "D_MCs_ChNb" ||
11215           HistoCode == "D_SCs_ChNb" )
11216         {
11217           xi = (Double_t)i;
11218           his_val = (Double_t)read_histo[i];
11219           h_his0->Fill(xi, his_val);
11220         }
11221       //................................................... EvolProj
11222       //
11223       //    *=======> direct Fill in ViewHistime(...)
11224       //
11225 
11226       //................................................... D_Adc_EvNb option
11227       if (HistoCode == "D_Adc_EvNb" )
11228         {
11229           xi = (Double_t)i;
11230           his_val = (Double_t)read_histo[i];
11231           h_his0->Fill(xi, his_val);
11232         }
11233       //................................................... Proj
11234       if (HistoCode == "D_NOE_ChDs" ||
11235           HistoCode == "D_Ped_ChDs" || HistoCode == "D_LFN_ChDs" ||
11236           HistoCode == "D_TNo_ChDs" || HistoCode == "D_HFN_ChDs" ||
11237           HistoCode == "D_MCs_ChDs" || HistoCode == "D_SCs_ChDs" ||
11238           HistoCode == "D_Adc_EvDs" )
11239         {
11240           his_val = (Double_t)read_histo[i];
11241           Double_t increment = (Double_t)1;
11242           h_his0->Fill(his_val, increment);
11243         }
11244     }
11245 }
11246 
11247 //===========================================================================
11248 //
11249 //          SetXinfMemoFromValue(...), SetXsupMemoFromValue(...)
11250 //          GetXsupValueFromMemo(...), GetXsupValueFromMemo(...)
11251 //
11252 //===========================================================================
11253 void TEcnaHistos::SetXinfMemoFromValue(const TString HistoCode, const Double_t& value)
11254 {
11255   if( HistoCode == "D_NOE_ChNb"){fD_NOE_ChNbXinf = value;}
11256   if( HistoCode == "D_NOE_ChDs"){fD_NOE_ChDsXinf = value;}  
11257   if( HistoCode == "D_Ped_ChNb"){fD_Ped_ChNbXinf = value;} 
11258   if( HistoCode == "D_Ped_ChDs"){fD_Ped_ChDsXinf = value;} 
11259   if( HistoCode == "D_TNo_ChNb"){fD_TNo_ChNbXinf = value;}
11260   if( HistoCode == "D_TNo_ChDs"){fD_TNo_ChDsXinf = value;} 
11261   if( HistoCode == "D_MCs_ChNb"){fD_MCs_ChNbXinf = value;} 
11262   if( HistoCode == "D_MCs_ChDs"){fD_MCs_ChDsXinf = value;} 
11263   if( HistoCode == "D_LFN_ChNb"){fD_LFN_ChNbXinf = value;} 
11264   if( HistoCode == "D_LFN_ChDs"){fD_LFN_ChDsXinf = value;}
11265   if( HistoCode == "D_HFN_ChNb"){fD_HFN_ChNbXinf = value;} 
11266   if( HistoCode == "D_HFN_ChDs"){fD_HFN_ChDsXinf = value;} 
11267   if( HistoCode == "D_SCs_ChNb"){fD_SCs_ChNbXinf = value;}
11268   if( HistoCode == "D_SCs_ChDs"){fD_SCs_ChDsXinf = value;}
11269   if( HistoCode == "D_MSp_Samp"){fD_Ped_ChNbXinf = value;}
11270   if( HistoCode == "D_SSp_Samp"){fD_TNo_ChNbXinf = value;}
11271   if( HistoCode == "D_Adc_EvDs"){fD_Adc_EvDsXinf = value;}
11272   if( HistoCode == "D_Adc_EvNb"){fD_Ped_ChNbXinf = value;}
11273   if( HistoCode == "H_Ped_Date"){fH_Ped_DateXinf = value;}
11274   if( HistoCode == "H_TNo_Date"){fH_TNo_DateXinf = value;}
11275   if( HistoCode == "H_MCs_Date"){fH_MCs_DateXinf = value;}
11276   if( HistoCode == "H_LFN_Date"){fH_LFN_DateXinf = value;}
11277   if( HistoCode == "H_HFN_Date"){fH_HFN_DateXinf = value;}
11278   if( HistoCode == "H_SCs_Date"){fH_SCs_DateXinf = value;}
11279   if( HistoCode == "H_Ped_RuDs"){fH_Ped_RuDsXinf = value;}
11280   if( HistoCode == "H_TNo_RuDs"){fH_TNo_RuDsXinf = value;}
11281   if( HistoCode == "H_MCs_RuDs"){fH_MCs_RuDsXinf = value;}
11282   if( HistoCode == "H_LFN_RuDs"){fH_LFN_RuDsXinf = value;}
11283   if( HistoCode == "H_HFN_RuDs"){fH_HFN_RuDsXinf = value;}
11284   if( HistoCode == "H_SCs_RuDs"){fH_SCs_RuDsXinf = value;}
11285 }// end of SetXinfMemoFromValue(...)
11286 
11287 void TEcnaHistos::SetXinfMemoFromValue(const Double_t& value)
11288 {fH1SameOnePlotXinf = value;}
11289 
11290 void TEcnaHistos::SetXsupMemoFromValue(const TString HistoCode, const Double_t& value)
11291 {
11292   if( HistoCode == "D_NOE_ChNb"){fD_NOE_ChNbXsup = value;}
11293   if( HistoCode == "D_NOE_ChDs"){fD_NOE_ChDsXsup = value;}  
11294   if( HistoCode == "D_Ped_ChNb"){fD_Ped_ChNbXsup = value;} 
11295   if( HistoCode == "D_Ped_ChDs"){fD_Ped_ChDsXsup = value;} 
11296   if( HistoCode == "D_TNo_ChNb"){fD_TNo_ChNbXsup = value;}
11297   if( HistoCode == "D_TNo_ChDs"){fD_TNo_ChDsXsup = value;} 
11298   if( HistoCode == "D_MCs_ChNb"){fD_MCs_ChNbXsup = value;} 
11299   if( HistoCode == "D_MCs_ChDs"){fD_MCs_ChDsXsup = value;} 
11300   if( HistoCode == "D_LFN_ChNb"){fD_LFN_ChNbXsup = value;} 
11301   if( HistoCode == "D_LFN_ChDs"){fD_LFN_ChDsXsup = value;}
11302   if( HistoCode == "D_HFN_ChNb"){fD_HFN_ChNbXsup = value;} 
11303   if( HistoCode == "D_HFN_ChDs"){fD_HFN_ChDsXsup = value;} 
11304   if( HistoCode == "D_SCs_ChNb"){fD_SCs_ChNbXsup = value;}
11305   if( HistoCode == "D_SCs_ChDs"){fD_SCs_ChDsXsup = value;}
11306   if( HistoCode == "D_MSp_Samp"){fD_Ped_ChNbXsup = value;}
11307   if( HistoCode == "D_SSp_Samp"){fD_TNo_ChNbXsup = value;}
11308   if( HistoCode == "D_Adc_EvDs"){fD_Adc_EvDsXsup = value;}
11309   if( HistoCode == "D_Adc_EvNb"){fD_Ped_ChNbXsup = value;}
11310   if( HistoCode == "H_Ped_Date"){fH_Ped_DateXsup = value;}
11311   if( HistoCode == "H_TNo_Date"){fH_TNo_DateXsup = value;}
11312   if( HistoCode == "H_MCs_Date"){fH_MCs_DateXsup = value;}
11313   if( HistoCode == "H_LFN_Date"){fH_LFN_DateXsup = value;}
11314   if( HistoCode == "H_HFN_Date"){fH_HFN_DateXsup = value;}
11315   if( HistoCode == "H_SCs_Date"){fH_SCs_DateXsup = value;}
11316   if( HistoCode == "H_Ped_RuDs"){fH_Ped_RuDsXsup = value;}
11317   if( HistoCode == "H_TNo_RuDs"){fH_TNo_RuDsXsup = value;}
11318   if( HistoCode == "H_MCs_RuDs"){fH_MCs_RuDsXsup = value;}
11319   if( HistoCode == "H_LFN_RuDs"){fH_LFN_RuDsXsup = value;}
11320   if( HistoCode == "H_HFN_RuDs"){fH_HFN_RuDsXsup = value;}
11321   if( HistoCode == "H_SCs_RuDs"){fH_SCs_RuDsXsup = value;}
11322 }// end of SetXsupMemoFromValue(...)
11323 
11324 void TEcnaHistos::SetXsupMemoFromValue(const Double_t& value)
11325 {fH1SameOnePlotXsup = value;}
11326 
11327 Double_t TEcnaHistos::GetXinfValueFromMemo(const TString HistoCode)
11328 {
11329   Double_t val_inf      = (Double_t)0.;
11330 
11331    if( HistoCode == "D_NOE_ChNb"){val_inf = fD_NOE_ChNbXinf;}
11332    if( HistoCode == "D_NOE_ChDs"){val_inf = fD_NOE_ChDsXinf;}  
11333    if( HistoCode == "D_Ped_ChNb"){val_inf = fD_Ped_ChNbXinf;} 
11334    if( HistoCode == "D_Ped_ChDs"){val_inf = fD_Ped_ChDsXinf;} 
11335    if( HistoCode == "D_TNo_ChNb"){val_inf = fD_TNo_ChNbXinf;}
11336    if( HistoCode == "D_TNo_ChDs"){val_inf = fD_TNo_ChDsXinf;} 
11337    if( HistoCode == "D_MCs_ChNb"){val_inf = fD_MCs_ChNbXinf;} 
11338    if( HistoCode == "D_MCs_ChDs"){val_inf = fD_MCs_ChDsXinf;} 
11339    if( HistoCode == "D_LFN_ChNb"){val_inf = fD_LFN_ChNbXinf;} 
11340    if( HistoCode == "D_LFN_ChDs"){val_inf = fD_LFN_ChDsXinf;}
11341    if( HistoCode == "D_HFN_ChNb"){val_inf = fD_HFN_ChNbXinf;} 
11342    if( HistoCode == "D_HFN_ChDs"){val_inf = fD_HFN_ChDsXinf;} 
11343    if( HistoCode == "D_SCs_ChNb"){val_inf = fD_SCs_ChNbXinf;}
11344    if( HistoCode == "D_SCs_ChDs"){val_inf = fD_SCs_ChDsXinf;}
11345    if( HistoCode == "D_MSp_Samp"){val_inf = fD_Ped_ChNbXinf;}
11346    if( HistoCode == "D_SSp_Samp"){val_inf = fD_TNo_ChNbXinf;}
11347    if( HistoCode == "D_Adc_EvDs"){val_inf = fD_Adc_EvDsXinf;}
11348    if( HistoCode == "D_Adc_EvNb"){val_inf = fD_Adc_EvNbXinf;}
11349    if( HistoCode == "H_Ped_Date"){val_inf = fH_Ped_DateXinf;}
11350    if( HistoCode == "H_TNo_Date"){val_inf = fH_TNo_DateXinf;}
11351    if( HistoCode == "H_MCs_Date"){val_inf = fH_MCs_DateXinf;}
11352    if( HistoCode == "H_LFN_Date"){val_inf = fH_LFN_DateXinf;}
11353    if( HistoCode == "H_HFN_Date"){val_inf = fH_HFN_DateXinf;}
11354    if( HistoCode == "H_SCs_Date"){val_inf = fH_SCs_DateXinf;}
11355    if( HistoCode == "H_Ped_RuDs"){val_inf = fH_Ped_RuDsXinf;}
11356    if( HistoCode == "H_TNo_RuDs"){val_inf = fH_TNo_RuDsXinf;}
11357    if( HistoCode == "H_MCs_RuDs"){val_inf = fH_MCs_RuDsXinf;}
11358    if( HistoCode == "H_LFN_RuDs"){val_inf = fH_LFN_RuDsXinf;}
11359    if( HistoCode == "H_HFN_RuDs"){val_inf = fH_HFN_RuDsXinf;}
11360    if( HistoCode == "H_SCs_RuDs"){val_inf = fH_SCs_RuDsXinf;}
11361   return val_inf;
11362 }// end of GetXinfValueFromMemo(...)
11363 
11364 Double_t TEcnaHistos::GetXinfValueFromMemo()
11365 {return fH1SameOnePlotXinf;}
11366 
11367 Double_t TEcnaHistos::GetXsupValueFromMemo(const TString HistoCode)
11368 {
11369   Double_t val_sup      = (Double_t)0.;
11370 
11371    if( HistoCode == "D_NOE_ChNb"){val_sup = fD_NOE_ChNbXsup;}
11372    if( HistoCode == "D_NOE_ChDs"){val_sup = fD_NOE_ChDsXsup;}  
11373    if( HistoCode == "D_Ped_ChNb"){val_sup = fD_Ped_ChNbXsup;} 
11374    if( HistoCode == "D_Ped_ChDs"){val_sup = fD_Ped_ChDsXsup;} 
11375    if( HistoCode == "D_TNo_ChNb"){val_sup = fD_TNo_ChNbXsup;}
11376    if( HistoCode == "D_TNo_ChDs"){val_sup = fD_TNo_ChDsXsup;} 
11377    if( HistoCode == "D_MCs_ChNb"){val_sup = fD_MCs_ChNbXsup;} 
11378    if( HistoCode == "D_MCs_ChDs"){val_sup = fD_MCs_ChDsXsup;} 
11379    if( HistoCode == "D_LFN_ChNb"){val_sup = fD_LFN_ChNbXsup;} 
11380    if( HistoCode == "D_LFN_ChDs"){val_sup = fD_LFN_ChDsXsup;}
11381    if( HistoCode == "D_HFN_ChNb"){val_sup = fD_HFN_ChNbXsup;} 
11382    if( HistoCode == "D_HFN_ChDs"){val_sup = fD_HFN_ChDsXsup;} 
11383    if( HistoCode == "D_SCs_ChNb"){val_sup = fD_SCs_ChNbXsup;}
11384    if( HistoCode == "D_SCs_ChDs"){val_sup = fD_SCs_ChDsXsup;}
11385    if( HistoCode == "D_MSp_Samp"){val_sup = fD_Ped_ChNbXsup;}
11386    if( HistoCode == "D_SSp_Samp"){val_sup = fD_TNo_ChNbXsup;}
11387    if( HistoCode == "D_Adc_EvDs"){val_sup = fD_Adc_EvDsXsup;}
11388    if( HistoCode == "D_Adc_EvNb"){val_sup = fD_Adc_EvNbXsup;}
11389    if( HistoCode == "H_Ped_Date"){val_sup = fH_Ped_DateXsup;}
11390    if( HistoCode == "H_TNo_Date"){val_sup = fH_TNo_DateXsup;}
11391    if( HistoCode == "H_MCs_Date"){val_sup = fH_MCs_DateXsup;}
11392    if( HistoCode == "H_LFN_Date"){val_sup = fH_LFN_DateXsup;}
11393    if( HistoCode == "H_HFN_Date"){val_sup = fH_HFN_DateXsup;}
11394    if( HistoCode == "H_SCs_Date"){val_sup = fH_SCs_DateXsup;}
11395    if( HistoCode == "H_Ped_RuDs"){val_sup = fH_Ped_RuDsXsup;}
11396    if( HistoCode == "H_TNo_RuDs"){val_sup = fH_TNo_RuDsXsup;}
11397    if( HistoCode == "H_MCs_RuDs"){val_sup = fH_MCs_RuDsXsup;}
11398    if( HistoCode == "H_LFN_RuDs"){val_sup = fH_LFN_RuDsXsup;}
11399    if( HistoCode == "H_HFN_RuDs"){val_sup = fH_HFN_RuDsXsup;}
11400    if( HistoCode == "H_SCs_RuDs"){val_sup = fH_SCs_RuDsXsup;}
11401   return val_sup;
11402 }// end of GetXsupValueFromMemo(...)
11403 
11404 Double_t TEcnaHistos::GetXsupValueFromMemo()
11405 {return fH1SameOnePlotXsup;}
11406 
11407 //-------------------------------------------------------------------------------------------
11408 //
11409 //           SetHistoMin, SetHistoMax, SetAllYminYmaxMemoFromDefaultValues
11410 //
11411 //       D O N ' T   S U P P R E S S  : THESE METHODS CAN BE CALLED BY EXTERNAL OBJECTS 
11412 //
11413 //-------------------------------------------------------------------------------------------
11414 void TEcnaHistos::SetHistoMin(const Double_t& value){fUserHistoMin = value; fFlagUserHistoMin = "ON";}
11415 void TEcnaHistos::SetHistoMax(const Double_t& value){fUserHistoMax = value; fFlagUserHistoMax = "ON";}
11416 
11417 void TEcnaHistos::SetHistoMin(){fFlagUserHistoMin = "AUTO";}
11418 void TEcnaHistos::SetHistoMax(){fFlagUserHistoMax = "AUTO";}
11419 
11420 void TEcnaHistos::SetAllYminYmaxMemoFromDefaultValues()
11421 {
11422 //.......... Default values for histo min and max
11423 
11424   SetYminMemoFromValue("D_NOE_ChNb", fCnaParHistos->GetYminDefaultValue("D_NOE_ChNb"));
11425   SetYmaxMemoFromValue("D_NOE_ChNb", fCnaParHistos->GetYmaxDefaultValue("D_NOE_ChNb"));
11426 
11427   SetYminMemoFromValue("D_NOE_ChDs", fCnaParHistos->GetYminDefaultValue("D_NOE_ChDs"));
11428   SetYmaxMemoFromValue("D_NOE_ChDs", fCnaParHistos->GetYmaxDefaultValue("D_NOE_ChDs"));
11429 
11430   SetYminMemoFromValue("D_Ped_ChNb", fCnaParHistos->GetYminDefaultValue("D_Ped_ChNb"));
11431   SetYmaxMemoFromValue("D_Ped_ChNb", fCnaParHistos->GetYmaxDefaultValue("D_Ped_ChNb"));
11432 
11433   SetYminMemoFromValue("D_Ped_ChDs", fCnaParHistos->GetYminDefaultValue("D_Ped_ChDs"));
11434   SetYmaxMemoFromValue("D_Ped_ChDs", fCnaParHistos->GetYmaxDefaultValue("D_Ped_ChDs"));
11435 
11436   SetYminMemoFromValue("D_TNo_ChNb", fCnaParHistos->GetYminDefaultValue("D_TNo_ChNb"));
11437   SetYmaxMemoFromValue("D_TNo_ChNb", fCnaParHistos->GetYmaxDefaultValue("D_TNo_ChNb"));
11438 
11439   SetYminMemoFromValue("D_TNo_ChDs", fCnaParHistos->GetYminDefaultValue("D_TNo_ChDs"));
11440   SetYmaxMemoFromValue("D_TNo_ChDs", fCnaParHistos->GetYmaxDefaultValue("D_TNo_ChDs"));
11441 
11442   SetYminMemoFromValue("D_MCs_ChNb", fCnaParHistos->GetYminDefaultValue("D_MCs_ChNb"));
11443   SetYmaxMemoFromValue("D_MCs_ChNb", fCnaParHistos->GetYmaxDefaultValue("D_MCs_ChNb"));
11444 
11445   SetYminMemoFromValue("D_MCs_ChDs", fCnaParHistos->GetYminDefaultValue("D_MCs_ChDs"));
11446   SetYmaxMemoFromValue("D_MCs_ChDs", fCnaParHistos->GetYmaxDefaultValue("D_MCs_ChDs"));
11447 
11448   SetYminMemoFromValue("D_LFN_ChNb", fCnaParHistos->GetYminDefaultValue("D_LFN_ChNb"));
11449   SetYmaxMemoFromValue("D_LFN_ChNb", fCnaParHistos->GetYmaxDefaultValue("D_LFN_ChNb"));
11450 
11451   SetYminMemoFromValue("D_LFN_ChDs", fCnaParHistos->GetYminDefaultValue("D_LFN_ChDs"));
11452   SetYmaxMemoFromValue("D_LFN_ChDs", fCnaParHistos->GetYmaxDefaultValue("D_LFN_ChDs"));
11453 
11454   SetYminMemoFromValue("D_HFN_ChNb", fCnaParHistos->GetYminDefaultValue("D_HFN_ChNb"));
11455   SetYmaxMemoFromValue("D_HFN_ChNb", fCnaParHistos->GetYmaxDefaultValue("D_HFN_ChNb"));
11456 
11457   SetYminMemoFromValue("D_HFN_ChDs", fCnaParHistos->GetYminDefaultValue("D_HFN_ChDs"));
11458   SetYmaxMemoFromValue("D_HFN_ChDs", fCnaParHistos->GetYmaxDefaultValue("D_HFN_ChDs"));
11459 
11460   SetYminMemoFromValue("D_SCs_ChNb", fCnaParHistos->GetYminDefaultValue("D_SCs_ChNb"));
11461   SetYmaxMemoFromValue("D_SCs_ChNb", fCnaParHistos->GetYmaxDefaultValue("D_SCs_ChNb"));
11462 
11463   SetYminMemoFromValue("D_SCs_ChDs", fCnaParHistos->GetYminDefaultValue("D_SCs_ChDs"));
11464   SetYmaxMemoFromValue("D_SCs_ChDs", fCnaParHistos->GetYmaxDefaultValue("D_SCs_ChDs"));
11465 
11466   SetYminMemoFromValue("D_MSp_Samp", fCnaParHistos->GetYminDefaultValue("D_MSp_Samp"));
11467   SetYmaxMemoFromValue("D_MSp_Samp", fCnaParHistos->GetYmaxDefaultValue("D_MSp_Samp"));
11468 
11469   SetYminMemoFromValue("D_SSp_Samp", fCnaParHistos->GetYminDefaultValue("D_SSp_Samp"));
11470   SetYmaxMemoFromValue("D_SSp_Samp", fCnaParHistos->GetYmaxDefaultValue("D_SSp_Samp"));
11471 
11472   SetYminMemoFromValue("D_Adc_EvDs", fCnaParHistos->GetYminDefaultValue("D_Adc_EvDs"));
11473   SetYmaxMemoFromValue("D_Adc_EvDs", fCnaParHistos->GetYmaxDefaultValue("D_Adc_EvDs"));
11474 
11475   SetYminMemoFromValue("D_Adc_EvNb", fCnaParHistos->GetYminDefaultValue("D_Adc_EvNb"));
11476   SetYmaxMemoFromValue("D_Adc_EvNb", fCnaParHistos->GetYmaxDefaultValue("D_Adc_EvNb"));
11477 
11478   SetYminMemoFromValue("H_Ped_Date", fCnaParHistos->GetYminDefaultValue("H_Ped_Date"));
11479   SetYmaxMemoFromValue("H_Ped_Date", fCnaParHistos->GetYmaxDefaultValue("H_Ped_Date"));
11480 
11481   SetYminMemoFromValue("H_TNo_Date", fCnaParHistos->GetYminDefaultValue("H_TNo_Date"));
11482   SetYmaxMemoFromValue("H_TNo_Date", fCnaParHistos->GetYmaxDefaultValue("H_TNo_Date"));
11483 
11484   SetYminMemoFromValue("H_LFN_Date", fCnaParHistos->GetYminDefaultValue("H_LFN_Date"));
11485   SetYmaxMemoFromValue("H_LFN_Date", fCnaParHistos->GetYmaxDefaultValue("H_LFN_Date"));
11486 
11487   SetYminMemoFromValue("H_HFN_Date", fCnaParHistos->GetYminDefaultValue("H_HFN_Date"));
11488   SetYmaxMemoFromValue("H_HFN_Date", fCnaParHistos->GetYmaxDefaultValue("H_HFN_Date"));
11489 
11490   SetYminMemoFromValue("H_MCs_Date", fCnaParHistos->GetYminDefaultValue("H_MCs_Date"));
11491   SetYmaxMemoFromValue("H_MCs_Date", fCnaParHistos->GetYmaxDefaultValue("H_MCs_Date"));
11492 
11493   SetYminMemoFromValue("H_SCs_Date", fCnaParHistos->GetYminDefaultValue("H_SCs_Date"));
11494   SetYmaxMemoFromValue("H_SCs_Date", fCnaParHistos->GetYmaxDefaultValue("H_SCs_Date"));
11495 
11496   SetYminMemoFromValue("H_Ped_RuDs", fCnaParHistos->GetYminDefaultValue("H_Ped_RuDs"));
11497   SetYmaxMemoFromValue("H_Ped_RuDs", fCnaParHistos->GetYmaxDefaultValue("H_Ped_RuDs"));
11498 
11499   SetYminMemoFromValue("H_TNo_RuDs", fCnaParHistos->GetYminDefaultValue("H_TNo_RuDs"));
11500   SetYmaxMemoFromValue("H_TNo_RuDs", fCnaParHistos->GetYmaxDefaultValue("H_TNo_RuDs"));
11501 
11502   SetYminMemoFromValue("H_LFN_RuDs", fCnaParHistos->GetYminDefaultValue("H_LFN_RuDs"));
11503   SetYmaxMemoFromValue("H_LFN_RuDs", fCnaParHistos->GetYmaxDefaultValue("H_LFN_RuDs"));
11504 
11505   SetYminMemoFromValue("H_HFN_RuDs", fCnaParHistos->GetYminDefaultValue("H_HFN_RuDs"));
11506   SetYmaxMemoFromValue("H_HFN_RuDs", fCnaParHistos->GetYmaxDefaultValue("H_HFN_RuDs"));
11507 
11508   SetYminMemoFromValue("H_MCs_RuDs", fCnaParHistos->GetYminDefaultValue("H_MCs_RuDs"));
11509   SetYmaxMemoFromValue("H_MCs_RuDs", fCnaParHistos->GetYmaxDefaultValue("H_MCs_RuDs"));
11510 
11511   SetYminMemoFromValue("H_SCs_RuDs", fCnaParHistos->GetYminDefaultValue("H_SCs_RuDs"));
11512   SetYmaxMemoFromValue("H_SCs_RuDs", fCnaParHistos->GetYmaxDefaultValue("H_SCs_RuDs"));
11513 
11514   SetYminMemoFromValue("H2LFccMosMatrix", fCnaParHistos->GetYminDefaultValue("H2LFccMosMatrix"));
11515   SetYmaxMemoFromValue("H2LFccMosMatrix", fCnaParHistos->GetYmaxDefaultValue("H2LFccMosMatrix"));
11516 
11517   SetYminMemoFromValue("H2HFccMosMatrix", fCnaParHistos->GetYminDefaultValue("H2HFccMosMatrix"));
11518   SetYmaxMemoFromValue("H2HFccMosMatrix", fCnaParHistos->GetYmaxDefaultValue("H2HFccMosMatrix"));
11519 
11520   SetYminMemoFromValue("H2CorccInStins",  fCnaParHistos->GetYminDefaultValue("H2CorccInStins"));
11521   SetYmaxMemoFromValue("H2CorccInStins",  fCnaParHistos->GetYmaxDefaultValue("H2CorccInStins"));
11522 
11523   //........... set user's min and max flags to "OFF" and values to -1 and +1
11524   fUserHistoMin = -1.; fFlagUserHistoMin = "OFF";
11525   fUserHistoMax =  1.; fFlagUserHistoMax = "OFF";
11526 }
11527 
11528 //===========================================================================
11529 //
11530 //          SetYminMemoFromValue(...), SetYmaxMemoFromValue(...)
11531 //          GetYminValueFromMemo(...), GetYmaxValueFromMemo(...)
11532 //
11533 //===========================================================================
11534 void TEcnaHistos::SetYminMemoFromValue(const TString HistoCode, const Double_t& value)
11535 {
11536   if( HistoCode == "D_NOE_ChNb" ){fD_NOE_ChNbYmin = value;}
11537   if( HistoCode == "D_NOE_ChDs" ){fD_NOE_ChDsYmin = value;}  
11538   if( HistoCode == "D_Ped_ChNb" ){fD_Ped_ChNbYmin = value;} 
11539   if( HistoCode == "D_Ped_ChDs" ){fD_Ped_ChDsYmin = value;} 
11540   if( HistoCode == "D_TNo_ChNb" ){fD_TNo_ChNbYmin = value;}
11541   if( HistoCode == "D_TNo_ChDs" ){fD_TNo_ChDsYmin = value;} 
11542   if( HistoCode == "D_MCs_ChNb" ){fD_MCs_ChNbYmin = value;} 
11543   if( HistoCode == "D_MCs_ChDs" ){fD_MCs_ChDsYmin = value;} 
11544   if( HistoCode == "D_LFN_ChNb" ){fD_LFN_ChNbYmin = value;} 
11545   if( HistoCode == "D_LFN_ChDs" ){fD_LFN_ChDsYmin = value;}
11546   if( HistoCode == "D_HFN_ChNb" ){fD_HFN_ChNbYmin = value;} 
11547   if( HistoCode == "D_HFN_ChDs" ){fD_HFN_ChDsYmin = value;} 
11548   if( HistoCode == "D_SCs_ChNb" ){fD_SCs_ChNbYmin = value;}
11549   if( HistoCode == "D_SCs_ChDs" ){fD_SCs_ChDsYmin = value;}
11550   if( HistoCode == "D_MSp_Samp" ){fD_Ped_ChNbYmin = value;}
11551   if( HistoCode == "D_SSp_Samp" ){fD_TNo_ChNbYmin = value;}
11552   if( HistoCode == "D_Adc_EvDs" ){fD_Adc_EvDsYmin = value;}
11553   if( HistoCode == "D_Adc_EvNb" ){fD_Ped_ChNbYmin = value;}
11554   if( HistoCode == "H_Ped_Date" ){fH_Ped_DateYmin = value;}
11555   if( HistoCode == "H_TNo_Date" ){fH_TNo_DateYmin = value;}
11556   if( HistoCode == "H_MCs_Date" ){fH_MCs_DateYmin = value;}
11557   if( HistoCode == "H_LFN_Date" ){fH_LFN_DateYmin = value;}
11558   if( HistoCode == "H_HFN_Date" ){fH_HFN_DateYmin = value;}
11559   if( HistoCode == "H_SCs_Date" ){fH_SCs_DateYmin = value;}
11560   if( HistoCode == "H_Ped_RuDs" ){fH_Ped_RuDsYmin = value;}
11561   if( HistoCode == "H_TNo_RuDs" ){fH_TNo_RuDsYmin = value;}
11562   if( HistoCode == "H_MCs_RuDs" ){fH_MCs_RuDsYmin = value;}
11563   if( HistoCode == "H_LFN_RuDs" ){fH_LFN_RuDsYmin = value;}
11564   if( HistoCode == "H_HFN_RuDs" ){fH_HFN_RuDsYmin = value;}
11565   if( HistoCode == "H_SCs_RuDs" ){fH_SCs_RuDsYmin = value;}
11566   if( HistoCode == "H2LFccMosMatrix" ){fH2LFccMosMatrixYmin = value;}
11567   if( HistoCode == "H2HFccMosMatrix" ){fH2HFccMosMatrixYmin = value;}
11568   if( HistoCode == "H2CorccInStins"  ){fH2CorccInStinsYmin  = value;}
11569 }// end of SetYminMemoFromValue(...)
11570 
11571 void TEcnaHistos::SetYmaxMemoFromValue(const TString HistoCode, const Double_t& value)
11572 {
11573   if( HistoCode == "D_NOE_ChNb" ){fD_NOE_ChNbYmax = value;}
11574   if( HistoCode == "D_NOE_ChDs" ){fD_NOE_ChDsYmax = value;}  
11575   if( HistoCode == "D_Ped_ChNb" ){fD_Ped_ChNbYmax = value;} 
11576   if( HistoCode == "D_Ped_ChDs" ){fD_Ped_ChDsYmax = value;} 
11577   if( HistoCode == "D_TNo_ChNb" ){fD_TNo_ChNbYmax = value;}
11578   if( HistoCode == "D_TNo_ChDs" ){fD_TNo_ChDsYmax = value;} 
11579   if( HistoCode == "D_MCs_ChNb" ){fD_MCs_ChNbYmax = value;} 
11580   if( HistoCode == "D_MCs_ChDs" ){fD_MCs_ChDsYmax = value;} 
11581   if( HistoCode == "D_LFN_ChNb" ){fD_LFN_ChNbYmax = value;} 
11582   if( HistoCode == "D_LFN_ChDs" ){fD_LFN_ChDsYmax = value;}
11583   if( HistoCode == "D_HFN_ChNb" ){fD_HFN_ChNbYmax = value;} 
11584   if( HistoCode == "D_HFN_ChDs" ){fD_HFN_ChDsYmax = value;} 
11585   if( HistoCode == "D_SCs_ChNb" ){fD_SCs_ChNbYmax = value;}
11586   if( HistoCode == "D_SCs_ChDs" ){fD_SCs_ChDsYmax = value;}
11587   if( HistoCode == "D_MSp_Samp" ){fD_Ped_ChNbYmax = value;}
11588   if( HistoCode == "D_SSp_Samp" ){fD_TNo_ChNbYmax = value;}
11589   if( HistoCode == "D_Adc_EvDs" ){fD_Adc_EvDsYmax = value;}
11590   if( HistoCode == "D_Adc_EvNb" ){fD_Ped_ChNbYmax = value;}
11591   if( HistoCode == "H_Ped_Date" ){fH_Ped_DateYmax = value;}
11592   if( HistoCode == "H_TNo_Date" ){fH_TNo_DateYmax = value;}
11593   if( HistoCode == "H_MCs_Date" ){fH_MCs_DateYmax = value;}
11594   if( HistoCode == "H_LFN_Date" ){fH_LFN_DateYmax = value;}
11595   if( HistoCode == "H_HFN_Date" ){fH_HFN_DateYmax = value;}
11596   if( HistoCode == "H_SCs_Date" ){fH_SCs_DateYmax = value;}
11597   if( HistoCode == "H_Ped_RuDs" ){fH_Ped_RuDsYmax = value;}
11598   if( HistoCode == "H_TNo_RuDs" ){fH_TNo_RuDsYmax = value;}
11599   if( HistoCode == "H_MCs_RuDs" ){fH_MCs_RuDsYmax = value;}
11600   if( HistoCode == "H_LFN_RuDs" ){fH_LFN_RuDsYmax = value;}
11601   if( HistoCode == "H_HFN_RuDs" ){fH_HFN_RuDsYmax = value;}
11602   if( HistoCode == "H_SCs_RuDs" ){fH_SCs_RuDsYmax = value;}
11603   if( HistoCode == "H2LFccMosMatrix" ){fH2LFccMosMatrixYmax = value;}
11604   if( HistoCode == "H2HFccMosMatrix" ){fH2HFccMosMatrixYmax = value;}
11605   if( HistoCode == "H2CorccInStins"  ){fH2CorccInStinsYmax  = value;}
11606 }// end of SetYmaxMemoFromValue(...)
11607 
11608 Double_t TEcnaHistos::GetYminValueFromMemo(const TString HistoCode)
11609 {
11610   Double_t val_min      = (Double_t)0.;
11611   Double_t val_min_proj = (Double_t)0.1;
11612 
11613    if( HistoCode == "D_NOE_ChNb" ){val_min = fD_NOE_ChNbYmin;}
11614    if( HistoCode == "D_NOE_ChDs" ){val_min = val_min_proj;}  
11615    if( HistoCode == "D_Ped_ChNb" ){val_min = fD_Ped_ChNbYmin;} 
11616    if( HistoCode == "D_Ped_ChDs" ){val_min = val_min_proj;} 
11617    if( HistoCode == "D_TNo_ChNb" ){val_min = fD_TNo_ChNbYmin;}
11618    if( HistoCode == "D_TNo_ChDs" ){val_min = val_min_proj;} 
11619    if( HistoCode == "D_MCs_ChNb" ){val_min = fD_MCs_ChNbYmin;} 
11620    if( HistoCode == "D_MCs_ChDs" ){val_min = val_min_proj;} 
11621    if( HistoCode == "D_LFN_ChNb" ){val_min = fD_LFN_ChNbYmin;} 
11622    if( HistoCode == "D_LFN_ChDs" ){val_min = val_min_proj;}
11623    if( HistoCode == "D_HFN_ChNb" ){val_min = fD_HFN_ChNbYmin;} 
11624    if( HistoCode == "D_HFN_ChDs" ){val_min = val_min_proj;} 
11625    if( HistoCode == "D_SCs_ChNb" ){val_min = fD_SCs_ChNbYmin;}
11626    if( HistoCode == "D_SCs_ChDs" ){val_min = val_min_proj;}
11627    if( HistoCode == "D_MSp_Samp" ){val_min = fD_Ped_ChNbYmin;}
11628    if( HistoCode == "D_SSp_Samp" ){val_min = fD_TNo_ChNbYmin;}
11629    if( HistoCode == "D_Adc_EvDs" ){val_min = val_min_proj;}
11630    if( HistoCode == "D_Adc_EvNb" ){val_min = fD_Ped_ChNbYmin;}
11631    if( HistoCode == "H_Ped_Date" ){val_min = fH_Ped_DateYmin;}
11632    if( HistoCode == "H_TNo_Date" ){val_min = fH_TNo_DateYmin;}
11633    if( HistoCode == "H_MCs_Date" ){val_min = fH_MCs_DateYmin;}
11634    if( HistoCode == "H_LFN_Date" ){val_min = fH_LFN_DateYmin;}
11635    if( HistoCode == "H_HFN_Date" ){val_min = fH_HFN_DateYmin;}
11636    if( HistoCode == "H_SCs_Date" ){val_min = fH_SCs_DateYmin;}
11637    if( HistoCode == "H_Ped_RuDs" ){val_min = fH_Ped_RuDsYmin;}
11638    if( HistoCode == "H_TNo_RuDs" ){val_min = fH_TNo_RuDsYmin;}
11639    if( HistoCode == "H_MCs_RuDs" ){val_min = fH_MCs_RuDsYmin;}
11640    if( HistoCode == "H_LFN_RuDs" ){val_min = fH_LFN_RuDsYmin;}
11641    if( HistoCode == "H_HFN_RuDs" ){val_min = fH_HFN_RuDsYmin;}
11642    if( HistoCode == "H_SCs_RuDs" ){val_min = fH_SCs_RuDsYmin;}
11643    if( HistoCode == "H2LFccMosMatrix" ){val_min = fH2LFccMosMatrixYmin;}
11644    if( HistoCode == "H2HFccMosMatrix" ){val_min = fH2HFccMosMatrixYmin;}
11645    if( HistoCode == "H2CorccInStins"  ){val_min = fH2CorccInStinsYmin;}
11646   return val_min;
11647 }// end of GetYminValueFromMemo(...)
11648 
11649 Double_t TEcnaHistos::GetYmaxValueFromMemo(const TString HistoCode)
11650 {
11651   Double_t val_max      = (Double_t)0.;
11652   Double_t val_max_proj = (Double_t)2000.;
11653 
11654    if( HistoCode == "D_NOE_ChNb" ){val_max = fD_NOE_ChNbYmax;}
11655    if( HistoCode == "D_NOE_ChDs" ){val_max = val_max_proj;} 
11656    if( HistoCode == "D_Ped_ChNb" ){val_max = fD_Ped_ChNbYmax;} 
11657    if( HistoCode == "D_Ped_ChDs" ){val_max = val_max_proj;}  
11658    if( HistoCode == "D_TNo_ChNb" ){val_max = fD_TNo_ChNbYmax;}   
11659    if( HistoCode == "D_TNo_ChDs" ){val_max = val_max_proj;} 
11660    if( HistoCode == "D_MCs_ChNb" ){val_max = fD_MCs_ChNbYmax;}
11661    if( HistoCode == "D_MCs_ChDs" ){val_max = val_max_proj;} 
11662    if( HistoCode == "D_LFN_ChNb" ){val_max = fD_LFN_ChNbYmax;} 
11663    if( HistoCode == "D_LFN_ChDs" ){val_max = val_max_proj;} 
11664    if( HistoCode == "D_HFN_ChNb" ){val_max = fD_HFN_ChNbYmax;}  
11665    if( HistoCode == "D_HFN_ChDs" ){val_max = val_max_proj;} 
11666    if( HistoCode == "D_SCs_ChNb" ){val_max = fD_SCs_ChNbYmax;} 
11667    if( HistoCode == "D_SCs_ChDs" ){val_max = val_max_proj;}
11668    if( HistoCode == "D_MSp_Samp" ){val_max = fD_Ped_ChNbYmax;}
11669    if( HistoCode == "D_SSp_Samp" ){val_max = fD_TNo_ChNbYmax;}
11670    if( HistoCode == "D_Adc_EvDs" ){val_max = val_max_proj;}
11671    if( HistoCode == "D_Adc_EvNb" ){val_max = fD_Ped_ChNbYmax;}
11672    if( HistoCode == "H_Ped_Date" ){val_max = fH_Ped_DateYmax;}
11673    if( HistoCode == "H_TNo_Date" ){val_max = fH_TNo_DateYmax;}
11674    if( HistoCode == "H_MCs_Date" ){val_max = fH_MCs_DateYmax;}
11675    if( HistoCode == "H_LFN_Date" ){val_max = fH_LFN_DateYmax;}
11676    if( HistoCode == "H_HFN_Date" ){val_max = fH_HFN_DateYmax;}
11677    if( HistoCode == "H_SCs_Date" ){val_max = fH_SCs_DateYmax;}
11678    if( HistoCode == "H_Ped_RuDs" ){val_max = fH_Ped_RuDsYmax;}
11679    if( HistoCode == "H_TNo_RuDs" ){val_max = fH_TNo_RuDsYmax;}
11680    if( HistoCode == "H_MCs_RuDs" ){val_max = fH_MCs_RuDsYmax;}
11681    if( HistoCode == "H_LFN_RuDs" ){val_max = fH_LFN_RuDsYmax;}
11682    if( HistoCode == "H_HFN_RuDs" ){val_max = fH_HFN_RuDsYmax;}
11683    if( HistoCode == "H_SCs_RuDs" ){val_max = fH_SCs_RuDsYmax;}
11684    if( HistoCode == "H2LFccMosMatrix" ){val_max = fH2LFccMosMatrixYmax;}
11685    if( HistoCode == "H2HFccMosMatrix" ){val_max = fH2HFccMosMatrixYmax;}
11686    if( HistoCode == "H2CorccInStins"  ){val_max = fH2CorccInStinsYmax;}
11687   return val_max;
11688 }// end of GetYmaxValueFromMemo(...)
11689 
11690 void TEcnaHistos::SetYminMemoFromPreviousMemo(const TString  HistoCode)
11691 {
11692 // InitQuantity Ymin
11693 
11694   if( HistoCode == "D_NOE_ChNb" ){fD_NOE_ChNbYmin = GetYminValueFromMemo("D_NOE_ChNb");}
11695   if( HistoCode == "D_NOE_ChDs" ){fD_NOE_ChDsYmin = GetYminValueFromMemo("D_NOE_ChDs");}
11696   if( HistoCode == "D_Ped_ChNb" ){fD_Ped_ChNbYmin = GetYminValueFromMemo("D_Ped_ChNb");}
11697   if( HistoCode == "D_Ped_ChDs" ){fD_Ped_ChDsYmin = GetYminValueFromMemo("D_Ped_ChDs");}
11698   if( HistoCode == "D_TNo_ChNb" ){fD_TNo_ChNbYmin = GetYminValueFromMemo("D_TNo_ChNb");}
11699   if( HistoCode == "D_TNo_ChDs" ){fD_TNo_ChDsYmin = GetYminValueFromMemo("D_TNo_ChDs");}
11700   if( HistoCode == "D_MCs_ChNb" ){fD_MCs_ChNbYmin = GetYminValueFromMemo("D_MCs_ChNb");}
11701   if( HistoCode == "D_MCs_ChDs" ){fD_MCs_ChDsYmin = GetYminValueFromMemo("D_MCs_ChDs");}
11702   if( HistoCode == "D_LFN_ChNb" ){fD_LFN_ChNbYmin = GetYminValueFromMemo("D_LFN_ChNb");}
11703   if( HistoCode == "D_LFN_ChDs" ){fD_LFN_ChDsYmin = GetYminValueFromMemo("D_LFN_ChDs");}
11704   if( HistoCode == "D_HFN_ChNb" ){fD_HFN_ChNbYmin = GetYminValueFromMemo("D_HFN_ChNb");}
11705   if( HistoCode == "D_HFN_ChDs" ){fD_HFN_ChDsYmin = GetYminValueFromMemo("D_HFN_ChDs");}
11706   if( HistoCode == "D_SCs_ChNb" ){fD_SCs_ChNbYmin = GetYminValueFromMemo("D_SCs_ChNb");}
11707   if( HistoCode == "D_SCs_ChDs" ){fD_SCs_ChDsYmin = GetYminValueFromMemo("D_SCs_ChDs");}
11708   if( HistoCode == "D_MSp_Samp" ){fD_MSp_SampYmin = GetYminValueFromMemo("D_MSp_Samp");}
11709   if( HistoCode == "D_SSp_Samp" ){fD_SSp_SampYmin = GetYminValueFromMemo("D_SSp_Samp");}
11710   if( HistoCode == "D_Adc_EvDs" ){fD_Adc_EvDsYmin = GetYminValueFromMemo("D_Adc_EvDs");}
11711   if( HistoCode == "D_Adc_EvNb" ){fD_Adc_EvNbYmin = GetYminValueFromMemo("D_Adc_EvNb");}
11712   if( HistoCode == "H_Ped_Date" ){fH_Ped_DateYmin = GetYminValueFromMemo("H_Ped_Date");}
11713   if( HistoCode == "H_TNo_Date" ){fH_TNo_DateYmin = GetYminValueFromMemo("H_TNo_Date");}
11714   if( HistoCode == "H_MCs_Date" ){fH_MCs_DateYmin = GetYminValueFromMemo("H_MCs_Date");}
11715   if( HistoCode == "H_LFN_Date" ){fH_LFN_DateYmin = GetYminValueFromMemo("H_LFN_Date");}
11716   if( HistoCode == "H_HFN_Date" ){fH_HFN_DateYmin = GetYminValueFromMemo("H_HFN_Date");}
11717   if( HistoCode == "H_SCs_Date" ){fH_SCs_DateYmin = GetYminValueFromMemo("H_SCs_Date");}
11718   if( HistoCode == "H_Ped_RuDs" ){fH_Ped_RuDsYmin = GetYminValueFromMemo("H_Ped_RuDs");}
11719   if( HistoCode == "H_TNo_RuDs" ){fH_TNo_RuDsYmin = GetYminValueFromMemo("H_TNo_RuDs");}
11720   if( HistoCode == "H_MCs_RuDs" ){fH_MCs_RuDsYmin = GetYminValueFromMemo("H_MCs_RuDs");}
11721   if( HistoCode == "H_LFN_RuDs" ){fH_LFN_RuDsYmin = GetYminValueFromMemo("H_LFN_RuDs");}
11722   if( HistoCode == "H_HFN_RuDs" ){fH_HFN_RuDsYmin = GetYminValueFromMemo("H_HFN_RuDs");}
11723   if( HistoCode == "H_SCs_RuDs" ){fH_SCs_RuDsYmin = GetYminValueFromMemo("H_SCs_RuDs");}
11724   if( HistoCode == "H2LFccMosMatrix" ){fH2LFccMosMatrixYmin = GetYminValueFromMemo("H2LFccMosMatrix");}
11725   if( HistoCode == "H2HFccMosMatrix" ){fH2HFccMosMatrixYmin = GetYminValueFromMemo("H2HFccMosMatrix");}
11726   if( HistoCode == "H2CorccInStins"  ){fH2CorccInStinsYmin  = GetYminValueFromMemo("H2CorccInStins");}
11727 }// end of SetYminMemoFromPreviousMemo(...)
11728 
11729 void TEcnaHistos::SetYmaxMemoFromPreviousMemo(const TString  HistoCode)
11730 {
11731 // InitQuantity Ymax
11732 
11733   if( HistoCode == "D_NOE_ChNb" ){fD_NOE_ChNbYmax = GetYmaxValueFromMemo("D_NOE_ChNb");}
11734   if( HistoCode == "D_NOE_ChDs" ){fD_NOE_ChDsYmax = GetYmaxValueFromMemo("D_NOE_ChDs");}
11735   if( HistoCode == "D_Ped_ChNb" ){fD_Ped_ChNbYmax = GetYmaxValueFromMemo("D_Ped_ChNb");}
11736   if( HistoCode == "D_Ped_ChDs" ){fD_Ped_ChDsYmax = GetYmaxValueFromMemo("D_Ped_ChDs");}
11737   if( HistoCode == "D_TNo_ChNb" ){fD_TNo_ChNbYmax = GetYmaxValueFromMemo("D_TNo_ChNb");}
11738   if( HistoCode == "D_TNo_ChDs" ){fD_TNo_ChDsYmax = GetYmaxValueFromMemo("D_TNo_ChDs");}
11739   if( HistoCode == "D_MCs_ChNb" ){fD_MCs_ChNbYmax = GetYmaxValueFromMemo("D_MCs_ChNb");}
11740   if( HistoCode == "D_MCs_ChDs" ){fD_MCs_ChDsYmax = GetYmaxValueFromMemo("D_MCs_ChDs");}
11741   if( HistoCode == "D_LFN_ChNb" ){fD_LFN_ChNbYmax = GetYmaxValueFromMemo("D_LFN_ChNb");}
11742   if( HistoCode == "D_LFN_ChDs" ){fD_LFN_ChDsYmax = GetYmaxValueFromMemo("D_LFN_ChDs");}
11743   if( HistoCode == "D_HFN_ChNb" ){fD_HFN_ChNbYmax = GetYmaxValueFromMemo("D_HFN_ChNb");}
11744   if( HistoCode == "D_HFN_ChDs" ){fD_HFN_ChDsYmax = GetYmaxValueFromMemo("D_HFN_ChDs");}
11745   if( HistoCode == "D_SCs_ChNb" ){fD_SCs_ChNbYmax = GetYmaxValueFromMemo("D_SCs_ChNb");}
11746   if( HistoCode == "D_SCs_ChDs" ){fD_SCs_ChDsYmax = GetYmaxValueFromMemo("D_SCs_ChDs");}
11747   if( HistoCode == "D_MSp_Samp" ){fD_MSp_SampYmax = GetYmaxValueFromMemo("D_MSp_Samp");}
11748   if( HistoCode == "D_SSp_Samp" ){fD_SSp_SampYmax = GetYmaxValueFromMemo("D_SSp_Samp");}
11749   if( HistoCode == "D_Adc_EvDs" ){fD_Adc_EvDsYmax = GetYmaxValueFromMemo("D_Adc_EvDs");}
11750   if( HistoCode == "D_Adc_EvNb" ){fD_Adc_EvNbYmax = GetYmaxValueFromMemo("D_Adc_EvNb");}
11751   if( HistoCode == "H_Ped_Date" ){fH_Ped_DateYmax = GetYmaxValueFromMemo("H_Ped_Date");}
11752   if( HistoCode == "H_TNo_Date" ){fH_TNo_DateYmax = GetYmaxValueFromMemo("H_TNo_Date");}
11753   if( HistoCode == "H_MCs_Date" ){fH_MCs_DateYmax = GetYmaxValueFromMemo("H_MCs_Date");}
11754   if( HistoCode == "H_LFN_Date" ){fH_LFN_DateYmax = GetYmaxValueFromMemo("H_LFN_Date");}
11755   if( HistoCode == "H_HFN_Date" ){fH_HFN_DateYmax = GetYmaxValueFromMemo("H_HFN_Date");}
11756   if( HistoCode == "H_SCs_Date" ){fH_SCs_DateYmax = GetYmaxValueFromMemo("H_SCs_Date");}
11757   if( HistoCode == "H_Ped_RuDs" ){fH_Ped_RuDsYmax = GetYmaxValueFromMemo("H_Ped_RuDs");}
11758   if( HistoCode == "H_TNo_RuDs" ){fH_TNo_RuDsYmax = GetYmaxValueFromMemo("H_TNo_RuDs");}
11759   if( HistoCode == "H_MCs_RuDs" ){fH_MCs_RuDsYmax = GetYmaxValueFromMemo("H_MCs_RuDs");}
11760   if( HistoCode == "H_LFN_RuDs" ){fH_LFN_RuDsYmax = GetYmaxValueFromMemo("H_LFN_RuDs");}
11761   if( HistoCode == "H_HFN_RuDs" ){fH_HFN_RuDsYmax = GetYmaxValueFromMemo("H_HFN_RuDs");}
11762   if( HistoCode == "H_SCs_RuDs" ){fH_SCs_RuDsYmax = GetYmaxValueFromMemo("H_SCs_RuDs");}
11763   if( HistoCode == "H2LFccMosMatrix" ){fH2LFccMosMatrixYmax = GetYmaxValueFromMemo("H2LFccMosMatrix");}
11764   if( HistoCode == "H2HFccMosMatrix" ){fH2HFccMosMatrixYmax = GetYmaxValueFromMemo("H2HFccMosMatrix");}
11765   if( HistoCode == "H2CorccInStins"  ){fH2CorccInStinsYmax  = GetYmaxValueFromMemo("H2CorccInStins");}
11766 }// end of SetYmaxMemoFromPreviousMemo(...)
11767 
11768 //------------------------------------------------------------------------------------------------------
11769 void TEcnaHistos::SetXVarMemo(const TString HistoCode, const TString opt_plot, const TString xvar)
11770 {
11771 
11772   if( opt_plot == fSameOnePlot ){fXMemoH1SamePlus = xvar;}
11773 
11774   if( opt_plot == fOnlyOnePlot || opt_plot == fSeveralPlot )
11775     {
11776       if( HistoCode == "D_NOE_ChNb"){fXMemoD_NOE_ChNb = xvar;}
11777       if( HistoCode == "D_NOE_ChDs"){fXMemoD_NOE_ChDs = xvar;}  
11778       if( HistoCode == "D_Ped_ChNb"){fXMemoD_Ped_ChNb = xvar;} 
11779       if( HistoCode == "D_Ped_ChDs"){fXMemoD_Ped_ChDs = xvar;} 
11780       if( HistoCode == "D_TNo_ChNb"){fXMemoD_TNo_ChNb = xvar;}
11781       if( HistoCode == "D_TNo_ChDs"){fXMemoD_TNo_ChDs = xvar;} 
11782       if( HistoCode == "D_MCs_ChNb"){fXMemoD_MCs_ChNb = xvar;} 
11783       if( HistoCode == "D_MCs_ChDs"){fXMemoD_MCs_ChDs = xvar;} 
11784       if( HistoCode == "D_LFN_ChNb"){fXMemoD_LFN_ChNb = xvar;} 
11785       if( HistoCode == "D_LFN_ChDs"){fXMemoD_LFN_ChDs = xvar;}
11786       if( HistoCode == "D_HFN_ChNb"){fXMemoD_HFN_ChNb = xvar;} 
11787       if( HistoCode == "D_HFN_ChDs"){fXMemoD_HFN_ChDs = xvar;} 
11788       if( HistoCode == "D_SCs_ChNb"){fXMemoD_SCs_ChNb = xvar;}
11789       if( HistoCode == "D_SCs_ChDs"){fXMemoD_SCs_ChDs = xvar;}
11790       if( HistoCode == "D_MSp_Samp"){fXMemoD_MSp_Samp = xvar;}
11791       if( HistoCode == "D_SSp_Samp"){fXMemoD_SSp_Samp = xvar;}
11792       if( HistoCode == "D_Adc_EvDs"){fXMemoD_Adc_EvDs = xvar;}
11793       if( HistoCode == "D_Adc_EvNb"){fXMemoD_Adc_EvNb = xvar;}
11794       if( HistoCode == "H_Ped_Date"){fXMemoH_Ped_Date = xvar;}
11795       if( HistoCode == "H_TNo_Date"){fXMemoH_TNo_Date = xvar;}
11796       if( HistoCode == "H_MCs_Date"){fXMemoH_MCs_Date = xvar;}
11797       if( HistoCode == "H_LFN_Date"){fXMemoH_LFN_Date = xvar;}
11798       if( HistoCode == "H_HFN_Date"){fXMemoH_HFN_Date = xvar;}
11799       if( HistoCode == "H_SCs_Date"){fXMemoH_SCs_Date = xvar;}
11800       if( HistoCode == "H_Ped_RuDs"){fXMemoH_Ped_RuDs = xvar;}
11801       if( HistoCode == "H_TNo_RuDs"){fXMemoH_TNo_RuDs = xvar;}
11802       if( HistoCode == "H_MCs_RuDs"){fXMemoH_MCs_RuDs = xvar;}
11803       if( HistoCode == "H_LFN_RuDs"){fXMemoH_LFN_RuDs = xvar;}
11804       if( HistoCode == "H_HFN_RuDs"){fXMemoH_HFN_RuDs = xvar;}
11805       if( HistoCode == "H_SCs_RuDs"){fXMemoH_SCs_RuDs = xvar;}
11806     }
11807 }// end of SetXVarMemo(...)
11808 
11809 TString TEcnaHistos::GetXVarFromMemo(const TString HistoCode, const TString opt_plot)
11810 {
11811   TString xvar = "(xvar not found)";
11812   
11813   if( opt_plot == fSameOnePlot ){xvar = fXMemoH1SamePlus;}
11814 
11815   if( opt_plot == fOnlyOnePlot || opt_plot == fSeveralPlot )
11816     {
11817       if( HistoCode == "D_NOE_ChNb"){xvar = fXMemoD_NOE_ChNb;}
11818       if( HistoCode == "D_NOE_ChDs"){xvar = fXMemoD_NOE_ChDs;}  
11819       if( HistoCode == "D_Ped_ChNb"){xvar = fXMemoD_Ped_ChNb;} 
11820       if( HistoCode == "D_Ped_ChDs"){xvar = fXMemoD_Ped_ChDs;} 
11821       if( HistoCode == "D_TNo_ChNb"){xvar = fXMemoD_TNo_ChNb;}
11822       if( HistoCode == "D_TNo_ChDs"){xvar = fXMemoD_TNo_ChDs;} 
11823       if( HistoCode == "D_MCs_ChNb"){xvar = fXMemoD_MCs_ChNb;} 
11824       if( HistoCode == "D_MCs_ChDs"){xvar = fXMemoD_MCs_ChDs;} 
11825       if( HistoCode == "D_LFN_ChNb"){xvar = fXMemoD_LFN_ChNb;} 
11826       if( HistoCode == "D_LFN_ChDs"){xvar = fXMemoD_LFN_ChDs;}
11827       if( HistoCode == "D_HFN_ChNb"){xvar = fXMemoD_HFN_ChNb;} 
11828       if( HistoCode == "D_HFN_ChDs"){xvar = fXMemoD_HFN_ChDs;} 
11829       if( HistoCode == "D_SCs_ChNb"){xvar = fXMemoD_SCs_ChNb;}
11830       if( HistoCode == "D_SCs_ChDs"){xvar = fXMemoD_SCs_ChDs;}
11831       if( HistoCode == "D_MSp_Samp"){xvar = fXMemoD_MSp_Samp;}
11832       if( HistoCode == "D_SSp_Samp"){xvar = fXMemoD_SSp_Samp;}
11833       if( HistoCode == "D_Adc_EvDs"){xvar = fXMemoD_Adc_EvDs;}
11834       if( HistoCode == "D_Adc_EvNb"){xvar = fXMemoD_Adc_EvNb;}
11835       if( HistoCode == "H_Ped_Date"){xvar = fXMemoH_Ped_Date;}
11836       if( HistoCode == "H_TNo_Date"){xvar = fXMemoH_TNo_Date;}
11837       if( HistoCode == "H_MCs_Date"){xvar = fXMemoH_MCs_Date;}
11838       if( HistoCode == "H_LFN_Date"){xvar = fXMemoH_LFN_Date;}
11839       if( HistoCode == "H_HFN_Date"){xvar = fXMemoH_HFN_Date;}
11840       if( HistoCode == "H_SCs_Date"){xvar = fXMemoH_SCs_Date;}
11841       if( HistoCode == "H_Ped_RuDs"){xvar = fXMemoH_Ped_RuDs;}
11842       if( HistoCode == "H_TNo_RuDs"){xvar = fXMemoH_TNo_RuDs;}
11843       if( HistoCode == "H_MCs_RuDs"){xvar = fXMemoH_MCs_RuDs;}
11844       if( HistoCode == "H_LFN_RuDs"){xvar = fXMemoH_LFN_RuDs;}
11845       if( HistoCode == "H_HFN_RuDs"){xvar = fXMemoH_HFN_RuDs;}
11846       if( HistoCode == "H_SCs_RuDs"){xvar = fXMemoH_SCs_RuDs;}
11847     }
11848   return xvar;
11849 }// end of GetXVarFromMemo(...)
11850 
11851 
11852 void TEcnaHistos::SetYVarMemo(const TString HistoCode, const TString opt_plot, const TString yvar)
11853 {
11854   if( opt_plot == fSameOnePlot ){fYMemoH1SamePlus = yvar;}
11855 
11856   if( opt_plot == fOnlyOnePlot || opt_plot == fSeveralPlot )
11857     {
11858       if( HistoCode == "D_NOE_ChNb"){fYMemoD_NOE_ChNb = yvar;}
11859       if( HistoCode == "D_NOE_ChDs"){fYMemoD_NOE_ChDs = yvar;}  
11860       if( HistoCode == "D_Ped_ChNb"){fYMemoD_Ped_ChNb = yvar;} 
11861       if( HistoCode == "D_Ped_ChDs"){fYMemoD_Ped_ChDs = yvar;} 
11862       if( HistoCode == "D_TNo_ChNb"){fYMemoD_TNo_ChNb = yvar;}
11863       if( HistoCode == "D_TNo_ChDs"){fYMemoD_TNo_ChDs = yvar;} 
11864       if( HistoCode == "D_MCs_ChNb"){fYMemoD_MCs_ChNb = yvar;} 
11865       if( HistoCode == "D_MCs_ChDs"){fYMemoD_MCs_ChDs = yvar;} 
11866       if( HistoCode == "D_LFN_ChNb"){fYMemoD_LFN_ChNb = yvar;} 
11867       if( HistoCode == "D_LFN_ChDs"){fYMemoD_LFN_ChDs = yvar;}
11868       if( HistoCode == "D_HFN_ChNb"){fYMemoD_HFN_ChNb = yvar;} 
11869       if( HistoCode == "D_HFN_ChDs"){fYMemoD_HFN_ChDs = yvar;} 
11870       if( HistoCode == "D_SCs_ChNb"){fYMemoD_SCs_ChNb = yvar;}
11871       if( HistoCode == "D_SCs_ChDs"){fYMemoD_SCs_ChDs = yvar;}
11872       if( HistoCode == "D_MSp_Samp"){fYMemoD_MSp_Samp = yvar;}
11873       if( HistoCode == "D_SSp_Samp"){fYMemoD_SSp_Samp = yvar;}
11874       if( HistoCode == "D_Adc_EvDs"){fYMemoD_Adc_EvDs = yvar;}
11875       if( HistoCode == "D_Adc_EvNb"){fYMemoD_Adc_EvNb = yvar;}
11876       if( HistoCode == "H_Ped_Date"){fYMemoH_Ped_Date = yvar;}
11877       if( HistoCode == "H_TNo_Date"){fYMemoH_TNo_Date = yvar;}
11878       if( HistoCode == "H_MCs_Date"){fYMemoH_MCs_Date = yvar;}
11879       if( HistoCode == "H_LFN_Date"){fYMemoH_LFN_Date = yvar;}
11880       if( HistoCode == "H_HFN_Date"){fYMemoH_HFN_Date = yvar;}
11881       if( HistoCode == "H_SCs_Date"){fYMemoH_SCs_Date = yvar;}
11882       if( HistoCode == "H_Ped_RuDs"){fYMemoH_Ped_RuDs = yvar;}
11883       if( HistoCode == "H_TNo_RuDs"){fYMemoH_TNo_RuDs = yvar;}
11884       if( HistoCode == "H_MCs_RuDs"){fYMemoH_MCs_RuDs = yvar;}
11885       if( HistoCode == "H_LFN_RuDs"){fYMemoH_LFN_RuDs = yvar;}
11886       if( HistoCode == "H_HFN_RuDs"){fYMemoH_HFN_RuDs = yvar;}
11887       if( HistoCode == "H_SCs_RuDs"){fYMemoH_SCs_RuDs = yvar;}
11888     }
11889 }// end of SetYVarMemo(...)
11890 
11891 TString TEcnaHistos::GetYVarFromMemo(const TString HistoCode, const TString opt_plot)
11892 {
11893   TString yvar = "(yvar not found)";
11894 
11895   if( opt_plot == fSameOnePlot ){yvar = fYMemoH1SamePlus;}
11896 
11897   if( opt_plot == fOnlyOnePlot || opt_plot == fSeveralPlot )
11898     {  
11899       if( HistoCode == "D_NOE_ChNb"){yvar = fYMemoD_NOE_ChNb;}
11900       if( HistoCode == "D_NOE_ChDs"){yvar = fYMemoD_NOE_ChDs;}
11901       if( HistoCode == "D_Ped_ChNb"){yvar = fYMemoD_Ped_ChNb;}
11902       if( HistoCode == "D_Ped_ChDs"){yvar = fYMemoD_Ped_ChDs;}
11903       if( HistoCode == "D_TNo_ChNb"){yvar = fYMemoD_TNo_ChNb;}
11904       if( HistoCode == "D_TNo_ChDs"){yvar = fYMemoD_TNo_ChDs;}
11905       if( HistoCode == "D_MCs_ChNb"){yvar = fYMemoD_MCs_ChNb;}
11906       if( HistoCode == "D_MCs_ChDs"){yvar = fYMemoD_MCs_ChDs;}
11907       if( HistoCode == "D_LFN_ChNb"){yvar = fYMemoD_LFN_ChNb;}
11908       if( HistoCode == "D_LFN_ChDs"){yvar = fYMemoD_LFN_ChDs;}
11909       if( HistoCode == "D_HFN_ChNb"){yvar = fYMemoD_HFN_ChNb;}
11910       if( HistoCode == "D_HFN_ChDs"){yvar = fYMemoD_HFN_ChDs;}
11911       if( HistoCode == "D_SCs_ChNb"){yvar = fYMemoD_SCs_ChNb;}
11912       if( HistoCode == "D_SCs_ChDs"){yvar = fYMemoD_SCs_ChDs;}
11913       if( HistoCode == "D_MSp_Samp"){yvar = fYMemoD_MSp_Samp;}
11914       if( HistoCode == "D_SSp_Samp"){yvar = fYMemoD_SSp_Samp;}
11915       if( HistoCode == "D_Adc_EvDs"){yvar = fYMemoD_Adc_EvDs;}
11916       if( HistoCode == "D_Adc_EvNb"){yvar = fYMemoD_Adc_EvNb;}
11917       if( HistoCode == "H_Ped_Date"){yvar = fYMemoH_Ped_Date;}
11918       if( HistoCode == "H_TNo_Date"){yvar = fYMemoH_TNo_Date;}
11919       if( HistoCode == "H_MCs_Date"){yvar = fYMemoH_MCs_Date;}
11920       if( HistoCode == "H_LFN_Date"){yvar = fYMemoH_LFN_Date;}
11921       if( HistoCode == "H_HFN_Date"){yvar = fYMemoH_HFN_Date;}
11922       if( HistoCode == "H_SCs_Date"){yvar = fYMemoH_SCs_Date;}
11923       if( HistoCode == "H_Ped_RuDs"){yvar = fYMemoH_Ped_RuDs;}
11924       if( HistoCode == "H_TNo_RuDs"){yvar = fYMemoH_TNo_RuDs;}
11925       if( HistoCode == "H_MCs_RuDs"){yvar = fYMemoH_MCs_RuDs;}
11926       if( HistoCode == "H_LFN_RuDs"){yvar = fYMemoH_LFN_RuDs;}
11927       if( HistoCode == "H_HFN_RuDs"){yvar = fYMemoH_HFN_RuDs;}
11928       if( HistoCode == "H_SCs_RuDs"){yvar = fYMemoH_SCs_RuDs;}
11929     }
11930   return yvar;
11931 }// end of GetYVarFromMemo(...)
11932 
11933 void TEcnaHistos::SetNbBinsMemo(const TString HistoCode, const TString opt_plot, const Int_t& nb_bins)
11934 {
11935 
11936   if( opt_plot == fSameOnePlot ){fNbBinsMemoH1SamePlus = nb_bins;}
11937 
11938   if( opt_plot == fOnlyOnePlot || opt_plot == fSeveralPlot )
11939     {
11940       if( HistoCode == "D_NOE_ChNb"){fNbBinsMemoD_NOE_ChNb = nb_bins;}
11941       if( HistoCode == "D_NOE_ChDs"){fNbBinsMemoD_NOE_ChDs = nb_bins;}  
11942       if( HistoCode == "D_Ped_ChNb"){fNbBinsMemoD_Ped_ChNb = nb_bins;} 
11943       if( HistoCode == "D_Ped_ChDs"){fNbBinsMemoD_Ped_ChDs = nb_bins;} 
11944       if( HistoCode == "D_TNo_ChNb"){fNbBinsMemoD_TNo_ChNb = nb_bins;}
11945       if( HistoCode == "D_TNo_ChDs"){fNbBinsMemoD_TNo_ChDs = nb_bins;} 
11946       if( HistoCode == "D_MCs_ChNb"){fNbBinsMemoD_MCs_ChNb = nb_bins;} 
11947       if( HistoCode == "D_MCs_ChDs"){fNbBinsMemoD_MCs_ChDs = nb_bins;} 
11948       if( HistoCode == "D_LFN_ChNb"){fNbBinsMemoD_LFN_ChNb = nb_bins;} 
11949       if( HistoCode == "D_LFN_ChDs"){fNbBinsMemoD_LFN_ChDs = nb_bins;}
11950       if( HistoCode == "D_HFN_ChNb"){fNbBinsMemoD_HFN_ChNb = nb_bins;} 
11951       if( HistoCode == "D_HFN_ChDs"){fNbBinsMemoD_HFN_ChDs = nb_bins;} 
11952       if( HistoCode == "D_SCs_ChNb"){fNbBinsMemoD_SCs_ChNb = nb_bins;}
11953       if( HistoCode == "D_SCs_ChDs"){fNbBinsMemoD_SCs_ChDs = nb_bins;}
11954       if( HistoCode == "D_MSp_Samp"){fNbBinsMemoD_MSp_Samp = nb_bins;}
11955       if( HistoCode == "D_SSp_Samp"){fNbBinsMemoD_SSp_Samp = nb_bins;}
11956       if( HistoCode == "D_Adc_EvDs"){fNbBinsMemoD_Adc_EvDs = nb_bins;}
11957       if( HistoCode == "D_Adc_EvNb"){fNbBinsMemoD_Adc_EvNb = nb_bins;}
11958       if( HistoCode == "H_Ped_Date"){fNbBinsMemoH_Ped_Date = nb_bins;}
11959       if( HistoCode == "H_TNo_Date"){fNbBinsMemoH_TNo_Date = nb_bins;}
11960       if( HistoCode == "H_MCs_Date"){fNbBinsMemoH_MCs_Date = nb_bins;}
11961       if( HistoCode == "H_LFN_Date"){fNbBinsMemoH_LFN_Date = nb_bins;}
11962       if( HistoCode == "H_HFN_Date"){fNbBinsMemoH_HFN_Date = nb_bins;}
11963       if( HistoCode == "H_SCs_Date"){fNbBinsMemoH_SCs_Date = nb_bins;}
11964       if( HistoCode == "H_Ped_RuDs"){fNbBinsMemoH_Ped_RuDs = nb_bins;}
11965       if( HistoCode == "H_TNo_RuDs"){fNbBinsMemoH_TNo_RuDs = nb_bins;}
11966       if( HistoCode == "H_MCs_RuDs"){fNbBinsMemoH_MCs_RuDs = nb_bins;}
11967       if( HistoCode == "H_LFN_RuDs"){fNbBinsMemoH_LFN_RuDs = nb_bins;}
11968       if( HistoCode == "H_HFN_RuDs"){fNbBinsMemoH_HFN_RuDs = nb_bins;}
11969       if( HistoCode == "H_SCs_RuDs"){fNbBinsMemoH_SCs_RuDs = nb_bins;}
11970     }
11971 }// end of SetNbBinsMemo(...)
11972 
11973 Int_t TEcnaHistos::GetNbBinsFromMemo(const TString HistoCode, const TString opt_plot)
11974 {
11975   Int_t nb_bins = 0;
11976 
11977   if( opt_plot == fSameOnePlot ){nb_bins = fNbBinsMemoH1SamePlus;}
11978 
11979   if( opt_plot == fOnlyOnePlot || opt_plot == fSeveralPlot )
11980     {
11981       if( HistoCode == "D_NOE_ChNb"){nb_bins = fNbBinsMemoD_NOE_ChNb;}
11982       if( HistoCode == "D_NOE_ChDs"){nb_bins = fNbBinsMemoD_NOE_ChDs;}  
11983       if( HistoCode == "D_Ped_ChNb"){nb_bins = fNbBinsMemoD_Ped_ChNb;} 
11984       if( HistoCode == "D_Ped_ChDs"){nb_bins = fNbBinsMemoD_Ped_ChDs;} 
11985       if( HistoCode == "D_TNo_ChNb"){nb_bins = fNbBinsMemoD_TNo_ChNb;}
11986       if( HistoCode == "D_TNo_ChDs"){nb_bins = fNbBinsMemoD_TNo_ChDs;} 
11987       if( HistoCode == "D_MCs_ChNb"){nb_bins = fNbBinsMemoD_MCs_ChNb;} 
11988       if( HistoCode == "D_MCs_ChDs"){nb_bins = fNbBinsMemoD_MCs_ChDs;} 
11989       if( HistoCode == "D_LFN_ChNb"){nb_bins = fNbBinsMemoD_LFN_ChNb;} 
11990       if( HistoCode == "D_LFN_ChDs"){nb_bins = fNbBinsMemoD_LFN_ChDs;}
11991       if( HistoCode == "D_HFN_ChNb"){nb_bins = fNbBinsMemoD_HFN_ChNb;} 
11992       if( HistoCode == "D_HFN_ChDs"){nb_bins = fNbBinsMemoD_HFN_ChDs;} 
11993       if( HistoCode == "D_SCs_ChNb"){nb_bins = fNbBinsMemoD_SCs_ChNb;}
11994       if( HistoCode == "D_SCs_ChDs"){nb_bins = fNbBinsMemoD_SCs_ChDs;}
11995       if( HistoCode == "D_MSp_Samp"){nb_bins = fNbBinsMemoD_MSp_Samp;}
11996       if( HistoCode == "D_SSp_Samp"){nb_bins = fNbBinsMemoD_SSp_Samp;}
11997       if( HistoCode == "D_Adc_EvDs"){nb_bins = fNbBinsMemoD_Adc_EvDs;}
11998       if( HistoCode == "D_Adc_EvNb"){nb_bins = fNbBinsMemoD_Adc_EvNb;}
11999       if( HistoCode == "H_Ped_Date"){nb_bins = fNbBinsMemoH_Ped_Date;}
12000       if( HistoCode == "H_TNo_Date"){nb_bins = fNbBinsMemoH_TNo_Date;}
12001       if( HistoCode == "H_MCs_Date"){nb_bins = fNbBinsMemoH_MCs_Date;}
12002       if( HistoCode == "H_LFN_Date"){nb_bins = fNbBinsMemoH_LFN_Date;}
12003       if( HistoCode == "H_HFN_Date"){nb_bins = fNbBinsMemoH_HFN_Date;}
12004       if( HistoCode == "H_SCs_Date"){nb_bins = fNbBinsMemoH_SCs_Date;}
12005       if( HistoCode == "H_Ped_RuDs"){nb_bins = fNbBinsMemoH_Ped_RuDs;}
12006       if( HistoCode == "H_TNo_RuDs"){nb_bins = fNbBinsMemoH_TNo_RuDs;}
12007       if( HistoCode == "H_MCs_RuDs"){nb_bins = fNbBinsMemoH_MCs_RuDs;}
12008       if( HistoCode == "H_LFN_RuDs"){nb_bins = fNbBinsMemoH_LFN_RuDs;}
12009       if( HistoCode == "H_HFN_RuDs"){nb_bins = fNbBinsMemoH_HFN_RuDs;}
12010       if( HistoCode == "H_SCs_RuDs"){nb_bins = fNbBinsMemoH_SCs_RuDs;}
12011     }
12012   return nb_bins;
12013 }// end of GetNbBinsFromMemo(...)
12014 
12015 TString TEcnaHistos::GetMemoFlag(const TString opt_plot)
12016 {
12017   TString memo_flag;
12018   Int_t MaxCar = fgMaxCar;
12019   memo_flag.Resize(MaxCar);
12020   memo_flag = "(no memo_flag info)";
12021 
12022   Int_t memo_flag_number = -1;
12023 
12024   if( opt_plot == fSameOnePlot ){memo_flag_number = fMemoPlotH1SamePlus;}
12025 
12026   if( opt_plot == fOnlyOnePlot || opt_plot == fSeveralPlot )
12027     {
12028       memo_flag_number = fMemoPlotD_TNo_ChDs+fMemoPlotD_MCs_ChDs
12029         +fMemoPlotD_LFN_ChDs+fMemoPlotD_HFN_ChDs+fMemoPlotD_SCs_ChDs;
12030     }
12031 
12032   if(memo_flag_number == 0){memo_flag = "Free";}
12033   if(memo_flag_number >= 1){memo_flag = "Busy";}
12034 
12035   return memo_flag;
12036 }
12037 
12038 TString TEcnaHistos::GetMemoFlag(const TString HistoCode, const TString opt_plot)
12039 {
12040 // Get Memo Flag
12041 
12042   TString memo_flag;
12043   Int_t MaxCar = fgMaxCar;
12044   memo_flag.Resize(MaxCar);
12045   memo_flag = "(no memo_flag info)";
12046 
12047   Int_t memo_flag_number = -1;
12048 
12049   if( opt_plot == fSameOnePlot ){memo_flag_number = fMemoPlotH1SamePlus;}
12050 
12051   if( opt_plot == fOnlyOnePlot || opt_plot == fSeveralPlot )
12052     {
12053       if(HistoCode == "D_NOE_ChNb"){memo_flag_number = fMemoPlotD_NOE_ChNb;}
12054       if(HistoCode == "D_NOE_ChDs"){memo_flag_number = fMemoPlotD_NOE_ChDs;}
12055       if(HistoCode == "D_Ped_ChNb"){memo_flag_number = fMemoPlotD_Ped_ChNb;}
12056       if(HistoCode == "D_Ped_ChDs"){memo_flag_number = fMemoPlotD_Ped_ChDs;}
12057       if(HistoCode == "D_TNo_ChNb"){memo_flag_number = fMemoPlotD_TNo_ChNb;}
12058       if(HistoCode == "D_TNo_ChDs"){memo_flag_number = fMemoPlotD_TNo_ChDs;}
12059       if(HistoCode == "D_MCs_ChNb"){memo_flag_number = fMemoPlotD_MCs_ChNb;}
12060       if(HistoCode == "D_MCs_ChDs"){memo_flag_number = fMemoPlotD_MCs_ChDs;}
12061       if(HistoCode == "D_LFN_ChNb"){memo_flag_number = fMemoPlotD_LFN_ChNb;}
12062       if(HistoCode == "D_LFN_ChDs"){memo_flag_number = fMemoPlotD_LFN_ChDs;} 
12063       if(HistoCode == "D_HFN_ChNb"){memo_flag_number = fMemoPlotD_HFN_ChNb;} 
12064       if(HistoCode == "D_HFN_ChDs"){memo_flag_number = fMemoPlotD_HFN_ChDs;}
12065       if(HistoCode == "D_SCs_ChNb"){memo_flag_number = fMemoPlotD_SCs_ChNb;}
12066       if(HistoCode == "D_SCs_ChDs"){memo_flag_number = fMemoPlotD_SCs_ChDs;}
12067       if(HistoCode == "D_MSp_Samp"){memo_flag_number = fMemoPlotD_MSp_Samp;}
12068       if(HistoCode == "D_SSp_Samp"){memo_flag_number = fMemoPlotD_SSp_Samp;}
12069       if(HistoCode == "D_Adc_EvDs"){memo_flag_number = fMemoPlotD_Adc_EvDs;}
12070       if(HistoCode == "D_Adc_EvNb"){memo_flag_number = fMemoPlotD_Adc_EvNb;}
12071       if(HistoCode == "H_Ped_Date"){memo_flag_number = fMemoPlotH_Ped_Date;}
12072       if(HistoCode == "H_TNo_Date"){memo_flag_number = fMemoPlotH_TNo_Date;}
12073       if(HistoCode == "H_MCs_Date"){memo_flag_number = fMemoPlotH_MCs_Date;}
12074       if(HistoCode == "H_LFN_Date"){memo_flag_number = fMemoPlotH_LFN_Date;}
12075       if(HistoCode == "H_HFN_Date"){memo_flag_number = fMemoPlotH_HFN_Date;}
12076       if(HistoCode == "H_SCs_Date"){memo_flag_number = fMemoPlotH_SCs_Date;}
12077       if(HistoCode == "H_Ped_RuDs"){memo_flag_number = fMemoPlotH_Ped_RuDs;}
12078       if(HistoCode == "H_TNo_RuDs"){memo_flag_number = fMemoPlotH_TNo_RuDs;}
12079       if(HistoCode == "H_MCs_RuDs"){memo_flag_number = fMemoPlotH_MCs_RuDs;}
12080       if(HistoCode == "H_LFN_RuDs"){memo_flag_number = fMemoPlotH_LFN_RuDs;}
12081       if(HistoCode == "H_HFN_RuDs"){memo_flag_number = fMemoPlotH_HFN_RuDs;}
12082       if(HistoCode == "H_SCs_RuDs"){memo_flag_number = fMemoPlotH_SCs_RuDs;}
12083     }
12084 
12085   if(memo_flag_number == 0){memo_flag = "Free";}
12086   if(memo_flag_number == 1){memo_flag = "Busy";}
12087 
12088   return memo_flag;
12089 }
12090 
12091 TCanvas* TEcnaHistos::CreateCanvas(const TString HistoCode, const TString opt_plot, const TString canvas_name,
12092                                  UInt_t canv_w, UInt_t canv_h)
12093 {
12094 // Create canvas according to HistoCode
12095 
12096   TCanvas* main_canvas = 0;
12097  
12098   if( opt_plot == fSameOnePlot )
12099     {
12100       fCanvH1SamePlus = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h); fCnewRoot++;
12101       main_canvas = fCanvH1SamePlus;
12102     }
12103   if( opt_plot == fSeveralPlot || opt_plot == fOnlyOnePlot )
12104     {
12105       if(HistoCode == "D_NOE_ChNb"){
12106         fCanvD_NOE_ChNb = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h); fCnewRoot++;
12107         main_canvas = fCanvD_NOE_ChNb;}
12108       if(HistoCode == "D_NOE_ChDs"){
12109         fCanvD_NOE_ChDs = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h); fCnewRoot++;
12110         main_canvas = fCanvD_NOE_ChDs;}
12111       if(HistoCode == "D_Ped_ChNb"){
12112         fCanvD_Ped_ChNb = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h); fCnewRoot++;
12113         main_canvas = fCanvD_Ped_ChNb;}
12114       if(HistoCode == "D_Ped_ChDs"){
12115         fCanvD_Ped_ChDs = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h); fCnewRoot++;
12116         main_canvas = fCanvD_Ped_ChDs;}
12117       if(HistoCode == "D_TNo_ChNb"){
12118         fCanvD_TNo_ChNb = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h); fCnewRoot++;
12119         main_canvas = fCanvD_TNo_ChNb;}
12120       if(HistoCode == "D_TNo_ChDs"){
12121         fCanvD_TNo_ChDs = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h); fCnewRoot++;
12122         main_canvas = fCanvD_TNo_ChDs;}
12123       if(HistoCode == "D_MCs_ChNb"){
12124         fCanvD_MCs_ChNb = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h); fCnewRoot++;
12125         main_canvas = fCanvD_MCs_ChNb;}
12126       if(HistoCode == "D_MCs_ChDs"){
12127         fCanvD_MCs_ChDs = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h); fCnewRoot++;
12128         main_canvas = fCanvD_MCs_ChDs;}
12129       if(HistoCode == "D_LFN_ChNb"){
12130         fCanvD_LFN_ChNb = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h); fCnewRoot++;
12131         main_canvas = fCanvD_LFN_ChNb;}
12132       if(HistoCode == "D_LFN_ChDs"){
12133         fCanvD_LFN_ChDs = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h); fCnewRoot++;
12134         main_canvas = fCanvD_LFN_ChDs;}
12135       if(HistoCode == "D_HFN_ChNb"){
12136         fCanvD_HFN_ChNb = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h); fCnewRoot++;
12137         main_canvas = fCanvD_HFN_ChNb;}
12138       if(HistoCode == "D_HFN_ChDs"){
12139         fCanvD_HFN_ChDs = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h); fCnewRoot++;
12140         main_canvas = fCanvD_HFN_ChDs;}
12141       if(HistoCode == "D_SCs_ChNb"){
12142         fCanvD_SCs_ChNb = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h); fCnewRoot++;
12143         main_canvas = fCanvD_SCs_ChNb;}
12144 
12145       if(HistoCode == "D_SCs_ChDs"){
12146         fCanvD_SCs_ChDs = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h); fCnewRoot++;
12147         main_canvas = fCanvD_SCs_ChDs;}
12148       if(HistoCode == "D_MSp_Samp"        ){
12149         fCanvD_MSp_Samp = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h); fCnewRoot++;
12150         main_canvas = fCanvD_MSp_Samp;}
12151       if(HistoCode =="D_SSp_Samp"      ){
12152         fCanvD_SSp_Samp = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h); fCnewRoot++;
12153         main_canvas = fCanvD_SSp_Samp;}
12154       if(HistoCode == "D_Adc_EvDs"){
12155         fCanvD_Adc_EvDs = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h); fCnewRoot++;
12156         main_canvas = fCanvD_Adc_EvDs;}
12157       if(HistoCode == "D_Adc_EvNb"){
12158         fCanvD_Adc_EvNb = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h); fCnewRoot++;
12159         main_canvas = fCanvD_Adc_EvNb;}
12160       if(HistoCode == "H_Ped_Date"){
12161         fCanvH_Ped_Date = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h); fCnewRoot++;
12162         main_canvas = fCanvH_Ped_Date;}
12163       if(HistoCode == "H_TNo_Date"){
12164         fCanvH_TNo_Date = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h); fCnewRoot++;
12165         main_canvas = fCanvH_TNo_Date;}
12166       if(HistoCode == "H_MCs_Date"){
12167         fCanvH_MCs_Date = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h); fCnewRoot++;
12168         main_canvas = fCanvH_MCs_Date;}
12169       if(HistoCode == "H_LFN_Date"){
12170         fCanvH_LFN_Date = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h); fCnewRoot++;
12171         main_canvas = fCanvH_LFN_Date;}
12172       if(HistoCode == "H_HFN_Date"){
12173         fCanvH_HFN_Date = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h); fCnewRoot++;
12174         main_canvas = fCanvH_HFN_Date;}
12175       if(HistoCode == "H_SCs_Date"){
12176         fCanvH_SCs_Date = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h); fCnewRoot++;
12177         main_canvas = fCanvH_SCs_Date;}
12178 
12179       if(HistoCode == "H_Ped_RuDs"){
12180         fCanvH_Ped_RuDs = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h); fCnewRoot++;
12181         main_canvas = fCanvH_Ped_RuDs;}
12182       if(HistoCode == "H_TNo_RuDs"){
12183         fCanvH_TNo_RuDs = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h); fCnewRoot++;
12184         main_canvas = fCanvH_TNo_RuDs;}
12185       if(HistoCode == "H_MCs_RuDs"){
12186         fCanvH_MCs_RuDs = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h); fCnewRoot++;
12187         main_canvas = fCanvH_MCs_RuDs;}
12188       if(HistoCode == "H_LFN_RuDs"){
12189         fCanvH_LFN_RuDs = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h); fCnewRoot++;
12190         main_canvas = fCanvH_LFN_RuDs;}
12191       if(HistoCode == "H_HFN_RuDs"){
12192         fCanvH_HFN_RuDs = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h); fCnewRoot++;
12193         main_canvas = fCanvH_HFN_RuDs;}
12194       if(HistoCode == "H_SCs_RuDs"){
12195         fCanvH_SCs_RuDs = new TCanvas(canvas_name.Data(), canvas_name.Data(), canv_w, canv_h); fCnewRoot++;
12196         main_canvas = fCanvH_SCs_RuDs;}
12197 
12198     }
12199   return main_canvas;
12200 }
12201 // end of CreateCanvas
12202 
12203 void TEcnaHistos::SetParametersCanvas(const TString HistoCode, const TString opt_plot)
12204 {
12205 // Set parameters canvas according to HistoCode
12206   
12207   Double_t x_margin_factor = fCnaParHistos->BoxLeftX("bottom_left_box") - 0.005;
12208   Double_t y_margin_factor = fCnaParHistos->BoxTopY("bottom_right_box") + 0.005;
12209 
12210   if( opt_plot == fSameOnePlot )
12211     {
12212       fImpH1SamePlus = (TRootCanvas*)fCanvH1SamePlus->GetCanvasImp();
12213       fCanvH1SamePlus->Divide(1, 1, x_margin_factor , y_margin_factor); gPad->cd(1);
12214       fPadH1SamePlus = gPad;
12215       fMemoPlotH1SamePlus = 1; fMemoColorH1SamePlus = 0;
12216     }
12217 
12218   if( opt_plot == fOnlyOnePlot ||  opt_plot == fSeveralPlot)
12219     {
12220       if(HistoCode == "D_NOE_ChNb")
12221         {
12222           fImpD_NOE_ChNb = (TRootCanvas*)fCanvD_NOE_ChNb->GetCanvasImp();
12223           fCanvD_NOE_ChNb->Divide(1, 1, x_margin_factor , y_margin_factor); gPad->cd(1);
12224           fPadD_NOE_ChNb = gPad;
12225           fMemoPlotD_NOE_ChNb = 1; fMemoColorD_NOE_ChNb = 0;
12226         }
12227       
12228       if(HistoCode == "D_NOE_ChDs")                                               // (SetParametersCanvas)
12229         {
12230           fImpD_NOE_ChDs = (TRootCanvas*)fCanvD_NOE_ChDs->GetCanvasImp();
12231           fCanvD_NOE_ChDs->Divide(1, 1, x_margin_factor , y_margin_factor); gPad->cd(1);
12232           fPadD_NOE_ChDs = gPad;
12233           fMemoPlotD_NOE_ChDs = 1; fMemoColorD_NOE_ChDs = 0;
12234         }
12235       
12236       if(HistoCode == "D_Ped_ChNb")
12237         {
12238           fImpD_Ped_ChNb = (TRootCanvas*)fCanvD_Ped_ChNb->GetCanvasImp();
12239           fCanvD_Ped_ChNb->Divide(1, 1, x_margin_factor , y_margin_factor); gPad->cd(1);
12240           fPadD_Ped_ChNb = gPad;
12241           fMemoPlotD_Ped_ChNb = 1; fMemoColorD_Ped_ChNb = 0;
12242         }
12243       
12244       if(HistoCode == "D_Ped_ChDs")
12245         {
12246           fImpD_Ped_ChDs = (TRootCanvas*)fCanvD_Ped_ChDs->GetCanvasImp();
12247           fCanvD_Ped_ChDs->Divide(1, 1, x_margin_factor , y_margin_factor); gPad->cd(1);
12248           fPadD_Ped_ChDs = gPad;
12249           fMemoPlotD_Ped_ChDs = 1; fMemoColorD_Ped_ChDs = 0;
12250         }
12251       
12252       if(HistoCode == "D_TNo_ChNb")
12253         {
12254           fImpD_TNo_ChNb = (TRootCanvas*)fCanvD_TNo_ChNb->GetCanvasImp();
12255           fCanvD_TNo_ChNb->Divide(1, 1, x_margin_factor , y_margin_factor); gPad->cd(1);
12256           fPadD_TNo_ChNb = gPad; 
12257           fMemoPlotD_TNo_ChNb = 1; fMemoColorD_TNo_ChNb = 0;
12258         }
12259       
12260       if(HistoCode == "D_TNo_ChDs")                                               // (SetParametersCanvas)
12261         {
12262           fImpD_TNo_ChDs = (TRootCanvas*)fCanvD_TNo_ChDs->GetCanvasImp();
12263           fCanvD_TNo_ChDs->Divide(1, 1, x_margin_factor , y_margin_factor); gPad->cd(1);
12264           fPadD_TNo_ChDs = gPad;
12265           fMemoPlotD_TNo_ChDs = 1; fMemoColorD_TNo_ChDs = 0;
12266         }
12267       
12268       if(HistoCode == "D_MCs_ChNb")
12269         {
12270           fImpD_MCs_ChNb = (TRootCanvas*)fCanvD_MCs_ChNb->GetCanvasImp();
12271           fCanvD_MCs_ChNb->Divide(1, 1, x_margin_factor , y_margin_factor); gPad->cd(1);
12272           fPadD_MCs_ChNb = gPad;
12273           fMemoPlotD_MCs_ChNb = 1; fMemoColorD_MCs_ChNb = 0;
12274         }
12275       
12276       if(HistoCode == "D_MCs_ChDs")
12277         {
12278           fImpD_MCs_ChDs = (TRootCanvas*)fCanvD_MCs_ChDs->GetCanvasImp();
12279           fCanvD_MCs_ChDs->Divide(1, 1, x_margin_factor , y_margin_factor); gPad->cd(1);
12280           fPadD_MCs_ChDs = gPad;
12281           fMemoPlotD_MCs_ChDs = 1; fMemoColorD_MCs_ChDs = 0;
12282         }
12283       
12284       if(HistoCode == "D_LFN_ChNb")                                               // (SetParametersCanvas)
12285         {
12286           fImpD_LFN_ChNb = (TRootCanvas*)fCanvD_LFN_ChNb->GetCanvasImp();
12287           fCanvD_LFN_ChNb->Divide(1, 1, x_margin_factor , y_margin_factor); gPad->cd(1);
12288           fPadD_LFN_ChNb = gPad;
12289           fMemoPlotD_LFN_ChNb = 1; fMemoColorD_LFN_ChNb = 0;
12290         }
12291       
12292       if(HistoCode == "D_LFN_ChDs")
12293         {
12294           fImpD_LFN_ChDs = (TRootCanvas*)fCanvD_LFN_ChDs->GetCanvasImp();
12295           fCanvD_LFN_ChDs->Divide(1, 1, x_margin_factor , y_margin_factor); gPad->cd(1);
12296           fPadD_LFN_ChDs = gPad;
12297           fMemoPlotD_LFN_ChDs = 1; fMemoColorD_LFN_ChDs = 0;
12298         }
12299       
12300       if(HistoCode == "D_HFN_ChNb")
12301         {
12302           fImpD_HFN_ChNb = (TRootCanvas*)fCanvD_HFN_ChNb->GetCanvasImp();
12303           fCanvD_HFN_ChNb->Divide(1, 1, x_margin_factor , y_margin_factor); gPad->cd(1);
12304           fPadD_HFN_ChNb = gPad;
12305           fMemoPlotD_HFN_ChNb = 1; fMemoColorD_HFN_ChNb = 0;
12306         }
12307       
12308       if(HistoCode == "D_HFN_ChDs")
12309         {
12310           fImpD_HFN_ChDs = (TRootCanvas*)fCanvD_HFN_ChDs->GetCanvasImp();
12311           fCanvD_HFN_ChDs->Divide(1, 1, x_margin_factor , y_margin_factor); gPad->cd(1);
12312           fPadD_HFN_ChDs = gPad;
12313           fMemoPlotD_HFN_ChDs = 1; fMemoColorD_HFN_ChDs = 0;
12314         }
12315       
12316       if(HistoCode == "D_SCs_ChNb")                                               // (SetParametersCanvas)
12317         {
12318           fImpD_SCs_ChNb = (TRootCanvas*)fCanvD_SCs_ChNb->GetCanvasImp();
12319           fCanvD_SCs_ChNb->Divide(1, 1, x_margin_factor , y_margin_factor); gPad->cd(1);
12320           fPadD_SCs_ChNb = gPad;
12321           fMemoPlotD_SCs_ChNb = 1; fMemoColorD_SCs_ChNb = 0;
12322         }
12323       
12324       if(HistoCode == "D_SCs_ChDs")
12325         {
12326           fImpD_SCs_ChDs = (TRootCanvas*)fCanvD_SCs_ChDs->GetCanvasImp();
12327           fCanvD_SCs_ChDs->Divide(1, 1, x_margin_factor , y_margin_factor); gPad->cd(1);
12328           fPadD_SCs_ChDs = gPad;
12329           fMemoPlotD_SCs_ChDs = 1; fMemoColorD_SCs_ChDs = 0;
12330         }
12331       
12332       if(HistoCode == "D_MSp_Samp")
12333         {
12334           fImpD_MSp_Samp = (TRootCanvas*)fCanvD_MSp_Samp->GetCanvasImp();
12335           fCanvD_MSp_Samp->Divide(1, 1, x_margin_factor , y_margin_factor); gPad->cd(1);
12336           fPadD_MSp_Samp = gPad;
12337           fMemoPlotD_MSp_Samp = 1; fMemoColorD_MSp_Samp = 0;
12338         }
12339       
12340       if(HistoCode == "D_SSp_Samp")                                               // (SetParametersCanvas)
12341         {
12342           fImpD_SSp_Samp = (TRootCanvas*)fCanvD_SSp_Samp->GetCanvasImp();
12343           fCanvD_SSp_Samp->Divide(1, 1, x_margin_factor , y_margin_factor); gPad->cd(1);
12344           fPadD_SSp_Samp = gPad;
12345           fMemoPlotD_SSp_Samp = 1; fMemoColorD_SSp_Samp = 0;
12346         }
12347       
12348       if(HistoCode == "D_Adc_EvDs")
12349         {
12350           fImpD_Adc_EvDs = (TRootCanvas*)fCanvD_Adc_EvDs->GetCanvasImp();
12351           fCanvD_Adc_EvDs->Divide(1, 1, x_margin_factor , y_margin_factor); gPad->cd(1);
12352           fPadD_Adc_EvDs = gPad;
12353           fMemoPlotD_Adc_EvDs = 1; fMemoColorD_Adc_EvDs = 0;              
12354         }
12355       
12356       if(HistoCode == "D_Adc_EvNb")
12357         {
12358           fImpD_Adc_EvNb = (TRootCanvas*)fCanvD_Adc_EvNb->GetCanvasImp();
12359           fCanvD_Adc_EvNb->Divide(1, 1, x_margin_factor , y_margin_factor); gPad->cd(1);
12360           fPadD_Adc_EvNb = gPad;
12361           fMemoPlotD_Adc_EvNb = 1; fMemoColorD_Adc_EvNb = 0;
12362         }
12363       
12364       if(HistoCode == "H_Ped_Date")                                               // (SetParametersCanvas)
12365         {
12366           fImpH_Ped_Date = (TRootCanvas*)fCanvH_Ped_Date->GetCanvasImp();
12367           fCanvH_Ped_Date->Divide(1, 1, x_margin_factor , y_margin_factor); gPad->cd(1);
12368           fPadH_Ped_Date = gPad;
12369           fMemoPlotH_Ped_Date = 1; fMemoColorH_Ped_Date = 0;
12370         }
12371       if(HistoCode == "H_TNo_Date")
12372         {
12373           fImpH_TNo_Date = (TRootCanvas*)fCanvH_TNo_Date->GetCanvasImp();
12374           fCanvH_TNo_Date->Divide(1, 1, x_margin_factor , y_margin_factor); gPad->cd(1);
12375           fPadH_TNo_Date = gPad;
12376           fMemoPlotH_TNo_Date = 1; fMemoColorH_TNo_Date = 0;
12377         }
12378       if(HistoCode == "H_MCs_Date")
12379         {
12380           fImpH_MCs_Date = (TRootCanvas*)fCanvH_MCs_Date->GetCanvasImp();
12381           fCanvH_MCs_Date->Divide(1, 1, x_margin_factor , y_margin_factor); gPad->cd(1);
12382           fPadH_MCs_Date = gPad;
12383           fMemoPlotH_MCs_Date = 1; fMemoColorH_MCs_Date = 0;
12384         }
12385 
12386       if(HistoCode == "H_LFN_Date")                                               // (SetParametersCanvas)
12387         {
12388           fImpH_LFN_Date = (TRootCanvas*)fCanvH_LFN_Date->GetCanvasImp();
12389           fCanvH_LFN_Date->Divide(1, 1, x_margin_factor , y_margin_factor); gPad->cd(1);
12390           fPadH_LFN_Date = gPad;
12391           fMemoPlotH_LFN_Date = 1; fMemoColorH_LFN_Date = 0;
12392         }
12393       if(HistoCode == "H_HFN_Date")
12394         {
12395           fImpH_HFN_Date = (TRootCanvas*)fCanvH_HFN_Date->GetCanvasImp();
12396           fCanvH_HFN_Date->Divide(1, 1, x_margin_factor , y_margin_factor); gPad->cd(1);
12397           fPadH_HFN_Date = gPad;
12398           fMemoPlotH_HFN_Date = 1; fMemoColorH_HFN_Date = 0;
12399         }
12400       if(HistoCode == "H_SCs_Date")
12401         {
12402           fImpH_SCs_Date = (TRootCanvas*)fCanvH_SCs_Date->GetCanvasImp();
12403           fCanvH_SCs_Date->Divide(1, 1, x_margin_factor , y_margin_factor); gPad->cd(1);
12404           fPadH_SCs_Date = gPad;
12405           fMemoPlotH_SCs_Date = 1; fMemoColorH_SCs_Date = 0;
12406         }
12407 
12408       if(HistoCode == "H_Ped_RuDs")                                               // (SetParametersCanvas)
12409         {
12410           fImpH_Ped_RuDs = (TRootCanvas*)fCanvH_Ped_RuDs->GetCanvasImp();
12411           fCanvH_Ped_RuDs->Divide(1, 1, x_margin_factor , y_margin_factor); gPad->cd(1);
12412           fPadH_Ped_RuDs = gPad;
12413           fMemoPlotH_Ped_RuDs = 1; fMemoColorH_Ped_RuDs = 0;
12414         }
12415       if(HistoCode == "H_TNo_RuDs")
12416         {
12417           fImpH_TNo_RuDs = (TRootCanvas*)fCanvH_TNo_RuDs->GetCanvasImp();
12418           fCanvH_TNo_RuDs->Divide(1, 1, x_margin_factor , y_margin_factor); gPad->cd(1);
12419           fPadH_TNo_RuDs = gPad;
12420           fMemoPlotH_TNo_RuDs = 1; fMemoColorH_TNo_RuDs = 0;
12421         }
12422       if(HistoCode == "H_MCs_RuDs")
12423         {
12424           fImpH_MCs_RuDs = (TRootCanvas*)fCanvH_MCs_RuDs->GetCanvasImp();
12425           fCanvH_MCs_RuDs->Divide(1, 1, x_margin_factor , y_margin_factor); gPad->cd(1);
12426           fPadH_MCs_RuDs = gPad;
12427           fMemoPlotH_MCs_RuDs = 1; fMemoColorH_MCs_RuDs = 0;
12428         }
12429 
12430       if(HistoCode == "H_LFN_RuDs")                                               // (SetParametersCanvas)
12431         {
12432           fImpH_LFN_RuDs = (TRootCanvas*)fCanvH_LFN_RuDs->GetCanvasImp();
12433           fCanvH_LFN_RuDs->Divide(1, 1, x_margin_factor , y_margin_factor); gPad->cd(1);
12434           fPadH_LFN_RuDs = gPad;
12435           fMemoPlotH_LFN_RuDs = 1; fMemoColorH_LFN_RuDs = 0;
12436         }
12437       if(HistoCode == "H_HFN_RuDs")
12438         {
12439           fImpH_HFN_RuDs = (TRootCanvas*)fCanvH_HFN_RuDs->GetCanvasImp();
12440           fCanvH_HFN_RuDs->Divide(1, 1, x_margin_factor , y_margin_factor); gPad->cd(1);
12441           fPadH_HFN_RuDs = gPad;
12442           fMemoPlotH_HFN_RuDs = 1; fMemoColorH_HFN_RuDs = 0;
12443         }
12444       if(HistoCode == "H_SCs_RuDs")
12445         {
12446           fImpH_SCs_RuDs = (TRootCanvas*)fCanvH_SCs_RuDs->GetCanvasImp();
12447           fCanvH_SCs_RuDs->Divide(1, 1, x_margin_factor , y_margin_factor); gPad->cd(1);
12448           fPadH_SCs_RuDs = gPad;
12449           fMemoPlotH_SCs_RuDs = 1; fMemoColorH_SCs_RuDs = 0;
12450         }
12451     }
12452 }
12453 // end of SetParametersCanvas
12454 
12455 TCanvas* TEcnaHistos::GetCurrentCanvas(const TString HistoCode, const TString opt_plot)
12456 {
12457   TCanvas* main_canvas = 0;
12458 
12459   if( opt_plot == fSameOnePlot ){main_canvas = fCanvH1SamePlus;}
12460 
12461   if( opt_plot == fOnlyOnePlot ||  opt_plot == fSeveralPlot)
12462     {
12463       if(HistoCode == "D_NOE_ChNb"){main_canvas = fCanvD_NOE_ChNb;}
12464       if(HistoCode == "D_NOE_ChDs"){main_canvas = fCanvD_NOE_ChDs;}
12465       if(HistoCode == "D_Ped_ChNb"){main_canvas = fCanvD_Ped_ChNb;}
12466       if(HistoCode == "D_Ped_ChDs"){main_canvas = fCanvD_Ped_ChDs;}
12467       if(HistoCode == "D_TNo_ChNb"){main_canvas = fCanvD_TNo_ChNb;}
12468       if(HistoCode == "D_TNo_ChDs"){main_canvas = fCanvD_TNo_ChDs;}
12469       if(HistoCode == "D_MCs_ChNb"){main_canvas = fCanvD_MCs_ChNb;}
12470       if(HistoCode == "D_MCs_ChDs"){main_canvas = fCanvD_MCs_ChDs;}
12471       if(HistoCode == "D_LFN_ChNb"){main_canvas = fCanvD_LFN_ChNb;}
12472       if(HistoCode == "D_LFN_ChDs"){main_canvas = fCanvD_LFN_ChDs;}
12473       if(HistoCode == "D_HFN_ChNb"){main_canvas = fCanvD_HFN_ChNb;}
12474       if(HistoCode == "D_HFN_ChDs"){main_canvas = fCanvD_HFN_ChDs;}
12475       if(HistoCode == "D_SCs_ChNb"){main_canvas = fCanvD_SCs_ChNb;}
12476       if(HistoCode == "D_SCs_ChDs"){main_canvas = fCanvD_SCs_ChDs;}
12477       if(HistoCode == "D_MSp_Samp"){main_canvas = fCanvD_MSp_Samp;}
12478       if(HistoCode == "D_SSp_Samp"){main_canvas = fCanvD_SSp_Samp;}
12479       if(HistoCode == "D_Adc_EvDs"){main_canvas = fCanvD_Adc_EvDs;}
12480       if(HistoCode == "D_Adc_EvNb"){main_canvas = fCanvD_Adc_EvNb;}
12481       if(HistoCode == "H_Ped_Date"){main_canvas = fCanvH_Ped_Date;}
12482       if(HistoCode == "H_TNo_Date"){main_canvas = fCanvH_TNo_Date;}
12483       if(HistoCode == "H_MCs_Date"){main_canvas = fCanvH_MCs_Date;}
12484       if(HistoCode == "H_LFN_Date"){main_canvas = fCanvH_LFN_Date;}
12485       if(HistoCode == "H_HFN_Date"){main_canvas = fCanvH_HFN_Date;}
12486       if(HistoCode == "H_SCs_Date"){main_canvas = fCanvH_SCs_Date;}
12487       if(HistoCode == "H_Ped_RuDs"){main_canvas = fCanvH_Ped_RuDs;}
12488       if(HistoCode == "H_TNo_RuDs"){main_canvas = fCanvH_TNo_RuDs;}
12489       if(HistoCode == "H_MCs_RuDs"){main_canvas = fCanvH_MCs_RuDs;}
12490       if(HistoCode == "H_LFN_RuDs"){main_canvas = fCanvH_LFN_RuDs;}
12491       if(HistoCode == "H_HFN_RuDs"){main_canvas = fCanvH_HFN_RuDs;}
12492       if(HistoCode == "H_SCs_RuDs"){main_canvas = fCanvH_SCs_RuDs;}
12493     }
12494   return main_canvas;
12495 }
12496 // end of GetCurrentCanvas(...)
12497 
12498 TCanvas* TEcnaHistos::GetCurrentCanvas(){return fCurrentCanvas;}
12499 TString  TEcnaHistos::GetCurrentCanvasName(){return fCurrentCanvasName;}
12500 
12501 void TEcnaHistos::PlotCloneOfCurrentCanvas()
12502 {
12503   if( fCurrentCanvas != 0)
12504     {
12505       if( (TRootCanvas*)fCurrentCanvas->GetCanvasImp() != 0 )
12506         {
12507           (TCanvas*)fCurrentCanvas->DrawClone();
12508         }
12509       else
12510         {
12511           cout << "TEcnaHistos::PlotCloneOfCurrentCanvas()> Last canvas has been removed. No clone can be done."
12512                << endl << "                                        Please, display the canvas again."
12513                << fTTBELL << endl;
12514         }
12515     }
12516   else
12517     {
12518       cout << "TEcnaHistos::PlotCloneOfCurrentCanvas()> No canvas has been created. No clone can be done."
12519            << fTTBELL << endl;
12520     }
12521 }
12522 
12523 //--------------------------------------------------------------------------------------------
12524 TVirtualPad* TEcnaHistos::ActivePad(const TString HistoCode, const TString opt_plot)
12525 {
12526 // Active Pad for Same plot option
12527 
12528   TVirtualPad* main_subpad = 0;
12529 
12530   if( opt_plot == fSameOnePlot )
12531     {
12532       if( (TRootCanvas*)fCanvH1SamePlus->GetCanvasImp() == fImpH1SamePlus ){
12533         main_subpad = fPadH1SamePlus;}
12534     }
12535 
12536   if( opt_plot == fOnlyOnePlot || opt_plot == fSeveralPlot)
12537     {
12538       if(HistoCode == "D_NOE_ChNb"){
12539         if( (TRootCanvas*)fCanvD_NOE_ChNb->GetCanvasImp() == fImpD_NOE_ChNb ){
12540           main_subpad = fPadD_NOE_ChNb;}}
12541       
12542       if(HistoCode == "D_NOE_ChDs"){
12543         if( (TRootCanvas*)fCanvD_NOE_ChDs->GetCanvasImp() == fImpD_NOE_ChDs ){
12544           main_subpad = fPadD_NOE_ChDs;}}
12545       
12546       if(HistoCode == "D_Ped_ChNb"){
12547         if( (TRootCanvas*)fCanvD_Ped_ChNb->GetCanvasImp() == fImpD_Ped_ChNb ){
12548           main_subpad = fPadD_Ped_ChNb;}}
12549 
12550       if(HistoCode == "D_Ped_ChDs"){
12551         if( (TRootCanvas*)fCanvD_Ped_ChDs->GetCanvasImp() == fImpD_Ped_ChDs ){
12552           main_subpad = fPadD_Ped_ChDs;}}
12553       
12554       if(HistoCode == "D_TNo_ChNb"){
12555         if((TRootCanvas*)fCanvD_TNo_ChNb->GetCanvasImp() == fImpD_TNo_ChNb){
12556           main_subpad = fPadD_TNo_ChNb;}}
12557 
12558       if(HistoCode == "D_TNo_ChDs"){
12559         if( (TRootCanvas*)fCanvD_TNo_ChDs->GetCanvasImp() == fImpD_TNo_ChDs ){
12560           main_subpad = fPadD_TNo_ChDs;}}
12561       
12562       if(HistoCode == "D_MCs_ChNb"){
12563         if( (TRootCanvas*)fCanvD_MCs_ChNb->GetCanvasImp() == fImpD_MCs_ChNb ){
12564           main_subpad = fPadD_MCs_ChNb;}}
12565       
12566       if(HistoCode == "D_MCs_ChDs"){
12567         if( (TRootCanvas*)fCanvD_MCs_ChDs->GetCanvasImp() == fImpD_MCs_ChDs ){
12568           main_subpad = fPadD_MCs_ChDs;}}
12569       
12570       if(HistoCode == "D_LFN_ChNb"){
12571         if( (TRootCanvas*)fCanvD_LFN_ChNb->GetCanvasImp() == fImpD_LFN_ChNb ){
12572           main_subpad = fPadD_LFN_ChNb;}}
12573       
12574       if(HistoCode == "D_LFN_ChDs"){
12575         if( (TRootCanvas*)fCanvD_LFN_ChDs->GetCanvasImp() == fImpD_LFN_ChDs ){
12576           main_subpad = fPadD_LFN_ChDs;}}
12577       
12578       if(HistoCode == "D_HFN_ChNb"){
12579         if( (TRootCanvas*)fCanvD_HFN_ChNb->GetCanvasImp() == fImpD_HFN_ChNb ){
12580           main_subpad = fPadD_HFN_ChNb;}}
12581       
12582       if(HistoCode == "D_HFN_ChDs"){
12583         if( (TRootCanvas*)fCanvD_HFN_ChDs->GetCanvasImp() == fImpD_HFN_ChDs ){
12584           main_subpad = fPadD_HFN_ChDs;}}
12585       
12586       if(HistoCode == "D_SCs_ChNb"){
12587         if( (TRootCanvas*)fCanvD_SCs_ChNb->GetCanvasImp() == fImpD_SCs_ChNb ){
12588           main_subpad = fPadD_SCs_ChNb;}}
12589       
12590       if(HistoCode == "D_SCs_ChDs"){
12591         if( (TRootCanvas*)fCanvD_SCs_ChDs->GetCanvasImp() == fImpD_SCs_ChDs ){
12592           main_subpad = fPadD_SCs_ChDs;}}
12593       
12594       if(HistoCode == "D_MSp_Samp"        ){
12595         if( (TRootCanvas*)fCanvD_MSp_Samp->GetCanvasImp() == fImpD_MSp_Samp ){
12596           main_subpad = fPadD_MSp_Samp;}}
12597       
12598       if(HistoCode == "D_SSp_Samp"     ){
12599         if( (TRootCanvas*)fCanvD_SSp_Samp->GetCanvasImp() == fImpD_SSp_Samp ){
12600           main_subpad = fPadD_SSp_Samp;}}
12601 
12602       if(HistoCode == "D_Adc_EvNb"){
12603         if( (TRootCanvas*)fCanvD_Adc_EvNb->GetCanvasImp() == fImpD_Adc_EvNb ){
12604           main_subpad = fPadD_Adc_EvNb;}}
12605       
12606       if(HistoCode == "D_Adc_EvDs"){
12607         if( (TRootCanvas*)fCanvD_Adc_EvDs->GetCanvasImp() == fImpD_Adc_EvDs ){
12608           main_subpad = fPadD_Adc_EvDs;}}
12609       
12610       if(HistoCode == "H_Ped_Date"){
12611         if( (TRootCanvas*)fCanvH_Ped_Date->GetCanvasImp() == fImpH_Ped_Date ){
12612           main_subpad = fPadH_Ped_Date;}}
12613 
12614       if(HistoCode == "H_TNo_Date"){
12615         if( (TRootCanvas*)fCanvH_TNo_Date->GetCanvasImp() == fImpH_TNo_Date ){
12616           main_subpad = fPadH_TNo_Date;}}
12617       
12618       if(HistoCode == "H_MCs_Date"){
12619         if( (TRootCanvas*)fCanvH_MCs_Date->GetCanvasImp() == fImpH_MCs_Date ){
12620           main_subpad = fPadH_MCs_Date;}}
12621 
12622       if(HistoCode == "H_LFN_Date"){
12623         if( (TRootCanvas*)fCanvH_LFN_Date->GetCanvasImp() == fImpH_LFN_Date ){
12624           main_subpad = fPadH_LFN_Date;}}
12625       
12626       if(HistoCode == "H_HFN_Date"){
12627         if( (TRootCanvas*)fCanvH_HFN_Date->GetCanvasImp() == fImpH_HFN_Date ){
12628           main_subpad = fPadH_HFN_Date;}}
12629       
12630       if(HistoCode == "H_SCs_Date"){
12631         if( (TRootCanvas*)fCanvH_SCs_Date->GetCanvasImp() == fImpH_SCs_Date ){
12632           main_subpad = fPadH_SCs_Date;}}
12633 
12634       if(HistoCode == "H_Ped_RuDs"){
12635         if( (TRootCanvas*)fCanvH_Ped_RuDs->GetCanvasImp() == fImpH_Ped_RuDs ){
12636           main_subpad = fPadH_Ped_RuDs;}}
12637       
12638       if(HistoCode == "H_TNo_RuDs"){
12639         if( (TRootCanvas*)fCanvH_TNo_RuDs->GetCanvasImp() == fImpH_TNo_RuDs ){
12640           main_subpad = fPadH_TNo_RuDs;}}
12641       
12642       if(HistoCode == "H_MCs_RuDs"){
12643         if( (TRootCanvas*)fCanvH_MCs_RuDs->GetCanvasImp() == fImpH_MCs_RuDs ){
12644           main_subpad = fPadH_MCs_RuDs;}}
12645 
12646       if(HistoCode == "H_LFN_RuDs"){
12647         if( (TRootCanvas*)fCanvH_LFN_RuDs->GetCanvasImp() == fImpH_LFN_RuDs ){
12648           main_subpad = fPadH_LFN_RuDs;}}
12649       
12650       if(HistoCode == "H_HFN_RuDs"){
12651         if( (TRootCanvas*)fCanvH_HFN_RuDs->GetCanvasImp() == fImpH_HFN_RuDs ){
12652           main_subpad = fPadH_HFN_RuDs;}}
12653       
12654       if(HistoCode == "H_SCs_RuDs"){
12655         if( (TRootCanvas*)fCanvH_SCs_RuDs->GetCanvasImp() == fImpH_SCs_RuDs ){
12656           main_subpad = fPadH_SCs_RuDs;}}
12657     }
12658     
12659   if( main_subpad == 0 )
12660     {cout << "*TEcnaHistos::ActivePad(...)> main_subpad = "
12661           << main_subpad << ". This canvas has been closed." << endl;}
12662 
12663   return main_subpad;
12664 }
12665 // end of ActivePad
12666 
12667 void TEcnaHistos::SetParametersPavTxt(const TString HistoCode, const TString opt_plot)
12668 {
12669 // Set parameters pave "sevearl changing" according to HistoCode
12670 
12671   if( opt_plot == fSameOnePlot ){fPavTxtH1SamePlus = fPavComSeveralChanging;}
12672 
12673   if( opt_plot == fOnlyOnePlot ||  opt_plot == fSeveralPlot)
12674     {
12675       if(HistoCode == "D_NOE_ChNb"){fPavTxtD_NOE_ChNb = fPavComSeveralChanging;}
12676       if(HistoCode == "D_NOE_ChDs"){fPavTxtD_NOE_ChDs = fPavComSeveralChanging;}
12677       if(HistoCode == "D_Ped_ChNb"){fPavTxtD_Ped_ChNb = fPavComSeveralChanging;}
12678       if(HistoCode == "D_Ped_ChDs"){fPavTxtD_Ped_ChDs = fPavComSeveralChanging;}
12679       if(HistoCode == "D_TNo_ChNb"){fPavTxtD_TNo_ChNb = fPavComSeveralChanging;}
12680       if(HistoCode == "D_TNo_ChDs"){fPavTxtD_TNo_ChDs = fPavComSeveralChanging;}
12681       if(HistoCode == "D_MCs_ChNb"){fPavTxtD_MCs_ChNb = fPavComSeveralChanging;}
12682       if(HistoCode == "D_MCs_ChDs"){fPavTxtD_MCs_ChDs = fPavComSeveralChanging;}
12683       if(HistoCode == "D_LFN_ChNb"){fPavTxtD_LFN_ChNb = fPavComSeveralChanging;}
12684       if(HistoCode == "D_LFN_ChDs"){fPavTxtD_LFN_ChDs = fPavComSeveralChanging;}
12685       if(HistoCode == "D_HFN_ChNb"){fPavTxtD_HFN_ChNb = fPavComSeveralChanging;}
12686       if(HistoCode == "D_HFN_ChDs"){fPavTxtD_HFN_ChDs = fPavComSeveralChanging;}
12687       if(HistoCode == "D_SCs_ChNb"){fPavTxtD_SCs_ChNb = fPavComSeveralChanging;}
12688       if(HistoCode == "D_SCs_ChDs"){fPavTxtD_SCs_ChDs = fPavComSeveralChanging;}
12689       if(HistoCode == "D_MSp_Samp"){fPavTxtD_MSp_Samp = fPavComSeveralChanging;}
12690       if(HistoCode == "D_SSp_Samp"){fPavTxtD_SSp_Samp = fPavComSeveralChanging;}
12691       if(HistoCode == "D_Adc_EvNb"){fPavTxtD_Adc_EvNb = fPavComSeveralChanging;}
12692       if(HistoCode == "D_Adc_EvDs"){fPavTxtD_Adc_EvDs = fPavComSeveralChanging;}
12693       if(HistoCode == "H_Ped_Date"){fPavTxtH_Ped_Date = fPavComSeveralChanging;}
12694       if(HistoCode == "H_TNo_Date"){fPavTxtH_TNo_Date = fPavComSeveralChanging;}
12695       if(HistoCode == "H_MCs_Date"){fPavTxtH_MCs_Date = fPavComSeveralChanging;}
12696       if(HistoCode == "H_LFN_Date"){fPavTxtH_LFN_Date = fPavComSeveralChanging;}
12697       if(HistoCode == "H_HFN_Date"){fPavTxtH_HFN_Date = fPavComSeveralChanging;}
12698       if(HistoCode == "H_SCs_Date"){fPavTxtH_SCs_Date = fPavComSeveralChanging;}
12699       if(HistoCode == "H_Ped_RuDs"){fPavTxtH_Ped_RuDs = fPavComSeveralChanging;}
12700       if(HistoCode == "H_TNo_RuDs"){fPavTxtH_TNo_RuDs = fPavComSeveralChanging;}
12701       if(HistoCode == "H_MCs_RuDs"){fPavTxtH_MCs_RuDs = fPavComSeveralChanging;}
12702       if(HistoCode == "H_LFN_RuDs"){fPavTxtH_LFN_RuDs = fPavComSeveralChanging;}
12703       if(HistoCode == "H_HFN_RuDs"){fPavTxtH_HFN_RuDs = fPavComSeveralChanging;}
12704       if(HistoCode == "H_SCs_RuDs"){fPavTxtH_SCs_RuDs = fPavComSeveralChanging;}
12705     }
12706 }
12707 // end of SetParametersPavTxt
12708 
12709 
12710 TPaveText* TEcnaHistos::ActivePavTxt(const TString HistoCode, const TString opt_plot)
12711 {
12712   // Active Pad for Same plot option
12713 
12714   TPaveText* main_pavtxt = 0;
12715   
12716   if( opt_plot == fSameOnePlot )
12717     {
12718       //if( (TRootCanvas*)fCanvH1SamePlus->GetCanvasImp() == fImpH1SamePlus )
12719       {main_pavtxt = fPavTxtH1SamePlus;}
12720     }
12721   
12722   if( opt_plot == fOnlyOnePlot || opt_plot == fSeveralPlot)
12723     {
12724       if(HistoCode == "D_NOE_ChNb"){main_pavtxt = fPavTxtD_NOE_ChNb;}
12725       if(HistoCode == "D_NOE_ChDs"){main_pavtxt = fPavTxtD_NOE_ChDs;}
12726       if(HistoCode == "D_Ped_ChNb"){main_pavtxt = fPavTxtD_Ped_ChNb;}
12727       if(HistoCode == "D_Ped_ChDs"){main_pavtxt = fPavTxtD_Ped_ChDs;}
12728       if(HistoCode == "D_TNo_ChNb"){main_pavtxt = fPavTxtD_TNo_ChNb;}
12729       if(HistoCode == "D_TNo_ChDs"){main_pavtxt = fPavTxtD_TNo_ChDs;}
12730       if(HistoCode == "D_MCs_ChNb"){main_pavtxt = fPavTxtD_MCs_ChNb;}     
12731       if(HistoCode == "D_MCs_ChDs"){main_pavtxt = fPavTxtD_MCs_ChDs;}
12732       if(HistoCode == "D_LFN_ChNb"){main_pavtxt = fPavTxtD_LFN_ChNb;}
12733       if(HistoCode == "D_LFN_ChDs"){main_pavtxt = fPavTxtD_LFN_ChDs;}
12734       if(HistoCode == "D_HFN_ChNb"){main_pavtxt = fPavTxtD_HFN_ChNb;}
12735       if(HistoCode == "D_HFN_ChDs"){main_pavtxt = fPavTxtD_HFN_ChDs;}
12736       if(HistoCode == "D_SCs_ChNb"){main_pavtxt = fPavTxtD_SCs_ChNb;}
12737       if(HistoCode == "D_SCs_ChDs"){main_pavtxt = fPavTxtD_SCs_ChDs;}
12738       if(HistoCode == "D_MSp_Samp"){main_pavtxt = fPavTxtD_MSp_Samp;}
12739       if(HistoCode == "D_SSp_Samp"){main_pavtxt = fPavTxtD_SSp_Samp;}
12740       if(HistoCode == "D_Adc_EvNb"){main_pavtxt = fPavTxtD_Adc_EvNb;}
12741       if(HistoCode == "D_Adc_EvDs"){main_pavtxt = fPavTxtD_Adc_EvDs;}
12742       if(HistoCode == "H_Ped_Date"){main_pavtxt = fPavTxtH_Ped_Date;}
12743       if(HistoCode == "H_TNo_Date"){main_pavtxt = fPavTxtH_TNo_Date;}
12744       if(HistoCode == "H_MCs_Date"){main_pavtxt = fPavTxtH_MCs_Date;}
12745       if(HistoCode == "H_LFN_Date"){main_pavtxt = fPavTxtH_LFN_Date;}
12746       if(HistoCode == "H_HFN_Date"){main_pavtxt = fPavTxtH_HFN_Date;}
12747       if(HistoCode == "H_SCs_Date"){main_pavtxt = fPavTxtH_SCs_Date;}
12748       if(HistoCode == "H_Ped_RuDs"){main_pavtxt = fPavTxtH_Ped_RuDs;}
12749       if(HistoCode == "H_TNo_RuDs"){main_pavtxt = fPavTxtH_TNo_RuDs;}
12750       if(HistoCode == "H_MCs_RuDs"){main_pavtxt = fPavTxtH_MCs_RuDs;}
12751       if(HistoCode == "H_LFN_RuDs"){main_pavtxt = fPavTxtH_LFN_RuDs;}
12752       if(HistoCode == "H_HFN_RuDs"){main_pavtxt = fPavTxtH_HFN_RuDs;}
12753       if(HistoCode == "H_SCs_RuDs"){main_pavtxt = fPavTxtH_SCs_RuDs;}
12754     }
12755   
12756   if( main_pavtxt == 0 )
12757     {cout << "*TEcnaHistos::ActivePavTxt(...)> ERROR: main_pavtxt = " << main_pavtxt << endl;}
12758 
12759   return main_pavtxt;
12760 }
12761 // end of ActivePavTxt
12762 
12763 //void TEcnaHistos::SetViewHistoMarkerAndLine(TH1D* h_his0, const TString HistoCode, const TString opt_plot)
12764 //{
12766 //
12767 //  TString HistoType = fCnaParHistos->GetHistoType(HistoCode.Data());
12768 //
12769 //  //............................... Marker
12770 //  h_his0->SetMarkerStyle(1);        // default
12771 //  
12772 //  if( HistoType == "Global" && ( opt_plot == fSeveralPlot || opt_plot == fSameOnePlot ) )
12773 //    {h_his0->SetMarkerStyle(7); }
12774 //  
12775 //  //............................... Line
12776 //  h_his0->SetLineWidth(1);        // default
12777 //
12778 //  if( HistoType == "Global" && ( opt_plot == fSeveralPlot || opt_plot == fSameOnePlot ) )
12779 //    {h_his0->SetLineWidth(0);}
12780 //
12781 //}
12782 
12783 void TEcnaHistos::SetViewHistoColors(TH1D* h_his0, const TString HistoCode, const TString opt_plot)
12784 {
12785 // Set colors, fill, marker, line style for histo view
12786 
12787   TString HistoType = fCnaParHistos->GetHistoType(HistoCode.Data());
12788   if( HistoType == "Global" ){h_his0->SetMarkerStyle(1);}
12789 
12790   Int_t MaxNbOfColors = fCnaParHistos->GetMaxNbOfColors();
12791 
12792   if( opt_plot == fSameOnePlot )
12793     {
12794       h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorH1SamePlus));
12795       h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorH1SamePlus));
12796       fMemoColorH1SamePlus++;
12797       if(fMemoColorH1SamePlus>MaxNbOfColors){fMemoColorH1SamePlus = 0;}
12798     }
12799 
12800   if( opt_plot == fOnlyOnePlot || opt_plot == fSeveralPlot)
12801     {
12802       if(HistoCode == "D_NOE_ChNb")
12803         {
12804           if(opt_plot == fOnlyOnePlot){h_his0->SetFillColor(fCnaParHistos->ColorDefinition("rose"));}
12805           if(opt_plot == fSeveralPlot )
12806             {h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorD_NOE_ChNb));
12807             h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorD_NOE_ChNb));
12808             fMemoColorD_NOE_ChNb++;
12809             if(fMemoColorD_NOE_ChNb>MaxNbOfColors){fMemoColorD_NOE_ChNb = 0;}}
12810         }
12811       if(HistoCode == "D_NOE_ChDs")
12812         {
12813           if(opt_plot == fOnlyOnePlot){h_his0->SetFillColor(fCnaParHistos->ColorDefinition("rose"));}
12814           if(opt_plot == fSeveralPlot )
12815             {h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorD_NOE_ChDs));
12816             h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorD_NOE_ChDs));
12817            fMemoColorD_NOE_ChDs++;
12818             if(fMemoColorD_NOE_ChDs>MaxNbOfColors){fMemoColorD_NOE_ChDs = 0;}}
12819         }
12820       if(HistoCode == "D_Ped_ChNb")
12821         {
12822           if(opt_plot == fOnlyOnePlot){h_his0->SetFillColor(fCnaParHistos->ColorDefinition("bleu38"));}
12823           if(opt_plot == fSeveralPlot )
12824             {h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorD_Ped_ChNb));
12825             h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorD_Ped_ChNb));
12826             fMemoColorD_Ped_ChNb++;
12827             if(fMemoColorD_Ped_ChNb>MaxNbOfColors){fMemoColorD_Ped_ChNb = 0;}}
12828         }
12829       if(HistoCode == "D_Ped_ChDs")
12830         {
12831           if(opt_plot == fOnlyOnePlot){h_his0->SetFillColor(fCnaParHistos->ColorDefinition("bleu38"));}
12832           if(opt_plot == fSeveralPlot )
12833             {h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorD_Ped_ChDs));
12834             h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorD_Ped_ChDs));
12835             fMemoColorD_Ped_ChDs++;
12836             if(fMemoColorD_Ped_ChDs>MaxNbOfColors){fMemoColorD_Ped_ChDs = 0;}}
12837         }
12838       if(HistoCode == "D_TNo_ChNb")
12839         {
12840           if(opt_plot == fOnlyOnePlot){h_his0->SetFillColor(fCnaParHistos->ColorDefinition("rouge48"));}
12841           if(opt_plot == fSeveralPlot )
12842             {h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorD_TNo_ChNb));
12843             h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorD_TNo_ChNb));
12844             fMemoColorD_TNo_ChNb++;
12845             if(fMemoColorD_TNo_ChNb>MaxNbOfColors){fMemoColorD_TNo_ChNb = 0;}}
12846         }
12847       if(HistoCode == "D_TNo_ChDs")
12848         {
12849           if(opt_plot == fOnlyOnePlot){h_his0->SetFillColor(fCnaParHistos->ColorDefinition("rouge48"));}
12850           if(opt_plot == fSeveralPlot )
12851             {h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorD_TNo_ChDs));
12852             h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorD_TNo_ChDs));
12853             fMemoColorD_TNo_ChDs++;
12854             if(fMemoColorD_TNo_ChDs>MaxNbOfColors){fMemoColorD_TNo_ChDs = 0;}}
12855         }
12856               
12857       if(HistoCode == "D_MCs_ChNb")
12858         {
12859           if(opt_plot == fOnlyOnePlot){h_his0->SetFillColor(fCnaParHistos->ColorDefinition("vert31"));}
12860           if(opt_plot == fSeveralPlot )
12861             {h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorD_MCs_ChNb));
12862             h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorD_MCs_ChNb));
12863             fMemoColorD_MCs_ChNb++;
12864             if(fMemoColorD_MCs_ChNb>MaxNbOfColors){fMemoColorD_MCs_ChNb = 0;}}
12865         }
12866       if(HistoCode == "D_MCs_ChDs")
12867         {
12868           if(opt_plot == fOnlyOnePlot){h_his0->SetFillColor(fCnaParHistos->ColorDefinition("vert31"));}
12869           if(opt_plot == fSeveralPlot )
12870             {h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorD_MCs_ChDs));
12871             h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorD_MCs_ChDs));
12872             fMemoColorD_MCs_ChDs++;
12873             if(fMemoColorD_MCs_ChDs>MaxNbOfColors){fMemoColorD_MCs_ChDs = 0;}}
12874         }
12875       if(HistoCode == "D_LFN_ChNb")
12876         {
12877           if(opt_plot == fOnlyOnePlot){h_his0->SetFillColor(fCnaParHistos->ColorDefinition("rouge44"));}
12878           if(opt_plot == fSeveralPlot )
12879             {h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorD_LFN_ChNb));
12880             h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorD_LFN_ChNb));
12881             fMemoColorD_LFN_ChNb++;
12882             if(fMemoColorD_LFN_ChNb>MaxNbOfColors){fMemoColorD_LFN_ChNb = 0;}}
12883         }
12884       if(HistoCode == "D_LFN_ChDs")
12885         {
12886           if(opt_plot == fOnlyOnePlot){h_his0->SetFillColor(fCnaParHistos->ColorDefinition("rouge44"));}
12887           if(opt_plot == fSeveralPlot )
12888             {h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorD_LFN_ChDs));
12889             h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorD_LFN_ChDs));
12890             fMemoColorD_LFN_ChDs++;
12891             if(fMemoColorD_LFN_ChDs>MaxNbOfColors){fMemoColorD_LFN_ChDs = 0;}}
12892         }
12893       if(HistoCode == "D_HFN_ChNb")
12894         {
12895           if(opt_plot == fOnlyOnePlot){h_his0->SetFillColor(fCnaParHistos->ColorDefinition("rouge50"));}
12896           if(opt_plot == fSeveralPlot )
12897             {h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorD_HFN_ChNb));
12898             h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorD_HFN_ChNb));
12899             fMemoColorD_HFN_ChNb++;
12900             if(fMemoColorD_HFN_ChNb>MaxNbOfColors){fMemoColorD_HFN_ChNb = 0;}}
12901         }
12902       if(HistoCode == "D_HFN_ChDs")
12903         {
12904           if(opt_plot == fOnlyOnePlot){h_his0->SetFillColor(fCnaParHistos->ColorDefinition("rouge50"));}
12905           if(opt_plot == fSeveralPlot )
12906             {h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorD_HFN_ChDs));
12907             h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorD_HFN_ChDs));
12908             fMemoColorD_HFN_ChDs++;
12909             if(fMemoColorD_HFN_ChDs>MaxNbOfColors){fMemoColorD_HFN_ChDs = 0;}}
12910         }
12911 
12912       if(HistoCode == "D_SCs_ChNb")
12913         {
12914           if(opt_plot == fOnlyOnePlot){h_his0->SetFillColor(fCnaParHistos->ColorDefinition("marron23"));}
12915           if(opt_plot == fSeveralPlot )
12916             {h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorD_SCs_ChNb));
12917             h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorD_SCs_ChNb));
12918             fMemoColorD_SCs_ChNb++;
12919             if(fMemoColorD_SCs_ChNb>MaxNbOfColors){fMemoColorD_SCs_ChNb = 0;}}
12920         }
12921       if(HistoCode == "D_SCs_ChDs")
12922         {
12923           if(opt_plot == fOnlyOnePlot){h_his0->SetFillColor(fCnaParHistos->ColorDefinition("marron23"));}
12924           if(opt_plot == fSeveralPlot )
12925             {h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorD_SCs_ChDs));
12926             h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorD_SCs_ChDs));
12927             fMemoColorD_SCs_ChDs++;
12928             if(fMemoColorD_SCs_ChDs>MaxNbOfColors){fMemoColorD_SCs_ChDs = 0;}}
12929         }
12930               
12931       if(HistoCode == "D_MSp_Samp")
12932         {
12933           if(opt_plot == fOnlyOnePlot){h_his0->SetFillColor(fCnaParHistos->ColorDefinition("bleu38"));}
12934           if(opt_plot == fSeveralPlot )
12935             {h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorD_MSp_Samp));
12936             h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorD_MSp_Samp));
12937             fMemoColorD_MSp_Samp++;
12938             if(fMemoColorD_MSp_Samp>MaxNbOfColors){fMemoColorD_MSp_Samp = 0;}}
12939         }
12940               
12941       if(HistoCode == "D_SSp_Samp")
12942         {
12943           if(opt_plot == fOnlyOnePlot){h_his0->SetFillColor(fCnaParHistos->ColorDefinition("rouge50"));}
12944           if(opt_plot == fSeveralPlot )
12945             {h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorD_SSp_Samp));
12946             h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorD_SSp_Samp));
12947             fMemoColorD_SSp_Samp++;
12948             if(fMemoColorD_SSp_Samp>MaxNbOfColors){fMemoColorD_SSp_Samp = 0;}}
12949         }
12950               
12951       if(HistoCode == "D_Adc_EvDs")
12952         {
12953           if(opt_plot == fOnlyOnePlot){h_his0->SetFillColor(fCnaParHistos->ColorDefinition("orange42"));}
12954           if(opt_plot == fSeveralPlot )
12955             {h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorD_Adc_EvDs));
12956             h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorD_Adc_EvDs));
12957             fMemoColorD_Adc_EvDs++;
12958             if(fMemoColorD_Adc_EvDs>MaxNbOfColors){fMemoColorD_Adc_EvDs = 0;}}
12959         }
12960 
12961       if(HistoCode == "D_Adc_EvNb")
12962         {
12963           if(opt_plot == fOnlyOnePlot){h_his0->SetFillColor(fCnaParHistos->ColorDefinition("orange42"));}
12964           if(opt_plot == fSeveralPlot )
12965             {h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorD_Adc_EvNb));
12966             h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorD_Adc_EvNb));
12967             fMemoColorD_Adc_EvNb++;
12968             if(fMemoColorD_Adc_EvNb>MaxNbOfColors){fMemoColorD_Adc_EvNb = 0;}}
12969           gPad->SetGrid(1,0);
12970         }
12971 
12972       if(HistoCode == "H_Ped_RuDs")
12973         {
12974           if(opt_plot == fOnlyOnePlot){h_his0->SetFillColor(fCnaParHistos->ColorDefinition("bleu38"));}
12975           if(opt_plot == fSeveralPlot )
12976             {h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorH_Ped_RuDs));
12977             h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorH_Ped_RuDs));
12978             fMemoColorH_Ped_RuDs++;
12979             if(fMemoColorH_Ped_RuDs>MaxNbOfColors){fMemoColorH_Ped_RuDs = 0;}}
12980           gPad->SetGrid(1,1);
12981         }
12982 
12983       if(HistoCode == "H_TNo_RuDs")
12984         {
12985           if(opt_plot == fOnlyOnePlot){h_his0->SetFillColor(fCnaParHistos->ColorDefinition("rouge48"));}
12986           if(opt_plot == fSeveralPlot )
12987             {h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorH_TNo_RuDs));
12988             h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorH_TNo_RuDs));
12989             fMemoColorH_TNo_RuDs++;
12990             if(fMemoColorH_TNo_RuDs>MaxNbOfColors){fMemoColorH_TNo_RuDs = 0;}}
12991           gPad->SetGrid(1,1);
12992         }
12993 
12994       if(HistoCode == "H_MCs_RuDs")
12995         {
12996           if(opt_plot == fOnlyOnePlot){h_his0->SetFillColor(fCnaParHistos->ColorDefinition("vert31"));}
12997           if(opt_plot == fSeveralPlot )
12998             {h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorH_MCs_RuDs));
12999             h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorH_MCs_RuDs));
13000             fMemoColorH_MCs_RuDs++;
13001             if(fMemoColorH_MCs_RuDs>MaxNbOfColors){fMemoColorH_MCs_RuDs = 0;}}
13002           gPad->SetGrid(1,1);
13003         }
13004 
13005       if(HistoCode == "H_LFN_RuDs")
13006         {
13007           if(opt_plot == fOnlyOnePlot){h_his0->SetFillColor(fCnaParHistos->ColorDefinition("rouge44"));}
13008           if(opt_plot == fSeveralPlot )
13009             {h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorH_LFN_RuDs));
13010             h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorH_LFN_RuDs));
13011             fMemoColorH_LFN_RuDs++;
13012             if(fMemoColorH_LFN_RuDs>MaxNbOfColors){fMemoColorH_LFN_RuDs = 0;}}
13013           gPad->SetGrid(1,1);
13014         }
13015 
13016       if(HistoCode == "H_HFN_RuDs")
13017         {
13018           if(opt_plot == fOnlyOnePlot){h_his0->SetFillColor(fCnaParHistos->ColorDefinition("rouge50"));}
13019           if(opt_plot == fSeveralPlot )
13020             {h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorH_HFN_RuDs));
13021             h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorH_HFN_RuDs));
13022             fMemoColorH_HFN_RuDs++;
13023             if(fMemoColorH_HFN_RuDs>MaxNbOfColors){fMemoColorH_HFN_RuDs = 0;}}
13024           gPad->SetGrid(1,1);
13025         }
13026 
13027       if(HistoCode == "H_SCs_RuDs")
13028         {
13029           if(opt_plot == fOnlyOnePlot){h_his0->SetFillColor(fCnaParHistos->ColorDefinition("marron23"));}
13030           if(opt_plot == fSeveralPlot )
13031             {h_his0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorH_SCs_RuDs));
13032             h_his0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorH_SCs_RuDs));
13033             fMemoColorH_SCs_RuDs++;
13034             if(fMemoColorH_SCs_RuDs>MaxNbOfColors){fMemoColorH_SCs_RuDs = 0;}}
13035           gPad->SetGrid(1,1);
13036         }
13037     }
13038 
13039   // if(opt_plot == fSeveralPlot || opt_plot == fSameOnePlot){h_his0->SetLineWidth(2);}
13040 }
13041 // end of SetViewHistoColors
13042 
13043 void TEcnaHistos::SetViewGraphColors(TGraph* g_graph0, const TString HistoCode, const TString opt_plot)
13044 {
13045 // Set colors for histo view
13046 
13047   Int_t MaxNbOfColors = fCnaParHistos->GetMaxNbOfColors();
13048 
13049   if( opt_plot == fSameOnePlot )
13050     {
13051       g_graph0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorH1SamePlus));
13052       g_graph0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorH1SamePlus));
13053       fMemoColorH1SamePlus++;
13054       if(fMemoColorH1SamePlus>MaxNbOfColors){fMemoColorH1SamePlus = 0;}
13055       gPad->SetGrid(1,1);
13056     }
13057 
13058   if( opt_plot == fOnlyOnePlot || opt_plot == fSeveralPlot)
13059     {
13060       if(HistoCode == "H_Ped_Date")
13061         {
13062           if(opt_plot == fOnlyOnePlot){g_graph0->SetMarkerColor(fCnaParHistos->ColorDefinition("bleu38"));}
13063           if(opt_plot == fSeveralPlot )
13064             {g_graph0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorH_Ped_Date));
13065             g_graph0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorH_Ped_Date));
13066             fMemoColorH_Ped_Date++;
13067             if(fMemoColorH_Ped_Date>MaxNbOfColors){fMemoColorH_Ped_Date = 0;}}
13068           gPad->SetGrid(1,1);
13069         }
13070       
13071       if(HistoCode == "H_TNo_Date")
13072         {
13073           if(opt_plot == fOnlyOnePlot){g_graph0->SetMarkerColor(fCnaParHistos->ColorDefinition("rouge48"));}
13074           if(opt_plot == fSeveralPlot)
13075             {g_graph0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorH_TNo_Date));
13076             g_graph0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorH_TNo_Date));
13077             fMemoColorH_TNo_Date++;
13078             if(fMemoColorH_TNo_Date>MaxNbOfColors){fMemoColorH_TNo_Date = 0;}}
13079           gPad->SetGrid(1,1);
13080         }
13081       
13082       if(HistoCode == "H_MCs_Date")
13083         {
13084           if(opt_plot == fOnlyOnePlot){g_graph0->SetMarkerColor(fCnaParHistos->ColorDefinition("vert31"));}
13085           if(opt_plot == fSeveralPlot)
13086             {g_graph0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorH_MCs_Date));
13087             g_graph0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorH_MCs_Date));
13088             fMemoColorH_MCs_Date++;
13089             if(fMemoColorH_MCs_Date>MaxNbOfColors){fMemoColorH_MCs_Date = 0;}}
13090           gPad->SetGrid(1,1);
13091         }
13092 
13093       if(HistoCode == "H_LFN_Date")
13094         {
13095           if(opt_plot == fOnlyOnePlot){g_graph0->SetMarkerColor(fCnaParHistos->ColorDefinition("bleu38"));}
13096           if(opt_plot == fSeveralPlot )
13097             {g_graph0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorH_LFN_Date));
13098             g_graph0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorH_LFN_Date));
13099             fMemoColorH_LFN_Date++;
13100             if(fMemoColorH_LFN_Date>MaxNbOfColors){fMemoColorH_LFN_Date = 0;}}
13101           gPad->SetGrid(1,1);
13102         }
13103       
13104       if(HistoCode == "H_HFN_Date")
13105         {
13106           if(opt_plot == fOnlyOnePlot){g_graph0->SetMarkerColor(fCnaParHistos->ColorDefinition("rouge48"));}
13107           if(opt_plot == fSeveralPlot)
13108             {g_graph0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorH_HFN_Date));
13109             g_graph0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorH_HFN_Date));
13110             fMemoColorH_HFN_Date++;
13111             if(fMemoColorH_HFN_Date>MaxNbOfColors){fMemoColorH_HFN_Date = 0;}}
13112           gPad->SetGrid(1,1);
13113         }
13114       
13115       if(HistoCode == "H_SCs_Date")
13116         {
13117           if(opt_plot == fOnlyOnePlot){g_graph0->SetMarkerColor(fCnaParHistos->ColorDefinition("vert31"));}
13118           if(opt_plot == fSeveralPlot)
13119             {g_graph0->SetMarkerColor(fCnaParHistos->ColorTab(fMemoColorH_SCs_Date));
13120             g_graph0->SetLineColor(fCnaParHistos->ColorTab(fMemoColorH_SCs_Date));
13121             fMemoColorH_SCs_Date++;
13122             if(fMemoColorH_SCs_Date>MaxNbOfColors){fMemoColorH_SCs_Date = 0;}}
13123           gPad->SetGrid(1,1);
13124         }
13125     }
13126   //if(opt_plot == fSeveralPlot){g_graph0->SetLineWidth(2);}
13127 }
13128 // end of SetViewGraphColors
13129 
13130 Color_t TEcnaHistos::GetViewHistoColor(const TString HistoCode, const TString opt_plot)
13131 {
13132   Color_t couleur = fCnaParHistos->ColorDefinition("noir");        // a priori = "noir"
13133 
13134   if( opt_plot == fSameOnePlot ){couleur = fCnaParHistos->ColorTab(fMemoColorH1SamePlus);}
13135 
13136   if( opt_plot == fOnlyOnePlot || opt_plot == fSeveralPlot )
13137     {
13138       if(HistoCode == "D_NOE_ChNb"){couleur = fCnaParHistos->ColorTab(fMemoColorD_NOE_ChNb);}
13139       if(HistoCode == "D_NOE_ChDs"){couleur = fCnaParHistos->ColorTab(fMemoColorD_NOE_ChDs);}
13140       if(HistoCode == "D_Ped_ChNb"){couleur = fCnaParHistos->ColorTab(fMemoColorD_Ped_ChNb);}
13141       if(HistoCode == "D_Ped_ChDs"){couleur = fCnaParHistos->ColorTab(fMemoColorD_Ped_ChDs);}
13142       if(HistoCode == "D_TNo_ChNb"){couleur = fCnaParHistos->ColorTab(fMemoColorD_TNo_ChNb);}
13143       if(HistoCode == "D_TNo_ChDs"){couleur = fCnaParHistos->ColorTab(fMemoColorD_TNo_ChDs);}
13144       if(HistoCode == "D_MCs_ChNb"){couleur = fCnaParHistos->ColorTab(fMemoColorD_MCs_ChNb);}
13145       if(HistoCode == "D_MCs_ChDs"){couleur = fCnaParHistos->ColorTab(fMemoColorD_MCs_ChDs);}
13146       if(HistoCode == "D_LFN_ChNb"){couleur = fCnaParHistos->ColorTab(fMemoColorD_LFN_ChNb);}
13147       if(HistoCode == "D_LFN_ChDs"){couleur = fCnaParHistos->ColorTab(fMemoColorD_LFN_ChDs);} 
13148       if(HistoCode == "D_HFN_ChNb"){couleur = fCnaParHistos->ColorTab(fMemoColorD_HFN_ChNb);} 
13149       if(HistoCode == "D_HFN_ChDs"){couleur = fCnaParHistos->ColorTab(fMemoColorD_HFN_ChDs);}
13150       if(HistoCode == "D_SCs_ChNb"){couleur = fCnaParHistos->ColorTab(fMemoColorD_SCs_ChNb);}
13151       if(HistoCode == "D_SCs_ChDs"){couleur = fCnaParHistos->ColorTab(fMemoColorD_SCs_ChDs);}
13152       if(HistoCode == "D_MSp_Samp"){couleur = fCnaParHistos->ColorTab(fMemoColorD_MSp_Samp);}
13153       if(HistoCode == "D_SSp_Samp"){couleur = fCnaParHistos->ColorTab(fMemoColorD_SSp_Samp);}
13154       if(HistoCode == "D_Adc_EvDs"){couleur = fCnaParHistos->ColorTab(fMemoColorD_Adc_EvDs);}
13155       if(HistoCode == "D_Adc_EvNb"){couleur = fCnaParHistos->ColorTab(fMemoColorD_Adc_EvNb);}
13156       if(HistoCode == "H_Ped_Date"){couleur = fCnaParHistos->ColorTab(fMemoColorH_Ped_Date);}
13157       if(HistoCode == "H_TNo_Date"){couleur = fCnaParHistos->ColorTab(fMemoColorH_TNo_Date);}
13158       if(HistoCode == "H_MCs_Date"){couleur = fCnaParHistos->ColorTab(fMemoColorH_MCs_Date);}
13159       if(HistoCode == "H_LFN_Date"){couleur = fCnaParHistos->ColorTab(fMemoColorH_LFN_Date);}
13160       if(HistoCode == "H_HFN_Date"){couleur = fCnaParHistos->ColorTab(fMemoColorH_HFN_Date);}
13161       if(HistoCode == "H_SCs_Date"){couleur = fCnaParHistos->ColorTab(fMemoColorH_SCs_Date);}
13162       if(HistoCode == "H_Ped_RuDs"){couleur = fCnaParHistos->ColorTab(fMemoColorH_Ped_RuDs);}
13163       if(HistoCode == "H_TNo_RuDs"){couleur = fCnaParHistos->ColorTab(fMemoColorH_TNo_RuDs);}
13164       if(HistoCode == "H_MCs_RuDs"){couleur = fCnaParHistos->ColorTab(fMemoColorH_MCs_RuDs);}
13165       if(HistoCode == "H_LFN_RuDs"){couleur = fCnaParHistos->ColorTab(fMemoColorH_LFN_RuDs);}
13166       if(HistoCode == "H_HFN_RuDs"){couleur = fCnaParHistos->ColorTab(fMemoColorH_HFN_RuDs);}
13167       if(HistoCode == "H_SCs_RuDs"){couleur = fCnaParHistos->ColorTab(fMemoColorH_SCs_RuDs);}
13168     }
13169   return couleur;
13170 }
13171 // end of GetViewHistoColor
13172 
13173 Color_t TEcnaHistos::GetSCColor(const TString DeeEndcap, const TString DeeDir, const TString QuadType)
13174 {
13175  //gives the SC color for the numbering plots
13176   TColor* my_color = new TColor();
13177   Color_t couleur = fCnaParHistos->ColorDefinition("noir");        // default = "noir"
13178 
13179   if( DeeEndcap == "EE+" )
13180     {
13181       if ( DeeDir == "right" && QuadType == "top"    ){couleur=fCnaParHistos->ColorDefinition("rouge");}
13182       if ( DeeDir == "right" && QuadType == "bottom" ){couleur=fCnaParHistos->ColorDefinition("bleu_fonce");}
13183       if ( DeeDir == "left"  && QuadType == "top"    ){couleur=(Color_t)my_color->GetColor("#006600");}
13184       if ( DeeDir == "left"  && QuadType == "bottom" ){couleur=(Color_t)my_color->GetColor("#CC3300");}
13185     }
13186   if( DeeEndcap == "EE-" )
13187     {
13188       if ( DeeDir == "right"  && QuadType == "top"    ){couleur=(Color_t)my_color->GetColor("#008800");}
13189       if ( DeeDir == "right"  && QuadType == "bottom" ){couleur=(Color_t)my_color->GetColor("#EE5500");}
13190       if ( DeeDir == "left"   && QuadType == "top"    ){couleur=fCnaParHistos->ColorDefinition("rouge");}
13191       if ( DeeDir == "left"   && QuadType == "bottom" ){couleur=fCnaParHistos->ColorDefinition("bleu_fonce");}
13192     }
13193 
13194   return couleur;
13195 }
13196 void TEcnaHistos::SetHistoPresentation(TH1D* histo, const TString HistoType)
13197 {
13198   // Set presentation (axis title offsets, title size, label size, etc... 
13199 
13200   fCnaParHistos->SetViewHistoStyle(HistoType.Data());
13201   fCnaParHistos->SetViewHistoPadMargins(HistoType.Data(), " ");
13202   fCnaParHistos->SetViewHistoOffsets(histo, HistoType.Data(), " ");
13203   fCnaParHistos->SetViewHistoStats(histo, HistoType.Data());
13204 }
13205 void TEcnaHistos::SetHistoPresentation(TH1D* histo, const TString HistoType, const TString opt_plot)
13206 {
13207 // Set presentation (axis title offsets, title size, label size, etc... 
13208 
13209   fCnaParHistos->SetViewHistoStyle(HistoType.Data());
13210   fCnaParHistos->SetViewHistoPadMargins(HistoType.Data(), opt_plot.Data());
13211   fCnaParHistos->SetViewHistoOffsets(histo, HistoType.Data(), opt_plot.Data());
13212   fCnaParHistos->SetViewHistoStats(histo, HistoType.Data());
13213 }
13214 
13215 void TEcnaHistos::SetGraphPresentation(TGraph* graph, const TString HistoType, const TString opt_plot)
13216 {
13217 // Set presentation (axis title offsets, title size, label size, etc... 
13218 
13219   fCnaParHistos->SetViewHistoStyle(HistoType.Data());
13220   fCnaParHistos->SetViewHistoPadMargins(HistoType.Data(), opt_plot);
13221   fCnaParHistos->SetViewGraphOffsets(graph, HistoType.Data());
13222   
13223   //............................... Graph marker
13224   graph->SetMarkerStyle(1);
13225   if( HistoType == "Evol" ){graph->SetMarkerStyle(20);}
13226 }
13227 
13228 //=====================================================================
13229 //
13230 //                 NewCanvas, ReInitCanvas
13231 //
13232 //=====================================================================
13233 void TEcnaHistos::NewCanvas(const TString opt_plot)   
13234 {
13235 // ReInit canvas in option SAME n in order to restart a new SAME n plot
13236 // (called by user only for option Same n)
13237 
13238   if( opt_plot == fSameOnePlot )
13239     {
13240       fImpH1SamePlus = 0;       fCanvH1SamePlus = 0;
13241       fPadH1SamePlus = 0;       fMemoPlotH1SamePlus = 0;
13242       fMemoColorH1SamePlus = 0; fCanvSameH1SamePlus++;
13243       fPavTxtH1SamePlus = 0;
13244     }
13245   else
13246     {
13247       cout << "TEcnaHistos::NewCanvas(...)> *** ERROR *** " << opt_plot.Data() << ": "
13248            << "unknown option for NewCanvas. Only " << fSameOnePlot << " option is accepted."
13249            << fTTBELL << endl;
13250     }
13251 }
13252 
13253 void TEcnaHistos::ReInitCanvas(const TString HistoCode, const TString opt_plot)
13254 {
13255 // ReInit canvas in option SAME and SAME n
13256 
13257   if( opt_plot == fSameOnePlot )
13258     {
13259       fImpH1SamePlus = 0;       fCanvH1SamePlus = 0;
13260       fPadH1SamePlus = 0;       fMemoPlotH1SamePlus = 0;
13261       fMemoColorH1SamePlus = 0; fCanvSameH1SamePlus++;
13262       fPavTxtH1SamePlus = 0;
13263     }
13264 
13265   if( opt_plot == fOnlyOnePlot ||  opt_plot == fSeveralPlot)
13266     {
13267       if(HistoCode == "D_NOE_ChNb")
13268         {             
13269           fImpD_NOE_ChNb = 0;       fCanvD_NOE_ChNb = 0;
13270           fPadD_NOE_ChNb = 0;       fMemoPlotD_NOE_ChNb = 0;
13271           fMemoColorD_NOE_ChNb = 0; fCanvSameD_NOE_ChNb++;
13272           fPavTxtD_NOE_ChNb = 0; 
13273         }
13274       
13275       if(HistoCode == "D_NOE_ChDs")
13276         {             
13277           fImpD_NOE_ChDs = 0;       fCanvD_NOE_ChDs = 0;
13278           fPadD_NOE_ChDs = 0;       fMemoPlotD_NOE_ChDs = 0;
13279           fMemoColorD_NOE_ChDs = 0; fCanvSameD_NOE_ChDs++;
13280           fPavTxtD_NOE_ChDs = 0;
13281         }
13282       
13283       if(HistoCode == "D_Ped_ChNb")                            // (ReInitCanvas)
13284         {             
13285           fImpD_Ped_ChNb = 0;       fCanvD_Ped_ChNb = 0;
13286           fPadD_Ped_ChNb = 0;       fMemoPlotD_Ped_ChNb = 0;
13287           fMemoColorD_Ped_ChNb = 0; fCanvSameD_Ped_ChNb++;
13288           fPavTxtD_Ped_ChNb = 0;   
13289         }
13290       
13291       if(HistoCode == "D_Ped_ChDs")
13292         {             
13293           fImpD_Ped_ChDs = 0;       fCanvD_Ped_ChDs = 0;
13294           fPadD_Ped_ChDs = 0;       fMemoPlotD_Ped_ChDs = 0;
13295           fMemoColorD_Ped_ChDs = 0; fCanvSameD_Ped_ChDs++;
13296           fPavTxtD_Ped_ChDs = 0; 
13297         }
13298       
13299       if(HistoCode == "D_TNo_ChNb")
13300         {             
13301           fImpD_TNo_ChNb = 0;       fCanvD_TNo_ChNb = 0;
13302           fPadD_TNo_ChNb = 0;       fMemoPlotD_TNo_ChNb = 0;
13303           fMemoColorD_TNo_ChNb = 0; fCanvSameD_TNo_ChNb++;
13304           fPavTxtD_TNo_ChNb = 0; 
13305         }
13306       
13307       if(HistoCode == "D_TNo_ChDs") 
13308         {             
13309           fImpD_TNo_ChDs = 0;       fCanvD_TNo_ChDs = 0;
13310           fPadD_TNo_ChDs = 0;       fMemoPlotD_TNo_ChDs = 0;
13311           fMemoColorD_TNo_ChDs = 0; fCanvSameD_TNo_ChDs++;
13312           fPavTxtD_TNo_ChDs = 0;
13313         }
13314       
13315       if(HistoCode == "D_MCs_ChNb")                           // (ReInitCanvas)
13316         {             
13317           fImpD_MCs_ChNb = 0;       fCanvD_MCs_ChNb = 0;
13318           fPadD_MCs_ChNb = 0;       fMemoPlotD_MCs_ChNb = 0;
13319           fMemoColorD_MCs_ChNb = 0; fCanvSameD_MCs_ChNb++;
13320           fPavTxtD_MCs_ChNb = 0;
13321         }
13322       
13323       if(HistoCode == "D_MCs_ChDs")
13324         {             
13325           fImpD_MCs_ChDs = 0;       fCanvD_MCs_ChDs = 0;
13326           fPadD_MCs_ChDs = 0;       fMemoPlotD_MCs_ChDs = 0;
13327           fMemoColorD_MCs_ChDs = 0; fCanvSameD_MCs_ChDs++;
13328           fPavTxtD_MCs_ChDs = 0;
13329         }
13330       
13331       if(HistoCode == "D_LFN_ChNb")
13332         {             
13333           fImpD_LFN_ChNb = 0;       fCanvD_LFN_ChNb = 0;
13334           fPadD_LFN_ChNb = 0;       fMemoPlotD_LFN_ChNb = 0;
13335           fMemoColorD_LFN_ChNb = 0; fCanvSameD_LFN_ChNb++;
13336           fPavTxtD_LFN_ChNb = 0;
13337         }
13338       
13339       if(HistoCode == "D_LFN_ChDs")                            // (ReInitCanvas)
13340         {             
13341           fImpD_LFN_ChDs = 0;       fCanvD_LFN_ChDs = 0;
13342           fPadD_LFN_ChDs= 0;        fMemoPlotD_LFN_ChDs = 0;
13343           fMemoColorD_LFN_ChDs = 0; fCanvSameD_LFN_ChDs++;
13344           fPavTxtD_LFN_ChDs= 0;
13345         }
13346       
13347       if(HistoCode == "D_HFN_ChNb")
13348         {             
13349           fImpD_HFN_ChNb = 0;       fCanvD_HFN_ChNb = 0;
13350           fPadD_HFN_ChNb = 0;       fMemoPlotD_HFN_ChNb = 0;
13351           fMemoColorD_HFN_ChNb = 0; fCanvSameD_HFN_ChNb++;
13352           fPavTxtD_HFN_ChNb = 0;
13353         }
13354       
13355       if(HistoCode == "D_HFN_ChDs")
13356         {             
13357           fImpD_HFN_ChDs = 0;       fCanvD_HFN_ChDs = 0;
13358           fPadD_HFN_ChDs = 0;       fMemoPlotD_HFN_ChDs = 0;
13359           fMemoColorD_HFN_ChDs = 0; fCanvSameD_HFN_ChDs++;
13360           fPavTxtD_HFN_ChDs = 0;
13361         }
13362       
13363       if(HistoCode == "D_SCs_ChNb")
13364         {             
13365           fImpD_SCs_ChNb = 0;       fCanvD_SCs_ChNb = 0;
13366           fPadD_SCs_ChNb = 0;       fMemoPlotD_SCs_ChNb = 0;
13367           fMemoColorD_SCs_ChNb = 0; fCanvSameD_SCs_ChNb++;
13368           fPavTxtD_SCs_ChNb = 0;
13369         }
13370       
13371       if(HistoCode == "D_SCs_ChDs")                            // (ReInitCanvas)
13372         {             
13373           fImpD_SCs_ChDs = 0;       fCanvD_SCs_ChDs = 0;
13374           fPadD_SCs_ChDs = 0;       fMemoPlotD_SCs_ChDs = 0;
13375           fMemoColorD_SCs_ChDs = 0; fCanvSameD_SCs_ChDs++;
13376           fPavTxtD_SCs_ChDs = 0;
13377         }
13378       
13379       if(HistoCode == "D_MSp_Samp")
13380         {             
13381           fImpD_MSp_Samp = 0;       fCanvD_MSp_Samp = 0;
13382           fPadD_MSp_Samp = 0;       fMemoPlotD_MSp_Samp = 0; 
13383           fMemoColorD_MSp_Samp = 0; fCanvSameD_MSp_Samp++;
13384           fPavTxtD_MSp_Samp = 0;
13385         }
13386       
13387       if(HistoCode == "D_SSp_Samp")
13388         {             
13389           fImpD_SSp_Samp = 0;       fCanvD_SSp_Samp = 0;
13390           fPadD_SSp_Samp = 0;       fMemoPlotD_SSp_Samp= 0;
13391           fMemoColorD_SSp_Samp = 0; fCanvSameD_SSp_Samp++;
13392           fPavTxtD_SSp_Samp = 0;
13393         }
13394       
13395       if(HistoCode == "D_Adc_EvDs")
13396         {             
13397           fImpD_Adc_EvDs = 0;       fCanvD_Adc_EvDs = 0;
13398           fPadD_Adc_EvDs = 0;       fMemoPlotD_Adc_EvDs = 0;
13399           fMemoColorD_Adc_EvDs = 0; fCanvSameD_Adc_EvDs++;
13400           fPavTxtD_Adc_EvDs = 0;
13401         }
13402       
13403       if(HistoCode == "D_Adc_EvNb")                            // (ReInitCanvas)
13404         {             
13405           fImpD_Adc_EvNb = 0;       fCanvD_Adc_EvNb = 0;
13406           fPadD_Adc_EvNb = 0;       fMemoPlotD_Adc_EvNb = 0;
13407           fMemoColorD_Adc_EvNb = 0; fCanvSameD_Adc_EvNb++;
13408           fPavTxtD_Adc_EvNb = 0;
13409         }
13410       
13411       if(HistoCode == "H_Ped_Date")
13412         {             
13413           fImpH_Ped_Date = 0;       fCanvH_Ped_Date = 0;
13414           fPadH_Ped_Date = 0;       fMemoPlotH_Ped_Date = 0;
13415           fMemoColorH_Ped_Date = 0; fCanvSameH_Ped_Date++;
13416           fNbOfListFileH_Ped_Date = 0;
13417         }
13418 
13419       if(HistoCode == "H_TNo_Date")
13420         {             
13421           fImpH_TNo_Date = 0;       fCanvH_TNo_Date = 0;
13422           fPadH_TNo_Date = 0;       fMemoPlotH_TNo_Date = 0;
13423           fMemoColorH_TNo_Date = 0; fCanvSameH_TNo_Date++;
13424           fNbOfListFileH_TNo_Date = 0;
13425         }
13426 
13427       if(HistoCode == "H_MCs_Date")                            // (ReInitCanvas)
13428         {             
13429           fImpH_MCs_Date = 0;       fCanvH_MCs_Date = 0;
13430           fPadH_MCs_Date = 0;       fMemoPlotH_MCs_Date = 0;
13431           fMemoColorH_MCs_Date = 0; fCanvSameH_MCs_Date++;
13432           fNbOfListFileH_MCs_Date = 0;
13433         }
13434 
13435       
13436       if(HistoCode == "H_LFN_Date")
13437         {             
13438           fImpH_LFN_Date = 0;       fCanvH_LFN_Date = 0;
13439           fPadH_LFN_Date = 0;       fMemoPlotH_LFN_Date = 0;
13440           fMemoColorH_LFN_Date = 0; fCanvSameH_LFN_Date++;
13441           fNbOfListFileH_LFN_Date = 0;
13442         }
13443 
13444       if(HistoCode == "H_HFN_Date")
13445         {             
13446           fImpH_HFN_Date = 0;       fCanvH_HFN_Date = 0;
13447           fPadH_HFN_Date = 0;       fMemoPlotH_HFN_Date = 0;
13448           fMemoColorH_HFN_Date = 0; fCanvSameH_HFN_Date++;
13449           fNbOfListFileH_HFN_Date = 0;
13450         }
13451 
13452       if(HistoCode == "H_SCs_Date")
13453         {             
13454           fImpH_SCs_Date = 0;       fCanvH_SCs_Date = 0;
13455           fPadH_SCs_Date = 0;       fMemoPlotH_SCs_Date = 0;
13456           fMemoColorH_SCs_Date = 0; fCanvSameH_SCs_Date++;
13457           fNbOfListFileH_SCs_Date = 0;
13458         }
13459 
13460       if(HistoCode == "H_Ped_RuDs")
13461         {             
13462           fImpH_Ped_RuDs = 0;       fCanvH_Ped_RuDs = 0;
13463           fPadH_Ped_RuDs = 0;       fMemoPlotH_Ped_RuDs = 0;
13464           fMemoColorH_Ped_RuDs = 0; fCanvSameH_Ped_RuDs++;
13465           fNbOfListFileH_Ped_RuDs = 0;
13466         }
13467 
13468       if(HistoCode == "H_TNo_RuDs")
13469         {             
13470           fImpH_TNo_RuDs = 0;       fCanvH_TNo_RuDs = 0;
13471           fPadH_TNo_RuDs = 0;       fMemoPlotH_TNo_RuDs = 0;
13472           fMemoColorH_TNo_RuDs = 0; fCanvSameH_TNo_RuDs++;
13473           fNbOfListFileH_TNo_RuDs = 0;
13474         }
13475 
13476       if(HistoCode == "H_MCs_RuDs")                            // (ReInitCanvas)
13477         {             
13478           fImpH_MCs_RuDs = 0;       fCanvH_MCs_RuDs = 0;
13479           fPadH_MCs_RuDs = 0;       fMemoPlotH_MCs_RuDs = 0;
13480           fMemoColorH_MCs_RuDs = 0; fCanvSameH_MCs_RuDs++;
13481           fNbOfListFileH_MCs_RuDs = 0;
13482         }
13483 
13484       
13485       if(HistoCode == "H_LFN_RuDs")
13486         {             
13487           fImpH_LFN_RuDs = 0;       fCanvH_LFN_RuDs = 0;
13488           fPadH_LFN_RuDs = 0;       fMemoPlotH_LFN_RuDs = 0;
13489           fMemoColorH_LFN_RuDs = 0; fCanvSameH_LFN_RuDs++;
13490           fNbOfListFileH_LFN_RuDs = 0;
13491         }
13492 
13493       if(HistoCode == "H_HFN_RuDs")
13494         {             
13495           fImpH_HFN_RuDs = 0;       fCanvH_HFN_RuDs = 0;
13496           fPadH_HFN_RuDs = 0;       fMemoPlotH_HFN_RuDs = 0;
13497           fMemoColorH_HFN_RuDs = 0; fCanvSameH_HFN_RuDs++;
13498           fNbOfListFileH_HFN_RuDs = 0;
13499         }
13500 
13501       if(HistoCode == "H_SCs_RuDs")
13502         {             
13503           fImpH_SCs_RuDs = 0;       fCanvH_SCs_RuDs = 0;
13504           fPadH_SCs_RuDs = 0;       fMemoPlotH_SCs_RuDs = 0;
13505           fMemoColorH_SCs_RuDs = 0; fCanvSameH_SCs_RuDs++;
13506           fNbOfListFileH_SCs_RuDs = 0;
13507         }
13508     }
13509 } 
13510 // ------- end of ReInitCanvas(...) ------------
13511 
13512 //==========================================================================================
13513 void TEcnaHistos::WriteMatrixAscii(const TString MatrixElement, const TString MatrixProbaNature,
13514                                   const Int_t&  StexStinEcna,  const Int_t&  MatrixBinIndex,
13515                                   const Int_t&  MatSize,       const TMatrixD& read_matrix)
13516 {   
13517 // write matrix in ascii file
13518 
13519   Int_t ChanNumber = MatrixBinIndex;
13520 
13521   fCnaWrite->RegisterFileParameters(fFapAnaType,    fFapNbOfSamples, 
13522                                     fFapRunNumber,  fFapFirstReqEvtNumber, fFapLastReqEvtNumber, fFapReqNbOfEvts,
13523                                     fFapStexNumber, fStartDate, fStopDate, fStartTime, fStopTime);
13524 
13525   if( MatrixElement == fBetweenSamples && MatrixProbaNature == fCorrelationMatrix )
13526     {
13527       fCnaWrite->WriteAsciiCorrelationsBetweenSamples(StexStinEcna, ChanNumber, MatSize, read_matrix);
13528       fAsciiFileName = fCnaWrite->GetAsciiFileName();
13529     }
13530 
13531   if( MatrixElement == fBetweenSamples && MatrixProbaNature == fCovarianceMatrix )
13532     {
13533       fCnaWrite->WriteAsciiCovariancesBetweenSamples(StexStinEcna, ChanNumber, MatSize, read_matrix);
13534       fAsciiFileName = fCnaWrite->GetAsciiFileName();
13535     }
13536 }
13537 //...............................................................................................
13538 void TEcnaHistos::WriteHistoAscii(const TString   HistoCode, const Int_t& HisSize,
13539                                  const TVectorD& read_histo)
13540 {
13541 // write matrix in ascii file
13542 
13543   fCnaWrite->RegisterFileParameters(fFapAnaType,    fFapNbOfSamples, 
13544                                     fFapRunNumber,  fFapFirstReqEvtNumber, fFapLastReqEvtNumber, fFapReqNbOfEvts,
13545                                     fFapStexNumber, fStartDate, fStopDate,
13546                                     fStartTime,     fStopTime);
13547 
13548   fCnaWrite->WriteAsciiHisto(HistoCode, HisSize, read_histo);
13549   fAsciiFileName = fCnaWrite->GetAsciiFileName();
13550 }
13551 
13552 TString TEcnaHistos::AsciiFileName(){return fAsciiFileName.Data();}
13553 
13554 //---------------------------------------------------------------------------------------------
13555 // HistoCode list modification (06/10/09)
13556 
13557 //    D = Detector Plot    ChNb = Channel Number
13558 //    H = History  Plot    ChDs = Channel Distribution (Y projection)
13559 //
13560 //      old code             new code
13561 //
13562 // *  1 H1NbOfEvtsGlobal     D_NOE_ChNb    NOE = Number Of Events
13563 // *  2 H1NbOfEvtsProj       D_NOE_ChDs    
13564 // *  3 H1EvEvGlobal         D_Ped_ChNb    Ped = Pedestal
13565 // *  4 H1EvEvProj           D_Ped_ChDs
13566 // *  5 H1EvSigGlobal        D_TNo_ChNb    TNo = Total Noise
13567 // *  6 H1EvSigProj          D_TNo_ChDs
13568 // *  7 H1SigEvGlobal        D_LFN_ChNb    LFN = Low Frequency noise
13569 // *  8 H1SigEvProj          D_LFN_ChDs
13570 // *  9 H1SigSigGlobal       D_HFN_ChNb    HFN = High Frequency noise
13571 // * 10 H1SigSigProj         D_HFN_ChDs
13572 // * 11 H1EvCorssGlobal      D_MCs_ChNb    MCs = Mean of the correlations between samples
13573 // * 12 H1EvCorssProj        D_MCs_ChDs
13574 // * 13 H1SigCorssGlobal     D_SCs_ChNb    Scs = Sigma of the correlations between samples
13575 // * 14 H1SigCorssProj       D_SCs_ChDs
13576 // * 15 Ev                   D_MSp_Samp    MSp = Mean of the samples
13577 // * 16 Sigma                D_SSp_Samp    SSp = Sigma of the samples
13578 // * 17 SampTime             D_Adc_EvNb    Adc = ADC count as a function of Event number
13579 // * 18 AdcProj              D_Adc_EvDs    EvDs = Event distribution
13580 // * 19 EvolEvEv             H_Ped_Date    Date = date in format YYMMJJ hhmmss
13581 // * 20 EvolEvEvProj         H_Ped_RuDs    RuDs = Run distribution
13582 // * 21 EvolEvSig            H_TNo_Date
13583 // * 22 EvolEvSigProj        H_TNo_RuDs   
13584 // * 23 EvolSigEv            H_LFN_Date 
13585 // * 24 EvolSigEvProj        H_LFN_RuDs 
13586 // * 25 EvolSigSig           H_HFN_Date 
13587 // * 26 EvolSigSigProj       H_HFN_RuDs 
13588 // * 27 EvolEvCorss          H_MCs_Date   
13589 // * 28 EvolEvCorssProj      H_MCs_RuDs   
13590 // * 29 EvolSigCorss         H_SCs_Date   
13591 // * 30 EvolSigCorssProj     H_SCs_RuDs   
13592 
13593 //---------------> messages de rappel pour l'auteur: 
13594 //
13595 //======= 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 ==============!!!!
13596 //      A EVITER ABSOLUMENT quand on est sous TEcnaGui CAR LE cin >> BLOQUE X11
13597 //      puisqu'on n'a pas la main dans la fenetre de compte-rendu de la CNA
13598 //     {Int_t cintoto; cout << "taper 0 pour continuer" << endl; cin >> cintoto;}
13599 //                         *=================================================*
13600 //                         |                                                 |
13601 //++++++++++++++++++++++++|  A T T E N T I O N:  PAS DE TEST "cintoto" ici! |+++++++++++++++++++++!!!!
13602 //                         |                                                 |
13603 //                         *=================================================*
13604 // INFO: When "new" fails to allocate the memory for an object, or "new[]" fails to allocate the memory
13605 // for an object array, a std::bad_alloc object is thrown.
13606 // "In GCC, the RTTI mangled name of std::bad_alloc is, I'm guessing, St9bad_alloc."