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 //////////////////////////////////////////////////////////////////////////////
25 #include "AliAnalysisTaskSE.h"
26 #include "AliAODHandler.h"
27 #include "AliAnalysisManager.h"
30 #include "AliJDiHadronCorrTask.h"
31 #include "AliJEventHeader.h"
32 #include "AliJRunHeader.h"
33 #include "AliJCORRANTask.h"
36 //______________________________________________________________________________
37 AliJDiHadronCorrTask::AliJDiHadronCorrTask() :
38 AliAnalysisTaskSE("AliJDiHadronCorrTaskTask"),
44 DefineOutput (1, TDirectory::Class());
47 //______________________________________________________________________________
48 AliJDiHadronCorrTask::AliJDiHadronCorrTask(const char *name, TString inputformat):
49 AliAnalysisTaskSE(name),
56 AliInfo("---- AliJDiHadronCorrTask Constructor ----");
59 DefineOutput (1, TDirectory::Class());
62 //____________________________________________________________________________
63 AliJDiHadronCorrTask::AliJDiHadronCorrTask(const AliJDiHadronCorrTask& ap) :
64 AliAnalysisTaskSE(ap.GetName()),
65 fFilterTask(ap.fFilterTask),
66 fFilterTaskName(ap.fFilterTaskName),
67 fJCORRAN( ap.fJCORRAN ),
71 AliInfo("----DEBUG AliJDiHadronCorrTask COPY ----");
75 //_____________________________________________________________________________
76 AliJDiHadronCorrTask& AliJDiHadronCorrTask::operator = (const AliJDiHadronCorrTask& ap)
78 // assignment operator
80 AliInfo("----DEBUG AliJDiHadronCorrTask operator= ----");
81 this->~AliJDiHadronCorrTask();
82 new(this) AliJDiHadronCorrTask(ap);
86 //______________________________________________________________________________
87 AliJDiHadronCorrTask::~AliJDiHadronCorrTask()
95 //________________________________________________________________________
97 void AliJDiHadronCorrTask::UserCreateOutputObjects()
99 //=== create the jcorran outputs objects
100 if(fDebug > 1) printf("AliJDiHadronCorrTask::UserCreateOutPutData() \n");
102 //=== Get AnalysisManager
103 AliAnalysisManager *man = AliAnalysisManager::GetAnalysisManager();
104 if(!man->GetOutputEventHandler()) {
105 Fatal("UserCreateOutputObjects", "This task needs an AOD handler");
109 fFilterTask = (AliJCORRANTask*)(man->GetTask( fFilterTaskName ));
112 fOutput = gDirectory;//->mkdir("JDiHadronCorr");
115 // Order should be kept
116 // TODO : better implementation
117 //bool orignalTH1AdddirectoryStatus=TH1::AddDirectoryStatus();
119 //TH1::AddDirectory(kTRUE);
120 //if( !orignalTH1AdddirectoryStatus ) cout<<"DEBUG :: TH1::AddDirectory is turned on"<<endl;
121 fJCORRAN->SetRunHeader( fFilterTask->GetJRunHeader() );//TODO
122 fJCORRAN->UserCreateOutputObjects();
123 fJCORRAN->SetHeaderList(fFilterTask->GetFilter()->GetHeaderList() );
124 fJCORRAN->SetTrackList( fFilterTask->GetFilter()->GetTrackList() );
125 fJCORRAN->SetMCTrackList( fFilterTask->GetFilter()->GetMCTrackList() );
126 fJCORRAN->GetCard()->WriteCard(fOutput);
128 PostData( 1, fOutput );
129 //TH1::AddDirectory( orignalTH1AdddirectoryStatus );
130 //cout<<"DEBYG :: TH1::AddDirectory get orignal Value = "<<( orignalTH1AdddirectoryStatus?"True":"False" )<<endl;
132 cout << "Add(fAliRunHeader) in UserCreateObject() ======= " << endl;
136 //______________________________________________________________________________
137 void AliJDiHadronCorrTask::UserExec(Option_t* /*option*/)
140 // Processing of one event
141 if(fDebug > 5) cout << "------- AliJDiHadronCorrTask Exec-------"<<endl;
142 //if(!((Entry()-1)%100)) cout << Form(" Processing event # %lld", Entry()) << endl;
145 //cout << "AliJDiHadronCorrTask::UserExec fFilterTask->GetFilter()->GetEventSuccess() = " << fFilterTask->GetFilter()->GetEventSuccess() << endl;
146 if( fFilterTask->GetFilter()->GetEventSuccess() ){
147 fJCORRAN->UserExec();
148 PostData(1, fOutput );
152 if(fDebug > 5) cout << "\t------- End UserExec "<<endl;
155 //______________________________________________________________________________
156 void AliJDiHadronCorrTask::Init()
158 // Intialisation of parameters
159 AliInfo("Doing initialization") ;
163 //______________________________________________________________________________
164 void AliJDiHadronCorrTask::Terminate(Option_t *)
167 fJCORRAN->Terminate();
171 cout<<"# Write Data "<<endl;
172 //write Trigg ID and Assoc ID
173 fOutput->Write(0,TObject::kOverwrite);
175 cout<<"AliJDiHadronCorrTask Analysis DONE !!"<<endl;