]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG4/CaloCalib/AliAnalysisTaskEMCALPi0PbPb.h
set geometry matrices if not yet set
[u/mrichter/AliRoot.git] / PWG4 / CaloCalib / AliAnalysisTaskEMCALPi0PbPb.h
1 #ifndef AliAnalysisTaskEMCALPi0PbPb_h
2 #define AliAnalysisTaskEMCALPi0PbPb_h
3
4 // $Id$
5
6 class TAxis;
7 class TClonesArray;
8 class TH1;
9 class TH2;
10 class TNtuple;
11 class TObjArray;
12 class AliAODCaloCells;
13 class AliAODCaloCluster;
14 class AliAODEvent;
15 class AliAODTrack;
16 class AliAODVertex;
17 class AliEMCALGeoUtils;
18 class AliEMCALRecoUtils;
19 class AliESDCaloCells;
20 class AliESDCaloCluster;
21 class AliESDEvent;
22 class AliESDTrack;
23 class AliESDVertex;
24 class AliESDtrackCuts;
25 class AliStaHeader;
26 class AliStaVertex;
27
28 #include "AliAnalysisTaskSE.h"
29
30 class AliAnalysisTaskEMCALPi0PbPb : public AliAnalysisTaskSE {
31  public:
32   AliAnalysisTaskEMCALPi0PbPb(const char *name=0);
33   virtual ~AliAnalysisTaskEMCALPi0PbPb(); 
34   
35   void         UserCreateOutputObjects();
36   void         UserExec(Option_t *option);
37   void         Terminate(Option_t *);
38
39   void         SetAsymMax(Double_t asymMax)                   { fAsymMax = asymMax;         }
40   void         SetCentrality(const char *name)                { fCentVar = name;            }
41   void         SetCentralityRange(Double_t from, Double_t to) { fCentFrom=from; fCentTo=to; }
42   void         SetClusName(const char *name)                  { fClusName = name;           }
43   void         SetDoAfterburner(Bool_t b)                     { fDoAfterburner = b;         }
44   void         SetDoTrackMatWithGeom(Bool_t b)                { fDoTrackMatWithGeom = b;    }
45   void         SetDoTrackVtxConstrain(Bool_t b)               { fDoConstrain = b;           }
46   void         SetFillNtuple(Bool_t b)                        { fDoNtuple = b;              }
47   void         SetGeoName(const char *n)                      { fGeoName = n;               }
48   void         SetIsoDist(Double_t d)                         { fIsoDist = d;               }
49   void         SetMinClusEnergy(Double_t e)                   { fMinE = e;                  }
50   void         SetMinEcc(Double_t ecc)                        { fMinEcc = ecc;              }
51   void         SetMinErat(Double_t erat)                      { fMinErat = erat;            }
52   void         SetMinNClustersPerTrack(Double_t mct)          { fMinNClustPerTrack = mct;   }
53   void         SetMinPtPerMatchedTrack(Double_t mpt)          { fMinPtPerTrack = mpt;       }
54   void         SetNminCells(Int_t n)                          { fNminCells = n;             }
55   void         SetTrClassNames(const char *n)                 { fTrClassNames = n;          }
56   void         SetTrackCuts(AliESDtrackCuts *c)               { fTrCuts = c;                }
57   void         SetUseQualFlag(Bool_t b)                       { fUseQualFlag = b;           }
58   void         SetVertexRange(Double_t z1, Double_t z2)       { fVtxZMin=z1; fVtxZMax=z2;   }
59
60  protected:
61   virtual void CalcClusterProps();
62   virtual void CalcTracks();
63   virtual void ClusterAfterburner();
64   virtual void FillCellHists();
65   virtual void FillClusHists();
66   virtual void FillNtuple();
67   virtual void FillOtherHists();
68   virtual void FillPionHists();
69   void         FillVertex(AliStaVertex *v, const AliESDVertex *esdv);
70   void         FillVertex(AliStaVertex *v, const AliAODVertex *aodv);
71
72   Double_t     GetCellIsolation(Double_t cEta, Double_t cPhi, Double_t radius=0.2)                const;
73   Double_t     GetMaxCellEnergy(AliVCluster *c) const { Short_t id=-1; return GetMaxCellEnergy(c,id); }
74   Double_t     GetMaxCellEnergy(AliVCluster *c, Short_t &id)                                      const;
75   Int_t        GetNCells(AliVCluster *c, Double_t emin=0.)                                        const;
76   void         GetSigma(AliVCluster *c, Double_t &sigmaMax, Double_t &sigmaMin)                   const;
77   Double_t     GetTrackIsolation(Double_t cEta, Double_t cPhi, Double_t radius=0.2)               const;
78
79   class ClusProps {
80     public:
81       ClusProps() : fTrIndex(-1), fTrDz(-1), fTrDr(-1), fTrDist(-1), fTrEp(0), 
82                     fTrIso(0), fTrLowPtIso(0), fCellIso(0) {}
83       void Reset() { fTrIndex=-1; fTrDz=-1; fTrDr=-1; fTrDist=-1; fTrEp=0; fTrIso=0; fTrLowPtIso=0; fCellIso=0; }
84       Int_t    fTrIndex;
85       Double_t fTrDz;
86       Double_t fTrDr;
87       Double_t fTrDist;
88       Double_t fTrEp;
89       Double_t fTrIso;
90       Double_t fTrLowPtIso;
91       Double_t fCellIso;
92   };
93     // input members
94   TString                fCentVar;                // variable for centrality determination
95   Double_t               fCentFrom;               // min centrality (def=0)
96   Double_t               fCentTo;                 // max centrality (def=100)
97   Double_t               fVtxZMin;                // min primary vertex z (def=-10cm)
98   Double_t               fVtxZMax;                // max primary vertex z (def=+10cm)
99   Bool_t                 fUseQualFlag;            // if true use quality flag for centrality
100   TString                fClusName;               // cluster branch name (def="")
101   Bool_t                 fDoNtuple;               // if true write out ntuple
102   Bool_t                 fDoAfterburner;          // if true run after burner
103   Double_t               fAsymMax;                // maximum energy asymmetry (def=1)
104   Int_t                  fNminCells;              // minimum number of cells attached to cluster (def=1)
105   Double_t               fMinE;                   // minimum cluster energy (def=0.1 GeV/c)
106   Double_t               fMinErat;                // minimum emax/ec ratio (def=0)
107   Double_t               fMinEcc;                 // minimum eccentricity (def=0)
108   TString                fGeoName;                // geometry name (def = EMCAL_FIRSTYEARV1)
109   Double_t               fMinNClustPerTrack;      // minimum number of cluster per track (def=50)
110   Double_t               fMinPtPerTrack;          // minimum pT per track (def=0.25 GeV/c)
111   Double_t               fIsoDist;                // isolation distance (def=0.2)
112   TString                fTrClassNames;           // trigger class names
113   AliESDtrackCuts       *fTrCuts;                 // track cuts
114   Bool_t                 fDoTrackMatWithGeom;     // track matching including geometry
115   Bool_t                 fDoConstrain;            // if true constrain tracks to vertex 
116
117     // derived members (ie with ! after //)
118   Bool_t                 fIsGeoMatsSet;           //!indicate that geo matrices are set 
119   ULong64_t              fNEvs;                   //!accepted events 
120   AliEMCALGeoUtils      *fGeom;                   //!geometry utils
121   AliEMCALRecoUtils     *fReco;                   //!geometry utils
122   TList                 *fOutput;                 //!container of output histograms
123   TObjArray             *fTrClassNamesArr;        //!array of trig class names  
124   AliESDEvent           *fEsdEv;                  //!pointer to input esd event
125   AliAODEvent           *fAodEv;                  //!pointer to input aod event
126   TObjArray             *fRecPoints;              //!pointer to rec points (AliAnalysisTaskEMCALClusterizeFast)
127   TObjArray             *fEsdClusters;            //!pointer to esd clusters
128   AliESDCaloCells       *fEsdCells;               //!pointer to esd cells
129   TObjArray             *fAodClusters;            //!pointer to aod clusters
130   AliAODCaloCells       *fAodCells;               //!pointer to aod cells
131   TAxis                 *fPtRanges;               //!pointer to pt ranges
132   TObjArray             *fSelTracks;              //!pointer to selected tracks
133   ClusProps              fClusProps[1000];        //!array of cluster properties
134     // ntuple
135   TTree                 *fNtuple;                 //!pointer to ntuple
136   AliStaHeader          *fHeader;                 //!pointer to header
137   AliStaVertex          *fPrimVert;               //!pointer to primary vertex
138   AliStaVertex          *fSpdVert;                //!pointer to SPD vertex
139   AliStaVertex          *fTpcVert;                //!pointer to TPC vertex
140   TClonesArray          *fClusters;               //!pointer to clusters
141     // histograms
142   TH1                   *fHCuts;                  //!histo for cuts
143   TH1                   *fHVertexZ;               //!histo for vtxz
144   TH1                   *fHVertexZ2;              //!histo for vtxz after vtx cuts
145   TH1                   *fHCent;                  //!histo for cent
146   TH1                   *fHCentQual;              //!histo for cent after quality flag cut
147   TH1                   *fHTclsBeforeCuts;        //!histo for trigger classes before cuts
148   TH1                   *fHTclsAfterCuts;         //!histo for trigger classes after cuts
149
150     // histograms for cells
151   TH2                  **fHColuRow;               //!histo for cell column and row
152   TH2                  **fHColuRowE;              //!histo for cell column and row weight energy
153   TH1                  **fHCellMult;              //!histo for cell multiplicity in module
154   TH1                   *fHCellE;                 //!histo for cell energy
155   TH1                   *fHCellH;                 //!histo for highest cell energy
156   TH1                   *fHCellM;                 //!histo for mean cell energy (normalized to hit cells)
157   TH1                   *fHCellM2;                //!histo for mean cell energy (normalized to all cells)
158   TH1                  **fHCellFreqNoCut;         //!histo for cell frequency without cut
159   TH1                  **fHCellFreqCut100M;       //!histo for cell frequency with cut 100MeV
160   TH1                  **fHCellFreqCut300M;       //!histo for cell frequency with cut 300MeV
161   TH1                  **fHCellFreqE;             //!histo for cell frequency weighted with energy
162   TH1                  **fHCellCheckE;            //!histo for cell E distribution for given channels
163     // histograms for clusters
164   TH1                   *fHClustEccentricity;     //!histo for cluster eccentricity
165   TH2                   *fHClustEtaPhi;           //!histo for cluster eta vs. phi
166   TH2                   *fHClustEnergyPt;         //!histo for cluster energy vs. pT
167   TH2                   *fHClustEnergySigma;      //!histo for cluster energy vs. variance over long axis 
168   TH2                   *fHClustSigmaSigma;       //!histo for sigma vs. lambda_0 comparison
169   TH2                   *fHClustNCellEnergyRatio; //!histo for cluster n tow vs. energy ratio
170     // histograms for pion candidates
171   TH2                   *fHPionEtaPhi;            //!histo for pion eta vs. phi
172   TH2                   *fHPionMggPt;             //!histo for pion mass vs. pT
173   TH2                   *fHPionMggAsym;           //!histo for pion mass vs. asym
174   TH2                   *fHPionMggDgg;            //!histo for pion mass vs. opening angle
175   TH1                   *fHPionInvMasses[21];     //!histos for invariant mass plots 
176
177  private:
178   AliAnalysisTaskEMCALPi0PbPb(const AliAnalysisTaskEMCALPi0PbPb&);            // not implemented
179   AliAnalysisTaskEMCALPi0PbPb &operator=(const AliAnalysisTaskEMCALPi0PbPb&); // not implemented
180
181   ClassDef(AliAnalysisTaskEMCALPi0PbPb, 5); // Analysis task for neutral pions in Pb+Pb
182 };
183 #endif
184
185 #ifndef AliStaObjs_h
186 #define AliStaObjs_h
187 class AliStaHeader
188 {
189  public:
190   AliStaHeader() : fRun(0), fOrbit(0), fPeriod(0), fBx(0), fL0(0), fL1(0), fL2(0),
191                    fTrClassMask(0), fTrCluster(0), fOffTriggers(0), fFiredTriggers(),
192                    fTcls(0), fV0Cent(0), fCl1Cent(0), fTrCent(0), fCqual(-1) {;}
193   virtual ~AliStaHeader() {;}
194   ULong64_t     GetEventId() const {
195                   return (((ULong64_t)fPeriod << 36) |
196                           ((ULong64_t)fOrbit  << 12) |
197                           (ULong64_t)fBx); 
198                 }
199
200  public:
201   Int_t         fRun;            //         run number
202   UInt_t        fOrbit;          //         orbit number
203   UInt_t        fPeriod;         //         period number
204   UShort_t      fBx;             //         bunch crossing id
205   UInt_t        fL0;             //         l0 trigger bits
206   UInt_t        fL1;             //         l1 trigger bits
207   UShort_t      fL2;             //         l2 trigger bits
208   ULong64_t     fTrClassMask;    //         trigger class mask
209   UChar_t       fTrCluster;      //         trigger cluster mask
210   UInt_t        fOffTriggers;    //         fired offline triggers for this event
211   TString       fFiredTriggers;  //         string with fired triggers
212   UInt_t        fTcls;           //         custom trigger definition
213   Double32_t    fV0Cent;         //[0,0,16] v0 cent
214   Double32_t    fCl1Cent;        //[0,0,16] cl1 cent
215   Double32_t    fTrCent;         //[0,0,16] tr cent
216   Int_t         fCqual;          //         centrality quality
217
218   ClassDef(AliStaHeader,1) // Header class
219 };
220
221 class AliStaVertex
222 {
223  public:
224   AliStaVertex(Double_t x=0, Double_t y=0, Double_t z=0) : fVx(x), fVy(y), fVz(z), fVc(-1), fDisp(0), fZres(0),
225                                                            fChi2(0), fSt(0), fIs3D(0), fIsZ(0) {;}
226   virtual ~AliStaVertex() {;}
227
228  public:
229   Double_t      fVx;          //[0,0,16] vertex x
230   Double_t      fVy;          //[0,0,16] vertex y
231   Double_t      fVz;          //[0,0,16] vertex z
232   Double_t      fVc;          //[0,0,16] number of contributors to vertex
233   Double_t      fDisp;        //[0,0,16] dispersion
234   Double_t      fZres;        //[0,0,16] z-resolution
235   Double_t      fChi2;        //[0,0,16] chi2 of fit
236   Bool_t        fSt;          //         status bit
237   Bool_t        fIs3D;        //         is vertex from 3D
238   Bool_t        fIsZ;         //         is vertex from Z only
239
240   ClassDef(AliStaVertex,1) // Vertex class
241 };
242
243 class AliStaCluster : public TObject
244 {
245  public:
246     AliStaCluster() : TObject(), fE(0), fR(0), fEta(0), fPhi(0), fN(0), fN1(0), fN3(0), fIdMax(0), fEmax(0),  
247                       fDbc(0), fDisp(0), fM20(0), fM02(0), fEcc(0), fSig(0), fTrDz(0), fTrDr(-1), fTrEp(0), 
248                       fTrIso(0), fCeIso(0) {;}
249
250 //  void          GetMom(TLorentzVector& p, Double_t *vertex=0);
251
252  public:
253   Double32_t    fE;                //[0,0,16] energy
254   Double32_t    fR;                //[0,0,16] radius
255   Double32_t    fEta;              //[0,0,16] eta
256   Double32_t    fPhi;              //[0,0,16] phi
257   UChar_t       fN;                //         number of cells
258   UChar_t       fN1;               //         number of cells > 100 MeV
259   UChar_t       fN3;               //         number of cells > 300 MeV
260   UShort_t      fIdMax;            //         id maximum cell
261   Double32_t    fEmax;             //[0,0,16] energy of maximum cell
262   Double32_t    fDbc;              //[0,0,16] distance to nearest bad channel
263   Double32_t    fDisp;             //[0,0,16] cluster dispersion, for shape analysis
264   Double32_t    fM20;              //[0,0,16] 2-nd moment along the main eigen axis
265   Double32_t    fM02;              //[0,0,16] 2-nd moment along the second eigen axis
266   Double32_t    fEcc;              //[0,0,16] eccentricity
267   Double32_t    fSig;              //[0,0,16] sigma
268   Double32_t    fTrDz;             //[0,0,16] dZ to nearest track
269   Double32_t    fTrDr;             //[0,0,16] dR to nearest track (in x,y; if neg then no match)
270   Double32_t    fTrEp;             //[0,0,16] E/P to nearest track 
271   Double32_t    fTrIso;            //[0,0,16] track isolation
272   Double32_t    fCeIso;            //[0,0,16] cell isolation
273
274   ClassDef(AliStaCluster,1) // Cluster class
275 };
276 #endif