]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGUD/multVScentPbPb/AliTrackletTaskUni.h
Merge branch 'feature-movesplit'
[u/mrichter/AliRoot.git] / PWGUD / multVScentPbPb / AliTrackletTaskUni.h
1 #ifndef ALITRACKLETTASKUNI_H
2 #define ALITRACKLETTASKUNI_H
3
4 ///////////////////////////////////////////////////////////////////////////
5 // Class AliTrackletTask                                                 //
6 // Analysis task to study performance of tracklet reconstruction         //
7 // algorithm and combinatorial background                                //
8 // Author:  M. Nicassio (INFN Bari)                                      //
9 // Contact: Maria.Nicassio@ba.infn.it, Domenico.Elia@ba.infn.it          //
10 ///////////////////////////////////////////////////////////////////////////
11
12 class TH1F; 
13 class TH2F;
14 class AliESDEvent;
15 class TList;
16 class TNtuple;
17
18 class AliMCParticle;
19 class AliITSMultRecBg;
20 class AliITSsegmentationSPD;
21 #include "AliAnalysisTaskSE.h"
22 #include "AliTriggerAnalysis.h" 
23
24 class AliTrackletTaskUni : public AliAnalysisTaskSE {
25  public:
26   enum {kData,kBgInj,kBgRot,kBgMix,kMC};
27   //
28   enum {  // define here id's of the standard histos in corresponding TObjArray* fHistosTr...
29     kHEtaZvDist,      // 3 d sparse histo with dist  (uncut) vs zv vs eta
30     kHEtaZvDPhiS,     // 3 d sparse histo with dphiS (uncut) vs zv vs eta
31     kHEtaZvCut,       // zv vs eta with strict cut on tracklets applied (dist<1 or |dPhi|<narrowWindow)
32     kHDPhiDTheta,     // measured dTheta vs dPhi
33     kHDPhiSDThetaX,   // dTheta (1/sin^2 scaled if needed) vs dPhi (bending subtracted)
34     kHEtaDPhiS,       // dPhi (bending subtracted) vs eta
35     kHEtaDThetaX,     // dTheta (1/sin^2 scaled if needed) vs eta
36     kHEtaDist,        // Weighted distance vs eta
37     kHZvDPhiS,        // dPhi (bending subtracted) vs Zv
38     kHZvDThetaX,      // dTheta (1/sin^2 scaled if needed) vs Zv
39     kHZvDist          // Weighted distance vs Zv
40   };
41   enum { // define here id's of any custom histos to be added to fHistosCustom
42     kHStat,            // job info (meaning of bins defined in the enum below)
43     kHZVEtaPrimMC,     // Zv vs eta for all primary tracks (true MC multiplicity)
44     //
45     kHZVtxNoSel,       // Z vertex distribution before event selection
46     kHNTrackletsNoSel, // N tracklets before event selection
47     kHNClSPD1NoSel,    // N clusters on SPD1 before event selection
48     kHNClSPD2NoSel,    // N clusters on SPD2 before event selection
49     kHV0NoSel,         // V0 mult before selection
50     kHV0NClSPD2NoSel,  // V0 - nspd2 correlation
51     //
52     kHZVtx,            // Z vertex distribution
53     kHNTracklets,      // N tracklets
54     kHNClSPD1,         // N clusters on SPD1
55     kHNClSPD2,         // N clusters on SPD2
56     kHV0,              // V0 mult after selection
57     //
58     kHZVtxMixDiff,     // difference in Z vtx of mixed events
59     kHNTrMixDiff,      // difference in N tracklets of mixed events
60     //
61     kHPrimPDG,         // PDG code of prim tracklet
62     kHSecPDG,          // PDG code of sec tracklet
63     kHPrimParPDG,      // PDG code of prim tracklet parent
64     kHSecParPDG        // PDG code of sec tracklet parent
65   }; // custom histos
66
67   // bins for saved parameters
68   enum {kDummyBin,
69         kEvTot0,      // events read
70         kEvTot,       // events read after vertex quality selection
71         kEvTotPlp,    // events with pile-up
72         kEvProcData,  // events with data mult.object (ESD or reco)
73         kEvProcInj,   // events Injected
74         kEvProcRot,   // events Rotated
75         kEvProcMix,   // events Mixed
76         //
77         kDPhi,        // dphi window
78         kDTht,        // dtheta window
79         kNStd,        // N.standard deviations to keep
80         kPhiShift,    // bending shift
81         kThtS2,       // is dtheta scaled by 1/sin^2
82         kThtCW,       // on top of w.dist cut cut also on 1 sigma dThetaX
83         kPhiOvl,      // overlap params
84         kZEtaOvl,     // overlap params
85         kNoOvl,       // flag that overlap are suppressed
86         //
87         kPhiRot,      // rotation phi
88         kInjScl,      // injection scaling
89         kEtaMin,      // eta cut
90         kEtaMax,      // eta cut
91         kZVMin,       // min ZVertex to process
92         kZVMax,       // max ZVertex to process
93         kTrcMin,      // min mult to process
94         kTrcMax,      // max mult to process
95         //
96         kMCV0Scale,   // scaling value for V0 in MC     
97         //
98         kOneUnit=49,  // just 1 to track mergings
99         kNWorkers=50, // n workers
100         kNStatBins
101   };
102
103   //
104   AliTrackletTaskUni(const char *name = "AliTrackletTaskUni");
105   virtual ~AliTrackletTaskUni(); 
106   
107   virtual void  UserCreateOutputObjects();
108   virtual void  UserExec(Option_t *option);
109   virtual void  Terminate(Option_t *);
110   void          RegisterStat();
111
112   void       SetUseMC(Bool_t mc = kFALSE)              {fUseMC = mc;}
113   void       SetCheckReconstructables(Bool_t c=kFALSE) {fCheckReconstructables = c;}
114   TObjArray* BookHistosSet(const char* pref, UInt_t selHistos=0xffffffff);
115   TObjArray* BookCustomHistos();
116   void       AddHisto(TObjArray* histos, TObject* h, Int_t at=-1);
117   void       FillHistosSet(TObjArray* histos, double phi,double theta,double dphi,double dtheta,double dist);
118   // RS
119   void       SetNStdDev(Float_t f=1.)           {fNStdDev = f<1e-5 ? 1e-5:f;}
120   void       SetScaleDThetaBySin2T(Bool_t v=kFALSE) {fScaleDTBySin2T = v;}
121   void       SetCutOnDThetaX(Bool_t v=kFALSE)   {fCutOnDThetaX = v;}
122   void       SetPhiWindow(float w=0.08)         {fDPhiWindow   = w<1e-5 ? 1e-5:w;}
123   void       SetThetaWindow(float w=0.025)      {if (w<0) fCutOnDThetaX=kTRUE; fDThetaWindow = TMath::Abs(w)<1e-5 ? 1e-5:TMath::Abs(w);}
124   void       SetPhiShift(float w=0.0045)        {fDPhiShift = w;}
125   void       SetPhiOverlapCut(float w=0.005)    {fPhiOverlapCut = w;}
126   void       SetZetaOverlapCut(float w=0.05)    {fZetaOverlap = w;}
127   void       SetPhiRot(float w=0)               {fPhiRot = w;}
128   void       SetInjScale(Float_t s=1.)          {fInjScale = s>0? s:1.;}
129   void       SetRemoveOverlaps(Bool_t w=kFALSE) {fRemoveOverlaps = w;}
130   void       SetScaleMCV0(Float_t s=1.0)        {fMCV0Scale = s;}  
131   //
132   void       SetEtaCut(Float_t etaCut)          {fEtaMax = TMath::Abs(etaCut); fEtaMin= -fEtaMax;}
133   void       SetEtaMin(Float_t etaMin)          {fEtaMin = etaMin;}
134   void       SetEtaMax(Float_t etaMax)          {fEtaMax = etaMax;}
135   void       SetZVertexMin(Float_t z)           {fZVertexMin = z;}
136   void       SetZVertexMax(Float_t z)           {fZVertexMax = z;}
137   void       SetMultCutMin(Int_t n=0)           {fMultCutMin = n;}
138   void       SetMultCutMax(Int_t n=99999)       {fMultCutMax = n;}
139   //
140   Bool_t     GetDoNormalReco()             const {return fDoNormalReco;}
141   Bool_t     GetDoInjection()              const {return fDoInjection;}
142   Bool_t     GetDoRotation()               const {return fDoRotation;}
143   Bool_t     GetDoMixing()                 const {return fDoMixing;}
144   //
145   void       SetDoNormalReco(Bool_t v=kTRUE)    {fDoNormalReco = v;}
146   void       SetDoInjection(Bool_t v=kTRUE)     {fDoInjection = v;}
147   void       SetDoRotation(Bool_t v=kTRUE)      {fDoRotation = v;}
148   void       SetDoMixing(Bool_t v=kTRUE)        {fDoMixing = v;}
149   //
150   void       SetDontMerge(Bool_t v=kTRUE)       {fDontMerge = v;}
151   /*
152   void       SetTrigger(AliTriggerAnalysis::Trigger trigger)  { fTrigger = trigger; }
153   void       SetMCCentralityBin(MCCentralityBin mccentrbin)   { fMCCentralityBin = mccentrbin;}
154   void       SetCentralityLowLim(Float_t centrlowlim)         { fCentrLowLim = centrlowlim;}
155   void       SetCentralityUpLim(Float_t centruplim)           { fCentrUpLim = centruplim;}
156   void       SetCentralityEst(TString centrest)               { fCentrEst = centrest;}
157   */
158   //
159  protected:
160   void       InitMultReco();
161   Bool_t     HaveCommonParent(const float* clLabs0,const float* clLabs1);
162   void       FillHistos(Int_t type, const AliMultiplicity* mlt);
163   void       FillMCPrimaries(TH2F* hetaz);
164   void       FillSpecies(Int_t primsec, Int_t id, Double_t dist);
165   Int_t      GetPdgBin(Int_t pdgCode);
166   void       CheckReconstructables();
167   //
168  protected:
169   TList*       fOutput;                   // output list send on output slot 1 
170   //
171   Bool_t       fDoNormalReco;              // do normal reco
172   Bool_t       fDoInjection;               // do injection
173   Bool_t       fDoRotation;                // do rotation
174   Bool_t       fDoMixing;                  // do mixing
175   //
176   Bool_t       fUseMC;                     // flag of MC processing
177   Bool_t       fCheckReconstructables;     // request check
178   //
179   TObjArray*   fHistosTrData;              //! all tracklets in data
180   TObjArray*   fHistosTrInj;               //! injected
181   TObjArray*   fHistosTrRot;               //! rotated
182   TObjArray*   fHistosTrMix;               //! mixed
183   //
184   TObjArray*   fHistosTrPrim;              //! primary
185   TObjArray*   fHistosTrSec;               //! secondary
186   TObjArray*   fHistosTrComb;              //! combinatorials
187   TObjArray*   fHistosTrCombU;             //! combinatorials uncorrelated
188   //
189   TObjArray*   fHistosTrRcblPrim;          //! Primary Reconstructable
190   TObjArray*   fHistosTrRcblSec;           //! Secondary Reconstructable
191   TObjArray*   fHistosCustom;              //! custom histos
192   //
193   // Settings for the reconstruction
194   // tracklet reco settings
195   Float_t      fEtaMin;                    // histos filled only for this eta range
196   Float_t      fEtaMax;                    // histos filled only for this eta range
197   Float_t      fZVertexMin;                // min Z vtx to process
198   Float_t      fZVertexMax;                // max Z vtx to process
199   Int_t        fMultCutMin;                // min mult in ESD to process?
200   Int_t        fMultCutMax;                // max mult in ESD to process?
201   Float_t      fMCV0Scale;                 // scaling factor for V0 in MC
202   //
203   Bool_t       fScaleDTBySin2T;            // request dTheta scaling by 1/sin^2(theta)
204   Bool_t       fCutOnDThetaX;              // if true, apart from NStdDev cut apply also the cut on dThetaX
205   Float_t      fNStdDev;                   // cut on weighted distance
206   Float_t      fDPhiWindow;                // max dPhi
207   Float_t      fDThetaWindow;              // max dTheta
208   Float_t      fDPhiShift;                 // mean bend
209   Float_t      fPhiOverlapCut;             // overlaps cut in phi
210   Float_t      fZetaOverlap;               // overlaps cut in Z
211   Float_t      fPhiRot;                    // rotate L1 wrt L2
212   Float_t      fInjScale;                  // scaling factor for injection
213   Bool_t       fRemoveOverlaps;            // request overlaps removal
214   //
215   AliITSMultRecBg *fMultReco;              //! mult.reco object
216   TTree*       fRPTree;                    //! tree of recpoints
217   TTree*       fRPTreeMix;                 //! tree of recpoints for mixing
218   AliStack*    fStack;                     //! MC stack
219   AliMCEvent*  fMCevent;                   //! MC Event
220   Float_t      fESDVtx[3];                 //  ESD vertex
221   //
222   /*
223   AliTriggerAnalysis::Trigger fTrigger;    // requested trigger
224   MCCentralityBin fMCCentralityBin;        // to select MC centrality bin in which corrections are calculated
225   Float_t      fCentrLowLim;               // to select centrality bin on data
226   Float_t      fCentrUpLim;                // to select centrality bin on data
227   TString      fCentrEst;                  // to select centrality estimator
228   */
229   Bool_t fDontMerge;                       // no merging requested
230   static const char*  fgkPDGNames[];                //!pdg names
231   static const Int_t  fgkPDGCodes[];                //!pdg codes
232   //
233  private:    
234   AliTrackletTaskUni(const AliTrackletTaskUni&); // not implemented
235   AliTrackletTaskUni& operator=(const AliTrackletTaskUni&); // not implemented 
236   
237   ClassDef(AliTrackletTaskUni, 1);  
238 };
239
240
241 #endif