CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
MuonTrackFinder.cc
Go to the documentation of this file.
1 
13 
18 
23 
26 
27 using namespace std;
28 using namespace edm;
29 
30 // Constructor, with default cleaner. For the STA reconstruction the trackLoader must have the propagator.
32  MuonTrackLoader *trackLoader) :
33  theTrajBuilder(ConcreteMuonTrajectoryBuilder),
34  theTrajCleaner(new MuonTrajectoryCleaner()),
35  theTrackLoader(trackLoader) {
36 }
37 
38 // Constructor, with user-defined cleaner. For the STA reconstruction the trackLoader must have the propagator.
40  MuonTrackLoader *trackLoader,
41  MuonTrajectoryCleaner* cleaner) :
42  theTrajBuilder(ConcreteMuonTrajectoryBuilder),
43  theTrajCleaner(cleaner),
44  theTrackLoader(trackLoader) {
45 }
46 
47 // destructor
49 
50  LogTrace("Muon|RecoMuon|MuonTrackFinder")<<"MuonTrackFinder destructor called"<<endl;
51  delete theTrajBuilder;
52  delete theTrajCleaner;
53  delete theTrackLoader;
54 
55 }
56 
57 // percolate the event setup
59  theTrajBuilder->setEvent(event);
60 }
61 
62 // convert the trajectories into tracks and load them in to the event
65  edm::Event& event) {
66 
67  return theTrackLoader->loadTracks(trajectories, event);
68 }
69 
70 // convert the trajectories into tracks and load them in to the event
72  Event& event) {
73 
74  theTrackLoader->loadTracks(muonCands, event);
75 
76 }
77 
78 // reconstruct trajectories
81  edm::Event& event){
82 
83  const string metname = "Muon|RecoMuon|MuonTrackFinder";
84  LogTrace(metname)<<"SA Recostruction starting from: "<<seeds->size()<<endl;
85 
86  // Percolate the event
87  setEvent(event);
88 
89  // Trajectory container
90  TrajectoryContainer muonTrajectories;
92  // reconstruct the trajectory
94  for(seed = seeds->begin();
95  seed != seeds->end(); ++seed, ++nSeed){
96  LogTrace(metname)<<"+++ New Seed +++"<<endl;
97  TrajectoryContainer muonTrajs_temp = theTrajBuilder->trajectories(*seed);
98  for(TrajectoryContainer::iterator it = muonTrajs_temp.begin();
99  it != muonTrajs_temp.end(); ++it){
100  (*it)->setSeedRef(seeds->refAt(nSeed));
101  muonTrajectories.push_back(*it);
102  }
103  }
104 
105  // clean the clone traj
106  LogTrace(metname)<<"Clean the trajectories container"<<endl;
107  if(theTrajCleaner) theTrajCleaner->clean(muonTrajectories, event); //used by reference...
108 
109  // convert the trajectories into tracks and load them in to the event
110  LogTrace(metname)
111  <<"Convert the trajectories into tracks and load them in to the event"<<endl;
112  return load(muonTrajectories,event);
113 
114 }
115 
116 
117 // reconstruct trajectories
118 void MuonTrackFinder::reconstruct(const std::vector<TrackCand>& staCandColl,
119  Event& event){
120 
121  const string metname = "Muon|RecoMuon|MuonTrackFinder";
122 
123  // percolate the event
124  setEvent(event);
125 
126  // Muon Candidate container
127  CandidateContainer muonCandidates;
128 
129  // reconstruct the muon candidates
130  for (vector<TrackCand>::const_iterator staCand = staCandColl.begin(); staCand != staCandColl.end(); ++staCand) {
131  CandidateContainer muonCands_temp = theTrajBuilder->trajectories(*staCand);
132  muonCandidates.insert(muonCandidates.end(), muonCands_temp.begin(),muonCands_temp.end());
133  }
134 
135  // clean the cloned candidates
136  if(theTrajCleaner) theTrajCleaner->clean(muonCandidates);
137 
138  // convert the trajectories into staTracks and load them into the event
139  LogTrace(metname)<<"Load Muon Candidates into the event"<<endl;
140  load(muonCandidates,event);
141 
142 }
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:81
const std::string metname
uint16_t size_type
virtual TrajectoryContainer trajectories(const TrajectorySeed &)=0
return a container of the reconstructed trajectories compatible with a given seed ...
void setEvent(const edm::Event &)
percolate the Event Setup
virtual ~MuonTrackFinder()
destructor
virtual void setEvent(const edm::Event &event)=0
pass the Event to the algo at each event
void clean(TrajectoryContainer &muonTrajectories, edm::Event &evt)
Clean the trajectories container, erasing the (worst) clone trajectory.
MuonTrackFinder(MuonTrajectoryBuilder *ConcreteMuonTrajectoryBuilder, MuonTrackLoader *trackLoader)
Constructor, with default cleaner. For the STA reconstruction the trackLoader must have the propagato...
MuonTrackLoader * theTrackLoader
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)
MuonCandidate::TrajectoryContainer TrajectoryContainer
edm::OrphanHandle< reco::TrackCollection > loadTracks(const TrajectoryContainer &, edm::Event &, const std::string &="", bool=true)
Convert the trajectories into tracks and load the tracks in the event.
edm::OrphanHandle< reco::TrackCollection > load(const TrajectoryContainer &, edm::Event &)
convert the trajectories into tracks and load them in to the event
MuonTrajectoryBuilder * theTrajBuilder
MuonTrajectoryCleaner * theTrajCleaner
const_iterator begin() const
const_iterator end() const
edm::OrphanHandle< reco::TrackCollection > reconstruct(const edm::Handle< edm::View< TrajectorySeed > > &, edm::Event &)
reconstruct standalone tracks starting from a collection of seeds
MuonCandidate::CandidateContainer CandidateContainer