]>
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 | ||
25 | ||
26 | // root | |
27 | #include <TROOT.h> | |
28 | #include <TSystem.h> | |
29 | #include <TInterpreter.h> | |
30 | #include <TChain.h> | |
31 | #include <TFile.h> | |
32 | //#include <Riostream.h> | |
33 | ||
34 | // analysis | |
35 | #include "AliAnalysisTaskParticleCorrelation.h" | |
36 | #include "AliAnalysisManager.h" | |
37 | #include "AliESDInputHandler.h" | |
38 | #include "AliMCEventHandler.h" | |
39 | #include "AliMCEvent.h" | |
40 | #include "AliAnaPartCorrMaker.h" | |
41 | #include "AliCaloTrackReader.h" | |
42 | #include "AliESDEvent.h" | |
43 | #include "AliAODEvent.h" | |
44 | #include "AliAODHandler.h" | |
45 | #include "AliStack.h" | |
46 | #include "AliLog.h" | |
7175a03a | 47 | #include "AliPDG.h" |
1c5acb87 | 48 | |
49 | ClassImp(AliAnalysisTaskParticleCorrelation) | |
50 | ||
51 | //////////////////////////////////////////////////////////////////////// | |
52 | ||
53 | AliAnalysisTaskParticleCorrelation::AliAnalysisTaskParticleCorrelation(): | |
54 | AliAnalysisTaskSE(), | |
55 | fAna(0x0), | |
56 | fOutputContainer(0x0), | |
57 | //fAODBranch(0x0), | |
58 | fConfigName(0) | |
59 | { | |
60 | // Default constructor | |
61 | } | |
62 | ||
63 | //_____________________________________________________ | |
64 | AliAnalysisTaskParticleCorrelation::AliAnalysisTaskParticleCorrelation(const char* name): | |
65 | AliAnalysisTaskSE(name), | |
66 | fAna(0x0), | |
67 | fOutputContainer(0x0), | |
68 | // fAODBranch(0x0), | |
69 | fConfigName("ConfigAnalysis") | |
70 | { | |
71 | // Default constructor | |
72 | ||
73 | DefineOutput(1, TList::Class()); | |
74 | ||
75 | } | |
76 | ||
77 | //_____________________________________________________ | |
78 | AliAnalysisTaskParticleCorrelation::~AliAnalysisTaskParticleCorrelation() | |
79 | { | |
80 | // Remove all pointers | |
81 | ||
82 | if(fOutputContainer){ | |
83 | fOutputContainer->Clear() ; | |
84 | delete fOutputContainer ; | |
85 | } | |
86 | ||
87 | } | |
88 | ||
89 | //_____________________________________________________ | |
90 | void AliAnalysisTaskParticleCorrelation::UserCreateOutputObjects() | |
91 | { | |
92 | // Create the output container | |
93 | if (fDebug > 1) printf("AnalysisTaskParticleCorrelation::CreateOutputData() \n"); | |
94 | ||
95 | ||
96 | // TClonesArray * aodBranch = new TClonesArray(fAna->GetAODBranchClassName(), 0); | |
97 | // aodBranch->SetName(fAna->GetAODBranchName()); | |
98 | // AddAODBranch("TClonesArray", &aodBranch); | |
99 | // fAna->SetAODBranch(aodBranch); | |
100 | ||
101 | //Get list of aod arrays, add each aod array to analysis frame | |
102 | TClonesArray * array = 0; | |
103 | TList * list = fAna->GetAODBranchList(); | |
104 | for(Int_t iaod = 0; iaod < list->GetEntries(); iaod++){ | |
105 | array = (TClonesArray*) list->At(iaod); | |
106 | AddAODBranch("TClonesArray", &array); | |
107 | } | |
108 | ||
109 | //Histograms container | |
110 | OpenFile(1); | |
111 | fOutputContainer = fAna->GetOutputContainer(); | |
112 | ||
113 | } | |
114 | ||
115 | //_____________________________________________________ | |
116 | void AliAnalysisTaskParticleCorrelation::Init() | |
117 | { | |
118 | // Initialization | |
119 | if (fDebug > 1) printf("AnalysisTaskParticleCorrelation::Init() \n"); | |
120 | ||
121 | // Call configuration file | |
122 | ||
123 | if(fConfigName == ""){ | |
124 | fConfigName="ConfigAnalysis"; | |
125 | } | |
126 | ||
127 | AliInfo(Form("### Configuration file is %s.C ###", fConfigName.Data())); | |
128 | gROOT->LoadMacro(fConfigName+".C"); | |
129 | fAna = (AliAnaPartCorrMaker*) gInterpreter->ProcessLine("ConfigAnalysis()"); | |
130 | ||
131 | if(!fAna) | |
132 | AliFatal("Analysis pointer not initialized, abort analysis!"); | |
133 | ||
7175a03a | 134 | // Add different generator particles to PDG Data Base |
135 | // to avoid problems when reading MC generator particles | |
136 | AliPDG::AddParticlesToPdgDataBase(); | |
137 | ||
1c5acb87 | 138 | // Initialise analysis |
139 | fAna->Init(); | |
140 | ||
141 | AliDebug(1,"End"); | |
142 | ||
143 | } | |
144 | ||
145 | ||
146 | //_____________________________________________________ | |
147 | void AliAnalysisTaskParticleCorrelation::UserExec(Option_t */*option*/) | |
148 | { | |
149 | // Execute analysis for current event | |
150 | // | |
151 | if (fDebug > 1) printf("AnalysisTaskParticleCorrelation::Exec() \n"); | |
152 | ||
153 | //Get the type of data, check if type is correct | |
154 | Int_t datatype = fAna->GetReader()->GetDataType(); | |
155 | if(datatype != AliCaloTrackReader::kESD && datatype != AliCaloTrackReader::kAOD && | |
156 | datatype != AliCaloTrackReader::kMC){ | |
157 | AliFatal("Wrong type of data"); | |
158 | return ; | |
159 | } | |
160 | ||
161 | fAna->GetReader()->SetInputEvent(InputEvent(), AODEvent(), MCEvent()); | |
162 | ||
163 | //Process event | |
164 | fAna->ProcessEvent((Int_t) Entry()); | |
165 | ||
166 | PostData(1, fOutputContainer); | |
167 | ||
168 | } | |
169 | ||
170 | //_____________________________________________________ | |
171 | void AliAnalysisTaskParticleCorrelation::Terminate(Option_t */*option*/) | |
172 | { | |
173 | // Terminate analysis | |
6639984f | 174 | // Do some plots |
1c5acb87 | 175 | // |
6639984f | 176 | |
177 | fAna->Terminate(); | |
178 | ||
1c5acb87 | 179 | } |
180 |