Skip to content

Commit 1d50057

Browse files
authored
Merge pull request cms-sw#31314 from JanFSchulte/VHIntegrationV2
Integrating VectorHits reconstruction for the Phase2 OT - reprise
2 parents 11c67e5 + 53aad7e commit 1d50057

File tree

70 files changed

+4804
-146
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+4804
-146
lines changed

CommonTools/RecoAlgos/src/ClusterStorer.cc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include "DataFormats/TrackerRecHit2D/interface/ProjectedSiStripRecHit2D.h"
1010
#include "DataFormats/TrackerRecHit2D/interface/SiStripMatchedRecHit2D.h"
1111
#include "DataFormats/TrackerRecHit2D/interface/Phase2TrackerRecHit1D.h"
12+
#include "DataFormats/TrackerRecHit2D/interface/VectorHit.h"
1213
// FastSim hits:
1314
#include "DataFormats/TrackerRecHit2D/interface/FastTrackerRecHit.h"
1415
#include "DataFormats/TrackerRecHit2D/interface/FastProjectedTrackerRecHit.h"
@@ -44,9 +45,12 @@ namespace helper {
4445
} else if (hit_type == typeid(Phase2TrackerRecHit1D)) {
4546
//FIXME:: this is just temporary solution for phase2,
4647
//it is not really running in the phase2 tracking wf - yet...
47-
//std::cout << "| It is a Phase2TrackerRecHit1D hit !!" << std::endl;
4848
phase2OTClusterRecords_.push_back(
4949
Phase2OTClusterHitRecord(static_cast<Phase2TrackerRecHit1D &>(newHit), hits, index));
50+
} else if (hit_type == typeid(VectorHit)) {
51+
//FIXME:: this is just temporary solution for phase2,
52+
//the VectorHit has 2 clusters but just a hit!
53+
phase2OTClusterRecords_.push_back(Phase2OTClusterHitRecord(static_cast<VectorHit &>(newHit), hits, index));
5054
} else {
5155
if (hit_type == typeid(FastTrackerRecHit) || hit_type == typeid(FastProjectedTrackerRecHit) ||
5256
hit_type == typeid(FastMatchedTrackerRecHit)) {
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import FWCore.ParameterSet.Config as cms
2+
3+
# This modifier is for activating Vector Hits reconstruction in the Phase II OT
4+
5+
vectorHits = cms.Modifier()

Configuration/PyReleaseValidation/python/relval_2026.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
numWFIB.extend([23434.99,23434.999]) #2026D49 premixing combined stage1+stage2 (ttbar+PU200, ttbar+PU50 for PR test)
2020
numWFIB.extend([23234.21,23434.21]) #2026D49 prodlike, prodlike PU
2121
numWFIB.extend([23234.103]) #2026D49 aging
22+
numWFIB.extend([23234.9]) #2026D49 vector hits
2223
numWFIB.extend([28234.0]) #2026D60
2324
numWFIB.extend([29834.0]) #2026D64
2425
numWFIB.extend([30234.0]) #2026D65

Configuration/PyReleaseValidation/python/upgradeWorkflowComponents.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,23 @@ def condition_(self, fragment, stepList, key, hasHarvest):
300300
'--procModifiers': 'trackingMkFit'
301301
}
302302

303+
# Vector Hits workflows
304+
class UpgradeWorkflow_vectorHits(UpgradeWorkflow):
305+
def setup_(self, step, stepName, stepDict, k, properties):
306+
stepDict[stepName][k] = merge([{'--procModifiers': 'vectorHits'}, stepDict[step][k]])
307+
def condition(self, fragment, stepList, key, hasHarvest):
308+
return fragment=="TTbar_14TeV" and '2026' in key
309+
upgradeWFs['vectorHits'] = UpgradeWorkflow_vectorHits(
310+
steps = [
311+
'RecoGlobal',
312+
],
313+
PU = [
314+
'RecoGlobal',
315+
],
316+
suffix = '_vectorHits',
317+
offset = 0.9,
318+
)
319+
303320
# Patatrack workflows
304321
class UpgradeWorkflowPatatrack(UpgradeWorkflow):
305322
def condition(self, fragment, stepList, key, hasHarvest):

DataFormats/TrackerRecHit2D/interface/BaseTrackerRecHit.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ class BaseTrackerRecHit : public TrackingRecHit {
2323

2424
// no position (as in persistent)
2525
BaseTrackerRecHit(DetId id, trackerHitRTTI::RTTI rt) : TrackingRecHit(id, (unsigned int)(rt)), qualWord_(0) {}
26+
BaseTrackerRecHit(const GeomDet& idet, trackerHitRTTI::RTTI rt)
27+
: TrackingRecHit(idet, (unsigned int)(rt)), qualWord_(0) {}
2628

2729
BaseTrackerRecHit(const LocalPoint& p, const LocalError& e, GeomDet const& idet, trackerHitRTTI::RTTI rt)
2830
: TrackingRecHit(idet, (unsigned int)(rt)), pos_(p), err_(e), qualWord_(0) {
@@ -49,18 +51,17 @@ class BaseTrackerRecHit : public TrackingRecHit {
4951
// verify that hits can share clusters...
5052
inline bool sameDetModule(TrackingRecHit const& hit) const;
5153

52-
bool hasPositionAndError() const final;
54+
bool hasPositionAndError() const override;
5355

54-
LocalPoint localPosition() const final {
56+
LocalPoint localPosition() const override {
5557
check();
5658
return pos_;
5759
}
5860

59-
LocalError localPositionError() const final {
61+
LocalError localPositionError() const override {
6062
check();
6163
return err_;
6264
}
63-
6465
const LocalPoint& localPositionFast() const {
6566
check();
6667
return pos_;

DataFormats/TrackerRecHit2D/interface/TkCloner.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ class SiStripRecHit1D;
1111
class SiStripMatchedRecHit2D;
1212
class ProjectedSiStripRecHit2D;
1313
class Phase2TrackerRecHit1D;
14+
class VectorHit;
1415

1516
class TkCloner {
1617
public:
@@ -39,6 +40,7 @@ class TkCloner {
3940
TrajectoryStateOnSurface const& tsos) const = 0;
4041
virtual std::unique_ptr<Phase2TrackerRecHit1D> operator()(Phase2TrackerRecHit1D const& hit,
4142
TrajectoryStateOnSurface const& tsos) const = 0;
43+
virtual std::unique_ptr<VectorHit> operator()(VectorHit const& hit, TrajectoryStateOnSurface const& tsos) const = 0;
4244

4345
#ifndef __GCCXML__
4446
virtual TrackingRecHit::ConstRecHitPointer makeShared(SiPixelRecHit const& hit,
@@ -53,6 +55,8 @@ class TkCloner {
5355
TrajectoryStateOnSurface const& tsos) const = 0;
5456
virtual TrackingRecHit::ConstRecHitPointer makeShared(Phase2TrackerRecHit1D const& hit,
5557
TrajectoryStateOnSurface const& tsos) const = 0;
58+
virtual TrackingRecHit::ConstRecHitPointer makeShared(VectorHit const& hit,
59+
TrajectoryStateOnSurface const& tsos) const = 0;
5660
#endif
5761
};
5862
#endif
Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
#ifndef DataFormats_TrackerRecHit2D_VectorHit_h
2+
#define DataFormats_TrackerRecHit2D_VectorHit_h
3+
4+
/** \class VectorHit
5+
*
6+
* 4-parameter RecHits for Phase2 Tracker (x,y, dx/dz, dy/dz)
7+
*
8+
* $Date: 2015/03/30 $
9+
* \author Erica Brondolin
10+
*
11+
*/
12+
13+
#include "DataFormats/TrackerRecHit2D/interface/BaseTrackerRecHit.h"
14+
#include "DataFormats/TrackerRecHit2D/interface/VectorHit2D.h"
15+
#include "DataFormats/TrackerRecHit2D/interface/OmniClusterRef.h"
16+
17+
#include "DataFormats/Common/interface/DetSetVector.h"
18+
#include "DataFormats/Common/interface/DetSetVectorNew.h"
19+
20+
#include "DataFormats/Phase2TrackerCluster/interface/Phase2TrackerCluster1D.h"
21+
#include "DataFormats/GeometryVector/interface/LocalVector.h"
22+
#include "Geometry/CommonDetUnit/interface/PixelGeomDetUnit.h"
23+
24+
#include "DataFormats/TrackingRecHit/interface/KfComponentsHolder.h"
25+
26+
#include "DataFormats/TrackerRecHit2D/interface/TkCloner.h"
27+
28+
class VectorHit final : public BaseTrackerRecHit {
29+
public:
30+
typedef OmniClusterRef::Phase2Cluster1DRef ClusterRef;
31+
32+
VectorHit() : thePosition(), theDirection(), theCovMatrix() { setType(bad); }
33+
34+
VectorHit(const GeomDet& idet,
35+
const LocalPoint& posInner,
36+
const LocalVector& dir,
37+
const AlgebraicSymMatrix44& covMatrix,
38+
const float chi2,
39+
OmniClusterRef const& lower,
40+
OmniClusterRef const& upper,
41+
const float curvature,
42+
const float curvatureError,
43+
const float phi);
44+
45+
VectorHit(const GeomDet& idet,
46+
const VectorHit2D& vh2Dzx,
47+
const VectorHit2D& vh2Dzy,
48+
OmniClusterRef const& lower,
49+
OmniClusterRef const& upper,
50+
const float curvature,
51+
const float curvatureError,
52+
const float phi);
53+
54+
~VectorHit() override = default;
55+
56+
VectorHit* clone() const override { return new VectorHit(*this); }
57+
RecHitPointer cloneSH() const override { return std::make_shared<VectorHit>(*this); }
58+
59+
bool sharesInput(const TrackingRecHit* other, SharedInputType what) const override;
60+
bool sharesClusters(VectorHit const& other, SharedInputType what) const;
61+
62+
// Parameters of the segment, for the track fit
63+
// For a 4D segment: (dx/dz,dy/dz,x,y)
64+
bool hasPositionAndError() const override {
65+
//if det is present pos&err are available as well.
66+
//if det() is not present (null) the hit has been read from file and not updated
67+
return det();
68+
};
69+
70+
void getKfComponents(KfComponentsHolder& holder) const override { getKfComponents4D(holder); }
71+
void getKfComponents4D(KfComponentsHolder& holder) const;
72+
73+
// returning methods
74+
LocalPoint localPosition() const override { return thePosition; }
75+
virtual LocalVector localDirection() const { return theDirection; }
76+
const AlgebraicSymMatrix44& covMatrix() const;
77+
LocalError localPositionError() const override;
78+
LocalError localDirectionError() const;
79+
Global3DVector globalDirectionVH() const;
80+
81+
float chi2() const { return theChi2; }
82+
int dimension() const override { return theDimension; }
83+
float curvature() const { return theCurvature; }
84+
float curvatureError() const { return theCurvatureError; }
85+
float phi() const { return thePhi; }
86+
87+
float transverseMomentum(float magField) const;
88+
float momentum(float magField) const;
89+
90+
/// "lower" is logical, not geometrically lower; in pixel-strip modules the "lower" is always a pixel
91+
ClusterRef lowerCluster() const { return theLowerCluster.cluster_phase2OT(); }
92+
ClusterRef upperCluster() const { return theUpperCluster.cluster_phase2OT(); }
93+
OmniClusterRef const lowerClusterRef() const { return theLowerCluster; }
94+
OmniClusterRef const upperClusterRef() const { return theUpperCluster; }
95+
96+
//FIXME::to update with a proper CPE maybe...
97+
Global3DPoint lowerGlobalPos() const;
98+
Global3DPoint upperGlobalPos() const;
99+
static Global3DPoint phase2clusterGlobalPos(const PixelGeomDetUnit* geomDet, ClusterRef cluster);
100+
GlobalError lowerGlobalPosErr() const;
101+
GlobalError upperGlobalPosErr() const;
102+
static GlobalError phase2clusterGlobalPosErr(const PixelGeomDetUnit* geomDet);
103+
104+
bool isPhase2() const override { return true; }
105+
106+
//FIXME: I have always two clusters in a VH
107+
OmniClusterRef const& firstClusterRef() const override { return theLowerCluster; }
108+
ClusterRef cluster() const { return theLowerCluster.cluster_phase2OT(); }
109+
110+
//This method returns the direction of the segment/stub in global coordinates
111+
Global3DVector globalDirection() const;
112+
float theta() const;
113+
114+
// Access to component RecHits (if any)
115+
std::vector<const TrackingRecHit*> recHits() const override;
116+
std::vector<TrackingRecHit*> recHits() override;
117+
118+
private:
119+
// double dispatch
120+
VectorHit* clone_(TkCloner const& cloner, TrajectoryStateOnSurface const& tsos) const override {
121+
return cloner(*this, tsos).release();
122+
}
123+
RecHitPointer cloneSH_(TkCloner const& cloner, TrajectoryStateOnSurface const& tsos) const override {
124+
return cloner.makeShared(*this, tsos);
125+
}
126+
127+
LocalPoint thePosition;
128+
LocalVector theDirection;
129+
130+
// the covariance matrix, has the following meaning
131+
// mat[0][0]=var(dx/dz)
132+
// mat[1][1]=var(dy/dz)
133+
// mat[2][2]=var(x)
134+
// mat[3][3]=var(y)
135+
// mat[0][2]=cov(dx/dz,x)
136+
// mat[1][3]=cov(dy/dz,y)
137+
AlgebraicSymMatrix44 theCovMatrix;
138+
float theChi2;
139+
static constexpr int theDimension = 4;
140+
OmniClusterRef theLowerCluster;
141+
OmniClusterRef theUpperCluster;
142+
float theCurvature;
143+
float theCurvatureError;
144+
float thePhi;
145+
};
146+
147+
inline bool operator<(const VectorHit& one, const VectorHit& other) { return (one.chi2() < other.chi2()); }
148+
149+
std::ostream& operator<<(std::ostream& os, const VectorHit& vh);
150+
151+
typedef edmNew::DetSetVector<VectorHit> VectorHitCollection;
152+
153+
#endif
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#ifndef DataFormats_TrackerRecHit2D_VectorHit2D_h
2+
#define DataFormats_TrackerRecHit2D_VectorHit2D_h
3+
4+
#include "DataFormats/GeometryVector/interface/LocalVector.h"
5+
#include "DataFormats/GeometryVector/interface/LocalPoint.h"
6+
#include "DataFormats/CLHEP/interface/AlgebraicObjects.h"
7+
#include "DataFormats/GeometrySurface/interface/LocalError.h"
8+
9+
//Stores geometric information about VectorHits, their convariance matrix and chi2 of the compatability of the two hits
10+
11+
class VectorHit2D {
12+
public:
13+
VectorHit2D() : thePosition(), theDirection(), theCovMatrix(), theChi2() {}
14+
VectorHit2D(const LocalPoint& pos, const LocalVector& dir, const AlgebraicSymMatrix22& covMatrix, const double& chi2)
15+
: thePosition(pos),
16+
theDirection(dir),
17+
theCovMatrix(covMatrix),
18+
theLocalError(theCovMatrix[0][0], theCovMatrix[0][1], theCovMatrix[1][1]),
19+
theChi2(chi2) {}
20+
21+
const LocalPoint& localPosition() const { return thePosition; }
22+
const LocalVector& localDirection() const { return theDirection; }
23+
const LocalError& localDirectionError() const { return theLocalError; }
24+
const AlgebraicSymMatrix22& covMatrix() const { return theCovMatrix; }
25+
float chi2() const { return theChi2; }
26+
int dimension() const { return theDimension; }
27+
28+
private:
29+
LocalPoint thePosition;
30+
LocalVector theDirection;
31+
AlgebraicSymMatrix22 theCovMatrix;
32+
LocalError theLocalError;
33+
float theChi2;
34+
static constexpr int theDimension = 2;
35+
};
36+
#endif

DataFormats/TrackerRecHit2D/interface/trackerHitRTTI.h

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ namespace trackerHitRTTI {
1717
fastProjMono = 8,
1818
fastMatch = 9,
1919
notFromCluster = 10,
20-
mipTiming = 11
20+
mipTiming = 11,
21+
vector = 12
2122
};
2223
inline RTTI rtti(TrackingRecHit const& hit) { return RTTI(hit.getRTTI()); }
2324
inline bool isUndef(TrackingRecHit const& hit) { return rtti(hit) == undef; }
@@ -32,10 +33,13 @@ namespace trackerHitRTTI {
3233
inline bool isMatched(TrackingRecHit const& hit) { return rtti(hit) == match || rtti(hit) == fastMatch; }
3334
inline bool isMulti(TrackingRecHit const& hit) { return rtti(hit) == multi; }
3435
inline bool isSingleType(TrackingRecHit const& hit) { return (rtti(hit) > 0) & (rtti(hit) < 4); }
35-
inline bool isFromDet(TrackingRecHit const& hit) { return (rtti(hit) > 0) & (rtti(hit) < 6); }
36+
inline bool isFromDet(TrackingRecHit const& hit) { return (((rtti(hit) > 0) & (rtti(hit) < 6)) | (rtti(hit) == 12)); }
3637
inline bool isFast(TrackingRecHit const& hit) { return (rtti(hit) > 5) & (rtti(hit) <= 9); }
37-
inline bool isFromDetOrFast(TrackingRecHit const& hit) { return (rtti(hit) > 0) & (rtti(hit) < 10); }
38+
inline bool isFromDetOrFast(TrackingRecHit const& hit) {
39+
return (((rtti(hit) > 0) & (rtti(hit) < 10)) | (rtti(hit) == 12));
40+
}
3841
inline bool isTiming(TrackingRecHit const& hit) { return rtti(hit) == mipTiming; }
42+
inline bool isVector(TrackingRecHit const& hit) { return rtti(hit) == vector; }
3943
inline unsigned int projId(TrackingRecHit const& hit) { return hit.rawId() + int(rtti(hit)) - 1; }
4044
} // namespace trackerHitRTTI
4145

DataFormats/TrackerRecHit2D/src/BaseTrackerRecHit.cc

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,9 @@ void BaseTrackerRecHit::check() const {
2727
#endif
2828

2929
bool BaseTrackerRecHit::hasPositionAndError() const {
30+
//if det is present pos&err are available as well.
31+
// //if det() is not present (null) the hit has been read from file and not updated
3032
return det();
31-
32-
// return (err_.xx() != 0) || (err_.yy() != 0) || (err_.xy() != 0) ||
33-
// (pos_.x() != 0) || (pos_.y() != 0) || (pos_.z() != 0);
3433
}
3534

3635
void BaseTrackerRecHit::getKfComponents1D(KfComponentsHolder &holder) const {

0 commit comments

Comments
 (0)