CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
PixelTripletLowPtGenerator Class Reference

#include <PixelTripletLowPtGenerator.h>

Inheritance diagram for PixelTripletLowPtGenerator:
HitTripletGeneratorFromPairAndLayers HitTripletGenerator OrderedHitsGenerator

Public Member Functions

virtual void hitTriplets (const TrackingRegion &region, OrderedHitTriplets &trs, const edm::Event &ev, const edm::EventSetup &es)
 
void init (const HitPairGenerator &pairs, LayerCacheType *layerCache) override
 
const HitPairGeneratorpairGenerator () const
 
 PixelTripletLowPtGenerator (const edm::ParameterSet &cfg, edm::ConsumesCollector &iC)
 
void setSeedingLayers (SeedingLayerSetsHits::SeedingLayerSet pairLayers, std::vector< SeedingLayerSetsHits::SeedingLayer > thirdLayers) override
 
virtual ~PixelTripletLowPtGenerator ()
 
- Public Member Functions inherited from HitTripletGeneratorFromPairAndLayers
virtual ~HitTripletGeneratorFromPairAndLayers ()
 
- Public Member Functions inherited from HitTripletGenerator
virtual void clear () final
 
 HitTripletGenerator (unsigned int size=500)
 
 HitTripletGenerator (HitTripletGenerator const &other)
 
virtual void hitTriplets (const TrackingRegion &reg, OrderedHitTriplets &prs, const edm::EventSetup &es)
 
virtual const OrderedHitTripletsrun (const TrackingRegion &region, const edm::Event &ev, const edm::EventSetup &es) final
 
virtual ~HitTripletGenerator ()
 
- Public Member Functions inherited from OrderedHitsGenerator
 OrderedHitsGenerator ()
 
virtual ~OrderedHitsGenerator ()
 

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
 
edm::ParameterSet ps
 
double rzTolerance
 
edm::EDGetTokenT
< SiPixelClusterShapeCache
theClusterShapeCacheToken
 
TripletFiltertheFilter
 
LayerCacheTypetheLayerCache
 
std::vector
< SeedingLayerSetsHits::SeedingLayer
theLayers
 
HitPairGeneratorthePairGenerator
 
const TrackerGeometrytheTracker
 

Additional Inherited Members

- Public Types inherited from HitTripletGeneratorFromPairAndLayers
typedef LayerHitMapCache LayerCacheType
 
- Public Attributes inherited from OrderedHitsGenerator
unsigned int theMaxElement
 

Detailed Description

Definition at line 24 of file PixelTripletLowPtGenerator.h.

Constructor & Destructor Documentation

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

Definition at line 25 of file PixelTripletLowPtGenerator.cc.

25  :
26  theTracker(nullptr), theFilter(nullptr), ps(cfg), thePairGenerator(nullptr), theLayerCache(nullptr),
28 {}
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
edm::EDGetTokenT< SiPixelClusterShapeCache > theClusterShapeCacheToken
const TrackerGeometry * theTracker
virtual PixelTripletLowPtGenerator::~PixelTripletLowPtGenerator ( )
inlinevirtual

Definition at line 31 of file PixelTripletLowPtGenerator.h.

References theFilter, and thePairGenerator.

31 { delete thePairGenerator; delete theFilter; }

Member Function Documentation

GlobalPoint PixelTripletLowPtGenerator::getGlobalPosition ( const TrackingRecHit recHit)
private

Definition at line 73 of file PixelTripletLowPtGenerator.cc.

References TrackingRecHit::geographicalId(), and TrackingRecHit::localPosition().

Referenced by hitTriplets().

74 {
75  DetId detId = recHit->geographicalId();
76 
77  return
78  theTracker->idToDet(detId)->toGlobal(recHit->localPosition());
79 }
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:52
Definition: DetId.h:18
const TrackerGeometry * theTracker
DetId geographicalId() const
virtual LocalPoint localPosition() const =0
virtual const TrackerGeomDet * idToDet(DetId) const
void PixelTripletLowPtGenerator::getTracker ( const edm::EventSetup es)
private

Definition at line 54 of file PixelTripletLowPtGenerator.cc.

References edm::EventSetup::get(), edm::ESHandle< class >::product(), and patCandidatesForDimuonsSequences_cff::tracker.

Referenced by hitTriplets().

55 {
56  if(theTracker == 0)
57  {
58  // Get tracker geometry
60  es.get<TrackerDigiGeometryRecord>().get(tracker);
61 
62  theTracker = tracker.product();
63  }
64 
65  if(theFilter == 0)
66  {
67  theFilter = new TripletFilter(es);
68  }
69 }
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:86
const TrackerGeometry * theTracker
void PixelTripletLowPtGenerator::hitTriplets ( const TrackingRegion region,
OrderedHitTriplets trs,
const edm::Event ev,
const edm::EventSetup es 
)
virtual

Implements HitTripletGenerator.

Definition at line 82 of file PixelTripletLowPtGenerator.cc.

References builderName, ecal_dqm_sourceclient-live_cfg::cerr, checkClusterShape, checkMultipleScattering, TripletFilter::checkTrack(), ev, edm::EventSetup::get(), edm::Event::getByToken(), getGlobalPosition(), HitInfo::getInfo(), ThirdHitPrediction::getRanges(), getTracker(), HitPairGenerator::hitPairs(), RecHitsSortedInPhi::hits(), i, ThirdHitPrediction::isCompatibleWithMultipleScattering(), DetLayer::location(), PixelRecoRange< T >::max(), maxAngleRatio, PixelRecoRange< T >::min(), nSigMultipleScattering, phi, edm::ESHandle< class >::product(), HLT_25ns14e33_v3_cff::recHits, HLT_25ns14e33_v3_cff::region, rzTolerance, OrderedHitPairs::size(), findQualityFiles::size, DetLayer::subDetector(), theClusterShapeCacheToken, theFilter, theLayerCache, theLayers, and thePairGenerator.

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

Implements HitTripletGeneratorFromPairAndLayers.

Definition at line 31 of file PixelTripletLowPtGenerator.cc.

References builderName, checkClusterShape, checkMultipleScattering, HitPairGenerator::clone(), edm::ParameterSet::getParameter(), maxAngleRatio, nSigMultipleScattering, ps, rzTolerance, theLayerCache, and thePairGenerator.

33 {
34  thePairGenerator = pairs.clone();
35  theLayerCache = layerCache;
36 
37  checkMultipleScattering = ps.getParameter<bool>("checkMultipleScattering");
38  nSigMultipleScattering = ps.getParameter<double>("nSigMultipleScattering");
39  checkClusterShape = ps.getParameter<bool>("checkClusterShape");
40  rzTolerance = ps.getParameter<double>("rzTolerance");
41  maxAngleRatio = ps.getParameter<double>("maxAngleRatio");
42  builderName = ps.getParameter<string>("TTRHBuilder");
43 }
T getParameter(std::string const &) const
virtual HitPairGenerator * clone() const =0
const HitPairGenerator& PixelTripletLowPtGenerator::pairGenerator ( ) const
inline

Definition at line 40 of file PixelTripletLowPtGenerator.h.

References thePairGenerator.

40 { return *thePairGenerator; }
void PixelTripletLowPtGenerator::setSeedingLayers ( SeedingLayerSetsHits::SeedingLayerSet  pairLayers,
std::vector< SeedingLayerSetsHits::SeedingLayer thirdLayers 
)
overridevirtual

Implements HitTripletGeneratorFromPairAndLayers.

Definition at line 46 of file PixelTripletLowPtGenerator.cc.

References HitPairGenerator::setSeedingLayers(), theLayers, and thePairGenerator.

47  {
49  theLayers = thirdLayers;
50 }
std::vector< SeedingLayerSetsHits::SeedingLayer > theLayers
virtual void setSeedingLayers(SeedingLayerSetsHits::SeedingLayerSet layers)=0

Member Data Documentation

std::string PixelTripletLowPtGenerator::builderName
private

Definition at line 60 of file PixelTripletLowPtGenerator.h.

Referenced by hitTriplets(), and init().

bool PixelTripletLowPtGenerator::checkClusterShape
private

Definition at line 62 of file PixelTripletLowPtGenerator.h.

Referenced by hitTriplets(), and init().

bool PixelTripletLowPtGenerator::checkMultipleScattering
private

Definition at line 61 of file PixelTripletLowPtGenerator.h.

Referenced by hitTriplets(), and init().

double PixelTripletLowPtGenerator::maxAngleRatio
private

Definition at line 58 of file PixelTripletLowPtGenerator.h.

Referenced by hitTriplets(), and init().

double PixelTripletLowPtGenerator::nSigMultipleScattering
private

Definition at line 56 of file PixelTripletLowPtGenerator.h.

Referenced by hitTriplets(), and init().

edm::ParameterSet PixelTripletLowPtGenerator::ps
private

Definition at line 49 of file PixelTripletLowPtGenerator.h.

Referenced by init().

double PixelTripletLowPtGenerator::rzTolerance
private

Definition at line 57 of file PixelTripletLowPtGenerator.h.

Referenced by hitTriplets(), and init().

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

Definition at line 54 of file PixelTripletLowPtGenerator.h.

Referenced by hitTriplets().

TripletFilter* PixelTripletLowPtGenerator::theFilter
private

Definition at line 47 of file PixelTripletLowPtGenerator.h.

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

LayerCacheType* PixelTripletLowPtGenerator::theLayerCache
private

Definition at line 52 of file PixelTripletLowPtGenerator.h.

Referenced by hitTriplets(), and init().

std::vector<SeedingLayerSetsHits::SeedingLayer> PixelTripletLowPtGenerator::theLayers
private

Definition at line 51 of file PixelTripletLowPtGenerator.h.

Referenced by hitTriplets(), and setSeedingLayers().

HitPairGenerator* PixelTripletLowPtGenerator::thePairGenerator
private
const TrackerGeometry* PixelTripletLowPtGenerator::theTracker
private

Definition at line 46 of file PixelTripletLowPtGenerator.h.