CMS 3D CMS Logo

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

#include <SiStripRecHitMatcher.h>

Public Types

typedef boost::function< void(SiStripMatchedRecHit2D
const &)> 
Collector
 
typedef
SiStripMatchedRecHit2DCollectionNew::FastFiller 
CollectorMatched
 
typedef
SiStripRecHit2DCollectionNew::DetSet::const_iterator 
RecHitIterator
 
typedef std::vector< const
SiStripRecHit2D * > 
SimpleHitCollection
 
typedef
SimpleHitCollection::const_iterator 
SimpleHitIterator
 
typedef std::pair< LocalPoint,
LocalPoint
StripPosition
 

Public Member Functions

template<typename MonoIterator , typename StereoIterator , typename CollectorHelper >
void doubleMatch (MonoIterator monoRHiter, MonoIterator monoRHend, StereoIterator seconditer, StereoIterator seconditerend, const GluedGeomDet *gluedDet, LocalVector trdir, CollectorHelper &collectorHelper) const
 
SiStripMatchedRecHit2D * match (const SiStripRecHit2D *monoRH, const SiStripRecHit2D *stereoRH, const GluedGeomDet *gluedDet, LocalVector trackdirection) const
 
SiStripMatchedRecHit2D * match (const SiStripMatchedRecHit2D *originalRH, const GluedGeomDet *gluedDet, LocalVector trackdirection) const
 
edm::OwnVector
< SiStripMatchedRecHit2D > 
match (const SiStripRecHit2D *monoRH, RecHitIterator begin, RecHitIterator end, const GluedGeomDet *gluedDet) const
 
edm::OwnVector
< SiStripMatchedRecHit2D > 
match (const SiStripRecHit2D *monoRH, RecHitIterator begin, RecHitIterator end, const GluedGeomDet *gluedDet, LocalVector trackdirection) const
 
edm::OwnVector
< SiStripMatchedRecHit2D > 
match (const SiStripRecHit2D *monoRH, SimpleHitIterator begin, SimpleHitIterator end, const GluedGeomDet *gluedDet, LocalVector trackdirection) const
 
void match (const SiStripRecHit2D *monoRH, RecHitIterator begin, RecHitIterator end, CollectorMatched &collector, const GluedGeomDet *gluedDet, LocalVector trackdirection) const
 
void match (const SiStripRecHit2D *monoRH, SimpleHitIterator begin, SimpleHitIterator end, CollectorMatched &collector, const GluedGeomDet *gluedDet, LocalVector trackdirection) const
 
void match (const SiStripRecHit2D *monoRH, SimpleHitIterator begin, SimpleHitIterator end, edm::OwnVector< SiStripMatchedRecHit2D > &collector, const GluedGeomDet *gluedDet, LocalVector trackdirection) const
 
void match (const SiStripRecHit2D *monoRH, SimpleHitIterator begin, SimpleHitIterator end, std::vector< SiStripMatchedRecHit2D * > &collector, const GluedGeomDet *gluedDet, LocalVector trackdirection) const
 
void match (const SiStripRecHit2D *monoRH, SimpleHitIterator begin, SimpleHitIterator end, Collector &collector, const GluedGeomDet *gluedDet, LocalVector trackdirection) const
 the actual implementation More...
 
StripPosition project (const GeomDetUnit *det, const GluedGeomDet *glueddet, StripPosition strip, LocalVector trackdirection) const
 
 SiStripRecHitMatcher (const edm::ParameterSet &conf)
 
 SiStripRecHitMatcher (const double theScale)
 

Public Attributes

float scale_
 

Detailed Description

Definition at line 23 of file SiStripRecHitMatcher.h.

Member Typedef Documentation

typedef boost::function<void(SiStripMatchedRecHit2D const&)> SiStripRecHitMatcher::Collector

Definition at line 33 of file SiStripRecHitMatcher.h.

Definition at line 27 of file SiStripRecHitMatcher.h.

Definition at line 29 of file SiStripRecHitMatcher.h.

typedef std::vector<const SiStripRecHit2D *> SiStripRecHitMatcher::SimpleHitCollection

Definition at line 30 of file SiStripRecHitMatcher.h.

typedef SimpleHitCollection::const_iterator SiStripRecHitMatcher::SimpleHitIterator

Definition at line 31 of file SiStripRecHitMatcher.h.

Definition at line 36 of file SiStripRecHitMatcher.h.

Constructor & Destructor Documentation

SiStripRecHitMatcher::SiStripRecHitMatcher ( const edm::ParameterSet conf)

Definition at line 18 of file SiStripRecHitMatcher.cc.

References edm::ParameterSet::getParameter(), and scale_.

18  {
19  scale_=conf.getParameter<double>("NSigmaInside");
20 }
T getParameter(std::string const &) const
SiStripRecHitMatcher::SiStripRecHitMatcher ( const double  theScale)

Definition at line 22 of file SiStripRecHitMatcher.cc.

References scale_.

22  {
23  scale_=theScale;
24 }

Member Function Documentation

