AliPhysics  9c66e61 (9c66e61)
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 DB_NAME "spd_corrections.root"
25 
26 //____________________________________________________________________
28 {
29  //
30  // Access to the singleton object
31  //
32  // Return:
33  // Reference to the singleton object
34  //
36  return *fgInstance;
37 }
38 
39 //____________________________________________________________________
41 {
42  //
43  // Default constructor
44  //
45 }
46 //____________________________________________________________________
49 {
50  //
51  // Non-default constructor
52  //
53  // Parameters:
54  // Not used
55  //
57  DB_NAME, AliCentralCorrSecondaryMap::Class(),
60  DB_NAME, AliCentralCorrAcceptance::Class(),
62 }
63 //____________________________________________________________________
64 Bool_t
66  const char* sys,
67  Float_t sNN,
68  Float_t field,
69  Bool_t mc,
70  Bool_t sat,
71  UInt_t what,
72  Bool_t force)
73 {
74  //
75  // Read in correction based on passed parameters
76  //
77  // Parameters:
78  // collisionSystem Collision system string
79  // cmsNN Center of mass energy per nucleon pair [GeV]
80  // field Magnetic field [kG]
81  // mc Monte-carlo switch
82  // what What to read in
83  // force Force (re-)reading of specified things
84  //
85  // Return:
86  // true on success
87  //
89  // AliInfo(Form("Initialising with cms='%s', sNN=%fGeV field=%fkG",
90  // cms, sNN, field));
91  return Init(runNo, col,
94  mc, sat, what, force);
95 }
96 
97 //____________________________________________________________________
98 Bool_t
100  UShort_t sys,
101  UShort_t sNN,
102  Short_t field,
103  Bool_t mc,
104  Bool_t sat,
105  UInt_t what,
106  Bool_t force)
107 {
108  //
109  // Read in corrections based on the parameters given
110  //
111  // Parameters:
112  // collisionSystem Collision system
113  // cmsNN Center of mass energy per nuclean pair [GeV]
114  // field Magnetic field setting [kG]
115  // mc Monte-carlo switch
116  // what What to read in.
117  // force Force (re-)reading of specified things
118  //
119  // Return:
120  //
121  //
124 
125  return InitCorrections(runNo, sys, sNN, field, mc, sat, force);
126 }
127 
128 //____________________________________________________________________
131 {
137  return static_cast<const AliCentralCorrSecondaryMap*>(Get(kIdSecondaryMap));
138 }
139 //____________________________________________________________________
142 {
149  return static_cast<const AliCentralCorrAcceptance*>(Get(kIdAcceptance));
150 }
151 
152 //____________________________________________________________________
153 const TAxis*
155 {
157  if (!map) return 0;
158  return &(map->GetVertexAxis());
159 }
160 
161 
162 #ifndef DOXY_INPUT
163 //______________________________________________________________________________
164 // @cond
165 void AliCentralCorrectionManager::Streamer(TBuffer &R__b)
166 {
167  //
168  // Stream an object of class AliCentralCorrectionManager.
169  //
170  if (R__b.IsReading()) {
171  R__b.ReadClassBuffer(AliCentralCorrectionManager::Class(),this);
172  if (fgInstance) {
173  AliWarning(Form("Singleton instance already set (%p) when reading "
174  "singleton object (%p). Read object will be new "
175  "singleton object", fgInstance, this));
176  // delete fgInstance;
177  }
178  fgInstance = this;
179  } else {
180  R__b.WriteClassBuffer(AliCentralCorrectionManager::Class(),this);
181  }
182 }
183 // @endcond
184 #endif
185 
186 //____________________________________________________________________
187 //
188 // EOF
189 //
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)
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)
const TAxis & GetVertexAxis() const
unsigned short UShort_t
Definition: External.C:28
bool Bool_t
Definition: External.C:53
static AliCentralCorrectionManager & Instance()