CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
MuonTransientTrackingRecHitBreaker.cc
Go to the documentation of this file.
2 
4 
6  TransientTrackingRecHit::ConstRecHitPointer muonRecHit, int granularity) {
7  const std::string metname = "Muon|RecoMuon|MuonTransientTrackingRecHitBreaker";
8 
10 
11  int subDet = muonRecHit->geographicalId().subdetId();
12 
13  switch (granularity) {
14  case 0: {
15  // Asking for 4D segments for the CSC/DT and a point for the RPC
16  recHitsForFit.push_back(muonRecHit);
17  break;
18  }
19  case 1: {
20  if (subDet == MuonSubdetId::DT || subDet == MuonSubdetId::CSC)
21  // measurement->recHit() returns a 4D segment, then
22  // DT case: asking for 2D segments.
23  // CSC case: asking for 2D points.
24  recHitsForFit = muonRecHit->transientHits();
25 
26  else if (subDet == MuonSubdetId::RPC)
27  recHitsForFit.push_back(muonRecHit);
28 
29  break;
30  }
31 
32  case 2: {
33  if (subDet == MuonSubdetId::DT) {
34  // Asking for 2D segments. measurement->recHit() returns a 4D segment
35  TransientTrackingRecHit::ConstRecHitContainer segments2D = muonRecHit->transientHits();
36 
37  // loop over segment
38  for (TransientTrackingRecHit::ConstRecHitContainer::const_iterator segment = segments2D.begin();
39  segment != segments2D.end();
40  ++segment) {
41  // asking for 1D Rec Hit
42  TransientTrackingRecHit::ConstRecHitContainer rechit1D = (**segment).transientHits();
43 
44  // load them into the recHitsForFit container
45  copy(rechit1D.begin(), rechit1D.end(), back_inserter(recHitsForFit));
46  }
47  }
48 
49  else if (subDet == MuonSubdetId::RPC)
50  recHitsForFit.push_back(muonRecHit);
51 
52  else if (subDet == MuonSubdetId::CSC)
53  // Asking for 2D points. measurement->recHit() returns a 4D segment
54  recHitsForFit = (*muonRecHit).transientHits();
55 
56  break;
57  }
58 
59  default: {
60  throw cms::Exception(metname) << "Wrong granularity chosen!"
61  << "it will be set to 0";
62  break;
63  }
64  }
65 
66  return recHitsForFit;
67 }
const std::string metname
static TransientTrackingRecHit::ConstRecHitContainer breakInSubRecHits(TransientTrackingRecHit::ConstRecHitPointer, int granularity)
takes a muon rechit and returns its sub-rechits given a certain granularity
std::shared_ptr< TrackingRecHit const > ConstRecHitPointer
std::vector< ConstRecHitPointer > ConstRecHitContainer
static constexpr int RPC
Definition: MuonSubdetId.h:13
static constexpr int DT
Definition: MuonSubdetId.h:11
static constexpr int CSC
Definition: MuonSubdetId.h:12