From be787d94dfb05d535edb3f5ddb07f7b450bdfb08 Mon Sep 17 00:00:00 2001 From: Pieter David Date: Thu, 5 Sep 2019 19:39:50 +0200 Subject: [PATCH 01/16] Add SiStripApvSimulationParameters and associated record including an ESSource, and EDAnalyzer to add to the database --- ...iStripApvSimulationParametersESProducer.cc | 142 ++++++++++++++++++ CondCore/SiStripPlugins/plugins/plugin.cc | 10 ++ CondCore/Utilities/plugins/Module_2XML.cc | 1 + CondCore/Utilities/src/CondDBFetch.cc | 1 + CondCore/Utilities/src/CondDBImport.cc | 1 + CondCore/Utilities/src/CondFormats.h | 1 + .../interface/SiStripCondDataRecords.h | 4 + .../DataRecord/src/SiStripCondDataRecords.cc | 2 + CondFormats/SiStripObjects/BuildFile.xml | 1 + .../SiStripApvSimulationParameters.h | 57 +++++++ .../src/SiStripApvSimulationParameters.cc | 99 ++++++++++++ .../src/T_EventSetup_SiStrip.cc | 2 + .../SiStripObjects/src/classes_def.xml | 4 + CondFormats/SiStripObjects/src/headers.h | 1 + .../test/testSerializationSiStripObjects.cpp | 2 +- .../SiStripApvSimulationParametersBuilder.cc | 37 +++++ ...StripApvSimulationParametersBuilder_cfg.py | 44 ++++++ 17 files changed, 408 insertions(+), 1 deletion(-) create mode 100644 CalibTracker/SiStripESProducers/plugins/real/SiStripApvSimulationParametersESProducer.cc create mode 100644 CondFormats/SiStripObjects/interface/SiStripApvSimulationParameters.h create mode 100644 CondFormats/SiStripObjects/src/SiStripApvSimulationParameters.cc create mode 100644 CondTools/SiStrip/plugins/SiStripApvSimulationParametersBuilder.cc create mode 100644 CondTools/SiStrip/test/SiStripApvSimulationParametersBuilder_cfg.py diff --git a/CalibTracker/SiStripESProducers/plugins/real/SiStripApvSimulationParametersESProducer.cc b/CalibTracker/SiStripESProducers/plugins/real/SiStripApvSimulationParametersESProducer.cc new file mode 100644 index 0000000000000..7b312bb277b7b --- /dev/null +++ b/CalibTracker/SiStripESProducers/plugins/real/SiStripApvSimulationParametersESProducer.cc @@ -0,0 +1,142 @@ +#include "FWCore/Framework/interface/ESProducer.h" +#include "FWCore/Framework/interface/EventSetupRecordIntervalFinder.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "CondFormats/DataRecord/interface/SiStripCondDataRecords.h" +#include "CondFormats/SiStripObjects/interface/SiStripApvSimulationParameters.h" +#include +#include + +class SiStripApvSimulationParametersESSource : public edm::ESProducer, public edm::EventSetupRecordIntervalFinder { +public: + explicit SiStripApvSimulationParametersESSource(const edm::ParameterSet& conf); + ~SiStripApvSimulationParametersESSource() override {} + + void setIntervalFor(const edm::eventsetup::EventSetupRecordKey&, + const edm::IOVSyncValue& iov, + edm::ValidityInterval& iValidity) override; + + std::unique_ptr produce(const SiStripApvSimulationParametersRcd& record); + +private: + std::vector baselineFiles_TOB_; + std::vector baselineFiles_TIB_; + unsigned int baseline_nBins_; + float baseline_min_; + float baseline_max_; + std::vector puBinEdges_; + std::vector zBinEdges_; + + SiStripApvSimulationParameters::LayerParameters makeLayerParameters(const std::string& apvBaselinesFileName) const; +}; + +SiStripApvSimulationParametersESSource::SiStripApvSimulationParametersESSource(const edm::ParameterSet& conf) + : baseline_nBins_(conf.getParameter("apvBaselines_nBinsPerBaseline")), + baseline_min_(conf.getParameter("apvBaselines_minBaseline")), + baseline_max_(conf.getParameter("apvBaselines_maxBaseline")) { + setWhatProduced(this); + findingRecord(); + for (const auto x : conf.getParameter>("apvBaselines_puBinEdges")) { + puBinEdges_.push_back(x); + } + for (const auto x : conf.getParameter>("apvBaselines_zBinEdges")) { + zBinEdges_.push_back(x); + } + baselineFiles_TIB_ = {conf.getParameter("apvBaselinesFile_tib1"), + conf.getParameter("apvBaselinesFile_tib2"), + conf.getParameter("apvBaselinesFile_tib3"), + conf.getParameter("apvBaselinesFile_tib4")}; + baselineFiles_TOB_ = {conf.getParameter("apvBaselinesFile_tob1"), + conf.getParameter("apvBaselinesFile_tob2"), + conf.getParameter("apvBaselinesFile_tob3"), + conf.getParameter("apvBaselinesFile_tob4"), + conf.getParameter("apvBaselinesFile_tob5"), + conf.getParameter("apvBaselinesFile_tob6")}; +} + +void SiStripApvSimulationParametersESSource::setIntervalFor(const edm::eventsetup::EventSetupRecordKey&, + const edm::IOVSyncValue& iov, + edm::ValidityInterval& iValidity) { + iValidity = edm::ValidityInterval{iov.beginOfTime(), iov.endOfTime()}; +} + +SiStripApvSimulationParameters::LayerParameters SiStripApvSimulationParametersESSource::makeLayerParameters( + const std::string& apvBaselinesFileName) const { + // Prepare histograms + unsigned int nZBins = zBinEdges_.size(); + unsigned int nPUBins = puBinEdges_.size(); + + if (nPUBins == 0 || nZBins == 0 || baseline_nBins_ == 0) { + throw cms::Exception("MissingInput") << "The parameters for the APV simulation are not correctly configured\n"; + } + std::vector baselineBinEdges{}; + const auto baseline_binWidth = (baseline_max_ - baseline_min_) / baseline_nBins_; + for (unsigned i{0}; i != baseline_nBins_; ++i) { + baselineBinEdges.push_back(baseline_min_ + i * baseline_binWidth); + } + baselineBinEdges.push_back(baseline_max_); + + SiStripApvSimulationParameters::LayerParameters layerParams{baselineBinEdges, puBinEdges_, zBinEdges_}; + + // Read apv baselines from text files + std::vector theAPVBaselines; + std::ifstream apvBaselineFile(apvBaselinesFileName.c_str()); + if (!apvBaselineFile.good()) { + throw cms::Exception("FileError") << "Problem opening APV baselines file: " << apvBaselinesFileName; + } + std::string line; + while (std::getline(apvBaselineFile, line)) { + if (!line.empty()) { + std::istringstream lStr{line}; + double value; + while (lStr >> value) { + theAPVBaselines.push_back(value); + } + } + } + if (theAPVBaselines.empty()) { + throw cms::Exception("WrongAPVBaselines") + << "Problem reading from APV baselines file " << apvBaselinesFileName << ": no values read in"; + } + + if (theAPVBaselines.size() != nZBins * nPUBins * baseline_nBins_) { + throw cms::Exception("WrongAPVBaselines") << "Problem reading from APV baselines file " << apvBaselinesFileName + << ": number of baselines read different to that expected i.e. nZBins * " + "nPUBins * apvBaselines_nBinsPerBaseline_"; + } + + // Put baselines into histograms + for (auto const& apvBaseline : theAPVBaselines | boost::adaptors::indexed(0)) { + unsigned int binInCurrentHistogram = apvBaseline.index() % baseline_nBins_ + 1; + unsigned int binInZ = int(apvBaseline.index()) / (nPUBins * baseline_nBins_); + unsigned int binInPU = int(apvBaseline.index() - binInZ * (nPUBins)*baseline_nBins_) / baseline_nBins_; + + layerParams.setBinContent(binInCurrentHistogram, binInPU+1, binInZ+1, apvBaseline.value()); + } + + return layerParams; +} + +std::unique_ptr SiStripApvSimulationParametersESSource::produce( + const SiStripApvSimulationParametersRcd& record) { + auto apvSimParams = + std::make_unique(baselineFiles_TIB_.size(), baselineFiles_TOB_.size()); + for (unsigned int i{0}; i != baselineFiles_TIB_.size(); ++i) { + if ( ! apvSimParams->putTIB(i + 1, makeLayerParameters(baselineFiles_TIB_[i].fullPath())) ) { + throw cms::Exception("SiStripApvSimulationParameters") << "Could not add parameters for TIB layer " << (i+1); + } else { + LogDebug("SiStripApvSimulationParameters") << "Added parameters for TIB layer " << (i+1); + } + } + for (unsigned int i{0}; i != baselineFiles_TOB_.size(); ++i) { + if ( ! apvSimParams->putTOB(i + 1, makeLayerParameters(baselineFiles_TOB_[i].fullPath())) ) { + throw cms::Exception("SiStripApvSimulationParameters") << "Could not add parameters for TOB layer " << (i+1); + } else { + LogDebug("SiStripApvSimulationParameters") << "Added parameters for TOB layer " << (i+1); + } + } + return apvSimParams; +} + +#include "FWCore/Framework/interface/SourceFactory.h" +DEFINE_FWK_EVENTSETUP_SOURCE(SiStripApvSimulationParametersESSource); diff --git a/CondCore/SiStripPlugins/plugins/plugin.cc b/CondCore/SiStripPlugins/plugins/plugin.cc index 13e565ff79769..419795cb23f98 100644 --- a/CondCore/SiStripPlugins/plugins/plugin.cc +++ b/CondCore/SiStripPlugins/plugins/plugin.cc @@ -65,6 +65,16 @@ REGISTER_PLUGIN(SiStripSummaryRcd,SiStripSummary); #include "CondFormats/SiStripObjects/interface/SiStripConfObject.h" REGISTER_PLUGIN(SiStripConfObjectRcd, SiStripConfObject); +#include "CondFormats/SiStripObjects/interface/SiStripApvSimulationParameters.h" +namespace { + struct initializeApvSimulationParameters { + void operator()(SiStripApvSimulationParameters& param) { param.calculateIntegrals(); } + }; +} // namespace +REGISTER_PLUGIN_INIT(SiStripApvSimulationParametersRcd, + SiStripApvSimulationParameters, + initializeApvSimulationParameters); + #include "CondFormats/SiStripObjects/interface/Phase2TrackerCabling.h" namespace { struct initializeCabling {void operator()(Phase2TrackerCabling& c){ c.initializeCabling();}}; diff --git a/CondCore/Utilities/plugins/Module_2XML.cc b/CondCore/Utilities/plugins/Module_2XML.cc index 7f4dbfd0600aa..986039af1ec3c 100644 --- a/CondCore/Utilities/plugins/Module_2XML.cc +++ b/CondCore/Utilities/plugins/Module_2XML.cc @@ -250,6 +250,7 @@ PAYLOAD_2XML_MODULE( pluginUtilities_payload2xml ){ PAYLOAD_2XML_CLASS( SiPixelQualityProbabilities ); PAYLOAD_2XML_CLASS( SiPixelTemplateDBObject ); PAYLOAD_2XML_CLASS( SiStripApvGain ); + PAYLOAD_2XML_CLASS( SiStripApvSimulationParameters ); PAYLOAD_2XML_CLASS( SiStripBackPlaneCorrection ); PAYLOAD_2XML_CLASS( SiStripBadStrip ); PAYLOAD_2XML_CLASS( SiStripConfObject ); diff --git a/CondCore/Utilities/src/CondDBFetch.cc b/CondCore/Utilities/src/CondDBFetch.cc index bb6cfde2491c0..5edc7f9d257ae 100644 --- a/CondCore/Utilities/src/CondDBFetch.cc +++ b/CondCore/Utilities/src/CondDBFetch.cc @@ -283,6 +283,7 @@ namespace cond { FETCH_PAYLOAD_CASE( SiPixelTemplateDBObject ) FETCH_PAYLOAD_CASE( SiPixel2DTemplateDBObject ) FETCH_PAYLOAD_CASE( SiStripApvGain ) + FETCH_PAYLOAD_CASE( SiStripApvSimulationParameters ) FETCH_PAYLOAD_CASE( SiStripBackPlaneCorrection ) FETCH_PAYLOAD_CASE( SiStripBadStrip ) FETCH_PAYLOAD_CASE( SiStripConfObject ) diff --git a/CondCore/Utilities/src/CondDBImport.cc b/CondCore/Utilities/src/CondDBImport.cc index d6e683c5ff079..73b0181780edc 100644 --- a/CondCore/Utilities/src/CondDBImport.cc +++ b/CondCore/Utilities/src/CondDBImport.cc @@ -304,6 +304,7 @@ namespace cond { IMPORT_PAYLOAD_CASE( SiPixelTemplateDBObject ) IMPORT_PAYLOAD_CASE( SiPixel2DTemplateDBObject ) IMPORT_PAYLOAD_CASE( SiStripApvGain ) + IMPORT_PAYLOAD_CASE( SiStripApvSimulationParameters ) IMPORT_PAYLOAD_CASE( SiStripBadStrip ) IMPORT_PAYLOAD_CASE( SiStripBackPlaneCorrection ) IMPORT_PAYLOAD_CASE( SiStripConfObject ) diff --git a/CondCore/Utilities/src/CondFormats.h b/CondCore/Utilities/src/CondFormats.h index 379d5a7137a9f..2a880f571aac5 100644 --- a/CondCore/Utilities/src/CondFormats.h +++ b/CondCore/Utilities/src/CondFormats.h @@ -151,6 +151,7 @@ #include "CondFormats/SiStripObjects/interface/SiStripFedCabling.h" #include "CondFormats/SiStripObjects/interface/SiStripThreshold.h" #include "CondFormats/SiStripObjects/interface/SiStripBackPlaneCorrection.h" +#include "CondFormats/SiStripObjects/interface/SiStripApvSimulationParameters.h" #include "CondFormats/CSCObjects/interface/CSCDBCrosstalk.h" #include "CondFormats/CSCObjects/interface/CSCDBL1TPParameters.h" #include "CondFormats/CastorObjects/interface/CastorChannelQuality.h" diff --git a/CondFormats/DataRecord/interface/SiStripCondDataRecords.h b/CondFormats/DataRecord/interface/SiStripCondDataRecords.h index 17c529b1528a9..cd9c56685bb49 100644 --- a/CondFormats/DataRecord/interface/SiStripCondDataRecords.h +++ b/CondFormats/DataRecord/interface/SiStripCondDataRecords.h @@ -46,6 +46,10 @@ class SiStripClusterThresholdRcd : public edm::eventsetup::EventSetupRecordImple /*Record for the configuration object*/ class SiStripConfObjectRcd : public edm::eventsetup::EventSetupRecordImplementation {}; +/*Record for the APV simulation parameters*/ +class SiStripApvSimulationParametersRcd + : public edm::eventsetup::EventSetupRecordImplementation {}; + /*Records for upgrade */ class Phase2TrackerCablingRcd : public edm::eventsetup::EventSetupRecordImplementation {}; diff --git a/CondFormats/DataRecord/src/SiStripCondDataRecords.cc b/CondFormats/DataRecord/src/SiStripCondDataRecords.cc index 893d29a90c9e8..c7dcd0a05f13f 100644 --- a/CondFormats/DataRecord/src/SiStripCondDataRecords.cc +++ b/CondFormats/DataRecord/src/SiStripCondDataRecords.cc @@ -39,5 +39,7 @@ EVENTSETUP_RECORD_REG(SiStripClusterThresholdRcd); EVENTSETUP_RECORD_REG(SiStripConfObjectRcd); +EVENTSETUP_RECORD_REG(SiStripApvSimulationParametersRcd); + EVENTSETUP_RECORD_REG(Phase2TrackerCablingRcd); diff --git a/CondFormats/SiStripObjects/BuildFile.xml b/CondFormats/SiStripObjects/BuildFile.xml index 2595c6a23936b..412a1e5d9fec2 100644 --- a/CondFormats/SiStripObjects/BuildFile.xml +++ b/CondFormats/SiStripObjects/BuildFile.xml @@ -1,5 +1,6 @@ + diff --git a/CondFormats/SiStripObjects/interface/SiStripApvSimulationParameters.h b/CondFormats/SiStripObjects/interface/SiStripApvSimulationParameters.h new file mode 100644 index 0000000000000..94b1bc776e20b --- /dev/null +++ b/CondFormats/SiStripObjects/interface/SiStripApvSimulationParameters.h @@ -0,0 +1,57 @@ +#ifndef SiStripApvSimulationParameters_h +#define SiStripApvSimulationParameters_h + +#include "CondFormats/Serialization/interface/Serializable.h" + +#include +#include "CondFormats/PhysicsToolsObjects/interface/Histogram2D.h" +#include "CondFormats/PhysicsToolsObjects/interface/Histogram3D.h" + +namespace CLHEP { + class HepRandomEngine; +} + +/** + * Stores a histogram binned in PU, z and baseline voltage, for every barrel layer of the strip tracker + */ +class SiStripApvSimulationParameters { +public: + using layerid = unsigned int; + using LayerParameters = PhysicsTools::Calibration::HistogramF3D; + + SiStripApvSimulationParameters(layerid nTIB, layerid nTOB) : m_nTIB(nTIB), m_nTOB(nTOB) { + m_barrelParam.resize(m_nTIB + m_nTOB); + m_barrelParam_xInt.resize(m_nTIB + m_nTOB); + } + SiStripApvSimulationParameters() {} + ~SiStripApvSimulationParameters() {} + + void calculateIntegrals(); // make sure integrals have been calculated + + bool putTIB(layerid layer, const LayerParameters& params) { return putTIB(layer, LayerParameters(params)); } + bool putTIB(layerid layer, LayerParameters&& params); + + bool putTOB(layerid layer, const LayerParameters& params) { return putTOB(layer, LayerParameters(params)); } + bool putTOB(layerid layer, LayerParameters&& params); + + const LayerParameters& getTIB(layerid layer) const { return m_barrelParam[layer - 1]; } + const LayerParameters& getTOB(layerid layer) const { return m_barrelParam[m_nTIB + layer - 1]; } + + float sampleTIB(layerid layer, float z, float pu, CLHEP::HepRandomEngine* engine) const { + return sampleBarrel(layer - 1, z, pu, engine); + } + float sampleTOB(layerid layer, float z, float pu, CLHEP::HepRandomEngine* engine) const { + return sampleBarrel(m_nTIB + layer - 1, z, pu, engine); + }; + +private: + layerid m_nTIB, m_nTOB; + std::vector m_barrelParam; + std::vector m_barrelParam_xInt; + + float sampleBarrel(layerid layerIdx, float z, float pu, CLHEP::HepRandomEngine* engine) const; + + COND_SERIALIZABLE; +}; + +#endif diff --git a/CondFormats/SiStripObjects/src/SiStripApvSimulationParameters.cc b/CondFormats/SiStripObjects/src/SiStripApvSimulationParameters.cc new file mode 100644 index 0000000000000..1bd7bf90e7ec0 --- /dev/null +++ b/CondFormats/SiStripObjects/src/SiStripApvSimulationParameters.cc @@ -0,0 +1,99 @@ +#include "CondFormats/SiStripObjects/interface/SiStripApvSimulationParameters.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "CLHEP/Random/RandFlat.h" + +namespace { + PhysicsTools::Calibration::HistogramF2D calculateXInt(const SiStripApvSimulationParameters::LayerParameters& params) { + auto hXInt = ( + params.hasEquidistantBinsY() ? + ( params.hasEquidistantBinsZ() ? + PhysicsTools::Calibration::HistogramF2D(params.numberOfBinsY(), params.rangeY(), params.numberOfBinsZ(), params.rangeZ()) + : PhysicsTools::Calibration::HistogramF2D(params.numberOfBinsY(), params.rangeY(), params.upperLimitsZ()) ) + : ( params.hasEquidistantBinsZ() ? + PhysicsTools::Calibration::HistogramF2D(params.upperLimitsY(), params.numberOfBinsZ(), params.rangeZ()) + : PhysicsTools::Calibration::HistogramF2D(params.upperLimitsY(), params.upperLimitsZ()) ) + ); + for (int i{0}; i != params.numberOfBinsY() + 2; ++i) { + for (int j{0}; j != params.numberOfBinsZ() + 2; ++j) { + float xInt = 0.; + for (int k{0}; k != params.numberOfBinsX() + 2; ++k) { + xInt += params.binContent(k, i, j); + } + hXInt.setBinContent(i, j, xInt); + } + } + return hXInt; + } + + float xBinPos(const SiStripApvSimulationParameters::LayerParameters& hist, int iBin, float pos=0.5) { + // NOTE: does not work for under- and overflow bins (iBin = 0 and iBIn == hist.numberOfBinsX()+1) + if ( hist.hasEquidistantBinsX() ) { + const auto range = hist.rangeX(); + const auto binWidth = (range.max-range.min)/hist.numberOfBinsX(); + return range.min+(iBin-1+pos)*binWidth; + } else { + return (1.-pos)*hist.upperLimitsX()[iBin-1]+pos*hist.upperLimitsX()[iBin]; + } + } +} // namespace + +void SiStripApvSimulationParameters::calculateIntegrals() { + if (m_barrelParam.size() != m_barrelParam_xInt.size()) { + m_barrelParam_xInt.resize(m_barrelParam.size()); + for (unsigned int i{0}; i != m_barrelParam.size(); ++i) { + m_barrelParam_xInt[i] = calculateXInt(m_barrelParam[i]); + } + } +} + +bool SiStripApvSimulationParameters::putTIB(SiStripApvSimulationParameters::layerid layer, + SiStripApvSimulationParameters::LayerParameters&& params) { + if ((layer > m_nTIB) || (layer < 1)) { + edm::LogError("SiStripApvSimulationParameters") + << "[" << __PRETTY_FUNCTION__ << "] layer index " << layer << " out of range [1," << m_nTIB << "]"; + return false; + } + m_barrelParam[layer - 1] = params; + m_barrelParam_xInt[layer - 1] = calculateXInt(params); + return true; +} + +bool SiStripApvSimulationParameters::putTOB(SiStripApvSimulationParameters::layerid layer, + SiStripApvSimulationParameters::LayerParameters&& params) { + if ((layer > m_nTOB) || (layer < 1)) { + edm::LogError("SiStripApvSimulationParameters") << "[" << __PRETTY_FUNCTION__ << "] layer index " << layer + << " out of range [1," << m_nTOB << ")"; + return false; + } + m_barrelParam[m_nTIB + layer - 1] = params; + m_barrelParam_xInt[m_nTIB + layer - 1] = calculateXInt(params); + return true; +} + +float SiStripApvSimulationParameters::sampleBarrel(layerid layerIdx, + float z, + float pu, + CLHEP::HepRandomEngine* engine) const { + if (m_barrelParam.size() != m_barrelParam_xInt.size()) { + throw cms::Exception("LogicError") << "x-integrals of 3D histograms have not been calculated"; + } + const auto layerParam = m_barrelParam[layerIdx]; + const int ip = layerParam.findBinY(pu); + const int iz = layerParam.findBinZ(z); + const float norm = m_barrelParam_xInt[layerIdx].binContent(ip, iz); + const auto val = CLHEP::RandFlat::shoot(engine) * norm; + if (val < layerParam.binContent(0, ip, iz)) { // underflow + return layerParam.rangeX().min; + } else if (norm - val < layerParam.binContent(layerParam.numberOfBinsX() + 1, ip, iz)) { // overflow + return layerParam.rangeX().max; + } else { // loop over bins, return center of our bin + float sum = layerParam.binContent(0, ip, iz); + for (int i{1}; i != layerParam.numberOfBinsX() + 1; ++i) { + sum += layerParam.binContent(i, ip, iz); + if (sum > val) { + return xBinPos(layerParam, i, (sum-val)/layerParam.binContent(i, ip, iz)); + } + } + } + throw cms::Exception("LogicError") << "Problem drawing a random number from the distribution"; +} diff --git a/CondFormats/SiStripObjects/src/T_EventSetup_SiStrip.cc b/CondFormats/SiStripObjects/src/T_EventSetup_SiStrip.cc index 9e769f6aaebed..dcde940c6c152 100644 --- a/CondFormats/SiStripObjects/src/T_EventSetup_SiStrip.cc +++ b/CondFormats/SiStripObjects/src/T_EventSetup_SiStrip.cc @@ -26,6 +26,8 @@ TYPELOOKUP_DATA_REG(SiStripSummary); TYPELOOKUP_DATA_REG(SiStripThreshold); #include "CondFormats/SiStripObjects/interface/SiStripConfObject.h" TYPELOOKUP_DATA_REG(SiStripConfObject); +#include "CondFormats/SiStripObjects/interface/SiStripApvSimulationParameters.h" +TYPELOOKUP_DATA_REG(SiStripApvSimulationParameters); #include "CondFormats/SiStripObjects/interface/Phase2TrackerModule.h" TYPELOOKUP_DATA_REG(Phase2TrackerModule); #include "CondFormats/SiStripObjects/interface/Phase2TrackerCabling.h" diff --git a/CondFormats/SiStripObjects/src/classes_def.xml b/CondFormats/SiStripObjects/src/classes_def.xml index feee6185b4af1..5af17456ceeb9 100644 --- a/CondFormats/SiStripObjects/src/classes_def.xml +++ b/CondFormats/SiStripObjects/src/classes_def.xml @@ -93,6 +93,10 @@ + + + + diff --git a/CondFormats/SiStripObjects/src/headers.h b/CondFormats/SiStripObjects/src/headers.h index 32ac0a42aaae3..5c6aa16c74533 100644 --- a/CondFormats/SiStripObjects/src/headers.h +++ b/CondFormats/SiStripObjects/src/headers.h @@ -13,5 +13,6 @@ #include "CondFormats/SiStripObjects/interface/SiStripRunSummary.h" #include "CondFormats/SiStripObjects/interface/SiStripSummary.h" #include "CondFormats/SiStripObjects/interface/SiStripConfObject.h" +#include "CondFormats/SiStripObjects/interface/SiStripApvSimulationParameters.h" #include "CondFormats/SiStripObjects/interface/Phase2TrackerModule.h" #include "CondFormats/SiStripObjects/interface/Phase2TrackerCabling.h" diff --git a/CondFormats/SiStripObjects/test/testSerializationSiStripObjects.cpp b/CondFormats/SiStripObjects/test/testSerializationSiStripObjects.cpp index 0f8885d7e23f2..8f293ef9e02bd 100644 --- a/CondFormats/SiStripObjects/test/testSerializationSiStripObjects.cpp +++ b/CondFormats/SiStripObjects/test/testSerializationSiStripObjects.cpp @@ -6,6 +6,7 @@ int main() { testSerialization(); testSerialization(); + testSerialization(); testSerialization(); testSerialization(); testSerialization(); @@ -43,6 +44,5 @@ int main() testSerialization(); testSerialization(); testSerialization >(); - return 0; } diff --git a/CondTools/SiStrip/plugins/SiStripApvSimulationParametersBuilder.cc b/CondTools/SiStrip/plugins/SiStripApvSimulationParametersBuilder.cc new file mode 100644 index 0000000000000..7bf183d71ad14 --- /dev/null +++ b/CondTools/SiStrip/plugins/SiStripApvSimulationParametersBuilder.cc @@ -0,0 +1,37 @@ +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" +#include "CondFormats/DataRecord/interface/SiStripCondDataRecords.h" +#include "CondFormats/SiStripObjects/interface/SiStripApvSimulationParameters.h" +#include "CommonTools/ConditionDBWriter/interface/ConditionDBWriter.h" + +class SiStripApvSimulationParametersBuilder : public edm::one::EDAnalyzer<> { +public: + explicit SiStripApvSimulationParametersBuilder(const edm::ParameterSet& iConfig) {} + ~SiStripApvSimulationParametersBuilder() override {} + + void analyze(const edm::Event&, const edm::EventSetup&) override; +}; + +void SiStripApvSimulationParametersBuilder::analyze(const edm::Event&, const edm::EventSetup& evtSetup) { + edm::ESHandle objHandle; + evtSetup.get().get(objHandle); + + // copy; DB service needs non-const pointer but does not take ownership + auto obj = std::make_unique(*objHandle); + + edm::Service mydbservice; + if (mydbservice.isAvailable()) { + if (mydbservice->isNewTagRequest("SiStripApvSimulationParametersRcd")) { + mydbservice->createNewIOV( + obj.get(), mydbservice->beginOfTime(), mydbservice->endOfTime(), "SiStripApvSimulationParametersRcd"); + } else { + mydbservice->appendSinceTime(obj.get(), mydbservice->currentTime(), "SiStripApvSimulationParametersRcd"); + } + } else { + edm::LogError("SiStripApvSimulationParametersBuilder") << "Service is unavailable"; + } +} + +#include "FWCore/PluginManager/interface/ModuleDef.h" +#include "FWCore/Framework/interface/MakerMacros.h" +DEFINE_FWK_MODULE(SiStripApvSimulationParametersBuilder); diff --git a/CondTools/SiStrip/test/SiStripApvSimulationParametersBuilder_cfg.py b/CondTools/SiStrip/test/SiStripApvSimulationParametersBuilder_cfg.py new file mode 100644 index 0000000000000..d6de296490fb5 --- /dev/null +++ b/CondTools/SiStrip/test/SiStripApvSimulationParametersBuilder_cfg.py @@ -0,0 +1,44 @@ +import FWCore.ParameterSet.Config as cms + +process = cms.Process("ICALIB") +process.source = cms.Source("EmptySource", + numberEventsInRun = cms.untracked.uint32(1), + firstRun = cms.untracked.uint32(1) +) +process.maxEvents = cms.untracked.PSet( + input = cms.untracked.int32(1) +) +process.PoolDBOutputService = cms.Service("PoolDBOutputService", + BlobStreamerName = cms.untracked.string('TBufferBlobStreamingService'), + DBParameters = cms.PSet( + messageLevel = cms.untracked.int32(2), + authenticationPath = cms.untracked.string('/afs/cern.ch/cms/DB/conddb') + ), + timetype = cms.untracked.string('runnumber'), + connect = cms.string('sqlite_file:dbfile.db'), + toPut = cms.VPSet(cms.PSet( + record = cms.string('SiStripApvSimulationParametersRcd'), + tag = cms.string('SiStripApvSimulationParameters_2016preVFP_v1') + )) +) + +process.apvSimParam = cms.ESSource("SiStripApvSimulationParametersESSource", + apvBaselines_nBinsPerBaseline=cms.uint32(82), + apvBaselines_minBaseline=cms.double(0.), + apvBaselines_maxBaseline=cms.double(738.), + apvBaselines_puBinEdges=cms.vdouble(0., 2., 4., 6., 8., 10., 12., 14., 16., 18., 20., 22., 24., 26., 28., 30., 32., 34., 36., 38., 40., 42., 44., 46., 48., 50.), + apvBaselines_zBinEdges=cms.vdouble(0., 25., 50., 75.), + apvBaselinesFile_tib1=cms.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TIB1_12us.txt"), + apvBaselinesFile_tib2=cms.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TIB2_15us.txt"), + apvBaselinesFile_tib3=cms.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TIB3_16us.txt"), + apvBaselinesFile_tib4=cms.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TIB4_17us.txt"), + apvBaselinesFile_tob1=cms.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TOB1_10us.txt"), + apvBaselinesFile_tob2=cms.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TOB2_13us.txt"), + apvBaselinesFile_tob3=cms.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TOB3_16us.txt"), + apvBaselinesFile_tob4=cms.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TOB4_17us.txt"), + apvBaselinesFile_tob5=cms.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TOB5_17us.txt"), + apvBaselinesFile_tob6=cms.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TOB6_18us.txt") + ) +process.prod = cms.EDAnalyzer("SiStripApvSimulationParametersBuilder") + +process.p = cms.Path(process.prod) From 2e6360fdf541b71724531c0e913e092192b962a1 Mon Sep 17 00:00:00 2001 From: Pieter David Date: Thu, 5 Sep 2019 12:35:42 +0200 Subject: [PATCH 02/16] Fix a bug (typo) in a constructor of PhysicsTools::Calibration::HistogramF3D --- CondFormats/PhysicsToolsObjects/interface/Histogram3D.icc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CondFormats/PhysicsToolsObjects/interface/Histogram3D.icc b/CondFormats/PhysicsToolsObjects/interface/Histogram3D.icc index 92873245fcd02..3fc2aca95e90e 100644 --- a/CondFormats/PhysicsToolsObjects/interface/Histogram3D.icc +++ b/CondFormats/PhysicsToolsObjects/interface/Histogram3D.icc @@ -59,7 +59,7 @@ Histogram3D::Histogram3D( strideX(binULimitsX.size() + 1), strideY(binULimitsY.size() + 1), binULimitsX(binULimitsX), binULimitsY(binULimitsY), binULimitsZ(binULimitsZ), - binValues((binULimitsY.size() + 1) * strideX * strideY), + binValues((binULimitsZ.size() + 1) * strideX * strideY), limitsX(AxisX_t(), AxisX_t()), limitsY(AxisY_t(), AxisY_t()), limitsZ(AxisZ_t(), AxisZ_t()), total(Value_t()), sliceTotal(binULimitsZ.size() + 1), rowTotal(binULimitsY.size() + 1), columnTotal(binULimitsX.size() + 1) From cbe2d8a61d22b73fba2fe94d90f94f8558d6d193 Mon Sep 17 00:00:00 2001 From: Pieter David Date: Tue, 10 Sep 2019 17:21:11 +0200 Subject: [PATCH 03/16] SiStripApvSimulationParameters: add members for TID and TEC partitions --- ...iStripApvSimulationParametersESProducer.cc | 2 +- .../SiStripApvSimulationParameters.h | 24 +++++++- .../src/SiStripApvSimulationParameters.cc | 58 +++++++++++++++++++ .../SiStripObjects/src/classes_def.xml | 1 + 4 files changed, 82 insertions(+), 3 deletions(-) diff --git a/CalibTracker/SiStripESProducers/plugins/real/SiStripApvSimulationParametersESProducer.cc b/CalibTracker/SiStripESProducers/plugins/real/SiStripApvSimulationParametersESProducer.cc index 7b312bb277b7b..e07b53f013f40 100644 --- a/CalibTracker/SiStripESProducers/plugins/real/SiStripApvSimulationParametersESProducer.cc +++ b/CalibTracker/SiStripESProducers/plugins/real/SiStripApvSimulationParametersESProducer.cc @@ -120,7 +120,7 @@ SiStripApvSimulationParameters::LayerParameters SiStripApvSimulationParametersES std::unique_ptr SiStripApvSimulationParametersESSource::produce( const SiStripApvSimulationParametersRcd& record) { auto apvSimParams = - std::make_unique(baselineFiles_TIB_.size(), baselineFiles_TOB_.size()); + std::make_unique(baselineFiles_TIB_.size(), baselineFiles_TOB_.size(), 0, 0); for (unsigned int i{0}; i != baselineFiles_TIB_.size(); ++i) { if ( ! apvSimParams->putTIB(i + 1, makeLayerParameters(baselineFiles_TIB_[i].fullPath())) ) { throw cms::Exception("SiStripApvSimulationParameters") << "Could not add parameters for TIB layer " << (i+1); diff --git a/CondFormats/SiStripObjects/interface/SiStripApvSimulationParameters.h b/CondFormats/SiStripObjects/interface/SiStripApvSimulationParameters.h index 94b1bc776e20b..5767fc6707524 100644 --- a/CondFormats/SiStripObjects/interface/SiStripApvSimulationParameters.h +++ b/CondFormats/SiStripObjects/interface/SiStripApvSimulationParameters.h @@ -19,9 +19,12 @@ class SiStripApvSimulationParameters { using layerid = unsigned int; using LayerParameters = PhysicsTools::Calibration::HistogramF3D; - SiStripApvSimulationParameters(layerid nTIB, layerid nTOB) : m_nTIB(nTIB), m_nTOB(nTOB) { + SiStripApvSimulationParameters(layerid nTIB, layerid nTOB, layerid nTID, layerid nTEC) + : m_nTIB(nTIB), m_nTOB(nTOB), m_nTID(nTID), m_nTEC(nTEC) { m_barrelParam.resize(m_nTIB + m_nTOB); m_barrelParam_xInt.resize(m_nTIB + m_nTOB); + m_endcapParam.resize(m_nTID + m_nTEC); + m_endcapParam_xInt.resize(m_nTID + m_nTEC); } SiStripApvSimulationParameters() {} ~SiStripApvSimulationParameters() {} @@ -34,8 +37,16 @@ class SiStripApvSimulationParameters { bool putTOB(layerid layer, const LayerParameters& params) { return putTOB(layer, LayerParameters(params)); } bool putTOB(layerid layer, LayerParameters&& params); + bool putTID(layerid ring, const LayerParameters& params) { return putTID(ring, LayerParameters(params)); } + bool putTID(layerid ring, LayerParameters&& params); + + bool putTEC(layerid ring, const LayerParameters& params) { return putTEC(ring, LayerParameters(params)); } + bool putTEC(layerid ring, LayerParameters&& params); + const LayerParameters& getTIB(layerid layer) const { return m_barrelParam[layer - 1]; } const LayerParameters& getTOB(layerid layer) const { return m_barrelParam[m_nTIB + layer - 1]; } + const LayerParameters& getTID(layerid ring) const { return m_endcapParam[ring - 1]; } + const LayerParameters& getTEC(layerid ring) const { return m_endcapParam[m_nTID + ring - 1]; } float sampleTIB(layerid layer, float z, float pu, CLHEP::HepRandomEngine* engine) const { return sampleBarrel(layer - 1, z, pu, engine); @@ -43,13 +54,22 @@ class SiStripApvSimulationParameters { float sampleTOB(layerid layer, float z, float pu, CLHEP::HepRandomEngine* engine) const { return sampleBarrel(m_nTIB + layer - 1, z, pu, engine); }; + float sampleTID(layerid ring, float z, float pu, CLHEP::HepRandomEngine* engine) const { + return sampleEndcap(ring - 1, z, pu, engine); + } + float sampleTEC(layerid ring, float z, float pu, CLHEP::HepRandomEngine* engine) const { + return sampleEndcap(m_nTID + ring - 1, z, pu, engine); + } private: - layerid m_nTIB, m_nTOB; + layerid m_nTIB, m_nTOB, m_nTID, m_nTEC; std::vector m_barrelParam; std::vector m_barrelParam_xInt; + std::vector m_endcapParam; + std::vector m_endcapParam_xInt; float sampleBarrel(layerid layerIdx, float z, float pu, CLHEP::HepRandomEngine* engine) const; + float sampleEndcap(layerid ringIdx, float z, float pu, CLHEP::HepRandomEngine* engine) const; COND_SERIALIZABLE; }; diff --git a/CondFormats/SiStripObjects/src/SiStripApvSimulationParameters.cc b/CondFormats/SiStripObjects/src/SiStripApvSimulationParameters.cc index 1bd7bf90e7ec0..3927570d54685 100644 --- a/CondFormats/SiStripObjects/src/SiStripApvSimulationParameters.cc +++ b/CondFormats/SiStripObjects/src/SiStripApvSimulationParameters.cc @@ -44,6 +44,12 @@ void SiStripApvSimulationParameters::calculateIntegrals() { m_barrelParam_xInt[i] = calculateXInt(m_barrelParam[i]); } } + if (m_endcapParam.size() != m_endcapParam_xInt.size()) { + m_endcapParam_xInt.resize(m_endcapParam.size()); + for (unsigned int i{0}; i != m_endcapParam.size(); ++i) { + m_endcapParam_xInt[i] = calculateXInt(m_endcapParam[i]); + } + } } bool SiStripApvSimulationParameters::putTIB(SiStripApvSimulationParameters::layerid layer, @@ -70,6 +76,30 @@ bool SiStripApvSimulationParameters::putTOB(SiStripApvSimulationParameters::laye return true; } +bool SiStripApvSimulationParameters::putTID(SiStripApvSimulationParameters::layerid ring, + SiStripApvSimulationParameters::LayerParameters&& params) { + if ((ring > m_nTID) || (ring < 1)) { + edm::LogError("SiStripApvSimulationParameters") + << "[" << __PRETTY_FUNCTION__ << "] ring index " << ring << " out of range [1," << m_nTID << "]"; + return false; + } + m_endcapParam[ring - 1] = params; + m_endcapParam_xInt[ring - 1] = calculateXInt(params); + return true; +} + +bool SiStripApvSimulationParameters::putTEC(SiStripApvSimulationParameters::layerid ring, + SiStripApvSimulationParameters::LayerParameters&& params) { + if ((ring > m_nTEC) || (ring < 1)) { + edm::LogError("SiStripApvSimulationParameters") + << "[" << __PRETTY_FUNCTION__ << "] ring index " << ring << " out of range [1," << m_nTEC << ")"; + return false; + } + m_endcapParam[m_nTID + ring - 1] = params; + m_endcapParam_xInt[m_nTID + ring - 1] = calculateXInt(params); + return true; +} + float SiStripApvSimulationParameters::sampleBarrel(layerid layerIdx, float z, float pu, @@ -97,3 +127,31 @@ float SiStripApvSimulationParameters::sampleBarrel(layerid layerIdx, } throw cms::Exception("LogicError") << "Problem drawing a random number from the distribution"; } + +float SiStripApvSimulationParameters::sampleEndcap(layerid ringIdx, + float z, + float pu, + CLHEP::HepRandomEngine* engine) const { + if (m_endcapParam.size() != m_endcapParam_xInt.size()) { + throw cms::Exception("LogicError") << "x-integrals of 3D histograms have not been calculated"; + } + const auto layerParam = m_endcapParam[ringIdx]; + const int ip = layerParam.findBinY(pu); + const int iz = layerParam.findBinZ(z); + const float norm = m_endcapParam_xInt[ringIdx].binContent(ip, iz); + const auto val = CLHEP::RandFlat::shoot(engine) * norm; + if (val < layerParam.binContent(0, ip, iz)) { // underflow + return layerParam.rangeX().min; + } else if (norm - val < layerParam.binContent(layerParam.numberOfBinsX() + 1, ip, iz)) { // overflow + return layerParam.rangeX().max; + } else { // loop over bins, return center of our bin + float sum = layerParam.binContent(0, ip, iz); + for (int i{1}; i != layerParam.numberOfBinsX() + 1; ++i) { + sum += layerParam.binContent(i, ip, iz); + if (sum > val) { + return xBinPos(layerParam, i, (sum - val) / layerParam.binContent(i, ip, iz)); + } + } + } + throw cms::Exception("LogicError") << "Problem drawing a random number from the distribution"; +} diff --git a/CondFormats/SiStripObjects/src/classes_def.xml b/CondFormats/SiStripObjects/src/classes_def.xml index 5af17456ceeb9..ce802c863f473 100644 --- a/CondFormats/SiStripObjects/src/classes_def.xml +++ b/CondFormats/SiStripObjects/src/classes_def.xml @@ -95,6 +95,7 @@ + From 8c315efc55ccf36565a8c54a85ed04ee031acf18 Mon Sep 17 00:00:00 2001 From: Pieter David Date: Thu, 12 Sep 2019 10:10:25 +0200 Subject: [PATCH 04/16] SiStripApvSimulationParameters: rename ring->wheel, z->r --- .../SiStripApvSimulationParameters.h | 22 +++++----- .../src/SiStripApvSimulationParameters.cc | 40 +++++++++---------- 2 files changed, 31 insertions(+), 31 deletions(-) diff --git a/CondFormats/SiStripObjects/interface/SiStripApvSimulationParameters.h b/CondFormats/SiStripObjects/interface/SiStripApvSimulationParameters.h index 5767fc6707524..03e5feae4308b 100644 --- a/CondFormats/SiStripObjects/interface/SiStripApvSimulationParameters.h +++ b/CondFormats/SiStripObjects/interface/SiStripApvSimulationParameters.h @@ -37,16 +37,16 @@ class SiStripApvSimulationParameters { bool putTOB(layerid layer, const LayerParameters& params) { return putTOB(layer, LayerParameters(params)); } bool putTOB(layerid layer, LayerParameters&& params); - bool putTID(layerid ring, const LayerParameters& params) { return putTID(ring, LayerParameters(params)); } - bool putTID(layerid ring, LayerParameters&& params); + bool putTID(layerid wheel, const LayerParameters& params) { return putTID(wheel, LayerParameters(params)); } + bool putTID(layerid wheel, LayerParameters&& params); - bool putTEC(layerid ring, const LayerParameters& params) { return putTEC(ring, LayerParameters(params)); } - bool putTEC(layerid ring, LayerParameters&& params); + bool putTEC(layerid wheel, const LayerParameters& params) { return putTEC(wheel, LayerParameters(params)); } + bool putTEC(layerid wheel, LayerParameters&& params); const LayerParameters& getTIB(layerid layer) const { return m_barrelParam[layer - 1]; } const LayerParameters& getTOB(layerid layer) const { return m_barrelParam[m_nTIB + layer - 1]; } - const LayerParameters& getTID(layerid ring) const { return m_endcapParam[ring - 1]; } - const LayerParameters& getTEC(layerid ring) const { return m_endcapParam[m_nTID + ring - 1]; } + const LayerParameters& getTID(layerid wheel) const { return m_endcapParam[wheel - 1]; } + const LayerParameters& getTEC(layerid wheel) const { return m_endcapParam[m_nTID + wheel - 1]; } float sampleTIB(layerid layer, float z, float pu, CLHEP::HepRandomEngine* engine) const { return sampleBarrel(layer - 1, z, pu, engine); @@ -54,11 +54,11 @@ class SiStripApvSimulationParameters { float sampleTOB(layerid layer, float z, float pu, CLHEP::HepRandomEngine* engine) const { return sampleBarrel(m_nTIB + layer - 1, z, pu, engine); }; - float sampleTID(layerid ring, float z, float pu, CLHEP::HepRandomEngine* engine) const { - return sampleEndcap(ring - 1, z, pu, engine); + float sampleTID(layerid wheel, float r, float pu, CLHEP::HepRandomEngine* engine) const { + return sampleEndcap(wheel - 1, r, pu, engine); } - float sampleTEC(layerid ring, float z, float pu, CLHEP::HepRandomEngine* engine) const { - return sampleEndcap(m_nTID + ring - 1, z, pu, engine); + float sampleTEC(layerid wheel, float r, float pu, CLHEP::HepRandomEngine* engine) const { + return sampleEndcap(m_nTID + wheel - 1, r, pu, engine); } private: @@ -69,7 +69,7 @@ class SiStripApvSimulationParameters { std::vector m_endcapParam_xInt; float sampleBarrel(layerid layerIdx, float z, float pu, CLHEP::HepRandomEngine* engine) const; - float sampleEndcap(layerid ringIdx, float z, float pu, CLHEP::HepRandomEngine* engine) const; + float sampleEndcap(layerid wheelIdx, float r, float pu, CLHEP::HepRandomEngine* engine) const; COND_SERIALIZABLE; }; diff --git a/CondFormats/SiStripObjects/src/SiStripApvSimulationParameters.cc b/CondFormats/SiStripObjects/src/SiStripApvSimulationParameters.cc index 3927570d54685..7ea5503238731 100644 --- a/CondFormats/SiStripObjects/src/SiStripApvSimulationParameters.cc +++ b/CondFormats/SiStripObjects/src/SiStripApvSimulationParameters.cc @@ -76,27 +76,27 @@ bool SiStripApvSimulationParameters::putTOB(SiStripApvSimulationParameters::laye return true; } -bool SiStripApvSimulationParameters::putTID(SiStripApvSimulationParameters::layerid ring, +bool SiStripApvSimulationParameters::putTID(SiStripApvSimulationParameters::layerid wheel, SiStripApvSimulationParameters::LayerParameters&& params) { - if ((ring > m_nTID) || (ring < 1)) { + if ((wheel > m_nTID) || (wheel < 1)) { edm::LogError("SiStripApvSimulationParameters") - << "[" << __PRETTY_FUNCTION__ << "] ring index " << ring << " out of range [1," << m_nTID << "]"; + << "[" << __PRETTY_FUNCTION__ << "] wheel index " << wheel << " out of range [1," << m_nTID << "]"; return false; } - m_endcapParam[ring - 1] = params; - m_endcapParam_xInt[ring - 1] = calculateXInt(params); + m_endcapParam[wheel - 1] = params; + m_endcapParam_xInt[wheel - 1] = calculateXInt(params); return true; } -bool SiStripApvSimulationParameters::putTEC(SiStripApvSimulationParameters::layerid ring, +bool SiStripApvSimulationParameters::putTEC(SiStripApvSimulationParameters::layerid wheel, SiStripApvSimulationParameters::LayerParameters&& params) { - if ((ring > m_nTEC) || (ring < 1)) { + if ((wheel > m_nTEC) || (wheel < 1)) { edm::LogError("SiStripApvSimulationParameters") - << "[" << __PRETTY_FUNCTION__ << "] ring index " << ring << " out of range [1," << m_nTEC << ")"; + << "[" << __PRETTY_FUNCTION__ << "] wheel index " << wheel << " out of range [1," << m_nTEC << ")"; return false; } - m_endcapParam[m_nTID + ring - 1] = params; - m_endcapParam_xInt[m_nTID + ring - 1] = calculateXInt(params); + m_endcapParam[m_nTID + wheel - 1] = params; + m_endcapParam_xInt[m_nTID + wheel - 1] = calculateXInt(params); return true; } @@ -128,28 +128,28 @@ float SiStripApvSimulationParameters::sampleBarrel(layerid layerIdx, throw cms::Exception("LogicError") << "Problem drawing a random number from the distribution"; } -float SiStripApvSimulationParameters::sampleEndcap(layerid ringIdx, - float z, +float SiStripApvSimulationParameters::sampleEndcap(layerid wheelIdx, + float r, float pu, CLHEP::HepRandomEngine* engine) const { if (m_endcapParam.size() != m_endcapParam_xInt.size()) { throw cms::Exception("LogicError") << "x-integrals of 3D histograms have not been calculated"; } - const auto layerParam = m_endcapParam[ringIdx]; + const auto layerParam = m_endcapParam[wheelIdx]; const int ip = layerParam.findBinY(pu); - const int iz = layerParam.findBinZ(z); - const float norm = m_endcapParam_xInt[ringIdx].binContent(ip, iz); + const int ir = layerParam.findBinZ(r); + const float norm = m_endcapParam_xInt[wheelIdx].binContent(ip, ir); const auto val = CLHEP::RandFlat::shoot(engine) * norm; - if (val < layerParam.binContent(0, ip, iz)) { // underflow + if (val < layerParam.binContent(0, ip, ir)) { // underflow return layerParam.rangeX().min; - } else if (norm - val < layerParam.binContent(layerParam.numberOfBinsX() + 1, ip, iz)) { // overflow + } else if (norm - val < layerParam.binContent(layerParam.numberOfBinsX() + 1, ip, ir)) { // overflow return layerParam.rangeX().max; } else { // loop over bins, return center of our bin - float sum = layerParam.binContent(0, ip, iz); + float sum = layerParam.binContent(0, ip, ir); for (int i{1}; i != layerParam.numberOfBinsX() + 1; ++i) { - sum += layerParam.binContent(i, ip, iz); + sum += layerParam.binContent(i, ip, ir); if (sum > val) { - return xBinPos(layerParam, i, (sum - val) / layerParam.binContent(i, ip, iz)); + return xBinPos(layerParam, i, (sum - val) / layerParam.binContent(i, ip, ir)); } } } From f7da7b3ac67437f410ea6e4e97e6d86e4c141cdb Mon Sep 17 00:00:00 2001 From: Pieter David Date: Thu, 12 Sep 2019 10:46:45 +0200 Subject: [PATCH 05/16] Update ESProducer for TID and TEC --- ...iStripApvSimulationParametersESProducer.cc | 58 +++++++++++++++---- 1 file changed, 48 insertions(+), 10 deletions(-) diff --git a/CalibTracker/SiStripESProducers/plugins/real/SiStripApvSimulationParametersESProducer.cc b/CalibTracker/SiStripESProducers/plugins/real/SiStripApvSimulationParametersESProducer.cc index e07b53f013f40..30e36b5456637 100644 --- a/CalibTracker/SiStripESProducers/plugins/real/SiStripApvSimulationParametersESProducer.cc +++ b/CalibTracker/SiStripESProducers/plugins/real/SiStripApvSimulationParametersESProducer.cc @@ -21,13 +21,18 @@ class SiStripApvSimulationParametersESSource : public edm::ESProducer, public ed private: std::vector baselineFiles_TOB_; std::vector baselineFiles_TIB_; + std::vector baselineFiles_TID_; + std::vector baselineFiles_TEC_; unsigned int baseline_nBins_; float baseline_min_; float baseline_max_; std::vector puBinEdges_; std::vector zBinEdges_; + std::vector rBinEdgesTID_; + std::vector rBinEdgesTEC_; - SiStripApvSimulationParameters::LayerParameters makeLayerParameters(const std::string& apvBaselinesFileName) const; + SiStripApvSimulationParameters::LayerParameters makeLayerParameters(const std::string& apvBaselinesFileName, + const std::vector& rzBinEdges) const; }; SiStripApvSimulationParametersESSource::SiStripApvSimulationParametersESSource(const edm::ParameterSet& conf) @@ -42,6 +47,12 @@ SiStripApvSimulationParametersESSource::SiStripApvSimulationParametersESSource(c for (const auto x : conf.getParameter>("apvBaselines_zBinEdges")) { zBinEdges_.push_back(x); } + for (const auto x : conf.getParameter>("apvBaselines_rBinEdges_TID")) { + rBinEdgesTID_.push_back(x); + } + for (const auto x : conf.getParameter>("apvBaselines_rBinEdges_TEC")) { + rBinEdgesTEC_.push_back(x); + } baselineFiles_TIB_ = {conf.getParameter("apvBaselinesFile_tib1"), conf.getParameter("apvBaselinesFile_tib2"), conf.getParameter("apvBaselinesFile_tib3"), @@ -52,6 +63,18 @@ SiStripApvSimulationParametersESSource::SiStripApvSimulationParametersESSource(c conf.getParameter("apvBaselinesFile_tob4"), conf.getParameter("apvBaselinesFile_tob5"), conf.getParameter("apvBaselinesFile_tob6")}; + baselineFiles_TID_ = {conf.getParameter("apvBaselinesFile_tid1"), + conf.getParameter("apvBaselinesFile_tid2"), + conf.getParameter("apvBaselinesFile_tid3")}; + baselineFiles_TEC_ = {conf.getParameter("apvBaselinesFile_tec1"), + conf.getParameter("apvBaselinesFile_tec2"), + conf.getParameter("apvBaselinesFile_tec3"), + conf.getParameter("apvBaselinesFile_tec4"), + conf.getParameter("apvBaselinesFile_tec5"), + conf.getParameter("apvBaselinesFile_tec6"), + conf.getParameter("apvBaselinesFile_tec7"), + conf.getParameter("apvBaselinesFile_tec8"), + conf.getParameter("apvBaselinesFile_tec9")}; } void SiStripApvSimulationParametersESSource::setIntervalFor(const edm::eventsetup::EventSetupRecordKey&, @@ -61,9 +84,9 @@ void SiStripApvSimulationParametersESSource::setIntervalFor(const edm::eventsetu } SiStripApvSimulationParameters::LayerParameters SiStripApvSimulationParametersESSource::makeLayerParameters( - const std::string& apvBaselinesFileName) const { + const std::string& apvBaselinesFileName, const std::vector& rzBinEdges) const { // Prepare histograms - unsigned int nZBins = zBinEdges_.size(); + unsigned int nZBins = rzBinEdges.size(); unsigned int nPUBins = puBinEdges_.size(); if (nPUBins == 0 || nZBins == 0 || baseline_nBins_ == 0) { @@ -76,7 +99,7 @@ SiStripApvSimulationParameters::LayerParameters SiStripApvSimulationParametersES } baselineBinEdges.push_back(baseline_max_); - SiStripApvSimulationParameters::LayerParameters layerParams{baselineBinEdges, puBinEdges_, zBinEdges_}; + SiStripApvSimulationParameters::LayerParameters layerParams{baselineBinEdges, puBinEdges_, rzBinEdges}; // Read apv baselines from text files std::vector theAPVBaselines; @@ -119,22 +142,37 @@ SiStripApvSimulationParameters::LayerParameters SiStripApvSimulationParametersES std::unique_ptr SiStripApvSimulationParametersESSource::produce( const SiStripApvSimulationParametersRcd& record) { - auto apvSimParams = - std::make_unique(baselineFiles_TIB_.size(), baselineFiles_TOB_.size(), 0, 0); + auto apvSimParams = std::make_unique( + baselineFiles_TIB_.size(), baselineFiles_TOB_.size(), baselineFiles_TID_.size(), baselineFiles_TEC_.size()); for (unsigned int i{0}; i != baselineFiles_TIB_.size(); ++i) { - if ( ! apvSimParams->putTIB(i + 1, makeLayerParameters(baselineFiles_TIB_[i].fullPath())) ) { - throw cms::Exception("SiStripApvSimulationParameters") << "Could not add parameters for TIB layer " << (i+1); + + if (!apvSimParams->putTIB(i + 1, makeLayerParameters(baselineFiles_TIB_[i].fullPath(), zBinEdges_))) { + throw cms::Exception("SiStripApvSimulationParameters") << "Could not add parameters for TIB layer " << (i + 1); } else { LogDebug("SiStripApvSimulationParameters") << "Added parameters for TIB layer " << (i+1); } } for (unsigned int i{0}; i != baselineFiles_TOB_.size(); ++i) { - if ( ! apvSimParams->putTOB(i + 1, makeLayerParameters(baselineFiles_TOB_[i].fullPath())) ) { - throw cms::Exception("SiStripApvSimulationParameters") << "Could not add parameters for TOB layer " << (i+1); + if (!apvSimParams->putTOB(i + 1, makeLayerParameters(baselineFiles_TOB_[i].fullPath(), zBinEdges_))) { + throw cms::Exception("SiStripApvSimulationParameters") << "Could not add parameters for TOB layer " << (i + 1); } else { LogDebug("SiStripApvSimulationParameters") << "Added parameters for TOB layer " << (i+1); } } + for (unsigned int i{0}; i != baselineFiles_TID_.size(); ++i) { + if (!apvSimParams->putTID(i + 1, makeLayerParameters(baselineFiles_TID_[i].fullPath(), rBinEdgesTID_))) { + throw cms::Exception("SiStripApvSimulationParameters") << "Could not add parameters for TID wheel " << (i + 1); + } else { + LogDebug("SiStripApvSimulationParameters") << "Added parameters for TID wheel " << (i + 1); + } + } + for (unsigned int i{0}; i != baselineFiles_TEC_.size(); ++i) { + if (!apvSimParams->putTEC(i + 1, makeLayerParameters(baselineFiles_TEC_[i].fullPath(), rBinEdgesTEC_))) { + throw cms::Exception("SiStripApvSimulationParameters") << "Could not add parameters for TEC wheel " << (i + 1); + } else { + LogDebug("SiStripApvSimulationParameters") << "Added parameters for TEC wheel " << (i + 1); + } + } return apvSimParams; } From cdb789b6a0b112181de0701ef37359592a8fc1d1 Mon Sep 17 00:00:00 2001 From: Emyr John Clement Date: Wed, 27 Jun 2018 21:05:18 +0100 Subject: [PATCH 06/16] Introduce APV dynamic gain simulation Use SiStripApvSimulationParameters from EventSetup in SiStripDigitizer Use SiStrip APV simulation baseline ascii files from SimTracker/SiStripDigitizer/data SiStripDIgitizerAlgorithm: use enum for tracker partitions Address PR comments. Make output collections unique_ptr from start Use emplace_back instead of push_back. Reserve size for vectors holding output collections if known Fix creation of output containers Reorganise new class members Fix to avoid potentially negative charge deposits after simulating APV gain. --- .../python/SiStripSimParameters_cfi.py | 8 +- .../SiStripDigitizer/data/pulse_2016.txt | 1 + .../plugins/SiStripDigitizer.cc | 47 +++++++- .../plugins/SiStripDigitizer.h | 1 + .../plugins/SiStripDigitizerAlgorithm.cc | 110 +++++++++++++++--- .../plugins/SiStripDigitizerAlgorithm.h | 19 ++- 6 files changed, 168 insertions(+), 18 deletions(-) create mode 100644 SimTracker/SiStripDigitizer/data/pulse_2016.txt diff --git a/SimGeneral/MixingModule/python/SiStripSimParameters_cfi.py b/SimGeneral/MixingModule/python/SiStripSimParameters_cfi.py index 7be4a635c55f5..6dbb4cd401c1d 100644 --- a/SimGeneral/MixingModule/python/SiStripSimParameters_cfi.py +++ b/SimGeneral/MixingModule/python/SiStripSimParameters_cfi.py @@ -116,7 +116,13 @@ # TOFCutForDeconvolution = cms.double(50.0), TOFCutForPeak = cms.double(100.0), - Inefficiency = cms.double(0.0) + Inefficiency = cms.double(0.0), + # APV Dynamic Gain Simulation + includeAPVSimulation = cms.bool( False ), + apv_maxResponse = cms.double( 729 ), + apv_rate = cms.double( 66.2 ), + apv_mVPerQ = cms.double( 5.5 ), + apvfCPerElectron = cms.double( 1.602e-4 ), ) from Configuration.ProcessModifiers.premix_stage1_cff import premix_stage1 diff --git a/SimTracker/SiStripDigitizer/data/pulse_2016.txt b/SimTracker/SiStripDigitizer/data/pulse_2016.txt new file mode 100644 index 0000000000000..49d8ef46c709f --- /dev/null +++ b/SimTracker/SiStripDigitizer/data/pulse_2016.txt @@ -0,0 +1 @@ +0.00325184 0.00325184 0.00325184 0.00325184 0.003251840.00325184 0.00325184 0.00325184 0.00325184 0.003251840.00325184 0.00325184 0.00325184 0.00325184 0.003251840.00325184 0.00325184 0.00325184 0.00325184 0.003251840.00325184 0.00325184 0.00325184 0.00325184 0.003251840.00325184 0.00325184 0.00325184 0.00325184 0.003251840.00325184 0.00325184 0.00325184 0.00325184 0.003251840.00325184 0.00325184 0.00325184 0.00325184 0.003251840.00325184 0.00325184 0.00325184 0.00325184 0.003251840.00325184 0.00325184 0.00325184 0.00325184 0.003251840.00325184 0.00325184 0.00325184 0.00325184 0.003251840.00325184 0.00325184 0.00325184 0.00325184 0.003251840.00325184 0.00325184 0.00325184 0.00325184 0.003251840.00325184 0.00325184 0.00325184 0.00325184 0.003251840.00325184 0.00325184 0.00325184 0.00325184 0.003251840.00325184 0.00325184 0.00325184 0.00325184 0.003251840.00325184 0.00325184 0.00325184 0.00325184 0.003251840.00325184 0.00325184 0.00325184 0.00325184 0.003251840.00325184 0.00325184 0.00325184 0.00325184 0.003251840.00325184 0.00325184 0.00325184 0.00325184 0.003251840.00325184 0.00325184 0.00325184 0.00325184 0.003251840.00325184 0.00325184 0.00325184 0.00325184 0.003251840.00325184 0.00325184 0.00325184 0.00325184 0.003251840.00325184 0.00325184 0.00325184 0.00325184 0.003251840.00325184 0.00325184 0.00325184 0.00325184 0.003251840.00325184 0.00325184 0.00325184 0.00325184 0.003251840.00325184 0.00325184 0.00325184 0.00325184 0.003251840.00325184 0.00325184 0.00325184 0.00325184 0.003251840.00325184 0.00325184 0.00325184 0.00325184 0.003251840.00325184 0.00325184 0.00325184 0.00325184 0.003251840.00325184 0.00325184 0.00325184 0.00325184 0.003251840.00325184 0.00325184 0.00325184 0.00325184 0.003251840.00325184 0.00325184 0.00325184 0.00325184 0.003251840.00325184 0.00325184 0.00325184 0.00325184 0.003251840.00325184 0.00325184 0.00325184 0.00325184 0.003251840.00325184 0.00325184 0.00325184 0.00325184 0.003251840.00325184 0.00325184 0.00325184 0.00325184 0.003251840.00325184 0.00325184 0.00325184 0.00325184 0.003251840.00325184 0.00325184 0.00325255 0.00325602 0.003264380.00327991 0.00330938 0.00335237 0.00341082 0.003486740.00358228 0.00370715 0.00385666 0.00403245 0.004236110.00446934 0.00474466 0.00505365 0.00539764 0.00577790.00619578 0.00666578 0.00717655 0.00772906 0.008324270.00896329 0.00966197 0.0104066 0.011198 0.01203670.0129236 0.0138754 0.0148767 0.0159279 0.01702940.0181817 0.019402 0.0206736 0.0219969 0.02337180.0247986 0.0262944 0.0278419 0.0294411 0.03109180.0327942 0.0345645 0.0363855 0.038257 0.04017880.0421507 0.0441884 0.0462752 0.0484108 0.05059490.0528273 0.0551231 0.057466 0.0598557 0.06229190.0647743 0.0673172 0.0699051 0.0725376 0.07521420.0779348 0.0807127 0.0835331 0.0863956 0.08929980.0922453 0.0952447 0.098284 0.101363 0.104480.107636 0.110843 0.114086 0.117366 0.1206820.124033 0.12743 0.130862 0.134327 0.1378250.141355 0.144927 0.14853 0.152164 0.1558280.15952 0.163252 0.167011 0.170797 0.1746110.178451 0.182326 0.186226 0.190151 0.19410.198073 0.202077 0.206104 0.210152 0.2142230.218315 0.222434 0.226574 0.230734 0.2349120.23911 0.243332 0.247573 0.25183 0.2561040.260396 0.264708 0.269037 0.27338 0.2777380.282111 0.286503 0.290908 0.295326 0.2997570.3042 0.308659 0.31313 0.317612 0.3221050.326608 0.331125 0.335652 0.340188 0.3447320.349286 0.35385 0.358423 0.363003 0.367590.372184 0.376787 0.381396 0.386012 0.3906320.395258 0.399891 0.404528 0.40917 0.4138160.418466 0.42312 0.427777 0.432437 0.43710.441766 0.446434 0.451103 0.455774 0.4604470.46512 0.469795 0.47447 0.479145 0.483820.488495 0.493169 0.497842 0.502514 0.5071850.511854 0.516522 0.521187 0.52585 0.5305110.535169 0.539823 0.544474 0.549122 0.5537660.558407 0.563043 0.567675 0.572302 0.5769250.581543 0.586155 0.590762 0.595363 0.5999590.60455 0.609133 0.61371 0.618281 0.6228450.627403 0.631953 0.636495 0.641031 0.645560.650081 0.654592 0.659096 0.663593 0.6680810.672561 0.677031 0.681492 0.685945 0.690390.694825 0.699249 0.703664 0.70807 0.7124670.716854 0.721229 0.725594 0.72995 0.7342950.738631 0.742954 0.747266 0.751568 0.7558590.76014 0.764407 0.768664 0.772909 0.7771440.781368 0.785577 0.789774 0.793961 0.7981360.802299 0.806447 0.810584 0.814709 0.8188220.822923 0.827008 0.831081 0.835142 0.8391910.843228 0.847248 0.851256 0.855251 0.8592330.863203 0.867156 0.871096 0.875019 0.8789230.882806 0.886655 0.890474 0.894261 0.8980130.901729 0.905391 0.90901 0.912584 0.9161110.919588 0.922996 0.92635 0.929647 0.9328870.936067 0.939166 0.942202 0.945173 0.9480780.950916 0.953663 0.956341 0.958948 0.9614830.963945 0.96631 0.968601 0.970817 0.9729580.975023 0.976986 0.978873 0.980682 0.9824150.98407 0.985623 0.987098 0.988496 0.9898170.99106 0.992202 0.993268 0.994258 0.9951730.996012 0.996752 0.997417 0.998009 0.9985270.998972 0.999321 0.999597 0.999803 0.9999371 0.99997 0.999871 0.999703 0.9994670.999162 0.998769 0.998309 0.997783 0.9971920.996536 0.995795 0.99499 0.994123 0.9931950.992204 0.991133 0.990003 0.988813 0.9875650.986259 0.984877 0.983439 0.981946 0.9803980.978797 0.977124 0.975399 0.973623 0.9717960.969918 0.967975 0.965982 0.963942 0.9618540.95972 0.957524 0.955282 0.952996 0.9506660.948292 0.945862 0.943389 0.940875 0.938320.935724 0.933075 0.930388 0.927662 0.9248980.922097 0.919247 0.916361 0.913439 0.9104830.907492 0.904455 0.901386 0.898283 0.8951490.891982 0.888774 0.885535 0.882267 0.8789680.875641 0.872275 0.868881 0.865459 0.862010.858535 0.855024 0.851488 0.847927 0.8443410.84073 0.837087 0.833421 0.829732 0.8260210.822287 0.818524 0.81474 0.810935 0.807110.803264 0.799392 0.795502 0.791592 0.7876640.783718 0.779748 0.775761 0.771757 0.7677360.763699 0.759642 0.755568 0.75148 0.7473770.74326 0.739124 0.734974 0.730811 0.7266350.722446 0.718241 0.714024 0.709795 0.7055550.701303 0.697037 0.692761 0.688475 0.6841790.679873 0.675555 0.671228 0.666893 0.6625490.658197 0.653834 0.649464 0.645087 0.6407030.636312 0.631912 0.627507 0.623095 0.6186780.614255 0.609825 0.60539 0.600951 0.5965070.592059 0.587606 0.583149 0.578688 0.5742240.569757 0.565286 0.560813 0.556337 0.5518590.547379 0.542897 0.538413 0.533928 0.5294420.524954 0.520466 0.515977 0.511488 0.5069990.502509 0.49802 0.493531 0.489043 0.4845560.480069 0.475584 0.4711 0.466618 0.4621370.457658 0.453182 0.448707 0.444235 0.4397660.435298 0.430835 0.426374 0.421917 0.4174630.413012 0.408565 0.404122 0.399683 0.3952480.390817 0.386392 0.38197 0.377554 0.3731410.368734 0.364333 0.359937 0.355545 0.351160.346779 0.342406 0.338038 0.333677 0.3293240.324979 0.320647 0.316327 0.312018 0.3077220.30344 0.299177 0.29493 0.290699 0.2864860.28229 0.278119 0.273967 0.269836 0.2657250.261636 0.257575 0.253537 0.249523 0.2455310.241564 0.237629 0.233719 0.229834 0.2259750.222142 0.218343 0.214572 0.210827 0.2071090.203418 0.199764 0.196138 0.192539 0.1889680.185425 0.18192 0.178442 0.174993 0.1715720.168179 0.164824 0.161496 0.158197 0.1549260.151682 0.148475 0.145297 0.142145 0.1390220.135926 0.132866 0.129834 0.126828 0.123850.120899 0.117984 0.115095 0.112233 0.1093970.106587 0.103813 0.101064 0.0983411 0.0956440.0929725 0.0903348 0.0877223 0.0851348 0.08257220.0800343 0.0775291 0.0750482 0.0725914 0.07015860.0677496 0.0653719 0.0630176 0.0606864 0.05837820.0560928 0.0538374 0.0516043 0.0493934 0.04720440.0450373 0.0428989 0.0407819 0.0386861 0.03661130.0345574 0.032531 0.030525 0.0285393 0.02657380.0246282 0.022709 0.0208093 0.018929 0.0170680.0152261 0.0134094 0.0116113 0.00983189 0.008070850.00632813 0.0046095 0.00290874 0.00122574 -0.000439632-0.00208749 -0.00371231 -0.00532003 -0.00691077 -0.00848465-0.0100418 -0.0115769 -0.0130956 -0.0145981 -0.0160845-0.0175549 -0.0190042 -0.0204378 -0.0218559 -0.0232586-0.024646 -0.0260133 -0.0273656 -0.028703 -0.0300257-0.0313337 -0.0326225 -0.033897 -0.0351574 -0.0364036-0.0376358 -0.0388497 -0.0400498 -0.0412365 -0.0424096-0.0435694 -0.0447116 -0.0458407 -0.0469569 -0.0480602-0.0491507 -0.0502245 -0.0512857 -0.0523346 -0.0533712-0.0543956 -0.0554039 -0.0564003 -0.0573848 -0.0583577-0.0593189 -0.0602647 -0.0611992 -0.0621223 -0.0630343-0.0639351 -0.0648212 -0.0656965 -0.066561 -0.0674149-0.068258 -0.0690872 -0.069906 -0.0707145 -0.0715128-0.0723009 -0.0730757 -0.0738406 -0.0745957 -0.075341-0.0760766 -0.0767994 -0.0775128 -0.0782168 -0.0789116-0.079597 -0.0802703 -0.0809346 -0.08159 -0.0822364-0.082874 -0.0835001 -0.0841175 -0.0847264 -0.0853268-0.0859188 -0.0864997 -0.0870724 -0.087637 -0.0881935-0.088742 -0.0892799 -0.08981 -0.0903324 -0.090847-0.091354 -0.0918509 -0.0923403 -0.0928224 -0.0932971-0.0937645 -0.0942223 -0.0946731 -0.0951167 -0.0955534-0.0959831 -0.0964037 -0.0968175 -0.0972246 -0.097625-0.0980188 -0.0984039 -0.0987826 -0.0991548 -0.0995207-0.0998803 -0.100232 -0.100577 -0.100916 -0.101249-0.101576 -0.101895 -0.102208 -0.102516 -0.102817-0.103113 -0.103402 -0.103685 -0.103962 -0.104234-0.104501 -0.10476 -0.105014 -0.105263 -0.105507-0.105745 -0.105977 -0.106203 -0.106425 -0.106641-0.106853 -0.107058 -0.107259 -0.107455 -0.107646-0.107832 -0.108012 -0.108188 -0.108359 -0.108526-0.108688 -0.108844 -0.108997 -0.109144 -0.109288-0.109427 -0.109561 -0.109691 -0.109816 -0.109938-0.110056 -0.110168 -0.110276 -0.110381 -0.110482-0.110579 -0.110671 -0.110759 -0.110844 -0.110925-0.111002 -0.111075 -0.111144 -0.111209 -0.111272-0.11133 -0.111385 -0.111436 -0.111484 -0.111528-0.111569 -0.111606 -0.11164 -0.111671 -0.111698-0.111723 -0.111744 -0.111761 -0.111776 -0.111788-0.111796 -0.111801 -0.111803 -0.111803 -0.1118-0.111793 -0.111784 -0.111771 -0.111756 -0.111739-0.111718 -0.111695 -0.111669 -0.11164 -0.111609-0.111575 -0.111539 -0.1115 -0.111458 -0.111414-0.111368 -0.111319 -0.111268 -0.111214 -0.111158-0.1111 -0.111039 -0.110976 -0.110911 -0.110844-0.110775 -0.110703 -0.110629 -0.110553 -0.110476-0.110396 -0.110314 -0.11023 -0.110144 -0.110056-0.109966 -0.109874 -0.10978 -0.109685 -0.109588-0.109489 -0.109387 -0.109285 -0.10918 -0.109074-0.108966 -0.108856 -0.108745 -0.108632 -0.108518-0.108402 -0.108284 -0.108165 -0.108044 -0.107922-0.107798 -0.107673 -0.107546 -0.107418 -0.107288-0.107157 -0.107025 -0.106891 -0.106756 -0.10662-0.106482 -0.106343 -0.106202 -0.106061 -0.105918-0.105774 -0.105629 -0.105483 -0.105335 -0.105187-0.105037 -0.104886 -0.104734 -0.104581 -0.104427-0.104272 -0.104115 -0.103958 -0.1038 -0.10364-0.10348 -0.103319 -0.103157 -0.102994 -0.10283-0.102665 -0.102499 -0.102332 -0.102165 -0.101996-0.101827 -0.101657 -0.101486 -0.101315 -0.101142-0.100969 -0.100795 -0.10062 -0.100445 -0.100269-0.100092 -0.0999145 -0.0997362 -0.0995574 -0.0993779-0.0991978 -0.0990169 -0.0988355 -0.0986534 -0.0984709-0.0982877 -0.0981039 -0.0979195 -0.0977346 -0.0975492-0.0973633 -0.0971768 -0.0969897 -0.0968022 -0.0966143-0.0964259 -0.0962369 -0.0960475 -0.0958576 -0.0956674-0.0954767 -0.0952855 -0.095094 -0.094902 -0.0947097-0.0945171 -0.0943239 -0.0941305 -0.0939367 -0.0937425-0.0935481 -0.0933532 -0.0931581 -0.0929626 -0.0927669-0.0925709 -0.0923745 -0.0921779 -0.091981 -0.0917839-0.0915865 -0.0913889 -0.091191 -0.0909929 -0.0907946-0.090596 -0.0903972 -0.0901983 -0.0899991 -0.0897998-0.0896003 -0.0894006 -0.0892007 -0.0890007 -0.0888006-0.0886003 -0.0883998 -0.0881992 -0.0879985 -0.0877977-0.0875968 -0.0873957 -0.0871946 -0.0869934 -0.0867921-0.0865907 -0.0863892 -0.0861876 -0.085986 -0.0857844-0.0855827 -0.0853809 -0.0851791 -0.0849773 -0.0847754-0.0845735 -0.0843716 -0.0841697 -0.0839678 -0.0837659-0.083564 -0.0833621 -0.0831602 -0.0829583 -0.0827564-0.0825546 -0.0823528 -0.082151 -0.0819493 -0.0817476-0.081546 -0.0813445 -0.081143 -0.0809415 -0.0807402-0.0805389 -0.0803377 -0.0801365 -0.0799355 -0.0797345-0.0795337 -0.0793329 -0.0791323 -0.0789317 -0.0787313-0.0785309 -0.0783308 -0.0781307 -0.0779307 -0.0777309-0.0775312 -0.0773316 -0.0771322 -0.076933 -0.0767338-0.0765348 -0.076336 -0.0761374 -0.0759389 -0.0757406-0.0755424 -0.0753444 -0.0751466 -0.0749489 -0.0747515-0.0745542 -0.0743571 -0.0741602 -0.0739635 -0.073767-0.0735706 -0.0733745 -0.0731786 -0.0729829 -0.0727874-0.0725921 -0.072397 -0.0722022 -0.0720075 -0.0718131-0.0716189 -0.0714249 -0.0712312 -0.0710377 -0.0708444-0.0706514 -0.0704586 -0.0702661 -0.0700737 -0.0698817-0.0696898 -0.0694983 -0.069307 -0.0691159 -0.0689251-0.0687345 -0.0685442 -0.0683542 -0.0681644 -0.0679749-0.0677857 -0.0675967 -0.0674081 -0.0672196 -0.0670315-0.0668436 -0.066656 -0.0664687 -0.0662817 -0.0660949-0.0659084 -0.0657223 -0.0655364 -0.0653508 -0.0651655-0.0649805 -0.0647958 -0.0646114 -0.0644272 -0.0642434-0.0640598 -0.0638766 -0.0636937 -0.0635111 -0.0633288-0.0631467 -0.0629651 -0.0627837 -0.0626026 -0.0624218-0.0622413 -0.0620612 -0.0618814 -0.0617019 -0.0615227-0.0613437 -0.0611652 -0.060987 -0.0608091 -0.0606314-0.0604541 -0.0602772 -0.0601006 -0.0599243 -0.0597483-0.0595726 -0.0593973 -0.0592223 -0.0590477 -0.0588733-0.0586993 -0.0585257 -0.0583523 -0.0581793 -0.0580066-0.0578343 -0.0576623 -0.0574907 -0.0573193 -0.0571483-0.0569776 -0.0568074 -0.0566374 -0.0564678 -0.0562985-0.0561295 -0.0559609 -0.0557927 -0.0556247 -0.0554571-0.0552899 -0.055123 -0.0549565 -0.0547903 -0.0546244-0.0544588 -0.0542937 -0.0541289 -0.0539644 -0.0538003-0.0536365 -0.0534731 -0.05331 -0.0531473 -0.0529849-0.0528228 -0.0526611 -0.0524998 -0.0523388 -0.0521782-0.0520179 -0.051858 -0.0516984 -0.0515392 -0.0513802-0.0512217 -0.0510635 -0.0509057 -0.0507482 -0.0505911-0.0504343 -0.0502779 -0.0501218 -0.0499661 -0.0498107-0.0496557 -0.049501 -0.0493467 -0.0491928 -0.0490392-0.0488859 -0.048733 -0.0485805 -0.0484283 -0.0482764-0.0481249 -0.0479738 -0.047823 -0.0476726 -0.0475225-0.0473727 -0.0472233 -0.0470743 -0.0469257 -0.0467773-0.0466293 -0.0464817 -0.0463345 -0.0461875 -0.0460409-0.0458947 -0.0457489 -0.0456034 -0.0454582 -0.0453134-0.0451688 -0.0450248 -0.044881 -0.0447376 -0.0445945-0.0444518 -0.0443094 -0.0441674 -0.0440257 -0.0438844-0.0437434 -0.0436028 -0.0434625 -0.0433226 -0.043183-0.0430437 -0.0429048 -0.0427663 -0.0426281 -0.0424902-0.0423527 -0.0422155 -0.0420787 -0.0419422 -0.0418061-0.0416702 -0.0415348 -0.0413997 -0.041265 -0.0411305-0.0409964 -0.0408627 -0.0407293 -0.0405963 -0.0404635-0.0403311 -0.0401991 -0.0400674 -0.039936 -0.039805-0.0396743 -0.039544 -0.039414 -0.0392843 -0.0391549-0.0390259 -0.0388972 -0.0387689 -0.0386409 -0.0385132-0.0383859 -0.0382589 -0.0381322 -0.0380059 -0.0378799-0.0377542 -0.0376289 -0.0375039 -0.0373792 -0.0372548-0.0371308 -0.0370071 -0.0368838 -0.0367607 -0.036638-0.0365156 -0.0363935 -0.0362718 -0.0361504 -0.0360293-0.0359085 -0.0357881 -0.035668 -0.0355482 -0.0354287-0.0353096 -0.0351908 -0.0350723 -0.0349541 -0.0348362-0.0347186 -0.0346014 -0.0344846 -0.034368 -0.0342517-0.0341357 -0.0340201 -0.0339047 -0.0337897 -0.033675-0.0335606 -0.0334466 -0.0333328 -0.0332194 -0.0331062-0.0329933 -0.0328809 -0.0327687 -0.0326568 -0.0325452-0.0324338 -0.0323229 -0.0322123 -0.0321019 -0.0319918-0.031882 -0.0317726 -0.0316635 -0.0315547 -0.0314461-0.0313378 -0.0312299 -0.0311223 -0.031015 -0.0309079-0.0308012 -0.0306948 -0.0305887 -0.0304828 -0.0303773-0.030272 -0.0301671 -0.0300624 -0.0299581 -0.029854-0.0297502 -0.0296468 -0.0295436 -0.0294407 -0.0293381-0.0292357 -0.0291337 -0.029032 -0.0289306 -0.0288294-0.0287285 -0.028628 -0.0285277 -0.0284277 -0.0283279-0.0282284 -0.0281293 -0.0280305 -0.0279319 -0.0278335-0.0277355 -0.0276378 -0.0275403 -0.0274431 -0.0273462-0.0272496 -0.0271532 -0.0270572 -0.0269614 -0.0268658-0.0267706 -0.0266756 -0.0265809 -0.0264865 -0.0263923-0.0262984 -0.0262049 -0.0261115 -0.0260185 -0.0259257-0.0258331 -0.0257409 -0.0256489 -0.0255572 -0.0254657-0.0253745 -0.0252836 -0.0251929 -0.0251025 -0.0250124-0.0249225 -0.0248329 -0.0247436 -0.0246545 -0.0245657-0.0244771 -0.0243888 -0.0243008 -0.024213 -0.0241254-0.0240381 -0.0239512 -0.0238644 -0.0237779 -0.0236916-0.0236056 -0.0235199 -0.0234344 -0.0233492 -0.0232642-0.0231794 -0.023095 -0.0230107 -0.0229268 -0.022843-0.0227595 -0.0226763 -0.0225933 -0.0225105 -0.022428-0.0223457 -0.0222637 -0.022182 -0.0221005 -0.0220192-0.0219381 -0.0218573 -0.0217768 -0.0216964 -0.0216163-0.0215365 -0.0214569 -0.0213775 -0.0212984 -0.0212195-0.0211408 -0.0210624 -0.0209842 -0.0209063 -0.0208285-0.020751 -0.0206738 -0.0205968 -0.02052 -0.0204434-0.0203671 -0.020291 -0.0202151 -0.0201395 -0.020064-0.0199888 -0.0199139 -0.0198392 -0.0197646 -0.0196903-0.0196162 -0.0195424 -0.0194688 -0.0193954 -0.0193222-0.0192493 -0.0191765 -0.019104 -0.0190318 -0.0189597-0.0188878 -0.0188162 -0.0187448 -0.0186736 -0.0186026-0.0185318 -0.0184612 -0.0183909 -0.0183208 -0.0182508-0.0181811 -0.0181116 -0.0180424 -0.0179733 -0.0179044-0.0178357 -0.0177673 -0.0176991 -0.0176311 -0.0175633-0.0174956 -0.0174282 -0.0173611 -0.0172941 -0.0172273-0.0171607 -0.0170943 -0.0170281 -0.0169622 -0.0168964-0.0168308 -0.0167654 -0.0167003 -0.0166353 -0.0165705-0.016506 -0.0164416 -0.0163774 -0.0163135 -0.0162497-0.0161861 -0.0161227 -0.0160595 -0.0159965 -0.0159337-0.0158711 -0.0158087 -0.0157465 -0.0156844 -0.0156226-0.0155609 -0.0154995 -0.0154382 -0.0153771 -0.0153162-0.0152555 -0.015195 -0.0151347 -0.0150745 -0.0150145-0.0149547 -0.0148952 -0.0148358 -0.0147766 -0.0147175-0.0146586 -0.0146 -0.0145415 -0.0144832 -0.0144251-0.0143671 -0.0143094 -0.0142518 -0.0141944 -0.0141371-0.0140801 -0.0140232 -0.0139665 -0.01391 -0.0138536-0.0137975 -0.0137415 -0.0136857 -0.01363 -0.0135745-0.0135192 -0.0134641 -0.0134092 -0.0133544 -0.0132998-0.0132453 -0.0131911 -0.013137 -0.013083 -0.0130292-0.0129756 -0.0129222 -0.012869 -0.0128159 -0.0127629-0.0127102 -0.0126576 -0.0126051 -0.0125529 -0.0125008-0.0124488 -0.012397 -0.0123454 -0.012294 -0.0122427-0.0121915 -0.0121406 -0.0120898 -0.0120391 -0.0119886-0.0119383 -0.0118881 -0.0118381 -0.0117882 -0.0117385-0.0116889 -0.0116396 -0.0115903 -0.0115413 -0.0114923-0.0114435 -0.0113949 -0.0113465 -0.0112982 -0.01125-0.011202 -0.0111541 -0.0111064 -0.0110589 -0.0110114-0.0109642 -0.0109171 -0.0108701 -0.0108233 -0.0107766-0.0107301 -0.0106837 -0.0106375 -0.0105915 -0.0105455-0.0104997 -0.0104541 -0.0104086 -0.0103632 -0.010318-0.0102729 -0.010228 -0.0101833 -0.0101386 -0.0100941-0.0100497 -0.0100055 -0.00996148 -0.00991754 -0.00987373-0.00983006 -0.00978656 -0.00974319 -0.00969995 -0.00965683-0.00961385 -0.00957104 -0.00952835 -0.00948579 -0.00944336-0.00940105 -0.00935892 -0.0093169 -0.00927502 -0.00923326-0.00919162 -0.00915015 -0.0091088 -0.00906758 -0.00902648-0.0089855 -0.00894469 -0.008904 -0.00886343 -0.00882298-0.00878265 -0.00874249 -0.00870244 -0.00866251 -0.00862271-0.00858302 -0.00854349 -0.00850408 -0.00846479 -0.00842561-0.00838656 -0.00834765 -0.00830887 -0.0082702 -0.00823165-0.00819321 -0.00815493 -0.00811676 -0.00807871 -0.00804077-0.00800295 -0.00796527 -0.00792771 -0.00789026 -0.00785293-0.00781571 -0.00777863 -0.00774167 -0.00770482 -0.00766808-0.00763145 -0.00759497 -0.0075586 -0.00752233 -0.00748618-0.00745014 -0.00741424 -0.00737844 -0.00734276 -0.00730718-0.00727171 -0.00723639 -0.00720117 -0.00716605 -0.00713104-0.00709614 -0.00706138 -0.00702672 -0.00699217 -0.00695772-0.00692338 -0.00688917 -0.00685507 -0.00682107 -0.00678717-0.00675338 -0.00671972 -0.00668617 -0.00665271 -0.00661936-0.0065861 -0.00655299 -0.00651997 -0.00648705 -0.00645423-0.00642151 -0.00638892 -0.00635643 -0.00632404 -0.00629175-0.00625956 -0.00622749 -0.00619552 -0.00616365 -0.00613188-0.0061002 -0.00606865 -0.0060372 -0.00600584 -0.00597458-0.00594341 -0.00591237 -0.00588142 -0.00585057 -0.0058198-0.00578914 -0.0057586 -0.00572815 -0.00569779 -0.00566752-0.00563735 -0.0056073 -0.00557734 -0.00554747 -0.00551769-0.00548801 -0.00545844 -0.00542896 -0.00539958 -0.00537028-0.00534107 -0.00531198 -0.00528298 -0.00525407 -0.00522524-0.00519651 -0.00516788 -0.00513935 -0.00511091 -0.00508255-0.00505427 -0.00502611 -0.00499804 -0.00497006 -0.00494215-0.00491434 -0.00488664 -0.00485902 -0.00483148 -0.00480403-0.00477667 -0.00474941 -0.00472224 -0.00469515 -0.00466814-0.00464122 -0.00461441 -0.00458768 -0.00456103 -0.00453446-0.00450797 -0.00448159 -0.00445529 -0.00442907 -0.00440293-0.00437688 -0.00435092 -0.00432505 -0.00429926 -0.00427354-0.00424791 -0.00422238 -0.00419692 -0.00417155 -0.00414625-0.00412103 -0.00409592 -0.00407088 -0.00404591 -0.00402103-0.00399622 -0.00397151 -0.00394688 -0.00392232 -0.00389784-0.00387343 -0.00384912 -0.00382489 -0.00380073 -0.00377665-0.00375264 -0.00372873 -0.00370489 -0.00368112 -0.00365743-0.00363381 diff --git a/SimTracker/SiStripDigitizer/plugins/SiStripDigitizer.cc b/SimTracker/SiStripDigitizer/plugins/SiStripDigitizer.cc index 7036d39135c8d..0be10b3db4edc 100644 --- a/SimTracker/SiStripDigitizer/plugins/SiStripDigitizer.cc +++ b/SimTracker/SiStripDigitizer/plugins/SiStripDigitizer.cc @@ -49,6 +49,7 @@ #include "CalibFormats/SiStripObjects/interface/SiStripDetCabling.h" #include "CalibTracker/Records/interface/SiStripDependentRecords.h" #include "CondFormats/DataRecord/interface/SiStripCondDataRecords.h" +#include "CondFormats/SiStripObjects/interface/SiStripApvSimulationParameters.h" //Random Number #include "FWCore/ServiceRegistry/interface/Service.h" @@ -66,12 +67,17 @@ SiStripDigitizer::SiStripDigitizer(const edm::ParameterSet& conf, edm::ProducerB geometryType(conf.getParameter("GeometryType")), useConfFromDB(conf.getParameter("TrackerConfigurationFromDB")), zeroSuppression(conf.getParameter("ZeroSuppression")), - makeDigiSimLinks_(conf.getUntrackedParameter("makeDigiSimLinks", false)) { + makeDigiSimLinks_(conf.getUntrackedParameter("makeDigiSimLinks", false)), + includeAPVSimulation_(conf.getParameter("includeAPVSimulation")) { const std::string alias("simSiStripDigis"); mixMod.produces>(ZSDigi).setBranchAlias(ZSDigi); mixMod.produces>(SCDigi).setBranchAlias(alias + SCDigi); mixMod.produces>(VRDigi).setBranchAlias(alias + VRDigi); + mixMod.produces>("StripAmplitudes").setBranchAlias(alias + "StripAmplitudes"); + mixMod.produces>("StripAmplitudesPostAPV") + .setBranchAlias(alias + "StripAmplitudesPostAPV"); + mixMod.produces>("StripAPVBaselines").setBranchAlias(alias + "StripAPVBaselines"); mixMod.produces>(PRDigi).setBranchAlias(alias + PRDigi); mixMod.produces>().setBranchAlias(alias + "siStripDigiSimLink"); mixMod.produces>>>("AffectedAPVList").setBranchAlias(alias + "AffectedAPV"); @@ -224,15 +230,25 @@ void SiStripDigitizer::finalizeEvent(edm::Event& iEvent, edm::EventSetup const& edm::ESHandle noiseHandle; edm::ESHandle thresholdHandle; edm::ESHandle pedestalHandle; + edm::ESHandle apvSimulationParametersHandle; iSetup.get().get(gainLabel, gainHandle); iSetup.get().get(noiseHandle); iSetup.get().get(thresholdHandle); iSetup.get().get(pedestalHandle); - + if (includeAPVSimulation_) { + iSetup.get().get(apvSimulationParametersHandle); + } std::vector> theDigiVector; std::vector> theRawDigiVector; + std::unique_ptr> theStripAmplitudeVector( new edm::DetSetVector()); + std::unique_ptr> theStripAmplitudeVectorPostAPV( new edm::DetSetVector()); + std::unique_ptr> theStripAPVBaselines( new edm::DetSetVector()); std::unique_ptr> pOutputDigiSimLink(new edm::DetSetVector); + edm::ESHandle tTopoHand; + iSetup.get().get(tTopoHand); + const TrackerTopology* tTopo = tTopoHand.product(); + // Step B: LOOP on StripGeomDetUnit theDigiVector.reserve(10000); theDigiVector.clear(); @@ -247,17 +263,34 @@ void SiStripDigitizer::finalizeEvent(edm::Event& iEvent, edm::EventSetup const& if (sgd != nullptr) { edm::DetSet collectorZS(iu->geographicalId().rawId()); edm::DetSet collectorRaw(iu->geographicalId().rawId()); + edm::DetSet collectorStripAmplitudes(iu->geographicalId().rawId()); + edm::DetSet collectorStripAmplitudesPostAPV(iu->geographicalId().rawId()); + edm::DetSet collectorStripAPVBaselines(iu->geographicalId().rawId()); edm::DetSet collectorLink(iu->geographicalId().rawId()); + + unsigned int detID = sgd->geographicalId().rawId(); + DetId detId(detID); + theDigiAlgo->digitize(collectorZS, collectorRaw, + collectorStripAmplitudes, + collectorStripAmplitudesPostAPV, + collectorStripAPVBaselines, collectorLink, sgd, gainHandle, thresholdHandle, noiseHandle, pedestalHandle, + apvSimulationParametersHandle, theAffectedAPVvector, - randomEngine_); + randomEngine_, + tTopo); + + if ( !collectorStripAmplitudes.data.empty() ) theStripAmplitudeVector->insert(collectorStripAmplitudes); + if ( !collectorStripAmplitudesPostAPV.data.empty() ) theStripAmplitudeVectorPostAPV->insert(collectorStripAmplitudesPostAPV); + if ( !collectorStripAPVBaselines.data.empty() ) theStripAPVBaselines->insert(collectorStripAPVBaselines); + if (zeroSuppression) { if (!collectorZS.data.empty()) { theDigiVector.push_back(collectorZS); @@ -281,10 +314,14 @@ void SiStripDigitizer::finalizeEvent(edm::Event& iEvent, edm::EventSetup const& std::unique_ptr> output(new edm::DetSetVector(theDigiVector)); std::unique_ptr>>> AffectedAPVList( new std::vector>>(theAffectedAPVvector)); + // Step D: write output to file iEvent.put(std::move(output), ZSDigi); iEvent.put(std::move(output_scopemode), SCDigi); iEvent.put(std::move(output_virginraw), VRDigi); + iEvent.put(std::move(theStripAmplitudeVector), "StripAmplitudes"); + iEvent.put(std::move(theStripAmplitudeVectorPostAPV), "StripAmplitudesPostAPV"); + iEvent.put(std::move(theStripAPVBaselines), "StripAPVBaselines"); iEvent.put(std::move(output_processedraw), PRDigi); iEvent.put(std::move(AffectedAPVList), "AffectedAPVList"); if (makeDigiSimLinks_) @@ -297,10 +334,14 @@ void SiStripDigitizer::finalizeEvent(edm::Event& iEvent, edm::EventSetup const& std::unique_ptr> output_scopemode(new edm::DetSetVector()); std::unique_ptr> output_processedraw(new edm::DetSetVector()); std::unique_ptr> output(new edm::DetSetVector()); + // Step D: write output to file iEvent.put(std::move(output), ZSDigi); iEvent.put(std::move(output_scopemode), SCDigi); iEvent.put(std::move(output_virginraw), VRDigi); + iEvent.put(std::move(theStripAmplitudeVector), "StripAmplitudes"); + iEvent.put(std::move(theStripAmplitudeVectorPostAPV), "StripAmplitudesPostAPV"); + iEvent.put(std::move(theStripAPVBaselines), "StripAPVBaselines"); iEvent.put(std::move(output_processedraw), PRDigi); if (makeDigiSimLinks_) iEvent.put( diff --git a/SimTracker/SiStripDigitizer/plugins/SiStripDigitizer.h b/SimTracker/SiStripDigitizer/plugins/SiStripDigitizer.h index 27f5a11373ed6..1dc8343e888c4 100644 --- a/SimTracker/SiStripDigitizer/plugins/SiStripDigitizer.h +++ b/SimTracker/SiStripDigitizer/plugins/SiStripDigitizer.h @@ -85,6 +85,7 @@ class SiStripDigitizer : public DigiAccumulatorMixMod { const bool useConfFromDB; const bool zeroSuppression; const bool makeDigiSimLinks_; + const bool includeAPVSimulation_; ///< Whether or not to create the association to sim truth collection. Set in configuration. /** @brief Offset to add to the index of each sim hit to account for which crossing it's in. diff --git a/SimTracker/SiStripDigitizer/plugins/SiStripDigitizerAlgorithm.cc b/SimTracker/SiStripDigitizer/plugins/SiStripDigitizerAlgorithm.cc index 37336ddc45d77..715492347379a 100644 --- a/SimTracker/SiStripDigitizer/plugins/SiStripDigitizerAlgorithm.cc +++ b/SimTracker/SiStripDigitizer/plugins/SiStripDigitizerAlgorithm.cc @@ -66,7 +66,12 @@ SiStripDigitizerAlgorithm::SiStripDigitizerAlgorithm(const edm::ParameterSet& co theSiNoiseAdder(new SiGaussianTailNoiseAdder(theThreshold)), theSiDigitalConverter(new SiTrivialDigitalConverter(theElectronPerADC, PreMixing_)), theSiZeroSuppress(new SiStripFedZeroSuppression(theFedAlgo)), - APVProbabilityFile(conf.getParameter("APVProbabilityFile")) { + APVProbabilityFile(conf.getParameter("APVProbabilityFile")), + includeAPVSimulation_(conf.getParameter("includeAPVSimulation")), + apv_maxResponse(conf.getParameter("apv_maxResponse")), + apv_rate(conf.getParameter("apv_rate")), + apv_mVPerQ(conf.getParameter("apv_mVPerQ")), + apv_fCPerElectron(conf.getParameter("apvfCPerElectron")) { if (peakMode) { LogDebug("StripDigiInfo") << "APVs running in peak mode (poor time resolution)"; } else { @@ -138,6 +143,8 @@ void SiStripDigitizerAlgorithm::initializeEvent(const edm::EventSetup& iSetup) { FirstLumiCalc_ = true; FirstDigitize_ = true; + nTruePU_ = 0; + //get gain noise pedestal lorentzAngle from ES handle edm::ESHandle pdt; iSetup.getData(pdt); @@ -265,8 +272,8 @@ void SiStripDigitizerAlgorithm::calculateInstlumiScale(PileupMixingContent* puIn pui++; } if (pu0 != bunchCrossing.end()) { // found the in-time interaction - double Tintr = TrueInteractionList.at(p); - double instLumi = Bunch * Tintr * RevFreq / minBXsec; + nTruePU_ = TrueInteractionList.at(p); + double instLumi = Bunch * nTruePU_ * RevFreq / minBXsec; APVSaturationProb_ = instLumi / 6.0E33; } FirstLumiCalc_ = false; @@ -277,17 +284,25 @@ void SiStripDigitizerAlgorithm::calculateInstlumiScale(PileupMixingContent* puIn void SiStripDigitizerAlgorithm::digitize(edm::DetSet& outdigi, edm::DetSet& outrawdigi, + edm::DetSet& outStripAmplitudes, + edm::DetSet& outStripAmplitudesPostAPV, + edm::DetSet& outStripAPVBaselines, edm::DetSet& outLink, const StripGeomDetUnit* det, edm::ESHandle& gainHandle, edm::ESHandle& thresholdHandle, edm::ESHandle& noiseHandle, edm::ESHandle& pedestalHandle, + edm::ESHandle& apvSimulationParametersHandle, std::vector>>& theAffectedAPVvector, - CLHEP::HepRandomEngine* engine) { + CLHEP::HepRandomEngine* engine, + const TrackerTopology* tTopo) { unsigned int detID = det->geographicalId().rawId(); int numStrips = (det->specificTopology()).nstrips(); + DetId detId(detID); + uint32_t SubDet = detId.subdetId(); + const SiPileUpSignals::SignalMapType* theSignal(theSiPileUpSignals->getSignal(detID)); std::vector detAmpl(numStrips, 0.); @@ -305,6 +320,70 @@ void SiStripDigitizerAlgorithm::digitize(edm::DetSet& outdigi, } } + if (includeAPVSimulation_) { + // Get index in apv baseline distributions corresponding to z of detSet and PU + const StripTopology* topol = dynamic_cast(&(det->specificTopology())); + LocalPoint localPos = topol->localPosition(0); + GlobalPoint globalPos = det->surface().toGlobal(Local3DPoint(localPos.x(), localPos.y(), localPos.z())); + float detSet_z = fabs(globalPos.z()); + + // Store SCD, before APV sim + outStripAmplitudes.reserve(numStrips); + for (int strip = 0; strip < numStrips; ++strip) { + outStripAmplitudes.emplace_back(SiStripRawDigi(detAmpl[strip] / theElectronPerADC)); + } + + // Simulate APV response for each strip + if (SubDet == SiStripSubdetector::TIB || SubDet == SiStripSubdetector::TOB) { + for (int strip = 0; strip < numStrips; ++strip) { + if (detAmpl[strip] > 0) { + // Convert charge from electrons to fC + double stripCharge = detAmpl[strip] * apv_fCPerElectron; + + // Get APV baseline + double baselineV = 0; + if (SubDet == SiStripSubdetector::TIB) { + baselineV = apvSimulationParametersHandle->sampleTIB(tTopo->tibLayer(detId), detSet_z, nTruePU_, engine); + } else if (SubDet == SiStripSubdetector::TOB) { + baselineV = apvSimulationParametersHandle->sampleTOB(tTopo->tobLayer(detId), detSet_z, nTruePU_, engine); + } + // Store APV baseline for this strip + outStripAPVBaselines.emplace_back(SiStripRawDigi(baselineV)); + + // Fitted parameters from G Hall/M Raymond + double maxResponse = apv_maxResponse; + double rate = apv_rate; + + double outputChargeInADC = 0; + if ( baselineV < apv_maxResponse ) { + // Convert V0 into baseline charge + double baselineQ = -1.0 * rate * log(2 * maxResponse / (baselineV + maxResponse) - 1); + + + // Add charge deposited in this BX + double newStripCharge = baselineQ + stripCharge; + + // Apply APV response + double signalV = 2 * maxResponse / (1 + exp(-1.0 * newStripCharge / rate)) - maxResponse; + double gain = signalV - baselineV; + + // Convert gain (mV) to charge (assuming linear region of APV) and then to electrons + double outputCharge = gain / apv_mVPerQ; + outputChargeInADC = outputCharge / apv_fCPerElectron; + } + + + // Output charge back to original container + detAmpl[strip] = outputChargeInADC; + } + } + } + // Store SCD, after APV sim + outStripAmplitudesPostAPV.reserve(numStrips); + for (int strip = 0; strip < numStrips; ++strip) + outStripAmplitudesPostAPV.emplace_back(SiStripRawDigi(detAmpl[strip] / theElectronPerADC)); + } + if (APVSaturationFromHIP) { //Implementation of the proper charge scaling function. Need consider resaturation effect: //The probability map gives the probability that at least one HIP happened during the last N bunch crossings (cfr APV recovery time). @@ -498,15 +577,19 @@ void SiStripDigitizerAlgorithm::digitize(edm::DetSet& outdigi, if (CommonModeNoise) { float cmnRMS = 0.; DetId detId(detID); - uint32_t SubDet = detId.subdetId(); - if (SubDet == 3) { - cmnRMS = cmnRMStib; - } else if (SubDet == 4) { - cmnRMS = cmnRMStid; - } else if (SubDet == 5) { - cmnRMS = cmnRMStob; - } else if (SubDet == 6) { - cmnRMS = cmnRMStec; + switch (detId.subdetId()) { + case SiStripSubdetector::TIB: + cmnRMS = cmnRMStib; + break; + case SiStripSubdetector::TID: + cmnRMS = cmnRMStid; + break; + case SiStripSubdetector::TOB: + cmnRMS = cmnRMStob; + break; + case SiStripSubdetector::TEC: + cmnRMS = cmnRMStec; + break; } cmnRMS *= theElectronPerADC; theSiNoiseAdder->addCMNoise(detAmpl, cmnRMS, badChannels, engine); @@ -534,6 +617,7 @@ void SiStripDigitizerAlgorithm::digitize(edm::DetSet& outdigi, theSiNoiseAdder->addPedestals(detAmpl, vPeds); //if(!RealPedestals&&!CommonModeNoise&&!noise&&!BaselineShift&&!APVSaturationFromHIP){ + // edm::LogWarning("SiStripDigitizer")<<"You are running the digitizer without Noise generation and without applying Zero Suppression. ARE YOU SURE???"; //}else{ diff --git a/SimTracker/SiStripDigitizer/plugins/SiStripDigitizerAlgorithm.h b/SimTracker/SiStripDigitizer/plugins/SiStripDigitizerAlgorithm.h index cdbe10e89592a..a506e0b08ab3f 100644 --- a/SimTracker/SiStripDigitizer/plugins/SiStripDigitizerAlgorithm.h +++ b/SimTracker/SiStripDigitizer/plugins/SiStripDigitizerAlgorithm.h @@ -22,6 +22,7 @@ #include "CondFormats/SiStripObjects/interface/SiStripPedestals.h" #include "CondFormats/SiStripObjects/interface/SiStripThreshold.h" #include "CondFormats/SiStripObjects/interface/SiStripBadStrip.h" +#include "CondFormats/SiStripObjects/interface/SiStripApvSimulationParameters.h" #include "CalibFormats/SiStripObjects/interface/SiStripGain.h" #include "SimTracker/SiStripDigitizer/interface/SiTrivialDigitalConverter.h" #include "SimTracker/SiStripDigitizer/interface/SiGaussianTailNoiseAdder.h" @@ -33,6 +34,9 @@ #include "Geometry/CommonDetUnit/interface/GeomDetType.h" #include "SimGeneral/HepPDTRecord/interface/ParticleDataTable.h" #include "RecoLocalTracker/SiStripZeroSuppression/interface/SiStripFedZeroSuppression.h" +#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" + +#include "TH1F.h" #include #include @@ -80,14 +84,19 @@ class SiStripDigitizerAlgorithm { void digitize(edm::DetSet& outDigis, edm::DetSet& outRawDigis, + edm::DetSet& outStripAmplitudes, + edm::DetSet& outStripAmplitudesPostAPV, + edm::DetSet& outStripAPVBaselines, edm::DetSet& outLink, const StripGeomDetUnit* stripdet, edm::ESHandle&, edm::ESHandle&, edm::ESHandle&, edm::ESHandle&, + edm::ESHandle&, std::vector>>& theAffectedAPVvector, - CLHEP::HepRandomEngine*); + CLHEP::HepRandomEngine*, + const TrackerTopology* tTopo); void calculateInstlumiScale(PileupMixingContent* puInfo); @@ -118,6 +127,7 @@ class SiStripDigitizerAlgorithm { const int theFedAlgo; const bool zeroSuppression; const double theElectronPerADC; + const double theTOFCutForPeak; const double theTOFCutForDeconvolution; const double tofCut; @@ -170,6 +180,13 @@ class SiStripDigitizerAlgorithm { std::map mapOfAPVprobabilities; std::map> SiStripTrackerAffectedAPVMap; int NumberOfBxBetweenHIPandEvent; + + bool includeAPVSimulation_; + const double apv_maxResponse; + const double apv_rate; + const double apv_mVPerQ; + const double apv_fCPerElectron; + unsigned int nTruePU_; }; #endif From 566906b57e731111e2ec3076a154609b1ff7baa1 Mon Sep 17 00:00:00 2001 From: Emyr Date: Thu, 12 Sep 2019 12:56:20 +0100 Subject: [PATCH 07/16] Add functionality to only simulate APV for fraction of events, and store bool with decision. --- .../python/SiStripSimParameters_cfi.py | 1 + .../plugins/SiStripDigitizer.cc | 15 +++++++++-- .../plugins/SiStripDigitizer.h | 1 + .../plugins/SiStripDigitizerAlgorithm.cc | 26 +++++++++++-------- .../plugins/SiStripDigitizerAlgorithm.h | 9 ++++--- 5 files changed, 35 insertions(+), 17 deletions(-) diff --git a/SimGeneral/MixingModule/python/SiStripSimParameters_cfi.py b/SimGeneral/MixingModule/python/SiStripSimParameters_cfi.py index 6dbb4cd401c1d..083bb16f1f6a5 100644 --- a/SimGeneral/MixingModule/python/SiStripSimParameters_cfi.py +++ b/SimGeneral/MixingModule/python/SiStripSimParameters_cfi.py @@ -123,6 +123,7 @@ apv_rate = cms.double( 66.2 ), apv_mVPerQ = cms.double( 5.5 ), apvfCPerElectron = cms.double( 1.602e-4 ), + fracOfEventsToSimAPV = cms.double( 0.5376 ), ) from Configuration.ProcessModifiers.premix_stage1_cff import premix_stage1 diff --git a/SimTracker/SiStripDigitizer/plugins/SiStripDigitizer.cc b/SimTracker/SiStripDigitizer/plugins/SiStripDigitizer.cc index 0be10b3db4edc..0d9550a6a69cd 100644 --- a/SimTracker/SiStripDigitizer/plugins/SiStripDigitizer.cc +++ b/SimTracker/SiStripDigitizer/plugins/SiStripDigitizer.cc @@ -55,6 +55,7 @@ #include "FWCore/ServiceRegistry/interface/Service.h" #include "FWCore/Utilities/interface/RandomNumberGenerator.h" #include "FWCore/Utilities/interface/Exception.h" +#include "CLHEP/Random/RandFlat.h" SiStripDigitizer::SiStripDigitizer(const edm::ParameterSet& conf, edm::ProducerBase& mixMod, edm::ConsumesCollector& iC) : gainLabel(conf.getParameter("Gain")), @@ -68,7 +69,8 @@ SiStripDigitizer::SiStripDigitizer(const edm::ParameterSet& conf, edm::ProducerB useConfFromDB(conf.getParameter("TrackerConfigurationFromDB")), zeroSuppression(conf.getParameter("ZeroSuppression")), makeDigiSimLinks_(conf.getUntrackedParameter("makeDigiSimLinks", false)), - includeAPVSimulation_(conf.getParameter("includeAPVSimulation")) { + includeAPVSimulation_(conf.getParameter("includeAPVSimulation")), + fracOfEventsToSimAPV_(conf.getParameter("fracOfEventsToSimAPV")) { const std::string alias("simSiStripDigis"); mixMod.produces>(ZSDigi).setBranchAlias(ZSDigi); @@ -80,6 +82,7 @@ SiStripDigitizer::SiStripDigitizer(const edm::ParameterSet& conf, edm::ProducerB mixMod.produces>("StripAPVBaselines").setBranchAlias(alias + "StripAPVBaselines"); mixMod.produces>(PRDigi).setBranchAlias(alias + PRDigi); mixMod.produces>().setBranchAlias(alias + "siStripDigiSimLink"); + mixMod.produces("SimulatedAPVDynamicGain").setBranchAlias(alias + "SimulatedAPVDynamicGain"); mixMod.produces>>>("AffectedAPVList").setBranchAlias(alias + "AffectedAPV"); for (auto const& trackerContainer : trackerContainers) { edm::InputTag tag(hitsProducer, trackerContainer); @@ -235,8 +238,13 @@ void SiStripDigitizer::finalizeEvent(edm::Event& iEvent, edm::EventSetup const& iSetup.get().get(noiseHandle); iSetup.get().get(thresholdHandle); iSetup.get().get(pedestalHandle); + + std::unique_ptr simulateAPVInThisEvent = std::make_unique(false); if (includeAPVSimulation_) { - iSetup.get().get(apvSimulationParametersHandle); + if (CLHEP::RandFlat::shoot(randomEngine_) < fracOfEventsToSimAPV_ ) { + *simulateAPVInThisEvent = true; + iSetup.get().get(apvSimulationParametersHandle); + } } std::vector> theDigiVector; std::vector> theRawDigiVector; @@ -282,6 +290,7 @@ void SiStripDigitizer::finalizeEvent(edm::Event& iEvent, edm::EventSetup const& thresholdHandle, noiseHandle, pedestalHandle, + *simulateAPVInThisEvent, apvSimulationParametersHandle, theAffectedAPVvector, randomEngine_, @@ -324,6 +333,7 @@ void SiStripDigitizer::finalizeEvent(edm::Event& iEvent, edm::EventSetup const& iEvent.put(std::move(theStripAPVBaselines), "StripAPVBaselines"); iEvent.put(std::move(output_processedraw), PRDigi); iEvent.put(std::move(AffectedAPVList), "AffectedAPVList"); + iEvent.put(std::move(simulateAPVInThisEvent), "SimulatedAPVDynamicGain"); if (makeDigiSimLinks_) iEvent.put( std::move(pOutputDigiSimLink)); // The previous EDProducer didn't name this collection so I won't either @@ -343,6 +353,7 @@ void SiStripDigitizer::finalizeEvent(edm::Event& iEvent, edm::EventSetup const& iEvent.put(std::move(theStripAmplitudeVectorPostAPV), "StripAmplitudesPostAPV"); iEvent.put(std::move(theStripAPVBaselines), "StripAPVBaselines"); iEvent.put(std::move(output_processedraw), PRDigi); + iEvent.put(std::move(simulateAPVInThisEvent), "SimulatedAPVDynamicGain"); if (makeDigiSimLinks_) iEvent.put( std::move(pOutputDigiSimLink)); // The previous EDProducer didn't name this collection so I won't either diff --git a/SimTracker/SiStripDigitizer/plugins/SiStripDigitizer.h b/SimTracker/SiStripDigitizer/plugins/SiStripDigitizer.h index 1dc8343e888c4..c8fa9054ebab1 100644 --- a/SimTracker/SiStripDigitizer/plugins/SiStripDigitizer.h +++ b/SimTracker/SiStripDigitizer/plugins/SiStripDigitizer.h @@ -86,6 +86,7 @@ class SiStripDigitizer : public DigiAccumulatorMixMod { const bool zeroSuppression; const bool makeDigiSimLinks_; const bool includeAPVSimulation_; + const double fracOfEventsToSimAPV_; ///< Whether or not to create the association to sim truth collection. Set in configuration. /** @brief Offset to add to the index of each sim hit to account for which crossing it's in. diff --git a/SimTracker/SiStripDigitizer/plugins/SiStripDigitizerAlgorithm.cc b/SimTracker/SiStripDigitizer/plugins/SiStripDigitizerAlgorithm.cc index 715492347379a..cc0be28870243 100644 --- a/SimTracker/SiStripDigitizer/plugins/SiStripDigitizerAlgorithm.cc +++ b/SimTracker/SiStripDigitizer/plugins/SiStripDigitizerAlgorithm.cc @@ -68,10 +68,10 @@ SiStripDigitizerAlgorithm::SiStripDigitizerAlgorithm(const edm::ParameterSet& co theSiZeroSuppress(new SiStripFedZeroSuppression(theFedAlgo)), APVProbabilityFile(conf.getParameter("APVProbabilityFile")), includeAPVSimulation_(conf.getParameter("includeAPVSimulation")), - apv_maxResponse(conf.getParameter("apv_maxResponse")), - apv_rate(conf.getParameter("apv_rate")), - apv_mVPerQ(conf.getParameter("apv_mVPerQ")), - apv_fCPerElectron(conf.getParameter("apvfCPerElectron")) { + apv_maxResponse_(conf.getParameter("apv_maxResponse")), + apv_rate_(conf.getParameter("apv_rate")), + apv_mVPerQ_(conf.getParameter("apv_mVPerQ")), + apv_fCPerElectron_(conf.getParameter("apvfCPerElectron")) { if (peakMode) { LogDebug("StripDigiInfo") << "APVs running in peak mode (poor time resolution)"; } else { @@ -293,6 +293,7 @@ void SiStripDigitizerAlgorithm::digitize(edm::DetSet& outdigi, edm::ESHandle& thresholdHandle, edm::ESHandle& noiseHandle, edm::ESHandle& pedestalHandle, + bool simulateAPVInThisEvent, edm::ESHandle& apvSimulationParametersHandle, std::vector>>& theAffectedAPVvector, CLHEP::HepRandomEngine* engine, @@ -320,7 +321,8 @@ void SiStripDigitizerAlgorithm::digitize(edm::DetSet& outdigi, } } - if (includeAPVSimulation_) { + if (includeAPVSimulation_ && simulateAPVInThisEvent ) { + // Get index in apv baseline distributions corresponding to z of detSet and PU const StripTopology* topol = dynamic_cast(&(det->specificTopology())); LocalPoint localPos = topol->localPosition(0); @@ -338,7 +340,7 @@ void SiStripDigitizerAlgorithm::digitize(edm::DetSet& outdigi, for (int strip = 0; strip < numStrips; ++strip) { if (detAmpl[strip] > 0) { // Convert charge from electrons to fC - double stripCharge = detAmpl[strip] * apv_fCPerElectron; + double stripCharge = detAmpl[strip] * apv_fCPerElectron_; // Get APV baseline double baselineV = 0; @@ -351,11 +353,12 @@ void SiStripDigitizerAlgorithm::digitize(edm::DetSet& outdigi, outStripAPVBaselines.emplace_back(SiStripRawDigi(baselineV)); // Fitted parameters from G Hall/M Raymond - double maxResponse = apv_maxResponse; - double rate = apv_rate; + double maxResponse = apv_maxResponse_; + double rate = apv_rate_; double outputChargeInADC = 0; - if ( baselineV < apv_maxResponse ) { + + if (baselineV < apv_maxResponse_) { // Convert V0 into baseline charge double baselineQ = -1.0 * rate * log(2 * maxResponse / (baselineV + maxResponse) - 1); @@ -368,8 +371,8 @@ void SiStripDigitizerAlgorithm::digitize(edm::DetSet& outdigi, double gain = signalV - baselineV; // Convert gain (mV) to charge (assuming linear region of APV) and then to electrons - double outputCharge = gain / apv_mVPerQ; - outputChargeInADC = outputCharge / apv_fCPerElectron; + double outputCharge = gain / apv_mVPerQ_; + outputChargeInADC = outputCharge / apv_fCPerElectron_; } @@ -382,6 +385,7 @@ void SiStripDigitizerAlgorithm::digitize(edm::DetSet& outdigi, outStripAmplitudesPostAPV.reserve(numStrips); for (int strip = 0; strip < numStrips; ++strip) outStripAmplitudesPostAPV.emplace_back(SiStripRawDigi(detAmpl[strip] / theElectronPerADC)); + } if (APVSaturationFromHIP) { diff --git a/SimTracker/SiStripDigitizer/plugins/SiStripDigitizerAlgorithm.h b/SimTracker/SiStripDigitizer/plugins/SiStripDigitizerAlgorithm.h index a506e0b08ab3f..0ad74f7bb2100 100644 --- a/SimTracker/SiStripDigitizer/plugins/SiStripDigitizerAlgorithm.h +++ b/SimTracker/SiStripDigitizer/plugins/SiStripDigitizerAlgorithm.h @@ -93,6 +93,7 @@ class SiStripDigitizerAlgorithm { edm::ESHandle&, edm::ESHandle&, edm::ESHandle&, + bool simulateAPVInThisEvent, edm::ESHandle&, std::vector>>& theAffectedAPVvector, CLHEP::HepRandomEngine*, @@ -182,10 +183,10 @@ class SiStripDigitizerAlgorithm { int NumberOfBxBetweenHIPandEvent; bool includeAPVSimulation_; - const double apv_maxResponse; - const double apv_rate; - const double apv_mVPerQ; - const double apv_fCPerElectron; + const double apv_maxResponse_; + const double apv_rate_; + const double apv_mVPerQ_; + const double apv_fCPerElectron_; unsigned int nTruePU_; }; From ccb464fabaedd5461d177ca21429da00ff9b1364 Mon Sep 17 00:00:00 2001 From: mmusich Date: Fri, 20 Sep 2019 13:52:40 +0200 Subject: [PATCH 08/16] use StripSubdetector namespace in 10.6.X --- .../plugins/SiStripDigitizerAlgorithm.cc | 14 +++++++------- .../plugins/SiStripDigitizerAlgorithm.h | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/SimTracker/SiStripDigitizer/plugins/SiStripDigitizerAlgorithm.cc b/SimTracker/SiStripDigitizer/plugins/SiStripDigitizerAlgorithm.cc index cc0be28870243..4ff5fa38ec926 100644 --- a/SimTracker/SiStripDigitizer/plugins/SiStripDigitizerAlgorithm.cc +++ b/SimTracker/SiStripDigitizer/plugins/SiStripDigitizerAlgorithm.cc @@ -336,7 +336,7 @@ void SiStripDigitizerAlgorithm::digitize(edm::DetSet& outdigi, } // Simulate APV response for each strip - if (SubDet == SiStripSubdetector::TIB || SubDet == SiStripSubdetector::TOB) { + if (SubDet == StripSubdetector::TIB || SubDet == StripSubdetector::TOB) { for (int strip = 0; strip < numStrips; ++strip) { if (detAmpl[strip] > 0) { // Convert charge from electrons to fC @@ -344,9 +344,9 @@ void SiStripDigitizerAlgorithm::digitize(edm::DetSet& outdigi, // Get APV baseline double baselineV = 0; - if (SubDet == SiStripSubdetector::TIB) { + if (SubDet == StripSubdetector::TIB) { baselineV = apvSimulationParametersHandle->sampleTIB(tTopo->tibLayer(detId), detSet_z, nTruePU_, engine); - } else if (SubDet == SiStripSubdetector::TOB) { + } else if (SubDet == StripSubdetector::TOB) { baselineV = apvSimulationParametersHandle->sampleTOB(tTopo->tobLayer(detId), detSet_z, nTruePU_, engine); } // Store APV baseline for this strip @@ -582,16 +582,16 @@ void SiStripDigitizerAlgorithm::digitize(edm::DetSet& outdigi, float cmnRMS = 0.; DetId detId(detID); switch (detId.subdetId()) { - case SiStripSubdetector::TIB: + case StripSubdetector::TIB: cmnRMS = cmnRMStib; break; - case SiStripSubdetector::TID: + case StripSubdetector::TID: cmnRMS = cmnRMStid; break; - case SiStripSubdetector::TOB: + case StripSubdetector::TOB: cmnRMS = cmnRMStob; break; - case SiStripSubdetector::TEC: + case StripSubdetector::TEC: cmnRMS = cmnRMStec; break; } diff --git a/SimTracker/SiStripDigitizer/plugins/SiStripDigitizerAlgorithm.h b/SimTracker/SiStripDigitizer/plugins/SiStripDigitizerAlgorithm.h index 0ad74f7bb2100..2cc542c02e196 100644 --- a/SimTracker/SiStripDigitizer/plugins/SiStripDigitizerAlgorithm.h +++ b/SimTracker/SiStripDigitizer/plugins/SiStripDigitizerAlgorithm.h @@ -34,7 +34,7 @@ #include "Geometry/CommonDetUnit/interface/GeomDetType.h" #include "SimGeneral/HepPDTRecord/interface/ParticleDataTable.h" #include "RecoLocalTracker/SiStripZeroSuppression/interface/SiStripFedZeroSuppression.h" -#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" +#include "DataFormats/SiStripDetId/interface/StripSubdetector.h" #include "TH1F.h" From cb65ffae3774b326de661e8f16038aa3481070ff Mon Sep 17 00:00:00 2001 From: Pieter David Date: Thu, 19 Sep 2019 16:02:13 +0200 Subject: [PATCH 09/16] Add APV simulation in PreMixingSiStripWorker --- .../plugins/PreMixingSiStripWorker.cc | 86 ++++++++++++++++++- 1 file changed, 85 insertions(+), 1 deletion(-) diff --git a/SimTracker/SiStripDigitizer/plugins/PreMixingSiStripWorker.cc b/SimTracker/SiStripDigitizer/plugins/PreMixingSiStripWorker.cc index 8c89bfb12de27..4e168e1edf6bf 100644 --- a/SimTracker/SiStripDigitizer/plugins/PreMixingSiStripWorker.cc +++ b/SimTracker/SiStripDigitizer/plugins/PreMixingSiStripWorker.cc @@ -6,6 +6,7 @@ #include "FWCore/ServiceRegistry/interface/Service.h" #include "DataFormats/Common/interface/Handle.h" #include "SimGeneral/MixingModule/interface/PileUpEventPrincipal.h" +#include "SimDataFormats/PileupSummaryInfo/interface/PileupSummaryInfo.h" #include "CondFormats/SiStripObjects/interface/SiStripBadStrip.h" #include "CalibTracker/Records/interface/SiStripDependentRecords.h" @@ -20,6 +21,7 @@ #include "CondFormats/SiStripObjects/interface/SiStripNoises.h" #include "CondFormats/SiStripObjects/interface/SiStripPedestals.h" #include "CondFormats/SiStripObjects/interface/SiStripThreshold.h" +#include "CondFormats/SiStripObjects/interface/SiStripApvSimulationParameters.h" #include "CalibFormats/SiStripObjects/interface/SiStripGain.h" #include "SimTracker/SiStripDigitizer/interface/SiTrivialDigitalConverter.h" #include "SimTracker/SiStripDigitizer/interface/SiGaussianTailNoiseAdder.h" @@ -120,6 +122,13 @@ class PreMixingSiStripWorker : public PreMixingWorker { std::map firstChannelsWithSignal; std::map lastChannelsWithSignal; + bool includeAPVSimulation_; + const double fracOfEventsToSimAPV_; + const double apv_maxResponse_; + const double apv_rate_; + const double apv_mVPerQ_; + const double apv_fCPerElectron_; + //---------------------------- class StrictWeakOrdering { @@ -145,7 +154,13 @@ PreMixingSiStripWorker::PreMixingSiStripWorker(const edm::ParameterSet& ps, theFedAlgo(ps.getParameter("FedAlgorithm_PM")), geometryType(ps.getParameter("GeometryType")), theSiZeroSuppress(new SiStripFedZeroSuppression(theFedAlgo)), - theSiDigitalConverter(new SiTrivialDigitalConverter(theElectronPerADC, false)) // no premixing + theSiDigitalConverter(new SiTrivialDigitalConverter(theElectronPerADC, false)), // no premixing + includeAPVSimulation_(ps.getParameter("includeAPVSimulation")), + fracOfEventsToSimAPV_(ps.getParameter("fracOfEventsToSimAPV")), + apv_maxResponse_(ps.getParameter("apv_maxResponse")), + apv_rate_(ps.getParameter("apv_rate")), + apv_mVPerQ_(ps.getParameter("apv_mVPerQ")), + apv_fCPerElectron_(ps.getParameter("apvfCPerElectron")) { // declare the products to produce @@ -330,6 +345,8 @@ void PreMixingSiStripWorker::put(edm::Event& e, edm::ESHandle thresholdHandle; edm::ESHandle pedestalHandle; edm::ESHandle deadChannelHandle; + edm::ESHandle apvSimulationParametersHandle; + edm::ESHandle tTopo; iSetup.get().get(gainLabel, gainHandle); iSetup.get().get(noiseHandle); iSetup.get().get(thresholdHandle); @@ -338,6 +355,23 @@ void PreMixingSiStripWorker::put(edm::Event& e, edm::Service rng; CLHEP::HepRandomEngine* engine = &rng->getEngine(e.streamID()); + const bool simulateAPVInThisEvent = includeAPVSimulation_ && (CLHEP::RandFlat::shoot(engine) < fracOfEventsToSimAPV_); + float nTruePU = 0.; // = ps.getTrueNumInteractions(); + if (simulateAPVInThisEvent) { + iSetup.get().get(tTopo); + iSetup.get().get(apvSimulationParametersHandle); + const auto it = std::find_if( + std::begin(ps), std::end(ps), [](const PileupSummaryInfo& bxps) { return bxps.getBunchCrossing() == 0; }); + if (it != std::begin(ps)) { + nTruePU = it->getTrueNumInteractions(); + edm::LogInfo("PreMixingSiStripWorker") << "True number of interactions for current bunch crossing: " << nTruePU; + } else { + edm::LogWarning("PreMixingSiStripWorker") << "Could not find PileupSummaryInfo for current bunch crossing"; + nTruePU = std::begin(ps)->getTrueNumInteractions(); + } + } else { + } + std::map> DeadAPVList; DeadAPVList.clear(); @@ -521,6 +555,56 @@ void PreMixingSiStripWorker::put(edm::Event& e, detAmpl[strip] = 0.; } + if (simulateAPVInThisEvent) { + // Get index in apv baseline distributions corresponding to z of detSet and PU + const StripTopology* topol = dynamic_cast(&(sgd->specificTopology())); + LocalPoint localPos = topol->localPosition(0); + GlobalPoint globalPos = sgd->surface().toGlobal(Local3DPoint(localPos.x(), localPos.y(), localPos.z())); + float detSet_z = fabs(globalPos.z()); + + const uint32_t SubDet = DetId(detID).subdetId(); + // Simulate APV response for each strip + if (SubDet == SiStripSubdetector::TIB || SubDet == SiStripSubdetector::TOB) { + for (int strip = 0; strip < numStrips; ++strip) { + if (detAmpl[strip] > 0) { + // Convert charge from electrons to fC + double stripCharge = detAmpl[strip] * apv_fCPerElectron_; + + // Get APV baseline + double baselineV = 0; + if (SubDet == SiStripSubdetector::TIB) { + baselineV = apvSimulationParametersHandle->sampleTIB(tTopo->tibLayer(detID), detSet_z, nTruePU, engine); + } else if (SubDet == SiStripSubdetector::TOB) { + baselineV = apvSimulationParametersHandle->sampleTOB(tTopo->tobLayer(detID), detSet_z, nTruePU, engine); + } + // Fitted parameters from G Hall/M Raymond + double maxResponse = apv_maxResponse_; + double rate = apv_rate_; + + double outputChargeInADC = 0; + if (baselineV < apv_maxResponse_) { + // Convert V0 into baseline charge + double baselineQ = -1.0 * rate * log(2 * maxResponse / (baselineV + maxResponse) - 1); + + // Add charge deposited in this BX + double newStripCharge = baselineQ + stripCharge; + + // Apply APV response + double signalV = 2 * maxResponse / (1 + exp(-1.0 * newStripCharge / rate)) - maxResponse; + double gain = signalV - baselineV; + + // Convert gain (mV) to charge (assuming linear region of APV) and then to electrons + double outputCharge = gain / apv_mVPerQ_; + outputChargeInADC = outputCharge / apv_fCPerElectron_; + } + + // Output charge back to original container + detAmpl[strip] = outputChargeInADC; + } + } + } + } + if (APVSaturationFromHIP_) { std::bitset<6>& bs = DeadAPVList[detID]; From 5c7fcbb62c5619646da2610ada726a9d20f7b69a Mon Sep 17 00:00:00 2001 From: Pieter David Date: Fri, 20 Sep 2019 09:13:15 +0200 Subject: [PATCH 10/16] store bool if dynamic gain is used, remove printout --- SimTracker/SiStripDigitizer/plugins/PreMixingSiStripWorker.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SimTracker/SiStripDigitizer/plugins/PreMixingSiStripWorker.cc b/SimTracker/SiStripDigitizer/plugins/PreMixingSiStripWorker.cc index 4e168e1edf6bf..70b156cf1c625 100644 --- a/SimTracker/SiStripDigitizer/plugins/PreMixingSiStripWorker.cc +++ b/SimTracker/SiStripDigitizer/plugins/PreMixingSiStripWorker.cc @@ -172,6 +172,7 @@ PreMixingSiStripWorker::PreMixingSiStripWorker(const edm::ParameterSet& ps, SistripAPVListDM_ = ps.getParameter("SiStripAPVListDM"); producer.produces>(SiStripDigiCollectionDM_); + producer.produces(SiStripDigiCollectionDM_ + "SimulatedAPVDynamicGain"); if (APVSaturationFromHIP_) { SistripAPVLabelSig_ = ps.getParameter("SistripAPVLabelSig"); @@ -364,12 +365,10 @@ void PreMixingSiStripWorker::put(edm::Event& e, std::begin(ps), std::end(ps), [](const PileupSummaryInfo& bxps) { return bxps.getBunchCrossing() == 0; }); if (it != std::begin(ps)) { nTruePU = it->getTrueNumInteractions(); - edm::LogInfo("PreMixingSiStripWorker") << "True number of interactions for current bunch crossing: " << nTruePU; } else { edm::LogWarning("PreMixingSiStripWorker") << "Could not find PileupSummaryInfo for current bunch crossing"; nTruePU = std::begin(ps)->getTrueNumInteractions(); } - } else { } std::map> DeadAPVList; @@ -699,6 +698,7 @@ void PreMixingSiStripWorker::put(edm::Event& e, // put collection e.put(std::move(MySiStripDigis), SiStripDigiCollectionDM_); + e.put(std::make_unique(simulateAPVInThisEvent), SiStripDigiCollectionDM_ + "SimulatedAPVDynamicGain"); // clear local storage for this event SiHitStorage_.clear(); From c51b2921f7e8973f90e33cf0058ca64e42912bca Mon Sep 17 00:00:00 2001 From: mmusich Date: Tue, 17 Sep 2019 19:30:27 +0200 Subject: [PATCH 11/16] adapt SiStripApvSimulationParametersESProducer to have optional EndCaps --- ...iStripApvSimulationParametersESProducer.cc | 54 ++++++++++--------- ...StripApvSimulationParametersBuilder_cfg.py | 22 ++++---- 2 files changed, 42 insertions(+), 34 deletions(-) diff --git a/CalibTracker/SiStripESProducers/plugins/real/SiStripApvSimulationParametersESProducer.cc b/CalibTracker/SiStripESProducers/plugins/real/SiStripApvSimulationParametersESProducer.cc index 30e36b5456637..452ea8d630945 100644 --- a/CalibTracker/SiStripESProducers/plugins/real/SiStripApvSimulationParametersESProducer.cc +++ b/CalibTracker/SiStripESProducers/plugins/real/SiStripApvSimulationParametersESProducer.cc @@ -47,34 +47,40 @@ SiStripApvSimulationParametersESSource::SiStripApvSimulationParametersESSource(c for (const auto x : conf.getParameter>("apvBaselines_zBinEdges")) { zBinEdges_.push_back(x); } - for (const auto x : conf.getParameter>("apvBaselines_rBinEdges_TID")) { + for (const auto x : conf.getUntrackedParameter>("apvBaselines_rBinEdges_TID")) { rBinEdgesTID_.push_back(x); } - for (const auto x : conf.getParameter>("apvBaselines_rBinEdges_TEC")) { + for (const auto x : conf.getUntrackedParameter>("apvBaselines_rBinEdges_TEC")) { rBinEdgesTEC_.push_back(x); } - baselineFiles_TIB_ = {conf.getParameter("apvBaselinesFile_tib1"), - conf.getParameter("apvBaselinesFile_tib2"), - conf.getParameter("apvBaselinesFile_tib3"), - conf.getParameter("apvBaselinesFile_tib4")}; - baselineFiles_TOB_ = {conf.getParameter("apvBaselinesFile_tob1"), - conf.getParameter("apvBaselinesFile_tob2"), - conf.getParameter("apvBaselinesFile_tob3"), - conf.getParameter("apvBaselinesFile_tob4"), - conf.getParameter("apvBaselinesFile_tob5"), - conf.getParameter("apvBaselinesFile_tob6")}; - baselineFiles_TID_ = {conf.getParameter("apvBaselinesFile_tid1"), - conf.getParameter("apvBaselinesFile_tid2"), - conf.getParameter("apvBaselinesFile_tid3")}; - baselineFiles_TEC_ = {conf.getParameter("apvBaselinesFile_tec1"), - conf.getParameter("apvBaselinesFile_tec2"), - conf.getParameter("apvBaselinesFile_tec3"), - conf.getParameter("apvBaselinesFile_tec4"), - conf.getParameter("apvBaselinesFile_tec5"), - conf.getParameter("apvBaselinesFile_tec6"), - conf.getParameter("apvBaselinesFile_tec7"), - conf.getParameter("apvBaselinesFile_tec8"), - conf.getParameter("apvBaselinesFile_tec9")}; + baselineFiles_TIB_ = {conf.getUntrackedParameter("apvBaselinesFile_tib1"), + conf.getUntrackedParameter("apvBaselinesFile_tib2"), + conf.getUntrackedParameter("apvBaselinesFile_tib3"), + conf.getUntrackedParameter("apvBaselinesFile_tib4")}; + baselineFiles_TOB_ = {conf.getUntrackedParameter("apvBaselinesFile_tob1"), + conf.getUntrackedParameter("apvBaselinesFile_tob2"), + conf.getUntrackedParameter("apvBaselinesFile_tob3"), + conf.getUntrackedParameter("apvBaselinesFile_tob4"), + conf.getUntrackedParameter("apvBaselinesFile_tob5"), + conf.getUntrackedParameter("apvBaselinesFile_tob6")}; + + if(rBinEdgesTID_.size()>0){ + baselineFiles_TID_ = {conf.getUntrackedParameter("apvBaselinesFile_tid1"), + conf.getUntrackedParameter("apvBaselinesFile_tid2"), + conf.getUntrackedParameter("apvBaselinesFile_tid3")}; + } + + if( rBinEdgesTEC_.size()>0){ + baselineFiles_TEC_ = {conf.getUntrackedParameter("apvBaselinesFile_tec1"), + conf.getUntrackedParameter("apvBaselinesFile_tec2"), + conf.getUntrackedParameter("apvBaselinesFile_tec3"), + conf.getUntrackedParameter("apvBaselinesFile_tec4"), + conf.getUntrackedParameter("apvBaselinesFile_tec5"), + conf.getUntrackedParameter("apvBaselinesFile_tec6"), + conf.getUntrackedParameter("apvBaselinesFile_tec7"), + conf.getUntrackedParameter("apvBaselinesFile_tec8"), + conf.getUntrackedParameter("apvBaselinesFile_tec9")}; + } } void SiStripApvSimulationParametersESSource::setIntervalFor(const edm::eventsetup::EventSetupRecordKey&, diff --git a/CondTools/SiStrip/test/SiStripApvSimulationParametersBuilder_cfg.py b/CondTools/SiStrip/test/SiStripApvSimulationParametersBuilder_cfg.py index d6de296490fb5..2170446816107 100644 --- a/CondTools/SiStrip/test/SiStripApvSimulationParametersBuilder_cfg.py +++ b/CondTools/SiStrip/test/SiStripApvSimulationParametersBuilder_cfg.py @@ -28,16 +28,18 @@ apvBaselines_maxBaseline=cms.double(738.), apvBaselines_puBinEdges=cms.vdouble(0., 2., 4., 6., 8., 10., 12., 14., 16., 18., 20., 22., 24., 26., 28., 30., 32., 34., 36., 38., 40., 42., 44., 46., 48., 50.), apvBaselines_zBinEdges=cms.vdouble(0., 25., 50., 75.), - apvBaselinesFile_tib1=cms.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TIB1_12us.txt"), - apvBaselinesFile_tib2=cms.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TIB2_15us.txt"), - apvBaselinesFile_tib3=cms.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TIB3_16us.txt"), - apvBaselinesFile_tib4=cms.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TIB4_17us.txt"), - apvBaselinesFile_tob1=cms.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TOB1_10us.txt"), - apvBaselinesFile_tob2=cms.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TOB2_13us.txt"), - apvBaselinesFile_tob3=cms.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TOB3_16us.txt"), - apvBaselinesFile_tob4=cms.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TOB4_17us.txt"), - apvBaselinesFile_tob5=cms.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TOB5_17us.txt"), - apvBaselinesFile_tob6=cms.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TOB6_18us.txt") + apvBaselines_rBinEdges_TID = cms.untracked.vdouble(), + apvBaselines_rBinEdges_TEC = cms.untracked.vdouble(), + apvBaselinesFile_tib1=cms.untracked.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TIB1_11us.txt"), + apvBaselinesFile_tib2=cms.untracked.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TIB2_14us.txt"), + apvBaselinesFile_tib3=cms.untracked.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TIB3_15us.txt"), + apvBaselinesFile_tib4=cms.untracked.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TIB4_17us.txt"), + apvBaselinesFile_tob1=cms.untracked.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TOB1_9us.txt"), + apvBaselinesFile_tob2=cms.untracked.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TOB2_11us.txt"), + apvBaselinesFile_tob3=cms.untracked.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TOB3_14us.txt"), + apvBaselinesFile_tob4=cms.untracked.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TOB4_17us.txt"), + apvBaselinesFile_tob5=cms.untracked.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TOB5_21us.txt"), + apvBaselinesFile_tob6=cms.untracked.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TOB6_21us.txt") ) process.prod = cms.EDAnalyzer("SiStripApvSimulationParametersBuilder") From 8a64b37b58d92b4b9882e24b9f7a7e84ef53db20 Mon Sep 17 00:00:00 2001 From: mmusich Date: Fri, 20 Sep 2019 14:01:07 +0200 Subject: [PATCH 12/16] use StripSubdetector instead of SiStripSubdetector in PreMixingSiStripWorker --- .../SiStripDigitizer/plugins/PreMixingSiStripWorker.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/SimTracker/SiStripDigitizer/plugins/PreMixingSiStripWorker.cc b/SimTracker/SiStripDigitizer/plugins/PreMixingSiStripWorker.cc index 70b156cf1c625..20892e2fa874d 100644 --- a/SimTracker/SiStripDigitizer/plugins/PreMixingSiStripWorker.cc +++ b/SimTracker/SiStripDigitizer/plugins/PreMixingSiStripWorker.cc @@ -563,7 +563,7 @@ void PreMixingSiStripWorker::put(edm::Event& e, const uint32_t SubDet = DetId(detID).subdetId(); // Simulate APV response for each strip - if (SubDet == SiStripSubdetector::TIB || SubDet == SiStripSubdetector::TOB) { + if (SubDet == StripSubdetector::TIB || SubDet == StripSubdetector::TOB) { for (int strip = 0; strip < numStrips; ++strip) { if (detAmpl[strip] > 0) { // Convert charge from electrons to fC @@ -571,9 +571,9 @@ void PreMixingSiStripWorker::put(edm::Event& e, // Get APV baseline double baselineV = 0; - if (SubDet == SiStripSubdetector::TIB) { + if (SubDet == StripSubdetector::TIB) { baselineV = apvSimulationParametersHandle->sampleTIB(tTopo->tibLayer(detID), detSet_z, nTruePU, engine); - } else if (SubDet == SiStripSubdetector::TOB) { + } else if (SubDet == StripSubdetector::TOB) { baselineV = apvSimulationParametersHandle->sampleTOB(tTopo->tobLayer(detID), detSet_z, nTruePU, engine); } // Fitted parameters from G Hall/M Raymond From 006f48bc4a5a1ac2984f91b9038aca5e2a2f18a1 Mon Sep 17 00:00:00 2001 From: Emyr Date: Wed, 25 Sep 2019 16:20:26 +0100 Subject: [PATCH 13/16] Include TID and TEC in APV dynamic gain simulation --- .../plugins/SiStripDigitizerAlgorithm.cc | 75 ++++++++++--------- 1 file changed, 38 insertions(+), 37 deletions(-) diff --git a/SimTracker/SiStripDigitizer/plugins/SiStripDigitizerAlgorithm.cc b/SimTracker/SiStripDigitizer/plugins/SiStripDigitizerAlgorithm.cc index 4ff5fa38ec926..138df2ff2405f 100644 --- a/SimTracker/SiStripDigitizer/plugins/SiStripDigitizerAlgorithm.cc +++ b/SimTracker/SiStripDigitizer/plugins/SiStripDigitizerAlgorithm.cc @@ -328,6 +328,7 @@ void SiStripDigitizerAlgorithm::digitize(edm::DetSet& outdigi, LocalPoint localPos = topol->localPosition(0); GlobalPoint globalPos = det->surface().toGlobal(Local3DPoint(localPos.x(), localPos.y(), localPos.z())); float detSet_z = fabs(globalPos.z()); + float detSet_r = globalPos.perp(); // Store SCD, before APV sim outStripAmplitudes.reserve(numStrips); @@ -336,51 +337,51 @@ void SiStripDigitizerAlgorithm::digitize(edm::DetSet& outdigi, } // Simulate APV response for each strip - if (SubDet == StripSubdetector::TIB || SubDet == StripSubdetector::TOB) { - for (int strip = 0; strip < numStrips; ++strip) { - if (detAmpl[strip] > 0) { - // Convert charge from electrons to fC - double stripCharge = detAmpl[strip] * apv_fCPerElectron_; - - // Get APV baseline - double baselineV = 0; - if (SubDet == StripSubdetector::TIB) { - baselineV = apvSimulationParametersHandle->sampleTIB(tTopo->tibLayer(detId), detSet_z, nTruePU_, engine); - } else if (SubDet == StripSubdetector::TOB) { - baselineV = apvSimulationParametersHandle->sampleTOB(tTopo->tobLayer(detId), detSet_z, nTruePU_, engine); - } - // Store APV baseline for this strip - outStripAPVBaselines.emplace_back(SiStripRawDigi(baselineV)); - - // Fitted parameters from G Hall/M Raymond - double maxResponse = apv_maxResponse_; - double rate = apv_rate_; - - double outputChargeInADC = 0; - - if (baselineV < apv_maxResponse_) { - // Convert V0 into baseline charge - double baselineQ = -1.0 * rate * log(2 * maxResponse / (baselineV + maxResponse) - 1); - + for (int strip = 0; strip < numStrips; ++strip) { + if (detAmpl[strip] > 0) { + // Convert charge from electrons to fC + double stripCharge = detAmpl[strip] * apv_fCPerElectron_; + + // Get APV baseline + double baselineV = 0; + if (SubDet == StripSubdetector::TIB) { + baselineV = apvSimulationParametersHandle->sampleTIB(tTopo->tibLayer(detId), detSet_z, nTruePU_, engine); + } else if (SubDet == StripSubdetector::TOB) { + baselineV = apvSimulationParametersHandle->sampleTOB(tTopo->tobLayer(detId), detSet_z, nTruePU_, engine); + } else if (SubDet == StripSubdetector::TID) { + baselineV = apvSimulationParametersHandle->sampleTID(tTopo->tidWheel(detId), detSet_r, nTruePU_, engine); + } else if (SubDet == StripSubdetector::TEC) { + baselineV = apvSimulationParametersHandle->sampleTEC(tTopo->tecWheel(detId), detSet_r, nTruePU_, engine); + } + // Store APV baseline for this strip + outStripAPVBaselines.emplace_back(SiStripRawDigi(baselineV)); - // Add charge deposited in this BX - double newStripCharge = baselineQ + stripCharge; + // Fitted parameters from G Hall/M Raymond + double maxResponse = apv_maxResponse_; + double rate = apv_rate_; - // Apply APV response - double signalV = 2 * maxResponse / (1 + exp(-1.0 * newStripCharge / rate)) - maxResponse; - double gain = signalV - baselineV; + double outputChargeInADC = 0; + if (baselineV < apv_maxResponse_) { + // Convert V0 into baseline charge + double baselineQ = -1.0 * rate * log(2 * maxResponse / (baselineV + maxResponse) - 1); - // Convert gain (mV) to charge (assuming linear region of APV) and then to electrons - double outputCharge = gain / apv_mVPerQ_; - outputChargeInADC = outputCharge / apv_fCPerElectron_; - } + // Add charge deposited in this BX + double newStripCharge = baselineQ + stripCharge; + // Apply APV response + double signalV = 2 * maxResponse / (1 + exp(-1.0 * newStripCharge / rate)) - maxResponse; + double gain = signalV - baselineV; - // Output charge back to original container - detAmpl[strip] = outputChargeInADC; + // Convert gain (mV) to charge (assuming linear region of APV) and then to electrons + double outputCharge = gain / apv_mVPerQ_; + outputChargeInADC = outputCharge / apv_fCPerElectron_; } + + // Output charge back to original container + detAmpl[strip] = outputChargeInADC; } } + // Store SCD, after APV sim outStripAmplitudesPostAPV.reserve(numStrips); for (int strip = 0; strip < numStrips; ++strip) From a5fc51c2e4a96ec2d7f0c6dcc218e76e551b9143 Mon Sep 17 00:00:00 2001 From: Emyr Date: Fri, 27 Sep 2019 10:35:21 +0100 Subject: [PATCH 14/16] Include feature in premixing workflow --- .../plugins/PreMixingSiStripWorker.cc | 75 ++++++++++--------- 1 file changed, 39 insertions(+), 36 deletions(-) diff --git a/SimTracker/SiStripDigitizer/plugins/PreMixingSiStripWorker.cc b/SimTracker/SiStripDigitizer/plugins/PreMixingSiStripWorker.cc index 20892e2fa874d..d0e2f9e1cbd66 100644 --- a/SimTracker/SiStripDigitizer/plugins/PreMixingSiStripWorker.cc +++ b/SimTracker/SiStripDigitizer/plugins/PreMixingSiStripWorker.cc @@ -560,46 +560,49 @@ void PreMixingSiStripWorker::put(edm::Event& e, LocalPoint localPos = topol->localPosition(0); GlobalPoint globalPos = sgd->surface().toGlobal(Local3DPoint(localPos.x(), localPos.y(), localPos.z())); float detSet_z = fabs(globalPos.z()); + float detSet_r = globalPos.perp(); const uint32_t SubDet = DetId(detID).subdetId(); // Simulate APV response for each strip - if (SubDet == StripSubdetector::TIB || SubDet == StripSubdetector::TOB) { - for (int strip = 0; strip < numStrips; ++strip) { - if (detAmpl[strip] > 0) { - // Convert charge from electrons to fC - double stripCharge = detAmpl[strip] * apv_fCPerElectron_; - - // Get APV baseline - double baselineV = 0; - if (SubDet == StripSubdetector::TIB) { - baselineV = apvSimulationParametersHandle->sampleTIB(tTopo->tibLayer(detID), detSet_z, nTruePU, engine); - } else if (SubDet == StripSubdetector::TOB) { - baselineV = apvSimulationParametersHandle->sampleTOB(tTopo->tobLayer(detID), detSet_z, nTruePU, engine); - } - // Fitted parameters from G Hall/M Raymond - double maxResponse = apv_maxResponse_; - double rate = apv_rate_; - - double outputChargeInADC = 0; - if (baselineV < apv_maxResponse_) { - // Convert V0 into baseline charge - double baselineQ = -1.0 * rate * log(2 * maxResponse / (baselineV + maxResponse) - 1); - - // Add charge deposited in this BX - double newStripCharge = baselineQ + stripCharge; - - // Apply APV response - double signalV = 2 * maxResponse / (1 + exp(-1.0 * newStripCharge / rate)) - maxResponse; - double gain = signalV - baselineV; - - // Convert gain (mV) to charge (assuming linear region of APV) and then to electrons - double outputCharge = gain / apv_mVPerQ_; - outputChargeInADC = outputCharge / apv_fCPerElectron_; - } - - // Output charge back to original container - detAmpl[strip] = outputChargeInADC; + for (int strip = 0; strip < numStrips; ++strip) { + if (detAmpl[strip] > 0) { + // Convert charge from electrons to fC + double stripCharge = detAmpl[strip] * apv_fCPerElectron_; + + // Get APV baseline + double baselineV = 0; + if (SubDet == StripSubdetector::TIB) { + baselineV = apvSimulationParametersHandle->sampleTIB(tTopo->tibLayer(detID), detSet_z, nTruePU, engine); + } else if (SubDet == StripSubdetector::TOB) { + baselineV = apvSimulationParametersHandle->sampleTOB(tTopo->tobLayer(detID), detSet_z, nTruePU, engine); + } else if (SubDet == StripSubdetector::TID) { + baselineV = apvSimulationParametersHandle->sampleTID(tTopo->tidWheel(detID), detSet_r, nTruePU, engine); + } else if (SubDet == StripSubdetector::TEC) { + baselineV = apvSimulationParametersHandle->sampleTEC(tTopo->tecWheel(detID), detSet_r, nTruePU, engine); + } + // Fitted parameters from G Hall/M Raymond + double maxResponse = apv_maxResponse_; + double rate = apv_rate_; + + double outputChargeInADC = 0; + if (baselineV < apv_maxResponse_) { + // Convert V0 into baseline charge + double baselineQ = -1.0 * rate * log(2 * maxResponse / (baselineV + maxResponse) - 1); + + // Add charge deposited in this BX + double newStripCharge = baselineQ + stripCharge; + + // Apply APV response + double signalV = 2 * maxResponse / (1 + exp(-1.0 * newStripCharge / rate)) - maxResponse; + double gain = signalV - baselineV; + + // Convert gain (mV) to charge (assuming linear region of APV) and then to electrons + double outputCharge = gain / apv_mVPerQ_; + outputChargeInADC = outputCharge / apv_fCPerElectron_; } + + // Output charge back to original container + detAmpl[strip] = outputChargeInADC; } } } From 221f332a36944eaab8a6352338c0d19f112e2e8f Mon Sep 17 00:00:00 2001 From: Emyr Date: Fri, 27 Sep 2019 10:37:19 +0100 Subject: [PATCH 15/16] Add TID/TEC files to ESSource config --- ...StripApvSimulationParametersBuilder_cfg.py | 38 ++++++++++++------- 1 file changed, 25 insertions(+), 13 deletions(-) diff --git a/CondTools/SiStrip/test/SiStripApvSimulationParametersBuilder_cfg.py b/CondTools/SiStrip/test/SiStripApvSimulationParametersBuilder_cfg.py index 2170446816107..f5b76fa49c0fa 100644 --- a/CondTools/SiStrip/test/SiStripApvSimulationParametersBuilder_cfg.py +++ b/CondTools/SiStrip/test/SiStripApvSimulationParametersBuilder_cfg.py @@ -27,19 +27,31 @@ apvBaselines_minBaseline=cms.double(0.), apvBaselines_maxBaseline=cms.double(738.), apvBaselines_puBinEdges=cms.vdouble(0., 2., 4., 6., 8., 10., 12., 14., 16., 18., 20., 22., 24., 26., 28., 30., 32., 34., 36., 38., 40., 42., 44., 46., 48., 50.), - apvBaselines_zBinEdges=cms.vdouble(0., 25., 50., 75.), - apvBaselines_rBinEdges_TID = cms.untracked.vdouble(), - apvBaselines_rBinEdges_TEC = cms.untracked.vdouble(), - apvBaselinesFile_tib1=cms.untracked.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TIB1_11us.txt"), - apvBaselinesFile_tib2=cms.untracked.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TIB2_14us.txt"), - apvBaselinesFile_tib3=cms.untracked.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TIB3_15us.txt"), - apvBaselinesFile_tib4=cms.untracked.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TIB4_17us.txt"), - apvBaselinesFile_tob1=cms.untracked.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TOB1_9us.txt"), - apvBaselinesFile_tob2=cms.untracked.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TOB2_11us.txt"), - apvBaselinesFile_tob3=cms.untracked.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TOB3_14us.txt"), - apvBaselinesFile_tob4=cms.untracked.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TOB4_17us.txt"), - apvBaselinesFile_tob5=cms.untracked.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TOB5_21us.txt"), - apvBaselinesFile_tob6=cms.untracked.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TOB6_21us.txt") + apvBaselines_zBinEdges=cms.vdouble(0., 10., 20., 30., 40., 50., 60., 70., 90.), + apvBaselines_rBinEdges_TID=cms.vdouble(0., 10., 20., 30., 40., 50., 60., 70., 90.), + apvBaselines_rBinEdges_TEC=cms.vdouble(0., 10., 20., 30., 40., 50., 60., 70., 90.), + apvBaselinesFile_tib1=cms.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TIB1_11us.txt"), + apvBaselinesFile_tib2=cms.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TIB2_14us.txt"), + apvBaselinesFile_tib3=cms.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TIB3_15us.txt"), + apvBaselinesFile_tib4=cms.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TIB4_18us.txt"), + apvBaselinesFile_tob1=cms.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TOB1_10us.txt"), + apvBaselinesFile_tob2=cms.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TOB2_12us.txt"), + apvBaselinesFile_tob3=cms.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TOB3_15us.txt"), + apvBaselinesFile_tob4=cms.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TOB4_19us.txt"), + apvBaselinesFile_tob5=cms.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TOB5_24us.txt"), + apvBaselinesFile_tob6=cms.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TOB6_25us.txt"), + apvBaselinesFile_tid1=cms.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TID1_9us.txt"), + apvBaselinesFile_tid2=cms.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TID2_9us.txt"), + apvBaselinesFile_tid3=cms.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TID3_9us.txt"), + apvBaselinesFile_tec1=cms.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TEC1_10us.txt"), + apvBaselinesFile_tec2=cms.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TEC2_11us.txt"), + apvBaselinesFile_tec3=cms.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TEC3_11us.txt"), + apvBaselinesFile_tec4=cms.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TEC4_13us.txt"), + apvBaselinesFile_tec5=cms.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TEC5_14us.txt"), + apvBaselinesFile_tec6=cms.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TEC6_15us.txt"), + apvBaselinesFile_tec7=cms.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TEC7_16us.txt"), + apvBaselinesFile_tec8=cms.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TEC8_16us.txt"), + apvBaselinesFile_tec9=cms.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TEC9_16us.txt") ) process.prod = cms.EDAnalyzer("SiStripApvSimulationParametersBuilder") From 7198b8f583a044f283429ab1293f21f9841c4f2a Mon Sep 17 00:00:00 2001 From: Emyr Date: Fri, 27 Sep 2019 15:45:16 +0100 Subject: [PATCH 16/16] Make parameters untracked. --- ...iStripApvSimulationParametersESProducer.cc | 10 ++-- ...StripApvSimulationParametersBuilder_cfg.py | 58 +++++++++---------- 2 files changed, 34 insertions(+), 34 deletions(-) diff --git a/CalibTracker/SiStripESProducers/plugins/real/SiStripApvSimulationParametersESProducer.cc b/CalibTracker/SiStripESProducers/plugins/real/SiStripApvSimulationParametersESProducer.cc index 452ea8d630945..696ab897036bb 100644 --- a/CalibTracker/SiStripESProducers/plugins/real/SiStripApvSimulationParametersESProducer.cc +++ b/CalibTracker/SiStripESProducers/plugins/real/SiStripApvSimulationParametersESProducer.cc @@ -36,15 +36,15 @@ class SiStripApvSimulationParametersESSource : public edm::ESProducer, public ed }; SiStripApvSimulationParametersESSource::SiStripApvSimulationParametersESSource(const edm::ParameterSet& conf) - : baseline_nBins_(conf.getParameter("apvBaselines_nBinsPerBaseline")), - baseline_min_(conf.getParameter("apvBaselines_minBaseline")), - baseline_max_(conf.getParameter("apvBaselines_maxBaseline")) { + : baseline_nBins_(conf.getUntrackedParameter("apvBaselines_nBinsPerBaseline")), + baseline_min_(conf.getUntrackedParameter("apvBaselines_minBaseline")), + baseline_max_(conf.getUntrackedParameter("apvBaselines_maxBaseline")) { setWhatProduced(this); findingRecord(); - for (const auto x : conf.getParameter>("apvBaselines_puBinEdges")) { + for (const auto x : conf.getUntrackedParameter>("apvBaselines_puBinEdges")) { puBinEdges_.push_back(x); } - for (const auto x : conf.getParameter>("apvBaselines_zBinEdges")) { + for (const auto x : conf.getUntrackedParameter>("apvBaselines_zBinEdges")) { zBinEdges_.push_back(x); } for (const auto x : conf.getUntrackedParameter>("apvBaselines_rBinEdges_TID")) { diff --git a/CondTools/SiStrip/test/SiStripApvSimulationParametersBuilder_cfg.py b/CondTools/SiStrip/test/SiStripApvSimulationParametersBuilder_cfg.py index f5b76fa49c0fa..922f8c65f92ed 100644 --- a/CondTools/SiStrip/test/SiStripApvSimulationParametersBuilder_cfg.py +++ b/CondTools/SiStrip/test/SiStripApvSimulationParametersBuilder_cfg.py @@ -23,35 +23,35 @@ ) process.apvSimParam = cms.ESSource("SiStripApvSimulationParametersESSource", - apvBaselines_nBinsPerBaseline=cms.uint32(82), - apvBaselines_minBaseline=cms.double(0.), - apvBaselines_maxBaseline=cms.double(738.), - apvBaselines_puBinEdges=cms.vdouble(0., 2., 4., 6., 8., 10., 12., 14., 16., 18., 20., 22., 24., 26., 28., 30., 32., 34., 36., 38., 40., 42., 44., 46., 48., 50.), - apvBaselines_zBinEdges=cms.vdouble(0., 10., 20., 30., 40., 50., 60., 70., 90.), - apvBaselines_rBinEdges_TID=cms.vdouble(0., 10., 20., 30., 40., 50., 60., 70., 90.), - apvBaselines_rBinEdges_TEC=cms.vdouble(0., 10., 20., 30., 40., 50., 60., 70., 90.), - apvBaselinesFile_tib1=cms.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TIB1_11us.txt"), - apvBaselinesFile_tib2=cms.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TIB2_14us.txt"), - apvBaselinesFile_tib3=cms.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TIB3_15us.txt"), - apvBaselinesFile_tib4=cms.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TIB4_18us.txt"), - apvBaselinesFile_tob1=cms.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TOB1_10us.txt"), - apvBaselinesFile_tob2=cms.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TOB2_12us.txt"), - apvBaselinesFile_tob3=cms.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TOB3_15us.txt"), - apvBaselinesFile_tob4=cms.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TOB4_19us.txt"), - apvBaselinesFile_tob5=cms.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TOB5_24us.txt"), - apvBaselinesFile_tob6=cms.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TOB6_25us.txt"), - apvBaselinesFile_tid1=cms.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TID1_9us.txt"), - apvBaselinesFile_tid2=cms.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TID2_9us.txt"), - apvBaselinesFile_tid3=cms.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TID3_9us.txt"), - apvBaselinesFile_tec1=cms.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TEC1_10us.txt"), - apvBaselinesFile_tec2=cms.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TEC2_11us.txt"), - apvBaselinesFile_tec3=cms.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TEC3_11us.txt"), - apvBaselinesFile_tec4=cms.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TEC4_13us.txt"), - apvBaselinesFile_tec5=cms.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TEC5_14us.txt"), - apvBaselinesFile_tec6=cms.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TEC6_15us.txt"), - apvBaselinesFile_tec7=cms.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TEC7_16us.txt"), - apvBaselinesFile_tec8=cms.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TEC8_16us.txt"), - apvBaselinesFile_tec9=cms.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TEC9_16us.txt") + apvBaselines_nBinsPerBaseline=cms.untracked.uint32(82), + apvBaselines_minBaseline=cms.untracked.double(0.), + apvBaselines_maxBaseline=cms.untracked.double(738.), + apvBaselines_puBinEdges=cms.untracked.vdouble(0., 2., 4., 6., 8., 10., 12., 14., 16., 18., 20., 22., 24., 26., 28., 30., 32., 34., 36., 38., 40., 42., 44., 46., 48., 50.), + apvBaselines_zBinEdges=cms.untracked.vdouble(0., 10., 20., 30., 40., 50., 60., 70., 90.), + apvBaselines_rBinEdges_TID=cms.untracked.vdouble(0., 10., 20., 30., 40., 50., 60., 70., 90.), + apvBaselines_rBinEdges_TEC=cms.untracked.vdouble(0., 10., 20., 30., 40., 50., 60., 70., 90.), + apvBaselinesFile_tib1=cms.untracked.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TIB1_11us.txt"), + apvBaselinesFile_tib2=cms.untracked.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TIB2_14us.txt"), + apvBaselinesFile_tib3=cms.untracked.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TIB3_15us.txt"), + apvBaselinesFile_tib4=cms.untracked.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TIB4_18us.txt"), + apvBaselinesFile_tob1=cms.untracked.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TOB1_10us.txt"), + apvBaselinesFile_tob2=cms.untracked.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TOB2_12us.txt"), + apvBaselinesFile_tob3=cms.untracked.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TOB3_15us.txt"), + apvBaselinesFile_tob4=cms.untracked.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TOB4_19us.txt"), + apvBaselinesFile_tob5=cms.untracked.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TOB5_24us.txt"), + apvBaselinesFile_tob6=cms.untracked.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TOB6_25us.txt"), + apvBaselinesFile_tid1=cms.untracked.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TID1_9us.txt"), + apvBaselinesFile_tid2=cms.untracked.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TID2_9us.txt"), + apvBaselinesFile_tid3=cms.untracked.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TID3_9us.txt"), + apvBaselinesFile_tec1=cms.untracked.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TEC1_10us.txt"), + apvBaselinesFile_tec2=cms.untracked.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TEC2_11us.txt"), + apvBaselinesFile_tec3=cms.untracked.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TEC3_11us.txt"), + apvBaselinesFile_tec4=cms.untracked.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TEC4_13us.txt"), + apvBaselinesFile_tec5=cms.untracked.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TEC5_14us.txt"), + apvBaselinesFile_tec6=cms.untracked.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TEC6_15us.txt"), + apvBaselinesFile_tec7=cms.untracked.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TEC7_16us.txt"), + apvBaselinesFile_tec8=cms.untracked.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TEC8_16us.txt"), + apvBaselinesFile_tec9=cms.untracked.FileInPath("SimTracker/SiStripDigitizer/data/APVBaselines_TEC9_16us.txt") ) process.prod = cms.EDAnalyzer("SiStripApvSimulationParametersBuilder")