]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGGA/GammaConv/AliDalitzElectronSelector.cxx
Merge branch 'feature-movesplit'
[u/mrichter/AliRoot.git] / PWGGA / GammaConv / AliDalitzElectronSelector.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                                                                                                                                                                                                                                              *
4  * Authors: Svein Lindal, Daniel Lohner                                                                                         *
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
16 ////////////////////////////////////////////////
17 //--------------------------------------------- 
18 // Class reconstructing primary electrons
19 //---------------------------------------------
20 ////////////////////////////////////////////////
21
22
23 #include "AliDalitzElectronSelector.h"
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 "AliStack.h"
35
36 class iostream;
37
38 using namespace std;
39
40
41
42 ClassImp(AliDalitzElectronSelector)
43
44 //________________________________________________________________________
45 AliDalitzElectronSelector::AliDalitzElectronSelector(const char *name) : AliAnalysisTaskSE(name),
46     fElectronCuts(0),
47     fPositronsIndex(),
48     fElectronsIndex(),
49     fEventIsSelected(kFALSE)
50 {
51     // Default constructor
52     DefineInput(0, TChain::Class());
53 }
54
55 //________________________________________________________________________
56 AliDalitzElectronSelector::~AliDalitzElectronSelector()
57 {
58     // default deconstructor
59
60    
61 }
62 //________________________________________________________________________
63 void AliDalitzElectronSelector::Init()
64 {
65     // Initialize function to be called once before analysis
66
67     if(fElectronCuts == 0){
68     //  fElectronCuts=AliConversionCuts::GetStandardCuts2010PbPb();
69         AliError("No Cut Selection initialized");
70     }
71
72 }
73
74 //________________________________________________________________________
75 void AliDalitzElectronSelector::UserCreateOutputObjects()
76 {
77     // Create User Output Objects
78 }
79
80 //________________________________________________________________________
81 void AliDalitzElectronSelector::UserExec(Option_t *){
82     // User Exec
83         fEventIsSelected=ProcessEvent(fInputEvent,fMCEvent);
84 }
85
86 //________________________________________________________________________
87 Bool_t AliDalitzElectronSelector::ProcessEvent(AliVEvent *inputEvent,AliMCEvent *mcEvent)
88 {
89         //Reset the index
90
91         fPositronsIndex.clear();
92         fElectronsIndex.clear();
93
94
95         fInputEvent=inputEvent;
96         fMCEvent=mcEvent;
97
98         if(!fInputEvent){
99                 AliError("No Input event");
100                 return kFALSE;
101         }
102
103         if(!fElectronCuts){AliError("No ConversionCuts");return kFALSE;}
104
105
106         if(fInputEvent->IsA()==AliESDEvent::Class()){
107                 ProcessESDs();
108         }
109
110         //if(fInputEvent->IsA()==AliAODEvent::Class()){
111         //GetAODConversionGammas();
112         //}
113
114
115         return kTRUE;
116 }
117
118 ///________________________________________________________________________
119 Bool_t AliDalitzElectronSelector::ProcessESDs(){
120         // Process ESD V0s for conversion photon reconstruction
121         AliESDEvent *fESDEvent=dynamic_cast<AliESDEvent*>(fInputEvent);
122         if(fESDEvent){
123                 for(Int_t currentTrackIndex=0;currentTrackIndex<fESDEvent->GetNumberOfTracks();currentTrackIndex++){
124                         AliESDtrack *fCurrentTrack = (AliESDtrack*)(fESDEvent->GetTrack(currentTrackIndex));
125                         if(!fCurrentTrack){
126                                 printf("Requested Track does not exist");
127                                 continue;
128                         }
129                         if (  fElectronCuts->ElectronIsSelected( fCurrentTrack ) ) {
130                                 if( fCurrentTrack->GetSign() > 0.0 ){
131                                         fPositronsIndex.push_back(currentTrackIndex);
132                                 } else {
133                                         fElectronsIndex.push_back(currentTrackIndex);
134                                 }
135                         }
136                 }
137         }
138         return kTRUE;
139 }
140
141
142 //________________________________________________________________________
143 void AliDalitzElectronSelector::Terminate(Option_t *)
144 {
145
146 }