Skip to content

Commit 06a1e0b

Browse files
authored
Merge pull request #90 from rest-for-physics/jgalan-pipeline-fix
Trying to fix pipeline
2 parents a0d1e94 + 81e514b commit 06a1e0b

File tree

5 files changed

+48
-47
lines changed

5 files changed

+48
-47
lines changed

.github/workflows/validation.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,11 @@ jobs:
103103
source ${{ env.REST_PATH }}/thisREST.sh
104104
cd ${{ env.DETECTOR_LIB_PATH }}/pipeline/readout
105105
restManager --c generateReadout.rml --o readout.root
106-
restRoot -b -q PrintReadout.C'("readout.root")' > print.txt
107-
diff print.txt validation.txt > output.txt
108-
python3 checkLines.py
106+
echo "Generating print.txt"
107+
restRoot -b -q PrintReadout.C'("readout.root")'
108+
ls
109+
echo "Validating"
110+
python3 compareFiles.py
109111
# We need to introduce basic validation here
110112
# - diff validation.txt print.txt
111113
# - name: Basic Readout

pipeline/readout/PrintReadout.C

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ void PrintReadout(TString fName) {
1515
exit(1);
1616
}
1717

18-
/*
1918
fstream file;
2019
file.open("print.txt", ios::out);
2120
string line;
@@ -24,33 +23,13 @@ void PrintReadout(TString fName) {
2423
streambuf* stream_buffer_file = file.rdbuf();
2524

2625
cout.rdbuf(stream_buffer_file);
27-
*/
28-
29-
cout << "Filename : " << fileName << endl;
3026

3127
TRestRun run(fname);
3228
TRestDetectorReadout* r = (TRestDetectorReadout*)run.GetMetadata("Prototype_2020_06");
3329
r->PrintMetadata(3);
34-
/*
35-
TFile* f = new TFile(fileName);
36-
37-
TIter nextkey(f->GetListOfKeys());
38-
TKey* key;
39-
int n = 0;
40-
while ((key = (TKey*)nextkey())) {
41-
if (((string)(key->GetClassName())).find("TRestDetectorReadout") != -1) {
42-
TObject* obj = f->Get(key->GetName());
43-
TRestDetectorReadout& readout = *(TRestDetectorReadout*)obj;
44-
readout[0].Print(1);
45-
}
46-
n++;
47-
}
48-
49-
f->Close();
5030

5131
cout.rdbuf(stream_buffer_cout); // back to the old buffer
5232
file.close();
53-
*/
5433

5534
return 0;
5635
}

pipeline/readout/checkLines.py

Lines changed: 0 additions & 9 deletions
This file was deleted.

pipeline/readout/compareFiles.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import sys
2+
3+
with open("print.txt") as file_1:
4+
file_1_text = file_1.readlines()
5+
6+
with open("validation.txt") as file_2:
7+
file_2_text = file_2.readlines()
8+
9+
stop_removing = 0
10+
while not stop_removing:
11+
if len(file_1_text) == 0:
12+
break
13+
if file_1_text[0].rstrip().find("Number of readout planes") >= 0:
14+
stop_removing = 1
15+
file_1_text.pop(0)
16+
17+
stop_removing = 0
18+
while not stop_removing:
19+
if len(file_2_text) == 0:
20+
break
21+
if file_2_text[0].rstrip().find("Number of readout planes") >= 0:
22+
stop_removing = 1
23+
file_2_text.pop(0)
24+
25+
result = 0
26+
maxN = 2700
27+
n = 0
28+
for line in file_1_text:
29+
if line.rstrip() != file_2_text[n].rstrip():
30+
print("XX:" + line.rstrip())
31+
print("YY:" + file_2_text[n].rstrip())
32+
result = 1
33+
n = n + 1
34+
if n > maxN:
35+
print("Readout validation result " + str(result))
36+
sys.exit(result)
37+
38+
39+
print("Readout validation result " + str(result))
40+
sys.exit(result)

pipeline/readout/validation.txt

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,5 @@
1-
= Loading libraries ...
2-
- /home/jgalan/rest-framework/install/lib/libRestDetector.so
3-
Heed:
4-
Database path: /programas/garfield/6.26.06/share/Heed/database
5-
- /home/jgalan/rest-framework/install/lib/libRestFramework.so
6-
- /home/jgalan/rest-framework/install/lib/libRestRaw.so
7-
- /home/jgalan/rest-framework/install/lib/libRestGeant4.so
8-
- /home/jgalan/rest-framework/install/lib/libRestConnectors.so
9-
- /home/jgalan/rest-framework/install/lib/libRestAxion.so
10-
11-
12-
Processing PrintReadout.C("output.root")...
13-
Filename : output.root
1+
<<<<<<< HEAD
2+
Processing PrintReadout.C("readout.root")...
143
+++++++++++++++++++++++++++++++++++++++++++++
154
TRestDetectorReadout content
165
Config file : generateReadout.rml
@@ -20,7 +9,7 @@ Title : PANDA readout 7module
209
REST Version : 2.3.15
2110
REST Official release: No
2211
Clean state: No
23-
REST Commit : 2aae3c43
12+
REST Commit : 2bac46ca
2413
REST Library version : 1.9
2514
---------------------------------------
2615
Number of readout planes : 1

0 commit comments

Comments
 (0)