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 (const reco::RecoEcalCandidate &ecalCand)
 
 EgammaObject (int id, float pt, float eta, float phi, float mass)
 
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...
 
template<typename T >
 TriggerObject (const T &o)
 ... and pdgId() More...
 
template<typename T >
 TriggerObject (int id, const T &o)
 any type T object implementing the methods pt(), eta(), phi(), mass() More...
 
 TriggerObject (int id, float pt, float eta, float phi, float mass)
 

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

Member Function Documentation

◆ clearVars()

void trigger::EgammaObject::clearVars ( )
inline

Definition at line 41 of file EgammaObject.h.

41 { vars_.clear(); }

References vars_.

◆ gsfTracks()

const reco::GsfTrackRefVector& trigger::EgammaObject::gsfTracks ( ) const
inline

Definition at line 26 of file EgammaObject.h.

26 { return gsfTracks_; }

References gsfTracks_.

◆ 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 }

◆ seeds()

const reco::ElectronSeedRefVector& trigger::EgammaObject::seeds ( ) const
inline

Definition at line 27 of file EgammaObject.h.

27 { return seeds_; }

References seeds_.

◆ setGsfTracks()

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

◆ setSeeds()

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

Definition at line 11 of file EgammaObject.cc.

11  {
13  hasPixelMatch_ = false;
14  for (const auto& seed : seeds_) {
15  if (!seed->hitInfo().empty()) {
16  hasPixelMatch_ = true;
17  break;
18  }
19  }
20 }

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

Referenced by EgammaHLTExtraProducer::setSeeds().

◆ setSuperCluster()

void trigger::EgammaObject::setSuperCluster ( const reco::SuperClusterRef sc)
inline

Definition at line 29 of file EgammaObject.h.

29 { superCluster_ = sc; }

References superCluster_.

◆ setVars()

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

Definition at line 59 of file EgammaObject.cc.

59  {
60  vars_ = std::move(vars);
61  std::sort(vars_.begin(), vars_.end(), [](auto& lhs, auto& rhs) { return lhs.first < rhs.first; });
62 }

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

Referenced by EgammaHLTExtraProducer::setVars().

◆ 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.

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 }

References SiStripPI::max.

Referenced by tree.Tree::copyStructure().

◆ varNames()

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

Definition at line 40 of file EgammaObject.cc.

40  {
41  std::vector<std::string> names;
42  for (const auto& var : vars_) {
43  names.push_back(var.first);
44  }
45  return names;
46 }

References names, and trigObjTnPSource_cfi::var.

◆ varNamesStr()

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

Definition at line 48 of file EgammaObject.cc.

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 }

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

◆ vars()

const std::vector<std::pair<std::string, float> >& trigger::EgammaObject::vars ( ) const
inline

Definition at line 35 of file EgammaObject.h.

35 { return vars_; }

References vars_.

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().

trigger::TriggerObject::phi
float phi() const
Definition: TriggerObject.h:54
trigger::EgammaObject::vars_
std::vector< std::pair< std::string, float > > vars_
Definition: EgammaObject.h:54
reco::RecoEcalCandidate::superCluster
reco::SuperClusterRef superCluster() const override
reference to a superCluster
Definition: RecoEcalCandidate.cc:9
fileCollector.seed
seed
Definition: fileCollector.py:127
trigger::TriggerObject::pt
float pt() const
Definition: TriggerObject.h:52
names
const std::string names[nVars_]
Definition: PhotonIDValueMapProducer.cc:124
vars
vars
Definition: DeepTauId.cc:164
trigger::TriggerObject::TriggerObject
TriggerObject()
methods
Definition: TriggerObject.h:32
trigger::EgammaObject::hasPixelMatch_
bool hasPixelMatch_
Definition: EgammaObject.h:53
trigger::EgammaObject::varNames
std::vector< std::string > varNames() const
Definition: EgammaObject.cc:40
trigger::EgammaObject::superCluster_
reco::SuperClusterRef superCluster_
Definition: EgammaObject.h:56
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
trigger::EgammaObject::seeds
const reco::ElectronSeedRefVector & seeds() const
Definition: EgammaObject.h:27
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
jetUpdater_cfi.sort
sort
Definition: jetUpdater_cfi.py:29
trigger::TriggerObject::eta
float eta() const
Definition: TriggerObject.h:53
trigger::EgammaObject::seeds_
reco::ElectronSeedRefVector seeds_
Definition: EgammaObject.h:59
eostools.move
def move(src, dest)
Definition: eostools.py:511
trigger::EgammaObject::gsfTracks_
reco::GsfTrackRefVector gsfTracks_
Definition: EgammaObject.h:57
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
hltEgammaHLTExtra_cfi.trks
trks
Definition: hltEgammaHLTExtra_cfi.py:43
cms::Exception
Definition: Exception.h:70
trigger::TriggerObject::mass
float mass() const
Definition: TriggerObject.h:55