AliPhysics  58f3d52 (58f3d52)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 <vector>
29 #include <TH1.h>
35 #include "AliEMCALTriggerPatchInfo.h"
36 
40 
41 namespace PWG {
42 namespace EMCAL {
43 
44 AliAnalysisTaskEmcalTriggerSelection::AliAnalysisTaskEmcalTriggerSelection():
46  fTriggerDecisionContainer(nullptr),
47  fGlobalDecisionContainerName("EmcalTriggerDecision"),
48  fTriggerSelections(),
49  fSelectionQA()
50 {
51  SetCaloTriggerPatchInfoName("EmcalTriggers");
52  fTriggerSelections.SetOwner(kTRUE);
53 }
54 
56  AliAnalysisTaskEmcal(name, kTRUE),
57  fTriggerDecisionContainer(nullptr),
58  fGlobalDecisionContainerName("EmcalTriggerDecision"),
59  fTriggerSelections(),
60  fSelectionQA()
61 {
62  SetCaloTriggerPatchInfoName("EmcalTriggers");
64  fTriggerSelections.SetOwner(kTRUE);
65 }
66 
69 
70  for(auto s : fTriggerSelections) InitQA(static_cast<AliEmcalTriggerSelection *>(s));
71  for(auto q : fSelectionQA) static_cast<AliEmcalTriggerSelectionQA *>(q)->GetHistos(fOutput);
72 }
73 
76  fInputEvent->AddObject(fTriggerDecisionContainer);
77 }
78 
80  fTriggerSelections.Add(selection);
81 }
82 
85  AliEmcalTriggerSelection *selection(NULL);
86  TIter selectionIter(&fTriggerSelections);
87  while((selection = dynamic_cast<AliEmcalTriggerSelection *>(selectionIter()))){
89  }
90  return kTRUE;
91 }
92 
95  return kTRUE;
96 }
97 
100  fSelectionQA.Add(qa);
101 }
102 
104  for(auto d : *(cont->GetListOfTriggerDecisions())) {
105  AliEmcalTriggerDecision *myd = static_cast<AliEmcalTriggerDecision *>(d);
106  static_cast<AliEmcalTriggerSelectionQA *>(fSelectionQA.FindObject(myd->GetName()))->Fill(myd);
107  }
108 }
109 
111  std::vector<TString> pp2016periods = {"LHC16h", "LHC16i", "LHC16j", "LHC16k", "LHC16l", "LHC16o", "LHC16p"};
112  std::vector<TString> mcpp2016periods = {"LHC17f8", "LHC17f8a", "LHC17f8b", "LHC178c", "LHC17f8d", "LHC17f8e",
113  "LHC17f8f", "LHC17f8g", "LHC17f8h", "LHC17f8i", "LHC17f8j", "LHC17f8k"};
114  TString periodstring(period);
115  if(std::find(pp2016periods.begin(), pp2016periods.end(), periodstring) != pp2016periods.end()) ConfigurePP2016();
116  if(std::find(mcpp2016periods.begin(), mcpp2016periods.end(), periodstring) != mcpp2016periods.end()) ConfigureMCPP2016();
117 }
118 
124  eg1cuts->SetUseRecalcPatches(true);
125  eg1cuts->SetThreshold(115);
126  this->AddTriggerSelection(new AliEmcalTriggerSelection("EG1", eg1cuts));
127 
132  eg2cuts->SetUseRecalcPatches(true);
133  eg2cuts->SetUseSimpleOfflinePatches(true);
134  eg2cuts->SetThreshold(51);
135  this->AddTriggerSelection(new AliEmcalTriggerSelection("EG2", eg2cuts));
136 
141  dg1cuts->SetUseRecalcPatches(true);
142  dg1cuts->SetThreshold(115);
143  this->AddTriggerSelection(new AliEmcalTriggerSelection("DG1", dg1cuts));
144 
149  dg2cuts->SetUseRecalcPatches(true);
150  dg2cuts->SetThreshold(51);
151  this->AddTriggerSelection(new AliEmcalTriggerSelection("DG2", dg2cuts));
152 
157  ej1cuts->SetUseRecalcPatches(true);
158  ej1cuts->SetThreshold(255);
159  this->AddTriggerSelection(new AliEmcalTriggerSelection("EJ1", ej1cuts));
160 
165  ej2cuts->SetUseRecalcPatches(true);
166  ej2cuts->SetThreshold(204);
167  this->AddTriggerSelection(new AliEmcalTriggerSelection("EJ2", ej2cuts));
168 
173  dj1cuts->SetUseRecalcPatches(true);
174  dj1cuts->SetThreshold(255);
175  this->AddTriggerSelection(new AliEmcalTriggerSelection("DJ1", dj1cuts));
176 
181  dj2cuts->SetUseRecalcPatches(true);
182  dj2cuts->SetThreshold(204);
183  this->AddTriggerSelection(new AliEmcalTriggerSelection("DJ2", dj2cuts));
184 
185 }
186 
192  eg1cuts->SetUseSimpleOfflinePatches(true);
193  eg1cuts->SetThreshold(9.);
194  this->AddTriggerSelection(new AliEmcalTriggerSelection("EG1", eg1cuts));
195 
200  eg2cuts->SetUseSimpleOfflinePatches(true);
201  eg2cuts->SetThreshold(4.);
202  this->AddTriggerSelection(new AliEmcalTriggerSelection("EG2", eg2cuts));
203 
208  dg1cuts->SetUseSimpleOfflinePatches(true);
209  dg1cuts->SetThreshold(9.);
210  this->AddTriggerSelection(new AliEmcalTriggerSelection("DG1", dg1cuts));
211 
216  dg2cuts->SetUseSimpleOfflinePatches(true);
217  dg2cuts->SetThreshold(4.);
218  this->AddTriggerSelection(new AliEmcalTriggerSelection("DG2", dg2cuts));
219 
224  ej1cuts->SetUseSimpleOfflinePatches(true);
225  ej1cuts->SetThreshold(9.);
226  this->AddTriggerSelection(new AliEmcalTriggerSelection("EJ1", ej1cuts));
227 
232  ej2cuts->SetUseSimpleOfflinePatches(true);
233  ej2cuts->SetThreshold(4.);
234  this->AddTriggerSelection(new AliEmcalTriggerSelection("EJ2", ej2cuts));
235 
240  dj1cuts->SetUseSimpleOfflinePatches(true);
241  dj1cuts->SetThreshold(20.);
242  this->AddTriggerSelection(new AliEmcalTriggerSelection("DJ1", dj1cuts));
243 
248  dj2cuts->SetUseSimpleOfflinePatches(true);
249  dj2cuts->SetThreshold(4.);
250  this->AddTriggerSelection(new AliEmcalTriggerSelection("DJ2", dj2cuts));
251 }
252 
254  TNamed(),
255  fMaxPatchADC(nullptr),
256  fMaxPatchEnergy(nullptr),
257  fMaxPatchEnergySmeared(nullptr)
258 {
259 }
260 
262  TNamed(sel->GetName(), ""),
263  fMaxPatchADC(nullptr),
264  fMaxPatchEnergy(nullptr),
265  fMaxPatchEnergySmeared(nullptr)
266 {
267  fMaxPatchADC = new TH1D(Form("hMaxPatchADC%s", GetName()), "Max. patch ADC", 1000, 0., 1000);
268  fMaxPatchEnergy = new TH1D(Form("hMaxPatchEnergy%s", GetName()), "Max. patch energy", 1000, 0., 100);
269  fMaxPatchEnergySmeared = new TH1D(Form("hMaxPatchEnergySmeared%s", GetName()), "Max. patch smeared energy", 1000, 0., 100);
270 }
271 
273  TNamed(ref),
274  fMaxPatchADC(ref.fMaxPatchADC),
275  fMaxPatchEnergy(ref.fMaxPatchEnergy),
276  fMaxPatchEnergySmeared(ref.fMaxPatchEnergySmeared)
277 {
278 }
279 
281  TNamed::operator=(ref);
282  if(this != &ref) {
283  fMaxPatchADC = ref.fMaxPatchADC;
284  fMaxPatchEnergy = ref.fMaxPatchEnergy;
285  fMaxPatchEnergySmeared = ref.fMaxPatchEnergySmeared;
286  }
287  return *this;
288 }
289 
291  if(decision->GetMainPatch()){
292  fMaxPatchADC->Fill(decision->GetMainPatch()->GetADCAmp());
293  fMaxPatchEnergy->Fill(decision->GetMainPatch()->GetPatchE());
294  fMaxPatchEnergySmeared->Fill(decision->GetMainPatch()->GetSmearedEnergy());
295  }
296 }
297 
299  targetlist->Add(fMaxPatchADC);
300  targetlist->Add(fMaxPatchEnergy);
301  targetlist->Add(fMaxPatchEnergySmeared);
302 
303 }
304 
305 }
306 }
Class for the selection of trigger patches in the EMCAL triggered event selection.
Object performing offline EMCAL trigger selection.
virtual Bool_t Run()
Run over all trigger selections, and append the selection to the global trigger selection container...
void ConfigurePP2016()
Configure the trigger selection task for pp anchored to 2016.
Container for trigger decision.
void MakeQA(const AliEmcalTriggerDecisionContainer *cont)
Fill QA histograms for the event.
virtual void UserExecOnce()
Initializing common output container for trigger decision.
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 InitQA(const AliEmcalTriggerSelection *const sel)
Initialize QA histograms for trigger selection.
void SetCaloTriggerPatchInfoName(const char *n)
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.
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()
Configure the trigger selection task for MC anchored to pp 2016.
void UserCreateOutputObjects()
Main initialization function on the worker.
bool Bool_t
Definition: External.C:53
void AddTriggerSelection(AliEmcalTriggerSelection *const selection)
void AddTriggerDecision(AliEmcalTriggerDecision *const decision)
Add trigger decision to the container.