AliPhysics  64bcec2 (64bcec2)
AliAnalysisTaskEmcalTriggerSelection.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 <algorithm>
28 #include <TH1.h>
34 #include "AliEMCALTriggerPatchInfo.h"
35 
39 
40 namespace PWG {
41 namespace EMCAL {
42 
43 AliAnalysisTaskEmcalTriggerSelection::AliAnalysisTaskEmcalTriggerSelection():
45  fTriggerDecisionContainer(nullptr),
46  fGlobalDecisionContainerName("EmcalTriggerDecision"),
47  fTriggerSelections(),
48  fSelectionQA()
49 {
50  SetCaloTriggerPatchInfoName("EmcalTriggers");
51  fTriggerSelections.SetOwner(kTRUE);
52 }
53 
55  AliAnalysisTaskEmcal(name, kTRUE),
57  fGlobalDecisionContainerName("EmcalTriggerDecision"),
59  fSelectionQA()
60 {
61  SetCaloTriggerPatchInfoName("EmcalTriggers");
63  fTriggerSelections.SetOwner(kTRUE);
64 }
65 
68 
69  for(auto s : fTriggerSelections) InitQA(static_cast<AliEmcalTriggerSelection *>(s));
70  for(auto q : fSelectionQA) static_cast<AliEmcalTriggerSelectionQA *>(q)->GetHistos(fOutput);
71 }
72 
75  fInputEvent->AddObject(fTriggerDecisionContainer);
76 }
77 
79  fTriggerSelections.Add(selection);
80 }
81 
84  AliEmcalTriggerSelection *selection(NULL);
85  TIter selectionIter(&fTriggerSelections);
86  while((selection = dynamic_cast<AliEmcalTriggerSelection *>(selectionIter()))){
88  }
89  return kTRUE;
90 }
91 
94  return kTRUE;
95 }
96 
99  fSelectionQA.Add(qa);
100 }
101 
103  for(auto d : *(cont->GetListOfTriggerDecisions())) {
104  AliEmcalTriggerDecision *myd = static_cast<AliEmcalTriggerDecision *>(d);
105  static_cast<AliEmcalTriggerSelectionQA *>(fSelectionQA.FindObject(myd->GetName()))->Fill(myd);
106  }
107 }
108 
110  if(Is2012PP(period)) ConfigurePP2012();
111  if(Is2016PP(period)) ConfigurePP2016();
112  if(Is2012MCPP(period)) ConfigureMCPP2012();
113  if(Is2016MCPP(period)) ConfigureMCPP2016();
114 }
115 
117  TString datasetstring(dataset);
118  datasetstring.ToLower();
119  if(datasetstring.Length() != 6) return false; // not data period
120  if(datasetstring.Contains("lhc12")){
121  auto subperiod = datasetstring[5];
122  if(subperiod > 'b' && subperiod < 'j') return true;
123  }
124  return false;
125 }
126 
128  TString datasetstring(dataset);
129  datasetstring.ToLower();
130  if(datasetstring.Length() != 6) return false; // not data period
131  if(datasetstring.Contains("lhc16") || datasetstring.Contains("lhc17") || datasetstring.Contains("lhc18")){
132  auto subperiod = datasetstring[5];
133  if(datasetstring.Contains("lhc16")){
134  if(subperiod > 'g' && subperiod < 'q') return true;
135  }
136  if(datasetstring.Contains("lhc17")) {
137  if((subperiod > 'c' && subperiod < 'n') || (subperiod == 'o') || (subperiod < 'r')) return true;
138  }
139  if(datasetstring.Contains("lhc18")) {
140  // 2018 runs will follow when taken
141  return true;
142  }
143  }
144  return false;
145 }
146 
148  std::vector<TString> supportedProductions = {"lhc15h1", "lhc15h2", "lhc16a1", "lhc16c2", "lhc17g5a", "lhc17g5"};
149  return IsSupportedMCSample(dataset, supportedProductions);
150 }
151 
153  std::vector<TString> supportedProductions = {"lhc17f8"};
154  return IsSupportedMCSample(dataset, supportedProductions);
155 }
156 
157 Bool_t AliAnalysisTaskEmcalTriggerSelection::IsSupportedMCSample(const char *dataset, std::vector<TString> &supportedProductions) const{
158  TString datasetstring(dataset);
159  datasetstring.ToLower();
160  bool found(false);
161  for(const auto & prod : supportedProductions) {
162  if(datasetstring.Contains(prod)) {
163  found = true;
164  break;
165  }
166  }
167  return found;
168 }
169 
175  eg1cuts->SetUseRecalcPatches(true);
176  eg1cuts->SetThreshold(130);
177  this->AddTriggerSelection(new AliEmcalTriggerSelection("EGA", eg1cuts));
178 
183  ej1cuts->SetUseRecalcPatches(true);
184  ej1cuts->SetThreshold(200);
185  this->AddTriggerSelection(new AliEmcalTriggerSelection("EJE", ej1cuts));
186 }
187 
193  eg1cuts->SetUseSimpleOfflinePatches(true);
194  eg1cuts->SetThreshold(10.);
195  this->AddTriggerSelection(new AliEmcalTriggerSelection("EGA", eg1cuts));
196 
201  ej1cuts->SetUseSimpleOfflinePatches(true);
202  ej1cuts->SetThreshold(15.5);
203  this->AddTriggerSelection(new AliEmcalTriggerSelection("EJE", ej1cuts));
204 }
205 
211  eg1cuts->SetUseRecalcPatches(true);
212  eg1cuts->SetThreshold(115);
213  this->AddTriggerSelection(new AliEmcalTriggerSelection("EG1", eg1cuts));
214 
219  eg2cuts->SetUseRecalcPatches(true);
220  eg2cuts->SetUseSimpleOfflinePatches(true);
221  eg2cuts->SetThreshold(51);
222  this->AddTriggerSelection(new AliEmcalTriggerSelection("EG2", eg2cuts));
223 
228  dg1cuts->SetUseRecalcPatches(true);
229  dg1cuts->SetThreshold(115);
230  this->AddTriggerSelection(new AliEmcalTriggerSelection("DG1", dg1cuts));
231 
236  dg2cuts->SetUseRecalcPatches(true);
237  dg2cuts->SetThreshold(51);
238  this->AddTriggerSelection(new AliEmcalTriggerSelection("DG2", dg2cuts));
239 
244  ej1cuts->SetUseRecalcPatches(true);
245  ej1cuts->SetThreshold(255);
246  this->AddTriggerSelection(new AliEmcalTriggerSelection("EJ1", ej1cuts));
247 
252  ej2cuts->SetUseRecalcPatches(true);
253  ej2cuts->SetThreshold(204);
254  this->AddTriggerSelection(new AliEmcalTriggerSelection("EJ2", ej2cuts));
255 
260  dj1cuts->SetUseRecalcPatches(true);
261  dj1cuts->SetThreshold(255);
262  this->AddTriggerSelection(new AliEmcalTriggerSelection("DJ1", dj1cuts));
263 
268  dj2cuts->SetUseRecalcPatches(true);
269  dj2cuts->SetThreshold(204);
270  this->AddTriggerSelection(new AliEmcalTriggerSelection("DJ2", dj2cuts));
271 
272 }
273 
279  eg1cuts->SetUseSimpleOfflinePatches(true);
280  eg1cuts->SetThreshold(9.);
281  this->AddTriggerSelection(new AliEmcalTriggerSelection("EG1", eg1cuts));
282 
287  eg2cuts->SetUseSimpleOfflinePatches(true);
288  eg2cuts->SetThreshold(4.);
289  this->AddTriggerSelection(new AliEmcalTriggerSelection("EG2", eg2cuts));
290 
295  dg1cuts->SetUseSimpleOfflinePatches(true);
296  dg1cuts->SetThreshold(9.);
297  this->AddTriggerSelection(new AliEmcalTriggerSelection("DG1", dg1cuts));
298 
303  dg2cuts->SetUseSimpleOfflinePatches(true);
304  dg2cuts->SetThreshold(4.);
305  this->AddTriggerSelection(new AliEmcalTriggerSelection("DG2", dg2cuts));
306 
311  ej1cuts->SetUseSimpleOfflinePatches(true);
312  ej1cuts->SetThreshold(19.);
313  this->AddTriggerSelection(new AliEmcalTriggerSelection("EJ1", ej1cuts));
314 
319  ej2cuts->SetUseSimpleOfflinePatches(true);
320  ej2cuts->SetThreshold(14.);
321  this->AddTriggerSelection(new AliEmcalTriggerSelection("EJ2", ej2cuts));
322 
327  dj1cuts->SetUseSimpleOfflinePatches(true);
328  dj1cuts->SetThreshold(19.);
329  this->AddTriggerSelection(new AliEmcalTriggerSelection("DJ1", dj1cuts));
330 
335  dj2cuts->SetUseSimpleOfflinePatches(true);
336  dj2cuts->SetThreshold(14.);
337  this->AddTriggerSelection(new AliEmcalTriggerSelection("DJ2", dj2cuts));
338 }
339 
341  TNamed(),
342  fMaxPatchADC(nullptr),
343  fMaxPatchEnergy(nullptr),
344  fMaxPatchEnergySmeared(nullptr)
345 {
346 }
347 
349  TNamed(sel->GetName(), ""),
353 {
354  fMaxPatchADC = new TH1D(Form("hMaxPatchADC%s", GetName()), "Max. patch ADC", 1000, 0., 1000);
355  fMaxPatchEnergy = new TH1D(Form("hMaxPatchEnergy%s", GetName()), "Max. patch energy", 1000, 0., 100);
356  fMaxPatchEnergySmeared = new TH1D(Form("hMaxPatchEnergySmeared%s", GetName()), "Max. patch smeared energy", 1000, 0., 100);
357 }
358 
360  TNamed(ref),
364 {
365 }
366 
368  TNamed::operator=(ref);
369  if(this != &ref) {
373  }
374  return *this;
375 }
376 
378  if(decision->GetMainPatch()){
379  fMaxPatchADC->Fill(decision->GetMainPatch()->GetADCAmp());
380  fMaxPatchEnergy->Fill(decision->GetMainPatch()->GetPatchE());
381  fMaxPatchEnergySmeared->Fill(decision->GetMainPatch()->GetSmearedEnergy());
382  }
383 }
384 
386  targetlist->Add(fMaxPatchADC);
387  targetlist->Add(fMaxPatchEnergy);
388  targetlist->Add(fMaxPatchEnergySmeared);
389 
390 }
391 
392 }
393 }
Class for the selection of trigger patches in the EMCAL triggered event selection.
Object performing offline EMCAL trigger selection.
void ConfigurePP2016()
Trigger configuration for run2 pp (2016 - 2018) - data mode.
Container for trigger decision.
void MakeQA(const AliEmcalTriggerDecisionContainer *cont)
Fill QA histograms for the event.
virtual void UserExecOnce()
Initializations performed when the first event is created.
void SetSelectionMethod(SelectionMethod_t selectionMethod)
void AutoConfigure(const char *period)
Automatically configure trigger decision handler for different periods.
TString fGlobalDecisionContainerName
Name of the global trigger selection.
Base task in the EMCAL framework.
virtual Bool_t FillHistograms()
Filling basic QA Histograms of the trigger selection task.
void ConfigurePP2012()
Trigger configuration for run1 pp (2012) - data mode.
virtual void UserCreateOutputObjects()
Initialization of output container.
void ConfigureMCPP2012()
Trigger configuration for MC anchored to run1 pp (2012)
void InitQA(const AliEmcalTriggerSelection *const sel)
Initialize QA histograms for trigger selection.
Bool_t IsSupportedMCSample(const char *period, std::vector< TString > &supportedProductions) const
void SetCaloTriggerPatchInfoName(const char *n)
Namespace for EMCAL framework classes and task.
const AliEMCALTriggerPatchInfo * GetMainPatch() const
Get the highest energetic trigger patch of the event firing the trigger.
AliEmcalTriggerDecisionContainer * GetGlobalTriggerDecisionContainer() const
Find the main trigger container in the input event.
void GetHistos(Double_t lowLim, Double_t highLim, Dir *resp, Dir *data, TDirectory *out)
Definition: UnfoldMult.C:261
const TList * GetListOfTriggerDecisions() const
Get container with trigger decision results.
AliEmcalTriggerSelectionQA & operator=(const AliEmcalTriggerSelectionQA &ref)
Assignment operator.
Definition: External.C:212
void GetHistos(TList *targetlist) const
Fill histograms of this QA component into the targetlist.
Namespace for PWG framework classes.
void Reset()
Clear container with trigger decisions.
AliEmcalTriggerDecision * MakeDecison(const TClonesArray *const reconstructedPatches) const
AliEmcalList * fOutput
!output list
Task providing an event selection for EMCAL-triggered events based on the reconstructed EMCAL trigger...
void SetMakeGeneralHistograms(Bool_t g)
TClonesArray * fTriggerPatchInfo
!trigger patch info array
void SetAcceptanceType(AcceptanceType_t acceptance)
void ConfigureMCPP2016()
Trigger configuration for MC anchored to run2 pp (2016-2018)
void UserCreateOutputObjects()
Main initialization function on the worker.
bool Bool_t
Definition: External.C:53
void AddTriggerSelection(AliEmcalTriggerSelection *const selection)
Add trigger selection to the trigger selection task.
TString prod[]
productions to be compared, directory name
void AddTriggerDecision(AliEmcalTriggerDecision *const decision)
Add trigger decision to the container.