CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
PixelTripletLowPtGenerator Class Reference

#include <PixelTripletLowPtGenerator.h>

Inheritance diagram for PixelTripletLowPtGenerator:
HitTripletGeneratorFromPairAndLayers

Public Member Functions

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
 
void hitTriplets (const TrackingRegion &region, OrderedHitTriplets &result, const edm::EventSetup &es, const HitDoublets &doublets, const RecHitsSortedInPhi **thirdHitMap, const std::vector< const DetLayer * > &thirdLayerDetLayer, const int nThirdLayers) override
 
 PixelTripletLowPtGenerator (const edm::ParameterSet &cfg, edm::ConsumesCollector &iC)
 
 ~PixelTripletLowPtGenerator () override
 
- Public Member Functions inherited from HitTripletGeneratorFromPairAndLayers
 HitTripletGeneratorFromPairAndLayers (unsigned int maxElement=0)
 
 HitTripletGeneratorFromPairAndLayers (const edm::ParameterSet &pset)
 
void init (std::unique_ptr< HitPairGeneratorFromLayerPair > &&pairs, LayerCacheType *layerCache)
 
const HitPairGeneratorFromLayerPairpairGenerator () const
 
virtual ~HitTripletGeneratorFromPairAndLayers ()
 

Private Member Functions

GlobalPoint getGlobalPosition (const TrackingRecHit *recHit)
 
void getTracker (const edm::EventSetup &es)
 

Private Attributes

std::string builderName
 
bool checkClusterShape
 
bool checkMultipleScattering
 
double maxAngleRatio
 
double nSigMultipleScattering
 
double rzTolerance
 
edm::EDGetTokenT< SiPixelClusterShapeCachetheClusterShapeCacheToken
 
std::unique_ptr< TripletFiltertheFilter
 
const TrackerGeometrytheTracker
 

Additional Inherited Members

- Public Types inherited from HitTripletGeneratorFromPairAndLayers
typedef LayerHitMapCache LayerCacheType
 
- Static Public Member Functions inherited from HitTripletGeneratorFromPairAndLayers
static void fillDescriptions (edm::ParameterSetDescription &desc)
 
- Protected Attributes inherited from HitTripletGeneratorFromPairAndLayers
LayerCacheTypetheLayerCache
 
const unsigned int theMaxElement
 
std::unique_ptr< HitPairGeneratorFromLayerPairthePairGenerator
 

Detailed Description

Definition at line 23 of file PixelTripletLowPtGenerator.h.

Constructor & Destructor Documentation

PixelTripletLowPtGenerator::PixelTripletLowPtGenerator ( const edm::ParameterSet cfg,
edm::ConsumesCollector iC 
)

Definition at line 25 of file PixelTripletLowPtGenerator.cc.

References builderName, checkClusterShape, checkMultipleScattering, edm::ParameterSet::getParameter(), maxAngleRatio, nSigMultipleScattering, and rzTolerance.

25  :
26  HitTripletGeneratorFromPairAndLayers(), // no theMaxElement used in this class
27  theTracker(nullptr),
29 {
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 }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
edm::EDGetTokenT< SiPixelClusterShapeCache > theClusterShapeCacheToken
const TrackerGeometry * theTracker
PixelTripletLowPtGenerator::~PixelTripletLowPtGenerator ( )
override

Definition at line 39 of file PixelTripletLowPtGenerator.cc.

References getTracker().

39 {}

Member Function Documentation

GlobalPoint PixelTripletLowPtGenerator::getGlobalPosition ( const TrackingRecHit recHit)
private

Definition at line 65 of file PixelTripletLowPtGenerator.cc.

References TrackingRecHit::geographicalId(), TrackerGeometry::idToDet(), TrackingRecHit::localPosition(), theTracker, and GeomDet::toGlobal().

Referenced by getTracker(), and hitTriplets().

66 {
67  DetId detId = recHit->geographicalId();
68 
69  return
70  theTracker->idToDet(detId)->toGlobal(recHit->localPosition());
71 }
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:54
virtual LocalPoint localPosition() const =0
Definition: DetId.h:18
const TrackerGeometry * theTracker
const TrackerGeomDet * idToDet(DetId) const override
DetId geographicalId() const
void PixelTripletLowPtGenerator::getTracker ( const edm::EventSetup es)
private

Definition at line 46 of file PixelTripletLowPtGenerator.cc.

References edm::EventSetup::get(), getGlobalPosition(), edm::ESHandle< T >::product(), theFilter, theTracker, and trackingTruthProducer_cfi::tracker.

Referenced by hitTriplets(), and ~PixelTripletLowPtGenerator().

47 {
48  if(theTracker == nullptr)
49  {
50  // Get tracker geometry
52  es.get<TrackerDigiGeometryRecord>().get(tracker);
53 
54  theTracker = tracker.product();
55  }
56 
57  if(!theFilter)
58  {
59  theFilter = std::make_unique<TripletFilter>(es);
60  }
61 }
std::unique_ptr< TripletFilter > theFilter
const TrackerGeometry * theTracker
T get() const
Definition: EventSetup.h:71
T const * product() const
Definition: ESHandle.h:86
void PixelTripletLowPtGenerator::hitTriplets ( const TrackingRegion region,
OrderedHitTriplets trs,
const edm::Event ev,
const edm::EventSetup es,
const SeedingLayerSetsHits::SeedingLayerSet pairLayers,
const std::vector< SeedingLayerSetsHits::SeedingLayer > &  thirdLayers 
)
overridevirtual

Implements HitTripletGeneratorFromPairAndLayers.

Definition at line 74 of file PixelTripletLowPtGenerator.cc.

References builderName, MessageLogger_cfi::cerr, checkClusterShape, checkMultipleScattering, edm::EventSetup::get(), edm::Event::getByToken(), getGlobalPosition(), HitInfo::getInfo(), ThirdHitPrediction::getRanges(), getTracker(), RecHitsSortedInPhi::hits(), mps_fire::i, ThirdHitPrediction::isCompatibleWithMultipleScattering(), DetLayer::location(), PixelRecoRange< T >::max(), maxAngleRatio, PixelRecoRange< T >::min(), nSigMultipleScattering, phi, hiPixelPairStep_cff::points, edm::ESHandle< T >::product(), rzTolerance, findQualityFiles::size, DetLayer::subDetector(), theClusterShapeCacheToken, theFilter, HitTripletGeneratorFromPairAndLayers::theLayerCache, and HitTripletGeneratorFromPairAndLayers::thePairGenerator.

81 {
82 
83  //Retrieve tracker topology from geometry
85  es.get<TrackerTopologyRcd>().get(tTopoHand);
86  const TrackerTopology *tTopo=tTopoHand.product();
87 
88  edm::Handle<SiPixelClusterShapeCache> clusterShapeCache;
89  ev.getByToken(theClusterShapeCacheToken, clusterShapeCache);
90 
91  // Generate pairs
92  OrderedHitPairs pairs; pairs.reserve(30000);
93  thePairGenerator->hitPairs(region,pairs,ev,es, pairLayers);
94 
95  if (pairs.empty()) return;
96 
97  int size = thirdLayers.size();
98 
99  // Set aliases
100  const RecHitsSortedInPhi **thirdHitMap = new const RecHitsSortedInPhi*[size];
101  for(int il=0; il<size; il++)
102  thirdHitMap[il] = &(*theLayerCache)(thirdLayers[il], region, es);
103 
104  // Get tracker
105  getTracker(es);
106 
107  // Look at all generated pairs
108  for(OrderedHitPairs::const_iterator ip = pairs.begin();
109  ip!= pairs.end(); ip++)
110  {
111  // Fill rechits and points
112  vector<const TrackingRecHit*> recHits(3);
113  vector<GlobalPoint> points(3);
114 
115  recHits[0] = (*ip).inner()->hit();
116  recHits[1] = (*ip).outer()->hit();
117 
118 #ifdef Debug
119  cerr << " RecHits " + HitInfo::getInfo(*recHits[0]) +
120  HitInfo::getInfo(*recHits[1]) << endl;
121 #endif
122 
123  for(int i=0; i<2; i++)
124  points[i] = getGlobalPosition(recHits[i]);
125 
126  // Initialize helix prediction
128  thePrediction(region,
129  points[0],points[1], es,
131 
132  // Look at all layers
133  for(int il=0; il<size; il++)
134  {
135  const DetLayer * layer = thirdLayers[il].detLayer();
136 
137 #ifdef Debug
138  cerr << " check layer " << layer->subDetector()
139  << " " << layer->location() << endl;
140 #endif
141 
142  // Get ranges for the third hit
143  float phi[2],rz[2];
144  thePrediction.getRanges(layer, phi,rz);
145 
146  PixelRecoRange<float> phiRange(phi[0] , phi[1] );
147  PixelRecoRange<float> rzRange( rz[0] - rzTolerance, rz[1] + rzTolerance);
148 
149  // Get third hit candidates from cache
151  vector<Hit> thirdHits = thirdHitMap[il]->hits(phiRange.min(),phiRange.max());
152  typedef vector<Hit>::const_iterator IH;
153 
154  for (IH th=thirdHits.begin(), eh=thirdHits.end(); th < eh; ++th)
155  {
156  // Fill rechit and point
157  recHits[2] = (*th)->hit();
158  points[2] = getGlobalPosition(recHits[2]);
159 
160 #ifdef Debug
161  cerr << " third hit " + HitInfo::getInfo(*recHits[2]) << endl;
162 #endif
163 
164  // Check if third hit is compatible with multiple scattering
165  vector<GlobalVector> globalDirs;
166  if(thePrediction.isCompatibleWithMultipleScattering
167  (points[2], recHits, globalDirs, es) == false)
168  {
169 #ifdef Debug
170  cerr << " not compatible: multiple scattering" << endl;
171 #endif
172  if(checkMultipleScattering) continue;
173  }
174 
175  // Convert to localDirs
176 /*
177  vector<LocalVector> localDirs;
178  vector<GlobalVector>::const_iterator globalDir = globalDirs.begin();
179  for(vector<const TrackingRecHit *>::const_iterator
180  recHit = recHits.begin();
181  recHit != recHits.end(); recHit++)
182  {
183  localDirs.push_back(theTracker->idToDet(
184  (*recHit)->geographicalId())->toLocal(*globalDir));
185  globalDir++;
186  }
187 */
188 
189  // Check if the cluster shapes are compatible with thrusts
191  {
192  if(! theFilter->checkTrack(recHits,globalDirs,tTopo, *clusterShapeCache))
193  {
194 #ifdef Debug
195  cerr << " not compatible: cluster shape" << endl;
196 #endif
197  continue;
198  }
199  }
200 
201  // All checks passed, put triplet back
202  result.push_back(OrderedHitTriplet((*ip).inner(),(*ip).outer(),*th));
203  }
204  }
205  }
206  delete [] thirdHitMap;
207 
208  return;
209 }
size
Write out results.
std::vector< Hit > hits(float phiMin, float phiMax) const
void getTracker(const edm::EventSetup &es)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
virtual SubDetector subDetector() const =0
The type of detector (PixelBarrel, PixelEndcap, TIB, TOB, TID, TEC, CSC, DT, RPCBarrel, RPCEndcap)
virtual Location location() const =0
Which part of the detector (barrel, endcap)
std::unique_ptr< TripletFilter > theFilter
edm::EDGetTokenT< SiPixelClusterShapeCache > theClusterShapeCacheToken
SeedingHitSet::ConstRecHitPointer Hit
BaseTrackerRecHit const * Hit
std::unique_ptr< HitPairGeneratorFromLayerPair > thePairGenerator
T get() const
Definition: EventSetup.h:71
GlobalPoint getGlobalPosition(const TrackingRecHit *recHit)
static std::string getInfo(const DetId &id, const TrackerTopology *tTopo)
Definition: HitInfo.cc:23
T const * product() const
Definition: ESHandle.h:86
void PixelTripletLowPtGenerator::hitTriplets ( const TrackingRegion region,
OrderedHitTriplets result,
const edm::EventSetup es,
const HitDoublets doublets,
const RecHitsSortedInPhi **  thirdHitMap,
const std::vector< const DetLayer * > &  thirdLayerDetLayer,
const int  nThirdLayers 
)
overridevirtual

Implements HitTripletGeneratorFromPairAndLayers.

Definition at line 210 of file PixelTripletLowPtGenerator.cc.

References Exception.

218 {
219  throw cms::Exception("Error")<<"PixelTripletLowPtGenerator::hitTriplets is not implemented \n";
220 }

Member Data Documentation

std::string PixelTripletLowPtGenerator::builderName
private

Definition at line 58 of file PixelTripletLowPtGenerator.h.

Referenced by hitTriplets(), and PixelTripletLowPtGenerator().

bool PixelTripletLowPtGenerator::checkClusterShape
private

Definition at line 60 of file PixelTripletLowPtGenerator.h.

Referenced by hitTriplets(), and PixelTripletLowPtGenerator().

bool PixelTripletLowPtGenerator::checkMultipleScattering
private

Definition at line 59 of file PixelTripletLowPtGenerator.h.

Referenced by hitTriplets(), and PixelTripletLowPtGenerator().

double PixelTripletLowPtGenerator::maxAngleRatio
private

Definition at line 56 of file PixelTripletLowPtGenerator.h.

Referenced by hitTriplets(), and PixelTripletLowPtGenerator().

double PixelTripletLowPtGenerator::nSigMultipleScattering
private

Definition at line 54 of file PixelTripletLowPtGenerator.h.

Referenced by hitTriplets(), and PixelTripletLowPtGenerator().

double PixelTripletLowPtGenerator::rzTolerance
private

Definition at line 55 of file PixelTripletLowPtGenerator.h.

Referenced by hitTriplets(), and PixelTripletLowPtGenerator().

edm::EDGetTokenT<SiPixelClusterShapeCache> PixelTripletLowPtGenerator::theClusterShapeCacheToken
private

Definition at line 53 of file PixelTripletLowPtGenerator.h.

Referenced by hitTriplets().

std::unique_ptr<TripletFilter> PixelTripletLowPtGenerator::theFilter
private

Definition at line 50 of file PixelTripletLowPtGenerator.h.

Referenced by getTracker(), and hitTriplets().

const TrackerGeometry* PixelTripletLowPtGenerator::theTracker
private

Definition at line 49 of file PixelTripletLowPtGenerator.h.

Referenced by getGlobalPosition(), and getTracker().