test
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.region(),1,id.chamber(),id.roll());
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 
35 ME0Segment::ME0Segment(const std::vector<const ME0RecHit*>& proto_segment, LocalPoint origin,
36  LocalVector direction, AlgebraicSymMatrix errors, double chi2) :
37  RecSegment(buildDetId(proto_segment.front()->me0Id())),
38  theOrigin(origin),
39  theLocalDirection(direction), theCovMatrix(errors), theChi2(chi2){
40  theTimeValue = 0.0;
41  theTimeUncrt = 0.0;
42  for(unsigned int i=0; i<proto_segment.size(); ++i)
43  theME0RecHits.push_back(*proto_segment[i]);
44 }
45 
46 ME0Segment::ME0Segment(const std::vector<const ME0RecHit*>& proto_segment, LocalPoint origin,
47  LocalVector direction, AlgebraicSymMatrix errors, double chi2, double time, double timeErr) :
48  RecSegment(buildDetId(proto_segment.front()->me0Id())),
49  theOrigin(origin),
50  theLocalDirection(direction), theCovMatrix(errors), theChi2(chi2){
53 
54  for(unsigned int i=0; i<proto_segment.size(); ++i)
55  theME0RecHits.push_back(*proto_segment[i]);
56 }
57 
59 
60 std::vector<const TrackingRecHit*> ME0Segment::recHits() const{
61  std::vector<const TrackingRecHit*> pointersOfRecHits;
62  for (std::vector<ME0RecHit>::const_iterator irh = theME0RecHits.begin(); irh!=theME0RecHits.end(); ++irh) {
63  pointersOfRecHits.push_back(&(*irh));
64  }
65  return pointersOfRecHits;
66 }
67 
68 std::vector<TrackingRecHit*> ME0Segment::recHits() {
69 
70  std::vector<TrackingRecHit*> pointersOfRecHits;
71  for (std::vector<ME0RecHit>::iterator irh = theME0RecHits.begin(); irh!=theME0RecHits.end(); ++irh) {
72  pointersOfRecHits.push_back(&(*irh));
73  }
74  return pointersOfRecHits;
75 }
76 
78  return LocalError(theCovMatrix[2][2], theCovMatrix[2][3], theCovMatrix[3][3]);
79 }
80 
82  return LocalError(theCovMatrix[0][0], theCovMatrix[0][1], theCovMatrix[1][1]);
83 }
84 
85 
87  // For consistency with DT and CSC and what we require for the TrackingRecHit interface,
88  // the order of the parameters in the returned vector should be (dx/dz, dy/dz, x, z)
89 
91 
92  if(theLocalDirection.z() != 0)
93  {
94  result[0] = theLocalDirection.x()/theLocalDirection.z();
95  result[1] = theLocalDirection.y()/theLocalDirection.z();
96  }
97  result[2] = theOrigin.x();
98  result[3] = theOrigin.y();
99 
100  return result;
101 }
102 
105  return (theProjectionMatrix.getMatrix());
106 }
107 
108 //
109 void ME0Segment::print() const {
110  LogDebug("ME0Segment") << *this;
111 
112 }
113 
114 std::ostream& operator<<(std::ostream& os, const ME0Segment& seg) {
115  os << "ME0Segment: local pos = " << seg.localPosition() <<
116  " posErr = (" << sqrt(seg.localPositionError().xx())<<","<<sqrt(seg.localPositionError().yy())<<
117  "0,)\n"<<
118  " dir = " << seg.localDirection() <<
119  " dirErr = (" << sqrt(seg.localDirectionError().xx())<<","<<sqrt(seg.localDirectionError().yy())<<
120  "0,)\n"<<
121  " chi2/ndf = " << ((seg.degreesOfFreedom() != 0.) ? seg.chi2()/double(seg.degreesOfFreedom()) :0 ) <<
122  " #rechits = " << seg.specificRecHits().size()<<
123  " time = "<< seg.time() << " +/- " << seg.timeErr() << " ns ";
124 
125  return os;
126 }
127 
#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:86
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:77
T sqrt(T t)
Definition: SSEVec.h:18
void print() const
Definition: ME0Segment.cc:109
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:81
virtual AlgebraicMatrix projectionMatrix() const
The projection matrix relates the trajectory state parameters to the segment parameters().
Definition: ME0Segment.cc:103
Definition: DetId.h:18
CLHEP::HepVector AlgebraicVector
virtual std::vector< const TrackingRecHit * > recHits() const
Access to component RecHits (if any)
Definition: ME0Segment.cc:60
virtual ~ME0Segment()
Destructor.
Definition: ME0Segment.cc:58
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