template<typename MonoIterator , typename StereoIterator , typename CollectorHelper >
void SiStripRecHitMatcher::doubleMatch ( MonoIterator  monoRHiter,
MonoIterator  monoRHend,
StereoIterator  seconditer,
StereoIterator  seconditerend,
const GluedGeomDet gluedDet,
LocalVector  trdir,
CollectorHelper &  collectorHelper 
) const

Definition at line 16 of file SSEMatcher.h.

References mathSSE::Vec2< T >::arr, PV3DBase< T, PVType, FrameType >::basicVector(), alignmentValidation::c1, diffTreeTool::diff, error, f, GeomDet::geographicalId(), mathSSE::Vec4< T >::get1(), i, info, StripTopology::localPitch(), StripTopology::localPosition(), PV3DBase< T, PVType, FrameType >::mag2(), Topology::measurementError(), Topology::measurementPosition(), GluedGeomDet::monoDet(), VarParsing::mult, evf::evtn::offset(), position, query::result, indexGen::s2, scale_, GluedGeomDet::stereoDet(), GeomDet::surface(), GeomDetUnit::topology(), HelpertRecHit2DLocalPos::updateWithAPE(), MeasurementError::uu(), Basic3DVector< T >::v, and x.

19  {
20 
22  using mathSSE::Vec3F;
23  using mathSSE::Vec2D;
24  using mathSSE::Vec3D;
25  using mathSSE::Rot3F;
26  typedef GloballyPositioned<float> ToGlobal;
27  typedef typename GloballyPositioned<float>::ToLocal ToLocal;
28 
29  // hits in both mono and stero
30  // match
31  bool notk = trdir.mag2()<FLT_MIN;
32  // FIXME we shall find a faster approximation for trdir: not useful to compute it each time for each strip
33 
34  // stripdet = mono
35  // partnerstripdet = stereo
36  const GeomDetUnit* stripdet = gluedDet->monoDet();
37  const GeomDetUnit* partnerstripdet = gluedDet->stereoDet();
38  const StripTopology& topol=(const StripTopology&)stripdet->topology();
39  const StripTopology& partnertopol=(const StripTopology&)partnerstripdet->topology();
40 
41  // toGlobal is fast, toLocal is slow
42  ToGlobal const & stripDetTrans = stripdet->surface();
43  ToGlobal const & partnerStripDetTrans = partnerstripdet->surface();
44  ToLocal gluedDetInvTrans(gluedDet->surface());
45 
46 
47 
48  StereoInfo cache[std::distance(seconditer,seconditerend)];
49  //iterate on stereo rechits
50  // fill cache with relevant info
51  int cacheSize=0;
52  for (;seconditer!=seconditerend; ++seconditer){
53 
54  const SiStripRecHit2D & secondHit = CollectorHelper::stereoHit(seconditer);
55 
56  double sigmap22 =secondHit.sigmaPitch();
57  if (sigmap22<0) {
58  LocalError tmpError( secondHit.localPositionErrorFast());
59  HelpertRecHit2DLocalPos::updateWithAPE(tmpError, *partnerstripdet);
60  MeasurementError errorstereoRH=partnertopol.measurementError(secondHit.localPositionFast(),tmpError);
61 
62  double pitch=partnertopol.localPitch(secondHit.localPositionFast());
63  secondHit.setSigmaPitch(sigmap22=errorstereoRH.uu()*pitch*pitch);
64  }
65 
66 
67  double STEREOpointX=partnertopol.measurementPosition( secondHit.localPositionFast()).x();
68  MeasurementPoint STEREOpointini(STEREOpointX,-0.5);
69  MeasurementPoint STEREOpointend(STEREOpointX,0.5);
70 
71  LocalPoint locp1 = partnertopol.localPosition(STEREOpointini);
72  LocalPoint locp2 = partnertopol.localPosition(STEREOpointend);
73 
74  GlobalPoint globalpointini=partnerStripDetTrans.toGlobal(locp1);
75  GlobalPoint globalpointend=partnerStripDetTrans.toGlobal(locp2);
76 
77  // position of the initial and final point of the strip in glued local coordinates
78  LocalPoint positiononGluedini=gluedDetInvTrans.toLocal(globalpointini);
79  LocalPoint positiononGluedend=gluedDetInvTrans.toLocal(globalpointend);
80 
81  // in case of no track hypothesis assume a track from the origin through the center of the strip
82  if(notk){
83  LocalPoint lcenterofstrip=secondHit.localPositionFast();
84  GlobalPoint gcenterofstrip= partnerStripDetTrans.toGlobal(lcenterofstrip);
85  GlobalVector gtrackdirection=gcenterofstrip-GlobalPoint(0,0,0);
86  trdir=gluedDetInvTrans.toLocal(gtrackdirection);
87  }
88 
89 
90  Vec3F offset = trdir.basicVector().v * positiononGluedini.basicVector().v.get1<2>()/trdir.basicVector().v.get1<2>();
91 
92 
93  Vec3F ret1 = positiononGluedini.basicVector().v - offset;
94  Vec3F ret2 = positiononGluedend.basicVector().v - offset;
95 
96  double m10=-(ret2.arr[1] - ret1.arr[1]);
97  double m11= ret2.arr[0] - ret1.arr[0];
98 
99  Vec2D c1vec; c1vec.set1(m11*ret1.arr[1] + m10 * ret1.arr[0]);
100 
101  // store
102  StereoInfo info = {c1vec,&secondHit,sigmap22,m10,m11};
103  cache[cacheSize++] = info;
104  }
105 
106 
107 
108  for (;monoRHiter != monoRHend; ++monoRHiter) {
109 
110  SiStripRecHit2D const & monoRH = CollectorHelper::monoHit(monoRHiter);
111 
112  // position of the initial and final point of the strip (RPHI cluster) in local strip coordinates
113  double RPHIpointX = topol.measurementPosition(monoRH.localPositionFast()).x();
114  MeasurementPoint RPHIpointini(RPHIpointX,-0.5);
115  MeasurementPoint RPHIpointend(RPHIpointX,0.5);
116 
117  // position of the initial and final point of the strip in local coordinates (mono det)
118  //StripPosition stripmono=StripPosition(topol.localPosition(RPHIpointini),topol.localPosition(RPHIpointend));
119  LocalPoint locp1o = topol.localPosition(RPHIpointini);
120  LocalPoint locp2o = topol.localPosition(RPHIpointend);
121 
122 
123  // in case of no track hypothesis assume a track from the origin through the center of the strip
124  if(notk){
125  LocalPoint lcenterofstrip=monoRH.localPositionFast();
126  GlobalPoint gcenterofstrip= stripDetTrans.toGlobal(lcenterofstrip);
127  GlobalVector gtrackdirection=gcenterofstrip-GlobalPoint(0,0,0);
128  trdir=gluedDetInvTrans.toLocal(gtrackdirection);
129  }
130 
131 
132  //project mono hit on glued det
133  //StripPosition projectedstripmono=project(stripdet,gluedDet,stripmono,trackdirection);
134 
135 
136  GlobalPoint globalpointini=stripDetTrans.toGlobal(locp1o);
137  GlobalPoint globalpointend=stripDetTrans.toGlobal(locp2o);
138 
139  // position of the initial and final point of the strip in glued local coordinates
140  LocalPoint positiononGluedini=gluedDetInvTrans.toLocal(globalpointini);
141  LocalPoint positiononGluedend=gluedDetInvTrans.toLocal(globalpointend);
142 
143  Vec3F offset = trdir.basicVector().v * positiononGluedini.basicVector().v.get1<2>()/trdir.basicVector().v.get1<2>();
144 
145 
146  Vec3F projini= positiononGluedini.basicVector().v - offset;
147  Vec3F projend = positiononGluedend.basicVector().v -offset;
148 
149  // ret1o = ret1o + (trdir * (ret1o.getSimd(2) / trdirz));
150  // ret2o = ret2o + (trdir * (ret2o.getSimd(2) / trdirz));
151 
152  double m00 = -(projend.arr[1] - projini.arr[1]);//-(projectedstripmono.second.y()-projectedstripmono.first.y());
153  double m01 = (projend.arr[0] - projini.arr[0]); // (projectedstripmono.second.x()-projectedstripmono.first.x());
154  double c0 = m01*projini.arr[1] + m00*projini.arr[0];//m01*projectedstripmono.first.y() + m00*projectedstripmono.first.x();
155 
156  Vec2D c0vec(c0,c0);
157  Vec2D minv00(-m01, m00);
158 
159  //error calculation (the part that depends on mono RH only)
160  double c1 = -m00;
161  double s1 = -m01;
162  double l1 = 1./(c1*c1+s1*s1);
163 
164  // FIXME: here for test...
165  double sigmap12 = monoRH.sigmaPitch();
166  if (sigmap12<0) {
167 
168  LocalError tmpError(monoRH.localPositionErrorFast());
169  HelpertRecHit2DLocalPos::updateWithAPE(tmpError,*stripdet);
170  MeasurementError errormonoRH=topol.measurementError(monoRH.localPositionFast(),tmpError);
171 
172  double pitch=topol.localPitch(monoRH.localPositionFast());
173  monoRH.setSigmaPitch(sigmap12=errormonoRH.uu()*pitch*pitch);
174  }
175 
176  //float code
177  float fc1(c1), fs1(s1);
178  Vec3F scc1(fs1, fc1, fc1, 0.f);
179  Vec3F ssc1(fs1, fs1, fc1, 0.f);
180  Vec3F l1vec; l1vec.set1(l1);
181  const Vec3F cslsimd = scc1 * ssc1 * l1vec;
182  Vec3F sigmap12simd; sigmap12simd.set1(sigmap12);
183 
184  for (int i=0; i!=cacheSize; ++i) {
185  StereoInfo const si = cache[i];
186 
187  // match
188  Vec2D minv10(si.m11, -si.m10);
189  Vec2D mult; mult.set1(1./(m00*si.m11 - m01*si.m10));
190  Vec2D resultmatmul = mult * (minv10 * c0vec + minv00 * si.c1vec);
191 
192  Local2DPoint position(resultmatmul.arr[0], resultmatmul.arr[1]);
193 
194  // LocalError tempError (100,0,100);
195  if (!((gluedDet->surface()).bounds().inside(position,10.f*scale_))) continue;
196 
197  double c2 = -si.m10;
198  double s2 = -si.m11;
199  double l2 = 1./(c2*c2+s2*s2);
200 
201  double diff=(c1*s2-c2*s1);
202  double invdet2 = 1./(diff*diff*l1*l2);
203 
204  float fc2(c2), fs2(s2), fid2(invdet2);
205  Vec3F invdet2simd(fid2, -fid2, fid2, 0.f);
206  Vec3F ccssimd(fs2, fc2, fc2, 0.f);
207  Vec3F csssimd(fs2, fs2, fc2, 0.f);
208  Vec3F l2simd; l2simd.set1(l2);
209  Vec3F sigmap22simd; sigmap22simd.set1(si.sigmap22);
210  Vec3F result = invdet2simd * (sigmap22simd * cslsimd + sigmap12simd * ccssimd * csssimd * l2simd);
211 
212 
213  LocalError error(result.arr[0], result.arr[1], result.arr[2]);
214 
215 
216  if((gluedDet->surface()).bounds().inside(position,error,scale_)){ //if it is inside the gluedet bonds
217 
218  //Change NSigmaInside in the configuration file to accept more hits
219  //...and add it to the Rechit collection
220 
221  collectorHelper.collector()(SiStripMatchedRecHit2D(LocalPoint(position), error,gluedDet->geographicalId() ,
222  &monoRH,si.secondHit));
223  }
224 
225  } // loop on cache info
226 
227  collectorHelper.closure(monoRHiter);
228  } // loop on mono hit
229 
230 }
Vec4 get1() const
Definition: SSEVec.h:209
int i
Definition: DBlmapReader.cc:9
T mag2() const
Definition: PV3DBase.h:66
Vec4< float > Vec3F
Definition: SSEVec.h:531
const GeomDetUnit * monoDet() const
Definition: GluedGeomDet.h:20
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
Vec4< float > Vec3F
Definition: ExtVec.h:123
static void updateWithAPE(LocalError &le, const GeomDet &det)
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:35
static int position[TOTALCHAMBERS][3]
Definition: ReadPGInfo.cc:509
tuple s2
Definition: indexGen.py:106
virtual const Topology & topology() const =0
virtual float localPitch(const LocalPoint &) const =0
virtual MeasurementError measurementError(const LocalPoint &, const LocalError &) const =0
tuple result
Definition: query.py:137
float uu() const
DetId geographicalId() const
The label of this GeomDet.
Definition: GeomDet.h:72
double f[11][100]
virtual MeasurementPoint measurementPosition(const LocalPoint &) const =0
Vec4< double > Vec3D
Definition: SSEVec.h:533
Rot3< float > Rot3F
Definition: SSERot.h:73
unsigned int offset(bool)
Vec2< double > Vec2D
Definition: ExtVec.h:124
Local3DPoint LocalPoint
Definition: LocalPoint.h:11
virtual LocalPoint localPosition(float strip) const =0
Definition: DDAxes.h:10
const BasicVectorType & basicVector() const
Definition: PV3DBase.h:56
const GeomDetUnit * stereoDet() const
Definition: GluedGeomDet.h:21
Vec2< double > Vec2D
Definition: SSEVec.h:532
SiStripMatchedRecHit2D * SiStripRecHitMatcher::match ( const SiStripRecHit2D *  monoRH,
const SiStripRecHit2D *  stereoRH,
const GluedGeomDet gluedDet,
LocalVector  trackdirection 
) const

