CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HIMuonTrackingRegionProducer.h
Go to the documentation of this file.
1 #ifndef RecoHI_HiTracking_HIMuonTrackingRegionProducer_H
2 #define RecoHI_HiTracking_HIMuonTrackingRegionProducer_H
3 
6 
11 
14 
17 
19 
20  public:
21 
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  }
37 
38 
40 
41 
42  virtual std::vector<std::unique_ptr<TrackingRegion> > regions(const edm::Event& ev, const edm::EventSetup& es) const override {
43 
44  // initialize output vector of tracking regions
45  std::vector<std::unique_ptr<TrackingRegion> > result;
46 
47  // initialize the region builder
48  theService->update(es);
50 
51  // get stand-alone muon collection
53  ev.getByToken(theMuonSourceToken ,muonH);
54 
55  // loop over all muons and add a tracking region for each
56  // that passes the requirements specified to theRegionBuilder
57  unsigned int nMuons = muonH->size();
58  //std::cout << "there are " << nMuons << " muon(s)" << std::endl;
59 
60  // TO DO: this can be extended further to a double-loop
61  // over all combinations of muons, returning tracking regions
62  // for pairs that pass some loose invariant mass cuts
63  for(unsigned int imu=0; imu<nMuons; imu++) {
64  reco::TrackRef muRef(muonH, imu);
65  //std::cout << "muon #" << imu << ": pt=" << muRef->pt() << std::endl;
66  result.push_back(theRegionBuilder->region(muRef));
67  }
68 
69  return result;
70 
71  }
72 
73 
74  private:
75 
80 
81 };
82 
83 #endif
void update(const edm::EventSetup &setup)
update the services each event
T getParameter(std::string const &) const
virtual std::vector< std::unique_ptr< TrackingRegion > > regions(const edm::Event &ev, const edm::EventSetup &es) const override
tuple cfg
Definition: looper.py:293
edm::EDGetTokenT< reco::TrackCollection > theMuonSourceToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
virtual void setEvent(const edm::Event &)
Pass the Event to the algo at each event.
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
bool ev
MuonTrackingRegionBuilder * theRegionBuilder
std::unique_ptr< RectangularEtaPhiTrackingRegion > region(const reco::TrackRef &) const
Define tracking region.
tuple result
Definition: mps_fire.py:84
HIMuonTrackingRegionProducer(const edm::ParameterSet &cfg, edm::ConsumesCollector &&iC)