CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch12/src/CalibCalorimetry/EcalCorrelatedNoiseAnalysisAlgos/interface/TEcnaRead.h

Go to the documentation of this file.
00001 #ifndef   CL_TEcnaRead_H
00002 #define   CL_TEcnaRead_H
00003 
00004 #include <time.h>
00005 #include <math.h>
00006 
00007 #include "TSystem.h"
00008 #include "TObject.h"
00009 #include "TString.h"
00010 #include "Riostream.h"
00011 #include "TVectorD.h"
00012 #include "TMatrixD.h"
00013 
00014 #include "CalibCalorimetry/EcalCorrelatedNoiseAnalysisAlgos/interface/TEcnaParEcal.h"
00015 #include "CalibCalorimetry/EcalCorrelatedNoiseAnalysisAlgos/interface/TEcnaHeader.h"
00016 
00017 #include "CalibCalorimetry/EcalCorrelatedNoiseAnalysisAlgos/interface/TEcnaParCout.h"
00018 #include "CalibCalorimetry/EcalCorrelatedNoiseAnalysisAlgos/interface/TEcnaParPaths.h"
00019 #include "CalibCalorimetry/EcalCorrelatedNoiseAnalysisAlgos/interface/TEcnaWrite.h"
00020 #include "CalibCalorimetry/EcalCorrelatedNoiseAnalysisAlgos/interface/TEcnaNumbering.h"
00021 
00022 #include "CalibCalorimetry/EcalCorrelatedNoiseAnalysisAlgos/interface/TEcnaResultType.h"
00023 #include "CalibCalorimetry/EcalCorrelatedNoiseAnalysisAlgos/interface/TEcnaRootFile.h"
00024 
00025 //-------------------------------- TEcnaRead.h ----------------------------
00026 // 
00027 //   Creation: 31 May    2005
00028 //
00029 //   Update:   see TEcnaRead.cc
00030 //
00031 //   For questions or comments, please send e-mail to:
00032 //
00033 //   Bernard Fabbro             
00034 //   fabbro@hep.saclay.cea.fr 
00035 //
00036 //-----------------------------------------------------------------------
00037 
00038 class TEcnaRead: public TObject {
00039   
00040  private:
00041 
00042   //............ attributes
00043 
00044   // static  const  Int_t        fgMaxCar    = 512;          <== DANGEROUS ! 
00045 
00046   Int_t fgMaxCar;   // Max nb of caracters for char*
00047 
00048   Int_t fCnew;      // flags for dynamical allocation
00049   Int_t fCdelete;       
00050 
00051   TString     fTTBELL;
00052 
00053   TEcnaParCout   *fCnaParCout;  // for comments or error messages
00054   TEcnaParPaths  *fCnaParPaths; // for NbBinsADC 
00055 
00056   TEcnaHeader    *fFileHeader;    // header for result file
00057   TEcnaWrite     *fCnaWrite;      // for writing in ascii files
00058   TEcnaParEcal   *fEcal;          // for Ecal parameters
00059   TEcnaNumbering *fEcalNumbering; // for Ecal numbering
00060 
00061   TString fFlagSubDet;
00062   TString fStexName, fStinName;
00063 
00064   Bool_t fOpenRootFile;  // flag open ROOT file (open = kTRUE, close = kFALSE)
00065 
00066   Int_t fReadyToReadRootFile;
00067   Int_t fLookAtRootFile;
00068 
00069   Int_t* fT1d_StexStinFromIndex; // 1D array[Stin] Stin Number as a function of the index Stin
00070   Int_t* fTagStinNumbers;
00071   Int_t  fMemoStinNumbers;
00072 
00073   TString fPathRoot;
00074 
00075   Int_t fSectChanSizeX, fSectChanSizeY,
00076         fSectSampSizeX, fSectSampSizeY;
00077 
00078   Int_t fNbChanByLine;  // Nb channels by line (for ASCII results file)
00079   Int_t fNbSampByLine;  // Nb samples by line  (for ASCII results file)
00080   Int_t fUserSamp;      // Current sample  number (for ASCII results file)    
00081   Int_t fUserChan;      // Current channel number (for ASCII results file) 
00082 
00083   Int_t fFlagPrint;
00084   Int_t fCodePrintComments, fCodePrintWarnings, fCodePrintAllComments, fCodePrintNoComment;
00085 
00086   //............... flag data exists
00087 
00088   Bool_t fDataExist;
00089 
00090   //................ 3d array for sample ADC value fast transfert
00091   Double_t*** fT3d_distribs;   // 3D array[channel][sample][event] ADC values distibutions
00092   Double_t**  fT3d2_distribs; 
00093   Double_t*   fT3d1_distribs;
00094 
00095   //.......................................... private methods
00096 
00097   void        fCopy(const TEcnaRead&);
00098 
00099  public: 
00100 
00101   //................. constructors
00102   
00103   TEcnaRead();                  //  constructor without argument (FOR USER'S DECLARATION)
00104   //  constructor with argument (FOR USER'S DECLARATION):
00105   TEcnaRead(const TString,     const TEcnaParPaths*,   const TEcnaParCout*,
00106            const TEcnaHeader*, const TEcnaNumbering*, const TEcnaWrite*);  
00107 
00108   TEcnaRead(const TEcnaRead&);   //  copy constructor
00109 
00110   //.................... C++ methods
00111 
00112   TEcnaRead&  operator=(const TEcnaRead&);  //  overloading of the operator=
00113 
00114   //................. destructor
00115   
00116   virtual ~TEcnaRead();
00117   
00118   //...................................................... methods that will (should) be private
00119 
00120   void     Init();
00121   void     SetEcalSubDetector(const TString, const TEcnaNumbering*, const TEcnaWrite*);
00122 
00123   void     Anew(const TString);
00124   void     Adelete(const TString);
00125 
00126   Bool_t   OpenRootFile(const Text_t *, TString);
00127   Bool_t   CloseRootFile(const Text_t *);
00128   Bool_t   ReadRootFileHeader(const Int_t&);
00129   Bool_t   DataExist();    // if data is present: kTRUE , if not: kFALSE
00130 
00131   //............................................................... Genuine public user's methods
00132                             
00133   void     GetReadyToReadRootFile(TString,
00134                                   const Int_t&, const Int_t&, const Int_t&,
00135                                   const Int_t&, const Int_t&, const Int_t&, TString);
00136   time_t   GetStartTime();
00137   time_t   GetStopTime();
00138   TString  GetStartDate();
00139   TString  GetStopDate();
00140   TString  GetRootFileName();
00141   TString  GetRootFileNameShort();
00142 
00143   TString  GetRunType();
00144 
00145   //.................. Recovering methods from ROOT file ( associated to GetReadyToReadRootFile(...) )
00146 
00147   Bool_t   LookAtRootFile();
00148 
00149   Int_t    GetStexStinFromIndex(const Int_t&);      // (no read in the ROOT file)
00150   Int_t    GetStinIndex(const Int_t&);              // Stin index from Stin number (StexStin)
00151 
00152   TVectorD ReadStinNumbers(const Int_t&);
00153   TMatrixD ReadNumberOfEventsForSamples(const Int_t&, const Int_t&, const Int_t&); // (Xtal,sample) of (StexStin)
00154 
00155   TVectorD ReadSampleValues(const Int_t&, const Int_t&, const Int_t&);  //(nb evts in burst) of (StexEcha,samp)
00156   Double_t*** ReadSampleValuesSameFile(const Int_t&, const Int_t&, const Int_t&); 
00157 
00158   TVectorD ReadSampleMeans(const Int_t&,  const Int_t&, const Int_t&);    // (sample) of (StexStin,Xtal)
00159   TVectorD ReadSampleSigmas(const Int_t&, const Int_t&, const Int_t&);    // (sample) of (StexStin,Xtal) 
00160   //TVectorD ReadSigmasOfSamples(const Int_t&, const Int_t&, const Int_t&); // (sample) of (StexStin,Xtal)
00161 
00162   //------------------------------------------------------------------------------------------------
00163   TMatrixD ReadCovariancesBetweenSamples(const Int_t&, const Int_t&, const Int_t&);  // (samp,samp) of (StexStin,Xtal)
00164   TMatrixD ReadCorrelationsBetweenSamples(const Int_t&, const Int_t&, const Int_t&); // (samp,samp) of (StexStin,Xtal)
00165   TVectorD ReadRelevantCorrelationsBetweenSamples(const Int_t&, const Int_t&, const Int_t&);
00166   // N(N-1)/2 of (StexStin, Xtal)
00167 
00168   //-----------------------------------------------------------------------------------------------
00169   TMatrixD ReadLowFrequencyCovariancesBetweenChannels(const Int_t&, const Int_t&, const Int_t&);
00170   TMatrixD ReadHighFrequencyCovariancesBetweenChannels(const Int_t&, const Int_t&, const Int_t&);
00171                                        // (Xtal in Stin X, Xtal in Stin Y) of (Stin_X, Stin_Y)
00172 
00173   TMatrixD ReadLowFrequencyCorrelationsBetweenChannels(const Int_t&, const Int_t&, const Int_t&);
00174   TMatrixD ReadHighFrequencyCorrelationsBetweenChannels(const Int_t&, const Int_t&, const Int_t&);
00175                                        // (Xtal in Stin X, Xtal in Stin Y) of (Stin_X, Stin_Y)
00176 
00177   //------------------- (BIG MATRIX 1700x1700 for barrel, 5000x5000? for endcap) ------------------
00178   TMatrixD ReadLowFrequencyCovariancesBetweenChannels(const Int_t&);  // (Xtal in Stin X, Xtal in Stin Y) for all Stins
00179   TMatrixD ReadHighFrequencyCovariancesBetweenChannels(const Int_t&);
00180   TMatrixD ReadLowFrequencyCorrelationsBetweenChannels(const Int_t&); // (Xtal in Stin X, Xtal in Stin Y) for all Stins
00181   TMatrixD ReadHighFrequencyCorrelationsBetweenChannels(const Int_t&);
00182 
00183   //-----------------------------------------------------------------------------------------------
00184   TMatrixD ReadLowFrequencyMeanCorrelationsBetweenStins(const Int_t&);  // 1 of (Stin,Stin) 
00185   TMatrixD ReadHighFrequencyMeanCorrelationsBetweenStins(const Int_t&); // 1 of (Stin,Stin) 
00186   //------------------------------------------------------------------------------------------------
00187 
00188   TVectorD ReadNumberOfEvents(const Int_t&);                    // 1 of (StexEcha)
00189   TVectorD ReadPedestals(const Int_t&);                         // 1 of (StexEcha)
00190   TVectorD ReadTotalNoise(const Int_t&);                        // 1 of (StexEcha)
00191   TVectorD ReadLowFrequencyNoise(const Int_t&);                 // 1 of (StexEcha)
00192   TVectorD ReadHighFrequencyNoise(const Int_t&);                // 1 of (StexEcha)
00193   TVectorD ReadMeanOfCorrelationsBetweenSamples(const Int_t&);  // 1 of (StexEcha)
00194   TVectorD ReadSigmaOfCorrelationsBetweenSamples(const Int_t&); // 1 of (StexEcha)
00195 
00196   //------------------------------------------------------------------------------------------------
00197   TVectorD ReadAveragedNumberOfEvents(const Int_t&);                    // 1 of (StexStin)
00198   TVectorD ReadAveragedPedestals(const Int_t&);                         // 1 of (StexStin)
00199   TVectorD ReadAveragedTotalNoise(const Int_t&);                        // 1 of (StexStin)
00200   TVectorD ReadAveragedLowFrequencyNoise(const Int_t&);                 // 1 of (StexStin)
00201   TVectorD ReadAveragedHighFrequencyNoise(const Int_t&);                // 1 of (StexStin)
00202   TVectorD ReadAveragedMeanOfCorrelationsBetweenSamples(const Int_t&);  // 1 of (StexStin)
00203   TVectorD ReadAveragedSigmaOfCorrelationsBetweenSamples(const Int_t&); // 1 of (StexStin)
00204 
00205   //------------------------------------------------------------------------------------------------
00206   TString GetAnalysisName();
00207   Int_t   GetFirstReqEvtNumber();
00208   Int_t   GetReqNbOfEvts();
00209 
00210   Int_t GetNumberOfBinsSampleAsFunctionOfTime();
00211 
00212   TString GetTypeOfQuantity(const CnaResultTyp);
00213 
00214   //............... Flags Print Comments/Debug
00215 
00216   void  PrintNoComment();   // (default) Set flags to forbid the printing of all the comments
00217                             // except ERRORS
00218   void  PrintWarnings();    // Set flags to authorize printing of some warnings
00219   void  PrintComments();    // Set flags to authorize printing of infos and some comments
00220                             // concerning initialisations
00221   void  PrintAllComments(); // Set flags to authorize printing of all the comments
00222 
00223 ClassDef(TEcnaRead,1) // Calculation of correlated noises from data
00224 };  
00225 
00226 #endif    //  CL_TEcnaRead_H
00227 
00228