3 //**************************************************************************
4 //* This file is property of and copyright by the ALICE Project *
5 //* ALICE Experiment at CERN, All rights reserved. *
7 //* Primary Authors: Matthias Richter <Matthias.Richter@ift.uib.no> *
8 //* Hege Erdal <hege.erdal@gmail.com> *
10 //* Permission to use, copy, modify and distribute this software and its *
11 //* documentation strictly for non-commercial purposes is hereby granted *
12 //* without fee, provided that the above copyright notice appears in all *
13 //* copies and that both the copyright notice and this permission notice *
14 //* appear in the supporting documentation. The authors make no claims *
15 //* about the suitability of this software for any purpose. It is *
16 //* provided "as is" without express or implied warranty. *
17 //**************************************************************************
19 /// @file AliDxHFEParticleSelectionMCD0.cxx
20 /// @author Hege Erdal, Matthias Richter
22 /// @brief MC D0 selection for D0-HFE correlation
25 #include "AliDxHFEParticleSelectionMCD0.h"
26 #include "AliAODRecoDecayHF2Prong.h"
27 #include "AliAODTrack.h"
28 #include "AliAODMCParticle.h"
29 #include "AliVParticle.h"
36 /// ROOT macro for the implementation of ROOT specific class methods
37 ClassImp(AliDxHFEParticleSelectionMCD0)
39 // TODO: can that be a common definition
40 const char* AliDxHFEParticleSelectionMCD0::fgkTrackControlBinNames[]={
50 AliDxHFEParticleSelectionMCD0::AliDxHFEParticleSelectionMCD0(const char* opt)
51 : AliDxHFEParticleSelectionD0(opt)
62 // TODO: argument scan, pass only relevant arguments to tools
63 fMCTools.~AliDxHFEToolsMC();
64 TString toolopt("pdg=421 mc-last");
65 new (&fMCTools) AliDxHFEToolsMC(toolopt);
68 AliDxHFEParticleSelectionMCD0::~AliDxHFEParticleSelectionMCD0()
72 THnSparse* AliDxHFEParticleSelectionMCD0::DefineTHnSparse() const
75 // Defines the THnSparse.
76 // could/should remove Pt and leave Ptbin
78 const int thnSize2 = 7;
79 const double Pi=TMath::Pi();
81 name.Form("%s info", GetName());
84 // Pt Phi Ptbin D0InvMass Eta 'stat D0' mother
85 int thnBins[thnSize2] = { 1000, 200, 21, 200, 500, 2, 10 };
86 double thnMin [thnSize2] = { 0, 0, 0, 1.5648, -1., -0.5, -1.5 };
87 double thnMax [thnSize2] = { 100, 2*Pi, 20, 2.1648, 1., 1.5, 8.5 };
89 return CreateControlTHnSparse(name,thnSize2,thnBins,thnMin,thnMax,fgkTrackControlBinNames);
93 int AliDxHFEParticleSelectionMCD0::DefineParticleProperties(AliVParticle* p, Double_t* data, int dimension) const
95 // fill the data array from the particle data
96 if (!data) return -EINVAL;
97 AliAODTrack *track=(AliAODTrack*)p;
98 if (!track) return -ENODATA;
100 // TODO: this corresponds to the THnSparse dimensions which is available in the same class
101 // use this consistently
102 const int requiredDimension=7;
103 if (dimension!=requiredDimension) {
104 // TODO: think about filling only the available data and throwing a warning
107 data[i++]=track->Pt();
108 data[i++]=track->Phi();
109 data[i++]=AliDxHFEParticleSelectionMCD0::GetPtBin();
110 data[i++]=AliDxHFEParticleSelectionMCD0::GetInvMass();
111 data[i++]=track->Eta();
112 data[i++]=fResultMC; // stat electron (MC electron or not)
113 data[i++]=fOriginMother; // at the moment not included background. Should expand
118 int AliDxHFEParticleSelectionMCD0::IsSelected(AliVParticle* p, const AliVEvent* pEvent)
120 /// overloaded from AliDxHFEParticleSelection: check particle
121 /// H: Have changed function. Now doing particle selection first, then run MC over
122 /// selected tracks. Could configure it to be configurable, but not sure if it
124 /// result from normal track selection is returned, result from MC is stored in
132 if (fMCTools.MCFirst() && (iResult=CheckMC(p, pEvent))==0) {
137 // step 2 or 1, depending on sequence:
138 // normal particle selection
139 iResult=AliDxHFEParticleSelectionD0::IsSelected(p, pEvent);
140 if (fMCTools.MCFirst() || iResult==0) return iResult;
142 // step 2, only executed if MC check is last
143 // MC selection - > Should maybe also distinguish between D0 and D0bar
144 iResult=CheckMC(p, pEvent);
145 // TODO: why do we need to store the result in a member?
151 int AliDxHFEParticleSelectionMCD0::CheckMC(AliVParticle* p, const AliVEvent* pEvent)
153 /// check if MC criteria are fulfilled
154 // Check both D0 and D0bar (for now only D0)
161 if (!fMCTools.IsInitialized() && (iResult=fMCTools.InitMCParticles(pEvent))<0) {
162 // TODO: message? but has to be filtered in order to avoid message flood
163 return 0; // no meaningful filtering on mc possible
166 AliAODRecoDecayHF2Prong *particle = dynamic_cast<AliAODRecoDecayHF2Prong*>(p);
168 if(!particle) return 0;
170 Int_t pdgDgD0toKpi[2]={AliDxHFEToolsMC::kPDGkaon,AliDxHFEToolsMC::kPDGpion};
172 TClonesArray* fMCArray = dynamic_cast<TClonesArray*>(fMCTools.GetMCArray());
173 if(!fMCArray) {cout << "no array" << endl; return -1;}
175 // find associated MC particle for D0->Kpi
178 //return MC particle label if the array corresponds to a D0, -1 if not (cf. AliAODRecoDecay.cxx). Checks both D0s and daughters
179 MClabel=particle->MatchToMC(AliDxHFEToolsMC::kPDGD0,fMCArray,2,pdgDgD0toKpi);
186 fMCTools.SetMClabel(MClabel);
187 fMCTools.FindMotherPDG(p,AliDxHFEToolsMC::kGetOriginMother);
188 fOriginMother=fMCTools.GetOriginMother();
193 void AliDxHFEParticleSelectionMCD0::Clear(const char* option)
195 /// clear internal memory
196 fMCTools.Clear(option);