CMS 3D CMS Logo

PixelMatchNextLayers.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: EgammaElectronAlgos
4 // Class: PixelMatchNextLayers
5 //
13 //
14 // Original Author: Ursula Berthon, Claude Charlot
15 // Created: Mon Mar 27 13:22:06 CEST 2006
16 //
17 //
18 
24 
27 
28 #include <iostream>
29 #include <algorithm>
30 
31 
32 PixelMatchNextLayers::PixelMatchNextLayers(const LayerMeasurements * theLayerMeasurements,const DetLayer* ilayer,
33  FreeTrajectoryState & aFTS,
34  const PropagatorWithMaterial *aProp,
35  const BarrelMeasurementEstimator *aBarrelMeas,
36  const ForwardMeasurementEstimator *aForwardMeas,
37  const TrackerTopology *tTopo,
38  const NavigationSchool& navigationSchool,
39  bool searchInTIDTEC)
40  {
41 
42  typedef std::vector<TrajectoryMeasurement>::const_iterator aMeas;
43  std::vector<const DetLayer*> allayers;
44  std::vector<const DetLayer*> nl = navigationSchool.nextLayers(*ilayer, aFTS, alongMomentum);
45  for (std::vector<const DetLayer*>::const_iterator il = nl.begin(); il != nl.end(); il++) {
46  allayers.push_back(*il);
47  std::vector<const DetLayer*> n2l = navigationSchool.nextLayers(**il, aFTS, alongMomentum);
48  for (std::vector<const DetLayer*>::const_iterator i2l = n2l.begin(); i2l != n2l.end(); i2l++) {
49  allayers.push_back(*i2l);
50  }
51  }
52 
53  const TrajectoryStateOnSurface tsos(aFTS,ilayer->surface());
54 
55  if (tsos.isValid())
56  {
57  for (std::vector<const DetLayer*>::const_iterator il = allayers.begin(); il != allayers.end(); il++)
58  {
59  if ( GeomDetEnumerators::isTrackerPixel((*il)->subDetector()) ) {
60 
61  std::vector<TrajectoryMeasurement> pixelMeasurements;
62  if (GeomDetEnumerators::isBarrel((*il)->subDetector())) {
63  pixelMeasurements = theLayerMeasurements->measurements( **il, tsos , *aProp, *aBarrelMeas);
64  } else {
65  pixelMeasurements = theLayerMeasurements->measurements( **il, tsos, *aProp, *aForwardMeas);
66  }
67  for (aMeas m=pixelMeasurements.begin(); m!=pixelMeasurements.end(); m++){
68  if (m == pixelMeasurements.begin()){
69  CLHEP::Hep3Vector prediction(m->forwardPredictedState().globalPosition().x(),
70  m->forwardPredictedState().globalPosition().y(),
71  m->forwardPredictedState().globalPosition().z());
72  predictionHere.push_back( prediction);
73  }
74  if (m->recHit()->isValid()) {
75  measurementsHere.push_back( *m);
76  hitsHere.push_back( m->recHit());
77 
78  //std::cout<<"\n SH B-D "<<std::endl;
79 
80  } else {
81  badMeasurementsHere.push_back( *m);
82  }
83  }
84  }
85  if (searchInTIDTEC) {
86  //additional search in the TID layers
87  if ( ((*il)->subDetector())==GeomDetEnumerators::TID && (ilayer->location()) == GeomDetEnumerators::endcap)
88  {
89  std::vector<TrajectoryMeasurement> pixelMeasurements;
90  pixelMeasurements = theLayerMeasurements->measurements( (**il), tsos , *aProp, *aForwardMeas);
91 
92  for (aMeas m=pixelMeasurements.begin(); m!=pixelMeasurements.end(); m++)
93  {
94  // limit search in first ring
95  if (tTopo->tidRing(m->recHit()->geographicalId()) > 1) continue;
96  if (m == pixelMeasurements.begin())
97  {
98  CLHEP::Hep3Vector prediction(m->forwardPredictedState().globalPosition().x(),
99  m->forwardPredictedState().globalPosition().y(),
100  m->forwardPredictedState().globalPosition().z());
101  predictionHere.push_back( prediction);
102  }
103  if (m->recHit()->isValid())
104  {
105  measurementsHere.push_back( *m);
106  hitsHere.push_back(m->recHit());
107  }
108  // else{ std::cout<<" 2H not valid "<<std::endl;}
109  }
110  } //end of TID search
111 
112  //additional search in the TEC layers
113  if ( ((*il)->subDetector())==GeomDetEnumerators::TEC && (ilayer->location()) == GeomDetEnumerators::endcap)
114  {
115  std::vector<TrajectoryMeasurement> pixelMeasurements;
116  pixelMeasurements = theLayerMeasurements->measurements( (**il), tsos , *aProp, *aForwardMeas);
117 
118  for (aMeas m=pixelMeasurements.begin(); m!=pixelMeasurements.end(); m++)
119  {
120  // limit search in first ring and first third wheels
121  if (tTopo->tecRing(m->recHit()->geographicalId()) > 1) continue;
122  if (tTopo->tecWheel(m->recHit()->geographicalId()) > 3) continue;
123  if (m == pixelMeasurements.begin())
124  {
125  CLHEP::Hep3Vector prediction(m->forwardPredictedState().globalPosition().x(),
126  m->forwardPredictedState().globalPosition().y(),
127  m->forwardPredictedState().globalPosition().z());
128  predictionHere.push_back( prediction);
129  }
130  if (m->recHit()->isValid())
131  {
132  measurementsHere.push_back( *m);
133  hitsHere.push_back(m->recHit());
134 
135  //std::cout<<"\n SH TEC "<<std::endl;
136 
137  }
138  // else{ std::cout<<" 2H not valid "<<std::endl;}
139  }
140  } //end of TEC search
141  }
142  }
143  }
144 }
145 
146 
147 std::vector<TrajectoryMeasurement> PixelMatchNextLayers::measurementsInNextLayers() const {
148 
149  return measurementsHere;
150 }
151 
152 std::vector<TrajectoryMeasurement> PixelMatchNextLayers::badMeasurementsInNextLayers() const {
153 
154  return badMeasurementsHere;
155 }
156 
158 
159  return hitsHere;
160 }
161 
162 std::vector<CLHEP::Hep3Vector> PixelMatchNextLayers::predictionInNextLayers() const {
163 
164  return predictionHere;
165 }
166 
167 
168 
169 
170 
171 
172 
173 
174 
175 
std::vector< TrajectoryMeasurement > measurements(const DetLayer &layer, const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est) const
PixelMatchNextLayers(const LayerMeasurements *theLayerMeasurements, const DetLayer *ilayer, FreeTrajectoryState &aFTS, const PropagatorWithMaterial *aProp, const BarrelMeasurementEstimator *aBarrelMeas, const ForwardMeasurementEstimator *aForwardMeas, const TrackerTopology *tTopo, const NavigationSchool &navigationSchool, bool searchInTIDTEC)
unsigned int tidRing(const DetId &id) const
std::vector< TrajectoryMeasurement > measurementsHere
std::vector< TrajectoryMeasurement > badMeasurementsInNextLayers() const
unsigned int tecRing(const DetId &id) const
ring id
bool isBarrel(GeomDetEnumerators::SubDetector m)
virtual Location location() const =0
Which part of the detector (barrel, endcap)
TransientTrackingRecHit::RecHitContainer hitsHere
std::vector< CLHEP::Hep3Vector > predictionInNextLayers() const
std::vector< ConstRecHitPointer > RecHitContainer
virtual const BoundSurface & surface() const =0
The surface of the GeometricSearchDet.
TransientTrackingRecHit::RecHitContainer hitsInNextLayers() const
std::vector< TrajectoryMeasurement > badMeasurementsHere
std::vector< TrajectoryMeasurement > measurementsInNextLayers() const
std::vector< const DetLayer * > nextLayers(const DetLayer &detLayer, Args &&...args) const
NavigationDirection.
bool isTrackerPixel(const GeomDetEnumerators::SubDetector m)
unsigned int tecWheel(const DetId &id) const
std::vector< CLHEP::Hep3Vector > predictionHere