AliPhysics  608b256 (608b256)
AliDalitzElectronSelector.cxx
Go to the documentation of this file.
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  * *
4  * Authors: Pedro Gonzales *
5  * Version 1.0 *
6  * *
7  * Permission to use, copy, modify and distribute this software and its *
8  * documentation strictly for non-commercial purposes is hereby granted *
9  * without fee, provided that the above copyright notice appears in all *
10  * copies and that both the copyright notice and this permission notice *
11  * appear in the supporting documentation. The authors make no claims *
12  * about the suitability of this software for any purpose. It is *
13  * provided "as is" without express or implied warranty. *
14  **************************************************************************/
15 
17 //---------------------------------------------
18 // Class reconstructing primary electrons
19 //---------------------------------------------
21 
22 
24 #include "AliDalitzElectronCuts.h"
25 #include "AliAODv0.h"
26 #include "AliESDv0.h"
27 #include "AliAODEvent.h"
28 #include "AliESDEvent.h"
29 #include "TVector.h"
30 #include "AliESDtrack.h"
31 #include "AliAnalysisManager.h"
32 #include "AliInputEventHandler.h"
33 #include "TChain.h"
34 #include "AliDalitzAODESD.h"
35 
36 class iostream;
37 
38 using namespace std;
39 
40 
41 
43 
44 //________________________________________________________________________
46  fElectronCuts(0),
47  fPositronsIndex(),
48  fElectronsIndex(),
49  fEventIsSelected(kFALSE)
50 {
51  // Default constructor
52  DefineInput(0, TChain::Class());
53 }
54 
55 //________________________________________________________________________
57 {
58  // default deconstructor
59 }
60 //________________________________________________________________________
62 {
63  // Initialize function to be called once before analysis
64 
65  if(fElectronCuts == 0){
66  // fElectronCuts=AliConversionCuts::GetStandardCuts2010PbPb();
67  AliError("No Cut Selection initialized");
68  }
69 }
70 
71 //________________________________________________________________________
73 {
74  // Create User Output Objects
75 }
76 
77 //________________________________________________________________________
79  // User Exec
80  fEventIsSelected=ProcessEvent(fInputEvent,fMCEvent);
81 }
82 
83 //________________________________________________________________________
84 Bool_t AliDalitzElectronSelector::ProcessEvent(AliVEvent *inputEvent,AliMCEvent *mcEvent)
85 {
86  //Reset the index
87 
88  fPositronsIndex.clear();
89  fElectronsIndex.clear();
90 
91 
92  fInputEvent=inputEvent;
93  fMCEvent=mcEvent;
94 
95  if(!fInputEvent){
96  AliError("No Input event");
97  return kFALSE;
98  }
99 
100  if(!fElectronCuts){AliError("No ConversionCuts");return kFALSE;}
101 
102 
103  //if(fInputEvent->IsA()==AliESDEvent::Class()){
104  ProcessESDs();
105  //}
106 
107  //if(fInputEvent->IsA()==AliAODEvent::Class()){
108  //GetAODConversionGammas();
109  //}
110  return kTRUE;
111 }
112 
115  // Process ESD V0s for conversion photon reconstruction
116  AliAODEvent *fAODEvent=0;
117  AliESDEvent *fESDEvent=0;
118  Int_t NumberOfTracks=0;
119 
120  if(fInputEvent->IsA()==AliESDEvent::Class()){
121  fESDEvent=dynamic_cast<AliESDEvent*>(fInputEvent);
122  NumberOfTracks=fESDEvent->GetNumberOfTracks();
123  }
124  else {fAODEvent=dynamic_cast<AliAODEvent*>(fInputEvent);
125  NumberOfTracks=fAODEvent->GetNumberOfTracks();
126  }
127  //if(fESDEvent){
128  for(Int_t currentTrackIndex=0;currentTrackIndex<NumberOfTracks;currentTrackIndex++){
129  AliDalitzAODESD *fCurrentTrack =0;
130 
131  if(fESDEvent){
132  fCurrentTrack= new AliDalitzAODESD((AliESDtrack*)(fESDEvent->GetTrack(currentTrackIndex)));
133  fCurrentTrack->ComputeImpactParameter();
134  }
135  else {fCurrentTrack= new AliDalitzAODESD((AliAODTrack*)(fAODEvent->GetTrack(currentTrackIndex)));
136  fCurrentTrack->ComputeImpactParameter(fAODEvent->GetPrimaryVertex(),fAODEvent->GetMagneticField());
137  }
138 
139  if(!fCurrentTrack){
140  printf("Requested Track does not exist");
141  continue;
142  }
143  if ( fElectronCuts->ElectronIsSelected( fCurrentTrack ) ) {
144  if( fCurrentTrack->GetSignG() > 0.0 ){
145  fPositronsIndex.push_back(currentTrackIndex);
146  } else {
147  fElectronsIndex.push_back(currentTrackIndex);
148  }
149  }
150  delete fCurrentTrack;
151  }
152  //}
153  return kTRUE;
154 }
155 
156 //________________________________________________________________________
158 {
159 
160 }
virtual void Terminate(Option_t *)
virtual void UserExec(Option_t *option)
Bool_t ProcessEvent(AliVEvent *inputEvent, AliMCEvent *mcEvent=NULL)
int Int_t
Definition: External.C:63
const char Option_t
Definition: External.C:48
bool Bool_t
Definition: External.C:53
void ComputeImpactParameter()