39 static const double GeV = 1000.0;
52 ATH_MSG_INFO(
"Inputs from LVL1 Calo systems switched off" );
55 ATH_MSG_INFO(
"Inputs from LVL1 Muon systems switched off" );
94 return StatusCode::SUCCESS;
104 if (!roibResult.isValid()) {
106 return StatusCode::FAILURE;
121 return StatusCode::SUCCESS;
125 const EventContext& ctx )
const {
131 auto emtau_xaod = std::make_unique< xAOD::EmTauRoIContainer >();
132 auto emtau_aux = std::make_unique< xAOD::EmTauRoIAuxContainer >();
133 emtau_xaod->setStore( emtau_aux.get() );
136 std::map< int, std::string > emThresholdNames;
137 std::map< int, std::string > tauThresholdNames;
141 float caloTrigScale =
static_cast<float>(l1menu->thrExtraInfo().EM().resolutionMeV());
142 for(
const auto& thr : l1menu->thresholds(
"EM")) {
143 emThresholdNames[ thr->mapping() ] = thr->name();
145 for(
const auto& thr : l1menu->thresholds(
"TAU")) {
146 tauThresholdNames[ thr->mapping() ] = thr->name();
154 if (cpmTower.isValid()) {
155 m_emTauTool->mapTowers( cpmTower.cptr(), &cpmtowers );
166 uint32_t roIWord = emtRoI.roIWord();
168 << std::setw( 8 ) << roIWord << MSG::dec );
175 double roiPhi = recRoI.
phi();
176 if( roiPhi >
M_PI ) roiPhi -= 2 *
M_PI;
179 emtau_xaod->push_back( roi );
185 std::unique_ptr< std::vector< unsigned int > > thrV( recRoI.
thresholdsPassed() );
186 for(
unsigned int thr : *thrV ) {
189 auto emNameItr = emThresholdNames.find( thr );
190 auto tauNameItr = tauThresholdNames.find( thr );
191 std::string thrName =
"NameNotFound";
193 ( emNameItr != emThresholdNames.end() ) ) {
194 thrName = emNameItr->second;
197 ( tauNameItr != tauThresholdNames.end() ) ) {
198 thrName = tauNameItr->second;
203 ATH_MSG_DEBUG(
"EmTau Thr : " << thr <<
", name = " << thrName
204 <<
", value = " << thrValue );
222 ATH_CHECK( emtauRoI.record( std::move( emtau_xaod ),
223 std::move( emtau_aux ) ) );
226 return StatusCode::SUCCESS;
231 const EventContext& ctx )
const {
236 auto jet_xaod = std::make_unique< xAOD::JetRoIContainer >();
237 auto jet_aux = std::make_unique< xAOD::JetRoIAuxContainer >();
238 jet_xaod->setStore( jet_aux.get() );
240 auto esum_xaod = std::make_unique< xAOD::EnergySumRoI >();
241 auto esum_aux = std::make_unique< xAOD::EnergySumRoIAuxInfo >();
242 esum_xaod->setStore( esum_aux.get() );
244 auto jetet_xaod = std::make_unique< xAOD::JetEtRoI >();
245 auto jetet_aux = std::make_unique< xAOD::JetEtRoIAuxInfo >();
246 jetet_xaod->setStore( jetet_aux.get() );
252 float caloTrigScale =
static_cast<float>(l1menu->thrExtraInfo().JET().resolutionMeV());
256 std::map<int, std::string> jetNames;
257 std::map<int, std::string> jfNames;
258 std::map<int, std::string> jbNames;
259 std::map<int, std::string> xeNames;
260 std::map<int, std::string> teNames;
261 std::map<int, std::string> xsNames;
262 std::map<int, std::string> jeNames;
263 for(
const auto& thr : l1menu->thresholds(
"JET")) {
264 jetNames[ thr->mapping() ] = thr->name();
266 for(
const auto& thr : l1menu->thresholds(
"XE")) {
267 xeNames[ thr->mapping() ] = thr->name();
269 for(
const auto& thr : l1menu->thresholds(
"TE")) {
270 teNames[ thr->mapping() ] = thr->name();
272 for(
const auto& thr : l1menu->thresholds(
"XS")) {
273 xsNames[ thr->mapping() ] = thr->name();
278 std::map< int, LVL1::JetInput* > jetInputs;
281 if (jetElement.isValid()) {
282 m_jetTool->mapJetInputs( jetElement.cptr(), &jetInputs );
287 std::vector< std::unique_ptr< LVL1::JetInput > > jetInputsHolder;
288 for(
auto pair : jetInputs ) {
289 jetInputsHolder.emplace_back(
pair.second );
294 auto itJET = jeteResult.roIVec().begin();
295 auto endJET = jeteResult.roIVec().end();
296 for( ; itJET != endJET; ++itJET ) {
298 const uint32_t roIWord = itJET->roIWord();
300 ATH_MSG_DEBUG(
"Jet RoI, RoIWord = " << MSG::hex << std::setw( 8 )
301 << roIWord << MSG::dec );
305 const int roiType = conv.roiType( roIWord );
314 double roiPhi = recRoI.
phi();
315 if( roiPhi >
M_PI ) roiPhi -= 2 *
M_PI;
318 jet_xaod->push_back( roi );
327 auto jetNameItr = jetNames.find( thr );
328 auto jfNameItr = jfNames.find( thr );
329 auto jbNameItr = jbNames.find( thr );
330 std::string thrName =
"NameNotFound";
332 if( jetNameItr != jetNames.end() ) {
333 thrName = jetNameItr->second;
336 else if( recRoI.
eta() > 0 ) {
337 if( jfNameItr != jfNames.end() ) {
338 thrName = jfNameItr->second;
342 if( jbNameItr != jbNames.end() ) {
343 thrName = jbNameItr->second;
350 <<
", value = " << thrValue );
366 jetet_xaod->setRoIWord( roIWord );
369 for(
unsigned int i = 0;
371 if( ( roIWord >> i ) & 0x1 ) {
372 std::string thrName =
"NameNotFound";
373 if (jeNames.find(i) != jeNames.end()) thrName = jeNames[i];
374 jetet_xaod->addThreshold( thrName );
384 const uint32_t roiWord0 = roIWord;
385 ATH_MSG_DEBUG(
"ET RoIWord 0 : " << MSG::hex << std::setw( 8 )
386 << roiWord0 << MSG::dec );
388 const uint32_t roiWord1 = itJET->roIWord();
389 ATH_MSG_DEBUG(
"ET RoIWord 1 : " << MSG::hex << std::setw( 8 )
390 << roiWord1 << MSG::dec );
392 const uint32_t roiWord2 = itJET->roIWord();
393 ATH_MSG_DEBUG(
"ET RoIWord 2 : " << MSG::hex << std::setw( 8 )
394 << roiWord2 << MSG::dec );
400 esum_xaod->initialize( roiWord0, roiWord1, roiWord2,
401 recRoI.
energyX() * caloTrigScale,
402 recRoI.
energyY() * caloTrigScale,
403 recRoI.
energyT() * caloTrigScale );
407 auto xeNameItr = xeNames.find( thr - 1 );
408 const std::string thrName = ( xeNameItr != xeNames.end() ?
411 esum_xaod->addThreshold( thrName );
417 auto teNameItr = teNames.find( thr - 1 );
418 const std::string thrName = ( teNameItr != teNames.end() ?
421 esum_xaod->addThreshold( thrName );
427 auto xsNameItr = xsNames.find( thr - 1 );
428 const std::string thrName = ( xsNameItr != xsNames.end() ?
431 esum_xaod->addThreshold( thrName );
440 ATH_CHECK( jetRoI.record( std::move( jet_xaod ), std::move( jet_aux ) ) );
443 ATH_CHECK( jetetRoI.record( std::move( jetet_xaod ),
444 std::move( jetet_aux ) ) );
447 ATH_CHECK( energysumRoI.record( std::move( esum_xaod ),
448 std::move( esum_aux ) ) );
451 return StatusCode::SUCCESS;
455 const EventContext& ctx )
const {
463 auto mu_xaod = std::make_unique< xAOD::MuonRoIContainer >();
464 auto mu_aux = std::make_unique< xAOD::MuonRoIAuxContainer >();
465 mu_xaod->setStore( mu_aux.get() );
468 std::vector< TrigConf::TriggerThreshold* > muonThresholds;
469 std::map< int, std::string > thresholdNames;
470 for(
const auto& thr : l1menu->thresholds(
"MU")) {
471 thresholdNames[ thr->mapping() ] = thr->name();
475 const std::vector< ROIB::MuCTPIRoI >& muonRoIV =
476 result.muCTPIResult().roIVec();
482 uint32_t roIWord = roi.roIWord();
491 auto thrNameItr = thresholdNames.find(
index );
492 const std::string thrName = ( thrNameItr != thresholdNames.end() ?
497 mu_xaod->push_back( xaod_roi );
501 ATH_MSG_DEBUG(
"Muon Thr : " << thrName <<
", value = " << thrValue );
506 ATH_CHECK( muonRoI.record( std::move( mu_xaod ), std::move( mu_aux ) ) );
509 return StatusCode::SUCCESS;
#define ATH_CHECK
Evaluate an expression and check for errors.
Handle class for reading from StoreGate.
Handle class for recording to StoreGate.
const ServiceHandle< StoreGateSvc > & detStore() const
An algorithm that can be simultaneously executed in multiple threads.
This is an internal class, used in the EM/Tau trigger.
int CoreET()
Additional information for reconstruction & performance studies.
int HadIsolET()
Returns Had isolation ET.
int EMClusET()
Returns EM cluster ET, limited to 8 bits.
int TauClusET()
Returns Tau cluster ET, limited to 8 bits.
int HadCoreET()
Returns Had core ET (inner isolation sum)
int EMIsolET()
Returns EM isolation ET.
This is an internal class, used in the jet trigger.
int ET4x4()
Returns 4x4 TT cluster ET.
int ET8x8()
Returns 8x8 TT cluster ET.
int ET6x6()
Returns 6x6 TT cluster ET.
A level 1 calorimeter trigger conversion service: returns the Coordinate represented by a RoI word.
This class defines the reconstructed em/tau hadron ROI.
virtual double eta() const
returns eta coord of ROI
TrigT1CaloDefs::ClusterAlgorithm thresholdType(unsigned int thresh) const
returns the type of the threshold, which is either EMAlg or TauAlg.
unsigned int triggerThreshold(unsigned int thresh) const
returns the value of the trigger threshold for the threshold passed.
unsigned int thresholdPattern() const
returns bitmask of passed thresholds
virtual double phi() const
returns phi coord of ROI
std::vector< unsigned int > * thresholdsPassed() const
returns a vector of thresholds passed.
This class defines the reconstructed EnergySum ROI.
std::vector< unsigned int > etMissThresholdsPassed() const
returns a vector of thresholds passed.
int energyY() const
returns the (signed) Ey energy projection.
int energyT() const
returns the total ET.
std::vector< unsigned int > sumEtThresholdsPassed() const
returns a vector of thresholds passed.
int energyX() const
returns the (signed) Ex energy projection.
std::vector< unsigned int > mEtSigThresholdsPassed() const
returns a vector of thresholds passed.
This class defines the reconstructed em/tau hadron ROI.
unsigned int triggerThreshold(unsigned int thresh) const
returns the value of the trigger threshold for the threshold passed.
virtual double eta() const
returns eta coord of ROI
std::vector< unsigned int > thresholdsPassed() const
returns a vector of thresholds passed.
virtual double phi() const
returns phi coord of ROI
unsigned int thresholdPattern() const
returns bitmask of passed thresholds
bool isForwardJet() const
returns true if the RoI is a forward jet RoI.
This class defines the reconstructed Muon ROI.
virtual double eta() const
returns eta coord of ROI
virtual double phi() const
returns phi coord of ROI
unsigned int getThresholdNumber() const
returns the Threshold Number (1 to 6) associated with this RecRoI
unsigned int getThresholdValue() const
returns the Threshold Value (in GeV) associated with this RecRoI
static const unsigned int numOfJetEtSumThresholds
Class for storing the 32-bit muon RoI word.
Class holding the LVL1 RoIB result build by the RoIBuilder.
SG::ReadHandleKey< xAOD::CPMTowerContainer > m_cpmTowerKey
Read key for the xAOD::CPMTowerContainer object.
RoIBResultToxAOD(const std::string &name, ISvcLocator *svcLoc)
Algorithm constructor.
ToolHandle< LVL1::IL1JEMJetTools > m_jetTool
Tool for calculation of Jet cluster sums per RoI.
ToolHandle< LVL1::ITrigT1MuonRecRoiTool > m_recRPCRoiTool
The RPC RoI reconstruction tool.
ToolHandle< LVL1::ITrigT1MuonRecRoiTool > m_recTGCRoiTool
The TGC RoI reconstruction service.
Gaudi::Property< bool > m_doMuon
Use inputs from the Muon system.
StatusCode createMuonRoI(const ROIB::RoIBResult &roib, const EventContext &ctx) const
Create the Muon RoI objects.
StatusCode createJetEnergyRoI(const ROIB::RoIBResult &roib, const EventContext &ctx) const
Create the JetEnergy RoI object.
SG::WriteHandleKey< xAOD::JetRoIContainer > m_jetRoIKey
Write key for the xAOD::JetRoIContainer object.
StatusCode createEmTauRoI(const ROIB::RoIBResult &roib, const EventContext &ctx) const
Create the EmTau RoI objects.
SG::ReadHandleKey< ROIB::RoIBResult > m_roibResultKey
Read key for the ROIB::RoIBResult object.
SG::WriteHandleKey< xAOD::EnergySumRoI > m_energysumRoIKey
Write key for the xAOD::EnergySumRoI object.
SG::WriteHandleKey< xAOD::MuonRoIContainer > m_muonRoIKey
Write key for the xAOD::MuonRoIContainer object.
virtual StatusCode initialize() override
Function initialising the algorithm.
SG::WriteHandleKey< xAOD::JetEtRoI > m_jetetRoIKey
Write key for the xAOD::JetEtRoI object.
SG::WriteHandleKey< xAOD::EmTauRoIContainer > m_emtauRoIKey
Write key for the xAOD::EmTauRoIContainer object.
SG::ReadHandleKey< xAOD::JetElementContainer > m_jetElementKey
Read key for the xAOD::JetElementContainer object.
virtual StatusCode execute(const EventContext &ctx) const override
Function executing the algorithm.
Gaudi::Property< bool > m_doCalo
ToolHandle< LVL1::IL1CPMTools > m_emTauTool
Tool for calculation of EmTau trigger sums per RoI.
void addThreshold(const std::string &name, float value)
Add a new threshold that was passed by the RoI.
void setTauClus(float value)
Set the deposited ET from the "tau cluster".
void setCore(float value)
Set the ET of the RoI Core cluster (2x2 towers, EM+Had)
void setHadCore(float value)
Set the ET deposited in the inner hadronic isolation region.
void setEtScale(float v)
Set the ET scale.
void setEmClus(float value)
Set the deposited ET from the "EM cluster".
void initialize(uint32_t roiword, float eta, float phi)
Initialise the object with its most important properties.
void setEmIsol(float value)
Set the EM calorimeter isolation (outer ring of EM towers)
void setThrPattern(uint32_t value)
Set the threshold pattern.
void setHadIsol(float value)
Set the hadron calorimeter isolation (outer ring of had towers)
void setEt8x8(float value)
Set the energy deposited in a 0.8x0.8 area around the RoI.
void setEt6x6(float value)
Set the energy deposited in a 0.6x0.6 area around the RoI.
void addThreshold(const std::string &name, float value)
Add a new threshold that was passed by the RoI.
void setEtScale(float value)
Set the ET scale for RoI digits.
void initialize(uint32_t roiword, float eta, float phi)
Initialise the object with its most important properties.
void setEt4x4(float value)
Set the energy deposited in a 0.4x0.4 area around the RoI.
void setThrPattern(uint32_t value)
Set the threshold pattern.
void initialize(uint32_t roiword, float eta, float phi, const std::string &thrname, float thrvalue, uint32_t extraword=0u)
Initialise the object with all its properties.
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
std::map< int, const CPMTower * > CPMTowerMap_t