CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
GlobalCosmicMuonProducer.cc
Go to the documentation of this file.
2 
11 // system include files
12 #include <memory>
14 
15 // user include files
17 
20 
22 
25 
29 
34 
35 //
36 // constructors and destructor
37 //
39  edm::ParameterSet tbpar = iConfig.getParameter<edm::ParameterSet>("TrajectoryBuilderParameters");
40  theTrackCollectionToken = consumes<reco::TrackCollection>(iConfig.getParameter<edm::InputTag>("MuonCollectionLabel"));
41 
42  // service parameters
43  edm::ParameterSet serviceParameters = iConfig.getParameter<edm::ParameterSet>("ServiceParameters");
44 
45  // TrackLoader parameters
46  edm::ParameterSet trackLoaderParameters = iConfig.getParameter<edm::ParameterSet>("TrackLoaderParameters");
47 
48  // the services
49  theService = std::make_unique<MuonServiceProxy>(serviceParameters, consumesCollector());
50  edm::ConsumesCollector iC = consumesCollector();
51  theTrackFinder = std::make_unique<MuonTrackFinder>(
52  std::make_unique<GlobalCosmicMuonTrajectoryBuilder>(tbpar, theService.get(), iC),
53  std::make_unique<MuonTrackLoader>(trackLoaderParameters, iC, theService.get()),
54  iC);
55 
56  produces<reco::TrackCollection>();
57  produces<TrackingRecHitCollection>();
58  produces<reco::TrackExtraCollection>();
59  produces<std::vector<Trajectory> >();
60  produces<TrajTrackAssociationCollection>();
61 
62  produces<reco::MuonTrackLinksCollection>();
63 }
64 
66 
67 // ------------ method called to produce the data ------------
69  const std::string metname = "Muon|RecoMuon|GlobalCosmicMuonProducer";
70  LogTrace(metname) << "Global Cosmic Muon Reconstruction started";
71 
73  iEvent.getByToken(theTrackCollectionToken, cosMuons);
74  if (!cosMuons.isValid()) {
75  LogTrace(metname) << "Muon Track collection is invalid!!!";
76  return;
77  }
78 
79  // Update the services
80  theService->update(iSetup);
81 
82  // Reconstruct the tracks in the tracker+muon system
83  LogTrace(metname) << "Track Reconstruction";
84 
85  std::vector<MuonTrajectoryBuilder::TrackCand> cosTrackCands;
86  for (unsigned int position = 0; position != cosMuons->size(); ++position) {
87  reco::TrackRef cosTrackRef(cosMuons, position);
89  cosTrackCands.push_back(cosCand);
90  }
91  theTrackFinder->reconstruct(cosTrackCands, iEvent, iSetup);
92  LogTrace(metname) << "Event loaded";
93 }
std::pair< const Trajectory *, reco::TrackRef > TrackCand
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
const std::string metname
void produce(edm::Event &, const edm::EventSetup &) override
#define LogTrace(id)
std::unique_ptr< MuonServiceProxy > theService
the event setup proxy, it takes care the services update
int iEvent
Definition: GenABIO.cc:224
std::unique_ptr< MuonTrackFinder > theTrackFinder
bool isValid() const
Definition: HandleBase.h:70
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
static int position[264][3]
Definition: ReadPGInfo.cc:289
GlobalCosmicMuonProducer(const edm::ParameterSet &)
edm::EDGetTokenT< reco::TrackCollection > theTrackCollectionToken