diff --git a/Gen/LbEvtGen/LbEvtGen/EvtGenDecay.h b/Gen/LbEvtGen/LbEvtGen/EvtGenDecay.h index e411d77e51b5ff3eb33823d143fedd1ce1df47b8..699f0517564eb987d55f198d98493448af5cdf7e 100644 --- a/Gen/LbEvtGen/LbEvtGen/EvtGenDecay.h +++ b/Gen/LbEvtGen/LbEvtGen/EvtGenDecay.h @@ -254,7 +254,7 @@ private: Gaudi::Property m_realHelOne{this, "RealHelOne", 1.}; /// Imaginary part of spin matrix for helicity 1 for charmonium polarization - Gaudi::Property m_imHelOne{this, "RealHelOne", 1.}; + Gaudi::Property m_imHelOne{this, "ImHelOne", 0.}; }; //#include "EvtGenBase/EvtIncoherentMixing.hh" diff --git a/Sim/FutureTestsDD4HEP/CMakeLists.txt b/Sim/FutureTestsDD4HEP/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..d171fcf63c4325483447c46dd888ed49b78b70a6 --- /dev/null +++ b/Sim/FutureTestsDD4HEP/CMakeLists.txt @@ -0,0 +1,15 @@ +############################################################################### +# (c) Copyright 2021 CERN for the benefit of the LHCb Collaboration # +# # +# This software is distributed under the terms of the GNU General Public # +# Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". # +# # +# In applying this licence, CERN does not waive the privileges and immunities # +# granted to it by virtue of its status as an Intergovernmental Organization # +# or submit itself to any jurisdiction. # +############################################################################### +# Temporary package holding tests for Gauss-on-Gaussino +if(USE_DD4HEP) +gaudi_subdir(FutureTestsDD4HEP) +gaudi_add_test(QMTest QMTEST) +endif() diff --git a/Sim/FutureTestsDD4HEP/options/dd4hep.py b/Sim/FutureTestsDD4HEP/options/dd4hep.py new file mode 100644 index 0000000000000000000000000000000000000000..0b30823f2e7897631454d55f2a842fe8c030d188 --- /dev/null +++ b/Sim/FutureTestsDD4HEP/options/dd4hep.py @@ -0,0 +1,83 @@ +############################################################################### +# (c) Copyright 2021 CERN for the benefit of the LHCb Collaboration # +# # +# This software is distributed under the terms of the GNU General Public # +# Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". # +# # +# In applying this licence, CERN does not waive the privileges and immunities # +# granted to it by virtue of its status as an Intergovernmental Organization # +# or submit itself to any jurisdiction. # +############################################################################### +from Gaudi.Configuration import importOptions +from Gaussino.Generation import GenPhase +from Configurables import GiGaMT +from Configurables import Generation, ToolSvc, EvtGenDecay, GenRndInit +from Configurables import Gauss, Gaussino +from Configurables import LHCbApp, CondDB +from Gauss.Geometry import LHCbGeo +from Gauss.Geometry.Helpers import getsubdetector + +# Beam options as in Beam6500GeV-md100-2016-nu1.6.py +importOptions("$APPCONFIGOPTS/Gauss/Beam7000GeV-mu100-nu7.6-HorExtAngle.py") + +# Add also the DDDB tag for now +LHCbApp().DDDBtag = "dddb-20210218" +LHCbApp().CondDBtag = "sim-20180530-vc-mu100" +LHCbApp().DataType = "Upgrade" +CondDB().Upgrade = True + +# Configure the generation phase as usual +Generation().EventType = 30000000 +GenPhase().SampleGenerationTool = "MinimumBias" +GenPhase().ProductionTool = "Pythia8ProductionMT" +GenPhase().DecayTool = "EvtGenDecay" +ToolSvc().addTool( + EvtGenDecay( + UserDecayFile="$DECFILESROOT/dkfiles/Dsst_ppbarpi=TightCut.dec", + DecayFile="$DECFILESROOT/dkfiles/DECAY.DEC")) + +# Configure number of events and parallelism +nthreads = 1 # cannot use many threads when writing output +GiGaMT().NumberOfWorkerThreads = nthreads +Gauss().EnableHive = True +Gauss().ThreadPoolSize = nthreads +Gauss().EventSlots = nthreads +GenRndInit().FirstEventNumber = 3000 +Gauss().EvtMax = 10 +Gauss().DatasetName = "gaussino-dd4hep" +Gaussino().DatasetNameForced = True # no time or EvtMax in output filenames + +# Activate global DD4hep flag, this results in the use of the DD4hep conversion service +# instead of GaussGeo +LHCbGeo().DD4hep = True +# Set the list of detectors / detector elements +LHCbGeo().DetectorGeo = {"Detectors": ['VP', 'Magnet', 'Bls']} +LHCbGeo().DetectorSim = {"Detectors": ['VP', 'Magnet', 'Bls']} +LHCbGeo().DetectorMoni = {"Detectors": ['VP', 'Magnet', 'Bls']} +# LHCbGeo().SaveGDMLFile = "detector.gdml" +# Optional mapping of a sensitive detector factory to a G4 logical volume +# LHCbGeo().SensDetMap = {'GiGaSensDetTracker/VPSDet': ["lvDet"] } +# LHCbGeo().Debug = True # Comment this in if you want a lot of debug output + +# Select and activate DD4hep for the subdetectors you want to. +# This needs to be for the future functionalities where DetDesc and +# DD4hep can be mixed but is already needed now. +getsubdetector('VP').UseDD4hep = True +getsubdetector('BeamPipe').UseDD4hep = True +getsubdetector('Magnet').UseDD4hep = True +getsubdetector('Bls').UseDD4hep = True + +# Comment in below to trigger a more verbose printout of the conversion service +# from Configurables import DD4hepCnvSvc +# from Gaudi.Configuration import VERBOSE +# DD4hepCnvSvc().OutputLevel = VERBOSE +# DD4hepCnvSvc().DebugMaterials = True +# DD4hepCnvSvc().DebugElements = True +# DD4hepCnvSvc().DebugShapes = True +# DD4hepCnvSvc().DebugVolumes = True +# DD4hepCnvSvc().DebugPlacements = True +# DD4hepCnvSvc().DebugRegions = True + +# Print some debugging information from the scheduler +from Configurables import AvalancheSchedulerSvc +AvalancheSchedulerSvc(ShowControlFlow=True, ShowDataFlow=True) diff --git a/Sim/FutureTestsDD4HEP/tests/qmtest/dd4hep.qmt b/Sim/FutureTestsDD4HEP/tests/qmtest/dd4hep.qmt new file mode 100755 index 0000000000000000000000000000000000000000..3066a561dac05bdf007f2aaf990649eea76d0ea6 --- /dev/null +++ b/Sim/FutureTestsDD4HEP/tests/qmtest/dd4hep.qmt @@ -0,0 +1,44 @@ + + + + +gaudirun.py +1200 + + ../../options/dd4hep.py + +true + + + +# from GaudiConf.QMTest.LHCbExclusions import preprocessor +# validateWithReference(preproc=preprocessor) + +countErrorLines({"FATAL": 0, "ERROR": 0, "WARNING": 0}) + +# check we processed the expected number of events +findReferenceBlock("GenRndInit INFO 10 events processed", id="processed") + +# check if some MCHits were produced (different message otherwise) +expected = "VPGaussMoni INFO Number of MCHits/Event:" +if expected not in stdout: + causes.append('missing string') + result['GaudiTest.expected_string'] = result.Quote(expected) + +# check we persisted the expected number of events +findReferenceBlock("GaussTape INFO Events output: 10", id="output") + + + \ No newline at end of file diff --git a/Sim/FutureTestsDD4HEP/tests/qmtest/ddg4_vp.qmt b/Sim/FutureTestsDD4HEP/tests/qmtest/ddg4_vp.qmt new file mode 100755 index 0000000000000000000000000000000000000000..0877b92e1ac65db73a1942acef8fec47ef1e17f1 --- /dev/null +++ b/Sim/FutureTestsDD4HEP/tests/qmtest/ddg4_vp.qmt @@ -0,0 +1,36 @@ + + + + +python + + $DETECTOR_PROJECT_ROOT/examples/ddg4_VP.py + --output=ddg4_vp.root + +true + + +import subprocess + +try: + output = subprocess.check_output(["rootls", "-t", "ddg4_vp.root:*"], text=True) +except subprocess.CalledProcessError: + causes.append("failed to list output file") + +result["output.summary"] = result.Quote(output) +if not (len(output.splitlines()) >= 6): + causes.append('output.summary is too short') + + + diff --git a/Sim/Gauss/python/Gauss/Configuration.py b/Sim/Gauss/python/Gauss/Configuration.py index c3690c66b5cdcfcc0350e8442bc6e855893d80db..f056010f8bb9f6a7381220cd728678594c56f2fb 100755 --- a/Sim/Gauss/python/Gauss/Configuration.py +++ b/Sim/Gauss/python/Gauss/Configuration.py @@ -23,6 +23,7 @@ from Gaudi.Configuration import ApplicationMgr from Configurables import LHCbConfigurableUser, LHCbApp, SimConf from Configurables import Gaussino from GaudiKernel import SystemOfUnits +from Gaussino.Utilities import configure_edm_conversion class Gauss(LHCbConfigurableUser): @@ -114,7 +115,7 @@ class Gauss(LHCbConfigurableUser): evtType = str(Generation("Generation").EventType) return evtType - def propagateSimConf(self): + def propagateSimConf(self, packing): # Propagate properties to SimConf SimConf().setProp("Writer", "GaussTape") self.setOtherProps( @@ -131,24 +132,10 @@ class Gauss(LHCbConfigurableUser): # Don't want SIM data unpacking enabled in DoD service SimConf().EnableUnpack = False - class dummy: - def __init__(self): - self.Members = [] - - packing = dummy() - # Need this dummy sequence to later extract all the algorithm that - # need to be given to the scheduler. if "GenToMCTree" in Gaussino().getProp('Phases') or "Simulation" in Gauss().getProp("Phases"): for so in self.defineCrossingList(): SimConf().PackingSequencers[so] = packing - from Gaudi.Configuration import appendPostConfigAction - - def runit(): - for a in packing.Members: - ApplicationMgr().TopAlg += [a] - - appendPostConfigAction(runit) SimConf().SaveHepMC = False def defineCrossingList(self): @@ -159,7 +146,7 @@ class Gauss(LHCbConfigurableUser): crossingList += spillOverList return crossingList - def defineOutput(self, SpillOverSlots): + def defineOutput(self, SpillOverSlots, prerequisites): """ Set up output stream according to phase processed, the spill-over slots and the type of output @@ -225,8 +212,11 @@ class Gauss(LHCbConfigurableUser): if not FileCatalog().isPropertySet("Catalogs"): FileCatalog().Catalogs = ["xmlcatalog_file:NewCatalog.xml"] - from Configurables import ApplicationMgr - ApplicationMgr().TopAlg += [simWriter] + output_seq = GaudiSequencer( + "OutputSeq", + Members=prerequisites + [SimConf().writer()], + Sequential=True) + ApplicationMgr().TopAlg += [output_seq] # Apply the configuration def __apply_configuration__(self): @@ -243,6 +233,9 @@ class Gauss(LHCbConfigurableUser): Gaussino().ParticleTable = 'git:///param/ParticleTable.txt' Gaussino().ConvertEDM = True + edm = configure_edm_conversion(self.getProp("ReDecay")) + packing = GaudiSequencer("PackingSeq", Sequential=True, IgnoreFilterPassed=True) + # Propagate beam settings for compatibility with existing option files from Gaussino.Generation import GenPhase self.setOtherProps(GenPhase(), [ @@ -254,7 +247,7 @@ class Gauss(LHCbConfigurableUser): # Propagates and sets up SimConf to be able to configure the # OutputStream during its apply_configuration - self.propagateSimConf() + self.propagateSimConf(packing) # Trigger the simulation related configuration if simulation is in # phases @@ -271,4 +264,4 @@ class Gauss(LHCbConfigurableUser): from Configurables import EvtGenDecay EvtGenDecay().DecayFile = "$DECFILESROOT/dkfiles/DECAY.DEC" - self.defineOutput(crossingList) + self.defineOutput(crossingList, prerequisites=edm + [packing]) diff --git a/Sim/Gauss/python/Gauss/Geometry/xml_writer.py b/Sim/Gauss/python/Gauss/Geometry/xml_writer.py index 14f28608f7d9ff203b1f9cc24bb4d6dd422cf6e7..c5154636d2d6e27edaf19769ac3cc3ec4f16bb86 100644 --- a/Sim/Gauss/python/Gauss/Geometry/xml_writer.py +++ b/Sim/Gauss/python/Gauss/Geometry/xml_writer.py @@ -57,6 +57,8 @@ def create_xml(includesfiles): value="/world/BeforeMagnetRegion", type="string") ET.SubElement(define, "constant", name="FT:parent", value="/world/AfterMagnetRegion/T", type="string") + ET.SubElement(define, "constant", name="Magnet:parent", + value="/world/MagnetRegion", type="string") ET.SubElement(define, "constant", name="Magnet:ignore", value="0") ET.SubElement(define, "constant", name="UpstreamRegion:ignore", value="0") ET.SubElement(define, "constant", name="BeforeMagnetRegion:ignore", value="0") # NOQA