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
31 * @param pedDA Object to copy from
33 AliFMDPedestalDA(const AliFMDPedestalDA & pedDA);
37 * @param pedDA Object to assign from
39 AliFMDPedestalDA& operator=(const AliFMDPedestalDA&) { return *this; }
44 virtual ~AliFMDPedestalDA();
57 * Add a channel to the containers.
59 * @param sectorArray Array of sectors
65 void AddChannelContainer(TObjArray* sectorArray, UShort_t det,
66 Char_t ring, UShort_t sec, UShort_t strip);
68 * Add summary(s) for sectors
76 virtual void AddSectorSummary(TObjArray* secArray, UShort_t det,
77 Char_t ring, UShort_t sector,
80 * Fill ADC values from a digit into the corresponding histogram.
82 * @param digit Digit to fill ADC values for.
84 void FillChannels(AliFMDDigit* digit);
86 * Analyse a strip. That is, compute the mean and spread of the ADC
87 * spectra for all strips. Also output on files the values.
93 * @param h Summary histogram with bins for sector and strip
95 void Analyse(UShort_t det, Char_t ring, UShort_t sec, UShort_t strip);
97 * Write headers to files.
100 void WriteHeaderToFile();
102 * Called at the end of an event.
105 void FinishEvent() {}
107 * Called at the end of a job. Fills in missing time-bins and
108 * closes output files
111 void Terminate(TFile* );
114 * Get the histogram corresponding to a strip sample.
116 * @param det Detector
120 * @param sample Sample
122 * @return ADC spectra of a strip.
124 TH1S* GetChannel(UShort_t det, Char_t ring, UShort_t sec,
125 UShort_t strip, UInt_t sample);
127 * Get the summary for a sector
129 * @param det Detector
132 * @param pedNotNoise Option
136 TH1F* GetSectorSummary(UShort_t det, Char_t ring, UShort_t sec,
139 * Calculate the hardware index
141 * @param ddl DDL number
142 * @param board Board number
143 * @param altro ALTRO number
144 * @param chan Channel number
146 * @return Index into hardware cache.
148 Int_t HWIndex(UShort_t ddl, UShort_t board, UShort_t altro,
149 UShort_t chan) const;
150 void FillinTimebins(std::ofstream& out, UShort_t ddl);
152 Int_t fCurrentChannel; //The current channel
153 /** Pedestal summary */
154 TH1F fPedSummary; //Summary of pedestals
156 TH1F fNoiseSummary; //Summary of noises
157 /** Output file for zero-suppression for FMD1 */
158 std::ofstream fZSfileFMD1; //Stream for ZS FMD1
159 /** Output file for zero-suppression for FMD2 */
160 std::ofstream fZSfileFMD2; //Stream for ZS FMD2
161 /** Output file for zero-suppression for FMD3 */
162 std::ofstream fZSfileFMD3; //Stream for ZS FMD3
163 /** The minimum timebin seen for all channels */
164 TArrayS fMinTimebin; //minimum timebin
165 /** The maximum timebin seen for all channels */
166 TArrayS fMaxTimebin; //maximum timebin
168 void MakeSummary(UShort_t det, Char_t ring);
170 TH2* fSummaryFMD1i; //Summary of FMD1
171 TH2* fSummaryFMD2i; //Summary of FMD2I
172 TH2* fSummaryFMD2o; //Summary of FMD2O
173 TH2* fSummaryFMD3i; //Summary of FMD3I
174 TH2* fSummaryFMD3o; //Summary of FMD3O
176 ClassDef(AliFMDPedestalDA,0)
180 AliFMDPedestalDA::HWIndex(UShort_t ddl, UShort_t b,
181 UShort_t a, UShort_t c) const
183 // Save some array entries
184 UShort_t lb = (b > 1 ? b-16+2 : b);
185 const Int_t kNDDL = 3;
186 const Int_t kNBoard = 4;
187 const Int_t kNAltro = 3;
188 const Int_t kNChannel = 16;
189 Int_t idx = c + kNChannel * (a + kNAltro * (lb + kNBoard * ddl));
190 if (idx > kNDDL * kNBoard * kNAltro * kNChannel) return -1;