Skip to content

Commit dbff744

Browse files
authored
Merge pull request cms-sw#40835 from mmusich/phase2CommonRefitter
Disentangle `TrackerTrackHitFilter` from phase-0 Strip conditions and activate common alignment track refitter sequence for phase-2
2 parents b47cd96 + 0a117c6 commit dbff744

File tree

4 files changed

+113
-56
lines changed

4 files changed

+113
-56
lines changed

Alignment/OfflineValidation/test/testPrimaryVertexRelatedValidations_cfg.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,7 @@ class RefitType(Enum):
3030
_allFromGT = True
3131
_applyBows = True
3232
_applyExtraConditions = True
33-
if(options.isPhase2):
34-
_theRefitter = RefitType.STANDARD # FIXME: once the sequence is cleared out
35-
else:
36-
_theRefitter = RefitType.COMMON
33+
_theRefitter = RefitType.COMMON # RefitType.STANDARD (other option not involving filtering)
3734
_theTrackCollection = 'generalTracks' # FIXME: 'ALCARECOTkAlMinBias' once a sample is available
3835

3936
###################################################################

Alignment/OfflineValidation/test/test_all_Phase2_cfg.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class RefitType(Enum):
1212
allFromGT = True
1313
applyBows = True
1414
applyExtraConditions = True
15-
theRefitter = RefitType.STANDARD
15+
theRefitter = RefitType.COMMON
1616
_theTrackCollection = "generalTracks" #"ALCARECOTkAlMinBias" unfortunately not yet
1717

1818
from Configuration.Eras.Era_Phase2C17I13M9_cff import Phase2C17I13M9
@@ -59,7 +59,7 @@ class RefitType(Enum):
5959
threshold = cms.untracked.string("INFO"),
6060
default = cms.untracked.PSet(limit = cms.untracked.int32(0)),
6161
FwkReport = cms.untracked.PSet(limit = cms.untracked.int32(-1),
62-
reportEvery = cms.untracked.int32(1000)
62+
reportEvery = cms.untracked.int32(1)
6363
),
6464
PrimaryVertexValidation = cms.untracked.PSet( limit = cms.untracked.int32(-1)),
6565
SplitVertexResolution = cms.untracked.PSet( limit = cms.untracked.int32(-1)),
@@ -193,7 +193,7 @@ class RefitType(Enum):
193193
# Load and Configure Common Track Selection and refitting sequence
194194
####################################################################
195195
import Alignment.CommonAlignment.tools.trackselectionRefitting as trackselRefit
196-
process.seqTrackselRefit = trackselRefit.getSequence(process, 'ALCARECOTkAlMinBias',
196+
process.seqTrackselRefit = trackselRefit.getSequence(process, _theTrackCollection ,
197197
isPVValidation=True,
198198
TTRHBuilder='WithAngleAndTemplate',
199199
usePixelQualityFlag=True,
@@ -295,6 +295,11 @@ def switchClusterizerParameters(da):
295295
TkClusParameters = switchClusterizerParameters(isDA)
296296
)
297297

298+
####################################################################
299+
# Needed to avoid dependency from Phase-0 strip conditions
300+
####################################################################
301+
#process.TrackerTrackHitFilter.isPhase2 = cms.bool(True)
302+
298303
####################################################################
299304
# Path
300305
####################################################################
@@ -348,10 +353,10 @@ def switchClusterizerParameters(da):
348353
runControl = cms.untracked.bool(True),
349354
runControlNumber = cms.untracked.vuint32(int(runboundary))
350355
)
356+
#process.Tracer = cms.Service("Tracer")
351357

352358
process.p2 = cms.Path(process.HLTFilter +
353359
process.seqTrackselRefit +
354360
process.offlinePrimaryVerticesFromRefittedTrks +
355361
process.PrimaryVertexResolution +
356-
process.myanalysis
357-
)
362+
process.myanalysis)

RecoTracker/FinalTrackSelectors/plugins/TrackerTrackHitFilter.cc

Lines changed: 59 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55

66
#include "FWCore/MessageLogger/interface/MessageLogger.h"
77
#include "FWCore/ParameterSet/interface/ParameterSet.h"
8+
#include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
9+
#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
810
#include "FWCore/Utilities/interface/InputTag.h"
911
#include "FWCore/Utilities/interface/ESGetToken.h"
1012

@@ -48,6 +50,7 @@
4850

4951
#include <boost/regex.hpp>
5052
#include <map>
53+
#include <optional>
5154
//#include <math>
5255

5356
/**
@@ -84,6 +87,8 @@ namespace reco {
8487
std::vector<TrackingRecHit *> &hits);
8588
void produceFromTrack(const edm::EventSetup &iSetup, const Track *itt, std::vector<TrackingRecHit *> &hits);
8689

90+
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions);
91+
8792
private:
8893
class Rule {
8994
public:
@@ -124,6 +129,7 @@ namespace reco {
124129
bool stripBackInvalidHits_;
125130
bool stripAllInvalidHits_;
126131

132+
bool isPhase2_;
127133
bool rejectBadStoNHits_;
128134
std::string CMNSubtractionMode_;
129135
std::vector<bool> subdetStoN_; //(6); //,std::bool(false));
@@ -156,7 +162,7 @@ namespace reco {
156162
edm::ESGetToken<MagneticField, IdealMagneticFieldRecord> tokenMagField;
157163
edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> tokenTrackerTopo;
158164

159-
SiStripClusterInfo siStripClusterInfo_;
165+
std::optional<SiStripClusterInfo> siStripClusterInfo_;
160166

161167
bool tagOverlaps_;
162168
int nOverlaps;
@@ -298,6 +304,7 @@ namespace reco {
298304
stripFrontInvalidHits_(iConfig.getParameter<bool>("stripFrontInvalidHits")),
299305
stripBackInvalidHits_(iConfig.getParameter<bool>("stripBackInvalidHits")),
300306
stripAllInvalidHits_(iConfig.getParameter<bool>("stripAllInvalidHits")),
307+
isPhase2_(iConfig.getParameter<bool>("isPhase2")),
301308
rejectBadStoNHits_(iConfig.getParameter<bool>("rejectBadStoNHits")),
302309
CMNSubtractionMode_(iConfig.getParameter<std::string>("CMNSubtractionMode")),
303310
detsToIgnore_(iConfig.getParameter<std::vector<uint32_t> >("detsToIgnore")),
@@ -309,8 +316,13 @@ namespace reco {
309316
pxlTPLProbXYQ_(iConfig.getParameter<double>("PxlTemplateProbXYChargeCut")),
310317
pxlTPLqBin_(iConfig.getParameter<std::vector<int32_t> >("PxlTemplateqBinCut")),
311318
PXLcorrClusChargeCut_(iConfig.getParameter<double>("PxlCorrClusterChargeCut")),
312-
siStripClusterInfo_(consumesCollector()),
313319
tagOverlaps_(iConfig.getParameter<bool>("tagOverlaps")) {
320+
// construct the SiStripClusterInfo object only for Phase-0 / Phase-1
321+
// no Strip modules in Phase-2
322+
if (!isPhase2_) {
323+
siStripClusterInfo_ = consumesCollector();
324+
}
325+
314326
tokenGeometry = esConsumes<TrackerGeometry, TrackerDigiGeometryRecord>();
315327
tokenMagField = esConsumes<MagneticField, IdealMagneticFieldRecord>();
316328
tokenTrackerTopo = esConsumes<TrackerTopology, TrackerTopologyRcd>();
@@ -399,7 +411,8 @@ namespace reco {
399411
// read from EventSetup
400412
theGeometry = iSetup.getHandle(tokenGeometry);
401413
theMagField = iSetup.getHandle(tokenMagField);
402-
siStripClusterInfo_.initEvent(iSetup);
414+
if (!isPhase2_)
415+
siStripClusterInfo_->initEvent(iSetup);
403416

404417
// prepare output collection
405418
size_t candcollsize;
@@ -781,6 +794,12 @@ namespace reco {
781794

782795
// if( subdetStoN_[subdet_cnt-1]&& (id.subdetId()==subdet_cnt) ){//check that hit is in a det belonging to a subdet where we decided to apply a S/N cut
783796

797+
// for phase-2 OT placehold, do nothing
798+
if (GeomDetEnumerators::isOuterTracker(theGeometry->geomDetSubDetector(id.subdetId())) &&
799+
!GeomDetEnumerators::isTrackerStrip(theGeometry->geomDetSubDetector(id.subdetId()))) {
800+
return true;
801+
}
802+
784803
if (GeomDetEnumerators::isTrackerStrip(theGeometry->geomDetSubDetector(id.subdetId()))) {
785804
if (subdetStoN_[subdet_cnt - 1]) {
786805
//check that hit is in a det belonging to a subdet where we decided to apply a S/N cut
@@ -816,14 +835,14 @@ namespace reco {
816835
}
817836

818837
if (keepthishit) {
819-
siStripClusterInfo_.setCluster(*cluster, id.rawId());
838+
siStripClusterInfo_->setCluster(*cluster, id.rawId());
820839
if ((subdetStoNlowcut_[subdet_cnt - 1] > 0) &&
821-
(siStripClusterInfo_.signalOverNoise() < subdetStoNlowcut_[subdet_cnt - 1]))
840+
(siStripClusterInfo_->signalOverNoise() < subdetStoNlowcut_[subdet_cnt - 1]))
822841
keepthishit = false;
823842
if ((subdetStoNhighcut_[subdet_cnt - 1] > 0) &&
824-
(siStripClusterInfo_.signalOverNoise() > subdetStoNhighcut_[subdet_cnt - 1]))
843+
(siStripClusterInfo_->signalOverNoise() > subdetStoNhighcut_[subdet_cnt - 1]))
825844
keepthishit = false;
826-
//if(!keepthishit)std::cout<<"Hit rejected because of bad S/N: "<<siStripClusterInfo_.signalOverNoise()<<std::endl;
845+
//if(!keepthishit)std::cout<<"Hit rejected because of bad S/N: "<<siStripClusterInfo_->signalOverNoise()<<std::endl;
827846
}
828847

829848
} //end if subdetStoN_[subdet_cnt]&&...
@@ -975,6 +994,39 @@ namespace reco {
975994
return tTopo->side(id);
976995
}
977996

997+
// ------------ method fills 'descriptions' with the allowed parameters for the module ------------
998+
void TrackerTrackHitFilter::fillDescriptions(edm::ConfigurationDescriptions &descriptions) {
999+
edm::ParameterSetDescription desc;
1000+
desc.setComment("");
1001+
desc.add<edm::InputTag>("src", edm::InputTag("generalTracks"));
1002+
desc.add<uint32_t>("minimumHits", 3)->setComment("number of hits for refit");
1003+
desc.add<bool>("replaceWithInactiveHits", false)
1004+
->setComment(
1005+
" instead of removing hits replace them with inactive hits, so you still consider the multiple "
1006+
"scattering");
1007+
desc.add<bool>("stripFrontInvalidHits", false)
1008+
->setComment("strip invalid & inactive hits from any end of the track");
1009+
desc.add<bool>("stripBackInvalidHits", false)
1010+
->setComment("strip invalid & inactive hits from any end of the track");
1011+
desc.add<bool>("stripAllInvalidHits", false)->setComment("dangerous to turn on, you might forget about MS");
1012+
desc.add<bool>("isPhase2", false);
1013+
desc.add<bool>("rejectBadStoNHits", false);
1014+
desc.add<std::string>("CMNSubtractionMode", std::string("Median"))->setComment("TT6");
1015+
desc.add<std::vector<uint32_t> >("detsToIgnore", {});
1016+
desc.add<bool>("useTrajectories", false);
1017+
desc.add<bool>("rejectLowAngleHits", false);
1018+
desc.add<double>("TrackAngleCut", 0.25)->setComment("rad");
1019+
desc.add<bool>("usePixelQualityFlag", false);
1020+
desc.add<double>("PxlTemplateProbXYCut", 0.000125);
1021+
desc.add<double>("PxlTemplateProbXYChargeCut", -99.);
1022+
desc.add<std::vector<int32_t> >("PxlTemplateqBinCut", {0, 3});
1023+
desc.add<double>("PxlCorrClusterChargeCut", -999.0);
1024+
desc.add<bool>("tagOverlaps", false);
1025+
desc.add<std::vector<std::string> >("commands", {})->setComment("layers to remove");
1026+
desc.add<std::vector<std::string> >("StoNcommands", {})->setComment("S/N cut per layer");
1027+
descriptions.addWithDefaultLabel(desc);
1028+
}
1029+
9781030
} // namespace modules
9791031
} // namespace reco
9801032

Lines changed: 43 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,46 @@
11
import FWCore.ParameterSet.Config as cms
22

3-
TrackerTrackHitFilter = cms.EDProducer("TrackerTrackHitFilter",
4-
src = cms.InputTag("generalTracks"),
5-
minimumHits =cms.uint32(3), ##min number of hits for refit
6-
## # layers to remove
7-
commands = cms.vstring(
8-
"drop PXB", "drop PXE" ### same works for TIB, TID, TOB, TEC,
9-
#"drop TIB 3", ## you can also drop specific layers/wheel/disks
10-
#"keep PXB 3", ## you can also 'keep' some layer after
11-
##having dropped the whole structure
12-
),
13-
14-
###list of individual detids to turn off, in addition to the structures above
15-
detsToIgnore = cms.vuint32( ),
16-
17-
### what to do with invalid hits
18-
replaceWithInactiveHits =cms.bool(False), ## instead of removing hits replace
19-
## them with inactive hits, so you still
20-
## consider the multiple scattering
21-
stripFrontInvalidHits =cms.bool(False), ## strip invalid & inactive hits from
22-
stripBackInvalidHits =cms.bool(False), ## any end of the track
23-
24-
stripAllInvalidHits = cms.bool(False), ##not sure if it's better 'true' or 'false'
25-
## might be dangerous to turn on
26-
## as you will forget about MS
3+
from RecoTracker.FinalTrackSelectors.trackerTrackHitFilter_cfi import trackerTrackHitFilter as _trackerTrackHitFilter
4+
TrackerTrackHitFilter = _trackerTrackHitFilter.clone(
5+
src = "generalTracks",
6+
minimumHits = 3, ##min number of hits for refit
7+
## # layers to remove
8+
commands = ["drop PXB", "drop PXE"], ### same works for TIB, TID, TOB, TEC,
9+
# "drop TIB 3", ## you can also drop specific layers/wheel/disks
10+
# "keep PXB 3", ## you can also 'keep' some layer after
11+
# having dropped the whole structure
2712

28-
### hit quality cuts
29-
rejectBadStoNHits = cms.bool(False),
30-
CMNSubtractionMode = cms.string("Median"), ## "TT6"
31-
StoNcommands = cms.vstring(
32-
"TIB 1.0 ", "TOB 1.0 999.0"
33-
),
34-
useTrajectories=cms.bool(False),
35-
rejectLowAngleHits=cms.bool(False),
36-
TrackAngleCut=cms.double(0.25), ## in radians
37-
tagOverlaps=cms.bool(False),
38-
usePixelQualityFlag=cms.bool(False),
39-
PxlTemplateProbXYCut=cms.double(0.000125), #recommended by experts
40-
PxlTemplateProbXYChargeCut=cms.double(-99.), #recommended by experts
41-
PxlTemplateqBinCut =cms.vint32(0, 3), #recommended by experts
42-
PxlCorrClusterChargeCut = cms.double(-999.0)
43-
)####end of module
13+
###list of individual detids to turn off, in addition to the structures above
14+
detsToIgnore = [],
15+
16+
### what to do with invalid hits
17+
replaceWithInactiveHits = False, ## instead of removing hits replace
18+
## them with inactive hits, so you still
19+
## consider the multiple scattering
20+
21+
stripFrontInvalidHits = False, ## strip invalid & inactive hits from
22+
stripBackInvalidHits = False, ## any end of the track
23+
24+
stripAllInvalidHits = False, ## not sure if it's better 'true' or 'false'
25+
## might be dangerous to turn on
26+
## as you will forget about MS
27+
28+
### hit quality cuts
29+
isPhase2 = False,
30+
rejectBadStoNHits = False,
31+
CMNSubtractionMode = "Median", ## "TT6"
32+
StoNcommands = ["TIB 1.0 ", "TOB 1.0 999.0"],
33+
useTrajectories = False,
34+
rejectLowAngleHits = False,
35+
TrackAngleCut = 0.25, ## in radians
36+
tagOverlaps= False,
37+
usePixelQualityFlag = False,
38+
PxlTemplateProbXYCut = 0.000125, # recommended by experts
39+
PxlTemplateProbXYChargeCut = -99., # recommended by experts
40+
PxlTemplateqBinCut = [0, 3], # recommended by experts
41+
PxlCorrClusterChargeCut = -999.0
42+
) #### end of module
43+
44+
from Configuration.Eras.Modifier_phase2_tracker_cff import phase2_tracker
45+
phase2_tracker.toModify(TrackerTrackHitFilter,
46+
isPhase2 = True)

0 commit comments

Comments
 (0)