CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Attributes
HIMuonTrackingRegionProducer Class Reference

#include <HIMuonTrackingRegionProducer.h>

Inheritance diagram for HIMuonTrackingRegionProducer:
TrackingRegionProducer

Public Member Functions

 HIMuonTrackingRegionProducer (const edm::ParameterSet &cfg, edm::ConsumesCollector &&iC)
 
std::vector< std::unique_ptr< TrackingRegion > > regions (const edm::Event &ev, const edm::EventSetup &es) const override
 
 ~HIMuonTrackingRegionProducer () override
 
- Public Member Functions inherited from TrackingRegionProducer
virtual ~TrackingRegionProducer ()
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Attributes

edm::InputTag theMuonSource
 
edm::EDGetTokenT< reco::TrackCollectiontheMuonSourceToken
 
MuonTrackingRegionBuildertheRegionBuilder
 
MuonServiceProxytheService
 

Detailed Description

Definition at line 18 of file HIMuonTrackingRegionProducer.h.

Constructor & Destructor Documentation

HIMuonTrackingRegionProducer::HIMuonTrackingRegionProducer ( const edm::ParameterSet cfg,
edm::ConsumesCollector &&  iC 
)
inline

Definition at line 22 of file HIMuonTrackingRegionProducer.h.

References edm::ParameterSet::getParameter(), MuonServiceProxy_cff::MuonServiceProxy, HiRegitMuonDetachedTripletStep_cff::MuonTrackingRegionBuilder, theMuonSource, theMuonSourceToken, theRegionBuilder, and theService.

22  {
23 
24  // get parameters from PSet
25  theMuonSource = cfg.getParameter<edm::InputTag>("MuonSrc");
27 
28  // initialize region builder
29  edm::ParameterSet regionBuilderPSet = cfg.getParameter<edm::ParameterSet>("MuonTrackingRegionBuilder");
30  theRegionBuilder = new MuonTrackingRegionBuilder(regionBuilderPSet,iC);
31 
32  // initialize muon service proxy
33  edm::ParameterSet servicePSet = cfg.getParameter<edm::ParameterSet>("ServiceParameters");
34  theService = new MuonServiceProxy(servicePSet);
35 
36  }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
edm::EDGetTokenT< reco::TrackCollection > theMuonSourceToken
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:15
MuonTrackingRegionBuilder * theRegionBuilder
HIMuonTrackingRegionProducer::~HIMuonTrackingRegionProducer ( )
inlineoverride

Definition at line 39 of file HIMuonTrackingRegionProducer.h.

39 {}

Member Function Documentation

static void HIMuonTrackingRegionProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
inlinestatic

Definition at line 42 of file HIMuonTrackingRegionProducer.h.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), MuonTrackingRegionBuilder::fillDescriptionsOffline(), and edm::ParameterSetDescription::setAllowAnything().

42  {
44 
45  desc.add<edm::InputTag>("MuonSrc", edm::InputTag(""));
46 
49  desc.add("MuonTrackingRegionBuilder", descRegion);
50 
51  edm::ParameterSetDescription descService;
52  descService.setAllowAnything();
53  desc.add<edm::ParameterSetDescription>("ServiceParameters", descService);
54 
55  descriptions.add("HiTrackingRegionEDProducer", desc);
56  }
void setAllowAnything()
allow any parameter label/value pairs
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
static void fillDescriptionsOffline(edm::ParameterSetDescription &descriptions)
std::vector<std::unique_ptr<TrackingRegion> > HIMuonTrackingRegionProducer::regions ( const edm::Event ev,
const edm::EventSetup es 
) const
inlineoverridevirtual

Implements TrackingRegionProducer.

Definition at line 58 of file HIMuonTrackingRegionProducer.h.

References edm::Event::getByToken(), jets_cff::nMuons, MuonTrackingRegionBuilder::region(), mps_fire::result, MuonTrackingRegionBuilder::setEvent(), theMuonSourceToken, theRegionBuilder, theService, and MuonServiceProxy::update().

58  {
59 
60  // initialize output vector of tracking regions
61  std::vector<std::unique_ptr<TrackingRegion> > result;
62 
63  // initialize the region builder
64  theService->update(es);
66 
67  // get stand-alone muon collection
69  ev.getByToken(theMuonSourceToken ,muonH);
70 
71  // loop over all muons and add a tracking region for each
72  // that passes the requirements specified to theRegionBuilder
73  unsigned int nMuons = muonH->size();
74  //std::cout << "there are " << nMuons << " muon(s)" << std::endl;
75 
76  // TO DO: this can be extended further to a double-loop
77  // over all combinations of muons, returning tracking regions
78  // for pairs that pass some loose invariant mass cuts
79  for(unsigned int imu=0; imu<nMuons; imu++) {
80  reco::TrackRef muRef(muonH, imu);
81  //std::cout << "muon #" << imu << ": pt=" << muRef->pt() << std::endl;
82  result.push_back(theRegionBuilder->region(muRef));
83  }
84 
85  return result;
86 
87  }
void update(const edm::EventSetup &setup)
update the services each event
edm::EDGetTokenT< reco::TrackCollection > theMuonSourceToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
virtual void setEvent(const edm::Event &)
Pass the Event to the algo at each event.
MuonTrackingRegionBuilder * theRegionBuilder
std::unique_ptr< RectangularEtaPhiTrackingRegion > region(const reco::TrackRef &) const
Define tracking region.

Member Data Documentation

edm::InputTag HIMuonTrackingRegionProducer::theMuonSource
private

Definition at line 92 of file HIMuonTrackingRegionProducer.h.

Referenced by HIMuonTrackingRegionProducer().

edm::EDGetTokenT<reco::TrackCollection> HIMuonTrackingRegionProducer::theMuonSourceToken
private

Definition at line 93 of file HIMuonTrackingRegionProducer.h.

Referenced by HIMuonTrackingRegionProducer(), and regions().

MuonTrackingRegionBuilder* HIMuonTrackingRegionProducer::theRegionBuilder
private

Definition at line 94 of file HIMuonTrackingRegionProducer.h.

Referenced by HIMuonTrackingRegionProducer(), and regions().

MuonServiceProxy* HIMuonTrackingRegionProducer::theService
private

Definition at line 95 of file HIMuonTrackingRegionProducer.h.

Referenced by HIMuonTrackingRegionProducer(), and regions().