Skip to content

Commit 4cfc222

Browse files
committed
fix code-format
1 parent 5e4e4c0 commit 4cfc222

File tree

1 file changed

+28
-30
lines changed

1 file changed

+28
-30
lines changed

RecoBTag/ONNXRuntime/plugins/UnifiedParticleTransformerAK4SonicJetTagsProducer.cc

Lines changed: 28 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@
2121

2222
class UnifiedParticleTransformerAK4SonicJetTagsProducer : public TritonEDProducer<> {
2323
public:
24-
explicit UnifiedParticleTransformerAK4SonicJetTagsProducer(const edm::ParameterSet&);
24+
explicit UnifiedParticleTransformerAK4SonicJetTagsProducer(const edm::ParameterSet &);
2525
~UnifiedParticleTransformerAK4SonicJetTagsProducer() override;
2626

2727
void acquire(edm::Event const &iEvent, edm::EventSetup const &iSetup, Input &iInput) override;
2828

2929
void produce(edm::Event &iEvent, edm::EventSetup const &iSetup, Output const &iOutput) override;
30-
static void fillDescriptions(edm::ConfigurationDescriptions&);
30+
static void fillDescriptions(edm::ConfigurationDescriptions &);
3131

3232
private:
3333
typedef std::vector<reco::UnifiedParticleTransformerAK4TagInfo> TagInfoCollection;
@@ -41,27 +41,28 @@ class UnifiedParticleTransformerAK4SonicJetTagsProducer : public TritonEDProduce
4141
bool skippedInference_ = false;
4242
};
4343

