Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-09-30 01:17:46

0001 #ifndef ZTR_TEcnaWrite
0002 #define ZTR_TEcnaWrite
0003 
0004 #include <Riostream.h>
0005 
0006 #include "TObject.h"
0007 #include "TSystem.h"
0008 #include "Riostream.h"
0009 #include <cmath>
0010 #include <ctime>
0011 
0012 #include "TVectorD.h"
0013 #include "TMatrixD.h"
0014 
0015 #include "CalibCalorimetry/EcalCorrelatedNoiseAnalysisAlgos/interface/TEcnaObject.h"
0016 #include "CalibCalorimetry/EcalCorrelatedNoiseAnalysisAlgos/interface/TEcnaNumbering.h"
0017 #include "CalibCalorimetry/EcalCorrelatedNoiseAnalysisAlgos/interface/TEcnaParEcal.h"
0018 #include "CalibCalorimetry/EcalCorrelatedNoiseAnalysisAlgos/interface/TEcnaParPaths.h"
0019 #include "CalibCalorimetry/EcalCorrelatedNoiseAnalysisAlgos/interface/TEcnaParCout.h"
0020 #include "CalibCalorimetry/EcalCorrelatedNoiseAnalysisAlgos/interface/TEcnaHeader.h"
0021 
0022 ///-----------------------------------------------------------
0023 ///   TEcnaWrite.h
0024 ///   Update: 05/10/2012
0025 ///   Authors:   B.Fabbro (bernard.fabbro@cea.fr), FX Gentit
0026 ///              DSM/IRFU/SPP CEA-Saclay
0027 ///   Copyright: Those valid for CEA sofware
0028 ///
0029 ///   ECNA web page:
0030 ///     http://cms-fabbro.web.cern.ch/cms-fabbro/
0031 ///     cna_new/Correlated_Noise_Analysis/ECNA_main_page.htm
0032 ///-----------------------------------------------------------
0033 
0034 class TEcnaWrite : public TObject {
0035 private:
0036   //..... Attributes
0037 
0038   Int_t fCnew, fCdelete;
0039   Int_t fCnewRoot, fCdeleteRoot;
0040 
0041   Int_t fgMaxCar;  // Max nb of caracters for char*
0042 
0043   TString fTTBELL;
0044 
0045   Int_t fCnaCommand, fCnaError;
0046 
0047   //...............................................................
0048 
0049   Int_t fFlagPrint;
0050   Int_t fCodePrintComments, fCodePrintWarnings, fCodePrintAllComments, fCodePrintNoComment;
0051 
0052   TEcnaParEcal* fEcal;
0053   TString fFlagSubDet;
0054 
0055   TEcnaNumbering* fEcalNumbering;
0056   TEcnaParPaths* fCnaParPaths;
0057   TEcnaParCout* fCnaParCout;
0058 
0059   std::ofstream fFcout_f;
0060 
0061   //...................................... Codes for file names
0062   Int_t fCodeHeaderAscii;
0063   Int_t fCodeRoot;
0064 
0065   Int_t fCodeNbOfEvts;
0066   Int_t fCodePed;
0067   Int_t fCodeTno;
0068   Int_t fCodeLfn;
0069   Int_t fCodeHfn;
0070   Int_t fCodeMeanCorss;
0071   Int_t fCodeSigCorss;
0072 
0073   Int_t fCodeCovCss;
0074   Int_t fCodeCorCss;
0075 
0076   Int_t fCodeAdcEvt;
0077   Int_t fCodeMSp;
0078   Int_t fCodeSSp;
0079 
0080   Int_t fCodeAvPed;
0081   Int_t fCodeAvTno;
0082   Int_t fCodeAvMeanCorss;
0083   Int_t fCodeAvSigCorss;
0084 
0085   Int_t fCodeLfCov;
0086   Int_t fCodeLfCor;
0087   Int_t fCodeHfCov;
0088   Int_t fCodeHfCor;
0089 
0090   Int_t fCodeLFccMoStins;
0091   Int_t fCodeHFccMoStins;
0092 
0093   //..........................................................................
0094   Int_t fSectChanSizeX, fSectChanSizeY;
0095   Int_t fSectSampSizeX, fSectSampSizeY;
0096 
0097   Int_t fNbChanByLine;  // Nb channels by line (for ASCII results file)
0098   Int_t fNbSampByLine;  // Nb samples by line  (for ASCII results file)
0099   Int_t fUserSamp;      // Current sample  number (for ASCII results file)
0100   Int_t fStexStinUser;  // Current Stin number in Stex
0101   Int_t fStinEchaUser;  // Current electronic channel number in Stin
0102                         // for ASCII results file ([0,24] for EB, [1,25] for EE)
0103 
0104   Double_t** fjustap_2d_ev;
0105   Double_t* fjustap_1d_ev;
0106 
0107   Double_t** fjustap_2d_var;
0108   Double_t* fjustap_1d_var;
0109 
0110   Double_t** fjustap_2d_cc;
0111   Double_t* fjustap_1d_cc;
0112 
0113   Double_t** fjustap_2d_ss;
0114   Double_t* fjustap_1d_ss;
0115 
0116   //.................... Private methods
0117 
0118   void fAsciiFileWriteHeader(const Int_t&);
0119   void fT2dWriteAscii(const Int_t&, const Int_t&, const Int_t&, const Int_t&, const TMatrixD&);
0120 
0121 public:
0122   //..... Public attributes
0123 
0124   TString fAnaType;
0125   Int_t fNbOfSamples;
0126   Int_t fRunNumber;
0127   Int_t fFirstReqEvtNumber;
0128   Int_t fLastReqEvtNumber;
0129   Int_t fReqNbOfEvts;
0130   Int_t fStexNumber;
0131   TString fStexName;
0132   TString fStinName;
0133 
0134   TString fPathForAsciiFiles;
0135   TString fStartDate, fStopDate;
0136   time_t fStartTime, fStopTime;
0137 
0138   TString fRootFileNameShort;  // name of  the results ROOT file
0139   TString fRootFileName;       // name of  the results ROOT file with its path = fPathRoot/fRootFileNameShort
0140 
0141   TString fAsciiFileName;       // name of  the results ASCII file
0142   TString fAsciiFileNameShort;  // name of  the results ASCII file = fPathAscii/fAsciiFileNameShort
0143 
0144   //..... Methods
0145 
0146   TEcnaWrite();
0147   TEcnaWrite(TEcnaObject*, const TString&);
0148   TEcnaWrite(const TString&, TEcnaParPaths*, TEcnaParCout*, TEcnaParEcal*, TEcnaNumbering*);
0149 
0150   ~TEcnaWrite() override;
0151 
0152   void Init();
0153   void SetEcalSubDetector(const TString&);
0154   void SetEcalSubDetector(const TString&, TEcnaParEcal*, TEcnaNumbering*);
0155 
0156   //...................................................... making file name method
0157   void fMakeResultsFileName();  // => default: arg = fCodeRoot
0158   void fMakeResultsFileName(const Int_t&);
0159 
0160   //.................................... ASCII writing file methods
0161   // void    WriteAsciiSampleMeans();    // methode a remettre ?
0162   // void    WriteAsciiSampleSigmas();   // methode a remettre ?
0163 
0164   void WriteAsciiCovariancesBetweenSamples(const Int_t&, const Int_t&, const Int_t&, const TMatrixD&);
0165   void WriteAsciiCorrelationsBetweenSamples(const Int_t&, const Int_t&, const Int_t&, const TMatrixD&);
0166 
0167   void WriteAsciiHisto(const TString&, const Int_t&, const TVectorD&);
0168 
0169   //...........................................................................
0170   const TString& GetAsciiFileName() const;
0171   const TString& GetRootFileName() const;
0172   const TString& GetRootFileNameShort() const;
0173   const TString& GetAnalysisName() const;
0174 
0175   Int_t GetNbOfSamples();
0176   Int_t GetRunNumber();
0177   Int_t GetFirstReqEvtNumber();
0178   Int_t GetReqNbOfEvts();
0179   Int_t GetStexNumber();
0180 
0181   Int_t NumberOfEventsAnalysis(Int_t**, const Int_t&, const Int_t&, const Int_t&);  // Called by TEcnaRun
0182   Int_t NumberOfEventsAnalysis(Int_t*, const Int_t&, const Int_t&, const Int_t&);   // Called by TEcnaRead
0183 
0184   void RegisterFileParameters(const TString&,
0185                               const Int_t&,
0186                               const Int_t&,
0187                               const Int_t&,
0188                               const Int_t&,
0189                               const Int_t&,
0190                               const Int_t&,
0191                               const TString&,
0192                               const TString&,
0193                               const time_t,
0194                               const time_t);
0195 
0196   void RegisterFileParameters(
0197       const TString&, const Int_t&, const Int_t&, const Int_t&, const Int_t&, const Int_t&, const Int_t&);
0198 
0199   ClassDefOverride(TEcnaWrite, 1)  // Writing in file (.ascii, .root) methods for CNA (Correlated Noises Analysis)
0200 };
0201 
0202 #endif  //    ZTR_TEcnaParameter