]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGCF/FLOW/Attic/AliFlowEvent.h
Merge branch 'feature-movesplit'
[u/mrichter/AliRoot.git] / PWGCF / FLOW / Attic / AliFlowEvent.h
1 //////////////////////////////////////////////////////////////////////
2 //
3 // $Id: AliFlowEvent.h 18618 2007-05-16 15:38:22Z snelling $
4 //
5 // Author: Emanuele Simili
6 //
7 //////////////////////////////////////////////////////////////////////
8 //
9 // Description: event format fitted to flow study, adapted from STAR.
10 //  The AliFlowEvent object stores global event variables, tracks and  
11 //  v0s, and provides the method to calculate Flow observables (Q vector, 
12 //  R.P. angle, phi weights). It needs an AliFlowSelection object.
13 //
14 // Original Authors:               Raimond Snellings & Art Poskanzer
15 //
16 //////////////////////////////////////////////////////////////////////
17
18 #ifndef AliFlowEvent_h
19 #define AliFlowEvent_h
20
21 #include "TVector.h"
22 #include "TVector2.h"
23 #include "TVector3.h"
24 #include "TClonesArray.h"
25 #include "TNamed.h"
26
27 #include "AliFlowConstants.h"
28
29 class AliFlowTrack ;
30 class AliFlowV0 ;
31 class AliFlowSelection ;
32
33 class AliFlowEvent : public TNamed {
34
35 public:                                                                            
36                                                                                    
37   AliFlowEvent() ;                                 // default constructor (to read events)                 
38   AliFlowEvent(Int_t length) ;                     // (new) constructor (to create events)                                                 
39   virtual        ~AliFlowEvent();                                                  
40                                                                                    
41  // Arrays
42   TClonesArray*     TrackCollection() const        { return fTrackCollection; }  // Returns a pointer to the TClonesArray of AliFlowTrack
43   TClonesArray*     V0Collection() const           { return fV0Collection; }     // Returns a pointer to the TClonesArray of AliFlowV0
44
45  // Calculations
46   void              MakeAll() ;                                                  // In just one loop, makes all the calculaton (Q, psi, mult) basing on the selection. 
47   Int_t             Mult(AliFlowSelection* pFlowSelect) const ;                  // Returns Multiplicity of tracks selected for the event plane
48   Float_t           MeanPt(AliFlowSelection* pFlowSelect) const ;                // Returns Mean pt of tracks selected for the event plane
49   TVector2          Q(AliFlowSelection* pFlowSelect) const ;                     // Returns Event plane vector
50   TVector2          NormQ(AliFlowSelection* pFlowSelect) const ;                 // Returns normalized Q = Q/sqrt(weights^2++)
51   Float_t           OldQ(AliFlowSelection* pFlowSelect) const ;                  // Returns Magnitude of normalized Q vector without pt or eta weighting
52   Float_t           Psi(AliFlowSelection* pFlowSelect) const ;                   // Returns Event plane angle
53   Double_t          SumWeightSquare(AliFlowSelection* pFlowSelect) const ;       // Returns Sum of weights^2
54   Double_t          WgtMultQ4(AliFlowSelection* pFlowSelect) const ;             // old comulants
55   Double_t          WgtMultQ6(AliFlowSelection* pFlowSelect) const ;             // old comulants
56   void              SetSelections(AliFlowSelection* pFlowSelect) ;               // Sets the tracks selection for R.P. calculations (see static cuts in AliFlowSelection class)
57   void              MakeSubEvents() const ;                                      // Makes sub-events, eta based (if EtaSubs()) or Random (otherwise)
58   void              MakeRndSubEvents() const ;                                   // Makes random sub-events
59   void              MakeEtaSubEvents() const ;                                   // Makes eta sub-events
60   void              MakeChrSubEvents() const ;                                   // Makes charged (+/-) sub-events
61   void              SetPids() ;                                                  // Re-sets the tracks P.id. (using the current fBayesianCs[] array)
62   void              RandomShuffle() ;                                            // Randomly re-shuffles the ObjArray of tracks
63   Double_t          NewG(AliFlowSelection* pFlowSelect,Double_t Zx,Double_t Zy) const ;  // Generating function for the new cumulant method (eq.3 in the Practical Guide)
64   Double_t          OldG(AliFlowSelection* pFlowSelect,Double_t Zx,Double_t Zy) const ;  // Generating function for the old cumulant method (if expanded in Taylor series, one recovers G_New() in new new cumulant method)
65   Double_t          PhiWeight(Int_t selN,Int_t harN,AliFlowTrack* pFlowTrack) const ;    // Returns PhiWeightRaw()*Weight()  
66   Double_t          PhiWeightRaw(Int_t selN,Int_t harN,AliFlowTrack* pFlowTrack) const ; // Returns weights for making the R.P. isotropic in the lab
67   Double_t          Weight(Int_t selN,Int_t harN,AliFlowTrack* pFlowTrack) const ;       // Returns weights for enhancing the resolution (+/-Sign(eta) for odd harmonics)
68   TVector           Bayesian() const ;                                                   // Returns the stored particle abundances as a TVector
69   void              Bayesian(Double_t bayes[AliFlowConstants::kPid]) const { for(Int_t i=0;i<AliFlowConstants::kPid;i++) { bayes[i] = AliFlowConstants::fgBayesian[i] ; } } // Returns the stored particle abundances
70
71  // Analysis flags
72   void       PrintFlagList() const ;                                                  // Prints a summary of the event's flag
73   Float_t    PtWgtSaturation() const  { return AliFlowConstants::fgPtWgtSaturation; } // Returns saturation value for pt weighting
74   Bool_t     PtWgt() const            { return fgPtWgt; }                             // Returns flag for pt weighting
75   Bool_t     EtaWgt() const           { return fgEtaWgt; }                            // Returns flag for eta weighting for odd harmonics
76   Bool_t     FirstLastPhiWgt() const  { return !fgOnePhiWgt ; }                       // Returns flag for using z of first and last points for phi weights (TPC +/-)
77   Bool_t     OnePhiWgt() const        { return fgOnePhiWgt ; }                        // Returns flag for using just one phi weight
78   Bool_t     NoWgt() const            { return fgNoWgt; }                             // returns kTRUE if weight are NOT used
79   Bool_t     CustomRespFunc() const   { return fgCustomRespFunc ; }
80   Bool_t     EtaSubs() const          { if(fgEtaSubs == 1)  { return kTRUE ; } return kFALSE ; }   // Returns flag for charged (+/-) sub-events
81   Bool_t     RndSubs() const          { if(fgEtaSubs == 0)  { return kTRUE ; } return kFALSE ; }   // Returns flag for random sub-events
82   Bool_t     ChrSubs() const          { if(fgEtaSubs == -1) { return kTRUE ; } return kFALSE ; }   // Returns flag for eta sub-events
83   Int_t      Subs() const             { return fgEtaSubs ; }                          // Returns flag for sub-events type (0 = random , 1 = eta , -1 = charged)
84
85  // Gets
86   Int_t      EventID() const                { return fEventID; }                          // Returns ID of the event
87   Int_t      RunID() const                  { return fRunID; }                            // Returns ID of the run
88   UInt_t     OrigMult() const               { return fOrigMult; }                         // Returns the original number of tracks (maybe some were trown away)
89   Long_t     L0TriggerWord() const          { return fL0Trigger; }                        // Returns L0 trigger word
90   Int_t      ZDCpart() const                { return fZDCpart; }                          // Returns estimated number of participants by the ZDC
91   Float_t    ZDCenergy(Int_t npem) const    { return fZDCenergy[npem]; }                  // Returns reconstructed energy in the neutron(1), proton(2), em(3) ZDC
92   Int_t      V0Mult() const                 { return fV0Collection->GetEntries() ; }      // Returns the number of V0s 
93   Int_t      TrackMult() const              { return fTrackCollection->GetEntries() ; }   // Returns number of tracks stored in the event
94
95   Int_t      UncorrNegMult(Float_t eta = AliFlowConstants::fgEtaGood) const ; // Returns number of - tracks in eta (-eta;eta)
96   Int_t      UncorrPosMult(Float_t eta = AliFlowConstants::fgEtaGood) const ; // Returns number of + tracks in eta (-eta;eta)
97   Int_t      MultEta() const ;                                                // Returns multiplicity in |eta|<AliFlowConstants::fgEetaMid
98   UInt_t     Centrality() ;                                                   // Returns centrality class, if not there, it sets it with MultEta()
99   TVector3   VertexPos() const;                                               // Returns primary vertex position as a TVector3
100   void       VertexPos(Float_t vtx[3]) const { for(Int_t ii=0;ii<3;ii++) { vtx[ii] = fVertexPos[ii] ; } }                         // Returns primary vertex position
101                                                                           
102   Float_t    ExtPsi(Int_t harN = 0) const    { if(harN<AliFlowConstants::kHars) { return fExtPsi[harN] ; } else { return 0. ; } } // external RP angle
103   Float_t    ExtRes(Int_t harN = 0) const    { if(harN<AliFlowConstants::kHars) { return fExtRes[harN] ; } else { return 0. ; } } // external RP resolution
104
105   Double_t   CenterOfMassEnergy() const      { return AliFlowConstants::fgCenterOfMassEnergy ; }   // Returns center of mass energy (5.5 TeV)
106   Double_t   MagneticField() const           { return AliFlowConstants::fgMagneticField ; }        // Returns magnetic field value
107   Short_t    BeamMassNumberEast() const      { return AliFlowConstants::fgBeamMassNumberEast ; }   // Returns beam mass (Pb = 208)
108   Short_t    BeamMassNumberWest() const      { return AliFlowConstants::fgBeamMassNumberWest ; }   // Returns beam mass (Pb = 208)
109
110  // Sets
111   void     SetEventID(const Int_t& id)                              { fEventID = id ; }  // Sets Event ID and the Event name (name = evtNumber_runId)
112   void     SetRunID(Int_t id)                                       { fRunID = id; }
113   void     SetOrigMult(UInt_t tracks)                               { fOrigMult = tracks; }
114   void     SetL0TriggerWord(Long_t trigger)                         { fL0Trigger = trigger; }
115   void     SetZDCpart(Int_t zdcp)                                   { fZDCpart = zdcp ; }
116   void     SetZDCenergy(Float_t n, Float_t p, Float_t em)           { fZDCenergy[0] = n ; fZDCenergy[1] = p ; fZDCenergy[2] = em ; }
117   void     SetVertexPos(Float_t v1=0.,Float_t v2=0.,Float_t v3=0.)  { fVertexPos[0] = v1 ; fVertexPos[1] = v2 ; fVertexPos[2] = v3 ; }
118
119   void     SetExtPsi(Int_t harN=0, Float_t psi=0.)                  { if(harN<AliFlowConstants::kHars) { fExtPsi[harN] = psi ; } }
120   void     SetExtRes(Int_t harN=0, Float_t res=0.)                  { if(harN<AliFlowConstants::kHars) { fExtRes[harN] = res ; } }
121
122   void     SetCentrality(Int_t cent)                                { fCentrality = cent ; } // Set the Centrality Classes to "cent"
123   void     SetCentrality() ;                                        // Sets the Centrality Classes basing on Multiplicity at mid rapidity
124
125   static void SetChrSubs()                                          { fgEtaSubs = -1 ; }
126   static void SetRndSubs()                                          { fgEtaSubs = 0 ; }
127   static void SetEtaSubs()                                          { fgEtaSubs = 1 ; }
128   static void SetOnePhiWgt()                                        { fgOnePhiWgt = kTRUE ; }
129   static void SetFirstLastPhiWgt()                                  { fgOnePhiWgt = kFALSE ; }
130   static void SetPtWgt(Bool_t ptWgt = kTRUE)                        { fgPtWgt = ptWgt; }
131   static void SetEtaWgt(Bool_t etaWgt = kTRUE)                      { fgEtaWgt = etaWgt ; }
132   static void SetNoWgt(Bool_t nowgt = kTRUE)                        { fgNoWgt = nowgt ; }  // still for odd harmonics: Wgt = +1 (positive Eta) or -1 (negative Eta)
133   static void SetCustomRespFunc(Bool_t crf = kTRUE)                 { fgCustomRespFunc = crf ; }
134                 
135   void    SetBayesian(Double_t bayes[AliFlowConstants::kPid]) const { for(Int_t i=0;i<AliFlowConstants::kPid;i++) { AliFlowConstants::fgBayesian[i] = bayes[i] ; } } // Set the Bayesian vector of particle abundances
136   void    SetMagneticField(const Double_t& mf) const                { AliFlowConstants::fgMagneticField = mf; }
137   void    SetCenterOfMassEnergy(const Double_t& cms) const          { AliFlowConstants::fgCenterOfMassEnergy = cms; }
138   void    SetBeamMassNumberEast(const Short_t& bme) const           { AliFlowConstants::fgBeamMassNumberEast = bme; }
139   void    SetBeamMassNumberWest(const Short_t& bmw) const           { AliFlowConstants::fgBeamMassNumberWest = bmw; }
140
141 // Fills Weights from Arrays (from file: flowPhiWgt.hist.root)
142   void    SetPhiWeight(const AliFlowConstants::PhiWgt_t& pPhiWgt)           { memcpy (fPhiWgt, pPhiWgt, sizeof(AliFlowConstants::PhiWgt_t)); }
143   void    SetPhiWeightPlus(const AliFlowConstants::PhiWgt_t& pPhiWgtPlus)   { memcpy (fPhiWgtPlus,  pPhiWgtPlus,  sizeof(AliFlowConstants::PhiWgt_t)); }
144   void    SetPhiWeightMinus(const AliFlowConstants::PhiWgt_t& pPhiWgtMinus) { memcpy (fPhiWgtMinus, pPhiWgtMinus, sizeof(AliFlowConstants::PhiWgt_t)); }
145   void    SetPhiWeightCross(const AliFlowConstants::PhiWgt_t& pPhiWgtCross) { memcpy (fPhiWgtCross, pPhiWgtCross, sizeof(AliFlowConstants::PhiWgt_t)); }
146
147
148 private:
149
150  // to make the code checker happy
151   AliFlowEvent(const AliFlowEvent &flowEvent) ;                  // Copy Constructor (dummy)
152   AliFlowEvent &operator=(const AliFlowEvent &flowEvent) ;       // Assignment Operator (dummy)
153
154  // Data Members
155   Int_t               fEventID;                                  // ID of the event
156   Int_t               fRunID;                                    // ID of the run
157   UInt_t              fOrigMult;                                 // Original number of tracks
158   Long_t              fL0Trigger;                                // Level 0 trigger 
159   Int_t               fZDCpart;                                  // ZDC estimated number of participants 
160   Float_t             fZDCenergy[3];                             // ZDC reconstructed energy [neutron,proton,em]
161   Float_t             fVertexPos[3];                             // primary vertex position
162   Int_t               fCentrality;                               //! Centrality Class (calculated from mult.)
163
164  // extension
165   Float_t             fExtPsi[AliFlowConstants::kHars] ;         // external RP angle (should be an input)
166   Float_t             fExtRes[AliFlowConstants::kHars] ;         // external RP resolution (should be an input as well)
167
168  // Tracks & V0s
169   TClonesArray*       fTrackCollection ;                         // collection of Flow Tracks
170   TClonesArray*       fV0Collection ;                            // collection of Flow V0s
171
172  // Weights
173   AliFlowConstants::PhiWgt_t      fPhiWgt;                       //! flattening weights (single hist)
174   AliFlowConstants::PhiWgt_t      fPhiWgtPlus;                   //! flattening weights (3 hist) - plus Z
175   AliFlowConstants::PhiWgt_t      fPhiWgtMinus;                  //! flattening weights (3 hist) - minus Z
176   AliFlowConstants::PhiWgt_t      fPhiWgtCross;                  //! flattening weights (3 hist) - cross Z
177   //Double_t            fBayesianCs[AliFlowConstants::kPid] ;    //! expected particles abundance (see Bayesian P.Id.)
178
179  // Weighting & Settings
180   static Bool_t       fgPtWgt;                                   //! flag for pt weighting
181   static Bool_t       fgEtaWgt;                                  //! flag for eta weighting for odd harmonics
182   static Bool_t       fgOnePhiWgt;                               //! flag for phi weights (just one hist)
183   static Bool_t       fgNoWgt;                                   //! No Weights (Wgt == 1)
184   static Bool_t       fgCustomRespFunc ;                         //! A custom "detector response function" is used for P.Id
185   static Int_t        fgEtaSubs;                                 //! Flag type of Sub-Events (0 = random , 1 = eta , -1 = charged)
186
187
188  // shortcuts (to speed up the execution)
189   Bool_t   fDone ;                                                                              //! flag setted kTRUE when the loop is done
190   TVector2 fQ[AliFlowConstants::kSels][AliFlowConstants::kHars];                                //! flow vector
191   UInt_t   fMult[AliFlowConstants::kSels][AliFlowConstants::kHars];                             //! multiplicity
192   Float_t  fSumOfWeightSqr[AliFlowConstants::kSels][AliFlowConstants::kHars];                   //! Sqrt(Sum(wgt)) ~ Sqrt(Mult)
193   TVector2 fQSub[AliFlowConstants::kSubs][AliFlowConstants::kSels][AliFlowConstants::kHars];    //! flow vector subs
194   UInt_t   fMultSub[AliFlowConstants::kSubs][AliFlowConstants::kSels][AliFlowConstants::kHars]; //! multiplicity subs
195
196   ClassDef(AliFlowEvent,2) ;                    // macro for rootcint
197 };
198
199 #endif