some fixes for running with makeflow
[u/mrichter/AliRoot.git] / PWGLF / ThermalFits / AliParticleYield.h
CommitLineData
2f86df33 1#ifndef _ALIPARTICLEYIELD_H_
2#define _ALIPARTICLEYIELD_H_
3
4// AliParticleYield
5// This class implements a container for particle yields results, to
6// be used e.g. in thermal model fits, with utility methods to
7// read/write to ASCII files or root trees
8// Author: Michele FLoris, michele.floris@cern.ch
9
10#include "TObject.h"
11#include "TString.h"
12
13class TClonesArray;
14class TTree;
15
16class AliParticleYield : public TObject
17{
18public:
19
20 enum AliPYCSystem_t {kCSpp = 0,
21 kCSpPb = 1,
22 kCSPbPb = 2 } ;
23
24 static const char * kSystemString[];
25
26 enum AliPYStatusCode_t {
27 kSCPublished = 0,
28 kSCPreliminary = 1,
29 kSCFinalNotPublished = 2,
30 kSCMayChange = 3,
31 };
32
33 static const char * kStatusString[];
34
35 enum AliPYMeasurementType_t { // this is a bit mask: more than one bit can be one (be careful not to set mutually exclusive ones).
36 // Type of measurements (lowest nibble reserved for this)
37 kTypeLinearInterpolation = 0x1,
38 kTypeParticleRatio = 0x2, // If true, this is a ratio of 2 particles where the propagation of uncertainty was properly taken into account.
39
40 // Type of errors
41 kTypeOnlyTotError = 0x10, // If on, only the total error is returned as "GetSystError". GetStatError should be set to 0;
42 };
43
44 AliParticleYield();
45 AliParticleYield(Int_t pdg, Int_t system, Float_t sqrts, Float_t value, Float_t stat, Float_t syst, Float_t norm, Float_t ymin, Float_t ymax, Int_t status, Int_t type, TString centr, Int_t isSum = 0, TString tag = "ALICE");
46 virtual ~AliParticleYield();
47 AliParticleYield(const AliParticleYield& part);
48
49 // IO
50 static TClonesArray * ReadFromASCIIFile(const char * fileName, const char * separators = " \t");
51 static TTree * ReadFromASCIIFileAsTree(const char * fileName, const char * separators = " \t");
52 static void SaveAsASCIIFile(TClonesArray * arr, const char * filename, const char * separator = " ", Int_t colWidth = 7);
53 static TClonesArray * GetEntriesMatchingSelection(TTree * tree, TString selection);
54
55 // Misc helpers
56 Bool_t CheckTypeConsistency() const;
16163c99 57 Bool_t CheckForDuplicates(TClonesArray * arr) ;
58 virtual void Print (Option_t * opt = "") const;
2f86df33 59 static Float_t GetError(TString error, Float_t yield) ;
60 static const char * FormatCol(const char * text, Int_t width, const char * sep) ;
61 static Double_t RoundToSignificantFigures(double num, int n) ;
16163c99 62 Bool_t operator==(const AliParticleYield& rhs);
63 Bool_t IsTheSameMeasurement(AliParticleYield &rhs);
2f86df33 64
65 // Getters
66 TString GetCentr() const{ return fCentr ;}
67 Int_t GetCollisionSystem() const{ return fCollisionSystem ;}
68 Int_t GetIsSum() const{ return fIsSum ;}
69 Int_t GetPdgCode() const{ return fPdgCode ;}
70 Int_t GetPdgCode2() const{ return fPdgCode2; }
71 Float_t GetSqrtS() const{ return fSqrtS ;}
72 Float_t GetYield() const{ return fYield ;}
73 Float_t GetNormError() const{ return fNormError ;}
74 TString GetPartName() const{ return fPartName ;}
75 Float_t GetStatError() const{ return fStatError ;}
76 Int_t GetStatus() const{ return fStatus ;}
77 Float_t GetSystError() const{ return fSystError ;}
78 Float_t GetYMax() const{ return fYMax ;}
79 Float_t GetYMin() const{ return fYMin ;}
80 UInt_t GetMeasurementType() const{ return fMeasurementType ;}
81 TString GetTag() const{ return fTag; }
82
83 const char * GetLatexName(Int_t pdg = 0) const;
84 Float_t GetTotalError(Bool_t includeNormalization = kFALSE) const;
85
86 Bool_t IsTypeMeasured() const{ CheckTypeConsistency(); return !(fMeasurementType & kTypeLinearInterpolation);}
87 Bool_t IsTypeRatio() const{ CheckTypeConsistency(); return (fMeasurementType & kTypeParticleRatio);}
88 Bool_t IsTypeLinearInterp() const{ CheckTypeConsistency(); return fMeasurementType & kTypeLinearInterpolation;}
89 Bool_t IsTypeOnlyTotErr() const{ CheckTypeConsistency(); return fMeasurementType & kTypeOnlyTotError; }
90
91 static Int_t GetSignificantDigits() { return fSignificantDigits; }
92
93 // Setters
94 void SetCentr (TString var ) { fCentr = var ;}
95 void SetCollisionSystem (AliPYCSystem_t var ) { fCollisionSystem = var ;}
96 void SetIsSum (Int_t var ) { fIsSum = var ;}
97 void SetPdgCode (Int_t var ) { fPdgCode = var ; SetPartName(var);}
98 void SetPdgCode2 (Int_t var ) { fPdgCode2 = var; }
99 void SetSqrtS (Float_t var ) { fSqrtS = var ;}
100 void SetYield (Float_t var ) { fYield = var ;}
101 void SetNormError (Float_t var ) { fNormError = var ;}
102 void SetPartName (TString var ) { fPartName = var; SetPdgCode(var); }
103 void SetStatError (Float_t var ) { fStatError = var ;}
104 void SetStatus (AliPYStatusCode_t var ) { fStatus = var ;}
105 void SetSystError (Float_t var ) { fSystError = var ;}
106 void SetYMax (Float_t var ) { fYMax = var ;}
107 void SetYMin (Float_t var ) { fYMin = var ;}
108 void SetMeasurementType (UInt_t var ) { fMeasurementType = var ;}
109 void SetTag (TString var ) { fTag = var;}
110 //This 2 additional setters will ensure consistency between the pdg code and the name of the particle
111 void SetPartName(Int_t pdgCode);
112 void SetPdgCode (TString partName);
113
114 void SetTypeBits(UInt_t mask) { fMeasurementType |= mask; } // This switches on the bits passed. Does not affect the others! If you want to set the Whole mask, use SetMeasurementType
115
116 static void SetSignificantDigits (Int_t var) { fSignificantDigits = var;}
117
118
119
120
121private:
122
16163c99 123 Bool_t Compare2Floats(Float_t a, Float_t b) ;
124
2f86df33 125 Int_t fPdgCode; // PdgCode
126 Int_t fPdgCode2; // The PdgCode of the second particle, only needed in case of a ratio
127 TString fPartName; // Particle name (redundant, we also have PDG code)
128 Int_t fCollisionSystem; // Collision System, see the AliPYCSystem_t enum for possible values
129 Float_t fSqrtS; // center of mass energy, in GeV
130 Float_t fYield; // The yield
131 Float_t fStatError; // StatError
132 Float_t fSystError; // SystError
133 Float_t fNormError; // Normalization error
134 Float_t fYMin; // min rapidity cut
135 Float_t fYMax; // max rapidity cut
136 Int_t fStatus; // Status code, to determine the quality of the measurement, see AliPYStatusCode_t for possible values
137
138 UInt_t fMeasurementType; // Measurement Type, e.g. actually measured, interpolated from 2 centrality bins or only total error given, etc. THIS IS A BIT MASK see AliPYMeasurementType_t for possible values and the IsType* Methods for easy access. Be carefull not to set mutually exclusive values
139
140 TString fCentr; // Centrality. The format is estimator 3-digits id, bin low-edge 2 digits, bin hi-edge 2 digits , e.g. V0A0005
141 Int_t fIsSum; // A flag which indicates if the yield is for a single charge or for the sum. 0 = single charge, 1 = particle + antiparticle
142 TString fTag; // Generic text tag (to be used e.g. for the name of the experiment)
143
144
145 static Int_t fSignificantDigits; // Significant Digits to be used in values and errors
16163c99 146 static Float_t fEpsilon; // Used for float conparisons
2f86df33 147
148 ClassDef(AliParticleYield,1)
149};
150
151
152#endif /* _ALIPARTICLEYIELD_H_ */