]> git.uio.no Git - u/mrichter/AliRoot.git/blob - FMD/AliFMDCalibFaker.h
Shorten names
[u/mrichter/AliRoot.git] / FMD / AliFMDCalibFaker.h
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  */
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 
14     @ingroup FMD_util
15 */
16 //____________________________________________________________________
17 //
18 //  Class to make fake calibration parameters 
19 // Used for populating inital data base
20 // Utility class 
21 //
22 #ifndef ROOT_TTask
23 # include <TTask.h>
24 #endif
25 class AliFMDParameters;
26 #include "AliFMDCalibFwd.h"
27
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  */
38 class AliFMDCalibFaker : public TTask
39 {
40 public:
41   /** What to make */
42   enum EWhat {
43     /** Zero suppressio threshold */
44     kZeroSuppression =  1, 
45     /** Sample rate */
46     kSampleRate,
47     /** Pedestals */
48     kPedestal,
49     /** Gain */
50     kPulseGain,
51     /** Dead map */
52     kDeadMap,
53     /** Hardware map */
54     kAltroMap, 
55     /** Strip range */
56     kStripRange
57   };
58   enum {
59     /** All parameters */
60     kAll             = (1<<kZeroSuppression|1<<kSampleRate|1<<kPedestal|
61                         1<<kPulseGain|1<<kDeadMap|1<<kAltroMap|1<<kStripRange)
62   };
63   /** Constructor 
64       @param mask Bit mask of what to make 
65       @param loc  Where to store the results */
66   AliFMDCalibFaker(Int_t mask=kAll, const char* loc="local://cdb");
67   /** Destructor */
68   virtual ~AliFMDCalibFaker() {}
69   /** Add a parameter to output 
70       @param w Bit of parameter */
71   void AddCalib(EWhat w) { SETBIT(fMask, w); }
72   /** Remove a parameter from output 
73       @param w Bit of parameter */
74   void RemoveCalib(EWhat w) { SETBIT(fMask, w); }
75   /** Set the bit mask of what to make 
76       @param mask bit mask */
77   void SetCalib(Int_t mask) { fMask = mask; }
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 */
81   void SetGainSeed(Float_t g) { fGain = g; }
82   /** Set the threshold factor.  The actual threshold is the gain seed
83       times the factor 
84       @param t Factor */
85   void SetThresholdFactor(Float_t t) { fThresholdFactor = t; }
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 */
90   void SetPedestalRange(Float_t min, Float_t max) 
91   {
92     fPedestalMin = min;
93     fPedestalMax = (max < min ? min : max);
94   }
95   /** Set run validty range 
96       @param min Minimum run number
97       @param max Maximum run number */
98   void SetRunRange(Int_t min, Int_t max) 
99   {
100     fRunMin = min;
101     fRunMax = (max < min ? min : max);
102   }
103   /** Set the likelyness that a strip is dead. 
104       @param chance Chance of dead channel. */
105   void SetDeadChance(Float_t chance) { fDeadChance = chance; }
106   /** Set Sample rate 
107       @param rate Rate */
108   void SetRate(UShort_t rate) { fRate = rate; }
109   /** Set the zero suppression threshold 
110       @param t Threshold (in ADC counts) */
111   void SetZeroThreshold(UShort_t t) { fZeroThreshold = t; }
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   }
120   /** Set the default output storage.  It must be a CDB URL. 
121       @param url CDB URL. */
122   void SetDefaultStorage(const char* url) { SetTitle(url); }
123   /** Make the fake calibration parameters 
124       @param option Not used */
125   void Exec(Option_t* option="");
126 protected:
127   /** Make zero suppression parameters 
128       @return Map of zero suppression */
129   virtual AliFMDCalibZeroSuppression* MakeZeroSuppression() const;
130   /** Make sample rate parameters 
131       @return Map of sample rate */
132   virtual AliFMDCalibSampleRate*      MakeSampleRate() const;
133   /** Make pedestal parameters 
134       @return Map of pedestal */
135   virtual AliFMDCalibPedestal*        MakePedestal() const;
136   /** Make gain parameters 
137       @return Map of gain */
138   virtual AliFMDCalibGain*            MakePulseGain() const;
139   /** Make dead channel parameters 
140       @return Map of dead channel */
141   virtual AliFMDCalibDeadMap*         MakeDeadMap() const;
142   /** Make a hardware map
143       @return hardware map */
144   virtual AliFMDAltroMapping*         MakeAltroMap() const;
145   /** Make a strip range
146       @return strip range map */
147   virtual AliFMDCalibStripRange*      MakeStripRange() const;
148   virtual Float_t MakeNoise(Char_t ring, UShort_t str) const;
149   
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
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
163   
164   ClassDef(AliFMDCalibFaker,0)
165 };
166
167 #endif
168 //____________________________________________________________________
169 //
170 // Local Variables:
171 //   mode: C++
172 // End:
173 //
174 // EOF
175 //
176