CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
EgammaObject.cc
Go to the documentation of this file.
2 
7 
9  : TriggerObject(ecalCand), hasPixelMatch_(false), superCluster_(ecalCand.superCluster()) {}
10 
12  seeds_ = std::move(seeds);
13  hasPixelMatch_ = false;
14  for (const auto& seed : seeds_) {
15  if (!seed->hitInfo().empty()) {
16  hasPixelMatch_ = true;
17  break;
18  }
19  }
20 }
21 
22 bool trigger::EgammaObject::hasVar(const std::string& varName) const {
23  return std::binary_search(vars_.begin(), vars_.end(), varName, VarComparer());
24 }
25 
26 float trigger::EgammaObject::var(const std::string& varName, const bool raiseExcept) const {
27  //here we have a guaranteed sorted vector with unique entries
28  auto varIt = std::equal_range(vars_.begin(), vars_.end(), varName, VarComparer());
29  if (varIt.first != varIt.second)
30  return varIt.first->second;
31  else if (raiseExcept) {
32  cms::Exception ex("AttributeError");
33  ex << " error variable " << varName << " is not present, variables present are " << varNamesStr();
34  throw ex;
35  } else {
37  }
38 }
39 
40 std::vector<std::string> trigger::EgammaObject::varNames() const {
41  std::vector<std::string> names;
42  for (const auto& var : vars_) {
43  names.push_back(var.first);
44  }
45  return names;
46 }
47 
49  std::string retVal;
50  auto names = varNames();
51  for (const auto& name : names) {
52  if (!retVal.empty())
53  retVal += " ";
54  retVal += name;
55  }
56  return retVal;
57 }
58 
59 void trigger::EgammaObject::setVars(std::vector<std::pair<std::string, float>> vars) {
60  vars_ = std::move(vars);
61  std::sort(vars_.begin(), vars_.end(), [](auto& lhs, auto& rhs) { return lhs.first < rhs.first; });
62 }
std::vector< std::string > varNames() const
Definition: EgammaObject.cc:40
void setVars(std::vector< std::pair< std::string, float >> vars)
Definition: EgammaObject.cc:59
std::string varNamesStr() const
Definition: EgammaObject.cc:48
constexpr char const * varNames[]
const std::string names[nVars_]
Single trigger physics object (e.g., an isolated muon)
Definition: TriggerObject.h:21
float var(const std::string &varName, bool raiseExcept=true) const
Definition: EgammaObject.cc:26
list var
if using global norm cols_to_minmax = [&#39;t_delta&#39;, &#39;t_hmaxNearP&#39;,&#39;t_emaxNearP&#39;, &#39;t_hAnnular&#39;, &#39;t_eAnnular&#39;,&#39;t_pt&#39;,&#39;t_nVtx&#39;,&#39;t_ieta&#39;,&#39;t_eHcal10&#39;, &#39;t_eHcal30&#39;,&#39;t_rhoh&#39;,&#39;t_eHcal&#39;] df[cols_to_minmax] = df[cols_to_minmax].apply(lambda x: (x - x.min()) / (x.max() - x.min()) if (x.max() - x.min() &gt; 0) else 1.0/200.0)
def move
Definition: eostools.py:511
void setSeeds(reco::ElectronSeedRefVector seeds)
Definition: EgammaObject.cc:11
bool hasVar(const std::string &varName) const
Definition: EgammaObject.cc:22
vars
Definition: DeepTauId.cc:164