Definition at line 28 of file SiStripRecHitMatcher.cc.

References runEdmFileComparison::collection.

Referenced by match().

31  {
32  SimpleHitCollection stereoHits(1,stereoRH);
33  std::vector<SiStripMatchedRecHit2D*> collection;
34  match( monoRH,
35  stereoHits.begin(), stereoHits.end(),
36  collection,
37  gluedDet,trackdirection);
38 
39  return collection.empty() ? (SiStripMatchedRecHit2D*)(0) : collection.front();
40 }
SiStripMatchedRecHit2D * match(const SiStripRecHit2D *monoRH, const SiStripRecHit2D *stereoRH, const GluedGeomDet *gluedDet, LocalVector trackdirection) const
std::vector< const SiStripRecHit2D * > SimpleHitCollection
SiStripMatchedRecHit2D * SiStripRecHitMatcher::match ( const SiStripMatchedRecHit2D *  originalRH,
const GluedGeomDet gluedDet,
LocalVector  trackdirection 
) const

Definition at line 43 of file SiStripRecHitMatcher.cc.

45  {
46 
47  throw "SiStripRecHitMatcher::match(const SiStripMatchedRecHit2D *,..) is obsoltete since 5.2.0";
48 
49  /*
50  const SiStripRecHit2D* theMonoRH = origRH->monoHit();
51  // const SiStripRecHit2D* theStereoRH = origRH->stereoHit();
52  SimpleHitCollection theStereoHits(1, origRH->stereoHit());
53  // theStereoHits.push_back(theStereoRH);
54 
55  std::vector<SiStripMatchedRecHit2D*> collection;
56  match( theMonoRH,
57  theStereoHits.begin(), theStereoHits.end(),
58  collection,
59  gluedDet,trackdirection);
60 
61  return collection.empty() ? (SiStripMatchedRecHit2D*)(0) : collection.front();
62  */
63 
64  return nullptr;
65 }
edm::OwnVector<SiStripMatchedRecHit2D> SiStripRecHitMatcher::match ( const SiStripRecHit2D *  monoRH,
RecHitIterator  begin,
RecHitIterator  end,
const GluedGeomDet gluedDet 
) const
inline

