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 
11 
16 
21 
24 
25 using namespace std;
26 using namespace edm;
27 
28 // Constructor, with default cleaner. For the STA reconstruction the trackLoader must have the propagator.
30  MuonTrackLoader *trackLoader) :
31  theTrajBuilder(ConcreteMuonTrajectoryBuilder),
32  theTrajCleaner(new MuonTrajectoryCleaner()),
33  theTrackLoader(trackLoader) {
34 }
35 
36 // Constructor, with user-defined cleaner. For the STA reconstruction the trackLoader must have the propagator.
38  MuonTrackLoader *trackLoader,
39  MuonTrajectoryCleaner* cleaner) :
40  theTrajBuilder(ConcreteMuonTrajectoryBuilder),
41  theTrajCleaner(cleaner),
42  theTrackLoader(trackLoader) {
43 }
44 
45 // destructor
47 
48  LogTrace("Muon|RecoMuon|MuonTrackFinder")<<"MuonTrackFinder destructor called"<<endl;
49  delete theTrajBuilder;
50  delete theTrajCleaner;
51  delete theTrackLoader;
52 
53 }
54 
55 // percolate the event setup
57  theTrajBuilder->setEvent(event);
58 }
59 
60 // convert the trajectories into tracks and load them in to the event
63  edm::Event& event) {
64 
65  return theTrackLoader->loadTracks(trajectories, event);
66 }
67 
68 // convert the trajectories into tracks and load them in to the event
70  Event& event) {
71 
72  theTrackLoader->loadTracks(muonCands, event);
73 
74 }
75 
76 // reconstruct trajectories
79  edm::Event& event){
80 
81  const string metname = "Muon|RecoMuon|MuonTrackFinder";
82  LogTrace(metname)<<"SA Recostruction starting from: "<<seeds->size()<<endl;
83 
84  // Percolate the event
85  setEvent(event);
86 
87  // Trajectory container
88  TrajectoryContainer muonTrajectories;
90  // reconstruct the trajectory
92  for(seed = seeds->begin();
93  seed != seeds->end(); ++seed, ++nSeed){
94  LogTrace(metname)<<"+++ New Seed +++"<<endl;
95  TrajectoryContainer muonTrajs_temp = theTrajBuilder->trajectories(*seed);
96  for(TrajectoryContainer::iterator it = muonTrajs_temp.begin();
97  it != muonTrajs_temp.end(); ++it){
98  (*it)->setSeedRef(seeds->refAt(nSeed));
99  muonTrajectories.push_back(*it);
100  }
101  }
102 
103  // clean the clone traj
104  LogTrace(metname)<<"Clean the trajectories container"<<endl;
105  if(theTrajCleaner) theTrajCleaner->clean(muonTrajectories, event); //used by reference...
106 
107  // convert the trajectories into tracks and load them in to the event
108  LogTrace(metname)
109  <<"Convert the trajectories into tracks and load them in to the event"<<endl;
110  return load(muonTrajectories,event);
111 
112 }
113 
114 
115 // reconstruct trajectories
116 void MuonTrackFinder::reconstruct(const std::vector<TrackCand>& staCandColl,
117  Event& event){
118 
119  const string metname = "Muon|RecoMuon|MuonTrackFinder";
120 
121  // percolate the event
122  setEvent(event);
123 
124  // Muon Candidate container
125  CandidateContainer muonCandidates;
126 
127  // reconstruct the muon candidates
128  for (vector<TrackCand>::const_iterator staCand = staCandColl.begin(); staCand != staCandColl.end(); ++staCand) {
129  CandidateContainer muonCands_temp = theTrajBuilder->trajectories(*staCand);
130  muonCandidates.insert(muonCandidates.end(), muonCands_temp.begin(),muonCands_temp.end());
131  }
132 
133  // clean the cloned candidates
134  if(theTrajCleaner) theTrajCleaner->clean(muonCandidates);
135 
136  // convert the trajectories into staTracks and load them into the event
137  LogTrace(metname)<<"Load Muon Candidates into the event"<<endl;
138  load(muonCandidates,event);
139 
140 }
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