CMS 3D CMS Logo

EtaPtBin.cc
Go to the documentation of this file.
2 
3 #include <algorithm>
4 #include <sstream>
5 
6 EtaPtBin::EtaPtBin(const bool& etaActive_,
7  const double& etaMin_,
8  const double& etaMax_,
9  const bool& ptActive_,
10  const double& ptMin_,
11  const double& ptMax_)
12  : etaActive(etaActive_), etaMin(etaMin_), etaMax(etaMax_), ptActive(ptActive_), ptMin(ptMin_), ptMax(ptMax_) {
14 }
15 
17  const double& etaMin_,
18  const double& etaMax_,
19  const bool& ptActive_,
20  const double& ptMin_,
21  const double& ptMax_) {
22  // create string only from the active parts
23  std::stringstream stream("");
24 
25  if (etaActive_) {
26  stream << "_ETA_" << etaMin_ << "-" << etaMax_;
27  }
28 
29  if (ptActive_) {
30  stream << "_PT_" << ptMin_ << "-" << ptMax_;
31  }
32  if (!(etaActive_ || ptActive_))
33  stream << "_GLOBAL";
34 
35  std::string descr(stream.str());
36  // remove blanks which are introduced when adding doubles
37  std::remove(descr.begin(), descr.end(), ' ');
38  std::replace(descr.begin(), descr.end(), '.', 'v');
39 
40  return descr;
41 }
42 
43 bool EtaPtBin::inBin(const reco::Jet& jet, const double jec) const { return inBin(jet.eta(), jet.pt() * jec); }
44 
45 // bool EtaPtBin::inBin(const BTagMCTools::JetFlavour & jetFlavour) const
46 // {
47 // return inBin(jetFlavour.underlyingParton4Vec().Eta(),
48 // jetFlavour.underlyingParton4Vec().Pt());
49 // }
50 
51 bool EtaPtBin::inBin(const double& eta, const double& pt) const {
52  if (etaActive) {
53  if (fabs(eta) < etaMin)
54  return false;
55  if (fabs(eta) > etaMax)
56  return false;
57  }
58 
59  if (ptActive) {
60  if (pt < ptMin)
61  return false;
62  if (pt > ptMax)
63  return false;
64  }
65 
66  return true;
67 }
EtaPtBin.h
EtaPtBin::etaMax
double etaMax
Definition: EtaPtBin.h:57
ALCARECOTkAlBeamHalo_cff.etaMin
etaMin
GeV.
Definition: ALCARECOTkAlBeamHalo_cff.py:32
reco::Jet
Base class for all types of Jets.
Definition: Jet.h:20
EtaPtBin::etaActive
bool etaActive
Definition: EtaPtBin.h:55
EtaPtBin::inBin
bool inBin(const double &eta, const double &pt) const
Check if jet/parton are within rapidity/pt cuts.
Definition: EtaPtBin.cc:51
DiDispStaMuonMonitor_cfi.pt
pt
Definition: DiDispStaMuonMonitor_cfi.py:39
EtaPtBin::ptMax
double ptMax
Definition: EtaPtBin.h:61
cms::cuda::stream
cudaStream_t stream
Definition: HistoContainer.h:57
ptMin
constexpr float ptMin
Definition: PhotonIDValueMapProducer.cc:153
EtaPtBin::EtaPtBin
EtaPtBin(const bool &etaActive_, const double &etaMin_, const double &etaMax_, const bool &ptActive_, const double &ptMin_, const double &ptMax_)
Definition: EtaPtBin.cc:6
AlignmentTrackSelector_cfi.ptMax
ptMax
Definition: AlignmentTrackSelector_cfi.py:12
PVValHelper::eta
Definition: PVValidationHelpers.h:69
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
EtaPtBin::etaMin
double etaMin
Definition: EtaPtBin.h:56
EtaPtBin::ptMin
double ptMin
Definition: EtaPtBin.h:60
EtaPtBin::buildDescriptionString
static std::string buildDescriptionString(const bool &etaActive_, const double &etaMin_, const double &etaMax_, const bool &ptActive_, const double &ptMin_, const double &ptMax_)
Definition: EtaPtBin.cc:16
EtaPtBin::ptActive
bool ptActive
Definition: EtaPtBin.h:59
metsig::jet
Definition: SignAlgoResolutions.h:47
MatrixUtil.remove
def remove(d, key, TELL=False)
Definition: MatrixUtil.py:212
ALCARECOTkAlBeamHalo_cff.etaMax
etaMax
Definition: ALCARECOTkAlBeamHalo_cff.py:33
EtaPtBin::descriptionString
std::string descriptionString
Definition: EtaPtBin.h:64
jetMETDQMOfflineSource_cff.jec
jec
Definition: jetMETDQMOfflineSource_cff.py:27
python.rootplot.root2matplotlib.replace
def replace(string, replacements)
Definition: root2matplotlib.py:444