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
LowPtClusterShapeSeedComparitor Class Reference

#include <LowPtClusterShapeSeedComparitor.h>

Inheritance diagram for LowPtClusterShapeSeedComparitor:
SeedComparitor

Public Member Functions

virtual bool compatible (const SeedingHitSet &hits, const edm::EventSetup &es)
 
 LowPtClusterShapeSeedComparitor (const edm::ParameterSet &ps)
 
virtual ~LowPtClusterShapeSeedComparitor ()
 
- Public Member Functions inherited from SeedComparitor
virtual ~SeedComparitor ()
 

Private Member Functions

float areaParallelogram (const Global2DVector &a, const Global2DVector &b)
 
std::vector< GlobalVectorgetGlobalDirs (const std::vector< GlobalPoint > &globalPoss)
 
std::vector< GlobalPointgetGlobalPoss (const TransientTrackingRecHit::ConstRecHitContainer &recHits)
 

Private Attributes

const ClusterShapeHitFiltertheFilter
 

Detailed Description

Definition at line 23 of file LowPtClusterShapeSeedComparitor.h.

Constructor & Destructor Documentation

LowPtClusterShapeSeedComparitor::LowPtClusterShapeSeedComparitor ( const edm::ParameterSet ps)

Definition at line 23 of file LowPtClusterShapeSeedComparitor.cc.

24 {
25 
26 }
LowPtClusterShapeSeedComparitor::~LowPtClusterShapeSeedComparitor ( )
virtual

Definition at line 29 of file LowPtClusterShapeSeedComparitor.cc.

30 {
31 }

Member Function Documentation

float LowPtClusterShapeSeedComparitor::areaParallelogram ( const Global2DVector a,
const Global2DVector b 
)
private

Definition at line 35 of file LowPtClusterShapeSeedComparitor.cc.

References PV2DBase< T, PVType, FrameType >::x(), and PV2DBase< T, PVType, FrameType >::y().

36 {
37  return a.x() * b.y() - a.y() * b.x();
38 }
T y() const
Definition: PV2DBase.h:40
T x() const
Definition: PV2DBase.h:39
bool LowPtClusterShapeSeedComparitor::compatible ( const SeedingHitSet hits,
const edm::EventSetup es 
)
virtual

Implements SeedComparitor.

Definition at line 120 of file LowPtClusterShapeSeedComparitor.cc.

References SeedingHitSet::container(), edm::EventSetup::get(), HitInfo::getInfo(), i, TrackingRecHit::isValid(), LogDebug, LogTrace, convertSQLiteXML::ok, and edm::ESHandle< class >::product().

123 {
124 
125  // Get cluster shape hit filter
127  es.get<CkfComponentsRecord>().get("ClusterShapeHitFilter",shape);
128  theFilter = shape.product();
129 
131 
132  // Get global positions
133  vector<GlobalPoint> globalPoss = getGlobalPoss(thits);
134 
135  // Get global directions
136  vector<GlobalVector> globalDirs = getGlobalDirs(globalPoss);
137 
138  bool ok = true;
139 
140  // Check whether shape of pixel cluster is compatible
141  // with local track direction
142 
143  if (globalDirs.size()!=globalPoss.size() || globalDirs.size()!=thits.size())
144  {
145  LogDebug("LowPtClusterShapeSeedComparitor")<<"not enough global dir calculated:"
146  <<"\nnHits: "<<thits.size()
147  <<"\nnPos: "<<globalPoss.size()
148  <<"\nnDir: "<<globalDirs.size()
149  <<" will say the seed is good anyway.";
150  return true;
151  }
152 
153  for(int i = 0; i < 3; i++)
154  {
155  const SiPixelRecHit* pixelRecHit =
156  dynamic_cast<const SiPixelRecHit *>(thits[i]->hit());
157 
158  if (!pixelRecHit){
159  edm::LogError("LowPtClusterShapeSeedComparitor")<<"this is not a pixel cluster";
160  ok = false; break;
161  }
162 
163  if(!pixelRecHit->isValid())
164  {
165  ok = false; break;
166  }
167 
168  LogDebug("LowPtClusterShapeSeedComparitor")<<"about to compute compatibility."
169  <<"hit ptr: "<<pixelRecHit
170  <<"global direction:"<< globalDirs[i];
171 
172 
173  if(! theFilter->isCompatible(*pixelRecHit, globalDirs[i]) )
174  {
175  LogTrace("LowPtClusterShapeSeedComparitor")
176  << " clusShape is not compatible"
177  << HitInfo::getInfo(*thits[i]->hit());
178 
179  ok = false; break;
180  }
181  }
182 
183  return ok;
184 }
#define LogDebug(id)
static std::string getInfo(const DetId &id)
Definition: HitInfo.cc:24
int i
Definition: DBlmapReader.cc:9
const RecHits & container() const
Definition: SeedingHitSet.h:18
std::vector< GlobalVector > getGlobalDirs(const std::vector< GlobalPoint > &globalPoss)
#define LogTrace(id)
std::vector< ConstRecHitPointer > ConstRecHitContainer
bool isCompatible(const SiPixelRecHit &recHit, const LocalVector &ldir) const
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62
bool isValid() const
std::vector< GlobalPoint > getGlobalPoss(const TransientTrackingRecHit::ConstRecHitContainer &recHits)
Our base class.
Definition: SiPixelRecHit.h:27
vector< GlobalVector > LowPtClusterShapeSeedComparitor::getGlobalDirs ( const std::vector< GlobalPoint > &  globalPoss)
private

