ATLAS Offline Software
Loading...
Searching...
No Matches
TrigHitDVHypoAlg Class Reference

Implements Hypo selection on triggering displaced vertex. More...

#include <TrigHitDVHypoAlg.h>

Inheritance diagram for TrigHitDVHypoAlg:
Collaboration diagram for TrigHitDVHypoAlg:

Public Member Functions

 TrigHitDVHypoAlg (const std::string &name, ISvcLocator *pSvcLocator)
virtual StatusCode initialize () override
virtual StatusCode execute (const EventContext &context) const override
virtual StatusCode sysInitialize () override
 initialise this base class
virtual bool isClonable () const override
 Specify if the algorithm is clonable.
virtual StatusCode sysExecute (const EventContext &ctx) override
 Execute an algorithm.
virtual const DataObjIDColl & extraOutputDeps () const override
 Return the list of extra output dependencies.
virtual bool filterPassed (const EventContext &ctx) const
 Get filter decision:
virtual void setFilterPassed (bool state, const EventContext &ctx) const
 Set filter decision:
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const

Static Public Member Functions

static StatusCode runtimeValidation (SG::WriteHandle< TrigCompositeUtils::DecisionContainer > &outputHandle, MsgStream &msg, bool onlyValidateOneStep=true, bool runTwoConversion=false)
 Executes all individual runtime tests.

Protected Member Functions

const SG::ReadHandleKey< TrigCompositeUtils::DecisionContainer > & decisionInput () const
 methods for derived classes to access handles of the base class input other read/write handles may be implemented by derived classes
const SG::WriteHandleKey< TrigCompositeUtils::DecisionContainer > & decisionOutput () const
 methods for derived classes to access handles of the base class output other read/write handles may be implemented by derived classes
StatusCode hypoBaseOutputProcessing (SG::WriteHandle< TrigCompositeUtils::DecisionContainer > &outputHandle, MSG::Level lvl=MSG::DEBUG) const
 Base class function to be called once slice specific code has finished. Handles debug printing and validation.
void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed.

Private Types

using SeedType = TrigHitDVHypoTool::SeedType
typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

StatusCode doMonitor (const xAOD::TrigCompositeContainer *) const
float deltaR2 (float, float, float, float) const
int getSPLayer (int, float) const
StatusCode findSPSeeds (const EventContext &, const std::vector< HitDVSpacePoint > &, std::vector< float > &, std::vector< float > &) const
StatusCode findJetSeeds (const xAOD::JetContainer *, const float, const float, std::vector< float > &, std::vector< float > &, std::vector< float > &) const
StatusCode selectSeedsNearby (const std::vector< HitDVSeed > &hitDVSeedsContainer, std::vector< float > &jetSeeds_eta, std::vector< float > &jetSeeds_phi, std::vector< float > &jetSeeds_pt) const
StatusCode calculateBDT (const std::vector< HitDVSpacePoint > &, const std::vector< HitDVTrk > &, const std::vector< float > &, const std::vector< float > &, const std::vector< float > &, const float &, const int, xAOD::TrigCompositeContainer *, int &) const
StatusCode findSPSeeds (const EventContext &ctx, const std::vector< float > &v_sp_eta, const std::vector< float > &v_sp_phi, const std::vector< int > &v_sp_layer, const std::vector< int > &v_sp_usedTrkId, std::vector< float > &seeds_eta, std::vector< float > &seeds_phi) const
StatusCode findHitDV (const EventContext &ctx, const std::vector< TrigSiSpacePointBase > &convertedSpacePoints, const DataVector< Trk::Track > &tracks, std::vector< HitDVSeed > &hitDVSeedsContainer, std::vector< HitDVTrk > &hitDVTrksContainer, std::vector< HitDVSpacePoint > &hitDVSPContainer) const
StatusCode printDebugInformation (SG::WriteHandle< TrigCompositeUtils::DecisionContainer > &outputHandle, MSG::Level lvl) const
 Common base function to print information on chains passed by objects considered in the hypo.
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

ToolHandle< ITrigSpacePointConversionToolm_spacePointTool {this, "SpacePointProviderTool", "TrigSpacePointConversionTool"}
ToolHandleArray< TrigHitDVHypoToolm_hypoTools {this, "HypoTools", {}, "Tools to perform selection"}
SG::ReadHandleKey< xAOD::JetContainerm_jetsKey {this, "Jets", "HLT_AntiKt4EMTopoJets_subjesIS", ""}
SG::WriteHandleKey< xAOD::TrigCompositeContainerm_hitDVKey {this, "HitDV", "HLT_HitDV", ""}
SG::ReadHandleKey< TrackCollectionm_tracksKey {this, "HitDVTracks", "HLT_IDTrkTrack_FS_FTF", ""}
ToolHandle< ILumiBlockMuToolm_lumiBlockMuTool
SG::ReadCondHandleKey< LuminosityCondDatam_lumiDataKey {this, "LuminosityCondDataKey", "LuminosityCondData", ""}
Gaudi::Property< bool > m_isMC {this, "isMC", false, "Real data or MC"}
Gaudi::Property< float > m_jetSeed_ptMin {this, "jetSeed_ptMin", 50.0, "Minimum pT for jet seed"}
Gaudi::Property< float > m_jetSeed_etaMax {this, "jetSeed_etaMin", 2.0, "Maximum eta for jet seed"}
Gaudi::Property< std::string > m_hitDVLinkName {this, "hitDVLinkName", "HitDVSeedLink", "Name of the link to HitDVContainer. Used by ViewCreatorROITool."}
ToolHandle< GenericMonitoringToolm_monTool { this, "MonTool", "", "Monitoring tool" }
std::unique_ptr< MVAUtils::BDTm_bdt_eta [2]
int m_tools_lowest_jetEt = 1000
int m_tools_loosest_wp = 0
bool m_useBeamSpot = true
bool m_doHitDV_Seeding = true
SG::ReadHandleKey< xAOD::jFexSRJetRoIContainerm_jetRoiCollectionKey {this, "jFexSRJetRoI", "", ""}
SG::ReadCondHandleKey< InDet::BeamSpotDatam_beamSpotKey { this, "BeamSpotKey", "BeamSpotData", "SG key for beam spot" }
SG::ReadHandleKey< TrigCompositeUtils::DecisionContainerm_input { this, "HypoInputDecisions", "UNSPECIFIED_INPUT", "Input Decision (implicit)" }
 input decisions
SG::WriteHandleKey< TrigCompositeUtils::DecisionContainerm_output { this, "HypoOutputDecisions", "UNSPECIFIED_OUTPUT", "Ouput Decision" }
 output decisions
Gaudi::Property< bool > m_runtimeValidation { this, "RuntimeValidation", false, "Enable detailed runtime validation of HypoAlg output, and upstream Decisions." }
 Enabling of detailed validation checks for use during development.
DataObjIDColl m_extendedExtraObjects
 Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks.
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default).
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default).
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Runtime validation methods

enum  LogicalFlowCheckMode { kRequireOne , kRequireAll }
static StatusCode validateHasLinks (const ElementLink< TrigCompositeUtils::DecisionContainer > &dEL, MsgStream &msg)
 Ensure all Decisions have the named ElementLink graph edges which they are required to by spec.
static StatusCode validateLogicalFlow (const ElementLink< TrigCompositeUtils::DecisionContainer > &dEL, MsgStream &msg, const LogicalFlowCheckMode mode)
 Ensure that all DecisionIDs have propagated correctly from their parent.
static StatusCode validateDuplicatedDecisionID (const ElementLink< TrigCompositeUtils::DecisionContainer > &dEL, MsgStream &msg)
 Ensure that no space is being wasted by duplicated DecisionIDs in any Decision objects.
static StatusCode validateDecisionIDs (const ElementLink< TrigCompositeUtils::DecisionContainer > &dEL, MsgStream &msg)
 Ensure that all present IDs correspond to configured chains.
static StatusCode validateParentLinking (const ElementLink< TrigCompositeUtils::DecisionContainer > &dEL, MsgStream &msg, bool runTwoConversion)
 Ensure that the Decision has at least one valid parent, unless it is a initial Decision from the HLTSeeding.
static StatusCode recursiveValidateGraph (const ElementLink< TrigCompositeUtils::DecisionContainer > &dEL, MsgStream &msg, bool onlyValidateOneStep, bool runTwoConversion, size_t callDepth, std::set< const TrigCompositeUtils::Decision * > &fullyExploredFrom)
 Execute all checks on one node in the graph, d, then recursive call self on all parent nodes up to L1.
static void printBangs (MsgStream &msg)
 Print header line.
static void printErrorHeader (const ElementLink< TrigCompositeUtils::DecisionContainer > &dEL, MsgStream &msg)
 A problem was found, print common output data.

Detailed Description

Implements Hypo selection on triggering displaced vertex.

Author
Kunihiro Nagano kunih.nosp@m.iro..nosp@m.nagan.nosp@m.o@ce.nosp@m.rn.ch - KEK

Definition at line 63 of file TrigHitDVHypoAlg.h.

Member Typedef Documentation

◆ SeedType

Definition at line 94 of file TrigHitDVHypoAlg.h.

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Member Enumeration Documentation

◆ LogicalFlowCheckMode

enum HypoBase::LogicalFlowCheckMode
privateinherited
Enumerator
kRequireOne 

Require all DecisionIDs to be present in at least one of my parent Decision objects.

kRequireAll 

Definition at line 52 of file HypoBase.h.

52 {
54 kRequireAll //<! Require all DecisionIDs to be present in all of my parent Decision objects
55 };
@ kRequireOne
Require all DecisionIDs to be present in at least one of my parent Decision objects.
Definition HypoBase.h:53
@ kRequireAll
Definition HypoBase.h:54

Constructor & Destructor Documentation

◆ TrigHitDVHypoAlg()

TrigHitDVHypoAlg::TrigHitDVHypoAlg ( const std::string & name,
ISvcLocator * pSvcLocator )

Definition at line 47 of file TrigHitDVHypoAlg.cxx.

48 :
49 ::HypoBase( name, pSvcLocator ),
50 m_lumiBlockMuTool("LumiBlockMuTool/LumiBlockMuTool")
51{}
HypoBase(const std::string &name, ISvcLocator *pSvcLocator)
constructor, to be called by sub-class constructors
Definition HypoBase.cxx:12
ToolHandle< ILumiBlockMuTool > m_lumiBlockMuTool

Member Function Documentation

◆ calculateBDT()

StatusCode TrigHitDVHypoAlg::calculateBDT ( const std::vector< HitDVSpacePoint > & spsContainer,
const std::vector< HitDVTrk > & trksContainer,
const std::vector< float > & seeds_pt,
const std::vector< float > & seeds_eta,
const std::vector< float > & seeds_phi,
const float & cutBDTthreshold,
const int seed_type,
xAOD::TrigCompositeContainer * dvContainer,
int & n_passed ) const
private

Definition at line 510 of file TrigHitDVHypoAlg.cxx.

516{
517 if( seeds_eta.size() != seeds_phi.size() ) return StatusCode::SUCCESS;
518 n_passed = 0;
519
520 for(unsigned int iseed=0; iseed<seeds_eta.size(); iseed++) {
521
522 float seed_eta = seeds_eta[iseed];
523 float seed_phi = seeds_phi[iseed];
524
525 ATH_MSG_VERBOSE("+++++ seed eta: " << seed_eta << ", phi:" << seed_phi << " +++++");
526
527 // loop on space points
528 const int N_LAYER = 8;
529 const float DR_SQUARED_TO_REF_CUT = 0.16; // const float DR_TO_REF_CUT = 0.4;
530
531 int n_sp_injet = 0;
532 int n_sp_injet_usedByTrk = 0;
533 int v_n_sp_injet[N_LAYER];
534 int v_n_sp_injet_usedByTrk[N_LAYER];
535 for(int i=0; i<N_LAYER; i++) { v_n_sp_injet[i]=0; v_n_sp_injet_usedByTrk[i]=0; }
536
537 for ( const auto & spData : spsContainer ) {
538 // match within dR
539 float sp_eta = spData.eta;
540 float sp_phi = spData.phi;
541 float dR2 = deltaR2(sp_eta,sp_phi,seed_eta,seed_phi);
542 if( dR2 > DR_SQUARED_TO_REF_CUT ) continue;
543
544 //
545 int sp_layer = (int)spData.layer;
546 int sp_trkid = (int)spData.usedTrkId;
547 bool isUsedByTrk = (sp_trkid != -1);
548
549 int ilayer = getSPLayer(sp_layer,sp_eta);
550
551 if( ilayer<=7 ) { // Pixel barrel or Sct barrel
552 n_sp_injet++;
553 v_n_sp_injet[ilayer]++;
554 if( isUsedByTrk ) {
555 n_sp_injet_usedByTrk++;
556 v_n_sp_injet_usedByTrk[ilayer]++;
557 }
558 }
559 }
560 ATH_MSG_VERBOSE("nr of SPs in jet: usedByTrk / all = " << n_sp_injet_usedByTrk << " / " << n_sp_injet);
561 float v_ly_sp_frac[N_LAYER];
562 for(int i=0; i<N_LAYER; i++) {
563 float frac = 0.;
564 if( v_n_sp_injet[i] > 0 ) frac = 1.0 - static_cast<float>(v_n_sp_injet_usedByTrk[i]) / static_cast<float>(v_n_sp_injet[i]);
565 v_ly_sp_frac[i] = frac;
566 ATH_MSG_VERBOSE("Layer " << i << ": frac=" << v_ly_sp_frac[i] << ", n used / all = " << v_n_sp_injet_usedByTrk[i] << " / " << v_n_sp_injet[i]);
567 }
568
569 // loop on tracks
570 const float TRK_PT_GEV_CUT = 2.0;
571
572 unsigned int n_qtrk_injet = 0;
573 for ( const auto& trk : trksContainer ) {
574 float trk_ptGeV = trk.pt;
575 trk_ptGeV /= Gaudi::Units::GeV;
576 if( trk_ptGeV < TRK_PT_GEV_CUT ) continue;
577 float dR2 = deltaR2(trk.eta,trk.phi,seed_eta,seed_phi);
578 if( dR2 > DR_SQUARED_TO_REF_CUT ) continue;
579 n_qtrk_injet++;
580 }
581 ATH_MSG_DEBUG("nr of all / quality tracks matched = " << trksContainer.size() << " / " << n_qtrk_injet);
582
583 // evaluate BDT
584 bool isSeedOutOfRange = false;
585 if( n_qtrk_injet == 0 ) {
586 isSeedOutOfRange = true;
587 for(int i=0; i<N_LAYER; i++) {
588 if( std::fabs(v_ly_sp_frac[i]) > 1e-3 ) {
589 isSeedOutOfRange = false; break;
590 }
591 }
592 }
593 float bdt_score = -2.0;
594 if( ! isSeedOutOfRange ) {
595 const std::vector<float> input_values = {
596 static_cast<float>(n_qtrk_injet),
597 v_ly_sp_frac[0],
598 v_ly_sp_frac[1],
599 v_ly_sp_frac[2],
600 v_ly_sp_frac[3],
601 v_ly_sp_frac[4],
602 v_ly_sp_frac[5],
603 v_ly_sp_frac[6],
604 v_ly_sp_frac[7] };
605
606 if ( std::abs(seed_eta) < 1 ) {
607 bdt_score = m_bdt_eta[0]->GetClassification(input_values);
608 } else if ( std::abs(seed_eta) < 2 ) {
609 bdt_score = m_bdt_eta[1]->GetClassification(input_values);
610 }
611 }
612
613 // BDT threshold
614 if( bdt_score < cutBDTthreshold ) continue;
615
616 // passed selection
617 ATH_MSG_VERBOSE("Passed selection");
618 n_passed++;
619
620 // create EDM object
622 dv->makePrivateStore();
623 dvContainer->push_back(dv);
624
625 float seed_pt = 0;
626 if ( seed_type == SeedType::HLTJet ) seed_pt = seeds_pt[iseed];
627 dv->setDetail<float>("hitDV_seed_pt", seed_pt);
628 dv->setDetail<float>("hitDV_seed_eta", seed_eta);
629 dv->setDetail<float>("hitDV_seed_phi", seed_phi);
630 dv->setDetail<int> ("hitDV_seed_type", seed_type);
631 dv->setDetail<int> ("hitDV_n_track_qual", n_qtrk_injet);
632 dv->setDetail<float>("hitDV_ly0_sp_frac", v_ly_sp_frac[0]);
633 dv->setDetail<float>("hitDV_ly1_sp_frac", v_ly_sp_frac[1]);
634 dv->setDetail<float>("hitDV_ly2_sp_frac", v_ly_sp_frac[2]);
635 dv->setDetail<float>("hitDV_ly3_sp_frac", v_ly_sp_frac[3]);
636 dv->setDetail<float>("hitDV_ly4_sp_frac", v_ly_sp_frac[4]);
637 dv->setDetail<float>("hitDV_ly5_sp_frac", v_ly_sp_frac[5]);
638 dv->setDetail<float>("hitDV_ly6_sp_frac", v_ly_sp_frac[6]);
639 dv->setDetail<float>("hitDV_ly7_sp_frac", v_ly_sp_frac[7]);
640 dv->setDetail<float>("hitDV_bdt_score", bdt_score);
641
642 ATH_MSG_VERBOSE("Created a new entry EDM");
643 }
644 ATH_MSG_DEBUG("nr of BDT passed = " << n_passed);
645
646 //
647 return StatusCode::SUCCESS;
648}
#define ATH_MSG_DEBUG(x,...)
#define ATH_MSG_VERBOSE(x,...)
value_type push_back(value_type pElem)
Add an element to the end of the collection.
float deltaR2(float, float, float, float) const
int getSPLayer(int, float) const
std::unique_ptr< MVAUtils::BDT > m_bdt_eta[2]
constexpr int N_LAYER
Definition MuonRoad.h:17
TrigComposite_v1 TrigComposite
Declare the latest version of the class.

