CMS 3D CMS Logo

StartingLayerFinder.cc
Go to the documentation of this file.
2 
10 
13 
14 #include <utility>
15 
16 using namespace std;
17 
18 vector<const DetLayer*> StartingLayerFinder::startingLayers(const FTS& aFts, float dr, float dz) const {
19  vector<const DetLayer*> mylayers;
20  mylayers.reserve(3);
21 
22  FTS fastFts(aFts.parameters());
23 
24  //barrel pixel
25  TSOS pTsos = propagator()->propagate(fastFts, firstPixelBarrelLayer()->surface());
26 
27  if (pTsos.isValid()) {
28  Range barrZRange(
29  firstPixelBarrelLayer()->position().z() - 0.5 * (firstPixelBarrelLayer()->surface().bounds().length()),
30  firstPixelBarrelLayer()->position().z() + 0.5 * (firstPixelBarrelLayer()->surface().bounds().length()));
31  Range trajZRange(pTsos.globalPosition().z() - dz, pTsos.globalPosition().z() + dz);
32 
33  if (rangesIntersect(trajZRange, barrZRange)) {
34  mylayers.push_back(firstPixelBarrelLayer());
35  }
36  }
37 
38  //negative fwd pixel
39 
40  for (auto infwd : firstPosPixelFwdLayer()) {
41  pTsos = propagator()->propagate(fastFts, infwd->surface());
42  if (pTsos.isValid()) {
43  Range nfwdRRange(infwd->specificSurface().innerRadius(), infwd->specificSurface().outerRadius());
44  Range trajRRange(pTsos.globalPosition().perp() - dr, pTsos.globalPosition().perp() + dr);
45  if (rangesIntersect(trajRRange, nfwdRRange)) {
46  mylayers.push_back(infwd);
47  }
48  }
49  }
50 
51  //positive fwd pixel
52  for (auto ipfwd : firstPosPixelFwdLayer()) {
53  pTsos = propagator()->propagate(fastFts, ipfwd->surface());
54  if (pTsos.isValid()) {
55  Range pfwdRRange(ipfwd->specificSurface().innerRadius(), ipfwd->specificSurface().outerRadius());
56  Range trajRRange(pTsos.globalPosition().perp() - dr, pTsos.globalPosition().perp() + dr);
57  if (rangesIntersect(trajRRange, pfwdRRange)) {
58  mylayers.push_back(ipfwd);
59  }
60  }
61  }
62 
63  return mylayers;
64 }
65 
66 vector<const DetLayer*> StartingLayerFinder::startingLayers(const TrajectorySeed& aSeed) const {
67  float dr = 0., dz = 0.;
68 
69  if (propagator()->propagationDirection() != aSeed.direction())
70  return vector<const DetLayer*>();
71 
72  if (aSeed.nHits() != 2)
73  return vector<const DetLayer*>();
74 
75  TrackingRecHitCollection::const_iterator firstHit = aSeed.recHits().first;
76  const TrackingRecHit* recHit1 = &(*firstHit);
77  const DetLayer* hit1Layer = theMeasurementTracker->geometricSearchTracker()->detLayer(recHit1->geographicalId());
78 
79  TrackingRecHitCollection::const_iterator secondHit = aSeed.recHits().second;
80  const TrackingRecHit* recHit2 = &(*secondHit);
81  const DetLayer* hit2Layer = theMeasurementTracker->geometricSearchTracker()->detLayer(recHit2->geographicalId());
82 
85 
87  dr = 0.1;
88  dz = 5.;
90  dr = 5.;
91  dz = 0.1;
92  } else {
93  dr = 0.1;
94  dz = 0.1;
95  }
96 
97  const GeomDet* gdet = theMeasurementTracker->geomTracker()->idToDet(DetId(aSeed.startingState().detId()));
98 
100  aSeed.startingState(), &(gdet->surface()), thePropagator->magneticField());
101 
102  const FreeTrajectoryState* fts = tsos.freeTrajectoryState();
103 
104  return startingLayers(*fts, dr, dz);
105 }
106 
108  checkPixelLayers();
109  return theFirstPixelBarrelLayer;
110 }
111 
112 const vector<const ForwardDetLayer*> StartingLayerFinder::firstNegPixelFwdLayer() const {
113  checkPixelLayers();
114  return theFirstNegPixelFwdLayer;
115 }
116 
117 const vector<const ForwardDetLayer*> StartingLayerFinder::firstPosPixelFwdLayer() const {
118  checkPixelLayers();
119  return theFirstPosPixelFwdLayer;
120 }
121 
123  if (!thePixelLayersValid) {
124  const GeometricSearchTracker* theGeometricSearchTracker = theMeasurementTracker->geometricSearchTracker();
125 
126  theFirstPixelBarrelLayer = theGeometricSearchTracker->pixelBarrelLayers().front();
127  theFirstNegPixelFwdLayer = theGeometricSearchTracker->negPixelForwardLayers();
128  theFirstPosPixelFwdLayer = theGeometricSearchTracker->posPixelForwardLayers();
129  thePixelLayersValid = true;
130  }
131 }
TrajectoryStateOnSurface.h
TrajectoryStateOnSurface::freeTrajectoryState
FreeTrajectoryState const * freeTrajectoryState(bool withErrors=true) const
Definition: TrajectoryStateOnSurface.h:60
PixelSubdetector.h
GeomDet
Definition: GeomDet.h:27
DetLayer
Definition: DetLayer.h:21
TrajectorySeed::nHits
unsigned int nHits() const
Definition: TrajectorySeed.h:53
StartingLayerFinder::firstNegPixelFwdLayer
const std::vector< const ForwardDetLayer * > firstNegPixelFwdLayer() const
Definition: StartingLayerFinder.cc:112
TrackingRecHitFwd.h
TrackingRecHit::geographicalId
DetId geographicalId() const
Definition: TrackingRecHit.h:120
GeomDetEnumerators::barrel
Definition: GeomDetEnumerators.h:9
DetId
Definition: DetId.h:17
DetLayer::location
virtual Location location() const =0
Which part of the detector (barrel, endcap)
GeomDet::surface
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
TrajectoryStateOnSurface
Definition: TrajectoryStateOnSurface.h:16
TrackingRecHit.h
PTrajectoryStateOnDet::detId
unsigned int detId() const
Definition: PTrajectoryStateOnDet.h:65
TrackCandidateProducer_cfi.propagator
propagator
Definition: TrackCandidateProducer_cfi.py:17
PTrajectoryStateOnDet.h
p2
double p2[4]
Definition: TauolaWrapper.h:90
StartingLayerFinder::Range
std::pair< float, float > Range
Definition: StartingLayerFinder.h:31
TrajectorySeed.h
TrajectorySeed::direction
PropagationDirection direction() const
Definition: TrajectorySeed.h:54
GeometricSearchTracker::posPixelForwardLayers
std::vector< ForwardDetLayer const * > const & posPixelForwardLayers() const
Definition: GeometricSearchTracker.h:45
GeomDetEnumerators::endcap
Definition: GeomDetEnumerators.h:9
StartingLayerFinder::firstPixelBarrelLayer
const BarrelDetLayer * firstPixelBarrelLayer() const
Definition: StartingLayerFinder.cc:107
position
static int position[264][3]
Definition: ReadPGInfo.cc:289
FreeTrajectoryState::parameters
const GlobalTrajectoryParameters & parameters() const
Definition: FreeTrajectoryState.h:79
trajectoryStateTransform::transientState
TrajectoryStateOnSurface transientState(const PTrajectoryStateOnDet &ts, const Surface *surface, const MagneticField *field)
Definition: TrajectoryStateTransform.cc:35
p1
double p1[4]
Definition: TauolaWrapper.h:89
StartingLayerFinder::firstPosPixelFwdLayer
const std::vector< const ForwardDetLayer * > firstPosPixelFwdLayer() const
Definition: StartingLayerFinder.cc:117
BarrelDetLayer
Definition: BarrelDetLayer.h:22
TrackingRecHit
Definition: TrackingRecHit.h:21
GeomDetEnumerators::Location
Location
Definition: GeomDetEnumerators.h:9
std
Definition: JetResolutionObject.h:76
FreeTrajectoryState
Definition: FreeTrajectoryState.h:27
GeometricSearchTracker::negPixelForwardLayers
std::vector< ForwardDetLayer const * > const & negPixelForwardLayers() const
Definition: GeometricSearchTracker.h:41
DetId.h
PVValHelper::dz
Definition: PVValidationHelpers.h:50
flavorHistoryFilter_cfi.dr
dr
Definition: flavorHistoryFilter_cfi.py:37
GeometricSearchTracker
Definition: GeometricSearchTracker.h:14
rangesIntersect
bool rangesIntersect(const Range &a, const Range &b)
Definition: rangesIntersect.h:14
TrajectorySeed::recHits
range recHits() const
Definition: TrajectorySeed.h:52
TrajectorySeed
Definition: TrajectorySeed.h:17
TrajectoryStateTransform.h
TrajectorySeed::startingState
PTrajectoryStateOnDet const & startingState() const
Definition: TrajectorySeed.h:55
StartingLayerFinder::checkPixelLayers
void checkPixelLayers() const
Definition: StartingLayerFinder.cc:122
StripSubdetector.h
StartingLayerFinder::startingLayers
std::vector< const DetLayer * > startingLayers(const FTS &aFts, float dr, float dz) const
Definition: StartingLayerFinder.cc:18
StartingLayerFinder.h
GeometricSearchTracker::pixelBarrelLayers
std::vector< BarrelDetLayer const * > const & pixelBarrelLayers() const
Definition: GeometricSearchTracker.h:37