]> git.uio.no Git - u/mrichter/AliRoot.git/blame - FMD/AliFMDPedestalDA.h
Adding a reminder for coders
[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:
52 /**
53 * Add a channel to the containers.
54 *
55 * @param sectorArray Array of sectors
56 * @param det Detector
57 * @param ring Ring
58 * @param sec Sector
59 * @param strip Strip
60 */
61 void AddChannelContainer(TObjArray* sectorArray, UShort_t det,
62 Char_t ring, UShort_t sec, UShort_t strip);
63 /**
64 * Fill ADC values from a digit into the corresponding histogram.
65 *
66 * @param digit Digit to fill ADC values for.
67 */
178c5972 68 void FillChannels(AliFMDDigit* digit);
5cf05dbb 69 /**
70 * Analyse a strip. That is, compute the mean and spread of the ADC
71 * spectra for all strips. Also output on files the values.
72 *
73 * @param det Detector
74 * @param ring Ring
75 * @param sec Sector
76 * @param strip Strip.
2a082c96 77 * @param h Summary histogram with bins for sector and strip
5cf05dbb 78 */
178c5972 79 void Analyse(UShort_t det, Char_t ring, UShort_t sec, UShort_t strip);
5cf05dbb 80 /**
81 * Write headers to files.
82 *
83 */
178c5972 84 void WriteHeaderToFile();
5cf05dbb 85 /**
86 * Called at the end of an event.
87 *
88 */
178c5972 89 void FinishEvent() {}
5cf05dbb 90 /**
91 * Called at the end of a job. Fills in missing time-bins and
92 * closes output files
93 *
94 */
f7f0b643 95 void Terminate(TFile* );
5cf05dbb 96private:
97 /**
98 * Get the histogram corresponding to a strip sample.
99 *
100 * @param det Detector
101 * @param ring Ring
102 * @param sec Sector
103 * @param strip Strip
104 * @param sample Sample
105 *
106 * @return ADC spectra of a strip.
107 */
108 TH1S* GetChannel(UShort_t det, Char_t ring, UShort_t sec,
109 UShort_t strip, UInt_t sample);
110 /**
111 * Calculate the hardware index
112 *
113 * @param ddl DDL number
114 * @param board Board number
115 * @param altro ALTRO number
116 * @param chan Channel number
117 *
118 * @return Index into hardware cache.
119 */
120 Int_t HWIndex(UShort_t ddl, UShort_t board, UShort_t altro,
121 UShort_t chan) const;
122 void FillinTimebins(std::ofstream& out, UShort_t ddl);
123 /** Current strip */
45cffd06 124 Int_t fCurrentChannel; //The current channel
8e23c82d 125 /** Pedestal summary */
45cffd06 126 TH1F fPedSummary; //Summary of pedestals
5cf05dbb 127 /** Noise summary */
45cffd06 128 TH1F fNoiseSummary; //Summary of noises
5cf05dbb 129 /** Output file for zero-suppression for FMD1 */
45cffd06 130 std::ofstream fZSfileFMD1; //Stream for ZS FMD1
5cf05dbb 131 /** Output file for zero-suppression for FMD2 */
45cffd06 132 std::ofstream fZSfileFMD2; //Stream for ZS FMD2
5cf05dbb 133 /** Output file for zero-suppression for FMD3 */
45cffd06 134 std::ofstream fZSfileFMD3; //Stream for ZS FMD3
5cf05dbb 135 /** The minimum timebin seen for all channels */
45cffd06 136 TArrayS fMinTimebin; //minimum timebin
5cf05dbb 137 /** The maximum timebin seen for all channels */
45cffd06 138 TArrayS fMaxTimebin; //maximum timebin
5cf05dbb 139
2a082c96 140 void MakeSummary(UShort_t det, Char_t ring);
141
45cffd06 142 TH2* fSummaryFMD1i; //Summary of FMD1
143 TH2* fSummaryFMD2i; //Summary of FMD2I
144 TH2* fSummaryFMD2o; //Summary of FMD2O
145 TH2* fSummaryFMD3i; //Summary of FMD3I
146 TH2* fSummaryFMD3o; //Summary of FMD3O
7bce699b 147
178c5972 148 ClassDef(AliFMDPedestalDA,0)
178c5972 149};
5cf05dbb 150
151inline Int_t
45cffd06 152AliFMDPedestalDA::HWIndex(UShort_t ddl, UShort_t b,
153 UShort_t a, UShort_t c) const
5cf05dbb 154{
155 // Save some array entries
156 UShort_t lb = (b > 1 ? b-16+2 : b);
157 const Int_t kNDDL = 3;
158 const Int_t kNBoard = 4;
159 const Int_t kNAltro = 3;
160 const Int_t kNChannel = 16;
161 Int_t idx = c + kNChannel * (a + kNAltro * (lb + kNBoard * ddl));
162 if (idx > kNDDL * kNBoard * kNAltro * kNChannel) return -1;
163 return idx;
164}
165
178c5972 166#endif
5cf05dbb 167//
168// Local Variables:
169// mode: C++
170// End:
171//