]> git.uio.no Git - u/mrichter/AliRoot.git/blame - FMD/AliFMDPedestalDA.h
change in naming LYZ outputfiles for plotting
[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"
18
5cf05dbb 19class AliFMDPedestalDA: public AliFMDBaseDA
20{
21public:
22 /**
23 * Constructor.
24 *
25 */
26 AliFMDPedestalDA();
27 /**
28 * Copy constructor
29 *
30 * @param pedDA Object to copy from
31 */
32 AliFMDPedestalDA(const AliFMDPedestalDA & pedDA);
72bc98e7 33 // AliFMDPedestalDA& operator = (const AliFMDPedestalDA & pedDA) ;
5cf05dbb 34 /**
35 * Destructor
36 *
37 */
178c5972 38 virtual ~AliFMDPedestalDA();
5cf05dbb 39 /**
40 * Initialiser
41 *
42 */
178c5972 43 void Init();
44
5cf05dbb 45protected:
46 /**
47 * Add a channel to the containers.
48 *
49 * @param sectorArray Array of sectors
50 * @param det Detector
51 * @param ring Ring
52 * @param sec Sector
53 * @param strip Strip
54 */
55 void AddChannelContainer(TObjArray* sectorArray, UShort_t det,
56 Char_t ring, UShort_t sec, UShort_t strip);
57 /**
58 * Fill ADC values from a digit into the corresponding histogram.
59 *
60 * @param digit Digit to fill ADC values for.
61 */
178c5972 62 void FillChannels(AliFMDDigit* digit);
5cf05dbb 63 /**
64 * Analyse a strip. That is, compute the mean and spread of the ADC
65 * spectra for all strips. Also output on files the values.
66 *
67 * @param det Detector
68 * @param ring Ring
69 * @param sec Sector
70 * @param strip Strip.
71 */
178c5972 72 void Analyse(UShort_t det, Char_t ring, UShort_t sec, UShort_t strip);
5cf05dbb 73 /**
74 * Write headers to files.
75 *
76 */
178c5972 77 void WriteHeaderToFile();
5cf05dbb 78 /**
79 * Called at the end of an event.
80 *
81 */
178c5972 82 void FinishEvent() {}
5cf05dbb 83 /**
84 * Called at the end of a job. Fills in missing time-bins and
85 * closes output files
86 *
87 */
f7f0b643 88 void Terminate(TFile* );
5cf05dbb 89private:
90 /**
91 * Get the histogram corresponding to a strip sample.
92 *
93 * @param det Detector
94 * @param ring Ring
95 * @param sec Sector
96 * @param strip Strip
97 * @param sample Sample
98 *
99 * @return ADC spectra of a strip.
100 */
101 TH1S* GetChannel(UShort_t det, Char_t ring, UShort_t sec,
102 UShort_t strip, UInt_t sample);
103 /**
104 * Calculate the hardware index
105 *
106 * @param ddl DDL number
107 * @param board Board number
108 * @param altro ALTRO number
109 * @param chan Channel number
110 *
111 * @return Index into hardware cache.
112 */
113 Int_t HWIndex(UShort_t ddl, UShort_t board, UShort_t altro,
114 UShort_t chan) const;
115 void FillinTimebins(std::ofstream& out, UShort_t ddl);
116 /** Current strip */
f7f0b643 117 Int_t fCurrentChannel;
5cf05dbb 118 /** Pedestal summary */
f7f0b643 119 TH1F fPedSummary;
5cf05dbb 120 /** Noise summary */
f7f0b643 121 TH1F fNoiseSummary;
5cf05dbb 122 /** Output file for zero-suppression for FMD1 */
7bce699b 123 std::ofstream fZSfileFMD1;
5cf05dbb 124 /** Output file for zero-suppression for FMD2 */
7bce699b 125 std::ofstream fZSfileFMD2;
5cf05dbb 126 /** Output file for zero-suppression for FMD3 */
7bce699b 127 std::ofstream fZSfileFMD3;
5cf05dbb 128 /** The minimum timebin seen for all channels */
129 TArrayS fMinTimebin;
130 /** The maximum timebin seen for all channels */
131 TArrayS fMaxTimebin;
132
7bce699b 133
178c5972 134 ClassDef(AliFMDPedestalDA,0)
178c5972 135};
5cf05dbb 136
137inline Int_t
138AliFMDPedestalDA::HWIndex(UShort_t ddl, UShort_t b, UShort_t a, UShort_t c)const
139{
140 // Save some array entries
141 UShort_t lb = (b > 1 ? b-16+2 : b);
142 const Int_t kNDDL = 3;
143 const Int_t kNBoard = 4;
144 const Int_t kNAltro = 3;
145 const Int_t kNChannel = 16;
146 Int_t idx = c + kNChannel * (a + kNAltro * (lb + kNBoard * ddl));
147 if (idx > kNDDL * kNBoard * kNAltro * kNChannel) return -1;
148 return idx;
149}
150
178c5972 151#endif
5cf05dbb 152//
153// Local Variables:
154// mode: C++
155// End:
156//