CMS 3D CMS Logo

StandAloneMuonProducer.cc
Go to the documentation of this file.
1 
13 // Framework
18 
20 
21 // TrackFinder and Specific STA Trajectory Builder
25 
29 
30 // Input and output collection
31 
35 
37 
38 #include <string>
39 
40 using namespace edm;
41 using namespace std;
42 
45  LogTrace("Muon|RecoMuon|StandAloneMuonProducer")<<"constructor called"<<endl;
46 
47  // Parameter set for the Builder
48  ParameterSet trajectoryBuilderParameters = parameterSet.getParameter<ParameterSet>("STATrajBuilderParameters");
49 
50  // MuonSeed Collection Label
51  theSeedCollectionLabel = parameterSet.getParameter<InputTag>("InputObjects");
52 
53  // service parameters
54  ParameterSet serviceParameters = parameterSet.getParameter<ParameterSet>("ServiceParameters");
55 
56  // TrackLoader parameters
57  ParameterSet trackLoaderParameters = parameterSet.getParameter<ParameterSet>("TrackLoaderParameters");
58  edm::ConsumesCollector iC = consumesCollector();
59 
60  // the services
61  theService = new MuonServiceProxy(serviceParameters);
62 
63  MuonTrackLoader * trackLoader = new MuonTrackLoader(trackLoaderParameters,iC,theService);
64  MuonTrajectoryBuilder * trajectoryBuilder = 0;
65  // instantiate the concrete trajectory builder in the Track Finder
66  string typeOfBuilder = parameterSet.getParameter<string>("MuonTrajectoryBuilder");
67  if(typeOfBuilder == "StandAloneMuonTrajectoryBuilder")
68  trajectoryBuilder = new StandAloneMuonTrajectoryBuilder(trajectoryBuilderParameters,theService,iC);
69  else if(typeOfBuilder == "DirectMuonTrajectoryBuilder")
70  trajectoryBuilder = new DirectMuonTrajectoryBuilder(trajectoryBuilderParameters,theService);
71  else if(typeOfBuilder == "Exhaustive")
72  trajectoryBuilder = new ExhaustiveMuonTrajectoryBuilder(trajectoryBuilderParameters,theService,iC);
73  else{
74  LogWarning("Muon|RecoMuon|StandAloneMuonProducer") << "No Trajectory builder associated with "<<typeOfBuilder
75  << ". Falling down to the default (StandAloneMuonTrajectoryBuilder)";
76  trajectoryBuilder = new StandAloneMuonTrajectoryBuilder(trajectoryBuilderParameters,theService,iC);
77  }
78  theTrackFinder = new MuonTrackFinder(trajectoryBuilder, trackLoader);
79 
80  setAlias(parameterSet.getParameter<std::string>("@module_label"));
81 
82  produces<reco::TrackCollection>().setBranchAlias(theAlias + "Tracks");
83  produces<reco::TrackCollection>("UpdatedAtVtx").setBranchAlias(theAlias + "UpdatedAtVtxTracks");
84  produces<TrackingRecHitCollection>().setBranchAlias(theAlias + "RecHits");
85  produces<reco::TrackExtraCollection>().setBranchAlias(theAlias + "TrackExtras");
86  produces<reco::TrackToTrackMap>().setBranchAlias(theAlias + "TrackToTrackMap");
87 
88  produces<std::vector<Trajectory> >().setBranchAlias(theAlias + "Trajectories");
89  produces<TrajTrackAssociationCollection>().setBranchAlias(theAlias + "TrajToTrackMap");
90 
91 
92 
93  seedToken = consumes<edm::View<TrajectorySeed> >(theSeedCollectionLabel);
94 
95 
96 }
97 
100  LogTrace("Muon|RecoMuon|StandAloneMuonProducer")<<"StandAloneMuonProducer destructor called"<<endl;
101  if (theService) delete theService;
102  if (theTrackFinder) delete theTrackFinder;
103 }
104 
107  const std::string metname = "Muon|RecoMuon|StandAloneMuonProducer";
108 
109  LogTrace(metname)<<endl<<endl<<endl;
110  LogTrace(metname)<<"Stand Alone Muon Reconstruction Started"<<endl;
111 
112  // Take the seeds container
113  LogTrace(metname)<<"Taking the seeds: "<<theSeedCollectionLabel.label()<<endl;
115  event.getByToken(seedToken,seeds);
116 
117  // Update the services
118  theService->update(eventSetup);
119 
120  // Reconstruct
121  LogTrace(metname)<<"Track Reconstruction"<<endl;
122  theTrackFinder->reconstruct(seeds,event, eventSetup);
123 
124  LogTrace(metname)<<"Event loaded"
125  <<"================================"
126  <<endl<<endl;
127 }
128 
T getParameter(std::string const &) const
const std::string metname
virtual ~StandAloneMuonProducer()
destructor
StandAloneMuonProducer(const edm::ParameterSet &)
constructor with config
#define LogTrace(id)
HLT enums.
virtual void produce(edm::Event &, const edm::EventSetup &) override
reconstruct muons
ParameterSet const & parameterSet(Provenance const &provenance)
Definition: Provenance.cc:11
Definition: event.py:1