A design and information of the HGCal can be found in


Setup CMSSW in SL6 machines:

source /uscmst1/prod/sw/cms/cshrc cvmfs

scram --arch slc6_amd64_gcc481 list CMSSW | grep CMSSW_7_1

scram --arch slc6_amd64_gcc481 project CMSSW_7_1_0_pre8

cd CMSSW_7_1_0_pre8/src/


scram b



We are using the repository for HGCal Geant4 standalone simulations located at, this can be obtained by doing:

git init

git remote add origin

git clone -b BASELINE-TP

cd PFCal/PFCalEE/

To set up the environment and compile (SL6 machines), go to the PFCalEE directory and run:

cd PFCal/PFCalEE


cd userlib

mkdir lib

mkdir obj

mkdir bin

make -j 5

cd ../

make -j 5


In the cmslpc (SL6) is possible that the setting up of the environment doesn't work, it is required to connect to a SL6 note


After this, copy the repository to your working area

cd workdir
git init
git remote add origin
git clone
cd PFCal/PFCalEE/

Updated to the desired git tag version

git tag
git fetch --all
git checkout (-f) Version

Setup the environment (bash)

cp /uscms/home/yumiceva/work/HGCal/PFCal/PFCalEE/ .

Setup the environment (csh)

cp /uscms/home/yumiceva/work/HGCal/PFCal/PFCalEE/g4env_fnal.csh .
source g4env_fnal.csh

Compile the files

mkdir -p userlib/{lib,obj,bin} && cd userlib && make dictionary && make -j 5 && cd - && make -j 5

Generation of events

The code is created to submit jobs in parallel to the batch system (using LSF), to run do:

python -options

In case of options conflicts it can be used also:

./ -options

The options for the code are:

  • -n : Number of events to generate (default 1000)
  • -g : Use particle gun
  • -d : Data or type of particle to shoot (default e-)
  • -s : Short batch queue (default 1nd)
  • -l : Long batch queue (default 2nw)
  • -t : Git tag use it
  • -r : Run stats
  • -m : Detector model
  • -v : Detector version
  • -e : eos Path to save root file
  • -o : Output directory
  • -a : Incidence angle in radians (default 0)
  • -b : Magnetic field in Tesla (default 0)
  • -f : Path to the HepMC input file
  • -S : Not submit batch job

Particle Gun

To run this example modify the file to set energy loops and run:

for i in seq 0 5; do python -s 1nd -q 2nd -t V00-00-00 -g -r ${i} -v 3 -m 0 -e /store/cmst3/group/hgcal/Geant4 -o ~/work/ntuples -d e- -n 2500; done

This example is running 2500 events of a particle gun shooting electrons to the detector model.

The energy of the initial particles can be changed in the script

At then moment of running the program other particles can be chosen for the particle gun, like muon (mu-) or pions (pi-)

For a complete code of the particles in Geant4 see:



A sample of the results are presented in the root files attached

The file DigiPFcal contains the histograms for the noise check and the reconstructed hits in the detector

The file HGcal contains 4 branches:

The file HGcal contains 4 branches:

Sampling Section: Contains the information of the volume; the total, absorbed y measured energy; the fraction of particles, etc.

SimHit : Contains histograms such as the number of particles, energy, time, layer, etc

GenParticle : Contains the information of the generated particle

Analysis code SimHits

An analysis script that plot histograms of the variables contained in the root files previously obtained is obtained using the MakeClass command in root.

The codes are named HGCal (see attached files), and are located in /afs/
To run the codes successfully in root is required to load one library for the main directory of G4, for this run:

ln -s ~/work/PFCal/PFCalEE/userlib/include .

At the moment of start root, some libraries need to be loaded(everytime start root):


Then we need load some files:

.L HGcal.C;

HGcal t;


The output of this script will be a root file that contains all the desired histograms, plus some .txt files with information about the events

√As a sample of the results the Z-X profile of the detector under the action of the different particle guns can be found in the attached files

Analysis code DigiRecoHits

For the Digitization the code Digitizer.cpp located in the directory .../PFCal/PFCalEE/userlib/test/

To execute this code run the command "make", the resulting executable will be located in the directory PFCal/PFCalEE/userlib/bin/

To run the executable:

