]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGJE/EMCALJetTasks/UserTasks/AliAnalysisTaskPtEMCalTriggerV1.cxx
- Remove unused variable
[u/mrichter/AliRoot.git] / PWGJE / EMCALJetTasks / UserTasks / AliAnalysisTaskPtEMCalTriggerV1.cxx
CommitLineData
4d1a3169 1/**************************************************************************
2 * Copyright(c) 1998-2014, 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/*
16 * Re-structured analysis task of the pt analysis on EMCal-triggered events:
17 * Analysis steps are moved to analysis components, which are grouped by a common
18 * event selection. The analysis task steers the event builder, runs each group,
19 * and collects the output of all groups.
20 *
21 * Author: Markus Fasel
22 */
23#include "AliJetContainer.h"
24#include "AliParticleContainer.h"
9de87858 25#include "AliEMCalTriggerBinningComponent.h"
5b1df951 26#include "AliEMCalTriggerBinningFactory.h"
4d1a3169 27#include "AliEMCalTriggerEventData.h"
28#include "AliEMCalTriggerTaskGroup.h"
29#include "AliAnalysisTaskPtEMCalTriggerV1.h"
30#include "AliVEvent.h"
31
32ClassImp(EMCalTriggerPtAnalysis::AliAnalysisTaskPtEMCalTriggerV1)
33
34namespace EMCalTriggerPtAnalysis {
35
36//______________________________________________________________________________
37AliAnalysisTaskPtEMCalTriggerV1::AliAnalysisTaskPtEMCalTriggerV1() :
38 AliAnalysisTaskEmcalJet(),
39 fTaskGroups(NULL),
9de87858 40 fBinning(NULL),
4d1a3169 41 fMCJetContainer(),
42 fDataJetContainer()
43{
44 /*
45 * Dummy constructor
46 */
47}
48
49//______________________________________________________________________________
50AliAnalysisTaskPtEMCalTriggerV1::AliAnalysisTaskPtEMCalTriggerV1(const char* name) :
51 AliAnalysisTaskEmcalJet(name, kTRUE),
52 fTaskGroups(NULL),
9de87858 53 fBinning(NULL),
4d1a3169 54 fMCJetContainer(),
55 fDataJetContainer()
56{
57 /*
58 * Main Constructor
59 */
60 fTaskGroups = new TObjArray;
61 fTaskGroups->SetOwner();
62 SetMakeGeneralHistograms(kTRUE);
63}
64
65//______________________________________________________________________________
66AliAnalysisTaskPtEMCalTriggerV1::~AliAnalysisTaskPtEMCalTriggerV1() {
67 /*
68 * Destructor
69 */
9de87858 70 delete fTaskGroups;
71 delete fBinning;
4d1a3169 72}
73
74//______________________________________________________________________________
75void AliAnalysisTaskPtEMCalTriggerV1::UserCreateOutputObjects() {
76 /*
77 * Initialise all analysis components
78 */
79 AliAnalysisTaskEmcal::UserCreateOutputObjects();
80
5b1df951 81 AliEMCalTriggerBinningFactory binmaker;
82 binmaker.Create(fBinning);
83
4d1a3169 84 TIter groupIter(fTaskGroups);
85 AliEMCalTriggerTaskGroup *mygroup(NULL);
86 TList *outputList = new TList;
87 outputList->SetName(Form("histos%s", GetName()));
88 while((mygroup = dynamic_cast<AliEMCalTriggerTaskGroup *>(groupIter()))){
9de87858 89 mygroup->SetGlobalBinning(fBinning);
4d1a3169 90 TList *ltmp = mygroup->InitialiseAnalysisComponents();
91 // Collect output list and append it to the global output list
92 TIter listIter(ltmp);
93 TObject *hist(NULL);
94 while((hist = listIter())) outputList->Add(hist);
95 }
96 fOutput->Add(outputList);
97 PostData(1, fOutput);
98
99}
100
101//______________________________________________________________________________
102Bool_t AliAnalysisTaskPtEMCalTriggerV1::Run() {
103 /*
104 * Run the analysis:
105 * 1st build the event data shared among the tasks
106 * 2nd loop over task groups and run them
107 */
108 AliEMCalTriggerEventData *event = BuildEvent();
109 TIter groupIter(fTaskGroups);
110 AliEMCalTriggerTaskGroup *mygroup(NULL);
111 while((mygroup = dynamic_cast<AliEMCalTriggerTaskGroup *>(groupIter())))
112 mygroup->Process(event);
113
114 delete event;
115
116 PostData(1, fOutput);
117 return kTRUE;
118}
119
9de87858 120//______________________________________________________________________________
121void AliAnalysisTaskPtEMCalTriggerV1::SetBinning(const char* dimname, int nbins, double* binning) {
122 /*
123 * Set binning for a give dimension
124 *
125 * @param dimname: name of the axis
126 * @param nbins: number of bins
127 * @param binning: the bin limits
128 */
129 fBinning->SetBinning(dimname, nbins, binning);
130}
131
5b1df951 132//______________________________________________________________________________
133void AliAnalysisTaskPtEMCalTriggerV1::SetBinning(const char* dimname, const TArrayD &binning) {
134 /*
135 * Set binning for a give dimension
136 *
137 * @param binning: the bin limits
138 */
139 fBinning->SetBinning(dimname, binning);
140}
141
4d1a3169 142//______________________________________________________________________________
143AliEMCalTriggerEventData* AliAnalysisTaskPtEMCalTriggerV1::BuildEvent() const {
144 /*
145 * Build event structure. Take the information about the different containers
146 * from the base analysis task.
147 *
148 * @return: the resulting event structure
149 */
150 AliEMCalTriggerEventData *eventstruct = new AliEMCalTriggerEventData;
151 eventstruct->SetRecEvent(fInputEvent);
152 eventstruct->SetMCEvent(fMCEvent);
153 eventstruct->SetTriggerPatchContainer(fTriggerPatchInfo);
154 eventstruct->SetClusterContainer(fCaloClusters);
155 eventstruct->SetTrackContainer(fTracks);
156 if(fMCJetContainer.Length()){
157 AliJetContainer *jcmc = dynamic_cast<AliJetContainer *>(fJetCollArray.FindObject(fMCJetContainer.Data()));
158 eventstruct->SetParticleContainer(jcmc->GetParticleContainer()->GetArray());
159 eventstruct->SetMCJetContainer(jcmc);
160 }
161 if(fDataJetContainer.Length()){
162 AliJetContainer *jcdat = dynamic_cast<AliJetContainer *>(fJetCollArray.FindObject(fDataJetContainer.Data()));
163 eventstruct->SetDataJetContainer(jcdat);
164 }
165 return eventstruct;
166}
167
168//______________________________________________________________________________
169void AliAnalysisTaskPtEMCalTriggerV1::AddAnalysisGroup(AliEMCalTriggerTaskGroup *taskGroup) {
170 /*
171 * Add group of analysis components to the task
172 *
173 * @param taskGroup: Group of analysis components
174 */
175 fTaskGroups->Add(taskGroup);
176}
177
178} /* namespace EMCalTriggerPtAnalysis */