]>
Commit | Line | Data |
---|---|---|
1c5acb87 | 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 | /* $Id: $ */ | |
16 | ||
17 | //_________________________________________________________________________ | |
18 | // Analysis task that executes the analysis classes | |
19 | // that depend on the PartCorr frame, frame for Particle identification and correlations. | |
20 | // Specially designed for calorimeters but also can be used for charged tracks | |
21 | // Input of this task is a configuration file that contains all the settings of the analyis | |
22 | // | |
23 | // -- Author: Gustavo Conesa (INFN-LNF) | |
24 | ||
268934f9 | 25 | #include <cstdlib> |
fbeaf916 | 26 | |
27 | // --- Root --- | |
1c5acb87 | 28 | #include <TROOT.h> |
1c5acb87 | 29 | #include <TInterpreter.h> |
1cd71065 | 30 | #include <TClonesArray.h> |
1c5acb87 | 31 | //#include <Riostream.h> |
1cd71065 | 32 | //#include <TObjectTable.h> |
1c5acb87 | 33 | |
fbeaf916 | 34 | // --- Analysis --- |
1c5acb87 | 35 | #include "AliAnalysisTaskParticleCorrelation.h" |
1c5acb87 | 36 | #include "AliAnaPartCorrMaker.h" |
37 | #include "AliCaloTrackReader.h" | |
7175a03a | 38 | #include "AliPDG.h" |
42dc8e7d | 39 | #include "AliAnalysisManager.h" |
1c5acb87 | 40 | |
41 | ClassImp(AliAnalysisTaskParticleCorrelation) | |
42 | ||
43 | //////////////////////////////////////////////////////////////////////// | |
fbeaf916 | 44 | AliAnalysisTaskParticleCorrelation::AliAnalysisTaskParticleCorrelation(): |
45 | AliAnalysisTaskSE(), | |
46 | fAna(0x0), | |
47 | fOutputContainer(0x0), | |
0c1383b5 | 48 | fConfigName(""), fCuts(0x0) |
1c5acb87 | 49 | { |
50 | // Default constructor | |
51 | } | |
52 | ||
53 | //_____________________________________________________ | |
54 | AliAnalysisTaskParticleCorrelation::AliAnalysisTaskParticleCorrelation(const char* name): | |
477d6cee | 55 | AliAnalysisTaskSE(name), |
56 | fAna(0x0), | |
57 | fOutputContainer(0x0), | |
0c1383b5 | 58 | fConfigName(""), fCuts(0x0) |
1c5acb87 | 59 | { |
60 | // Default constructor | |
477d6cee | 61 | |
1c5acb87 | 62 | DefineOutput(1, TList::Class()); |
0c1383b5 | 63 | DefineOutput(2, TList::Class()); // will contain cuts or local params |
1c5acb87 | 64 | } |
65 | ||
66 | //_____________________________________________________ | |
67 | AliAnalysisTaskParticleCorrelation::~AliAnalysisTaskParticleCorrelation() | |
68 | { | |
69 | // Remove all pointers | |
7787a778 | 70 | |
71 | // printf("********** Delete Task\n"); | |
72 | // // Do not delete it here, already done somewhere else, need to understand where. | |
73 | // if(fOutputContainer){ | |
74 | // fOutputContainer->Clear() ; | |
75 | // delete fOutputContainer ; | |
76 | // } | |
1c5acb87 | 77 | |
1cd71065 | 78 | if(fAna) delete fAna; |
7787a778 | 79 | |
80 | // printf("********** Task deleted \n"); | |
1c5acb87 | 81 | } |
82 | ||
83 | //_____________________________________________________ | |
84 | void AliAnalysisTaskParticleCorrelation::UserCreateOutputObjects() | |
85 | { | |
477d6cee | 86 | // Create the output container |
fbeaf916 | 87 | if (DebugLevel() > 1) printf("AliAnalysisTaskParticleCorrelation::UserCreateOutputObjects() - Begin\n"); |
477d6cee | 88 | |
89 | //Get list of aod arrays, add each aod array to analysis frame | |
1cd71065 | 90 | TClonesArray *array = 0; |
f37fa8d2 | 91 | TList * list = fAna->FillAndGetAODBranchList(); //Loop the analysis and create the list of branches |
92 | if (DebugLevel() >= 1) printf("AliAnalysisTaskParticleCorrelation::UserCreateOutputObjects() - n AOD branches %d\n",list->GetEntries()); | |
93 | ||
94 | //Put the delta AODs in output file, std or delta | |
95 | if((fAna->GetReader())->WriteDeltaAODToFile()){ | |
96 | TString deltaAODName = (fAna->GetReader())->GetDeltaAODFileName(); | |
97 | for(Int_t iaod = 0; iaod < list->GetEntries(); iaod++){ | |
98 | array = (TClonesArray*) list->At(iaod); | |
99 | if(deltaAODName!="") AddAODBranch("TClonesArray", &array, deltaAODName);//Put it in DeltaAOD file | |
100 | else AddAODBranch("TClonesArray", &array);//Put it in standard AOD file | |
101 | } | |
102 | } | |
103 | ||
477d6cee | 104 | //Histograms container |
105 | OpenFile(1); | |
106 | fOutputContainer = fAna->GetOutputContainer(); | |
f37fa8d2 | 107 | |
108 | if (DebugLevel() >= 1) printf("AliAnalysisTaskParticleCorrelation::UserCreateOutputObjects() - n histograms %d\n",fOutputContainer->GetEntries()); | |
109 | ||
4a745797 | 110 | fOutputContainer->SetOwner(kTRUE); |
f37fa8d2 | 111 | |
fbeaf916 | 112 | if (DebugLevel() > 1) printf("AliAnalysisTaskParticleCorrelation::UserCreateOutputObjects() - End\n"); |
609de1b2 | 113 | |
114 | PostData(1,fOutputContainer); | |
115 | ||
1c5acb87 | 116 | } |
0c1383b5 | 117 | //_____________________________________________________ |
118 | void AliAnalysisTaskParticleCorrelation::LocalInit() | |
119 | { | |
120 | // Local Initialization | |
121 | ||
37c0bcde | 122 | //Call the Init to initialize the configuration of the analysis |
123 | Init(); | |
124 | ||
0c1383b5 | 125 | // Create cuts/param objects and publish to slot |
0c1383b5 | 126 | fCuts = fAna->GetListOfAnalysisCuts(); |
37c0bcde | 127 | |
0c1383b5 | 128 | // Post Data |
37c0bcde | 129 | PostData(2, fCuts); |
0c1383b5 | 130 | |
0c1383b5 | 131 | } |
1c5acb87 | 132 | |
133 | //_____________________________________________________ | |
134 | void AliAnalysisTaskParticleCorrelation::Init() | |
135 | { | |
136 | // Initialization | |
fbeaf916 | 137 | |
138 | if (DebugLevel() > 1) printf("AliAnalysisTaskParticleCorrelation::Init() - Begin\n"); | |
477d6cee | 139 | |
140 | // Call configuration file if specified | |
141 | ||
142 | if (fConfigName.Length()) { | |
fbeaf916 | 143 | printf("AliAnalysisTaskParticleCorrelation::Init() - ### Configuration file is %s.C ###\n", fConfigName.Data()); |
477d6cee | 144 | gROOT->LoadMacro(fConfigName+".C"); |
145 | fAna = (AliAnaPartCorrMaker*) gInterpreter->ProcessLine("ConfigAnalysis()"); | |
1c5acb87 | 146 | } |
1c5acb87 | 147 | |
fbeaf916 | 148 | if(!fAna) { |
ee7d35e1 | 149 | printf("AliAnalysisTaskParticleCorrelation::Init() - Analysis maker pointer not initialized, no analysis specified, STOP !\n"); |
fbeaf916 | 150 | abort(); |
477d6cee | 151 | } |
1c5acb87 | 152 | |
7175a03a | 153 | // Add different generator particles to PDG Data Base |
154 | // to avoid problems when reading MC generator particles | |
155 | AliPDG::AddParticlesToPdgDataBase(); | |
156 | ||
486258c9 | 157 | //Set in the reader the name of the task in case is needed |
158 | (fAna->GetReader())->SetTaskName(GetName()); | |
159 | ||
1c5acb87 | 160 | // Initialise analysis |
161 | fAna->Init(); | |
42dc8e7d | 162 | |
163 | //Delta AOD | |
164 | if((fAna->GetReader())->GetDeltaAODFileName()!="") | |
165 | AliAnalysisManager::GetAnalysisManager()->RegisterExtraFile((fAna->GetReader())->GetDeltaAODFileName()); | |
166 | ||
fbeaf916 | 167 | if (DebugLevel() > 1) printf("AliAnalysisTaskParticleCorrelation::Init() - End\n"); |
1c5acb87 | 168 | |
169 | } | |
170 | ||
171 | ||
172 | //_____________________________________________________ | |
173 | void AliAnalysisTaskParticleCorrelation::UserExec(Option_t */*option*/) | |
174 | { | |
175 | // Execute analysis for current event | |
176 | // | |
fbeaf916 | 177 | if (DebugLevel() > 1) printf("AliAnalysisTaskParticleCorrelation::UserExec() - Begin\n"); |
1c5acb87 | 178 | |
fbeaf916 | 179 | //Get the type of data, check if type is correct |
1c5acb87 | 180 | Int_t datatype = fAna->GetReader()->GetDataType(); |
181 | if(datatype != AliCaloTrackReader::kESD && datatype != AliCaloTrackReader::kAOD && | |
182 | datatype != AliCaloTrackReader::kMC){ | |
fbeaf916 | 183 | printf("AliAnalysisTaskParticleCorrelation::UserExec() - Wrong type of data\n"); |
1c5acb87 | 184 | return ; |
185 | } | |
1cd71065 | 186 | |
477d6cee | 187 | fAna->GetReader()->SetInputOutputMCEvent(InputEvent(), AODEvent(), MCEvent()); |
1c5acb87 | 188 | |
189 | //Process event | |
a79a2424 | 190 | fAna->ProcessEvent((Int_t) Entry(), CurrentFileName()); |
191 | //printf("AliAnalysisTaskParticleCorrelation::Current Event %d; Current File Name : %s\n",(Int_t) Entry(), CurrentFileName()); | |
fbeaf916 | 192 | if (DebugLevel() > 1) printf("AliAnalysisTaskParticleCorrelation::UserExec() - End\n"); |
1cd71065 | 193 | |
1c5acb87 | 194 | PostData(1, fOutputContainer); |
1cd71065 | 195 | |
196 | //gObjectTable->Print(); | |
197 | ||
1c5acb87 | 198 | |
199 | } | |
200 | ||
201 | //_____________________________________________________ | |
202 | void AliAnalysisTaskParticleCorrelation::Terminate(Option_t */*option*/) | |
203 | { | |
204 | // Terminate analysis | |
6639984f | 205 | // Do some plots |
6639984f | 206 | |
a5cc4f03 | 207 | // Get merged histograms from the output container |
a5cc4f03 | 208 | // Propagate histagrams to maker |
1cd71065 | 209 | fAna->Terminate((TList*)GetOutputData(1)); |
a5cc4f03 | 210 | |
1c5acb87 | 211 | } |
212 |