CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Photon.cc
Go to the documentation of this file.
1 //
2 //
3 
5 
6 
7 using pat::Photon;
8 
9 
11 Photon::Photon() :
13  embeddedSuperCluster_(false)
14 {
15 }
16 
18 Photon::Photon(const reco::Photon & aPhoton) :
19  PATObject<reco::Photon>(aPhoton),
20  embeddedSuperCluster_(false)
21 {
22 }
23 
26  PATObject<reco::Photon>(aPhotonRef),
27  embeddedSuperCluster_(false)
28 {
29 }
30 
33  PATObject<reco::Photon>(aPhotonRef),
34  embeddedSuperCluster_(false)
35 {
36 }
37 
40 }
41 
42 std::ostream&
43 reco::operator<<(std::ostream& out, const pat::Photon& obj)
44 {
45  if(!out) return out;
46 
47  out << "\tpat::Photon: ";
48  out << std::setiosflags(std::ios::right);
49  out << std::setiosflags(std::ios::fixed);
50  out << std::setprecision(3);
51  out << " E/pT/eta/phi "
52  << obj.energy()<<"/"
53  << obj.pt()<<"/"
54  << obj.eta()<<"/"
55  << obj.phi();
56  return out;
57 }
58 
64  } else {
66  }
67 }
68 
71  superCluster_.clear();
72  if (reco::Photon::superCluster().isNonnull()) {
74  embeddedSuperCluster_ = true;
75  }
76 }
77 
78 // method to retrieve a photon ID (or throw)
79 Bool_t Photon::photonID(const std::string & name) const {
80  for (std::vector<IdPair>::const_iterator it = photonIDs_.begin(), ed = photonIDs_.end(); it != ed; ++it) {
81  if (it->first == name) return it->second;
82  }
83  cms::Exception ex("Key not found");
84  ex << "pat::Photon: the ID " << name << " can't be found in this pat::Photon.\n";
85  ex << "The available IDs are: ";
86  for (std::vector<IdPair>::const_iterator it = photonIDs_.begin(), ed = photonIDs_.end(); it != ed; ++it) {
87  ex << "'" << it->first << "' ";
88  }
89  ex << ".\n";
90  throw ex;
91 }
92 // check if an ID is there
94  for (std::vector<IdPair>::const_iterator it = photonIDs_.begin(), ed = photonIDs_.end(); it != ed; ++it) {
95  if (it->first == name) return true;
96  }
97  return false;
98 }
virtual double energy() const GCC11_FINAL
energy
Analysis-level Photon class.
Definition: Photon.h:44
Photon()
default constructor
Definition: Photon.cc:11
reco::SuperClusterRef superCluster() const
Ref to SuperCluster.
Definition: Photon.cc:58
void embedSuperCluster()
method to store the photon&#39;s supercluster internally
Definition: Photon.cc:70
std::vector< reco::SuperCluster > superCluster_
Definition: Photon.h:208
edm::Ref< SuperClusterCollection > SuperClusterRef
reference to an object in a collection of SuperCluster objects
virtual float phi() const GCC11_FINAL
momentum azimuthal angle
std::ostream & operator<<(std::ostream &, BeamSpot beam)
Definition: BeamSpot.cc:71
bool isPhotonIDAvailable(const std::string &name) const
Returns true if a specific ID is available in this pat::Photon.
Definition: Photon.cc:93
Bool_t photonID(const std::string &name) const
Definition: Photon.cc:79
std::vector< IdPair > photonIDs_
Definition: Photon.h:210
bool embeddedSuperCluster_
Definition: Photon.h:207
virtual float eta() const GCC11_FINAL
momentum pseudorapidity
tuple out
Definition: dbtoconf.py:99
reco::SuperClusterRef superCluster() const
override the superCluster method from CaloJet, to access the internal storage of the supercluster ...
Definition: Photon.cc:61
virtual ~Photon()
destructor
Definition: Photon.cc:39
Templated PAT object container.
Definition: PATObject.h:41
volatile std::atomic< bool > shutdown_flag false
virtual float pt() const GCC11_FINAL
transverse momentum