diff --git a/Trigger/TrigAlgorithms/TrigMinBias/python/TrackCountMonitoringMT.py b/Trigger/TrigAlgorithms/TrigMinBias/python/TrackCountMonitoringMT.py index 9972a81fb3f88e8e0ef46393dda1e8ba326b194c..207b77f8978022a0c722a309d4305758ba7ddad0 100644 --- a/Trigger/TrigAlgorithms/TrigMinBias/python/TrackCountMonitoringMT.py +++ b/Trigger/TrigAlgorithms/TrigMinBias/python/TrackCountMonitoringMT.py @@ -2,9 +2,11 @@ def TrackCountMonitoring(): from AthenaMonitoringKernel.GenericMonitoringTool import GenericMonitoringTool monTool = GenericMonitoringTool('MonTool') - monTool.defineHistogram('ntrks', path='EXPERT', type='TH1I', title='ntrks',xbins=100, xmin=-0.5, xmax=4999.5) + monTool.defineHistogram('ntrks', path='EXPERT', type='TH1I', title='ntrks', xbins=100, xmin=-0.5, xmax=4999.5) from TrigMinBias.TrigMinBiasConf import TrackCountHypoAlgMT alg=TrackCountHypoAlgMT() - for i in range(len(alg.min_pt)): - monTool.defineHistogram('counts_minpTcutIndex_{}_maxZ0cutIndex_{}'.format(i,i), path='EXPERT', type='TH1I', title='counts for min pT and max z0 cut',xbins=100, xmin=-0.5, xmax=4999.5) + for i in range(len(alg.minPt)): + monTool.defineHistogram('countsForSelection{}'.format(i), + path='EXPERT', type='TH1I', title='counts for min pT and max z0 cut', + xbins=100, xmin=-0.5, xmax=4999.5) return monTool diff --git a/Trigger/TrigAlgorithms/TrigMinBias/src/TrackCountHypoAlgMT.cxx b/Trigger/TrigAlgorithms/TrigMinBias/src/TrackCountHypoAlgMT.cxx index 171a55ba8dd8fa1418556f33dacb825607543dc5..1cebee7f19e310af9ada95a81e7daeae9bdae430 100644 --- a/Trigger/TrigAlgorithms/TrigMinBias/src/TrackCountHypoAlgMT.cxx +++ b/Trigger/TrigAlgorithms/TrigMinBias/src/TrackCountHypoAlgMT.cxx @@ -8,19 +8,18 @@ Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration #include "AthViews/ViewHelper.h" using TrigCompositeUtils::createAndStore; -using TrigCompositeUtils::DecisionContainer; using TrigCompositeUtils::DecisionAuxContainer; +using TrigCompositeUtils::DecisionContainer; using TrigCompositeUtils::DecisionIDContainer; using TrigCompositeUtils::decisionIDs; -using TrigCompositeUtils::newDecisionIn; -using TrigCompositeUtils::linkToPrevious; -using TrigCompositeUtils::viewString; using TrigCompositeUtils::featureString; using TrigCompositeUtils::findLink; using TrigCompositeUtils::LinkInfo; +using TrigCompositeUtils::linkToPrevious; +using TrigCompositeUtils::newDecisionIn; +using TrigCompositeUtils::viewString; -TrackCountHypoAlgMT::TrackCountHypoAlgMT(const std::string& name, ISvcLocator* pSvcLocator) : -::HypoBase(name, pSvcLocator) +TrackCountHypoAlgMT::TrackCountHypoAlgMT(const std::string &name, ISvcLocator *pSvcLocator) : ::HypoBase(name, pSvcLocator) { } @@ -29,103 +28,114 @@ StatusCode TrackCountHypoAlgMT::initialize() ATH_CHECK(m_tracksKey.initialize()); ATH_CHECK(m_trackCountKey.initialize()); renounce(m_tracksKey); - ATH_CHECK(m_min_pt.size()==m_max_z0.size()); + ATH_CHECK(m_minPt.size() == m_maxZ0.size()); - if (m_tracksKey.key() == "Undefined" || m_trackCountKey.key() == "Undefined") { - ATH_MSG_ERROR("either track Key name or track count key name is undefined " ); + if (m_tracksKey.key() == "Undefined" || m_trackCountKey.key() == "Undefined") + { + ATH_MSG_ERROR("either track Key name or track count key name is undefined "); return StatusCode::FAILURE; } ATH_CHECK(m_hypoTools.retrieve()); - if (!m_monTool.empty()) ATH_CHECK(m_monTool.retrieve()); + if (!m_monTool.empty()) + ATH_CHECK(m_monTool.retrieve()); return StatusCode::SUCCESS; } -StatusCode TrackCountHypoAlgMT::execute(const EventContext& context) const +StatusCode TrackCountHypoAlgMT::execute(const EventContext &context) const { - ATH_MSG_DEBUG ( "Executing " << name() << "..." ); - auto previousDecisionsHandle = SG::makeHandle( decisionInput(), context ); + ATH_MSG_DEBUG("Executing " << name() << "..."); + auto previousDecisionsHandle = SG::makeHandle(decisionInput(), context); - if( not previousDecisionsHandle.isValid() ) {//implicit - ATH_MSG_DEBUG( "No implicit RH for previous decisions "<< decisionInput().key()<<": is this expected?" ); + if (not previousDecisionsHandle.isValid()) + { //implicit + ATH_MSG_DEBUG("No implicit RH for previous decisions " << decisionInput().key() << ": is this expected?"); return StatusCode::SUCCESS; } - if (previousDecisionsHandle->size() == 0) { - ATH_MSG_DEBUG( "No previous decision, nothing to do."); + if (previousDecisionsHandle->size() == 0) + { + ATH_MSG_DEBUG("No previous decision, nothing to do."); return StatusCode::SUCCESS; - } else if (previousDecisionsHandle->size() > 1) { - ATH_MSG_ERROR("Found " << previousDecisionsHandle->size() <<" previous decisions."); + } + else if (previousDecisionsHandle->size() > 1) + { + ATH_MSG_ERROR("Found " << previousDecisionsHandle->size() << " previous decisions."); return StatusCode::FAILURE; } - ATH_MSG_DEBUG( "Running with "<< previousDecisionsHandle->size() <<" implicit ReadHandles for previous decisions"); + ATH_MSG_DEBUG("Running with " << previousDecisionsHandle->size() << " implicit ReadHandles for previous decisions"); + const auto viewTrk = (previousDecisionsHandle->at(0))->objectLink<ViewContainer>(viewString()); + ATH_CHECK(viewTrk.isValid()); + auto tracksHandle = ViewHelper::makeHandle(*viewTrk, m_tracksKey, context); + ATH_CHECK(tracksHandle.isValid()); + ATH_MSG_DEBUG("spacepoint handle size: " << tracksHandle->size() << "..."); - const auto viewTrk = (previousDecisionsHandle->at(0))->objectLink<ViewContainer>( viewString() ); - ATH_CHECK( viewTrk.isValid() ); - auto tracksHandle = ViewHelper::makeHandle( *viewTrk, m_tracksKey, context ); - ATH_CHECK( tracksHandle.isValid() ); - ATH_MSG_DEBUG ( "spacepoint handle size: " << tracksHandle->size() << "..." ); + int ntrks = tracksHandle->size(); + ATH_MSG_DEBUG("Successfully retrieved track container of size" << ntrks); - int ntrks=tracksHandle->size(); - ATH_MSG_DEBUG ("Successfully retrieved track container of size" <<ntrks); - - std::vector<int> counts(m_min_pt.size()); - for (const auto trackPtr: *tracksHandle){ - const Trk::Perigee& aMeasPer = trackPtr->perigeeParameters(); + std::vector<int> counts(m_minPt.size()); + for (const auto trackPtr : *tracksHandle) + { + const Trk::Perigee &aMeasPer = trackPtr->perigeeParameters(); const double pT = aMeasPer.pT(); const double z0 = aMeasPer.parameters()[Trk::z0]; - for (long unsigned int i=0;i<m_min_pt.size();i++){ - if(pT >= m_min_pt[i] && std::fabs(z0) < m_max_z0[i]) counts[i]++; + for (long unsigned int i = 0; i < m_minPt.size(); i++) + { + if (pT >= m_minPt[i] && std::fabs(z0) < m_maxZ0[i]) + counts[i]++; } } - for (long unsigned int i=0;i<m_min_pt.size();i++){ - ATH_MSG_DEBUG( "Number of tracks found with pT cut= "<<m_min_pt[i] << " MeV =" <<"and z0 cut= "<<m_max_z0[i] << counts[i] ); + for (long unsigned int i = 0; i < m_minPt.size(); i++) + { + ATH_MSG_DEBUG("Number of tracks found with pT cut= " << m_minPt[i] << " MeV =" + << "and z0 cut= " << m_maxZ0[i] << counts[i]); } // Recording Data - auto trackCountContainer = std::make_unique< xAOD::TrigCompositeContainer>(); - auto trackCountContainerAux = std::make_unique< xAOD::TrigCompositeAuxContainer>(); + auto trackCountContainer = std::make_unique<xAOD::TrigCompositeContainer>(); + auto trackCountContainerAux = std::make_unique<xAOD::TrigCompositeAuxContainer>(); trackCountContainer->setStore(trackCountContainerAux.get()); - xAOD::TrigComposite * trackCount = new xAOD::TrigComposite(); + xAOD::TrigComposite *trackCount = new xAOD::TrigComposite(); trackCountContainer->push_back(trackCount); trackCount->setDetail("ntrks", ntrks); - trackCount->setDetail("pTcuts", static_cast<std::vector<float>>(m_min_pt)); - trackCount->setDetail("z0cuts", static_cast<std::vector<float>>(m_max_z0)); + trackCount->setDetail("pTcuts", static_cast<std::vector<float>>(m_minPt)); + trackCount->setDetail("z0cuts", static_cast<std::vector<float>>(m_maxZ0)); trackCount->setDetail("counts", counts); // TODO revisit - auto mon_ntrks = Monitored::Scalar<int>("ntrks",ntrks); - Monitored::Group(m_monTool,mon_ntrks); - for(long unsigned int i=0;i<counts.size();i++){ - auto mon_counts = Monitored::Scalar<int>("counts"+std::to_string(i),counts[i]); - Monitored::Group(m_monTool,mon_counts); + auto mon_ntrks = Monitored::Scalar<int>("ntrks", ntrks); + Monitored::Group(m_monTool, mon_ntrks); + for (long unsigned int i = 0; i < counts.size(); i++) + { + auto mon_counts = Monitored::Scalar<int>("counts" + std::to_string(i), counts[i]); + Monitored::Group(m_monTool, mon_counts); } - SG::WriteHandle<DecisionContainer> outputHandle = createAndStore(decisionOutput(), context ); + SG::WriteHandle<DecisionContainer> outputHandle = createAndStore(decisionOutput(), context); auto decisions = outputHandle.ptr(); - auto d = newDecisionIn( decisions); - linkToPrevious( d, decisionInput().key(), 0 ); + auto d = newDecisionIn(decisions); + linkToPrevious(d, decisionInput().key(), 0); TrigCompositeUtils::DecisionIDContainer prev; - TrigCompositeUtils::decisionIDs( previousDecisionsHandle->at(0), prev ); + TrigCompositeUtils::decisionIDs(previousDecisionsHandle->at(0), prev); TrackCountHypoTool::TrkCountsInfo trkinfo{d, trackCount, prev}; - for(auto &tool:m_hypoTools) + for (auto &tool : m_hypoTools) { ATH_CHECK(tool->decide(trkinfo)); } SG::WriteHandle<xAOD::TrigCompositeContainer> trackCountHandle(m_trackCountKey, context); - ATH_CHECK(trackCountHandle.record( std::move( trackCountContainer ), std::move( trackCountContainerAux ) ) ); - d->setObjectLink( featureString(), ElementLink<xAOD::TrigCompositeContainer>( m_trackCountKey.key(), 0) ); + ATH_CHECK(trackCountHandle.record(std::move(trackCountContainer), std::move(trackCountContainerAux))); + d->setObjectLink(featureString(), ElementLink<xAOD::TrigCompositeContainer>(m_trackCountKey.key(), 0)); //ATH_CHECK( hypoBaseOutputProcessing(outputHandle) ); return StatusCode::SUCCESS; } diff --git a/Trigger/TrigAlgorithms/TrigMinBias/src/TrackCountHypoAlgMT.h b/Trigger/TrigAlgorithms/TrigMinBias/src/TrackCountHypoAlgMT.h index 715c4de3e6556d5003215022b705bd5466135dfa..6c1c91eba2b1c4ffc73c2b5781406f54b102d636 100644 --- a/Trigger/TrigAlgorithms/TrigMinBias/src/TrackCountHypoAlgMT.h +++ b/Trigger/TrigAlgorithms/TrigMinBias/src/TrackCountHypoAlgMT.h @@ -27,12 +27,12 @@ public: private: TrackCountHypoAlgMT(); - ToolHandleArray< TrackCountHypoTool > m_hypoTools {this, "HypoTools", {},"Tools that perform actual selection"}; - SG::ReadHandleKey<xAOD::TrackParticleContainer> m_tracksKey{this,"tracksKey","Undefined",""}; - SG::WriteHandleKey<xAOD::TrigCompositeContainer> m_trackCountKey{this,"trackCountKey","Undefined",""}; - Gaudi::Property<std::vector<float>> m_min_pt{this, "min_pt",{0.1,0.2,4.0,5.0}, "Accept events with momentum higher than this limit"}; - Gaudi::Property<std::vector<float>> m_max_z0{this, "max_z0",{100,401,200,300}, "Accept events with absolute value of vertex position lower \ - than this limit in mm; this vector has to be of the same size as min_pT vector, repetition of cut values are allowed if that makes the number of elements the same"}; - ToolHandle<GenericMonitoringTool> m_monTool{this,"MonTool","","Monitoring tool"}; + ToolHandleArray< TrackCountHypoTool > m_hypoTools {this, "HypoTools", {}, "Tools that perform actual selection"}; + SG::ReadHandleKey<xAOD::TrackParticleContainer> m_tracksKey{this, "tracksKey", "Undefined", ""}; + SG::WriteHandleKey<xAOD::TrigCompositeContainer> m_trackCountKey{this, "trackCountKey", "Undefined", ""}; + Gaudi::Property<std::vector<float>> m_minPt{this, "minPt", {0.1,0.2,4.0,5.0}, "Accept events with momentum higher than this limit"}; + Gaudi::Property<std::vector<float>> m_maxZ0{this, "maxZ0", {100,401,200,300}, "Accept events with absolute value of vertex position lower \ + than this limit in mm; this vector has to be of the same size as minPt vector, repetition of cut values are allowed if that makes the number of elements the same"}; + ToolHandle<GenericMonitoringTool> m_monTool{this,"MonTool", "", "Monitoring tool"}; }; #endif // TRIGT2MINBIAS_TRACKCOUNTHYPOALGMT_H diff --git a/Trigger/TrigAlgorithms/TrigMinBias/src/TrackCountHypoTool.cxx b/Trigger/TrigAlgorithms/TrigMinBias/src/TrackCountHypoTool.cxx index 7b1616eb9278d5d0c668c3398bf40a6e04f26f5b..83c4fa7f761bd14ad6dbd202d54c95c81d5d0fdd 100644 --- a/Trigger/TrigAlgorithms/TrigMinBias/src/TrackCountHypoTool.cxx +++ b/Trigger/TrigAlgorithms/TrigMinBias/src/TrackCountHypoTool.cxx @@ -3,7 +3,6 @@ Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ - #include "TrigCompositeUtils/HLTIdentifier.h" #include "AthenaMonitoringKernel/Monitored.h" @@ -11,19 +10,26 @@ Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration using namespace TrigCompositeUtils; -TrackCountHypoTool::TrackCountHypoTool( const std::string& type,const std::string& name,const IInterface* parent ) -: AthAlgTool( type, name, parent ), -m_decisionId( HLT::Identifier::fromToolName( name ) ) {} +TrackCountHypoTool::TrackCountHypoTool(const std::string &type, const std::string &name, const IInterface *parent) + : AthAlgTool(type, name, parent), + m_decisionId(HLT::Identifier::fromToolName(name)) {} -StatusCode TrackCountHypoTool::initialize() { +StatusCode TrackCountHypoTool::initialize() +{ return StatusCode::SUCCESS; } -StatusCode TrackCountHypoTool::decide( TrkCountsInfo& trkinfo ) const { - if ( trkinfo.previousDecisionIDs.count( m_decisionId.numeric() ) == 0 ) { +StatusCode TrackCountHypoTool::decide(TrkCountsInfo &trkinfo) const +{ + if (trkinfo.previousDecisionIDs.count(m_decisionId.numeric()) == 0) + { ATH_MSG_DEBUG("Already rejected"); return StatusCode::SUCCESS; } + if ( m_acceptAll ) { + addDecisionID(m_decisionId.numeric(), trkinfo.decision); + ATH_MSG_DEBUG("REGTEST event accepted because of acceptAll"); + } std::vector<int> counts; @@ -34,35 +40,35 @@ StatusCode TrackCountHypoTool::decide( TrkCountsInfo& trkinfo ) const { trkinfo.counts->getDetail<std::vector<float>>("z0cuts", z0cuts); float countForConfiguredPtThreshold{}; bool found{false}; - for ( size_t i = 0; i < counts.size(); ++i ) { - if ( std::abs( pTcuts[i] - m_min_pt ) < 0.001 && std::abs( z0cuts[i] - m_max_z0 ) < 0.001 ) { + for (size_t i = 0; i < counts.size(); ++i) + { + if (std::abs(pTcuts[i] - m_minPt) < 0.001 && std::abs(z0cuts[i] - m_maxZ0) < 0.001) + { found = true; countForConfiguredPtThreshold = counts[i]; - } + } } - if (!found ) { - ATH_MSG_ERROR ("Unable to find tracks count for requested pT threshold " << m_min_pt << " need to fix hypo tool configuratio or add new threshold in tracks counting"); - for ( size_t i = 0; i < counts.size(); ++i ) { - ATH_MSG_ERROR( "Count of tracks of pT above " << pTcuts[i] << " is available"); - } - return StatusCode::FAILURE; + + if (!found) + { + ATH_MSG_ERROR("Unable to find tracks count for requested pT threshold " << m_minPt << " need to fix hypo tool configuration or add new threshold in tracks counting"); + for (size_t i = 0; i < counts.size(); ++i) + { + ATH_MSG_ERROR("Count of tracks of pT above " << pTcuts[i] << " and z0 requirement " << z0cuts[i] << " that are available"); + } + return StatusCode::FAILURE; } - else{ - ATH_MSG_DEBUG ("REGTEST found "<<countForConfiguredPtThreshold <<" tracks for "<<m_min_pt); + else + { + ATH_MSG_DEBUG("REGTEST found " << countForConfiguredPtThreshold << " tracks for " << m_minPt); } - std::vector<bool> decisionCuts({ - (m_required_ntrks != -1 ? m_required_ntrks <= countForConfiguredPtThreshold : (bool)m_logicAnd), - (m_max_required_ntrks != -1 ? m_max_required_ntrks > countForConfiguredPtThreshold : (bool)m_logicAnd) - }); + + const bool minTrkPassed = (m_minNtrks == -1) or (countForConfiguredPtThreshold > m_minNtrks); + const bool maxTrkPassed = (m_maxNtrks == -1) or (countForConfiguredPtThreshold < m_maxNtrks); - if(m_logicAnd && !std::all_of(decisionCuts.begin(),decisionCuts.end(),[](bool k ){return k; }) ){ - - return StatusCode::SUCCESS; - }else if(m_logicAnd==false && !std::any_of(decisionCuts.begin(),decisionCuts.end(),[](bool k ){return k; }) ){ - return StatusCode::SUCCESS; - }else{ - addDecisionID( m_decisionId.numeric(), trkinfo.decision ); - ATH_MSG_DEBUG ("REGTEST event accepted"); + if ( minTrkPassed and maxTrkPassed ) { + addDecisionID(m_decisionId.numeric(), trkinfo.decision); + ATH_MSG_DEBUG("REGTEST event accepted"); } return StatusCode::SUCCESS; } diff --git a/Trigger/TrigAlgorithms/TrigMinBias/src/TrackCountHypoTool.h b/Trigger/TrigAlgorithms/TrigMinBias/src/TrackCountHypoTool.h index 4c0347dca06f5abc52efc47254a12f2ec324d12c..f62a1800900b6d7f4fac2b1e501a3713cb950788 100644 --- a/Trigger/TrigAlgorithms/TrigMinBias/src/TrackCountHypoTool.h +++ b/Trigger/TrigAlgorithms/TrigMinBias/src/TrackCountHypoTool.h @@ -31,13 +31,11 @@ public: private: HLT::Identifier m_decisionId; - Gaudi::Property<float> m_min_pt{this, "min_pt",0.1, "Accept events with momentum higher than this limit in MeV"}; - Gaudi::Property<float> m_max_z0{this, "max_z0",100, "Accept events with absolute value of vertex lower than this limit in mm"}; - Gaudi::Property<float> m_required_ntrks{this, "required_ntrks", 1, "Accept events with minimum of this number of tracks"}; - Gaudi::Property<float> m_max_required_ntrks{this, "max_required_ntrks", -1, "Accept events with maximum of this number of tracks"}; + Gaudi::Property<float> m_minPt{this, "minPt",0.1, "Accept events with momentum higher than this limit in MeV"}; + Gaudi::Property<float> m_maxZ0{this, "maxZ0",100, "Accept events with absolute value of vertex lower than this limit in mm"}; + Gaudi::Property<float> m_minNtrks{this, "minNtrks", 1, "Accept events with minimum of this number of tracks, -1 means this cut is disabled"}; + Gaudi::Property<float> m_maxNtrks{this, "maxNtrks", -1, "Accept events with maximum of this number of tracks, -1 means this cut is disabled"}; Gaudi::Property<bool> m_acceptAll{this, "acceptAll", false, "Accept all events"}; - Gaudi::Property<bool> m_cutMinAndMax{this, "cutMinAndMax", false, "take events within the given higher and lower limt/cut"}; - Gaudi::Property<bool> m_logicAnd{this, "TriggerTypeAnd", true, "And/Or Logic"}; }; #endif //> !TRIGT2MINBIAS_TRACKCOUNTHYPOTOOL_H diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/MinBias/MinBiasMenuSequences.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/MinBias/MinBiasMenuSequences.py index 1f3adb4398edb76e73b19ffae563340c750bfc4b..a23cf16951fa24f720879285b293a57f77e80044 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/MinBias/MinBiasMenuSequences.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/MinBias/MinBiasMenuSequences.py @@ -15,156 +15,121 @@ from TrigInDetConfig.ConfigSettings import getInDetTrigConfig ######## # to move into TrigMinBiasHypoConfigMT? -def SPCountHypoToolGen(chainDict): +def SPCountHypoToolGen(chainDict): from TrigT2MinBias.TrigT2MinBiasConf import SPCountHypoTool hypo = SPCountHypoTool(chainDict["chainName"]) if "hmt" in chainDict["chainName"]: - hypo.totNumSctSP = int( chainDict["chainParts"][0]["hypoL2Info"].strip("sp") ) + hypo.totNumSctSP = int(chainDict["chainParts"][0]["hypoL2Info"].strip("sp")) if "mb_sptrk" in chainDict["chainName"]: - hypo.totNumPixSP = 2 - hypo.totNumSctSP = 3 + hypo.totNumPixSP = 2 + hypo.totNumSctSP = 3 # will set here thresholds return hypo def TrackCountHypoToolGen(chainDict): - from TrigMinBias.TrigMinBiasConf import TrackCountHypoTool + from TrigMinBias.TrigMinBiasConf import TrackCountHypoTool hypo = TrackCountHypoTool(chainDict["chainName"]) if "hmt" in chainDict["chainName"]: - hypo.required_ntrks = int( chainDict["chainParts"][0]["hypoEFInfo"].strip("trk") ) + hypo.minNtrks = int(chainDict["chainParts"][0]["hypoEFInfo"].strip("trk")) if "mb_sptrk" in chainDict["chainName"]: - hypo.min_pt = 0.2 - hypo.max_z0 = 401 + hypo.minPt = 0.2 + hypo.maxZ0 = 401 # will set here cuts return hypo ### Now the sequences -# These are obsoletee and can probably be deleted. Leeft here commented as need feedback fomr experts - -## def minbiasSpacePointMenuSequence(): -## # menu components -## # retrieve the reco seuqnece -## from TriggerMenuMT.HLTMenuConfig.MinBias.MinBiasSPRecoSequences import minbiasSpacePointAthSequence -## ( minbiasSpacePointSequence, InputMakerAlg, sequenceOut) = RecoFragmentsPool.retrieve(minbiasSpacePointAthSequence,ConfigFlags) +def MinBiasSPSequence(): + spAlgsList = [] + from TrigT2MinBias.TrigT2MinBiasConf import TrigCountSpacePointsMT, SPCountHypoAlgMT -## #hypo -## mbHypoAlg = MbCountHypoAlgMT("MinBiasHypoAlg_sp") -## mbHypoAlg.MinBiasContainerKey=sequenceOut + spInputMakerAlg = EventViewCreatorAlgorithm("IM_SPEventViewCreator") + spInputMakerAlg.ViewFallThrough = True + spInputMakerAlg.RoITool = ViewCreatorInitialROITool() + spInputMakerAlg.InViewRoIs = "InputRoI" + spInputMakerAlg.Views = "SPView" + + idTrigConfig = getInDetTrigConfig('minBias') + idAlgs, verifier = makeInDetAlgs(config=idTrigConfig, + rois=spInputMakerAlg.InViewRoIs, + viewVerifier='SPViewDataVerifier') + verifier.DataObjects += [('TrigRoiDescriptorCollection', 'StoreGateSvc+InputRoI'), + ('SCT_ID', 'DetectorStore+SCT_ID'), + ('PixelID', 'DetectorStore+PixelID'), + ('TagInfo', 'DetectorStore+ProcessingTags')] -## return MenuSequence( Sequence = minbiasSpacePointSequence, -## Maker = InputMakerAlg, -## Hypo = mbHypoAlg, -## HypoToolGen = TrigMinBiasHypoToolFromDict ) + # Make sure required objects are still available at whole-event level + from AthenaCommon.AlgSequence import AlgSequence + topSequence = AlgSequence() + topSequence.SGInputLoader.Load += [('SCT_ID', 'DetectorStore+SCT_ID'), + ('PixelID', 'DetectorStore+PixelID'), + ('TagInfo', 'DetectorStore+ProcessingTags')] + spAlgsList = idAlgs[:-2] -## #obsolete? -## def minbiasTrackMenuSequence(): -## # menu components -## # retrieve the reco seuqnece -## from TriggerMenuMT.HLTMenuConfig.MinBias.MinBiasTrkRecoSequences import minbiasTrackAthSequence -## (minbiasTrackSequence, InputMakerAlg, sequenceOut) = RecoFragmentsPool.retrieve(minbiasTrackAthSequence,ConfigFlags) + spCount = TrigCountSpacePointsMT() + spCount.SpacePointsKey = recordable("HLT_SpacePointCounts") -## #hypo -## mbHypoAlg = MbCountHypoAlgMT("MinBiasHypoAlg_trk") -## mbHypoAlg.MinBiasContainerKey=sequenceOut + from TrigT2MinBias.TrigT2MinBiasMonitoringMT import SpCountMonitoring + spCount.MonTool = SpCountMonitoring() -## return MenuSequence( Sequence = minbiasTrackSequence, -## Maker = InputMakerAlg, -## Hypo = mbHypoAlg, -## HypoToolGen = TrigMinBiasHypoToolFromDict ) + spRecoSeq = parOR("spRecoSeq", spAlgsList + [spCount]) + spSequence = seqAND("spSequence", [spInputMakerAlg, spRecoSeq]) + spInputMakerAlg.ViewNodeName = spRecoSeq.name() -# NEW: -def MinBiasSPSequence(): - SpList = [] - from TrigT2MinBias.TrigT2MinBiasConf import TrigCountSpacePointsMT, SPCountHypoAlgMT + spCountHypo =SPCountHypoAlgMT() + spCountHypo.SpacePointsKey=recordable("HLT_SpacePointCounts") - SPInputMakerAlg = EventViewCreatorAlgorithm("IM_SPEventViewCreator") - SPInputMakerAlg.ViewFallThrough = True - SPInputMakerAlg.RoITool = ViewCreatorInitialROITool() - SPInputMakerAlg.InViewRoIs = "InputRoI" - SPInputMakerAlg.Views = "SPView" - - IDTrigConfig = getInDetTrigConfig( 'minBias' ) - idAlgs, verifier = makeInDetAlgs( config = IDTrigConfig, rois=SPInputMakerAlg.InViewRoIs, viewVerifier='SPViewDataVerifier' ) - verifier.DataObjects += [( 'TrigRoiDescriptorCollection' , 'StoreGateSvc+InputRoI' ), - ( 'SCT_ID' , 'DetectorStore+SCT_ID' ), - ( 'PixelID' , 'DetectorStore+PixelID' ), - ( 'TagInfo' , 'DetectorStore+ProcessingTags' )] - - # Make sure required objects are still available at whole-event level - from AthenaCommon.AlgSequence import AlgSequence - topSequence = AlgSequence() - topSequence.SGInputLoader.Load += [( 'SCT_ID' , 'DetectorStore+SCT_ID' ), - ( 'PixelID' , 'DetectorStore+PixelID' ), - ( 'TagInfo' , 'DetectorStore+ProcessingTags' )] - - SpList = idAlgs[:-2] - - SpCount=TrigCountSpacePointsMT() - SpCount.SpacePointsKey=recordable("HLT_SpacePointCounts") - - from TrigT2MinBias.TrigT2MinBiasMonitoringMT import SpCountMonitoring - SpCount.MonTool = SpCountMonitoring() - - SPrecoSeq = parOR("SPrecoSeq", SpList + [ SpCount ]) - SPSequence = seqAND("SPSequence", [SPInputMakerAlg, SPrecoSeq]) - SPInputMakerAlg.ViewNodeName = SPrecoSeq.name() - - - SpCountHypo =SPCountHypoAlgMT() - SpCountHypo.SpacePointsKey=recordable("HLT_SpacePointCounts") - - return MenuSequence( Sequence = SPSequence, - Maker = SPInputMakerAlg, - Hypo = SpCountHypo, + return MenuSequence(Sequence = spSequence, + Maker = spInputMakerAlg, + Hypo = spCountHypo, HypoToolGen = SPCountHypoToolGen ) def MinBiasTrkSequence(): from TrigMinBias.TrigMinBiasConf import TrackCountHypoAlgMT - TrkInputMakerAlg = EventViewCreatorAlgorithm("IM_TrkEventViewCreator") - TrkInputMakerAlg.ViewFallThrough = True - TrkInputMakerAlg.RoITool = ViewCreatorInitialROITool() - TrkInputMakerAlg.InViewRoIs = "InputRoI" # contract with the consumer - TrkInputMakerAlg.Views = "TrkView" - TrkInputMakerAlg.RequireParentView = True - TrkInputMakerAlg.ViewNodeName = "TrkCountHypoAlgMTNode" - - # prepare algorithms to run in views, first, inform scheduler that input data is available in parent view (has to be done by hand) - IDTrigConfig = getInDetTrigConfig( 'minBias' ) - idAlgs, verifier = makeInDetAlgs( config = IDTrigConfig, rois=TrkInputMakerAlg.InViewRoIs, viewVerifier='TrkrecoSeqDataVerifier') - verifier.DataObjects += [( 'TrigRoiDescriptorCollection' , 'StoreGateSvc+InputRoI' ), - ( 'IDCInDetBSErrContainer' , 'StoreGateSvc+SCT_FlaggedCondData_TRIG' ), - ( 'InDet::SCT_ClusterContainer' , 'StoreGateSvc+SCT_TrigClusters' ), - ( 'SpacePointContainer' , 'StoreGateSvc+SCT_TrigSpacePoints' ), - ( 'InDet::PixelClusterContainer' , 'StoreGateSvc+PixelTrigClusters' ), - ( 'SpacePointContainer' , 'StoreGateSvc+PixelTrigSpacePoints' )] + trkInputMakerAlg = EventViewCreatorAlgorithm("IM_TrkEventViewCreator") + trkInputMakerAlg.ViewFallThrough = True + trkInputMakerAlg.RoITool = ViewCreatorInitialROITool() + trkInputMakerAlg.InViewRoIs = "InputRoI" # contract with the consumer + trkInputMakerAlg.Views = "TrkView" + trkInputMakerAlg.RequireParentView = True + trkInputMakerAlg.ViewNodeName = "TrkCountHypoAlgMTNode" + + # prepare algorithms to run in views, first, + # inform scheduler that input data is available in parent view (has to be done by hand) + idTrigConfig = getInDetTrigConfig('minBias') + idAlgs, verifier = makeInDetAlgs(config=idTrigConfig, rois=trkInputMakerAlg.InViewRoIs, viewVerifier='TrkrecoSeqDataVerifier') + verifier.DataObjects += [('TrigRoiDescriptorCollection', 'StoreGateSvc+InputRoI'), + ('IDCInDetBSErrContainer', 'StoreGateSvc+SCT_FlaggedCondData_TRIG'), + ('InDet::SCT_ClusterContainer', 'StoreGateSvc+SCT_TrigClusters'), + ('SpacePointContainer', 'StoreGateSvc+SCT_TrigSpacePoints'), + ('InDet::PixelClusterContainer', 'StoreGateSvc+PixelTrigClusters'), + ('SpacePointContainer', 'StoreGateSvc+PixelTrigSpacePoints')] if globalflags.InputFormat.is_bytestream(): - verifier.DataObjects += [( 'IDCInDetBSErrContainer' , 'StoreGateSvc+PixelByteStreamErrs' ), - ( 'IDCInDetBSErrContainer' , 'StoreGateSvc+SCT_ByteStreamErrs' )] + verifier.DataObjects += [('IDCInDetBSErrContainer', 'StoreGateSvc+PixelByteStreamErrs'), + ('IDCInDetBSErrContainer', 'StoreGateSvc+SCT_ByteStreamErrs')] - TrkList = idAlgs[-2:] # FTF and Track to xAOD::TrackParticle conversion alg - TrackCountHypo=TrackCountHypoAlgMT() - TrackCountHypo.trackCountKey=recordable("HLT_TrackCount") - TrackCountHypo.tracksKey=recordable("HLT_IDTrack_MinBias_FTF") + trkList = idAlgs[-2:] # FTF and Track to xAOD::TrackParticle conversion alg + trackCountHypo = TrackCountHypoAlgMT() + trackCountHypo.trackCountKey = recordable("HLT_TrackCount") + trackCountHypo.tracksKey = recordable("HLT_IDTrack_MinBias_FTF") from TrigMinBias.TrackCountMonitoringMT import TrackCountMonitoring - TrackCountHypo.MonTool = TrackCountMonitoring() - - TrkrecoSeq = parOR("TrkrecoSeq", [verifier]+TrkList) - TrkSequence = seqAND("TrkSequence", [TrkInputMakerAlg, TrkrecoSeq]) - TrkInputMakerAlg.ViewNodeName = TrkrecoSeq.name() - - return MenuSequence( Sequence = TrkSequence, - Maker = TrkInputMakerAlg, - Hypo = TrackCountHypo, - HypoToolGen = TrackCountHypoToolGen ) + trackCountHypo.MonTool = TrackCountMonitoring() + trkRecoSeq = parOR("TrkrecoSeq", [verifier]+trkList) + trkSequence = seqAND("TrkSequence", [trkInputMakerAlg, trkRecoSeq]) + trkInputMakerAlg.ViewNodeName = trkRecoSeq.name() + return MenuSequence(Sequence = trkSequence, + Maker = trkInputMakerAlg, + Hypo = trackCountHypo, + HypoToolGen = TrackCountHypoToolGen)