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