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

Provide fillDescriptions for Pixel CPE classes #27694

Merged
merged 10 commits into from
Aug 28, 2019
3 changes: 0 additions & 3 deletions DQM/HLTEvF/python/HLTSiStripMonitoring_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
## make sure they are not already defined somewhereelse in the final configuration
from RecoLocalTracker.SiPixelRecHits.PixelCPETemplateReco_cfi import templates
hltESPPixelCPETemplateReco = templates.clone(
DoCosmics = cms.bool( False ),
LoadTemplatesFromDB = cms.bool( True ),
ComponentName = cms.string( "hltESPPixelCPETemplateReco" ),
Alpha2Order = cms.bool( True ),
Expand All @@ -36,15 +35,13 @@
size_cutX = cms.double( 3.0 ),
inflate_all_errors_no_trk_angle = cms.bool( False ),
IrradiationBiasCorrection = cms.bool( False ),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@mtosi the configuration of these producers looks somewhat outdated to me. I only fixed the patently useless parameters, though it would be good to revise what is done in the Tracking HLT DQM. I guess this can be left for a follow-up PR.

TanLorentzAnglePerTesla = cms.double( 0.106 ),
inflate_errors = cms.bool( False ),
eff_charge_cut_lowX = cms.double( 0.0 ),
eff_charge_cut_highY = cms.double( 1.0 ),
ClusterProbComputationFlag = cms.int32( 0 ),
EdgeClusterErrorY = cms.double( 85.0 ),
ComponentName = cms.string( "hltESPPixelCPEGeneric" ),
eff_charge_cut_lowY = cms.double( 0.0 ),
PixelErrorParametrization = cms.string( "NOTcmsim" ),
Alpha2Order = cms.bool( True )
)

Expand Down
3 changes: 0 additions & 3 deletions DQMOffline/Trigger/python/SiStrip_OfflineMonitoring_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@
xmin = cms.double(-0.5)
)
hltESPPixelCPETemplateReco = cms.ESProducer( "PixelCPETemplateRecoESProducer",
DoCosmics = cms.bool( False ),
LoadTemplatesFromDB = cms.bool( True ),
ComponentName = cms.string( "hltESPPixelCPETemplateReco" ),
Alpha2Order = cms.bool( True ),
Expand All @@ -84,15 +83,13 @@
size_cutX = cms.double( 3.0 ),
inflate_all_errors_no_trk_angle = cms.bool( False ),
IrradiationBiasCorrection = cms.bool( False ),
TanLorentzAnglePerTesla = cms.double( 0.106 ),
inflate_errors = cms.bool( False ),
eff_charge_cut_lowX = cms.double( 0.0 ),
eff_charge_cut_highY = cms.double( 1.0 ),
ClusterProbComputationFlag = cms.int32( 0 ),
EdgeClusterErrorY = cms.double( 85.0 ),
ComponentName = cms.string( "hltESPPixelCPEGeneric" ),
eff_charge_cut_lowY = cms.double( 0.0 ),
PixelErrorParametrization = cms.string( "NOTcmsim" ),
Alpha2Order = cms.bool( True )
)

Expand Down
12 changes: 12 additions & 0 deletions HLTrigger/Configuration/python/customizeHLTforCMSSW.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,23 @@ def customiseFor2017DtUnpacking(process):

return process

def customiseFor27694(process) :

for producer in esproducers_by_type(process, "PixelCPETemplateRecoESProducer"):
if hasattr(producer, "DoCosmics"): del producer.DoCosmics

for producer in esproducers_by_type(process, "PixelCPEGenericESProducer"):
if hasattr(producer, "TanLorentzAnglePerTesla"): del producer.TanLorentzAnglePerTesla
if hasattr(producer, "PixelErrorParametrization"): del producer.PixelErrorParametrization

return process

# CMSSW version specific customizations
def customizeHLTforCMSSW(process, menuType="GRun"):

# add call to action function in proper order: newest last!
# process = customiseFor12718(process)

process = customiseFor27694(process)

return process
3 changes: 3 additions & 0 deletions RecoLocalTracker/SiPixelRecHits/interface/PixelCPEBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

//--- For the configuration:
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"

#include "DataFormats/GeometryCommonDetAlgo/interface/MeasurementPoint.h"
#include "DataFormats/GeometryCommonDetAlgo/interface/MeasurementError.h"
Expand Down Expand Up @@ -128,6 +129,8 @@ class PixelCPEBase : public PixelClusterParameterEstimator {
int flag = 0 // flag=0 for generic, =1 for templates
); // NEW

