]>
Commit | Line | Data |
---|---|---|
d92b41ad | 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 | /* History of cvs commits: | |
18 | * | |
19 | * $Log$ | |
20 | * | |
21 | * | |
22 | */ | |
23 | ||
24 | //_________________________________________________________________________ | |
25 | // Base class for particle (gamma, hadron) identification and correlation analysis | |
26 | // It is called by the task class AliAnalysisGammaTask and it connects the input | |
27 | // (ESD/AOD/MonteCarlo) | |
28 | // got with AliCaloTrackReader (produces TClonesArrays of TParticles), with the | |
29 | // analysis classes that derive from AliAnaBaseClass | |
30 | // | |
31 | //*-- Author: Gustavo Conesa (INFN-LNF) | |
32 | ||
33 | // --- ROOT system --- | |
34 | ||
35 | //#include <TParticle.h> | |
36 | //#include <TH2.h> | |
37 | ||
38 | //---- AliRoot system ---- | |
39 | #include "AliAnaBaseClass.h" | |
40 | #include "AliAnaMaker.h" | |
41 | #include "AliCaloTrackReader.h" | |
42 | // #include "AliAODCaloCluster.h" | |
43 | // #include "AliAODTrack.h" | |
44 | // #include "AliAODEvent.h" | |
45 | #include "Riostream.h" | |
46 | #include "AliLog.h" | |
47 | ||
48 | ClassImp(AliAnaMaker) | |
49 | ||
50 | ||
51 | //____________________________________________________________________________ | |
52 | AliAnaMaker::AliAnaMaker() : | |
53 | TObject(), | |
54 | fOutputContainer(new TList ), fAnalysisContainer(new TList ), | |
55 | fMakeHisto(0), fMakeAOD(0), fAnaDebug(0), | |
56 | fReader(0x0), fAODBranch(0x0), fAODBranchName("") | |
57 | { | |
58 | //Default Ctor | |
59 | if(fAnaDebug > 1 ) printf("*** Analysis Maker Constructor *** \n"); | |
60 | ||
61 | //Initialize parameters, pointers and histograms | |
62 | if(!fReader) | |
63 | fReader = new AliCaloTrackReader(); | |
64 | ||
65 | InitParameters(); | |
66 | } | |
67 | ||
68 | //____________________________________________________________________________ | |
69 | AliAnaMaker::AliAnaMaker(const AliAnaMaker & g) : | |
70 | TObject(), | |
71 | fOutputContainer(g. fOutputContainer), fAnalysisContainer(g.fAnalysisContainer), | |
72 | fMakeHisto(g.fMakeHisto), fMakeAOD(fMakeAOD), fAnaDebug(g. fAnaDebug), | |
73 | fReader(g.fReader), fAODBranch(g.fAODBranch), | |
74 | fAODBranchName(g.fAODBranchName) | |
75 | { | |
76 | // cpy ctor | |
77 | ||
78 | } | |
79 | ||
80 | //_________________________________________________________________________ | |
81 | AliAnaMaker & AliAnaMaker::operator = (const AliAnaMaker & source) | |
82 | { | |
83 | // assignment operator | |
84 | ||
85 | if(this == &source)return *this; | |
86 | ((TObject *)this)->operator=(source); | |
87 | ||
88 | fOutputContainer = source.fOutputContainer ; | |
89 | fAnalysisContainer = source.fAnalysisContainer ; | |
90 | fAnaDebug = source.fAnaDebug; | |
91 | fMakeHisto = source.fMakeHisto; | |
92 | fMakeAOD = source.fMakeAOD; | |
93 | ||
94 | fAODBranchName = source.fAODBranchName; | |
95 | fAODBranch = source.fAODBranch; | |
96 | ||
97 | fReader = source.fReader ; | |
98 | ||
99 | return *this; | |
100 | ||
101 | } | |
102 | ||
103 | //____________________________________________________________________________ | |
104 | AliAnaMaker::~AliAnaMaker() | |
105 | { | |
106 | // Remove all pointers. | |
107 | ||
108 | // Protection added in case of NULL pointers (MG) | |
109 | if (fOutputContainer) { | |
110 | fOutputContainer->Clear(); | |
111 | delete fOutputContainer ; | |
112 | } | |
113 | ||
114 | if (fAnalysisContainer) { | |
115 | fAnalysisContainer->Clear(); | |
116 | delete fAnalysisContainer ; | |
117 | } | |
118 | ||
119 | if (fReader) delete fReader ; | |
120 | ||
121 | if (fAODBranch) { | |
122 | fAODBranch->Clear(); | |
123 | delete fAODBranch ; | |
124 | } | |
125 | ||
126 | } | |
127 | ||
128 | //________________________________________________________________________ | |
129 | void AliAnaMaker::Init() | |
130 | { | |
131 | //Init container histograms and other common variables | |
132 | ||
133 | if(fMakeHisto){// Analysis with histograms as output on | |
134 | ||
135 | //Fill container with appropriate histograms | |
136 | ||
137 | if(!fAnalysisContainer || fAnalysisContainer->GetEntries()==0) | |
138 | AliFatal("Analysis job list not initailized"); | |
139 | ||
140 | for(Int_t iana = 0; iana < fAnalysisContainer->GetEntries(); iana++){ | |
141 | TList * templist = ((AliAnaBaseClass *) fAnalysisContainer->At(iana)) -> GetCreateOutputObjects(); | |
142 | ||
143 | for(Int_t i = 0; i < templist->GetEntries(); i++) | |
144 | fOutputContainer->Add(templist->At(i)) ; | |
145 | ||
146 | } | |
147 | }// Analysis with histograms as output on | |
148 | } | |
149 | ||
150 | //____________________________________________________________________________ | |
151 | void AliAnaMaker::InitParameters() | |
152 | { | |
153 | ||
154 | //Init data members | |
155 | fMakeHisto = kTRUE; | |
156 | fMakeAOD = kTRUE; | |
157 | fAnaDebug = 0; // No debugging info displayed by default | |
158 | fAODBranchName = "Photons" ; | |
159 | ||
160 | } | |
161 | ||
162 | //__________________________________________________________________ | |
163 | void AliAnaMaker::Print(const Option_t * opt) const | |
164 | { | |
165 | ||
166 | //Print some relevant parameters set for the analysis | |
167 | if(! opt) | |
168 | return; | |
169 | ||
170 | printf("***** Print: %s %s ******\n", GetName(), GetTitle() ) ; | |
171 | printf("Debug level = %d\n", fAnaDebug) ; | |
172 | printf("New AOD branch = %s\n", fAODBranchName.Data()) ; | |
173 | printf("Produce Histo = %d\n", fMakeHisto) ; | |
174 | printf("Produce AOD = %d\n", fMakeAOD) ; | |
175 | ||
176 | } | |
177 | ||
178 | ||
179 | //____________________________________________________________________________ | |
180 | Bool_t AliAnaMaker::ProcessEvent(Int_t iEntry){ | |
181 | //Process analysis for this event | |
182 | ||
183 | if(fMakeHisto && !fOutputContainer) | |
184 | AliFatal("Histograms not initialized"); | |
185 | ||
186 | if(fAnaDebug >= 0 ) printf("*** Event %d *** \n",iEntry); | |
187 | ||
188 | //Each event needs an empty branch | |
189 | fAODBranch->Delete(); | |
190 | ||
191 | //Tell the reader to fill the data in the 3 detector lists | |
192 | fReader->FillInputEvent(); | |
193 | ||
194 | //Loop on analysis algorithms | |
195 | Int_t nana = fAnalysisContainer->GetEntries() ; | |
196 | for(Int_t iana = 0; iana < nana; iana++){ | |
197 | ||
198 | AliAnaBaseClass * ana = ((AliAnaBaseClass *) fAnalysisContainer->At(iana)) ; | |
199 | ||
200 | //Set reader and aod branch for each analysis | |
201 | ana->SetReader(fReader); | |
202 | ana->SetAODBranch(fAODBranch); | |
203 | ||
204 | //Make analysis, create aods in aod branch or AODCaloClusters | |
205 | if(fMakeAOD) ana->MakeAnalysisFillAOD() ; | |
206 | //Make further analysis with aod branch and fill histograms | |
207 | if(fMakeHisto) ana->MakeAnalysisFillHistograms() ; | |
208 | ||
209 | } | |
210 | ||
211 | fReader->ResetLists(); | |
212 | ||
213 | return kTRUE ; | |
214 | ||
215 | } |