Skip to content

Commit f63882c

Browse files
committed
Adapt ClusterTPAssociationProducer to deal with two strip cluster product ids, as well as relevant validation modules
1 parent ef9550b commit f63882c

File tree

4 files changed

+78
-9
lines changed

4 files changed

+78
-9
lines changed

HLTriggerOffline/Egamma/python/HLTmultiTrackValidatorGsfTracks_cff.py

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,17 @@
11
import FWCore.ParameterSet.Config as cms
22

3-
from Validation.RecoTrack.HLTmultiTrackValidator_cfi import *
3+
from Validation.RecoTrack.associators_cff import hltTPClusterProducer, hltTrackAssociatorByHits
4+
from Validation.RecoTrack.HLTmultiTrackValidator_cfi import hltMultiTrackValidator
5+
from Validation.RecoTrack.TrackValidation_cff import trackingParticlesElectron
6+
7+
hltTPClusterOnDemandProducer = hltTPClusterProducer.clone(
8+
stripClusterSrc = "hltSiStripRawToClustersFacilityOnDemand"
9+
)
10+
11+
hltGsfTrackAssociatorByHits = hltTrackAssociatorByHits.clone(
12+
cluster2TPSrc = "hltTPClusterOnDemandProducer"
13+
)
14+
415
hltGsfTrackValidator = hltMultiTrackValidator.clone(
516
label = [
617
"hltEgammaGsfTracks",
@@ -20,6 +31,7 @@
2031
),
2132
maxRapidityTP = 3.0,
2233
minRapidityTP = -3.0,
34+
associators = ['hltGsfTrackAssociatorByHits']
2335
)
2436

2537
def _modifyForPhase2(trackvalidator):
@@ -28,11 +40,10 @@ def _modifyForPhase2(trackvalidator):
2840
from Configuration.Eras.Modifier_phase2_common_cff import phase2_common
2941
phase2_common.toModify(hltGsfTrackValidator, _modifyForPhase2)
3042

31-
from Validation.RecoTrack.TrackValidation_cff import trackingParticlesElectron
3243
hltMultiTrackValidationGsfTracksTask = cms.Task(
33-
hltTPClusterProducer
34-
, hltTrackAssociatorByHits
35-
, trackingParticlesElectron
44+
hltTPClusterOnDemandProducer,
45+
hltGsfTrackAssociatorByHits,
46+
trackingParticlesElectron
3647
)
3748
hltMultiTrackValidationGsfTracks = cms.Sequence(
3849
hltGsfTrackValidator,

SimTracker/TrackerHitAssociation/interface/ClusterTPAssociation.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ class ClusterTPAssociation {
8686
}
8787

8888
map_type map_;
89-
edm::VecArray<edm::ProductID, 2> keyProductIDs_;
89+
std::vector<edm::ProductID> keyProductIDs_;
9090
edm::ProductID mappedProductId_;
9191
};
9292

