CMS 3D CMS Logo

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 DetId buildDetId(ME0DetId id) { return ME0DetId(id.chamberId()); }
13 } // namespace
14 
16  // Aider class to make the return of the projection Matrix thread-safe
17 protected:
19 
20 public:
22  theProjectionMatrix[0][1] = 1;
23  theProjectionMatrix[1][2] = 1;
24  theProjectionMatrix[2][3] = 1;
25  theProjectionMatrix[3][4] = 1;
26  }
27  const AlgebraicMatrix& getMatrix() const { return (theProjectionMatrix); }
28 };
29 
30 ME0Segment::ME0Segment(const std::vector<const ME0RecHit*>& proto_segment,
31  const LocalPoint& origin,
32  const LocalVector& direction,
34  float chi2)
35  : RecSegment(buildDetId(proto_segment.front()->me0Id())),
36  theOrigin(origin),
37  theLocalDirection(direction),
38  theCovMatrix(errors),
39  theChi2(chi2),
40  theTimeValue(0.),
41  theTimeUncrt(0.),
42  theDeltaPhi(0.) {
43  for (const auto* rh : proto_segment)
44  theME0RecHits.push_back(*rh);
45 }
46 
47 ME0Segment::ME0Segment(const std::vector<const ME0RecHit*>& proto_segment,
48  const LocalPoint& origin,
49  const LocalVector& direction,
51  float chi2,
52  float time,
53  float timeErr,
54  float deltaPhi)
55  : RecSegment(buildDetId(proto_segment.front()->me0Id())),
56  theOrigin(origin),
57  theLocalDirection(direction),
58  theCovMatrix(errors),
59  theChi2(chi2),
60  theTimeValue(time),
61  theTimeUncrt(timeErr),
62  theDeltaPhi(deltaPhi) {
63  for (const auto* rh : proto_segment)
64  theME0RecHits.push_back(*rh);
65 }
66 
68 
69 std::vector<const TrackingRecHit*> ME0Segment::recHits() const {
70  std::vector<const TrackingRecHit*> pointersOfRecHits;
71  for (const auto& rh : theME0RecHits)
72  pointersOfRecHits.push_back(&rh);
73  return pointersOfRecHits;
74 }
75 
76 std::vector<TrackingRecHit*> ME0Segment::recHits() {
77  std::vector<TrackingRecHit*> pointersOfRecHits;
78  for (auto& rh : theME0RecHits)
79  pointersOfRecHits.push_back(&rh);
80  return pointersOfRecHits;
81 }
82 
84  return LocalError(theCovMatrix[2][2], theCovMatrix[2][3], theCovMatrix[3][3]);
85 }
86 
88  return LocalError(theCovMatrix[0][0], theCovMatrix[0][1], theCovMatrix[1][1]);
89 }
90 
92  // For consistency with DT and CSC and what we require for the TrackingRecHit interface,
93  // the order of the parameters in the returned vector should be (dx/dz, dy/dz, x, z)
94 
96 
97  if (theLocalDirection.z() != 0) {
100  }
101  result[2] = theOrigin.x();
102  result[3] = theOrigin.y();
103 
104  return result;
105 }
106 
109  return (theProjectionMatrix.getMatrix());
110 }
111 
112 //
113 void ME0Segment::print() const { LogDebug("ME0Segment") << *this; }
114 
115 std::ostream& operator<<(std::ostream& os, const ME0Segment& seg) {
116  os << "ME0Segment: local pos = " << seg.localPosition() << " posErr = (" << sqrt(seg.localPositionError().xx()) << ","
117  << sqrt(seg.localPositionError().yy()) << "0,)\n"
118  << " dir = " << seg.localDirection() << " dirErr = (" << sqrt(seg.localDirectionError().xx()) << ","
119  << sqrt(seg.localDirectionError().yy()) << "0,)\n"
120  << " chi2/ndf = " << ((seg.degreesOfFreedom() != 0.) ? seg.chi2() / double(seg.degreesOfFreedom()) : 0)
121  << " #rechits = " << seg.specificRecHits().size() << " time = " << seg.time() << " +/- " << seg.timeErr()
122  << " ns ";
123 
124  return os;
125 }
Vector3DBase< float, LocalTag >
ME0Segment::parameters
AlgebraicVector parameters() const override
Parameters of the segment, for the track fit in the order (dx/dz, dy/dz, x, y )
Definition: ME0Segment.cc:91
MessageLogger.h
ME0Segment::theLocalDirection
LocalVector theLocalDirection
Definition: ME0Segment.h:90
PV3DBase::x
T x() const
Definition: PV3DBase.h:59
ME0Segment::specificRecHits
const std::vector< ME0RecHit > & specificRecHits() const
Definition: ME0Segment.h:74
ME0Segment::theCovMatrix
AlgebraicSymMatrix theCovMatrix
Definition: ME0Segment.h:91
RecSegment
Definition: RecSegment.h:27
protons_cff.time
time
Definition: protons_cff.py:39
ME0Segment::print
void print() const
Definition: ME0Segment.cc:113
ME0Segment::degreesOfFreedom
int degreesOfFreedom() const override
Degrees of freedom of the segment fit.
Definition: ME0Segment.h:70
ME0Segment::localDirectionError
LocalError localDirectionError() const override
Error on the local direction.
Definition: ME0Segment.cc:87
hltPixelTracks_cff.chi2
chi2
Definition: hltPixelTracks_cff.py:25
ME0Segment::recHits
std::vector< const TrackingRecHit * > recHits() const override
Access to component RecHits (if any)
Definition: ME0Segment.cc:69
ProjectionMatrixDiag
Definition: GEMCSCSegment.cc:16
PV3DBase::z
T z() const
Definition: PV3DBase.h:61
DetId
Definition: DetId.h:17
ME0Segment::timeErr
float timeErr() const
Definition: ME0Segment.h:81
errors
Definition: errors.py:1
AlgebraicVector
CLHEP::HepVector AlgebraicVector
Definition: AlgebraicObjects.h:13
SiPixelRawToDigiRegional_cfi.deltaPhi
deltaPhi
Definition: SiPixelRawToDigiRegional_cfi.py:9
LocalError::xx
float xx() const
Definition: LocalError.h:22
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
ME0Segment::theME0RecHits
std::vector< ME0RecHit > theME0RecHits
Definition: ME0Segment.h:88
ME0Segment::~ME0Segment
~ME0Segment() override
Destructor.
Definition: ME0Segment.cc:67
Point3DBase< float, LocalTag >
ME0Segment::localDirection
LocalVector localDirection() const override
Local direction.
Definition: ME0Segment.h:50
ProjectionMatrixDiag::getMatrix
const AlgebraicMatrix & getMatrix() const
Definition: ME0Segment.cc:27
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:233
ME0Segment
Definition: ME0Segment.h:20
LocalError
Definition: LocalError.h:12
ME0Segment::theOrigin
LocalPoint theOrigin
Definition: ME0Segment.h:89
PV3DBase::y
T y() const
Definition: PV3DBase.h:60
ME0Segment::projectionMatrix
AlgebraicMatrix projectionMatrix() const override
The projection matrix relates the trajectory state parameters to the segment parameters().
Definition: ME0Segment.cc:107
ProjectionMatrixDiag::theProjectionMatrix
AlgebraicMatrix theProjectionMatrix
Definition: GEMCSCSegment.cc:19
ME0Segment::localPositionError
LocalError localPositionError() const override
Definition: ME0Segment.cc:83
AlgebraicSymMatrix
CLHEP::HepSymMatrix AlgebraicSymMatrix
Definition: AlgebraicObjects.h:15
ME0Segment::chi2
double chi2() const override
Chi2 of the segment fit.
Definition: ME0Segment.h:66
ME0Segment::localPosition
LocalPoint localPosition() const override
Definition: ME0Segment.h:47
ME0DetId
Definition: ME0DetId.h:16
ME0Segment.h
operator<<
std::ostream & operator<<(std::ostream &os, const ME0Segment &seg)
Definition: ME0Segment.cc:115
AlgebraicMatrix
CLHEP::HepMatrix AlgebraicMatrix
Definition: AlgebraicObjects.h:14
ME0Segment::time
float time() const
Definition: ME0Segment.h:80
theProjectionMatrix
static const AlgebraicMatrix theProjectionMatrix
Definition: CSCSegment.cc:79
mps_fire.result
result
Definition: mps_fire.py:311
ME0Segment::ME0Segment
ME0Segment()
Default constructor.
Definition: ME0Segment.h:23
ProjectionMatrixDiag::ProjectionMatrixDiag
ProjectionMatrixDiag()
Definition: ME0Segment.cc:21
LocalError::yy
float yy() const
Definition: LocalError.h:24