CMS 3D CMS Logo

Public Types | Public Member Functions | Protected Types | Protected Attributes

pat::Photon Class Reference

Analysis-level Photon class. More...

#include <DataFormats/PatCandidates/interface/Photon.h>

Inheritance diagram for pat::Photon:
pat::PATObject< reco::Photon > reco::Photon reco::RecoCandidate reco::LeafCandidate reco::Candidate

List of all members.

Public Types

typedef std::pair< std::string,
Bool_t > 
IdPair

Public Member Functions

float caloIso () const
virtual Photonclone () const
 required reimplementation of the Candidate's clone method
float ecalIso () const
void ecalIsoDeposit (const IsoDeposit &dep)
 Sets ecal IsoDeposit.
const IsoDepositecalIsoDeposit () const
 Return the ecal IsoDeposit.
void embedSuperCluster ()
 method to store the photon's supercluster internally
const reco::CandidategenPhoton () const
 return the match to the generated photon
float hcalIso () const
void hcalIsoDeposit (const IsoDeposit &dep)
 Sets hcal IsoDeposit.
const IsoDeposithcalIsoDeposit () const
 Return the hcal IsoDeposit.
const IsoDepositisoDeposit (IsolationKeys key) const
 Returns the IsoDeposit associated with some key, or a null pointer if it is not available.
bool isPhotonIDAvailable (const std::string &name) const
 Returns true if a specific ID is available in this pat::Photon.
 Photon (const edm::Ptr< reco::Photon > &aPhotonRef)
 constructor from a Ptr to a reco photon
 Photon (const reco::Photon &aPhoton)
 constructor from a reco photon
 Photon (const edm::RefToBase< reco::Photon > &aPhotonRef)
 constructor from a RefToBase to a reco photon (to be superseded by Ptr counterpart)
 Photon ()
 default constructor
Bool_t photonID (const std::string &name) const
const std::vector< IdPair > & photonIDs () const
void setEcalIso (float caloIso)
 Sets ecal isolation variable.
void setGenPhoton (const reco::GenParticleRef &gp, bool embed=false)
 method to set the generated photon
void setHcalIso (float caloIso)
 Sets hcal isolation variable.
void setIsoDeposit (IsolationKeys key, const IsoDeposit &dep)
 Sets the IsoDeposit associated with some key; if it is already existent, it is overwritten.
void setIsolation (IsolationKeys key, float value)
void setPhotonIDs (const std::vector< IdPair > &ids)
void setTrackIso (float trackIso)
 Sets tracker isolation variable.
void setUserIso (float value, uint8_t index=0)
 Sets user isolation variable index.
reco::SuperClusterRef superCluster () const
 override the superCluster method from CaloJet, to access the internal storage of the supercluster
float trackIso () const
void trackIsoDeposit (const IsoDeposit &dep)
 Sets tracker IsoDeposit.
const IsoDeposittrackIsoDeposit () const
 Return the tracker IsoDeposit.
float userIso (uint8_t index=0) const
 Returns a user defined isolation value.
void userIsoDeposit (const IsoDeposit &dep, uint8_t index=0)
 Sets user-level IsoDeposit.
const IsoDeposituserIsoDeposit (uint8_t index=0) const
 Return a specified user-level IsoDeposit.
float userIsolation (IsolationKeys key) const
virtual ~Photon ()
 destructor

Protected Types

typedef std::vector< std::pair
< IsolationKeys,
pat::IsoDeposit > > 
IsoDepositPairs

Protected Attributes

bool embeddedSuperCluster_
IsoDepositPairs isoDeposits_
std::vector< float > isolations_
std::vector< IdPairphotonIDs_
std::vector< reco::SuperClustersuperCluster_

Detailed Description

Analysis-level Photon class.

pat::Photon implements the analysis-level photon class within the 'pat' namespace.

Please post comments and questions to the Physics Tools hypernews: https://hypernews.cern.ch/HyperNews/CMS/get/physTools.html

Author:
Steven Lowette, Giovanni Petrucciani, Frederic Ronga
Version:
Id:
Photon.h,v 1.23 2009/10/15 17:37:53 rwolf Exp

Definition at line 42 of file Photon.h.


Member Typedef Documentation

typedef std::pair<std::string,Bool_t> pat::Photon::IdPair

Definition at line 46 of file Photon.h.

typedef std::vector<std::pair<IsolationKeys, pat::IsoDeposit> > pat::Photon::IsoDepositPairs [protected]

