Skip to content
Snippets Groups Projects
Commit aea61dd2 authored by Whitney Armstrong's avatar Whitney Armstrong
Browse files

Merge branch 'master' into zdc

parents 646b2386 dbc08ac6
No related branches found
No related tags found
No related merge requests found
Pipeline #3592 passed
Showing
with 716 additions and 299 deletions
---
BasedOnStyle: LLVM
BreakConstructorInitializersBeforeComma: true
ConstructorInitializerAllOnOneLineOrOnePerLine: true
Cpp11BracedListStyle: true
Standard: Cpp11
#SpaceBeforeParens: ControlStatements
SpaceAfterControlStatementKeyword: true
PointerBindsToType: true
...
docs/_build/*
build/*
build
*.pcm
# Compiled Object files
*.slo
*.lo
*.o
# Compiled Dynamic libraries
*.so
*.dylib
# Compiled Static libraries
*.lai
*.la
*.a
# build trees
build/*
doc/doxygen_output
DEBUG*/*
BUILD*/*
RELEASE*/*
TEST*/*
# cmake
CMakeCache.txt
CMakeFiles
Makefile
cmake_install.cmake
install_manifest.txt
# vim
~*
*.swp
*.swo
# python
__pycache__/
*.py[cod]
*$py.class
.ipynb_checkpoints
##
*.d
*.pcm
*.root
*.slcio
*.stp
*.DS_Store
# vim
*.swp
old/*
doc/doxygen_output/*
docs/api/*
docs/doxyoutput
*.hepmc
image: eicweb.phy.anl.gov:4567/containers/eic_container/eic_container:latest
image: eicweb.phy.anl.gov:4567/containers/eic_container/eic:latest
stages:
- build
......@@ -8,9 +8,9 @@ stages:
compile:
stage: build
tags:
- singularity
- sodium
script:
- ./bin/do_build
- bash bin/do_build
docker_image:
image: eicweb.phy.anl.gov:4567/containers/image_recipes/ubuntu_dind:latest
......@@ -19,12 +19,9 @@ docker_image:
- sodium
only:
- master
- ci_dev
script:
- cd containers/docker && make release
#trigger:
# stage: containerize
# script: curl -X POST -F token=8806e69cdc802d752413e8a31554a2 -F ref=master https://eicweb.phy.anl.gov/api/v4/projects/290/trigger/pipeline
#
pages:
image: alpine
......
#!/bin/bash
ps
source /usr/local/bin/thisroot.sh
source /usr/local/bin/thisdd4hep.sh
source /usr/local/bin/geant4.sh
mkdir build
mkdir build
cd build
cmake ../. -DCMAKE_INSTALL_PREFIX=/usr/local
cmake ..
make -j30
FROM eicweb.phy.anl.gov:4567/containers/eic_container/eic_container:latest
FROM eicweb.phy.anl.gov:4567/containers/eic_container/eic:latest
LABEL maintainer="Whitney Armstrong <warmstrong@anl.gov>" \
name="npdet" \
......@@ -10,11 +10,7 @@ LABEL maintainer="Whitney Armstrong <warmstrong@anl.gov>" \
RUN cd /tmp \
&& git clone https://eicweb.phy.anl.gov/EIC/NPDet.git \
&& source /usr/local/bin/thisroot.sh \
&& source /usr/local/bin/geant4.sh \
&& source /usr/local/bin/thisdd4hep.sh \
&& mkdir -p NPDet/build && cd NPDet/build \
&& cmake ../. -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_CXX_STANDARD=17 \
&& cmake ../. -DCMAKE_CXX_STANDARD=17 \
&& make -j30 && make -j4 install \
&& cd /tmp && rm -rf /tmp/NPDet
_build/*
********************
Calorimeters
********************
Crystal Calorimeters
####################
For the backward electron direction
***********************************
From Tanja Horn's talk at 1st EIC Yellow Report Workshop at Temple University. The title of talk is Electromagnetic calorimetry technologies for EIC. The `presentation file <https://indico.bnl.gov/event/7449/contributions/35966/attachments/27177/41430/EIC-DWG-Calo-03192020.pdf>`_ can be found (Page 4 Electron Endcap EMCAL).
* Homogeneous calorimetry (inner part)
PbWO4 (12cam < R < 60 cm)
Dimension: 2x2x20 cm3
Performance: ~2%/sqrt(E)+0.7%
Estimated # of blocks for EIC: 2500
* Implemeted in
~/NPDet/src/GenericDetectors/calorimeters/compact/CrystalEndcapECAL_example.xml
~/NPDet/src/GenericDetectors/calorimeters/src/CrystalEndcapECAL_geo.cpp
Zero Degree Calorimeters
########################
For neutrons and photons
************************
.. image:: images/ZDC.png
:width: 200px
Input Event Format
==================
Use Hepmc3
###############
Tips and Tricks
###############
*************
Code Snippets
*************
Access Variables
################
**Volume ID** from **Cell ID**
******************************
* Volume ID that obtained from Cell ID using dd4hep::VolumeManagerContext.identifier
.. code-block:: cpp
auto volID = [&] (const std::vector<dd4hep::sim::Geant4Calorimeter::Hit*>& hits) {
std::vector<double> result;
for(const auto& h: hits) {
auto volcontext = cellid_converter.findContext(h->cellID);
result.push_back(volcontext->identifier);
}
return result;
};
* Volume ID that obtained from Cell ID using dd4hep::VolumeManagerContext.element and Readout/Segmentation
.. code-block:: cpp
auto volID = [&] (const std::vector<dd4hep::sim::Geant4Calorimeter::Hit*>& hits) {
std::vector<double> result;
for(const auto& h: hits) {
auto volcontext = cellid_converter.findContext(h->cellID);
dd4hep::Readout r = cellid_converter.findReadout(volcontext->element);
dd4hep::Segmentation seg = r.segmentation();
result.push_back(seg.volumeID(h->cellID));
}
return result;
};
***
FAQ
***
DD4hep
######
What is the difference between **Volume ID** and **Cell ID**?
*************************************************************
Both are unique IDs, but in the case of volume ID, it is associated with a physical placement of a volume (in G4 or tgeo).
The cell ID is used to further identify the subgeometry allocated to a volume through a segmentation.
The volume ID is related to the cell ID through the readout's ``id`` tag.
`See dd4hep CellID Descriptors documentation <https://dd4hep.web.cern.ch/dd4hep/usermanuals/DD4hepManual/DD4hepManualch2.html#x3-310002.12.1>`_
What is a **segmentation**?
***************************
A segmentation is a virtual geometry that is used to subdivide a volume. This
avoids creating many small volumes to uniquely identify sensitive elements of
a volume. An example would be a silicon detector with many channels at a fine
pitch. Instead of create each pixel as a box of silicon, one silicon box is
logically divide through the segmentation mechanism of DD4hep.
For a list of segmentations `look at the headers in DDSegmentation <https://github.com/AIDASoft/DD4hep/tree/master/DDCore/include/DDSegmentation>`_.
What is a **readout**?
**********************
A readout is associated with a senstive detector in DD4hep and is used by
setting the ``detector``'s ``readout`` attribute. The attribute value is the
name of a readout defined in the ``readouts``.
.. code-block:: XML
<readouts>
<readout name="ECalHits">
<segmentation type="CartesianGridXY" grid_size_x="10.0*cm" grid_size_y="10.0*cm" />
<id>system:5,layer:9,module:8,x:32:-16,y:-16</id>
</readout>
</readouts>
How do I run the GEANT4 simulation?
***********************************
todo
How can I visualize the GEANT4 simulation?
******************************************
todo
How can I visualize the detector geometry?
******************************************
todo
......@@ -3,7 +3,7 @@
intro
getting_started
detectors
RomanPot
Calorimeters
detectors/detectors
beamline_magnets
InputEvents
Tips_and_Tricks
************
Calorimeters
************
Crystal Calorimeters
####################
For the backward electron direction
***********************************
From Tanja Horn's talk at 1st EIC Yellow Report Workshop at Temple University. The title of talk is Electromagnetic calorimetry technologies for EIC. The
`presentation file <https://indico.bnl.gov/event/7449/contributions/35966/attachments/27177/41430/EIC-DWG-Calo-03192020.pdf>`_ can be found (Page 4 Electron Endcap EMCAL).
* Homogeneous calorimetry (inner part)
#. PbWO4 :math:`(12\mathrm{cm} < R < 60 \mathrm{cm})`
#. Dimension: :math:`2\times 2 \times 20 \mathrm{cm}^3`
#. Performance: :math:`\sim 2\%/\sqrt(E)+0.7\%`
#. Estimated # of blocks for EIC: 2500
* Implemeted in
#. GenericDetectors/calorimeters/compact/CrystalEndcapECAL_example.xml
#. `GenericDetectors/calorimeters/src/CrystalEndcapECAL_geo.cpp <https://argonne_mep.gitlab.io/eic/NPDet/group___crystal_endcap_e_c_a_l.html>`_
Zero Degree Calorimeters
########################
For neutrons and photons
************************
Form Yuji Goto (RIKEN)'s talk at 1st EIC Yellow Report Workshop at Temple University.
The title of talk is Zero Degree Calorimetry.
The `presentation <https://indico.bnl.gov/event/7449/contributions/35872/attachments/27171/41417/YRWS_2003.pdf>`_ can be found.
Detector configuration of RHICf detector
========================================
* Tungsten (Grey)
* Scintillator (Blue)
* Scintillator position (Red)
.. image:: ../images/ZDC.png
:width: 500px
Longitudinal structure
======================
.. image:: ../images/Longitudinal_structure_of_ZDC_detector.png
:width: 500px
Detector Description
====================
* Two towers with the same layer structure
#. Small tower: 20mm x 20 mm
#. Large tower: 40mm x 40 mm
#. Tungsten absorbers, Plastic Scintillators, and Scintillator position layers
Define section:
~~~~~~~~~~~~~~~
.. code-block:: XML
<define>
<constant name="offset_ZDC" value="5.0*mm"/>
<constant name="st_length" value="20.0*mm"/>
<constant name="lt_length" value="40.0*mm"/>
<constant name="st_ZDC_x_pos" value="0.0*m"/> <!-- value="0.60*m" -->
<constant name="st_ZDC_y_pos" value="0.0*m"/>
<constant name="st_ZDC_z_pos" value="1.0*m"/> <!-- value="34.0*m" -->
<constant name="lt_ZDC_x_pos" value="0.0*m"/> <!-- value="0.60*m" -->
<constant name="lt_ZDC_y_pos" value="offset_ZDC + (st_length+lt_length)/sqrt(2)"/>
<constant name="lt_ZDC_z_pos" value="1.0*m"/> <!-- value="34.0*m" -->
</define>
Detector section:
~~~~~~~~~~~~~~~~~
.. code-block:: XML
<detector id="1" name="smallZDC" type="ZDC" readout="ZDCHits" vis="RedVis">
<position x="st_ZDC_x_pos" y="st_ZDC_y_pos" z="st_ZDC_z_pos"/>
<dimensions x = "st_length" y = "st_length"/>
<layer repeat="2">
<slice name="Tungsten_slice" material="TungstenDens24" thickness="7*mm" vis = "GrayVis"/>
<slice name="Scint_slice" material="PlasticScint" thickness="3*mm" vis = "BlueVis" sensitive = "true"/>
</layer>
<layer repeat="1">
<slice name="Tungsten_slice" material="TungstenDens24" thickness="7*mm" vis = "GrayVis"/>
<slice name="SciFi_belt" material="PlasticScint" thickness="1*mm" vis = "RedVis" sensitive = "true"/>
<slice name="SciFi_belt" material="PlasticScint" thickness="1*mm" vis = "RedVis" sensitive = "true"/>
</layer>
<layer repeat="2">
<slice name="Scint_slice" material="PlasticScint" thickness="3*mm" vis = "BlueVis" sensitive = "true"/>
<slice name="Tungsten_slice" material="TungstenDens24" thickness="7*mm" vis = "GrayVis"/>
</layer>
<layer repeat="2">
<slice name="SciFi_belt" material="PlasticScint" thickness="1*mm" vis = "RedVis" sensitive = "true"/>
</layer>
<layer repeat="7">
<slice name="Scint_slice" material="PlasticScint" thickness="3*mm" vis = "BlueVis" sensitive = "true"/>
<slice name="Tungsten_slice" material="TungstenDens24" thickness="7*mm" vis = "GrayVis"/>
</layer>
<layer repeat="1">
<slice name="Tungsten_slice" material="TungstenDens24" thickness="7*mm" vis = "GrayVis"/>
<slice name="Scint_slice" material="PlasticScint" thickness="3*mm" vis = "BlueVis" sensitive = "true"/>
<slice name="Tungsten_slice" material="TungstenDens24" thickness="7*mm" vis = "GrayVis"/>
<slice name="Tungsten_slice" material="TungstenDens24" thickness="7*mm" vis = "GrayVis"/>
</layer>
<layer repeat="2">
<slice name="SciFi_belt" material="PlasticScint" thickness="1*mm" vis = "RedVis" sensitive = "true"/>
</layer>
<layer repeat="3">
<slice name="Scint_slice" material="PlasticScint" thickness="3*mm" vis = "BlueVis" sensitive = "true"/>
<slice name="Tungsten_slice" material="TungstenDens24" thickness="7*mm" vis = "GrayVis"/>
<slice name="Tungsten_slice" material="TungstenDens24" thickness="7*mm" vis = "GrayVis"/>
</layer>
<layer repeat="2">
<slice name="SciFi_belt" material="PlasticScint" thickness="1*mm" vis = "RedVis" sensitive = "true"/>
</layer>
<layer repeat="1">
<slice name="Scint_slice" material="PlasticScint" thickness="3*mm" vis = "BlueVis" sensitive = "true"/>
<slice name="Tungsten_slice" material="TungstenDens24" thickness="7*mm" vis = "GrayVis"/>
</layer>
</detector>
<detector id="2" name="largeZDC" type="ZDC" readout="ZDCHits" vis="RedVis">
<position x="lt_ZDC_x_pos" y="lt_ZDC_y_pos" z="lt_ZDC_z_pos"/>
<dimensions x = "lt_length" y = "lt_length"/>
<layer>
</layer>
</detector>
Access Variables
~~~~~~~~~~~~~~~~
* Volume ID that obtained from Cell ID using dd4hep::VolumeManagerContext.identifier
.. code-block:: cpp
auto volID = [&] (const std::vector<dd4hep::sim::Geant4Calorimeter::Hit*>& hits) {
std::vector<double> result;
for(const auto& h: hits) {
auto volcontext = cellid_converter.findContext(h->cellID);
result.push_back(volcontext->identifier);
}
return result;
};
* Volume ID that obtained from Cell ID using dd4hep::VolumeManagerContext.element and Readout/Segmentation
.. code-block:: cpp
auto volID = [&] (const std::vector<dd4hep::sim::Geant4Calorimeter::Hit*>& hits) {
std::vector<double> result;
for(const auto& h: hits) {
auto volcontext = cellid_converter.findContext(h->cellID);
dd4hep::Readout r = cellid_converter.findReadout(volcontext->element);
dd4hep::Segmentation seg = r.segmentation();
result.push_back(seg.volumeID(h->cellID));
}
return result;
};
.. include:: EMCalorimeterSoLID.rst
SoLID ElectroMagnetic Calorimeter
=========
#################################
A electromagnetic calorimeter for the SoLID detector. It is a ring-shape detector with hexgonal modules.
......@@ -27,7 +28,7 @@ Example use:
</detector>
Detector description variables
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
******************************
dimensions
Dimensions of the sensitive detector
......
Roman Pot
=========
#########
A pair of Roman Pot-style detectors for detection of particles scattered by very small angles, typically in forward and far-forward regions.
Generic information about design of Roman pot detectors can be found in references describing units used at LHC `ref 1`_ and `ref 2`_.
.. image:: images/RP.png
.. image:: ../images/RP.png
:width: 400
Example use:
......@@ -26,9 +26,9 @@ Example use:
</detector>
Detector description variables
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
******************************
.. image:: images/rp_schem.pdf
.. image:: ../images/rp_schem.pdf
:width: 400
dimensions
......
********
Trackers
********
.. include:: RomanPot.rst
*********
#########
Detectors
*********
#########
`NPdet` is detector toolkit for full simulations of Nuclear Physics experiments.
**This site is currently under construction. Come back later!!!**
Categories
##########
.. include:: Calorimeters.rst
.. include:: Trackers.rst
*****************************
Particle Identification (PID)
*****************************
Generic Gaseous RICH
====================
####################
A generic gas RICH detector for hadron PID in the forward dectection is shown in the figure below.
The simple design uses a plane mirror to reflect cherenkov photons (green) onto an array of MCP-PMT detectors (blue).
The optical properties of the mirror are defined in a properites block as `shown here <https://eicweb.phy.anl.gov/EIC/NPDet/-/blob/master/src/GenericDetectors/pid/compact/GenericRICH_example.xml#L23>`_.
.. image:: images/topside_rich.png
.. image:: ../images/topside_rich.png
:width: 600
.. code-block:: xml
......@@ -43,3 +45,4 @@ Their optical properites of surfaces are defined in the detector description:
</surfaces>
Getting Started
===============
Installation
------------
Singularity Container
~~~~~~~~~~~~~~~~~~~~~
The easiest way to use this library is the with the [eic_container](https://eicweb.phy.anl.gov/containers/eic_container/).
The easiest way to use this library is the with the `eic_container <https://eicweb.phy.anl.gov/containers/eic_container>`_.
.. warning:: need to add brief instructions here.
Building from source
~~~~~~~~~~~~~~~~~~~~
The following are needed before building `NPDet`
* [DD4hep](https://github.com/AIDAsoft/DD4hep)
* [ROOT](https://root.cern.ch)
* [GEANT4](http://geant4.cern.ch)
* `DD4hep <(https://github.com/AIDAsoft/DD4hep>`_
* `ROOT <https://root.cern.ch>`_
* `GEANT4 <http://geant4.cern.ch>`_
.. code-block:: bash
......@@ -28,3 +30,9 @@ The following are needed before building `NPDet`
make -j4
make install
Development
-----------
.. warning:: need to add brief how to for container development.
docs/images/Longitudinal_structure_of_ZDC_detector.png

96.3 KiB

......@@ -3,223 +3,255 @@ from __future__ import absolute_import, unicode_literals
import os
import time
import logging
import argparse
parser = argparse.ArgumentParser(
prog='run_topside',
description='''This runs the simulation the but that is okay''',
epilog='''
This program should be run in the "compact" directory.
''')
parser.add_argument("-v","--verbose", help="increase output verbosity", type=int, default=0)
parser.add_argument("--compact", help="compact detector file",default="simple_topside.xml")
parser.add_argument("--vis", help="vis true/false", action="store_true",default=False)
parser.add_argument("--ui", help="ui setting tcsh or qt; default=qt", type=str,default="qt",dest="ui")
parser.add_argument("-n","--n-events", help="number of events", type=int, default=0)
parser.add_argument("-s","--n-skip", help="number of events to skip", type=int, default=0)
parser.add_argument("-m","--macro", help="macro to execute", default="macro/vis.mac")
parser.add_argument("-o","--output", help="output file", default=None)
parser.add_argument("-i","--input", help="input data file", default=None)
parser.add_argument("--target-position", nargs=3, help="nominal location of the target in units of mm", default=[0.0,0.0,-3000.0],metavar=("X","Y","Z"))
args = parser.parse_args()
import DDG4
from DDG4 import OutputLevel as Output
from g4units import keV, GeV, mm, ns, MeV
def run():
#os.environ['G4UI_USE_TCSH'] = "1"
kernel = DDG4.Kernel()
description = kernel.detectorDescription()
kernel.loadGeometry(str("file:" + "simple_topside.xml"))
DDG4.importConstants(description)
geant4 = DDG4.Geant4(kernel)
#geant4.printDetectors()
geant4.setupUI('qt',vis=True,macro='macro/vis.mac')
#geant4.setupUI('tcsh',vis=False)
geant4.setupTrackingField(stepper='ClassicalRK4', equation='Mag_UsualEqRhs')
rndm = DDG4.Action(kernel, 'Geant4Random/Random')
rndm.Seed = 854321
rndm.initialize()
rndm.showStatus()
run1 = DDG4.RunAction(kernel, 'Geant4TestRunAction/RunInit')
run1.Property_int = 12345
run1.Property_double = -5e15 * keV
run1.Property_string = 'Startrun: Hello_2'
run1.enableUI()
kernel.registerGlobalAction(run1)
kernel.runAction().adopt(run1)
prt = DDG4.EventAction(kernel, 'Geant4ParticlePrint/ParticlePrint')
#prt.OutputLevel = Output.INFO
#prt.OutputType = 3 # Print both: table and tree
kernel.eventAction().adopt(prt)
rootoutput = geant4.setupROOTOutput('RootOutput', 'data/simple_topside_' + time.strftime('%Y-%m-%d_%H-%M'))
rootoutput.HandleMCTruth = True
#--------------------------------
gen = DDG4.GeneratorAction(kernel, "Geant4GeneratorActionInit/GenerationInit")
gen.OutputLevel = 5
gen.enableUI()
kernel.generatorAction().adopt(gen)
gen = DDG4.GeneratorAction(kernel, "Geant4InputAction/hepmc3")
gen.Mask = 0
#gen.Parameters["Flow1"] = "flow1"
#gen.Parameters["Flow2"] = "flow2"
gen.Input = "HEPMC3FileReader|" + "eg_data/eic.upsilon-10on100.4pi.disp-ups-97-muon.run00001-lumi10.hepmc"
#gen.Input = "HEPMC3FileReader|" + "eg_data/proton_dvcs_eic_Q2min_1GeV.hepmc"
#gen.Input = "HEPMC3FileReader|" + "eg_data/proton_dvcs_eic.hepmc"
#gen.Input = "HEPMC3FileReader|" + "data/eic_beam_275.hepmc"
gen.OutputLevel = 5 # generator_output_level
gen.enableUI()
kernel.generatorAction().adopt(gen)
gen = DDG4.GeneratorAction(kernel, "EICInteractionVertexSmear/BeamDivergence")
gen.Mask = 0
gen.OutputLevel = 5 # generator_output_level
#gen.Sigma = (4 * mm, 1 * mm, 1 * mm, 0 * ns)
kernel.generatorAction().adopt(gen)
gen = DDG4.GeneratorAction(kernel, "EICInteractionVertexBoost/CrossingAngle")
gen.Mask = 0
gen.OutputLevel = 5 # generator_output_level
#gen.Sigma = (4 * mm, 1 * mm, 1 * mm, 0 * ns)
kernel.generatorAction().adopt(gen)
#gen = DDG4.GeneratorAction(kernel, "Geant4InteractionVertexSmear/SmearVert")
#gen.Mask = 0
#gen.Offset = (0 * mm, 0 * mm, 0 * mm, 0 * ns)
#gen.Sigma = (3 * mm, 3 * mm, 200 * mm, 0 * ns)
#kernel.generatorAction().adopt(gen)
#gen = DDG4.GeneratorAction(kernel, "Geant4GeneratorWrapper/GPS")
#gen.Uses = 'G4GeneralParticleSource'
##gen.OutputLevel = Output.WARNING
##gen.Mask = 1
#gen.enableUI()
#kernel.generatorAction().adopt(gen)
gen = DDG4.GeneratorAction(kernel, "Geant4InteractionMerger/InteractionMerger")
gen.OutputLevel = 0 # generator_output_level
gen.enableUI()
kernel.generatorAction().adopt(gen)
gen = DDG4.GeneratorAction(kernel, "Geant4PrimaryHandler/PrimaryHandler")
gen.OutputLevel = 0 # generator_output_level
gen.enableUI()
kernel.generatorAction().adopt(gen)
part = DDG4.GeneratorAction(kernel, "Geant4ParticleHandler/ParticleHandler")
# part.SaveProcesses = ['conv','Decay']
#part.SaveProcesses = ['Decay']
part.MinimalKineticEnergy = 100000 * GeV
part.OutputLevel = 0 # generator_output_level
part.enableUI()
kernel.generatorAction().adopt(part)
#gen = DDG4.GeneratorAction(kernel, "Geant4IsotropeGenerator/IsotropE-")
#gen.Mask = 2
#gen.Particle = 'e-'
#gen.Energy = 25 * GeV
#gen.Multiplicity = 3
#gen.Distribution = 'uniform'
#kernel.generatorAction().adopt(gen)
#gen = DDG4.GeneratorAction(kernel, "Geant4InteractionMerger/InteractionMerger")
#gen.OutputLevel = 4 # generator_output_level
#gen.enableUI()
#kernel.generatorAction().adopt(gen)
#gen = DDG4.GeneratorAction(kernel, "Geant4PrimaryHandler/PrimaryHandler")
#gen.OutputLevel = 4 # generator_output_level
#gen.enableUI()
#kernel.generatorAction().adopt(gen)
#part = DDG4.GeneratorAction(kernel, "Geant4ParticleHandler/ParticleHandler")
#kernel.generatorAction().adopt(part)
## part.SaveProcesses = ['conv','Decay']
#part.SaveProcesses = ['Decay']
#part.MinimalKineticEnergy = 100 * MeV
#part.OutputLevel = 5 # generator_output_level
#part.enableUI()
#user = DDG4.Action(kernel, "Geant4TCUserParticleHandler/UserParticleHandler")
#user.TrackingVolume_Zmax = DDG4.EcalEndcap_zmin
#user.TrackingVolume_Rmax = DDG4.EcalBarrel_rmin
#user.enableUI()
#part.adopt(user)
#f1 = DDG4.Filter(kernel, 'GeantinoRejectFilter/GeantinoRejector')
f2 = DDG4.Filter(kernel, 'ParticleRejectFilter/OpticalPhotonRejector')
f2.particle = 'opticalphoton'
f3 = DDG4.Filter(kernel, 'ParticleSelectFilter/OpticalPhotonSelector')
f3.particle = 'opticalphoton'
#f4 = DDG4.Filter(kernel, 'EnergyDepositMinimumCut')
#f4.Cut = 10 * MeV
#f4.enableUI()
#kernel.registerGlobalFilter(f1)
kernel.registerGlobalFilter(f2)
kernel.registerGlobalFilter(f3)
#kernel.registerGlobalFilter(f4)
#seq, act = geant4.setupDetector('ForwardRICH','PhotoMultiplierSDAction')
#act.adopt(f3)
#seq, act = geant4.setupDetector('HeavyGasCherenkov','PhotoMultiplierSDAction')
#act.adopt(f3)
#seq, act = geant4.setupTracker('SiVertexBarrel')
#seq, act = geant4.setupTracker('SiTrackerForward')
#seq, act = geant4.setupCalorimeter('EcalBarrel')
#seq, act = geant4.setupCalorimeter('EcalEndcap')
#seq, act = geant4.setupCalorimeter('HcalBarrel')
seq, act = geant4.setupTracker('RomanPot1')
seq, act = geant4.setupTracker('RomanPot2')
seq, act = geant4.setupTracker('RomanPot3')
seq, act = geant4.setupTracker('RomanPot4')
seq, act = geant4.setupTracker('RomanPot44')
seq, act = geant4.setupTracker('RomanPot45')
seq, act = geant4.setupTracker('RomanPot46')
seq, act = geant4.setupTracker('RomanPot47')
seq, act = geant4.setupTracker('RomanPot48')
seq, act = geant4.setupTracker('RomanPot49')
seq, act = geant4.setupTracker('RomanPot50')
seq, act = geant4.setupTracker('RomanPot51')
phys = geant4.setupPhysics('QGSP_BERT')
geant4.addPhysics(str('Geant4PhysicsList/Myphysics'))
#ph = DDG4.PhysicsList(kernel, 'Geant4OpticalPhotonPhysics/OpticalPhotonPhys')
#ph.VerboseLevel = 0
#ph.enableUI()
#phys.adopt(ph)
#ph = DDG4.PhysicsList(kernel, 'Geant4CerenkovPhysics/CerenkovPhys')
#ph.MaxNumPhotonsPerStep = 10
#ph.MaxBetaChangePerStep = 10.0
#ph.TrackSecondariesFirst = True
#ph.VerboseLevel = 0
#ph.enableUI()
#phys.adopt(ph)
## Add special particle types from specialized physics constructor
#part = geant4.addPhysics('Geant4ExtraParticles/ExtraParticles')
#part.pdgfile = 'checkout/DDG4/examples/particle.tbl'
# Add global range cut
rg = geant4.addPhysics('Geant4DefaultRangeCut/GlobalRangeCut')
rg.RangeCut = 0.7 * mm
phys.dump()
#ui_action = dd4hep.sim.createAction(kernel, "Geant4UIManager/UI")
#ui_action.HaveVIS = True
#ui_action.HaveUI = True
#ui_action.SessionType = qt
#ui_action.SetupUI = macro
#kernel.registerGlobalAction(ui_action)
kernel.configure()
kernel.initialize()
# DDG4.setPrintLevel(Output.DEBUG)
kernel.run()
kernel.terminate()
if not args.vis:
os.environ['G4UI_USE_TCSH'] = "0"
kernel = DDG4.Kernel()
description = kernel.detectorDescription()
kernel.loadGeometry(str("file:" + args.compact))
DDG4.importConstants(description)
geant4 = DDG4.Geant4(kernel)
if args.vis > 0:
geant4.printDetectors()
n_events = args.n_events
if args.vis:
geant4.setupUI(typ=args.ui, vis=True,ui=True, macro=args.macro)
else:
geant4.setupUI(typ=args.ui, vis=False,ui=False,macro=False)
if n_events <= 0:
n_events = 1
kernel.NumEvents = n_events
geant4.setupTrackingField(stepper='ClassicalRK4', equation='Mag_UsualEqRhs')
rndm = DDG4.Action(kernel, 'Geant4Random/Random')
if os.getenv('SEED') is None:
rndm.Seed = 1234
else :
rndm.Seed = os.getenv('SEED')
rndm.initialize()
rndm.showStatus()
run1 = DDG4.RunAction(kernel, 'Geant4TestRunAction/RunInit')
run1.Property_int = 12345
run1.Property_double = -5e15 * keV
run1.Property_string = 'Startrun: Hello_2'
run1.enableUI()
kernel.registerGlobalAction(run1)
kernel.runAction().adopt(run1)
prt = DDG4.EventAction(kernel, 'Geant4ParticlePrint/ParticlePrint')
#prt.OutputLevel = Output.INFO
#prt.OutputType = 3 # Print both: table and tree
kernel.eventAction().adopt(prt)
rootoutput = geant4.setupROOTOutput('RootOutput', 'data/simple_topside_' + time.strftime('%Y-%m-%d_%H-%M'))
rootoutput.HandleMCTruth = True
#--------------------------------
gen = DDG4.GeneratorAction(kernel, "Geant4GeneratorActionInit/GenerationInit")
gen.OutputLevel = 5
gen.enableUI()
kernel.generatorAction().adopt(gen)
gen = DDG4.GeneratorAction(kernel, "Geant4InputAction/hepmc3")
gen.Mask = 0
#gen.Parameters["Flow1"] = "flow1"
#gen.Parameters["Flow2"] = "flow2"
gen.Input = "HEPMC3FileReader|" + "eg_data/proton_dvcs_eic_Q2min_1GeV.hepmc"
#gen.Input = "HEPMC3FileReader|" + "eg_data/proton_dvcs_eic.hepmc"
#gen.Input = "HEPMC3FileReader|" + "data/eic_beam_275.hepmc"
gen.OutputLevel = 5 # generator_output_level
gen.enableUI()
kernel.generatorAction().adopt(gen)
gen = DDG4.GeneratorAction(kernel, "EICInteractionVertexSmear/BeamDivergence")
gen.Mask = 0
gen.OutputLevel = 5 # generator_output_level
#gen.Sigma = (4 * mm, 1 * mm, 1 * mm, 0 * ns)
kernel.generatorAction().adopt(gen)
gen = DDG4.GeneratorAction(kernel, "EICInteractionVertexBoost/CrossingAngle")
gen.Mask = 0
gen.OutputLevel = 5 # generator_output_level
#gen.Sigma = (4 * mm, 1 * mm, 1 * mm, 0 * ns)
kernel.generatorAction().adopt(gen)
#gen = DDG4.GeneratorAction(kernel, "Geant4InteractionVertexSmear/SmearVert")
#gen.Mask = 0
#gen.Offset = (0 * mm, 0 * mm, 0 * mm, 0 * ns)
#gen.Sigma = (3 * mm, 3 * mm, 200 * mm, 0 * ns)
#kernel.generatorAction().adopt(gen)
#gen = DDG4.GeneratorAction(kernel, "Geant4GeneratorWrapper/GPS")
#gen.Uses = 'G4GeneralParticleSource'
##gen.OutputLevel = Output.WARNING
##gen.Mask = 1
#gen.enableUI()
#kernel.generatorAction().adopt(gen)
gen = DDG4.GeneratorAction(kernel, "Geant4InteractionMerger/InteractionMerger")
gen.OutputLevel = 0 # generator_output_level
gen.enableUI()
kernel.generatorAction().adopt(gen)
gen = DDG4.GeneratorAction(kernel, "Geant4PrimaryHandler/PrimaryHandler")
gen.OutputLevel = 0 # generator_output_level
gen.enableUI()
kernel.generatorAction().adopt(gen)
part = DDG4.GeneratorAction(kernel, "Geant4ParticleHandler/ParticleHandler")
# part.SaveProcesses = ['conv','Decay']
#part.SaveProcesses = ['Decay']
part.MinimalKineticEnergy = 100000 * GeV
part.OutputLevel = 0 # generator_output_level
part.enableUI()
kernel.generatorAction().adopt(part)
#gen = DDG4.GeneratorAction(kernel, "Geant4IsotropeGenerator/IsotropE-")
#gen.Mask = 2
#gen.Particle = 'e-'
#gen.Energy = 25 * GeV
#gen.Multiplicity = 3
#gen.Distribution = 'uniform'
#kernel.generatorAction().adopt(gen)
#gen = DDG4.GeneratorAction(kernel, "Geant4InteractionMerger/InteractionMerger")
#gen.OutputLevel = 4 # generator_output_level
#gen.enableUI()
#kernel.generatorAction().adopt(gen)
#gen = DDG4.GeneratorAction(kernel, "Geant4PrimaryHandler/PrimaryHandler")
#gen.OutputLevel = 4 # generator_output_level
#gen.enableUI()
#kernel.generatorAction().adopt(gen)
#part = DDG4.GeneratorAction(kernel, "Geant4ParticleHandler/ParticleHandler")
#kernel.generatorAction().adopt(part)
## part.SaveProcesses = ['conv','Decay']
#part.SaveProcesses = ['Decay']
#part.MinimalKineticEnergy = 100 * MeV
#part.OutputLevel = 5 # generator_output_level
#part.enableUI()
#user = DDG4.Action(kernel, "Geant4TCUserParticleHandler/UserParticleHandler")
#user.TrackingVolume_Zmax = DDG4.EcalEndcap_zmin
#user.TrackingVolume_Rmax = DDG4.EcalBarrel_rmin
#user.enableUI()
#part.adopt(user)
#f1 = DDG4.Filter(kernel, 'GeantinoRejectFilter/GeantinoRejector')
f2 = DDG4.Filter(kernel, 'ParticleRejectFilter/OpticalPhotonRejector')
f2.particle = 'opticalphoton'
f3 = DDG4.Filter(kernel, 'ParticleSelectFilter/OpticalPhotonSelector')
f3.particle = 'opticalphoton'
#f4 = DDG4.Filter(kernel, 'EnergyDepositMinimumCut')
#f4.Cut = 10 * MeV
#f4.enableUI()
#kernel.registerGlobalFilter(f1)
kernel.registerGlobalFilter(f2)
kernel.registerGlobalFilter(f3)
#kernel.registerGlobalFilter(f4)
seq, act = geant4.setupDetector('ForwardRICH','PhotoMultiplierSDAction')
act.adopt(f3)
#seq, act = geant4.setupDetector('HeavyGasCherenkov','PhotoMultiplierSDAction')
#act.adopt(f3)
seq, act = geant4.setupTracker('SiVertexBarrel')
seq, act = geant4.setupTracker('SiTrackerForward')
seq, act = geant4.setupCalorimeter('EcalBarrel')
seq, act = geant4.setupCalorimeter('EcalEndcap')
seq, act = geant4.setupCalorimeter('HcalBarrel')
seq, act = geant4.setupTracker('RomanPot1')
seq, act = geant4.setupTracker('RomanPot2')
seq, act = geant4.setupTracker('RomanPot3')
seq, act = geant4.setupTracker('RomanPot4')
seq, act = geant4.setupTracker('RomanPot44')
seq, act = geant4.setupTracker('RomanPot45')
seq, act = geant4.setupTracker('RomanPot46')
seq, act = geant4.setupTracker('RomanPot47')
seq, act = geant4.setupTracker('RomanPot48')
seq, act = geant4.setupTracker('RomanPot49')
seq, act = geant4.setupTracker('RomanPot50')
seq, act = geant4.setupTracker('RomanPot51')
phys = geant4.setupPhysics('QGSP_BERT')
geant4.addPhysics(str('Geant4PhysicsList/Myphysics'))
ph = DDG4.PhysicsList(kernel, 'Geant4OpticalPhotonPhysics/OpticalPhotonPhys')
ph.VerboseLevel = 0
ph.enableUI()
phys.adopt(ph)
ph = DDG4.PhysicsList(kernel, 'Geant4CerenkovPhysics/CerenkovPhys')
ph.MaxNumPhotonsPerStep = 10
ph.MaxBetaChangePerStep = 10.0
ph.TrackSecondariesFirst = True
ph.VerboseLevel = 0
ph.enableUI()
phys.adopt(ph)
## Add special particle types from specialized physics constructor
#part = geant4.addPhysics('Geant4ExtraParticles/ExtraParticles')
#part.pdgfile = 'checkout/DDG4/examples/particle.tbl'
# Add global range cut
rg = geant4.addPhysics('Geant4DefaultRangeCut/GlobalRangeCut')
rg.RangeCut = 0.7 * mm
phys.dump()
#ui_action = dd4hep.sim.createAction(kernel, "Geant4UIManager/UI")
#ui_action.HaveVIS = True
#ui_action.HaveUI = True
#ui_action.SessionType = qt
#ui_action.SetupUI = macro
#kernel.registerGlobalAction(ui_action)
kernel.configure()
kernel.initialize()
# DDG4.setPrintLevel(Output.DEBUG)
kernel.run()
kernel.terminate()
if __name__ == "__main__":
run()
run()
......@@ -41,6 +41,7 @@ dd4hep_add_plugin(GenDetectors
calorimeters/src/ScintillatingTileEndcapHCAL_geo.cpp
calorimeters/src/ZeroDegreeCAL_geo.cpp
calorimeters/src/ZDC_geo.cpp
calorimeters/src/Crystal_geo.cpp
beamline/src/Beampipe_geo.cpp
beamline/src/IRChamber_geo.cpp
beamline/src/Beampipe_geo.cpp
......
<lccdd xmlns:compact="http://www.lcsim.org/schemas/compact/1.0"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xs:noNamespaceSchemaLocation="http://www.lcsim.org/schemas/compact/1.0/compact.xsd">
<!-- Some information about detector -->
<info name="Electron_Endcap_EMcal_PbWO4_example" title="Electron Endcap EMCAL detector example"
author="Jihee Kim"
url="https://eicweb.phy.anl.gov/EIC/NPDet"
status="development"
version="v2.0 2020-07-30">
<comment>Electron Endcap EMCAL detector</comment>
</info>
<!-- Use DD4hep elements and materials definitions -->
<includes>
<gdmlFile ref="elements.xml"/>
<gdmlFile ref="materials.xml"/>
</includes>
<!-- Define the dimensions of the world volume -->
<define>
<constant name="world_side" value="50*m"/>
<constant name="world_x" value="world_side"/>
<constant name="world_y" value="world_side"/>
<constant name="world_z" value="world_side"/>
<constant name="tracker_region_zmax" value="6 * m"/>
<constant name="tracker_region_rmax" value="6 * m"/>
<constant name="CrystalEndcap_ID" value="1"/>
<constant name="CrystalEndcap_rmin" value="120.0*mm"/> <!-- 12cm -->
<constant name="CrystalEndcap_rmax" value="600.0*mm"/> <!-- 60cm -->
<constant name="CrystalBox_x_length" value="20.0*mm"/> <!-- 2cm -->
<constant name="CrystalBox_y_length" value="20.0*mm"/> <!-- 2cm -->
<constant name="CrystalBox_z_length" value="200.0*mm"/> <!-- 20cm -->
<constant name="CrystalEndcap_x_pos" value="0.0*m"/>
<constant name="CrystalEndcap_y_pos" value="0.0*m"/>
<constant name="CrystalEndcap_z_pos" value="-1.0*m"/>
</define>
<limits>
</limits>
<regions>
</regions>
<!-- Common Generic visualization attributes -->
<comment>Common Generic visualization attributes</comment>
<display>
<vis name="InvisibleNoDaughters" showDaughters="false" visible="false"/>
<vis name="InvisibleWithDaughters" showDaughters="true" visible="false"/>
<vis name="GreenVis" alpha="0.5" r= "0.0" g="1.0" b="0.0" showDaughters="true" visible="true"/>
<vis name="RedVis" alpha="0.5" r= "1.0" g="0.0" b="0.0" showDaughters="true" visible="true"/>
<vis name="BlueVis" alpha="0.5" r= "0.0" g="0.0" b="1.0" showDaughters="true" visible="true"/>
<vis name="OrangeVis" alpha="0.5" r= "1.0" g="0.45" b="0.0" showDaughters="true" visible="true"/>
<vis name="RedGreenVis" alpha="0.5" r= "1.0" g="1.0" b="0.0" showDaughters="true" visible="true"/>
<vis name="BlueGreenVis" alpha="0.5" r= "0.0" g="1.0" b="1.0" showDaughters="true" visible="true"/>
<vis name="PurpleVis" alpha="0.5" r= "1.0" g="0.0" b="1.0" showDaughters="true" visible="true"/>
<vis name="DoubleRedG" alpha="0.5" r= "2.0" g=".10" b="0.0" showDaughters="true" visible="true"/>
<vis name="RBG015" alpha="0.5" r= "0.0" g=".2" b="1.0" showDaughters="true" visible="true"/>
<vis name="RBG510" alpha="0.5" r= "1.0" g=".2" b="0.0" showDaughters="true" visible="true"/>
<vis name="RBG" alpha="0.5" r= "1.0" g="1.0" b="1.0" showDaughters="true" visible="true"/>
<vis name="GrayVis" alpha="0.5" r= "0.75" g="0.75" b="0.75" showDaughters="true" visible="true"/>
</display>
<!-- Define detector -->
<detectors>
<detector id="CrystalEndcap_ID" name="ElectronECAL" type="Crystal" readout="EcalHits" vis="GreenVis">
<position x="CrystalEndcap_x_pos" y="CrystalEndcap_y_pos" z="CrystalEndcap_z_pos"/>
<dimensions rmin="CrystalEndcap_rmin" rmax="CrystalEndcap_rmax" x="CrystalBox_x_length" y="CrystalBox_y_length" z="CrystalBox_z_length"/>
</detector>
</detectors>
<!-- Definition of the readout segmentation/definition -->
<readouts>
<readout name="EcalHits">
<segmentation type="CartesianGridXY" grid_size_x="20.0*mm" grid_size_y="20.0*mm" />
<id>system:8,sector:4,module:20,x:48:-8,y:-8</id>
</readout>
</readouts>
<plugins>
</plugins>
<fields>
</fields>
</lccdd>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment