AliPhysics  32b88a8 (32b88a8)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliCentralCorrectionManager.cxx
Go to the documentation of this file.
1 //
2 // Manager (singleton) of corrections
3 //
7 #include "AliForwardUtil.h"
8 #include "AliOADBForward.h"
9 #include <TString.h>
10 #include <AliLog.h>
11 #include <TFile.h>
12 #include <TSystem.h>
13 #include <TBrowser.h>
14 #include <TROOT.h>
15 #include <TClass.h>
16 #include <iostream>
17 #include <iomanip>
18 
19 //____________________________________________________________________
21 const char* AliCentralCorrectionManager::fgkSecondaryMapSkel = "secondary";
22 const char* AliCentralCorrectionManager::fgkAcceptanceSkel = "acceptance";
23 
24 #define PREFIX "$(ALICE_PHYSICS)/OADB/PWGLF/FORWARD/CORRECTIONS/data/"
25 #define DB_NAME "spd_corrections.root"
26 
27 //____________________________________________________________________
29 {
30  //
31  // Access to the singleton object
32  //
33  // Return:
34  // Reference to the singleton object
35  //
37  return *fgInstance;
38 }
39 
40 //____________________________________________________________________
42 {
43  //
44  // Default constructor
45  //
46 }
47 //____________________________________________________________________
50 {
51  //
52  // Non-default constructor
53  //
54  // Parameters:
55  // Not used
56  //
58  PREFIX DB_NAME, AliCentralCorrSecondaryMap::Class(),
61  PREFIX DB_NAME, AliCentralCorrAcceptance::Class(),
63 }
64 //____________________________________________________________________
65 Bool_t
67  const char* sys,
68  Float_t sNN,
69  Float_t field,
70  Bool_t mc,
71  Bool_t sat,
72  UInt_t what,
73  Bool_t force)
74 {
75  //
76  // Read in correction based on passed parameters
77  //
78  // Parameters:
79  // collisionSystem Collision system string
80  // cmsNN Center of mass energy per nucleon pair [GeV]
81  // field Magnetic field [kG]
82  // mc Monte-carlo switch
83  // what What to read in
84  // force Force (re-)reading of specified things
85  //
86  // Return:
87  // true on success
88  //
90  // AliInfo(Form("Initialising with cms='%s', sNN=%fGeV field=%fkG",
91  // cms, sNN, field));
92  return Init(runNo, col,
95  mc, sat, what, force);
96 }
97 
98 //____________________________________________________________________
99 Bool_t
101  UShort_t sys,
102  UShort_t sNN,
103  Short_t field,
104  Bool_t mc,
105  Bool_t sat,
106  UInt_t what,
107  Bool_t force)
108 {
109  //
110  // Read in corrections based on the parameters given
111  //
112  // Parameters:
113  // collisionSystem Collision system
114  // cmsNN Center of mass energy per nuclean pair [GeV]
115  // field Magnetic field setting [kG]
116  // mc Monte-carlo switch
117  // what What to read in.
118  // force Force (re-)reading of specified things
119  //
120  // Return:
121  //
122  //
125 
126  return InitCorrections(runNo, sys, sNN, field, mc, sat, force);
127 }
128 
129 //____________________________________________________________________
130 Bool_t
132  const TString& destination) const
133 {
134  TString dest(destination);
135  if (dest.IsNull())
136  dest = PREFIX DB_NAME;
137  return AliCorrectionManagerBase::Append(addition, dest);
138 }
139 
140 //____________________________________________________________________
143 {
149  return static_cast<const AliCentralCorrSecondaryMap*>(Get(kIdSecondaryMap));
150 }
151 //____________________________________________________________________
154 {
161  return static_cast<const AliCentralCorrAcceptance*>(Get(kIdAcceptance));
162 }
163 
164 //____________________________________________________________________
165 const TAxis*
167 {
169  if (!map) return 0;
170  return &(map->GetVertexAxis());
171 }
172 
173 
174 #ifndef DOXY_INPUT
175 //______________________________________________________________________________
176 // @cond
177 void AliCentralCorrectionManager::Streamer(TBuffer &R__b)
178 {
179  //
180  // Stream an object of class AliCentralCorrectionManager.
181  //
182  if (R__b.IsReading()) {
183  R__b.ReadClassBuffer(AliCentralCorrectionManager::Class(),this);
184  if (fgInstance) {
185  AliWarning(Form("Singleton instance already set (%p) when reading "
186  "singleton object (%p). Read object will be new "
187  "singleton object", fgInstance, this));
188  // delete fgInstance;
189  }
190  fgInstance = this;
191  } else {
192  R__b.WriteClassBuffer(AliCentralCorrectionManager::Class(),this);
193  }
194 }
195 // @endcond
196 #endif
197 
198 //____________________________________________________________________
199 //
200 // EOF
201 //
const AliCentralCorrAcceptance * GetAcceptance() const
static Short_t ParseMagneticField(Float_t field)
void EnableCorrection(Int_t id, Bool_t enable=true)
static UShort_t ParseCenterOfMassEnergy(UShort_t sys, Float_t cms)
static AliCentralCorrectionManager * fgInstance
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)
virtual Bool_t Append(const TString &addition, const TString &destination="") const
void RegisterCorrection(Int_t id, Correction *corr)
Bool_t Init(ULong_t runNumber, UShort_t collisionSystem, UShort_t cmsNN, Short_t field, Bool_t mc=false, Bool_t satelliteCollisions=false, UInt_t what=kDefault, Bool_t force=false)
unsigned int UInt_t
Definition: External.C:33
float Float_t
Definition: External.C:68
Various utilities used in PWGLF/FORWARD.
unsigned long ULong_t
Definition: External.C:38
short Short_t
Definition: External.C:23
const AliCentralCorrSecondaryMap * GetSecondaryMap() const
static UShort_t ParseCollisionSystem(const char *sys)
virtual Bool_t Append(const TString &addition, const TString &destination="") const
const TAxis & GetVertexAxis() const
unsigned short UShort_t
Definition: External.C:28
bool Bool_t
Definition: External.C:53
static AliCentralCorrectionManager & Instance()