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 =
73  std::make_unique<DirectMuonTrajectoryBuilder>(trajectoryBuilderParameters, theService.get(), iC);
74  else if (typeOfBuilder == "Exhaustive")
75  trajectoryBuilder =
76  std::make_unique<ExhaustiveMuonTrajectoryBuilder>(trajectoryBuilderParameters, theService.get(), iC);
77  else {
78  LogWarning("Muon|RecoMuon|StandAloneMuonProducer")
79  << "No Trajectory builder associated with " << typeOfBuilder
80  << ". Falling down to the default (StandAloneMuonTrajectoryBuilder)";
81  trajectoryBuilder =
82  std::make_unique<StandAloneMuonTrajectoryBuilder>(trajectoryBuilderParameters, theService.get(), iC);
83  }
84  theTrackFinder = std::make_unique<MuonTrackFinder>(std::move(trajectoryBuilder), std::move(trackLoader), iC);
85 
86  setAlias(parameterSet.getParameter<std::string>("@module_label"));
87 
88  produces<reco::TrackCollection>().setBranchAlias(theAlias + "Tracks");
89  produces<reco::TrackCollection>("UpdatedAtVtx").setBranchAlias(theAlias + "UpdatedAtVtxTracks");
90  produces<TrackingRecHitCollection>().setBranchAlias(theAlias + "RecHits");
91  produces<reco::TrackExtraCollection>().setBranchAlias(theAlias + "TrackExtras");
92  produces<reco::TrackToTrackMap>().setBranchAlias(theAlias + "TrackToTrackMap");
93 
94  produces<std::vector<Trajectory> >().setBranchAlias(theAlias + "Trajectories");
95  produces<TrajTrackAssociationCollection>().setBranchAlias(theAlias + "TrajToTrackMap");
96 
97  seedToken = consumes<edm::View<TrajectorySeed> >(theSeedCollectionLabel);
98 }
99 
102  LogTrace("Muon|RecoMuon|StandAloneMuonProducer") << "StandAloneMuonProducer destructor called" << endl;
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  << "================================" << endl
126  << endl;
127 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
const std::string metname
~StandAloneMuonProducer() override
destructor
ParameterSet const & parameterSet(StableProvenance const &provenance, ProcessHistory const &history)
Definition: Provenance.cc:11
#define LogTrace(id)
StandAloneMuonProducer(const edm::ParameterSet &)
constructor with config
HLT enums.
Log< level::Warning, false > LogWarning
void produce(edm::Event &, const edm::EventSetup &) override
reconstruct muons
def move(src, dest)
Definition: eostools.py:511
Definition: event.py:1