static void fillPSetDescription(edm::ParameterSetDescription& desc);

//--------------------------------------------------------------------------
// Allow the magnetic field to be set/updated later.
//--------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ class PixelCPEClusterRepair : public PixelCPEBase {

~PixelCPEClusterRepair() override;

static void fillPSetDescription(edm::ParameterSetDescription &desc);

private:
ClusterParam *createClusterParam(const SiPixelCluster &cl) const override;

Expand Down
2 changes: 2 additions & 0 deletions RecoLocalTracker/SiPixelRecHits/interface/PixelCPEGeneric.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ class PixelCPEGeneric final : public PixelCPEBase {

~PixelCPEGeneric() override { ; }

static void fillPSetDescription(edm::ParameterSetDescription &desc);

private:
ClusterParam *createClusterParam(const SiPixelCluster &cl) const override;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ class PixelCPETemplateReco : public PixelCPEBase {

~PixelCPETemplateReco() override;

static void fillPSetDescription(edm::ParameterSetDescription &desc);

private:
ClusterParam *createClusterParam(const SiPixelCluster &cl) const override;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,24 +64,17 @@ PixelCPEClusterRepairESProducer::~PixelCPEClusterRepairESProducer() {}
void PixelCPEClusterRepairESProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
// templates2
edm::ParameterSetDescription desc;
desc.add<bool>("DoLorentz", true);
desc.add<bool>("DoCosmics", false);
desc.add<bool>("LoadTemplatesFromDB", true);
desc.add<bool>("RunDamagedClusters", false);
desc.add<std::string>("ComponentName", "PixelCPEClusterRepair");
desc.add<double>("MinChargeRatio", 0.8);
desc.add<double>("MaxSizeMismatchInY", 0.3);
desc.add<bool>("Alpha2Order", true);
desc.add<std::vector<std::string>>("Recommend2D",
{
"PXB 2",
"PXB 3",
"PXB 4",
});
desc.add<int>("ClusterProbComputationFlag", 0);
desc.add<int>("speed", -2);
desc.add<bool>("UseClusterSplitter", false);
descriptions.add("templates2", desc);

// from PixelCPEBase
PixelCPEBase::fillPSetDescription(desc);
mmusich marked this conversation as resolved.
Show resolved Hide resolved

// from PixelCPEClusterRepair
PixelCPEClusterRepair::fillPSetDescription(desc);

// specific to PixelCPEClusterRepairESProducer
desc.add<bool>("DoLorentz", true);
descriptions.add("_templates2_default", desc);
}

std::unique_ptr<PixelClusterParameterEstimator> PixelCPEClusterRepairESProducer::produce(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class PixelCPEGenericESProducer : public edm::ESProducer {
public:
PixelCPEGenericESProducer(const edm::ParameterSet& p);
std::unique_ptr<PixelClusterParameterEstimator> produce(const TkPixelCPERecord&);
static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);

private:
edm::ESGetToken<MagneticField, IdealMagneticFieldRecord> magfieldToken_;
Expand All @@ -42,18 +43,15 @@ using namespace edm;
PixelCPEGenericESProducer::PixelCPEGenericESProducer(const edm::ParameterSet& p) {
std::string myname = p.getParameter<std::string>("ComponentName");
// Use LA-width from DB. If both (upper and this) are false LA-width is calcuated from LA-offset
useLAWidthFromDB_ = p.existsAs<bool>("useLAWidthFromDB") ? p.getParameter<bool>("useLAWidthFromDB") : false;
useLAWidthFromDB_ = p.getParameter<bool>("useLAWidthFromDB");
// Use Alignment LA-offset
const bool useLAAlignmentOffsets =
p.existsAs<bool>("useLAAlignmentOffsets") ? p.getParameter<bool>("useLAAlignmentOffsets") : false;
const bool useLAAlignmentOffsets = p.getParameter<bool>("useLAAlignmentOffsets");
char const* laLabel = ""; // standard LA, from calibration, label=""
if (useLAAlignmentOffsets) {
laLabel = "fromAlignment";
}

auto magname = p.existsAs<edm::ESInputTag>("MagneticFieldRecord")
? p.getParameter<edm::ESInputTag>("MagneticFieldRecord")
: edm::ESInputTag("");
auto magname = p.getParameter<edm::ESInputTag>("MagneticFieldRecord");
UseErrorsFromTemplates_ = p.getParameter<bool>("UseErrorsFromTemplates");

pset_ = p;
Copy link
Contributor

Choose a reason for hiding this comment

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

this should be (eventually) replaced by a config struct
to decouple dependency of tools instantiation from the PSet.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@slava77 please provide an example

Copy link
Contributor

Choose a reason for hiding this comment

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

this is in line with #27010 (comment)
That PR also has some examples of how to decouple the ES products from the ParameterSet.
Most examples have a free list of arguments though (if there are more than a few, making a C/C++ struct to represent them may be more readable).

Expand Down Expand Up @@ -98,4 +96,21 @@ std::unique_ptr<PixelClusterParameterEstimator> PixelCPEGenericESProducer::produ
lorentzAngleWidthProduct);
}

void PixelCPEGenericESProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
edm::ParameterSetDescription desc;

// from PixelCPEBase
PixelCPEBase::fillPSetDescription(desc);

// from PixelCPEGeneric
PixelCPEGeneric::fillPSetDescription(desc);

// specific to PixelCPEGenericESProducer
desc.add<std::string>("ComponentName", "PixelCPEGeneric");
desc.add<edm::ESInputTag>("MagneticFieldRecord", edm::ESInputTag(""));
desc.add<bool>("useLAAlignmentOffsets", false);
desc.add<bool>("DoLorentz", false);
descriptions.add("_generic_default", desc);
}

DEFINE_FWK_EVENTSETUP_MODULE(PixelCPEGenericESProducer);
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class PixelCPETemplateRecoESProducer : public edm::ESProducer {
public:
PixelCPETemplateRecoESProducer(const edm::ParameterSet& p);
std::unique_ptr<PixelClusterParameterEstimator> produce(const TkPixelCPERecord&);
static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);

private:
edm::ESGetToken<MagneticField, IdealMagneticFieldRecord> magfieldToken_;
Expand All @@ -38,7 +39,7 @@ PixelCPETemplateRecoESProducer::PixelCPETemplateRecoESProducer(const edm::Parame
std::string myname = p.getParameter<std::string>("ComponentName");

//DoLorentz_ = p.getParameter<bool>("DoLorentz"); // True when LA from alignment is used
DoLorentz_ = p.existsAs<bool>("DoLorentz") ? p.getParameter<bool>("DoLorentz") : false;
DoLorentz_ = p.getParameter<bool>("DoLorentz");

pset_ = p;
auto c = setWhatProduced(this, myname);
Expand Down Expand Up @@ -66,4 +67,19 @@ std::unique_ptr<PixelClusterParameterEstimator> PixelCPETemplateRecoESProducer::
&iRecord.get(templateDBobjectToken_));
}

void PixelCPETemplateRecoESProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
edm::ParameterSetDescription desc;

// from PixelCPEBase
PixelCPEBase::fillPSetDescription(desc);
mmusich marked this conversation as resolved.
Show resolved Hide resolved

// from PixelCPETemplateReco
PixelCPETemplateReco::fillPSetDescription(desc);

// specific to PixelCPETemplateRecoESProducer
desc.add<std::string>("ComponentName", "PixelCPETemplateReco");
desc.add<bool>("DoLorentz", true);
descriptions.add("_templates_default", desc);
}

DEFINE_FWK_EVENTSETUP_MODULE(PixelCPETemplateRecoESProducer);
Original file line number Diff line number Diff line change
@@ -1,34 +1,7 @@
import FWCore.ParameterSet.Config as cms

templates2 = cms.ESProducer("PixelCPEClusterRepairESProducer",
ComponentName = cms.string('PixelCPEClusterRepair'),
speed = cms.int32(-2),
#PixelErrorParametrization = cms.string('NOTcmsim'),
Alpha2Order = cms.bool(True),
UseClusterSplitter = cms.bool(False),

# parameters to select which clusters we believe are truncated from dead double columns
# Be careful modifying these!
MaxSizeMismatchInY = cms.double(0.3),
MinChargeRatio = cms.double(0.8),

# layers to run on: (only PXB 2,PXB 3,PXB 4 for now)
Recommend2D = cms.vstring("PXB 2","PXB 3","PXB 4"),

# to run on damaged clusterss or not (default=no)
RunDamagedClusters = cms.bool(False),

# petar, for clusterProbability() from TTRHs
ClusterProbComputationFlag = cms.int32(0),
# gavril
DoCosmics = cms.bool(False),
# The flag to regulate if the LA offset is taken from Alignment
# True in Run II for offline RECO
DoLorentz = cms.bool(True),

LoadTemplatesFromDB = cms.bool(True)

)
from RecoLocalTracker.SiPixelRecHits._templates2_default_cfi import _templates2_default
templates2 = _templates2_default.clone()

