CMS 3D CMS Logo

EgammaHLTRecoEcalCandidateProducers Class Reference

RecoEgamma/EgammaHLTProducers/interface/EgammaHLTRecoEcalCandidateProducers.h.h. More...

#include <RecoEgamma/EgammaHLTProducers/interface/EgammaHLTRecoEcalCandidateProducers.h>

Inheritance diagram for EgammaHLTRecoEcalCandidateProducers:

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

List of all members.

Public Member Functions

virtual void beginJob (edm::EventSetup const &es)
 EgammaHLTRecoEcalCandidateProducers (const edm::ParameterSet &ps)
virtual void produce (edm::Event &evt, const edm::EventSetup &es)
 ~EgammaHLTRecoEcalCandidateProducers ()

Private Attributes

edm::ParameterSet conf_
std::string recoEcalCandidateCollection_
edm::InputTag scHybridBarrelProducer_
edm::InputTag scIslandEndcapProducer_


Detailed Description

RecoEgamma/EgammaHLTProducers/interface/EgammaHLTRecoEcalCandidateProducers.h.h.

Author:
Monica Vazquez Acosta (CERN)
$Id:

Definition at line 26 of file EgammaHLTRecoEcalCandidateProducers.h.


Constructor & Destructor Documentation

EgammaHLTRecoEcalCandidateProducers::EgammaHLTRecoEcalCandidateProducers ( const edm::ParameterSet ps  ) 

Definition at line 29 of file EgammaHLTRecoEcalCandidateProducers.cc.

References conf_, edm::ParameterSet::getParameter(), recoEcalCandidateCollection_, scHybridBarrelProducer_, and scIslandEndcapProducer_.

00029                                                                                                       : 
00030   conf_(config) 
00031 
00032 {
00033   // use onfiguration file to setup input/output collection names
00034   scHybridBarrelProducer_       = conf_.getParameter<edm::InputTag>("scHybridBarrelProducer");
00035   scIslandEndcapProducer_       = conf_.getParameter<edm::InputTag>("scIslandEndcapProducer");
00036   recoEcalCandidateCollection_  = conf_.getParameter<std::string>("recoEcalCandidateCollection");
00037 
00038   // Register the product
00039   produces< reco::RecoEcalCandidateCollection >(recoEcalCandidateCollection_);
00040 }

EgammaHLTRecoEcalCandidateProducers::~EgammaHLTRecoEcalCandidateProducers (  ) 

Definition at line 42 of file EgammaHLTRecoEcalCandidateProducers.cc.

00042 {}


Member Function Documentation

void EgammaHLTRecoEcalCandidateProducers::beginJob ( edm::EventSetup const &  es  )  [virtual]

Reimplemented from edm::EDProducer.

Definition at line 44 of file EgammaHLTRecoEcalCandidateProducers.cc.

00044 {}

void EgammaHLTRecoEcalCandidateProducers::produce ( edm::Event evt,
const edm::EventSetup es 
) [virtual]

Implements edm::EDProducer.

Definition at line 46 of file EgammaHLTRecoEcalCandidateProducers.cc.

References direction, edm::Event::getByLabel(), p4, edm::Event::put(), recoEcalCandidateCollection_, scHybridBarrelProducer_, and scIslandEndcapProducer_.

