File indexing completed on 2024-04-06 12:28:50
0001 #include "RecoTracker/TkHitPairs/interface/CosmicHitPairGeneratorFromLayerPair.h"
0002 #include "RecoTracker/TkTrackingRegions/interface/TrackingRegion.h"
0003 #include "TrackingTools/DetLayers/interface/DetLayer.h"
0004 #include "RecoTracker/TkHitPairs/interface/OrderedHitPair.h"
0005 #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h"
0006 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0007 #include "TrackingTools/DetLayers/interface/BarrelDetLayer.h"
0008 #include "FWCore/Framework/interface/ESHandle.h"
0009 #include "RecoTracker/TransientTrackingRecHit/interface/TkTransientTrackingRecHitBuilder.h"
0010 #include "TrackingTools/Records/interface/TransientRecHitRecord.h"
0011
0012 using namespace std;
0013
0014
0015 CosmicHitPairGeneratorFromLayerPair::CosmicHitPairGeneratorFromLayerPair(const LayerWithHits* inner,
0016 const LayerWithHits* outer,
0017 const TrackerGeometry& geom)
0018 : trackerGeometry(&geom), theOuterLayer(outer), theInnerLayer(inner) {}
0019 CosmicHitPairGeneratorFromLayerPair::~CosmicHitPairGeneratorFromLayerPair() {}
0020
0021 void CosmicHitPairGeneratorFromLayerPair::hitPairs(const TrackingRegion& region, OrderedHitPairs& result) {
0022
0023
0024 typedef OrderedHitPair::InnerRecHit InnerHit;
0025 typedef OrderedHitPair::OuterRecHit OuterHit;
0026
0027 if (theInnerLayer->recHits().empty())
0028 return;
0029
0030 if (theOuterLayer->recHits().empty())
0031 return;
0032
0033
0034
0035
0036
0037 const DetLayer* blay1;
0038 const DetLayer* blay2;
0039 blay1 = dynamic_cast<const BarrelDetLayer*>(theInnerLayer->layer());
0040 blay2 = dynamic_cast<const BarrelDetLayer*>(theOuterLayer->layer());
0041
0042 bool seedfromoverlaps = false;
0043 bool InTheBarrel = false;
0044 bool InTheForward = false;
0045 if (blay1 && blay2) {
0046 InTheBarrel = true;
0047 } else
0048 InTheForward = true;
0049
0050 if (InTheBarrel) {
0051 float radius1 = dynamic_cast<const BarrelDetLayer*>(theInnerLayer->layer())->specificSurface().radius();
0052 float radius2 = dynamic_cast<const BarrelDetLayer*>(theOuterLayer->layer())->specificSurface().radius();
0053 seedfromoverlaps = (abs(radius1 - radius2) < 0.1) ? true : false;
0054 }
0055
0056 vector<OrderedHitPair> allthepairs;
0057
0058 for (auto ohh = theOuterLayer->recHits().begin(); ohh != theOuterLayer->recHits().end(); ohh++) {
0059 for (auto ihh = theInnerLayer->recHits().begin(); ihh != theInnerLayer->recHits().end(); ihh++) {
0060 auto oh = static_cast<BaseTrackerRecHit const* const>(*ohh);
0061 auto ih = static_cast<BaseTrackerRecHit const* const>(*ihh);
0062
0063 float z_diff = ih->globalPosition().z() - oh->globalPosition().z();
0064 float inny = ih->globalPosition().y();
0065 float outy = oh->globalPosition().y();
0066 float innx = ih->globalPosition().x();
0067 float outx = oh->globalPosition().x();
0068 ;
0069 float dxdy = abs((outx - innx) / (outy - inny));
0070 float DeltaR = oh->globalPosition().perp() - ih->globalPosition().perp();
0071 ;
0072
0073 if (InTheBarrel &&
0074 (abs(z_diff) < 30)
0075
0076 && (dxdy < 2) && (inny * outy > 0) && (abs(DeltaR) > 0)) {
0077
0078 if (seedfromoverlaps) {
0079
0080
0081
0082
0083 if ((DeltaR < 0) && (abs(z_diff) < 18) &&
0084 (abs(ih->globalPosition().phi() - oh->globalPosition().phi()) < 0.05) && (dxdy < 2))
0085 result.push_back(OrderedHitPair(ih, oh));
0086 } else
0087 result.push_back(OrderedHitPair(ih, oh));
0088 }
0089 if (InTheForward && (abs(z_diff) > 1.)) {
0090
0091 result.push_back(OrderedHitPair(ih, oh));
0092 }
0093 }
0094 }
0095
0096
0097
0098
0099
0100
0101
0102
0103
0104
0105
0106
0107
0108
0109
0110
0111
0112
0113
0114
0115
0116
0117
0118
0119
0120
0121
0122
0123
0124
0125
0126
0127
0128
0129
0130
0131
0132
0133 }