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