diff --git a/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/AthenaL1TopoHistSvc.cxx b/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/AthenaL1TopoHistSvc.cxx index 05fbe46334f556b07bf43b56adde624aad04f954..870263546dce71e1708cbc098dc0a52ade1a0153 100644 --- a/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/AthenaL1TopoHistSvc.cxx +++ b/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/AthenaL1TopoHistSvc.cxx @@ -29,8 +29,9 @@ public: TRG_MSG_DEBUG("Registration of " << h->GetName() ); if(m_histSvc) { string fullName( m_baseDir + h->GetName() ); - // auto colPos = fullName.find_last_of('/'); - // string histName = fullName.substr(colPos+1); + auto colPos = fullName.find_last_of('/'); + string histName = fullName.substr(colPos+1); + h->SetName(histName.c_str()); if( ! m_histSvc->regHist(fullName, h).isSuccess() ) { TRG_MSG_WARNING("Could not register histogram " << fullName << " with " << m_histSvc->name() ); } diff --git a/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/EMTauInputProvider.cxx b/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/EMTauInputProvider.cxx index 9195a94b692b09e98e26a6851ba815ea62f551da..6653a2c9830490122771a8493824fea81bc80d6a 100644 --- a/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/EMTauInputProvider.cxx +++ b/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/EMTauInputProvider.cxx @@ -59,13 +59,13 @@ EMTauInputProvider::handle(const Incident& incident) { m_hEMEt = new TH1I( "EMTOBEt", "EM TOB Et", 40, 0, 200); m_hEMEt->SetXTitle("E_{T}"); - m_hEMEtaPhi = new TH2I( "EMTOBPhiEta", "EM TOB Location", 25, -50, 50, 32, -32, 32); + m_hEMEtaPhi = new TH2I( "EMTOBPhiEta", "EM TOB Location", 25, -50, 50, 64, 0, 64); m_hEMEtaPhi->SetXTitle("#eta"); m_hEMEtaPhi->SetYTitle("#phi"); m_hTauEt = new TH1I( "TauTOBEt", "Tau TOB Et", 40, 0, 200); m_hTauEt->SetXTitle("E_{T}"); - m_hTauEtaPhi = new TH2I( "TauTOBPhiEta", "Tau TOB Location", 25, -50, 50, 32, -32, 32); + m_hTauEtaPhi = new TH2I( "TauTOBPhiEta", "Tau TOB Location", 25, -50, 50, 64, 0, 64); m_hTauEtaPhi->SetXTitle("#eta"); m_hTauEtaPhi->SetYTitle("#phi"); diff --git a/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/EnergyInputProvider.cxx b/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/EnergyInputProvider.cxx index f5bf4d34c7d40f3038b5cfb69523c08935280263..81d00c17aed1a0837def3ed246f914c367427c5b 100644 --- a/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/EnergyInputProvider.cxx +++ b/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/EnergyInputProvider.cxx @@ -59,7 +59,7 @@ EnergyInputProvider::handle(const Incident& incident) { replace( histPath.begin(), histPath.end(), '.', '/'); - m_hPt = new TH1I( "MET", "Missing ET TOB", 40, 0, 2000); + m_hPt = new TH1I( "MET", "Missing ET TOB", 200, 0, 2000); m_hPt->SetXTitle("p_{T}"); m_hPhi = new TH1I( "METPhi", "MET TOB Phi", 32, -3.2, 3.2); diff --git a/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/JetInputProvider.cxx b/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/JetInputProvider.cxx index 7b99f9bbe5ff68a897d6fb3bc400e5a2aee175d3..fbb64028efc0c0a9c29595251e59ce609419263f 100644 --- a/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/JetInputProvider.cxx +++ b/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/JetInputProvider.cxx @@ -58,7 +58,7 @@ JetInputProvider::handle(const Incident& incident) { m_hPt2 = new TH1I( "TOBPt2", "Jet TOB Pt 2", 40, 0, 200); m_hPt2->SetXTitle("p_{T}"); - m_hEtaPhi = new TH2I( "TOBPhiEta", "Jet TOB Location", 25, -50, 50, 32, -32, 32); + m_hEtaPhi = new TH2I( "TOBPhiEta", "Jet TOB Location", 25, -50, 50, 64, 0, 64); m_hEtaPhi->SetXTitle("#eta"); m_hEtaPhi->SetYTitle("#phi"); diff --git a/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/L1TopoSimulation.cxx b/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/L1TopoSimulation.cxx index d3f6b3717bff01ee052abc937491ec54e7c48c2c..fdf5514fc0dc6b3c45c5e4de6ae094041bd63794 100644 --- a/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/L1TopoSimulation.cxx +++ b/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/L1TopoSimulation.cxx @@ -251,13 +251,21 @@ L1TopoSimulation::execute() { ATH_MSG_DEBUG("" << m_topoSteering->simulationResult().globalDecision()); - // get the decision output and put it into storegate for the CTP + /** + * Get the decision output and store for the CTP simulation + * + * note the the topo simulation currently uses modules 0 and 1 + * while the CTP front panel expects the topo on cables 1 and 2 + * (cable 0 is coming from ALFA) + * + */ + const TCS::GlobalDecision & dec = m_topoSteering->simulationResult().globalDecision(); LVL1::FrontPanelCTP * topo2CTP = new LVL1::FrontPanelCTP(); for(unsigned int clock=0; clock<2; ++clock) { - topo2CTP->setCableWord0( clock, dec.decision( 0, clock) ); - topo2CTP->setCableWord1( clock, dec.decision( 1, clock) ); - topo2CTP->setCableWord2( clock, dec.decision( 2, clock) ); + topo2CTP->setCableWord0( clock, 0 ); // ALFA + topo2CTP->setCableWord1( clock, dec.decision( 0, clock) ); // TOPO 0 + topo2CTP->setCableWord2( clock, dec.decision( 1, clock) ); // TOPO 1 } CHECK(evtStore()->record( topo2CTP, m_topoCTPLocation )); diff --git a/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/MuonInputProvider.cxx b/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/MuonInputProvider.cxx index c56f64bdb9c7760a2ed947307e0e84a47dbdd26f..0634a476d9bb9c5c831901b73f827aa6765dac73 100644 --- a/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/MuonInputProvider.cxx +++ b/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/MuonInputProvider.cxx @@ -16,6 +16,8 @@ #include "TrigT1Interfaces/TrigT1StoreGateKeys.h" #include "TrigT1Interfaces/MuCTPIToRoIBSLink.h" #include "TrigT1Interfaces/RecMuonRoiSvc.h" +#include "TrigT1Interfaces/MuCTPIL1Topo.h" +#include "TrigT1Interfaces/MuCTPIL1TopoCandidate.h" #include "TrigT1Result/MuCTPIRoI.h" #include "TrigT1Result/RoIBResult.h" @@ -37,7 +39,9 @@ MuonInputProvider::MuonInputProvider( const std::string& type, const std::string m_configSvc( "TrigConf::TrigConfigSvc/TrigConfigSvc", name ), m_recRPCRoiSvc( LVL1::ID_RecRpcRoiSvc, name ), m_recTGCRoiSvc( LVL1::ID_RecTgcRoiSvc, name ), - m_muonROILocation( LVL1MUCTPI::DEFAULT_MuonRoIBLocation ) + m_muonROILocation( LVL1MUCTPI::DEFAULT_MuonRoIBLocation ), + m_MuonEncoding(0), + m_MuCTPItoL1TopoLocation ("/Run/L1MuCTPItoL1TopoLocation") { declareInterface<LVL1::IInputTOBConverter>( this ); declareProperty( "ROIBResultLocation", m_roibLocation, "Storegate key for the reading the ROIBResult" ); @@ -46,6 +50,8 @@ MuonInputProvider::MuonInputProvider( const std::string& type, const std::string declareProperty( "RecTgcRoiSvc", m_recTGCRoiSvc, "TGC Rec Roi Service"); declareProperty( "MuonROILocation", m_muonROILocation, "Storegate key for the Muon ROIs" ); + declareProperty( "MuonEncoding", m_MuonEncoding = 0, "0=full granularity Mu ROIs, 1=MuCTPiToTopo granularity"); + declareProperty( "locationMuCTPItoL1Topo", m_MuCTPItoL1TopoLocation = "/Run/L1MuCTPItoL1TopoLocation", "Storegate key for MuCTPItoL1Topo "); } MuonInputProvider::~MuonInputProvider() @@ -113,9 +119,39 @@ MuonInputProvider::createMuonTOB(uint32_t roiword) const { return muon; } +TCS::MuonTOB +MuonInputProvider::createMuonTOB(const MuCTPIL1TopoCandidate & roi) const { + + + ATH_MSG_DEBUG("Muon ROI (MuCTPiToTopo): thr ID = " << roi.getptThresholdID() << " eta = " << roi.geteta() << " phi = " << roi.getphi() << ", w = " << MSG::hex << std::setw( 8 ) << roi.getRoiID() << MSG::dec); + + + // Here it is unclear. The L1 topo hardware works with phi in [0,2pi]. The MuCTPi give muons in [0,2pi]. + // However, L1 topo simulation works with [-pi, pi] and otherwise it crashes. Thus we have to put check here + float phi = roi.getphi(); + if(phi<-M_PI) phi+=2.0*M_PI; + if(phi> M_PI) phi-=2.0*M_PI; + + TCS::MuonTOB muon( roi.getptValue(), 0, int(10*roi.geteta()), int(10*phi), roi.getRoiID() ); + + //OI this does not work cout << " Trying getphi "<<roi.getphi()<<" \n"; + // phi has to be in [-pi,pi] range, although hardware works with [0,2pi] + //TCS::MuonTOB muon( roi.getptValue(), 0, int(10*roi.geteta()), int(10*roi.getphi()), 0 ); + + muon.setEtaDouble( roi.geteta() ); + muon.setPhiDouble( phi ); + + m_hPt->Fill(muon.Et()); + m_hEtaPhi->Fill(muon.eta(),muon.phi()); + + return muon; +} + StatusCode MuonInputProvider::fillTopoInputEvent(TCS::TopoInputEvent& inputEvent) const { + if( m_MuonEncoding == 0 ) { + ATH_MSG_DEBUG("Filling the muon input from MuCTPIToRoIBSLink produced by L1Muctpi.cxx."); const ROIB::RoIBResult* roibResult {nullptr}; @@ -139,8 +175,10 @@ MuonInputProvider::fillTopoInputEvent(TCS::TopoInputEvent& inputEvent) const { for( const ROIB::MuCTPIRoI & muonRoI : rois ) { - inputEvent.addMuon( MuonInputProvider::createMuonTOB( muonRoI.roIWord() ) ); - + if( !( muonRoI.roIWord() & LVL1::CandidateVetoMask ) ) + inputEvent.addMuon( MuonInputProvider::createMuonTOB( muonRoI.roIWord() ) ); + else + ATH_MSG_DEBUG(" Ignore Vetoed L1 Mu RoI " << muonRoI.roIWord() ); } } else if( muctpi_slink ) { @@ -159,14 +197,26 @@ MuonInputProvider::fillTopoInputEvent(TCS::TopoInputEvent& inputEvent) const { if ( icnt > ( muctpi_slink->getMuCTPIToRoIBWords().size() - ROIB::Trailer::wordsPerTrailer ) ) continue; - inputEvent.addMuon( MuonInputProvider::createMuonTOB( roiword ) ); + if( !( roiword & LVL1::CandidateVetoMask ) ) + inputEvent.addMuon( MuonInputProvider::createMuonTOB( roiword ) ); + else + ATH_MSG_DEBUG(" Ignore Vetoed L1 Mu RoI " << roiword ); } } - - - + } else { // This option for trying MuCTPiToTopo + ATH_MSG_DEBUG("Use MuCTPiToTopo granularity Muon ROIs."); + + LVL1::MuCTPIL1Topo* l1topo {nullptr}; + CHECK( evtStore()->retrieve( l1topo, m_MuCTPItoL1TopoLocation ) ); + std::vector<MuCTPIL1TopoCandidate> candList = l1topo->getCandidates(); + for( std::vector<MuCTPIL1TopoCandidate>::const_iterator iMuCand = candList.begin(); iMuCand != candList.end(); iMuCand++) + { + //MuonInputProvider::createMuonTOB( *iMuCand ); + inputEvent.addMuon( MuonInputProvider::createMuonTOB( *iMuCand ) ); + } + } return StatusCode::SUCCESS; diff --git a/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/MuonInputProvider.h b/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/MuonInputProvider.h index 5114ac0629241a8f7c7768b833014a6c676e2bc0..a4c5e1ec1e00bb9dd4539245a04754ef7b68a402 100644 --- a/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/MuonInputProvider.h +++ b/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/MuonInputProvider.h @@ -27,6 +27,7 @@ namespace TCS { namespace LVL1 { class RecMuonRoiSvc; + class MuCTPIL1TopoCandidate; class MuonInputProvider : public extends2<AthAlgTool, IInputTOBConverter, IIncidentListener> { public: @@ -44,6 +45,7 @@ namespace LVL1 { private: TCS::MuonTOB createMuonTOB(uint32_t roiword) const; + TCS::MuonTOB createMuonTOB(const MuCTPIL1TopoCandidate & roi) const; StringProperty m_roibLocation; @@ -61,6 +63,8 @@ namespace LVL1 { TH1I * m_hPt {nullptr}; TH2I * m_hEtaPhi {nullptr}; + int m_MuonEncoding; //!< Use 0 for full granularity; 1 for MuCTPiToTopo muon granularity + StringProperty m_MuCTPItoL1TopoLocation; }; }