20 #include <TClonesArray.h> 22 #include <TLorentzVector.h> 25 #include "AliEMCALTriggerConstants.h" 26 #include "AliEMCALTriggerPatchInfo.h" 29 #include "AliVEvent.h" 37 const TString AliEmcalTriggerOfflineSelection::fgkTriggerNames[AliEmcalTriggerOfflineSelection::kTrgn] = {
38 "EMC7",
"EG1",
"EG2",
"EJ1",
"EJ2",
"DMC7",
"DG1",
"DG2",
"DJ1",
"DJ2" 41 AliEmcalTriggerOfflineSelection::AliEmcalTriggerOfflineSelection():
43 fEnergyDefinition(kFEEEnergy),
44 fNameClusterContainer(),
46 fUseSmearedEnergy(false)
53 for(
int itrg = 0; itrg <
kTrgn; itrg++){
64 return ApplyPatchTrigger(trgcls, static_cast<TClonesArray *>(data->FindListObject(
"EmcalTriggers")));
68 AliDebugStream(1) <<
"Using patch trigger with energy definition " <<
fEnergyDefinition << std::endl;
71 AliEMCALTriggerPatchInfo *patch = NULL;
72 std::vector<double> patchefficiencies;
73 for(
auto patchIter : *triggerpatches){
74 patch =
static_cast<AliEMCALTriggerPatchInfo *
>(patchIter);
75 if(!patch->IsOfflineSimple())
continue;
76 if((isDCAL && !patch->IsDCalPHOS()) || (!isDCAL && patch->IsDCalPHOS()))
continue;
78 if(!patch->IsGammaLowSimple())
continue;
80 if(!patch->IsJetLowSimple())
continue;
82 AliDebugStream(1) <<
"Patch energy: " << patch->GetPatchE() <<
", smeared " << patch->GetSmearedEnergy() << std::endl;
87 AliDebugStream(1) <<
"Using smeared energy" << std::endl;
88 energy = patch->GetSmearedEnergy();
90 AliDebugStream (1) <<
"Using default energy" << std::endl;
91 energy = patch->GetPatchE();
96 TLorentzVector cm = patch->GetLorentzVectorCM();
97 cm.SetE(patch->GetSmearedEnergy());
100 energy = patch->GetPatchET();
112 AliDebugStream(1) <<
"Smearing energy with resolution " <<
fResolution << std::endl;
114 AliDebugStream(1) <<
"Thresholds: original(" <<
fOfflineEnergyThreshold[trgcls] <<
"), smeared(" << threshold <<
")" << std::endl;
116 if(energy > threshold){
124 double peff =
fAcceptanceMaps[trgcls]->GetBinContent(patch->GetColStart(), patch->GetRowStart());
125 patchefficiencies.push_back(peff);
126 AliDebugStream(2) <<
"Spatial Efficiency " << peff
127 <<
" for trigger patch at position (" << patch->GetColStart()
128 <<
"," << patch->GetRowStart() <<
")" << std::endl;
130 patchefficiencies.push_back(1.);
134 if(patchefficiencies.size()){
135 std::sort(patchefficiencies.begin(), patchefficiencies.end(), std::greater<double>());
136 double sample =
gRandom->Uniform(0., 1.);
137 if(sample < patchefficiencies[0]){
138 AliDebugStream(1) <<
"Event selected for trigger class " <<
GetTriggerName(trgcls) <<
", " << nfound <<
" good patch(es) found" << std::endl;
146 AliDebugStream(1) <<
"Applying cluster trigger with energy definition " <<
fEnergyDefinition << std::endl;
149 double vertex[3]; ev->GetPrimaryVertex()->GetXYZ(vertex);
150 for(
auto o : *clusters){
151 AliVCluster *
c =
dynamic_cast<AliVCluster *
>(o);
152 if(!c->IsEMCAL())
continue;
154 double energy = c->GetNonLinCorrEnergy();
157 c->GetMomentum(vec, vertex);
158 vec.SetE(c->GetNonLinCorrEnergy());
170 if(energy > threshold) ntrigger++;
Bool_t IsOfflineSelected(EmcalTriggerClass trgcls, const AliVEvent *const data) const
Select event as triggered event.
virtual ~AliEmcalTriggerOfflineSelection()
Destructor.
Cluster transverse energy.
DCAL L1 Gamma trigger, low threshold.
DCAL L1 Jet trigger, high threshold.
static const TString & GetTriggerName(EmcalTriggerClass cls)
Get the name of the trigger class as string representation.
Number of supported triggers.
Helper class selecting events on the presence of a trigger patch for the given type above threshold...
bool ApplyClusterTrigger(EmcalTriggerClass trgcls, const AliVEvent *const event) const
Run event selection using a EMCAL clusters.
EMCAL L1 Gamma trigger, high threshold.
DCAL L1 Jet trigger, low threshold.
Double_t fOfflineEnergyThreshold[kTrgn]
Thresholds applied on offline energy.
Bool_t fUseSmearedEnergy
Switch whether to use smeared or original energy.
EmcalTriggerClass
Definition of the various supported trigger types.
static Bool_t IsSingleShower(EmcalTriggerClass cls)
Checks if the trigger class is a single shower patch trigger class.
Double_t fResolution
Resolution for threshold smearing.
DCAL L1 Gamma trigger, high threshold.
FEE transverse converted to L1 transverse ADC.
EMCAL L1 Gamma trigger, low threshold.
TString fNameClusterContainer
Name of the cluster container.
bool UseClusters() const
Check whether the trigger observable is based on clusters.
FEE energy converted to L1 ADC.
Analysis of high- tracks in triggered events.
bool ApplyPatchTrigger(EmcalTriggerClass trgcls, const TClonesArray *const triggerpatches) const
Run event selection using trigger patches.
static Bool_t IsDCAL(EmcalTriggerClass cls)
Checks if the trigger class is a jet patch trigger class.
EmcalEnergyDefinition_t fEnergyDefinition
Define type of energy to be use for the patch selection.
const TH2 * fAcceptanceMaps[kTrgn]
! Online acceptance distribution
bool UsePatches() const
Check whether the trigger observable is based on trigger patches.