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 
7 /* This Class Header */
9 
10 /* Collaborating Class Header */
12 
13 /* C++ Headers */
14 #include <iostream>
15 using namespace std;
16 
17 /* ====================================================================== */
18 
21  const DTSuperLayer& sl,
22  const edm::ESHandle<DTGeometry>& dtGeom) {
23 
24  theWireId = pair.wireId();
25  theDigiTime = pair.digiTime();
26 
27  const DTLayer* layer = dtGeom->layer(theWireId.layerId());
28 
29  // transform the Local position in Layer-rf in a SL local position
30  theLeftPos =
32  theRightPos =
34 
35  // TODO how do I transform an error from local to global?
37  // theError =
38  // layer->surface().toLocal(sl.surface().toGlobal(pair.componentRecHit(DTEnums::Left)->localPositionError()));
39 
40 }
41 
44 }
45 
46 /* Operations */
48  if (s==DTEnums::Left) return theLeftPos;
49  else if (s==DTEnums::Right) return theRightPos;
50  else{
51  throw cms::Exception("DTHitPairForFit")<<" localPosition called with undef LR code"<<endl;
52  return LocalPoint();
53  }
54 }
55 
56 pair<bool,bool>
58  const LocalVector& dirIni) const {
59 
60 
61  pair<bool,bool> ret;
62  LocalPoint segPosAtZLeft = posIni+dirIni*(theLeftPos.z() -posIni.z())/dirIni.z();
63  LocalPoint segPosAtZRight = posIni+dirIni*(theRightPos.z()-posIni.z())/dirIni.z();
64  float dxLeft = fabs(theLeftPos.x() - segPosAtZLeft.x());
65  float dxRight = fabs(theRightPos.x() - segPosAtZRight.x());
66  float exx = sqrt(theError.xx());
67  // if both below 3 sigma, return both
68  // if both at 10 sigma or above, return none
69  // if one is below N sigma and one above, for 10>=N>=3, match only that one, otherwise none
70  if (std::max(dxLeft, dxRight) < 3*exx) {
71  ret = make_pair(true,true);
72  } else if (std::min(dxLeft, dxRight) >= 10*exx) {
73  ret = make_pair(false,false);
74  } else {
75  float sigmasL = floorf(dxLeft/exx), sigmasR = floorf(dxRight/exx);
76  ret.first = ( sigmasL < sigmasR );
77  ret.second = ( sigmasR < sigmasL );
78  }
79  return ret;
80 }
81 
83  //SL if same layer use x() for strict ordering
84  if (id()==hit.id())
85  return (theLeftPos.x() < hit.localPosition(DTEnums::Left).x());
86  return (id() < hit.id());
87 }
88 
90  return (id() == hit.id() && fabs(digiTime() - hit.digiTime()) < 0.1 );
91 }
92 
93 ostream& operator<<(ostream& out, const DTHitPairForFit& hit) {
94  out << hit.leftPos() << " " << hit.rightPos() ;
95  return out;
96 }
tuple ret
prodAgent to be discontinued
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:52
std::pair< bool, bool > isCompatible(const LocalPoint &posIni, const LocalVector &dirIni) const
DTCellSide
Which side of the DT cell.
Definition: DTEnums.h:15
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
Definition: GeomDet.h:67
ostream & operator<<(std::ostream &o, vector< std::string > const &iValue)
Definition: refresh.cc:45
const DTRecHit1D * componentRecHit(DTEnums::DTCellSide lrSide) const
Return the left/right DTRecHit1D.
~DTHitPairForFit()
Destructor.
float digiTime() const
Returns the time of the corresponding digi.
T sqrt(T t)
Definition: SSEVec.h:18
T z() const
Definition: PV3DBase.h:64
DTHitPairForFit(const DTRecHit1DPair &pair, const DTSuperLayer &sl, const edm::ESHandle< DTGeometry > &dtGeom)
Constructor.
T min(T a, T b)
Definition: MathUtil.h:58
virtual LocalError localPositionError() const
Return the 3-dimensional error on the local position.
Definition: DTRecHit1D.h:66
virtual LocalPoint localPosition() const
Return the 3-dimensional local position.
Definition: DTRecHit1D.h:60
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:62