AliPhysics  2c6b7ad (2c6b7ad)
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 <TString.h>
15 #include <AliLog.h>
16 #include <TFile.h>
17 #include <TSystem.h>
18 #include <TBrowser.h>
19 #include <TROOT.h>
20 #include <TClass.h>
21 #include <iostream>
22 #include <iomanip>
23 
24 //____________________________________________________________________
26 const char* AliForwardCorrectionManager::fgkSecondaryMapSkel = "secondary";
27 const char* AliForwardCorrectionManager::fgkDoubleHitSkel = "doublehit";
28 const char* AliForwardCorrectionManager::fgkELossFitsSkel = "elossfits";
29 const char* AliForwardCorrectionManager::fgkVertexBiasSkel = "vertexbias";
31 const char* AliForwardCorrectionManager::fgkAcceptanceSkel = "acceptance";
32 const char* AliForwardCorrectionManager::fgkNoiseGainSkel = "noisegain";
33 
34 #define DB_NAME "fmd_corrections.root"
35 
36 //____________________________________________________________________
38 {
39  //
40  // Access to the singleton object
41  //
42  // Return:
43  // Reference to the singleton object
44  //
46  return *fgInstance;
47 }
48 
49 //____________________________________________________________________
51 {
52  //
53  // Default constructor
54  //
55 }
56 //____________________________________________________________________
59 {
60  //
61  // Non-default constructor
62  //
63  // Parameters:
64  // Not used
65  //
69  AliFMDCorrSecondaryMap::Class(),
74  AliFMDCorrELossFit::Class(),
75  kRun|kSys|kSNN|kSatellite|kMC /*kFull*/);
79  AliFMDCorrVertexBias::Class(),
84  AliFMDCorrMergingEfficiency::Class(),
89  AliFMDCorrDoubleHit::Class(),
90  kStandard|kMC);
94  AliFMDCorrAcceptance::Class(),
99  AliFMDCorrNoiseGain::Class(),
100  kRun);
101 }
102 //____________________________________________________________________
103 Bool_t
105  const char* sys,
106  Float_t sNN,
107  Float_t field,
108  Bool_t mc,
109  Bool_t sat,
110  UInt_t what,
111  Bool_t force)
112 {
113  //
114  // Read in correction based on passed parameters
115  //
116  // Parameters:
117  // collisionSystem Collision system string
118  // cmsNN Center of mass energy per nucleon pair [GeV]
119  // field Magnetic field [kG]
120  // mc Monte-carlo switch
121  // what What to read in
122  // force Force (re-)reading of specified things
123  //
124  // Return:
125  // true on success
126  //
128  // AliInfo(Form("Initialising with cms='%s', sNN=%fGeV field=%fkG",
129  // cms, sNN, field));
130  return Init(runNo, col,
133  mc, sat, what, force);
134 }
135 
136 //____________________________________________________________________
137 Bool_t
139  UShort_t sys,
140  UShort_t sNN,
141  Short_t field,
142  Bool_t mc,
143  Bool_t sat,
144  UInt_t what,
145  Bool_t force)
146 {
147  //
148  // Read in corrections based on the parameters given
149  //
150  // Parameters:
151  // collisionSystem Collision system
152  // cmsNN Center of mass energy per nuclean pair [GeV]
153  // field Magnetic field setting [kG]
154  // mc Monte-carlo switch
155  // what What to read in.
156  // force Force (re-)reading of specified things
157  //
158  // Return:
159  //
160  //
168 
169  return InitCorrections(runNo, sys, sNN, field, mc, sat, force);
170 }
171 
172 //____________________________________________________________________
173 UInt_t
175 {
176  UInt_t ret = 0;
177  TObjArray* tokens = fields.Tokenize(" \t,|+:;-&");
178  TIter next(tokens);
179  TObjString* ostr = 0;
180  while ((ostr = static_cast<TObjString*>(next()))) {
181  const TString& str = ostr->String();
182 
183  if (str.Contains("all", TString::kIgnoreCase))
184  ret |= kAll;
185  else if (str.Contains("default", TString::kIgnoreCase))
186  ret |= kDefault;
187  else if (str.Contains(fgkSecondaryMapSkel, TString::kIgnoreCase))
188  ret |= kSecondaryMap;
189  else if (str.Contains(fgkDoubleHitSkel, TString::kIgnoreCase))
190  ret |= kDoubleHit;
191  else if (str.Contains(fgkELossFitsSkel, TString::kIgnoreCase))
192  ret |= kELossFits;
193  else if (str.Contains(fgkVertexBiasSkel, TString::kIgnoreCase))
194  ret |= kVertexBias;
195  else if (str.Contains(fgkMergingEffSkel, TString::kIgnoreCase))
196  ret |= kMergingEfficiency;
197  else if (str.Contains(fgkAcceptanceSkel, TString::kIgnoreCase))
198  ret |= kAcceptance;
199  else if (str.Contains(fgkNoiseGainSkel, TString::kIgnoreCase))
200  ret |= kNoiseGain;
201  else
202  AliWarningClassF("Unknown correction: %s", str.Data());
203  }
204  delete tokens;
205  return ret;
206 }
207 
208 
209 //____________________________________________________________________
210 const AliFMDCorrELossFit*
212 {
218  return static_cast<const AliFMDCorrELossFit*>(Get(kIdELossFits));
219 }
220 //____________________________________________________________________
223 {
229  return static_cast<const AliFMDCorrSecondaryMap*>(Get(kIdSecondaryMap));
230 }
231 //____________________________________________________________________
232 const AliFMDCorrDoubleHit*
234 {
240  return static_cast<const AliFMDCorrDoubleHit*>(Get(kIdDoubleHit));
241 }
242 //____________________________________________________________________
245 {
251  return static_cast<const AliFMDCorrVertexBias*>(Get(kIdVertexBias));
252 }
253 //____________________________________________________________________
256 {
263  return
265 }
266 //____________________________________________________________________
269 {
276  return static_cast<const AliFMDCorrAcceptance*>(Get(kIdAcceptance));
277 }
278 //____________________________________________________________________
279 const AliFMDCorrNoiseGain*
281 {
287  return static_cast<const AliFMDCorrNoiseGain*>(Get(kIdNoiseGain));
288 }
289 
290 //____________________________________________________________________
291 const TAxis*
293 {
295  if (!map) return 0;
296  return &(map->GetEtaAxis());
297 }
298 //____________________________________________________________________
299 const TAxis*
301 {
303  if (!map) return 0;
304  return &(map->GetVertexAxis());
305 }
306 
307 
308 #ifndef DOXY_INPUT
309 //______________________________________________________________________________
310 // @cond
311 void AliForwardCorrectionManager::Streamer(TBuffer &R__b)
312 {
313  //
314  // Stream an object of class AliForwardCorrectionManager.
315  //
316  if (R__b.IsReading()) {
317  R__b.ReadClassBuffer(AliForwardCorrectionManager::Class(),this);
318  if (fgInstance) {
319  AliWarning(Form("Singleton instance already set (%p) when reading "
320  "singleton object (%p). Read object will be new "
321  "singleton object", fgInstance, this));
322  // delete fgInstance;
323  }
324  fgInstance = this;
325  // fgInstance->fCorrections.ls();
326  } else {
327  R__b.WriteClassBuffer(AliForwardCorrectionManager::Class(),this);
328  }
329 }
330 // @endcond
331 #endif
332 
333 //____________________________________________________________________
334 //
335 // EOF
336 //
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)
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
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