Skip to content

Commit

Permalink
code format
Browse files Browse the repository at this point in the history
  • Loading branch information
ccaillol committed May 10, 2021
1 parent 0db26b0 commit ad7e27c
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 33 deletions.
2 changes: 1 addition & 1 deletion DataFormats/L1TParticleFlow/interface/HPSPFTau.h
Expand Up @@ -17,7 +17,7 @@ namespace l1t {
HPSPFTau();

/// destructor
~HPSPFTau();
~HPSPFTau() override;

/// accessor functions for reco level quantities
bool isChargedPFCandSeeded() const { return seedChargedPFCand_.isNonnull(); }
Expand Down
2 changes: 1 addition & 1 deletion L1Trigger/Phase2L1Taus/interface/L1HPSPFTauBuilder.h
Expand Up @@ -4,7 +4,7 @@
#include "FWCore/ParameterSet/interface/ParameterSet.h" // edm::ParameterSet
#include "DataFormats/Provenance/interface/ProductID.h" // edm::ProductID
#include "L1Trigger/Phase2L1Taus/interface/L1HPSPFTauQualityCut.h" // L1HPSPFTauQualityCut
#include "DataFormats/L1TParticleFlow/interface/HPSPFTau.h" // l1t::HPSPFTau
#include "DataFormats/L1TParticleFlow/interface/HPSPFTau.h" // l1t::HPSPFTau
#include "DataFormats/L1TParticleFlow/interface/PFCandidate.h" // l1t::PFCandidate, l1t::PFCandidateCollection, l1t::PFCandidateRef
#include "DataFormats/JetReco/interface/CaloJet.h"
#include "DataFormats/L1TCorrelator/interface/TkPrimaryVertex.h"
Expand Down
29 changes: 13 additions & 16 deletions L1Trigger/Phase2L1Taus/plugins/HPSPFTauProducer.cc
Expand Up @@ -33,7 +33,7 @@ HPSPFTauProducer::HPSPFTauProducer(const edm::ParameterSet& cfg)
tokenL1Jets_ = consumes<std::vector<reco::CaloJet>>(srcL1Jets_);
}
srcL1Vertices_ = cfg.getParameter<edm::InputTag>("srcL1Vertices");
if (srcL1Vertices_.label() != "") {
if (!srcL1Vertices_.label().empty()) {
tokenL1Vertices_ = consumes<std::vector<l1t::TkPrimaryVertex>>(srcL1Vertices_);
}
deltaR2Cleaning_ = deltaRCleaning_ * deltaRCleaning_;
Expand Down Expand Up @@ -64,18 +64,18 @@ void HPSPFTauProducer::produce(edm::Event& evt, const edm::EventSetup& es) {

l1t::TkPrimaryVertexRef primaryVertex;
float primaryVertex_z = 0.;
if (srcL1Vertices_.label() != "") {
if (!srcL1Vertices_.label().empty()) {
edm::Handle<std::vector<l1t::TkPrimaryVertex>> vertices;
evt.getByToken(tokenL1Vertices_, vertices);
if (vertices->size() > 0) {
if (!vertices->->empty()) {
primaryVertex = l1t::TkPrimaryVertexRef(vertices, 0);
primaryVertex_z = primaryVertex->zvertex();
}
}

if (debug_) {
std::cout << "BEFORE selection:" << std::endl;
for (auto l1PFCand : *l1PFCands) {
for (const auto& l1PFCand : *l1PFCands) {
printPFCand(std::cout, l1PFCand, primaryVertex_z);
}
}
Expand Down Expand Up @@ -104,15 +104,15 @@ void HPSPFTauProducer::produce(edm::Event& evt, const edm::EventSetup& es) {

if (debug_) {
std::cout << "AFTER selection (signalQualityCuts):" << std::endl;
for (auto l1PFCand : selectedL1PFCandsSignalQualityCuts) {
for (const auto& l1PFCand : selectedL1PFCandsSignalQualityCuts) {
printPFCand(std::cout, *l1PFCand, primaryVertex_z);
}
}

l1t::HPSPFTauCollection l1PFTauCollectionUncleaned;

if (useChargedPFCandSeeds_) {
for (auto l1PFCand : selectedL1PFCandsSignalQualityCuts) {
for (const auto& l1PFCand : selectedL1PFCandsSignalQualityCuts) {
if (l1PFCand->charge() != 0 && l1PFCand->pt() > minSeedChargedPFCandPt_ &&
std::fabs(l1PFCand->eta()) < maxSeedChargedPFCandEta_) {
bool isFromPrimaryVertex = false;
Expand Down Expand Up @@ -173,20 +173,20 @@ void HPSPFTauProducer::produce(edm::Event& evt, const edm::EventSetup& es) {
}
}

for (auto l1PFTau : l1PFTauCollectionUncleaned) {
for (const auto& l1PFTau : l1PFTauCollectionUncleaned) {
if (applyPreselection_ &&
!(l1PFTau.pt() > minPFTauPt_ && std::fabs(l1PFTau.eta()) < maxPFTauEta_ &&
l1PFTau.leadChargedPFCand().isNonnull() && l1PFTau.leadChargedPFCand()->pt() > minLeadChargedPFCandPt_ &&
std::fabs(l1PFTau.leadChargedPFCand()->eta()) < maxLeadChargedPFCandEta_ &&
(srcL1Vertices_.label() == "" ||
(srcL1Vertices_.label().empty() ||
(primaryVertex.isNonnull() && l1PFTau.leadChargedPFCand()->pfTrack().isNonnull() &&
std::fabs(l1PFTau.leadChargedPFCand()->pfTrack()->vertex().z() - primaryVertex->zvertex()) <
maxLeadChargedPFCandDz_)) &&
l1PFTau.sumChargedIso() < maxChargedIso_ && l1PFTau.sumChargedIso() < maxChargedRelIso_ * l1PFTau.pt()))
continue;

bool isOverlap = false;
for (auto l1PFTau2 : *l1PFTauCollectionCleaned) {
for (const auto& l1PFTau2 : *l1PFTauCollectionCleaned) {
double deltaEta = l1PFTau.eta() - l1PFTau2.eta();
double deltaPhi = l1PFTau.phi() - l1PFTau2.phi();
if ((deltaEta * deltaEta + deltaPhi * deltaPhi) < deltaR2Cleaning_) {
Expand All @@ -209,12 +209,10 @@ void HPSPFTauProducer::produce(edm::Event& evt, const edm::EventSetup& es) {
evt.put(std::move(l1PFTauCollectionCleaned));
}


#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
#include "FWCore/ParameterSet/interface/ParameterSetDescription.h"

void
HPSPFTauProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
void HPSPFTauProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
// HPSPFTauProducerPF
edm::ParameterSetDescription desc;
desc.add<bool>("useJetSeeds", true);
Expand Down Expand Up @@ -256,7 +254,7 @@ HPSPFTauProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions)
desc.add<double>("minSeedJetPt", 30.0);
desc.add<double>("maxChargedRelIso", 1.0);
desc.add<double>("minSeedChargedPFCandPt", 5.0);
desc.add<edm::InputTag>("srcL1PFCands", edm::InputTag("l1pfCandidates","PF"));
desc.add<edm::InputTag>("srcL1PFCands", edm::InputTag("l1pfCandidates", "PF"));
desc.add<double>("stripSizeEta", 0.05);
desc.add<double>("maxLeadChargedPFCandEta", 2.4);
desc.add<double>("deltaRCleaning", 0.4);
Expand Down Expand Up @@ -304,14 +302,13 @@ HPSPFTauProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions)
desc.add<double>("maxLeadChargedPFCandDz", 1000.0);
desc.add<double>("maxSeedJetEta", 2.4);
desc.add<std::string>("signalConeSize", "2.8/max(1., pt)");
desc.add<edm::InputTag>("srcL1Jets", edm::InputTag("Phase1L1TJetProducer","UncalibratedPhase1L1TJetFromPfCandidates"));
desc.add<edm::InputTag>("srcL1Jets",
edm::InputTag("Phase1L1TJetProducer", "UncalibratedPhase1L1TJetFromPfCandidates"));
desc.addUntracked<bool>("debug", false);
desc.add<double>("maxPFTauEta", 2.4);
desc.add<double>("maxSignalConeSize", 0.1);
descriptions.addWithDefaultLabel(desc);
}



#include "FWCore/Framework/interface/MakerMacros.h"
DEFINE_FWK_MODULE(HPSPFTauProducer);
8 changes: 4 additions & 4 deletions L1Trigger/Phase2L1Taus/plugins/HPSPFTauProducer.h
Expand Up @@ -10,8 +10,8 @@

#include "L1Trigger/Phase2L1Taus/interface/L1HPSPFTauQualityCut.h" // L1HPSPFTauQualityCut
#include "L1Trigger/Phase2L1Taus/interface/L1HPSPFTauBuilder.h" // L1HPSPFTauBuilder
#include "DataFormats/L1TParticleFlow/interface/HPSPFTau.h" // l1t::HPSPFTau
#include "DataFormats/L1TParticleFlow/interface/HPSPFTauFwd.h" // l1t::HPSPFTauCollection
#include "DataFormats/L1TParticleFlow/interface/HPSPFTau.h" // l1t::HPSPFTau
#include "DataFormats/L1TParticleFlow/interface/HPSPFTauFwd.h" // l1t::HPSPFTauCollection
#include "DataFormats/L1TParticleFlow/interface/PFCandidate.h" // l1t::PFCandidate, l1t::PFCandidateCollection, l1t::PFCandidateRef
#include "DataFormats/JetReco/interface/CaloJet.h"
#include "DataFormats/L1TCorrelator/interface/TkPrimaryVertex.h"
Expand All @@ -22,12 +22,12 @@
class HPSPFTauProducer : public edm::stream::EDProducer<> {
public:
explicit HPSPFTauProducer(const edm::ParameterSet& cfg);
~HPSPFTauProducer() = default;
~HPSPFTauProducer() override = default;

static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);

private:
void produce(edm::Event& evt, const edm::EventSetup& es);
void produce(edm::Event& evt, const edm::EventSetup& es) override;

std::string moduleLabel_;

Expand Down
20 changes: 10 additions & 10 deletions L1Trigger/Phase2L1Taus/src/L1HPSPFTauBuilder.cc
Expand Up @@ -8,15 +8,15 @@
#include <cmath> // std::fabs

L1HPSPFTauBuilder::L1HPSPFTauBuilder(const edm::ParameterSet& cfg)
: signalConeSizeFormula_(std::regex_replace(cfg.getParameter<std::string>("signalConeSize"), std::regex("pt"), "x")),
: signalConeSizeFormula_(
std::regex_replace(cfg.getParameter<std::string>("signalConeSize"), std::regex("pt"), "x")),
minSignalConeSize_(cfg.getParameter<double>("minSignalConeSize")),
maxSignalConeSize_(cfg.getParameter<double>("maxSignalConeSize")),
useStrips_(cfg.getParameter<bool>("useStrips")),
stripSizeEta_(cfg.getParameter<double>("stripSizeEta")),
stripSizePhi_(cfg.getParameter<double>("stripSizePhi")),
isolationConeSize_(cfg.getParameter<double>("isolationConeSize")),
debug_(cfg.getUntrackedParameter<bool>("debug", false)) {

assert(maxSignalConeSize_ >= minSignalConeSize_);

isolationConeSize2_ = isolationConeSize_ * isolationConeSize_;
Expand Down Expand Up @@ -158,7 +158,7 @@ void L1HPSPFTauBuilder::setL1PFTauSeed(const reco::CaloJetRef& l1JetSeed,
float l1PFTauSeedZVtx = 0.;
bool l1PFTauSeed_hasVtx = false;
float max_chargedPFCand_pt = -1.;
for (auto l1PFCand : l1PFCands) {
for (const auto& l1PFCand : l1PFCands) {
double dR = reco::deltaR(l1PFCand->eta(), l1PFCand->phi(), l1JetSeed->eta(), l1JetSeed->phi());
if (dR > 0.4)
continue;
Expand Down Expand Up @@ -191,7 +191,7 @@ void L1HPSPFTauBuilder::addL1PFCandidates(const std::vector<l1t::PFCandidateRef>
if (!(isPFCandSeeded_ || isJetSeeded_))
return;

for (auto l1PFCand : l1PFCands) {
for (const auto& l1PFCand : l1PFCands) {
if (!isWithinIsolationCone(*l1PFCand))
continue;
sumAllL1PFCandidates_.push_back(l1PFCand);
Expand All @@ -208,7 +208,7 @@ void L1HPSPFTauBuilder::addL1PFCandidates(const std::vector<l1t::PFCandidateRef>
}
}

for (auto l1PFCand : sumAllL1PFCandidates_) {
for (const auto& l1PFCand : sumAllL1PFCandidates_) {
sumAllL1PFCandidatesPt_ += l1PFCand->pt();
}
std::vector<double> emptyV;
Expand All @@ -223,7 +223,7 @@ void L1HPSPFTauBuilder::addL1PFCandidates(const std::vector<l1t::PFCandidateRef>
signalConeSize_ = maxSignalConeSize_;
signalConeSize2_ = signalConeSize_ * signalConeSize_;

for (auto l1PFCand : sumAllL1PFCandidates_) {
for (const auto& l1PFCand : sumAllL1PFCandidates_) {
if (debug_) {
printPFCand(std::cout, *l1PFCand, primaryVertex_);
}
Expand Down Expand Up @@ -295,7 +295,7 @@ void L1HPSPFTauBuilder::addL1PFCandidates(const std::vector<l1t::PFCandidateRef>
}
}

for (auto l1PFCand : l1PFCands) {
for (const auto& l1PFCand : l1PFCands) {
if (!isWithinIsolationCone(*l1PFCand))
continue;

Expand Down Expand Up @@ -338,7 +338,7 @@ bool L1HPSPFTauBuilder::isWithinIsolationCone(const l1t::PFCandidate& l1PFCand)

void L1HPSPFTauBuilder::buildL1PFTau() {
reco::Particle::LorentzVector l1PFTau_p4;
for (auto l1PFCand : signalAllL1PFCandidates_) {
for (const auto& l1PFCand : signalAllL1PFCandidates_) {
if (l1PFCand->id() == l1t::PFCandidate::ChargedHadron || l1PFCand->id() == l1t::PFCandidate::Electron ||
l1PFCand->id() == l1t::PFCandidate::Photon) {
l1PFTau_p4 += l1PFCand->p4();
Expand Down Expand Up @@ -400,7 +400,7 @@ void L1HPSPFTauBuilder::buildL1PFTau() {

double sumChargedIso = 0.;
double sumNeutralIso = 0.;
for (auto l1PFCand : isoAllL1PFCandidates_) {
for (const auto& l1PFCand : isoAllL1PFCandidates_) {
if (l1PFCand->charge() != 0) {
sumChargedIso += l1PFCand->pt();
} else if (l1PFCand->id() == l1t::PFCandidate::Photon) {
Expand Down Expand Up @@ -430,7 +430,7 @@ void L1HPSPFTauBuilder::buildL1PFTau() {

l1t::PFCandidateRefVector L1HPSPFTauBuilder::convertToRefVector(const std::vector<l1t::PFCandidateRef>& l1PFCands) {
l1t::PFCandidateRefVector l1PFCandsRefVector(l1PFCandProductID_);
for (auto l1PFCand : l1PFCands) {
for (const auto& l1PFCand : l1PFCands) {
l1PFCandsRefVector.push_back(l1PFCand);
}
return l1PFCandsRefVector;
Expand Down
2 changes: 1 addition & 1 deletion L1Trigger/Phase2L1Taus/src/L1HPSPFTauQualityCut.cc
Expand Up @@ -46,7 +46,7 @@ bool L1HPSPFTauQualityCut::operator()(const l1t::PFCandidate& pfCand, float_t pr

if (pfCand.charge() != 0) {
if (dzCut_ == kEnabledPrimary || dzCut_ == kEnabledPileup) {
l1t::PFTrackRef pfCand_track = pfCand.pfTrack();
const l1t::PFTrackRef& pfCand_track = pfCand.pfTrack();
double dz = std::fabs(pfCand_track->vertex().z() - primaryVertex_z);
if (dzCut_ == kEnabledPrimary && dz > maxDz_)
return false;
Expand Down

0 comments on commit ad7e27c

Please sign in to comment.