44-
45-
UnifiedParticleTransformerAK4SonicJetTagsProducer::UnifiedParticleTransformerAK4SonicJetTagsProducer(const edm::ParameterSet& iConfig)
44+
UnifiedParticleTransformerAK4SonicJetTagsProducer::UnifiedParticleTransformerAK4SonicJetTagsProducer(
45+
const edm::ParameterSet &iConfig)
4646
: TritonEDProducer<>(iConfig),
4747
src_(consumes<TagInfoCollection>(iConfig.getParameter<edm::InputTag>("src"))),
4848
flav_names_(iConfig.getParameter<std::vector<std::string>>("flav_names")),
4949
input_names_(iConfig.getParameter<std::vector<std::string>>("input_names")),
5050
output_names_(iConfig.getParameter<std::vector<std::string>>("output_names")) {
5151
// get output names from flav_names
52-
for (const auto& flav_name : flav_names_) {
52+
for (const auto &flav_name : flav_names_) {
5353
produces<JetTagCollection>(flav_name);
5454
}
5555
}
5656

5757
UnifiedParticleTransformerAK4SonicJetTagsProducer::~UnifiedParticleTransformerAK4SonicJetTagsProducer() {}
5858

59-
void UnifiedParticleTransformerAK4SonicJetTagsProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
59+
void UnifiedParticleTransformerAK4SonicJetTagsProducer::fillDescriptions(edm::ConfigurationDescriptions &descriptions) {
6060
// pfUnifiedParticleTransformerAK4SonicJetTags
6161
edm::ParameterSetDescription desc;
6262
TritonClient::fillPSetDescription(desc);
6363
desc.add<edm::InputTag>("src", edm::InputTag("pfUnifiedParticleTransformerAK4TagInfos"));
64-
desc.add<std::vector<std::string>>("input_names", {"input_1", "input_2", "input_3", "input_4", "input_5", "input_6", "input_7", "input_8"});
64+
desc.add<std::vector<std::string>>(
65+
"input_names", {"input_1", "input_2", "input_3", "input_4", "input_5", "input_6", "input_7", "input_8"});
6566
desc.add<std::vector<std::string>>("output_names", {"softmax"});
6667
desc.add<std::vector<std::string>>(
6768
"flav_names",
@@ -85,20 +86,20 @@ void UnifiedParticleTransformerAK4SonicJetTagsProducer::acquire(edm::Event const
8586
if (tag_infos->empty())
8687
return;
8788

88-
// Find the max n_cpf, n_npf and n_vtx among all the jets in an event.
89+
// Find the max n_cpf, n_npf and n_vtx among all the jets in an event.
8990
unsigned int max_n_cpf_counter = 0;
9091
unsigned int max_n_lt_counter = 0;
9192
unsigned int max_n_npf_counter = 0;
9293
unsigned int max_n_vtx_counter = 0;
9394
for (unsigned jet_n = 0; jet_n < tag_infos->size(); ++jet_n) {
94-
max_n_cpf_counter = std::max(max_n_cpf_counter,
95-
static_cast<unsigned int>(((*tag_infos)[jet_n]).features().c_pf_features.size()));
96-
max_n_lt_counter = std::max(max_n_lt_counter,
97-
static_cast<unsigned int>(((*tag_infos)[jet_n]).features().lt_features.size()));
98-
max_n_npf_counter = std::max(max_n_npf_counter,
99-
static_cast<unsigned int>(((*tag_infos)[jet_n]).features().n_pf_features.size()));
100-
max_n_vtx_counter = std::max(max_n_vtx_counter,
101-
static_cast<unsigned int>(((*tag_infos)[jet_n]).features().sv_features.size()));
95+
max_n_cpf_counter =
96+
std::max(max_n_cpf_counter, static_cast<unsigned int>(((*tag_infos)[jet_n]).features().c_pf_features.size()));
97+
max_n_lt_counter =
98+
std::max(max_n_lt_counter, static_cast<unsigned int>(((*tag_infos)[jet_n]).features().lt_features.size()));
99+
max_n_npf_counter =
100+
std::max(max_n_npf_counter, static_cast<unsigned int>(((*tag_infos)[jet_n]).features().n_pf_features.size()));
101+
max_n_vtx_counter =
102+
std::max(max_n_vtx_counter, static_cast<unsigned int>(((*tag_infos)[jet_n]).features().sv_features.size()));
102103
}
103104

104105
// If an event has no jet, or all jets has zero n_cpf, n_lt, n_npf and n_vtx, the inference is skipped.
@@ -113,25 +114,22 @@ void UnifiedParticleTransformerAK4SonicJetTagsProducer::acquire(edm::Event const
113114
const unsigned int target_n_lt = std::clamp(max_n_lt_counter, (unsigned int)1, (unsigned int)UparT::n_lt_accept);
114115
const unsigned int target_n_npf = std::clamp(max_n_npf_counter, (unsigned int)1, (unsigned int)UparT::n_npf_accept);
115116
const unsigned int target_n_vtx = std::clamp(max_n_vtx_counter, (unsigned int)1, (unsigned int)UparT::n_sv_accept);
116-
const std::map<UparT::InputFeatures, unsigned int> target_n{
117-
{UparT::kChargedCandidates, target_n_cpf},
118-
{UparT::kLostTracks, target_n_lt},
119-
{UparT::kNeutralCandidates, target_n_npf},
120-
{UparT::kVertices, target_n_vtx},
121-
{UparT::kChargedCandidates4Vec, target_n_cpf},
122-
{UparT::kLostTracks4Vec, target_n_lt},
123-
{UparT::kNeutralCandidates4Vec, target_n_npf},
124-
{UparT::kVertices4Vec, target_n_vtx}
125-
};
117+
const std::map<UparT::InputFeatures, unsigned int> target_n{{UparT::kChargedCandidates, target_n_cpf},
118+
{UparT::kLostTracks, target_n_lt},
119+
{UparT::kNeutralCandidates, target_n_npf},
120+
{UparT::kVertices, target_n_vtx},
121+
{UparT::kChargedCandidates4Vec, target_n_cpf},
122+
{UparT::kLostTracks4Vec, target_n_lt},
123+
{UparT::kNeutralCandidates4Vec, target_n_npf},
124+
{UparT::kVertices4Vec, target_n_vtx}};
126125

127126
for (UparT::InputFeatures ifeature = UparT::kBegin; ifeature != UparT::kEnd;
128-
ifeature = static_cast<UparT::InputFeatures>(ifeature+1)) {
127+
ifeature = static_cast<UparT::InputFeatures>(ifeature + 1)) {
129128
const auto &group_name = input_names_[ifeature];
130129
auto &input = iInput.at(group_name);
131130
input.setShape(0, target_n.at(ifeature));
132131
auto tdata = input.allocate<float>(true);
133132
for (unsigned jet_n = 0; jet_n < tag_infos->size(); ++jet_n) {
134-
135133
const auto &taginfo = (*tag_infos)[jet_n];
136134
const auto &features = taginfo.features();
137135
auto &vdata = (*tdata)[jet_n];
@@ -149,8 +147,8 @@ void UnifiedParticleTransformerAK4SonicJetTagsProducer::acquire(edm::Event const
149147
}
150148
}
151149

152-
void UnifiedParticleTransformerAK4SonicJetTagsProducer::produce(edm::Event& iEvent,
153-
const edm::EventSetup& iSetup,
150+
void UnifiedParticleTransformerAK4SonicJetTagsProducer::produce(edm::Event &iEvent,
151+
const edm::EventSetup &iSetup,
154152
Output const &iOutput) {
155153
edm::Handle<TagInfoCollection> tag_infos;
156154
iEvent.getByToken(src_, tag_infos);

0 commit comments

Comments
 (0)