CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Classes | Public Member Functions | Private Attributes
trigger::EgammaObject Class Reference

#include <EgammaObject.h>

Inheritance diagram for trigger::EgammaObject:
trigger::TriggerObject

Classes

struct  VarComparer
 

Public Member Functions

void clearVars ()
 
 EgammaObject ()
 
 EgammaObject (int id, float pt, float eta, float phi, float mass)
 
 EgammaObject (const reco::RecoEcalCandidate &ecalCand)
 
const reco::GsfTrackRefVectorgsfTracks () const
 
bool hasVar (const std::string &varName) const
 
const reco::ElectronSeedRefVectorseeds () const
 
void setGsfTracks (reco::GsfTrackRefVector trks)
 
void setSeeds (reco::ElectronSeedRefVector seeds)
 
void setSuperCluster (const reco::SuperClusterRef &sc)
 
void setVars (std::vector< std::pair< std::string, float >> vars)
 
const reco::SuperClusterRefsuperCluster () const
 
float var (const std::string &varName, bool raiseExcept=true) const
 
std::vector< std::string > varNames () const
 
std::string varNamesStr () const
 
const std::vector< std::pair
< std::string, float > > & 
vars () const
 
- Public Member Functions inherited from trigger::TriggerObject
float energy () const
 
float et () const
 
float eta () const
 
int id () const
 getters More...
 
float mass () const
 
float p () const
 
reco::Particle particle (reco::Particle::Charge q=0, const reco::Particle::Point &vertex=reco::Particle::Point(0, 0, 0), int status=0, bool integerCharge=true) const
 
float phi () const
 
float pt () const
 
float px () const
 
float py () const
 
float pz () const
 
void setEta (float eta)
 
void setId (int id)
 setters More...
 
void setMass (float mass)
 
void setPhi (float phi)
 
void setPt (float pt)
 
 TriggerObject ()
 methods More...
 
 TriggerObject (int id, float pt, float eta, float phi, float mass)
 
template<typename T >
 TriggerObject (int id, const T &o)
 any type T object implementing the methods pt(), eta(), phi(), mass() More...
 
template<typename T >
 TriggerObject (const T &o)
 ... and pdgId() More...
 

Private Attributes

reco::GsfTrackRefVector gsfTracks_
 
bool hasPixelMatch_
 
reco::ElectronSeedRefVector seeds_
 
reco::SuperClusterRef superCluster_
 
std::vector< std::pair
< std::string, float > > 
vars_
 

Detailed Description

Definition at line 17 of file EgammaObject.h.

Constructor & Destructor Documentation

trigger::EgammaObject::EgammaObject ( )
inline

Definition at line 19 of file EgammaObject.h.

19 : hasPixelMatch_(false) {}
trigger::EgammaObject::EgammaObject ( int  id,
float  pt,
float  eta,
float  phi,
float  mass 
)
inline

Definition at line 21 of file EgammaObject.h.

22  : TriggerObject(id, pt, eta, phi, mass), hasPixelMatch_(false) {}
float phi() const
Definition: TriggerObject.h:54
float eta() const
Definition: TriggerObject.h:53
float mass() const
Definition: TriggerObject.h:55
trigger::EgammaObject::EgammaObject ( const reco::RecoEcalCandidate ecalCand)

Definition at line 8 of file EgammaObject.cc.

9  : TriggerObject(ecalCand), hasPixelMatch_(false), superCluster_(ecalCand.superCluster()) {}
reco::SuperClusterRef superCluster() const override
reference to a superCluster
reco::SuperClusterRef superCluster_
Definition: EgammaObject.h:56

Member Function Documentation

void trigger::EgammaObject::clearVars ( )
inline

Definition at line 41 of file EgammaObject.h.

References vars_.

41 { vars_.clear(); }
std::vector< std::pair< std::string, float > > vars_
Definition: EgammaObject.h:54
const reco::GsfTrackRefVector& trigger::EgammaObject::gsfTracks ( ) const
inline

Definition at line 26 of file EgammaObject.h.

References gsfTracks_.

26 { return gsfTracks_; }
reco::GsfTrackRefVector gsfTracks_
Definition: EgammaObject.h:57
bool trigger::EgammaObject::hasVar ( const std::string &  varName) const

Definition at line 22 of file EgammaObject.cc.

22  {
23  return std::binary_search(vars_.begin(), vars_.end(), varName, VarComparer());
24 }
std::vector< std::pair< std::string, float > > vars_
Definition: EgammaObject.h:54
const reco::ElectronSeedRefVector& trigger::EgammaObject::seeds ( ) const
inline