◆ decisionInput()

const SG::ReadHandleKey< TrigCompositeUtils::DecisionContainer > & HypoBase::decisionInput ( ) const
protectedinherited

methods for derived classes to access handles of the base class input other read/write handles may be implemented by derived classes

Definition at line 18 of file HypoBase.cxx.

18 {
19 return m_input;
20}
SG::ReadHandleKey< TrigCompositeUtils::DecisionContainer > m_input
input decisions
Definition HypoBase.h:101

◆ decisionOutput()

const SG::WriteHandleKey< TrigCompositeUtils::DecisionContainer > & HypoBase::decisionOutput ( ) const
protectedinherited

methods for derived classes to access handles of the base class output other read/write handles may be implemented by derived classes

Definition at line 22 of file HypoBase.cxx.

22 {
23 return m_output;
24}
SG::WriteHandleKey< TrigCompositeUtils::DecisionContainer > m_output
output decisions
Definition HypoBase.h:103

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareGaudiProperty ( Gaudi::Property< T, V, H > & hndl,
const SG::VarHandleKeyType &  )
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareProperty ( Gaudi::Property< T, V, H > & t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ deltaR2()

float TrigHitDVHypoAlg::deltaR2 ( float eta_1,
float phi_1,
float eta_2,
float phi_2 ) const
private

Definition at line 324 of file TrigHitDVHypoAlg.cxx.

324 {
325 float dPhi = CxxUtils::wrapToPi(phi_1 - phi_2);
326 float dEta = eta_1 - eta_2;
327 return (dPhi*dPhi)+(dEta*dEta);
328}
constexpr T wrapToPi(T phi)
Wrap angle in radians to [-pi, pi].
Definition phihelper.h:31
bool dPhi(const xAOD::TauJet &tau, const xAOD::CaloVertexedTopoCluster &cluster, float &out)
bool dEta(const xAOD::TauJet &tau, const xAOD::CaloVertexedTopoCluster &cluster, float &out)

◆ detStore()

const ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

◆ doMonitor()

StatusCode TrigHitDVHypoAlg::doMonitor ( const xAOD::TrigCompositeContainer * dvContainer) const
private

Definition at line 457 of file TrigHitDVHypoAlg.cxx.

458{
459 auto mon_ly0_spfr = Monitored::Collection(
460 "ly0_spfr", *dvContainer, [&](const Decision* d){ return d->getDetail<float>("hitDV_ly0_sp_frac"); });
461 auto mon_ly1_spfr = Monitored::Collection(
462 "ly1_spfr", *dvContainer, [&](const Decision* d){ return d->getDetail<float>("hitDV_ly1_sp_frac"); });
463 auto mon_ly2_spfr = Monitored::Collection(
464 "ly2_spfr", *dvContainer, [&](const Decision* d){ return d->getDetail<float>("hitDV_ly2_sp_frac"); });
465 auto mon_ly3_spfr = Monitored::Collection(
466 "ly3_spfr", *dvContainer, [&](const Decision* d){ return d->getDetail<float>("hitDV_ly3_sp_frac"); });
467 auto mon_ly4_spfr = Monitored::Collection(
468 "ly4_spfr", *dvContainer, [&](const Decision* d){ return d->getDetail<float>("hitDV_ly4_sp_frac"); });
469 auto mon_ly5_spfr = Monitored::Collection(
470 "ly5_spfr", *dvContainer, [&](const Decision* d){ return d->getDetail<float>("hitDV_ly5_sp_frac"); });
471 auto mon_ly6_spfr = Monitored::Collection(
472 "ly6_spfr", *dvContainer, [&](const Decision* d){ return d->getDetail<float>("hitDV_ly6_sp_frac"); });
473 auto mon_ly7_spfr = Monitored::Collection(
474 "ly7_spfr", *dvContainer, [&](const Decision* d){ return d->getDetail<float>("hitDV_ly7_sp_frac"); });
475 auto mon_bdtscore = Monitored::Collection(
476 "bdtscore", *dvContainer, [&](const Decision* d){ return d->getDetail<float>("hitDV_bdt_score"); });
477 auto mon_n_qtrk = Monitored::Collection(
478 "n_qtrk", *dvContainer, [&](const Decision* d){ return d->getDetail<int>("hitDV_n_track_qual"); });
479
480 // fill CutMask to split spacespoints into eta regions
481 std::vector<char> mask_eta1(dvContainer->size(), 0);
482 std::vector<char> mask_1eta2(dvContainer->size(), 0);
483 auto mon_eta1_mask = Monitored::Collection( "cutEta1", mask_eta1 );
484 auto mon_1eta2_mask = Monitored::Collection( "cut1Eta2", mask_1eta2 );
485
486 for (size_t i = 0; i<dvContainer->size(); ++i) {
487 const Decision* dv = (*dvContainer)[i];
488
489 // do not fill sp-seeded candidates
490 if( dv->getDetail<int>("hitDV_seed_type") == SeedType::SP ) continue;
491
492 // fill the cut mask according to eta range
493 static const std::string seedEtaStr{"hitDV_seed_eta"};
494 const float abs_eta = std::abs(dv->getDetail<float>(seedEtaStr));
495 if ( abs_eta < 1.0 ) mask_eta1[i] = 1;
496 else if( abs_eta < 2.0 ) mask_1eta2[i] = 1;
497 }
498
499 auto monitorIt = Monitored::Group( m_monTool,
500 mon_ly0_spfr, mon_ly1_spfr, mon_ly2_spfr, mon_ly3_spfr,
501 mon_ly4_spfr, mon_ly5_spfr, mon_ly6_spfr, mon_ly7_spfr,
502 mon_n_qtrk, mon_bdtscore, mon_eta1_mask, mon_1eta2_mask );
503
504 return StatusCode::SUCCESS;
505}
size_type size() const noexcept
Returns the number of elements in the collection.
ToolHandle< GenericMonitoringTool > m_monTool
ValuesCollection< T > Collection(std::string name, const T &collection)
Declare a monitored (double-convertible) collection.
xAOD::TrigComposite Decision

◆ evtStore()

ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

◆ execute()

StatusCode TrigHitDVHypoAlg::execute ( const EventContext & context) const
overridevirtual

Definition at line 118 of file TrigHitDVHypoAlg.cxx.

119{
120
121 const TrigRoiDescriptor roi = TrigRoiDescriptor(0, -4.5, 4.5, 0, -M_PI, M_PI, 0, -168.0, 168.0);
122 std::vector<TrigSiSpacePointBase> convertedSpacePoints;
123 convertedSpacePoints.reserve(5000);
124 int mnt_roi_nSPsPIX;
125 int mnt_roi_nSPsSCT;
126 ATH_CHECK(m_spacePointTool->getSpacePoints(roi, convertedSpacePoints, mnt_roi_nSPsPIX, mnt_roi_nSPsSCT, context));
127
128 // monitoring
129 auto mon_n_dvtrks = Monitored::Scalar<int>( "n_dvtrks", 0 );
130 auto mon_n_dvsps = Monitored::Scalar<int>( "n_dvsps", 0 );
131 auto mon_n_jetseeds = Monitored::Scalar<int>( "n_jetseeds", 0 );
132 auto mon_n_jetseedsdel= Monitored::Scalar<int>( "n_jetseedsdel",0 );
133 auto mon_n_spseeds = Monitored::Scalar<int>( "n_spseeds", 0 );
134 auto mon_n_spseedsdel = Monitored::Scalar<int>( "n_spseedsdel", 0 );
135 auto mon_average_mu = Monitored::Scalar<float>( "average_mu", 0.);
136 auto monitorIt = Monitored::Group( m_monTool, mon_n_dvtrks, mon_n_dvsps, mon_n_jetseeds, mon_n_jetseedsdel, mon_n_spseeds, mon_n_spseedsdel, mon_average_mu );
137
138 // previous decisions
139 ATH_MSG_DEBUG( "Retrieving pervious decision: \"" << decisionInput().key() << "\"" );
140 auto previousDecisionsHandle = SG::makeHandle( decisionInput(), context );
141 ATH_CHECK( previousDecisionsHandle.isValid() );
142
143 ATH_MSG_DEBUG( "Running with " << previousDecisionsHandle->size() << " previous decisions" );
144 if( previousDecisionsHandle->size()!=1 ) {
145 ATH_MSG_ERROR( "Previous decision handle size is not 1. It is" << previousDecisionsHandle->size() );
146 return StatusCode::FAILURE;
147 }
148 const Decision * previousDecision = previousDecisionsHandle->at(0);
149
150 TrigCompositeUtils::DecisionIDContainer previousDecisionIDs;
151 TrigCompositeUtils::decisionIDs(previousDecision, previousDecisionIDs);
152 ATH_MSG_DEBUG( "IDs of active legs:" );
153 for(auto decisionID: previousDecisionIDs) { ATH_MSG_DEBUG( " " << decisionID ); }
154
155 // new output decisions
156 ATH_MSG_DEBUG( "Creating new output decision handle" );
157 SG::WriteHandle<DecisionContainer> outputHandle = createAndStore(decisionOutput(), context );
158 auto outputDecisions = outputHandle.ptr();
159
160 // input objects
161
162 // jets
163 auto jetsHandle = SG::makeHandle(m_jetsKey, context );
164 ATH_CHECK( jetsHandle.isValid() );
165 ATH_MSG_DEBUG( "jet handle size: " << jetsHandle->size() );
166
167 const xAOD::JetContainer* jetsContainer = jetsHandle.get();
168 if( jetsContainer == nullptr ) {
169 ATH_MSG_ERROR( "ERROR Cannot get jet container" );
170 return StatusCode::FAILURE;
171 }
172 bool isJetEtPassToolsCut = false;
173 float jetEtaToolsCut = 2.0;
174 if( m_tools_loosest_wp >= 3 ) jetEtaToolsCut = 1.0;
175 for ( const xAOD::Jet* jet : *jetsContainer ) {
176 float jet_pt = static_cast<float>(jet->pt() / Gaudi::Units::GeV );
177 float jet_eta = static_cast<float>(jet->eta());
178 if( jet_pt >= m_tools_lowest_jetEt && std::abs(jet_eta)<=jetEtaToolsCut ) {
179 isJetEtPassToolsCut = true;
180 break;
181 }
182 }
183
184 auto tracks = SG::makeHandle( m_tracksKey, context );
185 ATH_CHECK(tracks.isValid());
186
187 std::vector<HitDVSeed> hitDVSeedsContainer;
188 std::vector<HitDVTrk> hitDVTrksContainer;
189 std::vector<HitDVSpacePoint> hitDVSPsContainer;
190
191
192 ATH_CHECK( findHitDV(context, convertedSpacePoints, *tracks, hitDVSeedsContainer, hitDVTrksContainer, hitDVSPsContainer) );
193
194 mon_n_dvtrks = hitDVTrksContainer.size();
195 mon_n_dvsps = hitDVSPsContainer.size();
196 const unsigned int N_MAX_SP_STORED = 100000;
197 bool isSPOverflow = false;
198 if( hitDVSPsContainer.size() >= N_MAX_SP_STORED ) isSPOverflow = true;
199 ATH_MSG_DEBUG( "hitDVSP size=" << mon_n_dvsps );
200
201 // average mu
202 float averageMu = 0;
203 if( m_isMC ) {
204 if( m_lumiBlockMuTool ) {
205 averageMu = static_cast<float>(m_lumiBlockMuTool->averageInteractionsPerCrossing(context));
206 ATH_MSG_DEBUG( "offline averageMu = " << averageMu );
207 }
208 }
209 else {
210 SG::ReadCondHandle<LuminosityCondData> lcd (m_lumiDataKey,context);
211 averageMu = lcd.cptr()->lbAverageInteractionsPerCrossing();
212 ATH_MSG_DEBUG( "online averageMu = " << averageMu );
213 }
214 mon_average_mu = averageMu;
215
216 // find seeds based on HLT jets
217 std::vector<float> jetSeeds_pt;
218 std::vector<float> jetSeeds_eta;
219 std::vector<float> jetSeeds_phi;
220 ATH_CHECK( findJetSeeds(jetsContainer, m_jetSeed_ptMin, m_jetSeed_etaMax, jetSeeds_pt, jetSeeds_eta, jetSeeds_phi) );
221 int n_alljetseeds = jetSeeds_eta.size();
222 ATH_CHECK( selectSeedsNearby(hitDVSeedsContainer, jetSeeds_eta, jetSeeds_phi, jetSeeds_pt) );
223 mon_n_jetseeds = jetSeeds_eta.size();
224 mon_n_jetseedsdel = n_alljetseeds - jetSeeds_eta.size();
225
226 // find seeds based on SP frac itself
227 std::vector<float> spSeeds_eta;
228 std::vector<float> spSeeds_phi;
229 std::vector<float> void_pt;
230 int n_allspseeds = 0;
231 if( m_tools_loosest_wp <= 1 ) {
232 ATH_CHECK( findSPSeeds(context, hitDVSPsContainer, spSeeds_eta, spSeeds_phi) );
233 n_allspseeds = spSeeds_eta.size();
234 ATH_CHECK( selectSeedsNearby(hitDVSeedsContainer, spSeeds_eta, spSeeds_phi, void_pt) );
235 mon_n_spseeds = spSeeds_eta.size();
236 mon_n_spseedsdel = n_allspseeds - spSeeds_eta.size();
237 }
238 else {
239 mon_n_spseeds = 0;
240 mon_n_spseedsdel = 0;
241 }
242
243 // output EDM object
244 auto hitDVContainer = std::make_unique<xAOD::TrigCompositeContainer>();
245 auto hitDVContainerAux = std::make_unique<xAOD::TrigCompositeAuxContainer>();
246 hitDVContainer->setStore(hitDVContainerAux.get());
247
248 xAOD::TrigCompositeContainer* dvContainer = hitDVContainer.get();
249 std::vector<TrigHitDVHypoTool::HitDVHypoInfo> hitDVHypoInputs;
250 std::unordered_map<Decision*, size_t> mapDecIdx;
251
252 // calculate BDT and create hitDVContainer EDM
253 if( isJetEtPassToolsCut ) {
254 const float preselBDTthreshold = -0.6;
255
256 int n_passed_jet = 0;
257 int seed_type = SeedType::HLTJet;
258 ATH_CHECK( calculateBDT(hitDVSPsContainer, hitDVTrksContainer, jetSeeds_pt, jetSeeds_eta, jetSeeds_phi, preselBDTthreshold, seed_type, dvContainer, n_passed_jet) );
259
260 int n_passed_sp = 0;
261 if( m_tools_loosest_wp <= 1 ) {
262 seed_type = SeedType::SP;
263 ATH_CHECK( calculateBDT(hitDVSPsContainer, hitDVTrksContainer, void_pt, spSeeds_eta, spSeeds_phi, preselBDTthreshold, seed_type, dvContainer, n_passed_sp) );
264 }
265
266 ATH_MSG_DEBUG( "nr of dv container / jet-seeded / sp-seed candidates = " << dvContainer->size() << " / " << n_passed_jet << " / " << n_passed_sp );
267
268 // Prepare inputs to HypoTool
269 for ( auto dv : *dvContainer ) {
270 Decision* newDecision = TrigCompositeUtils::newDecisionIn( outputDecisions, previousDecision, TrigCompositeUtils::hypoAlgNodeName(), context);
271 mapDecIdx.emplace( newDecision, dv->index() );
272 TrigHitDVHypoTool::HitDVHypoInfo hypoInfo{ newDecision, isSPOverflow, averageMu, dv, previousDecisionIDs };
273 hitDVHypoInputs.push_back( std::move(hypoInfo) );
274 }
275 }
276
277 // monitor
278 ATH_CHECK( doMonitor(dvContainer) );
279
280 // Loop over all hypoToolinputs and get their decisions
281 for ( auto & tool: m_hypoTools ) {
282 ATH_MSG_DEBUG( "+++++ Now computing decision for " << tool->name() );
283 ATH_CHECK( tool->decide( hitDVHypoInputs ) );
284 }
285
286 // record hitDV object
287 SG::WriteHandle<xAOD::TrigCompositeContainer> hitDVHandle(m_hitDVKey, context);
288 ATH_CHECK( hitDVHandle.record( std::move( hitDVContainer ), std::move( hitDVContainerAux ) ) );
289 ATH_MSG_DEBUG( "recorded hitDV object to SG" );
290
291 DecisionContainer::iterator it = outputDecisions->begin();
292 while(it != outputDecisions->end()) {
293 ATH_MSG_DEBUG( "+++++ outputDecision: " << *it << " +++++" );
294 if ( allFailed( *it ) ) {
295 ATH_MSG_DEBUG( "---> all failed, erasing" );
296 it = outputDecisions->erase(it);
297 } else {
298 ATH_MSG_DEBUG( "---> not all failed" );
299
300 // Link hitDV object
301 auto decision = *it;
302 size_t idx = mapDecIdx.at(*it);
303
305 ATH_CHECK( dvEL.isValid() );
306
307 ATH_CHECK( decision->setObjectLink<xAOD::TrigCompositeContainer>(featureString(), dvEL) );
308
309 ATH_MSG_DEBUG(*decision);
310 ++it;
311 }
312 }
313
314 //
315 ATH_CHECK( hypoBaseOutputProcessing(outputHandle) );
316
317 //
318 return StatusCode::SUCCESS;
319}
#define M_PI
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x,...)
SG::WriteHandle< DecisionContainer > createAndStore(const SG::WriteHandleKey< DecisionContainer > &key, const EventContext &ctx)
Creates and right away records the DecisionContainer with the key.
const std::string & featureString()
bool allFailed(const Decision *d)
return true if there is no positive decision stored
Athena::TPCnvVers::Current TrigRoiDescriptor
const T * get(size_type n) const
Access an element, as an rvalue.
DataModel_detail::iterator< DataVector > iterator
Definition DataVector.h:842
const SG::ReadHandleKey< TrigCompositeUtils::DecisionContainer > & decisionInput() const
methods for derived classes to access handles of the base class input other read/write handles may be...
Definition HypoBase.cxx:18
const SG::WriteHandleKey< TrigCompositeUtils::DecisionContainer > & decisionOutput() const
methods for derived classes to access handles of the base class output other read/write handles may b...
Definition HypoBase.cxx:22
StatusCode hypoBaseOutputProcessing(SG::WriteHandle< TrigCompositeUtils::DecisionContainer > &outputHandle, MSG::Level lvl=MSG::DEBUG) const
Base class function to be called once slice specific code has finished. Handles debug printing and va...
Definition HypoBase.cxx:35
pointer_type ptr()
Dereference the pointer.
ToolHandleArray< TrigHitDVHypoTool > m_hypoTools
StatusCode findHitDV(const EventContext &ctx, const std::vector< TrigSiSpacePointBase > &convertedSpacePoints, const DataVector< Trk::Track > &tracks, std::vector< HitDVSeed > &hitDVSeedsContainer, std::vector< HitDVTrk > &hitDVTrksContainer, std::vector< HitDVSpacePoint > &hitDVSPContainer) const
SG::ReadCondHandleKey< LuminosityCondData > m_lumiDataKey
Gaudi::Property< float > m_jetSeed_ptMin
StatusCode calculateBDT(const std::vector< HitDVSpacePoint > &, const std::vector< HitDVTrk > &, const std::vector< float > &, const std::vector< float > &, const std::vector< float > &, const float &, const int, xAOD::TrigCompositeContainer *, int &) const
SG::ReadHandleKey< TrackCollection > m_tracksKey
Gaudi::Property< float > m_jetSeed_etaMax
ToolHandle< ITrigSpacePointConversionTool > m_spacePointTool
StatusCode selectSeedsNearby(const std::vector< HitDVSeed > &hitDVSeedsContainer, std::vector< float > &jetSeeds_eta, std::vector< float > &jetSeeds_phi, std::vector< float > &jetSeeds_pt) const
Gaudi::Property< bool > m_isMC
StatusCode findJetSeeds(const xAOD::JetContainer *, const float, const float, std::vector< float > &, std::vector< float > &, std::vector< float > &) const
StatusCode findSPSeeds(const EventContext &, const std::vector< HitDVSpacePoint > &, std::vector< float > &, std::vector< float > &) const
SG::WriteHandleKey< xAOD::TrigCompositeContainer > m_hitDVKey
SG::ReadHandleKey< xAOD::JetContainer > m_jetsKey
StatusCode doMonitor(const xAOD::TrigCompositeContainer *) const
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Decision * newDecisionIn(DecisionContainer *dc, const std::string &name)
Helper method to create a Decision object, place it in the container and return a pointer to it.
std::set< DecisionID > DecisionIDContainer
const std::string & hypoAlgNodeName()
void decisionIDs(const Decision *d, DecisionIDContainer &destination)
Extracts DecisionIDs stored in the Decision object.
Jet_v1 Jet
Definition of the current "jet version".
TrigCompositeContainer_v1 TrigCompositeContainer
Declare the latest version of the container.
JetContainer_v1 JetContainer
Definition of the current "jet container version".

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase & ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ extraOutputDeps()

const DataObjIDColl & AthCommonAlgorithm< Gaudi::Algorithm >::extraOutputDeps ( ) const
overridevirtualinherited

Return the list of extra output dependencies.

This list is extended to include symlinks implied by inheritance relations.

Definition at line 89 of file AthCommonAlgorithm.cxx.

54{
55 // If we didn't find any symlinks to add, just return the collection
56 // from the base class. Otherwise, return the extended collection.
57 if (!m_extendedExtraObjects.empty()) {
59 }
61}
Common base class for algorithms.

◆ filterPassed()

virtual bool AthCommonAlgorithm< Gaudi::Algorithm >::filterPassed ( const EventContext & ctx) const
inlinevirtualinherited

Get filter decision:

Definition at line 93 of file AthCommonAlgorithm.h.

93 {
94 return execState( ctx ).filterPassed();
95 }
virtual bool filterPassed(const EventContext &ctx) const
Get filter decision:

◆ findHitDV()

StatusCode TrigHitDVHypoAlg::findHitDV ( const EventContext & ctx,
const std::vector< TrigSiSpacePointBase > & convertedSpacePoints,
const DataVector< Trk::Track > & tracks,
std::vector< HitDVSeed > & hitDVSeedsContainer,
std::vector< HitDVTrk > & hitDVTrksContainer,
std::vector< HitDVSpacePoint > & hitDVSPContainer ) const
private

Definition at line 1121 of file TrigHitDVHypoAlg.cxx.

1125{
1126 std::vector<int> v_dvtrk_id;
1127 std::vector<float> v_dvtrk_pt;
1128 std::vector<float> v_dvtrk_eta;
1129 std::vector<float> v_dvtrk_phi;
1130 std::vector<int> v_dvtrk_n_hits_inner;
1131 std::vector<int> v_dvtrk_n_hits_pix;
1132 std::vector<int> v_dvtrk_n_hits_sct;
1133 std::vector<float> v_dvtrk_a0beam;
1134 std::unordered_map<Identifier, int> umap_fittedTrack_identifier;
1135 int fittedTrack_id = -1;
1136
1137 static constexpr float TRKCUT_PTGEV_HITDV = 0.5;
1138
1139 for (const auto track: tracks) {
1140 float shift_x = 0; float shift_y = 0;
1141 if(m_useBeamSpot) {
1142 SG::ReadCondHandle<InDet::BeamSpotData> beamSpotHandle { m_beamSpotKey, ctx };
1143 FTF::getBeamSpotShift(shift_x, shift_y, **beamSpotHandle);
1144 }
1145 trackInfo theTrackInfo;
1146 bool igt = FTF::isGoodTrackUTT(track, theTrackInfo, shift_x, shift_y, TRKCUT_PTGEV_HITDV);
1147 if (not igt) {continue;}
1148
1149 fittedTrack_id++;
1150 ATH_MSG_DEBUG("Selected track pT = " << theTrackInfo.ptGeV << " GeV");
1151
1152
1154 m = track->measurementsOnTrack()->begin(),
1155 me = track->measurementsOnTrack()->end ();
1156 for(; m!=me; ++m ) {
1157 const Trk::PrepRawData* prd = ((const Trk::RIO_OnTrack*)(*m))->prepRawData();
1158 if( prd == nullptr ) continue;
1159 Identifier id_prd = prd->identify();
1160 if( umap_fittedTrack_identifier.find(id_prd) == umap_fittedTrack_identifier.end() ) {
1161 umap_fittedTrack_identifier.insert(std::make_pair(id_prd,fittedTrack_id));
1162 }
1163 }
1164 float phi = track->perigeeParameters()->parameters()[Trk::phi];
1165 v_dvtrk_id.push_back(fittedTrack_id);
1166 v_dvtrk_pt.push_back(theTrackInfo.ptGeV*Gaudi::Units::GeV);
1167 v_dvtrk_eta.push_back(theTrackInfo.eta);
1168 v_dvtrk_phi.push_back(phi);
1169 v_dvtrk_n_hits_inner.push_back(theTrackInfo.n_hits_inner);
1170 v_dvtrk_n_hits_pix.push_back(theTrackInfo.n_hits_pix);
1171 v_dvtrk_n_hits_sct.push_back(theTrackInfo.n_hits_sct);
1172 v_dvtrk_a0beam.push_back(theTrackInfo.a0beam);
1173 }
1174 ATH_MSG_DEBUG("Nr of selected tracks / all = " << fittedTrack_id << " / " << tracks.size());
1175 ATH_MSG_DEBUG("Nr of Identifiers used by selected tracks = " << umap_fittedTrack_identifier.size());
1176
1177 // space points
1178 int n_sp = 0;
1179 int n_sp_usedByTrk = 0;
1180
1181 std::unordered_map<Identifier, int> umap_sp_identifier;
1182 umap_sp_identifier.reserve(1.3*convertedSpacePoints.size());//up to 2 Identifiers per spacepoint, end up with 1.3 from measurements
1183
1184 auto add_to_sp_map = [&](const Trk::PrepRawData* prd) {
1185 if (prd) {
1186 Identifier id_prd = prd->identify();
1187 if( umap_sp_identifier.find(id_prd) == umap_sp_identifier.end() ) {
1188 umap_sp_identifier.insert(std::make_pair(id_prd,-1));
1189 }
1190 }
1191 };
1192
1193 for(unsigned int iSp=0; iSp<convertedSpacePoints.size(); ++iSp) {
1194 bool isPix = convertedSpacePoints[iSp].isPixel();
1195 bool isSct = convertedSpacePoints[iSp].isSCT();
1196 if( ! isPix && ! isSct ) continue;
1197 const Trk::SpacePoint* sp = convertedSpacePoints[iSp].offlineSpacePoint();
1198 add_to_sp_map(sp->clusterList().first);
1199 add_to_sp_map(sp->clusterList().second);
1200 }
1201 int n_id_usedByTrack = 0;
1202 for(auto it=umap_sp_identifier.begin(); it!=umap_sp_identifier.end(); ++it) {
1203 Identifier id_sp = it->first;
1204 if( umap_fittedTrack_identifier.find(id_sp) != umap_fittedTrack_identifier.end() ) {
1205 umap_sp_identifier[id_sp] = umap_fittedTrack_identifier[id_sp];
1206 ++n_id_usedByTrack;
1207 }
1208 }
1209 ATH_MSG_DEBUG("Nr of SPs / Identifiers (all) / Identifiers (usedByTrack) = " << convertedSpacePoints.size() << " / " << umap_sp_identifier.size() << " / " << n_id_usedByTrack);
1210
1211 auto sp_map_used_id = [&](const Trk::PrepRawData* prd) {
1212 int usedTrack_id = -1;
1213 if (prd) {
1214 Identifier id_prd = prd->identify();
1215 if( umap_sp_identifier.find(id_prd) != umap_sp_identifier.end() ) {
1216 usedTrack_id = umap_sp_identifier[id_prd];
1217 }
1218 }
1219 return usedTrack_id;
1220 };
1221
1222 std::vector<float> v_sp_eta;
1223 v_sp_eta.reserve(convertedSpacePoints.size());
1224 std::vector<float> v_sp_r;
1225 v_sp_r.reserve(convertedSpacePoints.size());
1226 std::vector<float> v_sp_phi;
1227 v_sp_phi.reserve(convertedSpacePoints.size());
1228 std::vector<int> v_sp_layer;
1229 v_sp_layer.reserve(convertedSpacePoints.size());
1230 std::vector<bool> v_sp_isPix;
1231 v_sp_isPix.reserve(convertedSpacePoints.size());
1232 std::vector<bool> v_sp_isSct;
1233 v_sp_isSct.reserve(convertedSpacePoints.size());
1234 std::vector<int> v_sp_usedTrkId;
1235 v_sp_usedTrkId.reserve(convertedSpacePoints.size());
1236
1237 for(const auto& sp : convertedSpacePoints) {
1238 bool isPix = sp.isPixel();
1239 bool isSct = sp.isSCT();
1240 if( ! isPix && ! isSct ) continue;
1241 const Trk::SpacePoint* osp = sp.offlineSpacePoint();
1242
1243 int usedTrack_id = -1;
1244 int usedTrack_id_first = sp_map_used_id(osp->clusterList().first);
1245 if (usedTrack_id_first != -1) {
1246 usedTrack_id = usedTrack_id_first;
1247 }
1248 int usedTrack_id_second = sp_map_used_id(osp->clusterList().second);
1249 if (usedTrack_id_second != -1) {
1250 usedTrack_id = usedTrack_id_second;
1251 }
1252
1253 //
1254 n_sp++;
1255 if( usedTrack_id != -1 ) n_sp_usedByTrk++;
1256 int layer = sp.layer();
1257 float sp_r = sp.r();
1258
1259 const Amg::Vector3D& pos_sp = osp->globalPosition();//Go back to globalPosition to get the non-shifted spacepoint positions
1260 float sp_eta = pos_sp.eta();
1261 float sp_phi = pos_sp.phi();
1262
1263 v_sp_eta.push_back(sp_eta);
1264 v_sp_r.push_back(sp_r);
1265 v_sp_phi.push_back(sp_phi);
1266 v_sp_layer.push_back(layer);
1267 v_sp_isPix.push_back(isPix);
1268 v_sp_isSct.push_back(isSct);
1269 v_sp_usedTrkId.push_back(usedTrack_id);
1270
1271 ATH_MSG_VERBOSE("+++ SP eta / phi / layer / ixPix / usedTrack_id = " << sp_eta << " / " << sp_phi << " / " << layer << " / " << isPix << " / " << usedTrack_id);
1272
1273 }
1274 ATH_MSG_DEBUG("Nr of SPs / all = " << n_sp << " / " << convertedSpacePoints.size());
1275 ATH_MSG_DEBUG("Nr of SPs used by selected tracks = " << n_sp_usedByTrk);
1276
1277 // Seed
1278 std::vector<float> v_seeds_eta;
1279 std::vector<float> v_seeds_phi;
1280 std::vector<int16_t> v_seeds_type;
1281
1282 if( m_doHitDV_Seeding ) {
1283
1284 // add L1 Jet seeds
1285 const unsigned int L1JET_ET_CUT = 27; // Mapping from legacy J30, make configurable?
1286
1287 auto jetRoiCollectionHandle = SG::makeHandle( m_jetRoiCollectionKey, ctx );
1288 const DataVector<xAOD::jFexSRJetRoI> *jetRoiCollection = jetRoiCollectionHandle.cptr();
1289 if (!jetRoiCollectionHandle.isValid()){
1290 ATH_MSG_ERROR("ReadHandle for DataVector<xAOD::jFexSRJetRoI> key:" << m_jetRoiCollectionKey.key() << " isn't Valid");
1291 return StatusCode::FAILURE;
1292 }
1293 for (size_t size=0; size<jetRoiCollection->size(); ++size){
1294 const xAOD::jFexSRJetRoI* jetRoI = jetRoiCollection->at(size);
1295 if( jetRoI == nullptr ) continue;
1296 // Good seed
1297 if( jetRoI->et() >= L1JET_ET_CUT ) {
1298 v_seeds_eta.push_back(jetRoI->eta());
1299 v_seeds_phi.push_back(jetRoI->phi());
1300 v_seeds_type.push_back(0); // L1_J:0
1301 }
1302 }
1303 ATH_MSG_DEBUG("Nr of L1_J" << L1JET_ET_CUT << " seeds = " << v_seeds_eta.size());
1304
1305 // space-point based (unseeded mode)
1306 std::vector<float> v_spseeds_eta;
1307 std::vector<float> v_spseeds_phi;
1308 ATH_CHECK( findSPSeeds(ctx, v_sp_eta, v_sp_phi, v_sp_layer, v_sp_usedTrkId, v_spseeds_eta, v_spseeds_phi) );
1309 ATH_MSG_DEBUG("Nr of SP seeds = " << v_spseeds_eta.size());
1310 for(size_t idx=0; idx<v_spseeds_eta.size(); ++idx) {
1311 v_seeds_eta.push_back(v_spseeds_eta[idx]);
1312 v_seeds_phi.push_back(v_spseeds_phi[idx]);
1313 v_seeds_type.push_back(1); // SP: 1
1314 }
1315 ATH_MSG_DEBUG("Nr of SP + L1_J" << L1JET_ET_CUT << " seeds = " << v_seeds_eta.size());
1316 }
1317
1318 // fill objects
1319
1320 // seeds
1321 const int N_MAX_SEEDS = 200;
1322 int n_seeds = std::min(N_MAX_SEEDS,(int)v_seeds_eta.size());
1323 hitDVSeedsContainer.reserve(n_seeds);
1324 for(auto iSeed=0; iSeed < n_seeds; ++iSeed) {
1325 HitDVSeed seed;
1326 seed.eta = v_seeds_eta[iSeed];
1327 seed.phi = v_seeds_phi[iSeed];
1328 seed.type = v_seeds_type[iSeed];
1329 hitDVSeedsContainer.push_back(seed);
1330 }
1331
1332 // track
1333 const float TRKCUT_DELTA_R_TO_SEED = 1.0;
1334 hitDVTrksContainer.reserve(v_dvtrk_pt.size());
1335 for(unsigned int iTrk=0; iTrk<v_dvtrk_pt.size(); ++iTrk) {
1336 float trk_eta = v_dvtrk_eta[iTrk];
1337 float trk_phi = v_dvtrk_phi[iTrk];
1338 if( m_doHitDV_Seeding ) {
1339 bool isNearSeed = false;
1340 for (unsigned int iSeed=0; iSeed<v_seeds_eta.size(); ++iSeed) {
1341 float seed_eta = v_seeds_eta[iSeed];
1342 float seed_phi = v_seeds_phi[iSeed];
1343 float dR2 = deltaR2(trk_eta,trk_phi,seed_eta,seed_phi);
1344 if( dR2 <= TRKCUT_DELTA_R_TO_SEED*TRKCUT_DELTA_R_TO_SEED ) { isNearSeed = true; break; }
1345 }
1346 if( ! isNearSeed ) continue;
1347 }
1348 HitDVTrk hitDVTrk;
1349 hitDVTrk.id = v_dvtrk_id[iTrk];
1350 hitDVTrk.pt = v_dvtrk_pt[iTrk];
1351 hitDVTrk.eta = v_dvtrk_eta[iTrk];
1352 hitDVTrk.phi = v_dvtrk_phi[iTrk];
1353 hitDVTrk.n_hits_inner = v_dvtrk_n_hits_inner[iTrk];
1354 hitDVTrk.n_hits_pix = v_dvtrk_n_hits_pix[iTrk];
1355 hitDVTrk.n_hits_sct = v_dvtrk_n_hits_sct[iTrk];
1356 hitDVTrk.a0beam = v_dvtrk_a0beam[iTrk];
1357
1358 hitDVTrksContainer.push_back(hitDVTrk);
1359 }
1360
1361 // space points
1362 const float SPCUT_DELTA_R_TO_SEED = 1.0;
1363 const size_t n_sp_max = std::min<size_t>(100000, v_sp_eta.size());
1364 size_t n_sp_stored = 0;
1365
1366 hitDVSPsContainer.reserve(n_sp_max);
1367
1368 for(size_t iSp=0; iSp<v_sp_eta.size(); ++iSp) {
1369 if( m_doHitDV_Seeding ) {
1370 const float sp_eta = v_sp_eta[iSp];
1371 const float sp_phi = v_sp_phi[iSp];
1372 bool isNearSeed = false;
1373 for (size_t iSeed=0; iSeed<v_seeds_eta.size(); ++iSeed) {
1374 const float seed_eta = v_seeds_eta[iSeed];
1375 const float seed_phi = v_seeds_phi[iSeed];
1376 const float dR2 = deltaR2(sp_eta, sp_phi, seed_eta, seed_phi);
1377 if( dR2 <= SPCUT_DELTA_R_TO_SEED*SPCUT_DELTA_R_TO_SEED ) { isNearSeed = true; break; }
1378 }
1379 if( ! isNearSeed ) continue;
1380 }
1381 if( n_sp_stored >= n_sp_max ) break;
1382 HitDVSpacePoint hitDVSP;
1383 hitDVSP.eta = v_sp_eta[iSp];
1384 hitDVSP.r = v_sp_r[iSp];
1385 hitDVSP.phi = v_sp_phi[iSp];
1386 hitDVSP.layer = v_sp_layer[iSp];
1387 hitDVSP.isPix = v_sp_isPix[iSp];
1388 hitDVSP.isSct = v_sp_isSct[iSp];
1389 hitDVSP.usedTrkId = v_sp_usedTrkId[iSp];
1390 hitDVSPsContainer.push_back(hitDVSP);
1391 ++n_sp_stored;
1392 }
1393 ATH_MSG_DEBUG("Nr of SPs stored = " << n_sp_stored);
1394
1395 return StatusCode::SUCCESS;
1396}
Scalar phi() const
phi method
static Double_t sp
size_t size() const
Number of registered mappings.
DataModel_detail::const_iterator< DataVector > const_iterator
Standard const_iterator.
Definition DataVector.h:838
const T * at(size_type n) const
Access an element, as an rvalue.
SG::ReadHandleKey< xAOD::jFexSRJetRoIContainer > m_jetRoiCollectionKey
SG::ReadCondHandleKey< InDet::BeamSpotData > m_beamSpotKey
Identifier identify() const
return the identifier
const std::pair< const PrepRawData *, const PrepRawData * > & clusterList() const
return the pair of cluster pointers by reference
virtual const Amg::Vector3D & globalPosition() const override final
Interface method to get the global Position.
unsigned int et() const
Methods that require combining results or applying scales.
Eigen::Matrix< double, 3, 1 > Vector3D
void getBeamSpotShift(float &shift_x, float &shift_y, const InDet::BeamSpotData &beamSpotHandle)
bool isGoodTrackUTT(const Trk::Track *track, trackInfo &theTrackInfo, const float shift_x, const float shift_y, float trkcut_ptgev)
@ layer
Definition HitInfo.h:79
@ phi
Definition ParamDefs.h:75
jFexSRJetRoI_v1 jFexSRJetRoI
Define the latest version of the jFexSRJetRoI class.
int16_t n_hits_inner
int16_t n_hits_sct
int16_t n_hits_pix

