CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
L3MuonProducer.cc
Go to the documentation of this file.
1 
13 // Framework
20 
22 
23 // TrackFinder and specific GLB Trajectory Builder
28 
29 // Input and output collection
32 
37 
38 using namespace edm;
39 using namespace std;
40 
41 //
42 // constructor with config
43 //
45 
46  LogTrace("L3MuonProducer") << "constructor called" << endl;
47 
48  // Parameter set for the Builder
49  ParameterSet trajectoryBuilderParameters = parameterSet.getParameter<ParameterSet>("L3TrajBuilderParameters");
50 
51  // L2 Muon Collection Label
52  theL2CollectionLabel = parameterSet.getParameter<InputTag>("MuonCollectionLabel");
53 
54  // service parameters
55  ParameterSet serviceParameters = parameterSet.getParameter<ParameterSet>("ServiceParameters");
56 
57  // TrackLoader parameters
58  ParameterSet trackLoaderParameters = parameterSet.getParameter<ParameterSet>("TrackLoaderParameters");
59 
60  // the services
61  theService = new MuonServiceProxy(serviceParameters);
62 
63  // instantiate the concrete trajectory builder in the Track Finder
64  MuonTrackLoader* mtl = new MuonTrackLoader(trackLoaderParameters,theService);
65  L3MuonTrajectoryBuilder* l3mtb = new L3MuonTrajectoryBuilder(trajectoryBuilderParameters, theService);
66  theTrackFinder = new MuonTrackFinder(l3mtb, mtl);
67 
68  theL2SeededTkLabel = trackLoaderParameters.getUntrackedParameter<std::string>("MuonSeededTracksInstance",std::string());
69 
70  produces<reco::TrackCollection>(theL2SeededTkLabel);
71  produces<TrackingRecHitCollection>(theL2SeededTkLabel);
72  produces<reco::TrackExtraCollection>(theL2SeededTkLabel);
73  produces<vector<Trajectory> >(theL2SeededTkLabel) ;
74  produces<TrajTrackAssociationCollection>(theL2SeededTkLabel);
75 
76  produces<reco::TrackCollection>();
77  produces<TrackingRecHitCollection>();
78  produces<reco::TrackExtraCollection>();
79  produces<vector<Trajectory> >() ;
80  produces<TrajTrackAssociationCollection>();
81 
82  produces<reco::MuonTrackLinksCollection>();
83 
84 }
85 
86 
87 //
88 // destructor
89 //
91 
92  LogTrace("L3MuonProducer") << "destructor called" << endl;
93  if (theService) delete theService;
94  if (theTrackFinder) delete theTrackFinder;
95 
96 }
97 
98 
99 //
100 // reconstruct muons
101 //
102 void L3MuonProducer::produce(Event& event, const EventSetup& eventSetup) {
103  const string metname = "Muon|RecoMuon|L3MuonProducer";
104  LogTrace(metname)<<endl<<endl<<endl;
105  LogTrace(metname)<<"L3 Muon Reconstruction started"<<endl;
106 
107  typedef vector<Trajectory> TrajColl;
108 
109  // Update the services
110  theService->update(eventSetup);
111 
112  // Take the L2 muon container(s)
113  LogTrace(metname)<<"Taking the L2 Muons "<<theL2CollectionLabel<<endl;
114 
116  event.getByLabel(theL2CollectionLabel,L2Muons);
117 
118  Handle<vector<Trajectory> > L2MuonsTraj;
119  vector<MuonTrajectoryBuilder::TrackCand> L2TrackCands;
120 
121 
122  event.getByLabel(theL2CollectionLabel.label(), L2MuonsTraj);
123 
125  event.getByLabel(theL2CollectionLabel.label(),L2AssoMap);
126 
127  edm::Handle<reco::TrackToTrackMap> updatedL2AssoMap;
128  event.getByLabel(theL2CollectionLabel.label(),updatedL2AssoMap);
129 
130  for(TrajTrackAssociationCollection::const_iterator it = L2AssoMap->begin(); it != L2AssoMap->end(); ++it){
131  const Ref<vector<Trajectory> > traj = it->key;
132  const reco::TrackRef tkRegular = it->val;
133  reco::TrackRef tkUpdated;
136  if ( theL2CollectionLabel.instance() == "UpdatedAtVtx") {
137  iEnd = updatedL2AssoMap->end();
138  iii = updatedL2AssoMap->find(it->val);
139  if (iii != iEnd ) tkUpdated = (*updatedL2AssoMap)[it->val] ;
140  }
141 
142  const reco::TrackRef tk = ( tkUpdated.isNonnull() ) ? tkUpdated : tkRegular ;
143 
145  if( traj->isValid() ) L2Cand.first = &*traj ;
146  L2TrackCands.push_back(L2Cand);
147  }
148 
149  theTrackFinder->reconstruct(L2TrackCands, event);
150 
151  LogTrace(metname)<<"Event loaded"
152  <<"================================"
153  <<endl<<endl;
154 
155 }
T getParameter(std::string const &) const
std::pair< const Trajectory *, reco::TrackRef > TrackCand
const std::string metname
tuple L2Muons
Definition: L2Muons_cfi.py:6
virtual ~L3MuonProducer()
destructor
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:250
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
#define LogTrace(id)
L3MuonProducer(const edm::ParameterSet &)
constructor with config
key_type key() const
Accessor for product key.
Definition: Ref.h:266
virtual void produce(edm::Event &, const edm::EventSetup &)
reconstruct muons