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 20 of file HIMuonTrackingRegionProducer.h.

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

20  {
21  // get parameters from PSet
22  theMuonSource = cfg.getParameter<edm::InputTag>("MuonSrc");
24 
25  // initialize region builder
26  edm::ParameterSet regionBuilderPSet = cfg.getParameter<edm::ParameterSet>("MuonTrackingRegionBuilder");
27  theRegionBuilder = new MuonTrackingRegionBuilder(regionBuilderPSet, iC);
28 
29  // initialize muon service proxy
30  edm::ParameterSet servicePSet = cfg.getParameter<edm::ParameterSet>("ServiceParameters");
31  theService = new MuonServiceProxy(servicePSet);
32  }
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:14
MuonTrackingRegionBuilder * theRegionBuilder
HIMuonTrackingRegionProducer::~HIMuonTrackingRegionProducer ( )
inlineoverride

Definition at line 34 of file HIMuonTrackingRegionProducer.h.

34 {}

Member Function Documentation

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

Definition at line 36 of file HIMuonTrackingRegionProducer.h.

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

36  {
38 
39  desc.add<edm::InputTag>("MuonSrc", edm::InputTag(""));
40 
43  desc.add("MuonTrackingRegionBuilder", descRegion);
44 
45  edm::ParameterSetDescription descService;
46  descService.setAllowAnything();
47  desc.add<edm::ParameterSetDescription>("ServiceParameters", descService);
48 
49  descriptions.add("HiTrackingRegionEDProducer", desc);
50  }
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 52 of file HIMuonTrackingRegionProducer.h.

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

53  {
54  // initialize output vector of tracking regions
55  std::vector<std::unique_ptr<TrackingRegion> > result;
56 
57  // initialize the region builder
58  theService->update(es);
60 
61  // get stand-alone muon collection
63  ev.getByToken(theMuonSourceToken, muonH);
64 
65  // loop over all muons and add a tracking region for each
66  // that passes the requirements specified to theRegionBuilder
67  unsigned int nMuons = muonH->size();
68  //std::cout << "there are " << nMuons << " muon(s)" << std::endl;
69 
70  // TO DO: this can be extended further to a double-loop
71  // over all combinations of muons, returning tracking regions
72  // for pairs that pass some loose invariant mass cuts
73  for (unsigned int imu = 0; imu < nMuons; imu++) {
74  reco::TrackRef muRef(muonH, imu);
75  //std::cout << "muon #" << imu << ": pt=" << muRef->pt() << std::endl;
76  result.push_back(theRegionBuilder->region(muRef));
77  }
78 
79  return result;
80  }
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:525
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 83 of file HIMuonTrackingRegionProducer.h.

Referenced by HIMuonTrackingRegionProducer().

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

Definition at line 84 of file HIMuonTrackingRegionProducer.h.

Referenced by HIMuonTrackingRegionProducer(), and regions().

MuonTrackingRegionBuilder* HIMuonTrackingRegionProducer::theRegionBuilder
private

Definition at line 85 of file HIMuonTrackingRegionProducer.h.

Referenced by HIMuonTrackingRegionProducer(), and regions().

MuonServiceProxy* HIMuonTrackingRegionProducer::theService
private

Definition at line 86 of file HIMuonTrackingRegionProducer.h.

Referenced by HIMuonTrackingRegionProducer(), and regions().