Skip to content

Commit e945f3c

Browse files
authored
Merge pull request #46566 from Dr15Jones/warnClusterSummary
Make ClusterSummary possible to turn off warning
2 parents 29902e3 + c901b94 commit e945f3c

File tree

3 files changed

+23
-14
lines changed

3 files changed

+23
-14
lines changed

DPGAnalysis/SiStripTools/plugins/MultiplicityAlgorithms.cc

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,15 @@ ClusterSummarySingleMultiplicity::ClusterSummarySingleMultiplicity(const edm::Pa
66
edm::ConsumesCollector&& iC)
77
: m_subdetenum((ClusterSummary::CMSTracker)iConfig.getParameter<int>("subDetEnum")),
88
m_varenum((ClusterSummary::VariablePlacement)iConfig.getParameter<int>("varEnum")),
9-
m_collection(iC.consumes<ClusterSummary>(iConfig.getParameter<edm::InputTag>("clusterSummaryCollection"))) {}
9+
m_collection(iC.consumes<ClusterSummary>(iConfig.getParameter<edm::InputTag>("clusterSummaryCollection"))),
10+
m_warn(iConfig.getUntrackedParameter<bool>("warnIfModuleMissing", true)) {}
1011

1112
ClusterSummarySingleMultiplicity::ClusterSummarySingleMultiplicity(const edm::ParameterSet& iConfig,
1213
edm::ConsumesCollector& iC)
1314
: m_subdetenum((ClusterSummary::CMSTracker)iConfig.getParameter<int>("subDetEnum")),
1415
m_varenum((ClusterSummary::VariablePlacement)iConfig.getParameter<int>("varEnum")),
15-
m_collection(iC.consumes<ClusterSummary>(iConfig.getParameter<edm::InputTag>("clusterSummaryCollection"))) {}
16+
m_collection(iC.consumes<ClusterSummary>(iConfig.getParameter<edm::InputTag>("clusterSummaryCollection"))),
17+
m_warn(iConfig.getUntrackedParameter<bool>("warnIfModuleMissing", true)) {}
1618

1719
ClusterSummarySingleMultiplicity::value_t ClusterSummarySingleMultiplicity::getEvent(
1820
const edm::Event& iEvent, const edm::EventSetup& iSetup) const {
@@ -23,13 +25,13 @@ ClusterSummarySingleMultiplicity::value_t ClusterSummarySingleMultiplicity::getE
2325

2426
switch (m_varenum) {
2527
case ClusterSummary::NCLUSTERS:
26-
mult = int(clustsumm->getNClus(m_subdetenum));
28+
mult = int(clustsumm->getNClus(m_subdetenum, m_warn));
2729
break;
2830
case ClusterSummary::CLUSTERSIZE:
29-
mult = int(clustsumm->getClusSize(m_subdetenum));
31+
mult = int(clustsumm->getClusSize(m_subdetenum, m_warn));
3032
break;
3133
case ClusterSummary::CLUSTERCHARGE:
32-
mult = int(clustsumm->getClusCharge(m_subdetenum));
34+
mult = int(clustsumm->getClusCharge(m_subdetenum, m_warn));
3335
break;
3436
default:
3537
mult = -1;

DPGAnalysis/SiStripTools/plugins/MultiplicityAlgorithms.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ namespace sistriptools::algorithm {
4242
ClusterSummary::CMSTracker m_subdetenum;
4343
ClusterSummary::VariablePlacement m_varenum;
4444
edm::EDGetTokenT<ClusterSummary> m_collection;
45+
bool m_warn;
4546
};
4647

4748
template <class T>

DataFormats/TrackerCommon/interface/ClusterSummary.h

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -106,16 +106,16 @@ class ClusterSummary {
106106
int getClusSizeByIndex(const int mod) const { return clusSize.at(mod); }
107107
float getClusChargeByIndex(const int mod) const { return clusCharge.at(mod); }
108108

109-
int getNClus(const CMSTracker mod) const {
110-
int pos = getModuleLocation(mod);
109+
int getNClus(const CMSTracker mod, bool warn = true) const {
110+
int pos = getModuleLocation(mod, warn);
111111
return pos < 0 ? 0. : nClus[pos];
112112
}
113-
int getClusSize(const CMSTracker mod) const {
114-
int pos = getModuleLocation(mod);
113+
int getClusSize(const CMSTracker mod, bool warn = true) const {
114+
int pos = getModuleLocation(mod, warn);
115115
return pos < 0 ? 0. : clusSize[pos];
116116
}
117-
float getClusCharge(const CMSTracker mod) const {
118-
int pos = getModuleLocation(mod);
117+
float getClusCharge(const CMSTracker mod, bool warn = true) const {
118+
int pos = getModuleLocation(mod, warn);
119119
return pos < 0 ? 0. : clusCharge[pos];
120120
}
121121

@@ -127,9 +127,15 @@ class ClusterSummary {
127127
void addClusSizeByIndex(const int mod, const int val) { clusSize.at(mod) += val; }
128128
void addClusChargeByIndex(const int mod, const float val) { clusCharge.at(mod) += val; }
129129

130-
void addNClus(const CMSTracker mod, const int val) { nClus.at(getModuleLocation(mod)) += val; }
131-
void addClusSize(const CMSTracker mod, const int val) { clusSize.at(getModuleLocation(mod)) += val; }
132-
void addClusCharge(const CMSTracker mod, const float val) { clusCharge.at(getModuleLocation(mod)) += val; }
130+
void addNClus(const CMSTracker mod, const int val, bool warn = true) {
131+
nClus.at(getModuleLocation(mod, warn)) += val;
132+
}
133+
void addClusSize(const CMSTracker mod, const int val, bool warn = true) {
134+
clusSize.at(getModuleLocation(mod, warn)) += val;
135+
}
136+
void addClusCharge(const CMSTracker mod, const float val, bool warn = true) {
137+
clusCharge.at(getModuleLocation(mod, warn)) += val;
138+
}
133139

134140
const std::vector<int>& getModules() const { return modules; }
135141
// Return the location of desired module within modules_. If warn is set to true, a warnign will be outputed in case no module was found

0 commit comments

Comments
 (0)