Definition at line 61 of file SiStripRecHitMatcher.h.

References match().

63  {
64  return match(monoRH,begin, end, gluedDet,LocalVector(0.,0.,0.));
65  }
Local3DVector LocalVector
Definition: LocalVector.h:12
SiStripMatchedRecHit2D * match(const SiStripRecHit2D *monoRH, const SiStripRecHit2D *stereoRH, const GluedGeomDet *gluedDet, LocalVector trackdirection) const
#define end
Definition: vmac.h:38
#define begin
Definition: vmac.h:31
edm::OwnVector< SiStripMatchedRecHit2D > SiStripRecHitMatcher::match ( const SiStripRecHit2D *  monoRH,
RecHitIterator  begin,
RecHitIterator  end,
const GluedGeomDet gluedDet,
LocalVector  trackdirection 
) const

Definition at line 69 of file SiStripRecHitMatcher.cc.

References end, i, and match().

73 {
74  SimpleHitCollection stereoHits;
75  stereoHits.reserve(end-begin);
76 
77  for (RecHitIterator i=begin; i != end; ++i) {
78  stereoHits.push_back( &(*i)); // convert to simple pointer
79  }
80  return match( monoRH,
81  stereoHits.begin(), stereoHits.end(),
82  gluedDet,trackdirection);
83 }
int i
Definition: DBlmapReader.cc:9
SiStripMatchedRecHit2D * match(const SiStripRecHit2D *monoRH, const SiStripRecHit2D *stereoRH, const GluedGeomDet *gluedDet, LocalVector trackdirection) const
#define end
Definition: vmac.h:38
std::vector< const SiStripRecHit2D * > SimpleHitCollection
SiStripRecHit2DCollectionNew::DetSet::const_iterator RecHitIterator
#define begin
Definition: vmac.h:31
edm::OwnVector< SiStripMatchedRecHit2D > SiStripRecHitMatcher::match ( const SiStripRecHit2D *  monoRH,
SimpleHitIterator  begin,
SimpleHitIterator  end,
const GluedGeomDet gluedDet,
LocalVector  trackdirection 
) const

