1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
17 //_________________________________________________________________________
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
22 // analysis classes that derive from AliAnaBaseClass
24 // -- Author: Gustavo Conesa (INFN-LNF)
26 // --- ROOT system ---
27 #include <TClonesArray.h>
30 //---- AliRoot system ----
31 #include "AliAnaBaseClass.h"
32 #include "AliAnaMaker.h"
33 #include "AliCaloTrackReader.h"
40 //____________________________________________________________________________
41 AliAnaMaker::AliAnaMaker() :
43 fOutputContainer(new TList ), fAnalysisContainer(new TList ),
44 fMakeHisto(0), fMakeAOD(0), fAnaDebug(0),
45 fReader(0x0), fAODBranch(0x0), fAODBranchName("")
48 if(fAnaDebug > 1 ) printf("*** Analysis Maker Constructor *** \n");
50 //Initialize parameters, pointers and histograms
52 fReader = new AliCaloTrackReader();
57 //____________________________________________________________________________
58 AliAnaMaker::AliAnaMaker(const AliAnaMaker & g) :
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)
69 //_________________________________________________________________________
70 AliAnaMaker & AliAnaMaker::operator = (const AliAnaMaker & source)
72 // assignment operator
74 if(this == &source)return *this;
75 ((TObject *)this)->operator=(source);
77 fOutputContainer = source.fOutputContainer ;
78 fAnalysisContainer = source.fAnalysisContainer ;
79 fAnaDebug = source.fAnaDebug;
80 fMakeHisto = source.fMakeHisto;
81 fMakeAOD = source.fMakeAOD;
83 fAODBranchName = source.fAODBranchName;
84 fAODBranch = source.fAODBranch;
86 fReader = source.fReader ;
92 //____________________________________________________________________________
93 AliAnaMaker::~AliAnaMaker()
95 // Remove all pointers.
97 // Protection added in case of NULL pointers (MG)
98 if (fOutputContainer) {
99 fOutputContainer->Clear();
100 delete fOutputContainer ;
103 if (fAnalysisContainer) {
104 fAnalysisContainer->Clear();
105 delete fAnalysisContainer ;
108 if (fReader) delete fReader ;
117 //________________________________________________________________________
118 void AliAnaMaker::Init()
120 //Init container histograms and other common variables
122 if(fMakeHisto){// Analysis with histograms as output on
124 //Fill container with appropriate histograms
126 if(!fAnalysisContainer || fAnalysisContainer->GetEntries()==0)
127 AliFatal("Analysis job list not initailized");
129 for(Int_t iana = 0; iana < fAnalysisContainer->GetEntries(); iana++){
130 TList * templist = ((AliAnaBaseClass *) fAnalysisContainer->At(iana)) -> GetCreateOutputObjects();
132 for(Int_t i = 0; i < templist->GetEntries(); i++)
133 fOutputContainer->Add(templist->At(i)) ;
136 }// Analysis with histograms as output on
139 //____________________________________________________________________________
140 void AliAnaMaker::InitParameters()
146 fAnaDebug = 0; // No debugging info displayed by default
147 fAODBranchName = "Photons" ;
151 //__________________________________________________________________
152 void AliAnaMaker::Print(const Option_t * opt) const
155 //Print some relevant parameters set for the analysis
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) ;
168 //____________________________________________________________________________
169 Bool_t AliAnaMaker::ProcessEvent(Int_t iEntry){
170 //Process analysis for this event
172 if(fMakeHisto && !fOutputContainer)
173 AliFatal("Histograms not initialized");
175 if(fAnaDebug >= 0 ) printf("*** Event %d *** \n",iEntry);
177 //Each event needs an empty branch
180 //Tell the reader to fill the data in the 3 detector lists
181 fReader->FillInputEvent();
183 //Loop on analysis algorithms
184 if(fAnaDebug > 0 ) printf("*** Begin analysis *** \n");
185 Int_t nana = fAnalysisContainer->GetEntries() ;
186 for(Int_t iana = 0; iana < nana; iana++){
188 AliAnaBaseClass * ana = ((AliAnaBaseClass *) fAnalysisContainer->At(iana)) ;
190 //Set reader and aod branch for each analysis
191 ana->SetReader(fReader);
192 ana->SetAODBranch(fAODBranch);
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() ;
201 if(fAnaDebug > 0 ) printf("*** End analysis *** \n");
203 fReader->ResetLists();