fixes
[u/mrichter/AliRoot.git] / FMD / AliFMDCalibFaker.h
CommitLineData
20345ac5 1#ifndef ALIFMDCALIBFAKER_H
2#define ALIFMDCALIBFAKER_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 */
c2fc1258 10/** @file AliFMDCalibFaker.h
11 @author Christian Holm Christensen <cholm@nbi.dk>
12 @date Sun Mar 26 18:29:36 2006
13 @brief Make fake calibration data
02a27b50 14 @ingroup FMD_util
c2fc1258 15*/
20345ac5 16//____________________________________________________________________
17//
18// Class to make fake calibration parameters
02a27b50 19// Used for populating inital data base
20// Utility class
20345ac5 21//
22#ifndef ROOT_TTask
23# include <TTask.h>
24#endif
09b6c804 25class AliFMDParameters;
26#include "AliFMDCalibFwd.h"
20345ac5 27
9f662337 28/** @class AliFMDCalibFaker
29 @brief Class to make fake calibration parameters.
30 @code
31 AliFMDCalibFaker f(0);
32 f.AddCalib(kPedestal);
33 f.AddCalib(kGain);
34 f.Exec();
35 @endcode
36 @ingroup FMD_util
37 */
20345ac5 38class AliFMDCalibFaker : public TTask
39{
40public:
9f662337 41 /** What to make */
20345ac5 42 enum EWhat {
9f662337 43 /** Zero suppressio threshold */
20345ac5 44 kZeroSuppression = 1,
9f662337 45 /** Sample rate */
20345ac5 46 kSampleRate,
9f662337 47 /** Pedestals */
20345ac5 48 kPedestal,
9f662337 49 /** Gain */
20345ac5 50 kPulseGain,
9f662337 51 /** Dead map */
20345ac5 52 kDeadMap,
9f662337 53 /** Hardware map */
c2fc1258 54 kAltroMap,
55 /** Strip range */
56 kStripRange
20345ac5 57 };
58 enum {
9f662337 59 /** All parameters */
20345ac5 60 kAll = (1<<kZeroSuppression|1<<kSampleRate|1<<kPedestal|
c2fc1258 61 1<<kPulseGain|1<<kDeadMap|1<<kAltroMap|1<<kStripRange)
20345ac5 62 };
9f662337 63 /** Constructor
64 @param mask Bit mask of what to make
65 @param loc Where to store the results */
20345ac5 66 AliFMDCalibFaker(Int_t mask=kAll, const char* loc="local://cdb");
9f662337 67 /** Destructor */
20345ac5 68 virtual ~AliFMDCalibFaker() {}
9f662337 69 /** Add a parameter to output
70 @param w Bit of parameter */
20345ac5 71 void AddCalib(EWhat w) { SETBIT(fMask, w); }
9f662337 72 /** Remove a parameter from output
73 @param w Bit of parameter */
20345ac5 74 void RemoveCalib(EWhat w) { SETBIT(fMask, w); }
9f662337 75 /** Set the bit mask of what to make
76 @param mask bit mask */
20345ac5 77 void SetCalib(Int_t mask) { fMask = mask; }
9f662337 78 /** Set seed for random gain. The gain is distributed flatly from
79 90 to 110 percent of the seed.
80 @param g Seed for gain */
20345ac5 81 void SetGainSeed(Float_t g) { fGain = g; }
9f662337 82 /** Set the threshold factor. The actual threshold is the gain seed
83 times the factor
84 @param t Factor */
20345ac5 85 void SetThresholdFactor(Float_t t) { fThresholdFactor = t; }
9f662337 86 /** Set the limits for the random pedestal. The pedestal values are
87 randomly distributed in the range
88 @param min Minimum of range
89 @param max Maximum of range */
20345ac5 90 void SetPedestalRange(Float_t min, Float_t max)
91 {
92 fPedestalMin = min;
93 fPedestalMax = (max < min ? min : max);
94 }
9f662337 95 /** Set run validty range
96 @param min Minimum run number
97 @param max Maximum run number */
20345ac5 98 void SetRunRange(Int_t min, Int_t max)
99 {
100 fRunMin = min;
101 fRunMax = (max < min ? min : max);
102 }
9f662337 103 /** Set the likelyness that a strip is dead.
104 @param chance Chance of dead channel. */
20345ac5 105 void SetDeadChance(Float_t chance) { fDeadChance = chance; }
9f662337 106 /** Set Sample rate
107 @param rate Rate */
20345ac5 108 void SetRate(UShort_t rate) { fRate = rate; }
9f662337 109 /** Set the zero suppression threshold
110 @param t Threshold (in ADC counts) */
20345ac5 111 void SetZeroThreshold(UShort_t t) { fZeroThreshold = t; }
c2fc1258 112 /** Set strip validty range
113 @param min Minimum strip number
114 @param max Maximum strip number */
115 void SetStripRange(UShort_t min, UShort_t max)
116 {
117 fStripMin = min;
118 fStripMax = (max < min ? min : max);
119 }
9f662337 120 /** Set the default output storage. It must be a CDB URL.
121 @param url CDB URL. */
20345ac5 122 void SetDefaultStorage(const char* url) { SetTitle(url); }
9f662337 123 /** Make the fake calibration parameters
124 @param option Not used */
20345ac5 125 void Exec(Option_t* option="");
126protected:
9f662337 127 /** Make zero suppression parameters
128 @return Map of zero suppression */
02a27b50 129 virtual AliFMDCalibZeroSuppression* MakeZeroSuppression() const;
9f662337 130 /** Make sample rate parameters
131 @return Map of sample rate */
02a27b50 132 virtual AliFMDCalibSampleRate* MakeSampleRate() const;
9f662337 133 /** Make pedestal parameters
134 @return Map of pedestal */
02a27b50 135 virtual AliFMDCalibPedestal* MakePedestal() const;
9f662337 136 /** Make gain parameters
137 @return Map of gain */
02a27b50 138 virtual AliFMDCalibGain* MakePulseGain() const;
9f662337 139 /** Make dead channel parameters
140 @return Map of dead channel */
02a27b50 141 virtual AliFMDCalibDeadMap* MakeDeadMap() const;
9f662337 142 /** Make a hardware map
143 @return hardware map */
02a27b50 144 virtual AliFMDAltroMapping* MakeAltroMap() const;
c2fc1258 145 /** Make a strip range
146 @return strip range map */
02a27b50 147 virtual AliFMDCalibStripRange* MakeStripRange() const;
a9579262 148 virtual Float_t MakeNoise(Char_t ring, UShort_t str) const;
149
20345ac5 150 Long_t fMask; // What to write
151 Float_t fGain; // Gain
152 Float_t fThresholdFactor; // Threshold factor
153 Float_t fThreshold; // Threshold
154 Float_t fPedestalMin; // Min pedestal
155 Float_t fPedestalMax; // Max pedestal
156 Float_t fDeadChance; // Chance of dead channel
157 UShort_t fRate; // Sample rate
158 UShort_t fZeroThreshold; // Zero suppression threshold
02a27b50 159 Int_t fRunMin; // Min run number
160 Int_t fRunMax; // Max run number
161 UShort_t fStripMin; // Min strip read out
162 UShort_t fStripMax; // Max strip read out
20345ac5 163
164 ClassDef(AliFMDCalibFaker,0)
165};
166
167#endif
168//____________________________________________________________________
169//
170// Local Variables:
171// mode: C++
172// End:
173//
174// EOF
175//
176