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