CMS 3D CMS Logo

Cuts.cc
Go to the documentation of this file.
3 
4 #include <cmath>
5 #include <sstream>
6 
7 using namespace std;
8 using namespace muonisolation;
9 
10 Cuts::Cuts(const edm::ParameterSet& pset) {
11  vector<double> etaBounds = pset.getParameter<std::vector<double> >("EtaBounds");
12  vector<double> coneSizes = pset.getParameter<std::vector<double> >("ConeSizes");
13  vector<double> thresholds = pset.getParameter<std::vector<double> >("Thresholds");
14  init(etaBounds, coneSizes, thresholds);
15 }
16 
17 Cuts::Cuts(const vector<double>& etaBounds, const vector<double>& coneSizes, const vector<double>& thresholds) {
18  init(etaBounds, coneSizes, thresholds);
19 }
20 
21 void Cuts::init(const vector<double>& etaBounds, const vector<double>& coneSizes, const vector<double>& thresholds) {
22  double minEta = 0.;
23  double coneSize = 0;
24  double threshold = 0;
25  unsigned int nEta = etaBounds.size();
26  for (unsigned int i = 0; i < nEta; i++) {
27  if (i > 0)
28  minEta = etaBounds[i - 1];
29  double maxEta = etaBounds[i];
30  if (i < coneSizes.size())
31  coneSize = coneSizes[i];
32  if (i < thresholds.size())
34 
36 
37  theCuts.push_back(cut);
38  }
39 }
40 
41 const Cuts::CutSpec& Cuts::operator()(double eta) const {
42  double absEta = fabs(eta);
43  unsigned int nCuts = theCuts.size();
44  unsigned int idx_eta = nCuts - 1;
45  for (unsigned int i = 0; i < nCuts; i++) {
46  if (absEta < theCuts[i].etaRange.max()) {
47  idx_eta = i;
48  break;
49  }
50  }
51  return theCuts[idx_eta];
52 }
53 
55  std::ostringstream result;
56  typedef std::vector<CutSpec>::const_iterator IT;
57  result << "Cuts : " << std::endl;
58  for (IT it = theCuts.begin(), itEnd = theCuts.end(); it < itEnd; ++it) {
59  result << "eta: " << (*it).etaRange << ", cone: " << (*it).conesize << ", cut: " << (*it).threshold << std::endl;
60  }
61  return result.str();
62 }
init
int init
Definition: HydjetWrapper.h:64
mps_fire.i
i
Definition: mps_fire.py:428
particleFlowZeroSuppressionECAL_cff.thresholds
thresholds
Definition: particleFlowZeroSuppressionECAL_cff.py:31
generateTowerEtThresholdLUT.etaRange
etaRange
Definition: generateTowerEtThresholdLUT.py:55
TkAlMuonSelectors_cfi.cut
cut
Definition: TkAlMuonSelectors_cfi.py:5
HLT_FULL_cff.nEta
nEta
Definition: HLT_FULL_cff.py:6586
PVValHelper::eta
Definition: PVValidationHelpers.h:69
maxEta
double maxEta
Definition: PFJetBenchmarkAnalyzer.cc:76
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ParameterSet
Definition: ParameterSet.h:47
HLT_FULL_cff.coneSize
coneSize
Definition: HLT_FULL_cff.py:50845
print
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:46
IT
std::vector< LinkConnSpec >::const_iterator IT
Definition: TriggerBoardSpec.cc:5
muonisolation
Definition: CandViewExtractor.h:16
std
Definition: JetResolutionObject.h:76
mps_fire.result
result
Definition: mps_fire.py:311
ParameterSet.h
muonisolation::Range< double >
remoteMonitoring_LED_IterMethod_cfg.threshold
threshold
Definition: remoteMonitoring_LED_IterMethod_cfg.py:426
EgHLTOffEleSelection_cfi.minEta
minEta
Definition: EgHLTOffEleSelection_cfi.py:11
muonisolation::Cuts::CutSpec
Definition: Cuts.h:16
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
Cuts.h