Definition at line 86 of file SiStripRecHitMatcher.cc.

References match(), and edm::OwnVector< T, P >::reserve().

89  {
91  collector.reserve(end-begin); // a resonable estimate of its size...
92  match(monoRH,begin,end,collector,gluedDet,trackdirection);
93  return collector;
94 }
SiStripMatchedRecHit2D * match(const SiStripRecHit2D *monoRH, const SiStripRecHit2D *stereoRH, const GluedGeomDet *gluedDet, LocalVector trackdirection) const
#define end
Definition: vmac.h:38
#define begin
Definition: vmac.h:31
void reserve(size_t)
Definition: OwnVector.h:267
void SiStripRecHitMatcher::match ( const SiStripRecHit2D *  monoRH,
RecHitIterator  begin,
RecHitIterator  end,
CollectorMatched collector,
const GluedGeomDet gluedDet,
LocalVector  trackdirection 
) const

Definition at line 132 of file SiStripRecHitMatcher.cc.

References end, i, and match().

136  {
137 
138  // is this really needed now????
139  SimpleHitCollection stereoHits;
140  stereoHits.reserve(end-begin);
141  for (RecHitIterator i=begin; i != end; ++i)
142  stereoHits.push_back( &(*i)); // convert to simple pointer
143 
144  return match( monoRH,
145  stereoHits.begin(), stereoHits.end(),
146  collector,
147  gluedDet,trackdirection);
148 }
int i
Definition: DBlmapReader.cc:9
SiStripMatchedRecHit2D * match(const SiStripRecHit2D *monoRH, const SiStripRecHit2D *stereoRH, const GluedGeomDet *gluedDet, LocalVector trackdirection) const
#define end
Definition: vmac.h:38
std::vector< const SiStripRecHit2D * > SimpleHitCollection
SiStripRecHit2DCollectionNew::DetSet::const_iterator RecHitIterator
#define begin
Definition: vmac.h:31
void SiStripRecHitMatcher::match ( const SiStripRecHit2D *  monoRH,
SimpleHitIterator  begin,
SimpleHitIterator  end,
CollectorMatched collector,
const GluedGeomDet gluedDet,
LocalVector  trackdirection 
) const

Definition at line 151 of file SiStripRecHitMatcher.cc.

References match(), edmNew::DetSetVector< T >::FastFiller::push_back(), and query::result.