◆ findJetSeeds()

StatusCode TrigHitDVHypoAlg::findJetSeeds ( const xAOD::JetContainer * jetsContainer,
const float cutJetPt,
const float cutJetEta,
std::vector< float > & jetSeeds_pt,
std::vector< float > & jetSeeds_eta,
std::vector< float > & jetSeeds_phi ) const
private

Definition at line 653 of file TrigHitDVHypoAlg.cxx.

655{
656 std::vector<float> mnt_jet_pt;
657 std::vector<float> mnt_jet_eta;
658 auto mon_jet_pt = Monitored::Collection("jet_pt", mnt_jet_pt);
659 auto mon_jet_eta = Monitored::Collection("jet_eta", mnt_jet_eta);
660 auto monitorIt = Monitored::Group( m_monTool, mon_jet_pt, mon_jet_eta );
661
662 ATH_MSG_VERBOSE("looking for jet seed with pt cut=" << cutJetPt << ", eta cut=" << cutJetEta);
663 for ( const xAOD::Jet* jet : *jetsContainer ) {
664 float jet_pt = static_cast<float>(jet->pt() / Gaudi::Units::GeV );
665 if( jet_pt < cutJetPt ) {
666 ATH_MSG_VERBOSE("Fails jet pt cut, pt = " << jet_pt);
667 continue;
668 }
669 mnt_jet_pt.push_back(jet_pt);
670 float jet_eta = static_cast<float>(jet->eta());
671 mnt_jet_eta.push_back(jet_eta);
672 if( std::fabs(jet_eta) > cutJetEta ) {
673 ATH_MSG_VERBOSE("Fails jet eta cut, eta = " << jet_eta);
674 continue;
675 }
676 float jet_phi = static_cast<float>(jet->phi());
677 jetSeeds_pt.push_back(jet_pt);
678 jetSeeds_eta.push_back(jet_eta);
679 jetSeeds_phi.push_back(jet_phi);
680 }
681 ATH_MSG_VERBOSE("nr of jet seeds=" << jetSeeds_eta.size());
682
683 return StatusCode::SUCCESS;
684}

◆ findSPSeeds() [1/2]

StatusCode TrigHitDVHypoAlg::findSPSeeds ( const EventContext & ctx,
const std::vector< HitDVSpacePoint > & spsContainer,
std::vector< float > & seeds_eta,
std::vector< float > & seeds_phi ) const
private

Definition at line 689 of file TrigHitDVHypoAlg.cxx.

691{
692 seeds_eta.clear();
693 seeds_phi.clear();
694
695 const int NBINS_ETA = 50;
696 const float ETA_MIN = -2.5;
697 const float ETA_MAX = 2.5;
698
699 const int NBINS_PHI = 80;
700 const float PHI_MIN = -4.0;
701 const float PHI_MAX = 4.0;
702
703 char hname[64];
704
705 unsigned int slotnr = ctx.slot();
706 unsigned int subSlotnr = ctx.subSlot();
707
708 sprintf(hname,"hitdv_s%u_ss%u_ly6_h2_nsp",slotnr,subSlotnr);
709 std::unique_ptr<TH2F> ly6_h2_nsp = std::make_unique<TH2F>(hname,hname,NBINS_ETA,ETA_MIN,ETA_MAX,NBINS_PHI,PHI_MIN,PHI_MAX);
710 sprintf(hname,"hitdv_s%u_ss%u_ly7_h2_nsp",slotnr,subSlotnr);
711 std::unique_ptr<TH2F> ly7_h2_nsp = std::make_unique<TH2F>(hname,hname,NBINS_ETA,ETA_MIN,ETA_MAX,NBINS_PHI,PHI_MIN,PHI_MAX);
712
713 sprintf(hname,"hitdv_s%u_ss%u_ly6_h2_nsp_notrk",slotnr,subSlotnr);
714 std::unique_ptr<TH2F> ly6_h2_nsp_notrk = std::make_unique<TH2F>(hname,hname,NBINS_ETA,ETA_MIN,ETA_MAX,NBINS_PHI,PHI_MIN,PHI_MAX);
715 sprintf(hname,"hitdv_s%u_ss%u_ly7_h2_nsp_notrk",slotnr,subSlotnr);
716 std::unique_ptr<TH2F> ly7_h2_nsp_notrk = std::make_unique<TH2F>(hname,hname,NBINS_ETA,ETA_MIN,ETA_MAX,NBINS_PHI,PHI_MIN,PHI_MAX);
717
718 for ( const auto& spData : spsContainer ) {
719 int16_t sp_layer = spData.layer;
720 float sp_eta = spData.eta;
721 int ilayer = getSPLayer(sp_layer,sp_eta);
722 if( ilayer<6 ) continue;
723
724 int sp_trkid = (int)spData.usedTrkId;
725 bool isUsedByTrk = (sp_trkid != -1);
726 float sp_phi = spData.phi;
727
728 bool fill_out_of_pi = false;
729 float sp_phi2 = 0;
730 if( sp_phi < 0 ) {
731 sp_phi2 = 2*TMath::Pi() + sp_phi;
732 if( sp_phi2 < PHI_MAX ) fill_out_of_pi = true;
733 }
734 else {
735 sp_phi2 = -2*TMath::Pi() + sp_phi;
736 if( PHI_MIN < sp_phi2 ) fill_out_of_pi = true;
737 }
738 if( ilayer==6 ) {
739 ly6_h2_nsp->Fill(sp_eta,sp_phi);
740 if( fill_out_of_pi ) ly6_h2_nsp->Fill(sp_eta,sp_phi2);
741 if( ! isUsedByTrk ) ly6_h2_nsp_notrk->Fill(sp_eta,sp_phi);
742 if( ! isUsedByTrk && fill_out_of_pi) ly6_h2_nsp_notrk->Fill(sp_eta,sp_phi2);
743 }
744 if( ilayer==7 ) {
745 ly7_h2_nsp->Fill(sp_eta,sp_phi);
746 if( fill_out_of_pi ) ly7_h2_nsp->Fill(sp_eta,sp_phi2);
747 if( ! isUsedByTrk ) ly7_h2_nsp_notrk->Fill(sp_eta,sp_phi);
748 if( ! isUsedByTrk && fill_out_of_pi) ly7_h2_nsp_notrk->Fill(sp_eta,sp_phi2);
749 }
750 }
751
752 ATH_MSG_VERBOSE("looking for ly6/ly6 doublet seeds");
753
754 // (idx, sort/weight, eta, phi)
755 std::vector<std::tuple<int,float,float,float>> QT;
756
757 for(int ly6_ieta=1; ly6_ieta<=NBINS_ETA; ly6_ieta++) {
758 float ly6_eta = (ly6_h2_nsp->GetXaxis()->GetBinLowEdge(ly6_ieta) + ly6_h2_nsp->GetXaxis()->GetBinUpEdge(ly6_ieta))/2.0;
759 for(int ly6_iphi=1; ly6_iphi<=NBINS_PHI; ly6_iphi++) {
760 float ly6_phi = (ly6_h2_nsp->GetYaxis()->GetBinLowEdge(ly6_iphi) + ly6_h2_nsp->GetYaxis()->GetBinUpEdge(ly6_iphi))/2.0;
761
762 float ly6_nsp = ly6_h2_nsp ->GetBinContent(ly6_ieta,ly6_iphi);
763 float ly6_nsp_notrk = ly6_h2_nsp_notrk->GetBinContent(ly6_ieta,ly6_iphi);
764 float ly6_frac = ( ly6_nsp > 0 ) ? ly6_nsp_notrk / ly6_nsp : 0;
765 if( ly6_nsp < 10 || ly6_frac < 0.85 ) continue;
766
767 float ly7_frac_max = 0;
768 float ly7_eta_max = 0;
769 float ly7_phi_max = 0;
770 for(int ly7_ieta=std::max(1,ly6_ieta-1); ly7_ieta<std::min(NBINS_ETA,ly6_ieta+1); ly7_ieta++) {
771 for(int ly7_iphi=std::max(1,ly6_iphi-1); ly7_iphi<=std::min(NBINS_PHI,ly6_iphi+1); ly7_iphi++) {
772 float ly7_nsp = ly7_h2_nsp ->GetBinContent(ly7_ieta,ly7_iphi);
773 float ly7_nsp_notrk = ly7_h2_nsp_notrk->GetBinContent(ly7_ieta,ly7_iphi);
774 float ly7_frac = ( ly7_nsp > 0 ) ? ly7_nsp_notrk / ly7_nsp : 0;
775 if( ly7_nsp < 10 ) continue;
776 if( ly7_frac > ly7_frac_max ) {
777 ly7_frac_max = ly7_frac;
778 ly7_eta_max = (ly7_h2_nsp->GetXaxis()->GetBinLowEdge(ly7_ieta) + ly7_h2_nsp->GetXaxis()->GetBinUpEdge(ly7_ieta))/2.0;
779 ly7_phi_max = (ly7_h2_nsp->GetXaxis()->GetBinLowEdge(ly7_iphi) + ly7_h2_nsp->GetXaxis()->GetBinUpEdge(ly7_iphi))/2.0;
780 }
781 }
782 }
783 if( ly7_frac_max < 0.85 ) continue;
784 //
785 float wsum = ly6_frac + ly7_frac_max;
786 float weta = (ly6_eta*ly6_frac + ly7_eta_max*ly7_frac_max) / wsum;
787 float wphi = (ly6_phi*ly6_frac + ly7_phi_max*ly7_frac_max) / wsum;
788 float w = wsum / 2.0;
789 QT.push_back(std::make_tuple(-1,w,weta,wphi));
790 }
791 }
792 ATH_MSG_VERBOSE("nr of ly6/ly7 doublet candidate seeds=" << QT.size() << ", doing clustering...");
793
794 // sort
795 std::sort(QT.begin(), QT.end(),
796 [](const std::tuple<int,float,float,float>& lhs, const std::tuple<int,float,float,float>& rhs) {
797 return std::get<1>(lhs) > std::get<1>(rhs); } );
798
799 // clustering
800 const double CLUSTCUT_DIST_SQUARED = 0.04; // const double CLUSTCUT_DIST = 0.2;
801 const double CLUSTCUT_SEED_FRAC = 0.9;
802
803 std::vector<float> seeds_wsum;
804
805 for(unsigned int i=0; i<QT.size(); i++) {
806 float phi = std::get<3>(QT[i]);
807 float eta = std::get<2>(QT[i]);
808 float w = std::get<1>(QT[i]);
809 if(i==0) {
810 seeds_eta.push_back(w*eta); seeds_phi.push_back(w*phi);
811 seeds_wsum.push_back(w);
812 continue;
813 }
814 const int IDX_INITIAL = 100;
815 float dist2_min = 100.0;
816 int idx_min = IDX_INITIAL;
817 for(unsigned j=0; j<seeds_eta.size(); j++) {
818 float ceta = seeds_eta[j]/seeds_wsum[j];
819 float cphi = seeds_phi[j]/seeds_wsum[j];
820 // intentionally calculate in this way as phi is defined beyond -Pi/Pi (no boundary)
821 float deta = std::fabs(ceta-eta);
822 float dphi = std::fabs(cphi-phi);
823 float dist2 = dphi*dphi+deta*deta;
824 if( dist2 < dist2_min ) {
825 dist2_min = dist2;
826 idx_min = j;
827 }
828 }
829 int match_idx = IDX_INITIAL;
830 if( idx_min != IDX_INITIAL ) {
831 if( dist2_min < CLUSTCUT_DIST_SQUARED ) { match_idx = idx_min; }
832 }
833 if( match_idx == IDX_INITIAL ) {
834 if( w > CLUSTCUT_SEED_FRAC && dist2_min > CLUSTCUT_DIST_SQUARED ) {
835 seeds_eta.push_back(w*eta); seeds_phi.push_back(w*phi);
836 seeds_wsum.push_back(w);
837 }
838 continue;
839 }
840 float new_eta = seeds_eta[match_idx] + w*eta;
841 float new_phi = seeds_phi[match_idx] + w*phi;
842 float new_wsum = seeds_wsum[match_idx] + w;
843 seeds_eta[match_idx] = new_eta;
844 seeds_phi[match_idx] = new_phi;
845 seeds_wsum[match_idx] = new_wsum;
846 }
847 QT.clear();
848 for(unsigned int i=0; i<seeds_eta.size(); i++) {
849 float eta = seeds_eta[i] / seeds_wsum[i];
850 float phi = seeds_phi[i] / seeds_wsum[i];
851 seeds_eta[i] = eta;
852 seeds_phi[i] = phi;
853 if( phi < -TMath::Pi() ) phi = 2*TMath::Pi() + phi;
854 if( phi > TMath::Pi() ) phi = -2*TMath::Pi() + phi;
855 seeds_phi[i] = phi;
856 }
857 ATH_MSG_VERBOSE("after clustering, nr of seeds = " << seeds_eta.size());
858
859 // delete overlap (can happen at phi=-Pi/Pi bounadry)
860 std::vector<unsigned int> idx_to_delete;
861 for(unsigned int i=0; i<seeds_eta.size(); i++) {
862 if( std::find(idx_to_delete.begin(),idx_to_delete.end(),i) != idx_to_delete.end() ) continue;
863 float eta_i = seeds_eta[i];
864 float phi_i = seeds_phi[i];
865 for(unsigned int j=i+1; j<seeds_eta.size(); j++) {
866 if( std::find(idx_to_delete.begin(),idx_to_delete.end(),j) != idx_to_delete.end() ) continue;
867 float eta_j = seeds_eta[j];
868 float phi_j = seeds_phi[j];
869 float dR2 = deltaR2(eta_i,phi_i,eta_j,phi_j);
870 if( dR2 < CLUSTCUT_DIST_SQUARED ) idx_to_delete.push_back(j);
871 }
872 }
873 ATH_MSG_VERBOSE("nr of duplicated seeds to be removed = " << idx_to_delete.size());
874 if( idx_to_delete.size() > 0 ) {
875 std::sort(idx_to_delete.begin(),idx_to_delete.end());
876 for(unsigned int j=idx_to_delete.size(); j>0; j--) {
877 unsigned int idx = idx_to_delete[j-1];
878 seeds_eta.erase(seeds_eta.begin()+idx);
879 seeds_phi.erase(seeds_phi.begin()+idx);
880 }
881 }
882
883 ATH_MSG_VERBOSE("nr of ly6/ly7 seeds=" << seeds_eta.size());
884
885 // return
886 return StatusCode::SUCCESS;
887}
Scalar eta() const
pseudorapidity method
constexpr float ETA_MAX
Definition NSWTPBits.h:17
constexpr float ETA_MIN
Definition NSWTPBits.h:16
constexpr float PHI_MAX
Definition NSWTPBits.h:24
float j(const xAOD::IParticle &, const xAOD::TrackMeasurementValidation &hit, const Eigen::Matrix3d &jab_inv)
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.
setScaleOne setStatusOne setSaturated int16_t

