diff --git a/Trigger/TrigConfiguration/TrigConfL1Data/Root/CTPConfig.cxx b/Trigger/TrigConfiguration/TrigConfL1Data/Root/CTPConfig.cxx index 041014a9c6c0963d735ea60c10e2d31db1049e40..42e1b9442ebd449fda78158c038aa36890fe3030 100644 --- a/Trigger/TrigConfiguration/TrigConfL1Data/Root/CTPConfig.cxx +++ b/Trigger/TrigConfiguration/TrigConfL1Data/Root/CTPConfig.cxx @@ -135,8 +135,8 @@ CTPConfig::writeXML(std::ostream & xmlfile, int indentLevel, int indentWidth) co pss.writeXML(xmlfile, indentLevel, indentWidth); } } - menu().writeXMLThresholds(xmlfile, indentLevel, indentWidth); menu().writeXMLMonCounters(xmlfile, indentLevel, indentWidth); + menu().writeXMLThresholds(xmlfile, indentLevel, indentWidth); random().writeXML(xmlfile, indentLevel, indentWidth); bunchGroupSet().writeXML(xmlfile, indentLevel, indentWidth); prescaledClock().writeXML(xmlfile, indentLevel, indentWidth); diff --git a/Trigger/TrigConfiguration/TrigConfL1Data/Root/TriggerItem.cxx b/Trigger/TrigConfiguration/TrigConfL1Data/Root/TriggerItem.cxx index b318091012365e61febbd8f6a02fc75d37c2184a..d633e0496812cbbe58f3060fbee707a188910903 100644 --- a/Trigger/TrigConfiguration/TrigConfL1Data/Root/TriggerItem.cxx +++ b/Trigger/TrigConfiguration/TrigConfL1Data/Root/TriggerItem.cxx @@ -124,7 +124,7 @@ TriggerItem::writeXML(std::ostream & xmlfile, int indentLevel, int indentWidth) << "\" complex_deadtime=\"" << complex_deadtime() << "\" definition=\"" << final_def << "\" trigger_type=\"" << TrigConf::uint2bin(m_TriggerType, partition()==1 ? 8 : 4) << "\""; - if(monitor()!=0) { + if(monitor()<0x40) { string s("LF:"); s += (monitor() & 0x04 ? '1' : '0'); s += (monitor() & 0x02 ? '1' : '0'); diff --git a/Trigger/TrigConfiguration/TrigConfL1Data/Root/TriggerThreshold.cxx b/Trigger/TrigConfiguration/TrigConfL1Data/Root/TriggerThreshold.cxx index de8daf7b6c2c4c911ffd68d95cd9ed897ee9ace2..f56c0a2adb1b4717f26e66ae0be0d9a5e09d79c5 100644 --- a/Trigger/TrigConfiguration/TrigConfL1Data/Root/TriggerThreshold.cxx +++ b/Trigger/TrigConfiguration/TrigConfL1Data/Root/TriggerThreshold.cxx @@ -226,6 +226,10 @@ TrigConf::TriggerThreshold::writeXML(std::ostream & xmlfile, int indentLevel, in << "\" seed_multi=\"" << m_ZBSeedingThresholdMulti << "\" bcdelay=\"" << m_BCDelay; + if(run()==3) { + xmlfile << "\" run=\"" << run(); + } + xmlfile << "\" version=\"" << version() <<"\">" << endl; auto sortedThresholdValues = m_TriggerThresholdValueVector; diff --git a/Trigger/TrigConfiguration/TrigConfL1Data/TrigConfL1Data/TriggerThreshold.h b/Trigger/TrigConfiguration/TrigConfL1Data/TrigConfL1Data/TriggerThreshold.h index 22ffd13dc0ef2eb11a218d7f8065ac6a704bdd93..f990b186a11566b234cbbeafe239b87a0250791f 100644 --- a/Trigger/TrigConfiguration/TrigConfL1Data/TrigConfL1Data/TriggerThreshold.h +++ b/Trigger/TrigConfiguration/TrigConfL1Data/TrigConfL1Data/TriggerThreshold.h @@ -44,6 +44,7 @@ namespace TrigConf { int bcDelay() const { return m_BCDelay; } unsigned int bitnum() const { return m_Bitnum; } const std::string& input() const { return m_Input; } + unsigned int run() const { return m_run; } // setters void setType (L1DataDef::TriggerType type); @@ -62,6 +63,7 @@ namespace TrigConf { void setBCDelay (int bcdelay) { m_BCDelay = bcdelay; } void setBitnum (unsigned int bitnum) { m_Bitnum = bitnum; } void setInput (const std::string& input); + void setRun (unsigned int run) { m_run = run; } // is internal threshold bool isInternal() const; @@ -96,6 +98,7 @@ namespace TrigConf { int m_BCDelay{3564}; unsigned int m_Bitnum{1}; std::string m_Input{"ctpin"}; + unsigned int m_run{2}; // run can be 2 or 3 to distinguish between old and new thresholds }; } diff --git a/Trigger/TrigSteer/TrigSteering/CMakeLists.txt b/Trigger/TrigSteer/TrigSteering/CMakeLists.txt index b78c2db2807533947248237bc3a99091520c5735..c6357780b5f0c66b779b13ee5913c47f9206fd86 100644 --- a/Trigger/TrigSteer/TrigSteering/CMakeLists.txt +++ b/Trigger/TrigSteer/TrigSteering/CMakeLists.txt @@ -40,7 +40,8 @@ atlas_depends_on_subdirs( PUBLIC Trigger/TrigSteer/TrigInterfaces Trigger/TrigT1/L1Topo/L1TopoCommon Trigger/TrigT1/L1Topo/L1TopoConfig - Trigger/TrigT1/TrigT1Interfaces ) + Trigger/TrigT1/TrigT1Interfaces + Trigger/TrigT1/TrigT1CaloUtils ) # External dependencies: find_package( Boost COMPONENTS filesystem thread system ) @@ -59,7 +60,7 @@ atlas_add_library( TrigSteeringLib PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${TDAQ-COMMON_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} PRIVATE_DEFINITIONS ${CLHEP_DEFINITIONS} LINK_LIBRARIES AthenaBaseComps AthenaKernel DataModel EventInfo xAODEventInfo GaudiKernel TrigConfBase TrigConfHLTData TrigSteeringEvent L1TopoAlgorithms L1TopoCoreSim L1TopoEvent TrigT1CaloToolInterfaces TrigT1Result AthenaMonitoringLib StoreGateLib SGtests TrigROBDataProviderSvcLib L1TopoSimulationLib TrigT1CaloEventLib TrigTimeAlgsLib ByteStreamCnvSvcBaseLib TrigSerializeResultLib TrigNavigationLib TrigMonitorBaseLib TrigInterfacesLib - PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} ${Boost_LIBRARIES} ${TDAQ-COMMON_LIBRARIES} ${CLHEP_LIBRARIES} TestTools xAODTrigger TrigConfL1Data TrigStorageDefinitions L1TopoCommon L1TopoConfig TrigT1Interfaces ) + PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} ${Boost_LIBRARIES} ${TDAQ-COMMON_LIBRARIES} ${CLHEP_LIBRARIES} TestTools xAODTrigger TrigConfL1Data TrigStorageDefinitions L1TopoCommon L1TopoConfig TrigT1Interfaces TrigT1CaloUtils ) atlas_add_component( TrigSteering src/components/*.cxx diff --git a/Trigger/TrigSteer/TrigSteering/TrigSteering/Lvl1Converter.h b/Trigger/TrigSteer/TrigSteering/TrigSteering/Lvl1Converter.h index a303037c6705ee4a3f12c95fe2ef008c9f18491a..9b1efc5c2019d775c4607e86ad96681dfcbbce4b 100755 --- a/Trigger/TrigSteer/TrigSteering/TrigSteering/Lvl1Converter.h +++ b/Trigger/TrigSteer/TrigSteering/TrigSteering/Lvl1Converter.h @@ -26,6 +26,13 @@ #include "TrigConfInterfaces/ILVL1ConfigSvc.h" #include "TrigSteering/Lvl1ConsistencyChecker.h" +#include "xAODTrigger/JetRoIContainer.h" +#include "xAODTrigger/EnergySumRoI.h" +#include "xAODTrigger/MuonRoIContainer.h" +#include "xAODTrigCalo/TrigEMClusterContainer.h" +#include "xAODTrigger/EmTauRoIContainer.h" + + // forward declarations class ITrigTimerSvc; class TrigTimer; @@ -78,7 +85,7 @@ namespace HLT { bool m_doTiming; //!< do timing measurements ? bool m_gotL1Config; //!< retrieve of Lvl1ConfigSvc pointer successful? bool m_ignoreL1Prescales; //!< ignores L1 prescales (takes But Before Prescale) - + bool m_useRun3FEXOutput; //!< uses ROIBResult and Run3 FEX algo output for creating thresholds unsigned m_overallRoIsLimit; //!< limit above which the event is considered busy unsigned m_jetRoIsLimit; //!< limit above which the event is considered busy @@ -93,6 +100,31 @@ namespace HLT { const LVL1::RecMuonRoiSvc* m_recRPCRoiSvc; //!< Muon RoI svc const LVL1::RecMuonRoiSvc* m_recTGCRoiSvc; //!< Muon RoI svc + // Inputs from the new L1Calo + // gFEX + const DataHandle< xAOD::EnergySumRoI > m_gFEXMETPufit; //!< MET from gFEX + const DataHandle< xAOD::EnergySumRoI > m_gFEXMETRho; //!< MET from gFEX + const DataHandle< xAOD::EnergySumRoI > m_gFEXMETJwoJ; //!< MET from gFEX + const DataHandle< xAOD::JetRoIContainer > m_gJet; //!< jets from gFEX + + // eFEX + const DataHandle< xAOD::TrigEMClusterContainer > m_eFEXCluster; //!< cluster from eFEX + const DataHandle< xAOD::EmTauRoIContainer > m_eFEXTau; //!< taus from eFEX + + // jFEX + const DataHandle< xAOD::JetRoIContainer > m_jJet; //!< jets from jFEX + const DataHandle< xAOD::JetRoIContainer > m_jLJet; //!< large jets from jFEX + + // new FEX collections + StringProperty m_gFEXMETPufitLoc {"gXEPUFIT_MET"}; + StringProperty m_gFEXMETRhoLoc {"gXERHO_MET"}; + StringProperty m_gFEXMETJwoJLoc {"gXEJWOJ_MET"}; + StringProperty m_gJetLoc {"gL1Jets"}; + StringProperty m_jJetLoc {"jRoundJets"}; + StringProperty m_jLJetLoc {"jRoundLargeRJets"}; + StringProperty m_eFEXClusterLoc {"SClusterCl"}; + StringProperty m_eFEXTauLoc {"SClusterTau"}; + ITrigTimerSvc* m_timerSvc; //!< the service with all the timers TrigTimer* m_totalTime; //!< total time of execution of this algo TrigTimer* m_sgTime; //!< StoreGate time diff --git a/Trigger/TrigSteer/TrigSteering/TrigSteering/Lvl1ItemsAndRoIs.h b/Trigger/TrigSteer/TrigSteering/TrigSteering/Lvl1ItemsAndRoIs.h index e650d379cf601e4670af0c084e961a2cc23323c1..14301aff9ca8038a517011c453ba613f252da54c 100644 --- a/Trigger/TrigSteer/TrigSteering/TrigSteering/Lvl1ItemsAndRoIs.h +++ b/Trigger/TrigSteer/TrigSteering/TrigSteering/Lvl1ItemsAndRoIs.h @@ -40,19 +40,19 @@ namespace HLT { Generic structure representing one LVL1 threshold which is used in all LVL1 RoIs */ struct ConfigThreshold { - ConfigThreshold(std::string n = "", unsigned int h=0, bool a = false, uint32_t m = 0) + ConfigThreshold(std::string n = "", unsigned int h=0, bool a = false, unsigned long int m = 0) : name(n), hashId(h), activeHLT(a), mask(m) { } std::string name; //!< threshold name, e.g. EM25i unsigned int hashId; //!< hash number of name, to speed up internal usage bool activeHLT; //!< is this LVL1 threshold used in HLT ? - uint32_t mask; //!< bit position of this LVL1 threshold in the RoI word + unsigned long int mask; //!< bit position of this LVL1 threshold in the RoI word }; /** @struct modifed ConfigThreshold to incorporate the JetEnergy type */ struct ConfigJetEThreshold : public ConfigThreshold { - ConfigJetEThreshold(std::string n = "", unsigned int h=0, bool a = false, uint32_t m = 0, JetRoIType t = Unknown) + ConfigJetEThreshold(std::string n = "", unsigned int h=0, bool a = false, unsigned long m = 0, JetRoIType t = Unknown) : ConfigThreshold(n, h, a, m), type(t) { } JetRoIType type; //!< JetEnergy type, see JetRoIType enumeration }; @@ -70,15 +70,15 @@ namespace HLT { std::vector::const_iterator begin() const { return m_thresholds.begin(); } //!< begin() method - for thresholds std::vector::const_iterator end() const { return m_thresholds.end(); } //!< end() method - for thresholds unsigned int size() const { return m_thresholds.size(); } //!< size() method - for thresholds - unsigned int thresholdMask() const { return m_thresholdMask; } + unsigned long int thresholdMask() const { return m_thresholdMask; } protected: void addThreshold(const ConfigThreshold* t) { m_thresholds.push_back(t); } //!< add threshold to this RoI object - void setThresholdMask(unsigned int mask) { m_thresholdMask = mask; } // Update threshold mask word + void setThresholdMask(unsigned long int mask) { m_thresholdMask = mask; } // Update threshold mask word R m_lvl1RoI; //!< underlying LVL1 RoI object std::vector m_thresholds; //!< vector holding all configured thresholds - unsigned int m_thresholdMask; + unsigned long int m_thresholdMask; }; diff --git a/Trigger/TrigSteer/TrigSteering/TrigSteering/Lvl1ResultAccessTool.h b/Trigger/TrigSteer/TrigSteering/TrigSteering/Lvl1ResultAccessTool.h index 49919ba0c435b0664174445ef4605fcd506bcf40..85ffb2d5a3ce63c2c4ac2eddd5e5db4c01985645 100755 --- a/Trigger/TrigSteer/TrigSteering/TrigSteering/Lvl1ResultAccessTool.h +++ b/Trigger/TrigSteer/TrigSteering/TrigSteering/Lvl1ResultAccessTool.h @@ -30,6 +30,13 @@ #include #include #include +#include + +#include "xAODTrigger/JetRoIContainer.h" +#include "xAODTrigger/EnergySumRoI.h" +#include "xAODTrigger/MuonRoIContainer.h" +#include "xAODTrigCalo/TrigEMClusterContainer.h" +#include "xAODTrigger/EmTauRoIContainer.h" // forward declarations namespace TrigConf { @@ -86,7 +93,16 @@ namespace HLT { virtual const std::vector< MuonRoI >& createMuonThresholds(const ROIB::RoIBResult& result) = 0; virtual const std::vector< EMTauRoI >& createEMTauThresholds(const ROIB::RoIBResult& result, bool updateCaloRoIs=false) = 0; + virtual const std::vector< EMTauRoI >& createEMTauThresholds(const ROIB::RoIBResult& result, + const xAOD::TrigEMClusterContainer& emROIs, + const xAOD::EmTauRoIContainer& tauROIs, + bool updateCaloRoIs=false) = 0; virtual const std::vector< JetEnergyRoI >& createJetEnergyThresholds(const ROIB::RoIBResult& result, bool updateCaloRoIs) = 0; + virtual const std::vector< JetEnergyRoI >& createJetEnergyThresholds(const ROIB::RoIBResult& result, + const std::vector & jetContainers, + const std::vector & jetThresholdFilters, + const std::vector & metROIs, + const std::vector & metThresholdFilters) = 0; virtual std::bitset<3> lvl1EMTauJetOverflow(const ROIB::RoIBResult& result) = 0; @@ -213,6 +229,18 @@ namespace HLT { */ const std::vector< EMTauRoI >& createEMTauThresholds(const ROIB::RoIBResult& result, bool updateCaloRoIs=false); + /** @brief Extract LVL1 EMTau-type RoIs and cache them internally + * @param result reference to RoIBResult object, holding all LVL1 RoIs and items + * @param emROIs reference to EM ROI container, holding LVL1 EM RoIs from eFEX + * @param tauROIs reference to TAU ROI container, holding LVL1 TAU RoIs from eFEX + * + * @return reference to vector holding all EMTau-RoI objects + */ + const std::vector< EMTauRoI >& createEMTauThresholds(const ROIB::RoIBResult& result, + const xAOD::TrigEMClusterContainer& emROIs, + const xAOD::EmTauRoIContainer& tauROIs, + bool updateCaloRoIs=false); + /** @brief Extract LVL1 JetEnergy-type RoIs and cache them internally * @param result reference to RoIBResul object, holding all LVL1 RoIs and items * @@ -220,6 +248,20 @@ namespace HLT { */ const std::vector< JetEnergyRoI >& createJetEnergyThresholds(const ROIB::RoIBResult& result, bool updateCaloRoIs=false); + /** @brief Extract LVL1 JetEnergy-type RoIs and cache them internally + * @param result reference to RoIBResul object, holding all LVL1 RoIs and items + * @param jJetROIs reference to jet ROI container, holding LVL1 jet RoIs from jFEX + * @param jLJetROIs reference to jet ROI container, holding LVL1 large_R jet RoIs from jFEX + * @param gJetROIs reference to jet ROI container, holding LVL1 jet RoIs from gFEX + * + * @return reference to vector holding all JetEnergy-RoI objects + */ + const std::vector< JetEnergyRoI >& createJetEnergyThresholds(const ROIB::RoIBResult& result, + const std::vector & jetContainers, + const std::vector & jetThresholdFilters, + const std::vector & metROIs, + const std::vector & metThresholdFilters); + /** @brief Check if there was an overflow in the TOB transmission to CMX * @param result reference to RoIBResul object * @@ -279,11 +321,20 @@ namespace HLT { std::vector< ConfigThreshold > m_tauCfg; //!< vector holding all configured LVL1 TAU thresholds std::vector< ConfigJetEThreshold > m_jetCfg; //!< vector holding all configured LVL1 jet thresholds - std::vector m_emtauThresholds; - std::vector m_jetThresholds; + std::map m_metThrCuts; //! map to look up MET threshold by name + + std::vector m_emtauThresholdsRun2; + std::vector m_emtauThresholdsRun3; + std::vector m_jetThresholdsRun2; + std::vector m_jetThresholdsRun3; bool addJetThreshold( HLT::JetEnergyRoI & roi, const ConfigJetEThreshold* threshold ); bool addMetThreshold( HLT::JetEnergyRoI & roi, const ConfigJetEThreshold* threshold, bool isRestrictedRange ); + + /** + * @brief helper function to add a MET threshold to an JetEnergyRoI if it passes the threshold energy cut + */ + bool addMetThreshold( HLT::JetEnergyRoI & roi, const ConfigJetEThreshold * thr, unsigned int thrVal); ServiceHandle m_lvl1ConfigSvc; //!< handle for the LVL1 configuration service }; diff --git a/Trigger/TrigSteer/TrigSteering/src/Lvl1Converter.cxx b/Trigger/TrigSteer/TrigSteering/src/Lvl1Converter.cxx index e6165404553d3f4cac5b6618244d05fa70f1478a..b4e45898ce7c239f4bcb8ddf5b1db3fbf0db6f21 100755 --- a/Trigger/TrigSteer/TrigSteering/src/Lvl1Converter.cxx +++ b/Trigger/TrigSteer/TrigSteering/src/Lvl1Converter.cxx @@ -80,11 +80,14 @@ Lvl1Converter::Lvl1Converter(const std::string& name, const std::string& type, declareProperty( "muonRoIsLimit", m_muonRoIsLimit = 0, "Return failure (specific one) if number of MU RoIs > that. 0 means no limit." ); declareProperty( "ignoreL1Prescales", m_ignoreL1Prescales=false, "If true L1 prescales are ignored (takes But Before Prescale)"); + declareProperty( "useRun3FEXOutput", m_useRun3FEXOutput=false, "Extracts ROIs with thresholds from ROIBResult and from L1Calo Run3 containers" ); } ErrorCode Lvl1Converter::hltInitialize() { - + + ATH_MSG_INFO("Setup to use Run 3 input TOBs : " << (m_useRun3FEXOutput ? "yes" : "no") ); + // retrieve Lvl1ResultAccessTool : // StatusCode sc = toolSvc()->retrieveTool("HLT::Lvl1ResultAccessTool", m_lvl1Tool); @@ -179,8 +182,8 @@ ErrorCode Lvl1Converter::hltExecute(std::vector& chainsToRu // ============================================================= if(m_doTiming) m_sgTime->start(); - const ROIB::RoIBResult* result; - StatusCode sc = evtStore()->retrieve(result); + const ROIB::RoIBResult* result = nullptr; + StatusCode sc = evtStore()->retrieve(result); // always needed for creation of L1Items if(sc.isFailure()){ ATH_MSG_WARNING("Unable to retrieve RoIBResult from storeGate!"); @@ -192,7 +195,61 @@ ErrorCode Lvl1Converter::hltExecute(std::vector& chainsToRu return HLT::ErrorCode(HLT::Action::ABORT_EVENT, HLT::Reason::USERDEF_1, HLT::SteeringInternalReason::NO_LVL1_RESULT); } - // m_lvl1Tool->updateResult(*result, m_updateCaloRoIs);// is done in each step .. + if ( m_useRun3FEXOutput ) { + // MET + sc = evtStore()->retrieve( m_gFEXMETPufit, m_gFEXMETPufitLoc ); + if(sc.isFailure()){ + ATH_MSG_WARNING("Unable to retrieve gFEX MET '" << m_gFEXMETPufitLoc << "' from storeGate!"); + } else { + ATH_MSG_DEBUG( "Retrieved gFEX MET '" << m_gFEXMETPufitLoc << "'"); + } + sc = evtStore()->retrieve( m_gFEXMETRho, m_gFEXMETRhoLoc ); + if(sc.isFailure()){ + ATH_MSG_WARNING("Unable to retrieve gFEX MET '" << m_gFEXMETRhoLoc << "' from storeGate!"); + } else { + ATH_MSG_DEBUG( "Retrieved gFEX MET '" << m_gFEXMETRhoLoc << "'"); + } + sc = evtStore()->retrieve( m_gFEXMETJwoJ, m_gFEXMETJwoJLoc ); + if(sc.isFailure()){ + ATH_MSG_WARNING("Unable to retrieve gFEX MET '" << m_gFEXMETJwoJLoc << "' from storeGate!"); + } else { + ATH_MSG_DEBUG( "Retrieved gFEX MET '" << m_gFEXMETJwoJLoc << "'"); + } + // jets + sc = evtStore()->retrieve( m_jJet, m_jJetLoc); + if(sc.isFailure()){ + ATH_MSG_WARNING("Unable to retrieve jFEX Jet container '" << m_jJetLoc << "' from storeGate!"); + } else { + ATH_MSG_DEBUG( "Retrieved jFEX Jet container '" << m_jJetLoc << "' with size " << m_jJet->size()); + } + sc = evtStore()->retrieve( m_jLJet, m_jLJetLoc); + if(sc.isFailure()){ + ATH_MSG_WARNING("Unable to retrieve jFEX large-R Jet container '" << m_jLJetLoc << "' from storeGate!"); + } else { + ATH_MSG_DEBUG( "Retrieved jFEX large-R Jet container '" << m_jLJetLoc << "' with size " << m_jLJet->size()); + } + sc = evtStore()->retrieve( m_gJet, m_gJetLoc); + if(sc.isFailure()){ + ATH_MSG_WARNING("Unable to retrieve gFEX Jet container '" << m_gJetLoc << "' from storeGate!"); + } else { + ATH_MSG_DEBUG( "Retrieved gFEX Jet container '" << m_gJetLoc << "' with size " << m_gJet->size()); + } + // em clusters + sc = evtStore()->retrieve( m_eFEXCluster, m_eFEXClusterLoc); + if(sc.isFailure()){ + ATH_MSG_WARNING("Unable to retrieve eFEX em cluster container '" << m_eFEXClusterLoc << "' from storeGate!"); + } else { + ATH_MSG_DEBUG( "Retrieved eFEX em cluster container '" << m_eFEXClusterLoc << "' with size " << m_eFEXCluster->size()); + } + // taus + sc = evtStore()->retrieve( m_eFEXTau, m_eFEXTauLoc); + if(sc.isFailure()){ + ATH_MSG_WARNING("Unable to retrieve eFEX em tau container '" << m_eFEXTauLoc << "' from storeGate!"); + } else { + ATH_MSG_DEBUG( "Retrieved eFEX em tau container '" << m_eFEXTauLoc << "' with size " << m_eFEXTau->size()); + } + } + unsigned int l1Id = m_config->getLvl1Id(); if(m_doTiming) m_sgTime->stop(); @@ -367,7 +424,9 @@ ErrorCode Lvl1Converter::hltExecute(std::vector& chainsToRu // reconstruct RoIs ATH_MSG_DEBUG("EmTau RoIs"); - const std::vector< HLT::EMTauRoI >& emTauRoIs = m_lvl1Tool->createEMTauThresholds(*result, m_updateCaloRoIs); + const std::vector< HLT::EMTauRoI >& emTauRoIs = m_useRun3FEXOutput ? + m_lvl1Tool->createEMTauThresholds(*result, *m_eFEXCluster, *m_eFEXTau, m_updateCaloRoIs) : + m_lvl1Tool->createEMTauThresholds(*result, m_updateCaloRoIs); for (std::vector< HLT::EMTauRoI >::const_iterator emTauRoI = emTauRoIs.begin(); emTauRoI != emTauRoIs.end(); ++emTauRoI) { @@ -447,8 +506,17 @@ ErrorCode Lvl1Converter::hltExecute(std::vector& chainsToRu // reconstruct RoIs ATH_MSG_DEBUG("JetEnergy RoIs"); + const std::vector & jetContainers = { &*m_jJet, &*m_jLJet, &*m_gJet }; + const std::vector & jetThresholdFilters = {"jJ", "jLJ", "gJ"}; + const std::vector & metROIs = { &*m_gFEXMETPufit, &*m_gFEXMETRho, &*m_gFEXMETJwoJ }; + const std::vector & metThresholdFilters = { "gXEPUFIT", "gXERHO", "gXEJWOJ" }; + + const std::vector< HLT::JetEnergyRoI >& jetERoIs = m_useRun3FEXOutput ? + m_lvl1Tool->createJetEnergyThresholds(*result, + jetContainers, jetThresholdFilters, + metROIs, metThresholdFilters ) : + m_lvl1Tool->createJetEnergyThresholds(*result, m_updateCaloRoIs); - const std::vector< HLT::JetEnergyRoI >& jetERoIs = m_lvl1Tool->createJetEnergyThresholds(*result, m_updateCaloRoIs); unsigned jetRoIsCount = 0; for ( std::vector< HLT::JetEnergyRoI >::const_iterator jetERoI = jetERoIs.begin(); diff --git a/Trigger/TrigSteer/TrigSteering/src/Lvl1ResultAccessTool.cxx b/Trigger/TrigSteer/TrigSteering/src/Lvl1ResultAccessTool.cxx index 2f7f428789d6cd1c012e179bcd34ad9201435863..9f3bdbea9496e3f6c65967ba3112f2f320d65491 100755 --- a/Trigger/TrigSteer/TrigSteering/src/Lvl1ResultAccessTool.cxx +++ b/Trigger/TrigSteer/TrigSteering/src/Lvl1ResultAccessTool.cxx @@ -28,8 +28,8 @@ #include "TrigT1Interfaces/RecEmTauRoI.h" #include "TrigT1Interfaces/RecJetRoI.h" #include "TrigT1Interfaces/TrigT1CaloDefs.h" - - +#include "TrigT1Interfaces/Coordinate.h" +#include "TrigT1CaloUtils/CoordToHardware.h" #include "TrigConfInterfaces/ILVL1ConfigSvc.h" #include "TrigConfL1Data/CTPConfig.h" #include "TrigConfL1Data/ThresholdConfig.h" @@ -241,7 +241,8 @@ StatusCode Lvl1ResultAccessTool::updateConfig( bool useL1Muon, bool useL1Calo, m_useL1Calo = false; // care about calo RoIs in execute only if at least one calo TriggerElement is used in HLT ! m_emCfg.clear(); m_tauCfg.clear(); - m_emtauThresholds.clear(); + m_emtauThresholdsRun2.clear(); + m_emtauThresholdsRun3.clear(); for( L1DataDef::TriggerType caloType : vector{ L1DataDef::EM, L1DataDef::TAU} ) { @@ -250,8 +251,11 @@ StatusCode Lvl1ResultAccessTool::updateConfig( bool useL1Muon, bool useL1Calo, if (clusterTT == nullptr) continue; // Needed to find thresholds passed by Run 2 RoI - m_emtauThresholds.push_back(clusterTT); - + if ( clusterTT->name()[0]=='e' ) { + m_emtauThresholdsRun3.push_back(clusterTT); + } else { + m_emtauThresholdsRun2.push_back(clusterTT); + } ATH_MSG_DEBUG("Searching TE that matches LVL1 EM/TAU threshold: " << clusterTT->name()); unsigned int teId = 0; @@ -293,13 +297,21 @@ StatusCode Lvl1ResultAccessTool::updateConfig( bool useL1Muon, bool useL1Calo, m_useL1JetEnergy = false;// care about jetEnergy RoIs in execute only if at least one jetEnergy TriggerElement is used in HLT ! m_jetCfg.clear(); - + m_jetThresholdsRun2.clear(); + m_jetThresholdsRun3.clear(); + // In case we need to calculate thresholds passed: copy jet thresholds into vector RecJetRoI can use - m_jetThresholds = thresholdConfig->getJetThresholdVector(); + for( TrigConf::TriggerThreshold * thr : thresholdConfig->getJetThresholdVector() ) { + if ( thr->name()[0]=='J' ) { + m_jetThresholdsRun2.push_back(thr); + } else { + m_jetThresholdsRun3.push_back(thr); + } + } for (TrigConf::TriggerThreshold* fwdThr : thresholdConfig->getFJetThresholdVector() ) - m_jetThresholds.push_back(fwdThr); + m_jetThresholdsRun2.push_back(fwdThr); - // Jet threholds: + // Jet thresholds: for(const TrigConf::TriggerThreshold * thr : thresholdConfig->getJetThresholdVector() ) { ATH_MSG_DEBUG("Searching TE that matches LVL1 JET threshold: " << thr->name()); @@ -318,7 +330,7 @@ StatusCode Lvl1ResultAccessTool::updateConfig( bool useL1Muon, bool useL1Calo, if (tn < 0) { ATH_MSG_WARNING("this LVL1 threshold bit position (" << tn << ") is smaller 0, go on w/o this threshold!"); } else { - uint32_t mask= 0x1 << tn; // 8 bits in Run 1, up to 25 in Run 2 + unsigned long int mask= 0x1L << tn; // 8 bits in Run 1, up to 25 in Run 2, many more (>32) in Run 3 ATH_MSG_DEBUG("thresholdNumber = " << tn << " .. mask = 0x" << hex << setw( 8 ) << setfill( '0' ) << mask << dec); m_jetCfg.push_back( ConfigJetEThreshold( thr->name(), teId, activeHLT, mask, JetRoI) ); m_useL1JetEnergy = true; @@ -460,6 +472,15 @@ StatusCode Lvl1ResultAccessTool::updateConfig( bool useL1Muon, bool useL1Calo, m_useL1JetEnergy = true; } } + + // build map to look up MET/TE cut value from threshold name + for( auto & listOfThrVec : { thresholdConfig->getMissEtVector(), thresholdConfig->getTotEtVector()} ) { + for(const TrigConf::TriggerThreshold * thr : listOfThrVec ) { + const TrigConf::TriggerThresholdValue * thrV = thr->triggerThresholdValue( 0, 0 ); + m_metThrCuts[thr->name()] = thrV->ptcut(); + } + } + } // end of Jet/Energy part ATH_MSG_DEBUG(" Initialize done"); @@ -745,8 +766,8 @@ const std::vector< EMTauRoI >& Lvl1ResultAccessTool::createEMTauThresholds(const if (m_useL1Calo) { // reconstruct RoIs - ATH_MSG_DEBUG("Looking for EMTau RoIs"); - ATH_MSG_DEBUG("----------------------"); + ATH_MSG_DEBUG("Looking for EMTau RoIs in ROIB::EMTauResult"); + ATH_MSG_DEBUG("-------------------------------------------"); std::map, int> emRoI, tau; // (crate,module) : count @@ -769,7 +790,7 @@ const std::vector< EMTauRoI >& Lvl1ResultAccessTool::createEMTauThresholds(const // Set threshold bits in a way that work for Run 1 or Run 2 - LVL1::RecEmTauRoI recRoI( roIWord, &m_emtauThresholds ); + LVL1::RecEmTauRoI recRoI( roIWord, &m_emtauThresholdsRun2 ); roi.setThresholdMask(recRoI.thresholdPattern()); ATH_MSG_DEBUG("RoI word: 0x" << MSG::hex << std::setw(8) << roIWord << ", threshold pattern " << roi.thresholdMask() << MSG::dec); @@ -783,7 +804,7 @@ const std::vector< EMTauRoI >& Lvl1ResultAccessTool::createEMTauThresholds(const roi.addThreshold( &(*threshold) ); - ATH_MSG_DEBUG("creating EM Theshold: " << threshold->name); + ATH_MSG_DEBUG("creating EM threshold: " << threshold->name << " for Run 2 EM RoI"); } } if (recRoI.roiType() == LVL1::TrigT1CaloDefs::TauRoIWordType || recRoI.roiType() == LVL1::TrigT1CaloDefs::CpRoIWordType) { @@ -795,7 +816,7 @@ const std::vector< EMTauRoI >& Lvl1ResultAccessTool::createEMTauThresholds(const roi.addThreshold( &(*threshold) ); - ATH_MSG_DEBUG("creating TAU Theshold: " << threshold->name); + ATH_MSG_DEBUG("creating TAU threshold: " << threshold->name << " for Run 2 TAU RoI"); } } m_emTauRoIs.push_back(roi); @@ -805,6 +826,118 @@ const std::vector< EMTauRoI >& Lvl1ResultAccessTool::createEMTauThresholds(const return m_emTauRoIs; } +const std::vector< EMTauRoI >& +Lvl1ResultAccessTool::createEMTauThresholds(const ROIB::RoIBResult& result, + const xAOD::TrigEMClusterContainer& emROIs, + const xAOD::EmTauRoIContainer& tauROIs, + bool updateCaloRoIs) +{ + createEMTauThresholds(result, updateCaloRoIs); + + if (! m_useL1Calo) { + return m_emTauRoIs; + } + + ATH_MSG_DEBUG("Looking for EMTau RoIs in xAOD::TrigEMClusterContainer and xAOD::EmTauRoIContainer"); + ATH_MSG_DEBUG("----------------------------------------------------------------------------------"); + + for ( const auto & tau : tauROIs ) { + + const static SG::AuxElement::ConstAccessor accR3ClET ("R3ClusterET"); + //const static SG::AuxElement::ConstAccessor accR3ClIso ("R3ClusterIso"); + + float eT = accR3ClET(*tau); // tau eT in MeV + //float iso = accR3ClIso(*tau); + double eta = tau->eta(); + double phi = tau->phi(); + if ( phi < 0 ) phi += 2*M_PI; + if ( phi >= 2*M_PI ) phi -= 2*M_PI; + + uint32_t roiword(0); + // type + roiword += LVL1::TrigT1CaloDefs::TauRoIWord << 28; // TauRoIWord = 1011 + // location + LVL1::Coordinate coord(phi, eta); + LVL1::CoordToHardware converter; + unsigned int cpCoord = converter.cpCoordinateWord(coord); + roiword += cpCoord << 16; + // isolation + uint32_t isolation = 0x1f; // until resolved, set all 5 isolation bits to agree with CTPEmulation + roiword += isolation << 8; + // energy + unsigned int eTCounts = (unsigned int) (eT/500.); // 1 count is 500MeV in Run 2, tau eT is in MeV + roiword += eTCounts<256 ? eTCounts : 255; // energy is 8 bits => limit 255 + + HLT::EMTauRoI roi = HLT::EMTauRoI( ROIB::EMTauRoI(roiword) ); + + LVL1::RecEmTauRoI recRoI( roiword, &m_emtauThresholdsRun3 ); + roi.setThresholdMask(recRoI.thresholdPattern()); + + ATH_MSG_DEBUG("Tau RoI word: 0x" << MSG::hex << std::setw(8) << roiword << ", threshold pattern 0x" << roi.thresholdMask() << MSG::dec); + + for ( const ConfigThreshold & threshold : m_tauCfg) { + + // check whether this LVL1 threshold is used by HLT: + if ( !(threshold.mask & roi.thresholdMask()) ) continue; + + roi.addThreshold( &threshold ); + + ATH_MSG_DEBUG( "adding TAU threshold " << threshold.name + << " to Run 3 TAU ROI (eFEX) with counts=" << eTCounts + << " and eta=" << eta); + } + + m_emTauRoIs.push_back(roi); + } + + for ( const auto & cl : emROIs ) { + + double eT = cl->et(); // cluster eT in GeV + double eta = cl->eta(); + double phi = cl->phi(); + if ( phi < 0 ) phi += 2*M_PI; + if ( phi >= 2*M_PI ) phi -= 2*M_PI; + + uint32_t roiword(0); + // type + roiword += LVL1::TrigT1CaloDefs::EMRoIWord << 28; // EMRoIWord = 1010 + // location + LVL1::Coordinate coord(phi, eta); + LVL1::CoordToHardware converter; + unsigned int cpCoord = converter.cpCoordinateWord(coord); + roiword += cpCoord << 16; + // isolation + uint32_t isolation = 0x1f; // until resolved, set all 5 isolation bits to agree with CTPEmulation + roiword += isolation << 8; + // energy + unsigned int eTCounts = (unsigned int) (2*eT); // 1 count is 500MeV in Run 2, em eT is in GeV + roiword += eTCounts<256 ? eTCounts : 255; // energy is 8 bits => limit 255 + + HLT::EMTauRoI roi = HLT::EMTauRoI( ROIB::EMTauRoI(roiword) ); + + LVL1::RecEmTauRoI recRoI( roiword, &m_emtauThresholdsRun3 ); + roi.setThresholdMask(recRoI.thresholdPattern()); + + ATH_MSG_DEBUG("EM RoI word: 0x" << MSG::hex << std::setw(8) << roiword << ", threshold pattern " << roi.thresholdMask() << MSG::dec); + + for ( const ConfigThreshold & threshold : m_emCfg) { + + // check whether this LVL1 threshold is used by HLT: + if ( !(threshold.mask & roi.thresholdMask()) ) continue; + + roi.addThreshold( &threshold ); + + ATH_MSG_DEBUG("creating EM threshold: " << threshold.name << " for Run 3 EM ROI (eFEX) " << eTCounts); + } + + m_emTauRoIs.push_back(roi); + } + return m_emTauRoIs; +} + + + + // ============================== @@ -846,7 +979,7 @@ const std::vector< JetEnergyRoI >& Lvl1ResultAccessTool::createJetEnergyThreshol unsigned int etSumType = itJetEn->etSumType(); - ATH_MSG_DEBUG("RoI word: 0x" << std::hex << std::setw( 8 ) << std::setfill( '0' ) << roIWord << std::dec); + ATH_MSG_DEBUG("Run 2 RoI word: 0x" << std::hex << std::setw( 8 ) << std::setfill( '0' ) << roIWord << std::dec); // RoI Type LVL1::TrigT1CaloDefs::RoIType roiType = m_jepDecoder->roiType(roIWord); @@ -869,7 +1002,7 @@ const std::vector< JetEnergyRoI >& Lvl1ResultAccessTool::createJetEnergyThreshol return m_jetRoIs; } - ATH_MSG_DEBUG( "RoI triplet = 0x" << std::hex << std::setw( 8 ) << std::setfill( '0' ) + ATH_MSG_DEBUG( "Run 2 RoI triplet = 0x" << std::hex << std::setw( 8 ) << std::setfill( '0' ) << roIWord << " 0x" << roIWord1 << " 0x" << roIWord2 << std::dec); } else if ( roiType == LVL1::TrigT1CaloDefs::JetRoIWordType ) { @@ -877,10 +1010,10 @@ const std::vector< JetEnergyRoI >& Lvl1ResultAccessTool::createJetEnergyThreshol // For Jet RoIs, fill thresholdMask word, used later for setting Configured Thresholds // Do it here so that it only needs to be done once/RoI - LVL1::RecJetRoI recRoI( roIWord, &m_jetThresholds ); + LVL1::RecJetRoI recRoI( roIWord, &m_jetThresholdsRun2 ); roi.setThresholdMask(recRoI.thresholdPattern()); - ATH_MSG_DEBUG("Jet RoI threshold pattern: 0x" << std::hex << recRoI.thresholdPattern() << std::dec); + ATH_MSG_DEBUG("Jet Run 2 RoI threshold pattern: 0x" << std::hex << recRoI.thresholdPattern() << std::dec); } @@ -891,8 +1024,6 @@ const std::vector< JetEnergyRoI >& Lvl1ResultAccessTool::createJetEnergyThreshol if ( roiType == LVL1::TrigT1CaloDefs::JetRoIWordType && (threshold->type == JetRoI || threshold->type == ForwardJetRoI) ) { - ATH_MSG_DEBUG(threshold->name << " is of type JetRoI or ForwardJetRoI"); - // plain Jet & ForwardJet RoI //--------------------- if ( ! addJetThreshold(roi, &*threshold) ) { @@ -937,8 +1068,10 @@ const std::vector< JetEnergyRoI >& Lvl1ResultAccessTool::createJetEnergyThreshol if( ! ignoreThreshold ) { - ATH_MSG_DEBUG( threshold->name << " is of type " << threshold->type << " TotalEtRoI (" << TotalEtRoI << ") or MissingEtRoI (" << MissingEtRoI << ") or METSignificanceRoI (" << METSignificanceRoI << ")" - << " and etSumType " << etSumType << "(" << (etSumType==0?"full range":"restricted range") << ")"); + ATH_MSG_DEBUG( threshold->name << " is of type " << threshold->type + << ( threshold->type == TotalEtRoI ? "TotalEtRoI" : + ( threshold->type == MissingEtRoI ? "MissingEtRoI" : "METSignificanceRoI") ) + << " and etSumType " << etSumType << "(" << (etSumType==0 ? "full range" : "restricted range") << ")"); roiET.setType(MissingOrTotalEtRoI); @@ -964,11 +1097,158 @@ const std::vector< JetEnergyRoI >& Lvl1ResultAccessTool::createJetEnergyThreshol } } // end of loop over RoIs } // end of jetEnergy Result - }// enf of m_useL1JetEnergy + }// end of m_useL1JetEnergy ATH_MSG_DEBUG("done with jet thresholds"); return m_jetRoIs; } +namespace { + + // reverse engineered from JEPRoIDecoder::decodeEnergyComponent + uint32_t encodeEnergy(double e) + { + int epi = abs( (int) (e) ); + int sign = e<0 ? -1 : 0; + bool overfl = ( epi >= (1<<14) ); + + uint32_t roi(0); + if(overfl) { + roi = 1<<16; + } else { + if(sign==0) { + roi = epi; + } else { + roi = 0x7FFF & (~epi+1) ; + } + } + return roi; + } +} + +const std::vector< JetEnergyRoI >& +Lvl1ResultAccessTool::createJetEnergyThresholds(const ROIB::RoIBResult& result, + const std::vector & jetContainers, + const std::vector & jetThresholdFilters, + const std::vector & metROIs, + const std::vector & metThresholdFilters ) +{ + createJetEnergyThresholds(result); + + if (!m_useL1JetEnergy) + return m_jetRoIs; + + ATH_MSG_DEBUG("Looking for Run 3 JetEnergy RoIs"); + ATH_MSG_DEBUG("--------------------------------"); + + uint idx(0); + for ( const xAOD::JetRoIContainer * jetContainer : jetContainers ) { + std::string thrStartsWith = jetThresholdFilters[idx++]; + std::vector thresholdsForThisCollection; + for(auto thr : m_jetThresholdsRun3 ) { + if( thr->name().find( thrStartsWith ) == 0 ) { + thresholdsForThisCollection.push_back(thr); + } + } + if( thresholdsForThisCollection.size() == 0 ) // no thresholds defined in the menu for this collection + continue; + for ( const auto & jet : *jetContainer ) { + float eTLargeWindow = jet->et8x8(); + float eTSmallWindow = jet->et4x4(); + float eta = jet->eta(); + float phi = jet->phi(); + if ( phi < 0 ) phi += 2*M_PI; + if ( phi >= 2*M_PI ) phi -= 2*M_PI; + + + // fake the roiword + uint32_t roiword(0); + // location + LVL1::Coordinate coord(phi, eta); + LVL1::CoordToHardware converter; + unsigned int jepCoord = converter.jepCoordinateWord(coord); + roiword += jepCoord << 19; + // energy + unsigned int eTLargeWindowCounts = (unsigned int) (eTLargeWindow/1000.); // 1 count is 1GeV in Run 2, jet eT is in MeV + unsigned int eTSmallWindowCounts = (unsigned int) (eTSmallWindow/1000.); // 1 count is 1GeV in Run 2, jet eT is in MeV + roiword += (eTSmallWindowCounts<512 ? eTSmallWindowCounts : 511) << 10; // energy small window is 9 bits => limit 511 + roiword += eTLargeWindowCounts<1024 ? eTLargeWindowCounts : 1023; // energy large window is 10 bits => limit 1023 + + HLT::JetEnergyRoI roi = HLT::JetEnergyRoI( ROIB::JetEnergyRoI(roiword) ); + + ATH_MSG_DEBUG("Run 3 " << thrStartsWith << "et RoI word: 0x" << std::hex << std::setw( 8 ) << std::setfill( '0' ) << roiword << std::dec + << " small w counts " << eTSmallWindowCounts << ", large w " << eTLargeWindowCounts << ", eta " << eta); + + LVL1::RecJetRoI recRoI( roiword, & thresholdsForThisCollection ); + roi.setThresholdMask(recRoI.thresholdPattern()); + + ATH_MSG_DEBUG( thrStartsWith << "Run 3 " << thrStartsWith << " Jet RoI threshold pattern: 0x" << std::hex << recRoI.thresholdPattern() << std::dec); + + for ( const ConfigJetEThreshold & threshold : m_jetCfg) { + + if( threshold.type != HLT::JetRoI) continue; + + // check whether this LVL1 threshold is used by HLT: + if ( !(threshold.mask & roi.thresholdMask()) ) continue; + + if ( ! addJetThreshold(roi, &threshold) ) { + ATH_MSG_WARNING("Problem while adding jet threshold: " << threshold.name << " returning prematurely"); + return m_jetRoIs; + } + + } + m_jetRoIs.push_back(roi); + } + } + + uint metIdx(0); + for (const xAOD::EnergySumRoI * energySum : metROIs ) { + std::string thrStartsWith = metThresholdFilters[metIdx++]; + + // https://edms.cern.ch/ui/#!master/navigator/document?D:1381415379:1381415379:subDocs + uint32_t roiword0( LVL1::TrigT1CaloDefs::EnergyRoIWordType0 << 29 ); // XS + uint32_t roiword1( LVL1::TrigT1CaloDefs::EnergyRoIWordType1 << 29 ); // TE + uint32_t roiword2( LVL1::TrigT1CaloDefs::EnergyRoIWordType2 << 29 ); // XE + + uint32_t ex = encodeEnergy( energySum->energyX()/1000. ); + uint32_t ey = encodeEnergy( energySum->energyY()/1000. ); + roiword0 += ex; + roiword1 += ey; + + HLT::JetEnergyRoI roiET = HLT::JetEnergyRoI( ROIB::JetEnergyRoI(roiword0) ); + + if ( !roiET.setExtraWords(roiword0, roiword1, roiword2)) { + ATH_MSG_ERROR("Error setting Total/Missing ET RoI extra words"); + return m_jetRoIs; + } + + ATH_MSG_DEBUG( "Run 3 " << thrStartsWith << " MET RoI triplet = 0x" << std::hex << std::setw( 8 ) << std::setfill( '0' ) + << roiword0 << " 0x" << std::setw( 8 ) << roiword1 << " 0x" << std::setw( 8 ) << roiword2 << std::dec); + + // Loop over possible Jet thresholds + for ( auto & threshold : m_jetCfg ) { + + if ( threshold.type != HLT::MissingEtRoI || + threshold.name.find( thrStartsWith ) != 0 ) continue; + + ATH_MSG_DEBUG(threshold.name << " is of type HLT::MissingEtRoI"); + + roiET.setType(HLT::MissingOrTotalEtRoI); + + if ( ! addMetThreshold(roiET, &threshold, m_metThrCuts[threshold.name]) ) { + ATH_MSG_WARNING("Problem while adding threshold: " << threshold.name << " returning prematurely"); + return m_jetRoIs; + } + + } + + m_jetRoIs.push_back(roiET); + + } + return m_jetRoIs; +} + + + std::bitset<3> Lvl1ResultAccessTool::lvl1EMTauJetOverflow(const ROIB::RoIBResult& result) { @@ -1026,18 +1306,54 @@ bool Lvl1ResultAccessTool::addJetThreshold(HLT::JetEnergyRoI & roi, const Config if ( !(threshold->mask & roi.thresholdMask()) ) return true; if (!roi.setType(threshold->type)) { - ATH_MSG_ERROR("Inconsistent threshold types " << roi.type() << " " << threshold->type); + ATH_MSG_ERROR("Inconsistent Jet threshold types " << roi.type() << " " << threshold->type); return false; } roi.addThreshold( threshold ); - ATH_MSG_DEBUG("Creating Jet threshold: " << threshold->name); + + ATH_MSG_DEBUG("adding Jet threshold: " << threshold->name << " to JET ROI"); + return true; } -// this is made separate function as it usesses different word for threhold bits (namely word1/2) -bool Lvl1ResultAccessTool::addMetThreshold( HLT::JetEnergyRoI & roi, const ConfigJetEThreshold* threshold, bool isRestrictedRange ) { +bool Lvl1ResultAccessTool::addMetThreshold( HLT::JetEnergyRoI & roi, const ConfigJetEThreshold * thr, unsigned int thrVal) { + + bool pass = false; + if( thr->type == HLT::MissingEtRoI ) { + double eX = (double) (roi.word0() & 0x7fff); // energy values are 15bits + double eY = (double) (roi.word1() & 0x7fff); + double xE = sqrt( eX * eX + eY * eY ); + + pass = (xE >= thrVal); + + } else if ( thr->type == HLT::TotalEtRoI ) { + + double tE = (double) (roi.word2() & 0x7fff); + pass = (tE >= thrVal); + + } else { + ATH_MSG_ERROR("Threshold " << thr->name << " is not implemented for Run 3 MET ROIs"); + return false; + } + + if(pass) { + roi.addThreshold( thr ); + ATH_MSG_DEBUG("adding MET threshold " << thr->name); + } + + return true; +} + + + +// this is made separate function as it uses different word for threshold bits (namely word1/2) +// In the format definition of the EnergyROIs at page 21 of +// https://edms.cern.ch/ui/#!master/navigator/document?D:1381415379:1381415379:subDocs +// bits 17-24 contains the XE/TE/XS threshold indices that were passed +// This function uses the information stored in bits 17-24 +bool Lvl1ResultAccessTool::addMetThreshold( HLT::JetEnergyRoI & roi, const ConfigJetEThreshold* threshold, bool isRestrictedRange ) { uint32_t word(0); switch(threshold->type) { case METSignificanceRoI: @@ -1053,7 +1369,7 @@ bool Lvl1ResultAccessTool::addMetThreshold( HLT::JetEnergyRoI & roi, const Confi word = 0; } - uint32_t mask = threshold->mask; + uint32_t mask = threshold->mask; // the mask is set from the threshold->mapping number if (isRestrictedRange) { mask >>= 8; @@ -1065,12 +1381,12 @@ bool Lvl1ResultAccessTool::addMetThreshold( HLT::JetEnergyRoI & roi, const Confi if (!roi.setType(threshold->type)) { - ATH_MSG_ERROR("Inconsistent threshold types " << roi.type() << " " << threshold->type); + ATH_MSG_ERROR("Inconsistent MET threshold types " << roi.type() << " " << threshold->type); return false; } roi.addThreshold( threshold ); - ATH_MSG_DEBUG("creating Met threshold: " << threshold->name); + ATH_MSG_DEBUG("adding MET threshold " << threshold->name << "(mask=" << threshold->mask << ")"); return true; } diff --git a/Trigger/TrigT1/TrigT1CTP/CMakeLists.txt b/Trigger/TrigT1/TrigT1CTP/CMakeLists.txt index 0e0c9478f7eeed4da81cd4aaec78bb84e1e76672..9e76b9edabdf8eefb773c746495a3058c6b3a4ac 100644 --- a/Trigger/TrigT1/TrigT1CTP/CMakeLists.txt +++ b/Trigger/TrigT1/TrigT1CTP/CMakeLists.txt @@ -24,6 +24,7 @@ atlas_depends_on_subdirs( PUBLIC Trigger/TrigT1/L1Topo/L1TopoConfig Trigger/TrigT1/TrigT1Interfaces Trigger/TrigT1/TrigT1Result + Trigger/TrigT1/TrigT1CaloUtils Trigger/TrigSteer/TrigSteering ) # External dependencies: @@ -37,7 +38,7 @@ atlas_add_component( TrigT1CTP src/*.cxx src/components/*.cxx INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} ${TDAQ-COMMON_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} - LINK_LIBRARIES ${Boost_LIBRARIES} ${ROOT_LIBRARIES} ${TDAQ-COMMON_LIBRARIES} ${CLHEP_LIBRARIES} AthenaBaseComps StoreGateLib SGtests GaudiKernel TrigConfL1Data TrigInterfacesLib AthenaKernel AthenaMonitoringLib AthenaPoolUtilities EventInfo PathResolver TrigConfStorage L1TopoConfig TrigT1Interfaces TrigT1Result ) + LINK_LIBRARIES ${Boost_LIBRARIES} ${ROOT_LIBRARIES} ${TDAQ-COMMON_LIBRARIES} ${CLHEP_LIBRARIES} AthenaBaseComps StoreGateLib SGtests GaudiKernel TrigConfL1Data TrigInterfacesLib AthenaKernel AthenaMonitoringLib AthenaPoolUtilities EventInfo PathResolver TrigConfStorage L1TopoConfig TrigT1Interfaces TrigT1Result TrigT1CaloUtils) # Install files from the package: atlas_install_headers( TrigT1CTP ) diff --git a/Trigger/TrigT1/TrigT1CTP/src/CTPEmulation.cxx b/Trigger/TrigT1/TrigT1CTP/src/CTPEmulation.cxx index d76e580c3e2d72fc1126c71fbd93bc9e24ce6947..9951b85fdaff39fa3070c0b7216c58f6ae551939 100644 --- a/Trigger/TrigT1/TrigT1CTP/src/CTPEmulation.cxx +++ b/Trigger/TrigT1/TrigT1CTP/src/CTPEmulation.cxx @@ -15,6 +15,7 @@ #include "TrigSteering/Lvl1ResultAccessTool.h" #include "TrigT1Result/RoIBResult.h" #include "TrigT1Result/JetEnergyRoI.h" +#include "TrigT1CaloUtils/CoordToHardware.h" #include "TrigT1Interfaces/CPRoIDecoder.h" #include "TrigT1Interfaces/JEPRoIDecoder.h" @@ -32,24 +33,6 @@ LVL1CTP::CTPEmulation::CTPEmulation( const std::string& name, ISvcLocator* pSvcL m_histSvc ("THistSvc", name), m_configSvc ("TrigConf::TrigConfigSvc/TrigConfigSvc", name), m_lvl1Tool("HLT::Lvl1ResultAccessTool/Lvl1ResultAccessTool",this), - m_useCTPInput (false), - m_gFEXMETPufitLoc ("gXEPUFIT_MET"), - m_gFEXMETRhoLoc ("gXERHO_MET"), - m_gFEXMETJwoJLoc ("gXEJWOJ_MET"), - m_gJetLoc ("gL1Jets"), - m_jJetLoc ("jRoundJets"), - m_jLJetLoc ("jRoundLargeRJets"), - m_eFEXClusterLoc ( "SClusterCl"), - m_eFEXTauLoc ( "SClusterTau"), - m_muonRoILoc ( "LVL1MuonRoIs" ), - m_lgJetRoILoc ( "LVL1JetRoIs" ), - m_muonCTPLoc ( LVL1MUCTPI::DEFAULT_MuonCTPLocation ), - m_isData ( false ), - m_roiOutputLoc ( LVL1CTP::DEFAULT_CTPSLinkLocation ), - m_roiOutputLoc_Rerun ( LVL1CTP::DEFAULT_CTPSLinkLocation_Rerun ), - m_rdoOutputLoc ( LVL1CTP::DEFAULT_RDOOutputLocation ), - m_rdoOutputLoc_Rerun ( LVL1CTP::DEFAULT_RDOOutputLocation_Rerun ), - m_histStream("EXPERT"), m_itemCountsSumTBP(512,0), m_itemCountsSumTAP(512,0), m_itemCountsSumTAV(512,0) @@ -58,7 +41,8 @@ LVL1CTP::CTPEmulation::CTPEmulation( const std::string& name, ISvcLocator* pSvcL declareProperty( "HistogramStream", m_histStream, "Histogram stream name, bound to file by THistSvc"); declareProperty( "TrigConfigSvc", m_configSvc, "Trigger configuration service"); - declareProperty( "UseCTPInputFromData", m_useCTPInput, "Trigger configuration service"); + declareProperty( "UseCTPInputFromData", m_useCTPInput, "Set true if using CTP input objects from the various L1 simulations"); + declareProperty( "UseCTPInputFromData", m_useROIBOutput, "Set to true the ROIBResult should be used for Run 2 data (not likely)"); // input data declareProperty( "gFEXMETPufitInput", m_gFEXMETPufitLoc, "StoreGate location of gFEX PUfit MET input" ); @@ -69,10 +53,6 @@ LVL1CTP::CTPEmulation::CTPEmulation( const std::string& name, ISvcLocator* pSvcL declareProperty( "gJetInput", m_gJetLoc, "StoreGate location of gFEX Jet inputs" ); declareProperty( "eFEXClusterInput", m_eFEXClusterLoc, "StoreGate location of eFEX Cluster inputs" ); - // input data from ROI - declareProperty( "MuonRoIInput", m_muonRoILoc, "StoreGate location of muon RoI inputs" ); - declareProperty( "LGJetRoIInput", m_lgJetRoILoc, "StoreGate location of muon RoI inputs" ); - // muon threshold counts from CTP input recorded in data declareProperty( "MuonCTPInput", m_muonCTPLoc, "StoreGate location of Muon inputs" ); declareProperty( "EmTauCTPLocation", m_emtauCTPLoc, "StoreGate location of EmTau inputs" ); @@ -100,8 +80,10 @@ StatusCode LVL1CTP::CTPEmulation::initialize() { CHECK(m_configSvc.retrieve()); - - CHECK(m_lvl1Tool.retrieve()); + + if ( m_useROIBOutput ) { + CHECK(m_lvl1Tool.retrieve()); + } CHECK(m_histSvc.retrieve()); @@ -185,7 +167,9 @@ LVL1CTP::CTPEmulation::beginRun() { CHECK( bookHists() ); - CHECK( m_lvl1Tool->updateConfig() ); + if ( m_useROIBOutput ) { + CHECK( m_lvl1Tool->updateConfig() ); + } return StatusCode::SUCCESS; } @@ -394,31 +378,43 @@ LVL1CTP::CTPEmulation::retrieveCollections() { // Run 2 ROIs if ( m_isData ) { - // they are contained in the ROIBResult when running on data - ATH_MSG_DEBUG( "Running on data, going to retrieve ROIBResult" ); + ATH_MSG_DEBUG( "Running on data" ); + + CHECK ( evtStore()->retrieve( m_muctpiCTP, m_muonCTPLoc ) ); + ATH_MSG_DEBUG( "Retrieved 'LVL1::MuCTPICTP#" << m_muonCTPLoc << "'"); + + CHECK ( evtStore()->retrieve( m_emtauCTP, m_emtauCTPLoc ) ); + ATH_MSG_DEBUG( "Retrieved 'LVL1::EmTauCTP#" << m_emtauCTPLoc << "'"); + + CHECK ( evtStore()->retrieve( m_jetCTP, m_jetCTPLoc ) ); + ATH_MSG_DEBUG( "Retrieved 'LVL1::JetCTP#" << m_jetCTPLoc << "'"); + + CHECK ( evtStore()->retrieve( m_energyCTP, m_energyCTPLoc ) ); + ATH_MSG_DEBUG( "Retrieved 'LVL1::EnergyCTP#" << m_energyCTPLoc << "'"); - CHECK ( evtStore()->retrieve( m_roibResult ) ); - ATH_MSG_DEBUG( "Retrieved ROIBResult" ); + // CHECK ( evtStore()->retrieve( m_topoCTP, m_topoCTPLoc ) ); + // ATH_MSG_DEBUG( "Retrieved 'LVL1::FrontPanelCTP#" << m_topoCTPLoc << "'"); - CHECK ( m_lvl1Tool->updateResult( *m_roibResult, false) ); - ATH_MSG_DEBUG( "Created ROIs from ROIBResult" ); + if ( m_useROIBOutput ) { + CHECK ( evtStore()->retrieve( m_roibResult ) ); + ATH_MSG_DEBUG( "Retrieved ROIBResult" ); + CHECK ( m_lvl1Tool->updateResult( *m_roibResult, false) ); + ATH_MSG_DEBUG( "Created ROIs from ROIBResult" ); + } } else { ATH_MSG_DEBUG( "Running on MC, going to retrieve simulated L1 objects in CTP format" ); CHECK ( evtStore()->retrieve( m_muctpiCTP, m_muonCTPLoc ) ); + ATH_MSG_DEBUG( "Retrieved 'LVL1::MuCTPICTP#" << m_muonCTPLoc << "'"); CHECK ( evtStore()->retrieve( m_emtauCTP, m_emtauCTPLoc ) ); + ATH_MSG_DEBUG( "Retrieved 'LVL1::EmTauCTP#" << m_emtauCTPLoc << "'"); CHECK ( evtStore()->retrieve( m_jetCTP, m_jetCTPLoc ) ); + ATH_MSG_DEBUG( "Retrieved 'LVL1::JetCTP#" << m_jetCTPLoc << "'"); CHECK ( evtStore()->retrieve( m_energyCTP, m_energyCTPLoc ) ); + ATH_MSG_DEBUG( "Retrieved 'LVL1::EnergyCTP#" << m_energyCTPLoc << "'"); CHECK ( evtStore()->retrieve( m_topoCTP, m_topoCTPLoc ) ); - - // ATH_MSG_DEBUG( "Running on MC, going to retrieve xAOD collections" ); - - // CHECK ( evtStore()->retrieve( m_muonRoIs, m_muonRoILoc ) ); - // ATH_MSG_DEBUG( "Retrieved Muon ROI container '" << m_muonRoILoc << "' with size " << m_muonRoIs->size()); - - // CHECK ( evtStore()->retrieve( m_lgJetRoIs, m_lgJetRoILoc ) ); - // ATH_MSG_DEBUG( "Retrieved LG Jet container '" << m_lgJetRoILoc << "' with size " << m_lgJetRoIs->size()); + ATH_MSG_DEBUG( "Retrieved 'LVL1::FrontPanelCTP#" << m_topoCTPLoc << "'"); } @@ -443,7 +439,7 @@ LVL1CTP::CTPEmulation::fillInputHistograms() { CHECK ( m_histSvc->getHist( histBasePath() + "/input/counts/taus", h) ); h->Fill(m_eFEXTau->size()); // counts of objects from ROIBResult - if( m_isData ) { + if ( m_useROIBOutput ) { CHECK ( m_histSvc->getHist( histBasePath() + "/input/counts/jetRoIData", h) ); h->Fill(m_lvl1Tool->getJetEnergyRoIs().size()); CHECK ( m_histSvc->getHist( histBasePath() + "/input/counts/emTauRoIData", h) ); h->Fill(m_lvl1Tool->getEMTauRoIs().size()); CHECK ( m_histSvc->getHist( histBasePath() + "/input/counts/muonRoIData", h) ); h->Fill(m_lvl1Tool->getMuonRoIs().size()); @@ -518,47 +514,48 @@ LVL1CTP::CTPEmulation::fillInputHistograms() { // === // JET - CHECK ( m_histSvc->getHist( histBasePath() + "/input/roi/jet/eta", h2) ); - CHECK ( m_histSvc->getHist( histBasePath() + "/input/roi/jet/phi", h3) ); - CHECK ( m_histSvc->getHist( histBasePath() + "/input/roi/jet/etLarge", h4) ); - CHECK ( m_histSvc->getHist( histBasePath() + "/input/roi/jet/etSmall", h5) ); - for ( const HLT::JetEnergyRoI & jetROI : m_lvl1Tool->getJetEnergyRoIs() ) { - - ATH_MSG_DEBUG( "HLT::JetEnergyRoI with word " << jetROI.lvl1RoI().roIWord() - << " has type " << jetROI.lvl1RoI().roIType() - << " and l1roi jet et " << jetROI.lvl1RoI().jetEt() ); - - if( jetROI.lvl1RoI().roIType() != LVL1::TrigT1CaloDefs::JetRoIWordType ) - continue; // not a jet (likely xe) + if ( m_useROIBOutput ) { + CHECK ( m_histSvc->getHist( histBasePath() + "/input/roi/jet/eta", h2) ); + CHECK ( m_histSvc->getHist( histBasePath() + "/input/roi/jet/phi", h3) ); + CHECK ( m_histSvc->getHist( histBasePath() + "/input/roi/jet/etLarge", h4) ); + CHECK ( m_histSvc->getHist( histBasePath() + "/input/roi/jet/etSmall", h5) ); + for ( const HLT::JetEnergyRoI & jetROI : m_lvl1Tool->getJetEnergyRoIs() ) { + + ATH_MSG_DEBUG( "HLT::JetEnergyRoI with word " << jetROI.lvl1RoI().roIWord() + << " has type " << jetROI.lvl1RoI().roIType() + << " and l1roi jet et " << jetROI.lvl1RoI().jetEt() ); + + if( jetROI.lvl1RoI().roIType() != LVL1::TrigT1CaloDefs::JetRoIWordType ) + continue; // not a jet (likely xe) - const ROIB::JetEnergyRoI & l1JetROI = jetROI.lvl1RoI(); - - LVL1::CoordinateRange coordRange = m_jetDecoder->coordinate(l1JetROI.roIWord()); - int ieta = int ( ( coordRange.etaRange().min() + 0.025) / 0.1) + - ( ( coordRange.etaRange().min() + 0.025 > 0) ? 0 : -1); - int iphi = int(( coordRange.phiRange().min() + 0.025) * 32 / M_PI); - h2->Fill( ieta ); - h3->Fill( iphi ); - h4->Fill( l1JetROI.etLarge() ); - h5->Fill( l1JetROI.etSmall() ); + const ROIB::JetEnergyRoI & l1JetROI = jetROI.lvl1RoI(); + + LVL1::CoordinateRange coordRange = m_jetDecoder->coordinate(l1JetROI.roIWord()); + int ieta = int ( ( coordRange.etaRange().min() + 0.025) / 0.1) + + ( ( coordRange.etaRange().min() + 0.025 > 0) ? 0 : -1); + int iphi = int(( coordRange.phiRange().min() + 0.025) * 32 / M_PI); + h2->Fill( ieta ); + h3->Fill( iphi ); + h4->Fill( l1JetROI.etLarge() ); + h5->Fill( l1JetROI.etSmall() ); + } } // MET - if( m_roibResult ) { + if ( m_useROIBOutput ) { int energyX(0), energyY(0), energyT(0); //unsigned int w0, w1, w2; CHECK ( m_histSvc->getHist( histBasePath() + "/input/roi/met/xe", h1) ); CHECK ( m_histSvc->getHist( histBasePath() + "/input/roi/met/xephi", h2) ); CHECK ( m_histSvc->getHist( histBasePath() + "/input/roi/met/te", h3) ); - LVL1::JEPRoIDecoder conv; for( const ROIB::JetEnergyResult & res : m_roibResult->jetEnergyResult() ) { for( const ROIB::JetEnergyRoI & roi : res.roIVec() ) { // RoI word uint32_t roIWord = roi.roIWord(); // RoI type - int roiType = conv.roiType( roIWord ); + int roiType = m_jetDecoder->roiType( roIWord ); - // ATH_MSG_DEBUG("JOERG MET t=" << roiType << " " << roi.roIType() << " w=" << roIWord << " et=" << roi.jetEt() + // ATH_MSG_DEBUG("MET t=" << roiType << " " << roi.roIType() << " w=" << roIWord << " et=" << roi.jetEt() // << " etLarge=" << roi.etLarge() << " etSmall=" << roi.etSmall() // << " eX=" << roi.energyX() << " eY=" << roi.energyY() << " eSum=" << roi.energySum() // << " eTsumType=" << roi.etSumType() @@ -589,44 +586,27 @@ LVL1CTP::CTPEmulation::fillInputHistograms() { } - if( m_roibResult ) { - { // EMTAU ROIs - unsigned int nEMROI(0), nTAUROI(0); - CHECK ( m_histSvc->getHist( histBasePath() + "/input/roi/em/et", h ) ); - CHECK ( m_histSvc->getHist( histBasePath() + "/input/roi/em/eta", h1) ); - CHECK ( m_histSvc->getHist( histBasePath() + "/input/roi/em/phi", h2) ); - CHECK ( m_histSvc->getHist( histBasePath() + "/input/roi/tau/et", h3) ); - CHECK ( m_histSvc->getHist( histBasePath() + "/input/roi/tau/eta", h4) ); - CHECK ( m_histSvc->getHist( histBasePath() + "/input/roi/tau/phi", h5) ); - for( const ROIB::EMTauResult & res : m_roibResult->eMTauResult() ) { - for ( const ROIB::EMTauRoI & roi : res.roIVec() ) { - ATH_MSG_DEBUG("JOERG EMTAU roi t=" << roi.roIType() << " et=" << roi.et() << " iso=" << roi.isolation()); - if( roi.roIType() == LVL1::TrigT1CaloDefs::EMRoIWordType) { - nEMROI++; - h->Fill(roi.et()); - } else if( roi.roIType() == LVL1::TrigT1CaloDefs::TauRoIWordType) { - nTAUROI++; - h3->Fill(roi.et()); - } + if ( m_useROIBOutput ) { + // EMTAU ROIs + unsigned int nEMROI(0), nTAUROI(0); + CHECK ( m_histSvc->getHist( histBasePath() + "/input/roi/em/et", h ) ); + CHECK ( m_histSvc->getHist( histBasePath() + "/input/roi/em/eta", h1) ); + CHECK ( m_histSvc->getHist( histBasePath() + "/input/roi/em/phi", h2) ); + CHECK ( m_histSvc->getHist( histBasePath() + "/input/roi/tau/et", h3) ); + CHECK ( m_histSvc->getHist( histBasePath() + "/input/roi/tau/eta", h4) ); + CHECK ( m_histSvc->getHist( histBasePath() + "/input/roi/tau/phi", h5) ); + for( const ROIB::EMTauResult & res : m_roibResult->eMTauResult() ) { + for ( const ROIB::EMTauRoI & roi : res.roIVec() ) { + ATH_MSG_DEBUG("EMTAU roi t=" << roi.roIType() << " et=" << roi.et() << " iso=" << roi.isolation()); + if( roi.roIType() == LVL1::TrigT1CaloDefs::EMRoIWordType) { + nEMROI++; + h->Fill(roi.et()); + } else if( roi.roIType() == LVL1::TrigT1CaloDefs::TauRoIWordType) { + nTAUROI++; + h3->Fill(roi.et()); } } } - // for( const ROIB::JetEnergyResult & res : m_roibResult->jetEnergyResult() ) { - // for( const ROIB::JetEnergyRoI & roi : res.roIVec() ) { - // uint32_t roIWord = roi.roIWord(); - // // RoI type - // LVL1::JEPRoIDecoder conv; - // int roiType = conv.roiType( roIWord ); - // ATH_MSG_DEBUG( "Jet RoI, RoIWord = " << MSG::hex << std::setw( 8 ) - // << roi.roIWord() << MSG::dec << " type = " << roiType << " " << roi.roIType() - // << " ==? " << LVL1::TrigT1CaloDefs::JetRoIWordType); - // // // Jet ROI - // // if( roiType == LVL1::TrigT1CaloDefs::JetRoIWordType ) { - // // // RecRoI - // // // LVL1::RecJetRoI recRoI( roIWord, &jetThresholds ); - // // } - // } - // } } @@ -666,12 +646,10 @@ LVL1CTP::CTPEmulation::extractMultiplicities() const { // get the multiplicity for each threshold unsigned int multiplicity = 0; - //thr->print(" ", 4); if( ! isNewThreshold(thr) && m_useCTPInput == true ) { multiplicity = extractMultiplicitiesFromCTPInputData( thr ); } else { multiplicity = calculateMultiplicity( thr ); - // ATH_MSG_DEBUG("Threshold " << thr->name() << " has multiplicity " << multiplicity ); } m_thrMap->decision( thr )->setValue( multiplicity ); @@ -694,9 +672,7 @@ LVL1CTP::CTPEmulation::calculateJetMultiplicity( const TrigConf::TriggerThreshol unsigned int multiplicity = 0; if( confThr->name().find("J") == 0 ) { - - if( m_isData ) { - // Run-2 threshold + if( m_useROIBOutput ) { for ( const HLT::JetEnergyRoI & jetROI : m_lvl1Tool->getJetEnergyRoIs() ) { LVL1::TrigT1CaloDefs::RoIType jettype = m_jetDecoder->roiType( jetROI.lvl1RoI().roIWord() ); @@ -757,12 +733,35 @@ LVL1CTP::CTPEmulation::calculateJetMultiplicity( const TrigConf::TriggerThreshol } if ( dh ) { for ( const auto & jet : **dh ) { - float eta = jet->eta(); - // copied fromm + + float eta = jet->eta(); + float phi = jet->phi(); + if ( phi < 0 ) phi += 2*M_PI; + if ( phi >= 2*M_PI ) phi -= 2*M_PI; + + LVL1::Coordinate coord(phi, eta); + LVL1::CoordToHardware converter; + unsigned int jepCoord = converter.jepCoordinateWord(coord); + uint32_t roiword = jepCoord << 19; + + auto coordRange = m_jetDecoder->coordinate(roiword); + + int ieta = + int((coordRange.eta() + ((coordRange.eta() > 0.01) ? 0.025 : -0.025)) / 0.1) - 1; + // Adjustment due to irregular geometries + if (ieta > 24) + ieta += 2; + int iphi = int((coordRange.phiRange().min() + 0.025) * 32 / M_PI); + + // copied from // https://acode-browser.usatlas.bnl.gov/lxr/source/athena/Trigger/TrigT1/TrigT1CaloUtils/src/JetAlgorithm.cxx#0337 - int ieta = int((eta + (eta>0 ? 0.005 : -0.005))/0.1); - int iphi = 0; // int((m_refPhi-0.005)*32/M_PI); iphi = 16*(iphi/16) + 8; - multiplicity += ( jet->et8x8()/1000. < confThr->triggerThresholdValue( ieta, iphi )->ptcut() ) ? 0 : 1; + //int ieta = int((eta + (eta>0 ? 0.005 : -0.005))/0.1); + //int iphi = 0; // int((m_refPhi-0.005)*32/M_PI); iphi = 16*(iphi/16) + 8; + bool pass = ((unsigned int) (jet->et8x8()/1000.)) > confThr->triggerThresholdValue( ieta, iphi )->ptcut(); + if (confThr->name() == "jJ15.31ETA49") { + std::cout << "JJJ ieta " << ieta << " iphi " << iphi << " eta " << eta << " phi " << phi << " et " << ((unsigned int) (jet->et8x8()/1000.)) << " thr " << confThr->triggerThresholdValue( ieta, iphi )->ptcut() << ( pass ? " --> pass" : "") << std::endl; + } + multiplicity += pass ? 1 : 0; } } } @@ -771,6 +770,7 @@ LVL1CTP::CTPEmulation::calculateJetMultiplicity( const TrigConf::TriggerThreshol CHECK( m_histSvc->getHist( histBasePath() + "/multi/jet", h) ); h->Fill(confThr->mapping(), multiplicity); + ATH_MSG_DEBUG("JET MULT calculated mult for threshold " << confThr->name() << " : " << multiplicity); return multiplicity; } @@ -787,14 +787,16 @@ LVL1CTP::CTPEmulation::calculateEMMultiplicity( const TrigConf::TriggerThreshold int ieta = int((eta + (eta>0 ? 0.005 : -0.005))/0.1); int iphi = 0; const TrigConf::TriggerThresholdValue * thrV = confThr->triggerThresholdValue( ieta, iphi ); + const ClusterThresholdValue *ctv = dynamic_cast(thrV); + float scale = ctv->caloInfo().globalEmScale(); - bool clusterPasses = ( cl->et() >= thrV->ptcut() ); // need to add cut on isolation and other variables, once available + bool clusterPasses = ( ((unsigned int) cl->et()) > thrV->ptcut()*scale ); // need to add cut on isolation and other variables, once available multiplicity += clusterPasses ? 1 : 0; } } else { // old EM threshold from data - if ( m_isData ) { + if ( false ) { if ( m_roibResult ) { for( const ROIB::EMTauResult & res : m_roibResult->eMTauResult() ) { for ( const ROIB::EMTauRoI & roi : res.roIVec() ) { @@ -842,6 +844,7 @@ LVL1CTP::CTPEmulation::calculateEMMultiplicity( const TrigConf::TriggerThreshold TH1 * h { nullptr }; CHECK( m_histSvc->getHist( histBasePath() + "/multi/em", h) ); h->Fill(confThr->mapping(), multiplicity); + ATH_MSG_DEBUG("EM MULT calculated mult for threshold " << confThr->name() << " : " << multiplicity); return multiplicity; } @@ -854,7 +857,7 @@ LVL1CTP::CTPEmulation::calculateTauMultiplicity( const TrigConf::TriggerThreshol const static SG::AuxElement::ConstAccessor accR3ClIso ("R3ClusterIso"); if( m_eFEXTau ) { for ( const auto & tau : * m_eFEXTau ) { - float eT = accR3ClET(*tau)/1000.; // tau eT is in MeV while the cut is in GeV - this is only temporary and needs to be made consistent for all L1Calo + unsigned int eT = (unsigned int) (accR3ClET(*tau)/1000.); // tau eT is in MeV while the cut is in GeV - this is only temporary and needs to be made consistent for all L1Calo //float iso = accR3ClIso(*tau); float eta = tau->eta(); int ieta = int((eta + (eta>0 ? 0.005 : -0.005))/0.1); @@ -866,7 +869,7 @@ LVL1CTP::CTPEmulation::calculateTauMultiplicity( const TrigConf::TriggerThreshol } } else { // old TAU threshold - if ( m_isData ) { + if ( false ) { if ( m_roibResult ) { for( const ROIB::EMTauResult & res : m_roibResult->eMTauResult() ) { for ( const ROIB::EMTauRoI & roi : res.roIVec() ) { @@ -893,9 +896,9 @@ LVL1CTP::CTPEmulation::calculateTauMultiplicity( const TrigConf::TriggerThreshol } } TH1 * h { nullptr }; - ATH_MSG_DEBUG("JOERG TAU MULT calculated mult for threshold " << confThr->name() << " : " << multiplicity); CHECK( m_histSvc->getHist( histBasePath() + "/multi/tau", h) ); h->Fill(confThr->mapping(), multiplicity); + ATH_MSG_DEBUG("TAU MULT calculated mult for threshold " << confThr->name() << " : " << multiplicity); return multiplicity; } @@ -905,7 +908,7 @@ LVL1CTP::CTPEmulation::calculateMETMultiplicity( const TrigConf::TriggerThreshol if ( confThr->name().find("XE")==0 ) { // old XE - if( m_isData ) { + if( m_useROIBOutput ) { int energyX(0), energyY(0); if ( m_roibResult ) { for( const ROIB::JetEnergyResult & res : m_roibResult->jetEnergyResult() ) { @@ -922,7 +925,7 @@ LVL1CTP::CTPEmulation::calculateMETMultiplicity( const TrigConf::TriggerThreshol } double missingET = sqrt(energyX*energyX + energyY*energyY); const TrigConf::TriggerThresholdValue * thrV = confThr->triggerThresholdValue( 0, 0 ); - multiplicity = missingET >= thrV->ptcut() ? 1 : 0; + multiplicity = ((unsigned int) missingET) >= thrV->ptcut() ? 1 : 0; } else { if ( m_energyCTP.isValid() ) { if ( confThr->cableName() == "JEP3" || confThr->cableName() == "EN1") { @@ -934,17 +937,17 @@ LVL1CTP::CTPEmulation::calculateMETMultiplicity( const TrigConf::TriggerThreshol } } else if ( confThr->name().find("TE")==0 ) { // old TE - if( m_isData ) { + if( m_useROIBOutput ) { int energyT(0); if ( m_roibResult ) { bool isRestrictedRangeTE = confThr->name().find("24ETA49") != std::string::npos; for( const ROIB::JetEnergyResult & res : m_roibResult->jetEnergyResult() ) { for( const ROIB::JetEnergyRoI & roi : res.roIVec() ) { - ATH_MSG_DEBUG("JOERG TE " << roi.etSumType() << " " << roi.roIType()); + ATH_MSG_DEBUG("TE " << roi.etSumType() << " " << roi.roIType()); if( (roi.etSumType() == (isRestrictedRangeTE ? 1 : 0) ) && // pick the correct sumtype 0-all, 1-restricted range roi.roIType() == LVL1::TrigT1CaloDefs::EnergyRoIWordType2 ) { // etSum energyT = m_jetDecoder->energyT( roi.roIWord() ); - ATH_MSG_DEBUG("JOERG TE RR " << energyT); + ATH_MSG_DEBUG("TE RR " << energyT); } } } @@ -988,6 +991,8 @@ LVL1CTP::CTPEmulation::calculateMETMultiplicity( const TrigConf::TriggerThreshol } else { CHECK( m_histSvc->getHist( histBasePath() + "/multi/xe", h) ); h->Fill(confThr->mapping(), multiplicity); } + + ATH_MSG_DEBUG("XE/TE/XS MULT calculated mult for threshold " << confThr->name() << " : " << multiplicity); return multiplicity; } @@ -997,7 +1002,7 @@ LVL1CTP::CTPEmulation::calculateMuonMultiplicity( const TrigConf::TriggerThresho unsigned int multiplicity = 0; // muon - if( m_isData ) { + if( m_useROIBOutput ) { for ( const auto & muon : m_lvl1Tool->getMuonRoIs() ) { multiplicity += (muon.lvl1RoI().pt()>= (unsigned int) confThr->mapping()) ? 1 : 0; // TrigT1Result/MuCTPIRoI } @@ -1010,6 +1015,7 @@ LVL1CTP::CTPEmulation::calculateMuonMultiplicity( const TrigConf::TriggerThresho TH1 * h { nullptr }; CHECK( m_histSvc->getHist( histBasePath() + "/multi/muon", h) ); h->Fill(confThr->mapping(), multiplicity); + ATH_MSG_DEBUG("MU MULT calculated mult for threshold " << confThr->name() << " : " << multiplicity); return multiplicity; } diff --git a/Trigger/TrigT1/TrigT1CTP/src/CTPEmulation.h b/Trigger/TrigT1/TrigT1CTP/src/CTPEmulation.h index 8d29a05126c717f77209d8b8702122773816e27c..967f0ac5db1f4583cc463a91676d6ec109405fa6 100644 --- a/Trigger/TrigT1/TrigT1CTP/src/CTPEmulation.h +++ b/Trigger/TrigT1/TrigT1CTP/src/CTPEmulation.h @@ -146,39 +146,35 @@ namespace LVL1CTP { // properties BooleanProperty m_useCTPInput { false }; + BooleanProperty m_useROIBOutput { false }; // name of input collections // new FEX collections - StringProperty m_gFEXMETPufitLoc {""}; - StringProperty m_gFEXMETRhoLoc {""}; - StringProperty m_gFEXMETJwoJLoc {""}; - StringProperty m_gJetLoc {""}; - StringProperty m_jJetLoc {""}; - StringProperty m_jLJetLoc {""}; - StringProperty m_eFEXClusterLoc {""}; - StringProperty m_eFEXTauLoc {""}; - - // old ROI Collections - StringProperty m_muonRoILoc {""}; - StringProperty m_lgJetRoILoc {""}; + StringProperty m_gFEXMETPufitLoc {"gXEPUFIT_MET"}; + StringProperty m_gFEXMETRhoLoc {"gXERHO_MET"}; + StringProperty m_gFEXMETJwoJLoc {"gXEJWOJ_MET"}; + StringProperty m_gJetLoc {"gL1Jets"}; + StringProperty m_jJetLoc {"jRoundJets"}; + StringProperty m_jLJetLoc {"jRoundLargeRJets"}; + StringProperty m_eFEXClusterLoc {"SClusterCl"}; + StringProperty m_eFEXTauLoc {"SClusterTau"}; // name of the CTP input words - StringProperty m_muonCTPLoc {""}; - StringProperty m_emtauCTPLoc { LVL1::TrigT1CaloDefs::EmTauCTPLocation }; - StringProperty m_jetCTPLoc { LVL1::TrigT1CaloDefs::JetCTPLocation }; + StringProperty m_muonCTPLoc { LVL1MUCTPI::DEFAULT_MuonCTPLocation}; + StringProperty m_emtauCTPLoc { LVL1::TrigT1CaloDefs::EmTauCTPLocation }; + StringProperty m_jetCTPLoc { LVL1::TrigT1CaloDefs::JetCTPLocation }; StringProperty m_energyCTPLoc { LVL1::TrigT1CaloDefs::EnergyCTPLocation }; - StringProperty m_topoCTPLoc { LVL1::DEFAULT_L1TopoCTPLocation }; - + StringProperty m_topoCTPLoc { LVL1::DEFAULT_L1TopoCTPLocation }; // output locations and control BooleanProperty m_isData { false }; - StringProperty m_roiOutputLoc {""}; - StringProperty m_roiOutputLoc_Rerun {""}; - StringProperty m_rdoOutputLoc {""}; - StringProperty m_rdoOutputLoc_Rerun {""}; + StringProperty m_roiOutputLoc { LVL1CTP::DEFAULT_CTPSLinkLocation }; + StringProperty m_roiOutputLoc_Rerun { LVL1CTP::DEFAULT_CTPSLinkLocation_Rerun }; + StringProperty m_rdoOutputLoc { LVL1CTP::DEFAULT_RDOOutputLocation }; + StringProperty m_rdoOutputLoc_Rerun { LVL1CTP::DEFAULT_RDOOutputLocation_Rerun }; - std::string m_histStream {""}; + std::string m_histStream {"EXPERT"}; // internal ThresholdMap* m_thrMap { nullptr }; diff --git a/Trigger/TrigT1/TrigT1CaloFexSim/python/L1SimulationSequence.py b/Trigger/TrigT1/TrigT1CaloFexSim/python/L1SimulationSequence.py index d89c6702c864b1776b5bc5e04580a9dd179e4f70..72c3802edb23032f83a843302b9226dfbae9bb4f 100644 --- a/Trigger/TrigT1/TrigT1CaloFexSim/python/L1SimulationSequence.py +++ b/Trigger/TrigT1/TrigT1CaloFexSim/python/L1SimulationSequence.py @@ -2,7 +2,7 @@ from AthenaCommon.Include import include # to include old style job options -def setupRun3L1CaloSimulationSequence(skipCTPEmulation = False): +def setupRun3L1CaloSimulationSequence(skipCTPEmulation = False, useAlgSequence = False): ## print some information about the conditions the simulation ## is running in @@ -138,15 +138,21 @@ def setupRun3L1CaloSimulationSequence(skipCTPEmulation = False): from TrigT1CTP.TrigT1CTP_EnableCTPEmulation import enableCTPEmulation enableCTPEmulation(l1simAlgSeq) - #algSequence = AthSequencer("AthAlgSeq") + if useAlgSequence: + sequence = AthSequencer("AthAlgSeq") # everything is added to the AthAlqSequence (which is then put in front of everything) + else: + sequence = AlgSequence() # everything is added to the topSequence + for alg in l1simAlgSeq: - topSequence += alg + sequence += alg l1simAlgSeq.removeAll() + + if simflags.EnableDebugOutput(): log.debug("Algorithm sequence after L1 simulation setup") from AthenaCommon.AlgSequence import dumpSequence - dumpSequence(topSequence) + dumpSequence(sequence) ## Configure the output content diff --git a/Trigger/TrigT1/TrigT1CaloFexSim/share/createL1SimulationSequence.py b/Trigger/TrigT1/TrigT1CaloFexSim/share/createL1SimulationSequence.py index 374adfef3d5f32cde95fceb5b86d7fdc7acd7a8e..09be6a22ba9cd5320d14c97f5c27efdbbc11f7d6 100644 --- a/Trigger/TrigT1/TrigT1CaloFexSim/share/createL1SimulationSequence.py +++ b/Trigger/TrigT1/TrigT1CaloFexSim/share/createL1SimulationSequence.py @@ -1,3 +1,3 @@ from TrigT1CaloFexSim.L1SimulationSequence import setupRun3L1CaloSimulationSequence -setupRun3L1CaloSimulationSequence() +setupRun3L1CaloSimulationSequence(useAlgSequence = True) diff --git a/Trigger/TrigT1/TrigT1CaloFexSim/src/JetAlg.cxx b/Trigger/TrigT1/TrigT1CaloFexSim/src/JetAlg.cxx index 4ae2fa112d1001c027ed02e23e8df64563b2cdc3..b7580b1f27cea15e50ad8e82c6f8035d25aa6b45 100644 --- a/Trigger/TrigT1/TrigT1CaloFexSim/src/JetAlg.cxx +++ b/Trigger/TrigT1/TrigT1CaloFexSim/src/JetAlg.cxx @@ -367,10 +367,7 @@ StatusCode JetAlg::BuildFatJet(const xAOD::JGTowerContainer towers, TString jetn float pt_cone = blocks[b].Pt(); float j_Et = 0; - float j_totalnoise = 0; - //std::cout << "cone pT : " << pt_cone << std::endl; if(pt_cone > pt_cone_cut){ - //std::cout << "cone pT : " << pt_cone << std::endl; for(unsigned int t = 0; t < towers.size(); t++){ const xAOD::JGTower* tower = towers.at(t); if(fabs(tower->et()) < noise.at(t) * jet_tower_noise_multiplier) continue; diff --git a/Trigger/TrigT1/TrigT1CaloFexSim/src/METAlg.cxx b/Trigger/TrigT1/TrigT1CaloFexSim/src/METAlg.cxx index 61b30db77e1a703af36c04b50698592315aad614..fdb5358ed6eb3e93c82f5817fd4c898cc882e581 100644 --- a/Trigger/TrigT1/TrigT1CaloFexSim/src/METAlg.cxx +++ b/Trigger/TrigT1/TrigT1CaloFexSim/src/METAlg.cxx @@ -18,7 +18,7 @@ std::map> METAlg::m_METMap; //------------------------------------------------------------------------------------------------ -StatusCode METAlg::MET_etaBins(const xAOD::JGTowerContainer* towers, TString metName, bool usegFEX, bool useRhoSub, bool usePUfit){ +StatusCode METAlg::MET_etaBins(const xAOD::JGTowerContainer* towers, TString metName, bool usegFEX, bool useRhoSub, bool){ float met_x = 0; float met_y = 0; std::shared_ptr met = std::make_shared(); diff --git a/Trigger/TrigT1/TrigT1Interfaces/TrigT1Interfaces/RecEmTauRoI.h b/Trigger/TrigT1/TrigT1Interfaces/TrigT1Interfaces/RecEmTauRoI.h index b2b47c1dfc14900946e8e3ee84ad94afd02ff873..98be8662bdfebc4ed08f1e6222f4f283ada0367f 100644 --- a/Trigger/TrigT1/TrigT1Interfaces/TrigT1Interfaces/RecEmTauRoI.h +++ b/Trigger/TrigT1/TrigT1Interfaces/TrigT1Interfaces/RecEmTauRoI.h @@ -100,7 +100,7 @@ namespace LVL1 { std::vector< unsigned int >* thresholdsPassed() const; /** returns bitmask of passed thresholds */ - unsigned int thresholdPattern() const; + unsigned long int thresholdPattern() const; /** returns the value of the trigger threshold for the threshold passed. The trigger threshold is also sometimes called the cluster threshold. diff --git a/Trigger/TrigT1/TrigT1Interfaces/TrigT1Interfaces/RecJetRoI.h b/Trigger/TrigT1/TrigT1Interfaces/TrigT1Interfaces/RecJetRoI.h index b17667f83b08fd7627cc3c6c0ced1cd579ff2a8b..8c6f122996d5f5bb2c0b22a315b3081962ac2911 100644 --- a/Trigger/TrigT1/TrigT1Interfaces/TrigT1Interfaces/RecJetRoI.h +++ b/Trigger/TrigT1/TrigT1Interfaces/TrigT1Interfaces/RecJetRoI.h @@ -109,7 +109,7 @@ namespace LVL1 { unsigned int windowSize( unsigned int thresh ) const; /** returns bitmask of passed thresholds */ - unsigned int thresholdPattern() const; + unsigned long int thresholdPattern() const; /** returns true if thresh is a valid threshold number */ bool isValidThreshold( unsigned int thresh ) const; diff --git a/Trigger/TrigT1/TrigT1Interfaces/src/RecEmTauRoI.cxx b/Trigger/TrigT1/TrigT1Interfaces/src/RecEmTauRoI.cxx index aaf1bdecc2e5218e81df590cfa86a60df5790644..25d975951b99d76a0d7dd8c33e053f27107029a6 100644 --- a/Trigger/TrigT1/TrigT1Interfaces/src/RecEmTauRoI.cxx +++ b/Trigger/TrigT1/TrigT1Interfaces/src/RecEmTauRoI.cxx @@ -208,7 +208,7 @@ void RecEmTauRoI::constructRun2( m_thresholdType.insert( std::map::value_type( num, type)); - m_thresholdMask |= (1 << num); + m_thresholdMask |= (1L << num); } // passes cuts } // ClusterThresholdValue pointer valid } // correct threshold type @@ -257,7 +257,7 @@ unsigned int RecEmTauRoI::isolation() const { } /** returns bitmask of thresholds passed by RoI */ -unsigned int RecEmTauRoI::thresholdPattern() const { return m_thresholdMask; } +unsigned long int RecEmTauRoI::thresholdPattern() const { return m_thresholdMask; } /** returns type of RoI */ TrigT1CaloDefs::RoIType RecEmTauRoI::roiType() const { return m_type; } diff --git a/Trigger/TrigT1/TrigT1Interfaces/src/RecJetRoI.cxx b/Trigger/TrigT1/TrigT1Interfaces/src/RecJetRoI.cxx index 63a6d04503c7e469e60222082a8ad3e573f5e793..3a002218ea5905e3cfa1b5d19faf6911dbfdea9f 100644 --- a/Trigger/TrigT1/TrigT1Interfaces/src/RecJetRoI.cxx +++ b/Trigger/TrigT1/TrigT1Interfaces/src/RecJetRoI.cxx @@ -165,7 +165,7 @@ void RecJetRoI::constructRun2( std::map::value_type(num, etCut)); m_windowSize.insert( std::map::value_type(num, window)); - m_thresholdMask |= (1 << num); + m_thresholdMask |= (1L << num); } // passes cuts } // JetThresholdValue pointer valid } // correct threshold type @@ -241,7 +241,7 @@ unsigned int RecJetRoI::etSmall() const { } /** returns mask of thresholds passed */ -unsigned int RecJetRoI::thresholdPattern() const { return m_thresholdMask; } +unsigned long int RecJetRoI::thresholdPattern() const { return m_thresholdMask; } /** returns TRUE if threshold number threshold_number has been pass ed by this ROI. */ diff --git a/Trigger/TriggerCommon/TriggerJobOpts/python/HLTTriggerGetter.py b/Trigger/TriggerCommon/TriggerJobOpts/python/HLTTriggerGetter.py index 4c67842cf43854ebb7df10918dc8fbe595b9697f..1e5f61c69f522bcdd6fd434fa9c6ffe0755231e6 100644 --- a/Trigger/TriggerCommon/TriggerJobOpts/python/HLTTriggerGetter.py +++ b/Trigger/TriggerCommon/TriggerJobOpts/python/HLTTriggerGetter.py @@ -164,12 +164,10 @@ class HLTSimulationGetter(Configured): if TriggerFlags.doHLT(): log.info("configuring HLT Steering") - from TrigSteering.TrigSteeringConfig import TrigSteer_HLT, ReruningTrigSteer_HLT if TriggerFlags.doFEX(): from RecExConfig.RecFlags import rec from AthenaCommon.GlobalFlags import globalflags - # schedule the conversion of the L1Calo ROIB data to topo simulation input # this ROIB converter should only be scheduled if @@ -187,7 +185,7 @@ class HLTSimulationGetter(Configured): log.info("configuring HLT merged system, for normal running (FEX + Hypo)") TrigSteer_HLT = TrigSteer_HLT('TrigSteer_HLT', hltFile=TriggerFlags.inputHLTconfigFile(), lvl1File=TriggerFlags.inputLVL1configFile()) TrigSteer_HLT.doHypo = TriggerFlags.doHypo() - + TrigSteer_HLT.LvlConverterTool.useRun3FEXOutput = TriggerFlags.doLVL1PhaseI() if not TriggerFlags.doFEX() and TriggerFlags.doHypo(): log.info("configuring merged HLT for re-running (Hypo only)") TrigSteer_HLT = ReruningTrigSteer_HLT('TrigSteer_HLT', hltFile=TriggerFlags.inputHLTconfigFile(), lvl1File=TriggerFlags.inputLVL1configFile()) diff --git a/Trigger/TriggerCommon/TriggerJobOpts/python/JobSetupPrinter.py b/Trigger/TriggerCommon/TriggerJobOpts/python/JobSetupPrinter.py new file mode 100644 index 0000000000000000000000000000000000000000..779e5fe9754ed0736b47ed6c4cd1163c928f1383 --- /dev/null +++ b/Trigger/TriggerCommon/TriggerJobOpts/python/JobSetupPrinter.py @@ -0,0 +1,36 @@ +from RecExConfig.Configured import Configured + +class JobSetupPrinter(Configured): + """This file is only temporary to configure different outputs that are needed to + debug the Run 3 CTPEmulation and HLT seeding + """ + + + def __init__(self): + from AthenaCommon.AlgSequence import AlgSequence + from AthenaCommon.Constants import DEBUG + + from TrigT1CaloFexSim.L1SimulationControlFlags import L1Phase1SimFlags as simflags + + topSequence = AlgSequence() + if simflags.EnableDebugOutput(): + if hasattr(topSequence,"CTPEmulation"): + topSequence.CTPEmulation.OutputLevel = DEBUG + + if hasattr(topSequence,"TrigSteer_HLT"): + topSequence.TrigSteer_HLT.LvlConverterTool.OutputLevel = DEBUG + topSequence.TrigSteer_HLT.LvlConverterTool.Lvl1ResultAccessTool.OutputLevel = DEBUG + from AthenaCommon.AppMgr import ServiceMgr as svcMgr + svcMgr.MessageSvc.debugLimit = 100000 + + if hasattr(topSequence,"L1Muctpi_on_RDO"): + print topSequence.L1Muctpi_on_RDO + + if hasattr(topSequence,"CTPEmulation"): + print topSequence.CTPEmulation + + if hasattr(topSequence,"RoIBuilder"): + print topSequence.RoIBuilder + if hasattr(topSequence,"TrigSteer_HLT"): + print topSequence.TrigSteer_HLT.LvlConverterTool + diff --git a/Trigger/TriggerCommon/TriggerJobOpts/python/Lvl1TriggerOnlineGetter.py b/Trigger/TriggerCommon/TriggerJobOpts/python/Lvl1TriggerOnlineGetter.py index c4b9591536680d92ad5e721eb8e06883f663c6c7..7acf600b03c15817990e08f6e81ec9604a867718 100644 --- a/Trigger/TriggerCommon/TriggerJobOpts/python/Lvl1TriggerOnlineGetter.py +++ b/Trigger/TriggerCommon/TriggerJobOpts/python/Lvl1TriggerOnlineGetter.py @@ -17,7 +17,6 @@ if (not TriggerFlags.fakeLVL1()) and TriggerFlags.doLVL1(): import TrigT1TGCRecRoiSvc.TrigT1TGCRecRoiConfig import TrigT1RPCsteering.TrigT1RPCsteeringConfig import TrigT1TGC.TrigT1TGCConfig - from TrigT1Muctpi.TrigT1MuctpiConfig import L1Muctpi from TrigT1MBTS.TrigT1MBTSConf import LVL1__TrigT1MBTS @@ -67,14 +66,19 @@ class Lvl1SimulationGetter (Configured): log.info( "LVL1ConfigSvc already created. Will ignore configuration from xml file="+TriggerFlags.inputLVL1configFile()\ +" and use file="+ServiceMgr.LVL1ConfigSvc.XMLFile ) - - if (not TriggerFlags.fakeLVL1()) and TriggerFlags.doLVL1(): - if TriggerFlags.useCaloTTL(): - include( "TrigT1CaloSim/TrigT1CaloSimJobOptions_TTL1.py") + ## Run 2 L1Calo + if (not TriggerFlags.fakeLVL1()) and (TriggerFlags.doLVL1() or TriggerFlags.doLVL1PhaseI()): + if TriggerFlags.doLVL1PhaseI(): + include ("TrigT1CaloByteStream/ReadLVL1CaloBS_jobOptions.py") + include ("TrigT1CaloSim/TrigT1CaloSimJobOptions_ReadTT.py" ) else: - include( "TrigT1CaloSim/TrigT1CaloSimJobOptions_Cell.py") - topSequence += LVL1__TrigT1MBTS() + if TriggerFlags.useCaloTTL(): + include( "TrigT1CaloSim/TrigT1CaloSimJobOptions_TTL1.py") + else: + include( "TrigT1CaloSim/TrigT1CaloSimJobOptions_Cell.py") + topSequence += LVL1__TrigT1MBTS() + ## Run 3 L1Calo if TriggerFlags.doLVL1PhaseI(): log.info("setting up the Run 3 L1 calo simulation") from TrigT1CaloFexSim.L1SimulationControlFlags import L1Phase1SimFlags as simflags @@ -82,10 +86,20 @@ class Lvl1SimulationGetter (Configured): from TrigT1CaloFexSim.L1SimulationSequence import setupRun3L1CaloSimulationSequence setupRun3L1CaloSimulationSequence(skipCTPEmulation=True) - if (not TriggerFlags.fakeLVL1()) and TriggerFlags.doLVL1(): - - topSequence += L1Muctpi() + ## MUCTPI + if (not TriggerFlags.fakeLVL1()) and ( TriggerFlags.doLVL1() or TriggerFlags.doLVL1PhaseI() ): + if TriggerFlags.doLVL1PhaseI(): + log.info("adding MUCTPI (on RDO) simulation to the topSequence") + from TrigT1Muctpi.TrigT1MuctpiConfig import L1Muctpi_on_RDO + topSequence += L1Muctpi_on_RDO() + topSequence.L1Muctpi_on_RDO.CTPOutputLocID = "/Run/L1MuCTPItoCTPLocation" + topSequence.L1Muctpi_on_RDO.RoIOutputLocID = "/Run/L1MuCTPItoRoIBLocation" + else: + from TrigT1Muctpi.TrigT1MuctpiConfig import L1Muctpi + topSequence += L1Muctpi() + ## L1 Topo + if (not TriggerFlags.fakeLVL1()) and TriggerFlags.doLVL1(): if TriggerFlags.doL1Topo(): log.info("adding l1topo simulation to the topSequence") from L1TopoSimulation.L1TopoSimulationConfig import L1TopoSimulation @@ -110,16 +124,17 @@ class Lvl1SimulationGetter (Configured): log.info("Muon eta/phi encoding with full granularity for data (L1 Simulation) - should be faced out") topSequence.L1TopoSimulation.MuonInputProvider.MuonEncoding = 1 - if not TriggerFlags.doLVL1PhaseI(): + + if (not TriggerFlags.fakeLVL1()) and ( TriggerFlags.doLVL1() or TriggerFlags.doLVL1PhaseI() ): + if TriggerFlags.doLVL1PhaseI(): # doLVL1PhaseI + log.info("adding Run 3 CTP emulation to the topSequence from with Lvl1TriggerOnlineGetter") + from TrigT1CTP.TrigT1CTP_EnableCTPEmulation import enableCTPEmulation + enableCTPEmulation(topSequence) + else: # doLVL1 log.info("adding CTP simulation to the topSequence") from TrigT1CTP.TrigT1CTPConfig import CTPSimulation topSequence += CTPSimulation("CTPSimulation") - if TriggerFlags.doLVL1PhaseI(): - log.info("adding Run 3 CTP emulation to the topSequence from with Lvl1TriggerOnlineGetter") - from TrigT1CTP.TrigT1CTP_EnableCTPEmulation import enableCTPEmulation - enableCTPEmulation(topSequence) - if ((not TriggerFlags.fakeLVL1()) and TriggerFlags.doLVL1()) or TriggerFlags.doLVL1PhaseI(): log.info("adding ROIB simulation to the topSequence") from TrigT1RoIB.TrigT1RoIBConf import ROIB__RoIBuilder diff --git a/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerGetter.py b/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerGetter.py index f5a2d287caea93a651ef9ccf8a4a804598bf21a0..f7605c505ff31583d59f8b3efe93c08c9cabd003 100644 --- a/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerGetter.py +++ b/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerGetter.py @@ -163,7 +163,11 @@ class TriggerGetter(Configured): if TF.doLVL2()==True or TF.doEF()==True or TF.doHLT() or (recAlgs.doTrigger() and TF.readBS()): from TriggerJobOpts.HLTTriggerResultGetter import HLTTriggerResultGetter hltouput = HLTTriggerResultGetter() - + + # enable printout to understand setup + from TriggerJobOpts.JobSetupPrinter import JobSetupPrinter + JobSetupPrinter() + return True def configureTriggerFromDB(self): diff --git a/Trigger/TriggerCommon/TriggerMenu/python/l1/Lvl1Thresholds.py b/Trigger/TriggerCommon/TriggerMenu/python/l1/Lvl1Thresholds.py index 9200179160dc56bf7ce0f1017aeac53a38c15501..30d16eba003c3dcfe9d255347446a71925efa57e 100644 --- a/Trigger/TriggerCommon/TriggerMenu/python/l1/Lvl1Thresholds.py +++ b/Trigger/TriggerCommon/TriggerMenu/python/l1/Lvl1Thresholds.py @@ -212,7 +212,7 @@ class LVL1Threshold(object): inputboard = "ctpcore" if self.cableinfo and not self.cableinfo.isDirectIn: inputboard = "ctpin" - bitnum = self.cableinfo.bitnum if self.cableinfo else -1 + bitnum = self.cableinfo.bitnum if self.cableinfo else 999 # bitnum is unsigned int in C++ s = ind * step * ' ' + '\n' % \ (self.active, bitnum, int(idgen.get('TriggerThreshold')), self.mapping, self.name, self.ttype, inputboard, seed, seed_multi, bcdelay, run) for thrv in sorted(self.thresholdValues): diff --git a/Trigger/TriggerRelease/share/Trigger_topOptions_standalone.py b/Trigger/TriggerRelease/share/Trigger_topOptions_standalone.py index b1a4e648c7a015e87eb7eb26d40aac65718453ba..5b9b1badfd58809e144f1adbf8064834722cf80c 100755 --- a/Trigger/TriggerRelease/share/Trigger_topOptions_standalone.py +++ b/Trigger/TriggerRelease/share/Trigger_topOptions_standalone.py @@ -207,6 +207,8 @@ log.info("configuring hlt") from TriggerJobOpts.HLTTriggerGetter import HLTSimulationGetter hlt = HLTSimulationGetter(g) +from TriggerJobOpts.JobSetupPrinter import JobSetupPrinter +JobSetupPrinter() if 'stopAfterMenuGeneration' in dir() and stopAfterMenuGeneration is True: theApp.exit()