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 "AliESDtrackCuts.h"
\r
34 #include "AliMCEventHandler.h"
\r
35 #include "dNdPt/AlidNdPt.h"
\r
36 #include "dNdPt/AlidNdPtEventCuts.h"
\r
37 #include "dNdPt/AlidNdPtAcceptanceCuts.h"
\r
39 #include "dNdPt/AlidNdPtTask.h"
\r
41 using namespace std;
\r
43 ClassImp(AlidNdPtTask)
\r
45 //_____________________________________________________________________________
\r
46 AlidNdPtTask::AlidNdPtTask(const char *name)
\r
47 : AliAnalysisTaskSE(name)
\r
53 , fUseMCInfo(kFALSE)
\r
57 // Define input and output slots here
\r
58 DefineOutput(1, TList::Class());
\r
60 // create the list for comparison objects
\r
61 fCompList = new TList;
\r
64 //_____________________________________________________________________________
\r
65 AlidNdPtTask::~AlidNdPtTask()
\r
67 if(fOutput) delete fOutput; fOutput =0;
\r
68 if(fCompList) delete fCompList; fCompList =0;
\r
71 //____________________________________________________________________________
\r
72 Bool_t AlidNdPtTask::Notify()
\r
74 static Int_t count = 0;
\r
76 //Printf("Processing %d. file: %s", count, ((TTree*) GetInputData(0))->GetCurrentFile()->GetName());
\r
77 TTree *chain = (TChain*)GetInputData(0);
\r
79 Printf("Processing %d. file: %s", count, chain->GetCurrentFile()->GetName());
\r
82 TChain *chain = (TChain*)GetInputData(0);
\r
83 AliESDInputHandler *esdH = dynamic_cast<AliESDInputHandler*> (AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
\r
85 Printf("ERROR: Could not get ESDInputHandler");
\r
89 Printf("chain->GetCurrentFile()->GetName() %s", chain->GetCurrentFile()->GetName());
\r
96 //_____________________________________________________________________________
\r
97 Bool_t AlidNdPtTask::AddAnalysisObject(AlidNdPt *pObj)
\r
99 // add analysis object to the list
\r
101 Printf("ERROR: Could not add comparison object");
\r
105 // add object to the list
\r
106 fCompList->AddLast(pObj);
\r
111 //_____________________________________________________________________________
\r
112 void AlidNdPtTask::UserCreateOutputObjects()
\r
114 // Create histograms
\r
117 OpenFile(1, "RECREATE");
\r
120 // create output list
\r
122 fOutput = new TList;
\r
123 fOutput->SetOwner();
\r
124 fPitList = fOutput->MakeIterator();
\r
126 // add dNdPt analysis objects to the output
\r
129 TIterator *pitCompList = fCompList->MakeIterator();
\r
130 pitCompList->Reset();
\r
131 while(( pObj = (AlidNdPt *)pitCompList->Next()) != NULL) {
\r
132 fOutput->Add(pObj);
\r
135 Printf("UserCreateOutputObjects(): Number of output objects: %d \n", count);
\r
138 //_____________________________________________________________________________
\r
139 void AlidNdPtTask::UserExec(Option_t *)
\r
142 // Called for each event
\r
146 fESD = (AliESDEvent*) (InputEvent());
\r
148 Printf("ERROR: ESD event not available");
\r
156 Printf("ERROR: MC event not available");
\r
161 // Process analysis
\r
162 AlidNdPt *pObj = 0;
\r
164 while((pObj = (AlidNdPt *)fPitList->Next()) != NULL) {
\r
165 pObj->Process(fESD,fMC);
\r
168 // Post output data.
\r
169 PostData(1, fOutput);
\r
172 //_____________________________________________________________________________
\r
173 void AlidNdPtTask::Terminate(Option_t *)
\r
175 // Called one at the end
\r
177 // check output data
\r
178 fOutput = dynamic_cast<TList*> (GetOutputData(1));
\r
180 Printf("ERROR: AlidNdPtTask::Terminate(): Output data not avaiable GetOutputData(0)==0x0 ..." );
\r