CLAS12 Preshower Calorimeter Example



This example shows the CLAS12 Preshower Calorimeter (PCAL) geometry from clas12-systems. It is upcoming in the next release.


Quickstart

From the clas12-systems repository, build the geometry database and run a short simulation:

cd $GEMC_HOME/../clas12-systems/geometry_src/pcal
./pcal.py
gemc pcal.yaml -n=1


Geometry

The geometry, shown below, is defined in geometry_src/pcal/pcal.py and geometry_src/pcal/geometry.py. The PCAL builder reads the local coatjava geometry factory, converts the CLAS12 preshower calorimeter sectors, windows, lead layers, scintillator layers, and U, V, and W strip volumes to GEMC volumes, and stores them in gemc.db.

The world (a box named root) contains, for each of the six sectors:

The PCAL is a large geometry, so the example sets pyvista-fast: true in _data/examples.yml to use the fast PyVista rendering path when exporting the interactive view below.

Interactive viewer:


Physics List

FTFP_BERT is used by default, selected in the YAML file with phys_list: FTFP_BERT.

phys_list

The physics list can be selected using the option

gemc -phys_list <value>

where <value> can be a combination of the Geant4 physics constructors separated by the + sign. For example

gemc -phys_list="FTFP_BERT + G4NeutronCrossSectionXS"

To see a list of the available Geant4 constructors:

gemc -showPhysics


Generator

The particle kinematics are defined in the YAML file:

gparticle:
  - name: e-
    p: 5000*MeV
    delta_p: 1*GeV
    theta: 25*deg
    delta_theta: 15*deg
    randomThetaModel: cosine
    delta_phi: 180*deg

See also the Internal Generator Documentation for more information.


Digitization

The scintillator strips use the shared CLAS12 ecal digitization plugin. PCAL writes to the same ECAL banks as the EC system, using hipo layers 1 through 3. The identifiers record sector, layer, and strip numbers:

gvolume.digitization = "ecal"
gvolume.set_identifier("sector", sector, "layer", layer, "strip", pcal_strip_id(uvw, kind, strip))


Usage

Building the detector

Use geometry_src/pcal/pcal.py to build the detector. By default, the setup is stored in a SQLite file named gemc.db.

See also the Building Geometry for more information.


Running GEMC

The file pcal.yaml can be used to run the setup. Add -gui to run interactively:

gemc pcal.yaml -gui

Modify pcal.yaml as needed, in particular to add particles, control the number of threads, or change the output.


Running Events

CLAS12 PCAL simulation: generated electrons crossing the preshower calorimeter geometry.


Output

The gstreamer option selects the output filenames and formats:

gstreamer:
  - format: csv
    filename: pcal
  - format: hipo
    filename: pcal

See also the Output Documentation for more information.

Plotting with the GEMC Analyzer

Run GEMC with 2,000 events first. The default YAML file writes the analyzer CSV streams.

gemc pcal.yaml -n=2000 -no_field=all -plugin_path=/opt/projects/gemc/clas12-systems/build

Plot the total energy deposited per hit:

gemc-analyzer pcal_t0_true_info.csv totalEDeposited --kind csv --data true_info

PCAL total energy deposited per hit

Plot the y vs x hit positions:

gemc-analyzer pcal_t0_true_info.csv --kind csv --data true_info --plot yvsx --bins 80

PCAL y vs x hit positions