1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
25 #include "AliAnalysisTask.h"
26 #include "AliAnalysisManager.h"
27 #include "AliESDEvent.h"
28 #include "AliESDInputHandler.h"
29 #include "AliESDVertex.h"
30 #include "AliTracker.h"
31 #include "AliGeomManager.h"
33 #include "AliCentrality.h"
34 #include "AliESDVZERO.h"
35 #include "AliMultiplicity.h"
37 #include "AliESDtrackCuts.h"
38 #include "AliMCEventHandler.h"
40 #include "AlidNdPtEventCuts.h"
41 #include "AlidNdPtAcceptanceCuts.h"
43 #include "AlidNdPtTask.h"
47 ClassImp(AlidNdPtTask)
49 //_____________________________________________________________________________
50 AlidNdPtTask::AlidNdPtTask(const char *name)
51 : AliAnalysisTaskSE(name)
61 // Define input and output slots here
62 DefineOutput(1, TList::Class());
64 // create the list for comparison objects
65 fCompList = new TList;
68 //_____________________________________________________________________________
69 AlidNdPtTask::~AlidNdPtTask()
71 if(fOutput) delete fOutput; fOutput =0;
72 if(fCompList) delete fCompList; fCompList =0;
75 //____________________________________________________________________________
76 Bool_t AlidNdPtTask::Notify()
78 static Int_t count = 0;
80 //Printf("Processing %d. file: %s", count, ((TTree*) GetInputData(0))->GetCurrentFile()->GetName());
81 TTree *chain = (TChain*)GetInputData(0);
83 Printf("Processing %d. file: %s", count, chain->GetCurrentFile()->GetName());
86 TChain *chain = (TChain*)GetInputData(0);
87 AliESDInputHandler *esdH = dynamic_cast<AliESDInputHandler*> (AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
89 Printf("ERROR: Could not get ESDInputHandler");
93 Printf("chain->GetCurrentFile()->GetName() %s", chain->GetCurrentFile()->GetName());
100 //_____________________________________________________________________________
101 Bool_t AlidNdPtTask::AddAnalysisObject(AlidNdPt *pObj)
103 // add analysis object to the list
105 Printf("ERROR: Could not add comparison object");
109 // add object to the list
110 fCompList->AddLast(pObj);
115 //_____________________________________________________________________________
116 void AlidNdPtTask::UserCreateOutputObjects()
121 OpenFile(1, "RECREATE");
124 // create output list
128 fPitList = fOutput->MakeIterator();
130 // add dNdPt analysis objects to the output
133 TIterator *pitCompList = fCompList->MakeIterator();
134 pitCompList->Reset();
135 while(( pObj = (AlidNdPt *)pitCompList->Next()) != NULL) {
139 Printf("UserCreateOutputObjects(): Number of output objects: %d \n", count);
141 PostData(1, fOutput);
144 //_____________________________________________________________________________
145 void AlidNdPtTask::UserExec(Option_t *)
148 // Called for each event
152 fESD = (AliESDEvent*) (InputEvent());
154 Printf("ERROR: ESD event not available");
162 Printf("ERROR: MC event not available");
170 while((pObj = (AlidNdPt *)fPitList->Next()) != NULL) {
171 pObj->Process(fESD,fMC);
176 PostData(1, fOutput);
179 //_____________________________________________________________________________
180 void AlidNdPtTask::FinishTaskOutput()
183 // Called one at the end
184 // locally on working node
187 fOutput = dynamic_cast<TList*> (GetOutputData(1));
189 Printf("ERROR: AlidNdPtTask::FinishTaskOutput(): Output data not avaiable GetOutputData(1)==0x0 ..." );
194 TIterator* itOut = fOutput->MakeIterator();
196 while(( pObj = dynamic_cast<AlidNdPt*>(itOut->Next())) != NULL) {
197 if(pObj->GetAnalyseOutput()) {
203 PostData(1, fOutput);
206 //_____________________________________________________________________________
207 void AlidNdPtTask::Terminate(Option_t *)
209 // Called one at the end
212 fOutput = dynamic_cast<TList*> (GetOutputData(1));
214 Printf("ERROR: AlidNdPtTask::Terminate(): Output data not avaiable GetOutputData(0)==0x0 ..." );