◆ findSPSeeds() [2/2]

StatusCode TrigHitDVHypoAlg::findSPSeeds ( const EventContext & ctx,
const std::vector< float > & v_sp_eta,
const std::vector< float > & v_sp_phi,
const std::vector< int > & v_sp_layer,
const std::vector< int > & v_sp_usedTrkId,
std::vector< float > & seeds_eta,
std::vector< float > & seeds_phi ) const
private

Definition at line 922 of file TrigHitDVHypoAlg.cxx.

926{
927 const int NBINS_ETA = 50;
928 const float ETA_MIN = -2.5;
929 const float ETA_MAX = 2.5;
930
931 const int NBINS_PHI = 80;
932 const float PHI_MIN = -4.0;
933 const float PHI_MAX = 4.0;
934
935 char hname[64];
936
937 unsigned int slotnr = ctx.slot();
938 unsigned int subSlotnr = ctx.subSlot();
939
940 sprintf(hname,"ftf_s%u_ss%u_ly6_h2_nsp",slotnr,subSlotnr);
941 std::unique_ptr<TH2F> ly6_h2_nsp = std::make_unique<TH2F>(hname,hname,NBINS_ETA,ETA_MIN,ETA_MAX,NBINS_PHI,PHI_MIN,PHI_MAX);
942 sprintf(hname,"ftf_s%u_ss%u_ly7_h2_nsp",slotnr,subSlotnr);
943 std::unique_ptr<TH2F> ly7_h2_nsp = std::make_unique<TH2F>(hname,hname,NBINS_ETA,ETA_MIN,ETA_MAX,NBINS_PHI,PHI_MIN,PHI_MAX);
944
945 sprintf(hname,"ftf_s%u_ss%u_ly6_h2_nsp_notrk",slotnr,subSlotnr);
946 std::unique_ptr<TH2F> ly6_h2_nsp_notrk = std::make_unique<TH2F>(hname,hname,NBINS_ETA,ETA_MIN,ETA_MAX,NBINS_PHI,PHI_MIN,PHI_MAX);
947 sprintf(hname,"ftf_s%u_ss%u_ly7_h2_nsp_notrk",slotnr,subSlotnr);
948 std::unique_ptr<TH2F> ly7_h2_nsp_notrk = std::make_unique<TH2F>(hname,hname,NBINS_ETA,ETA_MIN,ETA_MAX,NBINS_PHI,PHI_MIN,PHI_MAX);
949
950 for(unsigned int iSeed=0; iSeed<v_sp_eta.size(); ++iSeed) {
951
952 int sp_layer = v_sp_layer[iSeed];
953 float sp_eta = v_sp_eta[iSeed];
954 int ilayer = getSPLayer(sp_layer,sp_eta);
955 if( ilayer<6 ) continue;
956
957 int sp_trkid = v_sp_usedTrkId[iSeed];
958 bool isUsedByTrk = (sp_trkid != -1);
959 float sp_phi = v_sp_phi[iSeed];
960
961 bool fill_out_of_pi = false;
962 float sp_phi2 = 0;
963 if( sp_phi < 0 ) {
964 sp_phi2 = 2*TMath::Pi() + sp_phi;
965 if( sp_phi2 < PHI_MAX ) fill_out_of_pi = true;
966 }
967 else {
968 sp_phi2 = -2*TMath::Pi() + sp_phi;
969 if( PHI_MIN < sp_phi2 ) fill_out_of_pi = true;
970 }
971 if( ilayer==6 ) {
972 ly6_h2_nsp->Fill(sp_eta,sp_phi);
973 if( fill_out_of_pi ) ly6_h2_nsp->Fill(sp_eta,sp_phi2);
974 if( ! isUsedByTrk ) ly6_h2_nsp_notrk->Fill(sp_eta,sp_phi);
975 if( ! isUsedByTrk && fill_out_of_pi) ly6_h2_nsp_notrk->Fill(sp_eta,sp_phi2);
976 }
977 if( ilayer==7 ) {
978 ly7_h2_nsp->Fill(sp_eta,sp_phi);
979 if( fill_out_of_pi ) ly7_h2_nsp->Fill(sp_eta,sp_phi2);
980 if( ! isUsedByTrk ) ly7_h2_nsp_notrk->Fill(sp_eta,sp_phi);
981 if( ! isUsedByTrk && fill_out_of_pi) ly7_h2_nsp_notrk->Fill(sp_eta,sp_phi2);
982 }
983 }
984
985 ATH_MSG_VERBOSE("looking for ly6/ly6 doublet seeds");
986
987 // (idx, sort/weight, eta, phi)
988 std::vector<std::tuple<int,float,float,float>> QT;
989
990 for(int ly6_ieta=1; ly6_ieta<=NBINS_ETA; ly6_ieta++) {
991 float ly6_eta = (ly6_h2_nsp->GetXaxis()->GetBinLowEdge(ly6_ieta) + ly6_h2_nsp->GetXaxis()->GetBinUpEdge(ly6_ieta))/2.0;
992 for(int ly6_iphi=1; ly6_iphi<=NBINS_PHI; ly6_iphi++) {
993 float ly6_phi = (ly6_h2_nsp->GetYaxis()->GetBinLowEdge(ly6_iphi) + ly6_h2_nsp->GetYaxis()->GetBinUpEdge(ly6_iphi))/2.0;
994
995 float ly6_nsp = ly6_h2_nsp ->GetBinContent(ly6_ieta,ly6_iphi);
996 float ly6_nsp_notrk = ly6_h2_nsp_notrk->GetBinContent(ly6_ieta,ly6_iphi);
997 float ly6_frac = ( ly6_nsp > 0 ) ? ly6_nsp_notrk / ly6_nsp : 0;
998 if( ly6_nsp < 10 || ly6_frac < 0.85 ) continue;
999
1000 float ly7_frac_max = 0;
1001 float ly7_eta_max = 0;
1002 float ly7_phi_max = 0;
1003 for(int ly7_ieta=std::max(1,ly6_ieta-1); ly7_ieta<std::min(NBINS_ETA,ly6_ieta+1); ly7_ieta++) {
1004 for(int ly7_iphi=std::max(1,ly6_iphi-1); ly7_iphi<=std::min(NBINS_PHI,ly6_iphi+1); ly7_iphi++) {
1005 float ly7_nsp = ly7_h2_nsp ->GetBinContent(ly7_ieta,ly7_iphi);
1006 float ly7_nsp_notrk = ly7_h2_nsp_notrk->GetBinContent(ly7_ieta,ly7_iphi);
1007 float ly7_frac = ( ly7_nsp > 0 ) ? ly7_nsp_notrk / ly7_nsp : 0;
1008 if( ly7_nsp < 10 ) continue;
1009 if( ly7_frac > ly7_frac_max ) {
1010 ly7_frac_max = ly7_frac;
1011 ly7_eta_max = (ly7_h2_nsp->GetXaxis()->GetBinLowEdge(ly7_ieta) + ly7_h2_nsp->GetXaxis()->GetBinUpEdge(ly7_ieta))/2.0;
1012 ly7_phi_max = (ly7_h2_nsp->GetXaxis()->GetBinLowEdge(ly7_iphi) + ly7_h2_nsp->GetXaxis()->GetBinUpEdge(ly7_iphi))/2.0;
1013 }
1014 }
1015 }
1016 if( ly7_frac_max < 0.85 ) continue;
1017 //
1018 float wsum = ly6_frac + ly7_frac_max;
1019 float weta = (ly6_eta*ly6_frac + ly7_eta_max*ly7_frac_max) / wsum;
1020 float wphi = (ly6_phi*ly6_frac + ly7_phi_max*ly7_frac_max) / wsum;
1021 float w = wsum / 2.0;
1022 QT.push_back(std::make_tuple(-1,w,weta,wphi));
1023 }
1024 }
1025 ATH_MSG_VERBOSE("nr of ly6/ly7 doublet candidate seeds=" << QT.size() << ", doing clustering...");
1026
1027 // sort
1028 std::sort(QT.begin(), QT.end(),
1029 [](const std::tuple<int,float,float,float>& lhs, const std::tuple<int,float,float,float>& rhs) {
1030 return std::get<1>(lhs) > std::get<1>(rhs); } );
1031
1032 // clustering
1033 const double CLUSTCUT_DIST_SQUARED = 0.04; // const double CLUSTCUT_DIST = 0.2;
1034 const double CLUSTCUT_SEED_FRAC = 0.9;
1035
1036 std::vector<float> seeds_wsum;
1037
1038 for(unsigned int i=0; i<QT.size(); i++) {
1039 float phi = std::get<3>(QT[i]);
1040 float eta = std::get<2>(QT[i]);
1041 float w = std::get<1>(QT[i]);
1042 if(i==0) {
1043 seeds_eta.push_back(w*eta); seeds_phi.push_back(w*phi);
1044 seeds_wsum.push_back(w);
1045 continue;
1046 }
1047 const int IDX_INITIAL = 100;
1048 float dist2_min = 100.0;
1049 int idx_min = IDX_INITIAL;
1050 for(unsigned j=0; j<seeds_eta.size(); j++) {
1051 float ceta = seeds_eta[j]/seeds_wsum[j];
1052 float cphi = seeds_phi[j]/seeds_wsum[j];
1053 // intentionally calculate in this way as phi is defined beyond -Pi/Pi (no boundary)
1054 float deta = std::fabs(ceta-eta);
1055 float dphi = std::fabs(cphi-phi);
1056 float dist2 = dphi*dphi+deta*deta;
1057 if( dist2 < dist2_min ) {
1058 dist2_min = dist2;
1059 idx_min = j;
1060 }
1061 }
1062 int match_idx = IDX_INITIAL;
1063 if( idx_min != IDX_INITIAL ) {
1064 if( dist2_min < CLUSTCUT_DIST_SQUARED ) { match_idx = idx_min; }
1065 }
1066 if( match_idx == IDX_INITIAL ) {
1067 if( w > CLUSTCUT_SEED_FRAC && dist2_min > CLUSTCUT_DIST_SQUARED ) {
1068 seeds_eta.push_back(w*eta); seeds_phi.push_back(w*phi);
1069 seeds_wsum.push_back(w);
1070 }
1071 continue;
1072 }
1073 float new_eta = seeds_eta[match_idx] + w*eta;
1074 float new_phi = seeds_phi[match_idx] + w*phi;
1075 float new_wsum = seeds_wsum[match_idx] + w;
1076 seeds_eta[match_idx] = new_eta;
1077 seeds_phi[match_idx] = new_phi;
1078 seeds_wsum[match_idx] = new_wsum;
1079 }
1080 QT.clear();
1081 for(unsigned int i=0; i<seeds_eta.size(); i++) {
1082 float eta = seeds_eta[i] / seeds_wsum[i];
1083 float phi = seeds_phi[i] / seeds_wsum[i];
1084 seeds_eta[i] = eta;
1085 if( phi < -TMath::Pi() ) phi = 2*TMath::Pi() + phi;
1086 if( phi > TMath::Pi() ) phi = -2*TMath::Pi() + phi;
1087 seeds_phi[i] = phi;
1088 }
1089 ATH_MSG_VERBOSE("after clustering, nr of seeds = " << seeds_eta.size());
1090
1091 // delete overlap (can happen at phi=-Pi/Pi bounadry)
1092 std::vector<unsigned int> idx_to_delete;
1093 for(unsigned int i=0; i<seeds_eta.size(); i++) {
1094 if( std::find(idx_to_delete.begin(),idx_to_delete.end(),i) != idx_to_delete.end() ) continue;
1095 float eta_i = seeds_eta[i];
1096 float phi_i = seeds_phi[i];
1097 for(unsigned int j=i+1; j<seeds_eta.size(); j++) {
1098 if( std::find(idx_to_delete.begin(),idx_to_delete.end(),j) != idx_to_delete.end() ) continue;
1099 float eta_j = seeds_eta[j];
1100 float phi_j = seeds_phi[j];
1101 float dR2 = deltaR2(eta_i,phi_i,eta_j,phi_j);
1102 if( dR2 < CLUSTCUT_DIST_SQUARED ) idx_to_delete.push_back(j);
1103 }
1104 }
1105 ATH_MSG_VERBOSE("nr of duplicated seeds to be removed = " << idx_to_delete.size());
1106 if( idx_to_delete.size() > 0 ) {
1107 std::sort(idx_to_delete.begin(),idx_to_delete.end());
1108 for(unsigned int j=idx_to_delete.size(); j>0; j--) {
1109 unsigned int idx = idx_to_delete[j-1];
1110 seeds_eta.erase(seeds_eta.begin()+idx);
1111 seeds_phi.erase(seeds_phi.begin()+idx);
1112 }
1113 }
1114
1115 ATH_MSG_VERBOSE("nr of ly6/ly7 seeds=" << seeds_eta.size());
1116
1117 // return
1118 return StatusCode::SUCCESS;
1119}

