CMS 3D CMS Logo

MuonOverlapSeedFromRecHits.cc
Go to the documentation of this file.
11 #include <iomanip>
12 
13 
16 {
17 }
18 
19 
20 
21 
22 std::vector<TrajectorySeed> MuonOverlapSeedFromRecHits::seeds() const
23 {
24  std::vector<TrajectorySeed> result;
25  //@@ doesn't handle overlap between ME11 and ME12 correctly
26  // sort by station
28  for ( MuonRecHitContainer::const_iterator iter = theRhits.begin(), end = theRhits.end();
29  iter != end; ++iter)
30  {
31  if((*iter)->isDT())
32  {
33  DTChamberId dtId((**iter).geographicalId().rawId());
34  // try not doing seeds that start in DT station 2, if there'as a good single segment seed
35  if(dtId.station() == 1 || (dtId.station()==2 && (*iter)->dimension() == 2))
36  {
37  barrelHits.push_back(*iter);
38  }
39  }
40  else
41  {
42  endcapHits.push_back(*iter);
43  }
44  }
45 
46  ConstMuonRecHitPointer bestSegment = bestHit(barrelHits, endcapHits);
47  for ( MuonRecHitContainer::const_iterator barrelHitItr = barrelHits.begin(),
48  lastBarrelHit = barrelHits.end();
49  barrelHitItr != lastBarrelHit; ++barrelHitItr)
50  {
51  for ( MuonRecHitContainer::const_iterator endcapHitItr = endcapHits.begin(),
52  lastEndcapHit = endcapHits.end();
53  endcapHitItr != lastEndcapHit; ++endcapHitItr)
54  {
56  bool good = makeSeed(*barrelHitItr, *endcapHitItr, bestSegment, seed);
57  if(good) result.push_back(seed);
58  // try just one seed
59  return result;
60  }
61  }
62 
63  //std::cout << "Overlap hits " << barrelHits.size() << " "
64  // << endcapHits.size() << std::endl;
65 
66  return result;
67 }
68 
69 
70 
71 bool
75  TrajectorySeed & result) const
76 {
77  std::vector<double> pts = thePtExtractor->pT_extract(barrelHit, endcapHit);
78  double minpt = 3.;
79  double pt = pts[0];
80  double sigmapt = pts[1];
81  // if too small, probably an error. Keep trying.
82  if(pt != 0) {
83  if(fabs(pt) > minpt)
84  {
85  double maxpt = 2000.;
86  if(pt > maxpt) {
87  pt = maxpt;
88  sigmapt = maxpt;
89  }
90  if(pt < -maxpt) {
91  pt = -maxpt;
92  sigmapt = maxpt;
93  }
94  }
95 
96  result = createSeed(pt, sigmapt, bestSegment);
97  //std::cout << "OVERLAPFITTED PT " << pt << " dphi " << dphi << " eta " << eta << std::endl;
98  return true;
99  }
100  return false;
101 }
102 
107 {
108  MuonDTSeedFromRecHits dtSeeder;
109  MuonCSCSeedFromRecHits cscSeeder;
110 
112  if(barrelHits.size() > endcapHits.size())
113  {
114  result = dtSeeder.bestBarrelHit(barrelHits);
115  if (result->dimension() == 2) result = cscSeeder.bestEndcapHit(endcapHits);
116  }
117  else
118  {
119  result = cscSeeder.bestEndcapHit(endcapHits);
120  }
121  return result;
122 }
123 
124 
125 
126 
ConstMuonRecHitPointer bestBarrelHit(const MuonRecHitContainer &barrelHits) const
MuonTransientTrackingRecHit::MuonRecHitContainer theRhits
MuonTransientTrackingRecHit::MuonRecHitContainer MuonRecHitContainer
MuonTransientTrackingRecHit::ConstMuonRecHitPointer ConstMuonRecHitPointer
const MuonSeedPtExtractor * thePtExtractor
static const double pts[33]
Definition: Constants.h:30
ConstMuonRecHitPointer bestEndcapHit(const MuonRecHitContainer &endcapHits) const
bool makeSeed(MuonTransientTrackingRecHit::ConstMuonRecHitPointer barrelHit, MuonTransientTrackingRecHit::ConstMuonRecHitPointer endcapHit, MuonTransientTrackingRecHit::ConstMuonRecHitPointer bestSegment, TrajectorySeed &result) const
#define end
Definition: vmac.h:39
TrajectorySeed createSeed(float ptmean, float sptmean, MuonTransientTrackingRecHit::ConstMuonRecHitPointer last) const
std::shared_ptr< MuonTransientTrackingRecHit const > ConstMuonRecHitPointer
std::vector< TrajectorySeed > seeds() const
virtual std::vector< double > pT_extract(MuonTransientTrackingRecHit::ConstMuonRecHitPointer firstHit, MuonTransientTrackingRecHit::ConstMuonRecHitPointer secondHit) const
ConstMuonRecHitPointer bestHit(const MuonRecHitContainer &barrelHits, const MuonRecHitContainer &endcapHits) const
std::vector< MuonRecHitPointer > MuonRecHitContainer