Skip to content

Commit 3b01ae6

Browse files
whit2333Whitney Armstrong
andauthored
Petiroc timestamps2 (#512)
* Added petiroc board timestamps * Adding CI stuff that is for gitlab modified: common-tools/clas-detector/src/main/java/org/jlab/detector/decode/CLASDecoder4.java modified: common-tools/clas-detector/src/main/java/org/jlab/detector/decode/CodaEventDecoder.java modified: common-tools/clas-detector/src/main/java/org/jlab/detector/decode/DetectorDataDgtz.java modified: etc/bankdefs/hipo4/data.json --------- Co-authored-by: Whitney Armstrong <[email protected]>
1 parent e20330f commit 3b01ae6

File tree

8 files changed

+76
-20
lines changed

8 files changed

+76
-20
lines changed

.containers/coatjava.Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,5 @@ ARG REF_NAME=development
2222
# build coatjava
2323
RUN java --version && cd /opt && \
2424
git clone https://code.jlab.org/hallb/alert/coatjava.git && cd coatjava && \
25-
git fetch origin && git checkout ${REF_NAME} && ./build-coatjava.sh --quiet
25+
git fetch origin && git checkout ${REF_NAME} && ./build-coatjava.sh --quiet && \
26+
./install-clara /opt/clara

.containers/coatjava.def

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
Bootstrap: docker
2+
From: codecr.jlab.org/hallb/alert/coatjava/coatjava:{{ REF_NAME }}
3+
4+
5+
%environment
6+
export CLAS12DIR=/opt/coatjava/coatjava
7+
8+
%help
9+
This is a clas12 coatjava container used to run coatjava on HPC systems
10+
and do rapid development.
11+
12+
%labels
13+
Author Whitney Armstrong [email protected]
14+
REF_NAME {{ REF_NAME }}

.gitlab-ci.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ workflow:
99

1010
variables:
1111
KUBERNETES_MEMORY_LIMIT: "8Gi"
12+
REF_NAME: ${CI_COMMIT_REF_NAME}
1213

1314
default:
1415
image: ubuntu:noble
@@ -69,3 +70,16 @@ shared_for_alert_tests:
6970
project: hallb/alert/atof/shared_for_alert
7071
strategy: depend
7172

73+
coatjava:singularity:
74+
image: eicweb.phy.anl.gov:4567/containers/image_recipes/ubuntu_dind:latest
75+
tags:
76+
- silicon
77+
allow_failure: true
78+
script:
79+
- apptainer build --build-arg REF_NAME=${REF_NAME} coatjava.sif .containers/coatjava.def
80+
- ls -lrth
81+
artifacts:
82+
paths:
83+
- coatjava.sif
84+
85+

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,6 @@ http://stackoverflow.com/questions/600079/how-do-i-clone-a-subdirectory-only-of-
5858
5959
-->
6060

61+
62+
[Coatjava Apptainer](https://code.jlab.org/hallb/alert/coatjava/-/jobs/artifacts/development/raw/coatjava.sif?job=coatjava%3Asingularity)
63+

common-tools/clas-detector/src/main/java/org/jlab/detector/decode/CLASDecoder4.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,8 @@ public Bank getDataBankTDCPetiroc(String name, DetectorType type){
333333
tdcBANK.putByte("order", i, (byte) tdcDGTZ.get(i).getDescriptor().getOrder());
334334
tdcBANK.putInt("TDC", i, tdcDGTZ.get(i).getTDCData(0).getTime());
335335
tdcBANK.putInt("ToT", i, tdcDGTZ.get(i).getTDCData(0).getToT());
336+
tdcBANK.putLong("timestamp", i, tdcDGTZ.get(i).getTDCData(0).getTimeStamp());
337+
tdcBANK.putInt("trigger", i, tdcDGTZ.get(i).getTrigger());
336338
//System.err.println("event: " + tdcDGTZ.get(i).toString());
337339
}
338340
return tdcBANK;

common-tools/clas-detector/src/main/java/org/jlab/detector/decode/CodaEventDecoder.java

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1063,24 +1063,36 @@ public List<DetectorDataDgtz> getDataEntries_57657(Integer crate, EvioNode node
10631063

10641064
int position = 0;
10651065
while(position<cdatatypes.size()-4){
1066-
Byte slot = (Byte) cdataitems.get(position+0);
1067-
Integer trig_num = (Integer) cdataitems.get(position+1);
1066+
Byte slot = (Byte) cdataitems.get(position+0);
1067+
Integer trig_num = (Integer) cdataitems.get(position+1);
10681068
Long time_stamp = (Long) cdataitems.get(position+2);
1069-
Integer nchannels = (Integer) cdataitems.get(position+3);
1070-
position += 4;
1071-
int counter = 0;
1069+
Integer nchannels = (Integer) cdataitems.get(position+3);
1070+
int counter = 0;
1071+
1072+
position += 4; // slot, trig,time,nchannels
1073+
//
10721074
while(counter<nchannels){
10731075
Byte channel = (Byte) cdataitems.get(position+0);
10741076
Integer tdc = (Integer) cdataitems.get(position+1);
10751077
// width over threshold
10761078
Integer tot = (Integer) cdataitems.get(position+2);
10771079

1078-
1079-
// Not sure what is going on here yet...
1080-
DetectorDataDgtz bank = new DetectorDataDgtz(crate,slot.intValue(),channel.intValue());
1081-
bank.addTDC(new TDCData(tdc,tot));
1080+
DetectorDataDgtz bank = new DetectorDataDgtz(
1081+
crate, slot.intValue(), channel.intValue());
1082+
// the "bank" has a timestamp.
1083+
// the tdc also can have a timestamp.
1084+
// the tdc is added tot he "bank"
1085+
// the "bank" is added to the "entries" (array of DetectorDataDgtz)
1086+
// "entries" List<DetectorDataDgtz> -> "bank" DetectorDataDgtz -> "tdc" TDCData
1087+
// there is a redundancy in timestamp: the same value is stored in TDCData and the DetectorDataDgz
1088+
//
1089+
bank.setTimeStamp(time_stamp);
1090+
bank.setTrigger(trig_num);;
1091+
TDCData tdc_data = new TDCData(tdc, tot);
1092+
tdc_data.setTimeStamp(time_stamp).setOrder(counter);
1093+
bank.addTDC(tdc_data);
10821094
entries.add(bank);
1083-
position += 3;
1095+
position += 3; // channel,tdc,tot
10841096
counter++;
10851097
//System.err.println("event: " + bank.toString());
10861098
}

common-tools/clas-detector/src/main/java/org/jlab/detector/decode/DetectorDataDgtz.java

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,14 @@
1414
*/
1515
public class DetectorDataDgtz implements Comparable<DetectorDataDgtz> {
1616

17-
private final List<ADCData> adcStore = new ArrayList<>();
18-
private final List<TDCData> tdcStore = new ArrayList<>();
19-
private final List<VTPData> vtpStore = new ArrayList<>();
20-
private final List<SCALERData> scalerStore = new ArrayList<>();
21-
private Long timeStamp = 0L;
17+
private final List<ADCData> adcStore = new ArrayList<>();
18+
private final List<TDCData> tdcStore = new ArrayList<>();
19+
private final List<VTPData> vtpStore = new ArrayList<>();
20+
private final List<SCALERData> scalerStore = new ArrayList<>();
21+
private Long timeStamp = 0L;
22+
private int trigger = 0; // Trigger number ( usually only 1 trigger due to rol2(?) );
2223

24+
2325
private final DetectorDescriptor descriptor = new DetectorDescriptor();
2426

2527
public DetectorDataDgtz(){
@@ -66,6 +68,9 @@ public long getTimeStamp(){
6668
public DetectorDescriptor getDescriptor(){
6769
return this.descriptor;
6870
}
71+
72+
public int getTrigger() { return trigger;}
73+
public DetectorDataDgtz setTrigger(int trig) { trigger = trig;return this;}
6974

7075
@Override
7176
public String toString(){
@@ -330,19 +335,22 @@ public int compareTo(ADCData o) {
330335
*/
331336
public static class TDCData implements Comparable<TDCData>{
332337

333-
private int tdcOrder = 0; // Used for sorting
334-
private int tdcTime = 0;
335-
private int tdcToT = 0; // Time over threshold
338+
private int tdcOrder = 0; // Used for sorting
339+
private int tdcTime = 0;
340+
private int tdcToT = 0; // Time over threshold
341+
private Long timeStamp = 0L;
336342

337343
public TDCData() {}
338344
public TDCData(int time) { this.tdcTime = time;}
339345
public TDCData(int time, int ToT) { this.tdcTime = time; this.tdcToT = ToT;}
340346
public int getTime() { return this.tdcTime;}
341347
public int getToT() { return this.tdcToT;}
342348
public int getOrder() { return tdcOrder;}
349+
public long getTimeStamp(){ return this.timeStamp; }
343350
public TDCData setOrder(int order) { tdcOrder = order;return this;}
344351
public TDCData setTime(short time) { tdcTime = time;return this;}
345352
public TDCData setToT(short ToT) { tdcToT = ToT;return this;}
353+
public TDCData setTimeStamp(long time){ timeStamp = time;return this; }
346354

347355
@Override
348356
public String toString(){

etc/bankdefs/hipo4/data.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,9 @@
108108
{ "name":"component" , "type":"S", "info":"signal (1-2)"},
109109
{ "name":"order" , "type":"B", "info":"order: 2 - TDCL , 3 - TDCR"},
110110
{ "name":"TDC" , "type":"I", "info":"TDC value"},
111-
{ "name":"ToT" , "type":"I", "info":"Time Over Threshold"}
111+
{ "name":"ToT" , "type":"I", "info":"Time Over Threshold"},
112+
{ "name":"timestamp" , "type":"L", "info":"timestamp"},
113+
{ "name":"trigger" , "type":"I", "info":"trigger number"}
112114
]
113115
},
114116
{

0 commit comments

Comments
 (0)