◆ getSPLayer()

int TrigHitDVHypoAlg::getSPLayer ( int layer,
float eta ) const
private

Definition at line 333 of file TrigHitDVHypoAlg.cxx.

334{
335 float abseta = std::fabs(eta);
336
337 // if Pixel/SCT barrel, layer number is as it is
338 if( 0<=layer && layer <=7 ) {
339 ATH_MSG_VERBOSE("layer=" << layer << ", eta=" << abseta);
340 return layer;
341 }
342
343 // for Pixel/SCT endcap, assign layer number of 0-7 depending on eta range
344
345 int base = 0;
346
347 //
348 const float PixBR6limit = 1.29612;
349 const float PixBR5limit = 1.45204;
350 const float PixBR4limit = 1.64909;
351 const float PixBR3limit = 1.90036;
352 const float PixBR2limit = 2.2146;
353
354 // Pixel Endcap #1
355 base = 8;
356 if( layer==base || layer==(base+12) ) {
357 ATH_MSG_VERBOSE("Pix EC1, eta=" << abseta);
358 if( abseta > PixBR2limit ) return 2;
359 return 3;
360 }
361
362 // Pixel Endcap #2
363 base = 9;
364 if( layer==base || layer==(base+12) ) {
365 ATH_MSG_VERBOSE("Pix EC2, eta=" << abseta);
366 if( abseta > PixBR2limit ) return 2;
367 return 3;
368 }
369
370 // Pixel Endcap #3
371 base = 10;
372 if( layer==base || layer==(base+12) ) {
373 ATH_MSG_VERBOSE("Pix EC3, eta=" << abseta);
374 return 3;
375 }
376
377 // SCT Endcap #1
378 base = 11;
379 if( layer==base || layer==(base+12) ) {
380 ATH_MSG_VERBOSE("Sct EC1, eta=" << abseta);
381 if( abseta < PixBR6limit ) return 7;
382 else if( abseta < PixBR5limit ) return 6;
383 return 5;
384 }
385
386 // SCT Endcap #2
387 base = 12;
388 if( layer==base || layer==(base+12) ) {
389 ATH_MSG_VERBOSE("Sct EC2, eta=" << abseta);
390 if( abseta < PixBR5limit ) return 7;
391 else if( abseta < PixBR4limit ) return 6;
392 return 4;
393 }
394
395 // SCT Endcap #3
396 base = 13;
397 if( layer==base || layer==(base+12) ) {
398 ATH_MSG_VERBOSE("Sct EC3, eta=" << abseta);
399 if( abseta < PixBR4limit ) return 7;
400 return 5;
401 }
402
403 // SCT Endcap #4
404 base = 14;
405 if( layer==base || layer==(base+12) ) {
406 ATH_MSG_VERBOSE("Sct EC4, eta=" << abseta);
407 if( abseta < PixBR4limit ) return 6;
408 else if( abseta < PixBR3limit ) return 6;
409 return 4;
410 }
411
412 // SCT Endcap #5
413 base = 15;
414 if( layer==base || layer==(base+12) ) {
415 ATH_MSG_VERBOSE("Sct EC5, eta=" << abseta);
416 if( abseta < PixBR3limit ) return 7;
417 return 5;
418 }
419
420 // SCT Endcap #6
421 base = 16;
422 if( layer==base || layer==(base+12) ) {
423 ATH_MSG_VERBOSE("Sct EC6, eta=" << abseta);
424 if( abseta < PixBR3limit ) return 6;
425 return 4;
426 }
427
428 // SCT Endcap #7
429 base = 17;
430 if( layer==base || layer==(base+12) ) {
431 ATH_MSG_VERBOSE("Sct EC7, eta=" << abseta);
432 if( abseta < PixBR3limit ) return 7;
433 return 5;
434 }
435
436 // SCT Endcap #8
437 base = 18;
438 if( layer==base || layer==(base+12) ) {
439 ATH_MSG_VERBOSE("Sct EC8, eta=" << abseta);
440 if( abseta < PixBR3limit ) return 7;
441 return 6;
442 }
443
444 // SCT Endcap #9
445 base = 19;
446 if( layer==base || layer==(base+12) ) {
447 ATH_MSG_VERBOSE("Sct EC9, eta=" << abseta);
448 return 7;
449 }
450
451 return 0;
452}
std::string base
Definition hcg.cxx:83

◆ hypoBaseOutputProcessing()

StatusCode HypoBase::hypoBaseOutputProcessing ( SG::WriteHandle< TrigCompositeUtils::DecisionContainer > & outputHandle,
MSG::Level lvl = MSG::DEBUG ) const
protectedinherited

Base class function to be called once slice specific code has finished. Handles debug printing and validation.

Definition at line 35 of file HypoBase.cxx.

35 {
36
37 ATH_CHECK( printDebugInformation(outputHandle, lvl) );
38
40 ATH_CHECK( runtimeValidation(outputHandle, msg()) );
41 }
42
43 return StatusCode::SUCCESS;
44}
StatusCode printDebugInformation(SG::WriteHandle< TrigCompositeUtils::DecisionContainer > &outputHandle, MSG::Level lvl) const
Common base function to print information on chains passed by objects considered in the hypo.
Definition HypoBase.cxx:406
Gaudi::Property< bool > m_runtimeValidation
Enabling of detailed validation checks for use during development.
Definition HypoBase.h:105
static StatusCode runtimeValidation(SG::WriteHandle< TrigCompositeUtils::DecisionContainer > &outputHandle, MsgStream &msg, bool onlyValidateOneStep=true, bool runTwoConversion=false)
Executes all individual runtime tests.
Definition HypoBase.cxx:47

◆ initialize()

StatusCode TrigHitDVHypoAlg::initialize ( )
overridevirtual

Definition at line 56 of file TrigHitDVHypoAlg.cxx.

57{
60 CHECK( m_hypoTools.retrieve() );
61 for ( auto & tool: m_hypoTools ) {
62 ATH_MSG_VERBOSE( "+++++ Hypo Tool name: " << tool->name() );
63 std::cmatch results;
64 if( std::regex_search(tool->name().c_str(),results,std::regex("hitdvjet(\\d+)_(\\w+)_")) ) {
65 std::string sth = results[1].str();
66 std::string swp = results[2].str();
67 ATH_MSG_VERBOSE( " thres = " << sth << ", wp = " << swp );
68 int thres = std::stoi(sth);
69 if( thres < m_tools_lowest_jetEt ) m_tools_lowest_jetEt = thres;
70 if( swp == "loose" && m_tools_loosest_wp >= 1 ) m_tools_loosest_wp = 1;
71 if( swp == "medium" && m_tools_loosest_wp >= 2 ) m_tools_loosest_wp = 2;
72 if( swp == "tight" && m_tools_loosest_wp >= 3 ) m_tools_loosest_wp = 3;
73 }
74 }
75 ATH_MSG_DEBUG( "Lowest jetEt used in hypo tools = " << m_tools_lowest_jetEt << " (GeV)" );
76 ATH_MSG_DEBUG( "Loosest WP used in hypo tools = " << m_tools_loosest_wp << " (loose=1,medium=2,tight=3)");
77 // loose : eta<2.0, SP seed=true, BDT eff=0.9
78 // medium: eta<2.0, SP seed=false, BDT eff=0.75
79 // tight : eta<1.0, SP seed=false, BDT eff=0.75
80
81 CHECK( m_jetsKey.initialize() );
82 CHECK( m_hitDVKey.initialize());
83 CHECK( m_tracksKey.initialize());
84 CHECK( m_lumiDataKey.initialize(!m_isMC) );
86
87 if ( !m_monTool.empty() ) CHECK( m_monTool.retrieve() );
88
89 ATH_CHECK(m_beamSpotKey.initialize());
90 ATH_CHECK(m_spacePointTool.retrieve() );
91
92 // MVAUtils BDT initialisation
93 // could make this configurable as a property
94 std::string weightfile[2];
95 weightfile[0] = PathResolver::find_calib_file("TrigHitDVHypo/HitDV.BDT.weights.0eta1.v22a.root");
96 weightfile[1] = PathResolver::find_calib_file("TrigHitDVHypo/HitDV.BDT.weights.1eta2.v22a.root");
97 for (unsigned int i=0; i<2; ++i) {
98 std::unique_ptr<TFile> rootFile(TFile::Open(weightfile[i].c_str(), "READ"));
99 if (!rootFile) {
100 ATH_MSG_ERROR("Can not open BDT root file: " << weightfile[i] );
101 return StatusCode::FAILURE;
102 }
103 std::unique_ptr<TTree> tree((TTree*)rootFile->Get("BDT"));
104 if (!tree) {
105 ATH_MSG_ERROR("Can not find BDT tree in file: " << weightfile[i]);
106 return StatusCode::FAILURE;
107 }
108 ATH_MSG_INFO("Loading BDT tree from file: " << weightfile[i]);
109 m_bdt_eta[i] = std::make_unique<MVAUtils::BDT>(tree.get());
110 }
111
112 return StatusCode::SUCCESS;
113}
#define ATH_MSG_INFO(x,...)
#define CHECK(...)
Evaluate an expression and check for errors.
static std::string find_calib_file(const std::string &logical_file_name)
TChain * tree

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ isClonable()

virtual bool AthCommonAlgorithm< Gaudi::Algorithm >::isClonable ( ) const
inlineoverridevirtualinherited

Specify if the algorithm is clonable.

Only relevant for non-reentrant algorithms. Actual number of clones needs to be set via the "Cardinality" property.

Reimplemented in AFP_DigiTop, AlgB, AlgT, BCM_Digitization, CscDigitBuilder, CscDigitToCscRDO, G4AtlasAlg, G4RunAlg, HGTD_Digitization, HiveAlgBase, InDet::GNNSeedingTrackMaker, InDet::SCT_Clusterization, InDet::SiSPGNNTrackMaker, InDet::SiSPSeededTrackFinder, InDet::SiTrackerSpacePointFinder, ISF::SimKernelMT, ITk::StripDigitization, ITkPixelCablingAlg, ITkStripCablingAlg, LArHitEMapMaker, LArTTL1Maker, LUCID_DigiTop, LVL1::L1TopoSimulation, MergeCalibHits, MergeGenericMuonSimHitColl, MergeHijingPars, MergeMcEventCollection, MergeTrackRecordCollection, MergeTruthJets, MergeTruthParticles, MuonDigitizer, PileUpMTAlg, PixelDigitization, RoIBResultToxAOD, SCT_ByteStreamErrorsTestAlg, SCT_CablingCondAlgFromCoraCool, SCT_CablingCondAlgFromText, SCT_ConditionsParameterTestAlg, SCT_ConditionsSummaryTestAlg, SCT_ConfigurationConditionsTestAlg, SCT_Digitization, SCT_FlaggedConditionTestAlg, SCT_LinkMaskingTestAlg, SCT_MajorityConditionsTestAlg, SCT_ModuleVetoTestAlg, SCT_MonitorConditionsTestAlg, SCT_PrepDataToxAOD, SCT_RawDataToxAOD, SCT_ReadCalibChipDataTestAlg, SCT_ReadCalibDataTestAlg, SCT_RODVetoTestAlg, SCT_SensorsTestAlg, SCT_SiliconConditionsTestAlg, SCT_StripVetoTestAlg, SCT_TdaqEnabledTestAlg, SCT_TestCablingAlg, SCTEventFlagWriter, SCTRawDataProvider, SCTSiLorentzAngleTestAlg, SCTSiPropertiesTestAlg, SGInputLoader, Simulation::BeamEffectsAlg, TileHitVecToCnt, TileMuonFitter, TilePulseForTileMuonReceiver, TileRawChannelMaker, TRTDigitization, and ZDC_DigiTop.

Definition at line 68 of file AthCommonAlgorithm.h.

68 {
69 return true;
70 }

◆ msg()

MsgStream & AthCommonMsg< Gaudi::Algorithm >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24 {
25 return this->msgStream();
26 }

◆ msgLvl()

