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 // 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
23 // -- Author: Gustavo Conesa (INFN-LNF)
29 #include <TInterpreter.h>
30 //#include <Riostream.h>
33 #include "AliAnalysisTaskParticleCorrelation.h"
34 #include "AliAnaPartCorrMaker.h"
35 #include "AliCaloTrackReader.h"
37 #include "AliAnalysisManager.h"
39 ClassImp(AliAnalysisTaskParticleCorrelation)
41 ////////////////////////////////////////////////////////////////////////
42 AliAnalysisTaskParticleCorrelation::AliAnalysisTaskParticleCorrelation():
45 fOutputContainer(0x0),
48 // Default constructor
51 //_____________________________________________________
52 AliAnalysisTaskParticleCorrelation::AliAnalysisTaskParticleCorrelation(const char* name):
53 AliAnalysisTaskSE(name),
55 fOutputContainer(0x0),
58 // Default constructor
60 DefineOutput(1, TList::Class());
64 //_____________________________________________________
65 AliAnalysisTaskParticleCorrelation::~AliAnalysisTaskParticleCorrelation()
67 // Remove all pointers
70 fOutputContainer->Clear() ;
71 delete fOutputContainer ;
76 //_____________________________________________________
77 void AliAnalysisTaskParticleCorrelation::UserCreateOutputObjects()
79 // Create the output container
80 if (DebugLevel() > 1) printf("AliAnalysisTaskParticleCorrelation::UserCreateOutputObjects() - Begin\n");
82 //Get list of aod arrays, add each aod array to analysis frame
83 TClonesArray * array = 0;
84 TList * list = fAna->GetAODBranchList();
85 TString deltaAODName = (fAna->GetReader())->GetDeltaAODFileName();
86 for(Int_t iaod = 0; iaod < list->GetEntries(); iaod++){
87 array = (TClonesArray*) list->At(iaod);
88 if(deltaAODName!="") AddAODBranch("TClonesArray", &array, deltaAODName);//Put it in DeltaAOD file
89 else AddAODBranch("TClonesArray", &array);//Put it in standard AOD file
92 //Histograms container
94 fOutputContainer = fAna->GetOutputContainer();
95 fOutputContainer->SetOwner();
96 if (DebugLevel() > 1) printf("AliAnalysisTaskParticleCorrelation::UserCreateOutputObjects() - End\n");
98 PostData(1,fOutputContainer);
102 //_____________________________________________________
103 void AliAnalysisTaskParticleCorrelation::Init()
107 if (DebugLevel() > 1) printf("AliAnalysisTaskParticleCorrelation::Init() - Begin\n");
109 // Call configuration file if specified
111 if (fConfigName.Length()) {
112 printf("AliAnalysisTaskParticleCorrelation::Init() - ### Configuration file is %s.C ###\n", fConfigName.Data());
113 gROOT->LoadMacro(fConfigName+".C");
114 fAna = (AliAnaPartCorrMaker*) gInterpreter->ProcessLine("ConfigAnalysis()");
118 printf("AliAnalysisTaskParticleCorrelation::Init() - Analysis maker pointer not initialized, no analysis specified, STOP !\n");
122 // Add different generator particles to PDG Data Base
123 // to avoid problems when reading MC generator particles
124 AliPDG::AddParticlesToPdgDataBase();
126 // Initialise analysis
130 if((fAna->GetReader())->GetDeltaAODFileName()!="")
131 AliAnalysisManager::GetAnalysisManager()->RegisterExtraFile((fAna->GetReader())->GetDeltaAODFileName());
133 if (DebugLevel() > 1) printf("AliAnalysisTaskParticleCorrelation::Init() - End\n");
138 //_____________________________________________________
139 void AliAnalysisTaskParticleCorrelation::UserExec(Option_t */*option*/)
141 // Execute analysis for current event
143 if (DebugLevel() > 1) printf("AliAnalysisTaskParticleCorrelation::UserExec() - Begin\n");
145 //Get the type of data, check if type is correct
146 Int_t datatype = fAna->GetReader()->GetDataType();
147 if(datatype != AliCaloTrackReader::kESD && datatype != AliCaloTrackReader::kAOD &&
148 datatype != AliCaloTrackReader::kMC){
149 printf("AliAnalysisTaskParticleCorrelation::UserExec() - Wrong type of data\n");
153 fAna->GetReader()->SetInputOutputMCEvent(InputEvent(), AODEvent(), MCEvent());
156 fAna->ProcessEvent((Int_t) Entry(), CurrentFileName());
157 //printf("AliAnalysisTaskParticleCorrelation::Current Event %d; Current File Name : %s\n",(Int_t) Entry(), CurrentFileName());
158 if (DebugLevel() > 1) printf("AliAnalysisTaskParticleCorrelation::UserExec() - End\n");
160 PostData(1, fOutputContainer);
164 //_____________________________________________________
165 void AliAnalysisTaskParticleCorrelation::Terminate(Option_t */*option*/)
167 // Terminate analysis
170 // Get merged histograms from the output container
171 TList *outputList = (TList*)GetOutputData(1);
172 // Propagate histagrams to maker
173 fAna->Terminate(outputList);