CMS 3D CMS Logo

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 
26 
30 
35 
36 //
37 // constructors and destructor
38 //
40  edm::ParameterSet tbpar = iConfig.getParameter<edm::ParameterSet>("TrajectoryBuilderParameters");
41  theTrackCollectionToken = consumes<reco::TrackCollection>(iConfig.getParameter<edm::InputTag>("MuonCollectionLabel"));
42 
43  // service parameters
44  edm::ParameterSet serviceParameters = iConfig.getParameter<edm::ParameterSet>("ServiceParameters");
45 
46  // TrackLoader parameters
47  edm::ParameterSet trackLoaderParameters = iConfig.getParameter<edm::ParameterSet>("TrackLoaderParameters");
48 
49  // the services
50  theService = new MuonServiceProxy(serviceParameters);
51  edm::ConsumesCollector iC = consumesCollector();
52  theTrackFinder = new MuonTrackFinder(new GlobalCosmicMuonTrajectoryBuilder(tbpar, theService, iC),
53  new MuonTrackLoader(trackLoaderParameters, iC, theService));
54 
55  produces<reco::TrackCollection>();
56  produces<TrackingRecHitCollection>();
57  produces<reco::TrackExtraCollection>();
58  produces<std::vector<Trajectory> >();
59  produces<TrajTrackAssociationCollection>();
60 
61  produces<reco::MuonTrackLinksCollection>();
62 }
63 
65  if (theService)
66  delete theService;
67  if (theTrackFinder)
68  delete theTrackFinder;
69 }
70 
71 // ------------ method called to produce the data ------------
73  const std::string metname = "Muon|RecoMuon|GlobalCosmicMuonProducer";
74  LogTrace(metname) << "Global Cosmic Muon Reconstruction started";
75 
77  iEvent.getByToken(theTrackCollectionToken, cosMuons);
78  if (!cosMuons.isValid()) {
79  LogTrace(metname) << "Muon Track collection is invalid!!!";
80  return;
81  }
82 
83  // Update the services
84  theService->update(iSetup);
85 
86  // Reconstruct the tracks in the tracker+muon system
87  LogTrace(metname) << "Track Reconstruction";
88 
89  std::vector<MuonTrajectoryBuilder::TrackCand> cosTrackCands;
90  for (unsigned int position = 0; position != cosMuons->size(); ++position) {
91  reco::TrackRef cosTrackRef(cosMuons, position);
93  cosTrackCands.push_back(cosCand);
94  }
95  theTrackFinder->reconstruct(cosTrackCands, iEvent, iSetup);
96  LogTrace(metname) << "Event loaded";
97 }
void update(const edm::EventSetup &setup)
update the services each event
T getParameter(std::string const &) const
std::pair< const Trajectory *, reco::TrackRef > TrackCand
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
const std::string metname
void produce(edm::Event &, const edm::EventSetup &) override
int iEvent
Definition: GenABIO.cc:224
bool isValid() const
Definition: HandleBase.h:70
#define LogTrace(id)
static int position[264][3]
Definition: ReadPGInfo.cc:289
GlobalCosmicMuonProducer(const edm::ParameterSet &)
MuonServiceProxy * theService
the event setup proxy, it takes care the services update
edm::OrphanHandle< reco::TrackCollection > reconstruct(const edm::Handle< edm::View< TrajectorySeed > > &, edm::Event &, const edm::EventSetup &)
reconstruct standalone tracks starting from a collection of seeds
edm::EDGetTokenT< reco::TrackCollection > theTrackCollectionToken