Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22005 from JanFSchulte/candidateSeededRecovery10X
Candidate Seeded option for automated doublet recovery in HLT tracking
- Loading branch information
Showing
5 changed files
with
178 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
RecoTracker/TkTrackingRegions/plugins/TrackingSeedCandidates.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#include "TrackingSeedCandidates.h" | ||
|
||
TrackingSeedCandidates::TrackingSeedCandidates(const edm::ParameterSet& regPSet, edm::ConsumesCollector& iC) { | ||
// operation mode | ||
// | ||
std::string seedingModeString = regPSet.getParameter<std::string>("seedingMode"); | ||
if (seedingModeString == "Candidate") m_seedingMode = SeedingMode::CANDIDATE_SEEDED; | ||
else if (seedingModeString == "Global") m_seedingMode = SeedingMode::GLOBAL; | ||
else throw edm::Exception(edm::errors::Configuration) << "Unknown seeding mode string: "<<seedingModeString; | ||
|
||
m_deltaEta_Cand = regPSet.getParameter<double>("deltaEta_Cand"); | ||
m_deltaPhi_Cand = regPSet.getParameter<double>("deltaPhi_Cand"); | ||
|
||
// basic inputs | ||
if(m_seedingMode == SeedingMode::CANDIDATE_SEEDED){ | ||
m_token_input = iC.consumes<reco::CandidateView>(regPSet.getParameter<edm::InputTag>("input")); | ||
if (m_deltaEta_Cand<0 || m_deltaPhi_Cand<0) throw edm::Exception(edm::errors::Configuration) << "Delta eta and phi parameters must be set for candidates in candidate seeding mode"; | ||
} | ||
} | ||
|
||
void TrackingSeedCandidates::fillDescriptions(edm::ParameterSetDescription& desc) { | ||
desc.add<std::string>("seedingMode", "Global"); | ||
desc.add<edm::InputTag>("input",edm::InputTag()); | ||
desc.add<double>("deltaEta_Cand", -1.); | ||
desc.add<double>("deltaPhi_Cand", -1.); | ||
} | ||
|
||
TrackingSeedCandidates::Objects TrackingSeedCandidates::objects(const edm::Event& iEvent) const { | ||
|
||
Objects result; | ||
std::pair <float,float> dimensions = std::make_pair(m_deltaEta_Cand,m_deltaPhi_Cand); | ||
edm::Handle< reco::CandidateView > objects; | ||
|
||
if(m_seedingMode == SeedingMode::CANDIDATE_SEEDED){ | ||
iEvent.getByToken( m_token_input, objects ); | ||
result = std::make_pair(objects.product(),dimensions); | ||
} | ||
else result = std::make_pair(nullptr,dimensions); | ||
return result; | ||
} |
38 changes: 38 additions & 0 deletions
38
RecoTracker/TkTrackingRegions/plugins/TrackingSeedCandidates.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#ifndef RecoTracker_TkTrackingRegions_TrackingSeedCandidates_h | ||
#define RecoTracker_TkTrackingRegions_TrackingSeedCandidates_h | ||
|
||
#include "FWCore/Framework/interface/Event.h" | ||
#include "FWCore/ParameterSet/interface/ParameterSet.h" | ||
#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" | ||
#include "FWCore/Framework/interface/ConsumesCollector.h" | ||
#include "DataFormats/Candidate/interface/Candidate.h" | ||
#include "DataFormats/Common/interface/Handle.h" | ||
|
||
#include <vector> | ||
#include <utility> | ||
|
||
class TrackingSeedCandidates { | ||
public: | ||
|
||
enum class SeedingMode {CANDIDATE_SEEDED, GLOBAL}; | ||
//using Objects = std::pair< edm::Handle< reco::CandidateView > , std::pair < float, float > > ; // (origin, half-length in z) | ||
using Objects = std::pair< const reco::CandidateView* , std::pair < float, float > > ; // (origin, half-length in z) | ||
TrackingSeedCandidates(const edm::ParameterSet& regPSet, edm::ConsumesCollector&& iC): TrackingSeedCandidates(regPSet, iC) {} | ||
TrackingSeedCandidates(const edm::ParameterSet& regPSet, edm::ConsumesCollector& iC); | ||
~TrackingSeedCandidates() = default; | ||
|
||
static void fillDescriptions(edm::ParameterSetDescription& desc); | ||
|
||
Objects objects(const edm::Event& iEvent) const; | ||
|
||
private: | ||
SeedingMode m_seedingMode; | ||
float m_deltaEta_Cand; | ||
float m_deltaPhi_Cand; | ||
|
||
edm::EDGetTokenT<reco::CandidateView> m_token_input; | ||
|
||
}; | ||
|
||
|
||
#endif |