CMS 3D CMS Logo

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

#include <JetTracksAssociatorAtCaloFace.h>

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

Public Member Functions

virtual void beginRun (edm::Run const &run, edm::EventSetup const &setup)
 
 JetTracksAssociatorAtCaloFace (const edm::ParameterSet &)
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 
virtual ~JetTracksAssociatorAtCaloFace ()
 
- 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 Member Functions

 JetTracksAssociatorAtCaloFace ()
 

Private Attributes

double dR_
 
bool firstRun
 
JetTracksAssociationXtrpCalo mAssociator
 
edm::InputTag mExtrapolations
 
edm::InputTag mJets
 
edm::ESHandle< CaloGeometrypGeo
 

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)
 
- 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

Definition at line 20 of file JetTracksAssociatorAtCaloFace.h.

Constructor & Destructor Documentation

JetTracksAssociatorAtCaloFace::JetTracksAssociatorAtCaloFace ( const edm::ParameterSet fConfig)

Definition at line 24 of file JetTracksAssociatorAtCaloFace.cc.

25  : mJets (fConfig.getParameter<edm::InputTag> ("jets")),
26  mExtrapolations (fConfig.getParameter<edm::InputTag> ("extrapolations")),
27  firstRun(true),
28  dR_(fConfig.getParameter<double>("coneSize"))
29 {
30  produces<reco::JetTracksAssociation::Container> ();
31 }
T getParameter(std::string const &) const
virtual JetTracksAssociatorAtCaloFace::~JetTracksAssociatorAtCaloFace ( )
inlinevirtual

Definition at line 23 of file JetTracksAssociatorAtCaloFace.h.

23 {}
JetTracksAssociatorAtCaloFace::JetTracksAssociatorAtCaloFace ( )
inlineprivate

Definition at line 31 of file JetTracksAssociatorAtCaloFace.h.

31 {}

Member Function Documentation

void JetTracksAssociatorAtCaloFace::beginRun ( edm::Run const &  run,
edm::EventSetup const &  setup 
)
virtual

Definition at line 76 of file JetTracksAssociatorAtCaloFace.cc.

77 {
78 }
void JetTracksAssociatorAtCaloFace::produce ( edm::Event fEvent,
const edm::EventSetup fSetup 
)
virtual

Implements edm::EDProducer.

Definition at line 33 of file JetTracksAssociatorAtCaloFace.cc.

References reco::JetExtendedAssociation::allJets(), dR_, edm::hlt::Exception, firstRun, edm::EventSetup::get(), edm::Event::getByLabel(), i, edm::ESHandleBase::isValid(), mAssociator, mExtrapolations, mJets, pGeo, JetTracksAssociationXtrpCalo::produce(), and edm::Event::put().

33  {
34 
35 
36  // Get geometry
37  if ( firstRun ) {
38  fSetup.get<CaloGeometryRecord>().get(pGeo);
39  firstRun = false;
40  }
41 
42  if ( !pGeo.isValid() ) {
43  throw cms::Exception("InvalidInput") << "Did not get geometry" << std::endl;
44  }
45 
46  // get stuff from Event
48  fEvent.getByLabel (mJets, jets_h);
50  fEvent.getByLabel (mExtrapolations, extrapolations_h);
51 
52  // Check to make sure we have inputs
53  if ( jets_h->size() == 0 ) return;
54  // Check to make sure the inputs are calo jets
55  reco::CaloJet const * caloJet0 = dynamic_cast<reco::CaloJet const *>( & (jets_h->at(0)) );
56  // Disallowed non-CaloJet inputs
57  if ( caloJet0 == 0 ) {
58  throw cms::Exception("InvalidInput") << " Jet-track association is only defined for CaloJets.";
59  }
60 
61  std::auto_ptr<reco::JetTracksAssociation::Container> jetTracks (new reco::JetTracksAssociation::Container (reco::JetRefBaseProd(jets_h)));
62 
63 
64  // format inputs
65  std::vector <edm::RefToBase<reco::Jet> > allJets;
66  allJets.reserve (jets_h->size());
67  for (unsigned i = 0; i < jets_h->size(); ++i) allJets.push_back (jets_h->refAt(i));
68  mAssociator.produce (&*jetTracks, allJets, *extrapolations_h, *pGeo, dR_ );
69 
70 
71  // store output
72  fEvent.put (jetTracks);
73 }
std::vector< reco::JetBaseRef > allJets(const Container &)
fill list of all jets associated with values. Return # of jets in the list
int i
Definition: DBlmapReader.cc:9
Jets made from CaloTowers.
Definition: CaloJet.h:30
JetTracksAssociationXtrpCalo mAssociator
edm::ESHandle< CaloGeometry > pGeo
void produce(Association *, JetRefs const &, std::vector< reco::TrackExtrapolation > const &, CaloGeometry const &, double dR)
Associates tracks to jets.
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:84
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:359
const T & get() const
Definition: EventSetup.h:55
bool isValid() const
Definition: ESHandle.h:37

Member Data Documentation

double JetTracksAssociatorAtCaloFace::dR_
private

Definition at line 38 of file JetTracksAssociatorAtCaloFace.h.

Referenced by produce().

bool JetTracksAssociatorAtCaloFace::firstRun
private

Definition at line 37 of file JetTracksAssociatorAtCaloFace.h.

Referenced by produce().

JetTracksAssociationXtrpCalo JetTracksAssociatorAtCaloFace::mAssociator
private

Definition at line 35 of file JetTracksAssociatorAtCaloFace.h.

Referenced by produce().

edm::InputTag JetTracksAssociatorAtCaloFace::mExtrapolations
private

Definition at line 34 of file JetTracksAssociatorAtCaloFace.h.

Referenced by produce().

edm::InputTag JetTracksAssociatorAtCaloFace::mJets
private

Definition at line 33 of file JetTracksAssociatorAtCaloFace.h.

Referenced by produce().

edm::ESHandle<CaloGeometry> JetTracksAssociatorAtCaloFace::pGeo
private

Definition at line 36 of file JetTracksAssociatorAtCaloFace.h.

Referenced by produce().