00046                                                                                                         {
00047 
00048   using namespace edm;
00049 
00050   //
00051   // create empty output collections
00052   //
00053 
00054   reco::RecoEcalCandidateCollection outputRecoEcalCandidateCollection;
00055   std::auto_ptr< reco::RecoEcalCandidateCollection > outputRecoEcalCandidateCollection_p(new reco::RecoEcalCandidateCollection);
00056 
00057   // Get the  Barrel Super Cluster collection
00058   Handle<reco::SuperClusterCollection> scBarrelHandle;
00059   theEvent.getByLabel(scHybridBarrelProducer_,scBarrelHandle);
00060   // Get the  Endcap Super Cluster collection
00061   Handle<reco::SuperClusterCollection> scEndcapHandle;
00062   theEvent.getByLabel(scIslandEndcapProducer_,scEndcapHandle);
00063 
00064   //  Loop over barrel SC and fill the  recoecal collection
00065   int iSC=0; // index in recoecal collection
00066   int lSC=0; // local index on barrel
00067 
00068 
00069 for(reco::SuperClusterCollection::const_iterator aClus = scBarrelHandle->begin(); aClus != scBarrelHandle->end(); aClus++) {
00070 
00071     const reco::Particle::Point  vtx( 0, 0, 0 );
00072 
00073     // compute correctly the momentum vector of the recoecal from primary vertex and cluster position
00074     math::XYZVector direction =aClus->position() - vtx;
00075     math::XYZVector momentum = direction.unit() * aClus->energy();
00076     const reco::Particle::LorentzVector  p4(momentum.x(), momentum.y(), momentum.z(), aClus->energy() );
00077 
00078     reco::RecoEcalCandidate newCandidate(0, p4, vtx);
00079 
00080     outputRecoEcalCandidateCollection.push_back(newCandidate);
00081     reco::SuperClusterRef scRef(reco::SuperClusterRef(scBarrelHandle, lSC));
00082     outputRecoEcalCandidateCollection[iSC].setSuperCluster(scRef);
00083 
00084     lSC++;
00085     iSC++;
00086 
00087   }
00088 
00089   //  Loop over Endcap SC and fill the  recoecal collection
00090   lSC=0; // reset local index for endcap
00091 
00092 for(reco::SuperClusterCollection::const_iterator aClus = scEndcapHandle->begin(); aClus != scEndcapHandle->end(); aClus++) {
00093 
00094     const reco::Particle::Point  vtx( 0, 0, 0 );
00095 
00096     math::XYZVector direction =aClus->position() - vtx;
00097     math::XYZVector momentum = direction.unit() * aClus->energy();
00098     const reco::Particle::LorentzVector  p4(momentum.x(), momentum.y(), momentum.z(), aClus->energy() );
00099 
00100     reco::RecoEcalCandidate newCandidate(0, p4, vtx);
00101 
00102     outputRecoEcalCandidateCollection.push_back(newCandidate);
00103     reco::SuperClusterRef scRef(reco::SuperClusterRef(scEndcapHandle, lSC));
00104     outputRecoEcalCandidateCollection[iSC].setSuperCluster(scRef);
00105  
00106     iSC++;
00107     lSC++;
00108 
00109   }
00110 
00111   // put the product in the event
00112   outputRecoEcalCandidateCollection_p->assign(outputRecoEcalCandidateCollection.begin(),outputRecoEcalCandidateCollection.end());
00113   theEvent.put( outputRecoEcalCandidateCollection_p, recoEcalCandidateCollection_);
00114 
00115 }


Member Data Documentation

edm::ParameterSet EgammaHLTRecoEcalCandidateProducers::conf_ [private]

Definition at line 41 of file EgammaHLTRecoEcalCandidateProducers.h.

Referenced by EgammaHLTRecoEcalCandidateProducers().

std::string EgammaHLTRecoEcalCandidateProducers::recoEcalCandidateCollection_ [private]

Definition at line 38 of file EgammaHLTRecoEcalCandidateProducers.h.

Referenced by EgammaHLTRecoEcalCandidateProducers(), and produce().

edm::InputTag EgammaHLTRecoEcalCandidateProducers::scHybridBarrelProducer_ [private]

Definition at line 39 of file EgammaHLTRecoEcalCandidateProducers.h.

Referenced by EgammaHLTRecoEcalCandidateProducers(), and produce().

edm::InputTag EgammaHLTRecoEcalCandidateProducers::scIslandEndcapProducer_ [private]

Definition at line 40 of file EgammaHLTRecoEcalCandidateProducers.h.

Referenced by EgammaHLTRecoEcalCandidateProducers(), and produce().


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