AliPhysics  master (3d17d9d)
AliPrimaryDeuteronSelector.cxx
Go to the documentation of this file.
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  * *
4  * Authors: Friederike Bock *
5  * Converted to deuteron by A. Marin
6  * Version 1.0 *
7  * *
8  * Permission to use, copy, modify and distribute this software and its *
9  * documentation strictly for non-commercial purposes is hereby granted *
10  * without fee, provided that the above copyright notice appears in all *
11  * copies and that both the copyright notice and this permission notice *
12  * appear in the supporting documentation. The authors make no claims *
13  * about the suitability of this software for any purpose. It is *
14  * provided "as is" without express or implied warranty. *
15  **************************************************************************/
16 
18 //---------------------------------------------
19 // Class reconstructing primary deuterons
20 //---------------------------------------------
22 
23 
25 #include "AliPrimaryDeuteronCuts.h"
26 #include "AliAODv0.h"
27 #include "AliESDv0.h"
28 #include "AliAODEvent.h"
29 #include "AliESDEvent.h"
30 #include "TVector.h"
31 #include "AliESDtrack.h"
32 #include "AliAnalysisManager.h"
33 #include "AliInputEventHandler.h"
34 #include "TChain.h"
35 #include "AliMCEvent.h"
36 
37 class iostream;
38 
39 using namespace std;
40 
41 
42 
44 
45 //________________________________________________________________________
47  fDeuteronCuts(0),
48  fPosDeuteronsIndex(),
49  fNegDeuteronsIndex(),
50  fEventIsSelected(kFALSE)
51 {
52  // Default constructor
53  DefineInput(0, TChain::Class());
54 }
55 
56 //________________________________________________________________________
58 {
59  // default deconstructor
60 
61 
62 }
63 //________________________________________________________________________
65 {
66  // Initialize function to be called once before analysis
67 
68  if(fDeuteronCuts == 0){
69  // fDeuteronCuts=AliConversionCuts::GetStandardCuts2010PbPb();
70  AliError("No Cut Selection initialized");
71  }
72 
73 }
74 
75 //________________________________________________________________________
77 {
78  // Create User Output Objects
79 }
80 
81 //________________________________________________________________________
83  // User Exec
84  fEventIsSelected=ProcessEvent(fInputEvent,fMCEvent);
85 }
86 
87 //________________________________________________________________________
88 Bool_t AliPrimaryDeuteronSelector::ProcessEvent(AliVEvent *inputEvent,AliMCEvent *mcEvent)
89 {
90  //Reset the index
91 
92  fPosDeuteronsIndex.clear();
93  fNegDeuteronsIndex.clear();
94 
95 
96  fInputEvent=inputEvent;
97  fMCEvent=mcEvent;
98 
99  if(!fInputEvent){
100  AliError("No Input event");
101  return kFALSE;
102  }
103 
104  if(!fDeuteronCuts){AliError("No ConversionCuts");return kFALSE;}
105 
106 
107  if(fInputEvent->IsA()==AliESDEvent::Class()){
108  ProcessESDs();
109  }
110 
111  if(fInputEvent->IsA()==AliAODEvent::Class()){
112  ProcessAODs();
113  }
114 
115 
116  return kTRUE;
117 }
118 
121  // Process ESD V0s for conversion photon reconstruction
122  AliESDEvent *fESDEvent=dynamic_cast<AliESDEvent*>(fInputEvent);
123  if(fESDEvent){
124  for(Int_t currentTrackIndex=0;currentTrackIndex<fESDEvent->GetNumberOfTracks();currentTrackIndex++){
125  AliESDtrack *fCurrentTrack = dynamic_cast<AliESDtrack*> (fESDEvent->GetTrack(currentTrackIndex));
126  if(!fCurrentTrack){
127  printf("Requested Track does not exist");
128  continue;
129  }
130 
131  if ( fDeuteronCuts->DeuteronIsSelected( fCurrentTrack ) ) {
132  if( fCurrentTrack->GetSign() > 0.0 ){
133  fPosDeuteronsIndex.push_back(currentTrackIndex);
134  } else {
135  fNegDeuteronsIndex.push_back(currentTrackIndex);
136  }
137  }
138  }
139  }
140  return kTRUE;
141 }
142 
145  // process AOD primary pions
146  AliAODEvent *fAODEvent=dynamic_cast<AliAODEvent*>(fInputEvent);
147  if(fAODEvent){
148  for(Int_t currentTrackIndex=0;currentTrackIndex<fAODEvent->GetNumberOfTracks();currentTrackIndex++){
149  AliAODTrack *fCurrentTrack = dynamic_cast<AliAODTrack*> (fAODEvent->GetTrack(currentTrackIndex));
150  if(!fCurrentTrack){
151  printf("Requested Track does not exist");
152  continue;
153  }
154 
155  Float_t sign = ( fCurrentTrack ? fCurrentTrack->Charge() : fCurrentTrack->GetSign() );
156  if ( fDeuteronCuts->DeuteronIsSelectedAOD( fCurrentTrack ) ) {
157  if( sign > 0.0 ){
158  fPosDeuteronsIndex.push_back(currentTrackIndex);
159  } else {
160  fNegDeuteronsIndex.push_back(currentTrackIndex);
161  }
162  }
163  }
164  }
165  return kTRUE;
166 }
167 
168 //________________________________________________________________________
170 {
171 
172 }
int Int_t
Definition: External.C:63
float Float_t
Definition: External.C:68
const char Option_t
Definition: External.C:48
bool Bool_t
Definition: External.C:53
Bool_t ProcessEvent(AliVEvent *inputEvent, AliMCEvent *mcEvent=NULL)
virtual void UserExec(Option_t *option)