AliPhysics  master (3d17d9d)
AliMCSpectraWeights.h
Go to the documentation of this file.
1 
8 #ifndef __AliMCSpectraWeights__
9 #define __AliMCSpectraWeights__
10 
11 class TParticle;
12 class AliMCEvent;
13 class TH3F;
14 class TH1D;
15 class TF1;
16 #include <string>
17 #include <vector>
18 
27 public:
28  enum ParticleType {
29  kPion = 0,
30  kProtons = 1,
31  kKaon = 2,
34  kRest = 5
35  };
36  enum TaskState {
37  kAllEmpty = 0,
41  };
42  enum SysFlag {
43  kNominal = 0,
65  };
67 private:
68  std::string fstCollisionSystem;
69  std::string fstFileMCSpectra;
70  std::string fstFilePublished;
71  std::string fstSavedObjName;
72  std::string fstSavedListName;
73  std::vector<std::string> fstPartTypes;
74  std::vector<std::string> fstCentralities;
75  std::vector<float>fBinsMultCent;
76  std::vector<float> fBinsPt;
79  TH3F*
82  AliMCEvent* fMCEvent;
83  float fMultOrCent;
86  TaskState fbTaskStatus; /* controls internal status of class */
90  // functions
91  std::string GetFunctionFromSysFlag(SysFlag flag);
92  std::string GetSysVarFromSysFlag(SysFlag flag);
93  double GetMultFromCent(int CentBin) const;
94  std::vector<float> GetMultTupleFromCent(int CentBin) const;
95  double GetMultFromCent(std::string cent);
96  double GetCentFromMult(double dMult);
97  void InitHistos();
98  void LoadMeasuredFractions();
99  void CountEventMult();
100  int GetPartTypeNumber(ParticleType type);
101  int GetPartTypeNumber(std::string Particle);
102  int GetCentFromString(std::string cent);
103  bool
105  bool LoadFromTHnF(const char* histname);
106  bool CalculateMCWeights();
107  bool CalcMCFractions();
108  bool CorrectFractionsforRest();
109  #ifdef __CINT__
111  AliMCSpectraWeights& operator=(const AliMCSpectraWeights&);
112  #endif
113 public:
116  std::string collisionSystem, std::string stName,
119  #ifdef __CLING__
120  //C++ 11 feature
121  AliMCSpectraWeights(const AliMCSpectraWeights&) = delete;
122  AliMCSpectraWeights& operator=(const AliMCSpectraWeights&) = delete;
123  #endif
124 
126 
127  void
128  Init();
129  float GetMCSpectraWeight(
130  TParticle* mcGenParticle,
131  float eventMultiplicityOrCentrality);
132  float
133  GetMCSpectraWeight(TParticle* mcGenParticle,
134  AliMCEvent* mcEvent);
135  void FillMCSpectra(
136  AliMCEvent* mcEvent);
138  // Setter
143  void SetBinsPt(std::vector<double> bins);
144 
149  void SetBinsMultCent(std::vector<double> bins);
150 
151  void SetMCSpectraFile(const char* file) { fstFileMCSpectra = file; }
152  void SetDataFractionsFile(const char* file) { fstFilePublished = file; }
153  void SetCollisionSystem(const char* system) { fstCollisionSystem = system; }
154  void SetUseMultiplicity(bool bMult) { fUseMultiplicity = bMult; }
155  void SetSavedObjName(const char* name) { fstSavedObjName = name; }
156  void SetSavedListName(const char* name) { fstSavedListName = name; }
157  void SetSysFlag(SysFlag flag) { fFlag = flag; }
158 
159  // Getter
160  const std::vector<float>& GetBinsPt() const { return fBinsPt; }
161  const std::vector<std::string>& GetParticleTypes() const { return fstPartTypes; }
162  int GetNPartTypes() const { return fNPartTypes; }
163  int GetTaskStatus() const { return fbTaskStatus; }
166  }
169  TH3F* GetHistMCWeights() const { return fHistMCWeights; }
170  SysFlag GetSysFlag() const { return fFlag; }
171  float GetMultOrCent() const { return fMultOrCent; }
172 
173  int IdentifyMCParticle(TParticle* mcParticle);
174 };
175 
176 #endif /* __AliMCSpectraWeights__ */
void FillMCSpectra(AliMCEvent *mcEvent)
void SetDataFractionsFile(const char *file)
void Init()
Initialisation of object.
Definition: External.C:260
TH3F * GetHistMCWeights() const
void SetUseMultiplicity(bool bMult)
std::string fstCollisionSystem
void SetBinsPt(std::vector< double > bins)
function to set pt binning of all internal histograms
const std::vector< float > & GetBinsPt() const
const std::vector< std::string > & GetParticleTypes() const
bool CalculateMCWeights()
calculate weight factors using internal information
float GetMultOrCent() const
void SetBinsMultCent(std::vector< double > bins)
function to set multiplicity binning of all internal histograms
TH3F * GetHistMCFraction() const
int GetCentFromString(std::string cent)
TH3F * GetHistDataFraction() const
bool LoadFromAliMCSpectraWeight(AliMCSpectraWeights *obj)
Load the information from a previous train output.
AliMCSpectraWeights()
default constructor
void SetCollisionSystem(const char *system)
std::string GetFunctionFromSysFlag(SysFlag flag)
void LoadMeasuredFractions()
Load measured fractions (expert input) from alien.
bool LoadFromTHnF(const char *histname)
bool CalcMCFractions()
calculate the relative fractions of all particle species in MC
std::vector< std::string > fstPartTypes
double GetCentFromMult(double dMult)
Definition: External.C:212
SysFlag GetSysFlag() const
bool CorrectFractionsforRest()
correct the expert input for remaining particle species
void SetSavedListName(const char *name)
std::vector< float > GetMultTupleFromCent(int CentBin) const
TH3F * GetHistMCGenPrimTrackParticles() const
TFile * file
TList with histograms for a given trigger.
double GetMultFromCent(int CentBin) const
std::vector< std::string > fstCentralities
int IdentifyMCParticle(TParticle *mcParticle)
int GetPartTypeNumber(ParticleType type)
void SetSavedObjName(const char *name)
std::vector< float > fBinsPt
void SetMCSpectraFile(const char *file)
std::vector< float > fBinsMultCent
std::string GetSysVarFromSysFlag(SysFlag flag)
float GetMCSpectraWeight(TParticle *mcGenParticle, float eventMultiplicityOrCentrality)
void SetSysFlag(SysFlag flag)
void InitHistos()
Create all internal histograms.
void CountEventMult()
count the number of charged particles in the current event