Skip to content
Snippets Groups Projects
Commit c0dc01a8 authored by Frank Winklmeier's avatar Frank Winklmeier
Browse files

Merge branch 'fix-mbsptr-track-z-sel-range' into 'master'

Small fixes and renaming in min bias tracks counting algs & config

See merge request atlas/athena!39313
parents b57205f9 ca2760e6
No related branches found
No related tags found
No related merge requests found
...@@ -2,9 +2,11 @@ ...@@ -2,9 +2,11 @@
def TrackCountMonitoring(): def TrackCountMonitoring():
from AthenaMonitoringKernel.GenericMonitoringTool import GenericMonitoringTool from AthenaMonitoringKernel.GenericMonitoringTool import GenericMonitoringTool
monTool = GenericMonitoringTool('MonTool') 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 from TrigMinBias.TrigMinBiasConf import TrackCountHypoAlgMT
alg=TrackCountHypoAlgMT() alg=TrackCountHypoAlgMT()
for i in range(len(alg.min_pt)): for i in range(len(alg.minPt)):
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) 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 return monTool
...@@ -8,19 +8,18 @@ Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration ...@@ -8,19 +8,18 @@ Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
#include "AthViews/ViewHelper.h" #include "AthViews/ViewHelper.h"
using TrigCompositeUtils::createAndStore; using TrigCompositeUtils::createAndStore;
using TrigCompositeUtils::DecisionContainer;
using TrigCompositeUtils::DecisionAuxContainer; using TrigCompositeUtils::DecisionAuxContainer;
using TrigCompositeUtils::DecisionContainer;
using TrigCompositeUtils::DecisionIDContainer; using TrigCompositeUtils::DecisionIDContainer;
using TrigCompositeUtils::decisionIDs; using TrigCompositeUtils::decisionIDs;
using TrigCompositeUtils::newDecisionIn;
using TrigCompositeUtils::linkToPrevious;
using TrigCompositeUtils::viewString;
using TrigCompositeUtils::featureString; using TrigCompositeUtils::featureString;
using TrigCompositeUtils::findLink; using TrigCompositeUtils::findLink;
using TrigCompositeUtils::LinkInfo; using TrigCompositeUtils::LinkInfo;
using TrigCompositeUtils::linkToPrevious;
using TrigCompositeUtils::newDecisionIn;
using TrigCompositeUtils::viewString;
TrackCountHypoAlgMT::TrackCountHypoAlgMT(const std::string& name, ISvcLocator* pSvcLocator) : TrackCountHypoAlgMT::TrackCountHypoAlgMT(const std::string &name, ISvcLocator *pSvcLocator) : ::HypoBase(name, pSvcLocator)
::HypoBase(name, pSvcLocator)
{ {
} }
...@@ -29,103 +28,114 @@ StatusCode TrackCountHypoAlgMT::initialize() ...@@ -29,103 +28,114 @@ StatusCode TrackCountHypoAlgMT::initialize()
ATH_CHECK(m_tracksKey.initialize()); ATH_CHECK(m_tracksKey.initialize());
ATH_CHECK(m_trackCountKey.initialize()); ATH_CHECK(m_trackCountKey.initialize());
renounce(m_tracksKey); 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") { if (m_tracksKey.key() == "Undefined" || m_trackCountKey.key() == "Undefined")
ATH_MSG_ERROR("either track Key name or track count key name is undefined " ); {
ATH_MSG_ERROR("either track Key name or track count key name is undefined ");
return StatusCode::FAILURE; return StatusCode::FAILURE;
} }
ATH_CHECK(m_hypoTools.retrieve()); 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; return StatusCode::SUCCESS;
} }
StatusCode TrackCountHypoAlgMT::execute(const EventContext& context) const StatusCode TrackCountHypoAlgMT::execute(const EventContext &context) const
{ {
ATH_MSG_DEBUG ( "Executing " << name() << "..." ); ATH_MSG_DEBUG("Executing " << name() << "...");
auto previousDecisionsHandle = SG::makeHandle( decisionInput(), context ); auto previousDecisionsHandle = SG::makeHandle(decisionInput(), context);
if( not previousDecisionsHandle.isValid() ) {//implicit if (not previousDecisionsHandle.isValid())
ATH_MSG_DEBUG( "No implicit RH for previous decisions "<< decisionInput().key()<<": is this expected?" ); { //implicit
ATH_MSG_DEBUG("No implicit RH for previous decisions " << decisionInput().key() << ": is this expected?");
return StatusCode::SUCCESS; return StatusCode::SUCCESS;
} }
if (previousDecisionsHandle->size() == 0) { if (previousDecisionsHandle->size() == 0)
ATH_MSG_DEBUG( "No previous decision, nothing to do."); {
ATH_MSG_DEBUG("No previous decision, nothing to do.");
return StatusCode::SUCCESS; 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; 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() ); int ntrks = tracksHandle->size();
ATH_CHECK( viewTrk.isValid() ); ATH_MSG_DEBUG("Successfully retrieved track container of size" << ntrks);
auto tracksHandle = ViewHelper::makeHandle( *viewTrk, m_tracksKey, context );
ATH_CHECK( tracksHandle.isValid() );
ATH_MSG_DEBUG ( "spacepoint handle size: " << tracksHandle->size() << "..." );
int ntrks=tracksHandle->size(); std::vector<int> counts(m_minPt.size());
ATH_MSG_DEBUG ("Successfully retrieved track container of size" <<ntrks); for (const auto trackPtr : *tracksHandle)
{
std::vector<int> counts(m_min_pt.size()); const Trk::Perigee &aMeasPer = trackPtr->perigeeParameters();
for (const auto trackPtr: *tracksHandle){
const Trk::Perigee& aMeasPer = trackPtr->perigeeParameters();
const double pT = aMeasPer.pT(); const double pT = aMeasPer.pT();
const double z0 = aMeasPer.parameters()[Trk::z0]; const double z0 = aMeasPer.parameters()[Trk::z0];
for (long unsigned int i=0;i<m_min_pt.size();i++){ for (long unsigned int i = 0; i < m_minPt.size(); i++)
if(pT >= m_min_pt[i] && std::fabs(z0) < m_max_z0[i]) counts[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++){ for (long unsigned int i = 0; i < m_minPt.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] ); {
ATH_MSG_DEBUG("Number of tracks found with pT cut= " << m_minPt[i] << " MeV ="
<< "and z0 cut= " << m_maxZ0[i] << counts[i]);
} }
// Recording Data // Recording Data
auto trackCountContainer = std::make_unique< xAOD::TrigCompositeContainer>(); auto trackCountContainer = std::make_unique<xAOD::TrigCompositeContainer>();
auto trackCountContainerAux = std::make_unique< xAOD::TrigCompositeAuxContainer>(); auto trackCountContainerAux = std::make_unique<xAOD::TrigCompositeAuxContainer>();
trackCountContainer->setStore(trackCountContainerAux.get()); trackCountContainer->setStore(trackCountContainerAux.get());
xAOD::TrigComposite * trackCount = new xAOD::TrigComposite(); xAOD::TrigComposite *trackCount = new xAOD::TrigComposite();
trackCountContainer->push_back(trackCount); trackCountContainer->push_back(trackCount);
trackCount->setDetail("ntrks", ntrks); trackCount->setDetail("ntrks", ntrks);
trackCount->setDetail("pTcuts", static_cast<std::vector<float>>(m_min_pt)); trackCount->setDetail("pTcuts", static_cast<std::vector<float>>(m_minPt));
trackCount->setDetail("z0cuts", static_cast<std::vector<float>>(m_max_z0)); trackCount->setDetail("z0cuts", static_cast<std::vector<float>>(m_maxZ0));
trackCount->setDetail("counts", counts); trackCount->setDetail("counts", counts);
// TODO revisit // TODO revisit
auto mon_ntrks = Monitored::Scalar<int>("ntrks",ntrks); auto mon_ntrks = Monitored::Scalar<int>("ntrks", ntrks);
Monitored::Group(m_monTool,mon_ntrks); Monitored::Group(m_monTool, mon_ntrks);
for(long unsigned int i=0;i<counts.size();i++){ 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_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 decisions = outputHandle.ptr();
auto d = newDecisionIn( decisions); auto d = newDecisionIn(decisions);
linkToPrevious( d, decisionInput().key(), 0 ); linkToPrevious(d, decisionInput().key(), 0);
TrigCompositeUtils::DecisionIDContainer prev; TrigCompositeUtils::DecisionIDContainer prev;
TrigCompositeUtils::decisionIDs( previousDecisionsHandle->at(0), prev ); TrigCompositeUtils::decisionIDs(previousDecisionsHandle->at(0), prev);
TrackCountHypoTool::TrkCountsInfo trkinfo{d, trackCount, prev}; TrackCountHypoTool::TrkCountsInfo trkinfo{d, trackCount, prev};
for(auto &tool:m_hypoTools) for (auto &tool : m_hypoTools)
{ {
ATH_CHECK(tool->decide(trkinfo)); ATH_CHECK(tool->decide(trkinfo));
} }
SG::WriteHandle<xAOD::TrigCompositeContainer> trackCountHandle(m_trackCountKey, context); SG::WriteHandle<xAOD::TrigCompositeContainer> trackCountHandle(m_trackCountKey, context);
ATH_CHECK(trackCountHandle.record( std::move( trackCountContainer ), std::move( trackCountContainerAux ) ) ); ATH_CHECK(trackCountHandle.record(std::move(trackCountContainer), std::move(trackCountContainerAux)));
d->setObjectLink( featureString(), ElementLink<xAOD::TrigCompositeContainer>( m_trackCountKey.key(), 0) ); d->setObjectLink(featureString(), ElementLink<xAOD::TrigCompositeContainer>(m_trackCountKey.key(), 0));
//ATH_CHECK( hypoBaseOutputProcessing(outputHandle) ); //ATH_CHECK( hypoBaseOutputProcessing(outputHandle) );
return StatusCode::SUCCESS; return StatusCode::SUCCESS;
} }
...@@ -27,12 +27,12 @@ public: ...@@ -27,12 +27,12 @@ public:
private: private:
TrackCountHypoAlgMT(); TrackCountHypoAlgMT();
ToolHandleArray< TrackCountHypoTool > m_hypoTools {this, "HypoTools", {},"Tools that perform actual selection"}; ToolHandleArray< TrackCountHypoTool > m_hypoTools {this, "HypoTools", {}, "Tools that perform actual selection"};
SG::ReadHandleKey<xAOD::TrackParticleContainer> m_tracksKey{this,"tracksKey","Undefined",""}; SG::ReadHandleKey<xAOD::TrackParticleContainer> m_tracksKey{this, "tracksKey", "Undefined", ""};
SG::WriteHandleKey<xAOD::TrigCompositeContainer> m_trackCountKey{this,"trackCountKey","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_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_max_z0{this, "max_z0",{100,401,200,300}, "Accept events with absolute value of vertex position lower \ 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 min_pT vector, repetition of cut values are allowed if that makes the number of elements the same"}; 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"}; ToolHandle<GenericMonitoringTool> m_monTool{this,"MonTool", "", "Monitoring tool"};
}; };
#endif // TRIGT2MINBIAS_TRACKCOUNTHYPOALGMT_H #endif // TRIGT2MINBIAS_TRACKCOUNTHYPOALGMT_H
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
*/ */
#include "TrigCompositeUtils/HLTIdentifier.h" #include "TrigCompositeUtils/HLTIdentifier.h"
#include "AthenaMonitoringKernel/Monitored.h" #include "AthenaMonitoringKernel/Monitored.h"
...@@ -11,19 +10,26 @@ Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration ...@@ -11,19 +10,26 @@ Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
using namespace TrigCompositeUtils; using namespace TrigCompositeUtils;
TrackCountHypoTool::TrackCountHypoTool( const std::string& type,const std::string& name,const IInterface* parent ) TrackCountHypoTool::TrackCountHypoTool(const std::string &type, const std::string &name, const IInterface *parent)
: AthAlgTool( type, name, parent ), : AthAlgTool(type, name, parent),
m_decisionId( HLT::Identifier::fromToolName( name ) ) {} m_decisionId(HLT::Identifier::fromToolName(name)) {}
StatusCode TrackCountHypoTool::initialize() { StatusCode TrackCountHypoTool::initialize()
{
return StatusCode::SUCCESS; return StatusCode::SUCCESS;
} }
StatusCode TrackCountHypoTool::decide( TrkCountsInfo& trkinfo ) const { StatusCode TrackCountHypoTool::decide(TrkCountsInfo &trkinfo) const
if ( trkinfo.previousDecisionIDs.count( m_decisionId.numeric() ) == 0 ) { {
if (trkinfo.previousDecisionIDs.count(m_decisionId.numeric()) == 0)
{
ATH_MSG_DEBUG("Already rejected"); ATH_MSG_DEBUG("Already rejected");
return StatusCode::SUCCESS; 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; std::vector<int> counts;
...@@ -34,35 +40,35 @@ StatusCode TrackCountHypoTool::decide( TrkCountsInfo& trkinfo ) const { ...@@ -34,35 +40,35 @@ StatusCode TrackCountHypoTool::decide( TrkCountsInfo& trkinfo ) const {
trkinfo.counts->getDetail<std::vector<float>>("z0cuts", z0cuts); trkinfo.counts->getDetail<std::vector<float>>("z0cuts", z0cuts);
float countForConfiguredPtThreshold{}; float countForConfiguredPtThreshold{};
bool found{false}; bool found{false};
for ( size_t i = 0; i < counts.size(); ++i ) { 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 ) { {
if (std::abs(pTcuts[i] - m_minPt) < 0.001 && std::abs(z0cuts[i] - m_maxZ0) < 0.001)
{
found = true; found = true;
countForConfiguredPtThreshold = counts[i]; 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"); if (!found)
for ( size_t i = 0; i < counts.size(); ++i ) { {
ATH_MSG_ERROR( "Count of tracks of pT above " << pTcuts[i] << " is available"); 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)
return StatusCode::FAILURE; {
ATH_MSG_ERROR("Count of tracks of pT above " << pTcuts[i] << " and z0 requirement " << z0cuts[i] << " that are available");
}
return StatusCode::FAILURE;
} }
else{ else
ATH_MSG_DEBUG ("REGTEST found "<<countForConfiguredPtThreshold <<" tracks for "<<m_min_pt); {
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), const bool minTrkPassed = (m_minNtrks == -1) or (countForConfiguredPtThreshold > m_minNtrks);
(m_max_required_ntrks != -1 ? m_max_required_ntrks > countForConfiguredPtThreshold : (bool)m_logicAnd) const bool maxTrkPassed = (m_maxNtrks == -1) or (countForConfiguredPtThreshold < m_maxNtrks);
});
if(m_logicAnd && !std::all_of(decisionCuts.begin(),decisionCuts.end(),[](bool k ){return k; }) ){ if ( minTrkPassed and maxTrkPassed ) {
addDecisionID(m_decisionId.numeric(), trkinfo.decision);
return StatusCode::SUCCESS; ATH_MSG_DEBUG("REGTEST event accepted");
}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");
} }
return StatusCode::SUCCESS; return StatusCode::SUCCESS;
} }
...@@ -31,13 +31,11 @@ public: ...@@ -31,13 +31,11 @@ public:
private: private:
HLT::Identifier m_decisionId; 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_minPt{this, "minPt",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_maxZ0{this, "maxZ0",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_minNtrks{this, "minNtrks", 1, "Accept events with minimum of this number of tracks, -1 means this cut is disabled"};
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_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_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 #endif //> !TRIGT2MINBIAS_TRACKCOUNTHYPOTOOL_H
...@@ -15,156 +15,121 @@ from TrigInDetConfig.ConfigSettings import getInDetTrigConfig ...@@ -15,156 +15,121 @@ from TrigInDetConfig.ConfigSettings import getInDetTrigConfig
######## ########
# to move into TrigMinBiasHypoConfigMT? # to move into TrigMinBiasHypoConfigMT?
def SPCountHypoToolGen(chainDict): def SPCountHypoToolGen(chainDict):
from TrigT2MinBias.TrigT2MinBiasConf import SPCountHypoTool from TrigT2MinBias.TrigT2MinBiasConf import SPCountHypoTool
hypo = SPCountHypoTool(chainDict["chainName"]) hypo = SPCountHypoTool(chainDict["chainName"])
if "hmt" in 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"]: if "mb_sptrk" in chainDict["chainName"]:
hypo.totNumPixSP = 2 hypo.totNumPixSP = 2
hypo.totNumSctSP = 3 hypo.totNumSctSP = 3
# will set here thresholds # will set here thresholds
return hypo return hypo
def TrackCountHypoToolGen(chainDict): def TrackCountHypoToolGen(chainDict):
from TrigMinBias.TrigMinBiasConf import TrackCountHypoTool from TrigMinBias.TrigMinBiasConf import TrackCountHypoTool
hypo = TrackCountHypoTool(chainDict["chainName"]) hypo = TrackCountHypoTool(chainDict["chainName"])
if "hmt" in 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"]: if "mb_sptrk" in chainDict["chainName"]:
hypo.min_pt = 0.2 hypo.minPt = 0.2
hypo.max_z0 = 401 hypo.maxZ0 = 401
# will set here cuts # will set here cuts
return hypo return hypo
### Now the sequences ### Now the sequences
# These are obsoletee and can probably be deleted. Leeft here commented as need feedback fomr experts def MinBiasSPSequence():
spAlgsList = []
## def minbiasSpacePointMenuSequence(): from TrigT2MinBias.TrigT2MinBiasConf import TrigCountSpacePointsMT, SPCountHypoAlgMT
## # menu components
## # retrieve the reco seuqnece
## from TriggerMenuMT.HLTMenuConfig.MinBias.MinBiasSPRecoSequences import minbiasSpacePointAthSequence
## ( minbiasSpacePointSequence, InputMakerAlg, sequenceOut) = RecoFragmentsPool.retrieve(minbiasSpacePointAthSequence,ConfigFlags)
## #hypo spInputMakerAlg = EventViewCreatorAlgorithm("IM_SPEventViewCreator")
## mbHypoAlg = MbCountHypoAlgMT("MinBiasHypoAlg_sp") spInputMakerAlg.ViewFallThrough = True
## mbHypoAlg.MinBiasContainerKey=sequenceOut 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, # Make sure required objects are still available at whole-event level
## Maker = InputMakerAlg, from AthenaCommon.AlgSequence import AlgSequence
## Hypo = mbHypoAlg, topSequence = AlgSequence()
## HypoToolGen = TrigMinBiasHypoToolFromDict ) topSequence.SGInputLoader.Load += [('SCT_ID', 'DetectorStore+SCT_ID'),
('PixelID', 'DetectorStore+PixelID'),
('TagInfo', 'DetectorStore+ProcessingTags')]
spAlgsList = idAlgs[:-2]
## #obsolete? spCount = TrigCountSpacePointsMT()
## def minbiasTrackMenuSequence(): spCount.SpacePointsKey = recordable("HLT_SpacePointCounts")
## # menu components
## # retrieve the reco seuqnece
## from TriggerMenuMT.HLTMenuConfig.MinBias.MinBiasTrkRecoSequences import minbiasTrackAthSequence
## (minbiasTrackSequence, InputMakerAlg, sequenceOut) = RecoFragmentsPool.retrieve(minbiasTrackAthSequence,ConfigFlags)
## #hypo from TrigT2MinBias.TrigT2MinBiasMonitoringMT import SpCountMonitoring
## mbHypoAlg = MbCountHypoAlgMT("MinBiasHypoAlg_trk") spCount.MonTool = SpCountMonitoring()
## mbHypoAlg.MinBiasContainerKey=sequenceOut
## return MenuSequence( Sequence = minbiasTrackSequence, spRecoSeq = parOR("spRecoSeq", spAlgsList + [spCount])
## Maker = InputMakerAlg, spSequence = seqAND("spSequence", [spInputMakerAlg, spRecoSeq])
## Hypo = mbHypoAlg, spInputMakerAlg.ViewNodeName = spRecoSeq.name()
## HypoToolGen = TrigMinBiasHypoToolFromDict )
# NEW: spCountHypo =SPCountHypoAlgMT()
def MinBiasSPSequence(): spCountHypo.SpacePointsKey=recordable("HLT_SpacePointCounts")
SpList = []
from TrigT2MinBias.TrigT2MinBiasConf import TrigCountSpacePointsMT, SPCountHypoAlgMT
SPInputMakerAlg = EventViewCreatorAlgorithm("IM_SPEventViewCreator") return MenuSequence(Sequence = spSequence,
SPInputMakerAlg.ViewFallThrough = True Maker = spInputMakerAlg,
SPInputMakerAlg.RoITool = ViewCreatorInitialROITool() Hypo = spCountHypo,
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,
HypoToolGen = SPCountHypoToolGen ) HypoToolGen = SPCountHypoToolGen )
def MinBiasTrkSequence(): def MinBiasTrkSequence():
from TrigMinBias.TrigMinBiasConf import TrackCountHypoAlgMT from TrigMinBias.TrigMinBiasConf import TrackCountHypoAlgMT
TrkInputMakerAlg = EventViewCreatorAlgorithm("IM_TrkEventViewCreator") trkInputMakerAlg = EventViewCreatorAlgorithm("IM_TrkEventViewCreator")
TrkInputMakerAlg.ViewFallThrough = True trkInputMakerAlg.ViewFallThrough = True
TrkInputMakerAlg.RoITool = ViewCreatorInitialROITool() trkInputMakerAlg.RoITool = ViewCreatorInitialROITool()
TrkInputMakerAlg.InViewRoIs = "InputRoI" # contract with the consumer trkInputMakerAlg.InViewRoIs = "InputRoI" # contract with the consumer
TrkInputMakerAlg.Views = "TrkView" trkInputMakerAlg.Views = "TrkView"
TrkInputMakerAlg.RequireParentView = True trkInputMakerAlg.RequireParentView = True
TrkInputMakerAlg.ViewNodeName = "TrkCountHypoAlgMTNode" 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) # prepare algorithms to run in views, first,
IDTrigConfig = getInDetTrigConfig( 'minBias' ) # inform scheduler that input data is available in parent view (has to be done by hand)
idAlgs, verifier = makeInDetAlgs( config = IDTrigConfig, rois=TrkInputMakerAlg.InViewRoIs, viewVerifier='TrkrecoSeqDataVerifier') idTrigConfig = getInDetTrigConfig('minBias')
verifier.DataObjects += [( 'TrigRoiDescriptorCollection' , 'StoreGateSvc+InputRoI' ), idAlgs, verifier = makeInDetAlgs(config=idTrigConfig, rois=trkInputMakerAlg.InViewRoIs, viewVerifier='TrkrecoSeqDataVerifier')
( 'IDCInDetBSErrContainer' , 'StoreGateSvc+SCT_FlaggedCondData_TRIG' ), verifier.DataObjects += [('TrigRoiDescriptorCollection', 'StoreGateSvc+InputRoI'),
( 'InDet::SCT_ClusterContainer' , 'StoreGateSvc+SCT_TrigClusters' ), ('IDCInDetBSErrContainer', 'StoreGateSvc+SCT_FlaggedCondData_TRIG'),
( 'SpacePointContainer' , 'StoreGateSvc+SCT_TrigSpacePoints' ), ('InDet::SCT_ClusterContainer', 'StoreGateSvc+SCT_TrigClusters'),
( 'InDet::PixelClusterContainer' , 'StoreGateSvc+PixelTrigClusters' ), ('SpacePointContainer', 'StoreGateSvc+SCT_TrigSpacePoints'),
( 'SpacePointContainer' , 'StoreGateSvc+PixelTrigSpacePoints' )] ('InDet::PixelClusterContainer', 'StoreGateSvc+PixelTrigClusters'),
('SpacePointContainer', 'StoreGateSvc+PixelTrigSpacePoints')]
if globalflags.InputFormat.is_bytestream(): if globalflags.InputFormat.is_bytestream():
verifier.DataObjects += [( 'IDCInDetBSErrContainer' , 'StoreGateSvc+PixelByteStreamErrs' ), verifier.DataObjects += [('IDCInDetBSErrContainer', 'StoreGateSvc+PixelByteStreamErrs'),
( 'IDCInDetBSErrContainer' , 'StoreGateSvc+SCT_ByteStreamErrs' )] ('IDCInDetBSErrContainer', 'StoreGateSvc+SCT_ByteStreamErrs')]
TrkList = idAlgs[-2:] # FTF and Track to xAOD::TrackParticle conversion alg trkList = idAlgs[-2:] # FTF and Track to xAOD::TrackParticle conversion alg
TrackCountHypo=TrackCountHypoAlgMT() trackCountHypo = TrackCountHypoAlgMT()
TrackCountHypo.trackCountKey=recordable("HLT_TrackCount") trackCountHypo.trackCountKey = recordable("HLT_TrackCount")
TrackCountHypo.tracksKey=recordable("HLT_IDTrack_MinBias_FTF") trackCountHypo.tracksKey = recordable("HLT_IDTrack_MinBias_FTF")
from TrigMinBias.TrackCountMonitoringMT import TrackCountMonitoring from TrigMinBias.TrackCountMonitoringMT import TrackCountMonitoring
TrackCountHypo.MonTool = 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 )
trkRecoSeq = parOR("TrkrecoSeq", [verifier]+trkList)
trkSequence = seqAND("TrkSequence", [trkInputMakerAlg, trkRecoSeq])
trkInputMakerAlg.ViewNodeName = trkRecoSeq.name()
return MenuSequence(Sequence = trkSequence,
Maker = trkInputMakerAlg,
Hypo = trackCountHypo,
HypoToolGen = TrackCountHypoToolGen)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment