From 401a978898d3ec471b72284f1b03b6ad9c1671a3 Mon Sep 17 00:00:00 2001 From: Marco Cattaneo Date: Tue, 6 Mar 2018 16:55:00 +0100 Subject: [PATCH 1/4] Release notes and dependencies for v44r0 --- CMakeLists.txt | 8 +- LHCbSys/CMakeLists.txt | 2 +- ReleaseNotes/release_notes_template.md | 35 +++++++ ReleaseNotes/v42r7.md | 80 ++++++++++++++++ ReleaseNotes/v44r0.md | 124 +++++++++++++++++++++++++ 5 files changed, 242 insertions(+), 7 deletions(-) create mode 100644 ReleaseNotes/release_notes_template.md create mode 100644 ReleaseNotes/v42r7.md create mode 100644 ReleaseNotes/v44r0.md diff --git a/CMakeLists.txt b/CMakeLists.txt index 9b762021500..92af3551867 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,12 +18,8 @@ include_directories(SYSTEM ${Boost_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS}) # Declare project name and version -# For clang builds, use -# USE Gaudi mr284 -# Otherwise -# USE Gaudi v28r2 -gaudi_project(LHCb v43r1 - USE Gaudi v29r0 +gaudi_project(LHCb v44r0 + USE Gaudi v29r3 DATA Gen/DecFiles Det/SQLDDDB VERSION v7r* FieldMap diff --git a/LHCbSys/CMakeLists.txt b/LHCbSys/CMakeLists.txt index 8f74ce19b78..d2e7e74655e 100644 --- a/LHCbSys/CMakeLists.txt +++ b/LHCbSys/CMakeLists.txt @@ -1,7 +1,7 @@ ################################################################################ # Package: LHCbSys ################################################################################ -gaudi_subdir(LHCbSys v43r1) +gaudi_subdir(LHCbSys v44r0) gaudi_depends_on_subdirs(Associators/AssociatorsBase Associators/MCAssociators diff --git a/ReleaseNotes/release_notes_template.md b/ReleaseNotes/release_notes_template.md new file mode 100644 index 00000000000..ab04aa3ef18 --- /dev/null +++ b/ReleaseNotes/release_notes_template.md @@ -0,0 +1,35 @@ +{% set used = [] -%} +{% macro section(labels) -%} +{% for mr in select_mrs(merge_requests, labels, used) %} +- {{mr.title}}, !{{mr.iid}} (@{{mr.author.username}}) {{find_tasks(mr)}} + {{mr.description|mdindent(2)}} +{% endfor %} +{%- endmacro %} + +{{date}} {{project}} {{version}} +=== + +This version uses Gaudi v29r3 and LCG_93 with ROOT 6.12.06. +

+This version is released on `2018-patches` branch. + +### New features +{{ section(['new feature']) }} + +### Enhancements +{{ section(['enhancement']) }} + +### Bug fixes +{{ section(['bug fix']) }} + +### Code modernisations and cleanups +{{ section(['cleanup', 'modernisation']) }} + +### Monitoring changes +{{ section(['monitoring']) }} + +### Changes to tests +{{ section(['testing']) }} + +### Other +{{ section([[]]) }} diff --git a/ReleaseNotes/v42r7.md b/ReleaseNotes/v42r7.md new file mode 100644 index 00000000000..afabbd6cbf5 --- /dev/null +++ b/ReleaseNotes/v42r7.md @@ -0,0 +1,80 @@ +2018-03-05 LHCb v42r7 +=== + +This version uses Gaudi v28r2 and LCG_88 with ROOT 6.08.06. +

+This version is released on `2017-patches` branch. + +### Updates for CondDB +- Ignore CALIBOFF if we use Git CondDB, !1095 + +- Propagate LHCbApp.CondDBtag based on .Simulation, !1094 + +- Fix the default CondDB tag for 2017, !1085 (@rmatev) + The latest tag for 2017 data type is cond-20170724, which we were using at the end of the year. + +- Set default initial time for 2017 at end of fill 6417, !1022 + +- Update to latest LHCbCond global tag for 2015: cond-20171211, !1017 + + +### Fixes to handling of Turbo data +- Correct wrong comparison in TurboConf, !1154 (@apearce) + We were applying configuration to 2015, 2016, and 2017 data, but only should have been applying it to 2015 and 2016, else Tesla will fail running over 2017 data. + +- Do not try to unpack Turbo for non-Turbo jobs, !1136 + - Add configurable list of streams that should not be handled by the unpacking mapper. + - Do not try to unpack Turbo stream data in non-Turbo jobs. + - Append in case the value has been set already. + +- Support processing of 2016 Turbo MC, !1140 + +- Link DAQ/RawEvent to Trigger/RawEvent for 2015 and 2016 Turbo data, !954 (@apearce) + Fixes LHCBPS-1721. + + +### Enhancements +- Improve FileStagerSvc and add a test, !1161 (@raaij) + - Add ssh capability to FileStagerSvc (expert use) + - Remove capability to copy LFNs directory using lcg-cp and add fix a property. + - Grab more modernizations and adapt for gcc 4.9. + +- LHCbMath, !990 (@ibelyaev) + - improve parabolic interpolation for 1D-histograms + +- LHCbMath: add Bernstein3D and Positive3D, !953 (@ibelyaev) + +- Added new platforms to the list of known ones, !929 + - x86_64-centos7-clang50-opt + - x86_64-centos7-clang50-dbg + - x86_64+avx2+fma-centos7-gcc7-opt + + + +### Bug fixes +- UnpackParticlesAndVertices: add protection against segmentation fault, !1132 + +- Fix cache building of the GET functor, !948 (@rmatev) + - Fix base class constructor call in LoKi::TES::Get + The wrong base class constructor call prevented correct cpp code generation. + - Add include in LoKiHlt.h needed for cache generation + +- Truncate existing raw files when writing, !911 (@rmatev) + Currently, if a raw file exists, it is not truncated when opened for + writing. If the existing file has a larger size, the leftover bytes + at the end will be left there and further reading will lead to segvs + due to the corrupted file. This MR simply adds the `O_TRUNC` flag to the `open` call and a + test that verifies the correct behaviour. + + +### Code modernisations and cleanups +- Update TaggerType Enum, !944 (@kheinick) + + +### Changes to tests +- Improvements to test regex replacements, !952 + - Improvements to test regex replacements + - Hide also ParamFiles version + - Hide any data package version + +- Ignore tiny difference in vdt::fast_cossin when FMA enabled, !908, !966 (@cattanem) diff --git a/ReleaseNotes/v44r0.md b/ReleaseNotes/v44r0.md new file mode 100644 index 00000000000..d7cbb5d9386 --- /dev/null +++ b/ReleaseNotes/v44r0.md @@ -0,0 +1,124 @@ + + +2018-03-06 LHCb v44r0 +=== + +This version uses Gaudi v29r3 and LCG_93 with ROOT 6.12.06. +

+This version is released on `2018-patches` branch. + +### Updates for CondDB +- Ignore CALIBOFF if we use Git CondDB, !1095 (@clemenci) [LHCBCNDB-667] + +- Propagate LHCbApp.CondDBtag based on .Simulation, !1094 (@rmatev) + This avoids always adding two entries in CondDB.Tags, one for LHCBCOND and one for SIMCOND. + +- Add 2018 DataType, !1086 (@rmatev) [LHCBCNDB-667] + +- Fix the default CondDB tag for 2017, !1085 (@rmatev) + The latest tag for 2017 data type is cond-20170724, which we were using at the end of the year. + +- Set default initial time for 2017 at end of fill 6417, !1022 (@cattanem) + +- Update to latest LHCbCond global tag for 2015: cond-20171211, !1017 (@cattanem) + +- Update default DDDB tags to pick up LHCBCNDB-659, !915 (@cattanem) +``` +Name Datatype +dddb-20171030 2010 +dddb-20171030-1 2011 +dddb-20171030-2 2012,2013 +dddb-20171030-3 2015,2016,2017 +``` + + +### Fixes to handling of Turbo data +- Correct wrong comparison in TurboConf, !1154 (@apearce) + We were applying configuration to 2015, 2016, and 2017 data, but only should have been applying it to 2015 and 2016, else Tesla will fail running over 2017 data. + +- Do not try to unpack Turbo for non-Turbo jobs, !1136 (@apearce) + +- Support processing of 2016 Turbo MC, !1135 (@apearce) + See discussion in LHCb!1132 for motivation. + +- Link DAQ/RawEvent to Trigger/RawEvent for 2015 and 2016 Turbo data, !954 (@apearce) + + + +### New features +- GaudiConf: add "light" version of dst-dump script from Bender, !1133 (@ibelyaev) + - *some* functionality can't be ported in an easy way, in particular, access to grid files, LFN -> PFN conversion, automatic setting of DDDB/CondDB-tags, etc... + + +### Enhancements +- Improve FileStagerSvc and add a test, !1160 (@raaij) + - Add ssh capability to FileStagerSvc (expert use) + - Remove capability to copy LFNs directory using lcg-cp and add fix a property. + +- Extend standalone TCK utility, !1031 (@rmatev) + This will streamline the workflow with the new TCK/HltTCK package in git. + - Create CDB from file records + - Add option to avoid reformatting when converting to CDB + +- LHCbMath: fix&improve several 2D-models, !1065 (@ibelyaev) + +- LHCbMath: refactor the code for 2D-splines, !1093 (@ibelyaev) + +- LHCbMath:, !1008 (@ibelyaev) + - rewrite 2D/3D-interpolation functions for histograms + - replace "parabolic" with "2-parabolic" interpolation for n_bins>=4 + +- LHCbMath: Improve parabolic interpolation for 1D-histograms, !990 (@ibelyaev) + +- LHCbMath, !953, !967, !971, !977, !979, !1115 (@ibelyaev) + - add generic 3D-polynomial Bernstein3D + - add positive 3D-polynomial Positive3D + +- Update TaggerType Enum !944 (@kheinick) + +- Add the RICH and Muon digit summaries (equivalent of the linkers) to the LDST output format, !1088 (@jonrob) + +- Added new platforms to the list of known ones in PlatformInfo, !929, !968 (@clemenci) + - x86_64-centos7-clang50-opt + - x86_64-centos7-clang50-dbg + - x86_64+avx2+fma-centos7-gcc7-opt + - x86_64-centos7-gcc7-dbg to PlatformInfo + + +### Bug fixes +- Fix DecisionBankKiller.AlwaysKeepBanks property, !1155 (@rmatev) + The property `AlwaysKeepBanks` uses an update handler, which was not + "used" in the constructor. + +- UnpackParticlesAndVertices: add protection against segmentation fault, !1132 (@ibelyaev) [LHCBPS-1770] + +- Correctly use RootInTES in Particle2MCLinker, !1092 (@kgizdov) + `Particle2MCLinker` was not respecting `RootInTES` and failed on MDST MC. This patch makes sure `DataOnDemand` type tools (like `MCTupleToolReconstructed`) are configured correctly. + +- Fix opening a new cdb with ConfigCDBAccessSvc, !1105 (@rmatev) + This only affects the case where `ConfigCDBAccessSvc(File='x.cdb', Mode='ReadWrite')` is used and `x.cdb` does not exist. + +- Added protection in `FTRawBankDecoder` against module numbers that are out of bounds, !1023 (@jvantilb). + +- Fix cache building of the LoKi::TES::Get functor, !948 (@rmatev) + +- Fixed messaging to deal with changes in gaudi/Gaudi!428, !917, !919 (@cattanem) + + +### Code modernisations and cleanups +- Mask gcc 7.3 compilation warnings from Python, exposed with LCG_93, !1158 (@cattanem) + +- Make forward compatible with gaudi/Gaudi!477, !941 (@graven) + +- Fix compile warnings in DAQ/MDF, !997 (@frankm) + + + +### Changes to tests +- testvdtmath: Ignore tiny difference in vdt::fast_cossin when FMA enabled, !976 (@cattanem) + +- Improvements to test regex replacements, !1042 (@cattanem) + +- Do not rely on counter order when comparing counters, !1033 (@sponce) + +- Modified LHCbTest to be more resilient for changes in counters order, !1030 (@sponce) -- GitLab From 50a6a4c3df2da561500bda5358934590080226f9 Mon Sep 17 00:00:00 2001 From: Marco Cattaneo Date: Tue, 6 Mar 2018 18:08:47 +0100 Subject: [PATCH 2/4] Update v44r0 release notes and directory --- ReleaseNotes/v42r7.md | 80 ------------------------------------------- ReleaseNotes/v44r0.md | 2 ++ 2 files changed, 2 insertions(+), 80 deletions(-) delete mode 100644 ReleaseNotes/v42r7.md diff --git a/ReleaseNotes/v42r7.md b/ReleaseNotes/v42r7.md deleted file mode 100644 index afabbd6cbf5..00000000000 --- a/ReleaseNotes/v42r7.md +++ /dev/null @@ -1,80 +0,0 @@ -2018-03-05 LHCb v42r7 -=== - -This version uses Gaudi v28r2 and LCG_88 with ROOT 6.08.06. -

-This version is released on `2017-patches` branch. - -### Updates for CondDB -- Ignore CALIBOFF if we use Git CondDB, !1095 - -- Propagate LHCbApp.CondDBtag based on .Simulation, !1094 - -- Fix the default CondDB tag for 2017, !1085 (@rmatev) - The latest tag for 2017 data type is cond-20170724, which we were using at the end of the year. - -- Set default initial time for 2017 at end of fill 6417, !1022 - -- Update to latest LHCbCond global tag for 2015: cond-20171211, !1017 - - -### Fixes to handling of Turbo data -- Correct wrong comparison in TurboConf, !1154 (@apearce) - We were applying configuration to 2015, 2016, and 2017 data, but only should have been applying it to 2015 and 2016, else Tesla will fail running over 2017 data. - -- Do not try to unpack Turbo for non-Turbo jobs, !1136 - - Add configurable list of streams that should not be handled by the unpacking mapper. - - Do not try to unpack Turbo stream data in non-Turbo jobs. - - Append in case the value has been set already. - -- Support processing of 2016 Turbo MC, !1140 - -- Link DAQ/RawEvent to Trigger/RawEvent for 2015 and 2016 Turbo data, !954 (@apearce) - Fixes LHCBPS-1721. - - -### Enhancements -- Improve FileStagerSvc and add a test, !1161 (@raaij) - - Add ssh capability to FileStagerSvc (expert use) - - Remove capability to copy LFNs directory using lcg-cp and add fix a property. - - Grab more modernizations and adapt for gcc 4.9. - -- LHCbMath, !990 (@ibelyaev) - - improve parabolic interpolation for 1D-histograms - -- LHCbMath: add Bernstein3D and Positive3D, !953 (@ibelyaev) - -- Added new platforms to the list of known ones, !929 - - x86_64-centos7-clang50-opt - - x86_64-centos7-clang50-dbg - - x86_64+avx2+fma-centos7-gcc7-opt - - - -### Bug fixes -- UnpackParticlesAndVertices: add protection against segmentation fault, !1132 - -- Fix cache building of the GET functor, !948 (@rmatev) - - Fix base class constructor call in LoKi::TES::Get - The wrong base class constructor call prevented correct cpp code generation. - - Add include in LoKiHlt.h needed for cache generation - -- Truncate existing raw files when writing, !911 (@rmatev) - Currently, if a raw file exists, it is not truncated when opened for - writing. If the existing file has a larger size, the leftover bytes - at the end will be left there and further reading will lead to segvs - due to the corrupted file. This MR simply adds the `O_TRUNC` flag to the `open` call and a - test that verifies the correct behaviour. - - -### Code modernisations and cleanups -- Update TaggerType Enum, !944 (@kheinick) - - -### Changes to tests -- Improvements to test regex replacements, !952 - - Improvements to test regex replacements - - Hide also ParamFiles version - - Hide any data package version - -- Ignore tiny difference in vdt::fast_cossin when FMA enabled, !908, !966 (@cattanem) diff --git a/ReleaseNotes/v44r0.md b/ReleaseNotes/v44r0.md index d7cbb5d9386..d33cfe8ccfc 100644 --- a/ReleaseNotes/v44r0.md +++ b/ReleaseNotes/v44r0.md @@ -7,6 +7,8 @@ This version uses Gaudi v29r3 and LCG_93 with ROOT 6.12.06.

This version is released on `2018-patches` branch. +Built relative to LHCb v43r1, with the following changes: + ### Updates for CondDB - Ignore CALIBOFF if we use Git CondDB, !1095 (@clemenci) [LHCBCNDB-667] -- GitLab From c2eb091da9e55fe3bdda99b06fdc65d9381bc279 Mon Sep 17 00:00:00 2001 From: Alex Pearce Date: Wed, 7 Mar 2018 16:40:02 +0100 Subject: [PATCH 3/4] Support 2018 Turbo data processing. --- GaudiConf/python/GaudiConf/PersistRecoConf.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/GaudiConf/python/GaudiConf/PersistRecoConf.py b/GaudiConf/python/GaudiConf/PersistRecoConf.py index 35b46dbd564..508448d8722 100644 --- a/GaudiConf/python/GaudiConf/PersistRecoConf.py +++ b/GaudiConf/python/GaudiConf/PersistRecoConf.py @@ -234,6 +234,7 @@ standardDescriptors['2017'] = _od_rename( {'Hlt2DownstreamPIDMuonSegments': 'Hlt2MuonPIDSegments', 'Hlt2LongMuonPIDs': 'Hlt2MuonPIDs'} ) +standardDescriptors['2018'] = standardDescriptors['2017'].copy() standardOutputs = {} @@ -274,7 +275,7 @@ standardOutputs['2015']["Hlt2DownstreamRichPIDs"] = ( # We have 2012 descriptors only for running the unit tests standardOutputs['2012'] = standardOutputs['2016'].copy() -# In 2017 we unpack into a prefixed location /Event/Turbo +# In 2017 and 2018 we unpack into a prefixed location /Event/Turbo standardOutputs["2017"] = { "Hlt2LongProtos": "/Event/Turbo/Long/Protos", "Hlt2DownstreamProtos": "/Event/Turbo/Downstream/Protos", @@ -305,6 +306,7 @@ standardOutputs["2017"] = { "Hlt2CaloPrsAdcs": "/Event/Turbo/Raw/Prs/Adcs", "Hlt2CaloSpdAdcs": "/Event/Turbo/Raw/Spd/Adcs" } +standardOutputs['2018'] = standardOutputs['2017'].copy() # We need to register the locations of (non-reconstructed) data @@ -319,8 +321,8 @@ externalLocations = {} externalLocations['2012'] = list(_externalLocations) externalLocations['2015'] = list(_externalLocations) externalLocations['2016'] = list(externalLocations['2015']) -# Digits are handled explicitly in 2017 -externalLocations['2017'] = [] +# Digits are handled explicitly in 2017 and 2018 +externalLocations['2017'] = externalLocations['2018'] = [] class PersistRecoPacking(object): -- GitLab From b17fe963efc72245489ed201491f3e7789186187 Mon Sep 17 00:00:00 2001 From: Adam Davis Date: Sat, 17 Mar 2018 13:13:25 +0000 Subject: [PATCH 4/4] Move PGPrimaryVertex to LHCb for use in Gauss and other projects - LHCBGAUSS-1218 --- Sim/SimComponents/CMakeLists.txt | 4 +- Sim/SimComponents/src/PGPrimaryVertex.cpp | 152 ++++++++++++++++++++++ Sim/SimComponents/src/PGPrimaryVertex.h | 116 +++++++++++++++++ 3 files changed, 271 insertions(+), 1 deletion(-) create mode 100644 Sim/SimComponents/src/PGPrimaryVertex.cpp create mode 100644 Sim/SimComponents/src/PGPrimaryVertex.h diff --git a/Sim/SimComponents/CMakeLists.txt b/Sim/SimComponents/CMakeLists.txt index 9c702bee1ca..7087ba2d573 100644 --- a/Sim/SimComponents/CMakeLists.txt +++ b/Sim/SimComponents/CMakeLists.txt @@ -6,6 +6,8 @@ gaudi_subdir(SimComponents v4r0) gaudi_depends_on_subdirs(Det/CaloDet Event/GenEvent Event/MCEvent + Event/RecEvent + Event/TrackEvent GaudiAlg Kernel/MCInterfaces Kernel/FSRAlgs) @@ -19,5 +21,5 @@ include_directories(SYSTEM ${Boost_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS}) gaudi_add_module(SimComponents src/*.cpp INCLUDE_DIRS Boost AIDA Kernel/MCInterfaces - LINK_LIBRARIES Boost CaloDetLib GenEvent MCEvent GaudiAlgLib) + LINK_LIBRARIES Boost CaloDetLib GenEvent MCEvent RecEvent TrackEvent GaudiAlgLib) diff --git a/Sim/SimComponents/src/PGPrimaryVertex.cpp b/Sim/SimComponents/src/PGPrimaryVertex.cpp new file mode 100644 index 00000000000..1336dfac6b4 --- /dev/null +++ b/Sim/SimComponents/src/PGPrimaryVertex.cpp @@ -0,0 +1,152 @@ +// Include files: +// from Gaudi +// from Event +#include "Event/Track.h" +#include "Event/State.h" +#include "Event/RecVertex.h" +#include "Event/MCTrackInfo.h" +// Local +#include "PGPrimaryVertex.h" + + + +//----------------------------------------------------------------------------- +// Implementation file for class : PGPrimaryVertex +// +// 2008-12-07 : Marcin Kucharczyk +// 2014-08-01 : Improved by Dominik Mitzel +// 2018-05-03 : A.Davis. Made all hard coded numbers configurable, +// move to LHCb from Rec so that it can be used in Gauss +//----------------------------------------------------------------------------- +DECLARE_COMPONENT( PGPrimaryVertex ) + +//============================================================================= +// Initialisation. Check parameters +//============================================================================= +StatusCode PGPrimaryVertex::initialize() { + StatusCode sc = GaudiAlgorithm::initialize(); + if ( sc.isFailure() ) return sc; + if(msgLevel(MSG::DEBUG)) debug() << "Initialisation" << endmsg; + + if( m_usePVResFile ){ + // -- Open the file containing the PV resolution + m_file = TFile::Open( m_inputFileName.value().c_str() ); + if( !m_file ){ + error() << "Could not find PV resolution template file!" << endmsg; + return StatusCode::FAILURE; + } + m_hist = (TH3D*) m_file->Get( m_histoPath.value().c_str() ); + if( !m_hist ){ + error() << "Could not find PV resolution template histogram!" << endmsg; + return StatusCode::FAILURE; + } + } else { + // -- Initialize the random number generator + sc = m_gaus.initialize(randSvc(), Rndm::Gauss(0., 1.)); + if (sc.isFailure()) { + error() << "Cannot initialize Gaussian random number generator." << endmsg; + return sc; + } + sc = m_flat.initialize(randSvc(), Rndm::Flat(0., 1.)); + if (sc.isFailure()) { + error() << "Cannot initialize Uniform random number generator." << endmsg; + return sc; + } + } + + return StatusCode::SUCCESS; +} + +//============================================================================= +// Execution +//============================================================================= +StatusCode PGPrimaryVertex::execute() { + + if(msgLevel(MSG::DEBUG)) debug() << "Execute" << endmsg; + + LHCb::RecVertices* outputVertices = new LHCb::RecVertices(); + + put(outputVertices,m_outputVerticesName); + + // find a visible MC primary vertex + double x(0.), y(0.), z(0.); + bool found(false); + LHCb::MCVertices* mcVertices = get(m_inputVerticesName); + for(LHCb::MCVertices::const_iterator itMCV = mcVertices->begin(); mcVertices->end() != itMCV; itMCV++) { + const LHCb::MCVertex* mcv = *itMCV ; + if ( 0 == mcv || !mcv->isPrimary() ) continue; + x = mcv->position().x(); + y = mcv->position().y(); + z = mcv->position().z(); + found = true; + break; + } + if (!found) { + error() << "Could not find any PV in the event" << endmsg; + return StatusCode::SUCCESS; + } + + // calculate smearing + double smearX(0.), smearY(0.), smearZ(0.); + if( m_usePVResFile ) { + // -- sample components of PV resolution according to template in histogram + m_hist->GetRandom3(smearX, smearY, smearZ); + } else { + // -- use parameterization of PV resolution + double rx = m_flat(); + if (rx < m_fracx1) + smearX = m_gaus()*m_SmearX_width1 + m_SmearX_cv1; + else if (rx < m_fracx2) + smearX = m_gaus()*m_SmearX_width2 + m_SmearX_cv2; + else + smearX = m_gaus()*m_SmearX_width3 + m_SmearX_cv3; + //y + double ry = m_flat(); + if (ry < m_fracy1) + smearY = m_gaus()*m_SmearY_width1 + m_SmearY_cv1; + else if (ry < m_fracy2) + smearY = m_gaus()*m_SmearY_width2 + m_SmearY_cv2; + else + smearY = m_gaus()*m_SmearY_width3 + m_SmearY_cv3; + double rz = m_flat(); + if (rz < m_fracz1) + smearZ = m_gaus()*m_SmearZ_width1 + m_SmearZ_cv1; + else if (rz < m_fracz2) + smearZ = m_gaus()*m_SmearZ_width2 + m_SmearZ_cv2; + else + smearZ = m_gaus()*m_SmearZ_width3 + m_SmearZ_cv3; + } + if(msgLevel(MSG::DEBUG)) debug()<<"Got smear XYZ("<clearTracks(); + Gaudi::XYZPoint cheatedPVposition(x+smearX, y+smearY, z+smearZ); + cheatedPV->setPosition(cheatedPVposition); + Gaudi::SymMatrix3x3 cheatedPVcov; + cheatedPVcov(0,0) = m_covXX; + cheatedPVcov(1,1) = m_covYY; + cheatedPVcov(2,2) = m_covZZ; + cheatedPV->setCovMatrix(cheatedPVcov); + int nDoF(1); double chi2Vtx(1.); + cheatedPV->setChi2(chi2Vtx); + cheatedPV->setNDoF(nDoF); + cheatedPV->setTechnique(LHCb::RecVertex::RecVertexType::Primary); + + // save it + outputVertices->insert(cheatedPV); + + return StatusCode::SUCCESS; +} + +//============================================================================= +// Finalize +//============================================================================= +StatusCode PGPrimaryVertex::finalize() { + + debug() << "==> Finalize" << endmsg; + + if( m_usePVResFile ) m_file->Close(); + + return GaudiAlgorithm::finalize(); // must be called after all other actions +} diff --git a/Sim/SimComponents/src/PGPrimaryVertex.h b/Sim/SimComponents/src/PGPrimaryVertex.h new file mode 100644 index 00000000000..4d005d4b851 --- /dev/null +++ b/Sim/SimComponents/src/PGPrimaryVertex.h @@ -0,0 +1,116 @@ +#ifndef PGPRIMARYVERTEX_H +#define PGPRIMARYVERTEX_H 1 +// Include files: +// from Gaudi +#include "GaudiAlg/GaudiAlgorithm.h" +#include "GaudiKernel/RndmGenerators.h" +// From MCEvent +#include "Event/MCParticle.h" +#include "Event/MCVertex.h" +// From ROOT +#include "TFile.h" +#include "TH3.h" + +//#include "MCInterfaces/IForcedBDecayTool.h" + +/** @class PVEff PGPrimaryVertex.h + * Particle Gun Primary Vertex insertion + * + * @author Marcin Kucharczyk + * @date 2008-12-07 + * @author Domink Mitzel + * @date 2014-08-01 + * @author Adam Davis + * @date 2018-05-03 + */ + +class PGPrimaryVertex : public GaudiAlgorithm { + public: + // Standard constructor + + using GaudiAlgorithm::GaudiAlgorithm; + + StatusCode initialize() override; + StatusCode execute() override; + StatusCode finalize() override; + + int fromMCVertex(const LHCb::MCParticle* mcParticle,const LHCb::MCVertex* mcVertex); + + private: + //AD. Add input vertices as a configurable in case you want to pass something non-standard + Gaudi::Property m_inputVerticesName{this, + "InputVerticesName", + LHCb::MCVertexLocation::Default, + "Input MC Vertices to use"}; + Gaudi::Property m_outputVerticesName{this, + "OutputVerticesName", + LHCb::RecVertexLocation::Primary, + "Location in TES of output"}; + Gaudi::Propertym_usePVResFile{this, + "UsePVResFile", + false, + "external input of the possible PV parameterization"}; + Gaudi::Propertym_inputFileName{this,"InputFileName", ""}; + Gaudi::Propertym_histoPath{this,"HistogramPath", "h3_resovxvyvz"}; + + Rndm::Numbers m_gaus; + Rndm::Numbers m_flat; + TFile *m_file{nullptr}; + TH3* m_hist{nullptr}; + + + //AD. make hard coded numbers configurable + //central value of smearing, X, for each gaussian + //triple gaussian resolution + //from Previous authors + //The model is 3 gaussians with fractions f1, f2, 1-f1-f2. To sample from this model we do: + // - get r uniformly distributed in [0, 1[ + // - if rm_SmearX_cv1{this,"GaussResolutionX1CentralValue",-1.64321e-04,"Triple Gaussian, G1 x mean"}; + Gaudi::Propertym_SmearX_width1{this,"GaussResolutionX1Width",2.14809e-02,"Triple Gaussian, G1 x width"}; + Gaudi::Propertym_fracx1{this,"GaussResolutionX1fraction",0.4086, "Triple Gaussian, G1 x fraction1"}; + // + Gaudi::Propertym_SmearX_cv2{this,"GaussResolutionX2CentralValue",- 2.07447e-05,"Triple Gaussian, G2 x mean"}; + Gaudi::Propertym_SmearX_width2{this,"GaussResolutionX2Width",9.28222e-03,"Triple Gaussian, G2 x width"}; + Gaudi::Propertym_fracx2{this,"GaussResolutionX2fraction",0.7969, "Triple Gaussian, G2 x fraction1+2"}; + // + Gaudi::Propertym_SmearX_cv3{this,"GaussResolutionX3CentralValue", -1.59372e-04,"Triple Gaussian, G3 x mean"}; + Gaudi::Propertym_SmearX_width3{this,"GaussResolutionX3Width",5.53627e-02,"Triple Gaussian, G3 x width"}; + + //y direction + Gaudi::Propertym_SmearY_cv1{this,"GaussResolutionY1CentralValue",-3.54945e-05,"Triple Gaussian, G1 y mean"}; + Gaudi::Propertym_SmearY_width1{this,"GaussResolutionY1Width",2.12752e-02 ,"Triple Gaussian, G1 y width"}; + Gaudi::Propertym_fracy1{this,"GaussResolutionY1fraction",0.4035, "Triple Gaussian, G1 y fraction1"}; + // + Gaudi::Propertym_SmearY_cv2{this,"GaussResolutionY2CentralValue",-1.92725e-05,"Triple Gaussian, G2 y mean"}; + Gaudi::Propertym_SmearY_width2{this,"GaussResolutionY2Width",9.42666e-03,"Triple Gaussian, G2 y width"}; + Gaudi::Propertym_fracy2{this,"GaussResolutionY2fraction",0.8039, "Triple Gaussian, G2 y fraction1+2"}; + // + Gaudi::Propertym_SmearY_cv3{this,"GaussResolutionY3CentralValue",-7.60356e-05,"Triple Gaussian, G3 y mean"}; + Gaudi::Propertym_SmearY_width3{this,"GaussResolutionY3Width",5.50516e-02,"Triple Gaussian, G3 y width"}; + + //z direction + Gaudi::Propertym_SmearZ_cv1{this,"GaussResolutionZ1CentralValue",1.92948e-03,"Triple Gaussian, G1 z mean"}; + Gaudi::Propertym_SmearZ_width1{this,"GaussResolutionZ1Width",2.93170e-01,"Triple Gaussian, G1 z width"}; + Gaudi::Propertym_fracz1{this,"GaussResolutionZ1fraction",0.1628, "Triple Gaussian, G1 z fraction1"}; + // + Gaudi::Propertym_SmearZ_cv2{this,"GaussResolutionZ2CentralValue",-6.39393e-05,"Triple Gaussian, G2 z mean"}; + Gaudi::Propertym_SmearZ_width2{this,"GaussResolutionZ2Width",4.58140e-02,"Triple Gaussian, G2 z width"}; + Gaudi::Propertym_fracz2{this,"GaussResolutionZ2fraction",0.5597, "Triple Gaussian, G2 z fraction1+2"}; + // + Gaudi::Propertym_SmearZ_cv3{this,"GaussResolutionZ3CentralValue",4.43561e-04,"Triple Gaussian, G3 z mean"}; + Gaudi::Propertym_SmearZ_width3{this,"GaussResolutionZ3Width",1.10641e-01,"Triple Gaussian, G3 z width"}; + + //covariance properties + Gaudi::Propertym_covXX{this,"CovarianceXX",4.36969844565514146e-04, "Covariance Matrix XX term"}; + Gaudi::Propertym_covYY{this,"CovarianceYY",4.09792105425419665e-04, "Covariance Matrix YY term"}; + Gaudi::Propertym_covZZ{this,"CovarianceZZ",1.85588016359800601e-02, "Covariance Matrix ZZ term"}; + + + + +}; +#endif // PGPRIMARYVERTEX_H -- GitLab