CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ME0Segment.cc
Go to the documentation of this file.
1 
8 #include <iostream>
9 
10 namespace {
11  // define a Super Layer Id from the first layer of the first rechits, and put to first layer
12  inline
13  DetId buildDetId(ME0DetId id) {
14  return ME0DetId(id.chamberId());
15  }
16 }
17 
19  // Aider class to make the return of the projection Matrix thread-safe
20 protected:
22 public:
24  theProjectionMatrix[0][1] = 1;
25  theProjectionMatrix[1][2] = 1;
26  theProjectionMatrix[2][3] = 1;
27  theProjectionMatrix[3][4] = 1;
28  }
29  const AlgebraicMatrix &getMatrix() const {
30  return (theProjectionMatrix);
31  }
32 };
33 
34 ME0Segment::ME0Segment(const std::vector<const ME0RecHit*>& proto_segment, const LocalPoint& origin,
35  const LocalVector& direction, const AlgebraicSymMatrix& errors, double chi2) :
36  RecSegment(buildDetId(proto_segment.front()->me0Id())),
37  theOrigin(origin),
38  theLocalDirection(direction), theCovMatrix(errors), theChi2(chi2){
39  theTimeValue = 0.0;
40  theTimeUncrt = 0.0;
41  for(unsigned int i=0; i<proto_segment.size(); ++i)
42  theME0RecHits.push_back(*proto_segment[i]);
43 }
44 
45 ME0Segment::ME0Segment(const std::vector<const ME0RecHit*>& proto_segment, const LocalPoint& origin,
46  const LocalVector& direction, const AlgebraicSymMatrix& errors, double chi2, double time, double timeErr) :
47  RecSegment(buildDetId(proto_segment.front()->me0Id())),
48  theOrigin(origin),
49  theLocalDirection(direction), theCovMatrix(errors), theChi2(chi2){
52 
53  for(unsigned int i=0; i<proto_segment.size(); ++i)
54  theME0RecHits.push_back(*proto_segment[i]);
55 }
56 
58 
59 std::vector<const TrackingRecHit*> ME0Segment::recHits() const{
60  std::vector<const TrackingRecHit*> pointersOfRecHits;
61  for (std::vector<ME0RecHit>::const_iterator irh = theME0RecHits.begin(); irh!=theME0RecHits.end(); ++irh) {
62  pointersOfRecHits.push_back(&(*irh));
63  }
64  return pointersOfRecHits;
65 }
66 
67 std::vector<TrackingRecHit*> ME0Segment::recHits() {
68 
69  std::vector<TrackingRecHit*> pointersOfRecHits;
70  for (std::vector<ME0RecHit>::iterator irh = theME0RecHits.begin(); irh!=theME0RecHits.end(); ++irh) {
71  pointersOfRecHits.push_back(&(*irh));
72  }
73  return pointersOfRecHits;
74 }
75 
77  return LocalError(theCovMatrix[2][2], theCovMatrix[2][3], theCovMatrix[3][3]);
78 }
79 
81  return LocalError(theCovMatrix[0][0], theCovMatrix[0][1], theCovMatrix[1][1]);
82 }
83 
84 
86  // For consistency with DT and CSC and what we require for the TrackingRecHit interface,
87  // the order of the parameters in the returned vector should be (dx/dz, dy/dz, x, z)
88 
90 
91  if(theLocalDirection.z() != 0)
92  {
93  result[0] = theLocalDirection.x()/theLocalDirection.z();
94  result[1] = theLocalDirection.y()/theLocalDirection.z();
95  }
96  result[2] = theOrigin.x();
97  result[3] = theOrigin.y();
98 
99  return result;
100 }
101 
104  return (theProjectionMatrix.getMatrix());
105 }
106 
107 //
108 void ME0Segment::print() const {
109  LogDebug("ME0Segment") << *this;
110 
111 }
112 
113 std::ostream& operator<<(std::ostream& os, const ME0Segment& seg) {
114  os << "ME0Segment: local pos = " << seg.localPosition() <<
115  " posErr = (" << sqrt(seg.localPositionError().xx())<<","<<sqrt(seg.localPositionError().yy())<<
116  "0,)\n"<<
117  " dir = " << seg.localDirection() <<
118  " dirErr = (" << sqrt(seg.localDirectionError().xx())<<","<<sqrt(seg.localDirectionError().yy())<<
119  "0,)\n"<<
120  " chi2/ndf = " << ((seg.degreesOfFreedom() != 0.) ? seg.chi2()/double(seg.degreesOfFreedom()) :0 ) <<
121  " #rechits = " << seg.specificRecHits().size()<<
122  " time = "<< seg.time() << " +/- " << seg.timeErr() << " ns ";
123 
124  return os;
125 }
126 
#define LogDebug(id)
virtual int degreesOfFreedom() const
Degrees of freedom of the segment fit.
Definition: ME0Segment.h:63
LocalPoint localPosition() const
Definition: ME0Segment.h:40
double theTimeValue
Definition: ME0Segment.h:85
LocalPoint theOrigin
Definition: ME0Segment.h:81
int i
Definition: DBlmapReader.cc:9
float xx() const
Definition: LocalError.h:24
LocalVector theLocalDirection
Definition: ME0Segment.h:82
const std::vector< ME0RecHit > & specificRecHits() const
Definition: ME0Segment.h:67
T y() const
Definition: PV3DBase.h:63
LocalVector localDirection() const
Local direction.
Definition: ME0Segment.h:43
AlgebraicVector parameters() const
Parameters of the segment, for the track fit in the order (dx/dz, dy/dz, x, y )
Definition: ME0Segment.cc:85
AlgebraicMatrix theProjectionMatrix
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:188
static const AlgebraicMatrix theProjectionMatrix
Definition: CSCSegment.cc:80
double theTimeUncrt
Definition: ME0Segment.h:86
tuple result
Definition: mps_fire.py:84
std::vector< ME0RecHit > theME0RecHits
Definition: ME0Segment.h:80
ME0Segment()
Default constructor.
Definition: ME0Segment.h:25
CLHEP::HepMatrix AlgebraicMatrix
float yy() const
Definition: LocalError.h:26
LocalError localPositionError() const
Definition: ME0Segment.cc:76
T sqrt(T t)
Definition: SSEVec.h:18
void print() const
Definition: ME0Segment.cc:108
T z() const
Definition: PV3DBase.h:64
double chi2() const
Chi2 of the segment fit.
Definition: ME0Segment.h:59
LocalError localDirectionError() const
Error on the local direction.
Definition: ME0Segment.cc:80
virtual AlgebraicMatrix projectionMatrix() const
The projection matrix relates the trajectory state parameters to the segment parameters().
Definition: ME0Segment.cc:102
Definition: DetId.h:18
CLHEP::HepVector AlgebraicVector
virtual std::vector< const TrackingRecHit * > recHits() const
Access to component RecHits (if any)
Definition: ME0Segment.cc:59
virtual ~ME0Segment()
Destructor.
Definition: ME0Segment.cc:57
CLHEP::HepSymMatrix AlgebraicSymMatrix
float timeErr() const
Definition: ME0Segment.h:74
const AlgebraicMatrix & getMatrix() const
Definition: ME0Segment.cc:29
AlgebraicSymMatrix theCovMatrix
Definition: ME0Segment.h:83
T x() const
Definition: PV3DBase.h:62
float time() const
Definition: ME0Segment.h:73