155  {
156 
157  Collector result(boost::bind(&CollectorMatched::push_back,boost::ref(collector),_1));
158  match(monoRH,begin,end,result,gluedDet,trackdirection);
159 
160 }
void push_back(data_type const &d)
SiStripMatchedRecHit2D * match(const SiStripRecHit2D *monoRH, const SiStripRecHit2D *stereoRH, const GluedGeomDet *gluedDet, LocalVector trackdirection) const
tuple result
Definition: query.py:137
#define end
Definition: vmac.h:38
#define begin
Definition: vmac.h:31
boost::function< void(SiStripMatchedRecHit2D const &)> Collector
void SiStripRecHitMatcher::match ( const SiStripRecHit2D *  monoRH,
SimpleHitIterator  begin,
SimpleHitIterator  end,
edm::OwnVector< SiStripMatchedRecHit2D > &  collector,
const GluedGeomDet gluedDet,
LocalVector  trackdirection 
) const

Definition at line 98 of file SiStripRecHitMatcher.cc.

References match(), AlCaHLTBitMon_ParallelJobs::p, edm::OwnVector< T, P >::push_back(), and query::result.

102  {
103 
104  std::vector<SiStripMatchedRecHit2D*> result;
105  result.reserve(end-begin);
106  match(monoRH,begin,end,result,gluedDet,trackdirection);
107  for (std::vector<SiStripMatchedRecHit2D*>::iterator p=result.begin(); p!=result.end();
108  p++) collector.push_back(*p);
109 }
SiStripMatchedRecHit2D * match(const SiStripRecHit2D *monoRH, const SiStripRecHit2D *stereoRH, const GluedGeomDet *gluedDet, LocalVector trackdirection) const
void push_back(D *&d)
Definition: OwnVector.h:273
tuple result
Definition: query.py:137
#define end
Definition: vmac.h:38
#define begin
Definition: vmac.h:31
void SiStripRecHitMatcher::match ( const SiStripRecHit2D *  monoRH,
SimpleHitIterator  begin,
SimpleHitIterator  end,
std::vector< SiStripMatchedRecHit2D * > &  collector,
const GluedGeomDet gluedDet,
LocalVector  trackdirection 
) const

Definition at line 119 of file SiStripRecHitMatcher.cc.

References clone(), match(), and query::result.

123  {
124  Collector result(boost::bind(&pb,boost::ref(collector),
125  boost::bind(&SiStripMatchedRecHit2D::clone,_1)));
126  match(monoRH,begin,end,result,gluedDet,trackdirection);
127 }
SiStripMatchedRecHit2D * match(const SiStripRecHit2D *monoRH, const SiStripRecHit2D *stereoRH, const GluedGeomDet *gluedDet, LocalVector trackdirection) const
tuple result
Definition: query.py:137
#define end
Definition: vmac.h:38
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
Definition: eve_macros.cc:135
#define begin
Definition: vmac.h:31
boost::function< void(SiStripMatchedRecHit2D const &)> Collector
void SiStripRecHitMatcher::match ( const SiStripRecHit2D *  monoRH,
SimpleHitIterator  begin,
SimpleHitIterator  end,
Collector collector,
const GluedGeomDet gluedDet,
LocalVector  trackdirection 
) const

the actual implementation

Definition at line 165 of file SiStripRecHitMatcher.cc.

References trackerHits::c, alignmentValidation::c1, diffTreeTool::diff, end, error, GeomDet::geographicalId(), StripTopology::localPitch(), StripTopology::localPosition(), m, PV3DBase< T, PVType, FrameType >::mag2(), Topology::measurementError(), Topology::measurementPosition(), GluedGeomDet::monoDet(), position, project(), indexGen::s2, scale_, GluedGeomDet::stereoDet(), GeomDet::surface(), toLocal(), GeomDetUnit::topology(), HelpertRecHit2DLocalPos::updateWithAPE(), MeasurementError::uu(), x, and create_public_lumi_plots::xy.

