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  theBX = -10.0;
40  theDeltaPhi = -10.0;
41  for (unsigned int i = 0; i < proto_segment.size(); ++i)
42  theGEMRecHits.push_back(*proto_segment[i]);
43 }
44 
45 GEMSegment::GEMSegment(const std::vector<const GEMRecHit*>& proto_segment,
46  const LocalPoint& origin,
47  const LocalVector& direction,
49  double chi2,
50  float bx)
51  : RecSegment(buildDetId(proto_segment.front()->gemId())),
52  theOrigin(origin),
53  theLocalDirection(direction),
54  theCovMatrix(errors),
55  theChi2(chi2),
56  theBX(bx) {
57  theDeltaPhi = -10.0;
58  for (unsigned int i = 0; i < proto_segment.size(); ++i)
59  theGEMRecHits.push_back(*proto_segment[i]);
60 }
61 
62 GEMSegment::GEMSegment(const std::vector<const GEMRecHit*>& proto_segment,
63  const LocalPoint& origin,
64  const LocalVector& direction,
66  double chi2,
67  float bx,
68  float deltaPhi)
69  : RecSegment(buildDetId(proto_segment.front()->gemId())),
70  theOrigin(origin),
71  theLocalDirection(direction),
72  theCovMatrix(errors),
73  theChi2(chi2),
74  theBX(bx),
75  theDeltaPhi(deltaPhi) {
76  for (unsigned int i = 0; i < proto_segment.size(); ++i)
77  theGEMRecHits.push_back(*proto_segment[i]);
78 }
79 
81 
82 std::vector<const TrackingRecHit*> GEMSegment::recHits() const {
83  std::vector<const TrackingRecHit*> pointersOfRecHits;
84  for (std::vector<GEMRecHit>::const_iterator irh = theGEMRecHits.begin(); irh != theGEMRecHits.end(); ++irh) {
85  pointersOfRecHits.push_back(&(*irh));
86  }
87  return pointersOfRecHits;
88 }
89 
90 std::vector<TrackingRecHit*> GEMSegment::recHits() {
91  std::vector<TrackingRecHit*> pointersOfRecHits;
92  for (std::vector<GEMRecHit>::iterator irh = theGEMRecHits.begin(); irh != theGEMRecHits.end(); ++irh) {
93  pointersOfRecHits.push_back(&(*irh));
94  }
95  return pointersOfRecHits;
96 }
97 
99  return LocalError(theCovMatrix[2][2], theCovMatrix[2][3], theCovMatrix[3][3]);
100 }
101 
103  return LocalError(theCovMatrix[0][0], theCovMatrix[0][1], theCovMatrix[1][1]);
104 }
105 
107  // For consistency with DT and CSC and what we require for the TrackingRecHit interface,
108  // the order of the parameters in the returned vector should be (dx/dz, dy/dz, x, z)
109 
111 
112  if (theLocalDirection.z() != 0) {
115  }
116  result[2] = theOrigin.x();
117  result[3] = theOrigin.y();
118 
119  return result;
120 }
121 
124  return (theProjectionMatrix.getMatrix());
125 }
126 
127 //
128 void GEMSegment::print() const { LogDebug("GEMSegment") << *this; }
129 
130 std::ostream& operator<<(std::ostream& os, const GEMSegment& seg) {
131  os << "GEMSegment: local pos = " << seg.localPosition() << " posErr = (" << sqrt(seg.localPositionError().xx()) << ","
132  << sqrt(seg.localPositionError().yy()) << "0,)\n"
133  << " dir = " << seg.localDirection() << " dirErr = (" << sqrt(seg.localDirectionError().xx()) << ","
134  << sqrt(seg.localDirectionError().yy()) << "0,)\n"
135  << " chi2/ndf = " << ((seg.degreesOfFreedom() != 0.) ? seg.chi2() / double(seg.degreesOfFreedom()) : 0)
136  << " #rechits = " << seg.specificRecHits().size() << " bx = " << seg.bunchX() << " deltaPhi = " << seg.deltaPhi();
137 
138  return os;
139 }
Vector3DBase< float, LocalTag >
mps_fire.i
i
Definition: mps_fire.py:428
GEMSegment::theCovMatrix
AlgebraicSymMatrix theCovMatrix
Definition: GEMSegment.h:95
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:106
RecSegment
Definition: RecSegment.h:27
l1GtPatternGenerator_cfi.bx
bx
Definition: l1GtPatternGenerator_cfi.py:18
GEMSegment::projectionMatrix
AlgebraicMatrix projectionMatrix() const override
The projection matrix relates the trajectory state parameters to the segment parameters().
Definition: GEMSegment.cc:122
GEMSegment::~GEMSegment
~GEMSegment() override
Destructor.
Definition: GEMSegment.cc:80
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:82
GEMSegment::deltaPhi
float deltaPhi() const
Definition: GEMSegment.h:87
GEMSegment::theBX
float theBX
Definition: GEMSegment.h:97
ProjectionMatrixDiag
Definition: GEMCSCSegment.cc:16
PV3DBase::z
T z() const
Definition: PV3DBase.h:61
DetId
Definition: DetId.h:17
GEMSegment::bunchX
float bunchX() const
Definition: GEMSegment.h:85
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
GEMSegment::degreesOfFreedom
int degreesOfFreedom() const override
Degrees of freedom of the segment fit.
Definition: GEMSegment.h:75
GEMSegment::localPositionError
LocalError localPositionError() const override
Definition: GEMSegment.cc:98
Point3DBase< float, LocalTag >
GEMSegment::theLocalDirection
LocalVector theLocalDirection
Definition: GEMSegment.h:94
ProjectionMatrixDiag::getMatrix
const AlgebraicMatrix & getMatrix() const
Definition: GEMSegment.cc:26
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:233
LocalError
Definition: LocalError.h:12
GEMDetId
Definition: GEMDetId.h:18
PV3DBase::y
T y() const
Definition: PV3DBase.h:60
ProjectionMatrixDiag::theProjectionMatrix
AlgebraicMatrix theProjectionMatrix
Definition: GEMCSCSegment.cc:19
AlgebraicSymMatrix
CLHEP::HepSymMatrix AlgebraicSymMatrix
Definition: AlgebraicObjects.h:15
GEMSegment
Definition: GEMSegment.h:19
GEMSegment::print
void print() const
Definition: GEMSegment.cc:128
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:93
operator<<
std::ostream & operator<<(std::ostream &os, const GEMSegment &seg)
Definition: GEMSegment.cc:130
mps_fire.result
result
Definition: mps_fire.py:311
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:102
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:92
GEMSegment::theDeltaPhi
float theDeltaPhi
Definition: GEMSegment.h:98