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.;
89  } else if (p1 == GeomDetEnumerators::endcap && p2 == GeomDetEnumerators::endcap) {
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 }
PropagationDirection direction() const
const GlobalTrajectoryParameters & parameters() const
std::vector< ForwardDetLayer const * > const & posPixelForwardLayers() const
const std::vector< const ForwardDetLayer * > firstPosPixelFwdLayer() const
virtual Location location() const =0
Which part of the detector (barrel, endcap)
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
const BarrelDetLayer * firstPixelBarrelLayer() const
std::pair< float, float > Range
std::vector< ForwardDetLayer const * > const & negPixelForwardLayers() const
FreeTrajectoryState const * freeTrajectoryState(bool withErrors=true) const
bool rangesIntersect(const Range &a, const Range &b)
unsigned int detId() const
std::vector< BarrelDetLayer const * > const & pixelBarrelLayers() const
double p2[4]
Definition: TauolaWrapper.h:90
Definition: DetId.h:17
PTrajectoryStateOnDet const & startingState() const
TrajectoryStateOnSurface transientState(const PTrajectoryStateOnDet &ts, const Surface *surface, const MagneticField *field)
range recHits() const
void checkPixelLayers() const
unsigned int nHits() const
double p1[4]
Definition: TauolaWrapper.h:89
static int position[264][3]
Definition: ReadPGInfo.cc:289
std::vector< const DetLayer * > startingLayers(const FTS &aFts, float dr, float dz) const
DetId geographicalId() const
const std::vector< const ForwardDetLayer * > firstNegPixelFwdLayer() const