ATLAS Offline Software
Loading...
Searching...
No Matches
TrigEgammaMatchingToolMTTest.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3*/
4
5
8
9
10using namespace TrigCompositeUtils;
11
12
13
14TrigEgammaMatchingToolMTTest::TrigEgammaMatchingToolMTTest(const std::string& name, ISvcLocator* pSvcLocator )
15 : AthMonitorAlgorithm( name, pSvcLocator ),
16 m_trigdec("Trig::TrigDecisionTool/TrigDecisionTool"),
17 m_matchTool("Trig::TrigEgammaMatchingTool/TrigEgammaMatchingToolMT",this)
18
19{
20 declareProperty("TrigEgammaMatchingToolMT",m_matchTool);
21 declareProperty("TriggerList",m_triggerList);
22}
23
24
25
26//**********************************************************************
27
29
30 ATH_MSG_INFO("Initializing " << name() << "...");
31
32 ATH_CHECK( m_trigdec.retrieve() );
33 ATH_CHECK( m_matchTool.retrieve());
34 ATH_CHECK(m_electronKey.initialize());
35
36
37
38 return StatusCode::SUCCESS;
39}
40
41
42
43//**********************************************************************
44
45void TrigEgammaMatchingToolMTTest::inspect(const std::string& trigger,const xAOD::Egamma *eg) const {
46
47 if (eg) {
48
49 ATH_MSG_INFO("Getting all associated objects for " << trigger);
50
51 const TrigCompositeUtils::Decision *dec=nullptr;
52
53 m_matchTool->match( eg, trigger , dec);
54
55 if ( dec )
56 {
57 ATH_MSG_INFO( "Matched!");
58
59
60 auto l1_link = m_matchTool->getFeature<TrigRoiDescriptorCollection>(dec, trigger);
61 auto emCluster_link = m_matchTool->getFeature<xAOD::TrigEMClusterContainer>( dec , trigger);
62 auto trig_el_links = m_matchTool->getFeatures<xAOD::TrigElectronContainer>( dec, trigger );
63 auto cl_links = m_matchTool->getFeatures<xAOD::CaloClusterContainer>( dec , trigger);
64 auto el_links = m_matchTool->getFeatures<xAOD::ElectronContainer>( dec , trigger);
65
66 if( l1_link.isValid() ){
67 ATH_MSG_INFO( "We found the Roi object link" );
68 // Let's get the EMTau
69 auto l1 = m_matchTool->getL1Feature( l1_link.source );
70 if(l1)
71 ATH_MSG_INFO( "We found the EmTau object" );
72 ATH_MSG_INFO( "L1 object state is assigned as " << (l1_link.state==ActiveState::ACTIVE ? "Active" : "Not active") );
73 }
74
75 if( emCluster_link.isValid() ){
76 ATH_MSG_INFO( "We found the EmCluster object link" );
77 ATH_MSG_INFO( "L2Calo object state is assigned as " << (emCluster_link.state==ActiveState::ACTIVE ? "Active" : "Not active") );
78 }
79
80 if (trig_el_links.size() > 0){
81 ATH_MSG_INFO ( "We found " << trig_el_links.size() << " TrigElectron link objects for this decision souce." );
82 for ( auto featLinkInfo : trig_el_links ){
83 ATH_MSG_INFO( "L2Electron object state is assigned as " << (featLinkInfo.state==ActiveState::ACTIVE ? "Active" : "Not active") );
84 }
85 }
86
87 if (cl_links.size() > 0){
88 ATH_MSG_INFO ( "We found " << cl_links.size() << " CaloCluster link objects for this decision souce." );
89 for ( auto featLinkInfo : cl_links ){
90 ATH_MSG_INFO( "EFCalo object state is assigned as " << (featLinkInfo.state==ActiveState::ACTIVE ? "Active" : "Not active") );
91 }
92 }
93
94 if (el_links.size() > 0){
95 ATH_MSG_INFO ( "We found " << el_links.size() << " CaloCluster link objects for this decision souce." );
96 for ( auto featLinkInfo : el_links ){
97 ATH_MSG_INFO( "EFCalo object state is assigned as " << (featLinkInfo.state==ActiveState::ACTIVE ? "Active" : "Not active") );
98 }
99 }
100
101
102 bool passedHLT = m_matchTool->ancestorPassed<xAOD::ElectronContainer> (dec, trigger , "HLT_egamma_Electrons");
103 bool passedEFCalo = m_matchTool->ancestorPassed<xAOD::CaloClusterContainer> (dec, trigger , "HLT_CaloEMClusters");
104 bool passedL2 = m_matchTool->ancestorPassed<xAOD::TrigElectronContainer> (dec, trigger , "HLT_FastElectrons");
105 bool passedL2Calo = m_matchTool->ancestorPassed<xAOD::TrigEMClusterContainer> (dec, trigger , "HLT_FastCaloEMClusters");
106 bool passedL1Calo = m_matchTool->ancestorPassed<TrigRoiDescriptorCollection> (dec, trigger , "initialRois");
107
108 ATH_MSG_INFO( "L1Calo passed : "<< passedL1Calo );
109 ATH_MSG_INFO( "L2Calo passed : "<< passedL2Calo );
110 ATH_MSG_INFO( "L2 passed : "<< passedL2 );
111 ATH_MSG_INFO( "EFCalo passed : "<< passedEFCalo );
112 ATH_MSG_INFO( "HLT passed : "<< passedHLT );
113
114 }else{
115 ATH_MSG_INFO( "Not Matched! There is no Dec object for this trigger " << trigger );
116 }
117
118 }
119 else ATH_MSG_INFO("REGTEST: eg pointer null!");
120}
121
122
123//**********************************************************************
124
125StatusCode TrigEgammaMatchingToolMTTest::fillHistograms( const EventContext& ctx ) const {
126
127 ATH_MSG_INFO ("Fill histograms " << name() << "...");
128
129
131
132 if( !el_cont.isValid() ){
133 ATH_MSG_WARNING("Container "<< m_electronKey << " does not exist or is empty");
134 return StatusCode::SUCCESS;
135 }
136
137
138 ATH_MSG_INFO("Offline Electron container size " << el_cont->size());
139
140 for(const auto &trigger : m_triggerList){
141 for(const auto eg : *el_cont){
142 ATH_MSG_INFO("REGTEST:: Electron offline (eta="<<eg->eta()<<",phi="<<eg->phi()<<")");
143 inspect(trigger,eg);
144
145 } //End loop of offline electrons
146 } // End loop over trigger list
147
148
149
150 return StatusCode::SUCCESS;
151} // End execute
152
153
154
155
156
157
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_INFO(x)
#define ATH_MSG_WARNING(x)
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
AthMonitorAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
size_type size() const noexcept
Returns the number of elements in the collection.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
TrigEgammaMatchingToolMTTest(const std::string &name, ISvcLocator *pSvcLocator)
virtual StatusCode fillHistograms(const EventContext &ctx) const override
adds event to the monitoring histograms
void inspect(const std::string &, const xAOD::Egamma *) const
SG::ReadHandleKey< xAOD::ElectronContainer > m_electronKey
virtual StatusCode initialize() override
initialize
ToolHandle< TrigEgammaMatchingToolMT > m_matchTool
ToolHandle< Trig::TrigDecisionTool > m_trigdec
std::vector< std::string > m_triggerList
@ ACTIVE
The link was still active for one-or-more of the HLT Chains requested in the TDT.
Definition ActiveState.h:20
TrigElectronContainer_v1 TrigElectronContainer
Declare the latest version of the container.
ElectronContainer_v1 ElectronContainer
Definition of the current "electron container version".
TrigEMClusterContainer_v1 TrigEMClusterContainer
Define the latest version of the trigger EM cluster container.
Egamma_v1 Egamma
Definition of the current "egamma version".
Definition Egamma.h:17
CaloClusterContainer_v1 CaloClusterContainer
Define the latest version of the calorimeter cluster container.