CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 // $Id: PixelMatchNextLayers.cc,v 1.17 2011/04/08 08:54:09 innocent Exp $
17 //
18 //
19 
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  bool searchInTIDTEC)
38  {
39 
40  typedef std::vector<TrajectoryMeasurement>::const_iterator aMeas;
41  std::vector<const DetLayer*> allayers;
42  std::vector<const DetLayer*> nl = ilayer->nextLayers( aFTS, alongMomentum);
43  for (std::vector<const DetLayer*>::const_iterator il = nl.begin(); il != nl.end(); il++) {
44  allayers.push_back(*il);
45  std::vector<const DetLayer*> n2l = (*il)->nextLayers( aFTS, alongMomentum);
46  for (std::vector<const DetLayer*>::const_iterator i2l = n2l.begin(); i2l != n2l.end(); i2l++) {
47  allayers.push_back(*i2l);
48  }
49  }
50 
51  const TrajectoryStateOnSurface tsos(aFTS,ilayer->surface());
52 
53  if (tsos.isValid())
54  {
55  for (std::vector<const DetLayer*>::const_iterator il = allayers.begin(); il != allayers.end(); il++)
56  {
57  if ( (*il)->subDetector()==GeomDetEnumerators::PixelBarrel || (*il)->subDetector()==GeomDetEnumerators::PixelEndcap ) {
58 
59  std::vector<TrajectoryMeasurement> pixelMeasurements;
60  if ((*il)->subDetector()==GeomDetEnumerators::PixelBarrel) {
61  pixelMeasurements = theLayerMeasurements->measurements( **il, tsos , *aProp, *aBarrelMeas);
62  } else {
63  pixelMeasurements = theLayerMeasurements->measurements( **il, tsos, *aProp, *aForwardMeas);
64  }
65  for (aMeas m=pixelMeasurements.begin(); m!=pixelMeasurements.end(); m++){
66  if (m == pixelMeasurements.begin()){
67  CLHEP::Hep3Vector prediction(m->forwardPredictedState().globalPosition().x(),
68  m->forwardPredictedState().globalPosition().y(),
69  m->forwardPredictedState().globalPosition().z());
70  predictionHere.push_back( prediction);
71  }
72  if (m->recHit()->isValid()) {
73  measurementsHere.push_back( *m);
74  hitsHere.push_back( m->recHit());
75 
76  //std::cout<<"\n SH B-D "<<std::endl;
77 
78  } else {
79  badMeasurementsHere.push_back( *m);
80  }
81  }
82  }
83  if (searchInTIDTEC) {
84  //additional search in the TID layers
85  if ( ((*il)->subDetector())==GeomDetEnumerators::TID && (ilayer->location()) == GeomDetEnumerators::endcap)
86  {
87  std::vector<TrajectoryMeasurement> pixelMeasurements;
88  pixelMeasurements = theLayerMeasurements->measurements( (**il), tsos , *aProp, *aForwardMeas);
89 
90  for (aMeas m=pixelMeasurements.begin(); m!=pixelMeasurements.end(); m++)
91  {
92  // limit search in first ring
93  if (TIDDetId(m->recHit()->geographicalId()).ring() > 1) continue;
94  if (m == pixelMeasurements.begin())
95  {
96  CLHEP::Hep3Vector prediction(m->forwardPredictedState().globalPosition().x(),
97  m->forwardPredictedState().globalPosition().y(),
98  m->forwardPredictedState().globalPosition().z());
99  predictionHere.push_back( prediction);
100  }
101  if (m->recHit()->isValid())
102  {
103  measurementsHere.push_back( *m);
104  hitsHere.push_back(m->recHit());
105  }
106  // else{ std::cout<<" 2H not valid "<<std::endl;}
107  }
108  } //end of TID search
109 
110  //additional search in the TEC layers
111  if ( ((*il)->subDetector())==GeomDetEnumerators::TEC && (ilayer->location()) == GeomDetEnumerators::endcap)
112  {
113  std::vector<TrajectoryMeasurement> pixelMeasurements;
114  pixelMeasurements = theLayerMeasurements->measurements( (**il), tsos , *aProp, *aForwardMeas);
115 
116  for (aMeas m=pixelMeasurements.begin(); m!=pixelMeasurements.end(); m++)
117  {
118  // limit search in first ring and first third wheels
119  if (TECDetId(m->recHit()->geographicalId()).ring() > 1) continue;
120  if (TECDetId(m->recHit()->geographicalId()).wheel() > 3) continue;
121  if (m == pixelMeasurements.begin())
122  {
123  CLHEP::Hep3Vector prediction(m->forwardPredictedState().globalPosition().x(),
124  m->forwardPredictedState().globalPosition().y(),
125  m->forwardPredictedState().globalPosition().z());
126  predictionHere.push_back( prediction);
127  }
128  if (m->recHit()->isValid())
129  {
130  measurementsHere.push_back( *m);
131  hitsHere.push_back(m->recHit());
132 
133  //std::cout<<"\n SH TEC "<<std::endl;
134 
135  }
136  // else{ std::cout<<" 2H not valid "<<std::endl;}
137  }
138  } //end of TEC search
139  }
140  }
141  }
142 }
143 
144 
145 std::vector<TrajectoryMeasurement> PixelMatchNextLayers::measurementsInNextLayers() const {
146 
147  return measurementsHere;
148 }
149 
150 std::vector<TrajectoryMeasurement> PixelMatchNextLayers::badMeasurementsInNextLayers() const {
151 
152  return badMeasurementsHere;
153 }
154 
156 
157  return hitsHere;
158 }
159 
160 std::vector<CLHEP::Hep3Vector> PixelMatchNextLayers::predictionInNextLayers() const {
161 
162  return predictionHere;
163 }
164 
165 
166 
167 
168 
169 
170 
171 
172 
173 
std::vector< TrajectoryMeasurement > measurements(const DetLayer &layer, const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est) const
virtual const BoundSurface & surface() const =0
The surface of the GeometricSearchDet.
PixelMatchNextLayers(const LayerMeasurements *theLayerMeasurements, const DetLayer *ilayer, FreeTrajectoryState &aFTS, const PropagatorWithMaterial *aProp, const BarrelMeasurementEstimator *aBarrelMeas, const ForwardMeasurementEstimator *aForwardMeas, bool searchInTIDTEC)
virtual Location location() const =0
Which part of the detector (barrel, endcap)
std::vector< TrajectoryMeasurement > measurementsHere
std::vector< TrajectoryMeasurement > badMeasurementsInNextLayers() const
virtual std::vector< const DetLayer * > nextLayers(NavigationDirection direction) const
Definition: DetLayer.cc:35
TransientTrackingRecHit::RecHitContainer hitsHere
std::vector< CLHEP::Hep3Vector > predictionInNextLayers() const
std::vector< ConstRecHitPointer > RecHitContainer
TransientTrackingRecHit::RecHitContainer hitsInNextLayers() const
std::vector< TrajectoryMeasurement > badMeasurementsHere
std::vector< TrajectoryMeasurement > measurementsInNextLayers() const
std::vector< CLHEP::Hep3Vector > predictionHere