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)
 
virtual void init (const HitPairGenerator &pairs, const std::vector< ctfseeding::SeedingLayer > &layers, LayerCacheType *layerCache)
 
const HitPairGeneratorpairGenerator () const
 
 PixelTripletLowPtGenerator (const edm::ParameterSet &cfg)
 
const std::vector
< ctfseeding::SeedingLayer > & 
thirdLayers () const
 
virtual ~PixelTripletLowPtGenerator ()
 
- Public Member Functions inherited from HitTripletGeneratorFromPairAndLayers
virtual ~HitTripletGeneratorFromPairAndLayers ()
 
- Public Member Functions inherited from HitTripletGenerator
virtual void clear ()
 
 HitTripletGenerator (unsigned int size=500)
 
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)
 
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
 
TripletFiltertheFilter
 
LayerCacheTypetheLayerCache
 
std::vector
< ctfseeding::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 23 of file PixelTripletLowPtGenerator.h.

Constructor & Destructor Documentation

PixelTripletLowPtGenerator::PixelTripletLowPtGenerator ( const edm::ParameterSet cfg)
inline
virtual PixelTripletLowPtGenerator::~PixelTripletLowPtGenerator ( )
inlinevirtual

Definition at line 32 of file PixelTripletLowPtGenerator.h.

References theFilter, and thePairGenerator.

32 { delete thePairGenerator; delete theFilter; }

Member Function Documentation

GlobalPoint PixelTripletLowPtGenerator::getGlobalPosition ( const TrackingRecHit recHit)
private

Definition at line 58 of file PixelTripletLowPtGenerator.cc.

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

59 {
60  DetId detId = recHit->geographicalId();
61 
62  return
63  theTracker->idToDet(detId)->toGlobal(recHit->localPosition());
64 }
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:47
virtual const GeomDet * idToDet(DetId) const
Definition: DetId.h:20
const TrackerGeometry * theTracker
DetId geographicalId() const
virtual LocalPoint localPosition() const =0
void PixelTripletLowPtGenerator::getTracker ( const edm::EventSetup es)
private

Definition at line 39 of file PixelTripletLowPtGenerator.cc.

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

40 {
41  if(theTracker == 0)
42  {
43  // Get tracker geometry
45  es.get<TrackerDigiGeometryRecord>().get(tracker);
46 
47  theTracker = tracker.product();
48  }
49 
50  if(theFilter == 0)
51  {
52  theFilter = new TripletFilter(es);
53  }
54 }
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62
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 67 of file PixelTripletLowPtGenerator.cc.

References dtNoiseDBValidation_cfg::cerr, ctfseeding::SeedingLayer::detLayer(), HitInfo::getInfo(), ThirdHitPrediction::getRanges(), RecHitsSortedInPhi::hits(), i, ThirdHitPrediction::isCompatibleWithMultipleScattering(), DetLayer::location(), PixelRecoRange< T >::max(), PixelRecoRange< T >::min(), phi, OrderedHitPairs::size(), findQualityFiles::size, and DetLayer::subDetector().

72 {
73  // Generate pairs
74  OrderedHitPairs pairs; pairs.reserve(30000);
75  thePairGenerator->hitPairs(region,pairs,ev,es);
76 
77  if (pairs.size() == 0) return;
78 
79  int size = theLayers.size();
80 
81  // Set aliases
82  const RecHitsSortedInPhi **thirdHitMap = new const RecHitsSortedInPhi*[size];
83  for(int il=0; il<size; il++)
84  thirdHitMap[il] = &(*theLayerCache)(&theLayers[il], region, ev, es);
85 
86  // Get tracker
87  getTracker(es);
88 
89  // Look at all generated pairs
90  for(OrderedHitPairs::const_iterator ip = pairs.begin();
91  ip!= pairs.end(); ip++)
92  {
93  // Fill rechits and points
94  vector<const TrackingRecHit*> recHits(3);
95  vector<GlobalPoint> points(3);
96 
97  recHits[0] = (*ip).inner()->hit();
98  recHits[1] = (*ip).outer()->hit();
99 
100 #ifdef Debug
101  cerr << " RecHits " + HitInfo::getInfo(*recHits[0]) +
102  HitInfo::getInfo(*recHits[1]) << endl;
103 #endif
104 
105  for(int i=0; i<2; i++)
106  points[i] = getGlobalPosition(recHits[i]);
107 
108  // Initialize helix prediction
110  thePrediction(region,
111  points[0],points[1], es,
113 
114  // Look at all layers
115  for(int il=0; il<size; il++)
116  {
117  const SeedingLayer & layerwithhits = theLayers[il];
118  const DetLayer * layer = layerwithhits.detLayer();
119 
120 #ifdef Debug
121  cerr << " check layer " << layer->subDetector()
122  << " " << layer->location() << endl;
123 #endif
124 
125  // Get ranges for the third hit
126  float phi[2],rz[2];
127  thePrediction.getRanges(layer, phi,rz);
128 
129  PixelRecoRange<float> phiRange(phi[0] , phi[1] );
130  PixelRecoRange<float> rzRange( rz[0] - rzTolerance, rz[1] + rzTolerance);
131 
132  // Get third hit candidates from cache
134  vector<Hit> thirdHits = thirdHitMap[il]->hits(phiRange.min(),phiRange.max());
135  typedef vector<Hit>::const_iterator IH;
136 
137  for (IH th=thirdHits.begin(), eh=thirdHits.end(); th < eh; ++th)
138  {
139  // Fill rechit and point
140  recHits[2] = (*th)->hit();
141  points[2] = getGlobalPosition(recHits[2]);
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
150  (points[2], recHits, globalDirs, es) == false)
151  {
152 #ifdef Debug
153  cerr << " not compatible: multiple scattering" << endl;
154 #endif
155  if(checkMultipleScattering) continue;
156  }
157 
158  // Convert to localDirs
159 /*
160  vector<LocalVector> localDirs;
161  vector<GlobalVector>::const_iterator globalDir = globalDirs.begin();
162  for(vector<const TrackingRecHit *>::const_iterator
163  recHit = recHits.begin();
164  recHit != recHits.end(); recHit++)
165  {
166  localDirs.push_back(theTracker->idToDet(
167  (*recHit)->geographicalId())->toLocal(*globalDir));
168  globalDir++;
169  }
170 */
171 
172  // Check if the cluster shapes are compatible with thrusts
174  {
175  if(! theFilter->checkTrack(recHits,globalDirs))
176  {
177 #ifdef Debug
178  cerr << " not compatible: cluster shape" << endl;
179 #endif
180  continue;
181  }
182  }
183 
184  // All checks passed, put triplet back
185  result.push_back(OrderedHitTriplet((*ip).inner(),(*ip).outer(),*th));
186  }
187  }
188  }
189  delete [] thirdHitMap;
190 
191  return;
192 }
static std::string getInfo(const DetId &id)
Definition: HitInfo.cc:24
int i
Definition: DBlmapReader.cc:9
void getTracker(const edm::EventSetup &es)
virtual Location location() const =0
Which part of the detector (barrel, endcap)
const DetLayer * detLayer() const
Definition: SeedingLayer.cc:80
std::vector< Hit > hits(float phiMin, float phiMax) const
virtual SubDetector subDetector() const =0
The type of detector (PixelBarrel, PixelEndcap, TIB, TOB, TID, TEC, CSC, DT, RPCBarrel, RPCEndcap)
virtual unsigned int size() const
virtual void hitPairs(const TrackingRegion &reg, OrderedHitPairs &prs, const edm::EventSetup &es)
tuple result
Definition: query.py:137
std::vector< ctfseeding::SeedingLayer > theLayers
TransientTrackingRecHit::ConstRecHitPointer Hit
GlobalPoint getGlobalPosition(const TrackingRecHit *recHit)
bool checkTrack(std::vector< const TrackingRecHit * > recHits, std::vector< LocalVector > localDirs)
tuple size
Write out results.
Definition: DDAxes.h:10
void PixelTripletLowPtGenerator::init ( const HitPairGenerator pairs,
const std::vector< ctfseeding::SeedingLayer > &  layers,
LayerCacheType layerCache 
)
virtual

