CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TEcnaRead.h
Go to the documentation of this file.
1 #ifndef CL_TEcnaRead_H
2 #define CL_TEcnaRead_H
3 
4 #include <time.h>
5 #include <math.h>
6 
7 #include "TSystem.h"
8 #include "TObject.h"
9 #include "TString.h"
10 #include "Riostream.h"
11 #include "TVectorD.h"
12 #include "TMatrixD.h"
13 
16 
21 
24 
25 //-------------------------------- TEcnaRead.h ----------------------------
26 //
27 // Creation: 31 May 2005
28 //
29 // Update: see TEcnaRead.cc
30 //
31 // For questions or comments, please send e-mail to:
32 //
33 // Bernard Fabbro
34 // fabbro@hep.saclay.cea.fr
35 //
36 //-----------------------------------------------------------------------
37 
38 class TEcnaRead: public TObject {
39 
40  private:
41 
42  //............ attributes
43 
44  // static const Int_t fgMaxCar = 512; <== DANGEROUS !
45 
46  Int_t fgMaxCar; // Max nb of caracters for char*
47 
48  Int_t fCnew; // flags for dynamical allocation
49  Int_t fCdelete;
50 
51  TString fTTBELL;
52 
53  TEcnaParCout *fCnaParCout; // for comments or error messages
54  TEcnaParPaths *fCnaParPaths; // for NbBinsADC
55 
56  TEcnaHeader *fFileHeader; // header for result file
57  TEcnaWrite *fCnaWrite; // for writing in ascii files
58  TEcnaParEcal *fEcal; // for Ecal parameters
59  TEcnaNumbering *fEcalNumbering; // for Ecal numbering
60 
61  TString fFlagSubDet;
62  TString fStexName, fStinName;
63 
64  Bool_t fOpenRootFile; // flag open ROOT file (open = kTRUE, close = kFALSE)
65 
68 
69  Int_t* fT1d_StexStinFromIndex; // 1D array[Stin] Stin Number as a function of the index Stin
72 
73  TString fPathRoot;
74 
77 
78  Int_t fNbChanByLine; // Nb channels by line (for ASCII results file)
79  Int_t fNbSampByLine; // Nb samples by line (for ASCII results file)
80  Int_t fUserSamp; // Current sample number (for ASCII results file)
81  Int_t fUserChan; // Current channel number (for ASCII results file)
82 
83  Int_t fFlagPrint;
85 
86  //............... flag data exists
87 
88  Bool_t fDataExist;
89 
90  //................ 3d array for sample ADC value fast transfert
91  Double_t*** fT3d_distribs; // 3D array[channel][sample][event] ADC values distibutions
92  Double_t** fT3d2_distribs;
93  Double_t* fT3d1_distribs;
94 
95  //.......................................... private methods
96 
97  void fCopy(const TEcnaRead&);
98 
99  public:
100 
101  //................. constructors
102 
103  TEcnaRead(); // constructor without argument (FOR USER'S DECLARATION)
104  // constructor with argument (FOR USER'S DECLARATION):
105  TEcnaRead(const TString, const TEcnaParPaths*, const TEcnaParCout*,
106  const TEcnaHeader*, const TEcnaNumbering*, const TEcnaWrite*);
107 
108  TEcnaRead(const TEcnaRead&); // copy constructor
109 
110  //.................... C++ methods
111 
112  TEcnaRead& operator=(const TEcnaRead&); // overloading of the operator=
113 
114  //................. destructor
115 
116  virtual ~TEcnaRead();
117 
118  //...................................................... methods that will (should) be private
119 
120  void Init();
121  void SetEcalSubDetector(const TString, const TEcnaNumbering*, const TEcnaWrite*);
122 
123  void Anew(const TString);
124  void Adelete(const TString);
125 
126  Bool_t OpenRootFile(const Text_t *, TString);
127  Bool_t CloseRootFile(const Text_t *);
128  Bool_t ReadRootFileHeader(const Int_t&);
129  Bool_t DataExist(); // if data is present: kTRUE , if not: kFALSE
130 
131  //............................................................... Genuine public user's methods
132 
133  void GetReadyToReadRootFile(TString,
134  const Int_t&, const Int_t&, const Int_t&,
135  const Int_t&, const Int_t&, const Int_t&, TString);
136  time_t GetStartTime();
137  time_t GetStopTime();
138  TString GetStartDate();
139  TString GetStopDate();
140  TString GetRootFileName();
141  TString GetRootFileNameShort();
142 
143  TString GetRunType();
144 
145  //.................. Recovering methods from ROOT file ( associated to GetReadyToReadRootFile(...) )
146 
147  Bool_t LookAtRootFile();
148 
149  Int_t GetStexStinFromIndex(const Int_t&); // (no read in the ROOT file)
150  Int_t GetStinIndex(const Int_t&); // Stin index from Stin number (StexStin)
151 
152  TVectorD ReadStinNumbers(const Int_t&);
153  TMatrixD ReadNumberOfEventsForSamples(const Int_t&, const Int_t&, const Int_t&); // (Xtal,sample) of (StexStin)
154 
155  TVectorD ReadSampleValues(const Int_t&, const Int_t&, const Int_t&); //(nb evts in burst) of (StexEcha,samp)
156  Double_t*** ReadSampleValuesSameFile(const Int_t&, const Int_t&, const Int_t&);
157 
158  TVectorD ReadSampleMeans(const Int_t&, const Int_t&, const Int_t&); // (sample) of (StexStin,Xtal)
159  TVectorD ReadSampleSigmas(const Int_t&, const Int_t&, const Int_t&); // (sample) of (StexStin,Xtal)
160  //TVectorD ReadSigmasOfSamples(const Int_t&, const Int_t&, const Int_t&); // (sample) of (StexStin,Xtal)
161 
162  //------------------------------------------------------------------------------------------------
163  TMatrixD ReadCovariancesBetweenSamples(const Int_t&, const Int_t&, const Int_t&); // (samp,samp) of (StexStin,Xtal)
164  TMatrixD ReadCorrelationsBetweenSamples(const Int_t&, const Int_t&, const Int_t&); // (samp,samp) of (StexStin,Xtal)
165  TVectorD ReadRelevantCorrelationsBetweenSamples(const Int_t&, const Int_t&, const Int_t&);
166  // N(N-1)/2 of (StexStin, Xtal)
167 
168  //-----------------------------------------------------------------------------------------------
169  TMatrixD ReadLowFrequencyCovariancesBetweenChannels(const Int_t&, const Int_t&, const Int_t&);
170  TMatrixD ReadHighFrequencyCovariancesBetweenChannels(const Int_t&, const Int_t&, const Int_t&);
171  // (Xtal in Stin X, Xtal in Stin Y) of (Stin_X, Stin_Y)
172 
173  TMatrixD ReadLowFrequencyCorrelationsBetweenChannels(const Int_t&, const Int_t&, const Int_t&);
174  TMatrixD ReadHighFrequencyCorrelationsBetweenChannels(const Int_t&, const Int_t&, const Int_t&);
175  // (Xtal in Stin X, Xtal in Stin Y) of (Stin_X, Stin_Y)
176 
177  //------------------- (BIG MATRIX 1700x1700 for barrel, 5000x5000? for endcap) ------------------
178  TMatrixD ReadLowFrequencyCovariancesBetweenChannels(const Int_t&); // (Xtal in Stin X, Xtal in Stin Y) for all Stins
179  TMatrixD ReadHighFrequencyCovariancesBetweenChannels(const Int_t&);
180  TMatrixD ReadLowFrequencyCorrelationsBetweenChannels(const Int_t&); // (Xtal in Stin X, Xtal in Stin Y) for all Stins
181  TMatrixD ReadHighFrequencyCorrelationsBetweenChannels(const Int_t&);
182 
183  //-----------------------------------------------------------------------------------------------
184  TMatrixD ReadLowFrequencyMeanCorrelationsBetweenStins(const Int_t&); // 1 of (Stin,Stin)
185  TMatrixD ReadHighFrequencyMeanCorrelationsBetweenStins(const Int_t&); // 1 of (Stin,Stin)
186  //------------------------------------------------------------------------------------------------
187 
188  TVectorD ReadNumberOfEvents(const Int_t&); // 1 of (StexEcha)
189  TVectorD ReadPedestals(const Int_t&); // 1 of (StexEcha)
190  TVectorD ReadTotalNoise(const Int_t&); // 1 of (StexEcha)
191  TVectorD ReadLowFrequencyNoise(const Int_t&); // 1 of (StexEcha)
192  TVectorD ReadHighFrequencyNoise(const Int_t&); // 1 of (StexEcha)
193  TVectorD ReadMeanOfCorrelationsBetweenSamples(const Int_t&); // 1 of (StexEcha)
194  TVectorD ReadSigmaOfCorrelationsBetweenSamples(const Int_t&); // 1 of (StexEcha)
195 
196  //------------------------------------------------------------------------------------------------
197  TVectorD ReadAveragedNumberOfEvents(const Int_t&); // 1 of (StexStin)
198  TVectorD ReadAveragedPedestals(const Int_t&); // 1 of (StexStin)
199  TVectorD ReadAveragedTotalNoise(const Int_t&); // 1 of (StexStin)
200  TVectorD ReadAveragedLowFrequencyNoise(const Int_t&); // 1 of (StexStin)
201  TVectorD ReadAveragedHighFrequencyNoise(const Int_t&); // 1 of (StexStin)
202  TVectorD ReadAveragedMeanOfCorrelationsBetweenSamples(const Int_t&); // 1 of (StexStin)
203  TVectorD ReadAveragedSigmaOfCorrelationsBetweenSamples(const Int_t&); // 1 of (StexStin)
204 
205  //------------------------------------------------------------------------------------------------
206  TString GetAnalysisName();
207  Int_t GetFirstReqEvtNumber();
208  Int_t GetReqNbOfEvts();
209 
211 
212  TString GetTypeOfQuantity(const CnaResultTyp);
213 
214  //............... Flags Print Comments/Debug
215 
216  void PrintNoComment(); // (default) Set flags to forbid the printing of all the comments
217  // except ERRORS
218  void PrintWarnings(); // Set flags to authorize printing of some warnings
219  void PrintComments(); // Set flags to authorize printing of infos and some comments
220  // concerning initialisations
221  void PrintAllComments(); // Set flags to authorize printing of all the comments
222 
223 ClassDef(TEcnaRead,1) // Calculation of correlated noises from data
224 };
225 
226 #endif // CL_TEcnaRead_H
227 
228 
void Anew(const TString)
Definition: TEcnaRead.cc:394
Double_t *** fT3d_distribs
Definition: TEcnaRead.h:91
TVectorD ReadLowFrequencyNoise(const Int_t &)
Definition: TEcnaRead.cc:2539
Int_t fCnew
Definition: TEcnaRead.h:48
Int_t fMemoStinNumbers
Definition: TEcnaRead.h:71
TEcnaRead & operator=(const TEcnaRead &)
Definition: TEcnaRead.cc:469
CnaResultTyp
TMatrixD ReadCovariancesBetweenSamples(const Int_t &, const Int_t &, const Int_t &)
Definition: TEcnaRead.cc:1403
Int_t fUserChan
Definition: TEcnaRead.h:81
TString fPathRoot
Definition: TEcnaRead.h:73
TVectorD ReadAveragedMeanOfCorrelationsBetweenSamples(const Int_t &)
Definition: TEcnaRead.cc:2988
Double_t ** fT3d2_distribs
Definition: TEcnaRead.h:92
Double_t * fT3d1_distribs
Definition: TEcnaRead.h:93
TString GetStartDate()
Definition: TEcnaRead.cc:623
TMatrixD ReadLowFrequencyCorrelationsBetweenChannels(const Int_t &, const Int_t &, const Int_t &)
Definition: TEcnaRead.cc:1645
Int_t GetStinIndex(const Int_t &)
Definition: TEcnaRead.cc:3222
TVectorD ReadAveragedSigmaOfCorrelationsBetweenSamples(const Int_t &)
Definition: TEcnaRead.cc:3043
TVectorD ReadSigmaOfCorrelationsBetweenSamples(const Int_t &)
Definition: TEcnaRead.cc:2647
TEcnaWrite * fCnaWrite
Definition: TEcnaRead.h:57
Int_t fgMaxCar
Definition: TEcnaRead.h:46
TString GetRootFileNameShort()
Definition: TEcnaRead.cc:3168
void PrintComments()
Definition: TEcnaRead.cc:3275
time_t GetStopTime()
Definition: TEcnaRead.cc:622
void GetReadyToReadRootFile(TString, const Int_t &, const Int_t &, const Int_t &, const Int_t &, const Int_t &, const Int_t &, TString)
Definition: TEcnaRead.cc:532
Int_t fReadyToReadRootFile
Definition: TEcnaRead.h:66
Int_t fCodePrintAllComments
Definition: TEcnaRead.h:84
Int_t fUserSamp
Definition: TEcnaRead.h:80
TMatrixD ReadHighFrequencyMeanCorrelationsBetweenStins(const Int_t &)
Definition: TEcnaRead.cc:2260
TVectorD ReadAveragedTotalNoise(const Int_t &)
Definition: TEcnaRead.cc:2823
Int_t GetNumberOfBinsSampleAsFunctionOfTime()
Definition: TEcnaRead.cc:3216
TVectorD ReadRelevantCorrelationsBetweenSamples(const Int_t &, const Int_t &, const Int_t &)
Definition: TEcnaRead.cc:1519
TMatrixD ReadLowFrequencyMeanCorrelationsBetweenStins(const Int_t &)
Definition: TEcnaRead.cc:2187
TString GetTypeOfQuantity(const CnaResultTyp)
Definition: TEcnaRead.cc:3113
Int_t fCodePrintWarnings
Definition: TEcnaRead.h:84
Int_t GetFirstReqEvtNumber()
Definition: TEcnaRead.cc:3197
Bool_t ReadRootFileHeader(const Int_t &)
Definition: TEcnaRead.cc:729
Int_t fCodePrintNoComment
Definition: TEcnaRead.h:84
Int_t fSectChanSizeX
Definition: TEcnaRead.h:75
Int_t * fT1d_StexStinFromIndex
Definition: TEcnaRead.h:69
TVectorD ReadStinNumbers(const Int_t &)
Definition: TEcnaRead.cc:888
TVectorD ReadSampleValues(const Int_t &, const Int_t &, const Int_t &)
Definition: TEcnaRead.cc:1048
TVectorD ReadSampleSigmas(const Int_t &, const Int_t &, const Int_t &)
Definition: TEcnaRead.cc:1274
Int_t fSectSampSizeY
Definition: TEcnaRead.h:75
Int_t GetStexStinFromIndex(const Int_t &)
Definition: TEcnaRead.cc:3176
TString fStexName
Definition: TEcnaRead.h:62
TString fTTBELL
Definition: TEcnaRead.h:51
TVectorD ReadTotalNoise(const Int_t &)
Definition: TEcnaRead.cc:2433
void SetEcalSubDetector(const TString, const TEcnaNumbering *, const TEcnaWrite *)
Definition: TEcnaRead.cc:366
TVectorD ReadAveragedPedestals(const Int_t &)
Definition: TEcnaRead.cc:2768
TString GetStopDate()
Definition: TEcnaRead.cc:624
TEcnaParCout * fCnaParCout
Definition: TEcnaRead.h:53
void PrintNoComment()
Definition: TEcnaRead.cc:3299
TVectorD ReadPedestals(const Int_t &)
Definition: TEcnaRead.cc:2378
TString GetRootFileName()
Definition: TEcnaRead.cc:3167
TMatrixD ReadLowFrequencyCovariancesBetweenChannels(const Int_t &, const Int_t &, const Int_t &)
Definition: TEcnaRead.cc:1576
Bool_t DataExist()
Definition: TEcnaRead.cc:876
TEcnaParPaths * fCnaParPaths
Definition: TEcnaRead.h:54
Int_t fCdelete
Definition: TEcnaRead.h:49
void fCopy(const TEcnaRead &)
Definition: TEcnaRead.cc:414
TString GetAnalysisName()
Definition: TEcnaRead.cc:3188
TEcnaHeader * fFileHeader
Definition: TEcnaRead.h:56
TMatrixD ReadHighFrequencyCorrelationsBetweenChannels(const Int_t &, const Int_t &, const Int_t &)
Definition: TEcnaRead.cc:1784
TVectorD ReadMeanOfCorrelationsBetweenSamples(const Int_t &)
Definition: TEcnaRead.cc:2485
Int_t fNbSampByLine
Definition: TEcnaRead.h:79
void Init()
Definition: TEcnaRead.cc:309
TVectorD ReadHighFrequencyNoise(const Int_t &)
Definition: TEcnaRead.cc:2593
TMatrixD ReadNumberOfEventsForSamples(const Int_t &, const Int_t &, const Int_t &)
Definition: TEcnaRead.cc:973
Int_t GetReqNbOfEvts()
Definition: TEcnaRead.cc:3206
TEcnaParEcal * fEcal
Definition: TEcnaRead.h:58
Double_t *** ReadSampleValuesSameFile(const Int_t &, const Int_t &, const Int_t &)
Definition: TEcnaRead.cc:1104
Int_t fFlagPrint
Definition: TEcnaRead.h:83
TEcnaNumbering * fEcalNumbering
Definition: TEcnaRead.h:59
TString GetRunType()
Definition: TEcnaRead.cc:625
Bool_t fDataExist
Definition: TEcnaRead.h:88
TString fFlagSubDet
Definition: TEcnaRead.h:61
TMatrixD ReadCorrelationsBetweenSamples(const Int_t &, const Int_t &, const Int_t &)
Definition: TEcnaRead.cc:1466
TVectorD ReadAveragedNumberOfEvents(const Int_t &)
Definition: TEcnaRead.cc:2708
TVectorD ReadAveragedHighFrequencyNoise(const Int_t &)
Definition: TEcnaRead.cc:2933
Bool_t LookAtRootFile()
Definition: TEcnaRead.cc:675
TMatrixD ReadHighFrequencyCovariancesBetweenChannels(const Int_t &, const Int_t &, const Int_t &)
Definition: TEcnaRead.cc:1715
Bool_t CloseRootFile(const Text_t *)
Definition: TEcnaRead.cc:844
TVectorD ReadAveragedLowFrequencyNoise(const Int_t &)
Definition: TEcnaRead.cc:2878
virtual ~TEcnaRead()
Definition: TEcnaRead.cc:483
Bool_t fOpenRootFile
Definition: TEcnaRead.h:64
Int_t * fTagStinNumbers
Definition: TEcnaRead.h:70
Int_t fNbChanByLine
Definition: TEcnaRead.h:78
void PrintAllComments()
Definition: TEcnaRead.cc:3291
Int_t fCodePrintComments
Definition: TEcnaRead.h:84
Int_t fSectSampSizeX
Definition: TEcnaRead.h:75
TVectorD ReadSampleMeans(const Int_t &, const Int_t &, const Int_t &)
Definition: TEcnaRead.cc:1215
TString fStinName
Definition: TEcnaRead.h:62
Int_t fLookAtRootFile
Definition: TEcnaRead.h:67
Bool_t OpenRootFile(const Text_t *, TString)
Definition: TEcnaRead.cc:808
Int_t fSectChanSizeY
Definition: TEcnaRead.h:75
void PrintWarnings()
Definition: TEcnaRead.cc:3283
time_t GetStartTime()
Definition: TEcnaRead.cc:621
TVectorD ReadNumberOfEvents(const Int_t &)
Definition: TEcnaRead.cc:2338
void Adelete(const TString)
Definition: TEcnaRead.cc:403