AliRoot Core  edcc906 (edcc906)
AliCaloCalibSignal.h
Go to the documentation of this file.
1 #ifndef ALICALOCALIBSIGNAL_H
2 #define ALICALOCALIBSIGNAL_H
3 
4 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5  * See cxx source for full Copyright notice */
6 
7 //________________________________________________________________________
33 //________________________________________________________________________
34 
35 #include "TString.h"
36 #include "TTree.h"
37 #include "AliEMCALGeoParams.h"
38 
39 class AliCaloRawStreamV3;
40 class AliCaloAltroMapping;
41 class AliRawReader;
42 class AliCaloRawAnalyzer;
43 
44 class AliCaloCalibSignal : public TObject
45 {
46 
47  public:
48 
51 
52  AliCaloCalibSignal(kDetType detectorType = kEmCal); // ctor
53  virtual ~AliCaloCalibSignal(); // dtor
54 
55 private:
56 
57  // Just declare them, avoid compilation warning
58  AliCaloCalibSignal (const AliCaloCalibSignal & /*sig*/ ); // copy ctor
59  AliCaloCalibSignal& operator = (const AliCaloCalibSignal &/*source*/); // assing operator
60 
61 public:
62 
63  // Event processing methods:
64  Bool_t ProcessEvent(AliRawReader *rawReader);
65  Bool_t ProcessEvent(AliCaloRawStreamV3 *in, UInt_t Timestamp); // added header for time info
66 
67  Bool_t CheckFractionAboveAmp(const int *AmpVal, int resultArray[]) const;
68  Bool_t CheckLEDRefAboveAmp (const int *AmpVal, int resultArray[]) const;
69 
70  // Mapping handling
71  AliCaloAltroMapping **GetAltroMapping() const { return fMapping; }
72  void SetAltroMapping(AliCaloAltroMapping **mapp) { fMapping = mapp; }
73 
74  // Fitter / Analyzer
75  Int_t GetFittingAlgorithm() const { return fFittingAlgorithm ; }
76  void SetFittingAlgorithm(Int_t val) ;
78 
79  // Parameter/cut handling
80  void SetParametersFromFile(const char *parameterFile);
81  void WriteParametersToFile(const char *parameterFile);
82 
84  // Simple getters
85  // * for TTree
86  TTree * GetTreeAmpVsTime() const { return fTreeAmpVsTime ; }
87  TTree * GetTreeAvgAmpVsTime() const { return fTreeAvgAmpVsTime ; }
88  TTree * GetTreeLEDAmpVsTime() const { return fTreeLEDAmpVsTime ; }
89  TTree * GetTreeLEDAvgAmpVsTime() const { return fTreeLEDAvgAmpVsTime; }
90 
91  // how many points do we have for each tower&gain
92  int GetNHighGain(int imod, int icol, int irow) const
93  { int towId = GetTowerNum(imod, icol, irow); return fNHighGain[towId] ; }
94  int GetNLowGain (int imod, int icol, int irow) const
95  { int towId = GetTowerNum(imod, icol, irow); return fNLowGain [towId] ; }
96 
97  int GetNHighGain(int towId) const { return fNHighGain[towId] ; }
98  int GetNLowGain (int towId) const { return fNLowGain [towId] ; }
99 
100  // also for LED reference
101  int GetNRef(const int imod, const int istripMod, const int igain) const
102  { int refId = GetRefNum(imod, istripMod, igain); return fNRef[refId] ; }
103  int GetNRef(int refId) const { return fNRef[refId] ; }
104 
105  // Basic info: getters
107  kDetType GetDetectorType() const { return fDetType ; }
109  TString GetCaloString() const { return fCaloString ; }
110 
111  int GetColumns() const {return fColumns ; } // The number of columns per module
112  int GetRows() const {return fRows ; } // The number of rows per module
113  int GetLEDRefs() const {return fLEDRefs ; } // The number of LED references/monitors per module
114  int GetModules() const {return fModules ; } // The number of modules
115 
116  int GetTowerNum(const int imod, const int icol, const int irow) const
117  { return (imod*fColumns*fRows + icol*fRows + irow) ; } // help index
118 
120  int GetChannelNum(const int imod, const int icol, const int irow, const int igain) const
121  { return (igain*fModules*fColumns*fRows + imod*fColumns*fRows + icol*fRows + irow) ; }
122 
123  Bool_t DecodeChannelNum(const int chanId,
124  int *imod, int *icol, int *irow, int *igain) const;
125 
126  // LED reference indexing
127 
129  int GetRefNum(const int imod, const int istripMod, const int igain) const
130  { return (igain*fModules*fLEDRefs + imod*fLEDRefs + istripMod) ; }
131 
132  Bool_t DecodeRefNum(const int refId,
133  int *imod, int *istripMod, int *igain) const;
134 
135  // Basic Counters
136  int GetNEvents() const { return fNEvents ; }
137  int GetNAcceptedEvents() const { return fNAcceptedEvents ; }
138 
140  // Get and Set Cuts
141 
142  // * Section for if we should help with the event selection of what is likely LED events
143  void SetAmpCut(double d) { fAmpCut = d ; }
144  double GetAmpCut() const { return fAmpCut ; }
145 
148 
151 
152  // * also for LED Reference/Mon channels
153  void SetAmpCutLEDRef(double d) { fAmpCutLEDRef = d ; }
154  double GetAmpCutLEDRef() const { return fAmpCutLEDRef ; }
155 
158 
159  // * We may select to get averaged info
160  void SetUseAverage(bool b) { fUseAverage = b ; }
161  bool GetUseAverage() const { return fUseAverage ; }
162 
164  void SetSecInAverage(int secInAverage) { fSecInAverage = secInAverage ; }
165  int GetSecInAverage() const { return fSecInAverage ; }
166 
167  void SetDownscale(int i) { fDownscale = i ; }
168  int GetDownscale() const { return fDownscale ; }
169 
170  // * Info on time since start of run
171  // These times are typically the same, but not necessarily if the events do not come in order
172  // Could be useful when we know the length of the run (i.e. after it is over), e.g. for PreProcessor
173  double GetHour() const { return fHour ; } // time info for current event
174  double GetCurrentHour() const { return fHour ; } // time info for current event (same as GetHour(), just more explicitly named)
175  double GetLatestHour() const { return fLatestHour ; } // the latest time encountered
176  void SetLatestHour(double d) { fLatestHour = d ; }
177 
178  // * RunNumbers : setters and getters
179  void SetRunNumber(int runNo) { fRunNumber = runNo ; }
180  int GetRunNumber() const { return fRunNumber ; }
181 
182  // * Start-of-run timestamp : set and get
184  int GetStartTime() const { return fStartTime ; }
185 
187  // Analysis functions
188 
189  void ResetInfo();
190  Bool_t AddInfo(const AliCaloCalibSignal *sig);
191 
192  // Saving functions
193  Bool_t Save(TString fileName);
194  Bool_t Analyze();
195 
196  private:
197 
198  void DeleteTrees();
199  void Zero();
200  void CreateTrees();
201 
202  private:
203 
205  int fColumns;
206  int fRows;
207  int fLEDRefs;
208  int fModules;
209 
210  TString fCaloString;
211  AliCaloAltroMapping **fMapping;
212 
215 
218 
219  double fAmpCut;
222 
223  double fAmpCutLEDRef;
225 
226  double fHour;
227  double fLatestHour;
228  bool fUseAverage;
230 
232 
233  // status counters
234  int fNEvents;
236 
237  // Constants needed by the class: EMCAL ones are kept in AliEMCALGeoParams.h
238  static const int fgkPhosRows = 64;
239  static const int fgkPhosCols = 56;
240  static const int fgkPhosLEDRefs = 0;
241  static const int fgkPhosModules = 5;
242 
243  // From numbers above: EMCal+DCal has more possible towers than PHOS
244  static const int fgkMaxTowers = 23040;
245 
246  // for LED references; maximum from EMCAL
247  static const int fgkMaxRefs = 480;
248 
249  static const int fgkNumSecInHr = 3600;
250 
251  // trees
252  TTree * fTreeAmpVsTime;
256 
257  // counters
260  int fNRef [fgkMaxRefs * 2];
261 
263  ClassDef(AliCaloCalibSignal, 9) ;
265 
266 };
267 
268 #endif // ALICALOCALIBSIGNAL_H
kDetType fDetType
The detector type for this object.
TBrowser b
Definition: RunAnaESD.C:12
int fNAcceptedEvents
Number of events accepted.
void SetAmpCut(double d)
Bool_t ProcessEvent(AliRawReader *rawReader)
int GetNLowGain(int imod, int icol, int irow) const
Bool_t CheckLEDRefAboveAmp(const int *AmpVal, int resultArray[]) const
Base class for extraction of signal amplitude and peak position.
static const int fgkMaxTowers
AliEMCALGeoParams::fgkEMCALModules * AliEMCALGeoParams::fgkEMCALCols * AliEMCALGeoParams::fgkEMCALRow...
int fStartTime
Time of first event.
int fNHighGain[fgkMaxTowers]
Number of Amp. vs. Time readings per tower.
double GetAmpCut() const
void ResetInfo()
Reset trees and counters.
void SetRunNumber(int runNo)
bool GetUseAverage() const
void CreateTrees()
Create/initialize/setup the TTrees.
TTree * GetTreeLEDAmpVsTime() const
kDetType
The detector types (add common enum as in AliCalibPedestal?)
int GetChannelNum(const int imod, const int icol, const int irow, const int igain) const
static const int fgkPhosRows
Number of rows per module for PHOS.
int GetNHighGain(int towId) const
int fDownscale
To select 1 out every N (fDownscale) events.
bool fReqFractionAboveAmp
Flag to select if we should do some event selection based on amplitudes.
int fNEvents
Number of events processed.
AliCaloRawAnalyzer * fRawAnalyzer
! e.g. for sample selection for fits
void SetStartTime(int startTime)
kDetType GetDetectorType() const
AliCaloAltroMapping ** fMapping
! Altro Mapping object
void SetUseAverage(bool b)
double GetHour() const
double fLatestHour
Largest fraction of hour since beginning of run, for amp vs. time graphs.
static const int fgkPhosCols
Number of columns per module for PHOS.
class for signal monitoring and calibration tools
Bool_t DecodeChannelNum(const int chanId, int *imod, int *icol, int *irow, int *igain) const
Output with the module, column, row, and gain for a given channel number.
bool GetReqFractionAboveAmp() const
Int_t GetFittingAlgorithm() const
double GetCurrentHour() const
void SetFittingAlgorithm(Int_t val)
int fRows
The number of rows per module.
int fRunNumber
The run number. Needs to be set by the user.
void SetParametersFromFile(const char *parameterFile)
TString GetCaloString() const
double fReqFractionAboveAmpCutVal
Required fraction that should be above cut.
void DeleteTrees()
Delete old objects and set pointers, what was created in the constructor (TTrees) ...
TString fileName(const char *dir, int runNumber, const char *da, int i, const char *type)
int fLEDRefs
The number of LED references/monitors per module.
TTree * fTreeAvgAmpVsTime
Store channel, gain, amp, and time info, for averages.
Bool_t DecodeRefNum(const int refId, int *imod, int *istripMod, int *igain) const
Output with the module, stripModule, and gain for a given reference number.
void SetAmpCutLEDRef(double d)
double GetReqFractionAboveAmpCutVal() const
TTree * fTreeAmpVsTime
Store channel, gain, amp, and time info.
TString fCaloString
ID for which detector type we have.
AliCaloAltroMapping ** GetAltroMapping() const
double fAmpCut
Amplitude cut value.
void SetAltroMapping(AliCaloAltroMapping **mapp)
void SetReqLEDRefAboveAmpCutVal(bool b)
double fHour
Fraction of hour since beginning of run, for amp vs. time graphs, for current event.
void SetReqFractionAboveAmp(bool b)
int GetRefNum(const int imod, const int istripMod, const int igain) const
int fNRef[fgkMaxRefs *2]
Number of Amp. vs. Time readings per tower, for LED refs; *2 for both gains.
TTimeStamp startTime(2009, 8, 7, 0, 0, 0)
void Zero()
Set all counters to 0; not cuts etc. though.
void SetReqFractionAboveAmpCutVal(double d)
AliCaloCalibSignal(kDetType detectorType=kEmCal)
int GetNRef(int refId) const
TTree * fTreeLEDAmpVsTime
Store channel, gain, amp, and time info, for LED reference.
AliCaloRawAnalyzer * GetRawAnalyzer() const
bool GetReqLEDRefAboveAmpCutVal() const
void WriteParametersToFile(const char *parameterFile)
Write parameters to file.
void SetSecInAverage(int secInAverage)
set length of the interval that should be used for the average calculation (determines number of bins...
int GetSecInAverage() const
int GetTowerNum(const int imod, const int icol, const int irow) const
int fNLowGain[fgkMaxTowers]
Number of Amp. vs. Time readings per tower, for low gain.
TTree * GetTreeAvgAmpVsTime() const
int GetNLowGain(int towId) const
Bool_t AddInfo(const AliCaloCalibSignal *sig)
int GetNRef(const int imod, const int istripMod, const int igain) const
int fColumns
The number of columns per module.
double fAmpCutLEDRef
Amplitude cut value for LED reference.
int fSecInAverage
Time interval for the graph averaging.
double GetLatestHour() const
AliCaloCalibSignal & operator=(const AliCaloCalibSignal &)
static const int fgkPhosModules
Number of modules for PHOS.
static const int fgkNumSecInHr
Number of seconds in an hour, for the fractional hour conversion on the time graph.
TTree * GetTreeAmpVsTime() const
virtual ~AliCaloCalibSignal()
Destructor.
Bool_t CheckFractionAboveAmp(const int *AmpVal, int resultArray[]) const
bool fReqLEDRefAboveAmpCutVal
Flag to select if we should require that signal is also seen in LED Reference/Monitoring channel...
static const int fgkPhosLEDRefs
No LED monitor channels for PHOS.
int GetNAcceptedEvents() const
void SetLatestHour(double d)
TTree * GetTreeLEDAvgAmpVsTime() const
Bool_t Save(TString fileName)
int fModules
The number of modules.
Int_t fFittingAlgorithm
Select the fitting algorithm.
TTree * fTreeLEDAvgAmpVsTime
Store channel, gain, amp, and time info, for LED reference - averages.
double GetAmpCutLEDRef() const
int GetNHighGain(int imod, int icol, int irow) const
bool fUseAverage
Flag to average graph points into over a time interval.
static const int fgkMaxRefs
AliEMCALGeoParams::fgkEMCALModules * AliEMCALGeoParams::fgkEMCALLEDRefs;.