Skip to content

Commit

Permalink
scram build code-format
Browse files Browse the repository at this point in the history
  • Loading branch information
bainbrid committed May 21, 2021
1 parent 0393d68 commit 5acde33
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 32 deletions.
22 changes: 12 additions & 10 deletions PhysicsTools/PatAlgos/plugins/LeptonUpdater.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ namespace pat {
recomputeMuonBasicSelectors_ = iConfig.getParameter<bool>("recomputeMuonBasicSelectors");
// Apply energy regression for electrons
if (applyEreg_) {
auto const& conf = iConfig.getParameterSet("regressionConfig");
auto const& name = conf.getParameter<std::string>("modifierName");
auto cc = consumesCollector();
regression_ = ModifyObjectValueFactory::get()->create(name, conf, cc);
auto const &conf = iConfig.getParameterSet("regressionConfig");
auto const &name = conf.getParameter<std::string>("modifierName");
auto cc = consumesCollector();
regression_ = ModifyObjectValueFactory::get()->create(name, conf, cc);
}
produces<std::vector<T>>();
}
Expand All @@ -57,12 +57,11 @@ namespace pat {
desc.add<bool>("fixDxySign", false)->setComment("Fix the IP sign");
desc.addOptional<edm::InputTag>("pfCandsForMiniIso", edm::InputTag("packedPFCandidates"))
->setComment("PackedCandidate collection used for miniIso");
desc.add<bool>("applyEnergyRegression", false)
->setComment("Apply energy regression to electrons");
desc.add<bool>("applyEnergyRegression", false)->setComment("Apply energy regression to electrons");
edm::ParameterSetDescription psd;
psd.setUnknown();
desc.addOptional<edm::ParameterSetDescription>("regressionConfig", psd)
->setComment("Configuration for electron energy regression");
->setComment("Configuration for electron energy regression");
if (typeid(T) == typeid(pat::Muon)) {
desc.add<bool>("recomputeMuonBasicSelectors", false)
->setComment("Recompute basic cut-based muon selector flags");
Expand Down Expand Up @@ -146,7 +145,8 @@ namespace pat {
}

template <typename T>
void LeptonUpdater<T>::applyEreg(T &lep) const { /* do nothing for muons */ }
void LeptonUpdater<T>::applyEreg(T &lep) const { /* do nothing for muons */
}

template <>
void LeptonUpdater<pat::Electron>::applyEreg(pat::Electron &ele) const {
Expand All @@ -156,7 +156,7 @@ namespace pat {
} // namespace pat

template <typename T>
void pat::LeptonUpdater<T>::produce(edm::StreamID, edm::Event &iEvent, edm::EventSetup const & setup) const {
void pat::LeptonUpdater<T>::produce(edm::StreamID, edm::Event &iEvent, edm::EventSetup const &setup) const {
edm::Handle<std::vector<T>> src;
iEvent.getByToken(src_, src);

Expand Down Expand Up @@ -192,7 +192,9 @@ void pat::LeptonUpdater<T>::produce(edm::StreamID, edm::Event &iEvent, edm::Even
for (unsigned int i = 0, n = src->size(); i < n; ++i) {
T &lep = (*out)[i];
setDZ(lep, pv);
if (applyEreg_) { applyEreg(lep); }
if (applyEreg_) {
applyEreg(lep);
}
if (computeMiniIso_) {
const auto &params = miniIsoParams(lep);
pat::PFIsolation miniiso = pat::getMiniPFIsolation(pc.product(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ LowPtGsfElectronIDProducer::LowPtGsfElectronIDProducer(const edm::ParameterSet&
////////////////////////////////////////////////////////////////////////////////
//
void LowPtGsfElectronIDProducer::produce(edm::StreamID, edm::Event& event, const edm::EventSetup& setup) const {

// Get z-component of B field
edm::ESHandle<MagneticField> field;
setup.get<IdealMagneticFieldRecord>().get(field);
Expand Down Expand Up @@ -129,7 +128,9 @@ void LowPtGsfElectronIDProducer::produce(edm::StreamID, edm::Event& event, const

// ElectronSeed unbiased BDT
edm::Handle<edm::ValueMap<float> > unbiasedH;
if (!unbiased_.isUninitialized()) { event.getByToken(unbiased_, unbiasedH); }
if (!unbiased_.isUninitialized()) {
event.getByToken(unbiased_, unbiasedH);
}

// Iterate through Electrons, evaluate BDT, and store result
std::vector<std::vector<float> > output;
Expand All @@ -139,13 +140,11 @@ void LowPtGsfElectronIDProducer::produce(edm::StreamID, edm::Event& event, const
}
for (unsigned int iele = 0; iele < patElectrons->size(); iele++) {
edm::Ptr<pat::Electron> ele(patElectrons, iele);
if (!ele->isElectronIDAvailable("unbiased")) { continue; }
if (!ele->isElectronIDAvailable("unbiased")) {
continue;
}
for (unsigned int iname = 0; iname < names_.size(); ++iname) {
output[iname][iele] = eval(names_[iname],
ele,
*rho,
ele->electronID("unbiased"),
zfield.z());
output[iname][iele] = eval(names_[iname], ele, *rho, ele->electronID("unbiased"), zfield.z());
}
}
} else {
Expand All @@ -156,17 +155,17 @@ void LowPtGsfElectronIDProducer::produce(edm::StreamID, edm::Event& event, const
edm::Ptr<reco::GsfElectron> ele(electrons, iele);

if (ele->core().isNull()) {
continue;
continue;
}
const auto& gsf = ele->core()->gsfTrack(); // reco::GsfTrackRef
if (gsf.isNull()) {
continue;
continue;
}
float unbiased = (*unbiasedH)[gsf];

//if ( !passThrough_ && ( ele->pt() < minPtThreshold_ ) ) { continue; }
for (unsigned int iname = 0; iname < names_.size(); ++iname) {
output[iname][iele] = eval(names_[iname], ele, *rho, unbiased, zfield.z());
output[iname][iele] = eval(names_[iname], ele, *rho, unbiased, zfield.z());
}
}
}
Expand All @@ -175,12 +174,14 @@ void LowPtGsfElectronIDProducer::produce(edm::StreamID, edm::Event& event, const
for (unsigned int iname = 0; iname < names_.size(); ++iname) {
auto ptr = std::make_unique<edm::ValueMap<float> >(edm::ValueMap<float>());
edm::ValueMap<float>::Filler filler(*ptr);
if (usePAT_) { filler.insert(patElectrons, output[iname].begin(), output[iname].end()); }
else { filler.insert(electrons, output[iname].begin(), output[iname].end()); }
if (usePAT_) {
filler.insert(patElectrons, output[iname].begin(), output[iname].end());
} else {
filler.insert(electrons, output[iname].begin(), output[iname].end());
}
filler.fill();
event.put(std::move(ptr), names_[iname]);
}

}

//////////////////////////////////////////////////////////////////////////////////////////
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,8 @@ namespace lowptgsfeleid {
// GSF tracks
if (ele.core().isNonnull()) {
reco::GsfTrackRef gsf = ele.gsfTrack();
if (ele.core()->gsfTrack().isNonnull() || // if embedded
gsf.isNonnull()) {
if (ele.core()->gsfTrack().isNonnull() || // if embedded
gsf.isNonnull()) {
gsf_mode_p = gsf->pMode();
eid_gsf_nhits = (float)gsf->found();
eid_gsf_chi2red = gsf->normalizedChi2();
Expand All @@ -200,8 +200,8 @@ namespace lowptgsfeleid {
// Super clusters
if (ele.core().isNonnull()) {
reco::SuperClusterRef sc = ele.superCluster();
if (ele.core()->superCluster().isNonnull() || // if embedded
sc.isNonnull()) {
if (ele.core()->superCluster().isNonnull() || // if embedded
sc.isNonnull()) {
eid_sc_E = sc->energy();
eid_sc_eta = sc->eta();
eid_sc_etaWidth = sc->etaWidth();
Expand Down Expand Up @@ -233,11 +233,11 @@ namespace lowptgsfeleid {
// Clusters
if (ele.core().isNonnull()) {
reco::GsfTrackRef gsf = ele.gsfTrack();
if (ele.core()->gsfTrack().isNonnull() || // if embedded
gsf.isNonnull()) {
if (ele.core()->gsfTrack().isNonnull() || // if embedded
gsf.isNonnull()) {
reco::SuperClusterRef sc = ele.superCluster();
if (ele.core()->superCluster().isNonnull() || // if embedded
sc.isNonnull()) {
if (ele.core()->superCluster().isNonnull() || // if embedded
sc.isNonnull()) {
// Propagate electron track to ECAL surface
double mass2 = 0.000511 * 0.000511;
float p2 = pow(gsf->p(), 2);
Expand Down

0 comments on commit 5acde33

Please sign in to comment.