Implements HitTripletGeneratorFromPairAndLayers.

Definition at line 21 of file PixelTripletLowPtGenerator.cc.

References HitPairGenerator::clone().

24 {
25  thePairGenerator = pairs.clone();
26  theLayers = layers;
27  theLayerCache = layerCache;
28 
29  checkMultipleScattering = ps.getParameter<bool>("checkMultipleScattering");
30  nSigMultipleScattering = ps.getParameter<double>("nSigMultipleScattering");
31  checkClusterShape = ps.getParameter<bool>("checkClusterShape");
32  rzTolerance = ps.getParameter<double>("rzTolerance");
33  maxAngleRatio = ps.getParameter<double>("maxAngleRatio");
34  builderName = ps.getParameter<string>("TTRHBuilder");
35 }
T getParameter(std::string const &) const
virtual HitPairGenerator * clone() const =0
std::vector< ctfseeding::SeedingLayer > theLayers
const HitPairGenerator& PixelTripletLowPtGenerator::pairGenerator ( ) const
inline

Definition at line 39 of file PixelTripletLowPtGenerator.h.

References thePairGenerator.

39 { return *thePairGenerator; }
const std::vector<ctfseeding::SeedingLayer>& PixelTripletLowPtGenerator::thirdLayers ( ) const
inline

Definition at line 40 of file PixelTripletLowPtGenerator.h.

References theLayers.

40 { return theLayers; }
std::vector< ctfseeding::SeedingLayer > theLayers

Member Data Documentation

std::string PixelTripletLowPtGenerator::builderName
private

Definition at line 58 of file PixelTripletLowPtGenerator.h.

bool PixelTripletLowPtGenerator::checkClusterShape
private

Definition at line 60 of file PixelTripletLowPtGenerator.h.

bool PixelTripletLowPtGenerator::checkMultipleScattering
private

Definition at line 59 of file PixelTripletLowPtGenerator.h.

double PixelTripletLowPtGenerator::maxAngleRatio
private

Definition at line 56 of file PixelTripletLowPtGenerator.h.

double PixelTripletLowPtGenerator::nSigMultipleScattering
private

Definition at line 54 of file PixelTripletLowPtGenerator.h.

edm::ParameterSet PixelTripletLowPtGenerator::ps
private

Definition at line 49 of file PixelTripletLowPtGenerator.h.

double PixelTripletLowPtGenerator::rzTolerance
private

Definition at line 55 of file PixelTripletLowPtGenerator.h.

TripletFilter* PixelTripletLowPtGenerator::theFilter
private

Definition at line 47 of file PixelTripletLowPtGenerator.h.

Referenced by ~PixelTripletLowPtGenerator().

LayerCacheType* PixelTripletLowPtGenerator::theLayerCache
private

Definition at line 52 of file PixelTripletLowPtGenerator.h.

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

Definition at line 51 of file PixelTripletLowPtGenerator.h.

Referenced by thirdLayers().

HitPairGenerator* PixelTripletLowPtGenerator::thePairGenerator
private

Definition at line 50 of file PixelTripletLowPtGenerator.h.

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

const TrackerGeometry* PixelTripletLowPtGenerator::theTracker
private

Definition at line 46 of file PixelTripletLowPtGenerator.h.