Definition at line 42 of file LowPtClusterShapeSeedComparitor.cc.

References trackerHits::c, CircleFromThreePoints::center(), PixelRecoUtilities::curvature(), CircleFromThreePoints::curvature(), dir, LogDebug, M_PI, mag2(), L1TEmulatorMonitor_cff::p, slope, funct::sqr(), mathSSE::sqrt(), v, PV2DBase< T, PVType, FrameType >::x(), Basic2DVector< T >::x(), PV2DBase< T, PVType, FrameType >::y(), and Basic2DVector< T >::y().

43 {
44  // Get 2d points
45  vector<Global2DVector> p;
46  for(vector<GlobalPoint>::const_iterator ig = g.begin();
47  ig!= g.end(); ig++)
48  p.push_back( Global2DVector(ig->x(), ig->y()) );
49 
50  //
51  vector<GlobalVector> globalDirs;
52 
53  // Determine circle
54  CircleFromThreePoints circle(g[0],g[1],g[2]);
55 
56  if(circle.curvature() != 0.)
57  {
58  Global2DVector c (circle.center().x(), circle.center().y());
59 
60  float rad2 = (p[0] - c).mag2();
61  float area = fabsf(areaParallelogram(p[1] - p[0], p[1] - c));
62 
63  float a12;
64  if(area >= rad2) a12 = M_PI/2;
65  else a12 = asin(area / rad2);
66 
67  float slope = (g[1].z() - g[0].z()) / a12;
68 
69  float cotTheta = slope * circle.curvature(); // == sinhEta
70  float coshEta = sqrt(1 + sqr(cotTheta)); // == 1/sinTheta
71 
72  // Calculate globalDirs
73  float sinTheta = 1. / coshEta;
74  float cosTheta = cotTheta * sinTheta;
75 
76  int dir;
77  if(areaParallelogram(p[0] - c, p[1] - c) > 0) dir = 1; else dir = -1;
78 
79  float curvature = circle.curvature();
80 
81  for(vector<Global2DVector>::const_iterator ip = p.begin();
82  ip!= p.end(); ip++)
83  {
84  Global2DVector v = (*ip - c)*curvature*dir;
85  globalDirs.push_back(GlobalVector(-v.y()*sinTheta,
86  v.x()*sinTheta,
87  cosTheta));
88  }
89  }
90  else{
91  LogDebug("LowPtClusterShapeSeedComparitor")<<"the curvature is null:"
92  <<"\n point1: "<<g[0]
93  <<"\n point2: "<<g[1]
94  <<"\n point3: "<<g[2];
95  }
96  return globalDirs;
97 }
#define LogDebug(id)
T y() const
Definition: PV2DBase.h:40
static const double slope[3]
float areaParallelogram(const Global2DVector &a, const Global2DVector &b)
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
Definition: Activities.doc:4
T curvature(T InversePt, const edm::EventSetup &iSetup)
T sqrt(T t)
Definition: SSEVec.h:28
T mag2() const
The vector magnitude squared. Equivalent to vec.dot(vec)
#define M_PI
Definition: BFit3D.cc:3
Square< F >::type sqr(const F &f)
Definition: Square.h:13
dbl *** dir
Definition: mlp_gen.cc:35
T x() const
Definition: PV2DBase.h:39
mathSSE::Vec4< T > v
Global3DVector GlobalVector
Definition: GlobalVector.h:10
vector< GlobalPoint > LowPtClusterShapeSeedComparitor::getGlobalPoss ( const TransientTrackingRecHit::ConstRecHitContainer recHits)
private

Definition at line 101 of file LowPtClusterShapeSeedComparitor.cc.

102 {
103  vector<GlobalPoint> globalPoss;
104 
105  for(TransientTrackingRecHit::ConstRecHitContainer::const_iterator recHit = thits.begin();
106  recHit!= thits.end();
107  recHit++)
108  {
109  DetId detId = (*recHit)->hit()->geographicalId();
110 
111  GlobalPoint gpos = (*recHit)->globalPosition();
112 
113  globalPoss.push_back(gpos);
114  }
115 
116  return globalPoss;
117 }
Definition: DetId.h:20

Member Data Documentation

const ClusterShapeHitFilter* LowPtClusterShapeSeedComparitor::theFilter
private

Definition at line 38 of file LowPtClusterShapeSeedComparitor.h.