8 #include "AliAnalysisManager.h"
9 #include "AliAnalysisTask.h"
11 #include "AliESDEvent.h"
12 #include "AliAODEvent.h"
13 #include "AliRsnEvent.h"
16 #include "AliESDInputHandler.h"
17 #include "AliMCEventHandler.h"
18 #include "AliAODInputHandler.h"
20 #include "AliRsnBaseAT.h"
23 ClassImp ( AliRsnBaseAT );
25 //________________________________________________________________________
26 AliRsnBaseAT::AliRsnBaseAT ( const char *name /*,Bool_t isSecondChain*/ )
27 : AliAnalysisTask ( name, "" ) /*,fIsSecondChain ( isSecondChain )*/
30 DefineInput ( 0, TChain::Class() );
31 // if ( IsSecondChain() )
32 // DefineInput ( 1, TChain::Class() );
35 void AliRsnBaseAT::InitIOVars ()
37 AliDebug ( AliLog::kDebug, "<-" );
40 for ( Int_t i=0;i<3;i++ )
51 AliDebug ( AliLog::kDebug, "->" );
54 Bool_t AliRsnBaseAT::Notify()
56 return AliAnalysisTask::Notify();
59 //________________________________________________________________________
60 void AliRsnBaseAT::ConnectInputData ( Option_t * )
62 ConnectInputDataByInputType ( fInputType[0],0 );
63 // if ( IsSecondChain() )
64 // ConnectInputDataByInputType ( fInputType[1],1 );
68 void AliRsnBaseAT::ConnectInputDataByInputType ( EInputType type ,Short_t inputIndex )
70 AliDebug ( AliLog::kDebug, "<-" );
76 ConnectAOD ( inputIndex );
81 ConnectESD ( inputIndex );
86 ConnectESDMC ( inputIndex );
90 AliError ( "Not Implemented Yet ..." );
94 ConnectRSN ( inputIndex );
98 AliError ( "Type not supported ..." );
101 AliDebug ( AliLog::kDebug, "->" );
104 void AliRsnBaseAT::ConnectRSN ( Short_t inputIndex )
106 AliDebug ( AliLog::kDebug, "<-" );
107 char ** address = ( char ** ) GetBranchAddress ( inputIndex, "RsnEvents" );
110 fRSN[inputIndex] = ( AliRsnEvent* ) ( *address );
114 // fRSN[inputIndex] = new AliRsnEvent();
115 fRSN[inputIndex] = 0;
116 SetBranchAddress ( inputIndex, "RsnEvents", &fRSN[inputIndex] );
118 AliDebug ( AliLog::kDebug, "->" );
121 void AliRsnBaseAT::ConnectESD(Short_t inputIndex)
123 AliDebug ( AliLog::kDebug, "<-" );
125 // fAnalysisMgr->SetInputEventHandler ( new AliESDInputHandler() );
127 TTree* tree = dynamic_cast<TTree*> ( GetInputData ( inputIndex ) );
128 if ( !tree ) { AliError ( "Could not read chain from input slot 0" ); }
131 // Disable all branches, we want to process only MC
132 tree->SetBranchStatus ( "*", kFALSE );
133 tree->SetBranchStatus ( "fTracks.*", kTRUE );
135 AliESDInputHandler *esdH = dynamic_cast<AliESDInputHandler*> ( AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler() );
137 if ( !esdH ) { AliError ( "Could not get ESDInputHandler" ); }
139 fESD[inputIndex] = esdH->GetEvent();
141 AliDebug ( AliLog::kDebug, "->" );
145 void AliRsnBaseAT::ConnectESDMC(Short_t inputIndex)
147 AliDebug ( AliLog::kDebug, "<-" );
149 // fAnalysisMgr->SetInputEventHandler ( new AliESDInputHandler() );
150 // fAnalysisMgr->SetMCtruthEventHandler ( new AliMCEventHandler() );
153 TTree* tree = dynamic_cast<TTree*> ( GetInputData ( inputIndex ) );
154 if ( !tree ) { AliError ( "Could not read chain from input slot 0" ); }
157 // Disable all branches, we want to process only MC
158 tree->SetBranchStatus ( "*", kFALSE );
159 tree->SetBranchStatus ( "fTracks.*", kTRUE );
161 AliESDInputHandler *esdH = dynamic_cast<AliESDInputHandler*> ( AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler() );
163 if ( !esdH ) { AliError ( "Could not get ESDInputHandler" ); }
165 fESD[inputIndex] = esdH->GetEvent();
167 AliDebug ( AliLog::kDebug, "->" );
171 void AliRsnBaseAT::ConnectAOD(Short_t inputIndex)
173 AliDebug ( AliLog::kDebug, "<-" );
175 // fAnalysisMgr->SetInputEventHandler ( new AliAODInputHandler());
177 TTree* tree = dynamic_cast<TTree*> ( GetInputData ( inputIndex ) );
178 if ( !tree ) { AliError ( "Could not read chain from input slot 0" );}
181 AliAODInputHandler *aodH = dynamic_cast<AliAODInputHandler*> ( AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler() );
183 if ( !aodH ) { AliError ( "Could not get AODInputHandler" ); }
186 fAOD[inputIndex] = aodH->GetEvent();
189 AliDebug ( AliLog::kDebug, "->" );