File indexing completed on 2023-03-17 11:22:51
0001 #include "PixelRod.h"
0002
0003 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0004
0005 #include "TrackingTools/DetLayers/interface/MeasurementEstimator.h"
0006 #include "TrackingTools/DetLayers/interface/DetLayerException.h"
0007
0008 using namespace std;
0009
0010 typedef GeometricSearchDet::DetWithState DetWithState;
0011
0012 PixelRod::PixelRod(vector<const GeomDet*>& theInputDets) : DetRodOneR(theInputDets.begin(), theInputDets.end()) {
0013 theBinFinder = BinFinderType(theDets.begin(), theDets.end());
0014
0015
0016 LogDebug("TkDetLayers") << "==== DEBUG PixelRod =====";
0017 for (vector<const GeomDet*>::const_iterator i = theDets.begin(); i != theDets.end(); i++) {
0018 LogDebug("TkDetLayers") << "PixelRod's Det pos z,perp,eta,phi: " << (**i).position().z() << " , "
0019 << (**i).position().perp() << " , " << (**i).position().eta() << " , "
0020 << (**i).position().phi();
0021 }
0022 LogDebug("TkDetLayers") << "==== end DEBUG PixelRod =====";
0023
0024 }
0025
0026 PixelRod::~PixelRod() {}
0027
0028 const vector<const GeometricSearchDet*>& PixelRod::components() const {
0029 throw DetLayerException("PixelRod doesn't have GeometricSearchDet components");
0030 }
0031
0032 pair<bool, TrajectoryStateOnSurface> PixelRod::compatible(const TrajectoryStateOnSurface& ts,
0033 const Propagator&,
0034 const MeasurementEstimator&) const {
0035 edm::LogError("TkDetLayers") << "temporary dummy implementation of PixelRod::compatible()!!";
0036 return pair<bool, TrajectoryStateOnSurface>();
0037 }
0038
0039 void PixelRod::compatibleDetsV(const TrajectoryStateOnSurface& startingState,
0040 const Propagator& prop,
0041 const MeasurementEstimator& est,
0042 std::vector<DetWithState>& result) const {
0043 typedef MeasurementEstimator::Local2DVector Local2DVector;
0044 TrajectoryStateOnSurface ts = prop.propagate(startingState, specificSurface());
0045 if (!ts.isValid())
0046 return;
0047
0048 GlobalPoint startPos = ts.globalPosition();
0049
0050 int closest = theBinFinder.binIndex(startPos.z());
0051 pair<bool, TrajectoryStateOnSurface> closestCompat =
0052 theCompatibilityChecker.isCompatible(theDets[closest], startingState, prop, est);
0053
0054 if (closestCompat.first) {
0055 result.push_back(DetWithState(theDets[closest], closestCompat.second));
0056 } else {
0057 if (!closestCompat.second.isValid())
0058 return;
0059 }
0060
0061 const Plane& closestPlane(theDets[closest]->specificSurface());
0062
0063 Local2DVector maxDistance = est.maximalLocalDisplacement(closestCompat.second, closestPlane);
0064
0065 float detHalfLen = theDets[closest]->surface().bounds().length() / 2.;
0066
0067
0068 for (size_t idet = closest + 1; idet < theDets.size(); idet++) {
0069 LocalPoint nextPos(theDets[idet]->surface().toLocal(closestCompat.second.globalPosition()));
0070 if (std::abs(nextPos.y()) < detHalfLen + maxDistance.y()) {
0071 if (!add(idet, result, startingState, prop, est))
0072 break;
0073 } else {
0074 break;
0075 }
0076 }
0077
0078 for (int idet = closest - 1; idet >= 0; idet--) {
0079 LocalPoint nextPos(theDets[idet]->surface().toLocal(closestCompat.second.globalPosition()));
0080 if (std::abs(nextPos.y()) < detHalfLen + maxDistance.y()) {
0081 if (!add(idet, result, startingState, prop, est))
0082 break;
0083 } else {
0084 break;
0085 }
0086 }
0087 }
0088
0089 void PixelRod::groupedCompatibleDetsV(const TrajectoryStateOnSurface&,
0090 const Propagator&,
0091 const MeasurementEstimator&,
0092 std::vector<DetGroup>&) const {
0093 LogDebug("TkDetLayers") << "dummy implementation of PixelRod::groupedCompatibleDets()";
0094 }