]>
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 | **************************************************************************/ | |
1c5acb87 | 15 | |
16 | //_________________________________________________________________________ | |
17 | // Analysis task that executes the analysis classes | |
f15155ed | 18 | // that depend on the CaloTrackCorr frame, frame for Particle identification |
19 | // with calorimeters and tracks and correlations. | |
1c5acb87 | 20 | // Specially designed for calorimeters but also can be used for charged tracks |
f15155ed | 21 | // Input of this task is a configuration file that contains all the settings |
22 | // of the analysis | |
1c5acb87 | 23 | // |
f15155ed | 24 | // -- Author: Gustavo Conesa (INFN-LNF, LPSC-Grenoble) |
1c5acb87 | 25 | |
268934f9 | 26 | #include <cstdlib> |
fbeaf916 | 27 | |
28 | // --- Root --- | |
1c5acb87 | 29 | #include <TROOT.h> |
1c5acb87 | 30 | #include <TInterpreter.h> |
1cd71065 | 31 | #include <TClonesArray.h> |
1c5acb87 | 32 | //#include <Riostream.h> |
1cd71065 | 33 | //#include <TObjectTable.h> |
1c5acb87 | 34 | |
fbeaf916 | 35 | // --- Analysis --- |
f15155ed | 36 | #include "AliAnalysisTaskCaloTrackCorrelation.h" |
37 | #include "AliAnaCaloTrackCorrMaker.h" | |
1c5acb87 | 38 | #include "AliCaloTrackReader.h" |
7175a03a | 39 | #include "AliPDG.h" |
42dc8e7d | 40 | #include "AliAnalysisManager.h" |
66580b85 | 41 | #include "AliInputEventHandler.h" |
b759b1ee | 42 | #include "AliLog.h" |
1c5acb87 | 43 | |
f15155ed | 44 | ClassImp(AliAnalysisTaskCaloTrackCorrelation) |
1c5acb87 | 45 | |
f15155ed | 46 | //________________________________________________________________________ |
47 | AliAnalysisTaskCaloTrackCorrelation::AliAnalysisTaskCaloTrackCorrelation() : | |
fbeaf916 | 48 | AliAnalysisTaskSE(), |
49 | fAna(0x0), | |
50 | fOutputContainer(0x0), | |
f15155ed | 51 | fConfigName(""), |
52 | fCuts(0x0) | |
1c5acb87 | 53 | { |
54 | // Default constructor | |
55 | } | |
56 | ||
f15155ed | 57 | //________________________________________________________________________________________ |
58 | AliAnalysisTaskCaloTrackCorrelation::AliAnalysisTaskCaloTrackCorrelation(const char* name) : | |
477d6cee | 59 | AliAnalysisTaskSE(name), |
60 | fAna(0x0), | |
61 | fOutputContainer(0x0), | |
f15155ed | 62 | fConfigName(""), |
63 | fCuts(0x0) | |
1c5acb87 | 64 | { |
65 | // Default constructor | |
477d6cee | 66 | |
1c5acb87 | 67 | DefineOutput(1, TList::Class()); |
0c1383b5 | 68 | DefineOutput(2, TList::Class()); // will contain cuts or local params |
1c5acb87 | 69 | } |
70 | ||
f15155ed | 71 | //_________________________________________________________________________ |
72 | AliAnalysisTaskCaloTrackCorrelation::~AliAnalysisTaskCaloTrackCorrelation() | |
1c5acb87 | 73 | { |
74 | // Remove all pointers | |
f15155ed | 75 | |
90bb999a | 76 | if (AliAnalysisManager::GetAnalysisManager()->IsProofMode()) return; |
77 | ||
7e42e071 | 78 | if (fOutputContainer) |
accd903d | 79 | { |
7e42e071 | 80 | fOutputContainer->Clear() ; |
be9d1d38 | 81 | delete fOutputContainer ; |
82 | } | |
f15155ed | 83 | |
90bb999a | 84 | if (fAna) delete fAna; |
f15155ed | 85 | |
1c5acb87 | 86 | } |
87 | ||
f15155ed | 88 | //_________________________________________________________________ |
89 | void AliAnalysisTaskCaloTrackCorrelation::UserCreateOutputObjects() | |
1c5acb87 | 90 | { |
477d6cee | 91 | // Create the output container |
b759b1ee | 92 | AliDebug(1,"Begin"); |
477d6cee | 93 | |
7e42e071 | 94 | //Get list of aod arrays, add each aod array to analysis frame |
f37fa8d2 | 95 | TList * list = fAna->FillAndGetAODBranchList(); //Loop the analysis and create the list of branches |
accd903d | 96 | |
b759b1ee | 97 | AliDebug(1,Form("n AOD branches %d",list->GetEntries())); |
f37fa8d2 | 98 | |
99 | //Put the delta AODs in output file, std or delta | |
accd903d | 100 | if((fAna->GetReader())->WriteDeltaAODToFile()) |
101 | { | |
f37fa8d2 | 102 | TString deltaAODName = (fAna->GetReader())->GetDeltaAODFileName(); |
accd903d | 103 | for(Int_t iaod = 0; iaod < list->GetEntries(); iaod++) |
104 | { | |
105 | TClonesArray * array = (TClonesArray*) list->At(iaod); | |
f37fa8d2 | 106 | if(deltaAODName!="") AddAODBranch("TClonesArray", &array, deltaAODName);//Put it in DeltaAOD file |
107 | else AddAODBranch("TClonesArray", &array);//Put it in standard AOD file | |
7e42e071 | 108 | } |
109 | } | |
f37fa8d2 | 110 | |
477d6cee | 111 | //Histograms container |
112 | OpenFile(1); | |
113 | fOutputContainer = fAna->GetOutputContainer(); | |
f37fa8d2 | 114 | |
b759b1ee | 115 | AliDebug(1,Form("n histograms %d",fOutputContainer->GetEntries())); |
f15155ed | 116 | |
4a745797 | 117 | fOutputContainer->SetOwner(kTRUE); |
f37fa8d2 | 118 | |
b759b1ee | 119 | AliDebug(1,"End"); |
f15155ed | 120 | |
609de1b2 | 121 | PostData(1,fOutputContainer); |
f15155ed | 122 | |
1c5acb87 | 123 | } |
f15155ed | 124 | |
125 | //___________________________________________________ | |
126 | void AliAnalysisTaskCaloTrackCorrelation::LocalInit() | |
0c1383b5 | 127 | { |
7e42e071 | 128 | // Local Initialization |
129 | ||
130 | //Call the Init to initialize the configuration of the analysis | |
131 | Init(); | |
37c0bcde | 132 | |
0c1383b5 | 133 | } |
1c5acb87 | 134 | |
f15155ed | 135 | //______________________________________________ |
136 | void AliAnalysisTaskCaloTrackCorrelation::Init() | |
1c5acb87 | 137 | { |
138 | // Initialization | |
f15155ed | 139 | |
b759b1ee | 140 | AliDebug(1,"Begin"); |
141 | ||
142 | if( fDebug >= 0 ) | |
143 | (AliAnalysisManager::GetAnalysisManager())->AddClassDebug(this->ClassName(),fDebug); | |
477d6cee | 144 | |
145 | // Call configuration file if specified | |
146 | ||
7e42e071 | 147 | if (fConfigName.Length()) |
accd903d | 148 | { |
b759b1ee | 149 | AliInfo(Form("### Configuration file is %s.C ###", fConfigName.Data())); |
f15155ed | 150 | gROOT->LoadMacro(fConfigName+".C"); |
151 | fAna = (AliAnaCaloTrackCorrMaker*) gInterpreter->ProcessLine("ConfigAnalysis()"); | |
1c5acb87 | 152 | } |
1c5acb87 | 153 | |
7e42e071 | 154 | if(!fAna) |
155 | { | |
b759b1ee | 156 | AliFatal("Analysis maker pointer not initialized, no analysis specified, STOP!"); |
157 | return; // coverity | |
477d6cee | 158 | } |
1c5acb87 | 159 | |
7e42e071 | 160 | // Add different generator particles to PDG Data Base |
7175a03a | 161 | // to avoid problems when reading MC generator particles |
162 | AliPDG::AddParticlesToPdgDataBase(); | |
f15155ed | 163 | |
486258c9 | 164 | //Set in the reader the name of the task in case is needed |
165 | (fAna->GetReader())->SetTaskName(GetName()); | |
166 | ||
1c5acb87 | 167 | // Initialise analysis |
168 | fAna->Init(); | |
f15155ed | 169 | |
42dc8e7d | 170 | //Delta AOD |
171 | if((fAna->GetReader())->GetDeltaAODFileName()!="") | |
7e42e071 | 172 | AliAnalysisManager::GetAnalysisManager()->RegisterExtraFile((fAna->GetReader())->GetDeltaAODFileName()); |
173 | ||
174 | // Selected Trigger | |
175 | if(fAna->GetReader()->IsEventTriggerAtSEOn()) fAna->GetReader()->SetEventTriggerMask(GetCollisionCandidates()); | |
f15155ed | 176 | |
b759b1ee | 177 | AliDebug(1,"End"); |
1c5acb87 | 178 | |
179 | } | |
180 | ||
181 | ||
f15155ed | 182 | //______________________________________________________________________ |
183 | void AliAnalysisTaskCaloTrackCorrelation::UserExec(Option_t */*option*/) | |
1c5acb87 | 184 | { |
185 | // Execute analysis for current event | |
f15155ed | 186 | |
b759b1ee | 187 | AliDebug(1,"Begin"); |
f15155ed | 188 | |
189 | //Get the type of data, check if type is correct | |
1c5acb87 | 190 | Int_t datatype = fAna->GetReader()->GetDataType(); |
191 | if(datatype != AliCaloTrackReader::kESD && datatype != AliCaloTrackReader::kAOD && | |
accd903d | 192 | datatype != AliCaloTrackReader::kMC) |
193 | { | |
b759b1ee | 194 | AliError("Wrong type of data"); |
1c5acb87 | 195 | return ; |
196 | } | |
f15155ed | 197 | |
477d6cee | 198 | fAna->GetReader()->SetInputOutputMCEvent(InputEvent(), AODEvent(), MCEvent()); |
f15155ed | 199 | |
1c5acb87 | 200 | //Process event |
a79a2424 | 201 | fAna->ProcessEvent((Int_t) Entry(), CurrentFileName()); |
f15155ed | 202 | |
1c5acb87 | 203 | PostData(1, fOutputContainer); |
7e42e071 | 204 | |
b759b1ee | 205 | AliDebug(1,"End"); |
206 | ||
1cd71065 | 207 | //gObjectTable->Print(); |
1c5acb87 | 208 | |
209 | } | |
210 | ||
f15155ed | 211 | //_______________________________________________________________________ |
212 | void AliAnalysisTaskCaloTrackCorrelation::Terminate(Option_t */*option*/) | |
1c5acb87 | 213 | { |
214 | // Terminate analysis | |
6639984f | 215 | // Do some plots |
f15155ed | 216 | |
a5cc4f03 | 217 | // Get merged histograms from the output container |
a5cc4f03 | 218 | // Propagate histagrams to maker |
1cd71065 | 219 | fAna->Terminate((TList*)GetOutputData(1)); |
7e42e071 | 220 | |
accd903d | 221 | // Create cuts/param objects and publish to slot |
7e42e071 | 222 | fCuts = fAna->GetListOfAnalysisCuts(); |
223 | fCuts ->SetOwner(kTRUE); | |
224 | // Post Data | |
225 | PostData(2, fCuts); | |
accd903d | 226 | |
1c5acb87 | 227 | } |
228 | ||
f15155ed | 229 | //__________________________________________________________ |
230 | void AliAnalysisTaskCaloTrackCorrelation::FinishTaskOutput() | |
231 | { | |
66580b85 | 232 | // Put in the output some event summary histograms |
233 | AliAnalysisManager *am = AliAnalysisManager::GetAnalysisManager(); | |
f15155ed | 234 | |
66580b85 | 235 | AliInputEventHandler *inputH = dynamic_cast<AliInputEventHandler*>(am->GetInputEventHandler()); |
f15155ed | 236 | |
7e42e071 | 237 | if (!inputH) return; |
f15155ed | 238 | |
7e42e071 | 239 | TH2F *histStat = dynamic_cast<TH2F*>(inputH->GetStatistics()); |
66580b85 | 240 | TH2F *histBin0 = dynamic_cast<TH2F*>(inputH->GetStatistics("BIN0")); |
241 | ||
7e42e071 | 242 | if(histStat)fOutputContainer->Add(histStat); |
b759b1ee | 243 | else AliDebug(0,"Stat histogram not available check, \n if ESDs, that AliPhysicsSelection was on, \n if AODs, if EventStat_temp.root exists"); |
f15155ed | 244 | |
7e42e071 | 245 | if(histBin0)fOutputContainer->Add(histBin0); |
66580b85 | 246 | |
247 | } | |
248 |