CMS 3D CMS Logo

PixelTripletLowPtGenerator.cc
Go to the documentation of this file.
5 
8 
13 
16 
19 
20 #undef Debug
21 
22 using namespace std;
23 
24 /*****************************************************************************/
26  : HitTripletGeneratorFromPairAndLayers(), // no theMaxElement used in this class
27  theTracker(nullptr),
28  theClusterShapeCacheToken(
29  iC.consumes<SiPixelClusterShapeCache>(cfg.getParameter<edm::InputTag>("clusterShapeCacheSrc"))) {
30  checkMultipleScattering = cfg.getParameter<bool>("checkMultipleScattering");
31  nSigMultipleScattering = cfg.getParameter<double>("nSigMultipleScattering");
32  checkClusterShape = cfg.getParameter<bool>("checkClusterShape");
33  rzTolerance = cfg.getParameter<double>("rzTolerance");
34  maxAngleRatio = cfg.getParameter<double>("maxAngleRatio");
35  builderName = cfg.getParameter<string>("TTRHBuilder");
36 }
37 
38 /*****************************************************************************/
40 
41 /*****************************************************************************/
42 
43 /*****************************************************************************/
45  if (theTracker == nullptr) {
46  // Get tracker geometry
49 
50  theTracker = tracker.product();
51  }
52 
53  if (!theFilter) {
54  theFilter = std::make_unique<TripletFilter>(es);
55  }
56 }
57 
58 /*****************************************************************************/
60  DetId detId = recHit->geographicalId();
61 
62  return theTracker->idToDet(detId)->toGlobal(recHit->localPosition());
63 }
64 
65 /*****************************************************************************/
68  const edm::Event& ev,
69  const edm::EventSetup& es,
70  const SeedingLayerSetsHits::SeedingLayerSet& pairLayers,
71  const std::vector<SeedingLayerSetsHits::SeedingLayer>& thirdLayers) {
72  //Retrieve tracker topology from geometry
74  es.get<TrackerTopologyRcd>().get(tTopoHand);
75  const TrackerTopology* tTopo = tTopoHand.product();
76 
79 
80  // Generate pairs
81  OrderedHitPairs pairs;
82  pairs.reserve(30000);
83  thePairGenerator->hitPairs(region, pairs, ev, es, pairLayers);
84 
85  if (pairs.empty())
86  return;
87 
88  int size = thirdLayers.size();
89 
90  // Set aliases
91  const RecHitsSortedInPhi** thirdHitMap = new const RecHitsSortedInPhi*[size];
92  for (int il = 0; il < size; il++)
93  thirdHitMap[il] = &(*theLayerCache)(thirdLayers[il], region, es);
94 
95  // Get tracker
96  getTracker(es);
97 
98  // Look at all generated pairs
99  for (OrderedHitPairs::const_iterator ip = pairs.begin(); ip != pairs.end(); ip++) {
100  // Fill rechits and points
101  vector<const TrackingRecHit*> recHits(3);
102  vector<GlobalPoint> points(3);
103 
104  recHits[0] = (*ip).inner()->hit();
105  recHits[1] = (*ip).outer()->hit();
106 
107 #ifdef Debug
108  cerr << " RecHits " + HitInfo::getInfo(*recHits[0]) + HitInfo::getInfo(*recHits[1]) << endl;
109 #endif
110 
111  for (int i = 0; i < 2; i++)
113 
114  // Initialize helix prediction
115  ThirdHitPrediction thePrediction(
117 
118  // Look at all layers
119  for (int il = 0; il < size; il++) {
120  const DetLayer* layer = thirdLayers[il].detLayer();
121 
122 #ifdef Debug
123  cerr << " check layer " << layer->subDetector() << " " << layer->location() << endl;
124 #endif
125 
126  // Get ranges for the third hit
127  float phi[2], rz[2];
128  thePrediction.getRanges(layer, phi, rz);
129 
130  PixelRecoRange<float> phiRange(phi[0], phi[1]);
131  PixelRecoRange<float> rzRange(rz[0] - rzTolerance, rz[1] + rzTolerance);
132 
133  // Get third hit candidates from cache
135  vector<Hit> thirdHits = thirdHitMap[il]->hits(phiRange.min(), phiRange.max());
136  typedef vector<Hit>::const_iterator IH;
137 
138  for (IH th = thirdHits.begin(), eh = thirdHits.end(); th < eh; ++th) {
139  // Fill rechit and point
140  recHits[2] = (*th)->hit();
142 
143 #ifdef Debug
144  cerr << " third hit " + HitInfo::getInfo(*recHits[2]) << endl;
145 #endif
146 
147  // Check if third hit is compatible with multiple scattering
148  vector<GlobalVector> globalDirs;
149  if (thePrediction.isCompatibleWithMultipleScattering(points[2], recHits, globalDirs, es) == false) {
150 #ifdef Debug
151  cerr << " not compatible: multiple scattering" << endl;
152 #endif
154  continue;
155  }
156 
157  // Convert to localDirs
158  /*
159  vector<LocalVector> localDirs;
160  vector<GlobalVector>::const_iterator globalDir = globalDirs.begin();
161  for(vector<const TrackingRecHit *>::const_iterator
162  recHit = recHits.begin();
163  recHit != recHits.end(); recHit++)
164  {
165  localDirs.push_back(theTracker->idToDet(
166  (*recHit)->geographicalId())->toLocal(*globalDir));
167  globalDir++;
168  }
169 */
170 
171  // Check if the cluster shapes are compatible with thrusts
172  if (checkClusterShape) {
173  if (!theFilter->checkTrack(recHits, globalDirs, tTopo, *clusterShapeCache)) {
174 #ifdef Debug
175  cerr << " not compatible: cluster shape" << endl;
176 #endif
177  continue;
178  }
179  }
180 
181  // All checks passed, put triplet back
182  result.push_back(OrderedHitTriplet((*ip).inner(), (*ip).outer(), *th));
183  }
184  }
185  }
186  delete[] thirdHitMap;
187 
188  return;
189 }
192  const edm::EventSetup& es,
193  const HitDoublets& doublets,
194  const RecHitsSortedInPhi** thirdHitMap,
195  const std::vector<const DetLayer*>& thirdLayerDetLayer,
196  const int nThirdLayers) {
197  throw cms::Exception("Error") << "PixelTripletLowPtGenerator::hitTriplets is not implemented \n";
198 }
SiPixelPhase1OnlineDQM_cff.clusterShapeCache
clusterShapeCache
Definition: SiPixelPhase1OnlineDQM_cff.py:120
TrackerGeometry::idToDet
const TrackerGeomDet * idToDet(DetId) const override
Definition: TrackerGeometry.cc:193
edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
ThirdHitPrediction.h
PixelRecoPointRZ.h
OrderedHitPairs
Definition: OrderedHitPairs.h:8
ThirdHitPrediction::isCompatibleWithMultipleScattering
bool isCompatibleWithMultipleScattering(GlobalPoint g3, const std::vector< const TrackingRecHit * > &h, std::vector< GlobalVector > &localDirs, const edm::EventSetup &es)
Definition: ThirdHitPrediction.cc:345
mps_fire.i
i
Definition: mps_fire.py:428
SiPixelClusterShapeCache
Definition: SiPixelClusterShapeCache.h:43
TrackerGeometry.h
ESHandle.h
DetLayer::subDetector
virtual SubDetector subDetector() const =0
The type of detector (PixelBarrel, PixelEndcap, TIB, TOB, TID, TEC, CSC, DT, RPCBarrel,...
DetLayer
Definition: DetLayer.h:21
HLT_FULL_cff.points
points
Definition: HLT_FULL_cff.py:21455
edm
HLT enums.
Definition: AlignableModifier.h:19
TrackerTopology
Definition: TrackerTopology.h:16
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89287
PixelTripletLowPtGenerator::theFilter
std::unique_ptr< TripletFilter > theFilter
Definition: PixelTripletLowPtGenerator.h:48
HLT_FULL_cff.doublets
doublets
Definition: HLT_FULL_cff.py:9865
PixelTripletLowPtGenerator.h
PixelTripletLowPtGenerator::checkMultipleScattering
bool checkMultipleScattering
Definition: PixelTripletLowPtGenerator.h:56
edm::Handle< SiPixelClusterShapeCache >
rpcPointValidation_cfi.recHit
recHit
Definition: rpcPointValidation_cfi.py:7
PixelRecoRange::min
T min() const
Definition: PixelRecoRange.h:25
DetId
Definition: DetId.h:17
DetLayer::location
virtual Location location() const =0
Which part of the detector (barrel, endcap)
TrackerTopology.h
TrackerTopologyRcd.h
PixelTripletLowPtGenerator::PixelTripletLowPtGenerator
PixelTripletLowPtGenerator(const edm::ParameterSet &cfg, edm::ConsumesCollector &iC)
Definition: PixelTripletLowPtGenerator.cc:25
edm::EventSetup::get
T get() const
Definition: EventSetup.h:80
PixelTripletLowPtGenerator::checkClusterShape
bool checkClusterShape
Definition: PixelTripletLowPtGenerator.h:57
PixelTripletLowPtGenerator::~PixelTripletLowPtGenerator
~PixelTripletLowPtGenerator() override
Definition: PixelTripletLowPtGenerator.cc:39
HitTripletGeneratorFromPairAndLayers::thePairGenerator
std::unique_ptr< HitPairGeneratorFromLayerPair > thePairGenerator
Definition: HitTripletGeneratorFromPairAndLayers.h:55
PixelRecoRange::max
T max() const
Definition: PixelRecoRange.h:26
PixelTripletLowPtGenerator::nSigMultipleScattering
double nSigMultipleScattering
Definition: PixelTripletLowPtGenerator.h:51
TrackerDigiGeometryRecord
Definition: TrackerDigiGeometryRecord.h:15
HitTripletGeneratorFromPairAndLayers
Definition: HitTripletGeneratorFromPairAndLayers.h:25
edm::ESHandle< TrackerGeometry >
PixelTripletLowPtGenerator::builderName
std::string builderName
Definition: PixelTripletLowPtGenerator.h:55
RecHitsSortedInPhi::Hit
BaseTrackerRecHit const * Hit
Definition: RecHitsSortedInPhi.h:19
ThirdHitPrediction::getRanges
void getRanges(const DetLayer *layer, float phi[], float rz[])
Definition: ThirdHitPrediction.cc:304
Point3DBase< float, GlobalTag >
PixelTripletLowPtGenerator::rzTolerance
double rzTolerance
Definition: PixelTripletLowPtGenerator.h:52
FastTrackerRecHitMaskProducer_cfi.recHits
recHits
Definition: FastTrackerRecHitMaskProducer_cfi.py:8
PbPb_ZMuSkimMuonDPG_cff.tracker
tracker
Definition: PbPb_ZMuSkimMuonDPG_cff.py:60
RecHitsSortedInPhi
Definition: RecHitsSortedInPhi.h:17
TrackerDigiGeometryRecord.h
PixelRecoRange< float >
GeomDet::toGlobal
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:49
HitDoublets
Definition: RecHitsSortedInPhi.h:124
edm::ParameterSet
Definition: ParameterSet.h:47
PixelTripletLowPtGenerator::theClusterShapeCacheToken
edm::EDGetTokenT< SiPixelClusterShapeCache > theClusterShapeCacheToken
Definition: PixelTripletLowPtGenerator.h:50
PixelTripletLowPtGenerator::getTracker
void getTracker(const edm::EventSetup &es)
Definition: PixelTripletLowPtGenerator.cc:44
Event.h
OrderedHitTriplets
Definition: OrderedHitTriplets.h:9
HLT_FULL_cff.region
region
Definition: HLT_FULL_cff.py:88272
PixelTripletLowPtGenerator::hitTriplets
void hitTriplets(const TrackingRegion &region, OrderedHitTriplets &trs, const edm::Event &ev, const edm::EventSetup &es, const SeedingLayerSetsHits::SeedingLayerSet &pairLayers, const std::vector< SeedingLayerSetsHits::SeedingLayer > &thirdLayers) override
Definition: PixelTripletLowPtGenerator.cc:66
edm::EventSetup
Definition: EventSetup.h:57
TripletFilter.h
get
#define get
looper.cfg
cfg
Definition: looper.py:297
TrackingRecHit
Definition: TrackingRecHit.h:21
DDAxes::phi
HitTripletGeneratorFromPairAndLayers::theLayerCache
LayerCacheType * theLayerCache
Definition: HitTripletGeneratorFromPairAndLayers.h:56
std
Definition: JetResolutionObject.h:76
RecHitsSortedInPhi::hits
std::vector< Hit > hits(float phiMin, float phiMax) const
Definition: RecHitsSortedInPhi.cc:93
HitPairGeneratorFromLayerPair.h
ev
bool ev
Definition: Hydjet2Hadronizer.cc:95
Exception
Definition: hltDiff.cc:246
SeedingLayerSetsHits::SeedingLayerSet
Definition: SeedingLayerSetsHits.h:65
PixelTripletLowPtGenerator::theTracker
const TrackerGeometry * theTracker
Definition: PixelTripletLowPtGenerator.h:47
OrderedHitTriplet
Definition: OrderedHitTriplet.h:11
TrackingRegion
Definition: TrackingRegion.h:41
mps_fire.result
result
Definition: mps_fire.py:311
ConsumesCollector.h
PixelTripletLowPtGenerator::maxAngleRatio
double maxAngleRatio
Definition: PixelTripletLowPtGenerator.h:53
ThirdHitPrediction
Definition: ThirdHitPrediction.h:33
HitInfo.h
TrackerTopologyRcd
Definition: TrackerTopologyRcd.h:10
edm::Event
Definition: Event.h:73
EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0.cerr
cerr
Definition: EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0.py:8
edm::ConsumesCollector
Definition: ConsumesCollector.h:45
Hit
SeedingHitSet::ConstRecHitPointer Hit
Definition: SeedGeneratorFromProtoTracksEDProducer.cc:34
SiPixelClusterShapeCache.h
PixelTripletLowPtGenerator::getGlobalPosition
GlobalPoint getGlobalPosition(const TrackingRecHit *recHit)
Definition: PixelTripletLowPtGenerator.cc:59
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443
HitInfo::getInfo
static std::string getInfo(const DetId &id, const TrackerTopology *tTopo)
Definition: HitInfo.cc:19