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 **************************************************************************/
16 //______________________________________________________________________________
17 // Analysis task for high pt particle correlations
18 // author: R.Diaz, J. Rak, D.J. Kim
19 // ALICE Group University of Jyvaskyla
21 // Fill the analysis containers for ESD or AOD
22 // Adapted for AliAnalysisTaskSE and AOD objects
23 //////////////////////////////////////////////////////////////////////////////
31 #include "AliAnalysisTaskSE.h"
32 #include "AliAODHandler.h"
34 #include "AliJCORRANTask.h"
35 #include "AliAnalysisManager.h"
37 #include "AliJTrack.h"
38 #include "AliJMCTrack.h"
39 #include "AliJPhoton.h"
40 //#include "AliJCaloCell.h"
41 #include "AliJEventHeader.h"
42 #include "AliJRunHeader.h"
44 //______________________________________________________________________________
45 AliJCORRANTask::AliJCORRANTask() :
46 AliAnalysisTaskSE("PWG4JCORRAN"),
48 fAODName("jcorran.root"),
55 DefineInput (0, TChain::Class());
56 DefineOutput (1, TTree::Class());
57 DefineOutput (2, TList::Class());
59 fFilter = new AliJFilter();
62 //______________________________________________________________________________
63 AliJCORRANTask::AliJCORRANTask(const char *name, TString inputformat):
64 AliAnalysisTaskSE(name),
66 fAODName("jcorran.root"),
72 AliInfo("---- AliJCORRANTask Constructor ----");
76 DefineInput (0, TChain::Class());
77 DefineOutput (1, TTree::Class());
78 DefineOutput (2, TList::Class());
80 fFilter = new AliJFilter( Form("%sFilter",name), this );
83 //____________________________________________________________________________
84 AliJCORRANTask::AliJCORRANTask(const AliJCORRANTask& ap) :
85 AliAnalysisTaskSE(ap.GetName()),
87 fAODName(ap.fAODName),
88 fJODTree(ap.fJODTree),
89 fAliJRunHeader(ap.fAliJRunHeader),
90 fDoStoreJOD(ap.fDoStoreJOD)
93 AliInfo("----DEBUG AliJCORRANTask COPY ----");
97 //_____________________________________________________________________________
98 AliJCORRANTask& AliJCORRANTask::operator = (const AliJCORRANTask& ap)
100 // assignment operator
102 AliInfo("----DEBUG AliJCORRANTask operator= ----");
103 this->~AliJCORRANTask();
104 new(this) AliJCORRANTask(ap);
108 //______________________________________________________________________________
109 AliJCORRANTask::~AliJCORRANTask()
115 delete fAliJRunHeader;
119 //________________________________________________________________________
121 void AliJCORRANTask::UserCreateOutputObjects()
123 //=== create the jcorran outputs objects
124 if(fDebug > 1) printf("AliJCORRANTask::UserCreateOutPutData() \n");
126 //=== Get AnalysisManager
127 AliAnalysisManager *man = AliAnalysisManager::GetAnalysisManager();
128 if(!man->GetOutputEventHandler()) {
129 Fatal("UserCreateOutputObjects", "This task needs an AOD handler");
133 // run the filter class
134 fFilter->SetMyTask( this );
135 fFilter->SetAliJRunHeader( fAliJRunHeader );
136 fFilter->UserCreateOutputObjects();
138 // register ouput branches
141 TFile * file1 = OpenFile(1);
142 file1-> SetCompressionLevel(9);
143 TTree * tree = new TTree("JODTree","JYFL Object Data");
145 int basketsize = 32000;
146 tree->Branch("TrackList", fFilter->GetTrackList(),basketsize, split);
147 if( fFilter->IsMC() )
148 tree->Branch("MCTrackList", fFilter->GetMCTrackList(),basketsize, split );
150 tree->Branch("HeaderList", fFilter->GetHeaderList(),basketsize, split );
152 if( fFilter->GetStoreEventPlaneSource() ){
153 tree->Branch("AliESDVZERO", fFilter->GetESDVZERO());
154 tree->Branch("AliESDTZERO", fFilter->GetESDTZERO());
155 tree->Branch("AliESDZDC", fFilter->GetESDZDC());
160 PostData( 1, fJODTree );
162 PostData( 2,fFilter->GetRunInfoList());
165 cout << "Add(fAliRunHeader) in UserCreateObject() ======= " << endl;
169 //______________________________________________________________________________
170 void AliJCORRANTask::UserExec(Option_t* /*option*/)
173 // Processing of one event
174 if(fDebug > 5) cout << "------- AliJCORRANTask Exec-------"<<endl;
175 if(!((Entry()-1)%100)) AliInfo(Form(" Processing event # %lld", Entry()));
177 fFilter->UserExec("");
179 if( 1 || fFilter->GetEventSuccess() ){ // TODO
184 PostData(1,fJODTree);
185 PostData(2,fFilter->GetRunInfoList());
188 if(fDebug > 5) cout << "\t------- End UserExec "<<endl;
191 //______________________________________________________________________________
192 void AliJCORRANTask::Init()
194 // Intialisation of parameters
195 AliInfo("Doing initialization") ;
199 // TString formula(fEsdTrackCuts->GetMaxDCAToVertexXYPtDep());
200 // if(formula.Length()>0){ // momentum dep DCA cut for AOD
201 // formula.ReplaceAll("pt","x");
205 //______________________________________________________________________________
206 void AliJCORRANTask::Terminate(Option_t * option)
208 fFilter->Terminate();
210 // Processing when the event loop is ended
211 fAliJRunHeader->PrintOut();
212 cout<<"AliJCORRANTask Analysis DONE !!"<<endl;
213 // Printout fRunInfoList here
214 TList* fRunInfoList = dynamic_cast<TList*> (GetOutputData(1));
217 AliJRunHeader *fAliRunHeader = dynamic_cast<AliJRunHeader*> (fRunInfoList->FindObject("AliJRunHeader"));
218 if(fAliRunHeader) {fAliRunHeader->Print();}
222 cout << "WARNING : Run Information List is empty" << endl;