CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Member Functions | Private Attributes
EgammaHLTRecoEcalCandidateProducers Class Reference

#include <EgammaHLTRecoEcalCandidateProducers.h>

Inheritance diagram for EgammaHLTRecoEcalCandidateProducers:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

Classes

class  h
 

Public Member Functions

virtual void beginJob (void)
 
 EgammaHLTRecoEcalCandidateProducers (const edm::ParameterSet &ps)
 
virtual void produce (edm::Event &evt, const edm::EventSetup &es)
 
 ~EgammaHLTRecoEcalCandidateProducers ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

Private Attributes

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

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

Detailed Description

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_.

29  :
30  conf_(config)
31 
32 {
33  // use onfiguration file to setup input/output collection names
34  scHybridBarrelProducer_ = conf_.getParameter<edm::InputTag>("scHybridBarrelProducer");
35  scIslandEndcapProducer_ = conf_.getParameter<edm::InputTag>("scIslandEndcapProducer");
36  recoEcalCandidateCollection_ = conf_.getParameter<std::string>("recoEcalCandidateCollection");
37 
38  // Register the product
39  produces< reco::RecoEcalCandidateCollection >(recoEcalCandidateCollection_);
40 }
T getParameter(std::string const &) const
EgammaHLTRecoEcalCandidateProducers::~EgammaHLTRecoEcalCandidateProducers ( )

Definition at line 42 of file EgammaHLTRecoEcalCandidateProducers.cc.

42 {}

Member Function Documentation

void EgammaHLTRecoEcalCandidateProducers::beginJob ( void  )
virtual

Reimplemented from edm::EDProducer.

Definition at line 44 of file EgammaHLTRecoEcalCandidateProducers.cc.

44 {}
void EgammaHLTRecoEcalCandidateProducers::produce ( edm::Event evt,
const edm::EventSetup es 
)
virtual

Implements edm::EDProducer.

Definition at line 46 of file EgammaHLTRecoEcalCandidateProducers.cc.

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

46  {
47 
48  using namespace edm;
49 
50  //
51  // create empty output collections
52  //
53 
54  reco::RecoEcalCandidateCollection outputRecoEcalCandidateCollection;
55  std::auto_ptr< reco::RecoEcalCandidateCollection > outputRecoEcalCandidateCollection_p(new reco::RecoEcalCandidateCollection);
56 
57  // Get the Barrel Super Cluster collection
59  theEvent.getByLabel(scHybridBarrelProducer_,scBarrelHandle);
60  // Get the Endcap Super Cluster collection
62  theEvent.getByLabel(scIslandEndcapProducer_,scEndcapHandle);
63 
64  // Loop over barrel SC and fill the recoecal collection
65  int iSC=0; // index in recoecal collection
66  int lSC=0; // local index on barrel
67 
68 
69 for(reco::SuperClusterCollection::const_iterator aClus = scBarrelHandle->begin(); aClus != scBarrelHandle->end(); aClus++) {
70 
71  const reco::Particle::Point vtx( 0, 0, 0 );
72 
73  // compute correctly the momentum vector of the recoecal from primary vertex and cluster position
74  math::XYZVector direction =aClus->position() - vtx;
75  math::XYZVector momentum = direction.unit() * aClus->energy();
76  const reco::Particle::LorentzVector p4(momentum.x(), momentum.y(), momentum.z(), aClus->energy() );
77 
78  reco::RecoEcalCandidate newCandidate(0, p4, vtx);
79 
80  outputRecoEcalCandidateCollection.push_back(newCandidate);
81  reco::SuperClusterRef scRef(reco::SuperClusterRef(scBarrelHandle, lSC));
82  outputRecoEcalCandidateCollection[iSC].setSuperCluster(scRef);
83 
84  lSC++;
85  iSC++;
86 
87  }
88 
89  // Loop over Endcap SC and fill the recoecal collection
90  lSC=0; // reset local index for endcap
91 
92 for(reco::SuperClusterCollection::const_iterator aClus = scEndcapHandle->begin(); aClus != scEndcapHandle->end(); aClus++) {
93 
94  const reco::Particle::Point vtx( 0, 0, 0 );
95 
96  math::XYZVector direction =aClus->position() - vtx;
97  math::XYZVector momentum = direction.unit() * aClus->energy();
98  const reco::Particle::LorentzVector p4(momentum.x(), momentum.y(), momentum.z(), aClus->energy() );
99 
100  reco::RecoEcalCandidate newCandidate(0, p4, vtx);
101 
102  outputRecoEcalCandidateCollection.push_back(newCandidate);
103  reco::SuperClusterRef scRef(reco::SuperClusterRef(scEndcapHandle, lSC));
104  outputRecoEcalCandidateCollection[iSC].setSuperCluster(scRef);
105 
106  iSC++;
107  lSC++;
108 
109  }
110 
111  // put the product in the event
112  outputRecoEcalCandidateCollection_p->assign(outputRecoEcalCandidateCollection.begin(),outputRecoEcalCandidateCollection.end());
113  theEvent.put( outputRecoEcalCandidateCollection_p, recoEcalCandidateCollection_);
114 
115 }
double p4[4]
Definition: TauolaWrapper.h:92
math::XYZPoint Point
point in the space
Definition: Particle.h:29
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
std::vector< RecoEcalCandidate > RecoEcalCandidateCollection
collectin of RecoEcalCandidate objects
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Particle.h:25

Member Data Documentation

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