1 #ifndef ALIFMDPEDESTALDA_H
2 #define ALIFMDPEDESTALDA_H
4 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights
7 * See cxx source for full Copyright notice
9 // This class implements the pedestal detector algorithm (DA) for the FMD.
10 // It uses 51200 TH1S histograms to store the data for each channel of the FMD.
11 // The mean and standard deviation of a histogram define the pedestal and
12 // the noise for that channel.
15 #include "AliFMDBaseDA.h"
17 #include "TObjArray.h"
20 class AliFMDPedestalDA: public AliFMDBaseDA
23 typedef AliFMDBaseDA::Array Array;
33 * @param pedDA Object to copy from
35 AliFMDPedestalDA(const AliFMDPedestalDA & pedDA);
39 * @param pedDA Object to assign from
41 AliFMDPedestalDA& operator=(const AliFMDPedestalDA&) { return *this; }
46 virtual ~AliFMDPedestalDA();
48 * Open our output files
50 * The output files are named
58 * and existing files are rotated, or
61 * conditions_XXXXXXXXX.csv
66 * in case the run number is to be appended.
68 * @param appendRun if true, append run number (9 digits, zero
69 * padded) to the output file name(s).
71 * @return true on success
73 Bool_t OpenFiles(Bool_t appendRun=false);
86 * Add a channel to the containers.
88 * @param sectorArray Array of sectors
94 void AddChannelContainer(Array* sectorArray, UShort_t det,
95 Char_t ring, UShort_t sec, UShort_t strip);
97 * Add summary(s) for sectors
105 virtual void AddSectorSummary(Array* secArray, UShort_t det,
106 Char_t ring, UShort_t sector,
109 * Fill ADC values from a digit into the corresponding histogram.
111 * @param digit Digit to fill ADC values for.
113 void FillChannels(AliFMDDigit* digit);
115 * Analyse a strip. That is, compute the mean and spread of the ADC
116 * spectra for all strips. Also output on files the values.
118 * @param det Detector
121 * @param strip Strip.
122 * @param h Summary histogram with bins for sector and strip
124 void Analyse(UShort_t det, Char_t ring, UShort_t sec, UShort_t strip);
126 * Write headers to files.
129 void WriteHeaderToFile();
131 * Called at the end of an event.
134 void FinishEvent() {}
136 * Called at the end of a job. Fills in missing time-bins and
137 * closes output files
140 void Terminate(TFile* );
143 * Get the histogram corresponding to a strip sample.
145 * @param det Detector
149 * @param sample Sample
151 * @return ADC spectra of a strip.
153 TH1S* GetChannel(UShort_t det, Char_t ring, UShort_t sec,
154 UShort_t strip, UInt_t sample);
156 * Get the summary for a sector
158 * @param det Detector
161 * @param pedNotNoise Option
165 TH1F* GetSectorSummary(UShort_t det, Char_t ring, UShort_t sec,
168 * Calculate the hardware index
170 * @param ddl DDL number
171 * @param board Board number
172 * @param altro ALTRO number
173 * @param chan Channel number
175 * @return Index into hardware cache.
177 Int_t HWIndex(UShort_t ddl, UShort_t board, UShort_t altro,
178 UShort_t chan) const;
179 void FillinTimebins(std::ofstream& out, UShort_t ddl);
181 Int_t fCurrentChannel; //The current channel
182 /** Pedestal summary */
183 TH1F fPedSummary; //Summary of pedestals
185 TH1F fNoiseSummary; //Summary of noises
186 /** Output file for zero-suppression for FMD1 */
187 std::ofstream fZSfileFMD1; //Stream for ZS FMD1
188 /** Output file for zero-suppression for FMD2 */
189 std::ofstream fZSfileFMD2; //Stream for ZS FMD2
190 /** Output file for zero-suppression for FMD3 */
191 std::ofstream fZSfileFMD3; //Stream for ZS FMD3
192 /** The minimum timebin seen for all channels */
193 TArrayS fMinTimebin; //minimum timebin
194 /** The maximum timebin seen for all channels */
195 TArrayS fMaxTimebin; //maximum timebin
197 void MakeSummary(UShort_t det, Char_t ring);
199 TH2* fSummaryFMD1i; //Summary of FMD1
200 TH2* fSummaryFMD2i; //Summary of FMD2I
201 TH2* fSummaryFMD2o; //Summary of FMD2O
202 TH2* fSummaryFMD3i; //Summary of FMD3I
203 TH2* fSummaryFMD3o; //Summary of FMD3O
205 ClassDef(AliFMDPedestalDA,0)
209 AliFMDPedestalDA::HWIndex(UShort_t ddl, UShort_t b,
210 UShort_t a, UShort_t c) const
212 // Save some array entries
213 UShort_t lb = (b > 1 ? b-16+2 : b);
214 const Int_t kNDDL = 3;
215 const Int_t kNBoard = 4;
216 const Int_t kNAltro = 3;
217 const Int_t kNChannel = 16;
218 Int_t idx = c + kNChannel * (a + kNAltro * (lb + kNBoard * ddl));
219 if (idx > kNDDL * kNBoard * kNAltro * kNChannel) return -1;