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