bool AthCommonMsg< Gaudi::Algorithm >::msgLvl ( const MSG::Level lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30 {
31 return this->msgLevel(lvl);
32 }

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ printBangs()

void HypoBase::printBangs ( MsgStream & msg)
staticprivateinherited

Print header line.

Definition at line 390 of file HypoBase.cxx.

390 {
391 msg << MSG::ERROR << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endmsg;
392}
#define endmsg

◆ printDebugInformation()

StatusCode HypoBase::printDebugInformation ( SG::WriteHandle< TrigCompositeUtils::DecisionContainer > & outputHandle,
MSG::Level lvl ) const
privateinherited

Common base function to print information on chains passed by objects considered in the hypo.

Definition at line 406 of file HypoBase.cxx.

406 {
407 if (msgLvl(lvl)) {
408 msg() << lvl;
409 msg() << "Exiting with " << outputHandle->size() <<" Decision objects" << endmsg;
410 size_t count = 0;
411 for (const Decision* d : *outputHandle){
412 DecisionIDContainer objDecisions;
413 decisionIDs( d, objDecisions );
414 msg() << "Number of positive decisions for Decision object #" << count++ << ": " << objDecisions.size() << endmsg;
415 for (const TrigCompositeUtils::DecisionID id : objDecisions ) {
416 msg() << " --- Passes: " << HLT::Identifier( id ) << endmsg;
417 }
418 }
419 }
420 return StatusCode::SUCCESS;
421}
bool msgLvl(const MSG::Level lvl) const
int count(std::string s, const std::string &regx)
count how many occurances of a regx are in a string
Definition hcg.cxx:148
unsigned int DecisionID

◆ printErrorHeader()

void HypoBase::printErrorHeader ( const ElementLink< TrigCompositeUtils::DecisionContainer > & dEL,
MsgStream & msg )
staticprivateinherited

A problem was found, print common output data.

Definition at line 395 of file HypoBase.cxx.

397{
399 msg << MSG::ERROR << "! RUNTIME TRIGGER NAVIGATION VALIDATION ERROR" << endmsg;
400 msg << MSG::ERROR << "! Caused by Decision with index:" << (*dEL)->index() << endmsg;
401 msg << MSG::ERROR << "! From collection:" << dEL.dataID() << endmsg;
402 msg << MSG::ERROR << "! " << **dEL << endmsg;
403}
static void printBangs(MsgStream &msg)
Print header line.
Definition HypoBase.cxx:390

◆ recursiveValidateGraph()

StatusCode HypoBase::recursiveValidateGraph ( const ElementLink< TrigCompositeUtils::DecisionContainer > & dEL,
MsgStream & msg,
bool onlyValidateOneStep,
bool runTwoConversion,
size_t callDepth,
std::set< const TrigCompositeUtils::Decision * > & fullyExploredFrom )
staticprivateinherited

Execute all checks on one node in the graph, d, then recursive call self on all parent nodes up to L1.

Definition at line 71 of file HypoBase.cxx.

77{
78 if (onlyValidateOneStep && callDepth > 0) {
79 if ((*dEL)->name() == hypoAlgNodeName()) {
80 // Validation is called from HypoAlg nodes. So if we have reached the _previous_ HypoAlg node, then we have already
81 // validated back from here in the past. Can stop at this point.
82 return StatusCode::SUCCESS;
83 }
84 }
85
86 // Check logical flow at this place in the graph
87 if ((*dEL)->name() == hypoAlgNodeName()) {
88 // Check that all Hypo Decisions produced here satisfy the more-strict all-parent logical flow
89 if ( validateLogicalFlow(dEL, msg, kRequireAll).isFailure() ) {
90 return StatusCode::FAILURE;
91 }
92 } else {
93 // (looser requirement of one-valid-parent-with-decision than we had when we knew that d corresponded to a HypoAlg output)
94 if ( validateLogicalFlow(dEL, msg, kRequireOne).isFailure() ) {
95 return StatusCode::FAILURE;
96 }
97 }
98
99 // Check my IDs
100 if ( validateDecisionIDs(dEL, msg).isFailure() ) {
101 return StatusCode::FAILURE;
102 }
103 if ( validateDuplicatedDecisionID(dEL, msg).isFailure() ) {
104 return StatusCode::FAILURE;
105 }
106
107 // Check my linking
108 if( validateParentLinking(dEL, msg, runTwoConversion).isFailure() ) {
109 return StatusCode::FAILURE;
110 }
111 if ( validateHasLinks(dEL, msg).isFailure() ) {
112 return StatusCode::FAILURE;
113 }
114
115 // Continue upstream
116 const std::vector<ElementLink<DecisionContainer>> seeds = (*dEL)->objectCollectionLinks<DecisionContainer>(seedString());
117 for (const ElementLink<DecisionContainer>& seed : seeds) {
118 if (fullyExploredFrom.count( (*seed) ) == 1) {
119 continue; // Already fully explored from this seed and up
120 }
121 if ( not seed.isValid() ) {
122 msg << MSG::ERROR << "Invalid seed element link in recursiveValidateGraph" << endmsg;
123 return StatusCode::FAILURE;
124 }
125 if ( recursiveValidateGraph(seed, msg, onlyValidateOneStep, runTwoConversion, callDepth + 1, fullyExploredFrom).isFailure() ) {
126 return StatusCode::FAILURE;
127 }
128 }
129
130 fullyExploredFrom.insert( *dEL );
131 return StatusCode::SUCCESS;
132}
static StatusCode validateDecisionIDs(const ElementLink< TrigCompositeUtils::DecisionContainer > &dEL, MsgStream &msg)
Ensure that all present IDs correspond to configured chains.
Definition HypoBase.cxx:209
static StatusCode validateParentLinking(const ElementLink< TrigCompositeUtils::DecisionContainer > &dEL, MsgStream &msg, bool runTwoConversion)
Ensure that the Decision has at least one valid parent, unless it is a initial Decision from the HLTS...
Definition HypoBase.cxx:135
static StatusCode recursiveValidateGraph(const ElementLink< TrigCompositeUtils::DecisionContainer > &dEL, MsgStream &msg, bool onlyValidateOneStep, bool runTwoConversion, size_t callDepth, std::set< const TrigCompositeUtils::Decision * > &fullyExploredFrom)
Execute all checks on one node in the graph, d, then recursive call self on all parent nodes up to L1...
Definition HypoBase.cxx:71
static StatusCode validateHasLinks(const ElementLink< TrigCompositeUtils::DecisionContainer > &dEL, MsgStream &msg)
Ensure all Decisions have the named ElementLink graph edges which they are required to by spec.
Definition HypoBase.cxx:338
static StatusCode validateDuplicatedDecisionID(const ElementLink< TrigCompositeUtils::DecisionContainer > &dEL, MsgStream &msg)
Ensure that no space is being wasted by duplicated DecisionIDs in any Decision objects.
Definition HypoBase.cxx:229
static StatusCode validateLogicalFlow(const ElementLink< TrigCompositeUtils::DecisionContainer > &dEL, MsgStream &msg, const LogicalFlowCheckMode mode)
Ensure that all DecisionIDs have propagated correctly from their parent.
Definition HypoBase.cxx:247
const std::string & seedString()
xAOD::TrigCompositeContainer DecisionContainer

◆ renounce()

std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381 {
382 h.renounce();
384 }
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ runtimeValidation()

StatusCode HypoBase::runtimeValidation ( SG::WriteHandle< TrigCompositeUtils::DecisionContainer > & outputHandle,
MsgStream & msg,
bool onlyValidateOneStep = true,
bool runTwoConversion = false )
staticinherited

Executes all individual runtime tests.

Definition at line 47 of file HypoBase.cxx.

51{
52 // Detailed checks on the output container of this HypoAlg
53 std::set<const Decision*> fullyExploredFrom; // Cache used to avoid exploring regions of the graph more than once
54 for (const Decision* d : *outputHandle) {
55 const DecisionContainer* dContainer = dynamic_cast<const DecisionContainer*>( d->container() );
56 const ElementLink<DecisionContainer> dEL = ElementLink<DecisionContainer>(*dContainer, d->index());
57 if (not dEL.isValid()) {
58 msg << MSG::ERROR << "Invalid seed element link in recursiveValidateGraph" << endmsg;
59 return StatusCode::FAILURE;
60 }
61 // Check that we can reach L1 along all navigation paths up from each Decision
62 // and validate these Decisions on the way up too.
63 if (recursiveValidateGraph(dEL, msg, onlyValidateOneStep, runTwoConversion, 0, fullyExploredFrom).isFailure()) {
64 return StatusCode::FAILURE;
65 }
66 }
67 return StatusCode::SUCCESS;
68}

◆ selectSeedsNearby()

StatusCode TrigHitDVHypoAlg::selectSeedsNearby ( const std::vector< HitDVSeed > & hitDVSeedsContainer,
std::vector< float > & jetSeeds_eta,
std::vector< float > & jetSeeds_phi,
std::vector< float > & jetSeeds_pt ) const
private

Definition at line 892 of file TrigHitDVHypoAlg.cxx.

894{
895 std::vector<unsigned int> idx_to_delete;
896 for(unsigned int idx=0; idx<jetSeeds_eta.size(); ++idx) {
897 const float DR_SQUARED_CUT_TO_FTFSEED = 0.09; // const float DR_CUT_TO_FTFSEED = 0.3;
898 float eta = jetSeeds_eta[idx];
899 float phi = jetSeeds_phi[idx];
900 float dR2min = 9999;
901 for ( const auto& seed : hitDVSeedsContainer ) {
902 float dR2 = deltaR2(eta,phi,seed.eta,seed.phi);
903 if( dR2 < dR2min ) dR2min = dR2;
904 }
905 if( dR2min > DR_SQUARED_CUT_TO_FTFSEED ) idx_to_delete.push_back(idx);
906 }
907 if( idx_to_delete.size() > 0 ) {
908 std::sort(idx_to_delete.begin(),idx_to_delete.end());
909 for(unsigned int j=idx_to_delete.size(); j>0; j--) {
910 unsigned int idx = idx_to_delete[j-1];
911 jetSeeds_eta.erase(jetSeeds_eta.begin()+idx);
912 jetSeeds_phi.erase(jetSeeds_phi.begin()+idx);
913 if( jetSeeds_pt.size() > 0 ) jetSeeds_pt.erase(jetSeeds_pt.begin()+idx);
914 }
915 }
916 return StatusCode::SUCCESS;
917}

◆ setFilterPassed()

virtual void AthCommonAlgorithm< Gaudi::Algorithm >::setFilterPassed ( bool state,
const EventContext & ctx ) const
inlinevirtualinherited

Set filter decision:

Reimplemented in AthFilterAlgorithm.

Definition at line 99 of file AthCommonAlgorithm.h.

99 {
101 }
virtual void setFilterPassed(bool state, const EventContext &ctx) const
Set filter decision:

◆ sysExecute()

StatusCode AthCommonAlgorithm< Gaudi::Algorithm >::sysExecute ( const EventContext & ctx)
overridevirtualinherited

Execute an algorithm.

We override this in order to work around an issue with the Algorithm base class storing the event context in a member variable that can cause crashes in MT jobs.

Reimplemented in AthAnalysisAlgorithm.

Definition at line 80 of file AthCommonAlgorithm.cxx.

41{
42 return BaseAlg::sysExecute (ctx);
43}

◆ sysInitialize()

StatusCode HypoBase::sysInitialize ( )
overridevirtualinherited

initialise this base class

Reimplemented from AthCommonAlgorithm< Gaudi::Algorithm >.

Definition at line 26 of file HypoBase.cxx.

26 {
27 CHECK( AthReentrantAlgorithm::sysInitialize() ); // initialise base class
28 CHECK( m_input.initialize() );
29 ATH_MSG_DEBUG("HypoBase::sysInitialize() Will consume decision: " << m_input.key() );
30 CHECK( m_output.initialize() );
31 ATH_MSG_DEBUG("HypoBase::sysInitialize() And produce decision: " << m_output.key() );
32 return StatusCode::SUCCESS;
33}
virtual StatusCode sysInitialize() override

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::updateVHKA ( Gaudi::Details::PropertyBase & )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308 {
309 // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310 // << " size: " << m_vhka.size() << endmsg;
311 for (auto &a : m_vhka) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }

◆ validateDecisionIDs()

StatusCode HypoBase::validateDecisionIDs ( const ElementLink< TrigCompositeUtils::DecisionContainer > & dEL,
MsgStream & msg )
staticprivateinherited

Ensure that all present IDs correspond to configured chains.

Definition at line 209 of file HypoBase.cxx.

211{
212 // All numeric IDs must correspond to a know, configured, HLT chain
213 DecisionIDContainer decisionIDSet;
214 decisionIDs(*dEL, decisionIDSet);
215 for (const DecisionID id : decisionIDSet) {
216 const std::string chain = HLT::Identifier( id ).name();
217 if (!isChainId(chain) and !isLegId(chain)) {
218 printErrorHeader(dEL, msg);
219 msg << MSG::ERROR << "! Decision contains an ID which does not correspond to a configured chain or a configured chain-leg: " << HLT::Identifier( id ) << endmsg;
220 msg << MSG::ERROR << "! SOLUTION: Locate the producer of the collection, investigate how this bad ID could have been added." << endmsg;
222 return StatusCode::FAILURE;
223 }
224 }
225 return StatusCode::SUCCESS;
226}
static void printErrorHeader(const ElementLink< TrigCompositeUtils::DecisionContainer > &dEL, MsgStream &msg)
A problem was found, print common output data.
Definition HypoBase.cxx:395
bool isChainId(const HLT::Identifier &chainIdentifier)
Recognise whether the HLT identifier corresponds to a whole chain.
bool isLegId(const HLT::Identifier &legIdentifier)
Recognise whether the chain ID is a leg ID.

◆ validateDuplicatedDecisionID()

StatusCode HypoBase::validateDuplicatedDecisionID ( const ElementLink< TrigCompositeUtils::DecisionContainer > & dEL,
MsgStream & msg )
staticprivateinherited

Ensure that no space is being wasted by duplicated DecisionIDs in any Decision objects.

Definition at line 229 of file HypoBase.cxx.

231{
232 // Persistent vector storage does not guarantee against duplicate entries
233 DecisionIDContainer decisionIDSet;
234 decisionIDs(*dEL, decisionIDSet);
235 if (decisionIDSet.size() != (*dEL)->decisions().size()) {
236 printErrorHeader(dEL, msg);
237 msg << MSG::ERROR << "! Decision contains duplicate DecisionIDs." << endmsg;
238 msg << MSG::ERROR << "! SOLUTION: If combining DecisionIDs from multiple parents, de-duplicate the internal std::vector<DecisionID> of 'Decision* d' with:" << endmsg;
239 msg << MSG::ERROR << "! TrigCompositeUtils::insertDecisionIDs(DecisionIDContainer(), d);" << endmsg;
241 return StatusCode::FAILURE;
242 }
243 return StatusCode::SUCCESS;
244}

◆ validateHasLinks()

StatusCode HypoBase::validateHasLinks ( const ElementLink< TrigCompositeUtils::DecisionContainer > & dEL,
MsgStream & msg )
staticprivateinherited

Ensure all Decisions have the named ElementLink graph edges which they are required to by spec.

Definition at line 338 of file HypoBase.cxx.

340{
341 const std::string& name = (*dEL)->name();
342 if (name == hypoAlgNodeName()) {
343
344 // Check that I have a "feature"
345 if ((*dEL)->hasObjectLink( featureString() )) {
346 return StatusCode::SUCCESS;
347 }
348 printErrorHeader(dEL, msg);
349 msg << MSG::ERROR << "! Decision has no '" << featureString() << "' ElementLink." << endmsg;
350 msg << MSG::ERROR << "! Every Decision created by a HypoAlg must correspond to some physics object, and be linked to the object." << endmsg;
351 msg << MSG::ERROR << "! SOLUTION: Ensure that all produced Decision objects are assigned their feature:" << endmsg;
352 msg << MSG::ERROR << "! SOLUTION: decision->setObjectLink<MY_FEATURE_CONTANER_TYPE>(featureString(), MY_FEATURE_ELEMENT_LINK);" << endmsg;
354 return StatusCode::FAILURE;
355
356 } else if (name == inputMakerNodeName()) {
357
358 // This requirement is dropped for empty input makers to avoid unnecessary graph clutter.
359 bool exempt = false;
360 if ((*dEL)->hasDetail<int32_t>("isEmpty") and (*dEL)->getDetail<int32_t>("isEmpty") == 1) {
361 exempt = true;
362 }
363
364 if (not (*dEL)->hasObjectLink( roiString() ) and not exempt) {
365 printErrorHeader(dEL, msg);
366 msg << MSG::ERROR << "! Decision has no '" << roiString() << "' ElementLink." << endmsg;
367 msg << MSG::ERROR << "! Every Decision created by a InputMaker must link to the ROI which reconstruction will run on for that Decision object in this Step." << endmsg;
368 msg << MSG::ERROR << "! It can be the FullScan ROI created by the HLTSeeding (FSNOSEED) if no other suitable ROI exists." << endmsg;
369 msg << MSG::ERROR << "! SOLUTION: Check the configuration of InputMakerForRoI or EventViewCreatorAlgorithm responsible for creating this Decision Object" << endmsg;
370 msg << MSG::ERROR << "! SOLUTION: The algorithm must have an ROITool which must attach an '"<< roiString() <<"' link to each Decision Object" << endmsg;
372 }
373
374 } else if (name == hltSeedingNodeName()) {
375
376 if (not (*dEL)->hasObjectLink( initialRoIString() )) {
377 printErrorHeader(dEL, msg);
378 msg << MSG::ERROR << "! Decision has no '" << initialRoIString() << "' ElementLink." << endmsg;
379 msg << MSG::ERROR << "! Every Decision created by the HLTSeeding must link to the initial ROI which caused it to be created." << endmsg;
380 msg << MSG::ERROR << "! This includes the Decision Object created to represent the Full-Scan/NoSeed (FSNOSEED) ROI." << endmsg;
381 msg << MSG::ERROR << "! SOLUTION: Check the configuration of the HLTSeeding tool responsible for creating this Decision Object" << endmsg;
383 }
384
385 }
386 return StatusCode::SUCCESS;
387}
const std::string & inputMakerNodeName()
const std::string & roiString()
const std::string & featureString()
const std::string & initialRoIString()
const std::string & hltSeedingNodeName()

◆ validateLogicalFlow()

StatusCode HypoBase::validateLogicalFlow ( const ElementLink< TrigCompositeUtils::DecisionContainer > & dEL,
MsgStream & msg,
const LogicalFlowCheckMode mode )
staticprivateinherited

Ensure that all DecisionIDs have propagated correctly from their parent.

Definition at line 247 of file HypoBase.cxx.

250{
251 // Do not need to validate for L1 Decisions as these have no parents
252 if ((*dEL)->name() == hltSeedingNodeName()) {
253 return StatusCode::SUCCESS;
254 }
255
256 // Get all my passed DecisionIDs
257 DecisionIDContainer decisionIDSet;
258 decisionIDs(*dEL, decisionIDSet);
259 const std::vector<ElementLink<DecisionContainer>> seeds = (*dEL)->objectCollectionLinks<DecisionContainer>(seedString());
260 for (const DecisionID id : decisionIDSet) {
261 // For each chain that I'm passing, check how many of my parents were also passing the chain
262 size_t parentsWithDecision = 0;
263 for (const ElementLink<DecisionContainer>& seed : seeds) {
264 if ( not seed.isValid() ) {
265 msg << MSG::ERROR << "Invalid seed element link in recursiveValidateGraph" << endmsg;
266 return StatusCode::FAILURE;
267 }
268 DecisionIDContainer seedIDSet;
269 decisionIDs(*seed, seedIDSet);
270 // Id may be a chain-ID (represents a whole chain) or a leg-ID (represents just a single leg of a multi-leg chain)
271 // Is ID is in this parent's set of passed IDs?
272 // Or, (if ID is a leg-ID) is the chain-ID of leg-ID in the parent's set of passed IDs?
273 if (passed(id, seedIDSet) or passed(getIDFromLeg(id).numeric(), seedIDSet)) {
274 ++parentsWithDecision;
275 }
276 else{ // Or, for each of the seed IDs, if the seed ID is a leg-ID, is the seed chain-ID of the seed leg-ID the same as ID?
277 for (auto sid: seedIDSet){
278 if (getIDFromLeg(sid).numeric() == id){
279 ++parentsWithDecision;
280 break;
281 }
282 }
283 }
284 }
285
286 if (mode == kRequireOne && parentsWithDecision == 0) {
287 // InputMakers may merge multiple of their input collections in order to run reconstruction on a common set of ROI (for example)
288 // So the DecisionIDs may have come from any one or more of the inputs. But zero is not allowed.
289 printErrorHeader(dEL, msg);
290 msg << MSG::ERROR << "! This Decision object is not respecting logical flow of DecisionIDs for chain: " << HLT::Identifier( id ) << endmsg;
291 msg << MSG::ERROR << "! This chain's DecisionID can not be found in any parents of this Decision object:" << endmsg;
292 size_t seed_n = 0;
293 for (const ElementLink<DecisionContainer>& seed : seeds) {
294 msg << MSG::ERROR << "! Index:" << (*seed)->index() << " from collection:" << seed.dataID() << endmsg;
295 msg << MSG::ERROR << "! " << **seed << endmsg;
296 DecisionIDContainer objDecisions;
297 decisionIDs(*seed, objDecisions);
298 for (const TrigCompositeUtils::DecisionID id : objDecisions ) {
299 msg << "! --- Passing in parent #" << seed_n << ": " << HLT::Identifier( id ) << endmsg;
300 }
301 ++seed_n;
302 }
303 msg << MSG::ERROR << "! SOLUTION: Ensure that the producer of this Decision object only adds DecisionIDs"
304 " which were present in at least one of its parents." << endmsg;
306 return StatusCode::FAILURE;
307 } else if (mode == kRequireAll && parentsWithDecision != seeds.size()) {
308 // HypoAlgs may form a new physics object from multiple objects in the previous step
309 // (think a BPhysics object whose parents are two Decisions which each correspond to a different L1 MU RoI,
310 // both ROI need to be in active state for the chain, if the chain's HypoTool considers the BPhysics object)
311 // This case requires *all* of the physics objects which are being combined together to be active for the chain
312 // in order to preserve logical flow
313 printErrorHeader(dEL, msg);
314 msg << MSG::ERROR << "! This Decision object is not respecting logical flow of DecisionIDs for chain: " << HLT::Identifier( id ) << endmsg;
315 msg << MSG::ERROR << "! As this Decision object represents the output of a HypoAlg, it must respect logical flow on all "
316 << seeds.size() << " of its parent(s):" << endmsg;
317 size_t seed_n = 0;
318 for (const ElementLink<DecisionContainer>& seed : seeds) {
319 msg << MSG::ERROR << "! Index:" << (*seed)->index() << " from collection:" << seed.dataID() << endmsg;
320 msg << MSG::ERROR << "! " << **seed << endmsg;
321 DecisionIDContainer objDecisions;
322 decisionIDs(*seed, objDecisions);
323 for (const TrigCompositeUtils::DecisionID id : objDecisions ) {
324 msg << "! --- Passing in parent #" << seed_n << ": " << HLT::Identifier( id ) << endmsg;
325 }
326 ++seed_n;
327 }
328 msg << MSG::ERROR << "! SOLUTION: Ensure that the HypoTool responsible for " << HLT::Identifier( id )
329 << " in this HypoAlg only runs if this ID is present in all parent decisions." << endmsg;
331 return StatusCode::FAILURE;
332 }
333 }
334 return StatusCode::SUCCESS;
335}
HLT::Identifier getIDFromLeg(const HLT::Identifier &legIdentifier)
Generate the HLT::Identifier which corresponds to the chain name from the leg name.
bool passed(DecisionID id, const DecisionIDContainer &idSet)
checks if required decision ID is in the set of IDs in the container

◆ validateParentLinking()

StatusCode HypoBase::validateParentLinking ( const ElementLink< TrigCompositeUtils::DecisionContainer > & dEL,
MsgStream & msg,
bool runTwoConversion )
staticprivateinherited

Ensure that the Decision has at least one valid parent, unless it is a initial Decision from the HLTSeeding.

Definition at line 135 of file HypoBase.cxx.

138{
139 const std::vector<ElementLink<DecisionContainer>> seeds = (*dEL)->objectCollectionLinks<DecisionContainer>(seedString());
140 // All Decision object must have at least one parent, unless they are the initial set of objects created by the HLTSeeding
141 const std::string& name = (*dEL)->name();
142 if (seeds.size() == 0 && name != hltSeedingNodeName()) {
143 printErrorHeader(dEL, msg);
144 msg << MSG::ERROR << "! Decision has zero parents. This is only allowed for the initial Decisions created by the HLTSeeding." << endmsg;
145 msg << MSG::ERROR << "! SOLUTION: Attach parent Decision(s) with TrigCompositeUtils::linkToPrevious" << endmsg;
147 return StatusCode::FAILURE;
148 }
149
150 if (name == hltSeedingNodeName()) {
151 if (seeds.size() > 0) {
152 printErrorHeader(dEL, msg);
153 msg << MSG::ERROR << "! Decision has parents. This is not allowed for the initial Decisions created by the HLTSeeding." << endmsg;
154 msg << MSG::ERROR << "! SOLUTION: Check HLTSeeding, no where should it be adding a parent link." << endmsg;
156 return StatusCode::FAILURE;
157 }
158 return StatusCode::SUCCESS;
159 }
160
161 static const std::set<std::string> expectedParentsFilter = {hypoAlgNodeName(), comboHypoAlgNodeName(), hltSeedingNodeName()};
162 static const std::set<std::string> expectedParentsInputMaker = {filterNodeName()};
163 static const std::set<std::string> expectedParentsHypoAlg = {inputMakerNodeName()};
164 static const std::set<std::string> expectedParentsComboHypoAlg = {hypoAlgNodeName(), inputMakerNodeName(), hltSeedingNodeName()}; // TODO check hltSeedingNodeName(), needed for newJO
165 static const std::set<std::string> expectedParentsSummaryFilter = {hypoAlgNodeName(), comboHypoAlgNodeName(), hltSeedingNodeName()};
166 static const std::set<std::string> expectedParentsSummaryPassed = {summaryFilterNodeName()};
167
168 const std::set<std::string>* expectedParentsPtr = nullptr;
169 if (name == filterNodeName()) {
170 expectedParentsPtr = &expectedParentsFilter;
171 } else if (name == inputMakerNodeName() and !runTwoConversion) {
172 expectedParentsPtr = &expectedParentsInputMaker;
173 } else if (name == inputMakerNodeName() and runTwoConversion) {
174 expectedParentsPtr = &expectedParentsFilter; // We don't have Filter nodes in the R2->R3 conversion
175 } else if (name == hypoAlgNodeName()) {
176 expectedParentsPtr = &expectedParentsHypoAlg;
177 } else if (name == comboHypoAlgNodeName()) {
178 expectedParentsPtr = &expectedParentsComboHypoAlg;
179 } else if (name == summaryFilterNodeName()) {
180 expectedParentsPtr = &expectedParentsSummaryFilter;
181 } else if (name == summaryPassNodeName()) {
182 expectedParentsPtr = &expectedParentsSummaryPassed;
183 } else {
184 printErrorHeader(dEL, msg);
185 msg << MSG::ERROR << "! Invalid Node name '" << name << "'." << endmsg;
186 msg << MSG::ERROR << "! SOLUTION: Find the alg which made a node with this name. Allowed named may be found in TrigCompositeUtils.h, See:'Constant string literals used within the HLT'." << endmsg;
188 return StatusCode::FAILURE;
189 }
190
191 for (const ElementLink<DecisionContainer>& seed : seeds) {
192 if (!expectedParentsPtr->contains( (*seed)->name() )) {
193 printErrorHeader(dEL, msg);
194 msg << MSG::ERROR << "! Invalid linking from node with name '" << name << "' to one with name '"<< (*seed)->name() << "'." << endmsg;
195 msg << MSG::ERROR << "! Allowed seed names are:" << endmsg;
196 for (const std::string& allowed : *expectedParentsPtr) {
197 msg << MSG::ERROR << "! " << allowed << endmsg;
198 }
199 msg << MSG::ERROR << "! SOLUTION: Find where this invalid parent was added and correct it." << endmsg;
201 return StatusCode::FAILURE;
202 }
203 }
204
205 return StatusCode::SUCCESS;
206}
const std::string & summaryFilterNodeName()
const std::string & filterNodeName()
const std::string & comboHypoAlgNodeName()
const std::string & summaryPassNodeName()

Member Data Documentation

◆ m_bdt_eta

std::unique_ptr<MVAUtils::BDT> TrigHitDVHypoAlg::m_bdt_eta[2]
private

Definition at line 112 of file TrigHitDVHypoAlg.h.

◆ m_beamSpotKey

SG::ReadCondHandleKey<InDet::BeamSpotData> TrigHitDVHypoAlg::m_beamSpotKey { this, "BeamSpotKey", "BeamSpotData", "SG key for beam spot" }
private

Definition at line 125 of file TrigHitDVHypoAlg.h.

125{ this, "BeamSpotKey", "BeamSpotData", "SG key for beam spot" };

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default).

