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 AliAnaPartCorrBaseClass
24 // -- Author: Gustavo Conesa (INFN-LNF)
26 // --- ROOT system ---
29 //#include "Riostream.h"
31 //---- AliRoot system ----
32 #include "AliAnaPartCorrBaseClass.h"
33 #include "AliAnaPartCorrMaker.h"
34 #include "AliCaloTrackReader.h"
38 ClassImp(AliAnaPartCorrMaker)
41 //____________________________________________________________________________
42 AliAnaPartCorrMaker::AliAnaPartCorrMaker() :
44 fOutputContainer(new TList ), fAnalysisContainer(new TList ),
45 fMakeHisto(0), fMakeAOD(0), fAnaDebug(0),
46 fReader(0x0), fAODBranchList(new TList )
49 if(fAnaDebug > 1 ) printf("*** Analysis Maker Constructor *** \n");
51 //Initialize parameters, pointers and histograms
53 fReader = new AliCaloTrackReader();
58 //____________________________________________________________________________
59 AliAnaPartCorrMaker::AliAnaPartCorrMaker(const AliAnaPartCorrMaker & g) :
61 fOutputContainer(g. fOutputContainer), fAnalysisContainer(g.fAnalysisContainer),
62 fMakeHisto(g.fMakeHisto), fMakeAOD(fMakeAOD), fAnaDebug(g. fAnaDebug),
63 fReader(g.fReader), fAODBranchList(g.fAODBranchList)
69 //_________________________________________________________________________
70 AliAnaPartCorrMaker & AliAnaPartCorrMaker::operator = (const AliAnaPartCorrMaker & 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 fReader = source.fReader ;
84 fAODBranchList = source.fAODBranchList;
90 //____________________________________________________________________________
91 AliAnaPartCorrMaker::~AliAnaPartCorrMaker()
93 // Remove all pointers.
95 // Protection added in case of NULL pointers (MG)
96 if (fOutputContainer) {
97 fOutputContainer->Clear();
98 delete fOutputContainer ;
101 if (fAnalysisContainer) {
102 fAnalysisContainer->Clear();
103 delete fAnalysisContainer ;
106 if (fReader) delete fReader ;
110 // for(Int_t iaod = 0; iaod < fAODBranchList->GetEntries(); iaod++)
111 // fAODBranchList->At(iaod)->Clear();
113 fAODBranchList->Clear();
114 delete fAODBranchList ;
119 //________________________________________________________________________
120 TList * AliAnaPartCorrMaker::GetAODBranchList()
123 // Get any new output AOD branches from analysis and put them in a list
124 // The list is filled in the maker, and new branch passed to the analysis frame
125 // AliAnalysisTaskPartCorr
127 for(Int_t iana = 0; iana < fAnalysisContainer->GetEntries(); iana++){
129 AliAnaPartCorrBaseClass * ana = ((AliAnaPartCorrBaseClass *) fAnalysisContainer->At(iana)) ;
130 if(ana->NewOutputAOD()) fAODBranchList->Add(ana->GetCreateOutputAODBranch());
133 return fAODBranchList ;
137 //________________________________________________________________________
138 void AliAnaPartCorrMaker::Init()
140 //Init container histograms and other common variables
142 if(!fAnalysisContainer || fAnalysisContainer->GetEntries()==0)
143 AliFatal("Analysis job list not initialized");
145 for(Int_t iana = 0; iana < fAnalysisContainer->GetEntries(); iana++){
147 AliAnaPartCorrBaseClass * ana = ((AliAnaPartCorrBaseClass *) fAnalysisContainer->At(iana)) ;
148 ana->SetReader(fReader); //SetReader for each analysis
151 if(fMakeHisto){// Analysis with histograms as output on
152 //Fill container with appropriate histograms
153 TList * templist = ana -> GetCreateOutputObjects();
154 for(Int_t i = 0; i < templist->GetEntries(); i++)
155 fOutputContainer->Add(templist->At(i)) ;
156 }// Analysis with histograms as output on
157 }//Loop on analysis defined
160 //____________________________________________________________________________
161 void AliAnaPartCorrMaker::InitParameters()
167 fAnaDebug = 0; // No debugging info displayed by default
171 //__________________________________________________________________
172 void AliAnaPartCorrMaker::Print(const Option_t * opt) const
175 //Print some relevant parameters set for the analysis
179 printf("***** Print: %s %s ******\n", GetName(), GetTitle() ) ;
180 printf("Debug level = %d\n", fAnaDebug) ;
181 printf("Produce Histo = %d\n", fMakeHisto) ;
182 printf("Produce AOD = %d\n", fMakeAOD) ;
187 //____________________________________________________________________________
188 Bool_t AliAnaPartCorrMaker::ProcessEvent(Int_t iEntry){
189 //Process analysis for this event
191 if(fMakeHisto && !fOutputContainer)
192 AliFatal("Histograms not initialized");
194 if(fAnaDebug >= 0 ) printf("*** Event %d *** \n",iEntry);
196 //Each event needs an empty branch
197 for(Int_t iaod = 0; iaod < fAODBranchList->GetEntries(); iaod++)
198 fAODBranchList->At(iaod)->Clear();
200 //Tell the reader to fill the data in the 3 detector lists
201 fReader->FillInputEvent();
203 //Loop on analysis algorithms
204 if(fAnaDebug > 0 ) printf("*** Begin analysis *** \n");
205 Int_t nana = fAnalysisContainer->GetEntries() ;
206 for(Int_t iana = 0; iana < nana; iana++){
208 AliAnaPartCorrBaseClass * ana = ((AliAnaPartCorrBaseClass *) fAnalysisContainer->At(iana)) ;
210 ana->ConnectInputOutputAODBranches(); //Sets branches for each analysis
212 //Make analysis, create aods in aod branch or AODCaloClusters
213 if(fMakeAOD) ana->MakeAnalysisFillAOD() ;
214 //Make further analysis with aod branch and fill histograms
215 if(fMakeHisto) ana->MakeAnalysisFillHistograms() ;
219 fReader->ResetLists();
221 if(fAnaDebug > 0 ) printf("*** End analysis *** \n");