CMS 3D CMS Logo

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 }
TriggerObject
Definition: TriggerObject.py:1
funct::false
false
Definition: Factorize.h:29
trigger::EgammaObject::EgammaObject
EgammaObject()
Definition: EgammaObject.h:19
edm::RefVector< ElectronSeedCollection >
trigger::EgammaObject::setVars
void setVars(std::vector< std::pair< std::string, float >> vars)
Definition: EgammaObject.cc:59
trigObjTnPSource_cfi.var
var
Definition: trigObjTnPSource_cfi.py:21
fileCollector.seed
seed
Definition: fileCollector.py:127
names
const std::string names[nVars_]
Definition: PhotonIDValueMapProducer.cc:124
vars
vars
Definition: DeepTauId.cc:164
trigger::EgammaObject::varNames
std::vector< std::string > varNames() const
Definition: EgammaObject.cc:40
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
trigger::EgammaObject::hasVar
bool hasVar(const std::string &varName) const
Definition: EgammaObject.cc:22
InitialStep_cff.seeds
seeds
Definition: InitialStep_cff.py:231
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
jetUpdater_cfi.sort
sort
Definition: jetUpdater_cfi.py:29
GsfTrack.h
trackerHitRTTI::vector
Definition: trackerHitRTTI.h:21
EgammaObject.h
trigger::EgammaObject::setSeeds
void setSeeds(reco::ElectronSeedRefVector seeds)
Definition: EgammaObject.cc:11
eostools.move
def move(src, dest)
Definition: eostools.py:511
RecoEcalCandidate.h
trigger::EgammaObject::VarComparer
Definition: EgammaObject.h:44
SuperCluster.h
trigger::EgammaObject::var
float var(const std::string &varName, bool raiseExcept=true) const
Definition: EgammaObject.cc:26
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
trigger::EgammaObject::varNamesStr
std::string varNamesStr() const
Definition: EgammaObject.cc:48
varNames
constexpr const char * varNames[]
Definition: PulseShapeFitOOTPileupCorrection.cc:110
cms::Exception
Definition: Exception.h:70
reco::RecoEcalCandidate
Definition: RecoEcalCandidate.h:15
ElectronSeed.h