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