2 #include <TGeoGlobalMagField.h>
5 #include "AliKFParticle.h"
10 #include "AliAODEvent.h"
11 #include "AliESDEvent.h"
12 #include "AliVEvent.h"
14 #include "AliMCEvent.h"
15 #include "AliMCEventHandler.h"
16 #include "AliESDpid.h"
17 #include "AliESDtrackCuts.h"
19 #include "AliGenCocktailEventHeader.h"
25 #include "AliKFVertex.h"
26 #include "AliAODTrack.h"
27 #include "AliESDtrack.h"
28 #include "AliAnalysisManager.h"
29 #include "AliInputEventHandler.h"
30 #include "AliAODHandler.h"
31 #include "AliPIDResponse.h"
35 #include "TObjArray.h"
36 #include "AliVTrack.h"
37 #include "AliKFParticle.h"
49 fConversionGammas(NULL),
50 fEventIsSelected(kFALSE),
55 DefineInput(0, TChain::Class());
63 if(fConversionGammas){
64 fConversionGammas->Delete();
65 delete fConversionGammas;
66 fConversionGammas=0x0;
76 if(fV0Cuts==NULL)AliError(
"No V0 Cut Selection initialized");
79 if(fEventCuts==NULL)AliError(
"No Event Cut Selection initialized");
82 if(fConversionGammas != NULL){
83 delete fConversionGammas;
84 fConversionGammas=NULL;
87 if(fConversionGammas == NULL){
88 fConversionGammas =
new TClonesArray(
"AliKFParticle",1000);
94 fConversionGammas->Delete();
100 fVectorFoundGammas.clear();
108 if (!TGeoGlobalMagField::Instance()->GetField()) esdEvent->InitMagneticField();
112 if(!fConversionGammas)Init();
115 fEventIsSelected=ProcessEvent(fInputEvent,fMCEvent);
122 fConversionGammas->Delete();
124 fInputEvent=inputEvent;
128 AliError(
"No Input event");
131 if(!fEventCuts){AliError(
"No EventCuts");
return kFALSE;}
132 if(!fV0Cuts){AliError(
"No V0 Cuts");
return kFALSE;}
135 if(!fEventCuts->EventIsSelected(fInputEvent,fMCEvent))
return kFALSE;
138 AliKFParticle::SetField(fInputEvent->GetMagneticField());
140 if(fInputEvent->IsA()==AliESDEvent::Class()){
143 if(fInputEvent->IsA()==AliAODEvent::Class()){
159 for(
Int_t iV0=0; iV0<fESDEvent->GetNumberOfV0s(); ++iV0){
160 AliESDv0 *fCurrentV0=(AliESDv0*)(fESDEvent->GetV0(iV0));
162 printf(
"Requested V0 does not exist");
166 fCurrentMotherLambdaCandidate = ReconstructV0(fESDEvent, fCurrentV0, iV0);
167 if(fCurrentMotherLambdaCandidate){
168 new((*fConversionGammas)[fConversionGammas->GetEntriesFast()])
AliV0ParticleStrange(*fCurrentMotherLambdaCandidate);
169 delete fCurrentMotherLambdaCandidate;
170 fCurrentMotherLambdaCandidate=NULL;
183 if(!fV0Cuts->SelectV0Finder(fCurrentV0->GetOnFlyStatus())){
191 if(fCurrentV0->GetV0CosineOfPointingAngle() < 0.98)
return 0x0;
193 AliVTrack * pos = (AliVTrack*)fESDEvent->GetTrack(fCurrentV0->GetPindex());
194 AliVTrack * neg = (AliVTrack*)fESDEvent->GetTrack(fCurrentV0->GetNindex());
195 const AliExternalTrackParam * paramPos = fCurrentV0->GetParamP();
196 const AliExternalTrackParam * paramNeg = fCurrentV0->GetParamN();
198 if(pos->GetSign() <0){
200 neg=fESDEvent->GetTrack(fCurrentV0->GetPindex());
202 paramNeg=fCurrentV0->GetParamP();
211 if(pos->GetSign() == neg->GetSign()){
224 Bool_t isPiPlus = fV0Cuts->GetPIDpion(pos);
225 Bool_t isPiMinus = fV0Cuts->GetPIDpion(neg);
226 Bool_t isProton = fV0Cuts->GetPIDproton(pos);
227 Bool_t isAntiProton = fV0Cuts->GetPIDproton(neg);
230 if(!((isProton && isPiMinus) || (isAntiProton && isPiPlus)))
return 0x0;
234 Int_t pdgCodePos = 2211;
235 Int_t pdgCodeNeg = -211;
246 const AliKFParticle fCurrentPositiveKFParticle(*(paramPos), pdgCodePos);
247 const AliKFParticle fCurrentNegativeKFParticle(*(paramNeg), pdgCodeNeg);
248 const Bool_t gamma = kFALSE;
249 AliKFParticle *fCurrentMother =
new AliKFParticle(fCurrentPositiveKFParticle, fCurrentNegativeKFParticle, gamma);
262 TParticle *fNegativeMCParticle = 0x0;
263 if(labeln>-1) fNegativeMCParticle = fMCEvent->Particle(labeln);
264 TParticle *fPositiveMCParticle = 0x0;
265 if(labelp>-1) fPositiveMCParticle = fMCEvent->Particle(labelp);
267 if(fPositiveMCParticle&&fNegativeMCParticle){
274 return fCurrentMotherV0;
287 for(
Int_t iV0=0; iV0<fAODEvent->GetNumberOfV0s(); ++iV0){
288 AliAODv0 *fCurrentV0=(AliAODv0*)(fAODEvent->GetV0(iV0));
290 printf(
"Requested V0 does not exist");
294 fCurrentMotherLambdaCandidate = ReconstructV0(fAODEvent, fCurrentV0, iV0);
295 if(fCurrentMotherLambdaCandidate){
296 new((*fConversionGammas)[fConversionGammas->GetEntriesFast()])
AliV0ParticleStrange(*fCurrentMotherLambdaCandidate);
297 delete fCurrentMotherLambdaCandidate;
298 fCurrentMotherLambdaCandidate=NULL;
311 if(!fV0Cuts->SelectV0Finder(fCurrentV0->GetOnFlyStatus())){
319 AliAODVertex *vertex = fAODEvent->GetPrimaryVertex();
320 if(fCurrentV0->CosPointingAngle(vertex) < 0.98)
return 0x0;
322 AliVTrack* pos = (AliVTrack*)fCurrentV0->GetDaughter(0);
323 AliVTrack* neg = (AliVTrack*)fCurrentV0->GetDaughter(1);
325 AliExternalTrackParam paramPos;
326 paramPos.CopyFromVTrack(pos);
327 AliExternalTrackParam paramNeg;
328 paramPos.CopyFromVTrack(neg);
330 if(pos->GetSign() <0){
332 neg=(AliVTrack*)fCurrentV0->GetDaughter(0);
334 paramNeg.CopyFromVTrack(pos);
343 if(pos->GetSign() == neg->GetSign()){
356 Bool_t isPiPlus = fV0Cuts->GetPIDpion(pos);
357 Bool_t isPiMinus = fV0Cuts->GetPIDpion(neg);
358 Bool_t isProton = fV0Cuts->GetPIDproton(pos);
359 Bool_t isAntiProton = fV0Cuts->GetPIDproton(neg);
362 if(!((isProton && isPiMinus) || (isAntiProton && isPiPlus)))
return 0x0;
366 Int_t pdgCodePos = 2211;
367 Int_t pdgCodeNeg = -211;
375 const AliKFParticle fCurrentPositiveKFParticle(paramPos, pdgCodePos);
376 const AliKFParticle fCurrentNegativeKFParticle(paramNeg, pdgCodeNeg);
377 const Bool_t gamma = kFALSE;
378 AliKFParticle *fCurrentMother =
new AliKFParticle(fCurrentPositiveKFParticle, fCurrentNegativeKFParticle, gamma);
391 TParticle *fNegativeMCParticle = 0x0;
392 if(labeln>-1) fNegativeMCParticle = fMCEvent->Particle(labeln);
393 TParticle *fPositiveMCParticle = 0x0;
394 if(labelp>-1) fPositiveMCParticle = fMCEvent->Particle(labelp);
396 if(fPositiveMCParticle&&fNegativeMCParticle){
404 return fCurrentMotherV0;
void SetMCLabelNegative(Int_t label)
void UserCreateOutputObjects()
void SetMCLabelPositive(Int_t label)
Int_t GetTrackLabelNegative() const
Int_t GetTrackLabelPositive() const
virtual ~AliV0ReaderStrange()
virtual void UserExec(Option_t *option)
Bool_t ProcessEvent(AliVEvent *inputEvent, AliMCEvent *mcEvent=NULL)
AliV0ParticleStrange * ReconstructV0(AliESDEvent *fESDEvent, AliESDv0 *fCurrentV0, Int_t currentV0Index)