30 #include <unordered_map> 36 #include "AliEMCALTriggerPatchInfo.h" 46 AliAnalysisTaskEmcalTriggerSelection::AliAnalysisTaskEmcalTriggerSelection():
48 fTriggerDecisionContainer(
nullptr),
49 fGlobalDecisionContainerName(
"EmcalTriggerDecision"),
89 while((selection = dynamic_cast<AliEmcalTriggerSelection *>(selectionIter()))){
120 TString datasetstring(dataset);
121 datasetstring.ToLower();
122 if(datasetstring.Length() != 6)
return false;
123 if(datasetstring.Contains(
"lhc12")){
124 auto subperiod = datasetstring[5];
125 if(subperiod >
'b' && subperiod <
'j')
return true;
131 TString datasetstring(dataset);
132 datasetstring.ToLower();
133 if(datasetstring.Length() != 6)
return false;
134 if(datasetstring.Contains(
"lhc16") || datasetstring.Contains(
"lhc17") || datasetstring.Contains(
"lhc18")){
135 auto subperiod = datasetstring[5];
136 if(datasetstring.Contains(
"lhc16")){
137 if(subperiod >
'g' && subperiod <
'q')
return true;
139 if(datasetstring.Contains(
"lhc17")) {
140 if((subperiod >
'c' && subperiod <
'n') || (subperiod ==
'o') || (subperiod <
'r'))
return true;
142 if(datasetstring.Contains(
"lhc18")) {
151 std::vector<TString> supportedProductions = {
"lhc15h1",
"lhc15h2",
"lhc16a1",
"lhc16c2",
"lhc17g5a",
"lhc17g5"};
156 std::vector<TString> supportedProductions = {
"lhc17f8",
"lhc18f5"};
161 TString datasetstring(dataset);
162 datasetstring.ToLower();
164 for(
const auto &
prod : supportedProductions) {
165 if(datasetstring.Contains(
prod)) {
345 YAMLhandler configuration;
347 configuration.Initialize();
348 std::string namecontainer, acceptance, patchtype, energydef, energysource;
349 std::vector<std::string> triggerclasses;
350 configuration.GetProperty(
"containername", namecontainer);
351 configuration.GetProperty(
"energydef", energydef);
352 configuration.GetProperty(
"energysource", energysource);
353 configuration.GetProperty(
"triggerclasses", triggerclasses);
354 bool isOfflineSimple = energysource.find(
"Offline") != std::string::npos,
355 isRecalc = energysource.find(
"Recalc") != std::string::npos;
363 AliErrorStream() << e.
what() <<
" - not processing trigger classes" << std::endl;
366 for(
auto t : triggerclasses) {
368 configuration.GetProperty(Form(
"%s:acceptance", t.data()), acceptance);
369 configuration.GetProperty(Form(
"%s:patchtype", t.data()), patchtype);
370 configuration.GetProperty(Form(
"%s:threshold", t.data()), threshold);
377 AliErrorStream() << e.
what() <<
" - not adding trigger class " << t << std::endl;
391 std::unordered_map<std::string, AliEmcalTriggerSelectionCuts::AcceptanceType_t> mapacceptance = {
395 auto result = mapacceptance.find(acceptancestring);
396 if(result == mapacceptance.end())
throw ConfigValueException(
"accpetance", acceptancestring.data());
397 return result->second;
401 std::unordered_map<std::string, AliEmcalTriggerSelectionCuts::PatchType_t> mappatchtype = {
409 auto result = mappatchtype.find(patchtypestring);
410 if(result == mappatchtype.end())
throw ConfigValueException(
"accpetance", patchtypestring.data());
411 return result->second;
415 std::unordered_map<std::string, AliEmcalTriggerSelectionCuts::SelectionMethod_t> mapenergydef = {
421 auto result = mapenergydef.find(energydefstring);
422 if(result == mapenergydef.end())
throw ConfigValueException(
"accpetance", energydefstring.data());
423 return result->second;
429 stream <<
"Trigger classes: " << std::endl;
432 stream << *sel << std::endl;
440 fMaxPatchEnergySmeared(
nullptr)
445 TNamed(sel->GetName(),
""),
450 fMaxPatchADC =
new TH1D(Form(
"hMaxPatchADC%s", GetName()),
"Max. patch ADC", 1000, 0., 1000);
451 fMaxPatchEnergy =
new TH1D(Form(
"hMaxPatchEnergy%s", GetName()),
"Max. patch energy", 1000, 0., 100);
464 TNamed::operator=(ref);
493 std::stringstream msgbuilder;
494 msgbuilder <<
"Improper value for key " <<
fKey <<
": " <<
fValue;
Class for the selection of trigger patches in the EMCAL triggered event selection.
Object performing offline EMCAL trigger selection.
virtual Bool_t Run()
User event loop.
AliEmcalTriggerSelectionCuts::AcceptanceType_t DecodeAcceptanceString(const std::string &acceptancestring)
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 SetGlobalDecisionContainerName(const char *name)
Set the name of the global trigger decision container.
Bool_t Is2016PP(const char *dataset) const
void SetSelectionMethod(SelectionMethod_t selectionMethod)
Bool_t Is2012MCPP(const char *dataset) const
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.
TH1 * fMaxPatchADC
Histogram with patch ADC of the max patch.
virtual void UserCreateOutputObjects()
Initialization of output container.
void ConfigureMCPP2012()
Trigger configuration for MC anchored to run1 pp (2012)
Bool_t Is2012PP(const char *dataset) const
void InitQA(const AliEmcalTriggerSelection *const sel)
Initialize QA histograms for trigger selection.
Bool_t IsSupportedMCSample(const char *period, std::vector< TString > &supportedProductions) const
AliAnalysisTaskEmcalTriggerSelection()
Dummy constructor.
void SetUseSimpleOfflinePatches(Bool_t doUse=kTRUE)
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)
const TList * GetListOfTriggerDecisions() const
Get container with trigger decision results.
void SetThreshold(Double_t threshold)
void Fill(const AliEmcalTriggerDecision *const decision)
void PrintStream(std::ostream &stream) const
Print information about the trigger decision container to the output stream.
std::string fKey
Key for which an unknown value was assigned.
AliEmcalTriggerSelectionQA & operator=(const AliEmcalTriggerSelectionQA &ref)
Assignment operator.
TList fSelectionQA
Trigger selection QA.
void GetHistos(TList *targetlist) const
Fill histograms of this QA component into the targetlist.
AliEmcalTriggerSelectionCuts::SelectionMethod_t DecodeEnergyDefinition(const std::string &energydefstring)
std::string fMessage
Error message shown in what()
const char * what() const
Display error message.
Namespace for PWG framework classes.
void Reset()
Clear container with trigger decisions.
Container for trigger decision object.
TH1 * fMaxPatchEnergy
Histogram with patch energy of the max patch.
TH1 * fMaxPatchEnergySmeared
Histogram with smeared patch energy of the max patch.
AliEmcalTriggerDecision * MakeDecison(const TClonesArray *const reconstructedPatches) const
ConfigValueException(const char *key, const char *value)
Construct a new ConfigValueException object.
AliEmcalList * fOutput
!output list
TList fTriggerSelections
List of trigger selections.
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 ConfigureFromYAML(const char *yamlconfig)
Configure task using YAML configuration file.
void ConfigureMCPP2016()
Trigger configuration for MC anchored to run2 pp (2016-2018)
Helper class for the trigger selection.
AliEmcalTriggerSelectionCuts::PatchType_t DecodePatchTypeString(const std::string &patchtypestring)
AliEmcalTriggerSelectionQA()
Dummy constructor.
AliEmcalTriggerDecisionContainer * fTriggerDecisionContainer
Trigger decision container objects.
Handling of incorrect values in YAML configuration files.
void UserCreateOutputObjects()
Main initialization function on the worker.
friend std::ostream & operator<<(std::ostream &stream, const AliAnalysisTaskEmcalTriggerSelection &task)
Output stream operator.
void AddTriggerSelection(AliEmcalTriggerSelection *const selection)
Add trigger selection to the trigger selection task.
std::string fValue
Improper value raising the exception.
TString prod[]
productions to be compared, directory name
void AddTriggerDecision(AliEmcalTriggerDecision *const decision)
Add trigger decision to the container.
Bool_t Is2016MCPP(const char *dataset) const
void SetPatchType(PatchType_t patchType)
void SetUseRecalcPatches(Bool_t doUse=kTRUE)