Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef CL_TEcnaRead_H
0002 #define CL_TEcnaRead_H
0003 
0004 #include <ctime>
0005 #include <cmath>
0006 
0007 #include "TSystem.h"
0008 #include "TObject.h"
0009 #include "TString.h"
0010 #include "Riostream.h"
0011 #include "TVectorD.h"
0012 #include "TMatrixD.h"
0013 
0014 #include "CalibCalorimetry/EcalCorrelatedNoiseAnalysisAlgos/interface/TEcnaObject.h"
0015 #include "CalibCalorimetry/EcalCorrelatedNoiseAnalysisAlgos/interface/TEcnaParEcal.h"
0016 #include "CalibCalorimetry/EcalCorrelatedNoiseAnalysisAlgos/interface/TEcnaHeader.h"
0017 #include "CalibCalorimetry/EcalCorrelatedNoiseAnalysisAlgos/interface/TEcnaParCout.h"
0018 #include "CalibCalorimetry/EcalCorrelatedNoiseAnalysisAlgos/interface/TEcnaParPaths.h"
0019 #include "CalibCalorimetry/EcalCorrelatedNoiseAnalysisAlgos/interface/TEcnaNumbering.h"
0020 #include "CalibCalorimetry/EcalCorrelatedNoiseAnalysisAlgos/interface/TEcnaParHistos.h"
0021 #include "CalibCalorimetry/EcalCorrelatedNoiseAnalysisAlgos/interface/TEcnaWrite.h"
0022 #include "CalibCalorimetry/EcalCorrelatedNoiseAnalysisAlgos/interface/TEcnaResultType.h"
0023 #include "CalibCalorimetry/EcalCorrelatedNoiseAnalysisAlgos/interface/TEcnaRootFile.h"
0024 
0025 ///-----------------------------------------------------------
0026 ///   TEcnaRead.h
0027 ///   Update: 05/05/2012
0028 ///   Authors:   B.Fabbro (bernard.fabbro@cea.fr), FX Gentit
0029 ///              DSM/IRFU/SPP CEA-Saclay
0030 ///   Copyright: Those valid for CEA sofware
0031 ///
0032 ///   ECNA web page:
0033 ///     http://cms-fabbro.web.cern.ch/cms-fabbro/
0034 ///     cna_new/Correlated_Noise_Analysis/ECNA_main_page.htm
0035 ///-----------------------------------------------------------
0036 ///
0037 ///==============> INTRODUCTION
0038 ///
0039 ///    This class allows the user to read the .root results files (containing
0040 ///   expectation values, variances, covariances, correlations and other
0041 ///   quantities of interest) previously computed by the class TEcnaRun.
0042 ///   The results are available in arrays.
0043 ///
0044 ///==============> PRELIMINARY REMARK
0045 ///
0046 ///   Another class named TEcnaHistos can be used directly to make plots of results
0047 ///   previously computed by means of the class TEcnaRun. The class TEcnaHistos
0048 ///   calls TEcnaRead and manage the reading of the .root result file
0049 ///
0050 ///
0051 ///            ***   I N S T R U C T I O N S   F O R   U S E   ***
0052 ///
0053 ///   //==============> TEcnaRead DECLARATION
0054 ///
0055 ///   // The declaration is done by calling the constructor without argument:
0056 ///
0057 ///       TEcnaRead* MyCnaRead = new TEcnaRead();
0058 ///
0059 ///   //==============> PREPARATION METHOD FileParameters(...)
0060 ///
0061 ///   // There is a preparation method named: FileParameters(...);
0062 ///
0063 ///   //    FileParameters(...) is used to read the quantities written
0064 ///   //    in the ROOT files in order to use these quantities for analysis.
0065 ///
0066 ///   //.......  Example of program using FileParameters(...)
0067 ///
0068 ///   //  This example describes the reading of one result file. This file is situated in a
0069 ///   //  directory which name is given by the contents of a TString named PathForRootFile
0070 ///
0071 ///   //................ Set values for the arguments and call to the method
0072 ///
0073 ///      TString AnalysisName      = "AdcPed12"
0074 ///      Int_t   RunNumber         = 132440;
0075 ///      Int_t   FirstReqEvtNumber = 1;   |    (numbering starting from 1)
0076 ///      Int_t   LastReqEvtNumber  = 300; | => treats 150 evts between evt#100 and evt#300 (included)
0077 ///      Int_t   ReqNbOfEvts       = 150; |
0078 ///      TString PathForRootFile   = "/afs/cern.ch/etc..." // .root result files directory
0079 ///
0080 ///      TEcnaRead*  MyCnaRead = new TEcnaRead();
0081 ///      MyCnaRead->FileParameters(AnalysisName,      RunNumber,
0082 ///                                FirstReqEvtNumber, LastReqEvtNumber, ReqNbOfEvts, StexNumber,
0083 ///                                PathForRootFile);
0084 ///
0085 ///                                *==> Stex = SM if EB, Dee if EE
0086 ///
0087 ///    //==============>  CALL TO THE METHOD: Bool_t LookAtRootFile() (MANDATORY)
0088 ///    //                 and method: Bool_t   DataExist();  // if data exist:  kTRUE , if not: kFALSE
0089 ///
0090 ///    // This methods returns a boolean. It tests the existence
0091 ///    // of the ROOT file corresponding to the argument values given
0092 ///    // in the call to the method FileParameters(...).
0093 ///    // It is recommended to test the return value of the method.
0094 ///
0095 ///    //....... Example of use:
0096 ///
0097 ///     if( MyCnaRead->LookAtRootFile() == kFALSE )
0098 ///        {
0099 ///          std::cout << "*** ERROR: ROOT file not found" << std::endl;
0100 ///        }
0101 ///      else
0102 ///        {
0103 ///         //........... The ROOT file exists and has been found
0104 ///         //
0105 ///         //---> CALLS TO THE METHODS WHICH RECOVER THE QUANTITIES. EXAMPLE:
0106 ///         //     (see the complete list of the methods hereafter)
0107 ///
0108 ///           Int_t   MaxSamples  = 10;
0109 ///           TMatrixD CorMat(MaxSamples,MaxSamples);
0110 ///           Int_t Tower = 59;
0111 ///           Int_t Channel =  4;
0112 ///           CorMat = MyCnaRead->ReadMatrix(MaxSamples, "Cor", "Samples", Tower, Channel);
0113 ///
0114 ///           //   arguments: "Cor" = correlation matrix,   "Samples" = between samples
0115 ///           //   large amount of possibilities for syntax: "Cor", "cor", "correlation", etc...
0116 ///           //                                             "Samples", "samples", "samp", etc...
0117 ///
0118 ///           if( MyCnaRead->DataExist() == kFALSE )
0119 ///             {          :
0120 ///                Analysis of the correlations, etc...
0121 ///                        :
0122 ///             }
0123 ///           else
0124 ///             {
0125 ///               std::cout << "problem while reading file. data not available. " << std::endl;
0126 ////            }
0127 ///
0128 ///        }
0129 ///
0130 ///******************************************************************************
0131 ///
0132 ///                      *=======================*
0133 ///                      | DETAILLED DESCRIPTION |
0134 ///                      *=======================*
0135 ///
0136 ///&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
0137 ///
0138 ///       Method FileParameters(...) and associated methods
0139 ///
0140 ///&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
0141 ///
0142 ///   TEcnaRead* MyCnaRead = new TEcnaRead();  // declaration of the object MyCnaRead
0143 ///
0144 ///   MyCnaRead->FileParameters(AnalysisName, RunNumber,    NbOfSamples
0145 ///                             FirstReqEvtNumber, LastReqEvtNumber,  ReqNbOfEvts, StexNumber,
0146 ///                             PathForRootFile);
0147 ///
0148 ///   Arguments:
0149 ///
0150 ///      TString  AnalysisName: code for the analysis. According to this code,
0151 ///                             the analyzer EcnaAnalyser selects the event type
0152 ///                             (PEDESTAL_STD, PEDESTAL_GAP, LASER_STD, etc...)
0153 ///                             and some other event characteristics
0154 ///                             (example: the gain in pedestal runs:
0155 ///                              AnalysisName = "Ped1" or "Ped6" or "Ped12")
0156 ///                             See EcnaAnalyser.h for a list of available codes.
0157 ///                             The string AnalysisName is automatically
0158 ///                             included in the name of the results files
0159 ///                             (see below: results files paragraph).
0160 ///
0161 ///      Int_t    NbOfSamples         number of samples (=10 maximum)
0162 ///      Int_t    RunNumber           run number
0163 ///      Int_t    FirstReqEvtNumber   first requested event number (numbering starting from 1)
0164 ///      Int_t    LastReqEvtNumber    last  requested event number
0165 ///      Int_t    ReqNbOfEvts         requested number of events
0166 ///      Int_t    StexNumber          Stex number (Stex = SM if EB, Dee if EE)
0167 ///
0168 ///
0169 ///      TString  PathForRootFile: Path of the directory containing the ROOT file.
0170 ///               The path must be complete: /afs/cern.ch/user/... etc...
0171 ///
0172 ///==============> METHODS TO RECOVER THE QUANTITIES FROM THE ROOT FILE
0173 ///
0174 ///                SM = SuperModule  (EB) equivalent to a Dee   (EE)
0175 ///                SC = SuperCrystal (EE) equivalent to a Tower (EB)
0176 ///
0177 ///                Stex = SM    in case of EB  ,  Dee in case of EE
0178 ///                Stin = Tower in case of EB  ,  SC  in case of EE
0179 ///
0180 ///  n1StexStin = Stin#  in Stex
0181 ///             = Tower# in SM  (RANGE = [1,68])   if EB
0182 ///             = SC#    in Dee (RANGE = [1,149])  if EE
0183 ///
0184 ///  i0StexEcha = Channel# in Stex
0185 ///             = Channel# in SM  (RANGE = [0,1699])  if EB
0186 ///             = Channel# in Dee (RANGE = [0,3724])  if EE
0187 ///
0188 ///  i0StinEcha = Channel# in Stin
0189 ///             = Channel# in tower (RANGE = [0,24])  if EB
0190 ///             = Channel# in SC    (RANGE = [0,24])  if EE
0191 ///
0192 ///  MaxCrysInStin     = Maximum number of Xtals in a tower or a SC (25)
0193 ///  MaxCrysEcnaInStex = Maximum number of Xtals in SM (1700) or in the matrix including Dee (5000)
0194 ///  MaxStinEcnaInStex = Maximum number of towers in SM (68)  or in the matrix including Dee (200)
0195 ///  MaxSampADC        = Maximum number of samples (10)
0196 ///  NbOfSample        = Number of samples used to perform the calculations
0197 ///                      (example: for the 3 first samples, NbOfSample = 3)
0198 ///
0199 ///=============================== Standard methods for the user ===============================
0200 ///
0201 ///  Intervals:     Tower or SC: [1,...]        Channel:[0,24]          Sample:[1,10]
0202 ///
0203 ///...........................................................................
0204 ///  TVectorD Read1DHisto(const Int_t& VecDim,  const TString& Quantity, const Int_t& Tower or SC,
0205 ///                       const Int_t& Channel, const Int_t& Sample);
0206 ///
0207 ///  Example:
0208 ///  Int_t Tower = 59; Int_t Channel = 10; Int_t Sample = 4;
0209 ///  NbOfEvts = 150;
0210 ///  TVectorD Adc(NbOfEvts);
0211 ///  Adc = Read1DHisto(NbOfEvts, "AdcValue", Tower, Channel, Sample;
0212 ///
0213 ///...........................................................................
0214 ///  TVectorD Read1DHisto(const Int_t& VecDim, const TString& Quantity, const Int_t& Tower or SC);
0215 ///
0216 ///  Example:
0217 ///  Int_t Tower = 59;
0218 ///  TVectorD SampMean(fEcal->MaxCrysInTow()*fEcal->MaxSampADC());
0219 ///  SampMean = Read1DHisto(fEcal->MaxCrysInTow()*fEcal->MaxSampADC(), "SampleMean", Tower);
0220 ///
0221 ///...........................................................................
0222 ///  TVectorD Read1DHisto(const Int_t& VecDim, const TString& Quantity, const TString& Detector);
0223 ///
0224 ///  Example:
0225 ///  TVectorD Pedestal(fEcal->MaxCrysInTow());
0226 ///  Pedestal = Read1DHisto(fEcal->MaxCrysInTow(), "Ped","SM");
0227 ///
0228 ///...........................................................................
0229 ///  TMatrixD ReadMatrix(const Int_t&, const TString&, const TString&, const Int_t&, const Int_t&);
0230 ///  TMatrixD ReadMatrix(const Int_t&, const TString&, const TString&);
0231 ///
0232 ///=============================== more "technical" methods ===============================
0233 ///
0234 ///  TVectorD and TMatrixD sizes are indicated after the argument lists
0235 ///
0236 ///
0237 ///  TMatrixD ReadNumberOfEventsForSamples(const Int_t& n1StexStin, const Int_t& MaxCrysInStin,
0238 ///                                        const Int_t& NbOfSamples);
0239 /// // TMatrixD(MaxCrysInStin,NbOfSamples)
0240 ///
0241 ///  TVectorD ReadSampleAdcValues(const Int_t& i0StexEcha, const Int_t& sample,
0242 ///                               const Int_t& ReqNbOfEvts);
0243 /// // TVectorD(ReqNbOfEvts)
0244 ///
0245 ///  TVectorD ReadSampleMeans(const Int_t& n1StexStin, const Int_t& i0StinEcha,
0246 ///                           const Int_t& NbOfSamples);
0247 /// // TVectorD(NbOfSamples)
0248 ///
0249 ///  TVectorD ReadSampleMeans(const Int_t& n1StexStin, const Int_t& MaxCrysInStin*NbOfSamples);
0250 /// // TVectorD(MaxCrysInStin*NbOfSamples)
0251 ///
0252 ///  TVectorD ReadSampleSigmas(const Int_t& n1StexStin, const Int_t& i0StinEcha,
0253 ///                            const Int_t& NbOfSamples);
0254 /// // TVectorD(NbOfSamples)
0255 ///
0256 ///  TVectorD ReadSampleSigmas(const Int_t& n1StexStin, const Int_t& MaxCrysInStin*NbOfSamples);
0257 /// // TVectorD(MaxCrysInStin*NbOfSamples)
0258 ///
0259 ///  TMatrixD ReadCovariancesBetweenSamples(const Int_t& n1StexStin, const Int_t& i0StinEcha);
0260 /// // TMatrixD(NbOfSamples,NbOfSamples)
0261 ///
0262 ///  TMatrixD ReadCorrelationsBetweenSamples(const Int_t& n1StexStin, const Int_t& i0StinEcha);
0263 /// // TMatrixD(NbOfSamples,NbOfSamples)
0264 ///
0265 /// -----------------------------------------------------------  TMatrixD
0266 ///
0267 ///  TMatrixD size is (MaxCrysInStin, MaxCrysInStin)
0268 ///
0269 ///  TMatrixD ReadLowFrequencyCovariancesBetweenChannels(const Int_t& n1StexStin_X,
0270 ///                                                      const Int_t& n1StexStin_Y,
0271 ///                                                      const Int_t& MaxCrysInStin);
0272 ///
0273 ///  TMatrixD ReadLowFrequencyCorrelationsBetweenChannels(const Int_t& n1StexStin_X,
0274 ///                                                       const Int_t& n1StexStin_Y,
0275 ///                                                       const Int_t& MaxCrysInStin);
0276 ///
0277 ///  TMatrixD ReadHighFrequencyCovariancesBetweenChannels(const Int_t& n1StexStin_X,
0278 ///                                                       const Int_t& n1StexStin_Y,
0279 ///                                                       const Int_t& MaxCrysInStin);
0280 ///
0281 ///  TMatrixD ReadHighFrequencyCorrelationsBetweenChannels(const Int_t& n1StexStin_X,
0282 ///                                                        const Int_t& n1StexStin_Y,
0283 ///                                                        const Int_t& MaxCrysInStin);
0284 ///
0285 /// ----------------------------------------------------------- TMatrixD
0286 ///
0287 ///  TMatrixD size is (MaxCrysEcnaInStex, MaxCrysEcnaInStex) (BIG!: 1700x1700 for EB and 5000x5000 for EE)
0288 ///
0289 ///  TMatrixD ReadLowFrequencyCovariancesBetweenChannels(const Int_t& MaxCrysEcnaInStex);
0290 ///  TMatrixD ReadLowFrequencyCorrelationsBetweenChannels(const Int_t& MaxCrysEcnaInStex);
0291 ///
0292 ///  TMatrixD ReadHighFrequencyCovariancesBetweenChannels(const Int_t& MaxCrysEcnaInStex);
0293 ///  TMatrixD ReadHighFrequencyCorrelationsBetweenChannels(const Int_t& MaxCrysEcnaInStex);
0294 ///
0295 /// ----------------------------------------------------------- TMatrixD
0296 ///
0297 ///  TMatrixD size is (MaxStinEcnaInStex, MaxStinEcnaInStex)
0298 ///
0299 ///  TMatrixD ReadLowFrequencyMeanCorrelationsBetweenStins(const Int_t& MaxStinEcnaInStex);
0300 ///  TMatrixD ReadHighFrequencyMeanCorrelationsBetweenStins(const Int_t& MaxStinEcnaInStex);
0301 ///
0302 /// ----------------------------------------------------------- TVectorD
0303 ///
0304 ///  TVectorD sizes are indicated after the argument lists
0305 ///
0306 ///  TVectorD ReadPedestals(const Int_t& MaxCrysEcnaInStex);                         // TVectorD(MaxCrysEcnaInStex)
0307 ///  TVectorD ReadTotalNoise(const Int_t& MaxCrysEcnaInStex);                        // TVectorD(MaxCrysEcnaInStex)
0308 ///  TVectorD ReadMeanCorrelationsBetweenSamples(const Int_t& MaxCrysEcnaInStex);    // TVectorD(MaxCrysEcnaInStex)
0309 ///
0310 ///  TVectorD ReadLowFrequencyNoise(const Int_t& MaxCrysEcnaInStex);                 // TVectorD(MaxCrysEcnaInStex)
0311 ///  TVectorD ReadHighFrequencyNoise(const Int_t& MaxCrysEcnaInStex);                // TVectorD(MaxCrysEcnaInStex)
0312 ///  TVectorD ReadSigmaOfCorrelationsBetweenSamples(const Int_t& MaxCrysEcnaInStex); // TVectorD(MaxCrysEcnaInStex)
0313 ///
0314 ///----------------------------------------------------------------------------------------------------------------
0315 ///  TString GetStartDate()
0316 ///  TString GetStopDate()
0317 ///  TString GetRunType()
0318 ///  Int_t   GetFirstReqEvtNumber();
0319 ///  Int_t   GetReqNbOfEvts();
0320 ///
0321 ///&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
0322 ///
0323 ///                         Print Methods
0324 ///
0325 ///&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
0326 ///
0327 ///     Just after the declaration with the constructor,
0328 ///     you can set a "Print Flag" by means of the following "Print Methods":
0329 ///
0330 ///     TEcnaRead* MyCnaRead = new TEcnaRead(....); // declaration of the object MyCnaRead
0331 ///
0332 ///    // Print Methods:
0333 ///
0334 ///    MyCnaRead->PrintNoComment();  // Set flag to forbid printing of all the comments
0335 ///                                  // except ERRORS.
0336 ///
0337 ///    MyCnaRead->PrintWarnings();   // (DEFAULT)
0338 ///                                  // Set flag to authorize printing of some warnings.
0339 ///                                  // WARNING/INFO: information on something unusual
0340 ///                                  // in the data.
0341 ///                                  // WARNING/CORRECTION: something wrong (but not too serious)
0342 ///                                  // in the value of some argument.
0343 ///                                  // Automatically modified to a correct value.
0344 ///
0345 ///    MyCnaRead->PrintComments();    // Set flag to authorize printing of infos
0346 ///                                   // and some comments concerning initialisations
0347 ///
0348 ///    MyCnaRead->PrintAllComments(); // Set flag to authorize printing of all the comments
0349 ///
0350 ///------------------------------------------------------------------------------------------------
0351 
0352 class TEcnaRead : public TObject {
0353 private:
0354   //............ attributes
0355 
0356   // static  const  Int_t        fgMaxCar    = 512;          <== DANGEROUS !
0357 
0358   Int_t fgMaxCar;  // Max nb of caracters for char*
0359 
0360   Int_t fCnew;  // flags for dynamical allocation
0361   Int_t fCdelete;
0362 
0363   TString fTTBELL;
0364 
0365   TEcnaObject *fObjectManager;  // pointer to TEcnaObject keeped in attribute
0366 
0367   TEcnaParCout *fCnaParCout;    // for comments or error messages
0368   TEcnaParPaths *fCnaParPaths;  // for NbBinsADC
0369 
0370   TEcnaHeader *fFileHeader;        // header for result file
0371   TEcnaParEcal *fEcal;             // for Ecal parameters
0372   TEcnaNumbering *fEcalNumbering;  // for Ecal numbering
0373   TEcnaParHistos *fCnaParHistos;   // for Histo codes
0374   TEcnaWrite *fCnaWrite;           // for writing in ascii files
0375 
0376   //  TEcnaRootFile *gCnaRootFile;
0377 
0378   TString fFlagSubDet;
0379   TString fStexName, fStinName;
0380 
0381   Bool_t fOpenRootFile;            // flag open ROOT file (open = kTRUE, close = kFALSE)
0382   TString fCurrentlyOpenFileName;  // Name of the file currently open
0383   TString fFlagNoFileOpen;         // Flag to indicate that no file is open
0384 
0385   Int_t fReadyToReadRootFile;
0386   Int_t fLookAtRootFile;
0387 
0388   Int_t *fT1d_StexStinFromIndex;  // 1D array[Stin] Stin Number as a function of the index Stin
0389   Int_t *fTagStinNumbers;
0390   Int_t fMemoStinNumbers;
0391 
0392   //  Int_t fMemoReadNumberOfEventsforSamples;
0393 
0394   TString fPathRoot;  // path for results .root files directory
0395 
0396   Int_t fNbChanByLine;  // Nb channels by line (for ASCII results file)
0397   Int_t fNbSampByLine;  // Nb samples by line  (for ASCII results file)
0398 
0399   Int_t fFlagPrint;
0400   Int_t fCodePrintComments, fCodePrintWarnings, fCodePrintAllComments, fCodePrintNoComment;
0401 
0402   //............... flag data exists
0403 
0404   Bool_t fDataExist;
0405 
0406   //................ 3d array for sample ADC value fast transfert
0407   Double_t ***fT3d_AdcValues;  // 3D array[channel][sample][event] ADC values distibutions
0408   Double_t **fT3d2_AdcValues;
0409   Double_t *fT3d1_AdcValues;
0410 
0411   //==========================================================================================
0412   //
0413   //                                      M E T H O D S
0414   //
0415   //==========================================================================================
0416   //.......................................... private methods
0417 
0418   void fCopy(const TEcnaRead &);
0419 
0420 public:
0421   //................. constructors
0422   TEcnaRead();  //  constructor without argument (FOR USER'S DECLARATION)
0423   //  constructor with argument (FOR USER'S DECLARATION):
0424   TEcnaRead(TEcnaObject *, const TString &);
0425 
0426   TEcnaRead(const TEcnaRead &);  //  copy constructor
0427 
0428   //.................... C++ methods
0429   TEcnaRead &operator=(const TEcnaRead &);  //  overloading of the operator=
0430 
0431   //................. destructor
0432   ~TEcnaRead() override;
0433 
0434   //========================================================================
0435   //
0436   //                    METHODS FOR THE USER
0437   //
0438   //========================================================================
0439   void FileParameters(const TString &,
0440                       const Int_t &,
0441                       const Int_t &,
0442                       const Int_t &,
0443                       const Int_t &,
0444                       const Int_t &,
0445                       const Int_t &,
0446                       const TString &);
0447 
0448   Bool_t LookAtRootFile();  // if file exists: kTRUE , if not: kFALSE
0449   Bool_t DataExist();       // if data exist:  kTRUE , if not: kFALSE
0450 
0451   TVectorD Read1DHisto(const Int_t &, const TString &, const Int_t &, const Int_t &, const Int_t &);
0452   TVectorD Read1DHisto(const Int_t &, const TString &, const Int_t &);
0453   TVectorD Read1DHisto(const Int_t &, const TString &, const TString &);
0454 
0455   TMatrixD ReadMatrix(const Int_t &, const TString &, const TString &, const Int_t &, const Int_t &);
0456   TMatrixD ReadMatrix(const Int_t &, const TString &, const TString &);
0457 
0458   //========================================================================
0459   //
0460   //                       "TECHNICAL" METHODS
0461   //
0462   //========================================================================
0463   //...................................................... methods that will (should) be private
0464   void Init();
0465   void SetEcalSubDetector(const TString &);
0466 
0467   void Anew(const TString &);
0468   void Adelete(const TString &);
0469 
0470   Bool_t OpenRootFile(const Text_t *, const TString &);
0471   Bool_t CloseRootFile(const Text_t *);
0472   void TestArrayDimH1(const TString &, const TString &, const Int_t &, const Int_t &);
0473   void TestArrayDimH2(const TString &, const TString &, const Int_t &, const Int_t &);
0474 
0475   Bool_t ReadRootFileHeader(const Int_t &);
0476 
0477   TVectorD ReadSampleAdcValues(const Int_t &,
0478                                const Int_t &,
0479                                const Int_t &,
0480                                const Int_t &);  //(nb evts in burst) of (StinEcha,samp)
0481   //------------------------------------------------------------------------------------------------
0482   TVectorD ReadSampleMeans(const Int_t &, const Int_t &, const Int_t &);  // (sample) of (StexStin,Xtal)
0483   TVectorD ReadSampleMeans(const Int_t &, const Int_t &);                 // (MaxCrysInStin*sample) of (StexStin)
0484 
0485   TVectorD ReadSampleSigmas(const Int_t &, const Int_t &, const Int_t &);  // (sample) of (StexStin,Xtal)
0486   TVectorD ReadSampleSigmas(const Int_t &, const Int_t &);                 // (MaxCrysInStin*sample) of (StexStin)
0487 
0488   //------------------------------------------------------------------------------------------------
0489   TVectorD ReadNumberOfEvents(const Int_t &);                     // EcnaStexCrys of (StexEcha)
0490   TVectorD ReadPedestals(const Int_t &);                          // EcnaStexCrys of (StexEcha)
0491   TVectorD ReadTotalNoise(const Int_t &);                         // EcnaStexCrys of (StexEcha)
0492   TVectorD ReadLowFrequencyNoise(const Int_t &);                  // EcnaStexCrys of (StexEcha)
0493   TVectorD ReadHighFrequencyNoise(const Int_t &);                 // EcnaStexCrys of (StexEcha)
0494   TVectorD ReadMeanCorrelationsBetweenSamples(const Int_t &);     // EcnaStexCrys of (StexEcha)
0495   TVectorD ReadSigmaOfCorrelationsBetweenSamples(const Int_t &);  // EcnaStexCrys of (StexEcha)
0496 
0497   //------------------------------------------------------------------------------------------------
0498   TVectorD ReadAverageNumberOfEvents(const Int_t &);                     // EcnaStexStin of (StexStin)
0499   TVectorD ReadAveragePedestals(const Int_t &);                          // EcnaStexStin of (StexStin)
0500   TVectorD ReadAverageTotalNoise(const Int_t &);                         // EcnaStexStin of (StexStin)
0501   TVectorD ReadAverageLowFrequencyNoise(const Int_t &);                  // EcnaStexStin of (StexStin)
0502   TVectorD ReadAverageHighFrequencyNoise(const Int_t &);                 // EcnaStexStin of (StexStin)
0503   TVectorD ReadAverageMeanCorrelationsBetweenSamples(const Int_t &);     // EcnaStexStin of (StexStin)
0504   TVectorD ReadAverageSigmaOfCorrelationsBetweenSamples(const Int_t &);  // EcnaStexStin of (StexStin)
0505 
0506   //------------------------------------------------------------------------------------------------
0507   TMatrixD ReadCovariancesBetweenSamples(const Int_t &,
0508                                          const Int_t &,
0509                                          const Int_t &);  // (samp,samp) of (StexStin,Xtal)
0510   TMatrixD ReadCorrelationsBetweenSamples(const Int_t &,
0511                                           const Int_t &,
0512                                           const Int_t &);  // (samp,samp) of (StexStin,Xtal)
0513 
0514   //-----------------------------------------------------------------------------------------------
0515   TMatrixD ReadLowFrequencyCovariancesBetweenChannels(const Int_t &, const Int_t &, const Int_t &);
0516   TMatrixD ReadHighFrequencyCovariancesBetweenChannels(const Int_t &, const Int_t &, const Int_t &);
0517   // (Xtal in Stin X, Xtal in Stin Y) of (Stin_X, Stin_Y)
0518 
0519   TMatrixD ReadLowFrequencyCorrelationsBetweenChannels(const Int_t &, const Int_t &, const Int_t &);
0520   TMatrixD ReadHighFrequencyCorrelationsBetweenChannels(const Int_t &, const Int_t &, const Int_t &);
0521   // (Xtal in Stin X, Xtal in Stin Y) of (Stin_X, Stin_Y)
0522 
0523   //------------------- (BIG MATRIX 1700x1700 for barrel, 5000x5000? for endcap) ------------------
0524   TMatrixD ReadLowFrequencyCovariancesBetweenChannels(const Int_t &);  // (Xtal in Stin X, Xtal in Stin Y) for all Stins
0525   TMatrixD ReadHighFrequencyCovariancesBetweenChannels(const Int_t &);
0526   TMatrixD ReadLowFrequencyCorrelationsBetweenChannels(const Int_t &);  // (Xtal in Stin X, Xtal in Stin Y) for all Stins
0527   TMatrixD ReadHighFrequencyCorrelationsBetweenChannels(const Int_t &);
0528 
0529   //-----------------------------------------------------------------------------------------------
0530   TMatrixD ReadLowFrequencyMeanCorrelationsBetweenStins(const Int_t &);   // 1 of (Stin,Stin)
0531   TMatrixD ReadHighFrequencyMeanCorrelationsBetweenStins(const Int_t &);  // 1 of (Stin,Stin)
0532 
0533   //------------------------------------------------------------------------------------------------
0534   const TString &GetAnalysisName() const;
0535   Int_t GetNbOfSamples();
0536   Int_t GetRunNumber();
0537   Int_t GetFirstReqEvtNumber();
0538   Int_t GetLastReqEvtNumber();
0539   Int_t GetReqNbOfEvts();
0540   Int_t GetStexNumber();
0541 
0542   time_t GetStartTime();
0543   time_t GetStopTime();
0544   const TString &GetStartDate() const;
0545   const TString &GetStopDate() const;
0546   const TString &GetRootFileName() const;
0547   const TString &GetRootFileNameShort() const;
0548 
0549   TString GetRunType();
0550 
0551   //-------------------------------------------------------------------------------  "technical" methods
0552   TVectorD ReadRelevantCorrelationsBetweenSamples(const Int_t &, const Int_t &, const Int_t &);
0553   // N(N-1)/2 of (StexStin, Xtal)
0554 
0555   Int_t GetStexStinFromIndex(const Int_t &);  // (no read in the ROOT file)
0556   Int_t GetStinIndex(const Int_t &);          // Stin index from Stin number (StexStin)
0557 
0558   TVectorD ReadStinNumbers(const Int_t &);
0559   TMatrixD ReadNumberOfEventsForSamples(const Int_t &, const Int_t &, const Int_t &);  // (Xtal,sample) of (StexStin)
0560 
0561   Double_t ***ReadSampleAdcValuesSameFile(const Int_t &, const Int_t &, const Int_t &);
0562 
0563   Int_t GetNumberOfEvents(const Int_t &, const Int_t &);
0564   Int_t GetNumberOfBinsSampleAsFunctionOfTime();
0565 
0566   TString GetTypeOfQuantity(const CnaResultTyp);
0567 
0568   TString GetTechReadCode(const TString &, const TString &);
0569 
0570   //------------------------------------------------------------------------------------------------
0571   //............... Flags Print Comments/Debug
0572 
0573   void PrintNoComment();    // (default) Set flags to forbid the printing of all the comments
0574                             // except ERRORS
0575   void PrintWarnings();     // Set flags to authorize printing of some warnings
0576   void PrintComments();     // Set flags to authorize printing of infos and some comments
0577                             // concerning initialisations
0578   void PrintAllComments();  // Set flags to authorize printing of all the comments
0579 
0580   ClassDefOverride(TEcnaRead, 1)  // Calculation of correlated noises from data
0581 };
0582 
0583 #endif  //  CL_TEcnaRead_H