CMS 3D CMS Logo

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