Skip to content

Commit

Permalink
scram build code-checks, code-format
Browse files Browse the repository at this point in the history
  • Loading branch information
wonjun committed Jun 4, 2021
1 parent afc2428 commit 59f80f0
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 26 deletions.
15 changes: 4 additions & 11 deletions RecoMuon/TrackerSeedGenerator/interface/SeedMvaEstimator.h
Expand Up @@ -41,16 +41,9 @@ class SeedMvaEstimator {
private:
std::unique_ptr<const GBRForest> gbrForest_;

void getL1MuonVariables(const TrajectorySeed&,
GlobalVector,
edm::Handle<l1t::MuonBxCollection>,
int minL1Qual,
float&,
float&) const;
void getL2MuonVariables(const TrajectorySeed&,
GlobalVector,
edm::Handle<reco::RecoChargedCandidateCollection>,
float&,
float&) const;
void getL1MuonVariables(
const TrajectorySeed&, GlobalVector, edm::Handle<l1t::MuonBxCollection>, int minL1Qual, float&, float&) const;
void getL2MuonVariables(
const TrajectorySeed&, GlobalVector, edm::Handle<reco::RecoChargedCandidateCollection>, float&, float&) const;
};
#endif
25 changes: 12 additions & 13 deletions RecoMuon/TrackerSeedGenerator/plugins/MuonHLTSeedMVAClassifier.cc
Expand Up @@ -53,7 +53,8 @@ class MuonHLTSeedMVAClassifier : public edm::stream::EDProducer<> {
edm::EDGetTokenT<l1t::MuonBxCollection> t_L1Muon_;
edm::EDGetTokenT<reco::RecoChargedCandidateCollection> t_L2Muon_;

typedef std::pair<std::unique_ptr<const SeedMvaEstimator>, std::unique_ptr<const SeedMvaEstimator>> pairSeedMvaEstimator;
typedef std::pair<std::unique_ptr<const SeedMvaEstimator>, std::unique_ptr<const SeedMvaEstimator>>
pairSeedMvaEstimator;
pairSeedMvaEstimator mvaEstimator_;

edm::FileInPath mvaFileB_;
Expand Down Expand Up @@ -104,7 +105,6 @@ MuonHLTSeedMVAClassifier::MuonHLTSeedMVAClassifier(const edm::ParameterSet& iCon
isFromL1_(iConfig.getParameter<bool>("isFromL1")),
minL1Qual_(iConfig.getParameter<int>("minL1Qual")),
baseScore_(iConfig.getParameter<double>("baseScore")) {

if (!rejectAll_) {
mvaFileB_ = iConfig.getUntrackedParameter<edm::FileInPath>("mvaFileB");
mvaFileE_ = iConfig.getUntrackedParameter<edm::FileInPath>("mvaFileE");
Expand Down Expand Up @@ -147,7 +147,7 @@ void MuonHLTSeedMVAClassifier::produce(edm::Event& iEvent, const edm::EventSetup
iEvent.getByToken(t_L1Muon_, h_L1Muon);

edm::Handle<reco::RecoChargedCandidateCollection> h_L2Muon;
if(!isFromL1_) {
if (!isFromL1_) {
iEvent.getByToken(t_L2Muon_, h_L2Muon);
}

Expand All @@ -159,8 +159,8 @@ void MuonHLTSeedMVAClassifier::produce(edm::Event& iEvent, const edm::EventSetup
for (auto i = 0U; i < h_Seed->size(); ++i) {
const auto& seed(h_Seed->at(i));

GlobalVector global_p = trkGeom->idToDet(seed.startingState().detId())
->surface().toGlobal(seed.startingState().parameters().momentum());
GlobalVector global_p =
trkGeom->idToDet(seed.startingState().detId())->surface().toGlobal(seed.startingState().parameters().momentum());

bool isB = (std::abs(global_p.eta()) < etaEdge_);

Expand Down Expand Up @@ -192,8 +192,7 @@ void MuonHLTSeedMVAClassifier::produce(edm::Event& iEvent, const edm::EventSetup
}
}

double mva =
getSeedMva(mvaEstimator_, seed, global_p, h_L1Muon, minL1Qual_, h_L2Muon, isFromL1_, baseScore_);
double mva = getSeedMva(mvaEstimator_, seed, global_p, h_L1Muon, minL1Qual_, h_L2Muon, isFromL1_, baseScore_);

double score = 1. / (1. + std::exp(-1. * mva));
bool passMva = ((isB && (score > mvaCutB_)) || (!isB && (score > mvaCutE_)));
Expand Down Expand Up @@ -242,11 +241,9 @@ double MuonHLTSeedMVAClassifier::getSeedMva(const pairSeedMvaEstimator& pairMvaE
double baseScore_) {
double mva = 0.;
if (std::abs(global_p.eta()) < etaEdge_) {
mva = pairMvaEstimator.first->computeMva(
seed, global_p, h_L1Muon, minL1Qual_, h_L2Muon, isFromL1_);
mva = pairMvaEstimator.first->computeMva(seed, global_p, h_L1Muon, minL1Qual_, h_L2Muon, isFromL1_);
} else {
mva = pairMvaEstimator.second->computeMva(
seed, global_p, h_L1Muon, minL1Qual_, h_L2Muon, isFromL1_);
mva = pairMvaEstimator.second->computeMva(seed, global_p, h_L1Muon, minL1Qual_, h_L2Muon, isFromL1_);
}

return (mva + baseScore_);
Expand All @@ -272,8 +269,10 @@ void MuonHLTSeedMVAClassifier::fillDescriptions(edm::ConfigurationDescriptions&
desc.add<int>("minL1Qual", 7);
desc.add<double>("baseScore", 0.5);

desc.addOptionalUntracked<edm::FileInPath>("mvaFileB", edm::FileInPath("RecoMuon/TrackerSeedGenerator/data/Run3v6_Barrel_hltIter2.xml"));
desc.addOptionalUntracked<edm::FileInPath>("mvaFileE", edm::FileInPath("RecoMuon/TrackerSeedGenerator/data/Run3v6_Endcap_hltIter2.xml"));
desc.addOptionalUntracked<edm::FileInPath>(
"mvaFileB", edm::FileInPath("RecoMuon/TrackerSeedGenerator/data/Run3v6_Barrel_hltIter2.xml"));
desc.addOptionalUntracked<edm::FileInPath>(
"mvaFileE", edm::FileInPath("RecoMuon/TrackerSeedGenerator/data/Run3v6_Endcap_hltIter2.xml"));
desc.addOptionalUntracked<std::vector<double>>("mvaScaleMeanB", {0.});
desc.addOptionalUntracked<std::vector<double>>("mvaScaleStdB", {1.});
desc.addOptionalUntracked<std::vector<double>>("mvaScaleMeanE", {0.});
Expand Down
4 changes: 2 additions & 2 deletions RecoMuon/TrackerSeedGenerator/src/SeedMvaEstimator.cc
Expand Up @@ -51,7 +51,7 @@ void SeedMvaEstimator::getL1MuonVariables(const TrajectorySeed& seed,

float dR2tmp = reco::deltaR2(ref_L1Mu->etaAtVtx(), ref_L1Mu->phiAtVtx(), global_p.eta(), global_p.phi());

if (dR2tmp < dRdRL1SeedP*dRdRL1SeedP) {
if (dR2tmp < dRdRL1SeedP * dRdRL1SeedP) {
dRdRL1SeedP = std::sqrt(dR2tmp);
dPhidRL1SeedP = reco::deltaPhi(ref_L1Mu->phiAtVtx(), global_p.phi());
}
Expand All @@ -69,7 +69,7 @@ void SeedMvaEstimator::getL2MuonVariables(const TrajectorySeed& seed,

float dR2tmp = reco::deltaR2(*ref_L2Mu, global_p);

if (dR2tmp < dRdRL2SeedP*dRdRL2SeedP) {
if (dR2tmp < dRdRL2SeedP * dRdRL2SeedP) {
dRdRL2SeedP = std::sqrt(dR2tmp);
dPhidRL2SeedP = reco::deltaPhi(ref_L2Mu->phi(), global_p.phi());
}
Expand Down

0 comments on commit 59f80f0

Please sign in to comment.