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 
13 // system include files
14 #include <memory>
15 
16 // user include files
18 
21 
23 
27 
33 
38 
39 //
40 // constructors and destructor
41 //
43 {
44 
45  edm::ParameterSet tbpar = iConfig.getParameter<edm::ParameterSet>("TrajectoryBuilderParameters");
46  theTrackCollectionLabel = iConfig.getParameter<edm::InputTag>("MuonCollectionLabel");
47 
48  // service parameters
49  edm::ParameterSet serviceParameters = iConfig.getParameter<edm::ParameterSet>("ServiceParameters");
50 
51  // TrackLoader parameters
52  edm::ParameterSet trackLoaderParameters = iConfig.getParameter<edm::ParameterSet>("TrackLoaderParameters");
53 
54  // the services
55  theService = new MuonServiceProxy(serviceParameters);
56 
58  new MuonTrackLoader(trackLoaderParameters, theService));
59 
60  produces<reco::TrackCollection>();
61  produces<TrackingRecHitCollection>();
62  produces<reco::TrackExtraCollection>();
63  produces<std::vector<Trajectory> >();
64  produces<TrajTrackAssociationCollection>();
65 
66  produces<reco::MuonTrackLinksCollection>();
67 
68 }
69 
70 
72 {
73  if (theService) delete theService;
74  if (theTrackFinder) delete theTrackFinder;
75 }
76 
77 
78 // ------------ method called to produce the data ------------
79 void
81 {
82  const std::string metname = "Muon|RecoMuon|GlobalCosmicMuonProducer";
83  LogTrace(metname)<<"Global Cosmic Muon Reconstruction started";
84 
86  iEvent.getByLabel(theTrackCollectionLabel,cosMuons);
87  if (!cosMuons.isValid()) {
88  LogTrace(metname)<< "Muon Track collection is invalid!!!";
89  return;
90  }
91 
92  // Update the services
93  theService->update(iSetup);
94 
95  // Reconstruct the tracks in the tracker+muon system
96  LogTrace(metname)<<"Track Reconstruction";
97 
98  std::vector<MuonTrajectoryBuilder::TrackCand> cosTrackCands;
99  for ( unsigned int position = 0; position != cosMuons->size(); ++position ) {
100  reco::TrackRef cosTrackRef(cosMuons,position);
102  cosTrackCands.push_back(cosCand);
103  }
104  theTrackFinder->reconstruct(cosTrackCands,iEvent);
105  LogTrace(metname)<<"Event loaded";
106 
107 }
108 
void update(const edm::EventSetup &setup)
update the services each event
T getParameter(std::string const &) const
std::pair< const Trajectory *, reco::TrackRef > TrackCand
const std::string metname
static int position[TOTALCHAMBERS][3]
Definition: ReadPGInfo.cc:509
int iEvent
Definition: GenABIO.cc:243
bool isValid() const
Definition: HandleBase.h:76
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:361
#define LogTrace(id)
GlobalCosmicMuonProducer(const edm::ParameterSet &)
MuonServiceProxy * theService
the event setup proxy, it takes care the services update
virtual void produce(edm::Event &, const edm::EventSetup &)
edm::OrphanHandle< reco::TrackCollection > reconstruct(const edm::Handle< edm::View< TrajectorySeed > > &, edm::Event &)
reconstruct standalone tracks starting from a collection of seeds