CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_0/src/CalibCalorimetry/EcalCorrelatedNoiseAnalysisAlgos/interface/TEcnaWrite.h

Go to the documentation of this file.
00001 #ifndef ZTR_TEcnaWrite
00002 #define ZTR_TEcnaWrite
00003 
00004 #include <Riostream.h>
00005 
00006 #include "TObject.h"
00007 #include "TSystem.h"
00008 #include "Riostream.h"
00009 #include <math.h>
00010 #include <time.h>
00011 
00012 #include "TVectorD.h"
00013 #include "TMatrixD.h"
00014 
00015 #include "CalibCalorimetry/EcalCorrelatedNoiseAnalysisAlgos/interface/TEcnaObject.h"
00016 #include "CalibCalorimetry/EcalCorrelatedNoiseAnalysisAlgos/interface/TEcnaNumbering.h"
00017 #include "CalibCalorimetry/EcalCorrelatedNoiseAnalysisAlgos/interface/TEcnaParEcal.h"
00018 #include "CalibCalorimetry/EcalCorrelatedNoiseAnalysisAlgos/interface/TEcnaParPaths.h"
00019 #include "CalibCalorimetry/EcalCorrelatedNoiseAnalysisAlgos/interface/TEcnaParCout.h"
00020 #include "CalibCalorimetry/EcalCorrelatedNoiseAnalysisAlgos/interface/TEcnaHeader.h"
00021 
00033 
00034 class TEcnaWrite : public TObject {
00035 
00036  private:
00037 
00038   //..... Attributes
00039 
00040   Int_t fgMaxCar;   // Max nb of caracters for char*
00041   Int_t fCnew,     fCdelete;
00042   Int_t fCnewRoot, fCdeleteRoot;
00043 
00044   TString fTTBELL;
00045 
00046   Int_t fCnaCommand, fCnaError;
00047 
00048   //...............................................................
00049 
00050   Int_t fFlagPrint;
00051   Int_t fCodePrintComments, fCodePrintWarnings, fCodePrintAllComments, fCodePrintNoComment;
00052 
00053   TEcnaParEcal *fEcal;
00054   TString fFlagSubDet;
00055 
00056   TEcnaNumbering *fEcalNumbering;
00057   TEcnaParPaths  *fCnaParPaths;
00058   TEcnaParCout   *fCnaParCout;
00059 
00060   ofstream fFcout_f;
00061 
00062   //...................................... Codes for file names
00063   Int_t fCodeHeaderAscii;
00064   Int_t fCodeRoot;
00065 
00066   Int_t fCodeNbOfEvts;
00067   Int_t fCodePed;
00068   Int_t fCodeTno;
00069   Int_t fCodeLfn;
00070   Int_t fCodeHfn;
00071   Int_t fCodeMeanCorss;
00072   Int_t fCodeSigCorss;
00073 
00074   Int_t fCodeCovCss;
00075   Int_t fCodeCorCss;
00076   
00077   Int_t fCodeAdcEvt;
00078   Int_t fCodeMSp;  
00079   Int_t fCodeSSp;
00080   
00081   Int_t fCodeAvPed;  
00082   Int_t fCodeAvTno;
00083   Int_t fCodeAvMeanCorss;
00084   Int_t fCodeAvSigCorss;
00085   
00086   Int_t fCodeLfCov;
00087   Int_t fCodeLfCor;
00088   Int_t fCodeHfCov;
00089   Int_t fCodeHfCor;
00090   
00091   Int_t fCodeLFccMoStins;
00092   Int_t fCodeHFccMoStins;
00093   
00094   //..........................................................................
00095   Int_t fSectChanSizeX, fSectChanSizeY;
00096   Int_t fSectSampSizeX, fSectSampSizeY;
00097 
00098   Int_t fNbChanByLine; // Nb channels by line (for ASCII results file)
00099   Int_t fNbSampByLine; // Nb samples by line  (for ASCII results file)
00100   Int_t fUserSamp;     // Current sample  number (for ASCII results file)
00101   Int_t fStexStinUser; // Current Stin number in Stex 
00102   Int_t fStinEchaUser; // Current electronic channel number in Stin
00103                        // for ASCII results file ([0,24] for EB, [1,25] for EE)
00104 
00105 
00106   Double_t**  fjustap_2d_ev;
00107   Double_t*   fjustap_1d_ev;
00108 
00109   Double_t**  fjustap_2d_var;
00110   Double_t*   fjustap_1d_var;
00111 
00112   Double_t**  fjustap_2d_cc;
00113   Double_t*   fjustap_1d_cc;
00114 
00115   Double_t**  fjustap_2d_ss;
00116   Double_t*   fjustap_1d_ss;
00117 
00118   //.................... Private methods
00119 
00120   void     fAsciiFileWriteHeader(const Int_t&);
00121   void     fT2dWriteAscii(const Int_t&, const Int_t&, const Int_t&, const Int_t&, const TMatrixD&);
00122 
00123  public:
00124 
00125   //..... Public attributes
00126 
00127   TString  fAnaType;
00128   Int_t    fNbOfSamples;
00129   Int_t    fRunNumber;
00130   Int_t    fFirstReqEvtNumber;
00131   Int_t    fLastReqEvtNumber;
00132   Int_t    fReqNbOfEvts;
00133   Int_t    fStexNumber;
00134   TString  fStexName;
00135   TString  fStinName;
00136 
00137   TString  fPathForAsciiFiles;
00138   TString  fStartDate, fStopDate;
00139   time_t   fStartTime, fStopTime;
00140 
00141   TString  fRootFileNameShort;  // name of  the results ROOT file 
00142   TString  fRootFileName;       // name of  the results ROOT file with its path = fPathRoot/fRootFileNameShort
00143 
00144   TString  fAsciiFileName;      // name of  the results ASCII file
00145   TString  fAsciiFileNameShort; // name of  the results ASCII file = fPathAscii/fAsciiFileNameShort
00146 
00147   //..... Methods
00148   
00149   TEcnaWrite();
00150   TEcnaWrite(TEcnaObject*, const TString);
00151   TEcnaWrite(const TString, const TEcnaParPaths*, const TEcnaParCout*,
00152              const TEcnaParEcal*, const TEcnaNumbering*);
00153 
00154   virtual  ~TEcnaWrite();
00155   
00156   void     Init();
00157   void     SetEcalSubDetector(const TString);
00158   void     SetEcalSubDetector(const TString, const TEcnaParEcal*, const TEcnaNumbering*);
00159   
00160   //...................................................... making file name method
00161   void     fMakeResultsFileName();                // => default: arg = fCodeRoot
00162   void     fMakeResultsFileName(const Int_t&);
00163 
00164   //.................................... ASCII writing file methods 
00165   // void    WriteAsciiSampleMeans();    // methode a remettre ?
00166   // void    WriteAsciiSampleSigmas();   // methode a remettre ?
00167 
00168   void WriteAsciiCovariancesBetweenSamples(const Int_t&, const Int_t&, const Int_t&, const TMatrixD&);
00169   void WriteAsciiCorrelationsBetweenSamples(const Int_t&, const Int_t&, const Int_t&, const TMatrixD&);
00170 
00171   void WriteAsciiHisto(const TString, const Int_t&, const TVectorD&);
00172 
00173   //...........................................................................
00174   TString GetAsciiFileName();
00175   TString GetRootFileName();
00176   TString GetRootFileNameShort();
00177   TString GetAnalysisName();
00178 
00179   Int_t GetNbOfSamples();
00180   Int_t GetRunNumber();
00181   Int_t GetFirstReqEvtNumber();
00182   Int_t GetReqNbOfEvts();
00183   Int_t GetStexNumber();
00184 
00185   Int_t NumberOfEventsAnalysis(Int_t**, const Int_t&, const Int_t&, const Int_t&); // Called by TEcnaRun
00186   Int_t NumberOfEventsAnalysis(Int_t*,  const Int_t&, const Int_t&, const Int_t&); // Called by TEcnaRead
00187 
00188   void RegisterFileParameters(const TString, const Int_t&, const Int_t&, const Int_t&,
00189                               const Int_t&,  const Int_t&, const Int_t&, const TString, const TString,
00190                               const time_t,  const time_t);
00191   
00192   void RegisterFileParameters(const TString, const Int_t&, const Int_t&, const Int_t&,
00193                               const Int_t&,  const Int_t&, const Int_t&);
00194   
00195   ClassDef(TEcnaWrite,1)// Writing in file (.ascii, .root) methods for CNA (Correlated Noises Analysis)
00196     };
00197     
00198 #endif   //    ZTR_TEcnaParameter
00199