CMS 3D CMS Logo

TCnaReadEB.h

Go to the documentation of this file.
00001 #ifndef   CL_TCnaReadEB_H
00002 #define   CL_TCnaReadEB_H
00003 
00004 #include "TObject.h"
00005 #include "TString.h"
00006 #include "Riostream.h"
00007 #include "TVectorD.h"
00008 #include "TMatrixD.h"
00009 #include "CalibCalorimetry/EcalCorrelatedNoiseAnalysisAlgos/interface/TCnaHeaderEB.h"
00010 #include "CalibCalorimetry/EcalCorrelatedNoiseAnalysisAlgos/interface/TCnaResultType.h"
00011 #include "CalibCalorimetry/EcalCorrelatedNoiseAnalysisAlgos/interface/TCnaRootFile.h"
00012 #include "CalibCalorimetry/EcalCorrelatedNoiseAnalysisAlgos/interface/TCnaParameters.h"
00013 
00014 //-------------------------------- TCnaReadEB.h ----------------------------
00015 // 
00016 //   Creation: 31 May    2005
00017 //
00018 //   For questions or comments, please send e-mail to:
00019 //
00020 //   Bernard Fabbro             
00021 //   fabbro@hep.saclay.cea.fr 
00022 //
00023 //-----------------------------------------------------------------------
00024 
00025 class TCnaReadEB: public TObject {
00026   
00027  private:
00028 
00029   //............ attributes
00030 
00031   // static  const  Int_t        fgMaxCar    = 512;          <== DANGEROUS ! 
00032 
00033   Int_t       fgMaxCar;   // Max nb of caracters for char*
00034 
00035   Int_t       fCnew;      // flags for dynamical allocation
00036   Int_t       fCdelete;       
00037 
00038   TString     fTTBELL;
00039 
00040   TCnaHeaderEB *fFileHeader;    // header for result file
00041   Int_t        fCodeHeader;
00042 
00043   Bool_t      fOpenRootFile;  // flag open ROOT file (open = kTRUE, close = kFALSE)
00044   Int_t       fCodeRoot;
00045   Int_t       fCodeCorresp;
00046 
00047   Int_t       fReadyToReadRootFile;
00048   Int_t       fLookAtRootFile;
00049 
00050   Int_t       fSpecialSMTowerNotIndexed;
00051 
00052   Int_t*      fT1d_SMtowFromIndex; // 1D array[tower] tower Number as a function of the index tower
00053   Int_t*      fTagTowerNumbers;
00054   Int_t       fMemoTowerNumbers;
00055 
00056   Double_t**  fjustap_2d_ev;
00057   Double_t*   fjustap_1d_ev;
00058 
00059   Double_t**  fjustap_2d_var;
00060   Double_t*   fjustap_1d_var;
00061 
00062   Double_t**  fjustap_2d_cc;
00063   Double_t*   fjustap_1d_cc;
00064 
00065   Double_t**  fjustap_2d_ss;
00066   Double_t*   fjustap_1d_ss;
00067 
00068   ofstream    fFcout_f;
00069   ifstream    fFcin_f;
00070   
00071   Int_t       fDim_name;
00072 
00073   TString     fRootFileName;
00074   TString     fRootFileNameShort;
00075 
00076   TString     fAsciiFileName;
00077   TString     fAsciiFileNameShort;
00078 
00079   TString     fPathAscii;
00080   TString     fPathRoot;
00081 
00082   TString     fKeyFileNameForCnaPaths;
00083 
00084   TString     fKeyWorkingDirPath;
00085   TString     fKeyRootFilePath;
00086 
00087   Int_t       fSectChanSizeX, fSectChanSizeY,
00088               fSectSampSizeX, fSectSampSizeY;
00089 
00090   Int_t       fNbChanByLine;  // Nb channels by line (for ASCII results file)
00091   Int_t       fNbSampByLine;  // Nb samples by line  (for ASCII results file)
00092   Int_t       fUserSamp;      // Current sample  number (for ASCII results file)    
00093   Int_t       fUserChan;      // Current channel number (for ASCII results file) 
00094 
00095   Int_t       fFlagPrint;
00096   Int_t       fCodePrintComments, fCodePrintWarnings, fCodePrintAllComments, fCodePrintNoComment;
00097 
00098   //............... flag data exists
00099 
00100   Bool_t      fDataExist;
00101 
00102   //.......................................... private methods
00103 
00104   void        fCopy(const TCnaReadEB&);
00105   void        fMakeResultsFileName(const Int_t&);
00106 
00107  public: 
00108 
00109   //................. constructors
00110   
00111   TCnaReadEB();                            //  constructor without argument (FOR USER'S DECLARATION)
00112   TCnaReadEB(const TCnaReadEB&);              //  copy constructor
00113 
00114   //.................... C++ methods
00115 
00116   TCnaReadEB&  operator=(const TCnaReadEB&);  //  overloading of the operator=
00117 
00118   //................. destructor
00119   
00120   virtual ~TCnaReadEB();
00121   
00122   //...................................................... methods that will (should) be private
00123 
00124   void         Init();
00125 
00126   Bool_t       OpenRootFile(Text_t *, TString);
00127   Bool_t       CloseRootFile(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, const Int_t&, const Int_t&,
00134                                       const Int_t&, const Int_t&, TString);
00135 
00136   time_t       GetStartTime();
00137   time_t       GetStopTime();
00138   TString      GetStartDate();
00139   TString      GetStopDate();
00140   void         DefineResultsRootFilePath(TString);
00141   TString      GetRootFileNameShort();
00142 
00143   //.................. Recovering methods from ROOT file ( associated to GetReadyToReadRootFile(...) )
00144 
00145   Bool_t   LookAtRootFile();
00146 
00147   TVectorD ReadTowerNumbers();
00148   Int_t    GetSMTowFromIndex(const Int_t&);   // (no read in the ROOT file)
00149   Int_t    GetTowerIndex(const Int_t&);                     // Tower index from tower number (SMtower)
00150   Int_t    GetSMEcha(const Int_t&, const Int_t&); // CNA-Channel number from tower and crystal numbers 
00151 
00152   TMatrixD ReadNumbersOfFoundEventsForSamples(const Int_t&);                    // (crystal,sample) of (SMtower)
00153   TVectorD ReadSampleAsFunctionOfTime(const Int_t&, const Int_t&, const Int_t&); // (bins) of (SMtow,crys,sampl) 
00154   TVectorD ReadExpectationValuesOfSamples(const Int_t&,  const Int_t&);     // (sample) of (SMtower,crystal)
00155   TVectorD ReadVariancesOfSamples(const Int_t&, const Int_t&);              // (sample) of (SMtower,crystal) 
00156   TVectorD ReadSigmasOfSamples(const Int_t&, const Int_t&);                 // (sample) of (SMtower,crystal)
00157   TVectorD ReadEventDistribution(const Int_t&, const Int_t&, const Int_t&);  // (bins) of (SMtower,crystal,sample)
00158   Double_t ReadEventDistributionXmin(const Int_t&, const Int_t&, const Int_t&); // (1) of (SMtower,crystal,sample)
00159   Double_t ReadEventDistributionXmax(const Int_t&, const Int_t&, const Int_t&); // (1) of (SMtower,crystal,sample)
00160 
00161   TMatrixD ReadCovariancesBetweenCrystalsMeanOverSamples(const Int_t&, const Int_t&);
00162                                        // (crystal in tower X, crystal in tower Y) of (SMtower_X, SMtower_Y) 
00163   TMatrixD ReadCorrelationsBetweenCrystalsMeanOverSamples(const Int_t&, const Int_t&);
00164                                        // (crystal in tower X, crystal in tower Y) of (SMtower_X, SMtower_Y)
00165 
00166   TMatrixD ReadCovariancesBetweenCrystalsMeanOverSamples();  // (Xtal in tower X, Xtal in tower Y) for all towers 
00167   TMatrixD ReadCorrelationsBetweenCrystalsMeanOverSamples(); // (Xtal in tower X, Xtal in tower Y) for all towers
00168 
00169   TMatrixD ReadCovariancesBetweenTowersMeanOverSamplesAndChannels();  // 1 of (tower,tower) 
00170   TMatrixD ReadCorrelationsBetweenTowersMeanOverSamplesAndChannels(); // 1 of (tower,tower) 
00171 
00172   TMatrixD ReadCovariancesBetweenSamples(const Int_t&, const Int_t&);   // (sample,sample) of (SMtower, crystal)
00173   TMatrixD ReadCorrelationsBetweenSamples(const Int_t&, const Int_t&);  // (sample,sample) of (SMtower, crystal)
00174   TVectorD ReadRelevantCorrelationsBetweenSamples(const Int_t&, const Int_t&); // N(N-1)/2 of (SMtower, crystal)
00175 
00176   TVectorD ReadExpectationValuesOfExpectationValuesOfSamples();  // 1 of (SMEcha)
00177   TVectorD ReadExpectationValuesOfSigmasOfSamples();             // 1 of (SMEcha)
00178   TVectorD ReadExpectationValuesOfCorrelationsBetweenSamples();  // 1 of (SMEcha)
00179 
00180   TVectorD ReadSigmasOfExpectationValuesOfSamples();             // 1  of (SMEcha)
00181   TVectorD ReadSigmasOfSigmasOfSamples();                        // 1  of (SMEcha)
00182   TVectorD ReadSigmasOfCorrelationsBetweenSamples();             // 1  of (SMEcha)
00183 
00184   TMatrixD ReadCorrectionsToSamplesFromCovss(const Int_t&);                 // (crystal, sample) of (SMtower)
00185   TVectorD ReadCorrectionsToSamplesFromCovss(const Int_t&, const Int_t&);   // (sample) of (SMtower, crystal)
00186   TMatrixD ReadCorrectionFactorsToCovss(const Int_t&, const Int_t&);
00187   TMatrixD ReadCorrectionFactorsToCorss(const Int_t&, const Int_t&);
00188 
00189   Int_t MaxTowEtaInSM();
00190   Int_t MaxTowPhiInSM();
00191   Int_t MaxTowInSM();
00192 
00193   Int_t MaxCrysEtaInTow();           // Tower size X in terms of crystal
00194   Int_t MaxCrysPhiInTow();           // Tower size Y in terms of crystal
00195   Int_t MaxCrysInTow();
00196   Int_t MaxCrysInSM();
00197 
00198   Int_t MaxSampADC();
00199 
00200   TString GetAnalysisName();
00201   Int_t   GetFirstTakenEventNumber();
00202   Int_t   GetNumberOfTakenEvents();
00203 
00204   Int_t GetNumberOfBinsEventDistributions();
00205   Int_t GetNumberOfBinsSampleAsFunctionOfTime();
00206 
00207   TString GetTypeOfQuantity(const CnaResultTyp);
00208 
00209   //............... Flags Print Comments/Debug
00210 
00211   void  PrintNoComment();   // (default) Set flags to forbid the printing of all the comments
00212                             // except ERRORS
00213   void  PrintWarnings();    // Set flags to authorize printing of some warnings
00214   void  PrintComments();    // Set flags to authorize printing of infos and some comments
00215                             // concerning initialisations
00216   void  PrintAllComments(); // Set flags to authorize printing of all the comments
00217 
00218 ClassDef(TCnaReadEB,1) // Calculation of correlated noises from data
00219 };  
00220 
00221 #endif    //  CL_TCnaReadEB_H
00222 
00223 

Generated on Tue Jun 9 17:25:15 2009 for CMSSW by  doxygen 1.5.4