CMS 3D CMS Logo

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

◆ EgammaObject() [1/3]

trigger::EgammaObject::EgammaObject ( )
inline

Definition at line 19 of file EgammaObject.h.

19 : hasPixelMatch_(false) {}

◆ EgammaObject() [2/3]

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) {}

◆ EgammaObject() [3/3]

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

◆ clearVars()

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

◆ gsfTracks()

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

◆ hasVar()

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

◆ seeds()

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

◆ setGsfTracks()

void trigger::EgammaObject::setGsfTracks ( reco::GsfTrackRefVector  trks)
inline

Definition at line 30 of file EgammaObject.h.

References gsfTracks_, eostools::move(), and hltEgammaHLTExtra_cfi::trks.

Referenced by EgammaHLTExtraProducer::setGsfTracks().

reco::GsfTrackRefVector gsfTracks_
Definition: EgammaObject.h:57
def move(src, dest)
Definition: eostools.py:511

◆ setSeeds()

void trigger::EgammaObject::setSeeds ( reco::ElectronSeedRefVector  seeds)

Definition at line 11 of file EgammaObject.cc.

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

Referenced by EgammaHLTExtraProducer::setSeeds().

11  {
13  hasPixelMatch_ = false;
14  for (const auto& seed : seeds_) {
15  if (!seed->hitInfo().empty()) {
16  hasPixelMatch_ = true;
17  break;
18  }
19  }
20 }
const reco::ElectronSeedRefVector & seeds() const
Definition: EgammaObject.h:27
reco::ElectronSeedRefVector seeds_
Definition: EgammaObject.h:59
def move(src, dest)
Definition: eostools.py:511

◆ setSuperCluster()

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

◆ setVars()

void trigger::EgammaObject::setVars ( std::vector< std::pair< std::string, float >>  vars)

Definition at line 60 of file EgammaObject.cc.

References eostools::move(), and jetUpdater_cfi::sort.

Referenced by EgammaHLTExtraProducer::setVars().

60  {
61  vars_ = std::move(vars);
62  std::sort(vars_.begin(), vars_.end(), [](auto& lhs, auto& rhs) { return lhs.first < rhs.first; });
63 }
vars
Definition: DeepTauIdBase.h:60
std::vector< std::pair< std::string, float > > vars_
Definition: EgammaObject.h:54
def move(src, dest)
Definition: eostools.py:511

◆ superCluster()

const reco::SuperClusterRef& trigger::EgammaObject::superCluster ( ) const
inline

◆ var()

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:49
std::vector< std::pair< std::string, float > > vars_
Definition: EgammaObject.h:54

◆ varNames()

std::vector< std::string > trigger::EgammaObject::varNames ( ) const

Definition at line 40 of file EgammaObject.cc.

References names, and trigObjTnPSource_cfi::var.

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

◆ varNamesStr()

std::string trigger::EgammaObject::varNamesStr ( ) const

Definition at line 49 of file EgammaObject.cc.

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

49  {
50  std::string retVal;
51  auto names = varNames();
52  for (const auto& name : names) {
53  if (!retVal.empty())
54  retVal += " ";
55  retVal += name;
56  }
57  return retVal;
58 }
const std::string names[nVars_]
std::vector< std::string > varNames() const
Definition: EgammaObject.cc:40

◆ vars()

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

◆ gsfTracks_

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

Definition at line 57 of file EgammaObject.h.

Referenced by gsfTracks(), and setGsfTracks().

◆ hasPixelMatch_

bool trigger::EgammaObject::hasPixelMatch_
private

Definition at line 53 of file EgammaObject.h.

◆ seeds_

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

Definition at line 59 of file EgammaObject.h.

Referenced by seeds().

◆ superCluster_

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

Definition at line 56 of file EgammaObject.h.

Referenced by setSuperCluster(), and superCluster().

◆ vars_

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

Definition at line 54 of file EgammaObject.h.

Referenced by clearVars(), and vars().