diff --git a/Configuration/ProcessModifiers/python/fastSimPU_cff.py b/Configuration/ProcessModifiers/python/fastSimPU_cff.py new file mode 100644 index 0000000000000..97bfd16180c54 --- /dev/null +++ b/Configuration/ProcessModifiers/python/fastSimPU_cff.py @@ -0,0 +1,3 @@ +import FWCore.ParameterSet.Config as cms + +fastSimPU = cms.Modifier() diff --git a/Configuration/PyReleaseValidation/README.md b/Configuration/PyReleaseValidation/README.md index 3448afa7351bf..3ac405fd0b0f9 100644 --- a/Configuration/PyReleaseValidation/README.md +++ b/Configuration/PyReleaseValidation/README.md @@ -93,6 +93,8 @@ The offsets currently in use are: * 0.634: ECAL phase2 Trigger Primitive + component-method based digis * 0.635: ECAL phase2 Trigger Primitive + component-method based finely-sampled waveforms * 0.91: Track DNN modifier +* 0.95: Hybrid PU (FullSim signal + FastSim PU) stage2 +* 0.96: Hybrid PU (FullSim signal + FastSim PU) stage1+stage2 * 0.97: Premixing stage1 * 0.98: Premixing stage2 * 0.99: Premixing stage1+stage2 diff --git a/Configuration/PyReleaseValidation/python/WorkFlowRunner.py b/Configuration/PyReleaseValidation/python/WorkFlowRunner.py index 56a101132e6d2..53cc77d8dcc63 100644 --- a/Configuration/PyReleaseValidation/python/WorkFlowRunner.py +++ b/Configuration/PyReleaseValidation/python/WorkFlowRunner.py @@ -175,8 +175,9 @@ def closeCmd(i,ID): if self.noRun: cmd +=' --no_exec' # in case previous step used DAS query (either filelist of das:) - # not to be applied for premixing stage1 to allow combiend stage1+stage2 workflow - if inFile and not 'premix_stage1' in cmd: + # not to be applied for premixing stage1 to allow combined stage1+stage2 workflow + # & similar for HybridPU combined workflow + if inFile and not 'premix_stage1' in cmd and not 'FASTSIM' in cmd: cmd += ' --filein '+inFile inFile=None if lumiRangeFile: #DAS query can also restrict lumi range @@ -189,12 +190,13 @@ def closeCmd(i,ID): else: # Disable input for premix stage1 to allow combined stage1+stage2 workflow # Disable input for premix stage2 in FastSim to allow combined stage1+stage2 workflow (in FS, stage2 does also GEN) + # & similar for HybridPU combined workflow # Ugly hack but works extension = '.root' if '--rntuple_out' in cmd: extension = '.rntpl' outputExtensionForStep[istep] = extension - if istep!=1 and not '--filein' in cmd and not 'premix_stage1' in cmd and not ("--fast" in cmd and "premix_stage2" in cmd): + if istep!=1 and not '--filein' in cmd and not 'premix_stage1' in cmd and not ("--fast" in cmd and "premix_stage2" in cmd) and not 'FASTSIM' in cmd: steps = cmd.split("-s ")[1].split(" ")[0] ## relying on the syntax: cmsDriver -s STEPS --otherFlags if "ALCA" not in steps: cmd+=' --filein file:step%s%s '%(istep-1,extension) diff --git a/Configuration/PyReleaseValidation/python/relval_steps.py b/Configuration/PyReleaseValidation/python/relval_steps.py index c7b907d68dbc2..1e07755e28e80 100644 --- a/Configuration/PyReleaseValidation/python/relval_steps.py +++ b/Configuration/PyReleaseValidation/python/relval_steps.py @@ -5031,6 +5031,14 @@ def gen2024HiMix(fragment,howMuch): steps[k+'INPUT']={'INPUT':InputInfo(dataSet='/RelVal'+info.dataset+'/%s/GEN-SIM'%(baseDataSetReleaseBetter[s],),location='STD')} else: #For FastSim to recycle GEN steps[k+'INPUT']={'INPUT':InputInfo(dataSet='/RelVal'+info.dataset+'/%s/GEN'%(baseDataSetReleaseBetter[s],),location='STD')} + # this condition is checked here to avoid skipping the creation of default steps for other fragments + if 'HybridPU' in step: + # minbias fastsim for PU mixing + if not 'MinBias_14TeV' in frag: + continue + stepKey = 'HYBRID_'+key+'_'+step + howMuch = Kby(100,100) + steps[stepKey]=merge([ {'--evt_type':frag},howMuch,upgradeStepDict[step][key]]) else: for key in [key for year in upgradeKeys for key in upgradeKeys[year]]: k=step+'_'+key diff --git a/Configuration/PyReleaseValidation/python/relval_upgrade.py b/Configuration/PyReleaseValidation/python/relval_upgrade.py index 9c1fed0fe384e..590804583b51b 100644 --- a/Configuration/PyReleaseValidation/python/relval_upgrade.py +++ b/Configuration/PyReleaseValidation/python/relval_upgrade.py @@ -79,6 +79,14 @@ def notForGenOnly(key,specialType): if 'S2' in specialType: stepList[specialType].append(stepMade) # replace for s1 else: stepList[specialType][-1] = stepMade + # similar hack for fastpu + if 'HybridPU' in specialType: + if 'GenSim' in step: + s = step.replace('GenSim','GenSimFS')+'PU' # later processing requires to have PU here + if step in specialWF.PU: + stepMade = stepMaker(key,'HYBRID',s,specialWF.suffix) + # append for combined + if 'S2' in specialType: stepList[specialType].append(stepMade) else: stepList[specialType].append(stepMaker(key,frag[:-4],step,'')) diff --git a/Configuration/PyReleaseValidation/python/upgradeWorkflowComponents.py b/Configuration/PyReleaseValidation/python/upgradeWorkflowComponents.py index ab8a766fd070d..54835f6e79b21 100644 --- a/Configuration/PyReleaseValidation/python/upgradeWorkflowComponents.py +++ b/Configuration/PyReleaseValidation/python/upgradeWorkflowComponents.py @@ -2986,6 +2986,82 @@ def condition(self, fragment, stepList, key, hasHarvest): offset = 0.9921, ) +class UpgradeWorkflowHybridPU(UpgradeWorkflow): + def setup_(self, step, stepName, stepDict, k, properties): + # just copy steps + stepDict[stepName][k] = merge([stepDict[step][k]]) + def setupPU_(self, step, stepName, stepDict, k, properties): + # make new step for S1 + # this gets inserted in relval_upgrade.py + if "GenSim" in stepName: + # go back to non-PU step version + d = merge([stepDict[self.getStepName(step)][k]]) + stepNameS1 = stepName.replace('GenSim','GenSimFS') + if not stepNameS1 in stepDict: stepDict[stepNameS1] = {} + stepDict[stepNameS1][k] = merge([{ + '--fast': '', + '--era': stepDict[stepName][k]['--era']+'_FastSim', + '--eventcontent': 'FASTPU', + '--processName': 'FASTSIM', + }, d]) + else: + # include modifier in all subsequent steps in case any of them use PU replay + if "--procModifiers" in stepDict[stepName][k]: + stepDict[stepName][k]["--procModifiers"] += ",fastSimPU" + else: + stepDict[stepName][k]["--procModifiers"] = "fastSimPU" + + if "Digi" in stepName: + stepDict[stepName][k] = merge([digiPremixLocalPileup, stepDict[stepName][k]]) + elif 'S1S2' in self.suffix: + # increment inputs for subsequent steps in combined case + # also reset pileup input + digiPremixLocalPileupTmp = deepcopy(digiPremixLocalPileup) + filein = stepDict[stepName][k].get("--filein","") + m = re.search("step(?P\\d+)", filein) + if m: + digiPremixLocalPileupTmp['--filein'] = filein.replace(m.group(), "step%d"%(int(m.group("ind"))+1)) + else: + digiPremixLocalPileupTmp.pop('--filein') + stepDict[stepName][k] = merge([digiPremixLocalPileupTmp, stepDict[stepName][k]]) + def condition(self, fragment, stepList, key, hasHarvest): + return (fragment=='TTbar_14TeV' and 'PU' in key and key.startswith('202') and not 'FS' in key) +# stage1 is just FastSim MinBias, no separate workflow needed +# HybridPU stage2 +upgradeWFs['HybridPUS2'] = UpgradeWorkflowHybridPU( + steps = [], + PU = [ + 'Digi', + 'DigiTrigger', + ], + suffix = '_HybridPUS2', + offset = 0.95, +) +# HybridPU combined stage1+stage2 +upgradeWFs['HybridPUS1S2'] = UpgradeWorkflowHybridPU( + steps = [], + PU = [ + 'GenSim', + 'GenSimHLBeamSpot', + 'GenSimHLBeamSpot14', + 'Digi', + 'DigiTrigger', + 'RecoLocal', + 'Reco', + 'RecoFakeHLT', + 'RecoGlobal', + 'RecoGlobalFakeHLT', + 'RecoNano', + 'RecoNanoFakeHLT', + 'Nano', + 'HARVESTNano', + 'HARVESTNanoFakeHLT', + 'ALCA', + ], + suffix = '_HybridPUS1S2', + offset = 0.96, +) + class UpgradeWorkflow_Run3FStrackingOnly(UpgradeWorkflow): def setup_(self, step, stepName, stepDict, k, properties): if 'HARVESTFastRun3' in step: diff --git a/DataFormats/SoATemplate/interface/SoACommon.h b/DataFormats/SoATemplate/interface/SoACommon.h index a0f598048b0c4..16787b21b97f4 100644 --- a/DataFormats/SoATemplate/interface/SoACommon.h +++ b/DataFormats/SoATemplate/interface/SoACommon.h @@ -813,4 +813,298 @@ SOA_HOST_ONLY std::ostream& operator<<(std::ostream& os, const SOA& soa) { return os; } +namespace cms::soa { + // Helper function for streaming column + template + void printColumn(std::ostream& soa_impl_os, + const cms::soa::SoAConstParametersImpl& column, + std::string_view name, + cms::soa::byte_size_type& soa_impl_offset, + cms::soa::size_type, + cms::soa::byte_size_type alignment) { + soa_impl_os << " Scalar " << name << " at offset " << soa_impl_offset << " has size " << sizeof(T) + << " and padding " << ((sizeof(T) - 1) / alignment + 1) * alignment - sizeof(T) << std::endl; + soa_impl_offset += ((sizeof(T) - 1) / alignment + 1) * alignment; + } + + template + void printColumn(std::ostream& soa_impl_os, + const cms::soa::SoAConstParametersImpl& column, + std::string_view name, + cms::soa::byte_size_type& soa_impl_offset, + cms::soa::size_type elements, + cms::soa::byte_size_type alignment) { + soa_impl_os << " Column " << name << " at offset " << soa_impl_offset << " has size " << sizeof(T) * elements + << " and padding " << cms::soa::alignSize(elements * sizeof(T), alignment) - (elements * sizeof(T)) + << std::endl; + soa_impl_offset += cms::soa::alignSize(elements * sizeof(T), alignment); + } + + template + void printColumn(std::ostream& soa_impl_os, + const cms::soa::SoAConstParametersImpl& column, + std::string_view name, + cms::soa::byte_size_type& soa_impl_offset, + cms::soa::size_type elements, + cms::soa::byte_size_type alignment) { + soa_impl_os << " Eigen value " << name << " at offset " << soa_impl_offset << " has dimension " + << "(" << T::RowsAtCompileTime << " x " << T::ColsAtCompileTime << ")" + << " and per column size " << sizeof(T::Scalar) * elements << " and padding " + << cms::soa::alignSize(elements * sizeof(T::Scalar), alignment) - (elements * sizeof(T::Scalar)) + << std::endl; + soa_impl_offset += + cms::soa::alignSize(elements * sizeof(T::Scalar), alignment) * T::RowsAtCompileTime * T::ColsAtCompileTime; + } + + // Helper functions for accumulating column elements + template + struct AccumulateSoAElements; + + template + struct AccumulateSoAElements> { + cms::soa::byte_size_type operator()(cms::soa::size_type, cms::soa::byte_size_type alignment) const { + return cms::soa::alignSize(sizeof(T), alignment); + } + }; + + template + struct AccumulateSoAElements> { + cms::soa::byte_size_type operator()(cms::soa::size_type elements, cms::soa::byte_size_type alignment) const { + return cms::soa::alignSize(elements * sizeof(T), alignment); + } + }; + + template + struct AccumulateSoAElements> { + cms::soa::byte_size_type operator()(cms::soa::size_type elements, cms::soa::byte_size_type alignment) const { + return cms::soa::alignSize(elements * sizeof(typename T::Scalar), alignment) * T::RowsAtCompileTime * + T::ColsAtCompileTime; + } + }; + + // Helper functions for computing the pitch of each column + template + cms::soa::byte_size_type computePitch(const cms::soa::SoAParametersImpl& column, + cms::soa::byte_size_type alignment, + cms::soa::size_type elements) { + return cms::soa::alignSize(sizeof(T), alignment); + } + + template + cms::soa::byte_size_type computePitch(const cms::soa::SoAParametersImpl& column, + cms::soa::byte_size_type alignment, + cms::soa::size_type elements) { + return cms::soa::alignSize(elements * sizeof(T), alignment); + } + + template + cms::soa::byte_size_type computePitch(const cms::soa::SoAParametersImpl& column, + cms::soa::byte_size_type alignment, + cms::soa::size_type elements) { + return cms::soa::alignSize(elements * sizeof(typename T::Scalar), alignment) * T::RowsAtCompileTime * + T::ColsAtCompileTime; + } + + // Helper type trait for obtaining a span type for a column + template + struct getSpanType; + + template + struct getSpanType> { + using type = std::span; + }; + + template + struct getSpanType> { + using type = std::span; + }; + + template + struct getSpanType> { + using type = std::span; + }; + + template + struct getSpanType> { + using type = std::span; + }; + + template + struct getSpanType> { + using type = std::span; + }; + + template + struct getSpanType> { + using type = std::span; + }; + + // Helper type trait for obtaining a const-span type for a column + template + struct getConstSpanType; + + template + struct getConstSpanType> { + using type = std::span, 1>; + }; + + template + struct getConstSpanType> { + using type = std::span>; + }; + + template + struct getConstSpanType> { + using type = std::span>; + }; + + template + struct getConstSpanType> { + using type = std::span, 1>; + }; + + template + struct getConstSpanType> { + using type = std::span>; + }; + + template + struct getConstSpanType> { + using type = std::span>; + }; + + // Helper functions for constructing a span from a column + template + auto assignSpanToColumn(const cms::soa::SoAParametersImpl& column, + cms::soa::size_type, + cms::soa::byte_size_type alignment) { + return std::span(column.addr_, 1); + } + + template + auto assignSpanToColumn(const cms::soa::SoAParametersImpl& column, + cms::soa::size_type elements, + cms::soa::byte_size_type alignment) { + return std::span(column.addr_, elements); + } + + template + auto assignSpanToColumn(const cms::soa::SoAParametersImpl& column, + cms::soa::size_type elements, + cms::soa::byte_size_type alignment) { + return std::span(column.addr_, + cms::soa::alignSize(elements * sizeof(typename T::Scalar), alignment) * T::RowsAtCompileTime * + T::ColsAtCompileTime / sizeof(typename T::Scalar)); + } + + template + auto assignSpanToColumn(const cms::soa::SoAConstParametersImpl& column, + cms::soa::size_type elements, + cms::soa::byte_size_type alignment) { + return std::span(column.addr_, 1); + } + + template + auto assignSpanToColumn(const cms::soa::SoAConstParametersImpl& column, + cms::soa::size_type elements, + cms::soa::byte_size_type alignment) { + return std::span(column.addr_, elements); + } + + template + auto assignSpanToColumn(const cms::soa::SoAConstParametersImpl& column, + cms::soa::size_type elements, + cms::soa::byte_size_type alignment) { + return std::span(column.addr_, + cms::soa::alignSize(elements * sizeof(typename T::Scalar), alignment) * T::RowsAtCompileTime * + T::ColsAtCompileTime / sizeof(typename T::Scalar)); + } + + // TODO: This function can be used when the layout will contain ColumnTypes as members + // Helper functions for memcpy from file column + // template + // void memcpyColumnFromFile(cms::soa::SoAParametersImpl& destColumn, + // const cms::soa::SoAParametersImpl& originColumn) { + // memcpy(destColumn.addr_, originColumn.addr_, sizeof(T)); + // } + + // template + // void memcpyColumnFromFile(cms::soa::SoAParametersImpl& destColumn, + // const cms::soa::SoAParametersImpl& originColumn) { + // memcpy(destColumn.addr_, originColumn.addr_, originColumn.elements_ * sizeof(T)); + // } + + // template + // void memcpyColumnFromFile(cms::soa::SoAParametersImpl& destColumn, + // const cms::soa::SoAParametersImpl& originColumn) { + // memcpy(destColumn.addr_, + // originColumn.addr_, + // sizeof(T::Scalar) * destColumn.ElementsWithPadding); + // } + + // TODO: This function can be used when the layout will contain ColumnTypes as members + // // Helper functions for memcpy from view column + // template + // void memcpyColumnFromView(cms::soa::SoAParametersImpl& destColumn, + // const cms::soa::SoAParametersImpl& originColumn) { + // memcpy(destColumn.addr_, originColumn.addr_, sizeof(T)); + // } + + // template + // void memcpyColumnFromView(cms::soa::SoAParametersImpl& destColumn, + // const cms::soa::SoAParametersImpl& originColumn) { + // memcpy(destColumn.addr_, originColumn.addr_, originColumn.elements_ * sizeof(T)); + // } + + // template + // void memcpyColumnFromView(cms::soa::SoAParametersImpl& destColumn, + // const cms::soa::SoAParametersImpl& originColumn) { + // for (auto i = 0u; i < T::RowsAtCompileTime * T::ColsAtCompileTime; ++i) { + // memcpy(destColumn.addr_ + i * destColumn.stride_, + // originColumn.addr_, + // sizeof(T::Scalar) * destColumn.stride_ * T::RowsAtCompileTime * T::ColsAtCompileTime); + // } + // } + + // TODO: This function can be used when the layout will contain ColumnTypes as members + // Helper functions for computing the location of columns in memory + // computeColumnPosition(BOOST_PP_CAT(typename Metadata::ParametersTypeOf_, NAME)(), BOOST_PP_CAT(NAME, _), _soa_impl_curMem, alignment, elements_); + //template + //void computeColumnPosition(cms::soa::SoAParametersImpl&& column, + // T*& columnAddr, + // std::byte*& currMem, + // cms::soa::byte_size_type alignment, + // cms::soa::size_type elements) { + // using ColumnType = decltype(column); + // //column = ColumnType(reinterpret_cast(currMem), elements); + // columnAddr = reinterpret_cast(currMem); + // currMem += cms::soa::alignSize(sizeof(T), alignment); + //} + + //template + //void computeColumnPosition(cms::soa::SoAParametersImpl&& column, + // T*& columnAddr, + // std::byte*& currMem, + // cms::soa::byte_size_type alignment, + // cms::soa::size_type elements) { + // using ColumnType = decltype(column); + // //column = ColumnType(reinterpret_cast(currMem), elements); + // columnAddr = reinterpret_cast(currMem); + // currMem += cms::soa::alignSize(elements * sizeof(T), alignment); + //} + + //template + //void computeColumnPosition(cms::soa::SoAParametersImpl&& column, + // typename T::Scalar*& columnAddr, + // std::byte*& currMem, + // cms::soa::byte_size_type alignment, + // cms::soa::size_type elements) { + // using ColumnType = decltype(column); + // //column = ColumnType(reinterpret_cast(currMem), + // columnAddr = reinterpret_cast(currMem); + // currMem += cms::soa::alignSize(elements * sizeof(typename T::Scalar), alignment) * T::RowsAtCompileTime * + // T::ColsAtCompileTime; + //} +} // namespace cms::soa + #endif // DataFormats_SoATemplate_interface_SoACommon_h diff --git a/DataFormats/SoATemplate/interface/SoALayout.h b/DataFormats/SoATemplate/interface/SoALayout.h index d157e555ecb4b..cde0b08a1e4e8 100644 --- a/DataFormats/SoATemplate/interface/SoALayout.h +++ b/DataFormats/SoATemplate/interface/SoALayout.h @@ -105,34 +105,7 @@ namespace cms::soa { // clang-format off #define _DECLARE_SOA_STREAM_INFO_IMPL(VALUE_TYPE, CPP_TYPE, NAME, ARGS) \ - _SWITCH_ON_TYPE( \ - VALUE_TYPE, \ - /* Dump scalar */ \ - _soa_impl_os << " Scalar " BOOST_PP_STRINGIZE(NAME) " at offset " << _soa_impl_offset \ - << " has size " << sizeof(CPP_TYPE) \ - << " and padding " << ((sizeof(CPP_TYPE) - 1) / alignment + 1) * alignment - sizeof(CPP_TYPE) \ - << std::endl; \ - _soa_impl_offset += ((sizeof(CPP_TYPE) - 1) / alignment + 1) * alignment; \ - , \ - /* Dump column */ \ - _soa_impl_os << " Column " BOOST_PP_STRINGIZE(NAME) " at offset " << _soa_impl_offset << " has size " \ - << sizeof(CPP_TYPE) * elements_ << " and padding " \ - << cms::soa::alignSize(elements_ * sizeof(CPP_TYPE), alignment) - (elements_ * sizeof(CPP_TYPE)) \ - << std::endl; \ - _soa_impl_offset += cms::soa::alignSize(elements_ * sizeof(CPP_TYPE), alignment); \ - , \ - /* Dump Eigen column */ \ - _soa_impl_os << " Eigen value " BOOST_PP_STRINGIZE(NAME) " at offset " << _soa_impl_offset << " has dimension " \ - << "(" << CPP_TYPE::RowsAtCompileTime << " x " << CPP_TYPE::ColsAtCompileTime << ")" \ - << " and per column size " \ - << sizeof(CPP_TYPE::Scalar) * elements_ \ - << " and padding " \ - << cms::soa::alignSize(elements_ * sizeof(CPP_TYPE::Scalar), alignment) \ - - (elements_ * sizeof(CPP_TYPE::Scalar)) \ - << std::endl; \ - _soa_impl_offset += cms::soa::alignSize(elements_ * sizeof(CPP_TYPE::Scalar), alignment) \ - * CPP_TYPE::RowsAtCompileTime * CPP_TYPE::ColsAtCompileTime; \ - ) + cms::soa::printColumn(_soa_impl_os, ConstView::BOOST_PP_CAT(NAME, Parameters_), BOOST_PP_STRINGIZE(NAME), _soa_impl_offset, elements_, alignment); // clang-format on #define _DECLARE_SOA_STREAM_INFO(R, DATA, TYPE_NAME) \ @@ -147,23 +120,12 @@ namespace cms::soa { #define _DEFINE_METADATA_MEMBERS_IMPL(VALUE_TYPE, CPP_TYPE, NAME, ARGS) \ _SWITCH_ON_TYPE(VALUE_TYPE, \ /* Scalar */ \ - byte_size_type BOOST_PP_CAT(NAME, Pitch()) const { \ - return cms::soa::alignSize(sizeof(CPP_TYPE), ParentClass::alignment); \ - } \ constexpr static cms::soa::SoAColumnType BOOST_PP_CAT(ColumnTypeOf_, NAME) = cms::soa::SoAColumnType::scalar; \ - SOA_HOST_DEVICE SOA_INLINE \ - CPP_TYPE const* BOOST_PP_CAT(addressOf_, NAME)() const { \ - return parent_.metadata().BOOST_PP_CAT(parametersOf_, NAME)().addr_; \ - } \ using BOOST_PP_CAT(ParametersTypeOf_, NAME) = \ cms::soa::SoAParameters_ColumnType::DataType; \ SOA_HOST_DEVICE SOA_INLINE \ BOOST_PP_CAT(ParametersTypeOf_, NAME) BOOST_PP_CAT(parametersOf_, NAME)() const { \ return BOOST_PP_CAT(ParametersTypeOf_, NAME) (parent_.BOOST_PP_CAT(NAME, _)); \ - } \ - SOA_HOST_DEVICE SOA_INLINE \ - CPP_TYPE* BOOST_PP_CAT(addressOf_, NAME)() { \ - return parent_.metadata().BOOST_PP_CAT(parametersOf_, NAME)().addr_; \ }, \ /* Column */ \ using BOOST_PP_CAT(ParametersTypeOf_, NAME) = \ @@ -172,18 +134,6 @@ namespace cms::soa { BOOST_PP_CAT(ParametersTypeOf_, NAME) BOOST_PP_CAT(parametersOf_, NAME)() const { \ return BOOST_PP_CAT(ParametersTypeOf_, NAME) (parent_.BOOST_PP_CAT(NAME, _)); \ } \ - SOA_HOST_DEVICE SOA_INLINE \ - CPP_TYPE const* BOOST_PP_CAT(addressOf_, NAME)() const { \ - return parent_.metadata().BOOST_PP_CAT(parametersOf_, NAME)().addr_; \ - } \ - SOA_HOST_DEVICE SOA_INLINE \ - CPP_TYPE* BOOST_PP_CAT(addressOf_, NAME)() { \ - return parent_.metadata().BOOST_PP_CAT(parametersOf_, NAME)().addr_; \ - } \ - SOA_HOST_DEVICE SOA_INLINE \ - byte_size_type BOOST_PP_CAT(NAME, Pitch()) const { \ - return cms::soa::alignSize(parent_.elements_ * sizeof(CPP_TYPE), ParentClass::alignment); \ - } \ constexpr static cms::soa::SoAColumnType BOOST_PP_CAT(ColumnTypeOf_, NAME) = cms::soa::SoAColumnType::column;, \ /* Eigen column */ \ using BOOST_PP_CAT(ParametersTypeOf_, NAME) = \ @@ -194,22 +144,21 @@ namespace cms::soa { parent_.BOOST_PP_CAT(NAME, _), \ parent_.BOOST_PP_CAT(NAME, Stride_)); \ } \ - SOA_HOST_DEVICE SOA_INLINE \ - byte_size_type BOOST_PP_CAT(NAME, Pitch()) const { \ - return cms::soa::alignSize(parent_.elements_ * sizeof(CPP_TYPE::Scalar), ParentClass::alignment) \ - * CPP_TYPE::RowsAtCompileTime * CPP_TYPE::ColsAtCompileTime; \ - } \ constexpr static cms::soa::SoAColumnType BOOST_PP_CAT(ColumnTypeOf_, NAME) = cms::soa::SoAColumnType::eigen; \ - SOA_HOST_DEVICE SOA_INLINE \ - CPP_TYPE::Scalar const* BOOST_PP_CAT(addressOf_, NAME)() const { \ - return parent_.metadata().BOOST_PP_CAT(parametersOf_, NAME)().addr_; \ - } \ - SOA_HOST_DEVICE SOA_INLINE \ - CPP_TYPE::Scalar* BOOST_PP_CAT(addressOf_, NAME)() { \ - return parent_.metadata().BOOST_PP_CAT(parametersOf_, NAME)().addr_; \ - } \ - ) -// clang-format on + ) \ + SOA_HOST_DEVICE SOA_INLINE \ + auto* BOOST_PP_CAT(addressOf_, NAME)() { \ + return parent_.metadata().BOOST_PP_CAT(parametersOf_, NAME)().addr_; \ + } \ + SOA_HOST_DEVICE SOA_INLINE \ + const auto* BOOST_PP_CAT(addressOf_, NAME)() const { \ + return parent_.metadata().BOOST_PP_CAT(parametersOf_, NAME)().addr_; \ + } \ + byte_size_type BOOST_PP_CAT(NAME, Pitch()) const { \ + return cms::soa::computePitch(parent_.metadata().BOOST_PP_CAT(parametersOf_, NAME)(), \ + ParentClass::alignment, parent_.elements_); \ + } \ + // clang-format on #define _DEFINE_METADATA_MEMBERS(R, DATA, TYPE_NAME) \ BOOST_PP_IF(BOOST_PP_GREATER(BOOST_PP_TUPLE_ELEM(0, TYPE_NAME), _VALUE_LAST_COLUMN_TYPE), \ @@ -221,16 +170,7 @@ namespace cms::soa { */ // clang-format off #define _DECLARE_CONST_DESCRIPTOR_SPANS_IMPL(VALUE_TYPE, CPP_TYPE, NAME, ARGS) \ - _SWITCH_ON_TYPE(VALUE_TYPE, \ - /* Scalar */ \ - (std::span>) \ - , \ - /* Column */ \ - (std::span>) \ - , \ - /* Eigen column*/ \ - (std::span>) \ - ) + (typename cms::soa::getConstSpanType::type) // clang-format on #define _DECLARE_CONST_DESCRIPTOR_SPANS(R, DATA, TYPE_NAME) \ @@ -243,16 +183,7 @@ namespace cms::soa { */ // clang-format off #define _DECLARE_DESCRIPTOR_SPANS_IMPL(VALUE_TYPE, CPP_TYPE, NAME, ARGS) \ - _SWITCH_ON_TYPE(VALUE_TYPE, \ - /* Scalar */ \ - (std::span) \ - , \ - /* Column */ \ - (std::span) \ - , \ - /* Eigen column */ \ - (std::span) \ - ) + (typename cms::soa::getSpanType::type) // clang-format on #define _DECLARE_DESCRIPTOR_SPANS(R, DATA, TYPE_NAME) \ @@ -264,22 +195,8 @@ namespace cms::soa { * Build the spans of the (const) descriptor from a (const) view */ // clang-format off -#define _ASSIGN_SPAN_TO_COLUMNS_IMPL(VALUE_TYPE, CPP_TYPE, NAME, ARGS) \ - _SWITCH_ON_TYPE(VALUE_TYPE, \ - /* Scalar */ \ - (std::span(view.metadata().BOOST_PP_CAT(addressOf_, NAME)(), \ - cms::soa::alignSize(sizeof(CPP_TYPE), alignment) / sizeof(CPP_TYPE))) \ - , \ - /* Column */ \ - (std::span(view.metadata().BOOST_PP_CAT(addressOf_, NAME)(), \ - cms::soa::alignSize(view.metadata().size() * sizeof(CPP_TYPE), alignment) / sizeof(CPP_TYPE))) \ - , \ - /* Eigen column */ \ - (std::span(view.metadata().BOOST_PP_CAT(addressOf_, NAME)(), \ - cms::soa::alignSize(view.metadata().size() * sizeof(CPP_TYPE::Scalar), alignment) * \ - CPP_TYPE::RowsAtCompileTime * CPP_TYPE::ColsAtCompileTime / sizeof(CPP_TYPE::Scalar))) \ - ) -// clang-format on +#define _ASSIGN_SPAN_TO_COLUMNS_IMPL(VALUE_TYPE, CPP_TYPE, NAME, ARGS) \ + (cms::soa::assignSpanToColumn(view.metadata().BOOST_PP_CAT(parametersOf_, NAME)(), view.metadata().size(), alignment)) // clang-format on #define _ASSIGN_SPAN_TO_COLUMNS(R, DATA, TYPE_NAME) \ BOOST_PP_IF(BOOST_PP_GREATER(BOOST_PP_TUPLE_ELEM(0, TYPE_NAME), _VALUE_LAST_COLUMN_TYPE), \ @@ -456,17 +373,7 @@ namespace cms::soa { */ // clang-format off #define _ACCUMULATE_SOA_ELEMENT_IMPL(VALUE_TYPE, CPP_TYPE, NAME, ARGS) \ - _SWITCH_ON_TYPE(VALUE_TYPE, \ - /* Scalar */ \ - _soa_impl_ret += cms::soa::alignSize(sizeof(CPP_TYPE), alignment); \ - , \ - /* Column */ \ - _soa_impl_ret += cms::soa::alignSize(elements * sizeof(CPP_TYPE), alignment); \ - , \ - /* Eigen column */ \ - _soa_impl_ret += cms::soa::alignSize(elements * sizeof(CPP_TYPE::Scalar), alignment) \ - * CPP_TYPE::RowsAtCompileTime * CPP_TYPE::ColsAtCompileTime; \ - ) + _soa_impl_ret += cms::soa::AccumulateSoAElements{}(elements, alignment); // clang-format on #define _ACCUMULATE_SOA_ELEMENT(R, DATA, TYPE_NAME) \ @@ -531,7 +438,7 @@ namespace cms::soa { */ // clang-format off #define _STREAMER_READ_SOA_DATA_MEMBER_IMPL(VALUE_TYPE, CPP_TYPE, NAME, ARGS) \ - _SWITCH_ON_TYPE(VALUE_TYPE, \ + _SWITCH_ON_TYPE(VALUE_TYPE, \ /* Scalar */ \ memcpy(BOOST_PP_CAT(NAME, _), onfile.BOOST_PP_CAT(NAME, _), sizeof(CPP_TYPE)); \ , \ @@ -541,7 +448,7 @@ namespace cms::soa { /* Eigen column */ \ memcpy(BOOST_PP_CAT(NAME, _), onfile.BOOST_PP_CAT(NAME, _), \ sizeof(CPP_TYPE::Scalar) * BOOST_PP_CAT(NAME, ElementsWithPadding_)); \ - ) + ) // clang-format on #define _STREAMER_READ_SOA_DATA_MEMBER(R, DATA, TYPE_NAME) \ @@ -1744,6 +1651,8 @@ _SWITCH_ON_TYPE(VALUE_TYPE, size_type elements_; \ size_type const scalar_ = 1; \ byte_size_type byteSize_ EDM_REFLEX_TRANSIENT; \ + /* TODO: The layout will contain SoAParametersImpl as members for the columns, which will allow the use of \ + * more template helper functions. */ \ _ITERATE_ON_ALL(_DECLARE_SOA_DATA_MEMBER, ~, __VA_ARGS__) \ /* Making the code conditional is problematic in macros as the commas will interfere with parameter lisings */ \ /* So instead we make the code unconditional with paceholder names which are protected by a private protection. */ \ diff --git a/SimCalorimetry/EcalSimProducers/interface/EcalDigiProducer.h b/SimCalorimetry/EcalSimProducers/interface/EcalDigiProducer.h index 28cb92e3bbc72..aeaa09472d52d 100644 --- a/SimCalorimetry/EcalSimProducers/interface/EcalDigiProducer.h +++ b/SimCalorimetry/EcalSimProducers/interface/EcalDigiProducer.h @@ -43,9 +43,9 @@ #include "SimDataFormats/CaloHit/interface/PCaloHit.h" #include -typedef EcalTDigitizer EBDigitizer; -typedef EcalTDigitizer EEDigitizer; -typedef CaloTDigitizer ESOldDigitizer; +using EBDigitizer = EcalTDigitizer; +using EEDigitizer = EcalTDigitizer; +using ESOldDigitizer = CaloTDigitizer; class ESDigitizer; @@ -99,7 +99,7 @@ class EcalDigiProducer : public DigiAccumulatorMixMod { virtual void cacheEBDigis(const EBDigiCollection *ebDigiPtr) const {} virtual void cacheEEDigis(const EEDigiCollection *eeDigiPtr) const {} - typedef edm::Handle> HitsHandle; + using HitsHandle = edm::Handle>; void accumulateCaloHits(HitsHandle const &ebHandle, HitsHandle const &eeHandle, HitsHandle const &esHandle, @@ -121,10 +121,10 @@ class EcalDigiProducer : public DigiAccumulatorMixMod { const std::string m_EEdigiCollection; const std::string m_ESdigiCollection; const std::string m_hitsProducerTag; - - const edm::EDGetTokenT> m_HitsEBToken_; - const edm::EDGetTokenT> m_HitsEEToken_; - const edm::EDGetTokenT> m_HitsESToken_; + const std::string m_hitsProducerTagPU; + edm::EDGetTokenT> m_HitsEBToken_; + edm::EDGetTokenT> m_HitsEEToken_; + edm::EDGetTokenT> m_HitsESToken_; const edm::ESGetToken m_pedestalsToken; const edm::ESGetToken m_icalToken; @@ -188,9 +188,9 @@ class EcalDigiProducer : public DigiAccumulatorMixMod { std::unique_ptr m_BarrelDigitizer; std::unique_ptr m_EndcapDigitizer; - typedef CaloTSamples EcalSamples; + using EcalSamples = CaloTSamples; - typedef EcalElectronicsSim EcalElectronicsSim_Ph1; + using EcalElectronicsSim_Ph1 = EcalElectronicsSim; std::unique_ptr m_ElectronicsSim; std::unique_ptr m_Coder; diff --git a/SimCalorimetry/EcalSimProducers/src/EcalDigiProducer.cc b/SimCalorimetry/EcalSimProducers/src/EcalDigiProducer.cc index 586399a9c19d8..1f8d05fd29520 100644 --- a/SimCalorimetry/EcalSimProducers/src/EcalDigiProducer.cc +++ b/SimCalorimetry/EcalSimProducers/src/EcalDigiProducer.cc @@ -60,9 +60,7 @@ EcalDigiProducer::EcalDigiProducer(const edm::ParameterSet ¶ms, edm::Consume m_EEdigiCollection(params.getParameter("EEdigiCollection")), m_ESdigiCollection(params.getParameter("ESdigiCollection")), m_hitsProducerTag(params.getParameter("hitsProducer")), - m_HitsEBToken_(iC.consumes>(edm::InputTag(m_hitsProducerTag, "EcalHitsEB"))), - m_HitsEEToken_(iC.consumes>(edm::InputTag(m_hitsProducerTag, "EcalHitsEE"))), - m_HitsESToken_(iC.consumes>(edm::InputTag(m_hitsProducerTag, "EcalHitsES"))), + m_hitsProducerTagPU(params.getParameter("hitsProducerPU")), m_pedestalsToken(iC.esConsumes()), m_icalToken(iC.esConsumes()), m_laserToken(iC.esConsumes()), @@ -77,27 +75,27 @@ EcalDigiProducer::EcalDigiProducer(const edm::ParameterSet ¶ms, edm::Consume m_EEs25notCont(params.getParameter("EEs25notContainment")), m_readoutFrameSize(ecalPh1::sampleSize), - m_ParameterMap(new EcalSimParameterMap(params.getParameter("simHitToPhotoelectronsBarrel"), - params.getParameter("simHitToPhotoelectronsEndcap"), - params.getParameter("photoelectronsToAnalogBarrel"), - params.getParameter("photoelectronsToAnalogEndcap"), - params.getParameter("samplingFactor"), - params.getParameter("timePhase"), - m_readoutFrameSize, - params.getParameter("binOfMaximum"), - params.getParameter("doPhotostatistics"), - params.getParameter("syncPhase"))), + m_ParameterMap(std::make_unique(params.getParameter("simHitToPhotoelectronsBarrel"), + params.getParameter("simHitToPhotoelectronsEndcap"), + params.getParameter("photoelectronsToAnalogBarrel"), + params.getParameter("photoelectronsToAnalogEndcap"), + params.getParameter("samplingFactor"), + params.getParameter("timePhase"), + m_readoutFrameSize, + params.getParameter("binOfMaximum"), + params.getParameter("doPhotostatistics"), + params.getParameter("syncPhase"))), m_apdDigiTag(params.getParameter("apdDigiTag")), - m_apdParameters(new APDSimParameters(params.getParameter("apdAddToBarrel"), - m_apdSeparateDigi, - params.getParameter("apdSimToPELow"), - params.getParameter("apdSimToPEHigh"), - params.getParameter("apdTimeOffset"), - params.getParameter("apdTimeOffWidth"), - params.getParameter("apdDoPEStats"), - m_apdDigiTag, - params.getParameter>("apdNonlParms"))), + m_apdParameters(std::make_unique(params.getParameter("apdAddToBarrel"), + m_apdSeparateDigi, + params.getParameter("apdSimToPELow"), + params.getParameter("apdSimToPEHigh"), + params.getParameter("apdTimeOffset"), + params.getParameter("apdTimeOffWidth"), + params.getParameter("apdDoPEStats"), + m_apdDigiTag, + params.getParameter>("apdNonlParms"))), m_componentDigiTag(params.getParameter("componentDigiTag")), m_componentParameters( @@ -115,14 +113,14 @@ EcalDigiProducer::EcalDigiProducer(const edm::ParameterSet ¶ms, edm::Consume params.getParameter("syncPhase"))), m_APDResponse(!m_apdSeparateDigi ? nullptr - : new EBHitResponse(m_ParameterMap.get(), - &m_EBShape, - true, - false, - m_apdParameters.get(), - &m_APDShape, - m_componentParameters.get(), - &m_ComponentShapes)), + : std::make_unique(m_ParameterMap.get(), + &m_EBShape, + true, + false, + m_apdParameters.get(), + &m_APDShape, + m_componentParameters.get(), + &m_ComponentShapes)), m_ComponentResponse(!m_componentSeparateDigi ? nullptr @@ -136,18 +134,18 @@ EcalDigiProducer::EcalDigiProducer(const edm::ParameterSet ¶ms, edm::Consume m_componentParameters.get(), &m_ComponentShapes)), // check if that false is correct // TODO HERE JCH - m_EBResponse(new EBHitResponse(m_ParameterMap.get(), - &m_EBShape, - false, // barrel - false, // normal non-component shape based - m_apdParameters.get(), - &m_APDShape, - m_componentParameters.get(), - &m_ComponentShapes)), + m_EBResponse(std::make_unique(m_ParameterMap.get(), + &m_EBShape, + false, // barrel + false, // normal non-component shape based + m_apdParameters.get(), + &m_APDShape, + m_componentParameters.get(), + &m_ComponentShapes)), - m_EEResponse(new EEHitResponse(m_ParameterMap.get(), &m_EEShape)), - m_ESResponse(new ESHitResponse(m_ParameterMap.get(), &m_ESShape)), - m_ESOldResponse(new CaloHitResponse(m_ParameterMap.get(), &m_ESShape)), + m_EEResponse(std::make_unique(m_ParameterMap.get(), &m_EEShape)), + m_ESResponse(std::make_unique(m_ParameterMap.get(), &m_ESShape)), + m_ESOldResponse(std::make_unique(m_ParameterMap.get(), &m_ESShape)), m_addESNoise(params.getParameter("doESNoise")), m_PreMix1(params.getParameter("EcalPreMixStage1")), @@ -159,15 +157,17 @@ EcalDigiProducer::EcalDigiProducer(const edm::ParameterSet ¶ms, edm::Consume m_doEE(params.getParameter("doEE")), m_doES(params.getParameter("doES")), - m_ESElectronicsSim(m_doFastES ? nullptr : new ESElectronicsSim(m_addESNoise)), + m_ESElectronicsSim(m_doFastES ? nullptr : std::make_unique(m_addESNoise)), - m_ESOldDigitizer(m_doFastES ? nullptr - : new ESOldDigitizer(m_ESOldResponse.get(), m_ESElectronicsSim.get(), m_addESNoise)), + m_ESOldDigitizer( + m_doFastES ? nullptr + : std::make_unique(m_ESOldResponse.get(), m_ESElectronicsSim.get(), m_addESNoise)), - m_ESElectronicsSimFast(!m_doFastES ? nullptr : new ESElectronicsSimFast(m_addESNoise, m_PreMix1)), + m_ESElectronicsSimFast(!m_doFastES ? nullptr : std::make_unique(m_addESNoise, m_PreMix1)), - m_ESDigitizer(!m_doFastES ? nullptr - : new ESDigitizer(m_ESResponse.get(), m_ESElectronicsSimFast.get(), m_addESNoise)), + m_ESDigitizer( + !m_doFastES ? nullptr + : std::make_unique(m_ESResponse.get(), m_ESElectronicsSimFast.get(), m_addESNoise)), m_APDDigitizer(nullptr), m_ComponentDigitizer(nullptr), @@ -185,12 +185,24 @@ EcalDigiProducer::EcalDigiProducer(const edm::ParameterSet ¶ms, edm::Consume // mixMod.produces(m_EBdigiCollection); // mixMod.produces(m_EEdigiCollection); // mixMod.produces(m_ESdigiCollection); + const std::set producers = {m_hitsProducerTag, m_hitsProducerTagPU}; + std::vector>> eb_list, ee_list, es_list; + for (const auto &prod : producers) { + if (m_doEB) + eb_list.push_back(iC.consumes>(edm::InputTag(prod, "EcalHitsEB"))); + if (m_doEE) + ee_list.push_back(iC.consumes>(edm::InputTag(prod, "EcalHitsEE"))); + if (m_doES) + es_list.push_back(iC.consumes>(edm::InputTag(prod, "EcalHitsES"))); + } if (m_doEB) - iC.consumes>(edm::InputTag(m_hitsProducerTag, "EcalHitsEB")); + m_HitsEBToken_ = eb_list[0]; if (m_doEE) - iC.consumes>(edm::InputTag(m_hitsProducerTag, "EcalHitsEE")); + m_HitsEEToken_ = ee_list[0]; + if (m_doES) + m_HitsESToken_ = es_list[0]; + if (m_doES) { - iC.consumes>(edm::InputTag(m_hitsProducerTag, "EcalHitsES")); m_esGainToken = iC.esConsumes(); m_esMIPToGeVToken = iC.esConsumes(); m_esPedestalsToken = iC.esConsumes(); @@ -373,20 +385,27 @@ void EcalDigiProducer::accumulateCaloHits(HitsHandle const &ebHandle, void EcalDigiProducer::accumulate(edm::Event const &e, edm::EventSetup const &eventSetup) { // Step A: Get Inputs - const edm::Handle> &ebHandle = e.getHandle(m_HitsEBToken_); + edm::Handle> ebHandle; if (m_doEB) { + ebHandle = e.getHandle(m_HitsEBToken_); m_EBShape.setEventSetup(eventSetup); m_APDShape.setEventSetup(eventSetup); m_ComponentShapes.setEventSetup(eventSetup); } - const edm::Handle> &eeHandle = e.getHandle(m_HitsEEToken_); + edm::Handle> eeHandle; if (m_doEE) { + eeHandle = e.getHandle(m_HitsEEToken_); m_EEShape.setEventSetup(eventSetup); } - const edm::Handle> &esHandle = e.getHandle(m_HitsESToken_); - + edm::Handle> esHandle; + if (m_doES) { + esHandle = e.getHandle(m_HitsESToken_); + } +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EcalDigiProducer") << "Accumulate Signal Hits with Tag " << m_hitsProducerTag; +#endif accumulateCaloHits(ebHandle, eeHandle, esHandle, 0); } @@ -396,33 +415,35 @@ void EcalDigiProducer::accumulate(PileUpEventPrincipal const &e, // Step A: Get Inputs edm::Handle> ebHandle; if (m_doEB) { - edm::InputTag ebTag(m_hitsProducerTag, "EcalHitsEB"); + edm::InputTag ebTag(m_hitsProducerTagPU, "EcalHitsEB"); e.getByLabel(ebTag, ebHandle); } edm::Handle> eeHandle; if (m_doEE) { - edm::InputTag eeTag(m_hitsProducerTag, "EcalHitsEE"); + edm::InputTag eeTag(m_hitsProducerTagPU, "EcalHitsEE"); e.getByLabel(eeTag, eeHandle); } edm::Handle> esHandle; if (m_doES) { - edm::InputTag esTag(m_hitsProducerTag, "EcalHitsES"); + edm::InputTag esTag(m_hitsProducerTagPU, "EcalHitsES"); e.getByLabel(esTag, esHandle); } +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EcalDigiProducer") << "Accumulate PU Hits with Tag " << m_hitsProducerTagPU; +#endif accumulateCaloHits(ebHandle, eeHandle, esHandle, e.bunchCrossing()); } void EcalDigiProducer::finalizeEvent(edm::Event &event, edm::EventSetup const &eventSetup) { // Step B: Create empty output - std::unique_ptr apdResult(!m_apdSeparateDigi || !m_doEB ? nullptr : new EBDigiCollection()); - std::unique_ptr componentResult(!m_componentSeparateDigi || !m_doEB ? nullptr - : new EBDigiCollection()); - std::unique_ptr barrelResult(new EBDigiCollection()); - std::unique_ptr endcapResult(new EEDigiCollection()); - std::unique_ptr preshowerResult(new ESDigiCollection()); + auto apdResult = (!m_apdSeparateDigi || !m_doEB ? nullptr : std::make_unique()); + auto componentResult(!m_componentSeparateDigi || !m_doEB ? nullptr : std::make_unique()); + auto barrelResult = std::make_unique(); + auto endcapResult = std::make_unique(); + auto preshowerResult = std::make_unique(); // run the algorithm diff --git a/SimCalorimetry/HcalSimProducers/interface/HcalDigitizer.h b/SimCalorimetry/HcalSimProducers/interface/HcalDigitizer.h index e462f466206a1..44665a147d7d3 100644 --- a/SimCalorimetry/HcalSimProducers/interface/HcalDigitizer.h +++ b/SimCalorimetry/HcalSimProducers/interface/HcalDigitizer.h @@ -69,7 +69,8 @@ class HcalDigitizer { int bunchCrossing, CLHEP::HepRandomEngine *, const HcalTopology *h, - const ZdcTopology *z); + const ZdcTopology *z, + bool signal); /// some hits in each subdetector, just for testing purposes void fillFakeHits(); @@ -103,12 +104,12 @@ class HcalDigitizer { const HcalDDDRecConstants *theRecNumber; /** Reconstruction algorithm*/ - typedef CaloTDigitizer HBHEDigitizer; - typedef CaloTDigitizer HODigitizer; - typedef CaloTDigitizer HFDigitizer; - typedef CaloTDigitizer ZDCDigitizer; - typedef CaloTDigitizer QIE10Digitizer; - typedef CaloTDigitizer QIE11Digitizer; + using HBHEDigitizer = CaloTDigitizer; + using HODigitizer = CaloTDigitizer; + using HFDigitizer = CaloTDigitizer; + using ZDCDigitizer = CaloTDigitizer; + using QIE10Digitizer = CaloTDigitizer; + using QIE11Digitizer = CaloTDigitizer; HcalSimParameterMap theParameterMap; HcalShapes theShapes; @@ -169,6 +170,7 @@ class HcalDigitizer { bool isZDC, isHCAL, zdcgeo, hbhegeo, hogeo, hfgeo; bool testNumbering_; + bool testNumberingPU_; bool doHFWindow_; bool killHE_; bool debugCS_; @@ -176,6 +178,7 @@ class HcalDigitizer { bool injectTestHits_; std::string hitsProducer_; + std::string hitsProducerPU_; int theHOSiPMCode; diff --git a/SimCalorimetry/HcalSimProducers/python/hcalUnsuppressedDigis_cfi.py b/SimCalorimetry/HcalSimProducers/python/hcalUnsuppressedDigis_cfi.py index b02962b83576a..598b3a30fc308 100644 --- a/SimCalorimetry/HcalSimProducers/python/hcalUnsuppressedDigis_cfi.py +++ b/SimCalorimetry/HcalSimProducers/python/hcalUnsuppressedDigis_cfi.py @@ -21,8 +21,10 @@ doTimeSlew = cms.bool(True), doHFWindow = cms.bool(False), hitsProducer = cms.string('g4SimHits'), + hitsProducerPU = cms.string('g4SimHits'), DelivLuminosity = cms.double(0), TestNumbering = cms.bool(False), + TestNumberingPU = cms.bool(False), doNeutralDensityFilter = cms.bool(True), HBDarkening = cms.bool(False), HEDarkening = cms.bool(False), @@ -46,7 +48,13 @@ ) from Configuration.Eras.Modifier_fastSim_cff import fastSim -fastSim.toModify( hcalSimBlock, hitsProducer = "fastSimProducer" ) +fastSim.toModify(hcalSimBlock, + hitsProducer = cms.string('fastSimProducer'), + hitsProducerPU = cms.string('fastSimProducer') ) + +from Configuration.ProcessModifiers.fastSimPU_cff import fastSimPU +fastSimPU.toModify(hcalSimBlock, + hitsProducerPU = cms.string('fastSimProducer') ) from Configuration.ProcessModifiers.premix_stage1_cff import premix_stage1 premix_stage1.toModify(hcalSimBlock, @@ -60,7 +68,11 @@ # test numbering not used in fastsim from Configuration.Eras.Modifier_run2_HCAL_2017_cff import run2_HCAL_2017 -(run2_HCAL_2017 & ~fastSim).toModify( hcalSimBlock, TestNumbering = True ) +(run2_HCAL_2017 & ~fastSim).toModify( hcalSimBlock, + TestNumbering = True, + TestNumberingPU = True ) +(run2_HCAL_2017 & fastSimPU).toModify( hcalSimBlock, + TestNumberingPU = False ) # remove HE processing for phase 2, completely put in HGCal land # Also inhibit ZDC digitization diff --git a/SimCalorimetry/HcalSimProducers/src/HcalDigitizer.cc b/SimCalorimetry/HcalSimProducers/src/HcalDigitizer.cc index 5930e11b54768..297cadb2158a8 100644 --- a/SimCalorimetry/HcalSimProducers/src/HcalDigitizer.cc +++ b/SimCalorimetry/HcalSimProducers/src/HcalDigitizer.cc @@ -96,12 +96,11 @@ HcalDigitizer::HcalDigitizer(const edm::ParameterSet &ps, edm::ConsumesCollector ignoreTime_(ps.getParameter("ignoreGeantTime")), injectTestHits_(ps.getParameter("injectTestHits")), hitsProducer_(ps.getParameter("hitsProducer")), + hitsProducerPU_(ps.getParameter("hitsProducerPU")), theHOSiPMCode(ps.getParameter("ho").getParameter("siPMCode")), deliveredLumi(0.), agingFlagHB(ps.getParameter("HBDarkening")), agingFlagHE(ps.getParameter("HEDarkening")), - zdcToken_(iC.consumes(edm::InputTag(hitsProducer_, "ZDCHITS"))), - hcalToken_(iC.consumes(edm::InputTag(hitsProducer_, "HcalHits"))), m_HBDarkening(nullptr), m_HEDarkening(nullptr), m_HFRecalibration(nullptr), @@ -118,6 +117,14 @@ HcalDigitizer::HcalDigitizer(const edm::ParameterSet &ps, edm::ConsumesCollector mcParamsToken_ = iC.esConsumes(); } + const std::set producers = {hitsProducer_, hitsProducerPU_}; + std::vector>> zdc_list, hcal_list; + for (const auto &prod : producers) { + zdc_list.push_back(iC.consumes>(edm::InputTag(prod, "ZDCHITS"))); + hcal_list.push_back(iC.consumes>(edm::InputTag(prod, "HcalHits"))); + } + zdcToken_ = zdc_list[0]; + hcalToken_ = hcal_list[0]; bool doNoise = ps.getParameter("doNoise"); bool PreMix1 = ps.getParameter("HcalPreMixStage1"); // special threshold/pedestal treatment @@ -216,10 +223,12 @@ HcalDigitizer::HcalDigitizer(const edm::ParameterSet &ps, edm::ConsumesCollector edm::LogVerbatim("HcalDigitizer") << "iszDC: " << isZDC << " theZDCDigitizer: " << theZDCDigitizer; testNumbering_ = ps.getParameter("TestNumbering"); + testNumberingPU_ = ps.getParameter("TestNumberingPU"); #ifdef EDM_ML_DEBUG - edm::LogVerbatim("HcalSim") << "Flag to see if Hit Relabeller to be initiated " << testNumbering_; + edm::LogVerbatim("HcalSim") << "Flag to see if Hit Relabeller to be initiated " << testNumbering_ << ":" + << testNumberingPU_; #endif - if (testNumbering_) + if (testNumbering_ || testNumberingPU_) theRelabeller = std::make_unique(ps.getParameter("doNeutralDensityFilter")); if (ps.getParameter("doIonFeedback") && theHBHEResponse) { @@ -359,7 +368,8 @@ void HcalDigitizer::accumulateCaloHits(edm::Handle> const int bunchCrossing, CLHEP::HepRandomEngine *engine, const HcalTopology *htopoP, - const ZdcTopology *ztopoP) { + const ZdcTopology *ztopoP, + bool signal) { // Step A: pass in inputs, and accumulate digis if (isHCAL) { std::vector hcalHitsOrig = *hcalHandle.product(); @@ -369,12 +379,12 @@ void HcalDigitizer::accumulateCaloHits(edm::Handle> const hcalHits.reserve(hcalHitsOrig.size()); // evaluate darkening before relabeling - if (testNumbering_) { + if ((signal && testNumbering_) || ((!signal) && testNumberingPU_)) { if (m_HBDarkening || m_HEDarkening || m_HFRecalibration) { darkening(hcalHitsOrig); } // Relabel PCaloHits if necessary - edm::LogVerbatim("HcalDigitizer") << "Calling Relabeller"; + edm::LogVerbatim("HcalDigitizer") << "Calling Relabeller for signal " << signal; theRelabeller->process(hcalHitsOrig); } @@ -468,19 +478,22 @@ void HcalDigitizer::accumulate(edm::Event const &e, edm::EventSetup const &event const HcalTopology *htopoP = &eventSetup.getData(topoToken_); const ZdcTopology *ztopoP = &eventSetup.getData(topoZToken_); - accumulateCaloHits(hcalHandle, zdcHandle, 0, engine, htopoP, ztopoP); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("HcalDigitizer") << "Accumulate Signal Hits with Tag " << hitsProducer_; +#endif + accumulateCaloHits(hcalHandle, zdcHandle, 0, engine, htopoP, ztopoP, true); } void HcalDigitizer::accumulate(PileUpEventPrincipal const &e, edm::EventSetup const &eventSetup, CLHEP::HepRandomEngine *engine) { // Step A: Get Inputs - edm::InputTag zdcTag(hitsProducer_, "ZDCHITS"); + edm::InputTag zdcTag(hitsProducerPU_, "ZDCHITS"); edm::Handle> zdcHandle; e.getByLabel(zdcTag, zdcHandle); isZDC = zdcHandle.isValid(); - edm::InputTag hcalTag(hitsProducer_, "HcalHits"); + edm::InputTag hcalTag(hitsProducerPU_, "HcalHits"); edm::Handle> hcalHandle; e.getByLabel(hcalTag, hcalHandle); isHCAL = hcalHandle.isValid(); @@ -488,23 +501,24 @@ void HcalDigitizer::accumulate(PileUpEventPrincipal const &e, const HcalTopology *htopoP = &eventSetup.getData(topoToken_); const ZdcTopology *ztopoP = &eventSetup.getData(topoZToken_); - accumulateCaloHits(hcalHandle, zdcHandle, e.bunchCrossing(), engine, htopoP, ztopoP); + accumulateCaloHits(hcalHandle, zdcHandle, e.bunchCrossing(), engine, htopoP, ztopoP, false); } void HcalDigitizer::finalizeEvent(edm::Event &e, const edm::EventSetup &eventSetup, CLHEP::HepRandomEngine *engine) { // Step B: Create empty output - std::unique_ptr hbheResult(new HBHEDigiCollection()); - std::unique_ptr hoResult(new HODigiCollection()); - std::unique_ptr hfResult(new HFDigiCollection()); - std::unique_ptr zdcResult(new ZDCDigiCollection()); - std::unique_ptr hfQIE10Result(new QIE10DigiCollection( + auto hbheResult = std::make_unique(); + auto hoResult = std::make_unique(); + auto hfResult = std::make_unique(); + auto zdcResult = std::make_unique(); + + auto hfQIE10Result = std::make_unique( !theHFQIE10DetIds.empty() ? theHFQIE10Response.get()->getReadoutFrameSize(theHFQIE10DetIds[0]) - : QIE10DigiCollection::MAXSAMPLES)); - std::unique_ptr hbheQIE11Result(new QIE11DigiCollection( + : QIE10DigiCollection::MAXSAMPLES); + auto hbheQIE11Result = std::make_unique( !theHBHEQIE11DetIds.empty() ? theHBHESiPMResponse.get()->getReadoutFrameSize(theHBHEQIE11DetIds[0]) : // theParameterMap->simParameters(theHBHEQIE11DetIds[0]).readoutFrameSize() // : - QIE11DigiCollection::MAXSAMPLES)); + QIE11DigiCollection::MAXSAMPLES); // Step C: Invoke the algorithm, getting back outputs. if (isHCAL && hbhegeo) { @@ -545,7 +559,7 @@ void HcalDigitizer::finalizeEvent(edm::Event &e, const edm::EventSetup &eventSet e.put(std::move(hbheQIE11Result), "HBHEQIE11DigiCollection"); if (debugCS_) { - std::unique_ptr csResult(new CaloSamplesCollection()); + auto csResult = std::make_unique(); // smush together all the results if (theHBHEDigitizer) csResult->insert( @@ -573,7 +587,7 @@ void HcalDigitizer::finalizeEvent(edm::Event &e, const edm::EventSetup &eventSet } if (injectTestHits_) { - std::unique_ptr pcResult(new edm::PCaloHitContainer()); + auto pcResult = std::make_unique(); pcResult->insert(pcResult->end(), injectedHits_.begin(), injectedHits_.end()); e.put(std::move(pcResult), "HcalHits"); } diff --git a/SimGeneral/MixingModule/plugins/MixingModule.cc b/SimGeneral/MixingModule/plugins/MixingModule.cc index 0cf6dfe04f41e..b40c1f802888c 100644 --- a/SimGeneral/MixingModule/plugins/MixingModule.cc +++ b/SimGeneral/MixingModule/plugins/MixingModule.cc @@ -77,6 +77,10 @@ namespace edm { skipSignal_ = ps_mix.getParameter("skipSignal"); } + skipProductCheck_ = false; + if (ps_mix.exists("skipProductCheck")) { + skipProductCheck_ = ps_mix.getParameter("skipProductCheck"); + } ParameterSet ps = ps_mix.getParameter("mixObjects"); std::vector names = ps.getParameterNames(); for (std::vector::iterator it = names.begin(); it != names.end(); ++it) { @@ -109,8 +113,6 @@ namespace edm { LogInfo("MixingModule") << "Will mix " << object << "s with InputTag= " << tag.encode() << ", label will be " << label; - // std::cout <<"Will mix "<checkSignal(e)) { + if (skipSignal_ or skipProductCheck_ or adjuster->checkSignal(e)) { adjusters_.push_back(adjuster); } } } if (workers_.empty()) { for (auto const& worker : workersObjects_) { - if (skipSignal_ or worker->checkSignal(e)) { + if (skipSignal_ or skipProductCheck_ or worker->checkSignal(e)) { workers_.push_back(worker); } } @@ -394,8 +389,6 @@ namespace edm { for (auto const& worker : workers_) { LogDebug("MixingModule") << " merging Event: id " << eventPrincipal.id(); - // std::cout <<"PILEALLWORKERS merging Event: id " << eventPrincipal.id() << std::endl; - worker->addPileups(eventPrincipal, &moduleCallingContext, eventId); } @@ -499,10 +492,6 @@ namespace edm { bunchCrossingList, numInteractionList, TrueInteractionList, eventInfoList, bunchSpace_); } - // for (int bunchIdx = minBunch_; bunchIdx <= maxBunch_; ++bunchIdx) { - // std::cout << " bunch ID, Pileup, True " << bunchIdx << " " << PileupList[bunchIdx-minBunch_] << " " << TrueNumInteractions_[bunchIdx-minBunch_] << std::endl; - //} - for (int bunchIdx = minBunch_; bunchIdx <= maxBunch_; ++bunchIdx) { for (size_t setBcrIdx = 0; setBcrIdx < workers_.size(); ++setBcrIdx) { workers_[setBcrIdx]->setBcrOffset(); diff --git a/SimGeneral/MixingModule/plugins/MixingModule.h b/SimGeneral/MixingModule/plugins/MixingModule.h index 998f767a0bc9c..dba96ae9e83ef 100644 --- a/SimGeneral/MixingModule/plugins/MixingModule.h +++ b/SimGeneral/MixingModule/plugins/MixingModule.h @@ -109,6 +109,7 @@ namespace edm { bool useCurrentProcessOnly_; bool wrapLongTimes_; bool skipSignal_; + bool skipProductCheck_; // Digi-producing algorithms Accumulators digiAccumulators_; diff --git a/SimGeneral/MixingModule/plugins/MixingWorker.cc b/SimGeneral/MixingModule/plugins/MixingWorker.cc index 7131a1f3c36ed..09809a12ea4e6 100644 --- a/SimGeneral/MixingModule/plugins/MixingWorker.cc +++ b/SimGeneral/MixingModule/plugins/MixingWorker.cc @@ -52,6 +52,7 @@ namespace edm { InputTag t = InputTag(tag.label(), tag.instance()); LogInfo("MixingModule") << " Will create a CrossingFrame for HepMCProduct with " << " with InputTag= " << t.encode(); + break; } } diff --git a/SimGeneral/MixingModule/plugins/MixingWorker.h b/SimGeneral/MixingModule/plugins/MixingWorker.h index 7f2d0b5c97406..e0572a409eae0 100644 --- a/SimGeneral/MixingModule/plugins/MixingWorker.h +++ b/SimGeneral/MixingModule/plugins/MixingWorker.h @@ -121,7 +121,6 @@ namespace edm { if (got) LogInfo("MixingModule") << " Will create a CrossingFrame for " << typeid(T).name() << " with InputTag= " << t.encode(); - return got; } @@ -159,6 +158,7 @@ namespace edm { // When using mixed secondary source // Copy the data from the PCrossingFrame to the CrossingFrame virtual void copyPCrossingFrame(const PCrossingFrame *PCF); + InputTag getInputTag() const override { return tag_; } private: int minBunch_; diff --git a/SimGeneral/MixingModule/plugins/MixingWorkerBase.h b/SimGeneral/MixingModule/plugins/MixingWorkerBase.h index c7c7d2a458249..0c3aed663f11c 100644 --- a/SimGeneral/MixingModule/plugins/MixingWorkerBase.h +++ b/SimGeneral/MixingModule/plugins/MixingWorkerBase.h @@ -43,6 +43,7 @@ namespace edm { virtual void setTof() = 0; virtual void put(edm::Event &e) = 0; virtual void reload(int minBunch, int maxBunch, int bunchSpace) {} + virtual InputTag getInputTag() const = 0; }; } // namespace edm diff --git a/SimGeneral/MixingModule/python/SiPixelSimParameters_cfi.py b/SimGeneral/MixingModule/python/SiPixelSimParameters_cfi.py index c668619c702c7..ca2bf16dd8879 100644 --- a/SimGeneral/MixingModule/python/SiPixelSimParameters_cfi.py +++ b/SimGeneral/MixingModule/python/SiPixelSimParameters_cfi.py @@ -63,6 +63,11 @@ def _modifyPixelDigitizerForRun3( digitizer ): 'TrackerHitsPixelBarrelHighTof', 'TrackerHitsPixelEndcapLowTof', 'TrackerHitsPixelEndcapHighTof'), + RoutListPU = cms.vstring( + 'TrackerHitsPixelBarrelLowTof', + 'TrackerHitsPixelBarrelHighTof', + 'TrackerHitsPixelEndcapLowTof', + 'TrackerHitsPixelEndcapHighTof'), OffsetSmearing = cms.double(0.0), ThresholdInElectrons_FPix = cms.double(3000.0), ThresholdInElectrons_BPix = cms.double(3500.0), @@ -140,6 +145,14 @@ def _modifyPixelDigitizerForRun3( digitizer ): KillBadFEDChannels = False, #done in second step killModules = False #done in second step ) +# when FastSim events as PileUP events during mixing +from Configuration.ProcessModifiers.fastSimPU_cff import fastSimPU +fastSimPU.toModify(SiPixelSimBlock, + RoutListPU = cms.vstring('TrackerHits')) +from Configuration.Eras.Modifier_fastSim_cff import fastSim +fastSim.toModify(SiPixelSimBlock, + RoutList = cms.vstring('TrackerHits'), + RoutListPU = cms.vstring('TrackerHits')) # Threshold in electrons are the Official CRAFT09 numbers: # FPix(smearing)/BPix(smearing) = 2480(160)/2730(200) diff --git a/SimGeneral/MixingModule/python/SiStripSimParameters_cfi.py b/SimGeneral/MixingModule/python/SiStripSimParameters_cfi.py index b1a8ff11010fe..15bc1ab039368 100644 --- a/SimGeneral/MixingModule/python/SiStripSimParameters_cfi.py +++ b/SimGeneral/MixingModule/python/SiStripSimParameters_cfi.py @@ -87,6 +87,10 @@ "TrackerHitsTIDLowTof","TrackerHitsTIDHighTof", "TrackerHitsTOBLowTof","TrackerHitsTOBHighTof", "TrackerHitsTECLowTof","TrackerHitsTECHighTof"), + ROUListPU = cms.vstring("TrackerHitsTIBLowTof","TrackerHitsTIBHighTof", + "TrackerHitsTIDLowTof","TrackerHitsTIDHighTof", + "TrackerHitsTOBLowTof","TrackerHitsTOBHighTof", + "TrackerHitsTECLowTof","TrackerHitsTECHighTof"), GeometryType = cms.string('idealForDigi'), TrackerConfigurationFromDB = cms.bool(False), ZeroSuppression = cms.bool(True), @@ -156,3 +160,11 @@ CouplingConstantsRunIIDecW = True, #for TID and TEC APVShapeDecoFile =cms.FileInPath("SimTracker/SiStripDigitizer/data/APVShapeDeco_320.txt") ) +# when FastSim events as PileUP events during mixing +from Configuration.ProcessModifiers.fastSimPU_cff import fastSimPU +fastSimPU.toModify(SiStripSimBlock, + ROUListPU = cms.vstring('TrackerHits')) +from Configuration.Eras.Modifier_fastSim_cff import fastSim +fastSim.toModify(SiStripSimBlock, + ROUList = cms.vstring('TrackerHits'), + ROUListPU = cms.vstring('TrackerHits')) diff --git a/SimGeneral/MixingModule/python/ecalDigitizer_cfi.py b/SimGeneral/MixingModule/python/ecalDigitizer_cfi.py index a23451af1df6c..22e7276d7e278 100644 --- a/SimGeneral/MixingModule/python/ecalDigitizer_cfi.py +++ b/SimGeneral/MixingModule/python/ecalDigitizer_cfi.py @@ -20,13 +20,20 @@ ecal_notCont_sim, es_electronics_sim, hitsProducer = cms.string('g4SimHits'), + hitsProducerPU = cms.string('g4SimHits'), accumulatorType = cms.string("EcalDigiProducer"), makeDigiSimLinks = cms.untracked.bool(False) ) from Configuration.Eras.Modifier_fastSim_cff import fastSim -fastSim.toModify(ecalDigitizer, hitsProducer = "fastSimProducer") - +fastSim.toModify(ecalDigitizer, + hitsProducer = cms.string('fastSimProducer'), + hitsProducerPU = cms.string('fastSimProducer')) + +from Configuration.ProcessModifiers.fastSimPU_cff import fastSimPU +fastSimPU.toModify(ecalDigitizer, + hitsProducerPU = cms.string('fastSimProducer')) + ecalDigitizer.doEB = cms.bool(True) ecalDigitizer.doEE = cms.bool(True) ecalDigitizer.doES = cms.bool(True) diff --git a/SimGeneral/MixingModule/python/mixObjects_cfi.py b/SimGeneral/MixingModule/python/mixObjects_cfi.py index 8644ee7a254fd..f3cccbc3952f9 100644 --- a/SimGeneral/MixingModule/python/mixObjects_cfi.py +++ b/SimGeneral/MixingModule/python/mixObjects_cfi.py @@ -70,7 +70,21 @@ 'MuonRPCHits', 'TrackerHits'] ) - +from Configuration.ProcessModifiers.fastSimPU_cff import fastSimPU +fastSimPU.toModify(mixSimHits, + input = mixSimHits.input + + [ cms.InputTag("MuonSimHits","MuonCSCHits"), + cms.InputTag("MuonSimHits","MuonDTHits"), + cms.InputTag("MuonSimHits","MuonRPCHits"), + cms.InputTag("MuonSimHits","MuonGEMHits"), + cms.InputTag("fastSimProducer","TrackerHits")], + subdets = mixSimHits.subdets + + ['MuonCSCHits', + 'MuonDTHits', + 'MuonRPCHits', + 'MuonGEMHits', + 'TrackerHits'] +) mixCaloHits = cms.PSet( input = cms.VInputTag( # note that this list needs to be in the same order as the subdets #cms.InputTag("g4SimHits","CaloHitsTk"), cms.InputTag("g4SimHits","CastorBU"), cms.InputTag("g4SimHits","CastorPL"), cms.InputTag("g4SimHits","CastorTU"), @@ -107,6 +121,19 @@ 'EcalHitsES', 'HcalHits'] ) +# fastsimPU customs +fastSimPU.toModify(mixCaloHits, + input = mixCaloHits.input + + ["fastSimProducer:EcalHitsEB", + "fastSimProducer:EcalHitsEE", + "fastSimProducer:EcalHitsES", + "fastSimProducer:HcalHits"], + subdets = mixCaloHits.subdets + + ['EcalHitsEB', + 'EcalHitsEE', + 'EcalHitsES', + 'HcalHits'] +) mixSimTracks = cms.PSet( @@ -123,6 +150,8 @@ # fastsim customs fastSim.toModify(mixSimTracks, input = ["fastSimProducer"]) fastSim.toModify(mixSimVertices, input = ["fastSimProducer"]) +fastSimPU.toModify(mixSimTracks, input = mixSimTracks.input + ["fastSimProducer"]) +fastSimPU.toModify(mixSimVertices, input = mixSimVertices.input + ["fastSimProducer"]) mixHepMCProducts = cms.PSet( makeCrossingFrame = cms.untracked.bool(True), @@ -155,7 +184,7 @@ ) # fastsim customs -fastSim.toModify(theMixObjects, mixRecoTracks = cms.PSet(mixReconstructedTracks)) +(fastSim | fastSimPU).toModify(theMixObjects, mixRecoTracks = cms.PSet(mixReconstructedTracks)) mixPCFSimHits = cms.PSet( input = cms.VInputTag(cms.InputTag("CFWriter","g4SimHitsBSCHits"), cms.InputTag("CFWriter","g4SimHitsBCM1FHits"), cms.InputTag("CFWriter","g4SimHitsPLTHits"), cms.InputTag("CFWriter","g4SimHitsFP420SI"), cms.InputTag("CFWriter","g4SimHitsMuonCSCHits"), cms.InputTag("CFWriter","g4SimHitsMuonDTHits"), cms.InputTag("CFWriter","g4SimHitsMuonRPCHits"), diff --git a/SimGeneral/MixingModule/python/mix_probFunction_25ns_PoissonOOTPU_cfi.py b/SimGeneral/MixingModule/python/mix_probFunction_25ns_PoissonOOTPU_cfi.py index b0466ad56277a..6e36dd286977a 100644 --- a/SimGeneral/MixingModule/python/mix_probFunction_25ns_PoissonOOTPU_cfi.py +++ b/SimGeneral/MixingModule/python/mix_probFunction_25ns_PoissonOOTPU_cfi.py @@ -52,5 +52,5 @@ mixObjects = cms.PSet(theMixObjects) ) - - +from Configuration.ProcessModifiers.fastSimPU_cff import fastSimPU +fastSimPU.toModify(mix, skipProductCheck = cms.bool(True)) diff --git a/SimGeneral/MixingModule/python/pixelDigitizer_cfi.py b/SimGeneral/MixingModule/python/pixelDigitizer_cfi.py index 7dbb0ab4b9e14..cdbdf2e5130fd 100644 --- a/SimGeneral/MixingModule/python/pixelDigitizer_cfi.py +++ b/SimGeneral/MixingModule/python/pixelDigitizer_cfi.py @@ -6,6 +6,7 @@ SiPixelSimBlock, accumulatorType = cms.string("SiPixelDigitizer"), hitsProducer = cms.string('g4SimHits'), + hitsProducerPU = cms.string('g4SimHits'), makeDigiSimLinks = cms.untracked.bool(True) ) from Configuration.ProcessModifiers.premix_stage1_cff import premix_stage1 @@ -56,4 +57,12 @@ AdcFullScale = 1023, MissCalibrate = False ) +# when FastSim events as PileUP events during mixing +from Configuration.ProcessModifiers.fastSimPU_cff import fastSimPU +fastSimPU.toModify(pixelDigitizer, + hitsProducerPU = cms.string('fastSimProducer')) +from Configuration.Eras.Modifier_fastSim_cff import fastSim +fastSim.toModify(pixelDigitizer, + hitsProducer = cms.string('fastSimProducer'), + hitsProducerPU = cms.string('fastSimProducer')) diff --git a/SimGeneral/MixingModule/python/stripDigitizer_cfi.py b/SimGeneral/MixingModule/python/stripDigitizer_cfi.py index 0a99a3424543c..ace231c76bde2 100644 --- a/SimGeneral/MixingModule/python/stripDigitizer_cfi.py +++ b/SimGeneral/MixingModule/python/stripDigitizer_cfi.py @@ -7,6 +7,7 @@ SiStripSimBlock, accumulatorType = cms.string("SiStripDigitizer"), hitsProducer = cms.string('g4SimHits'), + hitsProducerPU = cms.string('g4SimHits'), makeDigiSimLinks = cms.untracked.bool(True) ) @@ -30,4 +31,12 @@ phase2_tracker.toModify( stripDigitizer, ROUList = ["g4SimHitsTrackerHitsPixelBarrelLowTof", "g4SimHitsTrackerHitsPixelEndcapLowTof"] ) +# when FastSim events as PileUP events during mixing +from Configuration.ProcessModifiers.fastSimPU_cff import fastSimPU +fastSimPU.toModify(stripDigitizer, + hitsProducerPU = cms.string('fastSimProducer')) +from Configuration.Eras.Modifier_fastSim_cff import fastSim +fastSim.toModify(stripDigitizer, + hitsProducer = cms.string('fastSimProducer'), + hitsProducerPU = cms.string('fastSimProducer')) diff --git a/SimGeneral/MixingModule/python/trackingTruthProducer_cfi.py b/SimGeneral/MixingModule/python/trackingTruthProducer_cfi.py index de2df4181ed18..05a282cbcb31c 100644 --- a/SimGeneral/MixingModule/python/trackingTruthProducer_cfi.py +++ b/SimGeneral/MixingModule/python/trackingTruthProducer_cfi.py @@ -21,12 +21,14 @@ cms.InputTag('g4SimHits','TrackerHitsTECLowTof'), cms.InputTag('g4SimHits','TrackerHitsTECHighTof') ), pixel = cms.VInputTag(cms.InputTag( 'g4SimHits','TrackerHitsPixelBarrelLowTof'), - cms.InputTag('g4SimHits','TrackerHitsPixelBarrelHighTof'), - cms.InputTag('g4SimHits','TrackerHitsPixelEndcapLowTof'), - cms.InputTag('g4SimHits','TrackerHitsPixelEndcapHighTof') ) + cms.InputTag('g4SimHits','TrackerHitsPixelBarrelHighTof'), + cms.InputTag('g4SimHits','TrackerHitsPixelEndcapLowTof'), + cms.InputTag('g4SimHits','TrackerHitsPixelEndcapHighTof') ) ), simTrackCollection = cms.InputTag('g4SimHits'), simVertexCollection = cms.InputTag('g4SimHits'), + simTrackCollectionPU = cms.InputTag('g4SimHits'), + simVertexCollectionPU = cms.InputTag('g4SimHits'), genParticleCollection = cms.InputTag('genParticles'), removeDeadModules = cms.bool(False), # currently not implemented volumeRadius = cms.double(120.0), @@ -48,10 +50,42 @@ cms.InputTag('MuonSimHits','MuonRPCHits') ), trackerAndPixel = cms.VInputTag( cms.InputTag('fastSimProducer','TrackerHits') ) ), - simTrackCollection = 'fastSimProducer', - simVertexCollection = 'fastSimProducer' + simTrackCollection = cms.InputTag('fastSimProducer'), + simVertexCollection = cms.InputTag('fastSimProducer'), + simTrackCollectionPU = cms.InputTag('fastSimProducer'), + simVertexCollectionPU = cms.InputTag('fastSimProducer') ) +from Configuration.ProcessModifiers.fastSimPU_cff import fastSimPU +fastSimPU.toModify(trackingParticles, + simHitCollections = cms.PSet( + muon = cms.VInputTag( + cms.InputTag('g4SimHits','MuonDTHits'), + cms.InputTag('g4SimHits','MuonCSCHits'), + cms.InputTag('g4SimHits','MuonRPCHits'), + cms.InputTag('MuonSimHits','MuonDTHits'), + cms.InputTag('MuonSimHits','MuonCSCHits'), + cms.InputTag('MuonSimHits','MuonRPCHits') ), + tracker = cms.VInputTag( + cms.InputTag('g4SimHits','TrackerHitsTIBLowTof'), + cms.InputTag('g4SimHits','TrackerHitsTIBHighTof'), + cms.InputTag('g4SimHits','TrackerHitsTIDLowTof'), + cms.InputTag('g4SimHits','TrackerHitsTIDHighTof'), + cms.InputTag('g4SimHits','TrackerHitsTOBLowTof'), + cms.InputTag('g4SimHits','TrackerHitsTOBHighTof'), + cms.InputTag('g4SimHits','TrackerHitsTECLowTof'), + cms.InputTag('g4SimHits','TrackerHitsTECHighTof')), + pixel = cms.VInputTag( + cms.InputTag('g4SimHits','TrackerHitsPixelBarrelLowTof'), + cms.InputTag('g4SimHits','TrackerHitsPixelBarrelHighTof'), + cms.InputTag('g4SimHits','TrackerHitsPixelEndcapLowTof'), + cms.InputTag('g4SimHits','TrackerHitsPixelEndcapHighTof')), + trackerAndPixel = cms.VInputTag( cms.InputTag('fastSimProducer','TrackerHits') ) + ), + simTrackCollectionPU = cms.InputTag('fastSimProducer'), + simVertexCollectionPU = cms.InputTag('fastSimProducer') +) + from Configuration.Eras.Modifier_run2_GEM_2017_cff import run2_GEM_2017 run2_GEM_2017.toModify(trackingParticles, simHitCollections = dict( muon = trackingParticles.simHitCollections.muon+[cms.InputTag("g4SimHits","MuonGEMHits")])) diff --git a/SimGeneral/TrackingAnalysis/plugins/TrackingTruthAccumulator.cc b/SimGeneral/TrackingAnalysis/plugins/TrackingTruthAccumulator.cc index 9d99992b4be05..1934e3fc2feb3 100644 --- a/SimGeneral/TrackingAnalysis/plugins/TrackingTruthAccumulator.cc +++ b/SimGeneral/TrackingAnalysis/plugins/TrackingTruthAccumulator.cc @@ -269,8 +269,10 @@ TrackingTruthAccumulator::TrackingTruthAccumulator(const edm::ParameterSet &conf createInitialVertexCollection_(config.getParameter("createInitialVertexCollection")), addAncestors_(config.getParameter("alwaysAddAncestors")), removeDeadModules_(config.getParameter("removeDeadModules")), - simTrackLabel_(config.getParameter("simTrackCollection")), - simVertexLabel_(config.getParameter("simVertexCollection")), + simTrackLabelSig_(config.getParameter("simTrackCollection")), + simVertexLabelSig_(config.getParameter("simVertexCollection")), + simTrackLabelPU_(config.getParameter("simTrackCollectionPU")), + simVertexLabelPU_(config.getParameter("simVertexCollectionPU")), collectionTags_(), genParticleLabel_(config.getParameter("genParticleCollection")), hepMCproductLabel_(config.getParameter("HepMCProductLabel")), @@ -335,6 +337,8 @@ TrackingTruthAccumulator::TrackingTruthAccumulator(const edm::ParameterSet &conf iC.consumes>(simTrackLabel_); iC.consumes>(simVertexLabel_); + iC.consumes>(simTrackLabelPU_); + iC.consumes>(simVertexLabelPU_); iC.consumes>(genParticleLabel_); iC.consumes>(genParticleLabel_); iC.consumes>(hepMCproductLabel_); @@ -390,6 +394,13 @@ void TrackingTruthAccumulator::accumulate(edm::Event const &event, edm::EventSet edm::Handle hepmc; event.getByLabel(hepMCproductLabel_, hepmc); + simTrackLabel_ = simTrackLabelSig_; + simVertexLabel_ = simVertexLabelSig_; + +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("TrackingTruthAccumulator") << "accumulate for Signal " + << " SimVertex " << simVertexLabel_ << " SimTrack " << simTrackLabel_; +#endif accumulateEvent(event, setup, hepmc); } @@ -405,6 +416,14 @@ void TrackingTruthAccumulator::accumulate(PileUpEventPrincipal const &event, // simply create empty handle as we do not have a HepMCProduct in PU anyway edm::Handle hepmc; + simTrackLabel_ = simTrackLabelPU_; + simVertexLabel_ = simVertexLabelPU_; + +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("TrackingTruthAccumulator") << "accumulate for PU " + << " SimVertex " << simVertexLabel_ << " SimTrack " << simTrackLabel_; +#endif + accumulateEvent(event, setup, hepmc); } else edm::LogInfo(messageCategory_) << "Skipping pileup event for bunch crossing " << event.bunchCrossing(); @@ -575,6 +594,13 @@ void TrackingTruthAccumulator::fillSimHits(std::vector &returnV event.getByLabel(collectionTag, hSimHits); // TODO - implement removing the dead modules + if (!hSimHits.isValid()) + continue; + // TODO - implement removing the dead modules +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("TrackingTruthAccumulator") + << "fillSimHits " << collectionTag << " SimHit Size " << hSimHits->size(); +#endif for (const auto &simHit : *hSimHits) { returnValue.push_back(&simHit); } @@ -1028,8 +1054,6 @@ namespace // Unnamed namespace for things only used in this file "parent."); } } // end of loop over decay vertices - - std::cout << "TrackingTruthAccumulator.cc integrityCheck() completed successfully" << std::endl; } // end of ::DecayChain::integrityCheck() #endif diff --git a/SimGeneral/TrackingAnalysis/plugins/TrackingTruthAccumulator.h b/SimGeneral/TrackingAnalysis/plugins/TrackingTruthAccumulator.h index f00d669ce9615..51eb03fef3c9e 100644 --- a/SimGeneral/TrackingAnalysis/plugins/TrackingTruthAccumulator.h +++ b/SimGeneral/TrackingAnalysis/plugins/TrackingTruthAccumulator.h @@ -137,8 +137,12 @@ class TrackingTruthAccumulator : public DigiAccumulatorMixMod { /// As of 11/Feb/2013 this option hasn't been implemented yet. const bool removeDeadModules_; - const edm::InputTag simTrackLabel_; - const edm::InputTag simVertexLabel_; + edm::InputTag simTrackLabel_; + edm::InputTag simVertexLabel_; + edm::InputTag simTrackLabelSig_; + edm::InputTag simVertexLabelSig_; + edm::InputTag simTrackLabelPU_; + edm::InputTag simVertexLabelPU_; std::vector collectionTags_; edm::InputTag genParticleLabel_; /// Needed to add HepMC::GenVertex to SimVertex diff --git a/SimMuon/CSCDigitizer/python/muonCSCDigis_cfi.py b/SimMuon/CSCDigitizer/python/muonCSCDigis_cfi.py index 14f17c91b9deb..e6abb24265176 100644 --- a/SimMuon/CSCDigitizer/python/muonCSCDigis_cfi.py +++ b/SimMuon/CSCDigitizer/python/muonCSCDigis_cfi.py @@ -74,6 +74,7 @@ mixLabel = cms.string("mix"), InputCollection = cms.string("g4SimHitsMuonCSCHits"), + InputCollectionPU = cms.string('g4SimHitsMuonCSCHits'), stripConditions = cms.string('Database'), GeometryType = cms.string('idealForDigi'), @@ -90,7 +91,13 @@ run2_common.toModify( simMuonCSCDigis.wires, bunchTimingOffsets=[0.0, 22.88, 22.55, 29.28, 30.0, 30.0, 30.5, 31.0, 29.5, 29.1, 29.88] ) from Configuration.Eras.Modifier_fastSim_cff import fastSim -fastSim.toModify(simMuonCSCDigis, InputCollection = 'MuonSimHitsMuonCSCHits') +fastSim.toModify(simMuonCSCDigis, + InputCollection = cms.string('MuonSimHitsMuonCSCHits'), + InputCollectionPU = cms.string('MuonSimHitsMuonCSCHits')) + +from Configuration.ProcessModifiers.fastSimPU_cff import fastSimPU +fastSimPU.toModify(simMuonCSCDigis, + InputCollectionPU = cms.string('MuonSimHitsMuonCSCHits')) from Configuration.ProcessModifiers.premix_stage2_cff import premix_stage2 premix_stage2.toModify(simMuonCSCDigis, mixLabel = "mixData") diff --git a/SimMuon/CSCDigitizer/src/CSCDigiProducer.cc b/SimMuon/CSCDigitizer/src/CSCDigiProducer.cc index 993eb879b8676..4d884c3a27576 100644 --- a/SimMuon/CSCDigitizer/src/CSCDigiProducer.cc +++ b/SimMuon/CSCDigitizer/src/CSCDigiProducer.cc @@ -47,9 +47,15 @@ CSCDigiProducer::CSCDigiProducer(const edm::ParameterSet &ps) : theDigitizer(ps) "in the configuration file or remove the modules that require it."; } - std::string mix_ = ps.getParameter("mixLabel"); - std::string collection_ = ps.getParameter("InputCollection"); - cf_token = consumes>(edm::InputTag(mix_, collection_)); + const std::string &mix = ps.getParameter("mixLabel"); + const std::set collections_for_XF{ps.getParameter("InputCollection"), + ps.getParameter("InputCollectionPU")}; + for (const auto &cname : collections_for_XF) { +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("CSCDigiProducer") << "Creating CrossingFrame Consumers for InputTag " << mix << ":" << cname; +#endif + cf_tokens.push_back(consumes>(edm::InputTag(mix, cname))); + } } CSCDigiProducer::~CSCDigiProducer() { delete theStripConditions; } @@ -60,18 +66,22 @@ void CSCDigiProducer::produce(edm::Event &ev, const edm::EventSetup &eventSetup) edm::Service rng; CLHEP::HepRandomEngine *engine = &rng->getEngine(ev.streamID()); - edm::Handle> cf; - ev.getByToken(cf_token, cf); - - std::unique_ptr> hits(new MixCollection(cf.product())); + std::vector *> cf_list; + for (const auto &token : cf_tokens) { + const auto &handle = ev.getHandle(token); + if (handle.isValid()) { + cf_list.emplace_back(handle.product()); + } else + edm::LogWarning("CSCDigitizer") << "Input Source not Valid !!"; + } + auto hits = std::make_unique>(cf_list); // Create empty output - - std::unique_ptr pWireDigis(new CSCWireDigiCollection()); - std::unique_ptr pStripDigis(new CSCStripDigiCollection()); - std::unique_ptr pComparatorDigis(new CSCComparatorDigiCollection()); - std::unique_ptr pWireDigiSimLinks(new DigiSimLinks()); - std::unique_ptr pStripDigiSimLinks(new DigiSimLinks()); + auto pWireDigis = std::make_unique(); + auto pStripDigis = std::make_unique(); + auto pComparatorDigis = std::make_unique(); + auto pWireDigiSimLinks = std::make_unique(); + auto pStripDigiSimLinks = std::make_unique(); //@@ DOES NOTHING IF NO HITS. Remove this for when there's real neutrons if (hits->size() > 0) { diff --git a/SimMuon/CSCDigitizer/src/CSCDigiProducer.h b/SimMuon/CSCDigitizer/src/CSCDigiProducer.h index d7d49a347232f..7fded8d1a46c5 100644 --- a/SimMuon/CSCDigitizer/src/CSCDigiProducer.h +++ b/SimMuon/CSCDigitizer/src/CSCDigiProducer.h @@ -28,7 +28,7 @@ class CSCDigiProducer : public edm::stream::EDProducer<> { CSCDigitizer theDigitizer; CSCStripConditions *theStripConditions; - edm::EDGetTokenT> cf_token; + std::vector>> cf_tokens; edm::ESGetToken geom_Token; edm::ESGetToken magfield_Token; edm::ESGetToken pdt_Token; diff --git a/SimMuon/DTDigitizer/python/muonDTDigis_cfi.py b/SimMuon/DTDigitizer/python/muonDTDigis_cfi.py index 5002f3028be74..21b0c070f70b6 100644 --- a/SimMuon/DTDigitizer/python/muonDTDigis_cfi.py +++ b/SimMuon/DTDigitizer/python/muonDTDigis_cfi.py @@ -22,6 +22,7 @@ #Name of Collection used for create the XF mixLabel = cms.string('mix'), InputCollection = cms.string('g4SimHitsMuonDTHits'), + InputCollectionPU = cms.string('g4SimHitsMuonDTHits'), debug = cms.untracked.bool(False), # Its parameters pset = cms.PSet( @@ -41,7 +42,13 @@ from Configuration.Eras.Modifier_fastSim_cff import fastSim -fastSim.toModify(simMuonDTDigis, InputCollection = 'MuonSimHitsMuonDTHits') +fastSim.toModify(simMuonDTDigis, + InputCollection = cms.string('MuonSimHitsMuonDTHits'), + InputCollectionPU = cms.string('MuonSimHitsMuonDTHits')) +from Configuration.ProcessModifiers.fastSimPU_cff import fastSimPU +fastSimPU.toModify(simMuonDTDigis, + InputCollectionPU = cms.string('MuonSimHitsMuonDTHits')) + from Configuration.ProcessModifiers.premix_stage2_cff import premix_stage2 premix_stage2.toModify(simMuonDTDigis, mixLabel = "mixData") diff --git a/SimMuon/DTDigitizer/src/DTDigitizer.cc b/SimMuon/DTDigitizer/src/DTDigitizer.cc index 29d762a450abe..3525d9db76d0c 100644 --- a/SimMuon/DTDigitizer/src/DTDigitizer.cc +++ b/SimMuon/DTDigitizer/src/DTDigitizer.cc @@ -115,9 +115,16 @@ DTDigitizer::DTDigitizer(const ParameterSet &conf_) LinksTimeWindow = conf_.getParameter("LinksTimeWindow"); // (10 ns) // Name of Collection used for create the XF - mix_ = conf_.getParameter("mixLabel"); - collection_for_XF = conf_.getParameter("InputCollection"); - cf_token = consumes>(edm::InputTag(mix_, collection_for_XF)); + const std::string &mix = conf_.getParameter("mixLabel"); + const std::set collections_for_XF{conf_.getParameter("InputCollection"), + conf_.getParameter("InputCollectionPU")}; + for (const auto &cname : collections_for_XF) { +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("DTDigiProducer") << "Creating CrossingFrame Consumers for InputTag " << mix << ":" << cname; +#endif + cf_tokens.push_back(consumes>(edm::InputTag(mix, cname))); + } + magnField_token = esConsumes(); // String to choose between ideal (the default) and (mis)aligned geometry @@ -140,15 +147,21 @@ void DTDigitizer::produce(Event &iEvent, const EventSetup &iSetup) { // iEvent.getByLabel("g4SimHits","MuonDTHits",simHits); // use MixCollection instead of the previous - Handle> xFrame; - iEvent.getByToken(cf_token, xFrame); - - unique_ptr> simHits(new MixCollection(xFrame.product())); + std::vector *> cf_list; + for (const auto &token : cf_tokens) { + const auto &handle = iEvent.getHandle(token); + if (handle.isValid()) { + cf_list.emplace_back(handle.product()); + + } else + edm::LogWarning("DTDigitizer") << "Input Source not Valid !!"; + } + auto simHits = std::make_unique>(cf_list); // create the pointer to the Digi container - unique_ptr output(new DTDigiCollection()); + auto output = std::make_unique(); // pointer to the DigiSimLink container - unique_ptr outputLinks(new DTDigiSimLinkCollection()); + auto outputLinks = std::make_unique(); // Muon Geometry ESHandle muonGeom = iSetup.getHandle(muonGeom_token); diff --git a/SimMuon/DTDigitizer/src/DTDigitizer.h b/SimMuon/DTDigitizer/src/DTDigitizer.h index f56f0c456d5a8..d9b6704599f0d 100644 --- a/SimMuon/DTDigitizer/src/DTDigitizer.h +++ b/SimMuon/DTDigitizer/src/DTDigitizer.h @@ -129,11 +129,7 @@ class DTDigitizer : public edm::stream::EDProducer<> { bool MultipleLinks; float LinksTimeWindow; - // Name of Collection use for create the XF - std::string mix_; - std::string collection_for_XF; - - edm::EDGetTokenT> cf_token; + std::vector>> cf_tokens; edm::ESGetToken muonGeom_token; edm::ESGetToken magnField_token; }; diff --git a/SimMuon/GEMDigitizer/plugins/GEMDigiProducer.cc b/SimMuon/GEMDigitizer/plugins/GEMDigiProducer.cc index c3beddd26716d..fcf37815f8aa1 100644 --- a/SimMuon/GEMDigitizer/plugins/GEMDigiProducer.cc +++ b/SimMuon/GEMDigitizer/plugins/GEMDigiProducer.cc @@ -36,7 +36,7 @@ namespace CLHEP { class GEMDigiProducer : public edm::stream::EDProducer<> { public: - typedef edm::DetSetVector GEMDigiSimLinks; + using GEMDigiSimLinks = edm::DetSetVector; explicit GEMDigiProducer(const edm::ParameterSet& ps); @@ -50,7 +50,7 @@ class GEMDigiProducer : public edm::stream::EDProducer<> { private: //Name of Collection used for create the XF - edm::EDGetTokenT > cf_token; + std::vector>> cf_tokens_; edm::ESGetToken geom_token_; const GEMGeometry* geometry_; @@ -69,10 +69,15 @@ GEMDigiProducer::GEMDigiProducer(const edm::ParameterSet& ps) : gemDigiModule_(s << "Add the service in the configuration file or remove the modules that require it."; } - std::string mix_(ps.getParameter("mixLabel")); - std::string collection_(ps.getParameter("inputCollection")); - - cf_token = consumes >(edm::InputTag(mix_, collection_)); + const std::string& mix = ps.getParameter("mixLabel"); + const std::set collections_for_XF{ps.getParameter("inputCollection"), + ps.getParameter("inputCollectionPU")}; + for (const auto& cname : collections_for_XF) { +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("GEMDigiProducer") << "Creating CrossingFrame Consumers for InputTag " << mix << ":" << cname; +#endif + cf_tokens_.push_back(consumes>(edm::InputTag(mix, cname))); + } geom_token_ = esConsumes(); } @@ -81,6 +86,7 @@ GEMDigiProducer::~GEMDigiProducer() = default; void GEMDigiProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { edm::ParameterSetDescription desc; desc.add("inputCollection", "g4SimHitsMuonGEMHits"); + desc.add("inputCollectionPU", "g4SimHitsMuonGEMHits"); desc.add("mixLabel", "mix"); desc.add("signalPropagationSpeed", 0.66); @@ -116,8 +122,8 @@ void GEMDigiProducer::fillDescriptions(edm::ConfigurationDescriptions& descripti // The follwing parameters are needed to model the background contribution // The parameters have been obtained after the fit of th perdicted by FLUKA - // By default the backgroundmodeling with these parameters should be disabled with - // the 9_2_X release setting simulateBkgNoise = false + // By default the backgroundmodeling with these parameters should be disabled + // with the 9_2_X release setting simulateBkgNoise = false desc.add("GE11ModNeuBkgParam0", 5710.23); desc.add("GE11ModNeuBkgParam1", -43.3928); desc.add("GE11ModNeuBkgParam2", 0.0863681); @@ -144,10 +150,14 @@ void GEMDigiProducer::produce(edm::Event& e, const edm::EventSetup& eventSetup) edm::Service rng; CLHEP::HepRandomEngine* engine = &rng->getEngine(e.streamID()); - edm::Handle > cf; - e.getByToken(cf_token, cf); - - MixCollection hits{cf.product()}; + std::vector*> cf_list; + for (auto const& token : cf_tokens_) { + const auto& handle = e.getHandle(token); + if (handle.isValid()) { + cf_list.emplace_back(handle.product()); + } + } + auto hits = std::make_unique>(cf_list); // Create empty output auto digis = std::make_unique(); @@ -155,7 +165,7 @@ void GEMDigiProducer::produce(edm::Event& e, const edm::EventSetup& eventSetup) // arrange the hits by eta partition std::map hitMap; - for (const auto& hit : hits) { + for (const auto& hit : *hits) { hitMap[GEMDetId(hit.detUnitId()).rawId()].emplace_back(hit); } diff --git a/SimMuon/GEMDigitizer/python/muonGEMDigis_cfi.py b/SimMuon/GEMDigitizer/python/muonGEMDigis_cfi.py index 146dc34109ff7..17e3596fbf931 100644 --- a/SimMuon/GEMDigitizer/python/muonGEMDigis_cfi.py +++ b/SimMuon/GEMDigitizer/python/muonGEMDigis_cfi.py @@ -14,3 +14,7 @@ from Configuration.Eras.Modifier_phase2_common_cff import phase2_common phase2_common.toModify( simMuonGEMDigis, instLumi = 5) + +from Configuration.ProcessModifiers.fastSimPU_cff import fastSimPU +fastSimPU.toModify(simMuonGEMDigis, + inputCollectionPU = cms.string('MuonSimHitsMuonGEMHits')) diff --git a/SimMuon/RPCDigitizer/python/muonRPCDigis_cfi.py b/SimMuon/RPCDigitizer/python/muonRPCDigis_cfi.py index de692e497f6d2..e6986009576d3 100644 --- a/SimMuon/RPCDigitizer/python/muonRPCDigis_cfi.py +++ b/SimMuon/RPCDigitizer/python/muonRPCDigis_cfi.py @@ -29,12 +29,19 @@ Signal = cms.bool(True), mixLabel = cms.string('mix'), InputCollection = cms.string('g4SimHitsMuonRPCHits'), + InputCollectionPU = cms.string('g4SimHitsMuonRPCHits'), digiModel = cms.string('RPCSimAsymmetricCls') ) #the digitizer for PhaseII muon upgrade is RPCSimModelTiming and for the moment is based on RPCSimAverageNoiseEffCls from Configuration.Eras.Modifier_fastSim_cff import fastSim -fastSim.toModify(simMuonRPCDigis, InputCollection = 'MuonSimHitsMuonRPCHits') +fastSim.toModify(simMuonRPCDigis, + InputCollection = cms.string('MuonSimHitsMuonRPCHits'), + InputCollectionPU = cms.string('MuonSimHitsMuonRPCHits')) + +from Configuration.ProcessModifiers.fastSimPU_cff import fastSimPU +fastSimPU.toModify(simMuonRPCDigis, + InputCollectionPU = cms.string('MuonSimHitsMuonRPCHits')) _simMuonRPCDigisPhaseII = cms.EDProducer("RPCandIRPCDigiProducer", Noise = cms.bool(True), diff --git a/SimMuon/RPCDigitizer/src/RPCDigiProducer.cc b/SimMuon/RPCDigitizer/src/RPCDigiProducer.cc index b322b8733d5fb..d480de8f1c4bb 100644 --- a/SimMuon/RPCDigitizer/src/RPCDigiProducer.cc +++ b/SimMuon/RPCDigitizer/src/RPCDigiProducer.cc @@ -37,8 +37,15 @@ RPCDigiProducer::RPCDigiProducer(const edm::ParameterSet& ps) { produces("RPCDigiSimLink"); //Name of Collection used for create the XF - mix_ = ps.getParameter("mixLabel"); - collection_for_XF = ps.getParameter("InputCollection"); + const std::string& mix = ps.getParameter("mixLabel"); + const std::set collections_for_XF{ps.getParameter("InputCollection"), + ps.getParameter("InputCollectionPU")}; + for (const auto& cname : collections_for_XF) { +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("RPCDigiProducer") << "Creating CrossingFrame Consumers for InputTag " << mix << ":" << cname; +#endif + crossingFrameTokens.push_back(consumes>(edm::InputTag(mix, cname))); + } edm::Service rng; if (!rng.isAvailable()) { @@ -49,7 +56,6 @@ RPCDigiProducer::RPCDigiProducer(const edm::ParameterSet& ps) { } theRPCSimSetUp = new RPCSimSetUp(ps); theDigitizer = new RPCDigitizer(ps); - crossingFrameToken = consumes>(edm::InputTag(mix_, collection_for_XF)); geomToken = esConsumes(); noiseToken = esConsumes(); clsToken = esConsumes(); @@ -89,16 +95,19 @@ void RPCDigiProducer::produce(edm::Event& e, const edm::EventSetup& eventSetup) << "[RPCDigiProducer::produce] to activate the test go in RPCDigiProducer.cc and uncomment the line below"; // LogDebug ("RPCDigiProducer")<<"[RPCDigiProducer::produce] Fired RandFlat :: "<>& cf = e.getHandle(crossingFrameToken); - - std::unique_ptr> hits(new MixCollection(cf.product())); + std::vector*> cf_list; + for (const auto& token : crossingFrameTokens) { + const auto& handle = e.getHandle(token); + if (handle.isValid()) { + cf_list.emplace_back(handle.product()); + } + } + auto hits = std::make_unique>(cf_list); // Create empty output - std::unique_ptr pDigis(new RPCDigiCollection()); - std::unique_ptr RPCDigitSimLink(new RPCDigitizerSimLinks()); + auto pDigis = std::make_unique(); + auto RPCDigitSimLink = std::make_unique(); // run the digitizer theDigitizer->doAction(*hits, *pDigis, *RPCDigitSimLink, engine); diff --git a/SimMuon/RPCDigitizer/src/RPCDigiProducer.h b/SimMuon/RPCDigitizer/src/RPCDigiProducer.h index c9ec7d2f73080..550e9551de0d8 100644 --- a/SimMuon/RPCDigitizer/src/RPCDigiProducer.h +++ b/SimMuon/RPCDigitizer/src/RPCDigiProducer.h @@ -38,12 +38,8 @@ class RPCDigiProducer : public edm::stream::EDProducer<> { RPCDigitizer* theDigitizer; RPCSimSetUp* theRPCSimSetUp; - //Name of Collection used for create the XF - std::string mix_; - std::string collection_for_XF; - //Token for accessing data - edm::EDGetTokenT> crossingFrameToken; + std::vector>> crossingFrameTokens; //EventSetup Tokens edm::ESGetToken geomToken; diff --git a/SimTracker/SiPixelDigitizer/plugins/SiPixelDigitizer.cc b/SimTracker/SiPixelDigitizer/plugins/SiPixelDigitizer.cc index 2738d96921150..5bbeefc26ed24 100644 --- a/SimTracker/SiPixelDigitizer/plugins/SiPixelDigitizer.cc +++ b/SimTracker/SiPixelDigitizer/plugins/SiPixelDigitizer.cc @@ -97,7 +97,9 @@ namespace cms { : false), _pixeldigialgo(), hitsProducer(iConfig.getParameter("hitsProducer")), - trackerContainers(iConfig.getParameter >("RoutList")), + hitsProducerPU(iConfig.getParameter("hitsProducerPU")), + trackerContainers(iConfig.getParameter>("RoutList")), + trackerContainersPU(iConfig.getParameter>("RoutListPU")), pilotBlades(iConfig.exists("enablePilotBlades") ? iConfig.getParameter("enablePilotBlades") : false), NumberOfEndcapDisks(iConfig.exists("NumPixelEndcap") ? iConfig.getParameter("NumPixelEndcap") : 2), tTopoToken_(iC.esConsumes()), @@ -109,18 +111,21 @@ namespace cms { const std::string alias("simSiPixelDigis"); - producesCollector.produces >().setBranchAlias(alias); - producesCollector.produces >().setBranchAlias(alias + "siPixelDigiSimLink"); + producesCollector.produces>().setBranchAlias(alias); + producesCollector.produces>().setBranchAlias(alias + "siPixelDigiSimLink"); if (store_SimHitEntryExitPoints_) - producesCollector.produces >().setBranchAlias(alias + - "siPixelExtraSimHit"); + producesCollector.produces>().setBranchAlias(alias + + "siPixelExtraSimHit"); if (store_SimHitEntryExitPointsLite_) - producesCollector.produces >().setBranchAlias( + producesCollector.produces>().setBranchAlias( alias + "siPixelExtraSimHitLite"); - for (auto const& trackerContainer : trackerContainers) { - edm::InputTag tag(hitsProducer, trackerContainer); - iC.consumes >(edm::InputTag(hitsProducer, trackerContainer)); + const std::map> pmap = {{hitsProducer, trackerContainers}, + {hitsProducerPU, trackerContainersPU}}; + for (auto const& ip : pmap) { + for (auto const& ic : ip.second) { + iC.consumes>(edm::InputTag(ip.first, ic)); + } } edm::Service rng; if (!rng.isAvailable()) { @@ -141,7 +146,7 @@ namespace cms { // member functions // - void SiPixelDigitizer::accumulatePixelHits(edm::Handle > hSimHits, + void SiPixelDigitizer::accumulatePixelHits(edm::Handle> hSimHits, size_t globalSimHitIndex, const unsigned int tofBin, edm::EventSetup const& iSetup) { @@ -153,18 +158,13 @@ namespace cms { for (std::vector::const_iterator it = simHits.begin(), itEnd = simHits.end(); it != itEnd; ++it, ++globalSimHitIndex) { unsigned int detId = (*it).detUnitId(); - if (detIds.insert(detId).second) { - // The insert succeeded, so this detector element has not yet been processed. - assert(detectorUnits[detId]); - if (detectorUnits[detId] && - detectorUnits[detId] - ->type() - .isTrackerPixel()) { // this test could be avoided and changed into a check of pixdet!=0 - std::map::iterator itDet = detectorUnits.find(detId); - if (itDet == detectorUnits.end()) - continue; - auto pixdet = itDet->second; - assert(pixdet != nullptr); + auto itDet = detectorUnits.find(detId); + if (itDet == detectorUnits.end()) + continue; + auto pixdet = itDet->second; + assert(pixdet != nullptr); + if (pixdet && pixdet->type().isTrackerPixel()) { + if (detIds.insert(detId).second) { //access to magnetic field in global coordinates GlobalVector bfield = pSetup->inTesla(pixdet->surface().position()); LogDebug("PixelDigitizer ") << "B-field(T) at " << pixdet->surface().position() @@ -222,10 +222,16 @@ namespace cms { void SiPixelDigitizer::accumulate(edm::Event const& iEvent, edm::EventSetup const& iSetup) { // Step A: Get Inputs for (vstring::const_iterator i = trackerContainers.begin(), iEnd = trackerContainers.end(); i != iEnd; ++i) { - edm::Handle > simHits; + edm::Handle> simHits; edm::InputTag tag(hitsProducer, *i); iEvent.getByLabel(tag, simHits); + if (!simHits.isValid()) + continue; +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("SiPixelDigitizer") << "accumulate " + << " Accumulating SimHits for Signals with InputTag " << tag; +#endif unsigned int tofBin = PixelDigiSimLink::LowTof; if ((*i).find(std::string("HighTof")) != std::string::npos) tofBin = PixelDigiSimLink::HighTof; @@ -234,7 +240,6 @@ namespace cms { // the global counter. Next time accumulateStripHits() is called it will count the sim hits // as though they were on the end of this collection. // Note that this is only used for creating digi-sim links (if configured to do so). - // std::cout << "index offset, current hit count = " << crossingSimHitIndexOffset_[tag.encode()] << ", " << simHits->size() << std::endl; if (simHits.isValid()) crossingSimHitIndexOffset_[tag.encode()] += simHits->size(); } @@ -244,11 +249,20 @@ namespace cms { edm::EventSetup const& iSetup, edm::StreamID const& streamID) { // Step A: Get Inputs - for (vstring::const_iterator i = trackerContainers.begin(), iEnd = trackerContainers.end(); i != iEnd; ++i) { - edm::Handle > simHits; - edm::InputTag tag(hitsProducer, *i); + for (vstring::const_iterator i = trackerContainersPU.begin(), iEnd = trackerContainersPU.end(); i != iEnd; ++i) { + edm::Handle> simHits; + edm::InputTag tag(hitsProducerPU, *i); iEvent.getByLabel(tag, simHits); + + if (!simHits.isValid()) + continue; +#ifdef EDM_ML_DEBUG + edm:; + LogVerbatim("SiPixelDigitizer") << "accumulate " + << " Accumulating SimHits for PUs with InputTag " << tag; +#endif + unsigned int tofBin = PixelDigiSimLink::LowTof; if ((*i).find(std::string("HighTof")) != std::string::npos) tofBin = PixelDigiSimLink::HighTof; @@ -257,7 +271,6 @@ namespace cms { // the global counter. Next time accumulateStripHits() is called it will count the sim hits // as though they were on the end of this collection. // Note that this is only used for creating digi-sim links (if configured to do so). - // std::cout << "index offset, current hit count = " << crossingSimHitIndexOffset_[tag.encode()] << ", " << simHits->size() << std::endl; if (simHits.isValid()) crossingSimHitIndexOffset_[tag.encode()] += simHits->size(); } @@ -267,10 +280,10 @@ namespace cms { void SiPixelDigitizer::finalizeEvent(edm::Event& iEvent, const edm::EventSetup& iSetup) { const TrackerTopology* tTopo = &iSetup.getData(tTopoToken_); - std::vector > theDigiVector; - std::vector > theDigiLinkVector; - std::vector > theExtraSimHitInfoVector; - std::vector > theExtraSimHitInfoLiteVector; + std::vector> theDigiVector; + std::vector> theDigiLinkVector; + std::vector> theExtraSimHitInfoVector; + std::vector> theExtraSimHitInfoLiteVector; if (firstFinalizeEvent_) { _pixeldigialgo->init_DynIneffDB(iSetup); @@ -286,7 +299,7 @@ namespace cms { } iEvent.put(std::move(PixelFEDChannelCollection_)); } - + int totalDigis = 0; for (const auto& iu : pDD->detUnits()) { if (iu->type().isTrackerPixel()) { // @@ -384,6 +397,7 @@ namespace cms { } if (!collector.data.empty()) { + totalDigis += collector.data.size(); theDigiVector.push_back(std::move(collector)); } if (!linkcollector.data.empty()) { @@ -400,13 +414,14 @@ namespace cms { _pixeldigialgo->resetSimHitMaps(); // Step C: create collection with the cache vector of DetSet - std::unique_ptr > output(new edm::DetSetVector(theDigiVector)); - std::unique_ptr > outputlink( - new edm::DetSetVector(theDigiLinkVector)); - std::unique_ptr > outputExtraSim( - new edm::DetSetVector(theExtraSimHitInfoVector)); - std::unique_ptr > outputExtraSimLite( - new edm::DetSetVector(theExtraSimHitInfoLiteVector)); + std::unique_ptr> output = + std::make_unique>(theDigiVector); + std::unique_ptr> outputlink = + std::make_unique>(theDigiLinkVector); + std::unique_ptr> outputExtraSim = + std::make_unique>(theExtraSimHitInfoVector); + std::unique_ptr> outputExtraSimLite = + std::make_unique>(theExtraSimHitInfoLiteVector); // Step D: write output to file iEvent.put(std::move(output)); diff --git a/SimTracker/SiPixelDigitizer/plugins/SiPixelDigitizer.h b/SimTracker/SiPixelDigitizer/plugins/SiPixelDigitizer.h index 7efb0ae3608dd..5dfd53fe0086d 100644 --- a/SimTracker/SiPixelDigitizer/plugins/SiPixelDigitizer.h +++ b/SimTracker/SiPixelDigitizer/plugins/SiPixelDigitizer.h @@ -89,9 +89,11 @@ namespace cms { * The key is the name of the sim hit collection. */ std::map crossingSimHitIndexOffset_; - typedef std::vector vstring; + using vstring = std::vector; const std::string hitsProducer; + const std::string hitsProducerPU; const vstring trackerContainers; + const vstring trackerContainersPU; const TrackerGeometry* pDD = nullptr; const MagneticField* pSetup = nullptr; std::map detectorUnits; diff --git a/SimTracker/SiStripDigitizer/plugins/SiStripDigitizer.cc b/SimTracker/SiStripDigitizer/plugins/SiStripDigitizer.cc index 1c3959b14002d..9f6d5fb76c4f0 100644 --- a/SimTracker/SiStripDigitizer/plugins/SiStripDigitizer.cc +++ b/SimTracker/SiStripDigitizer/plugins/SiStripDigitizer.cc @@ -54,7 +54,9 @@ SiStripDigitizer::SiStripDigitizer(const edm::ParameterSet& conf, edm::ProducesCollector producesCollector, edm::ConsumesCollector& iC) : hitsProducer(conf.getParameter("hitsProducer")), + hitsProducerPU(conf.getParameter("hitsProducerPU")), trackerContainers(conf.getParameter>("ROUList")), + trackerContainersPU(conf.getParameter>("ROUListPU")), ZSDigi(conf.getParameter("DigiModeList").getParameter("ZSDigi")), SCDigi(conf.getParameter("DigiModeList").getParameter("SCDigi")), VRDigi(conf.getParameter("DigiModeList").getParameter("VRDigi")), @@ -95,10 +97,15 @@ SiStripDigitizer::SiStripDigitizer(const edm::ParameterSet& conf, producesCollector.produces("SimulatedAPVDynamicGain").setBranchAlias(alias + "SimulatedAPVDynamicGain"); producesCollector.produces>>>("AffectedAPVList") .setBranchAlias(alias + "AffectedAPV"); - for (auto const& trackerContainer : trackerContainers) { - edm::InputTag tag(hitsProducer, trackerContainer); - iC.consumes>(edm::InputTag(hitsProducer, trackerContainer)); + + const std::map> pmap = {{hitsProducer, trackerContainers}, + {hitsProducerPU, trackerContainersPU}}; + for (auto const& ip : pmap) { + for (auto const& ic : ip.second) { + iC.consumes>(edm::InputTag(ip.first, ic)); + } } + edm::Service rng; if (!rng.isAvailable()) { throw cms::Exception("Configuration") @@ -126,11 +133,13 @@ void SiStripDigitizer::accumulateStripHits(edm::Handle> hSi for (std::vector::const_iterator it = simHits.begin(), itEnd = simHits.end(); it != itEnd; ++it, ++globalSimHitIndex) { unsigned int detId = (*it).detUnitId(); - if (detIds.insert(detId).second) { - // The insert succeeded, so this detector element has not yet been processed. - assert(detectorUnits[detId]); - if (detectorUnits[detId]->type().isTrackerStrip()) { // this test can be removed and replaced by stripdet!=0 - auto stripdet = detectorUnits[detId]; + auto itDet = detectorUnits.find(detId); + if (itDet == detectorUnits.end()) + continue; + auto stripdet = detectorUnits[detId]; + assert(stripdet); + if (stripdet->type().isTrackerStrip()) { + if (detIds.insert(detId).second) { //access to magnetic field in global coordinates GlobalVector bfield = pSetup->inTesla(stripdet->surface().position()); LogDebug("Digitizer ") << "B-field(T) at " << stripdet->surface().position() @@ -156,6 +165,13 @@ void SiStripDigitizer::accumulate(edm::Event const& iEvent, edm::EventSetup cons tofBin = StripDigiSimLink::HighTof; iEvent.getByLabel(tag, simHits); + + if (!simHits.isValid()) + continue; +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("SiStripDigitizer") << "accumulate " + << " Accumulating SimHits for Signals with InputTag " << tag; +#endif accumulateStripHits(simHits, tTopo, crossingSimHitIndexOffset_[tag.encode()], tofBin); // Now that the hits have been processed, I'll add the amount of hits in this crossing on to // the global counter. Next time accumulateStripHits() is called it will count the sim hits @@ -175,14 +191,21 @@ void SiStripDigitizer::accumulate(PileUpEventPrincipal const& iEvent, theDigiAlgo->calculateInstlumiScale(PileupInfo_.get()); // Step A: Get Inputs - for (auto const& trackerContainer : trackerContainers) { + for (auto const& trackerContainer : trackerContainersPU) { edm::Handle> simHits; - edm::InputTag tag(hitsProducer, trackerContainer); + edm::InputTag tag(hitsProducerPU, trackerContainer); unsigned int tofBin = StripDigiSimLink::LowTof; if (trackerContainer.find(std::string("HighTof")) != std::string::npos) tofBin = StripDigiSimLink::HighTof; iEvent.getByLabel(tag, simHits); + if (!simHits.isValid()) + continue; +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("SiStripDigitizer") << "accumulate " + << " Accumulating SimHits for PUs with InputTag " << tag; +#endif + accumulateStripHits(simHits, tTopo, crossingSimHitIndexOffset_[tag.encode()], tofBin); // Now that the hits have been processed, I'll add the amount of hits in this crossing on to // the global counter. Next time accumulateStripHits() is called it will count the sim hits @@ -252,18 +275,21 @@ void SiStripDigitizer::finalizeEvent(edm::Event& iEvent, edm::EventSetup const& } 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); + std::unique_ptr> theStripAmplitudeVector = + std::make_unique>(); + std::unique_ptr> theStripAmplitudeVectorPostAPV = + std::make_unique>(); + std::unique_ptr> theStripAPVBaselines = + std::make_unique>(); + std::unique_ptr> pOutputDigiSimLink = + std::make_unique>(); const TrackerTopology* tTopo = &iSetup.getData(tTopoToken_); // Step B: LOOP on StripGeomDetUnit theDigiVector.reserve(10000); theDigiVector.clear(); - + int totalDigis = 0; for (const auto& iu : pDD->detUnits()) { if (useConfFromDB) { //apply the cable map _before_ digitization: consider only the detis that are connected @@ -309,6 +335,7 @@ void SiStripDigitizer::finalizeEvent(edm::Event& iEvent, edm::EventSetup const& if (zeroSuppression) { if (!collectorZS.data.empty()) { theDigiVector.push_back(collectorZS); + totalDigis += collectorZS.data.size(); if (!collectorLink.data.empty()) pOutputDigiSimLink->insert(collectorLink); } @@ -323,12 +350,16 @@ void SiStripDigitizer::finalizeEvent(edm::Event& iEvent, edm::EventSetup const& } if (zeroSuppression) { // Step C: create output collection - std::unique_ptr> output_virginraw(new edm::DetSetVector()); - std::unique_ptr> output_scopemode(new edm::DetSetVector()); - std::unique_ptr> output_processedraw(new edm::DetSetVector()); - std::unique_ptr> output(new edm::DetSetVector(theDigiVector)); - std::unique_ptr>>> AffectedAPVList( - new std::vector>>(theAffectedAPVvector)); + std::unique_ptr> output_virginraw = + std::make_unique>(); + std::unique_ptr> output_scopemode = + std::make_unique>(); + std::unique_ptr> output_processedraw = + std::make_unique>(); + std::unique_ptr> output = + std::make_unique>(theDigiVector); + std::unique_ptr>>> AffectedAPVList = + std::make_unique>>>(theAffectedAPVvector); // Step D: write output to file iEvent.put(std::move(output), ZSDigi); @@ -345,11 +376,13 @@ void SiStripDigitizer::finalizeEvent(edm::Event& iEvent, edm::EventSetup const& std::move(pOutputDigiSimLink)); // The previous EDProducer didn't name this collection so I won't either } else { // Step C: create output collection - std::unique_ptr> output_virginraw( - new edm::DetSetVector(theRawDigiVector)); - std::unique_ptr> output_scopemode(new edm::DetSetVector()); - std::unique_ptr> output_processedraw(new edm::DetSetVector()); - std::unique_ptr> output(new edm::DetSetVector()); + std::unique_ptr> output_virginraw = + std::make_unique>(theRawDigiVector); + std::unique_ptr> output_scopemode = + std::make_unique>(); + std::unique_ptr> output_processedraw = + std::make_unique>(); + std::unique_ptr> output = std::make_unique>(); // Step D: write output to file iEvent.put(std::move(output), ZSDigi); diff --git a/SimTracker/SiStripDigitizer/plugins/SiStripDigitizer.h b/SimTracker/SiStripDigitizer/plugins/SiStripDigitizer.h index 5e8e20e2c015e..8c72ee746d2f9 100644 --- a/SimTracker/SiStripDigitizer/plugins/SiStripDigitizer.h +++ b/SimTracker/SiStripDigitizer/plugins/SiStripDigitizer.h @@ -82,12 +82,14 @@ class SiStripDigitizer : public DigiAccumulatorMixMod { size_t globalSimHitIndex, const unsigned int tofBin); - typedef std::vector vstring; - typedef std::map>, std::less> simhit_map; - typedef simhit_map::iterator simhit_map_iterator; + using vstring = std::vector; + using simhit_map = std::map>, std::less>; + using simhit_map_iterator = simhit_map::iterator; const std::string hitsProducer; + const std::string hitsProducerPU; const vstring trackerContainers; + const vstring trackerContainersPU; const std::string ZSDigi; const std::string SCDigi; const std::string VRDigi;