Commit b14e0bb6 authored by Vladimir Lyubushkin's avatar Vladimir Lyubushkin Committed by Johannes Elmsheuser
Browse files

Add B-physics L2 filter to the mul2IOOvlpRmSequence for the dimuon triggers...

Add B-physics L2 filter to the mul2IOOvlpRmSequence for the dimuon triggers with 'muCombIO' step (ATR-21003)
parent 218bd80e
......@@ -21,25 +21,48 @@ trigMultiTrkComboHypoToolDict = {
}
def DimuL2ComboHypoCfg(name):
def StreamerDimuL2ComboHypoCfg(name):
log.debug('DimuL2ComboHypoCfg.name = %s ', name)
config = TrigMultiTrkComboHypoConfig()
hypo = config.ConfigurationComboHypo(
isStreamer = True,
trigSequenceName = 'Dimu',
trigLevel = 'L2',
trackCollection='HLT_IDTrack_Muon_FTF')
return hypo
def StreamerDimuL2IOComboHypoCfg(name):
log.debug('DimuL2IOComboHypoCfg.name = %s ', name)
config = TrigMultiTrkComboHypoConfig()
hypo = config.ConfigurationComboHypo(
isStreamer = True,
trigSequenceName = 'Dimu',
trigLevel = 'L2IO')
return hypo
def DimuEFComboHypoCfg(name):
from TriggerMenuMT.HLTMenuConfig.Muon.MuonSetup import muonNames
log.debug('DimuEFComboHypoCfg.name = %s ', name)
config = TrigMultiTrkComboHypoConfig()
hypo = config.ConfigurationComboHypo(
isStreamer = False,
trigSequenceName = 'Dimu',
trigLevel = 'EF',
muonCollection = muonNames().getNames('RoI').EFCBName)
outputTrigBphysCollection = 'HLT_DimuEF')
return hypo
def StreamerDimuEFComboHypoCfg(name):
log.debug('StreamerDimuEFComboHypoCfg.name = %s ', name)
config = TrigMultiTrkComboHypoConfig()
hypo = config.ConfigurationComboHypo(
isStreamer = True,
trigSequenceName = 'StreamerDimu',
trigLevel = 'EF')
hypo.chi2 = 20.
hypo.massRanges = [ (100., 6000.) ]
return hypo
def TrigMultiTrkComboHypoToolFromDict(chainDict):
......@@ -49,44 +72,44 @@ def TrigMultiTrkComboHypoToolFromDict(chainDict):
class TrigMultiTrkComboHypoConfig(object):
def ConfigurationComboHypo(self, trigSequenceName='Dimu', trigLevel='L2', trackCollection='', muonCollection=''):
def ConfigurationComboHypo(self, isStreamer='False', trigSequenceName='Dimu', trigLevel='L2', trackCollection='', outputTrigBphysCollection='TrigBphysContainer'):
trigLevelDict = {'L2':0, 'EF':1}
trigLevelDict = {'L2':0, 'L2IO':1, 'EF':2}
try:
value = trigLevelDict[trigLevel]
log.debug('TrigMultiTrkComboHypo.trigLevel = %s ', value)
except KeyError:
raise Exception('TrigMultiTrkComboHypo.trigLevel should be L2 or EF, but %s provided.', trigLevel)
raise Exception('TrigMultiTrkComboHypo.trigLevel should be L2, L2IO or EF, but %s provided.', trigLevel)
baseName = 'Streamer'+trigSequenceName+trigLevel if isStreamer else trigSequenceName+trigLevel
from TrkExTools.AtlasExtrapolator import AtlasExtrapolator
VertexFitter = CompFactory.Trk__TrkVKalVrtFitter(
name = 'TrigBphysFitter_'+trigSequenceName+trigLevel,
name = 'TrigBphysFitter_'+baseName,
FirstMeasuredPoint = False,
MakeExtendedVertex = False,
Extrapolator = AtlasExtrapolator())
VertexPointEstimator = CompFactory.InDet__VertexPointEstimator(
name = 'VertexPointEstimator_'+trigSequenceName+trigLevel,
name = 'VertexPointEstimator_'+baseName,
MinDeltaR = [-10000., -10000., -10000.],
MaxDeltaR = [ 10000., 10000., 10000.],
MaxPhi = [ 10000., 10000., 10000.],
MaxChi2OfVtxEstimation = 2000.)
tool = CompFactory.TrigMultiTrkComboHypo(
name = trigSequenceName+trigLevel+'ComboHypo',
name = baseName+'ComboHypo',
isStreamer = isStreamer,
trigLevel = trigLevel,
nTracks = 2,
massRanges = [ (100., 20000.) ],
TrackCollectionKey = trackCollection,
MuonCollectionKey = muonCollection,
TrigBphysCollectionKey = outputTrigBphysCollection,
VertexFitter = VertexFitter,
VertexPointEstimator = VertexPointEstimator,
CheckMultiplicityMap = False,
MonTool = TrigMultiTrkComboHypoMonitoring('TrigMultiTrkComboHypoMonitoring_'+trigSequenceName+trigLevel))
if trigLevel == 'EF':
tool.TrigBphysCollectionKey = 'HLT_'+trigSequenceName+trigLevel
MonTool = TrigMultiTrkComboHypoMonitoring('TrigMultiTrkComboHypoMonitoring_'+baseName))
return tool
......
......@@ -5,16 +5,15 @@ from AthenaMonitoringKernel.GenericMonitoringTool import GenericMonitoringTool,
class TrigMultiTrkComboHypoMonitoring(GenericMonitoringTool):
def __init__ (self, name):
super(TrigMultiTrkComboHypoMonitoring, self).__init__(name)
if 'L2' in name:
if 'Streamer' in name:
self.Histograms = [
defineHistogram('nTrk', type='TH1F', path='EXPERT', title="number of tracks in input views", xbins=100, xmin=0, xmax=100),
defineHistogram('nAcceptedTrk', type='TH1F', path='EXPERT', title="number of selected input tracks", xbins=100, xmin=0, xmax=100),
defineHistogram('nVertexFitterCalls', type='TH1F', path='EXPERT', title="number of calls for vertex fit", xbins=200, xmin=0, xmax=200),
defineHistogram('acceptance', type='TH1F',path='EXPERT', title="filter acceptance", xbins=2, xmin=0, xmax=2),
defineHistogram('TIME_all', type='TH1F', path='EXPERT', title='execution time; [microseconds]', xbins=100, xmin=0, xmax=1000),
]
elif 'EF' in name:
else:
self.Histograms = [
defineHistogram('nTrk', type='TH1F', path='EXPERT', title="number of tracks in input views", xbins=100, xmin=0, xmax=100),
defineHistogram('nAcceptedTrk', type='TH1F', path='EXPERT', title="number of selected input tracks", xbins=100, xmin=0, xmax=100),
defineHistogram('nCombination', type='TH1F',path='EXPERT', title="number of track combinations before mass preselection", xbins=100, xmin=0, xmax=100),
defineHistogram('nCombinationBeforeFit', type='TH1F', path='EXPERT', title="number of inputs to the vertex fitter", xbins=100, xmin=0, xmax=100),
......
......@@ -19,8 +19,11 @@
#include <vector>
#include "xAODTracking/TrackParticleContainer.h"
#include "xAODTracking/VertexContainer.h"
#include "xAODTracking/VertexAuxContainer.h"
#include "xAODMuon/MuonContainer.h"
#include "xAODTrigger/TrigComposite.h"
#include "xAODTrigBphys/TrigBphys.h"
#include "xAODTrigBphys/TrigBphysContainer.h"
#include "StoreGate/ReadHandleKey.h"
......@@ -35,6 +38,7 @@
#include "AthenaMonitoringKernel/Monitored.h"
#include "AthenaMonitoringKernel/GenericMonitoringTool.h"
#include "ITrigBphysState.h"
#include "TrigMultiTrkComboHypoTool.h"
#include "BeamSpotConditionsData/BeamSpotData.h"
......@@ -43,6 +47,29 @@ class IVKalState;
}
/**
* @class TrigMultiTrkState
* @brief State class for TrigMultiTrkComboHypo algorithm
*/
class TrigMultiTrkState: public ::ITrigBphysState {
public:
const EventContext* context;
const TrigCompositeUtils::DecisionContainer* previousDecisions;
TrigCompositeUtils::DecisionContainer* decisions;
xAOD::TrigBphysContainer* trigBphysCollection;
struct Muon {
ElementLink<xAOD::MuonContainer> link;
ElementLinkVector<TrigCompositeUtils::DecisionContainer> decisionLinks;
TrigCompositeUtils::DecisionIDContainer decisionIDs;
};
std::vector<Muon> muons;
std::vector<ElementLink<xAOD::TrackParticleContainer>> tracks;
int isEventAccepted;
std::vector<std::vector<size_t>> trigBphysMuonIndices;
};
class TrigMultiTrkComboHypo: public ::ComboHypo {
public:
TrigMultiTrkComboHypo(const std::string& name, ISvcLocator* pSvcLocator);
......@@ -51,41 +78,53 @@ class TrigMultiTrkComboHypo: public ::ComboHypo {
virtual StatusCode initialize() override;
virtual StatusCode execute(const EventContext& context) const override;
protected:
private:
StatusCode executeL2(const EventContext& context) const;
StatusCode executeEF(const EventContext& context) const;
std::unique_ptr<TrigMultiTrkState> makeState(const EventContext* context,
const TrigCompositeUtils::DecisionContainer* previousDecisions,
TrigCompositeUtils::DecisionContainer* decisions,
xAOD::TrigBphysContainer* trigBphysCollection) const;
StatusCode mergeMuonsFromDecisions(TrigMultiTrkState&) const;
StatusCode mergeTracksFromViews(TrigMultiTrkState&) const;
StatusCode mergeTracksFromDecisions(TrigMultiTrkState&) const;
StatusCode filterTrackCombinations(TrigMultiTrkState&) const;
StatusCode copyDecisionObjects(TrigMultiTrkState&) const;
StatusCode findDimuonCandidates(TrigMultiTrkState&) const;
StatusCode createDecisionObjects(TrigMultiTrkState&) const;
xAOD::Vertex* fit(const std::vector<ElementLink<xAOD::TrackParticleContainer>>& tracklist, Trk::IVKalState*) const;
xAOD::TrigBphys* makeTrigBPhys(xAOD::Vertex* vertex, Trk::IVKalState* fitterState, const Amg::Vector3D &beamspot) const;
xAOD::TrigBphys* makeTrigBPhys(xAOD::Vertex* vertex, Trk::IVKalState* fitterState, const Amg::Vector3D& beamspot) const;
bool isIdenticalTracks(const xAOD::TrackParticle* lhs, const xAOD::TrackParticle* rhs) const;
bool isIdenticalTracks(const xAOD::Muon* lhs, const xAOD::Muon* rhs) const;
bool isInMassRange(double mass) const;
float Lxy(const xAOD::TrigBphys*, const Amg::Vector3D&) const;
SG::ReadHandleKey<xAOD::TrackParticleContainer>
m_trackParticleContainerKey {this, "TrackCollectionKey", "Tracks", "input TrackParticle container name"};
SG::ReadHandleKey<xAOD::MuonContainer>
m_muonContainerKey {this, "MuonCollectionKey", "CBCombinedMuon", "input EF Muon container name"};
SG::WriteHandleKey<xAOD::TrigBphysContainer>
m_trigBphysContainerKey {this, "TrigBphysCollectionKey", "TrigBphysContainer", "output TrigBphysContainer name"};
SG::ReadCondHandleKey<InDet::BeamSpotData>
m_beamSpotKey {this, "BeamSpotKey", "BeamSpotData", "SG key for beam spot"};
Gaudi::Property<unsigned int> m_nTrk {this, "nTracks", 2, "number of tracks in the vertex"};
Gaudi::Property<std::vector<double>> m_trkMass {this, "trackMasses", {105.6583745, 105.6583745}, "track masses for vertex reco (one per track)"};
Gaudi::Property<std::vector<float>> m_trkPt {this, "trkPtThresholds", {3650., 3650.} ,"minimum track pTs (one per track, sorted descending)"};
Gaudi::Property<std::vector<std::pair<double, double>>> m_massRange {this, "massRanges", { {0., 100000.} }, "mass ranges"};
Gaudi::Property<float> m_deltaR {this, "deltaR", 0.01, "minimum deltaR between same-sign tracks (overlap removal)"};
Gaudi::Property<float> m_chi2 {this, "chi2", 150., "chi2 cut for the fitted vertex"};
Gaudi::Property<std::string> m_trigLevelString {this, "trigLevel", "", "trigger Level to set for created TrigBphys objects"};
xAOD::TrigBphys::levelType m_trigLevel;
Gaudi::Property<bool> m_isStreamer {this, "isStreamer", false, "if true we do not create trigger objects, just copy all appropriate decisions to the next step or break the chain"};
Gaudi::Property<std::string> m_trigLevel {this, "trigLevel", "EF", "trigger Level to set for created TrigBphys objects"};
ToolHandle<InDet::VertexPointEstimator> m_vertexPointEstimator {this, "VertexPointEstimator", "", "tool to find starting point for the vertex fitter"};
ToolHandle<Trk::TrkVKalVrtFitter> m_vertexFitter {this, "VertexFitter", "", "VKalVrtFitter tool to fit tracks into the common vertex"};
ToolHandle<GenericMonitoringTool> m_monTool {this, "MonTool", "", "monitoring tool"};
SG::ReadCondHandleKey<InDet::BeamSpotData> m_beamSpotKey { this, "BeamSpotKey", "BeamSpotData", "SG key for beam spot" };
TrigCompositeUtils::DecisionIDContainer m_allowedIDs;
TrigCompositeUtils::DecisionIDContainer m_allowedIDs;
};
#endif // TRIG_TrigMultiTrkComboHypo_H
......@@ -61,14 +61,14 @@ bool TrigMultiTrkComboHypoTool::passed(const xAOD::TrigBphys* trigBphys) const {
auto mon = Monitored::Group( m_monTool, mon_totalCharge, mon_chi2, mon_mass, mon_pT_trk1, mon_pT_trk2, mon_Lxy);
if (m_acceptAll || (isInMassRange(trigBphys->mass()) && passedChi2Cut(trigBphys->fitchi2()) && passedChargeCut(totalCharge(trigBphys)) &&
if (m_acceptAll || (isInMassRange(trigBphys->mass()) && passedChi2Cut(trigBphys->fitchi2()) && passedChargeCut(totalCharge(trigBphys)) &&
trigBphys->lxy() > m_LxyCut )) {
mon_Lxy = trigBphys->lxy();
mon_totalCharge = totalCharge(trigBphys);
mon_chi2 = trigBphys->fitchi2();
mon_mass = trigBphys->mass();
mon_pT_trk1 = trigBphys->trackParticle(0)->pt();
mon_pT_trk2 = trigBphys->trackParticle(1)->pt();
mon_mass = 0.001 * trigBphys->mass();
mon_pT_trk1 = 0.001 * trigBphys->trackParticle(0)->pt();
mon_pT_trk2 = 0.001 * trigBphys->trackParticle(1)->pt();
ATH_MSG_DEBUG( "accepting event" );
return true;
}
......
......@@ -332,65 +332,55 @@ HLT_2mu4_bBmumux_BcmumuPi_L12MU4:
0: 3
1: 2
2: 1
3: 1
stepFeatures:
0: 6
1: 6
2: 2
3: 2
4: 2
HLT_2mu4_bBmumux_BdmumuKst_L12MU4:
eventCount: 0
stepCounts:
0: 3
1: 2
2: 1
3: 1
stepFeatures:
0: 6
1: 6
2: 2
3: 2
4: 2
HLT_2mu4_bBmumux_BpmumuKp_L12MU4:
eventCount: 0
stepCounts:
0: 3
1: 2
2: 1
3: 1
stepFeatures:
0: 6
1: 6
2: 2
3: 2
4: 2
HLT_2mu4_bBmumux_BsmumuPhi_L12MU4:
eventCount: 0
stepCounts:
0: 3
1: 2
2: 1
3: 1
stepFeatures:
0: 6
1: 6
2: 2
3: 2
4: 2
HLT_2mu4_bBmumux_LbPqKm_L12MU4:
eventCount: 0
stepCounts:
0: 3
1: 2
2: 1
3: 1
stepFeatures:
0: 6
1: 6
2: 2
3: 2
4: 2
HLT_2mu4_bDimu_L12MU4:
eventCount: 0
stepCounts:
......@@ -493,15 +483,15 @@ HLT_2mu6_bJpsimumul2io_L12MU6:
eventCount: 0
stepCounts:
0: 3
1: 2
2: 2
3: 2
1: 1
2: 1
3: 1
stepFeatures:
0: 6
1: 7
2: 4
3: 4
4: 4
2: 2
3: 2
4: 2
HLT_2mu6_l2io_L12MU6:
eventCount: 2
stepCounts:
......
......@@ -11,10 +11,11 @@ log = logging.getLogger("TriggerMenuMT.HLTMenuConfig.Bphysics.BphysicsDef")
from TriggerMenuMT.HLTMenuConfig.Menu.ChainConfigurationBase import ChainConfigurationBase
from TriggerMenuMT.HLTMenuConfig.Muon.MuonDef import MuonChainConfiguration as MuonChainConfiguration
from TriggerMenuMT.HLTMenuConfig.Muon.MuonDef import mul2IOOvlpRmSequenceCfg, muEFCBSequenceCfg
from TriggerMenuMT.HLTMenuConfig.Bphysics.BphysicsSequenceSetup import dimuL2Sequence, dimuEFSequence, bmumuxSequence
from TrigBphysHypo.TrigMultiTrkComboHypoConfig import DimuL2ComboHypoCfg, DimuEFComboHypoCfg, TrigMultiTrkComboHypoToolFromDict
from TrigBphysHypo.TrigMultiTrkComboHypoConfig import StreamerDimuL2ComboHypoCfg, StreamerDimuL2IOComboHypoCfg, DimuEFComboHypoCfg, StreamerDimuEFComboHypoCfg, TrigMultiTrkComboHypoToolFromDict
from TrigBphysHypo.TrigBmumuxComboHypoConfig import BmumuxComboHypoCfg, TrigBmumuxComboHypoToolFromDict
#--------------------------------------------------------
......@@ -64,8 +65,8 @@ class BphysicsChainConfiguration(MuonChainConfiguration):
stepDictionary = {
'dimu' : [['getmuFast', 'getDimuL2'], ['getmuEFSA', 'getmuEFCB', 'getDimuEF']],
'bl2io' : [['getmuFast', 'getmuCombIO'], ['getmuEFSA', 'getmuEFCB', 'getDimuEF']],
'bmumux' : [['getmuFast', 'getDimuL2'], ['getmuEFSA', 'getmuEFCB', 'getBmumux']],
'bl2io' : [['getmuFast', 'getDimuL2IO'], ['getmuEFSA', 'getmuEFCB', 'getDimuEF']],
'bmumux' : [['getmuFast', 'getDimuL2'], ['getmuEFSA', 'getDimuEFCB', 'getBmumux']],
}
return stepDictionary
......@@ -91,10 +92,16 @@ class BphysicsChainConfiguration(MuonChainConfiguration):
return topo_dict[the_topo]
def getDimuL2(self):
return self.getStep(2, 'dimuL2', [dimuL2SequenceCfg], comboHypoCfg=DimuL2ComboHypoCfg)
return self.getStep(2, 'dimuL2', [dimuL2SequenceCfg], comboHypoCfg=StreamerDimuL2ComboHypoCfg)
def getDimuL2IO(self):
return self.getStep(2, 'dimuL2IO', [mul2IOOvlpRmSequenceCfg], comboHypoCfg=StreamerDimuL2IOComboHypoCfg)
def getDimuEF(self):
return self.getStep(5, 'dimuEF', [dimuEFSequenceCfg], comboHypoCfg=DimuEFComboHypoCfg, comboTools=[TrigMultiTrkComboHypoToolFromDict])
def getDimuEFCB(self):
return self.getStep(4, 'dimuEFCB', [muEFCBSequenceCfg], comboHypoCfg=StreamerDimuEFComboHypoCfg)
def getBmumux(self):
return self.getStep(5, 'bmumux', [bmumuxSequenceCfg], comboHypoCfg=BmumuxComboHypoCfg, comboTools=[TrigBmumuxComboHypoToolFromDict])
......@@ -237,10 +237,10 @@ def generateChains():
##################################################################
if opt.doBphysicsSlice is True:
from TriggerMenuMT.HLTMenuConfig.Muon.MuonSequenceSetup import muFastSequence, muCombSequence, muEFSASequence, muEFCBSequence
from TrigBphysHypo.TrigMultiTrkComboHypoConfig import DimuL2ComboHypoCfg, DimuEFComboHypoCfg
from TrigBphysHypo.TrigMultiTrkComboHypoConfig import StreamerDimuL2ComboHypoCfg, DimuEFComboHypoCfg
step1_dimufast=makeChainStep("Step1_dimuFast", [muFastSequence()], multiplicity=[2])
step2_dimuComb=makeChainStep("Step2_dimuComb", [muCombSequence()], multiplicity=[2], comboHypoCfg=DimuL2ComboHypoCfg)
step2_dimuComb=makeChainStep("Step2_dimuComb", [muCombSequence()], multiplicity=[2], comboHypoCfg=StreamerDimuL2ComboHypoCfg)
step3_dimuEFSA=makeChainStep("Step3_dimuEFSA", [muEFSASequence()], multiplicity=[2])
step4_dimuEFCB=makeChainStep("Step4_dimuEFCB", [muEFCBSequence()], multiplicity=[2], comboHypoCfg=DimuEFComboHypoCfg)
steps = [step1_dimufast, step2_dimuComb, step3_dimuEFSA, step4_dimuEFCB]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment