Go to the documentation of this file.00001
00002
00003
00004
00005
00013
00014
00015
00016
00017
00018
00019
00020 #include "TrackingTools/DetLayers/interface/DetLayer.h"
00021 #include "TrackingTools/MeasurementDet/interface/LayerMeasurements.h"
00022 #include "TrackingTools/MaterialEffects/interface/PropagatorWithMaterial.h"
00023 #include "RecoEgamma/EgammaElectronAlgos/interface/PixelMatchNextLayers.h"
00024
00025 #include "DataFormats/SiStripDetId/interface/TIDDetId.h"
00026 #include "DataFormats/SiStripDetId/interface/TECDetId.h"
00027
00028 #include <iostream>
00029 #include <algorithm>
00030
00031
00032 PixelMatchNextLayers::PixelMatchNextLayers(const LayerMeasurements * theLayerMeasurements,const DetLayer* ilayer,
00033 FreeTrajectoryState & aFTS,
00034 const PropagatorWithMaterial *aProp,
00035 const BarrelMeasurementEstimator *aBarrelMeas,
00036 const ForwardMeasurementEstimator *aForwardMeas,
00037 bool searchInTIDTEC)
00038 {
00039
00040 typedef std::vector<TrajectoryMeasurement>::const_iterator aMeas;
00041 std::vector<const DetLayer*> allayers;
00042 std::vector<const DetLayer*> nl = ilayer->nextLayers( aFTS, alongMomentum);
00043 for (std::vector<const DetLayer*>::const_iterator il = nl.begin(); il != nl.end(); il++) {
00044 allayers.push_back(*il);
00045 std::vector<const DetLayer*> n2l = (*il)->nextLayers( aFTS, alongMomentum);
00046 for (std::vector<const DetLayer*>::const_iterator i2l = n2l.begin(); i2l != n2l.end(); i2l++) {
00047 allayers.push_back(*i2l);
00048 }
00049 }
00050
00051 const TrajectoryStateOnSurface tsos(aFTS,ilayer->surface());
00052
00053 if (tsos.isValid())
00054 {
00055 for (std::vector<const DetLayer*>::const_iterator il = allayers.begin(); il != allayers.end(); il++)
00056 {
00057 if ( (*il)->subDetector()==GeomDetEnumerators::PixelBarrel || (*il)->subDetector()==GeomDetEnumerators::PixelEndcap ) {
00058
00059 std::vector<TrajectoryMeasurement> pixelMeasurements;
00060 if ((*il)->subDetector()==GeomDetEnumerators::PixelBarrel) {
00061 pixelMeasurements = theLayerMeasurements->measurements( **il, tsos , *aProp, *aBarrelMeas);
00062 } else {
00063 pixelMeasurements = theLayerMeasurements->measurements( **il, tsos, *aProp, *aForwardMeas);
00064 }
00065 for (aMeas m=pixelMeasurements.begin(); m!=pixelMeasurements.end(); m++){
00066 if (m == pixelMeasurements.begin()){
00067 CLHEP::Hep3Vector prediction(m->forwardPredictedState().globalPosition().x(),
00068 m->forwardPredictedState().globalPosition().y(),
00069 m->forwardPredictedState().globalPosition().z());
00070 predictionHere.push_back( prediction);
00071 }
00072 if (m->recHit()->isValid()) {
00073 measurementsHere.push_back( *m);
00074 hitsHere.push_back( m->recHit());
00075
00076
00077
00078 } else {
00079 badMeasurementsHere.push_back( *m);
00080 }
00081 }
00082 }
00083 if (searchInTIDTEC) {
00084
00085 if ( ((*il)->subDetector())==GeomDetEnumerators::TID && (ilayer->location()) == GeomDetEnumerators::endcap)
00086 {
00087 std::vector<TrajectoryMeasurement> pixelMeasurements;
00088 pixelMeasurements = theLayerMeasurements->measurements( (**il), tsos , *aProp, *aForwardMeas);
00089
00090 for (aMeas m=pixelMeasurements.begin(); m!=pixelMeasurements.end(); m++)
00091 {
00092
00093 if (TIDDetId(m->recHit()->geographicalId()).ring() > 1) continue;
00094 if (m == pixelMeasurements.begin())
00095 {
00096 CLHEP::Hep3Vector prediction(m->forwardPredictedState().globalPosition().x(),
00097 m->forwardPredictedState().globalPosition().y(),
00098 m->forwardPredictedState().globalPosition().z());
00099 predictionHere.push_back( prediction);
00100 }
00101 if (m->recHit()->isValid())
00102 {
00103 measurementsHere.push_back( *m);
00104 hitsHere.push_back(m->recHit());
00105 }
00106
00107 }
00108 }
00109
00110
00111 if ( ((*il)->subDetector())==GeomDetEnumerators::TEC && (ilayer->location()) == GeomDetEnumerators::endcap)
00112 {
00113 std::vector<TrajectoryMeasurement> pixelMeasurements;
00114 pixelMeasurements = theLayerMeasurements->measurements( (**il), tsos , *aProp, *aForwardMeas);
00115
00116 for (aMeas m=pixelMeasurements.begin(); m!=pixelMeasurements.end(); m++)
00117 {
00118
00119 if (TECDetId(m->recHit()->geographicalId()).ring() > 1) continue;
00120 if (TECDetId(m->recHit()->geographicalId()).wheel() > 3) continue;
00121 if (m == pixelMeasurements.begin())
00122 {
00123 CLHEP::Hep3Vector prediction(m->forwardPredictedState().globalPosition().x(),
00124 m->forwardPredictedState().globalPosition().y(),
00125 m->forwardPredictedState().globalPosition().z());
00126 predictionHere.push_back( prediction);
00127 }
00128 if (m->recHit()->isValid())
00129 {
00130 measurementsHere.push_back( *m);
00131 hitsHere.push_back(m->recHit());
00132
00133
00134
00135 }
00136
00137 }
00138 }
00139 }
00140 }
00141 }
00142 }
00143
00144
00145 std::vector<TrajectoryMeasurement> PixelMatchNextLayers::measurementsInNextLayers() const {
00146
00147 return measurementsHere;
00148 }
00149
00150 std::vector<TrajectoryMeasurement> PixelMatchNextLayers::badMeasurementsInNextLayers() const {
00151
00152 return badMeasurementsHere;
00153 }
00154
00155 TransientTrackingRecHit::RecHitContainer PixelMatchNextLayers::hitsInNextLayers() const {
00156
00157 return hitsHere;
00158 }
00159
00160 std::vector<CLHEP::Hep3Vector> PixelMatchNextLayers::predictionInNextLayers() const {
00161
00162 return predictionHere;
00163 }
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173