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