Definition at line 393 of file AthCommonDataStore.h.

◆ m_doHitDV_Seeding

bool TrigHitDVHypoAlg::m_doHitDV_Seeding = true
private

Definition at line 122 of file TrigHitDVHypoAlg.h.

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default).

Definition at line 390 of file AthCommonDataStore.h.

◆ m_extendedExtraObjects

DataObjIDColl AthCommonAlgorithm< Gaudi::Algorithm >::m_extendedExtraObjects
privateinherited

Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks.

Empty if no symlinks were found.

Definition at line 108 of file AthCommonAlgorithm.h.

◆ m_hitDVKey

SG::WriteHandleKey<xAOD::TrigCompositeContainer> TrigHitDVHypoAlg::m_hitDVKey {this, "HitDV", "HLT_HitDV", ""}
private

Definition at line 78 of file TrigHitDVHypoAlg.h.

78{this, "HitDV", "HLT_HitDV", ""};

◆ m_hitDVLinkName

Gaudi::Property<std::string> TrigHitDVHypoAlg::m_hitDVLinkName {this, "hitDVLinkName", "HitDVSeedLink", "Name of the link to HitDVContainer. Used by ViewCreatorROITool."}
private

Definition at line 91 of file TrigHitDVHypoAlg.h.

91{this, "hitDVLinkName", "HitDVSeedLink", "Name of the link to HitDVContainer. Used by ViewCreatorROITool."};

◆ m_hypoTools

ToolHandleArray< TrigHitDVHypoTool > TrigHitDVHypoAlg::m_hypoTools {this, "HypoTools", {}, "Tools to perform selection"}
private

Definition at line 74 of file TrigHitDVHypoAlg.h.

74{this, "HypoTools", {}, "Tools to perform selection"};

◆ m_input

SG::ReadHandleKey<TrigCompositeUtils::DecisionContainer> HypoBase::m_input { this, "HypoInputDecisions", "UNSPECIFIED_INPUT", "Input Decision (implicit)" }
privateinherited

input decisions

Definition at line 101 of file HypoBase.h.

101{ this, "HypoInputDecisions", "UNSPECIFIED_INPUT", "Input Decision (implicit)" };

◆ m_isMC

Gaudi::Property<bool> TrigHitDVHypoAlg::m_isMC {this, "isMC", false, "Real data or MC"}
private

Definition at line 86 of file TrigHitDVHypoAlg.h.

86{this, "isMC", false, "Real data or MC"};

◆ m_jetRoiCollectionKey

SG::ReadHandleKey<xAOD::jFexSRJetRoIContainer> TrigHitDVHypoAlg::m_jetRoiCollectionKey {this, "jFexSRJetRoI", "", ""}
private

Definition at line 124 of file TrigHitDVHypoAlg.h.

124{this, "jFexSRJetRoI", "", ""};

◆ m_jetSeed_etaMax

Gaudi::Property<float> TrigHitDVHypoAlg::m_jetSeed_etaMax {this, "jetSeed_etaMin", 2.0, "Maximum eta for jet seed"}
private

Definition at line 89 of file TrigHitDVHypoAlg.h.

89{this, "jetSeed_etaMin", 2.0, "Maximum eta for jet seed"};

◆ m_jetSeed_ptMin

Gaudi::Property<float> TrigHitDVHypoAlg::m_jetSeed_ptMin {this, "jetSeed_ptMin", 50.0, "Minimum pT for jet seed"}
private

Definition at line 88 of file TrigHitDVHypoAlg.h.

88{this, "jetSeed_ptMin", 50.0, "Minimum pT for jet seed"};

◆ m_jetsKey

SG::ReadHandleKey< xAOD::JetContainer > TrigHitDVHypoAlg::m_jetsKey {this, "Jets", "HLT_AntiKt4EMTopoJets_subjesIS", ""}
private

Definition at line 77 of file TrigHitDVHypoAlg.h.

77{this, "Jets", "HLT_AntiKt4EMTopoJets_subjesIS", ""};

◆ m_lumiBlockMuTool

ToolHandle<ILumiBlockMuTool> TrigHitDVHypoAlg::m_lumiBlockMuTool
private

Definition at line 82 of file TrigHitDVHypoAlg.h.

◆ m_lumiDataKey

SG::ReadCondHandleKey<LuminosityCondData> TrigHitDVHypoAlg::m_lumiDataKey {this, "LuminosityCondDataKey", "LuminosityCondData", ""}
private

Definition at line 84 of file TrigHitDVHypoAlg.h.

84{this, "LuminosityCondDataKey", "LuminosityCondData", ""};

◆ m_monTool

ToolHandle<GenericMonitoringTool> TrigHitDVHypoAlg::m_monTool { this, "MonTool", "", "Monitoring tool" }
private

Definition at line 97 of file TrigHitDVHypoAlg.h.

97{ this, "MonTool", "", "Monitoring tool" };

◆ m_output

SG::WriteHandleKey<TrigCompositeUtils::DecisionContainer> HypoBase::m_output { this, "HypoOutputDecisions", "UNSPECIFIED_OUTPUT", "Ouput Decision" }
privateinherited

output decisions

Definition at line 103 of file HypoBase.h.

103{ this, "HypoOutputDecisions", "UNSPECIFIED_OUTPUT", "Ouput Decision" };

◆ m_runtimeValidation

Gaudi::Property<bool> HypoBase::m_runtimeValidation { this, "RuntimeValidation", false, "Enable detailed runtime validation of HypoAlg output, and upstream Decisions." }
privateinherited

Enabling of detailed validation checks for use during development.

Definition at line 105 of file HypoBase.h.

105{ this, "RuntimeValidation", false, "Enable detailed runtime validation of HypoAlg output, and upstream Decisions." };

◆ m_spacePointTool

ToolHandle<ITrigSpacePointConversionTool> TrigHitDVHypoAlg::m_spacePointTool {this, "SpacePointProviderTool", "TrigSpacePointConversionTool"}
private

Definition at line 73 of file TrigHitDVHypoAlg.h.

73{this, "SpacePointProviderTool", "TrigSpacePointConversionTool"};

◆ m_tools_loosest_wp

int TrigHitDVHypoAlg::m_tools_loosest_wp = 0
private

Definition at line 116 of file TrigHitDVHypoAlg.h.

◆ m_tools_lowest_jetEt

int TrigHitDVHypoAlg::m_tools_lowest_jetEt = 1000
private

Definition at line 115 of file TrigHitDVHypoAlg.h.

◆ m_tracksKey

SG::ReadHandleKey< TrackCollection> TrigHitDVHypoAlg::m_tracksKey {this, "HitDVTracks", "HLT_IDTrkTrack_FS_FTF", ""}
private

Definition at line 79 of file TrigHitDVHypoAlg.h.

79{this, "HitDVTracks", "HLT_IDTrkTrack_FS_FTF", ""};

◆ m_useBeamSpot

bool TrigHitDVHypoAlg::m_useBeamSpot = true
private

Definition at line 119 of file TrigHitDVHypoAlg.h.

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.


The documentation for this class was generated from the following files: