Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrating VectorHits reconstruction for the Phase2 OT - reprise #31314

Merged
merged 115 commits into from Oct 21, 2020
Merged
Show file tree
Hide file tree
Changes from 110 commits
Commits
Show all changes
115 commits
Select commit Hold shift + click to select a range
1d33be2
commit VH technical integration changes only - VH switched off by def…
JanFSchulte Sep 22, 2019
9643a44
fixes after review by Mia
JanFSchulte Oct 1, 2019
3bc0dde
apply code checks
JanFSchulte Oct 1, 2019
09136ad
address Iannas comments part 1
JanFSchulte Oct 1, 2019
e0a73fd
code checks
JanFSchulte Oct 2, 2019
3e0523b
set usePhase2Stacks to false by default in the fillDescription of Tra…
JanFSchulte Oct 2, 2019
00ad9bb
try to fix header issues and fix missing import broken by the last co…
JanFSchulte Oct 2, 2019
e652383
code checkes
JanFSchulte Oct 2, 2019
5ad296d
restructure code in VectorHit.cc to satisfy static analyzer
JanFSchulte Oct 2, 2019
05858c2
code format
JanFSchulte Oct 2, 2019
0ffda00
fix most of the issues making the tests fail
JanFSchulte Oct 3, 2019
7c1b911
code checks
JanFSchulte Oct 3, 2019
872a25c
apply comments by andrea
JanFSchulte Oct 8, 2019
ac8f3be
apply code checks
JanFSchulte Oct 8, 2019
35bc979
fix things broken in SeedingOTEDProducer.cc by last commit
JanFSchulte Oct 8, 2019
672156a
fix the fixes
JanFSchulte Oct 9, 2019
2dd7bf8
code formates
JanFSchulte Oct 9, 2019
d5c6cb4
resolve conflict in TkStackMeasurementDet.h
JanFSchulte Oct 14, 2019
428127c
Revert "resolve conflict in TkStackMeasurementDet.h"
JanFSchulte Oct 14, 2019
236113f
resolve merge conflict in kStackMeasurementDet.h
JanFSchulte Oct 14, 2019
ee3a194
adapt includes to match changes in PR 28127
JanFSchulte Oct 14, 2019
c9eace1
rebase to latest IB
JanFSchulte Oct 16, 2019
8bdb8a4
refactor code to not use EDProducer as product of ESProducer - part I
JanFSchulte Aug 28, 2020
9e38c4c
refactor code to not use EDProducer as product of ESProducer - part II
JanFSchulte Aug 28, 2020
4391753
refactor code to not use EDProducer as product of ESProducer - part III
JanFSchulte Aug 29, 2020
7b018f7
slight cleanup of diff
JanFSchulte Aug 29, 2020
cb8050b
apply code checks
JanFSchulte Sep 1, 2020
4e69b00
remove unnecessary dependencies in build files
JanFSchulte Sep 2, 2020
728f0d0
add VectorHitMomentumHelper to avoid include of MagenticField.h in Da…
JanFSchulte Sep 2, 2020
8b43243
apply code formats
JanFSchulte Sep 2, 2020
472b65a
fix missing initializations
JanFSchulte Sep 3, 2020
7725ff0
trying to work around memory leaks
JanFSchulte Sep 3, 2020
ac77617
apply code format
JanFSchulte Sep 3, 2020
5f6110a
register consumes of ES products in SeedingOTEDProducer
JanFSchulte Sep 3, 2020
b775266
addressing PR comments part I
JanFSchulte Sep 3, 2020
142acec
addressing PR comments part II
JanFSchulte Sep 4, 2020
ce1a3ea
addressing PR comments part III
JanFSchulte Sep 4, 2020
5903788
restructure constructor of VectorHitBuilderAlgorithm and changed Vect…
JanFSchulte Sep 4, 2020
efcebde
clean file structure of the EDProducers
JanFSchulte Sep 4, 2020
727cb46
add new files from last step
JanFSchulte Sep 4, 2020
17bbbd6
use det()
JanFSchulte Sep 4, 2020
d06cd10
remove uncessary cfi files
JanFSchulte Sep 4, 2020
9e1ca77
code checks and format
JanFSchulte Sep 4, 2020
6fa2229
turn VHs off again and fix capitilization of import name
JanFSchulte Sep 5, 2020
2536365
fix overlooked switch from dynamic to static cast
JanFSchulte Sep 5, 2020
1009a20
add vector hits to isFromDet and isFromDataOrFast in trackerHitRTTI
JanFSchulte Sep 5, 2020
b17261d
code format
JanFSchulte Sep 5, 2020
01114c0
small improvements requested by Vincenzo
JanFSchulte Sep 8, 2020
2cdd767
protect against invalid TSOSs when propagating between layers
JanFSchulte Sep 8, 2020
ccf9e94
update validation configs to run on current RelVals
JanFSchulte Sep 8, 2020
33bbeff
made a lot of functions const
JanFSchulte Sep 8, 2020
758d273
more improvements to SeedingOTEDProducer
JanFSchulte Sep 8, 2020
754d08c
more improvements to SeedingOTEDProducer and Phase2OTBarrelRodBuilder
JanFSchulte Sep 8, 2020
403ac04
Kevin's comments on a couple of files
JanFSchulte Sep 9, 2020
7c64d65
Kevin's comment to VectorHitBuilderAlgorithmBase
JanFSchulte Sep 9, 2020
424df27
most of Kevin's remaining comments
JanFSchulte Sep 9, 2020
9109e2e
fix clang compile error
JanFSchulte Sep 9, 2020
0aba3e5
move curvatureOrPhi function from VectorHit to VectorHitBuilderAlgori…
JanFSchulte Sep 9, 2020
90cf48a
code checks, mostly
JanFSchulte Sep 9, 2020
6b9b4f2
minor updates
JanFSchulte Sep 10, 2020
61599bc
cache position in LocalPositionSort
JanFSchulte Sep 10, 2020
18a03b3
turn VHs off again
JanFSchulte Sep 10, 2020
8bf7d15
clarify 'sor' and rebase to latest IB
JanFSchulte Sep 14, 2020
45ec1f2
code format
JanFSchulte Sep 14, 2020
17a2e02
fix theDimension usage and add constepr nComponents
JanFSchulte Sep 14, 2020
f149ea2
Vincenzo's commnets on VectorHitBuilderAlgorirthm
JanFSchulte Sep 14, 2020
ccc74b6
code checks
JanFSchulte Sep 14, 2020
999d80b
add process modifier to switch on Vector Hits
JanFSchulte Sep 14, 2020
92f2c7e
remove need to run curvatureORPhi 3 times
JanFSchulte Sep 15, 2020
68ea0ce
put printClusters behind EDM_ML_DEBUG
JanFSchulte Sep 16, 2020
ba5e5d4
add forgotten push_heap
JanFSchulte Sep 16, 2020
2d15513
code format
JanFSchulte Sep 16, 2020
66e765d
adapt track selection for vector hits
JanFSchulte Sep 16, 2020
c3357eb
add pixelLess iteration for vectorHits process modifier
JanFSchulte Sep 16, 2020
e9b6828
add special workflows to test vector hits
JanFSchulte Sep 16, 2020
580200d
some cleanup
JanFSchulte Sep 17, 2020
16e51bb
add wf 23234.9 to those available for PR validation
JanFSchulte Sep 17, 2020
cfd6018
add removed newline
JanFSchulte Sep 21, 2020
74cf64c
use seedingOT producer in pixelLess step
JanFSchulte Sep 22, 2020
f1ce21b
bug fixes
JanFSchulte Sep 22, 2020
ec1a12e
code checks
JanFSchulte Sep 22, 2020
2c87639
cleanup
JanFSchulte Sep 22, 2020
24d84b9
fix bug in incrementing loop counter
JanFSchulte Sep 23, 2020
9ac1ebe
use pre-created VectorHits in track building
JanFSchulte Sep 24, 2020
03f9495
code checks and format
JanFSchulte Sep 24, 2020
5c42b05
some cleanup
JanFSchulte Sep 25, 2020
867caf2
code comments from Kevin + Matti and implementation of cluster masking
JanFSchulte Sep 25, 2020
1edd84d
add second VH collection to TkStackMeasurementDet to recover low pT t…
JanFSchulte Sep 25, 2020
d8b3b31
initialize useVectorHits_ in MeasurementTrackerEventProducer
JanFSchulte Sep 26, 2020
35d4bf7
cleanup
JanFSchulte Sep 29, 2020
b4fe5a6
remove phase2 matcher from MeasurementTrackerEvent as it is no longer…
JanFSchulte Sep 29, 2020
38225d6
code format
JanFSchulte Sep 29, 2020
4774710
slightly reduce diff
JanFSchulte Sep 29, 2020
b6b9e9e
get rid of AlgebraicSymMatrix as member of VectorHit clas
JanFSchulte Sep 30, 2020
1e9919f
restore change overwritten in rebase
JanFSchulte Oct 8, 2020
1fea02b
Slava's comments on DataFormats
JanFSchulte Oct 9, 2020
946eb90
intermediate commit of Slava's comments
JanFSchulte Oct 9, 2020
359a1bc
more comments from Slava
JanFSchulte Oct 9, 2020
41ed2ad
add renamed files
JanFSchulte Oct 9, 2020
e58adab
a few more comments
JanFSchulte Oct 10, 2020
2689ca8
finish first pass at Slava's comments
JanFSchulte Oct 10, 2020
671803f
add reserve statement in loadDetSetVector
JanFSchulte Oct 10, 2020
93a827a
speed up cluster masking
JanFSchulte Oct 10, 2020
3b4b4d2
code format
JanFSchulte Oct 10, 2020
224b3a9
put printClusters behind debug statements
JanFSchulte Oct 10, 2020
41ff72e
re-add mysteriously vanished float
JanFSchulte Oct 10, 2020
d952d3a
code format
JanFSchulte Oct 10, 2020
7d164db
fix earlyGeneralTracks config
JanFSchulte Oct 11, 2020
72ba9db
get rid of the sorting of the VH
JanFSchulte Oct 12, 2020
6dcc8c4
code format
JanFSchulte Oct 12, 2020
a82f984
add comments
JanFSchulte Oct 12, 2020
6019571
code format
JanFSchulte Oct 13, 2020
3300a89
comments from Slava
JanFSchulte Oct 15, 2020
988c5a3
code format and checks
JanFSchulte Oct 15, 2020
53aad7e
fix vectorHits workflows
JanFSchulte Oct 15, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 5 additions & 1 deletion CommonTools/RecoAlgos/src/ClusterStorer.cc
Expand Up @@ -9,6 +9,7 @@
#include "DataFormats/TrackerRecHit2D/interface/ProjectedSiStripRecHit2D.h"
#include "DataFormats/TrackerRecHit2D/interface/SiStripMatchedRecHit2D.h"
#include "DataFormats/TrackerRecHit2D/interface/Phase2TrackerRecHit1D.h"
#include "DataFormats/TrackerRecHit2D/interface/VectorHit.h"
// FastSim hits:
#include "DataFormats/TrackerRecHit2D/interface/FastTrackerRecHit.h"
#include "DataFormats/TrackerRecHit2D/interface/FastProjectedTrackerRecHit.h"
Expand Down Expand Up @@ -44,9 +45,12 @@ namespace helper {
} else if (hit_type == typeid(Phase2TrackerRecHit1D)) {
//FIXME:: this is just temporary solution for phase2,
//it is not really running in the phase2 tracking wf - yet...
//std::cout << "| It is a Phase2TrackerRecHit1D hit !!" << std::endl;
phase2OTClusterRecords_.push_back(
Phase2OTClusterHitRecord(static_cast<Phase2TrackerRecHit1D &>(newHit), hits, index));
} else if (hit_type == typeid(VectorHit)) {
//FIXME:: this is just temporary solution for phase2,
//the VectorHit has 2 clusters but just a hit!
phase2OTClusterRecords_.push_back(Phase2OTClusterHitRecord(static_cast<VectorHit &>(newHit), hits, index));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not add both clusters already here/now?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not entirely sure what you are proposing here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not entirely sure what you are proposing here?

this was my attempt to read the meaning of //FIXME:: this is just temporary solution for phase2,,
compared to SiStripMatchedRecHit2D

} else {
if (hit_type == typeid(FastTrackerRecHit) || hit_type == typeid(FastProjectedTrackerRecHit) ||
hit_type == typeid(FastMatchedTrackerRecHit)) {
Expand Down
5 changes: 5 additions & 0 deletions Configuration/ProcessModifiers/python/vectorHits_cff.py
@@ -0,0 +1,5 @@
import FWCore.ParameterSet.Config as cms

# This modifier is for activating Vector Hits reconstruction in the Phase II OT

vectorHits = cms.Modifier()
1 change: 1 addition & 0 deletions Configuration/PyReleaseValidation/python/relval_2026.py
Expand Up @@ -19,6 +19,7 @@
numWFIB.extend([23434.99,23434.999]) #2026D49 premixing combined stage1+stage2 (ttbar+PU200, ttbar+PU50 for PR test)
numWFIB.extend([23234.21,23434.21]) #2026D49 prodlike, prodlike PU
numWFIB.extend([23234.103]) #2026D49 aging
numWFIB.extend([23234.9]) #2026D49 vector hits
numWFIB.extend([28234.0]) #2026D60
numWFIB.extend([29834.0]) #2026D64
numWFIB.extend([30234.0]) #2026D65
Expand Down
Expand Up @@ -298,6 +298,24 @@ def condition_(self, fragment, stepList, key, hasHarvest):
'--procModifiers': 'trackingMkFit'
}

# Vector Hits workflows
class UpgradeWorkflow_vectorHits(UpgradeWorkflow):
def setup_(self, step, stepName, stepDict, k, properties):
stepDict[stepName][k] = merge([{'--procModifiers': 'vectorHits'}, stepDict[step][k]])
def condition(self, fragment, stepList, key, hasHarvest):
return fragment=="TTbar_14TeV" and '2026' in key
upgradeWFs['vectorHits'] = UpgradeWorkflow_vectorHits(
steps = [
'Reco',
],
PU = [
'Reco',
],
suffix = '_vectorHits',
offset = 0.9,
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kpedro88
something is missing here, apparently.
With this PR I do not see any --procModifiers vectorHits in runTheMatrix.py -w upgrade -n -e

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I must have broken it when doing the last rebase as there were conflicts in this file. Working to fix it...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Phase2 workflows use the RecoGlobal step, not the Reco step.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That fixes it, thanks! That probably also means that it never actually worked in the first place, sorry!



# Patatrack workflows
class UpgradeWorkflowPatatrack(UpgradeWorkflow):
def condition(self, fragment, stepList, key, hasHarvest):
Expand Down
9 changes: 5 additions & 4 deletions DataFormats/TrackerRecHit2D/interface/BaseTrackerRecHit.h
Expand Up @@ -23,6 +23,8 @@ class BaseTrackerRecHit : public TrackingRecHit {

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

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

bool hasPositionAndError() const final;
bool hasPositionAndError() const override;

LocalPoint localPosition() const final {
LocalPoint localPosition() const override {
check();
return pos_;
}

LocalError localPositionError() const final {
LocalError localPositionError() const override {
check();
return err_;
}

const LocalPoint& localPositionFast() const {
check();
return pos_;
Expand Down
4 changes: 4 additions & 0 deletions DataFormats/TrackerRecHit2D/interface/TkCloner.h
Expand Up @@ -11,6 +11,7 @@ class SiStripRecHit1D;
class SiStripMatchedRecHit2D;
class ProjectedSiStripRecHit2D;
class Phase2TrackerRecHit1D;
class VectorHit;

class TkCloner {
public:
Expand Down Expand Up @@ -39,6 +40,7 @@ class TkCloner {
TrajectoryStateOnSurface const& tsos) const = 0;
virtual std::unique_ptr<Phase2TrackerRecHit1D> operator()(Phase2TrackerRecHit1D const& hit,
TrajectoryStateOnSurface const& tsos) const = 0;
virtual std::unique_ptr<VectorHit> operator()(VectorHit const& hit, TrajectoryStateOnSurface const& tsos) const = 0;

#ifndef __GCCXML__
virtual TrackingRecHit::ConstRecHitPointer makeShared(SiPixelRecHit const& hit,
Expand All @@ -53,6 +55,8 @@ class TkCloner {
TrajectoryStateOnSurface const& tsos) const = 0;
virtual TrackingRecHit::ConstRecHitPointer makeShared(Phase2TrackerRecHit1D const& hit,
TrajectoryStateOnSurface const& tsos) const = 0;
virtual TrackingRecHit::ConstRecHitPointer makeShared(VectorHit const& hit,
TrajectoryStateOnSurface const& tsos) const = 0;
#endif
};
#endif
156 changes: 156 additions & 0 deletions DataFormats/TrackerRecHit2D/interface/VectorHit.h
@@ -0,0 +1,156 @@
#ifndef DataFormats_TrackerRecHit2D_VectorHit_h
#define DataFormats_TrackerRecHit2D_VectorHit_h

/** \class VectorHit
*
* 4-parameter RecHits for Phase2 Tracker (x,y, dx/dz, dy/dz)
*
* $Date: 2015/03/30 $
* \author Erica Brondolin
*
*/

#include "DataFormats/TrackerRecHit2D/interface/BaseTrackerRecHit.h"
#include "DataFormats/TrackerRecHit2D/interface/VectorHit2D.h"
#include "DataFormats/TrackerRecHit2D/interface/OmniClusterRef.h"

#include "DataFormats/Common/interface/DetSetVector.h"
#include "DataFormats/Common/interface/DetSetVectorNew.h"

#include "DataFormats/Phase2TrackerCluster/interface/Phase2TrackerCluster1D.h"
#include "DataFormats/GeometryVector/interface/LocalVector.h"
#include "Geometry/CommonDetUnit/interface/PixelGeomDetUnit.h"

#include "DataFormats/TrackingRecHit/interface/KfComponentsHolder.h"

#include "DataFormats/TrackerRecHit2D/interface/TkCloner.h"

class VectorHit final : public BaseTrackerRecHit {
public:
typedef OmniClusterRef::Phase2Cluster1DRef ClusterRef;

VectorHit() : thePosition(), theDirection(), theCovMatrix() { setType(bad); }

//VectorHit(const VectorHit& vh);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this commented out code needed?
Please remove or add comments inline in the code why the commented out block is relevant

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Accidental leftover, removed.


VectorHit(const GeomDet& idet,
const LocalPoint& posInner,
const LocalVector& dir,
const AlgebraicSymMatrix44 covMatrix,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const AlgebraicSymMatrix44 covMatrix,
const AlgebraicSymMatrix44& covMatrix,

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

const float chi2,
OmniClusterRef const& lower,
OmniClusterRef const& upper,
const float curvature,
const float curvatureError,
const float phi);

VectorHit(const GeomDet& idet,
const VectorHit2D& vh2Dzx,
const VectorHit2D& vh2Dzy,
OmniClusterRef const& lower,
OmniClusterRef const& upper,
const float curvature,
const float curvatureError,
const float phi);

~VectorHit() override = default;

VectorHit* clone() const override { return new VectorHit(*this); }
RecHitPointer cloneSH() const override { return std::make_shared<VectorHit>(*this); }

bool sharesInput(const TrackingRecHit* other, SharedInputType what) const override;
bool sharesClusters(VectorHit const& other, SharedInputType what) const;

// Parameters of the segment, for the track fit
// For a 4D segment: (dx/dz,dy/dz,x,y)
bool hasPositionAndError() const override {
JanFSchulte marked this conversation as resolved.
Show resolved Hide resolved
//if det is present pos&err are available as well.
//if det() is not present (null) the hit has been read from file and not updated
return det();
};

void getKfComponents(KfComponentsHolder& holder) const override { getKfComponents4D(holder); }
void getKfComponents4D(KfComponentsHolder& holder) const;

// returning methods
LocalPoint localPosition() const override { return thePosition; }
virtual LocalVector localDirection() const { return theDirection; }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

given class VectorHit final, is a new virtual method still useful at this level?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really, I don't know with this was made virtual. Removed it.

AlgebraicSymMatrix44 covMatrix() const;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
AlgebraicSymMatrix44 covMatrix() const;
const AlgebraicSymMatrix44& covMatrix() const;

the current use case is visible, but somewhat negligible
https://slava77sk.web.cern.ch/slava77sk/reco/cgi-bin/igprof-navigator/jschulte/igreport_perf_PU200_72ba9db/2356
Still, if someone wants to get a few elements, no need to require a full copy.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

LocalError localPositionError() const override;
LocalError localDirectionError() const;
Global3DVector globalDirectionVH() const;

float chi2() const { return theChi2; }
int dimension() const override { return theDimension; }
float curvature() const { return theCurvature; }
float curvatureError() const { return theCurvatureError; }
float phi() const { return thePhi; }

float transverseMomentum(float magField) const;
float momentum(float magField) const;

/// "lower" is logical, not geometrically lower; in pixel-strip modules the "lower" is always a pixel
ClusterRef lowerCluster() const { return theLowerCluster.cluster_phase2OT(); }
ClusterRef upperCluster() const { return theUpperCluster.cluster_phase2OT(); }
OmniClusterRef const lowerClusterRef() const { return theLowerCluster; }
OmniClusterRef const upperClusterRef() const { return theUpperCluster; }
JanFSchulte marked this conversation as resolved.
Show resolved Hide resolved

//FIXME::to update with a proper CPE maybe...
Global3DPoint lowerGlobalPos() const;
Global3DPoint upperGlobalPos() const;
static Global3DPoint phase2clusterGlobalPos(const PixelGeomDetUnit* geomDet, ClusterRef cluster);
GlobalError lowerGlobalPosErr() const;
GlobalError upperGlobalPosErr() const;
static GlobalError phase2clusterGlobalPosErr(const PixelGeomDetUnit* geomDet);

bool isPhase2() const override { return true; }

//FIXME: I have always two clusters in a VH
OmniClusterRef const& firstClusterRef() const override { return theLowerCluster; }
ClusterRef cluster() const { return theLowerCluster.cluster_phase2OT(); }

//This method returns the direction of the segment/stub in global coordinates
Global3DVector globalDirection() const;
float theta() const;

// Access to component RecHits (if any)
std::vector<const TrackingRecHit*> recHits() const override;
std::vector<TrackingRecHit*> recHits() override;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is this non const method that return something by value????

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not having it leads to compilation errors because the concrete implementation of the non-const function seems to needed, without it I get the following errors:

/uscms_data/d3/jschulte/VH/new/CMSSW_11_2_X_2020-09-03-1100/src/DataFormats/TrackerRecHit2D/interface/VectorHit.h:52:65: error: invalid new-expression of abstract class type 'VectorHit' VectorHit* clone() const override { return new VectorHit(*this); }
^
/uscms_data/d3/jschulte/VH/new/CMSSW_11_2_X_2020-09-03-1100/src/DataFormats/TrackerRecHit2D/interface/VectorHit.h:28:7: note: because the following virtual functions are pure within 'VectorHit': class VectorHit final : public BaseTrackerRecHit {
^~~~~~~~~
In file included from /uscms_data/d3/jschulte/VH/new/CMSSW_11_2_X_2020-09-03-1100/src/DataFormats/TrackerRecHit2D/interface/trackerHitRTTI.h:4, from /uscms_data/d3/jschulte/VH/new/CMSSW_11_2_X_2020-09-03-1100/src/DataFormats/TrackerRecHit2D/interface/BaseTrackerRecHit.h:4, from /uscms_data/d3/jschulte/VH/new/CMSSW_11_2_X_2020-09-03-1100/src/DataFormats/TrackerRecHit2D/interface/VectorHit.h:13, from /uscms_data/d3/jschulte/VH/new/CMSSW_11_2_X_2020-09-03-1100/src/DataFormats/TrackerRecHit2D/src/VectorHit.cc:1:
/cvmfs/cms-ib.cern.ch/week0/slc7_amd64_gcc820/cms/cmssw-patch/CMSSW_11_2_X_2020-09-03-1100/src/DataFormats/TrackingRecHit/interface/TrackingRecHit.h:105:40: note: 'virtual std::vector<TrackingRecHit*> TrackingRecHit::recHits()' virtual std::vector<TrackingRecHit*> recHits() = 0;


private:
// double dispatch
VectorHit* clone_(TkCloner const& cloner, TrajectoryStateOnSurface const& tsos) const override {
return cloner(*this, tsos).release();
}
RecHitPointer cloneSH_(TkCloner const& cloner, TrajectoryStateOnSurface const& tsos) const override {
return cloner.makeShared(*this, tsos);
}

LocalPoint thePosition;
LocalVector theDirection;

// the covariance matrix, has the following meaning
// mat[0][0]=var(dx/dz)
// mat[1][1]=var(dy/dz)
// mat[2][2]=var(x)
// mat[3][3]=var(y)
// mat[0][2]=cov(dx/dz,x)
// mat[1][3]=cov(dy/dz,y)
AlgebraicSymMatrix44 theCovMatrix;
float theChi2;
static constexpr int theDimension = 4;
OmniClusterRef theLowerCluster;
OmniClusterRef theUpperCluster;
float theCurvature;
float theCurvatureError;
float thePhi;
};

inline bool operator<(const VectorHit& one, const VectorHit& other) { return (one.chi2() < other.chi2()); }

std::ostream& operator<<(std::ostream& os, const VectorHit& vh);

typedef edmNew::DetSetVector<VectorHit> VectorHitCollection;
//typedef VectorHitCollection VectorHitCollectionNew;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this commented out code needed?
Please remove or add comments inline in the code why the commented out block is relevant

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Accidental leftover, removed.


#endif
36 changes: 36 additions & 0 deletions DataFormats/TrackerRecHit2D/interface/VectorHit2D.h
@@ -0,0 +1,36 @@
#ifndef DataFormats_TrackerRecHit2D_VectorHit2D_h
#define DataFormats_TrackerRecHit2D_VectorHit2D_h

JanFSchulte marked this conversation as resolved.
Show resolved Hide resolved
#include "DataFormats/GeometryVector/interface/LocalVector.h"
#include "DataFormats/GeometryVector/interface/LocalPoint.h"
#include "DataFormats/CLHEP/interface/AlgebraicObjects.h"
#include "DataFormats/GeometrySurface/interface/LocalError.h"

//Stores geometric information about VectorHits, their convariance matrix and chi2 of the compatability of the two hits

class VectorHit2D {
public:
VectorHit2D() : thePosition(), theDirection(), theCovMatrix(), theChi2() {}
VectorHit2D(const LocalPoint& pos, const LocalVector& dir, const AlgebraicSymMatrix22& covMatrix, const double& chi2)
: thePosition(pos),
theDirection(dir),
theCovMatrix(covMatrix),
theLocalError(theCovMatrix[0][0], theCovMatrix[0][1], theCovMatrix[1][1]),
theChi2(chi2){};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
theChi2(chi2){};
theChi2(chi2){}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.


const LocalPoint localPosition() const { return thePosition; }
const LocalVector localDirection() const { return theDirection; }
const LocalError localDirectionError() const { return theLocalError; }
const AlgebraicSymMatrix22 covMatrix() const { return theCovMatrix; }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const LocalPoint localPosition() const { return thePosition; }
const LocalVector localDirection() const { return theDirection; }
const LocalError localDirectionError() const { return theLocalError; }
const AlgebraicSymMatrix22 covMatrix() const { return theCovMatrix; }
const LocalPoint& localPosition() const { return thePosition; }
const LocalVector& localDirection() const { return theDirection; }
const LocalError& localDirectionError() const { return theLocalError; }
const AlgebraicSymMatrix22& covMatrix() const { return theCovMatrix; }

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

float chi2() const { return theChi2; }
int dimension() const { return theDimension; }

private:
LocalPoint thePosition;
LocalVector theDirection;
AlgebraicSymMatrix22 theCovMatrix;
LocalError theLocalError;
float theChi2;
static constexpr int theDimension = 2;
};
#endif
10 changes: 7 additions & 3 deletions DataFormats/TrackerRecHit2D/interface/trackerHitRTTI.h
Expand Up @@ -17,7 +17,8 @@ namespace trackerHitRTTI {
fastProjMono = 8,
fastMatch = 9,
notFromCluster = 10,
mipTiming = 11
mipTiming = 11,
vector = 12
};
inline RTTI rtti(TrackingRecHit const& hit) { return RTTI(hit.getRTTI()); }
inline bool isUndef(TrackingRecHit const& hit) { return rtti(hit) == undef; }
Expand All @@ -32,10 +33,13 @@ namespace trackerHitRTTI {
inline bool isMatched(TrackingRecHit const& hit) { return rtti(hit) == match || rtti(hit) == fastMatch; }
inline bool isMulti(TrackingRecHit const& hit) { return rtti(hit) == multi; }
inline bool isSingleType(TrackingRecHit const& hit) { return (rtti(hit) > 0) & (rtti(hit) < 4); }
inline bool isFromDet(TrackingRecHit const& hit) { return (rtti(hit) > 0) & (rtti(hit) < 6); }
inline bool isFromDet(TrackingRecHit const& hit) { return (((rtti(hit) > 0) & (rtti(hit) < 6)) | (rtti(hit) == 12)); }
inline bool isFast(TrackingRecHit const& hit) { return (rtti(hit) > 5) & (rtti(hit) <= 9); }
inline bool isFromDetOrFast(TrackingRecHit const& hit) { return (rtti(hit) > 0) & (rtti(hit) < 10); }
inline bool isFromDetOrFast(TrackingRecHit const& hit) {
return (((rtti(hit) > 0) & (rtti(hit) < 10)) | (rtti(hit) == 12));
}
inline bool isTiming(TrackingRecHit const& hit) { return rtti(hit) == mipTiming; }
inline bool isVector(TrackingRecHit const& hit) { return rtti(hit) == vector; }
JanFSchulte marked this conversation as resolved.
Show resolved Hide resolved
inline unsigned int projId(TrackingRecHit const& hit) { return hit.rawId() + int(rtti(hit)) - 1; }
} // namespace trackerHitRTTI

Expand Down
5 changes: 2 additions & 3 deletions DataFormats/TrackerRecHit2D/src/BaseTrackerRecHit.cc
Expand Up @@ -27,10 +27,9 @@ void BaseTrackerRecHit::check() const {
#endif

bool BaseTrackerRecHit::hasPositionAndError() const {
//if det is present pos&err are available as well.
// //if det() is not present (null) the hit has been read from file and not updated
return det();

// return (err_.xx() != 0) || (err_.yy() != 0) || (err_.xy() != 0) ||
// (pos_.x() != 0) || (pos_.y() != 0) || (pos_.z() != 0);
}

void BaseTrackerRecHit::getKfComponents1D(KfComponentsHolder &holder) const {
Expand Down