169  {
170  // stripdet = mono
171  // partnerstripdet = stereo
172  const GeomDetUnit* stripdet = gluedDet->monoDet();
173  const GeomDetUnit* partnerstripdet = gluedDet->stereoDet();
174  const StripTopology& topol=(const StripTopology&)stripdet->topology();
175 
176  // position of the initial and final point of the strip (RPHI cluster) in local strip coordinates
177  double RPHIpointX = topol.measurementPosition(monoRH->localPositionFast()).x();
178  MeasurementPoint RPHIpointini(RPHIpointX,-0.5);
179  MeasurementPoint RPHIpointend(RPHIpointX,0.5);
180 
181  // position of the initial and final point of the strip in local coordinates (mono det)
182  StripPosition stripmono=StripPosition(topol.localPosition(RPHIpointini),topol.localPosition(RPHIpointend));
183 
184  if(trackdirection.mag2()<FLT_MIN){// in case of no track hypothesis assume a track from the origin through the center of the strip
185  LocalPoint lcenterofstrip=monoRH->localPositionFast();
186  GlobalPoint gcenterofstrip=(stripdet->surface()).toGlobal(lcenterofstrip);
187  GlobalVector gtrackdirection=gcenterofstrip-GlobalPoint(0,0,0);
188  trackdirection=(gluedDet->surface()).toLocal(gtrackdirection);
189  }
190 
191  //project mono hit on glued det
192  StripPosition projectedstripmono=project(stripdet,gluedDet,stripmono,trackdirection);
193  const StripTopology& partnertopol=(const StripTopology&)partnerstripdet->topology();
194 
195  double m00 = -(projectedstripmono.second.y()-projectedstripmono.first.y());
196  double m01 = (projectedstripmono.second.x()-projectedstripmono.first.x());
197  double c0 = m01*projectedstripmono.first.y() + m00*projectedstripmono.first.x();
198 
199  //error calculation (the part that depends on mono RH only)
200  // LocalVector RPHIpositiononGluedendvector=projectedstripmono.second-projectedstripmono.first;
201  /*
202  double l1 = 1./RPHIpositiononGluedendvector.perp2();
203  double c1 = RPHIpositiononGluedendvector.y();
204  double s1 =-RPHIpositiononGluedendvector.x();
205  */
206  double c1 = -m00;
207  double s1 = -m01;
208  double l1 = 1./(c1*c1+s1*s1);
209 
210 
211  // FIXME: here for test...
212  double sigmap12 = monoRH->sigmaPitch();
213  if (sigmap12<0) {
214  //AlgebraicSymMatrix tmpMatrix = monoRH->parametersError();
215  /*
216  std::cout << "DEBUG START" << std::endl;
217  std::cout << "APE mono,stereo,glued : "
218  << stripdet->alignmentPositionError()->globalError().cxx() << " , "
219  << partnerstripdet->alignmentPositionError()->globalError().cxx() << " , "
220  << gluedDet->alignmentPositionError()->globalError().cxx() << std::endl;
221  */
222  LocalError tmpError(monoRH->localPositionErrorFast());
223  HelpertRecHit2DLocalPos::updateWithAPE(tmpError,*stripdet);
224  MeasurementError errormonoRH=topol.measurementError(monoRH->localPositionFast(),tmpError);
225  /*
226  std::cout << "localPosError.xx(), helper.xx(), param.xx(): "
227  << monoRH->localPositionError().xx() << " , "
228  << monoRH->parametersError()[0][0] << " , "
229  << tmpMatrix[0][0] << std::endl;
230  */
231  //MeasurementError errormonoRH=topol.measurementError(monoRH->localPosition(),monoRH->localPositionError());
232  double pitch=topol.localPitch(monoRH->localPositionFast());
233  monoRH->setSigmaPitch(sigmap12=errormonoRH.uu()*pitch*pitch);
234  }
235 
236  SimpleHitIterator seconditer;
237 
238  for(seconditer=begin;seconditer!=end;++seconditer){//iterate on stereo rechits
239 
240  // position of the initial and final point of the strip (STEREO cluster)
241  double STEREOpointX=partnertopol.measurementPosition((*seconditer)->localPositionFast()).x();
242  MeasurementPoint STEREOpointini(STEREOpointX,-0.5);
243  MeasurementPoint STEREOpointend(STEREOpointX,0.5);
244 
245  // position of the initial and final point of the strip in local coordinates (stereo det)
246  StripPosition stripstereo(partnertopol.localPosition(STEREOpointini),partnertopol.localPosition(STEREOpointend));
247 
248  //project stereo hit on glued det
249  StripPosition projectedstripstereo=project(partnerstripdet,gluedDet,stripstereo,trackdirection);
250 
251 
252  double m10=-(projectedstripstereo.second.y()-projectedstripstereo.first.y());
253  double m11=(projectedstripstereo.second.x()-projectedstripstereo.first.x());
254 
255  //perform the matching
256  //(x2-x1)(y-y1)=(y2-y1)(x-x1)
257  AlgebraicMatrix22 m; AlgebraicVector2 c; // FIXME understand why moving this initializer out of the loop changes the output!
258  m(0,0)=m00;
259  m(0,1)=m01;
260  m(1,0)=m10;
261  m(1,1)=m11;
262  c(0)=c0;
263  c(1)=m11*projectedstripstereo.first.y()+m10*projectedstripstereo.first.x();
264  m.Invert();
265  AlgebraicVector2 solution = m * c;
266  LocalPoint position(solution(0),solution(1));
267 
268  /*
269  {
270  double m00 = -(projectedstripmono.second.y()-projectedstripmono.first.y());
271  double m01 = (projectedstripmono.second.x()-projectedstripmono.first.x());
272  double m10 = -(projectedstripstereo.second.y()-projectedstripstereo.first.y());
273  double m11 = (projectedstripstereo.second.x()-projectedstripstereo.first.x());
274  double c0 = m01*projectedstripmono.first.y() + m00*projectedstripmono.first.x();
275  double c1 = m11*projectedstripstereo.first.y() + m10*projectedstripstereo.first.x();
276 
277  double invDet = 1./(m00*m11-m10*m01);
278  }
279  */
280 
281  //
282  // temporary fix by tommaso
283  //
284 
285 
286  LocalError tempError (100,0,100);
287  if (!((gluedDet->surface()).bounds().inside(position,tempError,scale_))) continue;
288 
289  // then calculate the error
290  /*
291  LocalVector stereopositiononGluedendvector=projectedstripstereo.second-projectedstripstereo.first;
292  double l2 = 1./stereopositiononGluedendvector.perp2();
293  double c2 = stereopositiononGluedendvector.y();
294  double s2 =-stereopositiononGluedendvector.x();
295  */
296 
297  double c2 = -m10;
298  double s2 = -m11;
299  double l2 = 1./(c2*c2+s2*s2);
300 
301 
302  // FIXME: here for test...
303  double sigmap22 = (*seconditer)->sigmaPitch();
304  if (sigmap22<0) {
305  //AlgebraicSymMatrix tmpMatrix = (*seconditer)->parametersError();
306  LocalError tmpError((*seconditer)->localPositionErrorFast());
307  HelpertRecHit2DLocalPos::updateWithAPE(tmpError, *partnerstripdet);
308  MeasurementError errorstereoRH=partnertopol.measurementError((*seconditer)->localPositionFast(),tmpError);
309  //MeasurementError errorstereoRH=partnertopol.measurementError((*seconditer)->localPosition(),(*seconditer)->localPositionError());
310  double pitch=partnertopol.localPitch((*seconditer)->localPositionFast());
311  (*seconditer)->setSigmaPitch(sigmap22=errorstereoRH.uu()*pitch*pitch);
312  }
313 
314  double diff=(c1*s2-c2*s1);
315  double invdet2=1/(diff*diff*l1*l2);
316  float xx= invdet2*(sigmap12*s2*s2*l2+sigmap22*s1*s1*l1);
317  float xy=-invdet2*(sigmap12*c2*s2*l2+sigmap22*c1*s1*l1);
318  float yy= invdet2*(sigmap12*c2*c2*l2+sigmap22*c1*c1*l1);
319  LocalError error(xx,xy,yy);
320 
321  if((gluedDet->surface()).bounds().inside(position,error,scale_)){ //if it is inside the gluedet bonds
322  //Change NSigmaInside in the configuration file to accept more hits
323  //...and add it to the Rechit collection
324 
325  const SiStripRecHit2D* secondHit = *seconditer;
326  collector(SiStripMatchedRecHit2D(position, error,gluedDet->geographicalId() ,
327  monoRH,secondHit));
328  }
329  }
330 }
T mag2() const
Definition: PV3DBase.h:66
const GeomDetUnit * monoDet() const
Definition: GluedGeomDet.h:20
StripPosition project(const GeomDetUnit *det, const GluedGeomDet *glueddet, StripPosition strip, LocalVector trackdirection) const
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
static void updateWithAPE(LocalError &le, const GeomDet &det)
LocalVector toLocal(const reco::Track::Vector &v, const Surface &s)
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:35
static int position[TOTALCHAMBERS][3]
Definition: ReadPGInfo.cc:509
ROOT::Math::SMatrix< double, 2, 2, ROOT::Math::MatRepStd< double, 2, 2 > > AlgebraicMatrix22
tuple s2
Definition: indexGen.py:106
virtual const Topology & topology() const =0
virtual float localPitch(const LocalPoint &) const =0
virtual MeasurementError measurementError(const LocalPoint &, const LocalError &) const =0
std::pair< LocalPoint, LocalPoint > StripPosition
float uu() const
DetId geographicalId() const
The label of this GeomDet.
Definition: GeomDet.h:72
virtual MeasurementPoint measurementPosition(const LocalPoint &) const =0
#define end
Definition: vmac.h:38
#define begin
Definition: vmac.h:31
SimpleHitCollection::const_iterator SimpleHitIterator
virtual LocalPoint localPosition(float strip) const =0
Definition: DDAxes.h:10
ROOT::Math::SVector< double, 2 > AlgebraicVector2
const GeomDetUnit * stereoDet() const
Definition: GluedGeomDet.h:21
SiStripRecHitMatcher::StripPosition SiStripRecHitMatcher::project ( const GeomDetUnit det,
const GluedGeomDet glueddet,
StripPosition  strip,
LocalVector  trackdirection 
) const

