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