Definition at line 191 of file Photon.h.


Constructor & Destructor Documentation

Photon::Photon ( )

default constructor

Reimplemented from reco::Photon.

Definition at line 12 of file Photon.cc.

Referenced by clone().

               :
    PATObject<reco::Photon>(reco::Photon()),
    embeddedSuperCluster_(false)
{
}
Photon::Photon ( const reco::Photon aPhoton)

constructor from a reco photon

constructor from reco::Photon

Reimplemented from reco::Photon.

Definition at line 20 of file Photon.cc.

                                         :
    PATObject<reco::Photon>(aPhoton),
    embeddedSuperCluster_(false)
{
}
Photon::Photon ( const edm::RefToBase< reco::Photon > &  aPhotonRef)

constructor from a RefToBase to a reco photon (to be superseded by Ptr counterpart)

constructor from ref to reco::Photon

Definition at line 27 of file Photon.cc.

                                                          :
    PATObject<reco::Photon>(aPhotonRef),
    embeddedSuperCluster_(false)
{
}
Photon::Photon ( const edm::Ptr< reco::Photon > &  aPhotonRef)

constructor from a Ptr to a reco photon

constructor from ref to reco::Photon

Definition at line 34 of file Photon.cc.

                                                    :
    PATObject<reco::Photon>(aPhotonRef),
    embeddedSuperCluster_(false)
{
}
Photon::~Photon ( ) [virtual]

destructor

Reimplemented from reco::Photon.

Definition at line 41 of file Photon.cc.

                {
}

Member Function Documentation

float pat::Photon::caloIso ( ) const [inline]

Returns the calorimeter isolation combined from ecal and hcal

Definition at line 100 of file Photon.h.

References ecalIso(), and hcalIso().

{ return ecalIso()+hcalIso(); }
virtual Photon* pat::Photon::clone ( void  ) const [inline, virtual]

required reimplementation of the Candidate's clone method

Reimplemented from reco::Photon.

Definition at line 60 of file Photon.h.

References Photon().

{ return new Photon(*this); }
float pat::Photon::ecalIso ( ) const [inline]

Returns the summed Et in a cone of deltaR<0.4 calculated from recHits

Definition at line 94 of file Photon.h.

References reco::Photon::ecalRecHitSumEtConeDR04().

Referenced by PatPhotonSimpleAnalyzer::analyze(), and caloIso().

const IsoDeposit* pat::Photon::ecalIsoDeposit ( ) const [inline]

Return the ecal IsoDeposit.

Definition at line 160 of file Photon.h.

References pat::EcalIso, and isoDeposit().

{ return isoDeposit(pat::EcalIso ); }
void pat::Photon::ecalIsoDeposit ( const IsoDeposit dep) [inline]

Sets ecal IsoDeposit.

Definition at line 176 of file Photon.h.

References pat::EcalIso, and setIsoDeposit().

void Photon::embedSuperCluster ( )

method to store the photon's supercluster internally

Definition at line 56 of file Photon.cc.

References embeddedSuperCluster_, reco::Photon::superCluster(), and superCluster_.

Referenced by pat::PATPhotonProducer::produce().

const reco::Candidate* pat::Photon::genPhoton ( ) const [inline]

return the match to the generated photon

Definition at line 70 of file Photon.h.

References pat::PATObject< reco::Photon >::genParticle().

{ return genParticle(); }
float pat::Photon::hcalIso ( ) const [inline]

Returns summed Et in a cone of deltaR<0.4 calculated from caloTowers

Definition at line 97 of file Photon.h.

References reco::Photon::hcalTowerSumEtConeDR04().

Referenced by PatPhotonSimpleAnalyzer::analyze(), and caloIso().

{ return hcalTowerSumEtConeDR04(); }
const IsoDeposit* pat::Photon::hcalIsoDeposit ( ) const [inline]

Return the hcal IsoDeposit.

Definition at line 162 of file Photon.h.

References pat::HcalIso, and isoDeposit().

{ return isoDeposit(pat::HcalIso ); }
void pat::Photon::hcalIsoDeposit ( const IsoDeposit dep) [inline]

Sets hcal IsoDeposit.

Definition at line 178 of file Photon.h.

References pat::HcalIso, and setIsoDeposit().

const IsoDeposit* pat::Photon::isoDeposit ( IsolationKeys  key) const [inline]

Returns the IsoDeposit associated with some key, or a null pointer if it is not available.

Definition at line 149 of file Photon.h.