Definition at line 333 of file SiStripRecHitMatcher.cc.

References pileupReCalc_HLTpaths::scale, GeomDet::surface(), toLocal(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by match().

334 {
335 
336  GlobalPoint globalpointini=(det->surface()).toGlobal(strip.first);
337  GlobalPoint globalpointend=(det->surface()).toGlobal(strip.second);
338 
339  // position of the initial and final point of the strip in glued local coordinates
340  LocalPoint positiononGluedini=(glueddet->surface()).toLocal(globalpointini);
341  LocalPoint positiononGluedend=(glueddet->surface()).toLocal(globalpointend);
342 
343  //correct the position with the track direction
344 
345  float scale=-positiononGluedini.z()/trackdirection.z();
346 
347  LocalPoint projpositiononGluedini= positiononGluedini + scale*trackdirection;
348  LocalPoint projpositiononGluedend= positiononGluedend + scale*trackdirection;
349 
350  return StripPosition(projpositiononGluedini,projpositiononGluedend);
351 }
LocalVector toLocal(const reco::Track::Vector &v, const Surface &s)
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:35
std::pair< LocalPoint, LocalPoint > StripPosition
T z() const
Definition: PV3DBase.h:64

Member Data Documentation

float SiStripRecHitMatcher::scale_

Definition at line 130 of file SiStripRecHitMatcher.h.

Referenced by doubleMatch(), match(), and SiStripRecHitMatcher().