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.12 2009/05/27 07:31:22 fabiocos Exp $
17 //
18 //
19 
29 
39 
40 #include <iostream>
41 #include <algorithm>
42 
43 
44 PixelMatchNextLayers::PixelMatchNextLayers(const LayerMeasurements * theLayerMeasurements,const DetLayer* ilayer,
45  FreeTrajectoryState & aFTS,
46  const PropagatorWithMaterial *aProp,
47  const BarrelMeasurementEstimator *aBarrelMeas,
48  const ForwardMeasurementEstimator *aForwardMeas,
49  bool searchInTIDTEC)
50  {
51 
52  typedef std::vector<TrajectoryMeasurement>::const_iterator aMeas;
53  std::vector<const DetLayer*> allayers;
54  std::vector<const DetLayer*> nl = ilayer->nextLayers( aFTS, alongMomentum);
55  for (std::vector<const DetLayer*>::const_iterator il = nl.begin(); il != nl.end(); il++) {
56  allayers.push_back(*il);
57  std::vector<const DetLayer*> n2l = (*il)->nextLayers( aFTS, alongMomentum);
58  for (std::vector<const DetLayer*>::const_iterator i2l = n2l.begin(); i2l != n2l.end(); i2l++) {
59  allayers.push_back(*i2l);
60  }
61  }
62 
63  const TrajectoryStateOnSurface tsos(aFTS,ilayer->surface());
64 
65  if (tsos.isValid())
66  {
67  for (std::vector<const DetLayer*>::const_iterator il = allayers.begin(); il != allayers.end(); il++)
68  {
69  if ( (*il)->subDetector()==GeomDetEnumerators::PixelBarrel || (*il)->subDetector()==GeomDetEnumerators::PixelEndcap ) {
70 
71  std::vector<TrajectoryMeasurement> pixelMeasurements;
72  if ((*il)->subDetector()==GeomDetEnumerators::PixelBarrel) {
73  pixelMeasurements = theLayerMeasurements->measurements( **il, tsos , *aProp, *aBarrelMeas);
74  } else {
75  pixelMeasurements = theLayerMeasurements->measurements( **il, tsos, *aProp, *aForwardMeas);
76  }
77  for (aMeas m=pixelMeasurements.begin(); m!=pixelMeasurements.end(); m++){
78  if (m == pixelMeasurements.begin()){
79  CLHEP::Hep3Vector prediction(m->forwardPredictedState().globalPosition().x(),
80  m->forwardPredictedState().globalPosition().y(),
81  m->forwardPredictedState().globalPosition().z());
82  predictionHere.push_back( prediction);
83  }
84  if (m->recHit()->isValid()) {
85  measurementsHere.push_back( *m);
86  hitsHere.push_back( m->recHit());
87 
88  //std::cout<<"\n SH B-D "<<std::endl;
89 
90  } else {
91  badMeasurementsHere.push_back( *m);
92  }
93  }
94  }
95  if (searchInTIDTEC) {
96  //additional search in the TID layers
97  if ( ((*il)->subDetector())==GeomDetEnumerators::TID && (ilayer->location()) == GeomDetEnumerators::endcap)
98  {
99  std::vector<TrajectoryMeasurement> pixelMeasurements;
100  pixelMeasurements = theLayerMeasurements->measurements( (**il), tsos , *aProp, *aForwardMeas);
101 
102  for (aMeas m=pixelMeasurements.begin(); m!=pixelMeasurements.end(); m++)
103  {
104  // limit search in first ring
105  if (TIDDetId(m->recHit()->geographicalId()).ring() > 1) continue;
106  if (m == pixelMeasurements.begin())
107  {
108  CLHEP::Hep3Vector prediction(m->forwardPredictedState().globalPosition().x(),
109  m->forwardPredictedState().globalPosition().y(),
110  m->forwardPredictedState().globalPosition().z());
111  predictionHere.push_back( prediction);
112  }
113  if (m->recHit()->isValid())
114  {
115  measurementsHere.push_back( *m);
116  hitsHere.push_back(m->recHit());
117  }
118  // else{ std::cout<<" 2H not valid "<<std::endl;}
119  }
120  } //end of TID search
121 
122  //additional search in the TEC layers
123  if ( ((*il)->subDetector())==GeomDetEnumerators::TEC && (ilayer->location()) == GeomDetEnumerators::endcap)
124  {
125  std::vector<TrajectoryMeasurement> pixelMeasurements;
126  pixelMeasurements = theLayerMeasurements->measurements( (**il), tsos , *aProp, *aForwardMeas);
127 
128  for (aMeas m=pixelMeasurements.begin(); m!=pixelMeasurements.end(); m++)
129  {
130  // limit search in first ring and first third wheels
131  if (TECDetId(m->recHit()->geographicalId()).ring() > 1) continue;
132  if (TECDetId(m->recHit()->geographicalId()).wheel() > 3) continue;
133  if (m == pixelMeasurements.begin())
134  {
135  CLHEP::Hep3Vector prediction(m->forwardPredictedState().globalPosition().x(),
136  m->forwardPredictedState().globalPosition().y(),
137  m->forwardPredictedState().globalPosition().z());
138  predictionHere.push_back( prediction);
139  }
140  if (m->recHit()->isValid())
141  {
142  measurementsHere.push_back( *m);
143  hitsHere.push_back(m->recHit());
144 
145  //std::cout<<"\n SH TEC "<<std::endl;
146 
147  }
148  // else{ std::cout<<" 2H not valid "<<std::endl;}
149  }
150  } //end of TEC search
151  }
152  }
153  }
154 }
155 
156 
157 std::vector<TrajectoryMeasurement> PixelMatchNextLayers::measurementsInNextLayers() const {
158 
159  return measurementsHere;
160 }
161 
162 std::vector<TrajectoryMeasurement> PixelMatchNextLayers::badMeasurementsInNextLayers() const {
163 
164  return badMeasurementsHere;
165 }
166 
168 
169  return hitsHere;
170 }
171 
172 std::vector<CLHEP::Hep3Vector> PixelMatchNextLayers::predictionInNextLayers() const {
173 
174  return predictionHere;
175 }
176 
177 
178 
179 
180 
181 
182 
183 
184 
185 
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