References isoDeposits_.

Referenced by ecalIsoDeposit(), hcalIsoDeposit(), trackIsoDeposit(), and userIsoDeposit().

                                                             {
          for (IsoDepositPairs::const_iterator it = isoDeposits_.begin(), ed = isoDeposits_.end(); 
                  it != ed; ++it) 
          {
              if (it->first == key) return & it->second;
          }
          return 0;
      } 
bool Photon::isPhotonIDAvailable ( const std::string &  name) const

Returns true if a specific ID is available in this pat::Photon.

Definition at line 79 of file Photon.cc.

References photonIDs_.

                                                             {
  for (std::vector<IdPair>::const_iterator it = photonIDs_.begin(), ed = photonIDs_.end(); it != ed; ++it) {
    if (it->first == name) return true;
  }
  return false;
}
Bool_t Photon::photonID ( const std::string &  name) const

Returns a specific photon ID associated to the pat::Photon given its name. Note: an exception is thrown if the specified ID is not available

Definition at line 65 of file Photon.cc.

References photonIDs_.

                                                    {
  for (std::vector<IdPair>::const_iterator it = photonIDs_.begin(), ed = photonIDs_.end(); it != ed; ++it) {
    if (it->first == name) return it->second;
  }
  cms::Exception ex("Key not found");
  ex << "pat::Photon: the ID " << name << " can't be found in this pat::Photon.\n";
  ex << "The available IDs are: ";
  for (std::vector<IdPair>::const_iterator it = photonIDs_.begin(), ed = photonIDs_.end(); it != ed; ++it) {
    ex << "'" << it->first << "' ";
  }
  ex << ".\n";
  throw ex;
}
const std::vector<IdPair>& pat::Photon::photonIDs ( ) const [inline]

Returns all the Photon IDs in the form of <name,value> pairs The 'default' ID is the first in the list

Definition at line 82 of file Photon.h.

References photonIDs_.

{ return photonIDs_; }
void pat::Photon::setEcalIso ( float  caloIso) [inline]

Sets ecal isolation variable.

Definition at line 141 of file Photon.h.

References pat::EcalIso, and setIsolation().

void pat::Photon::setGenPhoton ( const reco::GenParticleRef gp,
bool  embed = false 
) [inline]

method to set the generated photon

Definition at line 72 of file Photon.h.

References embed, and pat::PATObject< reco::Photon >::setGenParticleRef().

void pat::Photon::setHcalIso ( float  caloIso) [inline]

Sets hcal isolation variable.

Definition at line 143 of file Photon.h.

References pat::HcalIso, and setIsolation().

void pat::Photon::setIsoDeposit ( IsolationKeys  key,
const IsoDeposit dep 
) [inline]

Sets the IsoDeposit associated with some key; if it is already existent, it is overwritten.

Definition at line 166 of file Photon.h.

References isoDeposits_.

Referenced by ecalIsoDeposit(), hcalIsoDeposit(), pat::PATPhotonProducer::produce(), trackIsoDeposit(), and userIsoDeposit().

                                                                   {
          IsoDepositPairs::iterator it = isoDeposits_.begin(), ed = isoDeposits_.end();
          for (; it != ed; ++it) {
              if (it->first == key) { it->second = dep; return; }
          }
          isoDeposits_.push_back(std::make_pair(key,dep));
      } 
void pat::Photon::setIsolation ( IsolationKeys  key,
float  value 
) [inline]

Sets the isolation variable for a specifc key. Note that you can't set isolation for a pseudo-key like CaloIso

Definition at line 126 of file Photon.h.

References Exception, isolations_, combine::key, and relativeConstraints::value.

Referenced by pat::PATPhotonProducer::produce(), setEcalIso(), setHcalIso(), setTrackIso(), and setUserIso().

                                                        {
          if (key >= 0) {
              if (size_t(key) >= isolations_.size()) isolations_.resize(key+1, -1.0);
              isolations_[key] = value;
          } else {
              throw cms::Exception("Illegal Argument") << 
                  "The key for which you're setting isolation does not correspond " <<
                  "to an individual isolation but to the sum of more independent isolations " <<
                  "(e.g. Calo = Ecal + Hcal), so you can't SET the value, just GET it.\n" <<
                  "Please set up each component independly.\n";
          }
      }
void pat::Photon::setPhotonIDs ( const std::vector< IdPair > &  ids) [inline]

Store multiple photon ID values, discarding existing ones The first one in the list becomes the 'default' photon id

