AliPhysics  6cf2591 (6cf2591)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliCorrectionManagerBase.h
Go to the documentation of this file.
1 // -*- mode: C++ -*-
11 #ifndef ALICORRECTIONMANAGERBASE_H
12 #define ALICORRECTIONMANAGERBASE_H
13 #include <TString.h>
14 #include <TNamed.h>
15 #include <TObjArray.h>
16 class AliOADBForward;
17 class TBrowser;
18 class TAxis;
19 
81 {
82 public:
83  enum EConstants {
85  kIgnoreField = 999 // Must be synced with AliOADBForward::kInvalidField
86  };
87  enum EFields {
88  kRun = 0x01,
89  kSys = 0x02,
90  kSNN = 0x04,
91  kField = 0x08,
92  kMC = 0x10,
93  kSatellite = 0x20,
96  };
100  virtual ~AliCorrectionManagerBase();
106  virtual void SetPrefix(const TString& prefix);
112  virtual void SetEnableFallBack(Bool_t use=true) { fFallBack = use; }
113 
133  virtual Bool_t Store(TObject* o,
134  ULong_t runNo,
135  UShort_t sys,
136  UShort_t sNN,
137  Short_t field,
138  Bool_t mc,
139  Bool_t sat,
140  const char* file,
141  const char* meth="NEAR") const;
151  virtual Bool_t Append(const TString& addition,
152  const TString& destination="") const;
163  virtual Bool_t CleanUp(const TString& destination,
164  Bool_t verb=false,
165  Bool_t all=false) const;
166  /* @} */
167 
179  virtual void EnableCorrections(UInt_t what);
188  virtual Bool_t CheckCorrections(UInt_t what, Bool_t verbose=true) const;
203  UShort_t sys,
204  UShort_t sNN,
205  Short_t fld,
206  Bool_t mc,
207  Bool_t sat,
208  Bool_t force=false);
209  /* @} */
210 
220  virtual const TAxis* GetVertexAxis() const { return 0; }
226  virtual const TAxis* GetEtaAxis() const { return 0; }
227  /* @} */
228 
238  virtual Bool_t IsInit() const { return fIsInit; }
247  virtual void Print(Option_t* option="") const;
253  virtual void Browse(TBrowser* b);
259  virtual Bool_t IsFolder() const { return true; }
265  virtual void SetDebug(Bool_t debug) { fDebug = debug; }
266  /* @} */
272  struct Correction : public TNamed
273  {
277  Correction();
287  Correction(const TString& tableName,
288  const TString& fileName,
289  TClass* cls,
290  UShort_t queryFields=kStandard,
291  Bool_t enabled=false);
297  Correction(const Correction& o);
305  Correction& operator=(const Correction& o);
309  ~Correction() { delete fObject; }
326  ULong_t run,
327  UShort_t sys,
328  UShort_t sNN,
329  Short_t fld,
330  Bool_t mc,
331  Bool_t sat,
332  Bool_t vrb=false,
333  Bool_t fbk=false);
351  TObject* o,
352  ULong_t run,
353  UShort_t sys,
354  UShort_t sNN,
355  Short_t fld,
356  Bool_t mc,
357  Bool_t sat,
358  const char* file=0,
359  const char* meth="NEAR") const;
365  void Enable(Bool_t enabled=true) { fEnabled = enabled; }
371  TObject* Get();
377  const TObject* Get() const;
383  void SetFile(const TString& fileName) { fTitle = fileName; }
390  const TClass* TheClass() const;
396  void Print(Option_t* option="") const;
402  void Browse(TBrowser* b);
408  Bool_t IsFolder() const { return true; }
422  void MassageFields(ULong_t& run,
423  UShort_t& sys,
424  UShort_t& sNN,
425  Short_t & fld,
426  Bool_t& mc,
427  Bool_t& sat) const;
438  void CorrectFields(ULong_t& run,
439  UShort_t& sys,
440  UShort_t& sNN,
441  Short_t & fld,
442  Bool_t& mc,
443  Bool_t& sat) const;
455  const TString& dest,
456  Bool_t verb=false,
457  Bool_t all=false) const;
468  Bool_t vrb=false,
469  Bool_t fallback=false) const;
470 
471  mutable TClass* fCls;
472  const TString fClientCls; // Class name
473  UShort_t fQueryFields; // Enabled query fields
474  Bool_t fEnabled; // Whether we're in use
475  TString fLastEntry; // Text representation of last entry
476  TObject* fObject; // The data
477  ClassDef(Correction,1) // Correction meta object
478  };
479  const char* GetObjectName(Int_t what) const;
480 
481 protected:
508  void RegisterCorrection(Int_t id, Correction* corr);
519  void RegisterCorrection(Int_t id,
520  const TString& tableName,
521  const TString& fileName,
522  TClass* cls,
523  UShort_t fields=kStandard,
524  Bool_t enabled=false);
531  void EnableCorrection(Int_t id, Bool_t enable=true);
547  const Correction* GetCorrection(Int_t id) const;
554  void SetCorrectionFile(Int_t id, const TString& fileName) const;
562  Int_t GetId(const TString& what) const;
570  Int_t GetId(const TObject* obj) const;
578  TObject* Get(Int_t id);
586  const TObject* Get(Int_t id) const;
600  UShort_t sys,
601  UShort_t sNN,
602  Short_t fld,
603  Bool_t mc,
604  Bool_t sat);
618  UShort_t sys,
619  UShort_t sNN,
620  Short_t fld,
621  Bool_t mc,
622  Bool_t sat);
637  ULong_t run,
638  UShort_t sys,
639  UShort_t sNN,
640  Short_t fld,
641  Bool_t mc,
642  Bool_t sat);
649  void SetCorrectionFile(Int_t i, const TString& file);
650 
651  TObjArray fCorrections; // List of corrections
652  Bool_t fIsInit; // Whether we're intialized or not
653  ULong_t fRun; // Cached run number
654  UShort_t fSys; // Cached system (1:pp 2:PbPb 3:pPb)
655  UShort_t fSNN; // Cached center of mass energy [GeV]
656  Short_t fField; // Cached L3 magnetic field [kG]
657  Bool_t fMC; // Cached Simulation flag
658  Bool_t fSatellite; // Cached satellite interaction flat
660  Bool_t fDebug; // If true, do verbose queries
661  Bool_t fFallBack; // If true, enable fall-back queries
663 };
664 
665 #endif
666 
667 
668 
669 
void EnableCorrection(Int_t id, Bool_t enable=true)
virtual Bool_t IsInit() const
virtual void SetPrefix(const TString &prefix)
TString fileName
virtual void EnableCorrections(UInt_t what)
Bool_t ReadCorrection(Int_t id, ULong_t run, UShort_t sys, UShort_t sNN, Short_t fld, Bool_t mc, Bool_t sat)
Bool_t InitCorrections(ULong_t run, UShort_t sys, UShort_t sNN, Short_t fld, Bool_t mc, Bool_t sat, Bool_t force=false)
ClassDef(AliCorrectionManagerBase, 2)
void Print(Option_t *option="") const
void RegisterCorrection(Int_t id, Correction *corr)
void CorrectFields(ULong_t &run, UShort_t &sys, UShort_t &sNN, Short_t &fld, Bool_t &mc, Bool_t &sat) const
virtual Bool_t CleanUp(const TString &destination, Bool_t verb=false, Bool_t all=false) const
Bool_t ReadIt(AliOADBForward *db, ULong_t run, UShort_t sys, UShort_t sNN, Short_t fld, Bool_t mc, Bool_t sat, Bool_t vrb=false, Bool_t fbk=false)
AliCorrectionManagerBase & operator=(const AliCorrectionManagerBase &o)
int Int_t
Definition: External.C:63
void SetCorrectionFile(Int_t id, const TString &fileName) const
unsigned int UInt_t
Definition: External.C:33
virtual Bool_t Store(TObject *o, ULong_t runNo, UShort_t sys, UShort_t sNN, Short_t field, Bool_t mc, Bool_t sat, const char *file, const char *meth="NEAR") const
virtual Bool_t CheckCorrections(UInt_t what, Bool_t verbose=true) const
Bool_t CleanIt(AliOADBForward *db, const TString &dest, Bool_t verb=false, Bool_t all=false) const
const char * GetObjectName(Int_t what) const
unsigned long ULong_t
Definition: External.C:38
virtual void SetDebug(Bool_t debug)
Int_t GetId(const TString &what) const
virtual void Browse(TBrowser *b)
short Short_t
Definition: External.C:23
Correction * GetCorrection(Int_t id)
Bool_t CheckConditions(ULong_t run, UShort_t sys, UShort_t sNN, Short_t fld, Bool_t mc, Bool_t sat)
virtual void SetEnableFallBack(Bool_t use=true)
Correction & operator=(const Correction &o)
Bool_t ReadCorrections(ULong_t run, UShort_t sys, UShort_t sNN, Short_t fld, Bool_t mc, Bool_t sat)
virtual const TAxis * GetEtaAxis() const
virtual void Print(Option_t *option="") const
virtual Bool_t Append(const TString &addition, const TString &destination="") const
TFile * file
unsigned short UShort_t
Definition: External.C:28
const char Option_t
Definition: External.C:48
Bool_t OpenIt(AliOADBForward *db, Bool_t vrb=false, Bool_t fallback=false) const
bool Bool_t
Definition: External.C:53
virtual Bool_t IsFolder() const
Bool_t StoreIt(AliOADBForward *db, TObject *o, ULong_t run, UShort_t sys, UShort_t sNN, Short_t fld, Bool_t mc, Bool_t sat, const char *file=0, const char *meth="NEAR") const
const TString fClientCls
Class of correction objects.
void MassageFields(ULong_t &run, UShort_t &sys, UShort_t &sNN, Short_t &fld, Bool_t &mc, Bool_t &sat) const
virtual const TAxis * GetVertexAxis() const