CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
L2MuonProducer.cc
Go to the documentation of this file.
1 //-------------------------------------------------
2 //
14 //
15 //--------------------------------------------------
16 
18 
19 // Framework
24 
25 // TrackFinder and Specific STA/L2 Trajectory Builder
32 
35 
41 
42 #include <string>
43 
44 using namespace edm;
45 using namespace std;
46 
49  LogTrace("Muon|RecoMuon|L2MuonProducer")<<"constructor called"<<endl;
50 
51  // Parameter set for the Builder
52  ParameterSet trajectoryBuilderParameters = parameterSet.getParameter<ParameterSet>("L2TrajBuilderParameters");
53 
54  // MuonSeed Collection Label
55  theSeedCollectionLabel = parameterSet.getParameter<InputTag>("InputObjects");
56  seedsToken = consumes<edm::View<TrajectorySeed> >(theSeedCollectionLabel);
57  // service parameters
58  ParameterSet serviceParameters = parameterSet.getParameter<ParameterSet>("ServiceParameters");
59 
60  // TrackLoader parameters
61  ParameterSet trackLoaderParameters = parameterSet.getParameter<ParameterSet>("TrackLoaderParameters");
62 
63  // the services
64  theService = new MuonServiceProxy(serviceParameters);
65 
66  MuonTrajectoryBuilder * trajectoryBuilder = 0;
67  // instantiate the concrete trajectory builder in the Track Finder
68  edm::ConsumesCollector iC = consumesCollector();
69  string typeOfBuilder = parameterSet.existsAs<string>("MuonTrajectoryBuilder") ?
70  parameterSet.getParameter<string>("MuonTrajectoryBuilder") : "StandAloneMuonTrajectoryBuilder";
71  if(typeOfBuilder == "StandAloneMuonTrajectoryBuilder" || typeOfBuilder == "")
72  trajectoryBuilder = new StandAloneMuonTrajectoryBuilder(trajectoryBuilderParameters,theService,iC);
73  else if(typeOfBuilder == "Exhaustive")
74  trajectoryBuilder = new ExhaustiveMuonTrajectoryBuilder(trajectoryBuilderParameters,theService,iC);
75  else{
76  LogWarning("Muon|RecoMuon|StandAloneMuonProducer") << "No Trajectory builder associated with "<<typeOfBuilder
77  << ". Falling down to the default (StandAloneMuonTrajectoryBuilder)";
78  trajectoryBuilder = new StandAloneMuonTrajectoryBuilder(trajectoryBuilderParameters,theService,iC);
79  }
80  theTrackFinder = new MuonTrackFinder(trajectoryBuilder,
81  new MuonTrackLoader(trackLoaderParameters, iC, theService),
82  new MuonTrajectoryCleaner(true));
83 
84  produces<reco::TrackCollection>();
85  produces<reco::TrackCollection>("UpdatedAtVtx");
86  produces<TrackingRecHitCollection>();
87  produces<reco::TrackExtraCollection>();
88  produces<reco::TrackToTrackMap>();
89 
90  produces<std::vector<Trajectory> >();
91  produces<TrajTrackAssociationCollection>();
92 
93  produces<edm::AssociationMap<edm::OneToMany<std::vector<L2MuonTrajectorySeed>, std::vector<L2MuonTrajectorySeed> > > >();
94 }
95 
98  LogTrace("Muon|RecoMuon|L2eMuonProducer")<<"L2MuonProducer destructor called"<<endl;
99  delete theService;
100  delete theTrackFinder;
101 }
102 
103 
105 void L2MuonProducer::produce(Event& event, const EventSetup& eventSetup){
106 
107  const std::string metname = "Muon|RecoMuon|L2MuonProducer";
108 
109  LogTrace(metname)<<endl<<endl<<endl;
110  LogTrace(metname)<<"L2 Muon Reconstruction Started"<<endl;
111 
112  // Take the seeds container
113  LogTrace(metname)<<"Taking the seeds: "<<theSeedCollectionLabel.label()<<endl;
115  event.getByToken(seedsToken,seeds);
116 
117  // Update the services
118  theService->update(eventSetup);
119  NavigationSetter setter(*theService->muonNavigationSchool());
120 
121  // Reconstruct
122  LogTrace(metname)<<"Track Reconstruction"<<endl;
123  theTrackFinder->reconstruct(seeds,event);
124 
125  LogTrace(metname)<<"Event loaded"
126  <<"================================"
127  <<endl<<endl;
128 }
129 
T getParameter(std::string const &) const
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:184
const std::string metname
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)
L2MuonProducer(const edm::ParameterSet &)
constructor with config
virtual ~L2MuonProducer()
destructor
virtual void produce(edm::Event &, const edm::EventSetup &)
reconstruct muons
ParameterSet const & parameterSet(Provenance const &provenance)
Definition: Provenance.cc:11