Skip to content

Commit

Permalink
Adding option to run displaced vertexing in ntupler maker, reverting …
Browse files Browse the repository at this point in the history
…changes to ntuple maker params, removing BDT requirement on displaced track quality
  • Loading branch information
ryanm124 committed Aug 8, 2024
1 parent 707419f commit ce39382
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 57 deletions.
84 changes: 43 additions & 41 deletions L1Trigger/L1TTrackMatch/test/L1TrackObjectNtupleMaker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ class L1TrackObjectNtupleMaker : public edm::one::EDAnalyzer<edm::one::SharedRes
int L1Tk_minNStub; // require L1 tracks to have >= minNStub (this is mostly for tracklet purposes)
bool SaveTrackJets;
bool SaveTrackSums;
bool runDispVert;

edm::InputTag L1TrackInputTag; // L1 track collection
edm::InputTag MCTruthTrackInputTag; // MC truth collection
Expand Down Expand Up @@ -621,7 +622,8 @@ L1TrackObjectNtupleMaker::L1TrackObjectNtupleMaker(edm::ParameterSet const& iCon

SaveTrackJets = iConfig.getParameter<bool>("SaveTrackJets");
SaveTrackSums = iConfig.getParameter<bool>("SaveTrackSums");

runDispVert = iConfig.getParameter<bool>("runDispVert");

L1StubInputTag = iConfig.getParameter<edm::InputTag>("L1StubInputTag");
MCTruthClusterInputTag = iConfig.getParameter<edm::InputTag>("MCTruthClusterInputTag");
MCTruthStubInputTag = iConfig.getParameter<edm::InputTag>("MCTruthStubInputTag");
Expand Down Expand Up @@ -770,7 +772,7 @@ L1TrackObjectNtupleMaker::L1TrackObjectNtupleMaker(edm::ParameterSet const& iCon
GenJetToken_ = consumes<std::vector<reco::GenJet>>(GenJetInputTag);
GenParticleToken_ = consumes<std::vector<reco::GenParticle>>(GenParticleInputTag);
SimVertexToken_ = consumes<std::vector<SimVertex>>(SimVertexInputTag);
DispVertToken_ = consumes<std::vector<l1t::DisplacedTrackVertex>>(DisplacedVertexInputTag);
if(runDispVert) DispVertToken_ = consumes<std::vector<l1t::DisplacedTrackVertex>>(DisplacedVertexInputTag);
L1VertexToken_ = consumes<l1t::VertexCollection>(RecoVertexInputTag);
L1VertexEmuToken_ = consumes<l1t::VertexWordCollection>(RecoVertexEmuInputTag);
tTopoToken_ = esConsumes<TrackerTopology, TrackerTopologyRcd>(edm::ESInputTag("", ""));
Expand Down Expand Up @@ -1577,25 +1579,25 @@ void L1TrackObjectNtupleMaker::beginJob() {
eventTree->Branch("gen_mother_pdgid", &m_gen_mother_pdgid);

eventTree->Branch("gen_z0", &m_gen_z0);

eventTree->Branch("dv_d_T", &m_dv_d_T);
eventTree->Branch("dv_R_T", &m_dv_R_T);
eventTree->Branch("dv_cos_T", &m_dv_cos_T);
eventTree->Branch("dv_x", &m_dv_x);
eventTree->Branch("dv_y", &m_dv_y);
eventTree->Branch("dv_z", &m_dv_z);
eventTree->Branch("dv_openingAngle", &m_dv_openingAngle);
eventTree->Branch("dv_parentPt", &m_dv_parentPt);
eventTree->Branch("dv_firstIndexTrk", &m_dv_firstIndexTrk);
eventTree->Branch("dv_secondIndexTrk", &m_dv_secondIndexTrk);
eventTree->Branch("dv_firstIndexPt", &m_dv_firstIndexPt);
eventTree->Branch("dv_secondIndexPt", &m_dv_secondIndexPt);
eventTree->Branch("dv_inTraj", &m_dv_inTraj);
eventTree->Branch("dv_del_Z", &m_dv_del_Z);
eventTree->Branch("dv_delIndexPt", &m_dv_delIndexPt);
eventTree->Branch("dv_isReal", &m_dv_isReal);
eventTree->Branch("dv_score", &m_dv_score);

if(runDispVert){
eventTree->Branch("dv_d_T", &m_dv_d_T);
eventTree->Branch("dv_R_T", &m_dv_R_T);
eventTree->Branch("dv_cos_T", &m_dv_cos_T);
eventTree->Branch("dv_x", &m_dv_x);
eventTree->Branch("dv_y", &m_dv_y);
eventTree->Branch("dv_z", &m_dv_z);
eventTree->Branch("dv_openingAngle", &m_dv_openingAngle);
eventTree->Branch("dv_parentPt", &m_dv_parentPt);
eventTree->Branch("dv_firstIndexTrk", &m_dv_firstIndexTrk);
eventTree->Branch("dv_secondIndexTrk", &m_dv_secondIndexTrk);
eventTree->Branch("dv_firstIndexPt", &m_dv_firstIndexPt);
eventTree->Branch("dv_secondIndexPt", &m_dv_secondIndexPt);
eventTree->Branch("dv_inTraj", &m_dv_inTraj);
eventTree->Branch("dv_del_Z", &m_dv_del_Z);
eventTree->Branch("dv_delIndexPt", &m_dv_delIndexPt);
eventTree->Branch("dv_isReal", &m_dv_isReal);
eventTree->Branch("dv_score", &m_dv_score);
}
if (SaveTrackJets) {
eventTree->Branch("genjet_eta", &m_genjet_eta);
eventTree->Branch("genjet_p", &m_genjet_p);
Expand Down Expand Up @@ -1848,25 +1850,25 @@ void L1TrackObjectNtupleMaker::analyze(const edm::Event& iEvent, const edm::Even
m_gen_mother_pdgid->clear();

m_gen_z0->clear();

m_dv_d_T->clear();
m_dv_R_T->clear();
m_dv_cos_T->clear();
m_dv_x->clear();
m_dv_y->clear();
m_dv_z->clear();
m_dv_openingAngle->clear();
m_dv_parentPt->clear();
m_dv_firstIndexTrk->clear();
m_dv_secondIndexTrk->clear();
m_dv_firstIndexPt->clear();
m_dv_secondIndexPt->clear();
m_dv_inTraj->clear();
m_dv_del_Z->clear();
m_dv_delIndexPt->clear();
m_dv_isReal->clear();
m_dv_score->clear();

if(runDispVert){
m_dv_d_T->clear();
m_dv_R_T->clear();
m_dv_cos_T->clear();
m_dv_x->clear();
m_dv_y->clear();
m_dv_z->clear();
m_dv_openingAngle->clear();
m_dv_parentPt->clear();
m_dv_firstIndexTrk->clear();
m_dv_secondIndexTrk->clear();
m_dv_firstIndexPt->clear();
m_dv_secondIndexPt->clear();
m_dv_inTraj->clear();
m_dv_del_Z->clear();
m_dv_delIndexPt->clear();
m_dv_isReal->clear();
m_dv_score->clear();
}
if (Displaced == "Prompt" || Displaced == "Both") {
m_matchtrk_pt->clear();
m_matchtrk_eta->clear();
Expand Down Expand Up @@ -2057,7 +2059,7 @@ void L1TrackObjectNtupleMaker::analyze(const edm::Event& iEvent, const edm::Even

//Displaced vertices
edm::Handle<std::vector<l1t::DisplacedTrackVertex>> DispVertHandle;
iEvent.getByToken(DispVertToken_, DispVertHandle);
if(runDispVert) iEvent.getByToken(DispVertToken_, DispVertHandle);

//Vertex
edm::Handle<l1t::VertexCollection> L1PrimaryVertexHandle;
Expand Down
12 changes: 8 additions & 4 deletions L1Trigger/L1TTrackMatch/test/L1TrackObjectNtupleMaker_cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@


runVtxNN = True
runDispVert = False
############################################################
# import standard configurations
############################################################
Expand All @@ -42,7 +43,6 @@
# input and output
############################################################


process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(20))

readFiles = cms.untracked.vstring(
Expand Down Expand Up @@ -170,7 +170,7 @@
process.pTkMET = cms.Path(process.l1tTrackerEtMissExtended)
process.pTkMHT = cms.Path(process.l1tTrackerHTMissExtended)
process.pTkMHTEmulator = cms.Path(process.l1tTrackerEmuHTMissExtended)
process.DispVert = cms.Path(process.DisplacedVertexProducer)
if(runDispVert): process.DispVert = cms.Path(process.DisplacedVertexProducer)
DISPLACED = 'Displaced'#

# HYBRID: extended tracking
Expand All @@ -192,7 +192,7 @@
process.pTkMHT = cms.Path(process.l1tTrackerHTMiss*process.l1tTrackerHTMissExtended)
process.pTkMHTEmulator = cms.Path(process.l1tTrackerEmuHTMiss*process.l1tTrackerEmuHTMissExtended)
process.pL1TrackTripletEmulator = cms.Path(process.l1tTrackTripletEmulation)
process.DispVert = cms.Path(process.DisplacedVertexProducer)
if(runDispVert): process.DispVert = cms.Path(process.DisplacedVertexProducer)
DISPLACED = 'Both'


Expand Down Expand Up @@ -284,6 +284,7 @@
RecoVertexInputTag=cms.InputTag("l1tVertexFinder", "L1Vertices"),
RecoVertexEmuInputTag=cms.InputTag("l1tVertexFinderEmulator", "L1VerticesEmulation"),
DisplacedVertexInputTag = cms.InputTag("DisplacedVertexProducer","dispVertices"),
runDispVert = cms.bool(runDispVert)
)

process.ntuple = cms.Path(process.L1TrackNtuple)
Expand All @@ -304,4 +305,7 @@
# use this if cluster/stub associators not available
# process.schedule = cms.Schedule(process.TTClusterStubTruth,process.TTTracksEmuWithTruth,process.ntuple)

process.schedule = cms.Schedule(process.TTClusterStub, process.TTClusterStubTruth, process.dtc, process.TTTracksEmuWithTruth, process.pL1GTTInput, process.pL1TrackSelection, process.pPV, process.pPVemu,process.pL1TrackVertexAssociation, process.pL1TrackJets, process.pL1TrackJetsEmu,process.pL1TrackFastJets, process.pTkMET, process.pTkMETEmu, process.pTkMHT, process.pTkMHTEmulator,process.pL1TrackTripletEmulator, process.DispVert, process.ntuple)
if(runDispVert):
process.schedule = cms.Schedule(process.TTClusterStub, process.TTClusterStubTruth, process.dtc, process.TTTracksEmuWithTruth, process.pL1GTTInput, process.pL1TrackSelection, process.pPV, process.pPVemu,process.pL1TrackVertexAssociation, process.pL1TrackJets, process.pL1TrackJetsEmu,process.pL1TrackFastJets, process.pTkMET, process.pTkMETEmu, process.pTkMHT, process.pTkMHTEmulator,process.pL1TrackTripletEmulator, process.DispVert, process.ntuple)
else:
process.schedule = cms.Schedule(process.TTClusterStub, process.TTClusterStubTruth, process.dtc, process.TTTracksEmuWithTruth, process.pL1GTTInput, process.pL1TrackSelection, process.pPV, process.pPVemu,process.pL1TrackVertexAssociation, process.pL1TrackJets, process.pL1TrackJetsEmu,process.pL1TrackFastJets, process.pTkMET, process.pTkMETEmu, process.pTkMHT, process.pTkMHTEmulator,process.pL1TrackTripletEmulator,process.ntuple)
15 changes: 3 additions & 12 deletions L1Trigger/TrackFindingTracklet/plugins/L1FPGATrackProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -744,19 +744,10 @@ void L1FPGATrackProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSe
aTrack.setTrackWordBits();

if (trackQuality_) {
double qualityScore = trackQualityModel_->getL1TrackQuality(aTrack);
aTrack.settrkMVA1(qualityScore);
if(extended_){
qualityScore = trackQualityDispModel_->getL1TrackQuality(aTrack);
if(trackQualityDispModel_->getQualityAlgorithm()==L1TrackQuality::QualityAlgorithm::GBDT){
aTrack.settrkMVA2(qualityScore);
}
else{
aTrack.settrkMVA1(qualityScore);
}
}
aTrack.settrkMVA1(trackQualityModel_->getL1TrackQuality(aTrack));
if(extended_)
aTrack.settrkMVA2(trackQualityDispModel_->getL1TrackQuality(aTrack));
}

// hph::HitPatternHelper hph(setupHPH_, tmp_hit, tmp_tanL, tmp_z0);
// if (trackQuality_) {
// trackQualityModel_->setBonusFeatures(hph.bonusFeatures());
Expand Down

0 comments on commit ce39382

Please sign in to comment.