AliPhysics  ff1d528 (ff1d528)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliAnalysisTaskEmcalTriggerJets.cxx
Go to the documentation of this file.
1 /************************************************************************************
2  * Copyright (C) 2017, Copyright Holders of the ALICE Collaboration *
3  * All rights reserved. *
4  * *
5  * Redistribution and use in source and binary forms, with or without *
6  * modification, are permitted provided that the following conditions are met: *
7  * * Redistributions of source code must retain the above copyright *
8  * notice, this list of conditions and the following disclaimer. *
9  * * Redistributions in binary form must reproduce the above copyright *
10  * notice, this list of conditions and the following disclaimer in the *
11  * documentation and/or other materials provided with the distribution. *
12  * * Neither the name of the <organization> nor the *
13  * names of its contributors may be used to endorse or promote products *
14  * derived from this software without specific prior written permission. *
15  * *
16  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND *
17  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED *
18  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
19  * DISCLAIMED. IN NO EVENT SHALL ALICE COLLABORATION BE LIABLE FOR ANY *
20  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES *
21  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; *
22  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND *
23  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
24  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
25  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
26  ************************************************************************************/
27 #include <THistManager.h>
28 #include <TMath.h>
29 #include <TString.h>
30 
31 #include "AliAnalysisManager.h"
32 #include "AliClusterContainer.h"
33 #include "AliEmcalJet.h"
34 #include "AliInputEventHandler.h"
35 #include "AliJetContainer.h"
36 #include "AliLog.h"
37 #include "AliTrackContainer.h"
39 #include "AliVEvent.h"
40 
41 #include <iostream>
42 
46 
47 namespace EmcalTriggerJets {
48 
49 AliAnalysisTaskEmcalTriggerJets::AliAnalysisTaskEmcalTriggerJets():
51  fHistos(nullptr)
52 {
53 
54 }
55 
57  AliAnalysisTaskEmcalJet(name, true),
58  fHistos(nullptr)
59 {
60 
61 }
62 
64  delete fHistos;
65 }
66 
69 
70  std::vector<TString> kEmcalTriggers = {"INT7", "EJ1", "EJ2", "DJ1", "DJ2"};
71  fHistos = new THistManager("EmcalJetHistos");
72  for(auto t : kEmcalTriggers){
73  fHistos->CreateTH1("hEventCount" + t, "Event counter for trigger " + t, 1., 0.5, 1.5);
74  fHistos->CreateTH1("hPtRawFullJetR02EMCAL" + t, "Raw pt spectrum for full jets with R=0.2 in EMCAL for trigger " + t, 200, 0., 200);
75  fHistos->CreateTH1("hPtRawFullJetR04EMCAL" + t, "Raw pt spectrum for full jets with R=0.4 in EMCAL for trigger " + t, 200, 0., 200);
76  fHistos->CreateTH1("hPtRawChargedJetR02EMCAL" + t, "Raw pt spectrum for charged jets with R=0.2 in EMCAL for trigger " + t, 200, 0., 200);
77  fHistos->CreateTH1("hPtRawChargedJetR04EMCAL" + t, "Raw pt spectrum for charged jets with R=0.4 in EMCAL for trigger " + t, 200, 0., 200);
78  fHistos->CreateTH1("hPtRawNeutralJetR02EMCAL" + t, "Raw pt spectrum for neutral jets with R=0.2 in EMCAL for trigger " + t, 200, 0., 200);
79  fHistos->CreateTH1("hPtRawNeutralJetR04EMCAL" + t, "Raw pt spectrum for neutral jets with R=0.4 in EMCAL for trigger " + t, 200, 0., 200);
80  fHistos->CreateTH1("hPtRawFullJetR02DCAL" + t, "Raw pt spectrum for full jets with R=0.2 in DCAL for trigger " + t, 200, 0., 200);
81  fHistos->CreateTH1("hPtRawFullJetR04DCAL" + t, "Raw pt spectrum for full jets with R=0.4 in DCAL for trigger " + t, 200, 0., 200);
82  fHistos->CreateTH1("hPtRawChargedJetR02DCAL" + t, "Raw pt spectrum for charged jets with R=0.2 in DCAL for trigger " + t, 200, 0., 200);
83  fHistos->CreateTH1("hPtRawChargedJetR04DCAL" + t, "Raw pt spectrum for charged jets with R=0.4 in DCAL for trigger " + t, 200, 0., 200);
84  fHistos->CreateTH1("hPtRawNeutralJetR02DCAL" + t, "Raw pt spectrum for neutral jets with R=0.2 in DCAL for trigger " + t, 200, 0., 200);
85  fHistos->CreateTH1("hPtRawNeutralJetR04DCAL" + t, "Raw pt spectrum for neutral jets with R=0.4 in DCAL for trigger " + t, 200, 0., 200);
86  }
87  for(auto h : *(fHistos->GetListOfHistograms())){
88  fOutput->Add(h);
89  }
90  PostData(1, fOutput);
91 }
92 
94  std::vector<TString> triggers, kEmcalTriggers = {"EJ1", "EJ2", "DJ1", "DJ2"};
95  if(fInputHandler->IsEventSelected() & AliVEvent::kINT7) triggers.push_back("INT7");
96  if(fInputHandler->IsEventSelected() & AliVEvent::kEMCEJE){
97  TString fired = fInputEvent->GetFiredTriggerClasses();
98  for(auto e : kEmcalTriggers){
99  if(fired.Contains(e)) triggers.push_back(e);
100  }
101  }
102  if(!triggers.size()) return false;
103 
104  for(auto t : triggers) fHistos->FillTH1("hEventCount" + t, 1);
105  std::vector<TString> jettypes = {"Full", "Charged", "Neutral"}, detectors = {"EMCAL", "DCAL"}, radii = {"R02", "R04"};
106  for(auto jt : jettypes) {
107  for(auto det : detectors){
108  for(auto r : radii) {
109  TString namejcont = jt + "Jets" + r + det,
110  histnamebase = "hPtRaw" + jt + "Jet" + r + det;
111  AliJetContainer *c = this->GetJetContainer(namejcont);
112  if(!c) AliErrorStream() << "Not found jet container " << namejcont << std::endl;
113  for(auto j : c->accepted()){
114  for(auto t : triggers) {
115  fHistos->FillTH1(histnamebase + t, TMath::Abs(j->Pt()));
116  }
117  }
118  }
119  }
120  }
121  return true;
122 }
123 
125  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
126 
128  mgr->AddTask(task);
129 
130  // Adding containers for clusters and tracks
131  AliClusterContainer *clustercont = task->AddClusterContainer("caloClusters");
132  clustercont->SetMinE(0.3);
133  AliTrackContainer *trackcont = task->AddTrackContainer("tracks");
134  trackcont->SetMinPt(0.15);
135 
136  // Adding Jet containers
137  // - Using jet radii 0.2 and 0.4
138  // - Splitting between EMCAL and DCAL side
139  // - processing full, charged and neutral jets
140 
141  // Full jets, R=0.2, EMCAL
142  AliJetContainer *cont = task->AddJetContainer(
146  0.2,
148  trackcont, clustercont
149  );
150  cont->SetName("FullJetsR02EMCAL");
151 
152  // Full jets, R=0.4, EMCAL
153  cont = task->AddJetContainer(
157  0.4,
159  trackcont, clustercont
160  );
161  cont->SetName("FullJetsR04EMCAL");
162 
163  // Full jets, R=0.2, DCAL
164  cont = task->AddJetContainer(
168  0.2,
170  trackcont, clustercont
171  );
172  cont->SetName("FullJetsR02DCAL");
173 
174  // Full jets, R=0.4, EMCAL
175  cont = task->AddJetContainer(
179  0.4,
181  trackcont, clustercont
182  );
183  cont->SetName("FullJetsR04DCAL");
184 
185 
186  // Charged jets, R=0.2, EMCAL
187  cont = task->AddJetContainer(
191  0.2,
193  trackcont, nullptr
194  );
195  cont->SetName("ChargedJetsR02EMCAL");
196 
197  // Charged jets, R=0.4, EMCAL
198  cont = task->AddJetContainer(
202  0.4,
204  trackcont, nullptr
205  );
206  cont->SetName("ChargedJetsR04EMCAL");
207 
208  // Charged jets, R=0.2, DCAL
209  cont = task->AddJetContainer(
213  0.2,
215  trackcont, nullptr
216  );
217  cont->SetName("ChargedJetsR02DCAL");
218 
219  // Charged jets, R=0.4, DCAL
220  cont = task->AddJetContainer(
224  0.4,
226  trackcont, nullptr
227  );
228  cont->SetName("ChargedJetsR04DCAL");
229 
230 
231  // Neutral jets, R=0.2, EMCAL
232  cont = task->AddJetContainer(
236  0.2,
238  nullptr, clustercont
239  );
240  cont->SetName("NeutralJetsR02EMCAL");
241 
242  // Neutral jets, R=0.4, EMCAL
243  cont = task->AddJetContainer(
247  0.4,
249  nullptr, clustercont
250  );
251  cont->SetName("NeutralJetsR04EMCAL");
252 
253  // Neutral jets, R=0.2, DCAL
254  cont = task->AddJetContainer(
258  0.2,
260  nullptr, clustercont
261  );
262  cont->SetName("NeutralJetsR02DCAL");
263 
264  // Neutral jets, R=0.4, DCAL
265  cont = task->AddJetContainer(
269  0.4,
271  nullptr, clustercont
272  );
273  cont->SetName("NeutralJetsR04DCAL");
274 
275  // Connect Input / Output containers
276  TString outfilename = mgr->GetCommonFileName();
277  outfilename += ":EmcalTriggerJets";
278  mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());
279  mgr->ConnectOutput(task, 1, mgr->CreateContainer("HistsEmcalTriggerJets", TList::Class(), AliAnalysisManager::kOutputContainer, outfilename));
280 
281  return task;
282 }
283 
284 } /* namespace EmcalTriggerJets */
AliJetContainer * GetJetContainer(Int_t i=0) const
Container with name, TClonesArray and cuts for particles.
TCanvas * c
Definition: TestFitELoss.C:172
AliJetContainer * AddJetContainer(const char *n, TString defaultCutType, Float_t jetRadius=0.4)
AliClusterContainer * AddClusterContainer(const char *n)
Create new cluster container and attach it to the task.
THashList * GetListOfHistograms() const
Get the list of histograms.
Definition: THistManager.h:671
TH1 * CreateTH1(const char *name, const char *title, int nbins, double xmin, double xmax, Option_t *opt="")
Create a new TH1 within the container.
void FillTH1(const char *hname, double x, double weight=1., Option_t *opt="")
Fill a 1D histogram within the container.
AliEmcalList * fOutput
!output list
ClassImp(AliAnalysisTaskCRC) AliAnalysisTaskCRC
AliTrackContainer * AddTrackContainer(const char *n)
Create new track container and attach it to the task.
Base task in the EMCAL jet framework.
Container class for histograms.
Definition: THistManager.h:99
void UserCreateOutputObjects()
Main initialization function on the worker.
DCal fiducial acceptance (each eta, phi edge narrowed by jet R)
Definition: AliEmcalJet.h:65
const AliJetIterableContainer accepted() const
Container structure for EMCAL clusters.
EMCal fiducial acceptance (each eta, phi edge narrowed by jet R)
Definition: AliEmcalJet.h:63
Container for jet within the EMCAL jet framework.
virtual bool Run()
Run function. This is the core function of the analysis and contains the user code. Therefore users have to implement this function.
static AliAnalysisTaskEmcalTriggerJets * AddTaskEmcalTriggerJets(const char *name)