# This customization will be removed once we get the templates for phase2 pixel
from Configuration.Eras.Modifier_phase2_tracker_cff import phase2_tracker
Expand Down
60 changes: 2 additions & 58 deletions RecoLocalTracker/SiPixelRecHits/python/PixelCPEGeneric_cfi.py
Original file line number Diff line number Diff line change
@@ -1,63 +1,7 @@
import FWCore.ParameterSet.Config as cms

PixelCPEGenericESProducer = cms.ESProducer("PixelCPEGenericESProducer",

ComponentName = cms.string('PixelCPEGeneric'),
Alpha2Order = cms.bool(True),
PixelErrorParametrization = cms.string('NOTcmsim'),

# Allows cuts to be optimized
eff_charge_cut_lowX = cms.double(0.0),
eff_charge_cut_lowY = cms.double(0.0),
eff_charge_cut_highX = cms.double(1.0),
eff_charge_cut_highY = cms.double(1.0),
size_cutX = cms.double(3.0),
size_cutY = cms.double(3.0),

# Edge cluster errors in microns (determined by looking at residual RMS)
EdgeClusterErrorX = cms.double( 50.0 ),
EdgeClusterErrorY = cms.double( 85.0 ),

# [email protected]
inflate_errors = cms.bool(False),
inflate_all_errors_no_trk_angle = cms.bool(False),

# Can use errors predicted by the template code
# If UseErrorsFromTemplates is False, must also set
# TruncatePixelCharge, IrradiationBiasCorrection, DoCosmics and LoadTemplatesFromDB to be False
UseErrorsFromTemplates = cms.bool(True),

# When set True this gives a slight improvement in resolution at no cost
TruncatePixelCharge = cms.bool(True),

# Turn this ON later
IrradiationBiasCorrection = cms.bool(False),

# When set to True we use templates with extended angular acceptance
DoCosmics = cms.bool(False),

LoadTemplatesFromDB = cms.bool(True),

# petar, for clusterProbability() from TTRHs
ClusterProbComputationFlag = cms.int32(0),

# new parameters added in 1/14, dk
# LA defined by hand, FOR TESTING ONLY, not for production
# 0.0 means that the offset is taken from DB
#lAOffset = cms..double(0.0),
#lAWidthBPix = cms.double(0.0),
#lAWidthFPix = cms.double(0.0),

# Flag to select the source of LA-Width
# Normal = True, use LA from DB
useLAWidthFromDB = cms.bool(True),
# if lAWith=0 and useLAWidthFromDB=false than width is calculated from lAOffset.
# Use the LA-Offsets from Alignment instead of our calibration
useLAAlignmentOffsets = cms.bool(False),

#MagneticFieldRecord: e.g. "" or "ParabolicMF"
MagneticFieldRecord = cms.ESInputTag(""),
)
from RecoLocalTracker.SiPixelRecHits._generic_default_cfi import _generic_default
PixelCPEGenericESProducer = _generic_default.clone()

# This customizes the Run3 Pixel CPE generic reconstruction in order to activate the IrradiationBiasCorrection
# because of the expected resolution loss due to radiation damage
Expand Down
20 changes: 2 additions & 18 deletions RecoLocalTracker/SiPixelRecHits/python/PixelCPETemplateReco_cfi.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,7 @@
import FWCore.ParameterSet.Config as cms

templates = cms.ESProducer("PixelCPETemplateRecoESProducer",
ComponentName = cms.string('PixelCPETemplateReco'),
speed = cms.int32(-2),
#PixelErrorParametrization = cms.string('NOTcmsim'),
Alpha2Order = cms.bool(True),
UseClusterSplitter = cms.bool(False),

# petar, for clusterProbability() from TTRHs
ClusterProbComputationFlag = cms.int32(0),
# gavril
DoCosmics = cms.bool(False),
# The flag to regulate if the LA offset is taken from Alignment
# True in Run II for offline RECO
DoLorentz = cms.bool(True),

LoadTemplatesFromDB = cms.bool(True)

)
from RecoLocalTracker.SiPixelRecHits._templates_default_cfi import _templates_default
templates = _templates_default.clone()

# This customization will be removed once we get the templates for phase2 pixel
from Configuration.Eras.Modifier_phase2_tracker_cff import phase2_tracker
Expand Down
Loading