update to master versions
[u/mrichter/AliRoot.git] / PWGCF / Correlations / JCORRAN / AliJCORRANTask.cxx
CommitLineData
37dde34e 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
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 **************************************************************************/
15
16//______________________________________________________________________________
17// Analysis task for high pt particle correlations
18// author: R.Diaz, J. Rak, D.J. Kim
19// ALICE Group University of Jyvaskyla
20// Finland
21// Fill the analysis containers for ESD or AOD
22// Adapted for AliAnalysisTaskSE and AOD objects
23//////////////////////////////////////////////////////////////////////////////
24
66be7134 25#include "TChain.h"
26#include "TList.h"
27#include "TTree.h"
28#include "TFile.h"
37dde34e 29
37dde34e 30
31#include "AliAnalysisTaskSE.h"
32#include "AliAODHandler.h"
33
34#include "AliJCORRANTask.h"
35#include "AliAnalysisManager.h"
37dde34e 36
37#include "AliJTrack.h"
38#include "AliJMCTrack.h"
39#include "AliJPhoton.h"
66be7134 40//#include "AliJCaloCell.h"
37dde34e 41#include "AliJEventHeader.h"
42#include "AliJRunHeader.h"
43
44//______________________________________________________________________________
45AliJCORRANTask::AliJCORRANTask() :
46 AliAnalysisTaskSE("PWG4JCORRAN"),
66be7134 47 fFilter(0x0),
5ca97880 48 fAliJRunHeader(0x0)
66be7134 49{
37dde34e 50
51 DefineInput (0, TChain::Class());
66be7134 52
53 fFilter = new AliJFilter();
37dde34e 54}
55
56//______________________________________________________________________________
57AliJCORRANTask::AliJCORRANTask(const char *name, TString inputformat):
58 AliAnalysisTaskSE(name),
66be7134 59 fFilter(0x0),
5ca97880 60 fAliJRunHeader(0x0)
37dde34e 61{
62 // Constructor
66be7134 63 AliInfo("---- AliJCORRANTask Constructor ----");
37dde34e 64
66be7134 65 JUNUSED(inputformat);
37dde34e 66
67 DefineInput (0, TChain::Class());
66be7134 68
69 fFilter = new AliJFilter( Form("%sFilter",name), this );
37dde34e 70}
71
72//____________________________________________________________________________
73AliJCORRANTask::AliJCORRANTask(const AliJCORRANTask& ap) :
74 AliAnalysisTaskSE(ap.GetName()),
66be7134 75 fFilter(ap.fFilter),
5ca97880 76 fAliJRunHeader(ap.fAliJRunHeader)
37dde34e 77{
37dde34e 78
66be7134 79 AliInfo("----DEBUG AliJCORRANTask COPY ----");
37dde34e 80
81}
82
83//_____________________________________________________________________________
84AliJCORRANTask& AliJCORRANTask::operator = (const AliJCORRANTask& ap)
85{
86 // assignment operator
87
66be7134 88 AliInfo("----DEBUG AliJCORRANTask operator= ----");
37dde34e 89 this->~AliJCORRANTask();
90 new(this) AliJCORRANTask(ap);
91 return *this;
92}
93
94//______________________________________________________________________________
95AliJCORRANTask::~AliJCORRANTask()
96{
97 // destructor
37dde34e 98
66be7134 99 delete fFilter;
66be7134 100 delete fAliJRunHeader;
37dde34e 101
102}
103
104//________________________________________________________________________
105
106void AliJCORRANTask::UserCreateOutputObjects()
107{
108 //=== create the jcorran outputs objects
109 if(fDebug > 1) printf("AliJCORRANTask::UserCreateOutPutData() \n");
66be7134 110
37dde34e 111 //=== Get AnalysisManager
112 AliAnalysisManager *man = AliAnalysisManager::GetAnalysisManager();
113 if(!man->GetOutputEventHandler()) {
114 Fatal("UserCreateOutputObjects", "This task needs an AOD handler");
115 return;
116 }
37dde34e 117
66be7134 118 // run the filter class
119 fFilter->SetMyTask( this );
120 fFilter->SetAliJRunHeader( fAliJRunHeader );
121 fFilter->UserCreateOutputObjects();
37dde34e 122
37dde34e 123
66be7134 124 cout << "Add(fAliRunHeader) in UserCreateObject() ======= " << endl;
37dde34e 125
126}
127
128//______________________________________________________________________________
66be7134 129void AliJCORRANTask::UserExec(Option_t* /*option*/)
37dde34e 130{
37dde34e 131
66be7134 132 // Processing of one event
133 if(fDebug > 5) cout << "------- AliJCORRANTask Exec-------"<<endl;
134 if(!((Entry()-1)%100)) AliInfo(Form(" Processing event # %lld", Entry()));
37dde34e 135
66be7134 136 fFilter->UserExec("");
37dde34e 137
66be7134 138 if(fDebug > 5) cout << "\t------- End UserExec "<<endl;
37dde34e 139}
140
141//______________________________________________________________________________
66be7134 142void AliJCORRANTask::Init()
37dde34e 143{
66be7134 144 // Intialisation of parameters
145 AliInfo("Doing initialization") ;
37dde34e 146
66be7134 147 fFilter->Init();
37dde34e 148}
149
150//______________________________________________________________________________
5ca97880 151void AliJCORRANTask::Terminate(Option_t *)
37dde34e 152{
66be7134 153 fFilter->Terminate();
154
155 // Processing when the event loop is ended
156 fAliJRunHeader->PrintOut();
157 cout<<"AliJCORRANTask Analysis DONE !!"<<endl;
37dde34e 158}