Skip to content
Snippets Groups Projects
Commit ac69b190 authored by Jihee Kim's avatar Jihee Kim
Browse files

Added crystal emcal scripts for benchmarks.

parent abbcb001
No related branches found
No related tags found
No related merge requests found
...@@ -38,3 +38,5 @@ __pycache__/ ...@@ -38,3 +38,5 @@ __pycache__/
# test for calorimeter # test for calorimeter
calorimeters/test/ calorimeters/test/
*.d
*.pcm
...@@ -67,6 +67,15 @@ zdc_simulation: ...@@ -67,6 +67,15 @@ zdc_simulation:
- cp NPDet/src/GenericDetectors/calorimeters/compact/materials.xml ./. - cp NPDet/src/GenericDetectors/calorimeters/compact/materials.xml ./.
- bash calorimeters/run_simulation_zdc.sh - bash calorimeters/run_simulation_zdc.sh
crystal_emcal_simulation:
stage: simulate
tags:
- sodium
script:
- cp NPDet/src/GenericDetectors/calorimeters/compact/elements.xml ./.
- cp NPDet/src/GenericDetectors/calorimeters/compact/materials.xml ./.
- bash calorimeters/run_simulation_crystal.sh
cal_test_1_dummy_test2: cal_test_1_dummy_test2:
stage: benchmarks stage: benchmarks
tags: tags:
...@@ -142,6 +151,15 @@ zdc_benchmark_info_histogram: ...@@ -142,6 +151,15 @@ zdc_benchmark_info_histogram:
- root -b -q calorimeters/simple_info_plot_histograms.cxx+ - root -b -q calorimeters/simple_info_plot_histograms.cxx+
allow_failure: true allow_failure: true
crystal_benchmark:
stage: benchmarks
tags:
- sodium
script:
- ls -lrth sim_output
- root -b -q calorimeters/simple_checking_crystal.cxx+
allow_failure: true
deploy_results: deploy_results:
stage: deploy stage: deploy
tags: tags:
......
<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="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>
#!/bin/bash
ddsim --runType batch --numberOfEvents 100 \
--compactFile ./calorimeters/Crystal_example.xml \
--inputFiles ./data/emcal_electrons.hepmc \
--outputFile ./sim_output/output_emcal_electrons.root
R__LOAD_LIBRARY(libDDG4IO.so)
#include "DDG4/Geant4Data.h"
#include "ROOT/RDataFrame.hxx"
#include "TCanvas.h"
#include "TChain.h"
#include <random>
void simple_checking_crystal(const char* fname = "sim_output/output_emcal_electrons.root"){
ROOT::EnableImplicitMT(); // Tell ROOT you want to go parallel
double degree = TMath::Pi()/180.0;
TChain* t = new TChain("EVENT");
t->Add(fname);
ROOT::RDataFrame d0(*t);//, {"EcalHits","MCParticles"});
auto nhits = [] (std::vector<dd4hep::sim::Geant4Calorimeter::Hit*>& hits){ return (int) hits.size(); };
auto d1 = d0.Define("nhits", nhits, {"ZDCHits"});
auto h0 = d1.Histo1D(TH1D("h0", "nhits; ", 20, 0,20), "nhits");
auto n0 = d1.Filter([](int n){ return (n>0); },{"nhits"}).Count();
TCanvas* c = new TCanvas();
std::cout << *n0 << " events with nonzero hits\n";
if(*n0<5) {
std::quick_exit(1);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment