]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGCF/Correlations/JCORRAN/AliJCORRANTask.cxx
Merge branch 'master' of https://git.cern.ch/reps/AliRoot
[u/mrichter/AliRoot.git] / PWGCF / Correlations / JCORRAN / AliJCORRANTask.cxx
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
25 #include "TChain.h"
26 #include "TList.h"
27 #include "TTree.h"
28 #include "TFile.h"
29
30
31 #include "AliAnalysisTaskSE.h"
32 #include "AliAODHandler.h"
33
34 #include "AliJCORRANTask.h" 
35 #include "AliAnalysisManager.h"
36
37 #include "AliJTrack.h"
38 #include "AliJMCTrack.h"
39 #include "AliJPhoton.h"
40 //#include "AliJCaloCell.h"
41 #include "AliJEventHeader.h"
42 #include "AliJRunHeader.h"
43
44 //______________________________________________________________________________
45 AliJCORRANTask::AliJCORRANTask() :   
46     AliAnalysisTaskSE("PWG4JCORRAN"),
47         fFilterEntry(0),
48     fFilter(0x0),
49     fAliJRunHeader(0x0)
50 {
51
52   DefineInput (0, TChain::Class());
53   
54    fFilter = new AliJFilter();
55 }
56
57 //______________________________________________________________________________
58 AliJCORRANTask::AliJCORRANTask(const char *name, TString inputformat):
59     AliAnalysisTaskSE(name), 
60         fFilterEntry(0),
61     fFilter(0x0),
62     fAliJRunHeader(0x0)
63 {
64   // Constructor
65   AliInfo("---- AliJCORRANTask Constructor ----");
66
67   JUNUSED(inputformat);
68
69   DefineInput (0, TChain::Class());
70
71    fFilter = new AliJFilter( Form("%sFilter",name), this );
72 }
73
74 //____________________________________________________________________________
75 AliJCORRANTask::AliJCORRANTask(const AliJCORRANTask& ap) :
76     AliAnalysisTaskSE(ap.GetName()), 
77         fFilterEntry(ap.fFilterEntry),
78     fFilter(ap.fFilter),
79     fAliJRunHeader(ap.fAliJRunHeader)
80
81
82   AliInfo("----DEBUG AliJCORRANTask COPY ----");
83
84 }
85
86 //_____________________________________________________________________________
87 AliJCORRANTask& AliJCORRANTask::operator = (const AliJCORRANTask& ap)
88 {
89   // assignment operator
90
91   AliInfo("----DEBUG AliJCORRANTask operator= ----");
92   this->~AliJCORRANTask();
93   new(this) AliJCORRANTask(ap);
94   return *this;
95 }
96
97 //______________________________________________________________________________
98 AliJCORRANTask::~AliJCORRANTask()
99 {
100   // destructor 
101
102    delete fFilter;
103    delete fAliJRunHeader;
104
105 }
106
107 //________________________________________________________________________
108
109 void AliJCORRANTask::UserCreateOutputObjects()
110 {  
111   //=== create the jcorran outputs objects
112   if(fDebug > 1) printf("AliJCORRANTask::UserCreateOutPutData() \n");
113   
114   //=== Get AnalysisManager
115   AliAnalysisManager *man = AliAnalysisManager::GetAnalysisManager();
116   if(!man->GetOutputEventHandler()) {
117     Fatal("UserCreateOutputObjects", "This task needs an AOD handler");
118     return;
119   }
120
121    // run the filter class
122    fFilter->SetMyTask( this );
123    fFilter->SetAliJRunHeader( fAliJRunHeader );
124    fFilter->UserCreateOutputObjects();
125
126
127   cout << "Add(fAliRunHeader) in UserCreateObject() ======= " << endl;
128
129 }
130
131 //______________________________________________________________________________
132 void AliJCORRANTask::UserExec(Option_t* /*option*/) 
133 {
134
135         // Processing of one event
136         if(fDebug > 5) cout << "------- AliJCORRANTask Exec-------"<<endl;
137         if(!((Entry()-1)%100))  AliInfo(Form(" Processing event # %lld",  Entry())); 
138         fFilterEntry = fEntry;
139         fFilter->UserExec("");
140
141         if(fDebug > 5) cout << "\t------- End UserExec "<<endl;
142 }
143
144 //______________________________________________________________________________
145 void AliJCORRANTask::Init()
146 {
147         // Intialisation of parameters
148         AliInfo("Doing initialization") ; 
149
150         fFilter->Init();
151 }
152
153 //______________________________________________________________________________
154 void AliJCORRANTask::Terminate(Option_t *)
155 {
156         //fFilter->Terminate();
157
158         // Processing when the event loop is ended
159         //fAliJRunHeader->PrintOut();
160         cout<<"AliJCORRANTask Analysis DONE !!"<<endl; 
161 }