]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG0/multVScentPbPb/AliTrackletTaskMultipp.h
coverity fix
[u/mrichter/AliRoot.git] / PWG0 / multVScentPbPb / AliTrackletTaskMultipp.h
1 #ifndef ALITRACKLETTASKMULTI_H
2 #define ALITRACKLETTASKMULTI_H
3
4 ///////////////////////////////////////////////////////////////////////////
5 // Class AliTrackletTaskMulti                                            //
6 // Analysis task to produce data and MC histos needed for tracklets      //
7 // dNdEta extraction in multiple bins in one go                          //
8 // Author:  ruben.shahoyan@cern.ch                                       //
9 ///////////////////////////////////////////////////////////////////////////
10
11 class TH1F; 
12 class TH2F;
13 class TH3F;
14 class AliESDEvent;
15 class TList;
16 class TNtuple;
17
18 class AliMCParticle;
19 class AliITSMultRecBg;
20 class AliESDTrackCuts;
21
22 #include "../ITS/AliITSsegmentationSPD.h"
23 #include "AliAnalysisTaskSE.h"
24 #include "AliTriggerAnalysis.h" 
25 #include <TMath.h>
26
27 class AliTrackletTaskMulti : public AliAnalysisTaskSE {
28  public:
29   enum {kData,kBgInj,kBgRot,kBgMix,kMC};
30   enum {kCentV0M,kCentFMD,kCentTRK,kCentTKL,kCentCL0,kCentCL1,kCentV0MvsFMD,kCentTKLvsV0,kCentZEMvsZDC,kNCentTypes}; // what is used to define centrality
31   //
32   enum {  // define here id's of the standard histos in corresponding TObjArray* fHistosTr...
33     kHEtaZvCut,       // histo zv vs eta for tracklets passing final selection (dist<1 or |dPhi|<narrowWindow ...)
34     kHDPhiDTheta,     // measured dTheta vs dPhi
35     kHDPhiSDThetaX,   // dTheta (1/sin^2 scaled if needed) vs dPhi (bending subtracted)
36     kHWDist,          // Weighted distance 
37     kHEtaZvSPD1,      // histo zv vs eta for SPD1 single clusters
38     kNStandardH       // number of standard histos per centrality bin
39   };
40   enum { // define here id's of any custom histos to be added to fHistosCustom
41     kHStat,            // job info (meaning of bins defined in the enum below)
42     //
43     kHStatCent,        // events per centrality bin with real values on the axis
44     kHStatCentBin,     // events per centrality bin
45     //
46     kHNPrimMeanMC,     // <n> primaries per mult bin
47     kHNPrim2PartMC,    // <n> prim per part.pair per mult bin
48     kHNPrim2BCollMC,   // <n> prim per bin.coll per mult bin
49     kHNPrim2PartNpMC,  // <n> prim per n part vs npart
50     kHNPrim2BCollNpMC, // <n> prim per n part vs npart
51     kHNPartMC,         // n.part.pairs according to MC
52     kHNPartMeanMC,     // <n> part pairs per mult bin
53     kHNBCollMC,        // n.bin.colls according to MC
54     kHNBCollMeanMC,
55     //
56     kHZVtxNoSel,       // Z vertex distribution before event selection
57     kHV0NoSel,         // V0 before selection
58     kHNClSPD2NoSel,    // NSPD2 before selection
59     kHZDCZEMNoSel,     // ZDC ZEM before selection
60     //
61     kHZVtx,            // Z vertex distribution
62     kHV0,              // V0 before selection
63     kHNClSPD2,         // NSPD2 before selection
64     kHZDCZEM,          // ZDC ZEM before selection
65     
66
67     kHZVtxMixDiff,     // difference in Z vtx of mixed events
68     kHNTrMixDiff,      // difference in N tracklets of mixed events
69     //
70     kHPrimPDG,         // PDG code of prim tracklet
71     kHSecPDG,          // PDG code of sec tracklet
72     kHPrimParPDG,      // PDG code of prim tracklet parent
73     kHSecParPDG,       // PDG code of sec tracklet parent
74     //
75     kHClUsedInfoL0,    // used clusters of lr0
76     kHClUsedInfoL1,    // used clusters of lr1
77     kHClAllInfoL0,     // all clusters of lr0
78     kHClAllInfoL1,     // all clusters of lr1
79     //
80     //-------------------------------------- tmp
81     kHclDstZAll,       // Distance between SPD1 clusters vs Z, all cl
82     kHclDstPhiAll,     // Distance between SPD1 clusters vs phi, all cl
83     kHclDstZUsed,      // Distance between SPD1 clusters vs Z, used-unused cl
84     kHclDstPhiUsed,    // Distance between SPD1 clusters vs phi, used-unused cl
85     //--------------------------------------
86     // This MUST be last one: this is just beginning of many histos (one per bin)
87     kHZVEtaPrimMC      // Zv vs eta for all primary tracks (true MC multiplicity)
88   }; // custom histos
89
90   // bins for saved parameters
91   enum {kDummyBin,
92         kEvTot0,      // events read
93         kEvTot,       // events read after vertex quality selection
94         kOneUnit,     // just 1 to track primate merges
95         kNWorkers,    // n workers
96         //
97         kCentVar,     // cetrality var. used
98         kDPhi,        // dphi window
99         kDTht,        // dtheta window
100         kNStd,        // N.standard deviations to keep
101         kPhiShift,    // bending shift
102         kThtS2,       // is dtheta scaled by 1/sin^2
103         kThtCW,       // on top of w.dist cut cut also on 1 sigma dThetaX
104         kPhiOvl,      // overlap params
105         kZEtaOvl,     // overlap params
106         kNoOvl,       // flag that overlap are suppressed
107         //
108         kPhiRot,      // rotation phi
109         kInjScl,      // injection scaling
110         kEtaMin,      // eta cut
111         kEtaMax,      // eta cut
112         kZVMin,       // min ZVertex to process
113         kZVMax,       // max ZVertex to process
114         //
115         kDPiSCut,     // cut on dphi used to extract signal (when WDist is used in analysis, put it equal to kDPhi
116         kNStdCut,     // cut on weighted distance (~1) used to extract signal 
117         //
118         kMCV0Scale,   // scaling value for V0 in MC
119         //
120         // here we put entries for each mult.bin
121         kBinEntries = 50,
122         kEvProcData,  // events with data mult.object (ESD or reco)
123         kEvProcInj,   // events Injected, total
124         kEvProcRot,   // events Rotated
125         kEvProcMix,   // events Mixed
126         kEntriesPerBin
127   };
128
129   //
130   AliTrackletTaskMulti(const char *name = "AliTrackletTaskMulti");
131   virtual ~AliTrackletTaskMulti(); 
132   
133   virtual void  UserCreateOutputObjects();
134   virtual void  UserExec(Option_t *option);
135   virtual void  Terminate(Option_t *);
136
137   void       SetUseCentralityVar(Int_t v=kCentV0M)     {fUseCentralityVar = v;}
138   void       SetUseMC(Bool_t mc = kFALSE)              {fUseMC = mc;}
139   void       SetCheckReconstructables(Bool_t c=kFALSE) {fCheckReconstructables = c;}
140   TObjArray* BookHistosSet(const char* pref, UInt_t selHistos=0xffffffff);
141   TObjArray* BookCustomHistos();
142   void       AddHisto(TObjArray* histos, TObject* h, Int_t at=-1);
143   void       FillHistosSet(TObjArray* histos, double eta, /*double phi,double theta,*/double dphi,double dtheta,double dthetaX,double dist);
144   // RS
145   void       SetNStdDev(Float_t f=1.)           {fNStdDev = f<1e-5 ? 1e-5:f;}
146   void       SetScaleDThetaBySin2T(Bool_t v=kFALSE) {fScaleDTBySin2T = v;}
147   void       SetCutOnDThetaX(Bool_t v=kFALSE)   {fCutOnDThetaX = v;}
148   void       SetPhiWindow(float w=0.08)         {fDPhiWindow   = w<1e-5 ? 1e-5:w;}
149   void       SetThetaWindow(float w=0.025)      {if (w<0) fCutOnDThetaX=kTRUE; fDThetaWindow = TMath::Abs(w)<1e-5 ? 1e-5:TMath::Abs(w);}
150   void       SetPhiShift(float w=0.0045)        {fDPhiShift = w;}
151   void       SetPhiOverlapCut(float w=0.005)    {fPhiOverlapCut = w;}
152   void       SetZetaOverlapCut(float w=0.05)    {fZetaOverlap = w;}
153   void       SetPhiRot(float w=0)               {fPhiRot = w;}
154   void       SetInjScale(Float_t s=1.)          {fInjScale = s>0? s:1.;}
155   void       SetRemoveOverlaps(Bool_t w=kFALSE) {fRemoveOverlaps = w;}
156   //
157   void       SetDPhiSCut(Float_t c=0.06)        {fDPhiSCut = c;}
158   void       SetNStdCut(Float_t c=1.0)          {fNStdCut = c;}
159   void       SetScaleMCV0(Float_t s=1.0)        {fMCV0Scale = s;}  
160   //
161   void       SetEtaCut(Float_t etaCut)          {fEtaMax = TMath::Abs(etaCut); fEtaMin= -fEtaMax;}
162   void       SetEtaMin(Float_t etaMin)          {fEtaMin = etaMin;}
163   void       SetEtaMax(Float_t etaMax)          {fEtaMax = etaMax;}
164   void       SetZVertexMin(Float_t z)           {fZVertexMin = z;}
165   void       SetZVertexMax(Float_t z)           {fZVertexMax = z;}
166   //
167   Bool_t     GetDoNormalReco()             const {return fDoNormalReco;}
168   Bool_t     GetDoInjection()              const {return fDoInjection;}
169   Bool_t     GetDoRotation()               const {return fDoRotation;}
170   Bool_t     GetDoMixing()                 const {return fDoMixing;}
171   //
172   void       SetDoNormalReco(Bool_t v=kTRUE)    {fDoNormalReco = v;}
173   void       SetDoInjection(Bool_t v=kTRUE)     {fDoInjection = v;}
174   void       SetDoRotation(Bool_t v=kTRUE)      {fDoRotation = v;}
175   void       SetDoMixing(Bool_t v=kTRUE)        {fDoMixing = v;}
176   //
177   //
178  protected:
179   void       InitMultReco();
180   Bool_t     HaveCommonParent(const float* clLabs0,const float* clLabs1);
181   void       FillHistos(Int_t type, const AliMultiplicity* mlt);
182   void       FillMCPrimaries();
183   void       FillSpecies(Int_t primsec, Int_t id);
184   void       FillClusterInfo();
185   void       FillClusterInfoFromMult(const AliMultiplicity* mlt, double zVertex);
186   void       FillClusterAutoCorrelationFromMult(const AliMultiplicity* mlt, double zVertex);
187   Int_t      GetPdgBin(Int_t pdgCode);
188   void       CheckReconstructables();
189   Int_t      GetCentralityBin(Float_t percentile) const;
190   //
191  protected:
192   TList*       fOutput;                   // output list send on output slot 1 
193   //
194   Bool_t       fDoNormalReco;              // do normal reco
195   Bool_t       fDoInjection;               // do injection
196   Bool_t       fDoRotation;                // do rotation
197   Bool_t       fDoMixing;                  // do mixing
198   //
199   Bool_t       fUseMC; 
200   Bool_t       fCheckReconstructables;
201   //
202   TObjArray*   fHistosTrData;              //! all tracklets in data
203   TObjArray*   fHistosTrInj;               //! injected
204   TObjArray*   fHistosTrRot;               //! rotated
205   TObjArray*   fHistosTrMix;               //! mixed
206   //
207   TObjArray*   fHistosTrPrim;              //! primary
208   TObjArray*   fHistosTrSec;               //! secondary
209   TObjArray*   fHistosTrComb;              //! combinatorials
210   TObjArray*   fHistosTrCombU;             //! combinatorials uncorrelated
211   //
212   TObjArray*   fHistosTrRcblPrim;          //! Primary Reconstructable
213   TObjArray*   fHistosTrRcblSec;           //! Secondary Reconstructable
214   TObjArray*   fHistosCustom;              //! custom histos
215   //
216   // Settings for the reconstruction
217   // tracklet reco settings
218   Float_t      fEtaMin;                    // histos filled only for this eta range
219   Float_t      fEtaMax;                    // histos filled only for this eta range
220   Float_t      fZVertexMin;                // min Z vtx to process
221   Float_t      fZVertexMax;                // max Z vtx to process
222   //
223   Bool_t       fScaleDTBySin2T;            // request dTheta scaling by 1/sin^2(theta)
224   Bool_t       fCutOnDThetaX;              // if true, apart from NStdDev cut apply also the cut on dThetaX
225   Float_t      fNStdDev;                   // cut on weighted distance
226   Float_t      fDPhiWindow;                // max dPhi
227   Float_t      fDThetaWindow;              // max dTheta
228   Float_t      fDPhiShift;                 // mean bend
229   Float_t      fPhiOverlapCut;             // overlaps cut in phi
230   Float_t      fZetaOverlap;               // overlaps cut in Z
231   Float_t      fPhiRot;                    // rotate L1 wrt L2
232   Float_t      fInjScale;                  // scaling factor for injection
233   Bool_t       fRemoveOverlaps;            // request overlaps removal
234   //
235   Float_t      fDPhiSCut;                  // cut on signal dphiS
236   Float_t      fNStdCut;                   // cut on signal weighted distance
237   Float_t      fMCV0Scale;                 // scaling factor for V0 in MC
238   //
239   AliITSMultRecBg *fMultReco;              //! mult.reco object
240   TTree*       fRPTree;                    //! tree of recpoints
241   TTree*       fRPTreeMix;                 //! tree of recpoints for mixing
242   AliStack*    fStack;                     //! MC stack
243   AliMCEvent*  fMCEvent;                   //! MC Event
244   Float_t      fESDVtx[3];                 //  ESD vertex
245   //
246   Float_t fNPart;                          // number of participant pairs from MC
247   Float_t fNBColl;                         // number of bin. collision from MC
248   Int_t  fCurrCentBin;                     // current centrality bin
249   Int_t  fNCentBins;                       // N of mult bins
250   Int_t  fUseCentralityVar;                // what is used to determine the centrality
251   //
252   static const Float_t fgkCentPerc[];               //! centrality in percentiles
253   //
254   static const char*  fgCentSelName[];              //!centrality types
255   static const char*  fgkPDGNames[];                //!pdg names
256   static const Int_t  fgkPDGCodes[];                //!pdg codes
257   //
258  private:    
259   AliTrackletTaskMulti(const AliTrackletTaskMulti&); // not implemented
260   AliTrackletTaskMulti& operator=(const AliTrackletTaskMulti&); // not implemented 
261   
262   ClassDef(AliTrackletTaskMulti, 1);  
263 };
264
265
266 #endif