CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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 
26 
30 
35 
36 //
37 // constructors and destructor
38 //
40 {
41 
42  edm::ParameterSet tbpar = iConfig.getParameter<edm::ParameterSet>("TrajectoryBuilderParameters");
43  theTrackCollectionToken =consumes<reco::TrackCollection>( iConfig.getParameter<edm::InputTag>("MuonCollectionLabel"));
44 
45  // service parameters
46  edm::ParameterSet serviceParameters = iConfig.getParameter<edm::ParameterSet>("ServiceParameters");
47 
48  // TrackLoader parameters
49  edm::ParameterSet trackLoaderParameters = iConfig.getParameter<edm::ParameterSet>("TrackLoaderParameters");
50 
51  // the services
52  theService = new MuonServiceProxy(serviceParameters);
55  new MuonTrackLoader(trackLoaderParameters,iC, theService));
56 
57  produces<reco::TrackCollection>();
58  produces<TrackingRecHitCollection>();
59  produces<reco::TrackExtraCollection>();
60  produces<std::vector<Trajectory> >();
61  produces<TrajTrackAssociationCollection>();
62 
63  produces<reco::MuonTrackLinksCollection>();
64 
65 }
66 
67 
69 {
70  if (theService) delete theService;
71  if (theTrackFinder) delete theTrackFinder;
72 }
73 
74 
75 // ------------ method called to produce the data ------------
76 void
78 {
79  const std::string metname = "Muon|RecoMuon|GlobalCosmicMuonProducer";
80  LogTrace(metname)<<"Global Cosmic Muon Reconstruction started";
81 
83  iEvent.getByToken(theTrackCollectionToken,cosMuons);
84  if (!cosMuons.isValid()) {
85  LogTrace(metname)<< "Muon Track collection is invalid!!!";
86  return;
87  }
88 
89  // Update the services
90  theService->update(iSetup);
91 
92  // Reconstruct the tracks in the tracker+muon system
93  LogTrace(metname)<<"Track Reconstruction";
94 
95  std::vector<MuonTrajectoryBuilder::TrackCand> cosTrackCands;
96  for ( unsigned int position = 0; position != cosMuons->size(); ++position ) {
97  reco::TrackRef cosTrackRef(cosMuons,position);
99  cosTrackCands.push_back(cosCand);
100  }
101  theTrackFinder->reconstruct(cosTrackCands,iEvent,iSetup);
102  LogTrace(metname)<<"Event loaded";
103 
104 }
105 
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:464
const std::string metname
virtual void produce(edm::Event &, const edm::EventSetup &) override
int iEvent
Definition: GenABIO.cc:230
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
bool isValid() const
Definition: HandleBase.h:75
#define LogTrace(id)
static int position[264][3]
Definition: ReadPGInfo.cc:509
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