Skip to content

Commit 3da5ee3

Browse files
authored
Merge pull request #223 from JeffersonLab/bugfix-docker-extract-analysis-products
Added targz_macros.sh script to pack up the test products (pngs, root, log)
2 parents 0637609 + 1820def commit 3da5ee3

8 files changed

Lines changed: 149 additions & 6 deletions

File tree

.travis.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,14 @@ script:
99
done
1010
- for suite in unit commit release ; do
1111
docker run -t jeffersonlab/remoll "scripts/tests/test_macros.sh ${suite}" || exit 1 ;
12+
docker start $(docker ps -l -q) ;
13+
docker exec $(docker ps -l -q) "scripts/tests/targz_macros.sh ${suite}" ;
14+
docker cp $(docker ps -l -q):"remolltest.${suite}.log.tar.gz" . ;
15+
docker cp $(docker ps -l -q):"remolltest.${suite}.root.tar.gz" . ;
16+
docker cp $(docker ps -l -q):"remolltest.${suite}.analysis.log.tar.gz" . ;
17+
docker cp $(docker ps -l -q):"remolltest.${suite}.analysis.png.tar.gz" . ;
18+
docker cp $(docker ps -l -q):"remolltest.${suite}.analysis.root.tar.gz" . ;
19+
docker stop $(docker ps -l -q) ;
1220
done
1321

1422
after_success:
@@ -21,3 +29,24 @@ after_success:
2129

2230
notifications:
2331
slack: jlab12gev:PVp0QYADLTXmFdicK6WXkTGN
32+
33+
deploy:
34+
provider: releases
35+
api_key:
36+
secure: MzvvPA8KxYjEVa8C9rNtAQbtD+mDx2Wn3Em02JKMtwv953Htnv3zRcyGPfF++sLV80RvZ8NZ8pN3WfiAPTBHatUSgWh9w+GRv0G366wxKrAS4O+9BVy96U7A0gFkaXRwXirJWo4u2lJscQ1hC2IDbI2dGAS/VF5Lt1TLjWcPUL8LPcKgF80FG8+9+BUH1cRiW8mULT36EeVAB1K+vwO6Qob5k4ef66eHjkbdpuUktDr6wrehoyGXtFiBfl+XWotvcrer/51J6wn85UqCc/A+KYrVshBH/gKCD7/w6D2akNM2/sJcFdLzv5WkaQOwplsAYuzLn1cNRUKbWay5ClCSm6rsoHGfaagW4/wXk9TxqJhcdmNZ+eeAvNXAxJIeRvb82pwANlSJ658FBw2ov75p3Y6rjvc8CUPsxBXZkw3dzOgwTdjmJI9q+aD4GuVeGiq9MdyJDgXUjxlP2qEtcLJfvvF9q5Bnzy+hoAV+A5yHg0lR0VjsUem2+CdexuHb/LJLx4YVkSrCSyEELAsfyJTCYNLaMKrWKujelqtKwXy4H/rwzaja6IBP77gkisNI82bvnrzn/QsvnueGyWSu/Z2HC2M/d6WAQAl3Et9W6kOb7MK+NAmEMOTW7tzaxjD+lq8aOiLJYndrOYaymin5GLNk3F2iqZMkhMCRC2YcstNr61w=
37+
file:
38+
- remolltest.commit.log.tar.gz
39+
- remolltest.commit.root.tar.gz
40+
- remolltest.commit.analysis.log.tar.gz
41+
- remolltest.commit.analysis.png.tar.gz
42+
- remolltest.commit.analysis.root.tar.gz
43+
- remolltest.release.log.tar.gz
44+
- remolltest.release.root.tar.gz
45+
- remolltest.release.analysis.log.tar.gz
46+
- remolltest.release.analysis.png.tar.gz
47+
- remolltest.release.analysis.root.tar.gz
48+
skip_cleanup: true
49+
on:
50+
repo: JeffersonLab/remoll
51+
tags: true
52+