Definition at line 27 of file EgammaObject.h.

References seeds_.

27 { return seeds_; }
reco::ElectronSeedRefVector seeds_
Definition: EgammaObject.h:59
void trigger::EgammaObject::setGsfTracks ( reco::GsfTrackRefVector  trks)
inline

Definition at line 30 of file EgammaObject.h.

References gsfTracks_, and eostools::move().

Referenced by EgammaHLTExtraProducer::setGsfTracks().

30 { gsfTracks_ = std::move(trks); }
def move
Definition: eostools.py:511
reco::GsfTrackRefVector gsfTracks_
Definition: EgammaObject.h:57
void trigger::EgammaObject::setSeeds ( reco::ElectronSeedRefVector  seeds)

Definition at line 11 of file EgammaObject.cc.

References eostools::move(), and fileCollector::seed.

Referenced by EgammaHLTExtraProducer::setSeeds().

11  {
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 }
def move
Definition: eostools.py:511
reco::ElectronSeedRefVector seeds_
Definition: EgammaObject.h:59
void trigger::EgammaObject::setSuperCluster ( const reco::SuperClusterRef sc)
inline

Definition at line 29 of file EgammaObject.h.

References superCluster_.

29 { superCluster_ = sc; }
reco::SuperClusterRef superCluster_
Definition: EgammaObject.h:56
void trigger::EgammaObject::setVars ( std::vector< std::pair< std::string, float >>  vars)

Definition at line 59 of file EgammaObject.cc.

References eostools::move().

Referenced by EgammaHLTExtraProducer::setVars().

59  {
60  vars_ = std::move(vars);
61  std::sort(vars_.begin(), vars_.end(), [](auto& lhs, auto& rhs) { return lhs.first < rhs.first; });
62 }
def move
Definition: eostools.py:511
vars
Definition: DeepTauId.cc:164
std::vector< std::pair< std::string, float > > vars_
Definition: EgammaObject.h:54
const reco::SuperClusterRef& trigger::EgammaObject::superCluster ( ) const
inline
float trigger::EgammaObject::var ( const std::string &  varName,
bool  raiseExcept = true 
) const

Definition at line 26 of file EgammaObject.cc.

References SiStripPI::max.

Referenced by tree.Tree::copyStructure().

26  {
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 }
std::string varNamesStr() const
Definition: EgammaObject.cc:48
std::vector< std::pair< std::string, float > > vars_
Definition: EgammaObject.h:54
std::vector< std::string > trigger::EgammaObject::varNames ( ) const

Definition at line 40 of file EgammaObject.cc.

References names, and isotrackApplyRegressor::var.

40  {
41  std::vector<std::string> names;
42  for (const auto& var : vars_) {
43  names.push_back(var.first);
44  }
45  return names;
46 }
const std::string names[nVars_]
float var(const std::string &varName, bool raiseExcept=true) const
Definition: EgammaObject.cc:26
std::vector< std::pair< std::string, float > > vars_
Definition: EgammaObject.h:54
std::string trigger::EgammaObject::varNamesStr ( ) const

Definition at line 48 of file EgammaObject.cc.

References mergeVDriftHistosByStation::name, names, AlCaHLTBitMon_QueryRunRegistry::string, and varNames.

48  {
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 }
std::vector< std::string > varNames() const
Definition: EgammaObject.cc:40
const std::string names[nVars_]
const std::vector<std::pair<std::string, float> >& trigger::EgammaObject::vars ( ) const
inline

Definition at line 35 of file EgammaObject.h.

References vars_.

35 { return vars_; }
std::vector< std::pair< std::string, float > > vars_
Definition: EgammaObject.h:54

Member Data Documentation

reco::GsfTrackRefVector trigger::EgammaObject::gsfTracks_
private

Definition at line 57 of file EgammaObject.h.

Referenced by gsfTracks(), and setGsfTracks().

bool trigger::EgammaObject::hasPixelMatch_
private

Definition at line 53 of file EgammaObject.h.

reco::ElectronSeedRefVector trigger::EgammaObject::seeds_
private

Definition at line 59 of file EgammaObject.h.

Referenced by seeds().

reco::SuperClusterRef trigger::EgammaObject::superCluster_
private

Definition at line 56 of file EgammaObject.h.

Referenced by setSuperCluster(), and superCluster().

std::vector<std::pair<std::string, float> > trigger::EgammaObject::vars_
private

Definition at line 54 of file EgammaObject.h.

Referenced by clearVars(), and vars().