]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONCalibrationData.h
Merge branch 'master' of https://git.cern.ch/reps/AliRoot
[u/mrichter/AliRoot.git] / MUON / AliMUONCalibrationData.h
1 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
2 * See cxx source for full Copyright notice                               */
3
4 // $Id: AliMUONCalibrationData.h 59457 2012-11-06 12:36:48Z laphecet $
5
6 /// \ingroup calib
7 /// \class AliMUONCalibrationData
8 /// \brief Single entry point to access MUON calibration data.
9 /// 
10 //  Author Laurent Aphecetche
11
12 #ifndef ALIMUONCALIBRATIONDATA_H
13 #define ALIMUONCALIBRATIONDATA_H
14
15 #ifndef ROOT_TObject
16 #include "TObject.h"
17 #endif
18
19 class AliCDBEntry;
20 class AliMUONGlobalCrateConfig;
21 class AliMUONRegionalTriggerConfig;
22 class AliMUONRejectList;
23 class AliMUONTriggerEfficiencyCells;
24 class AliMUONTriggerLut;
25 class AliMUONVCalibParam;
26 class AliMUONVStore;
27 class AliMUONVStore;
28 class TMap;
29
30 class AliMUONCalibrationData : public TObject
31 {
32 public:
33   /** Constructor.
34     * @param runNumber is used as a key to the CDB
35     * @param deferredInitialization if kFALSE, all the calibrations are fetched
36     * regardless of whether you'll use them or not.
37     */
38   AliMUONCalibrationData(Int_t runNumber=-1, Bool_t deferredInitialization=kTRUE);
39   virtual ~AliMUONCalibrationData();
40
41   AliMUONVStore* Capacitances() const;
42
43   /// Create a capa store (which must be deleted) from OCDB for the given run
44   static AliMUONVStore* CreateCapacitances(Int_t runNumber, Int_t* startOfValidity=0);
45
46   /// Create a gain store (which must be deleted) from OCDB for the given run
47   static AliMUONVStore* CreateGains(Int_t runNumber, Int_t* startOfValidity=0);
48
49   /// Create a global trigger mask (which must be deleted) from OCDB for the given run
50   static AliMUONGlobalCrateConfig* CreateGlobalTriggerCrateConfig(Int_t runNumber, Int_t* startOfValidity=0);
51   
52   /// Create a hv map (which must be deleted) from OCDB for the given run
53   static TMap* CreateHV(Int_t runNumber, Int_t* startOfValidity=0, Bool_t patched=kTRUE, TList* messages=0x0, Bool_t dryRun=kFALSE);
54
55   /// Create a Trigger HV and current  map (which must be deleted) from OCDB for the given run
56   static TMap* CreateTriggerDCS(Int_t runNumber, Int_t* startOfValidity=0);
57
58   /// Create a neighbours store (which must be deleted) from OCDB for the given run
59   static AliMUONVStore* CreateNeighbours(Int_t runNumber, Int_t* startOfValidity=0);
60   
61   /// Create a local trigger mask store (which must be deleted) for a given run
62   static AliMUONVStore* CreateLocalTriggerBoardMasks(Int_t runNumber, Int_t* startOfValidity=0);
63
64   /// Create an occupancy map store (which must be deleted) from OCDB for the given run
65   static AliMUONVStore* CreateOccupancyMap(Int_t runNumber, Int_t* startOfValidity=0);
66
67   /// Create a rejectlist store (which must be deleted) from OCDB for the given run
68   static AliMUONRejectList* CreateRejectList(Int_t runNumber, Int_t* startOfValidity=0);
69
70   /// Create a pedestal store (which must be deleted) from OCDB for the given run
71   static AliMUONVStore* CreatePedestals(Int_t runNumber, Int_t* startOfValidity=0);
72
73   /// Create a configuration store (which must be deleted) from OCDB for the given run
74   static AliMUONVStore* CreateConfig(Int_t runNumber, Int_t* startOfValidity=0);
75
76   /// Create a regional trigger mask store (which must be deleted) for a given run
77   static AliMUONRegionalTriggerConfig* CreateRegionalTriggerConfig(Int_t runNumber, Int_t* startOfValidity=0);
78
79   /// Create a trigger Look Up Table (which must be deleted) for a given run
80   static AliMUONTriggerLut* CreateTriggerLut(Int_t runNumber, Int_t* startOfValidity=0);
81   /// Create a trigger efficiency map (which must be deleted) for a given run
82   static AliMUONTriggerEfficiencyCells* CreateTriggerEfficiency(Int_t runNumber, Int_t* startOfValidity=0);
83   
84   /// Get all the gains
85   AliMUONVStore* Gains() const;
86
87   /// Get the configuration for the global trigger board.
88   AliMUONGlobalCrateConfig* GlobalTriggerCrateConfig() const;
89     
90   /// Get the Gain calibration object for channels within (detElemId,manuId).
91   AliMUONVCalibParam* Gains(Int_t detElemId, Int_t manuId) const;
92     
93   /// Get the HV values. Use patched=kFALSE to get unprocessed (i.e. "raw") values as they are in the OCDB
94   TMap* HV(Bool_t patched=kTRUE) const;
95
96   /// Get the Trigger HV and current values
97   TMap* TriggerDCS() const;
98     
99   /// Whether this object is valid or not (might be invalid if fetching from CDB failed).
100   Bool_t IsValid() const { return fIsValid; }
101     
102   /// Get the mask for a given local trigger board.
103   AliMUONVCalibParam* LocalTriggerBoardMasks(Int_t localBoardNumber) const;
104     
105   /// Get the neighbours store
106   AliMUONVStore* Neighbours() const;
107   
108   /// Get the pedestal store
109   AliMUONVStore* Pedestals() const;
110
111   /// Get the config store
112   AliMUONVStore* Config() const;
113   
114   /// Get the occupancy map store
115   AliMUONVStore* OccupancyMap() const;
116
117   /// Get the reject list store
118   AliMUONRejectList* RejectList() const;
119
120   /// Get the Pedestal calibration object for channels within (detElemId,manuId).
121   AliMUONVCalibParam* Pedestals(Int_t detElemId, Int_t manuId) const;
122   
123   /// Dump to screen.
124   virtual void Print(Option_t* opt="") const;
125
126   /// Get the config for regional trigger.
127   AliMUONRegionalTriggerConfig* RegionalTriggerConfig() const;
128
129
130   /// The runnumber used by this object.
131   Int_t RunNumber() const { return fRunNumber; }
132   
133   /// Get the trigger Look Up Table.
134   AliMUONTriggerLut* TriggerLut() const;
135   
136   /// Get the trigger efficiency map
137   AliMUONTriggerEfficiencyCells* TriggerEfficiency() const;
138   
139   void Reset();
140
141   static TObject* CreateObject(Int_t runNumber, const char* path, Int_t* startOfValidity=0x0);
142   
143   static void Check(Int_t runNumber);
144
145   static void BypassStores(AliMUONVStore* ped, AliMUONVStore* gain);
146
147 protected:
148   /// Not implemented
149   AliMUONCalibrationData(const AliMUONCalibrationData& other);
150   /// Not implemented
151   AliMUONCalibrationData& operator=(const AliMUONCalibrationData& other);
152
153   static Bool_t PatchHVValues(TObjArray& values, TString* msg=0x0, Bool_t dryRun=kFALSE);
154   
155   static Bool_t CheckHVGroup(TObjArray& values, Int_t first, Int_t last, Double_t& value,
156                              Int_t& slope, TString* msg);
157
158   static void PatchSt1DCSAliases(TMap& hvMap);
159
160   static void AddToMap(const TMap& sourceMap,
161                        TMap& destMap,
162                        const TString& key,
163                        const char* source,
164                        const char* dest);
165
166 private:
167   mutable Bool_t fIsValid; ///<  Whether we were able to correctly initialize
168   Int_t fRunNumber; ///<  The run number for which we hold calibrations
169   mutable AliMUONVStore* fGains; //!< Gains
170   mutable AliMUONVStore* fPedestals; //!< Pedestals
171   mutable TMap* fHV; //!< HV
172   mutable TMap* fTriggerDCS; //!< Trigger HV and Currents
173   mutable AliMUONVStore* fLocalTriggerBoardMasks; //!< Local trigger board maska  
174   mutable AliMUONRegionalTriggerConfig* fRegionalTriggerConfig; //!< Regional trigger config
175   mutable AliMUONGlobalCrateConfig* fGlobalTriggerCrateConfig; //!< Global trigger crate config
176   
177   mutable AliMUONTriggerLut* fTriggerLut; //!< TRigger LUTs
178   mutable AliMUONTriggerEfficiencyCells* fTriggerEfficiency; //!< Trigger efficiency cells
179   mutable AliMUONVStore* fCapacitances; //!< Manu capacitances
180   mutable AliMUONVStore* fNeighbours; //!< list of neighbours for all channels
181   
182   mutable AliMUONVStore* fOccupancyMap; //!< occupancy map
183   
184   mutable AliMUONRejectList* fRejectList; //!< reject list
185
186   static AliMUONVStore* fgBypassPedestals;
187   static AliMUONVStore* fgBypassGains;
188   
189   mutable AliMUONVStore* fConfig; //!< configuration of the tracker
190   
191   static UInt_t fgkDCSSt1Flag; //!< flag to indicate that the DCS alias naming is not messed up in St1
192   
193   ClassDef(AliMUONCalibrationData,14) // Storage for all MUON calibration data.
194 };
195
196 #endif