20 #include <TClonesArray.h>
22 #include <TLorentzVector.h>
25 #include "AliEMCALTriggerConstants.h"
29 #include "AliVEvent.h"
35 namespace EMCalTriggerPtAnalysis {
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;
72 std::vector<double> patchefficiencies;
73 for(
auto patchIter : *triggerpatches){
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->
GetSmearedETV1() << std::endl;
87 AliDebugStream(1) <<
"Using smeared energy" << std::endl;
90 AliDebugStream (1) <<
"Using default energy" << std::endl;
91 energy = patch->GetPatchE();
98 energy = patch->GetPatchET();
110 AliDebugStream(1) <<
"Smearing energy with resolution " <<
fResolution << std::endl;
112 AliDebugStream(1) <<
"Thresholds: original(" <<
fOfflineEnergyThreshold[trgcls] <<
"), smeared(" << threshold <<
")" << std::endl;
114 if(energy > threshold){
122 double peff =
fAcceptanceMaps[trgcls]->GetBinContent(patch->GetColStart(), patch->GetRowStart());
123 patchefficiencies.push_back(peff);
124 AliDebugStream(2) <<
"Spatial Efficiency " << peff
125 <<
" for trigger patch at position (" << patch->GetColStart()
126 <<
"," << patch->GetRowStart() <<
")" << std::endl;
128 patchefficiencies.push_back(1.);
132 if(patchefficiencies.size()){
133 std::sort(patchefficiencies.begin(), patchefficiencies.end(), std::greater<double>());
134 double sample =
gRandom->Uniform(0., 1.);
135 if(sample < patchefficiencies[0]){
136 AliDebugStream(1) <<
"Event selected for trigger class " <<
GetTriggerName(trgcls) <<
", " << nfound <<
" good patch(es) found" << std::endl;
144 AliDebugStream(1) <<
"Applying cluster trigger with energy definition " <<
fEnergyDefinition << std::endl;
147 double vertex[3]; ev->GetPrimaryVertex()->GetXYZ(vertex);
148 for(
auto o : *clusters){
149 AliVCluster *
c =
dynamic_cast<AliVCluster *
>(o);
150 if(!c->IsEMCAL())
continue;
152 double energy = c->GetNonLinCorrEnergy();
155 c->GetMomentum(vec, vertex);
156 vec.SetE(c->GetNonLinCorrEnergy());
168 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.
Temporary class handling.
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.
ClassImp(AliAnalysisTaskCRC) AliAnalysisTaskCRC
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
Double_t GetSmearedEnergyV1() const
bool UsePatches() const
Check whether the trigger observable is based on trigger patches.
Double_t GetSmearedETV1() const