Definition at line 85 of file Photon.h.

References photonIDs_.

Referenced by pat::PATPhotonProducer::produce().

{ photonIDs_ = ids; }
void pat::Photon::setTrackIso ( float  trackIso) [inline]

Sets tracker isolation variable.

Definition at line 139 of file Photon.h.

References setIsolation(), and pat::TrackIso.

void pat::Photon::setUserIso ( float  value,
uint8_t  index = 0 
) [inline]

Sets user isolation variable index.

Definition at line 145 of file Photon.h.

References setIsolation(), and pat::UserBaseIso.

reco::SuperClusterRef Photon::superCluster ( ) const [virtual]

override the superCluster method from CaloJet, to access the internal storage of the supercluster

override the superCluster method from CaloJet, to access the internal storage of the supercluster this returns a transient Ref which *should never be persisted*!

Reimplemented from reco::Photon.

Definition at line 47 of file Photon.cc.

References embeddedSuperCluster_, and superCluster_.

Referenced by PatPhotonSimpleAnalyzer::analyze().

float pat::Photon::trackIso ( ) const [inline]

Returns the summed track pt in a cone of deltaR<0.4 including the region of the reconstructed photon

Definition at line 91 of file Photon.h.

References reco::Photon::trkSumPtSolidConeDR04().

Referenced by PatPhotonSimpleAnalyzer::analyze().

{ return trkSumPtSolidConeDR04(); }
const IsoDeposit* pat::Photon::trackIsoDeposit ( ) const [inline]

Return the tracker IsoDeposit.

Definition at line 158 of file Photon.h.

References isoDeposit(), and pat::TrackIso.

void pat::Photon::trackIsoDeposit ( const IsoDeposit dep) [inline]

Sets tracker IsoDeposit.

Definition at line 174 of file Photon.h.

References setIsoDeposit(), and pat::TrackIso.

float pat::Photon::userIso ( uint8_t  index = 0) const [inline]

Returns a user defined isolation value.

Definition at line 102 of file Photon.h.

References pat::UserBaseIso, and userIsolation().

const IsoDeposit* pat::Photon::userIsoDeposit ( uint8_t  index = 0) const [inline]

Return a specified user-level IsoDeposit.

Definition at line 164 of file Photon.h.

References isoDeposit(), and pat::UserBaseIso.

void pat::Photon::userIsoDeposit ( const IsoDeposit dep,
uint8_t  index = 0 
) [inline]

Sets user-level IsoDeposit.

Definition at line 180 of file Photon.h.

References setIsoDeposit(), and pat::UserBaseIso.

float pat::Photon::userIsolation ( IsolationKeys  key) const [inline]

Returns the isolation variable for a specifc key (or pseudo-key like CaloIso), or -1.0 if not available

Definition at line 105 of file Photon.h.

References pat::CaloIso, pat::EcalIso, pat::HcalIso, isolations_, and combine::key.

Referenced by userIso().

                                                   { 
          if (key >= 0) {
            //if (key >= isolations_.size()) throw cms::Excepton("Missing Data") 
            //<< "Isolation corresponding to key " << key 
            //<< " was not stored for this particle.";
              if (size_t(key) >= isolations_.size()) return -1.0;
              return isolations_[key];
          } else switch (key) {
          case pat::CaloIso:  
                //if (isolations_.size() <= pat::HcalIso) throw cms::Excepton("Missing Data") 
                //<< "CalIsoo Isolation was not stored for this particle.";
                if (isolations_.size() <= pat::HcalIso) return -1.0; 
                return isolations_[pat::EcalIso] + isolations_[pat::HcalIso];
          default:
            return -1.0;
            //throw cms::Excepton("Missing Data") << "Isolation corresponding to key " 
            //<< key << " was not stored for this particle.";
          }
      }

Member Data Documentation

Definition at line 186 of file Photon.h.

Referenced by embedSuperCluster(), and superCluster().

Definition at line 192 of file Photon.h.

Referenced by isoDeposit(), and setIsoDeposit().

std::vector<float> pat::Photon::isolations_ [protected]

Definition at line 193 of file Photon.h.

Referenced by setIsolation(), and userIsolation().

std::vector<IdPair> pat::Photon::photonIDs_ [protected]

Definition at line 189 of file Photon.h.

Referenced by isPhotonIDAvailable(), photonID(), photonIDs(), and setPhotonIDs().

Definition at line 187 of file Photon.h.

Referenced by embedSuperCluster(), and superCluster().