1 /**************************************************************************
\r
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
\r
4 * Author: The ALICE Off-line Project. *
\r
5 * Contributors are mentioned in the code where appropriate. *
\r
7 * Permission to use, copy, modify and distribute this software and its *
\r
8 * documentation strictly for non-commercial purposes is hereby granted *
\r
9 * without fee, provided that the above copyright notice appears in all *
\r
10 * copies and that both the copyright notice and this permission notice *
\r
11 * appear in the supporting documentation. The authors make no claims *
\r
12 * about the suitability of this software for any purpose. It is *
\r
13 * provided "as is" without express or implied warranty. *
\r
14 **************************************************************************/
\r
21 #include "TCanvas.h"
\r
25 #include "AliAnalysisTask.h"
\r
26 #include "AliAnalysisManager.h"
\r
27 #include "AliESDEvent.h"
\r
28 #include "AliESDInputHandler.h"
\r
29 #include "AliESDVertex.h"
\r
30 #include "AliTracker.h"
\r
31 #include "AliGeomManager.h"
\r
33 #include "AliCentrality.h"
\r
34 #include "AliESDVZERO.h"
\r
35 #include "AliMultiplicity.h"
\r
37 #include "AliESDtrackCuts.h"
\r
38 #include "AliMCEventHandler.h"
\r
39 #include "AlidNdPt.h"
\r
40 #include "AlidNdPtEventCuts.h"
\r
41 #include "AlidNdPtAcceptanceCuts.h"
\r
43 #include "AlidNdPtTask.h"
\r
45 using namespace std;
\r
47 ClassImp(AlidNdPtTask)
\r
49 //_____________________________________________________________________________
\r
50 AlidNdPtTask::AlidNdPtTask(const char *name)
\r
51 : AliAnalysisTaskSE(name)
\r
57 , fUseMCInfo(kFALSE)
\r
61 // Define input and output slots here
\r
62 DefineOutput(1, TList::Class());
\r
64 // create the list for comparison objects
\r
65 fCompList = new TList;
\r
68 //_____________________________________________________________________________
\r
69 AlidNdPtTask::~AlidNdPtTask()
\r
71 if(fOutput) delete fOutput; fOutput =0;
\r
72 if(fCompList) delete fCompList; fCompList =0;
\r
75 //____________________________________________________________________________
\r
76 Bool_t AlidNdPtTask::Notify()
\r
78 static Int_t count = 0;
\r
80 //Printf("Processing %d. file: %s", count, ((TTree*) GetInputData(0))->GetCurrentFile()->GetName());
\r
81 TTree *chain = (TChain*)GetInputData(0);
\r
83 Printf("Processing %d. file: %s", count, chain->GetCurrentFile()->GetName());
\r
86 TChain *chain = (TChain*)GetInputData(0);
\r
87 AliESDInputHandler *esdH = dynamic_cast<AliESDInputHandler*> (AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
\r
89 Printf("ERROR: Could not get ESDInputHandler");
\r
93 Printf("chain->GetCurrentFile()->GetName() %s", chain->GetCurrentFile()->GetName());
\r
100 //_____________________________________________________________________________
\r
101 Bool_t AlidNdPtTask::AddAnalysisObject(AlidNdPt *pObj)
\r
103 // add analysis object to the list
\r
105 Printf("ERROR: Could not add comparison object");
\r
109 // add object to the list
\r
110 fCompList->AddLast(pObj);
\r
115 //_____________________________________________________________________________
\r
116 void AlidNdPtTask::UserCreateOutputObjects()
\r
118 // Create histograms
\r
121 OpenFile(1, "RECREATE");
\r
124 // create output list
\r
126 fOutput = new TList;
\r
127 fOutput->SetOwner();
\r
128 fPitList = fOutput->MakeIterator();
\r
130 // add dNdPt analysis objects to the output
\r
133 TIterator *pitCompList = fCompList->MakeIterator();
\r
134 pitCompList->Reset();
\r
135 while(( pObj = (AlidNdPt *)pitCompList->Next()) != NULL) {
\r
136 fOutput->Add(pObj);
\r
139 Printf("UserCreateOutputObjects(): Number of output objects: %d \n", count);
\r
141 PostData(1, fOutput);
\r
144 //_____________________________________________________________________________
\r
145 void AlidNdPtTask::UserExec(Option_t *)
\r
148 // Called for each event
\r
152 fESD = (AliESDEvent*) (InputEvent());
\r
154 Printf("ERROR: ESD event not available");
\r
162 Printf("ERROR: MC event not available");
\r
168 AlidNdPt *pObj = 0;
\r
170 while((pObj = (AlidNdPt *)fPitList->Next()) != NULL) {
\r
171 pObj->Process(fESD,fMC);
\r
175 // Post output data.
\r
176 PostData(1, fOutput);
\r
179 //_____________________________________________________________________________
\r
180 void AlidNdPtTask::FinishTaskOutput()
\r
183 // Called one at the end
\r
184 // locally on working node
\r
186 // check output data
\r
187 fOutput = dynamic_cast<TList*> (GetOutputData(1));
\r
189 Printf("ERROR: AlidNdPtTask::FinishTaskOutput(): Output data not avaiable GetOutputData(1)==0x0 ..." );
\r
194 TIterator* itOut = fOutput->MakeIterator();
\r
196 while(( pObj = dynamic_cast<AlidNdPt*>(itOut->Next())) != NULL) {
\r
197 if(pObj->GetAnalyseOutput()) {
\r
202 // Post output data.
\r
203 PostData(1, fOutput);
\r
206 //_____________________________________________________________________________
\r
207 void AlidNdPtTask::Terminate(Option_t *)
\r
209 // Called one at the end
\r
211 // check output data
\r
212 fOutput = dynamic_cast<TList*> (GetOutputData(1));
\r
214 Printf("ERROR: AlidNdPtTask::Terminate(): Output data not avaiable GetOutputData(0)==0x0 ..." );
\r