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

[Draft] Add fillDescriptions to SiPixel digitizers #40673

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions SimGeneral/MixingModule/plugins/MixingModule.cc
Original file line number Diff line number Diff line change
Expand Up @@ -704,4 +704,5 @@ namespace edm {
(*accItr)->finalizeEvent(event, setup);
}
}
void MixingModule::fillPSetDescription(edm::ParameterSetDescription& iDesc) { iDesc.setAllowAnything(); }
} // namespace edm
3 changes: 3 additions & 0 deletions SimGeneral/MixingModule/plugins/MixingModule.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

#include "FWCore/Framework/interface/Event.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
#include "FWCore/Utilities/interface/InputTag.h"

#include "SimDataFormats/CrossingFrame/interface/CrossingFrame.h"
Expand Down Expand Up @@ -56,6 +57,8 @@ namespace edm {
/**Default destructor*/
~MixingModule() override;

static void fillPSetDescription(edm::ParameterSetDescription& iDesc);
tvami marked this conversation as resolved.
Show resolved Hide resolved

virtual void beginJob() {}

void beginRun(Run const& r1, EventSetup const& c) override;
Expand Down
28 changes: 21 additions & 7 deletions SimTracker/Common/interface/SiPixelChargeReweightingAlgorithm.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@
#include "DataFormats/TrackerCommon/interface/TrackerTopology.h"
#include "FWCore/Framework/interface/ConsumesCollector.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
#include "FWCore/ServiceRegistry/interface/Service.h"
#include "FWCore/Utilities/interface/Exception.h"
#include "Geometry/CommonDetUnit/interface/PixelGeomDetUnit.h"
Expand All @@ -52,6 +54,7 @@ class SiPixelChargeReweightingAlgorithm {
public:
SiPixelChargeReweightingAlgorithm(const edm::ParameterSet& conf, edm::ConsumesCollector iC);
~SiPixelChargeReweightingAlgorithm();
static void fillPSetDescription(edm::ParameterSetDescription& desc);

// initialization that cannot be done in the constructor
void init(const edm::EventSetup& es);
Expand Down Expand Up @@ -136,14 +139,12 @@ inline SiPixelChargeReweightingAlgorithm::SiPixelChargeReweightingAlgorithm(cons
templ2D(templateStores_),
xdouble(TXSIZE),
ydouble(TYSIZE),
IDnum(conf.exists("TemplateIDnumerator") ? conf.getParameter<int>("TemplateIDnumerator") : 0),
IDden(conf.exists("TemplateIDdenominator") ? conf.getParameter<int>("TemplateIDdenominator") : 0),

IDnum(conf.getParameter<int>("TemplateIDnumerator")),
IDden(conf.getParameter<int>("TemplateIDdenominator")),
UseReweighting(conf.getParameter<bool>("UseReweighting")),
applyLateReweighting_(conf.exists("applyLateReweighting") ? conf.getParameter<bool>("applyLateReweighting")
: false),
PrintClusters(conf.exists("PrintClusters") ? conf.getParameter<bool>("PrintClusters") : false),
PrintTemplates(conf.exists("PrintTemplates") ? conf.getParameter<bool>("PrintTemplates") : false) {
applyLateReweighting_(conf.getParameter<bool>("ApplyLateReweighting")),
PrintClusters(conf.getParameter<bool>("PrintClusters")),
PrintTemplates(conf.getParameter<bool>("PrintTemplates")) {
if (UseReweighting || applyLateReweighting_) {
SiPixel2DTemp_den_token_ = iC.esConsumes(edm::ESInputTag("", "denominator"));
SiPixel2DTemp_num_token_ = iC.esConsumes(edm::ESInputTag("", "numerator"));
Expand Down Expand Up @@ -485,6 +486,7 @@ inline int SiPixelChargeReweightingAlgorithm::PixelTempRewgt2D(int id_in, int id
}
}
}
LogDebug("SiPixelChargeReweightingAlgorithm") << "Total cluster charge in the initial cluster: " << qclust;

// Next, interpolate the physical output template needed to reweight

Expand Down Expand Up @@ -603,6 +605,8 @@ inline int SiPixelChargeReweightingAlgorithm::PixelTempRewgt2D(int id_in, int id
}
}

LogDebug("SiPixelChargeReweightingAlgorithm") << "Total cluster charge in the final cluster: " << qclust;

return success;
} // PixelTempRewgt2D

Expand Down Expand Up @@ -849,4 +853,14 @@ bool SiPixelChargeReweightingAlgorithm::lateSignalReweight(const PixelGeomDetUni
return true;
}

inline inline void SiPixelChargeReweightingAlgorithm::fillPSetDescription(edm::ParameterSetDescription& desc) {
desc.setComment("Charge reweighting algo to simulate irradiation damage in SiPixel detectors");
desc.add("TemplateIDnumerator", 0);
desc.add("TemplateIDdenominator", 0);
desc.add("UseReweighting", false);
desc.add("ApplyLateReweighting", false);
desc.add("PrintClusters", false);
desc.add("PrintTemplates", false);
}

#endif
21 changes: 18 additions & 3 deletions SimTracker/SiPhase2Digitizer/plugins/Phase2TrackerDigitizer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ namespace cms {
if (makeDigiSimLinks_)
producesCollector.produces<edm::DetSetVector<PixelDigiSimLink> >("Pixel").setBranchAlias(alias1);

if (!iConfig.getParameter<bool>("isOTreadoutAnalog")) {
if (!isOuterTrackerReadoutAnalog_) {
const std::string alias2("simSiTrackerDigis");
if (premixStage1_) {
// Premixing exploits the ADC field of PixelDigi to store the collected charge
Expand Down Expand Up @@ -115,8 +115,8 @@ namespace cms {

// access to magnetic field in global coordinates
GlobalVector bfield = pSetup_->inTesla(phase2det->surface().position());
LogDebug("PixelDigitizer") << "B-field(T) at " << phase2det->surface().position()
<< " (cm): " << pSetup_->inTesla(phase2det->surface().position());
LogDebug("Phase2TrackerDigitizer") << "B-field(T) at " << phase2det->surface().position()
<< " (cm): " << pSetup_->inTesla(phase2det->surface().position());

auto kiter = algomap_.find(getAlgoType(detId_raw));
if (kiter != algomap_.end())
Expand Down Expand Up @@ -317,7 +317,21 @@ namespace cms {
if (makeDigiSimLinks_)
iEvent.put(std::move(outputlink), "Pixel");
}
void Phase2TrackerDigitizer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
edm::ParameterSetDescription desc;
desc.add<std::string>("hitsProducer", "g4SimHits");
desc.add("ROUList",
std::vector<std::string>{"TrackerHitsPixelBarrelLowTof",
"TrackerHitsPixelBarrelHighTof",
"TrackerHitsPixelEndcapLowTof",
"TrackerHitsPixelEndcapHighTof"});
desc.add<std::string>("GeometryType", "idealForDigi");
desc.add("isOTreadoutAnalog", false);
desc.add("premixStage1", false);
descriptions.addWithDefaultLabel(desc);
}
} // namespace cms

namespace {
void addToCollector(edm::DetSet<PixelDigi>& collector, const int channel, const digitizerUtility::DigiSimInfo& info) {
// For premixing stage1 the channel must be decoded with PixelDigi
Expand All @@ -334,6 +348,7 @@ namespace {
collector.data.emplace_back(ip.first, ip.second, info.ot_bit);
}
} // namespace

namespace cms {
template <typename DigiType>
void Phase2TrackerDigitizer::addOuterTrackerCollection(edm::Event& iEvent, const edm::EventSetup& iSetup) {
Expand Down
5 changes: 5 additions & 0 deletions SimTracker/SiPhase2Digitizer/plugins/Phase2TrackerDigitizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@

#include "FWCore/Framework/interface/ESWatcher.h"
#include "FWCore/Framework/interface/ProducesCollector.h"
#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h"
#include "Geometry/Records/interface/TrackerTopologyRcd.h"
Expand Down Expand Up @@ -57,6 +60,8 @@ namespace cms {
edm::ConsumesCollector& iC);
~Phase2TrackerDigitizer() override;

void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
tvami marked this conversation as resolved.
Show resolved Hide resolved

void initializeEvent(edm::Event const& e, edm::EventSetup const& c) override;
void accumulate(edm::Event const& e, edm::EventSetup const& c) override;
void accumulate(PileUpEventPrincipal const& e, edm::EventSetup const& c, edm::StreamID const&) override;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1025,3 +1025,50 @@ float Phase2TrackerDigitizerAlgorithm::calcQ(float x) {
auto xx = std::min(0.5f * x * x, p1);
return 0.5f * (1.f - std::copysign(std::sqrt(1.f - unsafe_expf<4>(-xx * (1.f + p2 / (1.f + p3 * xx)))), x));
}

void Phase2TrackerDigitizerAlgorithm::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
edm::ParameterSetDescription desc;
SiPixelChargeReweightingAlgorithm::fillPSetDescription(desc);
desc.addUntracked<bool>("makeDigiSimLinks", true);
desc.add<bool>("InefficiencyDB", false);
desc.add<bool>("KillModules", false);
desc.add<bool>("DeadModules_DB", false);
desc.add<bool>("LorentzAngle_DB", false);
edm::ParameterSetDescription desc_deadModules;
desc.addVPSet("DeadModules", desc_deadModules, {});
desc.add<bool>("Alpha2Order", false);
desc.add<bool>("AddXTalk", false);
desc.add<double>("InterstripCoupling", 0.0);
desc.add<double>("SigmaZero", 0.00037);
desc.add<double>("SigmaCoeff", 0.0);
desc.add<double>("ClusterWidth", 3);
desc.add<int>("Phase2ReadoutMode", 3);
desc.add<double>("ElectronPerAdc", 135);
desc.add<int>("AdcFullScale", 255);
desc.add<double>("NoiseInElectrons", 0.0);
desc.add<double>("ReadoutNoiseInElec", -99.9);
desc.add<double>("ThresholdInElectrons_Endcap", 1000.0);
desc.add<double>("ThresholdInElectrons_Barrel", 1000.0);
desc.add<double>("ThresholdSmearing_Endcap", 0.0);
desc.add<double>("ThresholdSmearing_Barrel", 0.0);
desc.add<double>("HIPThresholdInElectrons_Endcap", 1.0e10);
desc.add<double>("HIPThresholdInElectrons_Barrel", 1.0e10);
desc.add<double>("TofLowerCut", 12.5);
desc.add<double>("TofUpperCut", -12.5);
desc.add<double>("TanLorentzAnglePerTesla_Endcap", 0.0);
desc.add<double>("TanLorentzAnglePerTesla_Barrel", 0.0);
desc.add<bool>("AddNoise", false);
desc.add<bool>("AddNoisyPixels", false);
desc.addUntracked<bool>("FluctuateCharge", true);
desc.add<bool>("AddInefficiency", false);
desc.add<bool>("AddThresholdSmearing", false);
desc.add<double>("PseudoRadDamage", 0.0);
desc.add<double>("PseudoRadDamageRadius", 0.0);
desc.add<double>("DeltaProductionCut", 0.03);
edm::ParameterSetDescription desc_cellsToKill;
desc.addVPSet("CellsToKill", desc_cellsToKill, {});
desc.add<std::vector<double> >("EfficiencyFactors_Barrel", {});
desc.add<std::vector<double> >("EfficiencyFactors_Endcap", {});
desc.add("UseReweighting", false);
descriptions.addWithDefaultLabel(desc);
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ class Phase2TrackerDigitizerAlgorithm {
const edm::ParameterSet& conf_specific,
edm::ConsumesCollector iC);
virtual ~Phase2TrackerDigitizerAlgorithm();
virtual void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
tvami marked this conversation as resolved.
Show resolved Hide resolved

// initialization that cannot be done in the constructor
virtual void init(const edm::EventSetup& es) = 0;
Expand Down