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

Removed dummies and moved scripts around.

- Each benchmark or set ofcommon benchmarks will have their own
directory.
parent 4e648c36
Branches
No related tags found
1 merge request!8Added input event script
image: eicweb.phy.anl.gov:4567/eic/juggler/juggler:latest
default:
tags:
- silicon
artifacts:
expire_in: 60 mins
expire_in: 3 days
paths:
- config/
- results/
......@@ -27,75 +29,52 @@ stages:
- data_init
- config
- run
- benchmarks1
- benchmarks2
- finish
get_data:
stage: data_init
tags:
- silicon
script:
- mkdir -p results
- mkdir -p sim_output
generate_config:
stage: config
needs: ["get_data"]
tags:
- silicon
script:
- mkdir -p config && ./bin/gen_ci_config -p test_ -i dummy > config/dummy_config.yml
- mkdir -p config && ./bin/gen_ci_config -p clustering_ -i clustering > config/clustering_config.yml
- mkdir -p config
dummy-pipeline:
stage: run
needs: ["generate_config"]
trigger:
include:
- artifact: config/dummy_config.yml
job: generate_config
strategy: depend
clustering-pipeline:
stage: run
needs: ["generate_config"]
trigger:
include:
- artifact: config/clustering_config.yml
job: generate_config
strategy: depend
#generate_config:
# stage: config
# needs: ["get_data"]
# tags:
# - silicon
# script:
# - mkdir -p config && ./bin/gen_ci_config -p test_ -i dummy > config/dummy_config.yml
# - mkdir -p config && ./bin/gen_ci_config -p clustering_ -i clustering > config/clustering_config.yml
#
#dummy-pipeline:
# stage: run
# needs: ["generate_config"]
# trigger:
# include:
# - artifact: config/dummy_config.yml
# job: generate_config
# strategy: depend
#
#clustering-pipeline:
# stage: run
# needs: ["generate_config"]
# trigger:
# include:
# - artifact: config/clustering_config.yml
# job: generate_config
# strategy: depend
include:
- local: 'ecal/ecal_config.yml'
#ecal-pipeline:
# stage: run
# needs: ["get_data"]
# trigger:
# include:
# - artifact: config/ecal_config.yml
# job: generate_config
# strategy: depend
#crystal_electron_simulation:
# stage: run
# needs: ["get_data"]
# tags:
# - sodium
# script:
# - git clone https://eicweb.phy.anl.gov/EIC/datasets.git datasets
# - ln -s datasets/data
# - ls -lrth
# - root -b -q "datasets/emcal_electrons.cxx(1e7, \"emcal_uniform_electrons.hepmc\")"
# - cd topside && ls -l
# - npsim --runType batch --numberOfEvents 100000 --compactFile topside.xml --inputFiles ../emcal_uniform_electrons.hepmc --outputFile ../sim_output/sim_electron_0GeVto30GeV_100k_input.root
# - run gaudirun.py ./options/example_crystal.py
# - root -b -q ./scripts/makeplot.C
final_report:
stage: finish
tags:
- silicon
needs: ["clustering-pipeline","dummy-pipeline"]
needs: ["ecal_1_emcal_electrons"]
script:
- echo "It was a success!"
#!/bin/bash
echo "Dummy Test..."
echo "..."
echo "Fails!"
exit 1
#!/bin/bash
echo "Dummy Test..."
echo "..."
echo "Passes!"
#exit 1
#!/bin/bash
echo "Dummy Test number 2..."
echo "..."
echo "Passes!"
#exit 1
#!/bin/bash
echo "Dummy Test..."
echo "..."
echo "Fails!"
exit 1
#!/bin/bash
echo "Dummy Test..."
echo "..."
echo "Passes!"
#exit 1
#!/bin/bash
echo "Dummy Test number 2..."
echo "..."
echo "Passes!"
#exit 1
......@@ -2,6 +2,7 @@ ecal_1_emcal_electrons:
image: eicweb.phy.anl.gov:4567/eic/juggler/juggler:latest
tags:
- silicon
needs: ["get_data"]
timeout: 12 hours 30 minutes
artifacts:
expire_in: 20 weeks
......
#!/bin/bash
if [[ ! -n "${JUGGLER_DETECTOR}" ]] ; then
export JUGGLER_DETECTOR="topside"
fi
......@@ -18,15 +17,19 @@ export JUGGLER_REC_FILE="rec_${JUGGLER_FILE_NAME_TAG}.root"
echo "JUGGLER_N_EVENTS = ${JUGGLER_N_EVENTS}"
echo "JUGGLER_DETECTOR = ${JUGGLER_DETECTOR}"
git clone https://eicweb.phy.anl.gov/EIC/datasets.git datasets
root -b -q "datasets/emcal_electrons.cxx(${JUGGLER_N_EVENTS}, \"${JUGGLER_FILE_NAME_TAG}.hepmc\")"
# Build the detector constructors.
git clone https://eicweb.phy.anl.gov/EIC/detectors/${JUGGLER_DETECTOR}.git
mkdir ${JUGGLER_DETECTOR}/build
pushd ${JUGGLER_DETECTOR}/build
cmake ../. -DCMAKE_INSTALL_PREFIX=/usr/local && make -j30 install
popd
# generate the input events
# note datasets is now only used to develop datasets.
#git clone https://eicweb.phy.anl.gov/EIC/datasets.git datasets
root -b -q "ecal/scripts/emcal_electrons.cxx(${JUGGLER_N_EVENTS}, \"${JUGGLER_FILE_NAME_TAG}.hepmc\")"
pushd ${JUGGLER_DETECTOR}
ls -l
# run geant4 simulations
......@@ -37,18 +40,15 @@ npsim --runType batch \
--inputFiles ../${JUGGLER_FILE_NAME_TAG}.hepmc \
--outputFile ${JUGGLER_SIM_FILE}
# Need to figure out how to pass file name to juggler from the commandline
xenv -x /usr/local/Juggler.xenv gaudirun.py ../ecal/options/example_crystal.py
ls -l
popd
ls -l
pwd
mkdir -p results
root -b -q "./scripts/makeplot.C(\"${JUGGLER_DETECTOR}/${JUGGLER_REC_FILE}\")"
root -b -q "ecal/scripts/makeplot.C(\"${JUGGLER_DETECTOR}/${JUGGLER_REC_FILE}\")"
mkdir -p sim_output
cp "${JUGGLER_DETECTOR}/${JUGGLER_REC_FILE}" sim_output/.
cp "${JUGGLER_DETECTOR}/${JUGGLER_SIM_FILE}" sim_output/.
#mkdir -p sim_output
#cp "${JUGGLER_DETECTOR}/${JUGGLER_REC_FILE}" sim_output/.
#cp "${JUGGLER_DETECTOR}/${JUGGLER_SIM_FILE}" sim_output/.
//////////////////////////////////////////////////////////////
// Crystal EMCAL detector
// Single Electron dataset
// J.KIM 07/20/2020
//
// 10/4/2020
// Changed to have isotropic distribution in momentum sphere
//////////////////////////////////////////////////////////////
#include "HepMC3/GenEvent.h"
#include "HepMC3/ReaderAscii.h"
#include "HepMC3/WriterAscii.h"
#include "HepMC3/Print.h"
#include <iostream>
#include<random>
#include<cmath>
#include <math.h>
#include <TMath.h>
using namespace HepMC3;
void emcal_electrons(int n_events = 1e6, const char* out_fname = "./data/emcal_electron_0GeVto30GeV_100kEvt.hepmc")
{
WriterAscii hepmc_output(out_fname);
int events_parsed = 0;
GenEvent evt(Units::GEV, Units::MM);
// Random number generator
TRandom *r1 = new TRandom();
for (events_parsed = 0; events_parsed < n_events; events_parsed++) {
// FourVector(px,py,pz,e,pdgid,status)
// type 4 is beam
// pdgid 11 - electron
// pdgid 111 - pi0
// pdgid 2212 - proton
GenParticlePtr p1 =
std::make_shared<GenParticle>(FourVector(0.0, 0.0, 10.0, 10.0), 11, 4);
GenParticlePtr p2 = std::make_shared<GenParticle>(
FourVector(0.0, 0.0, 0.0, 0.938), 2212, 4);
// Define momentum
Double_t p = r1->Uniform(0.0, 30.0);
Double_t px;
Double_t py;
Double_t pz;
// Generates random vectors, uniformly distributed over the surface of a
// sphere of given radius, in this case momentum.
r1->Sphere(px, py, pz, p);
// type 1 is final state
// pdgid 11 - electron 0.510 MeV/c^2
GenParticlePtr p3 = std::make_shared<GenParticle>(
FourVector(
px, py, pz,
sqrt(p*p + (0.000511 * 0.000511))),
11, 1);
GenVertexPtr v1 = std::make_shared<GenVertex>();
v1->add_particle_in(p1);
v1->add_particle_in(p2);
v1->add_particle_out(p3);
evt.add_vertex(v1);
if (events_parsed == 0) {
std::cout << "First event: " << std::endl;
Print::listing(evt);
}
hepmc_output.write_event(evt);
if (events_parsed % 10000 == 0) {
std::cout << "Event: " << events_parsed << std::endl;
}
evt.clear();
}
hepmc_output.close();
std::cout << "Events parsed and written: " << events_parsed << std::endl;
}
//////////////////////////
// Crystal EMCAL detector
// Electron dataset
// J.KIM 07/20/2020
//////////////////////////
#include "HepMC3/GenEvent.h"
#include "HepMC3/ReaderAscii.h"
#include "HepMC3/WriterAscii.h"
#include "HepMC3/Print.h"
#include "TH1F.h"
#include <iostream>
#include "TStyle.h"
using namespace HepMC3;
void emcal_electrons_reader(){
// Setting for graphs
gROOT->SetStyle("Plain");
gStyle->SetOptFit(1);
gStyle->SetLineWidth(2);
gStyle->SetPadTickX(1);
gStyle->SetPadTickY(1);
gStyle->SetPadGridX(1);
gStyle->SetPadGridY(1);
gStyle->SetPadLeftMargin(0.14);
gStyle->SetPadRightMargin(0.14);
ReaderAscii hepmc_input("./data/emcal_electron_0GeVto30GeV_100kEvt.hepmc");
int events_parsed = 0;
GenEvent evt(Units::GEV, Units::MM);
// Histograms
TH1F* h_electrons_energy = new TH1F("h_electron_energy", "electron energy;E [GeV];Events", 100,-0.5,30.5);
TH1F* h_electrons_eta = new TH1F("h_electron_eta", "electron #eta;#eta;Events", 100,-10.0,10.0);
TH1F* h_electrons_theta = new TH1F("h_electron_theta", "electron #theta;#theta [degree];Events", 100,-0.5,180.5);
TH1F* h_electrons_phi = new TH1F("h_electron_phi", "electron #phi;#phi [degree];Events", 100,-180.5,180.5);
TH2F* h_electrons_pzpt = new TH2F("h_electrons_pzpt", "electron pt vs pz;pt [GeV];pz [GeV]", 100,-0.5,30.5,100,-30.5,30.5);
TH2F* h_electrons_pxpy = new TH2F("h_electrons_pxpy", "electron px vs py;px [GeV];py [GeV]", 100,-30.5,30.5,100,-30.5,30.5);
TH3F* h_electrons_p = new TH3F("h_electron_p", "electron p;px [GeV];py [GeV];pz [GeV]", 100,-30.5,30.5,100,-30.5,30.5,100,-30.5,30.5);
while(!hepmc_input.failed()) {
// Read event from input file
hepmc_input.read_event(evt);
// If reading failed - exit loop
if( hepmc_input.failed() ) break;
for(const auto& v : evt.vertices() ) {
for(const auto& p : v->particles_out() ) {
if(p->pid() == 11) {
h_electrons_energy->Fill(p->momentum().e());
h_electrons_eta->Fill(p->momentum().eta());
h_electrons_theta->Fill(p->momentum().theta()*TMath::RadToDeg());
h_electrons_phi->Fill(p->momentum().phi()*TMath::RadToDeg());
h_electrons_pzpt->Fill(TMath::Sqrt(p->momentum().px()*p->momentum().px() + p->momentum().py()*p->momentum().py()),p->momentum().pz());
h_electrons_pxpy->Fill(p->momentum().px(),p->momentum().py());
h_electrons_p->Fill(p->momentum().px(),p->momentum().py(),p->momentum().pz());
}
}
}
evt.clear();
events_parsed++;
}
std::cout << "Events parsed and written: " << events_parsed << std::endl;
TCanvas* c = new TCanvas("c","c", 500, 500);
h_electrons_energy->GetYaxis()->SetTitleOffset(1.8);
h_electrons_energy->SetLineWidth(2);
h_electrons_energy->SetLineColor(kBlue);
h_electrons_energy->DrawClone();
c->SaveAs("results/emcal_electrons_energy_0GeVto30GeV.png");
c->SaveAs("results/emcal_electrons_energy_0GeVto30GeV.pdf");
TCanvas* c1 = new TCanvas("c1","c1", 500, 500);
h_electrons_eta->GetYaxis()->SetTitleOffset(1.9);
h_electrons_eta->SetLineWidth(2);
h_electrons_eta->SetLineColor(kBlue);
h_electrons_eta->DrawClone();
c1->SaveAs("results/emcal_electrons_eta_0GeVto30GeV.png");
c1->SaveAs("results/emcal_electrons_eta_0GeVto30GeV.pdf");
TCanvas* c2 = new TCanvas("c2","c2", 500, 500);
h_electrons_theta->GetYaxis()->SetTitleOffset(1.8);
h_electrons_theta->SetLineWidth(2);
h_electrons_theta->SetLineColor(kBlue);
h_electrons_theta->DrawClone();
c2->SaveAs("results/emcal_electrons_theta_0GeVto30GeV.png");
c2->SaveAs("results/emcal_electrons_theta_0GeVto30GeV.pdf");
TCanvas* c3 = new TCanvas("c3","c3", 500, 500);
h_electrons_phi->GetYaxis()->SetTitleOffset(1.8);
h_electrons_phi->SetLineWidth(2);
h_electrons_phi->GetYaxis()->SetRangeUser(0.0,h_electrons_phi->GetMaximum()+100.0);
h_electrons_phi->SetLineColor(kBlue);
h_electrons_phi->DrawClone();
c3->SaveAs("results/emcal_electrons_phi_0GeVto30GeV.png");
c3->SaveAs("results/emcal_electrons_phi_0GeVto30GeV.pdf");
TCanvas* c4 = new TCanvas("c4","c4", 500, 500);
h_electrons_pzpt->GetYaxis()->SetTitleOffset(1.4);
h_electrons_pzpt->SetLineWidth(2);
h_electrons_pzpt->SetLineColor(kBlue);
h_electrons_pzpt->DrawClone("COLZ");
c4->SaveAs("results/emcal_electrons_pzpt_0GeVto30GeV.png");
c4->SaveAs("results/emcal_electrons_pzpt_0GeVto30GeV.pdf");
TCanvas* c5 = new TCanvas("c5","c5", 500, 500);
h_electrons_pxpy->GetYaxis()->SetTitleOffset(1.4);
h_electrons_pxpy->SetLineWidth(2);
h_electrons_pxpy->SetLineColor(kBlue);
h_electrons_pxpy->DrawClone("COLZ");
c5->SaveAs("results/emcal_electrons_pxpy_0GeVto30GeV.png");
c5->SaveAs("results/emcal_electrons_pxpy_0GeVto30GeV.pdf");
TCanvas* c6 = new TCanvas("c6","c6", 500, 500);
h_electrons_p->GetYaxis()->SetTitleOffset(1.8);
h_electrons_p->GetXaxis()->SetTitleOffset(1.6);
h_electrons_p->GetZaxis()->SetTitleOffset(1.6);
h_electrons_p->SetLineWidth(2);
h_electrons_p->SetLineColor(kBlue);
h_electrons_p->DrawClone();
c6->SaveAs("results/emcal_electrons_p_0GeVto30GeV.png");
c6->SaveAs("results/emcal_electrons_p_0GeVto30GeV.pdf");
}
File moved
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment