|
ATLAS Offline Software
|
Go to the documentation of this file.
37 #ifndef XAOD_STANDALONE // For now metadata is Athena-only
63 if (
electrons.empty())
return StatusCode::SUCCESS;
65 if (ElectronsToRemove.find(
electron) != ElectronsToRemove.end()){
66 ATH_MSG_DEBUG(
"Removing electron from output collection (isLRT?) : ("<<
static_cast<int>(acc_isLRT(*
electron)) <<
")" );
72 ATH_MSG_DEBUG(
"Adding electron to output collection (isLRT?) : (" <<
static_cast<int>(acc_isLRT(*
electron)) <<
")" );
86 return StatusCode::SUCCESS;
95 if ( acc_lrtFilter.isAvailable(*idtrack) )
97 if (
static_cast<int>(acc_lrtFilter(*idtrack) ) ){
98 std::unique_ptr<xAOD::Electron> copyElectron = std::make_unique<xAOD::Electron>(*
electron);
103 copy->push_back( std::move(copyElectron) );
108 std::unique_ptr<xAOD::Electron> copyElectron = std::make_unique<xAOD::Electron>(*
electron);
111 copy->push_back( std::move(copyElectron) );
114 return StatusCode::SUCCESS;
122 return StatusCode::FAILURE;
126 auto outputCol = std::make_unique<xAOD::ElectronContainer>();
127 std::unique_ptr<xAOD::ElectronAuxContainer> outputAuxCol;
128 outputAuxCol = std::make_unique<xAOD::ElectronAuxContainer>();
129 outputCol->setStore(outputAuxCol.get());
132 if (
bool(
m_eleLRT) && !lrtelekey.empty() &&
evtStore()->contains<xAOD::ElectronContainer>(lrtelekey)){
136 if (
evtStore()->contains<xAOD::ElectronContainer>(
"StdWithLRTElectrons")) {
137 ATH_MSG_DEBUG(
"Merged prompt/LRT container already created in TStore");
139 ATH_MSG_DEBUG(
"Creating merged prompt/LRT container in TStore");
146 auto filtered_electrons = std::make_unique<xAOD::ElectronContainer>();
147 std::unique_ptr<xAOD::ElectronAuxContainer> filtered_electrons_aux = std::make_unique<xAOD::ElectronAuxContainer>();
148 filtered_electrons->setStore(filtered_electrons_aux.get());
152 std::set<const xAOD::Electron *> ElectronsToRemove;
168 }
else if (!lrtelekey.empty()) {
169 if(
evtStore()->contains<xAOD::ElectronContainer>(lrtelekey) ==
false &&
bool(
m_eleLRT) ==
true)
ATH_MSG_WARNING(
"prompt/LRT OR procedure attempted but " << lrtelekey <<
" not in ROOT file, check config!");
170 ATH_MSG_DEBUG(
"Not applying prompt/LRT electron OR procedure");
173 if (
m_isPHYSLITE && elekey.find(
"AnalysisElectrons")==std::string::npos){
174 ATH_MSG_ERROR(
"You are running on PHYSLITE derivation. Please change the Electrons container to 'AnalysisElectrons'");
175 return StatusCode::FAILURE;
179 if (
bool(
m_eleLRT) &&
evtStore()->contains<xAOD::ElectronContainer>(lrtelekey)){
186 if (containerToBeCopied !=
nullptr) {
198 copy = shallowcopy.first;
199 copyaux = shallowcopy.second;
204 ATH_MSG_DEBUG(
"Not retrieving electron collection, using existing one provided by user");
217 return StatusCode::SUCCESS;
227 dec_baseline(
input) =
false;
228 dec_selected(
input) = 0;
229 dec_signal(
input) =
false;
230 dec_isol(
input) =
false;
231 dec_isolHighPt(
input) =
false;
232 dec_passSignalID(
input) =
false;
233 dec_passChID(
input) =
false;
234 dec_ecisBDT(
input) = -999.;
241 ATH_MSG_DEBUG(
"No primary track particle for this electron. Skipping.");
242 return StatusCode::SUCCESS;
244 double primvertex_z =
pv ?
pv->z() : 0;
245 double el_z0 =
track->z0() +
track->vz() - primvertex_z;
246 dec_z0sinTheta(
input) = el_z0 * TMath::Sin(
input.p4().Theta());
252 float d0sigError = -99.;
253 ATH_MSG_WARNING(
"FillElectron : Exception catched from d0significance() calculation. Setting dummy decoration d0sig=" << d0sigError );
254 dec_d0sig(
input) = d0sigError;
258 if (
input.pt() < 4
e3 )
return StatusCode::SUCCESS;
259 if ( !
input.caloCluster() ) {
ATH_MSG_WARNING(
"FillElectron: no caloCluster found: " <<
input.caloCluster() );
return StatusCode::SUCCESS; }
265 unsigned char el_nPixHits(0), el_nSCTHits(0);
278 ATH_MSG_INFO(
"ELECTRON nPixHits: " <<
static_cast<int>(el_nPixHits));
279 ATH_MSG_INFO(
"ELECTRON nSCTHits: " <<
static_cast<int>(el_nSCTHits));
280 ATH_MSG_INFO(
"ELECTRON deadHVTools: " <<
static_cast<bool>(pass_deadHVTool));
283 if (!pass_deadHVTool)
return StatusCode::SUCCESS;
288 return StatusCode::FAILURE;
291 bool passBaseID =
false;
298 ATH_MSG_VERBOSE (
"DFCommonElectronsLHxxx variables are not found. Calculating the ID from LH tool..");
309 if (std::abs(
input.caloCluster()->etaBE(2)) >= etacut)
return StatusCode::SUCCESS;
312 if ( std::abs(
input.caloCluster()->etaBE(2) ) >1.37 && std::abs(
input.caloCluster()->etaBE(2) ) <1.52) {
313 return StatusCode::SUCCESS;
319 ATH_MSG_ERROR(
"FillElectron: EgammaCalibTool applyCorrection failed ");
322 ATH_MSG_ERROR(
"FillElectron: IsolationCorrectionTool applyCorrection failed");
326 if (
input.pt() < etcut)
return StatusCode::SUCCESS;
334 dec_baseline(
input) =
true;
335 dec_selected(
input) = 2;
351 dec_passChID(
input) =
true;
356 return StatusCode::SUCCESS;
362 if (!acc_baseline(
input))
return false;
364 dec_passSignalID(
input) =
false;
373 ATH_MSG_VERBOSE (
"DFCommonElectronsLHxxx variables are not found. Calculating the ID from LH tool..");
381 if (!acc_passSignalID(
input))
return false;
383 if (
input.p4().Perp2() <= etcut * etcut ||
input.p4().Perp2() == 0)
return false;
384 if ( etacut==DUMMYDEF ){
385 if(std::abs(
input.caloCluster()->etaBE(2)) >
m_eleEta )
return false;
387 else if ( std::abs(
input.caloCluster()->etaBE(2)) > etacut )
return false;
390 if ( std::abs(
input.caloCluster()->etaBE(2) ) >1.37 && std::abs(
input.caloCluster()->etaBE(2) ) <1.52) {
395 if (acc_d0sig(
input) != 0) {
396 if (d0sigcut > 0.0 && std::abs(acc_d0sig(
input)) > d0sigcut)
return false;
399 if (z0cut > 0.0 && std::abs(acc_z0sinTheta(
input)) > z0cut)
return false;
411 dec_signal(
input) =
true;
421 const bool triggerSF,
423 const std::string& trigExpr,
428 ATH_MSG_ERROR(
"No signal electron ID or trigger scale factors provided for the selected working point!");
433 std::string singleLepStr =
"singleLepton";
434 std::string diLepStr =
"diLepton";
435 std::string multiLepStr =
"multiLepton";
448 ATH_MSG_ERROR(
"Failed to retrieve signal electron reco SF");
451 ATH_MSG_VERBOSE(
"OutOfValidityRange found for signal electron reco SF");
470 ATH_MSG_VERBOSE(
"OutOfValidityRange found for signal electron id SF");
479 std::vector<std::string> trigMChains={};
480 std::string theExpr (
"");
481 if(trigExpr==singleLepStr) {
490 ATH_MSG_WARNING(
"Only single lepton trigger SFs are supported in GetSignalElecSF(). Use GetTriggerGlobalEfficiencySF() for dilepton or multilepton triggers!");
496 if(!acc_trigmatched(
el)){
497 ATH_MSG_DEBUG(
"Electron was not matched to trigger " << theExpr <<
" - scale factor does not apply (year " << this->
treatAsYear() <<
") Returning 1." );
500 if (trigExpr==multiLepStr || trigExpr==diLepStr) {
501 ATH_MSG_WARNING(
"The dilepton or multilepton trigger SFs are not supported in GetSignalElecSF(). Use GetTriggerGlobalEfficiencySF()!");
526 ATH_MSG_VERBOSE(
"OutOfValidityRange found for signal electron iso SF");
534 if ( ecidsSF || cidSF ) {
544 dec_sfChIDEff(
el) = chf_sf;
549 dec_effscalefact(
el) =
sf;
558 std::string single_str =
"SINGLE_E";
559 std::string single_str_2022 =
"2022_";
560 std::string dilep_str =
"DI_E";
561 std::string multi_str =
"MULTI_L";
564 if ( trigExpr.find(single_str) != std::string::npos || trigExpr.find(single_str_2022) != std::string::npos)
566 else if ( trigExpr.find(dilep_str) != std::string::npos )
567 ATH_MSG_ERROR(
"Use GetTriggerGlobalEfficiency for logical OR of lepton triggers");
568 else if ( trigExpr.find(multi_str) != std::string::npos )
569 ATH_MSG_ERROR(
"Use GetTriggerGlobalEfficiency for logical OR of lepton triggers");
571 ATH_MSG_ERROR(
"The trigger expression (" << trigExpr <<
") is not supported by the electron trigger SF!");
575 ATH_MSG_ERROR(
"Failed to retrieve signal electron trigger SF");
578 ATH_MSG_VERBOSE(
"OutOfValidityRange found for signal electron trigger SF");
590 std::string single_str =
"SINGLE_E";
591 std::string single_str_2022 =
"2022_";
592 std::string dilep_str =
"DI_E";
593 std::string multi_str =
"MULTI_L";
598 if ( trigExpr.find(single_str) != std::string::npos || trigExpr.find(single_str_2022) != std::string::npos)
600 else if ( trigExpr.find(dilep_str) != std::string::npos )
601 ATH_MSG_ERROR(
"Use GetTriggerGlobalEfficiency for logical OR of lepton triggers");
602 else if ( trigExpr.find(multi_str) != std::string::npos )
603 ATH_MSG_ERROR(
"Use GetTriggerGlobalEfficiency for logical OR of lepton triggers");
605 ATH_MSG_ERROR(
"The trigger expression (" << trigExpr <<
") is not supported by the electron trigger efficiency!");
609 ATH_MSG_ERROR(
"Failed to retrieve signal electron trigger efficiency");
612 ATH_MSG_VERBOSE(
"OutOfValidityRange found for signal electron trigger efficiency");
627 if (!acc_passOR(*
electron))
continue;
641 if (ret != StatusCode::SUCCESS) {
642 ATH_MSG_ERROR(
"Cannot configure AsgElectronEfficiencyCorrectionTool (reco) for systematic var. " << systConfig.
name() );
646 if (ret != StatusCode::SUCCESS) {
647 ATH_MSG_ERROR(
"Cannot configure AsgElectronEfficiencyCorrectionTool (id) for systematic var. " << systConfig.
name() );
651 if (ret != StatusCode::SUCCESS) {
652 ATH_MSG_ERROR(
"Cannot configure AsgElectronEfficiencyCorrectionTool (trigger) for systematic var. " << systConfig.
name() );
656 if (ret != StatusCode::SUCCESS) {
657 ATH_MSG_ERROR(
"Cannot configure AsgElectronEfficiencyCorrectionTool (iso) for systematic var. " << systConfig.
name() );
661 if (ret != StatusCode::SUCCESS) {
662 ATH_MSG_ERROR(
"Cannot configure AsgElectronEfficiencyCorrectionTool (iso high-pt) for systematic var. " << systConfig.
name() );
666 if (ret != StatusCode::SUCCESS) {
667 ATH_MSG_ERROR(
"Cannot configure ElectronChargeEfficiencyCorrectionTool for systematic var. " << systConfig.
name() );
676 if (ret != StatusCode::SUCCESS) {
677 ATH_MSG_ERROR(
"Cannot configure AsgElectronEfficiencyCorrectionTool (reco) back to default.");
681 if (ret != StatusCode::SUCCESS) {
682 ATH_MSG_ERROR(
"Cannot configure AsgElectronEfficiencyCorrectionTool (id) back to default.");
686 if (ret != StatusCode::SUCCESS) {
687 ATH_MSG_ERROR(
"Cannot configure AsgElectronEfficiencyCorrectionTool (trigger) back to default.");
691 if (ret != StatusCode::SUCCESS) {
692 ATH_MSG_ERROR(
"Cannot configure AsgElectronEfficiencyCorrectionTool (iso) back to default.");
696 if (ret != StatusCode::SUCCESS) {
697 ATH_MSG_ERROR(
"Cannot configure AsgElectronEfficiencyCorrectionTool (iso high-pt) back to default.");
701 if (ret != StatusCode::SUCCESS) {
702 ATH_MSG_ERROR(
"Cannot configure ElectronChargeEfficiencyCorrectionTool back to default.");
def retrieve(aClass, aKey=None)
asg::AnaToolHandle< CP::IIsolationSelectionTool > m_isoHighPtTool
SG::WriteHandleKey< xAOD::ElectronContainer > m_outElectronLocation
StatusCode MergeElectrons(const xAOD::ElectronContainer &electrons, xAOD::ElectronContainer *outputCol, const std::set< const xAOD::Electron * > &ElectronsToRemove) const override final
asg::AnaToolHandle< IAsgDeadHVCellRemovalTool > m_deadHVTool
double GetEleTriggerEfficiencySF(const xAOD::Electron &el, const std::string &trigExpr="SINGLE_E_2015_e24_lhmedium_L1EM20VH_OR_e60_lhmedium_OR_e120_lhloose_2016_2018_e26_lhtight_nod0_ivarloose_OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0") const override final
Electron_v1 Electron
Definition of the current "egamma version".
bool IsSignalElectron(const xAOD::Electron &input, const float etcut, const float d0sigcut, const float z0cut, const float etacut=DUMMYDEF) const override final
asg::AnaToolHandle< IAsgElectronEfficiencyCorrectionTool > m_elecChargeEffCorrTool
SG::ConstAccessor< char > m_acc_eleId
std::string m_eleIsoHighPt_WP
asg::AnaToolHandle< CP::IEgammaCalibrationAndSmearingTool > m_egammaCalibTool
Combined electron collection.
SG::ConstAccessor< char > m_acc_eleIdBaseline
const xAOD::ElectronContainer * prompt_electrons
float GetTotalElectronSFsys(const xAOD::ElectronContainer &electrons, const CP::SystematicSet &systConfig, const bool recoSF=true, const bool idSF=true, const bool triggerSF=true, const bool isoSF=true, const std::string &trigExpr="singleLepton", const bool ecidsSF=false, const bool cidSF=false) override final
asg::AnaToolHandle< IAsgElectronEfficiencyCorrectionTool > m_elecEfficiencySFTool_reco
Combined muon collection.
asg::AnaToolHandle< IAsgElectronLikelihoodTool > m_elecSelLikelihood
DataVector adapter that acts like it holds const pointers.
asg::AnaToolHandle< CP::IIsolationSelectionTool > m_isoBaselineTool
std::vector< std::string > m_v_trigs17_cache_singleEle
double d0significance(const xAOD::TrackParticle *tp, double d0_uncert_beam_spot_2)
Class creating a shallow copy of an existing auxiliary container.
StatusCode FillElectron(xAOD::Electron &input, const float etcut, const float etacut) override final
Class to wrap a set of SystematicVariations.
float GetTotalElectronSF(const xAOD::ElectronContainer &electrons, const bool recoSF=true, const bool idSF=true, const bool triggerSF=true, const bool isoSF=true, const std::string &trigExpr="singleLepton", const bool ecidsSF=false, const bool cidSF=false) override final
StatusCode prepareLRTElectrons(const xAOD::ElectronContainer *inMuons, xAOD::ElectronContainer *copy) const override final
const T * get(size_type n) const
Access an element, as an rvalue.
std::string name() const
returns: the systematics joined into a single string.
float GetSignalElecSF(const xAOD::Electron &el, const bool recoSF=true, const bool idSF=true, const bool triggerSF=true, const bool isoSF=true, const std::string &trigExpr="singleLepton", const bool ecidsSF=false, const bool cidSF=false) override final
float beamPosSigmaX() const
The width of the beam spot in the X direction.
@ numberOfPixelHits
these are the pixel hits, including the b-layer [unit8_t].
std::vector< std::string > m_v_trigs18_cache_singleEle
const uint32_t BADCLUSELECTRON
const xAOD::Vertex * GetPrimVtx() const override final
std::vector< std::string > m_v_trigs22_cache_singleEle
#define ATH_MSG_VERBOSE(x)
const std::string & key() const
Return the StoreGate ID for the referenced object.
double m_elebaselined0sig
asg::AnaToolHandle< CP::IElectronLRTOverlapRemovalTool > m_elecLRTORTool
std::vector< std::string > m_v_trigs15_cache_singleEle
asg::AnaToolHandle< IAsgElectronEfficiencyCorrectionTool > m_elecEfficiencySFTool_isoHighPt
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
@ OutOfValidityRange
Input object is out of validity range.
@ Error
Some error happened during the object correction.
asg::AnaToolHandle< IAsgElectronEfficiencyCorrectionTool > m_elecEfficiencySFTool_id
const xAOD::ElectronContainer * lrt_electrons
::StatusCode StatusCode
StatusCode definition for legacy code.
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
asg::AnaToolHandle< IAsgElectronEfficiencyCorrectionTool > m_elecEfficiencySFTool_trigEff_singleLep
asg::AnaToolHandle< IAsgElectronEfficiencyCorrectionTool > m_elecEfficiencySFTool_iso
float beamPosSigmaY() const
The width of the beam spot in the Y direction.
asg::AnaToolHandle< IAsgElectronLikelihoodTool > m_elecSelLikelihoodBaseline
double GetEleTriggerEfficiency(const xAOD::Electron &el, const std::string &trigExpr="SINGLE_E_2015_e24_lhmedium_L1EM20VH_OR_e60_lhmedium_OR_e120_lhloose_2016_2018_e26_lhtight_nod0_ivarloose_OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0") const override final
void TrigMatch(const xAOD::IParticle *p, std::initializer_list< std::string >::iterator, std::initializer_list< std::string >::iterator) override final
asg::AnaToolHandle< IAsgElectronEfficiencyCorrectionTool > m_elecEfficiencySFTool_trig_singleLep
value_type push_back(value_type pElem)
Add an element to the end of the collection.
std::pair< std::unique_ptr< T >, std::unique_ptr< ShallowAuxContainer > > shallowCopyContainer(const T &cont, [[maybe_unused]] const EventContext &ctx)
Function making a shallow copy of a constant container.
Class describing the basic event information.
@ Ok
The correction was done successfully.
asg::AnaToolHandle< IAsgElectronLikelihoodTool > m_elecChargeIDSelectorTool
float beamPosSigmaXY() const
The beam spot shape's X-Y correlation.
std::string m_eleBaselineIso_WP
Class describing a Vertex.
#define ATH_MSG_WARNING(x)
bool setOriginalObjectLink(const IParticle &original, IParticle ©)
This function should be used by CP tools when they make a deep copy of an object in their correctedCo...
Return value from object correction CP tools.
CP::SystematicSet m_currentSyst
std::string m_electronTriggerSFStringSingle
@ numberOfSCTHits
number of hits in SCT [unit8_t].
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.
Class describing a TrackParticle.
const IParticle * getOriginalObject(const IParticle ©)
This function can be used to conveniently get a pointer back to the original object from which a copy...
bool m_eleBaselineCrackVeto
StatusCode GetElectrons(xAOD::ElectronContainer *©, xAOD::ShallowAuxContainer *©aux, const bool recordSG=true, const std::string &elekey="Electrons", const std::string &lrtelekey="LRTElectrons", const xAOD::ElectronContainer *containerToBeCopied=nullptr) override final
int treatAsYear(const int runNumber=-1) const override final
setBGCode setTAP setLVL2ErrorBits bool
size_type size() const noexcept
Returns the number of elements in the collection.
asg::AnaToolHandle< CP::IIsolationCorrectionTool > m_isoCorrTool
std::vector< std::string > m_v_trigs16_cache_singleEle
double m_eleIsoHighPtThresh
asg::AnaToolHandle< CP::IIsolationSelectionTool > m_isoTool