CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ExhaustiveMuonTrajectoryBuilder.cc
Go to the documentation of this file.
5 
6 
8  const MuonServiceProxy* proxy)
9 : theTrajBuilder(pset, proxy),
10  theSeeder(),
11  theService(proxy)
12 {
13 }
14 
15 
17 
18 
21 {
22  LocalTrajectoryParameters localTrajectoryParameters(seed.startingState().parameters());
23  LocalVector p(localTrajectoryParameters.momentum());
24  int rawId = seed.startingState().detId();
25  DetId detId(rawId);
26  bool isBarrel = (detId.subdetId() == 1);
27  // homemade local-to-global
28  double pt = (isBarrel) ? -p.z() : p.perp();
29  pt *= localTrajectoryParameters.charge();
30  float err00 = seed.startingState().error(0);
31  // float p_err = sqr(sptmean/(ptmean*ptmean));
32  // mat[0][0]= p_err;
33  float sigmapt = sqrt(err00)*pt*pt;
34  TrajectorySeed::range range = seed.recHits();
36  // Make a new seed based on each segment, using the original pt and sigmapt
37  for(TrajectorySeed::const_iterator recHitItr = range.first;
38  recHitItr != range.second; ++recHitItr)
39  {
40  const GeomDet * geomDet = theService->trackingGeometry()->idToDet((*recHitItr).geographicalId());
42  = MuonTransientTrackingRecHit::specificBuild(geomDet,&*recHitItr);
43  TrajectorySeed tmpSeed(theSeeder.createSeed(pt, sigmapt, muonRecHit));
45  result.insert(result.end(), trajectories.begin(), trajectories.end());
46  }
47  // choose the best trajectory
48  if(!result.empty()) clean(result);
49  return result;
50 }
51 
52 
55 {
56  return CandidateContainer();
57 }
58 
59 
60 
62 {
63  theTrajBuilder.setEvent(event);
64 }
65 
66 
68 {
69  // choose the one with the most hits, and the smallest chi-squared
70  int best_nhits = 0;
71  unsigned best = 0;
72  unsigned ntraj = trajectories.size();
73  for(unsigned i = 0; i < ntraj; ++i)
74  {
75  int nhits = trajectories[i]->foundHits();
76  if(nhits > best_nhits)
77  {
78  best_nhits = nhits;
79  best = i;
80  }
81  else if(nhits == best_nhits && trajectories[i]->chiSquared() < trajectories[best]->chiSquared())
82  {
83  best = i;
84  }
85  }
87  for(unsigned i = 0; i < ntraj; ++i)
88  {
89  if(i == best) {
90  result.push_back(trajectories[best]);
91  } else {
92  delete trajectories[i];
93  }
94  }
95  trajectories.swap(result);
96 }
97 
MuonCandidate::CandidateContainer CandidateContainer
int i
Definition: DBlmapReader.cc:9
std::pair< const Trajectory *, reco::TrackRef > TrackCand
virtual void setEvent(const edm::Event &event)
pass the Event to the algo at each event
StandAloneMuonTrajectoryBuilder theTrajBuilder
MuonCandidate::TrajectoryContainer TrajectoryContainer
ExhaustiveMuonTrajectoryBuilder(const edm::ParameterSet &pset, const MuonServiceProxy *)
virtual void setEvent(const edm::Event &event)
Pass the Event to the algo at each event.
recHitContainer::const_iterator const_iterator
T sqrt(T t)
Definition: SSEVec.h:48
tuple result
Definition: query.py:137
std::pair< const_iterator, const_iterator > range
unsigned int detId() const
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
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:39
Definition: DetId.h:20
PTrajectoryStateOnDet const & startingState() const
range recHits() const
edm::ESHandle< GlobalTrackingGeometry > trackingGeometry() const
get the tracking geometry
void clean(TrajectoryContainer &trajectories) const
TrajectoryContainer trajectories(const TrajectorySeed &)
return a container of the reconstructed trajectories compatible with a given seed ...
TrajectorySeed createSeed(float ptmean, float sptmean, MuonTransientTrackingRecHit::ConstMuonRecHitPointer last) const
static MuonRecHitPointer specificBuild(const GeomDet *geom, const TrackingRecHit *rh)
virtual TrajectoryContainer trajectories(const TrajectorySeed &)
return a container of the reconstructed trajectories compatible with a given seed ...
const LocalTrajectoryParameters & parameters() const