CMS 3D CMS Logo

GEMSegment.cc
Go to the documentation of this file.
1 
7 #include <iostream>
8 
9 namespace {
10  // create reference GEM Chamber ID for segment
11  inline DetId buildDetId(GEMDetId id) { return GEMDetId(id.superChamberId()); }
12 } // namespace
13 
15  // Aider class to make the return of the projection Matrix thread-safe
16 protected:
18 
19 public:
21  theProjectionMatrix[0][1] = 1;
22  theProjectionMatrix[1][2] = 1;
23  theProjectionMatrix[2][3] = 1;
24  theProjectionMatrix[3][4] = 1;
25  }
26  const AlgebraicMatrix& getMatrix() const { return (theProjectionMatrix); }
27 };
28 
29 GEMSegment::GEMSegment(const std::vector<const GEMRecHit*>& proto_segment,
30  const LocalPoint& origin,
31  const LocalVector& direction,
33  double chi2)
34  : RecSegment(buildDetId(proto_segment.front()->gemId())),
35  theOrigin(origin),
36  theLocalDirection(direction),
37  theCovMatrix(errors),
38  theChi2(chi2) {
39  theTimeValue = 0.0;
40  theTimeUncrt = 0.0;
41  theBX = -10.0;
42  for (unsigned int i = 0; i < proto_segment.size(); ++i)
43  theGEMRecHits.push_back(*proto_segment[i]);
44 }
45 
46 GEMSegment::GEMSegment(const std::vector<const GEMRecHit*>& proto_segment,
47  const LocalPoint& origin,
48  const LocalVector& direction,
50  double chi2,
51  float bx)
52  : RecSegment(buildDetId(proto_segment.front()->gemId())),
53  theOrigin(origin),
54  theLocalDirection(direction),
55  theCovMatrix(errors),
56  theChi2(chi2) {
57  theTimeValue = 0.0;
58  theTimeUncrt = 0.0;
59  theBX = bx;
60  for (unsigned int i = 0; i < proto_segment.size(); ++i)
61  theGEMRecHits.push_back(*proto_segment[i]);
62 }
63 
64 GEMSegment::GEMSegment(const std::vector<const GEMRecHit*>& proto_segment,
65  const LocalPoint& origin,
66  const LocalVector& direction,
68  double chi2,
69  double time,
70  double timeErr)
71  : RecSegment(buildDetId(proto_segment.front()->gemId())),
72  theOrigin(origin),
73  theLocalDirection(direction),
74  theCovMatrix(errors),
75  theChi2(chi2) {
78  theBX = -10.0;
79  for (unsigned int i = 0; i < proto_segment.size(); ++i)
80  theGEMRecHits.push_back(*proto_segment[i]);
81 }
82 
84 
85 std::vector<const TrackingRecHit*> GEMSegment::recHits() const {
86  std::vector<const TrackingRecHit*> pointersOfRecHits;
87  for (std::vector<GEMRecHit>::const_iterator irh = theGEMRecHits.begin(); irh != theGEMRecHits.end(); ++irh) {
88  pointersOfRecHits.push_back(&(*irh));
89  }
90  return pointersOfRecHits;
91 }
92 
93 std::vector<TrackingRecHit*> GEMSegment::recHits() {
94  std::vector<TrackingRecHit*> pointersOfRecHits;
95  for (std::vector<GEMRecHit>::iterator irh = theGEMRecHits.begin(); irh != theGEMRecHits.end(); ++irh) {
96  pointersOfRecHits.push_back(&(*irh));
97  }
98  return pointersOfRecHits;
99 }
100 
102  return LocalError(theCovMatrix[2][2], theCovMatrix[2][3], theCovMatrix[3][3]);
103 }
104 
106  return LocalError(theCovMatrix[0][0], theCovMatrix[0][1], theCovMatrix[1][1]);
107 }
108 
110  // For consistency with DT and CSC and what we require for the TrackingRecHit interface,
111  // the order of the parameters in the returned vector should be (dx/dz, dy/dz, x, z)
112 
114 
115  if (theLocalDirection.z() != 0) {
118  }
119  result[2] = theOrigin.x();
120  result[3] = theOrigin.y();
121 
122  return result;
123 }
124 
127  return (theProjectionMatrix.getMatrix());
128 }
129 
130 //
131 void GEMSegment::print() const { LogDebug("GEMSegment") << *this; }
132 
133 std::ostream& operator<<(std::ostream& os, const GEMSegment& seg) {
134  os << "GEMSegment: local pos = " << seg.localPosition() << " posErr = (" << sqrt(seg.localPositionError().xx()) << ","
135  << sqrt(seg.localPositionError().yy()) << "0,)\n"
136  << " dir = " << seg.localDirection() << " dirErr = (" << sqrt(seg.localDirectionError().xx()) << ","
137  << sqrt(seg.localDirectionError().yy()) << "0,)\n"
138  << " chi2/ndf = " << ((seg.degreesOfFreedom() != 0.) ? seg.chi2() / double(seg.degreesOfFreedom()) : 0)
139  << " #rechits = " << seg.specificRecHits().size() << " bx = " << seg.bunchX() << " time = " << seg.time()
140  << " +/- " << seg.timeErr() << " ns";
141 
142  return os;
143 }
Vector3DBase< float, LocalTag >
mps_fire.i
i
Definition: mps_fire.py:355
GEMSegment::theCovMatrix
AlgebraicSymMatrix theCovMatrix
Definition: GEMSegment.h:94
MessageLogger.h
PV3DBase::x
T x() const
Definition: PV3DBase.h:59
GEMSegment::localPosition
LocalPoint localPosition() const override
Definition: GEMSegment.h:52
GEMSegment::parameters
AlgebraicVector parameters() const override
Parameters of the segment, for the track fit in the order (dx/dz, dy/dz, x, y )
Definition: GEMSegment.cc:109
RecSegment
Definition: RecSegment.h:27
GEMSegment::projectionMatrix
AlgebraicMatrix projectionMatrix() const override
The projection matrix relates the trajectory state parameters to the segment parameters().
Definition: GEMSegment.cc:125
GEMSegment::~GEMSegment
~GEMSegment() override
Destructor.
Definition: GEMSegment.cc:83
hltPixelTracks_cff.chi2
chi2
Definition: hltPixelTracks_cff.py:25
GEMSegment::recHits
std::vector< const TrackingRecHit * > recHits() const override
Access to component RecHits (if any)
Definition: GEMSegment.cc:85
GEMSegment::theBX
float theBX
Definition: GEMSegment.h:98
ProjectionMatrixDiag
Definition: GEMCSCSegment.cc:15
PV3DBase::z
T z() const
Definition: PV3DBase.h:61
simKBmtfDigis_cfi.bx
bx
Definition: simKBmtfDigis_cfi.py:55
DetId
Definition: DetId.h:17
GEMSegment::bunchX
float bunchX() const
Definition: GEMSegment.h:87
errors
Definition: errors.py:1
AlgebraicVector
CLHEP::HepVector AlgebraicVector
Definition: AlgebraicObjects.h:13
LocalError::xx
float xx() const
Definition: LocalError.h:22
GEMSegment::time
float time() const
Definition: GEMSegment.h:85
GEMSegment::timeErr
float timeErr() const
Definition: GEMSegment.h:86
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
GEMSegment::degreesOfFreedom
int degreesOfFreedom() const override
Degrees of freedom of the segment fit.
Definition: GEMSegment.h:75
GEMSegment::theTimeUncrt
double theTimeUncrt
Definition: GEMSegment.h:97
GEMSegment::localPositionError
LocalError localPositionError() const override
Definition: GEMSegment.cc:101
Point3DBase< float, LocalTag >
GEMSegment::theTimeValue
double theTimeValue
Definition: GEMSegment.h:96
GEMSegment::theLocalDirection
LocalVector theLocalDirection
Definition: GEMSegment.h:93
ProjectionMatrixDiag::getMatrix
const AlgebraicMatrix & getMatrix() const
Definition: GEMSegment.cc:26
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:670
LocalError
Definition: LocalError.h:12
GEMDetId
Definition: GEMDetId.h:17
PV3DBase::y
T y() const
Definition: PV3DBase.h:60
ProjectionMatrixDiag::theProjectionMatrix
AlgebraicMatrix theProjectionMatrix
Definition: GEMCSCSegment.cc:18
AlgebraicSymMatrix
CLHEP::HepSymMatrix AlgebraicSymMatrix
Definition: AlgebraicObjects.h:15
GEMSegment
Definition: GEMSegment.h:19
GEMSegment::print
void print() const
Definition: GEMSegment.cc:131
GEMSegment::chi2
double chi2() const override
Chi2 of the segment fit.
Definition: GEMSegment.h:71
AlgebraicMatrix
CLHEP::HepMatrix AlgebraicMatrix
Definition: AlgebraicObjects.h:14
GEMSegment::GEMSegment
GEMSegment()
Default constructor.
Definition: GEMSegment.h:22
GEMSegment::localDirection
LocalVector localDirection() const override
Local direction.
Definition: GEMSegment.h:55
theProjectionMatrix
static const AlgebraicMatrix theProjectionMatrix
Definition: CSCSegment.cc:79
GEMSegment::theOrigin
LocalPoint theOrigin
Definition: GEMSegment.h:92
operator<<
std::ostream & operator<<(std::ostream &os, const GEMSegment &seg)
Definition: GEMSegment.cc:133
mps_fire.result
result
Definition: mps_fire.py:303
GEMSegment::specificRecHits
const std::vector< GEMRecHit > & specificRecHits() const
Definition: GEMSegment.h:79
GEMSegment::localDirectionError
LocalError localDirectionError() const override
Error on the local direction.
Definition: GEMSegment.cc:105
ntuplemaker.time
time
Definition: ntuplemaker.py:310
ProjectionMatrixDiag::ProjectionMatrixDiag
ProjectionMatrixDiag()
Definition: GEMSegment.cc:20
LocalError::yy
float yy() const
Definition: LocalError.h:24
GEMSegment.h
GEMSegment::theGEMRecHits
std::vector< GEMRecHit > theGEMRecHits
Definition: GEMSegment.h:91