Fixed doxygen docs
[u/mrichter/AliRoot.git] / FMD / AliFMDRawReader.h
CommitLineData
e802be3e 1#ifndef ALIFMDRAWREADER_H
2#define ALIFMDRAWREADER_H
3/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights
4 * reserved.
5 *
6 * Latest changes by Christian Holm Christensen <cholm@nbi.dk>
7 *
8 * See cxx source for full Copyright notice
9 */
e802be3e 10//____________________________________________________________________
11//
12// Class to read ADC values from a AliRawReader object.
088f8e79 13// Note, that it uses an ALTRO reader, which is wrong.
14// Perhaps we need to implement it our selves
e802be3e 15//
02a27b50 16/* $Id$ */
17/** @file AliFMDRawReader.h
18 @author Christian Holm Christensen <cholm@nbi.dk>
19 @date Mon Mar 27 12:45:23 2006
20 @brief Class to read raw data
21 @ingroup FMD_rec
22*/
e802be3e 23#ifndef ROOT_TTask
24# include <TTask.h>
25#endif
f38b1653 26#include "AliFMDUShortMap.h"
e802be3e 27
28//____________________________________________________________________
29class AliRawReader;
1a1fdef7 30class TTree;
d760ea03 31class TClonesArray;
3effc6e7 32class TArrayS;
33class AliFMDCalibSampleRate;
34class AliFMDCalibStripRange;
e802be3e 35
36//____________________________________________________________________
9f662337 37/** @brief Class to read ALTRO formated raw data from an AliRawReader
38 object.
39 @code
40 AliRawReader* reader = new AliRawReaderFile(0);
41 AliFMDRawReader* fmdReader = new AliFMDRawReader(reader);
42 TClonesArray* array = new TClonesArray("AliFMDDigit");
43 fmdReader->ReadAdcs(array);
44 @endcode
45 @ingroup FMD_rec
46*/
e802be3e 47class AliFMDRawReader : public TTask
48{
49public:
faf80567 50 /**
51 * CTOR
52 *
53 * @param reader Raw reader
54 * @param array Output tree
55 */
1a1fdef7 56 AliFMDRawReader(AliRawReader* reader, TTree* array);
faf80567 57 /**
58 * DTOR
59 */
088f8e79 60 virtual ~AliFMDRawReader() {}
faf80567 61 /**
62 * Read in, and store in output tree
63 *
64 * @param option Not used
65 */
d760ea03 66 virtual void Exec(Option_t* option="");
faf80567 67 /**
68 * Read ADC's into a TClonesArray of AliFMDDigit objects.
69 *
70 * @param array Array to read into
71 * @param summable Create SDigits rather than digits
72 * @param pedSub Whether to do pedestal subtraction.
73 * @param noiseFactor If we do pedestal subtraction, then this is
74 * the number we use to suppress remenants of the noise.
75 *
76 * @return @c true on success
77 */
d760ea03 78 virtual Bool_t ReadAdcs(TClonesArray* array);
5cf05dbb 79 /**
80 * Read SOD event into passed objects.
81 *
82 * @param samplerate The sample rate object to fill
83 * @param striprange The strip range object to fill
84 * @param pulseSize The pulse size object to fill
85 * @param pulseLength The pulse length (in events) object to fill
86 *
87 * @return @c true on success
88 */
3effc6e7 89 virtual Bool_t ReadSODevent(AliFMDCalibSampleRate* samplerate,
90 AliFMDCalibStripRange* striprange,
91 TArrayS &pulseSize,
408bf2b4 92 TArrayS &pulseLength,
93 Bool_t* detectors=0);
5cf05dbb 94 /**
95 * Check of the data from DDL @a ddl is zero-suppressed
96 *
97 * @param ddl DDL number (0-2)
98 *
99 * @return @c true if the data from this DDL is zero-suppressed.
100 */
101 Bool_t IsZeroSuppressed(UShort_t ddl) const { return fZeroSuppress[ddl]; }
102 /**
103 * The factor used to multiply the noise when making on-line
104 * pedestal subtraction.
105 *
106 * @param ddl DDL number (0-2)
107 *
108 * @return The factor used.
109 */
110 UShort_t NoiseFactor(UShort_t ddl) const { return fNoiseFactor[ddl]; }
111
faf80567 112 /**
113 * Get the next signal
114 *
115 * @param det On return, the detector
116 * @param rng On return, the ring
117 * @param sec On return, the sector
118 * @param str On return, the strip
119 * @param sam On return, the sample
120 * @param rat On return, the sample rate
121 * @param adc On return, the ADC value
122 * @param zs On return, whether zero-supp. is enabled
123 * @param fac On return, the usd noise factor
124 *
125 * @return true if valid data is returned
126 */
127 Bool_t NextSample(UShort_t& det, Char_t& rng, UShort_t& sec, UShort_t& str,
128 UShort_t& sam, UShort_t& rat, Short_t& adc,
129 Bool_t& zs, UShort_t& fac);
130 /**
131 * Get the next signal
132 *
133 * @param det On return, the detector
134 * @param rng On return, the ring
135 * @param sec On return, the sector
136 * @param str On return, the strip
137 * @param adc On return, the ADC value
138 * @param zs On return, whether zero-supp. is enabled
139 * @param fac On return, the usd noise factor
140 *
141 * @return true if valid data is returned
142 */
b5014544 143 Bool_t NextSignal(UShort_t& det, Char_t& rng,
144 UShort_t& sec, UShort_t& str,
145 Short_t& adc, Bool_t& zs,
146 UShort_t& fac);
faf80567 147 /**
148 * Whether to keep a sample based on the rate used.
149 *
150 * @param samp Sample number
151 * @param rate Over sampling rate
152 *
153 * @return Whether to keep the sample or not
154 */
155 static Bool_t SelectSample(UShort_t samp, UShort_t rate);
e802be3e 156protected:
b5ee4425 157 AliFMDRawReader(const AliFMDRawReader& o)
158 : TTask(o),
159 fTree(0),
160 fReader(0),
3effc6e7 161 fData(0),
f38b1653 162 fNbytes(0),
60e95d46 163 fSeen(0)
b5ee4425 164 {}
02a27b50 165 AliFMDRawReader& operator=(const AliFMDRawReader&) { return *this; }
3effc6e7 166 ULong_t GetNwords() const {return fNbytes / 4;}
167 UInt_t Get32bitWord(Int_t idx);
168 Int_t GetHalfringIndex(UShort_t det, Char_t ring, UShort_t board);
f38b1653 169 TTree* fTree; //! Pointer to tree to read into
170 AliRawReader* fReader; //! Pointer to raw reader
faf80567 171 UShort_t fSampleRate[3]; // The sample rate (if 0, inferred from data)
f38b1653 172 UChar_t* fData;
173 ULong_t fNbytes;
5cf05dbb 174 Bool_t fZeroSuppress[3];
175 UShort_t fNoiseFactor[3];
f38b1653 176 AliFMDUShortMap fSeen;
3effc6e7 177
e802be3e 178 ClassDef(AliFMDRawReader, 0) // Read FMD raw data into a cache
179};
180
181#endif
182//____________________________________________________________________
183//
184// Local Variables:
185// mode: C++
186// End:
187//
188// EOF
189//