]> git.uio.no Git - u/mrichter/AliRoot.git/blame - FMD/AliFMDPedestalDA.h
added mono-cathods removal in real Pb-Pb settings
[u/mrichter/AliRoot.git] / FMD / AliFMDPedestalDA.h
CommitLineData
178c5972 1#ifndef ALIFMDPEDESTALDA_H
2#define ALIFMDPEDESTALDA_H
3
4/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights
5 * reserved.
6 *
7 * See cxx source for full Copyright notice
8 */
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.
13
14
15#include "AliFMDBaseDA.h"
16#include "TH1.h"
17#include "TObjArray.h"
2a082c96 18class TH2;
178c5972 19
5cf05dbb 20class AliFMDPedestalDA: public AliFMDBaseDA
21{
22public:
23 /**
24 * Constructor.
25 *
26 */
27 AliFMDPedestalDA();
28 /**
29 * Copy constructor
30 *
31 * @param pedDA Object to copy from
32 */
33 AliFMDPedestalDA(const AliFMDPedestalDA & pedDA);
8e23c82d 34 /**
35 * Assignment operator
36 *
37 * @param pedDA Object to assign from
38 */
39 AliFMDPedestalDA& operator=(const AliFMDPedestalDA&) { return *this; }
5cf05dbb 40 /**
41 * Destructor
42 *
43 */
178c5972 44 virtual ~AliFMDPedestalDA();
5cf05dbb 45 /**
46 * Initialiser
47 *
48 */
178c5972 49 void Init();
50
5cf05dbb 51protected:
a31ea3ce 52 enum {
53 kPedestalOffset = 1,
54 kNoiseOffset = 2
55 };
5cf05dbb 56 /**
57 * Add a channel to the containers.
58 *
59 * @param sectorArray Array of sectors
60 * @param det Detector
61 * @param ring Ring
62 * @param sec Sector
63 * @param strip Strip
64 */
65 void AddChannelContainer(TObjArray* sectorArray, UShort_t det,
66 Char_t ring, UShort_t sec, UShort_t strip);
a31ea3ce 67 /**
68 * Add summary(s) for sectors
69 *
70 * @param secArray
71 * @param det
72 * @param ring
73 * @param sector
74 * @param nStrip
75 */
76 virtual void AddSectorSummary(TObjArray* secArray, UShort_t det,
77 Char_t ring, UShort_t sector,
78 UShort_t nStrip);
5cf05dbb 79 /**
80 * Fill ADC values from a digit into the corresponding histogram.
81 *
82 * @param digit Digit to fill ADC values for.
83 */
178c5972 84 void FillChannels(AliFMDDigit* digit);
5cf05dbb 85 /**
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.
88 *
89 * @param det Detector
90 * @param ring Ring
91 * @param sec Sector
92 * @param strip Strip.
2a082c96 93 * @param h Summary histogram with bins for sector and strip
5cf05dbb 94 */
178c5972 95 void Analyse(UShort_t det, Char_t ring, UShort_t sec, UShort_t strip);
5cf05dbb 96 /**
97 * Write headers to files.
98 *
99 */
178c5972 100 void WriteHeaderToFile();
5cf05dbb 101 /**
102 * Called at the end of an event.
103 *
104 */
178c5972 105 void FinishEvent() {}
5cf05dbb 106 /**
107 * Called at the end of a job. Fills in missing time-bins and
108 * closes output files
109 *
110 */
f7f0b643 111 void Terminate(TFile* );
5cf05dbb 112private:
113 /**
114 * Get the histogram corresponding to a strip sample.
115 *
116 * @param det Detector
117 * @param ring Ring
118 * @param sec Sector
119 * @param strip Strip
120 * @param sample Sample
121 *
122 * @return ADC spectra of a strip.
123 */
124 TH1S* GetChannel(UShort_t det, Char_t ring, UShort_t sec,
125 UShort_t strip, UInt_t sample);
a31ea3ce 126 /**
127 * Get the summary for a sector
128 *
129 * @param det Detector
130 * @param ring Ring
131 * @param sec Sector
132 * @param pedNotNoise Option
133 *
134 * @return histogram
135 */
136 TH1F* GetSectorSummary(UShort_t det, Char_t ring, UShort_t sec,
137 Bool_t pedNotNoise);
5cf05dbb 138 /**
139 * Calculate the hardware index
140 *
141 * @param ddl DDL number
142 * @param board Board number
143 * @param altro ALTRO number
144 * @param chan Channel number
145 *
146 * @return Index into hardware cache.
147 */
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);
151 /** Current strip */
45cffd06 152 Int_t fCurrentChannel; //The current channel
8e23c82d 153 /** Pedestal summary */
45cffd06 154 TH1F fPedSummary; //Summary of pedestals
5cf05dbb 155 /** Noise summary */
45cffd06 156 TH1F fNoiseSummary; //Summary of noises
5cf05dbb 157 /** Output file for zero-suppression for FMD1 */
45cffd06 158 std::ofstream fZSfileFMD1; //Stream for ZS FMD1
5cf05dbb 159 /** Output file for zero-suppression for FMD2 */
45cffd06 160 std::ofstream fZSfileFMD2; //Stream for ZS FMD2
5cf05dbb 161 /** Output file for zero-suppression for FMD3 */
45cffd06 162 std::ofstream fZSfileFMD3; //Stream for ZS FMD3
5cf05dbb 163 /** The minimum timebin seen for all channels */
45cffd06 164 TArrayS fMinTimebin; //minimum timebin
5cf05dbb 165 /** The maximum timebin seen for all channels */
45cffd06 166 TArrayS fMaxTimebin; //maximum timebin
5cf05dbb 167
2a082c96 168 void MakeSummary(UShort_t det, Char_t ring);
169
45cffd06 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
7bce699b 175
178c5972 176 ClassDef(AliFMDPedestalDA,0)
178c5972 177};
5cf05dbb 178
179inline Int_t
45cffd06 180AliFMDPedestalDA::HWIndex(UShort_t ddl, UShort_t b,
181 UShort_t a, UShort_t c) const
5cf05dbb 182{
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;
191 return idx;
192}
193
178c5972 194#endif
5cf05dbb 195//
196// Local Variables:
197// mode: C++
198// End:
199//