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 
34 
40 
41 #include <string>
42 
43 using namespace edm;
44 using namespace std;
45 
48  LogTrace("Muon|RecoMuon|L2MuonProducer")<<"constructor called"<<endl;
49 
50  // Parameter set for the Builder
51  ParameterSet trajectoryBuilderParameters = parameterSet.getParameter<ParameterSet>("L2TrajBuilderParameters");
52 
53  // MuonSeed Collection Label
54  theSeedCollectionLabel = parameterSet.getParameter<InputTag>("InputObjects");
55  seedsToken = consumes<edm::View<TrajectorySeed> >(theSeedCollectionLabel);
56  // service parameters
57  ParameterSet serviceParameters = parameterSet.getParameter<ParameterSet>("ServiceParameters");
58 
59  // TrackLoader parameters
60  ParameterSet trackLoaderParameters = parameterSet.getParameter<ParameterSet>("TrackLoaderParameters");
61 
62  // the services
63  theService = new MuonServiceProxy(serviceParameters);
64 
65  MuonTrajectoryBuilder * trajectoryBuilder = 0;
66  // instantiate the concrete trajectory builder in the Track Finder
67 
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 
120  // Reconstruct
121  LogTrace(metname)<<"Track Reconstruction"<<endl;
122  theTrackFinder->reconstruct(seeds,event);
123 
124  LogTrace(metname)<<"Event loaded"
125  <<"================================"
126  <<endl<<endl;
127 }
128 
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:186
const std::string metname
virtual void produce(edm::Event &, const edm::EventSetup &) override
reconstruct muons
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
ParameterSet const & parameterSet(Provenance const &provenance)
Definition: Provenance.cc:11