]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGGA/GammaConv/AliPrimaryPionSelector.cxx
Merge branch 'feature-movesplit'
[u/mrichter/AliRoot.git] / PWGGA / GammaConv / AliPrimaryPionSelector.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved.       *
3  *                                                                                                                                                      *
4  * Authors: Friederike Bock                                                                                                     *
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 "AliPrimaryPionSelector.h"
24 #include "AliPrimaryPionCuts.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(AliPrimaryPionSelector)
43
44 //________________________________________________________________________
45 AliPrimaryPionSelector::AliPrimaryPionSelector(const char *name) : AliAnalysisTaskSE(name),
46     fPionCuts(0),
47     fPosPionsIndex(),
48     fNegPionsIndex(),
49     fEventIsSelected(kFALSE)
50 {
51     // Default constructor
52     DefineInput(0, TChain::Class());
53 }
54
55 //________________________________________________________________________
56 AliPrimaryPionSelector::~AliPrimaryPionSelector()
57 {
58     // default deconstructor
59
60    
61 }
62 //________________________________________________________________________
63 void AliPrimaryPionSelector::Init()
64 {
65     // Initialize function to be called once before analysis
66
67     if(fPionCuts == 0){
68     //  fPionCuts=AliConversionCuts::GetStandardCuts2010PbPb();
69         AliError("No Cut Selection initialized");
70     }
71
72 }
73
74 //________________________________________________________________________
75 void AliPrimaryPionSelector::UserCreateOutputObjects()
76 {
77     // Create User Output Objects
78 }
79
80 //________________________________________________________________________
81 void AliPrimaryPionSelector::UserExec(Option_t *){
82     // User Exec
83         fEventIsSelected=ProcessEvent(fInputEvent,fMCEvent);
84 }
85
86 //________________________________________________________________________
87 Bool_t AliPrimaryPionSelector::ProcessEvent(AliVEvent *inputEvent,AliMCEvent *mcEvent)
88 {
89         //Reset the index
90
91         fPosPionsIndex.clear();
92         fNegPionsIndex.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(!fPionCuts){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 AliPrimaryPionSelector::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 (  fPionCuts->PionIsSelected( fCurrentTrack ) ) {
130                                 if( fCurrentTrack->GetSign() > 0.0 ){
131                                         fPosPionsIndex.push_back(currentTrackIndex);
132                                 } else {
133                                         fNegPionsIndex.push_back(currentTrackIndex);
134                                 }
135                         }
136                 }
137         }
138         return kTRUE;
139 }
140
141
142 //________________________________________________________________________
143 void AliPrimaryPionSelector::Terminate(Option_t *)
144 {
145
146 }