diff --git a/CMakeLists.txt b/CMakeLists.txt index 7bd3be3b3..cf4c4cb24 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -136,9 +136,6 @@ add_library(lcgeo ALIAS k4geo) target_include_directories(${PackageName} PRIVATE ${PROJECT_SOURCE_DIR}/detector/include ) target_include_directories(${PackageName}G4 PRIVATE ${PROJECT_SOURCE_DIR}/detector/include ) -# target_include_directories(${PackageName} PRIVATE ${PROJECT_SOURCE_DIR}/detectorSegmentations/include ) -# target_include_directories(${PackageName}G4 PRIVATE ${PROJECT_SOURCE_DIR}/detectorSegmentations/include ) - target_include_directories(${PackageName} PRIVATE ${PROJECT_SOURCE_DIR}/detector/calorimeter/dual-readout/include ) target_include_directories(${PackageName}G4 PRIVATE ${PROJECT_SOURCE_DIR}/detector/calorimeter/dual-readout/include ) diff --git a/FCCee/IDEA/compact/IDEA_o2_v01/DectDimensions_IDEA_o2_v01.xml b/FCCee/IDEA/compact/IDEA_o2_v01/DectDimensions_IDEA_o2_v01.xml index d8e9a9470..ced713ca0 100644 --- a/FCCee/IDEA/compact/IDEA_o2_v01/DectDimensions_IDEA_o2_v01.xml +++ b/FCCee/IDEA/compact/IDEA_o2_v01/DectDimensions_IDEA_o2_v01.xml @@ -269,7 +269,7 @@ - + diff --git a/FCCee/IDEA/compact/IDEA_o2_v01/IDEA_o2_v01.xml b/FCCee/IDEA/compact/IDEA_o2_v01/IDEA_o2_v01.xml index eb4f52957..40edfbd2e 100644 --- a/FCCee/IDEA/compact/IDEA_o2_v01/IDEA_o2_v01.xml +++ b/FCCee/IDEA/compact/IDEA_o2_v01/IDEA_o2_v01.xml @@ -58,6 +58,9 @@ + + + diff --git a/FCCee/IDEA/compact/IDEA_o2_v01/SCEPCal.xml b/FCCee/IDEA/compact/IDEA_o2_v01/SCEPCal.xml index d3cdf46f6..fdba2e3c1 100644 --- a/FCCee/IDEA/compact/IDEA_o2_v01/SCEPCal.xml +++ b/FCCee/IDEA/compact/IDEA_o2_v01/SCEPCal.xml @@ -980,8 +980,8 @@ - - + + @@ -1006,7 +1006,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - system:4,eta:11,phi:11,depth:4 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/detector/calorimeter/SCEPCalConstructor.cpp b/detector/calorimeter/SCEPCalConstructor.cpp index 0af2bfa3c..633f38aee 100644 --- a/detector/calorimeter/SCEPCalConstructor.cpp +++ b/detector/calorimeter/SCEPCalConstructor.cpp @@ -3,7 +3,7 @@ // Princeton University //=============================== -#include "detectorSegmentations/SCEPCalSegmentationHandle_k4geo.h" +#include "detectorSegmentations/SCEPCalSegmentation_k4geo.h" #include "DD4hep/DetFactoryHelper.h" #include "DD4hep/DetectorTools.h" #include "DD4hep/Printout.h" @@ -203,19 +203,21 @@ create_detector_SCEPCal(dd4hep::Detector &theDetector,xml_h xmlElement,dd4hep::S dd4hep::Polyhedra endcap1AssemblyShape(PHI_SEGMENTS,D_PHI_GLOBAL/2,2*M_PI,zEndcap1Polyhedra,rminEndcap1Polyhedra,rmaxEndcap1Polyhedra); dd4hep::Volume endcap1AssemblyVol("endcap1AssemblyVol",endcap1AssemblyShape,theDetector.material("Vacuum")); endcap1AssemblyVol.setVisAttributes(theDetector,endcapAssemblyGlobalVisXML.visStr()); - auto timingAssemblyVolId =segmentation->setVolumeID(3,0,0,0); + auto timingAssemblyVolId =segmentation->setVolumeID(6,0,0,0); int timingAssemblyVolId32=segmentation->getFirst32bits(timingAssemblyVolId); - auto barrelAssemblyVolId =segmentation->setVolumeID(1,0,0,0); + auto barrelAssemblyVolId =segmentation->setVolumeID(4,0,0,0); int barrelAssemblyVolId32=segmentation->getFirst32bits(barrelAssemblyVolId); - auto endcapAssemblyVolId =segmentation->setVolumeID(2,0,0,0); + auto endcapAssemblyVolId =segmentation->setVolumeID(5,0,0,0); int endcapAssemblyVolId32=segmentation->getFirst32bits(endcapAssemblyVolId); - auto endcap1AssemblyVolId =segmentation->setVolumeID(2,1,0,0); + auto endcap1AssemblyVolId =segmentation->setVolumeID(5,1,0,0); int endcap1AssemblyVolId32=segmentation->getFirst32bits(endcap1AssemblyVolId); experimentalHall.placeVolume(timingAssemblyVol,timingAssemblyVolId32); dd4hep::PlacedVolume barrelPlacedVol =experimentalHall.placeVolume(barrelAssemblyVol,barrelAssemblyVolId32); experimentalHall.placeVolume(endcapAssemblyVol,endcapAssemblyVolId32); experimentalHall.placeVolume(endcap1AssemblyVol,endcap1AssemblyVolId32); + barrelPlacedVol.addPhysVolID("system", detectorXML.id()); + ScepcalDetElement.setPlacement(barrelPlacedVol); int numCrystalsBarrel = 0; @@ -265,24 +267,24 @@ create_detector_SCEPCal(dd4hep::Detector &theDetector,xml_h xmlElement,dd4hep::S Position dispSipmLg(0,0,lT/2-sipmth/2); Position dispSipmTr(0,wT-sipmth/2,0); - auto timingLgId64=segmentation->setVolumeID(3,nTile*nCy+nC ,iPhi,3); - auto timingTrId64=segmentation->setVolumeID(3,nTile*nCy+nC ,iPhi,6); + auto timingLgId64=segmentation->setVolumeID(6,nTile*nCy+nC ,iPhi,3); + auto timingTrId64=segmentation->setVolumeID(6,nTile*nCy+nC ,iPhi,6); int timingLgId32=segmentation->getFirst32bits(timingLgId64); int timingTrId32=segmentation->getFirst32bits(timingTrId64); dd4hep::PlacedVolume timingLgp=tileAssemblyVolume.placeVolume(timingCrystalLgVol,timingLgId32,dispLg); dd4hep::PlacedVolume timingTrp=tileAssemblyVolume.placeVolume(timingCrystalTrVol,timingTrId32,dispTr); - timingLgp.addPhysVolID("system",3); + timingLgp.addPhysVolID("system",6); timingLgp.addPhysVolID("eta",nTile*nCy+nC); timingLgp.addPhysVolID("phi",iPhi); timingLgp.addPhysVolID("depth",3); - timingTrp.addPhysVolID("system",3); + timingTrp.addPhysVolID("system",6); timingTrp.addPhysVolID("eta",nTile*nCy+nC); timingTrp.addPhysVolID("phi",iPhi); timingTrp.addPhysVolID("depth",6); - auto sipmLgId64_1=segmentation->setVolumeID(3,nTile*nCy+nC ,iPhi,4); - auto sipmLgId64_2=segmentation->setVolumeID(3,nTile*nCy+nC ,iPhi,5); - auto sipmTrId64_1=segmentation->setVolumeID(3,nTile*nCy+nC ,iPhi,7); - auto sipmTrId64_2=segmentation->setVolumeID(3,nTile*nCy+nC ,iPhi,8); + auto sipmLgId64_1=segmentation->setVolumeID(6,nTile*nCy+nC ,iPhi,4); + auto sipmLgId64_2=segmentation->setVolumeID(6,nTile*nCy+nC ,iPhi,5); + auto sipmTrId64_1=segmentation->setVolumeID(6,nTile*nCy+nC ,iPhi,7); + auto sipmTrId64_2=segmentation->setVolumeID(6,nTile*nCy+nC ,iPhi,8); int sipmLgId32_1=segmentation->getFirst32bits(sipmLgId64_1); int sipmLgId32_2=segmentation->getFirst32bits(sipmLgId64_2); int sipmTrId32_1=segmentation->getFirst32bits(sipmTrId64_1); @@ -291,19 +293,19 @@ create_detector_SCEPCal(dd4hep::Detector &theDetector,xml_h xmlElement,dd4hep::S dd4hep::PlacedVolume sipmLgp2=tileAssemblyVolume.placeVolume(sipmBoxLgVol,sipmLgId32_2,dispLg-dispSipmLg); dd4hep::PlacedVolume sipmTrp1=tileAssemblyVolume.placeVolume(sipmBoxTrVol,sipmTrId32_1,dispTr+dispSipmTr); dd4hep::PlacedVolume sipmTrp2=tileAssemblyVolume.placeVolume(sipmBoxTrVol,sipmTrId32_2,dispTr-dispSipmTr); - sipmLgp1.addPhysVolID("system",3); + sipmLgp1.addPhysVolID("system",6); sipmLgp1.addPhysVolID("eta",nTile*nCy+nC); sipmLgp1.addPhysVolID("phi",iPhi); sipmLgp1.addPhysVolID("depth",4); - sipmLgp2.addPhysVolID("system",3); + sipmLgp2.addPhysVolID("system",6); sipmLgp2.addPhysVolID("eta",nTile*nCy+nC); sipmLgp2.addPhysVolID("phi",iPhi); sipmLgp2.addPhysVolID("depth",5); - sipmTrp1.addPhysVolID("system",3); + sipmTrp1.addPhysVolID("system",6); sipmTrp1.addPhysVolID("eta",nTile*nCy+nC); sipmTrp1.addPhysVolID("phi",iPhi); sipmTrp1.addPhysVolID("depth",7); - sipmTrp2.addPhysVolID("system",3); + sipmTrp2.addPhysVolID("system",6); sipmTrp2.addPhysVolID("eta",nTile*nCy+nC); sipmTrp2.addPhysVolID("phi",iPhi); sipmTrp2.addPhysVolID("depth",8); @@ -374,17 +376,17 @@ create_detector_SCEPCal(dd4hep::Detector &theDetector,xml_h xmlElement,dd4hep::S crystalRVol.setVisAttributes(theDetector,crystalRXML.visStr()); crystalFVol.setSensitiveDetector(sens); crystalRVol.setSensitiveDetector(sens); - auto crystalFId64=segmentation->setVolumeID(1,N_THETA_ENDCAP+iTheta ,iPhi*N_PHI_BARREL_CRYSTAL+nGamma,1); - auto crystalRId64=segmentation->setVolumeID(1,N_THETA_ENDCAP+iTheta ,iPhi*N_PHI_BARREL_CRYSTAL+nGamma,2); + auto crystalFId64=segmentation->setVolumeID(4,N_THETA_ENDCAP+iTheta ,iPhi*N_PHI_BARREL_CRYSTAL+nGamma,1); + auto crystalRId64=segmentation->setVolumeID(4,N_THETA_ENDCAP+iTheta ,iPhi*N_PHI_BARREL_CRYSTAL+nGamma,2); int crystalFId32=segmentation->getFirst32bits(crystalFId64); int crystalRId32=segmentation->getFirst32bits(crystalRId64); dd4hep::PlacedVolume crystalFp=barrelPhiAssemblyVolume.placeVolume(crystalFVol,crystalFId32,Transform3D(rot,dispF)); dd4hep::PlacedVolume crystalRp=barrelPhiAssemblyVolume.placeVolume(crystalRVol,crystalRId32,Transform3D(rot,dispR)); - crystalFp.addPhysVolID("system",1); + crystalFp.addPhysVolID("system",4); crystalFp.addPhysVolID("eta",N_THETA_ENDCAP+iTheta); crystalFp.addPhysVolID("phi",iPhi*N_PHI_BARREL_CRYSTAL+nGamma); crystalFp.addPhysVolID("depth",1); - crystalRp.addPhysVolID("system",1); + crystalRp.addPhysVolID("system",4); crystalRp.addPhysVolID("eta",N_THETA_ENDCAP+iTheta); crystalRp.addPhysVolID("phi",iPhi*N_PHI_BARREL_CRYSTAL+nGamma); crystalRp.addPhysVolID("depth",2); @@ -437,17 +439,17 @@ create_detector_SCEPCal(dd4hep::Detector &theDetector,xml_h xmlElement,dd4hep::S crystalRVol.setVisAttributes(theDetector,projRXML.visStr()); crystalFVol.setSensitiveDetector(sens); crystalRVol.setSensitiveDetector(sens); - auto crystalFId64=segmentation->setVolumeID(4,iTheta,iPhi*N_PHI_BARREL_CRYSTAL+nGamma,1); - auto crystalRId64=segmentation->setVolumeID(4,iTheta,iPhi*N_PHI_BARREL_CRYSTAL+nGamma,2); + auto crystalFId64=segmentation->setVolumeID(7,iTheta,iPhi*N_PHI_BARREL_CRYSTAL+nGamma,1); + auto crystalRId64=segmentation->setVolumeID(7,iTheta,iPhi*N_PHI_BARREL_CRYSTAL+nGamma,2); int crystalFId32=segmentation->getFirst32bits(crystalFId64); int crystalRId32=segmentation->getFirst32bits(crystalRId64); dd4hep::PlacedVolume crystalFp=barrelPhiAssemblyVolume.placeVolume(crystalFVol,crystalFId32,Transform3D(rot,dispF)); dd4hep::PlacedVolume crystalRp=barrelPhiAssemblyVolume.placeVolume(crystalRVol,crystalRId32,Transform3D(rot,dispR)); - crystalFp.addPhysVolID("system",4); + crystalFp.addPhysVolID("system",7); crystalFp.addPhysVolID("eta",iTheta); crystalFp.addPhysVolID("phi",iPhi*N_PHI_BARREL_CRYSTAL+nGamma); crystalFp.addPhysVolID("depth",1); - crystalRp.addPhysVolID("system",4); + crystalRp.addPhysVolID("system",7); crystalRp.addPhysVolID("eta",iTheta); crystalRp.addPhysVolID("phi",iPhi*N_PHI_BARREL_CRYSTAL+nGamma); crystalRp.addPhysVolID("depth",2); @@ -529,31 +531,31 @@ create_detector_SCEPCal(dd4hep::Detector &theDetector,xml_h xmlElement,dd4hep::S crystalRVol.setVisAttributes(theDetector,crystalRXML.visStr()); crystalFVol.setSensitiveDetector(sens); crystalRVol.setSensitiveDetector(sens); - auto crystalFId64=segmentation->setVolumeID(2,iTheta,iPhi*nPhiEndcapCrystal+nGamma,1); - auto crystalRId64=segmentation->setVolumeID(2,iTheta,iPhi*nPhiEndcapCrystal+nGamma,2); + auto crystalFId64=segmentation->setVolumeID(5,iTheta,iPhi*nPhiEndcapCrystal+nGamma,1); + auto crystalRId64=segmentation->setVolumeID(5,iTheta,iPhi*nPhiEndcapCrystal+nGamma,2); int crystalFId32=segmentation->getFirst32bits(crystalFId64); int crystalRId32=segmentation->getFirst32bits(crystalRId64); dd4hep::PlacedVolume crystalFp=endcapRingAssemblyVolume.placeVolume(crystalFVol,crystalFId32,Transform3D(rot,dispF)); dd4hep::PlacedVolume crystalRp=endcapRingAssemblyVolume.placeVolume(crystalRVol,crystalRId32,Transform3D(rot,dispR)); - crystalFp.addPhysVolID("system",2); + crystalFp.addPhysVolID("system",5); crystalFp.addPhysVolID("eta",iTheta); crystalFp.addPhysVolID("phi",iPhi*nPhiEndcapCrystal+nGamma); crystalFp.addPhysVolID("depth",1); - crystalRp.addPhysVolID("system",2); + crystalRp.addPhysVolID("system",5); crystalRp.addPhysVolID("eta",iTheta); crystalRp.addPhysVolID("phi",iPhi*nPhiEndcapCrystal+nGamma); crystalRp.addPhysVolID("depth",2); - auto crystalFId641=segmentation->setVolumeID(2,N_THETA_ENDCAP+N_THETA_BARREL+N_THETA_ENDCAP-iTheta,iPhi*nPhiEndcapCrystal+nGamma,1); - auto crystalRId641=segmentation->setVolumeID(2,N_THETA_ENDCAP+N_THETA_BARREL+N_THETA_ENDCAP-iTheta,iPhi*nPhiEndcapCrystal+nGamma,2); + auto crystalFId641=segmentation->setVolumeID(5,N_THETA_ENDCAP+N_THETA_BARREL+N_THETA_ENDCAP-iTheta,iPhi*nPhiEndcapCrystal+nGamma,1); + auto crystalRId641=segmentation->setVolumeID(5,N_THETA_ENDCAP+N_THETA_BARREL+N_THETA_ENDCAP-iTheta,iPhi*nPhiEndcapCrystal+nGamma,2); int crystalFId321=segmentation->getFirst32bits(crystalFId641); int crystalRId321=segmentation->getFirst32bits(crystalRId641); dd4hep::PlacedVolume crystalFp1=endcap1RingAssemblyVolume.placeVolume(crystalFVol,crystalFId321,Transform3D(rot,dispF)); dd4hep::PlacedVolume crystalRp1=endcap1RingAssemblyVolume.placeVolume(crystalRVol,crystalRId321,Transform3D(rot,dispR)); - crystalFp1.addPhysVolID("system",2); + crystalFp1.addPhysVolID("system",5); crystalFp1.addPhysVolID("eta",N_THETA_ENDCAP+N_THETA_BARREL+N_THETA_ENDCAP-iTheta); crystalFp1.addPhysVolID("phi",iPhi*nPhiEndcapCrystal+nGamma); crystalFp1.addPhysVolID("depth",1); - crystalRp1.addPhysVolID("system",2); + crystalRp1.addPhysVolID("system",5); crystalRp1.addPhysVolID("eta",N_THETA_ENDCAP+N_THETA_BARREL+N_THETA_ENDCAP-iTheta); crystalRp1.addPhysVolID("phi",iPhi*nPhiEndcapCrystal+nGamma); crystalRp1.addPhysVolID("depth",2); diff --git a/detectorSegmentations/src/SCEPCalSegmentation_k4geo.cpp b/detectorSegmentations/src/SCEPCalSegmentation_k4geo.cpp index c87eb9303..71d810f35 100644 --- a/detectorSegmentations/src/SCEPCalSegmentation_k4geo.cpp +++ b/detectorSegmentations/src/SCEPCalSegmentation_k4geo.cpp @@ -63,7 +63,8 @@ Vector3D SCEPCalSegmentation_k4geo::myPosition(const CellID& cID) const { int N_PHI_BARREL_CRYSTAL=floor(2*M_PI*Rin/(PHI_SEGMENTS*nomfw)); double D_PHI_BARREL_CRYSTAL=D_PHI_GLOBAL/N_PHI_BARREL_CRYSTAL; - if (system == 3) { + // timing + if (system == 6) { double thC_end =THETA_SIZE_ENDCAP+D_THETA_BARREL/2; double r0slice_end =Rin/sin(thC_end); double y0slice_end =r0slice_end*tan(D_THETA_BARREL/2.); @@ -98,7 +99,8 @@ Vector3D SCEPCalSegmentation_k4geo::myPosition(const CellID& cID) const { else if (nDepth_in==7) {return rotZ*(dispTimingAssembly +dispTileAssembly +dispTr +dispSipmTr);} else if (nDepth_in==8) {return rotZ*(dispTimingAssembly +dispTileAssembly +dispTr -dispSipmTr);} } - else if (system == 2) { + // endcap + else if (system == 5) { int nTheta; if (nEta_inN_THETA_ENDCAP+N_THETA_BARREL) { @@ -130,7 +132,8 @@ Vector3D SCEPCalSegmentation_k4geo::myPosition(const CellID& cID) const { return rotY*(dispSlice+rotZ*dispR); } } - else if (system == 1) { + // barrel + else if (system == 4) { int nTheta =nEta_in-N_THETA_ENDCAP; int nPhi =int(nPhi_in/N_PHI_BARREL_CRYSTAL); int nGamma =nPhi_in%N_PHI_BARREL_CRYSTAL; @@ -154,7 +157,8 @@ Vector3D SCEPCalSegmentation_k4geo::myPosition(const CellID& cID) const { return (dispSlice+rotZ*dispR); } } - else if (system == 4) { + // projective fill + else if (system == 7) { int nTheta =nEta_in; int nPhi =int(nPhi_in/N_PHI_BARREL_CRYSTAL); int nGamma =nPhi_in%N_PHI_BARREL_CRYSTAL; diff --git a/example/SteeringFile_IDEA_o2_v01.py b/example/SteeringFile_IDEA_o2_v01.py index 9133c506c..4eef726d7 100644 --- a/example/SteeringFile_IDEA_o2_v01.py +++ b/example/SteeringFile_IDEA_o2_v01.py @@ -103,8 +103,10 @@ ## List of patterns matching sensitive detectors of type Calorimeter. SIM.action.calorimeterSDTypes = ["calorimeter"] -## Replace SDAction for DREndcapTubes subdetector +## Replace SDAction for subdetectors SIM.action.mapActions["DREndcapTubes"] = "DRTubesSDAction" +SIM.action.mapActions["SCEPCal"] = "SCEPCalSDAction_DRHit" + ## Configure the regexSD for DREndcapTubes subdetector SIM.geometry.regexSensitiveDetector["DREndcapTubes"] = { "Match": ["DRETS"], @@ -184,7 +186,7 @@ } ## a map between patterns and filter objects, using patterns to attach filters to sensitive detector -SIM.filter.mapDetFilter = {} +SIM.filter.mapDetFilter = {'SCEPCal' : 'edep1kev'} ## default filter for tracking sensitive detectors; this is applied if no other filter is used for a tracker SIM.filter.tracker = "edep1kev" @@ -440,7 +442,25 @@ ## # arbitrary options can be created and set via the steering file or command line ## SIM.outputConfig.myExtension = '.csv' ## - +def setupEDM4hepOutputDR(dd4hepSimulation): + from DDG4 import EventAction, Kernel + dd = dd4hepSimulation + evt_edm4hep = EventAction(Kernel(), 'Geant4Output2EDM4hep_DRC/' + dd.outputFile, True) + evt_edm4hep.Control = True + output = dd.outputFile + if not dd.outputFile.endswith(dd.outputConfig.myExtension): + output = dd.outputFile + dd.outputConfig.myExtension + evt_edm4hep.Output = output + evt_edm4hep.enableUI() + Kernel().eventAction().add(evt_edm4hep) + eventPars = dd.meta.parseEventParameters() + evt_edm4hep.RunHeader = dd.meta.addParametersToRunHeader(dd) + evt_edm4hep.EventParametersString, evt_edm4hep.EventParametersInt, evt_edm4hep.EventParametersFloat = eventPars + evt_edm4hep.RunNumberOffset = dd.meta.runNumberOffset if dd.meta.runNumberOffset > 0 else 0 + evt_edm4hep.EventNumberOffset = dd.meta.eventNumberOffset if dd.meta.eventNumberOffset > 0 else 0 + return None +SIM.outputConfig.userOutputPlugin = setupEDM4hepOutputDR +SIM.outputConfig.myExtension = '.root' ################################################################################ ## Configuration for the Particle Handler/ MCTruth treatment diff --git a/example/scepcal_steering.py b/example/scepcal_steering.py deleted file mode 100644 index 0e0643f91..000000000 --- a/example/scepcal_steering.py +++ /dev/null @@ -1,147 +0,0 @@ -from DDSim.DD4hepSimulation import DD4hepSimulation -from g4units import mm, GeV, MeV, keV, eV -from math import pi - -SIM = DD4hepSimulation() -SIM.runType = "batch" - -SIM.printLevel = 5 -SIM.output.geometry = 7 -SIM.output.inputStage = 7 -SIM.output.kernel = 5 -SIM.output.part = 7 -SIM.output.random = 7 - -SIM.compactFile = ['FCCee/IDEA/compact/IDEA_o2_v01/SCEPCal.xml'] -SIM.macroFile = "" - -opticalPhysics = True - -# SIM.inputFiles = ['examples/wzp6_ee_ZZ_test_ecm240_1k.stdhep'] -# SIM.outputFile = 'examples/wzp6_ee_ZZ_test_ecm240_n1_cut0_BEonly.root' -SIM.numberOfEvents = 1 -SIM.skipNEvents = 0 - -SIM.gun.multiplicity = 1 -# SIM.gun.position = (0, 0, 0) #(0, 0, -50.0*mm) #(0, 0, 50.0*mm) #(0, 0, 0) -# SIM.gun.direction = (1, 1, 0) -# SIM.gun.isotrop = False -# SIM.gun.distribution = 'uniform' -# SIM.gun.energy = 10*GeV -# SIM.gun.particle = "gamma" -SIM.gun.momentumMin = 10.0*MeV-10*keV #10.00000*GeV -SIM.gun.momentumMax = 10.0*MeV+10*keV #10.00001*GeV -# SIM.gun.phiMin = 10*pi/180.0 -# SIM.gun.phiMax = 10*pi/180.0 -# SIM.gun.thetaMin = (90-10)*pi/180.0 - -def setupEDM4hepOutputDR(dd4hepSimulation): - from DDG4 import EventAction, Kernel - dd = dd4hepSimulation - evt_edm4hep = EventAction(Kernel(), 'Geant4Output2EDM4hep_DRC/' + dd.outputFile, True) - evt_edm4hep.Control = True - output = dd.outputFile - if not dd.outputFile.endswith(dd.outputConfig.myExtension): - output = dd.outputFile + dd.outputConfig.myExtension - evt_edm4hep.Output = output - evt_edm4hep.enableUI() - Kernel().eventAction().add(evt_edm4hep) - eventPars = dd.meta.parseEventParameters() - evt_edm4hep.RunHeader = dd.meta.addParametersToRunHeader(dd) - evt_edm4hep.EventParametersString, evt_edm4hep.EventParametersInt, evt_edm4hep.EventParametersFloat = eventPars - evt_edm4hep.RunNumberOffset = dd.meta.runNumberOffset if dd.meta.runNumberOffset > 0 else 0 - evt_edm4hep.EventNumberOffset = dd.meta.eventNumberOffset if dd.meta.eventNumberOffset > 0 else 0 - return None -SIM.outputConfig.userOutputPlugin = setupEDM4hepOutputDR -SIM.outputConfig.myExtension = '.root' - -SIM.crossingAngleBoost = 0.0 -SIM.vertexOffset = [0.0, 0.0, 0.0, 0.0] -SIM.vertexSigma = [0.0, 0.0, 0.0, 0.0] - -SIM.filter.filters = { - 'geantino':{'name':'GeantinoRejectFilter/GeantinoRejector', - 'parameter':{}}, - 'edep1keV':{'name':'EnergyDepositMinimumCut/1keV', - 'parameter':{'Cut':1.0*keV}}, - 'edep0' :{'name':'EnergyDepositMinimumCut/Cut0', - 'parameter':{'Cut':0.0}} -} - -SIM.action.calo = "SCEPCalSDAction_DRHit" -SIM.action.calorimeterSDTypes = ['SegmentedCrystalCalorimeter'] - -SIM.filter.calo = "edep0" -print(f'Using filter {SIM.filter.calo} !') - -SIM.action.trackerSDTypes = ['tracker'] -SIM.action.tracker = ( - 'Geant4TrackerWeightedAction', - { - 'HitPositionCombination':2, - 'CollectSingleDeposits':False - } -) -SIM.filter.tracker = "edep0" - -SIM.part.enableDetailedHitsAndParticleInfo = False -SIM.part.keepAllParticles = True -SIM.part.minDistToParentVertex = 2.2e-10 -SIM.part.minimalKineticEnergy = 0.0 -SIM.part.printEndTracking = False -SIM.part.printStartTracking = False -SIM.part.saveProcesses = ['Decay'] -SIM.part.userParticleHandler = '' - -SIM.physics.decays = False -SIM.physics.list = "FTFP_BERT" -SIM.physics.pdgfile = None -SIM.physics.rangecut = None -SIM.physics.rejectPDGs = {1, 2, 3, 4, 5, 6, - 3201, 3203, 4101, 4103, - 21, 23, 24, 25, - 5401, 2203, 5403, - 3101, 3103, 4403, - 2101, 5301, 2103, 5303, - 4301, 1103, 4303, 5201, - 5203, 3303, 4201, 4203, - 5101, 5103, 5503} -SIM.physics.zeroTimePDGs = {17, 11, 13, 15} - -def setupCerenkovScint(kernel): - from DDG4 import PhysicsList - seq = kernel.physicsList() - - scint = PhysicsList(kernel, 'Geant4ScintillationPhysics/ScintillationPhys') - scint.VerboseLevel = 0 - scint.TrackSecondariesFirst = True - scint.enableUI() - seq.adopt(scint) - - cerenkov = PhysicsList(kernel, 'Geant4CerenkovPhysics/CerenkovPhys') - cerenkov.VerboseLevel = 0 - cerenkov.MaxNumPhotonsPerStep = 10 - cerenkov.MaxBetaChangePerStep = 10.0 - cerenkov.TrackSecondariesFirst = True - cerenkov.enableUI() - seq.adopt(cerenkov) - - ph = PhysicsList(kernel, 'Geant4OpticalPhotonPhysics/OpticalGammaPhys') - ph.addParticleConstructor('G4OpticalPhoton') - ph.VerboseLevel = 0 - ph.enableUI() - seq.adopt(ph) - - return None -if opticalPhysics: - SIM.physics.setupUserPhysics(setupCerenkovScint) - print ("Optical physics is ON !") -else: - print ("Optical physics is OFF !") - -SIM.random.enableEventSeed = False -SIM.random.file = None -SIM.random.luxury = 1 -SIM.random.replace_gRandom = True -SIM.random.seed = None -SIM.random.type = None \ No newline at end of file