19 #include <TClonesArray.h>
21 #include <TLorentzVector.h>
24 #include "AliEMCALTriggerConstants.h"
25 #include "AliEMCALTriggerPatchInfo.h"
28 #include "AliVEvent.h"
34 namespace EMCalTriggerPtAnalysis {
36 const TString AliEmcalTriggerOfflineSelection::fgkTriggerNames[AliEmcalTriggerOfflineSelection::kTrgn] = {
37 "EMC7",
"EG1",
"EG2",
"EJ1",
"EJ2",
"DMC7",
"DG1",
"DG2",
"DJ1",
"DJ2"
40 AliEmcalTriggerOfflineSelection::AliEmcalTriggerOfflineSelection():
42 fEnergyDefinition(kFEEEnergy),
43 fNameClusterContainer()
50 for(
int itrg = 0; itrg <
kTrgn; itrg++){
61 return ApplyPatchTrigger(trgcls, static_cast<TClonesArray *>(data->FindListObject(
"EmcalTriggers")));
67 AliEMCALTriggerPatchInfo *patch = NULL;
68 std::vector<double> patchefficiencies;
69 for(
auto patchIter : *triggerpatches){
70 patch =
static_cast<AliEMCALTriggerPatchInfo *
>(patchIter);
71 if(!patch->IsOfflineSimple())
continue;
72 if((isDCAL && !patch->IsDCalPHOS()) || (!isDCAL && patch->IsDCalPHOS()))
continue;
74 if(!patch->IsGammaLowSimple())
continue;
76 if(!patch->IsJetLowSimple())
continue;
92 double peff =
fAcceptanceMaps[trgcls]->GetBinContent(patch->GetColStart(), patch->GetRowStart());
93 patchefficiencies.push_back(peff);
94 AliDebugStream(2) <<
"Spatial Efficiency " << peff
95 <<
" for trigger patch at position (" << patch->GetColStart()
96 <<
"," << patch->GetRowStart() <<
")" << std::endl;
98 patchefficiencies.push_back(1.);
102 if(patchefficiencies.size()){
103 std::sort(patchefficiencies.begin(), patchefficiencies.end(), std::greater<double>());
104 double sample =
gRandom->Uniform(0., 1.);
105 if(sample < patchefficiencies[0]){
106 AliDebugStream(1) <<
"Event selected for trigger class " <<
GetTriggerName(trgcls) <<
", " << nfound <<
" good patch(es) found" << std::endl;
116 double vertex[3]; ev->GetPrimaryVertex()->GetXYZ(vertex);
117 for(
auto o : *clusters){
118 AliVCluster *
c =
dynamic_cast<AliVCluster *
>(o);
119 if(!c->IsEMCAL())
continue;
121 double energy = c->GetNonLinCorrEnergy();
124 c->GetMomentum(vec, vertex);
Bool_t IsOfflineSelected(EmcalTriggerClass trgcls, const AliVEvent *const data) const
virtual ~AliEmcalTriggerOfflineSelection()
Cluster transverse energy.
DCAL L1 Gamma trigger, low threshold.
DCAL L1 Jet trigger, high threshold.
static const TString & GetTriggerName(EmcalTriggerClass cls)
Number of supported triggers.
Helper class selecting events on the presence of a trigger patch for the given type above threshold...
EMCAL L1 Gamma trigger, high threshold.
DCAL L1 Jet trigger, low threshold.
Double_t fOfflineEnergyThreshold[kTrgn]
Thresholds applied on offline energy.
EmcalTriggerClass
Definition of the various supported trigger types.
static Bool_t IsSingleShower(EmcalTriggerClass cls)
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.
FEE energy converted to L1 ADC.
ClassImp(AliAnalysisTaskCRC) AliAnalysisTaskCRC
bool ApplyPatchTrigger(EmcalTriggerClass trgcls, const TClonesArray *const triggerpatches) const
static Bool_t IsDCAL(EmcalTriggerClass cls)
EmcalEnergyDefinition_t fEnergyDefinition
Define type of energy to be use for the patch selection.
const TH2 * fAcceptanceMaps[kTrgn]
! Online acceptance distribution
bool ApplyClusterTrigger(EmcalTriggerClass trgcls, const AliVEvent *const triggerpatches) const