Skip to content

Commit

Permalink
Merge pull request #90 from rest-for-physics/jgalan-pipeline-fix
Browse files Browse the repository at this point in the history
Trying to fix pipeline
  • Loading branch information
jgalan authored Jun 6, 2023
2 parents a0d1e94 + 81e514b commit 06a1e0b
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 47 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,11 @@ jobs:
source ${{ env.REST_PATH }}/thisREST.sh
cd ${{ env.DETECTOR_LIB_PATH }}/pipeline/readout
restManager --c generateReadout.rml --o readout.root
restRoot -b -q PrintReadout.C'("readout.root")' > print.txt
diff print.txt validation.txt > output.txt
python3 checkLines.py
echo "Generating print.txt"
restRoot -b -q PrintReadout.C'("readout.root")'
ls
echo "Validating"
python3 compareFiles.py
# We need to introduce basic validation here
# - diff validation.txt print.txt
# - name: Basic Readout
Expand Down
21 changes: 0 additions & 21 deletions pipeline/readout/PrintReadout.C
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ void PrintReadout(TString fName) {
exit(1);
}

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

cout.rdbuf(stream_buffer_file);
*/

cout << "Filename : " << fileName << endl;

TRestRun run(fname);
TRestDetectorReadout* r = (TRestDetectorReadout*)run.GetMetadata("Prototype_2020_06");
r->PrintMetadata(3);
/*
TFile* f = new TFile(fileName);
TIter nextkey(f->GetListOfKeys());
TKey* key;
int n = 0;
while ((key = (TKey*)nextkey())) {
if (((string)(key->GetClassName())).find("TRestDetectorReadout") != -1) {
TObject* obj = f->Get(key->GetName());
TRestDetectorReadout& readout = *(TRestDetectorReadout*)obj;
readout[0].Print(1);
}
n++;
}
f->Close();

cout.rdbuf(stream_buffer_cout); // back to the old buffer
file.close();
*/

return 0;
}
9 changes: 0 additions & 9 deletions pipeline/readout/checkLines.py

This file was deleted.

40 changes: 40 additions & 0 deletions pipeline/readout/compareFiles.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import sys

with open("print.txt") as file_1:
file_1_text = file_1.readlines()

with open("validation.txt") as file_2:
file_2_text = file_2.readlines()

stop_removing = 0
while not stop_removing:
if len(file_1_text) == 0:
break
if file_1_text[0].rstrip().find("Number of readout planes") >= 0:
stop_removing = 1
file_1_text.pop(0)

stop_removing = 0
while not stop_removing:
if len(file_2_text) == 0:
break
if file_2_text[0].rstrip().find("Number of readout planes") >= 0:
stop_removing = 1
file_2_text.pop(0)

result = 0
maxN = 2700
n = 0
for line in file_1_text:
if line.rstrip() != file_2_text[n].rstrip():
print("XX:" + line.rstrip())
print("YY:" + file_2_text[n].rstrip())
result = 1
n = n + 1
if n > maxN:
print("Readout validation result " + str(result))
sys.exit(result)


print("Readout validation result " + str(result))
sys.exit(result)
17 changes: 3 additions & 14 deletions pipeline/readout/validation.txt
Original file line number Diff line number Diff line change
@@ -1,16 +1,5 @@
= Loading libraries ...
- /home/jgalan/rest-framework/install/lib/libRestDetector.so
Heed:
Database path: /programas/garfield/6.26.06/share/Heed/database
- /home/jgalan/rest-framework/install/lib/libRestFramework.so
- /home/jgalan/rest-framework/install/lib/libRestRaw.so
- /home/jgalan/rest-framework/install/lib/libRestGeant4.so
- /home/jgalan/rest-framework/install/lib/libRestConnectors.so
- /home/jgalan/rest-framework/install/lib/libRestAxion.so


Processing PrintReadout.C("output.root")...
Filename : output.root
<<<<<<< HEAD
Processing PrintReadout.C("readout.root")...
+++++++++++++++++++++++++++++++++++++++++++++
TRestDetectorReadout content
Config file : generateReadout.rml
Expand All @@ -20,7 +9,7 @@ Title : PANDA readout 7module
REST Version : 2.3.15
REST Official release: No
Clean state: No
REST Commit : 2aae3c43
REST Commit : 2bac46ca
REST Library version : 1.9
---------------------------------------
Number of readout planes : 1
Expand Down

0 comments on commit 06a1e0b

Please sign in to comment.