Skip to content

Commit

Permalink
Merge pull request #42514 from Dr15Jones/PixelTemplateStoreFromES
Browse files Browse the repository at this point in the history
Moved creating SiPixelTemplateStore from DB to an ESProducer
  • Loading branch information
cmsbuild authored Aug 17, 2023
2 parents 7769acb + 880dadf commit 8fff0b8
Show file tree
Hide file tree
Showing 38 changed files with 232 additions and 80 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,10 @@ def getSequence(process, collection,
modules.append(getattr(process, src))

moduleSum = process.offlineBeamSpot # first element of the sequence
tasks = []
if usePixelQualityFlag:
process.load("RecoLocalTracker.SiPixelRecHits.SiPixelTemplateStoreESProducer_cfi")
tasks =[process.SiPixelTemplateStoreESProducer]
if g4Refitting:
# g4Refitter needs measurements
moduleSum += getattr(process,"MeasurementTrackerEvent")
Expand Down Expand Up @@ -421,6 +425,8 @@ def getSequence(process, collection,

moduleSum += module # append the other modules

if tasks:
return cms.Sequence(moduleSum, cms.Task(*tasks))
return cms.Sequence(moduleSum)

###############################
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,16 +289,19 @@
)


process.load("RecoLocalTracker.SiPixelRecHits.SiPixelTemplateStoreESProducer_cfi")
if (triggerFilter == "nothing" or triggerFilter == ""):
process.p = cms.Path(process.offlineBeamSpot +
process.TrackRefitter +
process.offlinePrimaryVerticesFromRefittedTrks +
process.jetHTAnalyzer)
process.jetHTAnalyzer,
cms.Task(process.SiPixelTemplateStoreESProducer))
else:
process.p = cms.Path(process.HLTFilter +
process.offlineBeamSpot +
process.TrackRefitter +
process.offlinePrimaryVerticesFromRefittedTrks +
process.jetHTAnalyzer)
process.jetHTAnalyzer,
cms.Task(process.SiPixelTemplateStoreESProducer))


Original file line number Diff line number Diff line change
Expand Up @@ -196,10 +196,13 @@
)
print("Saving the output at %s" % process.TFileService.fileName.value())


process.load("RecoLocalTracker.SiPixelRecHits.SiPixelTemplateStoreESProducer_cfi")
process.theValidSequence = cms.Sequence(process.offlineBeamSpot +
process.TrackRefitter +
process.offlinePrimaryVerticesFromRefittedTrks +
process.PrimaryVertexResolution)
process.PrimaryVertexResolution,
cms.Task(process.SiPixelTemplateStoreESProducer))

HLTSel = config["validation"].get("HLTselection", False)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,10 +228,12 @@ def best_match(rcd):
####################################################################
# Sequence
####################################################################
process.load("RecoLocalTracker.SiPixelRecHits.SiPixelTemplateStoreESProducer_cfi")
process.seqTrackselRefit = cms.Sequence(process.offlineBeamSpot*
# in case NavigatioSchool is set !=''
#process.MeasurementTrackerEvent*
process.TrackRefitter)
process.TrackRefitter,
cms.Task(process.SiPixelTemplateStoreESProducer))

####################################################################
# Re-do vertices
Expand Down
4 changes: 3 additions & 1 deletion Alignment/OfflineValidation/test/eopTreeWriter_cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,10 @@
####################################################################
# Path
####################################################################
process.load("RecoLocalTracker.SiPixelRecHits.SiPixelTemplateStoreESProducer_cfi")
process.p = cms.Path(process.MeasurementTrackerEvent*
process.offlineBeamSpot*
process.AlignmentTrackSelector*
process.TrackRefitter*
process.energyOverMomentumTree)
process.energyOverMomentumTree,
cms.Task(process.SiPixelTemplateStoreESProducer))
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ class SiPixelLorentzAnglePCLWorker : public DQMEDAnalyzer {
// template stuff
edm::ESWatcher<SiPixelTemplateDBObjectESProducerRcd> watchSiPixelTemplateRcd_;
const SiPixelTemplateDBObject* templateDBobject_;
std::vector<SiPixelTemplateStore> thePixelTemp_;
const std::vector<SiPixelTemplateStore>* thePixelTemp_ = nullptr;

LorentzAngleAnalysisTypeEnum analysisType_;
std::string folder_;
Expand Down Expand Up @@ -195,6 +195,7 @@ class SiPixelLorentzAnglePCLWorker : public DQMEDAnalyzer {
edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> geomEsToken_;
edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> topoEsToken_;
edm::ESGetToken<SiPixelTemplateDBObject, SiPixelTemplateDBObjectESProducerRcd> siPixelTemplateEsToken_;
edm::ESGetToken<std::vector<SiPixelTemplateStore>, SiPixelTemplateDBObjectESProducerRcd> siPixelTemplateStoreEsToken_;
edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> topoPerEventEsToken_;
edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> geomPerEventEsToken_;
edm::ESGetToken<MagneticField, IdealMagneticFieldRecord> magneticFieldToken_;
Expand Down Expand Up @@ -223,6 +224,7 @@ SiPixelLorentzAnglePCLWorker::SiPixelLorentzAnglePCLWorker(const edm::ParameterS
geomEsToken_(esConsumes<edm::Transition::BeginRun>()),
topoEsToken_(esConsumes<edm::Transition::BeginRun>()),
siPixelTemplateEsToken_(esConsumes<edm::Transition::BeginRun>()),
siPixelTemplateStoreEsToken_(esConsumes<edm::Transition::BeginRun>()),
topoPerEventEsToken_(esConsumes()),
geomPerEventEsToken_(esConsumes()),
magneticFieldToken_(esConsumes()) {
Expand Down Expand Up @@ -467,7 +469,7 @@ void SiPixelLorentzAnglePCLWorker::analyze(edm::Event const& iEvent, edm::EventS

if (notInPCL_) {
// fill the template from the store (from dqmBeginRun)
SiPixelTemplate theTemplate(thePixelTemp_);
SiPixelTemplate theTemplate(*thePixelTemp_);

float locBx = (cotbeta < 0.) ? -1 : 1.;
float locBz = (cotalpha < 0.) ? -locBx : locBx;
Expand Down Expand Up @@ -639,7 +641,7 @@ void SiPixelLorentzAnglePCLWorker::analyze(edm::Event const& iEvent, edm::EventS

if (notInPCL_) {
// fill the template from the store (from dqmBeginRun)
SiPixelTemplate theTemplate(thePixelTemp_);
SiPixelTemplate theTemplate(*thePixelTemp_);

float locBx = (cotbeta < 0.) ? -1 : 1.;
float locBz = (cotalpha < 0.) ? -locBx : locBx;
Expand Down Expand Up @@ -730,11 +732,7 @@ void SiPixelLorentzAnglePCLWorker::dqmBeginRun(edm::Run const& run, edm::EventSe
// Initialize 1D templates
if (watchSiPixelTemplateRcd_.check(iSetup)) {
templateDBobject_ = &iSetup.getData(siPixelTemplateEsToken_);
if (!SiPixelTemplate::pushfile(*templateDBobject_, thePixelTemp_)) {
edm::LogError("SiPixelLorentzAnglePCLWorker")
<< "Templates not filled correctly. Check the sqlite file. Using SiPixelTemplateDBObject version "
<< (*templateDBobject_).version();
}
thePixelTemp_ = &iSetup.getData(siPixelTemplateStoreEsToken_);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
from RecoTracker.Configuration.RecoTrackerP5_cff import *
from RecoTracker.TrackProducer.TrackRefitter_cfi import *
from TrackingTools.TransientTrack.TransientTrackBuilder_cfi import *
from RecoLocalTracker.SiPixelRecHits.SiPixelTemplateStoreESProducer_cfi import *

ALCARECOPixelLACalibrationTracksRefitMCS = TrackRefitter.clone(src = "ALCARECOPixelLACalibrationTracksMCS",
TrajectoryInEvent = True,
Expand Down Expand Up @@ -65,5 +66,6 @@
ALCARECOCalCosmicsFilterForSiPixelLorentzAngleMCS *
ALCARECOPixelLATrackFilterRefitMCS *
ALCARECOSiPixelLACalibMCS *
MEtoEDMConvertSiPixelLorentzAngleMCS
MEtoEDMConvertSiPixelLorentzAngleMCS,
cms.Task(SiPixelTemplateStoreESProducer)
)
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,11 @@
)

# The actual sequence
from RecoLocalTracker.SiPixelRecHits.SiPixelTemplateStoreESProducer_cfi import *
seqALCARECOPromptCalibProdSiPixelLorentzAngle = cms.Sequence(
ALCARECOCalSignleMuonFilterForSiPixelLorentzAngle *
ALCARECOPixelLATrackFilterRefit *
ALCARECOSiPixelLACalib *
MEtoEDMConvertSiPixelLorentzAngle
MEtoEDMConvertSiPixelLorentzAngle,
cms.Task(SiPixelTemplateStoreESProducer)
)
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,12 @@
)

# refit and BS can be dropped if done together with RECO.
# track filter can be moved in acalreco if no otehr users
# track filter can be moved in acalreco if no other users
from RecoLocalTracker.SiPixelRecHits.SiPixelTemplateStoreESProducer_cfi import SiPixelTemplateStoreESProducer
ALCARECOTrackFilterRefitAAG = cms.Sequence(ALCARECOCalibrationTracksAAG +
offlineBeamSpot +
ALCARECOCalibrationTracksRefitAAG )
ALCARECOCalibrationTracksRefitAAG,
cms.Task(SiPixelTemplateStoreESProducer) )

# ------------------------------------------------------------------------------
# This is the module actually doing the calibration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,10 @@
##################################################################
# Sequence: track refit + close-by-pixel producer
##################################################################
from RecoLocalTracker.SiPixelRecHits.SiPixelTemplateStoreESProducer_cfi import SiPixelTemplateStoreESProducer
ALCARECOSiPixelCalSingleMuonTightOffTrackClusters = cms.Sequence(ALCARECOSiPixelCalSingleMuonTightTracksRefit +
closebyPixelClusters)
closebyPixelClusters ,
cms.Task(SiPixelTemplateStoreESProducer))

##################################################################
# Producer of distances value map
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// -*- C++ -*-
//
// Package: CondFormats/SiPixelTransient
// Class : T_EventSetup_SiPixelTemplateStore
//
// Implementation:
// [Notes on implementation]
//
// Original Author: Christopher Jones
// Created: Tue, 08 Aug 2023 15:33:48 GMT
//

// system include files

// user include files
#include "CondFormats/SiPixelTransient/interface/SiPixelTemplate.h"
#include "FWCore/Utilities/interface/typelookup.h"

TYPELOOKUP_DATA_REG(std::vector<SiPixelTemplateStore>);
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from DQM.SiPixelPhase1Track.SiPixelPhase1ResidualsExtra_cfi import *
# Clusters ontrack/offtrack (also general tracks)
from DQM.SiPixelPhase1Track.SiPixelPhase1TrackClusters_cfi import *
from RecoLocalTracker.SiPixelRecHits.SiPixelTemplateStoreESProducer_cfi import *
# Hit Efficiencies
from DQM.SiPixelPhase1Track.SiPixelPhase1TrackEfficiency_cfi import *
# FED/RAW Data
Expand All @@ -24,7 +25,6 @@
from DQM.SiPixelPhase1Summary.SiPixelBarycenter_cfi import *



from RecoTracker.PixelLowPtUtilities.ClusterShapeHitFilterESProducer_cfi import *
from RecoLocalTracker.SiStripClusterizer.SiStripClusterChargeCut_cfi import *
from DQM.SiPixelPhase1Track.SiPixelPhase1EfficiencyExtras_cfi import *
Expand All @@ -39,7 +39,8 @@
+ SiPixelPhase1RecHitsAnalyzer
+ SiPixelPhase1TrackResidualsAnalyzer
+ SiPixelPhase1TrackClustersAnalyzer
+ SiPixelPhase1TrackEfficiencyAnalyzer
+ SiPixelPhase1TrackEfficiencyAnalyzer,
cms.Task(SiPixelTemplateStoreESProducer)
)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,12 @@

# Cluster (track-independent) monitoring
from DQM.SiPixelPhase1Common.SiPixelPhase1Clusters_cfi import *
from RecoLocalTracker.SiPixelRecHits.SiPixelTemplateStoreESProducer_cfi import *

# Track cluster
from DQM.SiPixelPhase1Track.SiPixelPhase1TrackClusters_cfi import *
from DQM.SiPixelPhase1Track.SiPixelPhase1TrackResiduals_cfi import *


# Raw data errors
from DQM.SiPixelPhase1Common.SiPixelPhase1RawData_cfi import *

Expand All @@ -115,7 +115,8 @@
+ SiPixelPhase1ClustersAnalyzer
+ SiPixelPhase1RawDataAnalyzer
+ SiPixelPhase1TrackClustersAnalyzer
+ SiPixelPhase1TrackResidualsAnalyzer
+ SiPixelPhase1TrackResidualsAnalyzer,
cms.Task(SiPixelTemplateStoreESProducer)
)

siPixelPhase1OnlineDQM_harvesting = cms.Sequence(
Expand Down Expand Up @@ -149,7 +150,8 @@
+ SiPixelPhase1ClustersAnalyzer
+ SiPixelPhase1RawDataAnalyzer
+ SiPixelPhase1TrackClustersAnalyzer_cosmics
+ SiPixelPhase1TrackResidualsAnalyzer_cosmics
+ SiPixelPhase1TrackResidualsAnalyzer_cosmics,
cms.Task(SiPixelTemplateStoreESProducer)
)

## Additional settings for pp_run (Phase 0 test)
Expand Down Expand Up @@ -177,6 +179,7 @@
+ SiPixelPhase1RawDataAnalyzer
+ SiPixelPhase1TrackClustersAnalyzer_pprun
+ SiPixelPhase1TrackResidualsAnalyzer_pprun
+ SiPixelPhase1TrackEfficiencyAnalyzer_pprun
+ SiPixelPhase1TrackEfficiencyAnalyzer_pprun,
cms.Task(SiPixelTemplateStoreESProducer)
)

9 changes: 7 additions & 2 deletions DQM/SiPixelPhase1Config/python/SiPixelPhase1OnlineDQM_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@

# Track cluster
from DQM.SiPixelPhase1Track.SiPixelPhase1TrackClusters_cfi import *
from RecoLocalTracker.SiPixelRecHits.SiPixelTemplateStoreESProducer_cfi import *

SiPixelPhase1TrackClustersOnTrackCorrCharge.enabled=cms.bool(False)
SiPixelPhase1TrackTemplateCorr.enabled=cms.bool(False)
SiPixelPhase1TrackClustersOnTrackCorrChargeOuter.enabled=cms.bool(False)
Expand All @@ -86,6 +88,7 @@
+ SiPixelPhase1TrackClustersAnalyzer
+ SiPixelPhase1TrackResidualsAnalyzer
# + SiPixelPhase1GeometryDebugAnalyzer
, cms.Task(SiPixelTemplateStoreESProducer)
)

siPixelPhase1OnlineDQM_harvesting = cms.Sequence(
Expand Down Expand Up @@ -119,7 +122,8 @@
+ SiPixelPhase1ClustersAnalyzer
+ SiPixelPhase1RawDataAnalyzer
+ SiPixelPhase1TrackClustersAnalyzer_cosmics
+ SiPixelPhase1TrackResidualsAnalyzer_cosmics
+ SiPixelPhase1TrackResidualsAnalyzer_cosmics,
cms.Task(SiPixelTemplateStoreESProducer)
)

## Additional settings for pp_run
Expand All @@ -142,7 +146,8 @@
+ SiPixelPhase1ClustersAnalyzer
+ SiPixelPhase1RawDataAnalyzer
+ SiPixelPhase1TrackClustersAnalyzer_pprun
+ SiPixelPhase1TrackResidualsAnalyzer_pprun
+ SiPixelPhase1TrackResidualsAnalyzer_pprun,
cms.Task(SiPixelTemplateStoreESProducer)
)

siPixelPhase1OnlineDQM_timing_harvesting = siPixelPhase1OnlineDQM_harvesting.copyAndExclude([
Expand Down
13 changes: 6 additions & 7 deletions DQM/SiPixelPhase1Track/plugins/SiPixelPhase1TrackClusters.cc
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ namespace {

private:
const bool applyVertexCut_;
const SiPixelTemplateDBObject* templateDBobject_;
std::vector<SiPixelTemplateStore> thePixelTemp_;
const SiPixelTemplateDBObject* templateDBobject_ = nullptr;
const std::vector<SiPixelTemplateStore>* thePixelTemp_ = nullptr;
const TrackerTopology* tkTpl = nullptr;

edm::EDGetTokenT<reco::TrackCollection> tracksToken_;
Expand All @@ -101,6 +101,7 @@ namespace {
edm::ESGetToken<ClusterShapeHitFilter, CkfComponentsRecord> clusterShapeHitFilterToken_;

edm::ESGetToken<SiPixelTemplateDBObject, SiPixelTemplateDBObjectESProducerRcd> templateDBobjectToken_;
edm::ESGetToken<std::vector<SiPixelTemplateStore>, SiPixelTemplateDBObjectESProducerRcd> templateStoreToken_;
};

SiPixelPhase1TrackClusters::SiPixelPhase1TrackClusters(const edm::ParameterSet& iConfig)
Expand All @@ -118,6 +119,7 @@ namespace {
trackerGeomToken_ = esConsumes<edm::Transition::BeginRun>();
clusterShapeHitFilterToken_ =
esConsumes<ClusterShapeHitFilter, CkfComponentsRecord>(edm::ESInputTag("", "ClusterShapeHitFilter"));
templateStoreToken_ = esConsumes<edm::Transition::BeginRun>();
templateDBobjectToken_ = esConsumes<edm::Transition::BeginRun>();
}

Expand All @@ -127,10 +129,7 @@ namespace {

// Initialize 1D templates
templateDBobject_ = &iSetup.getData(templateDBobjectToken_);
if (!SiPixelTemplate::pushfile(*templateDBobject_, thePixelTemp_))
edm::LogError("SiPixelPhase1TrackClusters")
<< "Templates not filled correctly. Check the sqlite file. Using SiPixelTemplateDBObject version "
<< (*templateDBobject_).version() << std::endl;
thePixelTemp_ = &iSetup.getData(templateStoreToken_);
}

void SiPixelPhase1TrackClusters::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) {
Expand Down Expand Up @@ -162,7 +161,7 @@ namespace {
return;
}

SiPixelTemplate templ(thePixelTemp_);
SiPixelTemplate templ(*thePixelTemp_);

edm::Handle<SiPixelClusterShapeCache> pixelClusterShapeCacheH;
iEvent.getByToken(pixelClusterShapeCacheToken_, pixelClusterShapeCacheH);
Expand Down
4 changes: 3 additions & 1 deletion DQMOffline/Trigger/python/SiPixel_OfflineMonitoring_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from DQMOffline.Trigger.SiPixel_OfflineMonitoring_TrackCluster_cff import *
from RecoTracker.PixelLowPtUtilities.siPixelClusterShapeCache_cfi import *
from DQM.SiPixelMonitorTrack.RefitterForPixelDQM import *
from RecoLocalTracker.SiPixelRecHits.SiPixelTemplateStoreESProducer_cfi import *

hltSiPixelClusterShapeCache = siPixelClusterShapeCache.clone(src = 'hltSiPixelClusters')
hltrefittedForPixelDQM = refittedForPixelDQM.clone(src ='hltMergedTracks',
Expand All @@ -12,5 +13,6 @@
hltSiPixelClusterShapeCache
+ hltSiPixelPhase1ClustersAnalyzer
+ hltrefittedForPixelDQM
+ hltSiPixelPhase1TrackClustersAnalyzer
+ hltSiPixelPhase1TrackClustersAnalyzer,
cms.Task(SiPixelTemplateStoreESProducer)
)
1 change: 1 addition & 0 deletions DQMOffline/Trigger/python/SiStrip_OfflineMonitoring_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#HLTsiStripClusters.SiStripRefGetter = cms.InputTag("hltSiStripClusters")

# SiStripCluster monitoring
from RecoLocalTracker.SiPixelRecHits.SiPixelTemplateStoreESProducer_cfi import SiPixelTemplateStoreESProducer
import DQM.SiStripMonitorCluster.SiStripMonitorCluster_cfi
HLTSiStripMonitorCluster = DQM.SiStripMonitorCluster.SiStripMonitorCluster_cfi.SiStripMonitorCluster.clone(
ClusterProducerStrip = "hltSiStripRawToClustersFacility",
Expand Down
Loading

0 comments on commit 8fff0b8

Please sign in to comment.