]>
Commit | Line | Data |
---|---|---|
356c3e0c | 1 | #ifndef ALICALOCALIBPEDESTAL_H |
2 | #define ALICALOCALIBPEDESTAL_H | |
3 | ||
a235e2bc | 4 | /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * |
5 | * See cxx source for full Copyright notice */ | |
356c3e0c | 6 | |
a235e2bc | 7 | /* $Id$ */ |
8 | ||
9 | ||
10 | // \file AliCaloCalibPedestal.h | |
11 | // \brief Description: | |
12 | // A help class for monitoring and calibration tools: MOOD, AMORE etc., | |
13 | // that can process events from a standard AliCaloRawStream, | |
14 | // most usually from LED/pulser runs. It stores signal info as | |
15 | // typical (highest) amplitude, and pedestal info in geometrically-binned | |
16 | // 2D profiles of the detectors (EMCAL and PHOS). | |
17 | // Comparisons (ratios and differences) can be done with references. | |
18 | ||
19 | // \author: Timo Alho (Jyvaskyla), original version. | |
20 | // [Consultant: D. Silvermyr (ORNL)] | |
21 | // Partly based on AliTPCCalibPedestal. | |
22 | // | |
23 | // \version $Revision$ | |
24 | // \date $Date$ | |
356c3e0c | 25 | |
26 | #include "TProfile2D.h" | |
27 | #include "TH2.h" | |
28 | #include "TObjArray.h" | |
a235e2bc | 29 | class AliCaloRawStream; |
f4fc542c | 30 | class AliCaloAltroMapping; |
31 | class AliRawReader; | |
356c3e0c | 32 | |
33 | class AliCaloCalibPedestal : public TObject { | |
34 | ||
35 | public: | |
36 | ||
37 | enum kDetType {kPhos, kEmCal, kNone};//The detector types | |
38 | enum kDeadMapEntry{kAlive = 0, kDead, kResurrected, kRecentlyDeceased, kNumDeadMapStates};//The entries being put to the deadmap | |
39 | ||
40 | AliCaloCalibPedestal(kDetType detectorType = kPhos); | |
41 | virtual ~AliCaloCalibPedestal(); | |
42 | ||
43 | // copy ctor, and '=' operator, are not fully tested/debugged yet | |
44 | // at least for now; the reference info is not copied from one to the other | |
45 | AliCaloCalibPedestal(const AliCaloCalibPedestal &ped); | |
46 | AliCaloCalibPedestal& operator = (const AliCaloCalibPedestal &source); | |
47 | ||
48 | //Functions to ask for the constants (in case a GUI needs them, for an example | |
abad76ae | 49 | int GetSampleMax() const {return fgkSampleMax;}; |
50 | int GetSampleMin() const {return fgkSampleMin;}; | |
f4fc542c | 51 | |
52 | // Event processing methods: | |
53 | Bool_t ProcessEvent(AliRawReader *rawReader); | |
356c3e0c | 54 | Bool_t ProcessEvent(AliCaloRawStream *in); |
55 | ||
f4fc542c | 56 | // Mapping handling |
57 | AliCaloAltroMapping **GetAltroMapping() { return fMapping; }; | |
58 | void SetAltroMapping(AliCaloAltroMapping **mapp) { fMapping = mapp; }; | |
59 | ||
356c3e0c | 60 | //////////////////////////// |
61 | //Simple getters | |
62 | // Main profiles: | |
63 | TProfile2D * GetPedProfileLowGain(int i) const {return (TProfile2D*)fPedestalLowGain[i];}; // Return a pointer to the low-gain pedestal profile | |
64 | TProfile2D * GetPedProfileHighGain(int i) const {return (TProfile2D*)fPedestalHighGain[i];}; // Return a pointer to the high-gain pedestal profile | |
18db89b7 | 65 | TProfile2D * GetSampleProfileLowGain(int i) const {return (TProfile2D*)fSampleLowGain[i];}; // Return a pointer to the low-gain profile of all samples |
66 | TProfile2D * GetSampleProfileHighGain(int i) const {return (TProfile2D*)fSampleHighGain[i];}; // Return a pointer to the high-gain profile of all samples | |
356c3e0c | 67 | TProfile2D * GetPeakProfileLowGain(int i) const {return (TProfile2D*)fPeakMinusPedLowGain[i];}; // Return a pointer to the low-gain pedestal profile |
68 | TProfile2D * GetPeakProfileHighGain(int i) const {return (TProfile2D*)fPeakMinusPedHighGain[i];}; // Return a pointer to the high-gain pedestal profile | |
69 | ||
70 | // Differences to references: | |
71 | TProfile2D * GetPedProfileLowGainDiff(int i){ValidateComparisonProfiles(); return (TProfile2D*)fPedestalLowGainDiff[i];}; // Return a pointer to the low-gain pedestal profile difference | |
72 | TProfile2D * GetPedProfileHighGainDiff(int i){ValidateComparisonProfiles(); return (TProfile2D*)fPedestalHighGainDiff[i];}; // Return a pointer to the high-gain pedestal profile difference | |
73 | TProfile2D * GetPeakProfileLowGainDiff(int i){ValidateComparisonProfiles(); return (TProfile2D*)fPeakMinusPedLowGainDiff[i];}; // Return a pointer to the low-gain pedestal profile difference | |
74 | TProfile2D * GetPeakProfileHighGainDiff(int i){ValidateComparisonProfiles(); return (TProfile2D*)fPeakMinusPedHighGainDiff[i];}; // Return a pointer to the high-gain pedestal profile difference | |
75 | ||
76 | // Ratio to references: | |
77 | TProfile2D * GetPedProfileLowGainRatio(int i){ValidateComparisonProfiles(); return (TProfile2D*)fPedestalLowGainRatio[i];}; // Return a pointer to the low-gain pedestal profile ratio | |
78 | TProfile2D * GetPedProfileHighGainRatio(int i){ValidateComparisonProfiles(); return (TProfile2D*)fPedestalHighGainRatio[i];}; // Return a pointer to the high-gain pedestal profile ratio | |
79 | TProfile2D * GetPeakProfileLowGainRatio(int i){ValidateComparisonProfiles(); return (TProfile2D*)fPeakMinusPedLowGainRatio[i];}; // Return a pointer to the low-gain pedestal profile ratio | |
80 | TProfile2D * GetPeakProfileHighGainRatio(int i){ValidateComparisonProfiles(); return (TProfile2D*)fPeakMinusPedHighGainRatio[i];}; // Return a pointer to the high-gain pedestal profile ratio | |
81 | ||
82 | TH2D * GetDeadMap(int i) const {return (TH2D*)fDeadMap[i];}; | |
83 | ||
84 | // Basic info: getters | |
85 | kDetType GetDetectorType() const {return fDetType;};//Returns if this is a PHOS or EMCAL object | |
f4fc542c | 86 | TString GetCaloString() const {return fCaloString;}; //Returns if this is a PHOS or EMCAL object |
356c3e0c | 87 | |
88 | int GetColumns() const {return fColumns;}; //The number of columns per module | |
89 | int GetRows() const {return fRows;}; //The number of rows per module | |
90 | int GetModules() const {return fModules;}; //The number of modules | |
18db89b7 | 91 | int GetRowMin() const {return fRowMin;}; //for histo def. |
92 | int GetRowMax() const {return fRowMax;}; //for histo def. | |
93 | int GetRowMultiplier() const {return fRowMultiplier;}; //for histo filling | |
356c3e0c | 94 | |
95 | // RunNumbers : setters and getters | |
96 | void SetRunNumber(int runNo) {fRunNumber = runNo;}; | |
97 | int GetRunNumber() const {return fRunNumber;}; | |
98 | int GetRefRunNumber() const {if (fReference) return fReference->GetRunNumber(); else return -1;}; | |
419341ea | 99 | |
100 | // Basic counters | |
101 | int GetNEvents() const {return fNEvents;}; | |
102 | int GetNChanFills() const {return fNChanFills;}; | |
356c3e0c | 103 | |
104 | ///////////////////////////// | |
105 | //Analysis functions | |
106 | int GetDeadTowerCount() const {return fDeadTowers;};//Returns the number of dead towers, by counting the bins in peak-pedestal smaller than threshold | |
107 | double GetDeadTowerRatio() const {return fDeadTowers/(double)(fRows*fColumns);}; //returns the percentage of dead towers, relative to a full module | |
108 | int GetDeadTowerNew() const {return fNewDeadTowers;}; //return the new dead towers compared to the reference | |
109 | int GetDeadTowerResurrected() const {return fResurrectedTowers;}; //The the towers resurrected since the reference run | |
419341ea | 110 | |
356c3e0c | 111 | void Reset();//Resets the whole class. |
419341ea | 112 | Bool_t AddInfo(const AliCaloCalibPedestal *ped);//picks up new info from supplied argument |
356c3e0c | 113 | |
114 | ////////////////////////////////////////////////////// | |
115 | //Functions related to comparing this with another (reference) run. | |
116 | Bool_t LoadReferenceCalib(TString fileName, TString objectName); //Loads another AliCaloCalibPedestal by name "objectName" from the file "fileName", for reference | |
117 | void ComputeDiffAndRatio();//Actually computes the difference and ratio into the histo's in memory | |
118 | AliCaloCalibPedestal * GetReference() const {return fReference;}; //Get the reference object. Needed for debug, will probably be removed later | |
119 | void ComputeDeadTowers(int threshold = 5, const char * deadMapFile = 0);//Computes the dead tower values | |
120 | ||
121 | ||
122 | //Saving functions | |
123 | Bool_t SaveHistograms(TString fileName, Bool_t saveEmptyHistos = kFALSE); //Saves the histograms to a .root file | |
124 | ||
125 | private: | |
126 | ||
127 | void ValidateComparisonProfiles(); //Makes sure that fPe..Diff and fPe..Ratio profiles exist | |
128 | ||
129 | //The histograms. We use a TObjArray instead of a simple array,because this gives automatic streaming properties for the | |
130 | //class. A TClonesArray would be more efficient, but it's a bit more difficult to use and it doesn't matter too much | |
131 | //since we have only around 12 objects (maximum) in the array anyway. | |
a235e2bc | 132 | TObjArray fPedestalLowGain; // pedestal info for low gain |
133 | TObjArray fPedestalHighGain; // pedestal info for high gain | |
18db89b7 | 134 | TObjArray fSampleLowGain; // all sample info for low gain |
135 | TObjArray fSampleHighGain; // all sample info for high gain | |
a235e2bc | 136 | TObjArray fPeakMinusPedLowGain; // (peak-pedestal) info for low gain |
137 | TObjArray fPeakMinusPedHighGain; // (peak-pedestal) info for high gain | |
356c3e0c | 138 | |
139 | //The difference of profiles between this and the reference object | |
140 | TObjArray fPedestalLowGainDiff; //! | |
141 | TObjArray fPedestalHighGainDiff; //! | |
142 | TObjArray fPeakMinusPedLowGainDiff; //! | |
143 | TObjArray fPeakMinusPedHighGainDiff; //! | |
144 | ||
145 | //The ratio of profiles between this and the reference object | |
146 | TObjArray fPedestalLowGainRatio; //! | |
147 | TObjArray fPedestalHighGainRatio; //! | |
148 | TObjArray fPeakMinusPedLowGainRatio; //! | |
149 | TObjArray fPeakMinusPedHighGainRatio; //! | |
150 | ||
151 | TObjArray fDeadMap;//The deadmap | |
419341ea | 152 | |
153 | // status counters | |
154 | int fNEvents; //# total events processed, | |
155 | int fNChanFills; //# total channel fills (NChan * NEvents if not zero-suppressed) | |
156 | ||
356c3e0c | 157 | //The dead tower counts |
158 | int fDeadTowers; //! | |
159 | int fNewDeadTowers; //! Towers that have died since the reference run | |
160 | int fResurrectedTowers; //! Towers that have been resurrected from the dead, compared to the reference | |
161 | ||
162 | AliCaloCalibPedestal * fReference; //! A reference object, for comparing the accumulated results to a previous run | |
163 | ||
164 | kDetType fDetType; //The detector type for this object | |
165 | int fColumns; //The number of columns per module | |
166 | int fRows; //The number of rows per module | |
167 | int fModules; //The number of modules | |
18db89b7 | 168 | int fRowMin; // Mimimum Row number |
169 | int fRowMax; // Maximum now number | |
170 | int fRowMultiplier; // Multiplication factor to get proper row range between PHOS and EMCAL | |
f4fc542c | 171 | TString fCaloString; // id for which detector type we have |
172 | AliCaloAltroMapping **fMapping; //! Altro Mapping object | |
356c3e0c | 173 | int fRunNumber; //The run number. Needs to be set by the user. |
f4fc542c | 174 | |
356c3e0c | 175 | //Constants needed by the class |
a235e2bc | 176 | static const int fgkSampleMax = 1023; // highest possible sample value (10-bit = 0x3ff) |
177 | static const int fgkSampleMin = 0; // lowest possible sample value | |
356c3e0c | 178 | |
a235e2bc | 179 | static const int fgkPhosRows = 64; // number of rows per module for PHOS |
180 | static const int fgkPhosCols = 56; // number of columns per module for PHOS | |
181 | static const int fgkPhosModules = 5; // number of modules for PHOS | |
356c3e0c | 182 | |
a235e2bc | 183 | static const int fgkEmCalRows = 24; // number of rows per module for EMCAL |
184 | static const int fgkEmCalCols = 48; // number of columns per module for EMCAL | |
185 | static const int fgkEmCalModules = 12; // number of modules for EMCAL | |
356c3e0c | 186 | |
18db89b7 | 187 | ClassDef(AliCaloCalibPedestal,2) |
356c3e0c | 188 | |
189 | }; | |
190 | ||
191 | #endif |