CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DTHitPairForFit.cc
Go to the documentation of this file.
1 
9 /* This Class Header */
11 
12 /* Collaborating Class Header */
14 
15 /* C++ Headers */
16 #include <iostream>
17 using namespace std;
18 
19 /* ====================================================================== */
20 
23  const DTSuperLayer& sl,
24  const edm::ESHandle<DTGeometry>& dtGeom) {
25 
26  theWireId = pair.wireId();
27  theDigiTime = pair.digiTime();
28 
29  const DTLayer* layer = dtGeom->layer(theWireId.layerId());
30 
31  // transform the Local position in Layer-rf in a SL local position
32  theLeftPos =
34  theRightPos =
36 
37  // TODO how do I transform an error from local to global?
39  // theError =
40  // layer->surface().toLocal(sl.surface().toGlobal(pair.componentRecHit(DTEnums::Left)->localPositionError()));
41 
42 }
43 
46 }
47 
48 /* Operations */
50  if (s==DTEnums::Left) return theLeftPos;
51  else if (s==DTEnums::Right) return theRightPos;
52  else{
53  throw cms::Exception("DTHitPairForFit")<<" localPosition called with undef LR code"<<endl;
54  return LocalPoint();
55  }
56 }
57 
58 pair<bool,bool>
60  const LocalVector& dirIni) const {
61 
62 
63  pair<bool,bool> ret;
64  LocalPoint segPosAtZLeft = posIni+dirIni*(theLeftPos.z() -posIni.z())/dirIni.z();
65  LocalPoint segPosAtZRight = posIni+dirIni*(theRightPos.z()-posIni.z())/dirIni.z();
66  float dxLeft = fabs(theLeftPos.x() - segPosAtZLeft.x());
67  float dxRight = fabs(theRightPos.x() - segPosAtZRight.x());
68  float exx = sqrt(theError.xx());
69  // if both below 3 sigma, return both
70  // if both at 10 sigma or above, return none
71  // if one is below N sigma and one above, for 10>=N>=3, match only that one, otherwise none
72  if (std::max(dxLeft, dxRight) < 3*exx) {
73  ret = make_pair(true,true);
74  } else if (std::min(dxLeft, dxRight) >= 10*exx) {
75  ret = make_pair(false,false);
76  } else {
77  float sigmasL = floorf(dxLeft/exx), sigmasR = floorf(dxRight/exx);
78  ret.first = ( sigmasL < sigmasR );
79  ret.second = ( sigmasR < sigmasL );
80  }
81  return ret;
82 }
83 
85  //SL if same layer use x() for strict ordering
86  if (id()==hit.id())
87  return (theLeftPos.x() < hit.localPosition(DTEnums::Left).x());
88  return (id() < hit.id());
89 }
90 
92  return (id() == hit.id() && fabs(digiTime() - hit.digiTime()) < 0.1 );
93 }
94 
95 ostream& operator<<(ostream& out, const DTHitPairForFit& hit) {
96  out << hit.leftPos() << " " << hit.rightPos() ;
97  return out;
98 }
bool operator<(const DTHitPairForFit &hit) const
define the order by increasing z
LocalPoint localPosition(DTEnums::DTCellSide s) const
Returns the local position in the layer.
const DTWireId & id() const
Returns the Id of the wire on which the rechit rely.
float digiTime() const
Return the digi time (ns) used to build the rechits.
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:47
std::pair< bool, bool > isCompatible(const LocalPoint &posIni, const LocalVector &dirIni) const
DTCellSide
Which side of the DT cell.
Definition: DTEnums.h:17
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
Definition: GeomDet.h:62
#define min(a, b)
Definition: mlp_lapack.h:161
ostream & operator<<(std::ostream &o, vector< std::string > const &iValue)
Definition: refresh.cc:46
const DTRecHit1D * componentRecHit(DTEnums::DTCellSide lrSide) const
Return the left/right DTRecHit1D.
~DTHitPairForFit()
Destructor.
const T & max(const T &a, const T &b)
float digiTime() const
Returns the time of the corresponding digi.
T sqrt(T t)
Definition: SSEVec.h:46
T z() const
Definition: PV3DBase.h:63
DTHitPairForFit(const DTRecHit1DPair &pair, const DTSuperLayer &sl, const edm::ESHandle< DTGeometry > &dtGeom)
Constructor.
virtual LocalError localPositionError() const
Return the 3-dimensional error on the local position.
Definition: DTRecHit1D.h:68
virtual LocalPoint localPosition() const
Return the 3-dimensional local position.
Definition: DTRecHit1D.h:62
tuple out
Definition: dbtoconf.py:99
LocalPoint leftPos() const
Returns the position in the layer r.f. of the left rechit.
bool operator==(const DTHitPairForFit &hit) const
LocalPoint rightPos() const
Returns the position in the layer r.f. of the right rechit.
Local3DPoint LocalPoint
Definition: LocalPoint.h:11
DTWireId wireId() const
T x() const
Definition: PV3DBase.h:61