]>
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), | |
46 | fConfigName(0) | |
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(); | |
fbeaf916 | 95 | if (DebugLevel() > 1) printf("AliAnalysisTaskParticleCorrelation::UserCreateOutputObjects() - End\n"); |
1c5acb87 | 96 | } |
97 | ||
98 | //_____________________________________________________ | |
99 | void AliAnalysisTaskParticleCorrelation::Init() | |
100 | { | |
101 | // Initialization | |
fbeaf916 | 102 | |
103 | if (DebugLevel() > 1) printf("AliAnalysisTaskParticleCorrelation::Init() - Begin\n"); | |
477d6cee | 104 | |
105 | // Call configuration file if specified | |
106 | ||
107 | if (fConfigName.Length()) { | |
fbeaf916 | 108 | printf("AliAnalysisTaskParticleCorrelation::Init() - ### Configuration file is %s.C ###\n", fConfigName.Data()); |
477d6cee | 109 | gROOT->LoadMacro(fConfigName+".C"); |
110 | fAna = (AliAnaPartCorrMaker*) gInterpreter->ProcessLine("ConfigAnalysis()"); | |
1c5acb87 | 111 | } |
1c5acb87 | 112 | |
fbeaf916 | 113 | if(!fAna) { |
114 | printf("AliAnalysisTaskParticleCorrelation::Init() - Analysis maker pointer not initialized, no analysis specified, STOP!\n"); | |
115 | abort(); | |
477d6cee | 116 | } |
1c5acb87 | 117 | |
7175a03a | 118 | // Add different generator particles to PDG Data Base |
119 | // to avoid problems when reading MC generator particles | |
120 | AliPDG::AddParticlesToPdgDataBase(); | |
121 | ||
1c5acb87 | 122 | // Initialise analysis |
123 | fAna->Init(); | |
42dc8e7d | 124 | |
125 | //Delta AOD | |
126 | if((fAna->GetReader())->GetDeltaAODFileName()!="") | |
127 | AliAnalysisManager::GetAnalysisManager()->RegisterExtraFile((fAna->GetReader())->GetDeltaAODFileName()); | |
128 | ||
fbeaf916 | 129 | if (DebugLevel() > 1) printf("AliAnalysisTaskParticleCorrelation::Init() - End\n"); |
1c5acb87 | 130 | |
131 | } | |
132 | ||
133 | ||
134 | //_____________________________________________________ | |
135 | void AliAnalysisTaskParticleCorrelation::UserExec(Option_t */*option*/) | |
136 | { | |
137 | // Execute analysis for current event | |
138 | // | |
fbeaf916 | 139 | if (DebugLevel() > 1) printf("AliAnalysisTaskParticleCorrelation::UserExec() - Begin\n"); |
1c5acb87 | 140 | |
fbeaf916 | 141 | //Get the type of data, check if type is correct |
1c5acb87 | 142 | Int_t datatype = fAna->GetReader()->GetDataType(); |
143 | if(datatype != AliCaloTrackReader::kESD && datatype != AliCaloTrackReader::kAOD && | |
144 | datatype != AliCaloTrackReader::kMC){ | |
fbeaf916 | 145 | printf("AliAnalysisTaskParticleCorrelation::UserExec() - Wrong type of data\n"); |
1c5acb87 | 146 | return ; |
147 | } | |
fbeaf916 | 148 | |
477d6cee | 149 | fAna->GetReader()->SetInputOutputMCEvent(InputEvent(), AODEvent(), MCEvent()); |
1c5acb87 | 150 | |
151 | //Process event | |
a79a2424 | 152 | fAna->ProcessEvent((Int_t) Entry(), CurrentFileName()); |
153 | //printf("AliAnalysisTaskParticleCorrelation::Current Event %d; Current File Name : %s\n",(Int_t) Entry(), CurrentFileName()); | |
fbeaf916 | 154 | if (DebugLevel() > 1) printf("AliAnalysisTaskParticleCorrelation::UserExec() - End\n"); |
477d6cee | 155 | |
1c5acb87 | 156 | PostData(1, fOutputContainer); |
157 | ||
158 | } | |
159 | ||
160 | //_____________________________________________________ | |
161 | void AliAnalysisTaskParticleCorrelation::Terminate(Option_t */*option*/) | |
162 | { | |
163 | // Terminate analysis | |
6639984f | 164 | // Do some plots |
6639984f | 165 | |
a5cc4f03 | 166 | // Get merged histograms from the output container |
167 | TList *outputList = (TList*)GetOutputData(1); | |
168 | // Propagate histagrams to maker | |
169 | fAna->Terminate(outputList); | |
170 | ||
1c5acb87 | 171 | } |
172 |