AliPhysics  4e47bdd (4e47bdd)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliForwardCorrectionManager.cxx
Go to the documentation of this file.
1 //
2 // Manager (singleton) of corrections
3 //
6 #include "AliFMDCorrDoubleHit.h"
7 #include "AliFMDCorrELossFit.h"
8 #include "AliFMDCorrVertexBias.h"
10 #include "AliFMDCorrAcceptance.h"
11 #include "AliFMDCorrNoiseGain.h"
12 #include "AliForwardUtil.h"
13 #include "AliOADBForward.h"
14 #include "AliDataFile.h"
15 #include <TString.h>
16 #include <AliLog.h>
17 #include <TFile.h>
18 #include <TSystem.h>
19 #include <TBrowser.h>
20 #include <TROOT.h>
21 #include <TClass.h>
22 #include <iostream>
23 #include <iomanip>
24 
25 //____________________________________________________________________
27 const char* AliForwardCorrectionManager::fgkSecondaryMapSkel = "secondary";
28 const char* AliForwardCorrectionManager::fgkDoubleHitSkel = "doublehit";
29 const char* AliForwardCorrectionManager::fgkELossFitsSkel = "elossfits";
30 const char* AliForwardCorrectionManager::fgkVertexBiasSkel = "vertexbias";
32 const char* AliForwardCorrectionManager::fgkAcceptanceSkel = "acceptance";
33 const char* AliForwardCorrectionManager::fgkNoiseGainSkel = "noisegain";
34 
35 #define DB_NAME "fmd_corrections.root"
36 
37 //____________________________________________________________________
39 {
40  //
41  // Access to the singleton object
42  //
43  // Return:
44  // Reference to the singleton object
45  //
47  return *fgInstance;
48 }
49 
50 //____________________________________________________________________
52 {
53  //
54  // Default constructor
55  //
56 }
57 //____________________________________________________________________
60 {
61  //
62  // Non-default constructor
63  //
64  // Parameters:
65  // Not used
66  //
68  AliDataFile::GetFileNameOADB("PWGLF/FORWARD/CORRECTIONS/data/" DB_NAME).c_str(), AliFMDCorrSecondaryMap::Class(),
71  AliDataFile::GetFileNameOADB("PWGLF/FORWARD/CORRECTIONS/data/" DB_NAME).c_str(), AliFMDCorrELossFit::Class(),
72  kRun|kSys|kSNN|kSatellite|kMC /*kFull*/);
74  AliDataFile::GetFileNameOADB("PWGLF/FORWARD/CORRECTIONS/data/" DB_NAME).c_str(), AliFMDCorrVertexBias::Class(),
77  AliDataFile::GetFileNameOADB("PWGLF/FORWARD/CORRECTIONS/data/" DB_NAME).c_str(), AliFMDCorrMergingEfficiency::Class(),
80  AliDataFile::GetFileNameOADB("PWGLF/FORWARD/CORRECTIONS/data/" DB_NAME).c_str(), AliFMDCorrDoubleHit::Class(),
81  kStandard|kMC);
83  AliDataFile::GetFileNameOADB("PWGLF/FORWARD/CORRECTIONS/data/" DB_NAME).c_str(), AliFMDCorrAcceptance::Class(),
86  AliDataFile::GetFileNameOADB("PWGLF/FORWARD/CORRECTIONS/data/" DB_NAME).c_str(), AliFMDCorrNoiseGain::Class(), kRun);
87 }
88 //____________________________________________________________________
89 Bool_t
91  const char* sys,
92  Float_t sNN,
93  Float_t field,
94  Bool_t mc,
95  Bool_t sat,
96  UInt_t what,
97  Bool_t force)
98 {
99  //
100  // Read in correction based on passed parameters
101  //
102  // Parameters:
103  // collisionSystem Collision system string
104  // cmsNN Center of mass energy per nucleon pair [GeV]
105  // field Magnetic field [kG]
106  // mc Monte-carlo switch
107  // what What to read in
108  // force Force (re-)reading of specified things
109  //
110  // Return:
111  // true on success
112  //
114  // AliInfo(Form("Initialising with cms='%s', sNN=%fGeV field=%fkG",
115  // cms, sNN, field));
116  return Init(runNo, col,
119  mc, sat, what, force);
120 }
121 
122 //____________________________________________________________________
123 Bool_t
125  UShort_t sys,
126  UShort_t sNN,
127  Short_t field,
128  Bool_t mc,
129  Bool_t sat,
130  UInt_t what,
131  Bool_t force)
132 {
133  //
134  // Read in corrections based on the parameters given
135  //
136  // Parameters:
137  // collisionSystem Collision system
138  // cmsNN Center of mass energy per nuclean pair [GeV]
139  // field Magnetic field setting [kG]
140  // mc Monte-carlo switch
141  // what What to read in.
142  // force Force (re-)reading of specified things
143  //
144  // Return:
145  //
146  //
154 
155  return InitCorrections(runNo, sys, sNN, field, mc, sat, force);
156 }
157 
158 //____________________________________________________________________
159 UInt_t
161 {
162  UInt_t ret = 0;
163  TObjArray* tokens = fields.Tokenize(" \t,|+:;-&");
164  TIter next(tokens);
165  TObjString* ostr = 0;
166  while ((ostr = static_cast<TObjString*>(next()))) {
167  const TString& str = ostr->String();
168 
169  if (str.Contains("all", TString::kIgnoreCase))
170  ret |= kAll;
171  else if (str.Contains("default", TString::kIgnoreCase))
172  ret |= kDefault;
173  else if (str.Contains(fgkSecondaryMapSkel, TString::kIgnoreCase))
174  ret |= kSecondaryMap;
175  else if (str.Contains(fgkDoubleHitSkel, TString::kIgnoreCase))
176  ret |= kDoubleHit;
177  else if (str.Contains(fgkELossFitsSkel, TString::kIgnoreCase))
178  ret |= kELossFits;
179  else if (str.Contains(fgkVertexBiasSkel, TString::kIgnoreCase))
180  ret |= kVertexBias;
181  else if (str.Contains(fgkMergingEffSkel, TString::kIgnoreCase))
182  ret |= kMergingEfficiency;
183  else if (str.Contains(fgkAcceptanceSkel, TString::kIgnoreCase))
184  ret |= kAcceptance;
185  else if (str.Contains(fgkNoiseGainSkel, TString::kIgnoreCase))
186  ret |= kNoiseGain;
187  else
188  AliWarningClassF("Unknown correction: %s", str.Data());
189  }
190  delete tokens;
191  return ret;
192 }
193 
194 
195 //____________________________________________________________________
196 Bool_t
198  const TString& destination) const
199 {
200  TString dest(destination);
201  if (dest.IsNull())
202  dest = AliDataFile::GetFileNameOADB("OADB/PWGLF/FORWARD/CORRECTIONS/data/" DB_NAME).c_str();
203  return AliCorrectionManagerBase::Append(addition, dest);
204 }
205 
206 
207 //____________________________________________________________________
208 const AliFMDCorrELossFit*
210 {
216  return static_cast<const AliFMDCorrELossFit*>(Get(kIdELossFits));
217 }
218 //____________________________________________________________________
221 {
227  return static_cast<const AliFMDCorrSecondaryMap*>(Get(kIdSecondaryMap));
228 }
229 //____________________________________________________________________
230 const AliFMDCorrDoubleHit*
232 {
238  return static_cast<const AliFMDCorrDoubleHit*>(Get(kIdDoubleHit));
239 }
240 //____________________________________________________________________
243 {
249  return static_cast<const AliFMDCorrVertexBias*>(Get(kIdVertexBias));
250 }
251 //____________________________________________________________________
254 {
261  return
263 }
264 //____________________________________________________________________
267 {
274  return static_cast<const AliFMDCorrAcceptance*>(Get(kIdAcceptance));
275 }
276 //____________________________________________________________________
277 const AliFMDCorrNoiseGain*
279 {
285  return static_cast<const AliFMDCorrNoiseGain*>(Get(kIdNoiseGain));
286 }
287 
288 //____________________________________________________________________
289 const TAxis*
291 {
293  if (!map) return 0;
294  return &(map->GetEtaAxis());
295 }
296 //____________________________________________________________________
297 const TAxis*
299 {
301  if (!map) return 0;
302  return &(map->GetVertexAxis());
303 }
304 
305 
306 #ifndef DOXY_INPUT
307 //______________________________________________________________________________
308 // @cond
309 void AliForwardCorrectionManager::Streamer(TBuffer &R__b)
310 {
311  //
312  // Stream an object of class AliForwardCorrectionManager.
313  //
314  if (R__b.IsReading()) {
315  R__b.ReadClassBuffer(AliForwardCorrectionManager::Class(),this);
316  if (fgInstance) {
317  AliWarning(Form("Singleton instance already set (%p) when reading "
318  "singleton object (%p). Read object will be new "
319  "singleton object", fgInstance, this));
320  // delete fgInstance;
321  }
322  fgInstance = this;
323  // fgInstance->fCorrections.ls();
324  } else {
325  R__b.WriteClassBuffer(AliForwardCorrectionManager::Class(),this);
326  }
327 }
328 // @endcond
329 #endif
330 
331 //____________________________________________________________________
332 //
333 // EOF
334 //
return jsonbuilder str().c_str()
static Short_t ParseMagneticField(Float_t field)
void EnableCorrection(Int_t id, Bool_t enable=true)
const AliFMDCorrDoubleHit * GetDoubleHit() const
static UShort_t ParseCenterOfMassEnergy(UShort_t sys, Float_t cms)
virtual Bool_t Append(const TString &addition, const TString &destination="") const
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)
const TAxis & GetVertexAxis() const
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.
const AliFMDCorrMergingEfficiency * GetMergingEfficiency() const
unsigned long ULong_t
Definition: External.C:38
const AliFMDCorrELossFit * GetELossFit() const
const AliFMDCorrNoiseGain * GetNoiseGain() const
static UInt_t ParseFields(const TString &what)
short Short_t
Definition: External.C:23
static UShort_t ParseCollisionSystem(const char *sys)
const AliFMDCorrAcceptance * GetAcceptance() const
virtual Bool_t Append(const TString &addition, const TString &destination="") const
const AliFMDCorrVertexBias * GetVertexBias() const
unsigned short UShort_t
Definition: External.C:28
bool Bool_t
Definition: External.C:53
static AliForwardCorrectionManager * fgInstance
const AliFMDCorrSecondaryMap * GetSecondaryMap() const
static AliForwardCorrectionManager & Instance()
const TAxis & GetEtaAxis() const