]>
Commit | Line | Data |
---|---|---|
1c5acb87 | 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 | //_________________________________________________________________________ | |
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 | |
22 | // | |
23 | // -- Author: Gustavo Conesa (INFN-LNF) | |
24 | ||
268934f9 | 25 | #include <cstdlib> |
fbeaf916 | 26 | |
27 | // --- Root --- | |
1c5acb87 | 28 | #include <TROOT.h> |
1c5acb87 | 29 | #include <TInterpreter.h> |
1c5acb87 | 30 | //#include <Riostream.h> |
31 | ||
fbeaf916 | 32 | // --- Analysis --- |
1c5acb87 | 33 | #include "AliAnalysisTaskParticleCorrelation.h" |
1c5acb87 | 34 | #include "AliAnaPartCorrMaker.h" |
35 | #include "AliCaloTrackReader.h" | |
7175a03a | 36 | #include "AliPDG.h" |
1c5acb87 | 37 | |
38 | ClassImp(AliAnalysisTaskParticleCorrelation) | |
39 | ||
40 | //////////////////////////////////////////////////////////////////////// | |
fbeaf916 | 41 | AliAnalysisTaskParticleCorrelation::AliAnalysisTaskParticleCorrelation(): |
42 | AliAnalysisTaskSE(), | |
43 | fAna(0x0), | |
44 | fOutputContainer(0x0), | |
45 | fConfigName(0) | |
1c5acb87 | 46 | { |
47 | // Default constructor | |
48 | } | |
49 | ||
50 | //_____________________________________________________ | |
51 | AliAnalysisTaskParticleCorrelation::AliAnalysisTaskParticleCorrelation(const char* name): | |
477d6cee | 52 | AliAnalysisTaskSE(name), |
53 | fAna(0x0), | |
54 | fOutputContainer(0x0), | |
55 | fConfigName("") | |
1c5acb87 | 56 | { |
57 | // Default constructor | |
477d6cee | 58 | |
1c5acb87 | 59 | DefineOutput(1, TList::Class()); |
477d6cee | 60 | |
1c5acb87 | 61 | } |
62 | ||
63 | //_____________________________________________________ | |
64 | AliAnalysisTaskParticleCorrelation::~AliAnalysisTaskParticleCorrelation() | |
65 | { | |
66 | // Remove all pointers | |
477d6cee | 67 | |
1c5acb87 | 68 | if(fOutputContainer){ |
69 | fOutputContainer->Clear() ; | |
70 | delete fOutputContainer ; | |
71 | } | |
72 | ||
73 | } | |
74 | ||
75 | //_____________________________________________________ | |
76 | void AliAnalysisTaskParticleCorrelation::UserCreateOutputObjects() | |
77 | { | |
477d6cee | 78 | // Create the output container |
fbeaf916 | 79 | if (DebugLevel() > 1) printf("AliAnalysisTaskParticleCorrelation::UserCreateOutputObjects() - Begin\n"); |
477d6cee | 80 | |
81 | //Get list of aod arrays, add each aod array to analysis frame | |
82 | TClonesArray * array = 0; | |
83 | TList * list = fAna->GetAODBranchList(); | |
84 | for(Int_t iaod = 0; iaod < list->GetEntries(); iaod++){ | |
85 | array = (TClonesArray*) list->At(iaod); | |
86 | AddAODBranch("TClonesArray", &array); | |
87 | } | |
88 | ||
89 | //Histograms container | |
90 | OpenFile(1); | |
91 | fOutputContainer = fAna->GetOutputContainer(); | |
fbeaf916 | 92 | if (DebugLevel() > 1) printf("AliAnalysisTaskParticleCorrelation::UserCreateOutputObjects() - End\n"); |
1c5acb87 | 93 | } |
94 | ||
95 | //_____________________________________________________ | |
96 | void AliAnalysisTaskParticleCorrelation::Init() | |
97 | { | |
98 | // Initialization | |
fbeaf916 | 99 | |
100 | if (DebugLevel() > 1) printf("AliAnalysisTaskParticleCorrelation::Init() - Begin\n"); | |
477d6cee | 101 | |
102 | // Call configuration file if specified | |
103 | ||
104 | if (fConfigName.Length()) { | |
fbeaf916 | 105 | printf("AliAnalysisTaskParticleCorrelation::Init() - ### Configuration file is %s.C ###\n", fConfigName.Data()); |
477d6cee | 106 | gROOT->LoadMacro(fConfigName+".C"); |
107 | fAna = (AliAnaPartCorrMaker*) gInterpreter->ProcessLine("ConfigAnalysis()"); | |
1c5acb87 | 108 | } |
1c5acb87 | 109 | |
fbeaf916 | 110 | if(!fAna) { |
111 | printf("AliAnalysisTaskParticleCorrelation::Init() - Analysis maker pointer not initialized, no analysis specified, STOP!\n"); | |
112 | abort(); | |
477d6cee | 113 | } |
1c5acb87 | 114 | |
7175a03a | 115 | // Add different generator particles to PDG Data Base |
116 | // to avoid problems when reading MC generator particles | |
117 | AliPDG::AddParticlesToPdgDataBase(); | |
118 | ||
1c5acb87 | 119 | // Initialise analysis |
120 | fAna->Init(); | |
121 | ||
fbeaf916 | 122 | if (DebugLevel() > 1) printf("AliAnalysisTaskParticleCorrelation::Init() - End\n"); |
1c5acb87 | 123 | |
124 | } | |
125 | ||
126 | ||
127 | //_____________________________________________________ | |
128 | void AliAnalysisTaskParticleCorrelation::UserExec(Option_t */*option*/) | |
129 | { | |
130 | // Execute analysis for current event | |
131 | // | |
fbeaf916 | 132 | if (DebugLevel() > 1) printf("AliAnalysisTaskParticleCorrelation::UserExec() - Begin\n"); |
1c5acb87 | 133 | |
fbeaf916 | 134 | //Get the type of data, check if type is correct |
1c5acb87 | 135 | Int_t datatype = fAna->GetReader()->GetDataType(); |
136 | if(datatype != AliCaloTrackReader::kESD && datatype != AliCaloTrackReader::kAOD && | |
137 | datatype != AliCaloTrackReader::kMC){ | |
fbeaf916 | 138 | printf("AliAnalysisTaskParticleCorrelation::UserExec() - Wrong type of data\n"); |
1c5acb87 | 139 | return ; |
140 | } | |
fbeaf916 | 141 | |
477d6cee | 142 | fAna->GetReader()->SetInputOutputMCEvent(InputEvent(), AODEvent(), MCEvent()); |
1c5acb87 | 143 | |
144 | //Process event | |
145 | fAna->ProcessEvent((Int_t) Entry()); | |
146 | ||
fbeaf916 | 147 | if (DebugLevel() > 1) printf("AliAnalysisTaskParticleCorrelation::UserExec() - End\n"); |
477d6cee | 148 | |
1c5acb87 | 149 | PostData(1, fOutputContainer); |
150 | ||
151 | } | |
152 | ||
153 | //_____________________________________________________ | |
154 | void AliAnalysisTaskParticleCorrelation::Terminate(Option_t */*option*/) | |
155 | { | |
156 | // Terminate analysis | |
6639984f | 157 | // Do some plots |
6639984f | 158 | |
a5cc4f03 | 159 | // Get merged histograms from the output container |
160 | TList *outputList = (TList*)GetOutputData(1); | |
161 | // Propagate histagrams to maker | |
162 | fAna->Terminate(outputList); | |
163 | ||
1c5acb87 | 164 | } |
165 |