]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGHF/correlationHF/AliDxHFEToolsMC.h
adding checks and debugging information
[u/mrichter/AliRoot.git] / PWGHF / correlationHF / AliDxHFEToolsMC.h
CommitLineData
d731501a 1//-*- Mode: C++ -*-
2// $Id$
3
4//* This file is property of and copyright by the ALICE Project *
5//* ALICE Experiment at CERN, All rights reserved. *
6//* See cxx source for full Copyright notice *
7
8/// @file AliDxHFEToolsMC.h
9/// @author Hege Erdal, Matthias Richter
10/// @date 2012-07-19
11/// @brief Common Tools for MC particle selection
12///
13
14#ifndef ALIDXHFETOOLSMC_H
15#define ALIDXHFETOOLSMC_H
16
17#include "TObject.h"
18#include <vector>
19
20class AliVEvent;
21class AliVParticle;
22class TH1;
23
24using std::vector;
25
26/**
27 * @class AliDxHFEToolsMC
28 * Common Tools for MC particle selection.
29 */
30class AliDxHFEToolsMC {
31 public:
32 /// constructor
33 AliDxHFEToolsMC(const char* options="");
34 /// destructor
35 virtual ~AliDxHFEToolsMC();
36
37 // different pdgs
38 enum{
39 kPDGnone=0,
40 kPDGd=1,
41 kPDGu=2,
42 kPDGs=3,
43 kPDGc=4,
44 kPDGb=5,
45 kPDGelectron=11,
46 kPDGmuon=13,
47 kPDGgluon=21,
48 kPDGgamma=22,
49 kPDGpi0=111,
50 kPDGpion=211,
51 kPDGeta=221,
52 kPDGkaon=321,
53 kPDGD0=421,
54 kPDGJpsi=443,
55 kPDGproton=2212
56 };
57
58 enum {
59 kPDGLabelPositron,
60 kPDGLabelElectron,
61 kPDGLabelMuPlus,
62 kPDGLabelMuMinus,
63 kPDGLabelPiPlus,
64 kPDGLabelPiMinus,
65 kPDGLabelKPlus,
66 kPDGLabelKMinus,
67 kPDGLabelProton,
68 kPDGLabelAntiproton,
69 kPDGLabelOthers,
70 kNofPDGLabels
71 };
72
73 enum {
74 kPDGMotherLabelD,
75 kPDGMotherLabelU,
76 kPDGMotherLabelS,
77 kPDGMotherLabelC,
78 kPDGMotherLabelB,
79 kPDGMotherLabelGluon,
80 kPDGMotherLabelGamma,
81 kPDGMotherLabelPi0,
82 kPDGMotherLabelEta,
83 kPDGMotherLabelProton,
84 kPDGMotherLabelOthers,
85 kNofPDGMotherLabels
86 };
87
88 enum {
89 kMCFirst = 0,
90 kMCLast
91 };
92
93 enum {
94 kOriginNone=0,
95 kOriginDown,
96 kOriginUp,
97 kOriginStrange,
98 kOriginCharm,
99 kOriginBeauty,
100 kOriginGluon,
101 kOriginGluonCharm,
102 kOriginGluonBeauty,
103 kNrOrginMother
104 };
105
106 enum {
107 kGetOriginMother=0,
108 kGetFirstMother
109 };
110
111 /// initialize according to options
112 int Init(const char* /*option*/);
113
114 /// init MC info from event object
115 int InitMCParticles(const AliVEvent* pEvent);
116
117 /// Returning MC Array
118 TObjArray* GetMCArray() const {return fMCParticles;}
119
120 /// check state
121 bool IsInitialized() const {return fMCParticles!=NULL;}
122
123 /// clear internal memory
124 virtual void Clear(const char* option="");
125
126 /// flag indicating to do the selection on MC first
127 bool MCFirst() const {return fSequence==kMCFirst;}
128 /// flag indicating to do the selection on MC last
129 bool MCLast() const {return fSequence==kMCLast;}
130
131 /// Return the result on check on initial quark
132 int GetOriginMother() const {return fOriginMother;}
133
134 /// check if pdg should be rejected
135 /// always false if pdg list is not initialized
dfe96b90 136 bool RejectByPDG(AliVParticle* p, bool doStatistics=true, int* pdgParticleResult=NULL);
137 bool RejectByPDG(AliVParticle* p, int* pdgParticleResult) {
138 return RejectByPDG(p, true, pdgParticleResult);
139 }
d731501a 140
141 /// check if pdg should be rejected by mother
142 /// always false if mother pdg list is not initialized
143 bool RejectByMotherPDG(AliVParticle* p, bool doStatistics=true);
144
145 /// Finds pdg of first or origin mother and returns value
146 int FindMotherPDG(AliVParticle* p, bool bReturnFirstMother=false);
147
148 /// step through tree and find the original mother particle
149 /// TODO: this can possibly be const, however, a member is set inside
150 /// check whether this is really necessary
151 int FindPdgOriginMother(AliVParticle* p,bool bReturnFirstMother=false);
152
153 // Compare pdg to quark and gluon
154 void CheckOriginMother(int pdg);
dfe96b90 155 // Tests if particle have been marked as HF quark
156 Bool_t TestIfHFquark(int origin);
d731501a 157
158 // Setting MC label from outside
159 void SetMClabel(int mclab){fMClabel=mclab;}
160
161 /// TODO: want to have this function to be private again, currently
162 /// used with an external vector
163 /// check if pdg should be rejected, particle is not rejected
164 /// if it is in the list, returns always false if list is empty
165 bool RejectByPDG(int pdg, const vector<int> &list) const;
166
dfe96b90 167 int GetNrMCParticles() const {return fNrMCParticles;}
168
169 /// mapping of pdg code to enum
170 int MapPDGLabel(int pdg) const;
171 /// mapping of pdg code to enum
172 int MapPDGMotherLabel(int pdg) const;
173
d731501a 174 protected:
175
176 private:
177 /// copy contructor prohibited
178 AliDxHFEToolsMC(const AliDxHFEToolsMC&);
179 /// assignment operator prohibited
180 AliDxHFEToolsMC& operator=(const AliDxHFEToolsMC&);
181
182 /// create control histogram
183 TH1* CreateControlHistogram(const char* name,
184 const char* title,
185 int nBins,
186 const char** binLabels) const;
187
d731501a 188 static const char* fgkPDGBinLabels[];
189 static const char* fgkPDGMotherBinLabels[];
190 static const char* fgkStatisticsBinLabels[];
191
192 int fSequence; // sequence of checks
193 TObjArray* fMCParticles; //! pointer to external array of MC particles
194 vector<int> fPDGs; // PDGs to be selected
195 vector<int> fMotherPDGs; // mother PDGs to be selected
196 TH1* fHistPDG; // control histogram pdg of selected particle
197 TH1* fHistPDGMother; // control histogram pdg of selected particle
198 int fOriginMother; // Holds the origin motherquark (process)
199 int fMClabel; // MClabel passed from outside (default =-1)
dfe96b90 200 int fNrMCParticles; // number of MC particles
d731501a 201
dfe96b90 202 ClassDef(AliDxHFEToolsMC, 2);
d731501a 203};
204#endif