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 // $Id: Photon.cc,v 1.18 2011/06/08 20:40:19 rwolf Exp $
3 //
4 
6 
7 
8 using pat::Photon;
9 
10 
12 Photon::Photon() :
14  embeddedSuperCluster_(false)
15 {
16 }
17 
19 Photon::Photon(const reco::Photon & aPhoton) :
20  PATObject<reco::Photon>(aPhoton),
21  embeddedSuperCluster_(false)
22 {
23 }
24 
27  PATObject<reco::Photon>(aPhotonRef),
28  embeddedSuperCluster_(false)
29 {
30 }
31 
34  PATObject<reco::Photon>(aPhotonRef),
35  embeddedSuperCluster_(false)
36 {
37 }
38 
41 }
42 
43 std::ostream&
44 reco::operator<<(std::ostream& out, const pat::Photon& obj)
45 {
46  if(!out) return out;
47 
48  out << "\tpat::Photon: ";
49  out << std::setiosflags(std::ios::right);
50  out << std::setiosflags(std::ios::fixed);
51  out << std::setprecision(3);
52  out << " E/pT/eta/phi "
53  << obj.energy()<<"/"
54  << obj.pt()<<"/"
55  << obj.eta()<<"/"
56  << obj.phi();
57  return out;
58 }
59 
65  } else {
67  }
68 }
69 
72  superCluster_.clear();
73  if (reco::Photon::superCluster().isNonnull()) {
75  embeddedSuperCluster_ = true;
76  }
77 }
78 
79 // method to retrieve a photon ID (or throw)
80 Bool_t Photon::photonID(const std::string & name) const {
81  for (std::vector<IdPair>::const_iterator it = photonIDs_.begin(), ed = photonIDs_.end(); it != ed; ++it) {
82  if (it->first == name) return it->second;
83  }
84  cms::Exception ex("Key not found");
85  ex << "pat::Photon: the ID " << name << " can't be found in this pat::Photon.\n";
86  ex << "The available IDs are: ";
87  for (std::vector<IdPair>::const_iterator it = photonIDs_.begin(), ed = photonIDs_.end(); it != ed; ++it) {
88  ex << "'" << it->first << "' ";
89  }
90  ex << ".\n";
91  throw ex;
92 }
93 // check if an ID is there
95  for (std::vector<IdPair>::const_iterator it = photonIDs_.begin(), ed = photonIDs_.end(); it != ed; ++it) {
96  if (it->first == name) return true;
97  }
98  return false;
99 }
virtual double energy() const GCC11_FINAL
energy
Analysis-level Photon class.
Definition: Photon.h:46
Photon()
default constructor
Definition: Photon.cc:12
reco::SuperClusterRef superCluster() const
Ref to SuperCluster.
Definition: Photon.cc:59
void embedSuperCluster()
method to store the photon&#39;s supercluster internally
Definition: Photon.cc:71
std::vector< reco::SuperCluster > superCluster_
Definition: Photon.h:193
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:72
bool isPhotonIDAvailable(const std::string &name) const
Returns true if a specific ID is available in this pat::Photon.
Definition: Photon.cc:94
Bool_t photonID(const std::string &name) const
Definition: Photon.cc:80
std::vector< IdPair > photonIDs_
Definition: Photon.h:195
bool embeddedSuperCluster_
Definition: Photon.h:192
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:62
virtual ~Photon()
destructor
Definition: Photon.cc:40
Templated PAT object container.
Definition: PATObject.h:43
virtual float pt() const GCC11_FINAL
transverse momentum