analysis/tests/test_power.C

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
/*
2+
This program for calculating the power on the collimator 1,2,4,5 for MOLLER
3+
experiment
4+
Chandan Ghosh
5+
part of this is taken from Rakitha's code coll_scan.cc
6+
*/
7+
#include <vector>
8+
#include <iostream>
9+
10+
#include "remolltypes.hh"
11+
12+
#include <TTree.h>
13+
#include <TFile.h>
14+
#include <TChain.h>
15+
16+
void test_power (const TString& inputdir = ".", const TString& inputname = "remollout")
17+
{
18+
// Input files
19+
TChain* T = new TChain("T");
20+
T->Add(inputdir + "/" + inputname + ".root");
21+
22+
// Output files
23+
TString outputdir = inputdir + "/" + "analysis";
24+
TFile file(outputdir + "/" + inputname + ".root","RECREATE");
25+
26+
// Collimators and particles to track
27+
std::vector<Int_t> collimators = {2001, 2006, 2002, 2004, 2005};
28+
std::vector<Int_t> particles = {11, -11, 22, 2112};
29+
30+
// Energy vectors
31+
std::vector<Double_t> esum(collimators.size(), 0.0);
32+
std::vector<std::vector<Double_t>> esum2(collimators.size(), std::vector<Double_t>(particles.size(), 0.0));
33+
34+
// Connect to tree
35+
std::vector<remollGenericDetectorSum_t>* fGenDetSum = 0;
36+
T->SetBranchAddress("sum",&fGenDetSum);
37+
38+
// Event loop
39+
Int_t nentries = T->GetEntries();
40+
std::cout << "Number of entries in TChain " << nentries << std::endl;
41+
for (int ev = 0; ev < T->GetEntries(); ev++) {
42+
43+
T->GetEntry(ev);
44+
45+
for (size_t isum = 0; isum < fGenDetSum->size(); isum++) {
46+
47+
Int_t volume = fGenDetSum->at(isum).det;
48+
Double_t edep = fGenDetSum->at(isum).edep;
49+
50+
for (size_t coll = 0; coll < collimators.size(); coll++) {
51+
52+
if (volume == collimators[coll]) {
53+
54+
esum[coll] += edep;
55+
56+
std::vector<remollGenericDetectorSumByPID_t> sumbypid = fGenDetSum->at(isum).by_pid;
57+
58+
for (size_t isum2 = 0; isum2 < sumbypid.size(); isum2++) {
59+
60+
Double_t edep = sumbypid.at(isum2).edep;
61+
Int_t pid = sumbypid.at(isum2).pid;
62+
63+
for (size_t part = 0; part < particles.size(); part++) {
64+
if (pid == particles[part])
65+
esum2[coll][part] += edep;
66+
}
67+
}
68+
}
69+
}
70+
}
71+
}
72+
73+
for (size_t coll = 0; coll < collimators.size(); coll++) {
74+
std::cout << "Collimator " << collimators[coll] << std::endl;
75+
std::vector<Double_t> esum_pid(collimators.size(), 0.0);
76+
std::cout << "Deposited energy (from sum.edep) " << std::setw(8) << esum[coll]*85./nentries << " W/85uA" << std::endl;
77+
for (size_t part = 0; part < particles.size(); part++) {
78+
std::cout << "particle " << std::setw(5) << particles[part] << " energy deposited (from by_pid) " << std::setw(6) << esum2[coll][part]*85./nentries << " W/85uA" << std::endl;
79+
esum_pid[coll] += esum2[coll][part];
80+
}
81+
std::cout << "By pid sum edep (from by_pid) " << esum_pid[coll]*85./nentries << " W/85uA" << std::endl;
82+
}
83+
std::cout << "Total energy deposited inside collimator (from sum.edep) " << esum[0]*85./nentries + esum[1]*85./nentries << " W/85uA" <<std::endl;
84+
85+
// Cleanup
86+
delete T;
87+
}
88+

macros/issues/issue179.mac

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,6 @@
88
/remoll/evgen/set beam
99
/remoll/beamene 11 GeV
1010
/remoll/kryptonite/set true
11-
/remoll/kryptonite/del Lead
12-
/remoll/kryptonite/del CW95
13-
/remoll/kryptonite/del Tungsten
14-
/remoll/kryptonite/del Copper
1511
/remoll/kryptonite/add Lead_kryp
1612
/process/list
1713
/remoll/filename remollout1.root

macros/tests/commit/test_power.mac

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/remoll/setgeofile geometry/mollerMother_merged.gdml
2+
3+
/run/initialize
4+
5+
/remoll/addfield map_directory/blockyHybrid_rm_3.0.txt
6+
/remoll/addfield map_directory/blockyUpstream_rm_1.1.txt
7+
8+
/remoll/evgen/set beam
9+
/remoll/beamene 11 GeV
10+
11+
/remoll/filename test_power.root
12+
/run/beamOn 10000

macros/tests/unit/test_kryptonite.mac

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
/run/initialize
22
/remoll/filename test_kryptonite.root
33

4-
/remoll/kryptonite/del Lead
54
/remoll/kryptonite/add G4_Pb
65
/remoll/kryptonite/list
76

scripts/tests/targz_macros.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
3+
# Exit whenever non-zero exit code occurs
4+
set -euo pipefail
5+
6+
# Determine absolute path of this script
7+
dir=`dirname $0`/../..
8+
dir=`readlink -f ${dir}`
9+
10+
# The test suite can be specified as first argument, default is "commit"
11+
suite="${1:-commit}"
12+
13+
# Pack log files
14+
tar -czvf remolltest.${suite}.log.tar.gz --transform 's|logfiles/tests/||g' logfiles/tests/${suite}/*.log
15+
tar -czvf remolltest.${suite}.analysis.log.tar.gz --transform 's|logfiles/tests/||g' logfiles/tests/${suite}/analysis/*.log
16+
# Pack analysis products
17+
tar -czvf remolltest.${suite}.root.tar.gz --transform 's|rootfiles/tests/||g' rootfiles/tests/${suite}/*.root
18+
tar -czvf remolltest.${suite}.analysis.png.tar.gz --transform 's|rootfiles/tests/||g' rootfiles/tests/${suite}/analysis/*.png
19+
tar -czvf remolltest.${suite}.analysis.root.tar.gz --transform 's|rootfiles/tests/||g' rootfiles/tests/${suite}/analysis/*.root

scripts/tests/test_macros.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ for macro in ${macros}/${macroglob} ; do
9292
echo "Starting analysis..." | tee ${logfiles}/analysis/${name}.log
9393
for rootmacro in ${analysis1}/${analysisglob} ${analysis2}/${analysisglob} ; do
9494
echo "Running analysis macro `basename ${rootmacro} .C`..."
95-
root -q -b -l "${rootmacro}+(\"${rootfiles}\",\"${name}\")" 2>&1 | tee -a ${logfiles}/analysis/${name}.log
95+
build/reroot -q -b -l "${rootmacro}+(\"${rootfiles}\",\"${name}\")" 2>&1 | tee -a ${logfiles}/analysis/${name}.log
9696
done
9797

9898
done

0 commit comments

Comments
 (0)