CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
HIMuonTrackingRegionProducer.h
Go to the documentation of this file.
1 #ifndef RecoHI_HiTracking_HIMuonTrackingRegionProducer_H
2 #define RecoHI_HiTracking_HIMuonTrackingRegionProducer_H
3 
6 
10 
13 
16 
18 public:
20  // get parameters from PSet
21  theMuonSource = cfg.getParameter<edm::InputTag>("MuonSrc");
23 
24  // initialize region builder
25  edm::ParameterSet regionBuilderPSet = cfg.getParameter<edm::ParameterSet>("MuonTrackingRegionBuilder");
26  theRegionBuilder = new MuonTrackingRegionBuilder(regionBuilderPSet, iC);
27 
28  // initialize muon service proxy
29  edm::ParameterSet servicePSet = cfg.getParameter<edm::ParameterSet>("ServiceParameters");
30  }
31 
33 
34  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
36 
37  desc.add<edm::InputTag>("MuonSrc", edm::InputTag(""));
38 
41  desc.add("MuonTrackingRegionBuilder", descRegion);
42 
43  edm::ParameterSetDescription descService;
44  descService.setAllowAnything();
45  desc.add<edm::ParameterSetDescription>("ServiceParameters", descService);
46 
47  descriptions.add("HiTrackingRegionEDProducer", desc);
48  }
49 
50  std::vector<std::unique_ptr<TrackingRegion> > regions(const edm::Event& ev,
51  const edm::EventSetup& es) const override {
52  // initialize output vector of tracking regions
53  std::vector<std::unique_ptr<TrackingRegion> > result;
54 
55  // initialize the region builder
56  theRegionBuilder->setEvent(ev, es);
57 
58  // get stand-alone muon collection
60  ev.getByToken(theMuonSourceToken, muonH);
61 
62  // loop over all muons and add a tracking region for each
63  // that passes the requirements specified to theRegionBuilder
64  unsigned int nMuons = muonH->size();
65  //std::cout << "there are " << nMuons << " muon(s)" << std::endl;
66 
67  // TO DO: this can be extended further to a double-loop
68  // over all combinations of muons, returning tracking regions
69  // for pairs that pass some loose invariant mass cuts
70  for (unsigned int imu = 0; imu < nMuons; imu++) {
71  reco::TrackRef muRef(muonH, imu);
72  //std::cout << "muon #" << imu << ": pt=" << muRef->pt() << std::endl;
73  result.push_back(theRegionBuilder->region(muRef));
74  }
75 
76  return result;
77  }
78 
79 private:
83 };
84 
85 #endif
tuple cfg
Definition: looper.py:296
edm::EDGetTokenT< reco::TrackCollection > theMuonSourceToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
void setAllowAnything()
allow any parameter label/value pairs
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:311
void setEvent(const edm::Event &, const edm::EventSetup &)
Pass the Event to the algo at each event.
tuple MuonTrackingRegionBuilder
ParameterDescriptionBase * add(U const &iLabel, T const &value)
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
void add(std::string const &label, ParameterSetDescription const &psetDescription)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
std::vector< std::unique_ptr< TrackingRegion > > regions(const edm::Event &ev, const edm::EventSetup &es) const override
static void fillDescriptionsOffline(edm::ParameterSetDescription &descriptions)
HIMuonTrackingRegionProducer(const edm::ParameterSet &cfg, edm::ConsumesCollector &&iC)