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