SimTracker/TrackerHitAssociation/plugins/ClusterTPAssociationProducer.cc

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ class ClusterTPAssociationProducer final : public edm::global::EDProducer<> {
6868
edm::EDGetTokenT<edm::DetSetVector<PixelDigiSimLink> > siphase2OTSimLinksToken_;
6969
edm::EDGetTokenT<edmNew::DetSetVector<SiPixelCluster> > pixelClustersToken_;
7070
edm::EDGetTokenT<edmNew::DetSetVector<SiStripCluster> > stripClustersToken_;
71+
const edm::InputTag otherStripClusterTag_;
72+
edm::EDGetTokenT<edmNew::DetSetVector<SiStripCluster> > stripClustersOtherToken_;
7173
edm::EDGetTokenT<edmNew::DetSetVector<Phase2TrackerCluster1D> > phase2OTClustersToken_;
7274
edm::EDGetTokenT<TrackingParticleCollection> trackingParticleToken_;
7375
bool throwOnMissingCollections_;
@@ -84,6 +86,8 @@ ClusterTPAssociationProducer::ClusterTPAssociationProducer(const edm::ParameterS
8486
consumes<edmNew::DetSetVector<SiPixelCluster> >(cfg.getParameter<edm::InputTag>("pixelClusterSrc"))),
8587
stripClustersToken_(
8688
consumes<edmNew::DetSetVector<SiStripCluster> >(cfg.getParameter<edm::InputTag>("stripClusterSrc"))),
89+
otherStripClusterTag_(cfg.getParameter<edm::InputTag>("stripClusterOtherSrc")),
90+
stripClustersOtherToken_(consumes<edmNew::DetSetVector<SiStripCluster> >(otherStripClusterTag_)),
8791
phase2OTClustersToken_(consumes<edmNew::DetSetVector<Phase2TrackerCluster1D> >(
8892
cfg.getParameter<edm::InputTag>("phase2OTClusterSrc"))),
8993
trackingParticleToken_(
@@ -100,6 +104,7 @@ void ClusterTPAssociationProducer::fillDescriptions(edm::ConfigurationDescriptio
100104
desc.add<edm::InputTag>("phase2OTSimLinkSrc", edm::InputTag("simSiPixelDigis", "Tracker"));
101105
desc.add<edm::InputTag>("pixelClusterSrc", edm::InputTag("siPixelClusters"));
102106
desc.add<edm::InputTag>("stripClusterSrc", edm::InputTag("siStripClusters"));
107+
desc.add<edm::InputTag>("stripClusterOtherSrc", edm::InputTag(""));
103108
desc.add<edm::InputTag>("phase2OTClusterSrc", edm::InputTag("siPhase2Clusters"));
104109
desc.add<edm::InputTag>("trackingParticleSrc", edm::InputTag("mix", "MergedTrackTruth"));
105110
desc.add<bool>("throwOnMissingCollections", true);
@@ -115,6 +120,12 @@ void ClusterTPAssociationProducer::produce(edm::StreamID, edm::Event& iEvent, co
115120
edm::Handle<edmNew::DetSetVector<SiStripCluster> > stripClusters;
116121
bool foundStripClusters = iEvent.getByToken(stripClustersToken_, stripClusters);
117122

123+
// Strip Cluster (other product, if there)
124+
bool foundOtherStripClusters = false;
125+
edm::Handle<edmNew::DetSetVector<SiStripCluster> > stripClustersOther;
126+
if (otherStripClusterTag_ != edm::InputTag(""))
127+
foundOtherStripClusters = iEvent.getByToken(stripClustersOtherToken_, stripClustersOther);
128+
118129
// Phase2 Cluster
119130
edm::Handle<edmNew::DetSetVector<Phase2TrackerCluster1D> > phase2OTClusters;
120131
bool foundPhase2OTClusters = iEvent.getByToken(phase2OTClustersToken_, phase2OTClusters);
@@ -129,9 +140,10 @@ void ClusterTPAssociationProducer::produce(edm::StreamID, edm::Event& iEvent, co
129140
}
130141

131142
// SiStrip DigiSimLink
143+
bool foundAnyStripClusters = (foundStripClusters || foundOtherStripClusters);
132144
edm::Handle<edm::DetSetVector<StripDigiSimLink> > sistripSimLinks;
133145
auto stripSimLinksFound = iEvent.getByToken(sistripSimLinksToken_, sistripSimLinks);
134-
if (not throwOnMissingCollections_ and foundStripClusters and not stripSimLinksFound) {
146+
if (not throwOnMissingCollections_ and foundAnyStripClusters and not stripSimLinksFound) {
135147
auto clusterTPList = std::make_unique<ClusterTPAssociation>();
136148
iEvent.put(std::move(clusterTPList));
137149
return;
@@ -244,6 +256,43 @@ void ClusterTPAssociationProducer::produce(edm::StreamID, edm::Event& iEvent, co
244256
}
245257
}
246258

259+
if (foundOtherStripClusters) {
260+
// Strip Clusters (other product, if there)
261+
clusterTPList->addKeyID(stripClustersOther.id());
262+
for (edmNew::DetSetVector<SiStripCluster>::const_iterator iter = stripClustersOther->begin(false),
263+
eter = stripClustersOther->end(false);
264+
iter != eter;
265+
++iter) {
266+
if (!(*iter).isValid())
267+
continue;
268+
uint32_t detid = iter->id();
269+
DetId detId(detid);
270+
edmNew::DetSet<SiStripCluster> link_strip = (*iter);
271+
for (edmNew::DetSet<SiStripCluster>::const_iterator di = link_strip.begin(); di != link_strip.end(); di++) {
272+
const SiStripCluster& cluster = (*di);
273+
edm::Ref<edmNew::DetSetVector<SiStripCluster>, SiStripCluster> c_ref =
274+
edmNew::makeRefTo(stripClustersOther, di);
275+
276+
simTkIds.clear();
277+
int first = cluster.firstStrip();
278+
int last = first + cluster.amplitudes().size();
279+
280+
for (int istr = first; istr < last; ++istr) {
281+
trkid.clear();
282+
getSimTrackId<StripDigiSimLink>(trkid, sistripSimLinks, detId, istr);
283+
simTkIds.insert(trkid.begin(), trkid.end());
284+
}
285+
for (auto iset = simTkIds.begin(); iset != simTkIds.end(); iset++) {
286+
auto ipos = mapping.find(*iset);
287+
if (ipos != mapping.end()) {
288+
//std::cout << "cluster in detid: " << detid << " from tp: " << ipos->second.key() << " " << iset->first << std::endl;
289+
clusterTPList->emplace_back(OmniClusterRef(c_ref), ipos->second);
290+
}
291+
}
292+
}
293+
}
294+
}
295+
247296
if (foundPhase2OTClusters) {
248297
// Phase2 Clusters
249298
clusterTPList->addKeyID(phase2OTClusters.id());

Validation/RecoVertex/python/HLTmultiPVvalidator_cff.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,20 @@
1010
trackAssociatorMap = "trackingParticleRecoTrackAsssociation",
1111
vertexAssociator = "VertexAssociatorByPositionAndTracks"
1212
)
13-
from Validation.RecoTrack.associators_cff import hltTrackAssociatorByHits, tpToHLTpixelTrackAssociation
13+
from Validation.RecoTrack.associators_cff import hltTPClusterProducer, hltTrackAssociatorByHits, tpToHLTpixelTrackAssociation
1414
from SimTracker.VertexAssociation.VertexAssociatorByPositionAndTracks_cfi import VertexAssociatorByPositionAndTracks as _VertexAssociatorByPositionAndTracks
1515
vertexAssociatorByPositionAndTracks4pixelTracks = _VertexAssociatorByPositionAndTracks.clone(
1616
trackAssociation = "tpToHLTpixelTrackAssociation"
1717
)
18+
hltOtherTPClusterProducer = hltTPClusterProducer.clone(
19+
stripClusterOtherSrc = "hltSiStripRawToClustersFacilityOnDemand"
20+
)
21+
hltOtherTrackAssociatorByHits = hltTrackAssociatorByHits.clone(
22+
cluster2TPSrc = cms.InputTag("hltOtherTPClusterProducer")
23+
)
1824
tpToHLTpfMuonMergingTrackAssociation = tpToHLTpixelTrackAssociation.clone(
19-
label_tr = "hltPFMuonMerging"
25+
label_tr = "hltPFMuonMerging",
26+
associator = cms.InputTag('hltOtherTrackAssociatorByHits')
2027
)
2128
vertexAssociatorByPositionAndTracks4pfMuonMergingTracks = _VertexAssociatorByPositionAndTracks.clone(
2229
trackAssociation = "tpToHLTpfMuonMergingTrackAssociation"
@@ -62,7 +69,9 @@ def _modifyFullPVanalysisForPhase2(pvanalysis):
6269
phase2_tracker.toModify(hltPVanalysis, _modifyFullPVanalysisForPhase2)
6370

6471
hltMultiPVAssociations = cms.Task(
72+
hltOtherTPClusterProducer,
6573
hltTrackAssociatorByHits,
74+
hltOtherTrackAssociatorByHits,
6675
tpToHLTpixelTrackAssociation,
6776
vertexAssociatorByPositionAndTracks4pixelTracks,
6877
tpToHLTpfMuonMergingTrackAssociation,

0 commit comments

Comments
 (0)