diff --git a/Trigger/TrigHypothesis/TrigJetHypo/TrigJetHypo/TrigEFJetHypoNoise.h b/Trigger/TrigHypothesis/TrigJetHypo/TrigJetHypo/TrigEFJetHypoNoise.h index aa33a4779f65474c4f912f98a35b3df195aaeeb8..b900b70891911b6322a827b2a449586bfd2e835b 100755 --- a/Trigger/TrigHypothesis/TrigJetHypo/TrigJetHypo/TrigEFJetHypoNoise.h +++ b/Trigger/TrigHypothesis/TrigJetHypo/TrigJetHypo/TrigEFJetHypoNoise.h @@ -17,6 +17,11 @@ #include "TrigInterfaces/HypoAlgo.h" #include "TrigTimeAlgs/TrigTimerSvc.h" +#include "CaloInterface/ILArNoisyROTool.h" + +#ifdef ONLINEIS +#include "hltinterface/IInfoRegister.h" +#endif class StoreGateSvc; class TriggerElement; @@ -55,12 +60,6 @@ class TrigEFJetHypoNoise : public HLT::HypoAlgo { bool m_doMonitoring; - int m_cutCounter; - double m_njet; - double m_et; - double m_eta; - double m_phi; - StoreGateSvc* m_storeGate; // Timing: @@ -69,6 +68,16 @@ class TrigEFJetHypoNoise : public HLT::HypoAlgo { std::vector<TrigTimer*> m_timers; unsigned int m_MinBadFEB; +#ifdef ONLINEIS + std::shared_ptr<hltinterface::GenericHLTContainer> m_IsObject; +#endif + size_t m_evntPos; + size_t m_timeTagPos; + size_t m_timeTagPosns; + bool m_isInterface; + + ToolHandle<ILArNoisyROTool> m_noisyROTool; + }; #endif diff --git a/Trigger/TrigHypothesis/TrigJetHypo/cmt/requirements b/Trigger/TrigHypothesis/TrigJetHypo/cmt/requirements index f69bdda0ee49f0fca8e1cf609c1f820523347caf..f7a8105c4dc7ec57ff1f9b32cf728096877b4a5a 100755 --- a/Trigger/TrigHypothesis/TrigJetHypo/cmt/requirements +++ b/Trigger/TrigHypothesis/TrigJetHypo/cmt/requirements @@ -23,12 +23,19 @@ use TrigInterfaces TrigInterfaces-* Trigger/TrigSteer #use TrigSerializeResult TrigSerializeResult-* Trigger/TrigDataAccess #use AnalysisTriggerEvent AnalysisTriggerEvent-* PhysicsAnalysis/AnalysisTrigger +use CaloInterface CaloInterface-* Calorimeter +macro online_use "" AtlasHLT_scripts "HLTtdaqcommon HLTtdaqcommon-* HLT/HLTExternal" +use $(online_use) + apply_pattern dual_use_library files=*.cxx apply_pattern declare_runtime apply_pattern declare_joboptions files="jobOfragment_*.py TriggerConfig_*.py" apply_pattern declare_python_modules files="*.py" +macro_append TrigJetHypo_shlibflags "" AtlasHLT_scripts " -lhltinterface" +macro_append AtlasCxxPolicy_pp_cppflags "" AtlasHLT_scripts "-DONLINEIS" + private use AtlasCLHEP AtlasCLHEP-* External use EventKernel EventKernel-* Event @@ -36,6 +43,9 @@ use FourMomUtils FourMomUtils-* Event use TrigNavigation TrigNavigation-* Trigger/TrigEvent use TrigMissingEtEvent TrigMissingEtEvent-* Trigger/TrigEvent use JetUtils JetUtils-* Reconstruction/Jet -use CaloEvent CaloEvent-* Calorimeter +#use CaloEvent CaloEvent-* Calorimeter use xAODJet xAODJet-* Event/xAOD use xAODCaloEvent xAODCaloEvent-* Event/xAOD +use xAODEventInfo xAODEventInfo-* Event/xAOD +use LArCellRec LArCellRec-* LArCalorimeter +use LArRecEvent LArRecEvent-* LArCalorimeter diff --git a/Trigger/TrigHypothesis/TrigJetHypo/python/TrigEFRazorAllTEMonitoring.py b/Trigger/TrigHypothesis/TrigJetHypo/python/TrigEFRazorAllTEMonitoring.py index e1fef7b464608950c9e7e3dbb44a90c469b8bcd5..2213512387e25bf277389a01e87cd4781905137e 100644 --- a/Trigger/TrigHypothesis/TrigJetHypo/python/TrigEFRazorAllTEMonitoring.py +++ b/Trigger/TrigHypothesis/TrigJetHypo/python/TrigEFRazorAllTEMonitoring.py @@ -27,12 +27,12 @@ class TrigEFRazorAllTEOnlineMonitoring(TrigGenericMonitoringToolConfig): self.Histograms += [ defineHistogram('cutCounter',type='TH1F', title="EFRazor Cut Counter", xbins=10, xmin=0, xmax=10) ] - self.Histograms += [ defineHistogram('m_gaminvR', type='TH1F', title="EFRazor Razor variable - 1/gamR", xbins=200, xmin=0, xmax=10 )] - self.Histograms += [ defineHistogram('m_shatR', type='TH1F', title="EFRazor Razor variable - s_R hat", xbins=200, xmin=0, xmax=10000 )] - self.Histograms += [ defineHistogram('m_mdeltaR', type='TH1F', title="EFRazor Razor variable - m^Delta_R", xbins=200, xmin=0, xmax=10000 )] - self.Histograms += [ defineHistogram('m_cosptR', type='TH1F', title="EFRazor Razor variable - cos Theta_pt^R", xbins=200, xmin=0, xmax=10000 )] - self.Histograms += [ defineHistogram('m_Minv2', type='TH1F', title="EFRazor Razor variable - Minv2", xbins=200, xmin=0, xmax=10000 )] - self.Histograms += [ defineHistogram('m_Einv', type='TH1F', title="EFRazor Razor variable - Einv", xbins=200, xmin=0, xmax=10000 )] + self.Histograms += [ defineHistogram('gaminvRp1', type='TH1F', title="EFRazor Razor variable - 1/gamRp1", xbins=200, xmin=0, xmax=10 )] + self.Histograms += [ defineHistogram('shatR', type='TH1F', title="EFRazor Razor variable - s_R hat", xbins=200, xmin=0, xmax=10000 )] + self.Histograms += [ defineHistogram('mdeltaR', type='TH1F', title="EFRazor Razor variable - m^Delta_R", xbins=200, xmin=0, xmax=10000 )] + self.Histograms += [ defineHistogram('cosptR', type='TH1F', title="EFRazor Razor variable - cos Theta_pt^R", xbins=200, xmin=0, xmax=10000 )] + self.Histograms += [ defineHistogram('Minv2', type='TH1F', title="EFRazor Razor variable - Minv2", xbins=200, xmin=0, xmax=10000 )] + self.Histograms += [ defineHistogram('Einv', type='TH1F', title="EFRazor Razor variable - Einv", xbins=200, xmin=0, xmax=10000 )] class TrigEFRazorAllTEValidationMonitoring(TrigGenericMonitoringToolConfig): @@ -58,7 +58,7 @@ class TrigEFRazorAllTEValidationMonitoring(TrigGenericMonitoringToolConfig): self.Histograms += [ defineHistogram('cutCounter',type='TH1F', title="EFRazor Cut Counter", xbins=10, xmin=0, xmax=10) ] - self.Histograms += [ defineHistogram('gaminvR', type='TH1F', title="EFRazor Razor variable - 1/gamR", xbins=200, xmin=0, xmax=10 )] + self.Histograms += [ defineHistogram('gaminvRp1', type='TH1F', title="EFRazor Razor variable - 1/gamRp1", xbins=200, xmin=0, xmax=10 )] self.Histograms += [ defineHistogram('shatR', type='TH1F', title="EFRazor Razor variable - s_R hat", xbins=200, xmin=0, xmax=10000 )] self.Histograms += [ defineHistogram('mdeltaR', type='TH1F', title="EFRazor Razor variable - m^Delta_R", xbins=200, xmin=0, xmax=10000 )] self.Histograms += [ defineHistogram('cosptR', type='TH1F', title="EFRazor Razor variable - cos Theta_pt^R", xbins=200, xmin=0, xmax=10000 )] diff --git a/Trigger/TrigHypothesis/TrigJetHypo/python/TrigJetHypoConfig.py b/Trigger/TrigHypothesis/TrigJetHypo/python/TrigJetHypoConfig.py index 9f435dc1376c9804d41f191e9840aaeee429f843..7aa9e839f3c05479187229cd873b6686edacdef1 100755 --- a/Trigger/TrigHypothesis/TrigJetHypo/python/TrigJetHypoConfig.py +++ b/Trigger/TrigHypothesis/TrigJetHypo/python/TrigJetHypoConfig.py @@ -8,6 +8,7 @@ from TrigJetHypo.TrigJetHypoConf import TrigL2HTFullScanHypo from TrigJetHypo.TrigJetHypoConf import TrigL2HTAllTE from TrigJetHypo.TrigJetHypoConf import TrigEFJetHypo from TrigJetHypo.TrigJetHypoConf import TrigEFJetHypoNoise +from LArCellRec.LArCellRecConf import LArNoisyROTool from AthenaCommon.SystemOfUnits import GeV @@ -222,6 +223,8 @@ class EFJetHypoNoiseConfig (TrigEFJetHypoNoise): self.Etcut = ef_thr self.BadFEBCut=3 + theLArNoisyROTool=LArNoisyROTool() + self.NoiseTool = theLArNoisyROTool diff --git a/Trigger/TrigHypothesis/TrigJetHypo/src/TrigEFJetHypoNoise.cxx b/Trigger/TrigHypothesis/TrigJetHypo/src/TrigEFJetHypoNoise.cxx index ad7982ed8c41a0193ca45b522be17496fa49e7c2..d84bed5ad25a24a092efc50e6037cd6fd49f21b2 100755 --- a/Trigger/TrigHypothesis/TrigJetHypo/src/TrigEFJetHypoNoise.cxx +++ b/Trigger/TrigHypothesis/TrigJetHypo/src/TrigEFJetHypoNoise.cxx @@ -20,17 +20,20 @@ #include "GaudiKernel/MsgStream.h" #include "GaudiKernel/StatusCode.h" #include "GaudiKernel/ListItem.h" +#include "xAODEventInfo/EventInfo.h" +#include "LArCellRec/LArNoisyROTool.h" +#include "LArRecEvent/LArNoisyROSummary.h" -//#include "TrigConfHLTData/HLTTriggerElement.h" - -//#include "TrigSteeringEvent/TriggerElement.h" #include "TrigSteeringEvent/TrigRoiDescriptor.h" #include "TrigSteeringEvent/Enums.h" #include "TrigJetHypo/TrigEFJetHypoNoise.h" -#include "CaloEvent/CaloClusterContainer.h" #include "xAODCaloEvent/CaloClusterContainer.h" +#ifdef ONLINEIS +#include "hltinterface/ContainerFactory.h" +#endif + class ISvcLocator; ///////////////////////////////////////////////////////////////////// @@ -38,21 +41,15 @@ class ISvcLocator; ///////////////////////////////////////////////////////////////////// // TrigEFJetHypoNoise::TrigEFJetHypoNoise(const std::string& name, ISvcLocator* pSvcLocator): - HLT::HypoAlgo(name, pSvcLocator) { + HLT::HypoAlgo(name, pSvcLocator), m_isInterface(false), m_noisyROTool("",this) { declareProperty("Etcut", m_EtCut = 40*CLHEP::GeV); // Default: 40 GeV declareProperty("doMonitoring", m_doMonitoring = false ); declareProperty("AcceptAll", m_acceptAll=false); + declareProperty("NoiseTool", m_noisyROTool); declareProperty( "BadFEBCut", m_MinBadFEB=5 ); - declareMonitoredVariable("CutCounter", m_cutCounter); - - // Monitored variables... - declareMonitoredVariable("NJet", m_njet); - declareMonitoredVariable("Et", m_et); - declareMonitoredVariable("Eta", m_eta); - declareMonitoredVariable("Phi", m_phi); } TrigEFJetHypoNoise::~TrigEFJetHypoNoise() @@ -79,6 +76,31 @@ HLT::ErrorCode TrigEFJetHypoNoise::hltInitialize() m_accepted=0; m_rejected=0; m_errors=0; + m_isInterface = false; + + if ( m_noisyROTool.retrieve().isFailure() ){ + msg() << MSG::WARNING << "Could not retrieve tool, no noise burst hunting" << endreq; + return HLT::OK; + } + +#ifdef ONLINEIS + auto cfact = hltinterface::ContainerFactory::getInstance(); + if ( cfact ) { + msg() << MSG::DEBUG << "Got the factory for TDAQ interface, will try to register vectors" << endreq; + try { + m_IsObject = cfact->constructContainer("LArISInfo","LArNoiseBurstCandidates"); + m_evntPos = cfact->addIntVector(m_IsObject,"Flag",hltinterface::GenericHLTContainer::LASTVALUE); + m_timeTagPos = cfact->addIntVector(m_IsObject,"TimeStamp",hltinterface::GenericHLTContainer::LASTVALUE); + m_timeTagPosns = cfact->addIntVector(m_IsObject,"TimeStamp_ns",hltinterface::GenericHLTContainer::LASTVALUE); + hltinterface::IInfoRegister::instance()->registerObject("/HLTObjects/",m_IsObject); + m_isInterface = true; + } + catch (std::exception& ex ) { + msg() << MSG::WARNING << "Cannot really use ISInfo publication. got exception " << ex.what() << endreq; + m_isInterface = false; + } + } // if cfact +#endif return HLT::OK; @@ -104,58 +126,70 @@ HLT::ErrorCode TrigEFJetHypoNoise::hltExecute(const HLT::TriggerElement* outputT // ------------------------------------- // if (m_timersvc) m_timers[0]->start(); - m_cutCounter = -1; - pass=false; + bool msgDebug = msgLvl(MSG::DEBUG); - m_njet = 0.0; - m_et = -99000.; - m_eta = -99.; - m_phi = -99.; + if ( !m_noisyROTool ) return HLT::OK; + // no tool running anyway - const xAOD::CaloClusterContainer* outJets = 0; - HLT::ErrorCode ec = getFeature(outputTE, outJets); + const CaloCellContainer* outCells(0); + HLT::ErrorCode ec = getFeature(outputTE, outCells); if(ec!=HLT::OK) { - msg() << MSG::WARNING << " Failed to get JetCollections " << endreq; + msg() << MSG::WARNING << " Failed to get CellCollections " << endreq; return ec; } - xAOD::CaloClusterContainer::const_iterator itr = outJets->begin(); - xAOD::CaloClusterContainer::const_iterator itrE = outJets->end(); - double NBadFEBEMBA = 0.0; - double NBadFEBEMBC = 0.0; - double NBadFEBEMECA = 0.0; - double NBadFEBEMECC = 0.0; - for( ; itr != itrE ; ++itr ){ - NBadFEBEMECA = (*itr)->rawE(); - NBadFEBEMBA = (*itr)->e(); - NBadFEBEMECC = (*itr)->time(); - NBadFEBEMBC = (*itr)->m(); - } - uint32_t BadFEBPartitions = 0; - if ( NBadFEBEMBA > m_MinBadFEB ) BadFEBPartitions |= 1; - if ( NBadFEBEMBC > m_MinBadFEB ) BadFEBPartitions |= 2; - if ( NBadFEBEMECA > m_MinBadFEB ) BadFEBPartitions |=4; - if ( NBadFEBEMECC > m_MinBadFEB ) BadFEBPartitions |=8; - bool badFEBFlag = (BadFEBPartitions != 0); - if ( msgLvl() <= MSG::DEBUG ) { - msg(MSG::DEBUG) << "BadFEBPartitions : 0x" << - std::hex << BadFEBPartitions << std::dec << endreq; - if ( badFEBFlag ) { - msg(MSG::DEBUG) << "Noisy Event accepted!" << endreq; - } else { - msg(MSG::DEBUG) << "Noisy Event rejected!" << endreq; - } - } - if ( badFEBFlag ) - pass=true; - else - pass=false; + + char flag = 0; + if ( outCells ) { + if ( msgDebug ) msg() << MSG::DEBUG << "Got cell container, will process it" << endreq; + std::unique_ptr<LArNoisyROSummary> noisyRO = m_noisyROTool->process(outCells); + if ( msgDebug ) msg() << MSG::DEBUG << "processed it" << endreq; + if ( noisyRO->BadFEBFlaggedPartitions() ) { + if ( msgDebug ) msg() << MSG::DEBUG << "Passed : BadFEBFlaggedPartitions" << endreq; + flag |= 0x1; + } + if ( noisyRO->BadFEB_WFlaggedPartitions() ) { + if ( msgDebug ) msg() << MSG::DEBUG << "Passed : BadFEB_WFlaggedPartitions" << endreq; + flag |= 0x8; + } + if ( noisyRO->SatTightFlaggedPartitions() ) { + if ( msgDebug ) msg() << MSG::DEBUG << "Passed : SatTightFlaggedPartitions" << endreq; + flag |= 0x2; + } + } // end of if outCells + + if ( msgDebug ) msg() << MSG::DEBUG << "got the flag : " << (unsigned int)flag << endreq; + - // Time total TrigEFCaloHypo execution time. - // ------------------------------------- - // if (m_timersvc) m_timers[0]->stop(); + if ( flag != 0x0 ) { + if ( msgDebug ) msg() << MSG::INFO << "LAr Noise detected : "; + pass = true; + } + else if ( msgDebug ) msg() << MSG::INFO << "LAr Noise not detected!" << endreq; + + if ( pass ) { + const xAOD::EventInfo* evt; + if ( (store()->retrieve(evt)).isFailure() ) { + msg(MSG::DEBUG) << endreq; + msg(MSG::ERROR) << "Cannot access eventinfo" << endreq; + } + else { + if ( msgDebug ) msg() << MSG::DEBUG << "at event number : " + << evt->eventNumber() << "; LB : " + << evt->lumiBlock() << "; timeStamp : " + << evt->timeStamp() << "; timeStamp ns : " + << evt->timeStampNSOffset() << endreq; +#ifdef ONLINEIS + if ( m_isInterface ) { + m_IsObject->appendField(m_evntPos,std::vector<long>{flag}); + m_IsObject->appendField(m_timeTagPos,std::vector<long>{(long int)evt->timeStamp()}); + m_IsObject->appendField(m_timeTagPosns,std::vector<long>{(long int)evt->timeStampNSOffset()}); + } +#endif + } + } return HLT::OK;