./HGCal-SimHit (number of events) (complete path to input file) (complete path to output file) (granularity layeri-layerj:value, laye...) (noise layeri-layerj:value...) (threshold layeri-layerj:value...) (random seed value, default = 0) (debug, default = 0) (save sim hits, default = 0) (save digi hits, default = 0)

For the ECAL CALICE-like HG:

number of events : choosing 0 or negative numbers will lead to take the full number of events

granularity : 0-19:4,20-29:6

noise: 0-29:0.12

hreshold : 0-29:2

The result will be a root file located in the output directory, this file will contain the Reconstructed information.

As a sample of the results the Z-X profile of the detector under the action of the different particle guns can be found in the attached files.

Geometry Visualization

To visualize the geometry that is used for the standalone simulation the files (~/.../PFCalEE/src) and DetectorCosntruction.hh (~/.../PFCalEE/include) contains the information of all the available geometries, e.g:

enum DetectorVersion {

  enum DetectorModel {

In the PFCalEE directory the file can be modified to change to use the desired detector and model, the line to change is:

int version=0; //DetectorConstruction::v_HGCAL;                                                                                                       
  //int model=DetectorConstruction::m_FULLSECTION;                                                                                                     
  int model=DetectorConstruction::m_SIMPLE_20;

After the file is modified to compile run:

make -j 5

After this, run the following command (Changing the path to one in your directory):

export G4DAWNFILE_DEST_DIR=/afs/

Copy the file vis.mac to the directory where the PFCalEE executable is (geant4_workdir/bin/Linux-g++).

To run the visualization is necessary to go to the directory where the PFCalEE executable is and run:

PFCalEE vis.mac

A sample and a complete geometry construction for the CALICE detector can be found in the attached files.

A sample and a complete geometry construction for the HGCalHe-CALICE (like) can be found in the attached files.

HGcal Particle Flow Reconstruction

pandora PFA recipe for developers

source /uscmst1/prod/sw/cms/cshrc cvmfse

setenv scram_ARCH slc5_amd64_gcc472

cmsrel CMSSW_6_2_0_SLHC16

cd CMSSW_6_2_0_SLHC16/src
git init
git remote add PFCal-dev

Topic attachments
I AttachmentSorted ascending History Action Size Date Who Comment
Unknown file formateps CALICEFULLSECTION.eps r1 manage 1307.7 K 2014-07-02 - 15:26 ShiyuanXu if model = FULLSECTION then m_minRadius=150 m_maxRadius=m_CalorSizeXY=1700
Unknown file formateps CALICESIMPLE20.eps r1 manage 162.0 K 2014-07-02 - 15:24 ShiyuanXu if model=SIMPLE20 then m_CalorSizeXY=200
Unknown file formateps HGCAL_CALICESIMPLE100.eps r1 manage 246.7 K 2014-07-02 - 15:28 ShiyuanXu if model = SIMPLE100 then m_CalorSizeXY=1000
Unknown file formateps HGCALFULLSECTION.eps r1 manage 3968.3 K 2014-07-02 - 15:29 ShiyuanXu  
Unknown file formateps HGCALHE_CALICEFULLSECTION.eps r1 manage 2003.6 K 2014-07-02 - 15:31 ShiyuanXu  
Unknown file formateps HGCALHE_CALICESIMPLE20.eps r1 manage 245.9 K 2014-07-02 - 15:31 ShiyuanXu  
Unknown file formateps HGCALHE_CALICESIMPLE50.eps r1 manage 245.8 K 2014-07-02 - 15:32 ShiyuanXu if model = SIMPLE100 then m_CalorSizeXY=500
Unknown file formateps HGCALHEFULLSECTION.eps r1 manage 1632.8 K 2014-07-02 - 15:33 ShiyuanXu  
Unknown file formateps HGCALHESIMPLE20.eps r1 manage 200.7 K 2014-07-02 - 15:34 ShiyuanXu  
Unknown file formateps HGCALSIMPLE20.eps r1 manage 483.0 K 2014-07-02 - 15:34 ShiyuanXu  

This topic: Main > TWikiUsers > ShiyuanXu > Shiyuan-HGCal
Topic revision: r9 - 2014-10-22 - ShiyuanXu
This site is powered by the TWiki collaboration platform Powered by PerlCopyright &© 2008-2020 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
or Ideas, requests, problems regarding TWiki? use Discourse or Send feedback