Skip to content

Commit 4ae74ed

Browse files
Merge pull request #193 from josephbertaux/mapping_test
Added explicit round-trip conversion checking macro
2 parents 6ae009d + a53bcb0 commit 4ae74ed

File tree

4 files changed

+87
-3
lines changed

4 files changed

+87
-3
lines changed

general_codes/josephb/software_check/Fun4All_G4_sPHENIX.C

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ int Fun4All_G4_sPHENIX(
279279
// Write the DST
280280
//======================
281281

282-
//Enable::DSTOUT = true;
282+
Enable::DSTOUT = true;
283283
Enable::DSTOUT_COMPRESS = false;
284284
DstOut::OutputDir = outdir;
285285
DstOut::OutputFile = outputFile;
@@ -682,6 +682,8 @@ int Fun4All_G4_sPHENIX(
682682
{
683683
string FullOutFile = DstOut::OutputDir + "/" + DstOut::OutputFile;
684684
Fun4AllDstOutputManager *out = new Fun4AllDstOutputManager("DSTOUT", FullOutFile);
685+
out->AddNode("TRKR_HITSET");
686+
out->AddNode("TRKR_CLUSTER");
685687
if (Enable::DSTOUT_COMPRESS)
686688
{
687689
ShowerCompress();

general_codes/josephb/software_check/check.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,6 @@ ${LD_LIBRARY_PATH}
3333
---------------------------------------------
3434
3535
EOF
36-
root -q -b Fun4All_G4_sPHENIX.C
37-
root -q -b check.C
36+
# root -q -b Fun4All_G4_sPHENIX.C | tee Fun4All_G4_sPHENIX.out
37+
# root -q -b check.C | tee check.out
38+
root -q -b do_round_trip.C | tee do_round_trip.out
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
#ifndef DO_ROUND_TRIP_C
2+
#define DO_ROUND_TRIP_C
3+
4+
#include <intt/InttMapping.h>
5+
R__LOAD_LIBRARY(libintt.so)
6+
7+
#include <boost/format.hpp>
8+
9+
void
10+
print (
11+
InttNameSpace::RawData_s const& rawdata
12+
) {
13+
std::cout << (boost::format (
14+
"RawData_s { .felix_server = %1d, .felix_channel = %2d, .chip = %2d, .channel = %3d }")
15+
% rawdata.felix_server % rawdata.felix_channel % rawdata.chip % rawdata.channel).str();
16+
}
17+
18+
void
19+
print (
20+
InttNameSpace::Online_s const& online
21+
) {
22+
std::cout << (boost::format (
23+
"Online_s { .lyr = %1d, .ldr = %2d, .arm = %2d, .chp = %2d, .chn = %3d }")
24+
% online.lyr % online.ldr % online.arm % online.chp % online.chn).str();
25+
}
26+
27+
void
28+
print (
29+
InttNameSpace::Offline_s const& offline
30+
) {
31+
std::cout << (boost::format (
32+
"Online_s { .layer = %1d, .ladder_phi = %2d, .ladder_z = %2d, .strip_x = %2d, .strip_y = %3d }")
33+
% offline.layer % offline.ladder_phi % offline.ladder_z % offline.strip_x % offline.strip_y).str();
34+
}
35+
36+
void
37+
do_round_trip (
38+
) {
39+
40+
for (int felix_server = 0; felix_server < 8; ++felix_server) {
41+
for (int felix_channel = 0; felix_channel < 14; ++felix_channel) {
42+
for (int chip = 0; chip < 26; ++chip) {
43+
for (int channel = 0; channel < 128; ++channel) {
44+
45+
InttNameSpace::RawData_s rawdata;
46+
rawdata.felix_server = felix_server;
47+
rawdata.felix_channel = felix_channel;
48+
rawdata.chip = chip;
49+
rawdata.channel = channel;
50+
51+
InttNameSpace::Online_s online = InttNameSpace::ToOnline(rawdata);
52+
InttNameSpace::Offline_s offline = InttNameSpace::ToOffline(rawdata);
53+
54+
print(rawdata); std::cout << std::endl;
55+
print(online); std::cout << std::endl;
56+
print(offline); std::cout << std::endl;
57+
58+
// Checks
59+
if (InttNameSpace::ToRawData(online) != rawdata) {
60+
std::cout << "Problem on line " << __LINE__ << std::endl;
61+
}
62+
63+
if (InttNameSpace::ToRawData(offline) != rawdata) {
64+
std::cout << "Problem on line " << __LINE__ << std::endl;
65+
}
66+
67+
if (InttNameSpace::ToOnline(offline) != online) {
68+
std::cout << "Problem on line " << __LINE__ << std::endl;
69+
}
70+
71+
if (InttNameSpace::ToOffline(online) != offline) {
72+
std::cout << "Problem on line " << __LINE__ << std::endl;
73+
}
74+
}
75+
}
76+
}
77+
}
78+
}
79+
80+
#endif//DO_ROUND_TRIP_C

general_codes/josephb/software_check/submit_jobs.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ cp check.sh "check_$1/."
2020
cp Fun4All_G4_sPHENIX.C "check_$1/."
2121
cp G4Setup_sPHENIX.C "check_$1/."
2222
cp check.C "check_$1/."
23+
cp do_round_trip.C "check_$1/."
2324

2425
JOB="job/job_$1.txt"
2526
cat << EOF > ${JOB}

0 commit comments

Comments
 (0)