CMS 3D CMS Logo

PhotonIDProducer Class Reference

#include <RecoEgamma/PhotonIdentification/plugins/PhotonIDProducer.h>

Inheritance diagram for PhotonIDProducer:

edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

 PhotonIDProducer (const edm::ParameterSet &conf)
virtual void produce (edm::Event &e, const edm::EventSetup &c)
virtual ~PhotonIDProducer ()

Private Attributes

edm::ParameterSet conf_
CutBasedPhotonIDAlgocutBasedAlgo_
bool doCutBased_
std::string photonIDAssociation_
std::string photonIDLabel_
std::string photonLabel_
std::string photonProducer_


Detailed Description

Definition at line 14 of file PhotonIDProducer.h.


Constructor & Destructor Documentation

PhotonIDProducer::PhotonIDProducer ( const edm::ParameterSet conf  )  [explicit]

Definition at line 15 of file PhotonIDProducer.cc.

References conf_, cutBasedAlgo_, doCutBased_, edm::ParameterSet::getParameter(), photonIDAssociation_, photonIDLabel_, photonLabel_, and photonProducer_.

00015                                                               : conf_(conf) {
00016 
00017   photonProducer_ = conf_.getParameter<std::string>("photonProducer");
00018   photonLabel_ = conf_.getParameter<std::string>("photonLabel");
00019   photonIDLabel_ = conf_.getParameter<std::string>("photonIDLabel");
00020   photonIDAssociation_ = conf_.getParameter<std::string>("photonIDAssociationLabel");
00021 
00022   doCutBased_ = conf_.getParameter<bool>("doCutBased");
00023   cutBasedAlgo_ = new CutBasedPhotonIDAlgo();
00024   cutBasedAlgo_->setup(conf);
00025   produces<reco::PhotonIDCollection>(photonIDLabel_);
00026   produces<reco::PhotonIDAssociationCollection>(photonIDAssociation_);
00027 
00028 }

PhotonIDProducer::~PhotonIDProducer (  )  [virtual]

Definition at line 30 of file PhotonIDProducer.cc.

References cutBasedAlgo_.

00030                                     {
00031 
00032   //if (doCutBased_)
00033   delete cutBasedAlgo_;
00034 
00035 }


Member Function Documentation

void PhotonIDProducer::produce ( edm::Event e,
const edm::EventSetup c 
) [virtual]

Implements edm::EDProducer.

Definition at line 37 of file PhotonIDProducer.cc.

References CutBasedPhotonIDAlgo::calculate(), cutBasedAlgo_, edm::Event::getByLabel(), i, photonIDAssociation_, photonIDLabel_, photonLabel_, photonProducer_, photons_cfi::photons, and edm::Event::put().

00037                                                                   {
00038 
00039   // Read in photons
00040   edm::Handle<reco::PhotonCollection> photons;
00041   e.getByLabel(photonProducer_,photonLabel_,photons);
00042 
00043   // Initialize output photon ID collection
00044   reco::PhotonIDCollection photonIDCollection;
00045   std::auto_ptr<reco::PhotonIDCollection> photonIDCollection_p(new reco::PhotonIDCollection);
00046 
00047   // Loop over photons and calculate photon ID using specified technique(s)
00048   reco::PhotonCollection::const_iterator photon;
00049   for (photon = (*photons).begin();
00050        photon != (*photons).end(); ++photon) {
00051     reco::PhotonID phoID = cutBasedAlgo_->calculate(&(*photon),e, c);
00052     photonIDCollection.push_back(phoID);
00053   }
00054   
00055   // Add output electron ID collection to the event
00056   photonIDCollection_p->assign(photonIDCollection.begin(),
00057                                photonIDCollection.end());
00058   edm::OrphanHandle<reco::PhotonIDCollection> PhotonIDHandle = e.put(photonIDCollection_p,photonIDLabel_);
00059   
00060   // Add photon ID AssociationMap to the event
00061   std::auto_ptr<reco::PhotonIDAssociationCollection> photonIDAssocs_p(new reco::PhotonIDAssociationCollection);
00062   for (unsigned int i = 0; i < photons->size(); i++){
00063     photonIDAssocs_p->insert(edm::Ref<reco::PhotonCollection>(photons,i),edm::Ref<reco::PhotonIDCollection>(PhotonIDHandle,i));
00064   }
00065   e.put(photonIDAssocs_p,photonIDAssociation_);
00066   
00067 }


Member Data Documentation

edm::ParameterSet PhotonIDProducer::conf_ [private]

Definition at line 28 of file PhotonIDProducer.h.

Referenced by PhotonIDProducer().

CutBasedPhotonIDAlgo* PhotonIDProducer::cutBasedAlgo_ [private]

Definition at line 26 of file PhotonIDProducer.h.

Referenced by PhotonIDProducer(), produce(), and ~PhotonIDProducer().

bool PhotonIDProducer::doCutBased_ [private]

Definition at line 35 of file PhotonIDProducer.h.

Referenced by PhotonIDProducer().

std::string PhotonIDProducer::photonIDAssociation_ [private]

Definition at line 33 of file PhotonIDProducer.h.

Referenced by PhotonIDProducer(), and produce().

std::string PhotonIDProducer::photonIDLabel_ [private]

Definition at line 32 of file PhotonIDProducer.h.

Referenced by PhotonIDProducer(), and produce().

std::string PhotonIDProducer::photonLabel_ [private]

Definition at line 31 of file PhotonIDProducer.h.

Referenced by PhotonIDProducer(), and produce().

std::string PhotonIDProducer::photonProducer_ [private]

Definition at line 30 of file PhotonIDProducer.h.

Referenced by PhotonIDProducer(), and produce().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:29:54 2009 for CMSSW by  doxygen 1.5.4