Skip to content

Commit 4f1ec62

Browse files
committed
Replace ATOF tdc/tot/tdc-start time variables with ATOF time
1 parent d40827f commit 4f1ec62

1 file changed

Lines changed: 52 additions & 67 deletions

File tree

  • src/main/java/org/jlab/clas/timeline/histograms

src/main/java/org/jlab/clas/timeline/histograms/ALERT.java

Lines changed: 52 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import java.util.*;
44

55
import org.jlab.groot.data.H1F;
6-
import org.jlab.groot.data.H2F;
6+
// import org.jlab.groot.data.H2F;
77
import org.jlab.io.base.DataBank;
88
import org.jlab.io.base.DataEvent;
99
import org.jlab.groot.data.TDirectory;
@@ -27,16 +27,18 @@ public class ALERT {
2727
public int rf_large_integer;
2828

2929
//Hodoscope
30-
public H1F[] TDC, TDC_minus_start_time, TOT; //ATOF-related histograms
31-
public H2F[] TDC_minus_start_time_vs_TOT;
32-
public H1F START_TIME;//ATOF-related histogram
30+
// public H1F[] TDC, TDC_minus_start_time, TOT; //ATOF-related histograms
31+
// public H2F[] TDC_minus_start_time_vs_TOT;
32+
// public H1F START_TIME;//ATOF-related histogram
33+
public H1F[] TOT;
34+
public H1F[] ATOF_Time;
3335
public H1F[] ADC, AHDC_RESIDUAL, AHDC_TIME;//AHDC-related-histograms
3436
private H1F bits;
3537

3638
public IndexedTable rfTable;
3739

3840
public ConstantsManager ccdb;
39-
private float tdc_bin_time = 0.015625f; // ns/bin
41+
// private float tdc_bin_time = 0.015625f; // ns/bin
4042
// private int[] layer_wires = {47, 56, 56, 72, 72, 87, 87, 99};
4143
private int[] layer_wires_cumulative = {0, 47, 103, 159, 231, 303, 390, 477, 576};
4244
private int[] layer_encoding = {11, 21, 22, 31, 32, 41, 42, 51};
@@ -61,50 +63,34 @@ public ALERT(int reqrunNum, String reqOutputDir, float reqEb, boolean reqTimeBas
6163
}
6264
rf_large_integer = 1000;
6365

64-
//ATOF TDC Histograms
65-
TDC = new H1F[720];
66-
TDC_minus_start_time = new H1F[720];
67-
TOT = new H1F[720];
68-
TDC_minus_start_time_vs_TOT = new H2F[720];
66+
// //ATOF TDC Histograms
67+
// TDC = new H1F[660];
68+
// TDC_minus_start_time = new H1F[660];
69+
// TOT = new H1F[660];
70+
// TDC_minus_start_time_vs_TOT = new H2F[660];
71+
ATOF_Time = new H1F[660];
6972

70-
for (int index = 0; index < 720; index++) {
73+
for (int index = 0; index < 660; index++) {
7174
int sector = 0;
7275
int layer = 0;
7376
int component = 0;
74-
int order = 0;
75-
76-
sector = index / (12 * 4);
77-
layer = (index % (12 * 4)) / 12;
78-
component = index % 12;
79-
order = 0;
80-
if (component == 11){
81-
component = 10;
82-
order = 1;
83-
}
8477

85-
float tdc_offset = 0.0f;
86-
if (reqrunNum<21331) tdc_offset = 250.0f;
87-
88-
TDC[index] = new H1F(String.format("TDC_sector%d_layer%d_component%d_order%d", sector, layer, component, order), String.format("TDC sector%d layer%d component%d order%d", sector, layer, component, order), 200, tdc_offset + 150.0, tdc_offset+ 250.0);
89-
TDC[index].setTitleX("TDC (ns)");
90-
TDC[index].setTitleY("Counts");
91-
TDC[index].setFillColor(4);
92-
TDC_minus_start_time[index] = new H1F(String.format("TDC_minus_start_time_sector%d_layer%d_component%d_order%d", sector, layer, component, order), String.format("TDC - start time sector%d layer%d component%d order%d", sector, layer, component, order), 200, tdc_offset + 50.0, tdc_offset + 150.0);
93-
TDC_minus_start_time[index].setTitleX("TDC - start time (ns)");
94-
TDC_minus_start_time[index].setTitleY("Counts");
95-
TDC_minus_start_time[index].setFillColor(4);
96-
TOT[index] = new H1F(String.format("TOT_sector%d_layer%d_component%d_order%d", sector, layer, component, order), String.format("TOT sector%d layer%d component%d order%d", sector, layer, component, order), 700, 0.0, 70.0);
97-
TOT[index].setTitleX("TOT (ns)");
98-
TOT[index].setTitleY("Counts");
99-
TOT[index].setFillColor(4);
100-
TDC_minus_start_time_vs_TOT[index] = new H2F(String.format("TDC_minus_start_time_vs_TOT_sector%d_layer%d_component_%d_order_%d", sector, layer, component, order), String.format("TDC minus start time vs TOT sector%d layer%d component%d order%d", sector, layer, component, order), 70, 0.0, 70.0, 40, tdc_offset + 80.0, tdc_offset + 120.0);
101-
TDC_minus_start_time_vs_TOT[index].setTitleX("TOT (ns)");
102-
TDC_minus_start_time_vs_TOT[index].setTitleY("TDC - start time (ns)");
78+
sector = index / (11 * 4);
79+
layer = (index % (11 * 4)) / 11;
80+
component = index % 11;
81+
82+
// float tdc_offset = 0.0f;
83+
// if (reqrunNum<21331) tdc_offset = 250.0f;
84+
85+
ATOF_Time[index] = new H1F(String.format("ATOF_Time_sector%d_layer%d_component%d", sector, layer, component), String.format("ATOF Time sector%d layer%d component%d", sector, layer, component), 1000, -500, 500);
86+
ATOF_Time[index].setTitleX("ATOF_Time (ns)");
87+
ATOF_Time[index].setTitleY("Counts");
88+
ATOF_Time[index].setFillColor(4);
10389
}
10490

105-
START_TIME = new H1F("start time","start time", 80, 80.0, 120.0);
106-
START_TIME.setTitle("Event start time when the start time is defined and the trigger particle is an electron");
107-
START_TIME.setTitleX("start time (ns)");
91+
// START_TIME = new H1F("start time","start time", 80, 80.0, 120.0);
92+
// START_TIME.setTitle("Event start time when the start time is defined and the trigger particle is an electron");
93+
// START_TIME.setTitleX("start time (ns)");
10894

10995
//AHDC ADC Histograms
11096
ADC = new H1F[576];
@@ -184,24 +170,17 @@ public void fillAHDC_hits(DataBank ahdc_hits) {
184170
}
185171

186172

187-
public void fillATOF(DataBank atof_tdc) {
188-
int rows = atof_tdc.rows();
173+
public void fillATOF(DataBank atof_hits) {
174+
int rows = atof_hits.rows();
189175
for (int loop = 0; loop < rows; loop++) {
190-
int sector = atof_tdc.getInt("sector", loop);
191-
int layer = atof_tdc.getInt("layer", loop);
192-
int component = atof_tdc.getInt("component", loop);
193-
int order = atof_tdc.getInt("order", loop);
194-
int tdc = atof_tdc.getInt("TDC", loop);
195-
int tot = atof_tdc.getInt("ToT", loop);
196-
int index = sector * 48 + layer * 12 + component + order;
197-
198-
TDC[index].fill(tdc*tdc_bin_time);
199-
if (startTime!=-1000.0 && triggerPID == 11){
200-
START_TIME.fill(startTime);
201-
TDC_minus_start_time[index].fill(tdc*tdc_bin_time - startTime);
202-
TDC_minus_start_time_vs_TOT[index].fill(tot*tdc_bin_time, tdc*tdc_bin_time - startTime);
203-
}
204-
TOT[index].fill(tot*tdc_bin_time);
176+
int sector = atof_hits.getInt("sector", loop);
177+
int layer = atof_hits.getInt("layer", loop);
178+
int component = atof_hits.getInt("component", loop);
179+
float time = (float) atof_hits.getDouble("time", loop);
180+
int index = sector * 44 + layer * 11 + component;
181+
182+
ATOF_Time[index].fill(time);
183+
205184
}
206185
}
207186

@@ -210,7 +189,8 @@ public void processEvent(DataEvent event) {
210189
DataBank recBankEB = null;
211190
DataBank recEvenEB = null;
212191
DataBank runConfig = null;
213-
DataBank atof_tdc = null;
192+
// DataBank atof_tdc = null;
193+
DataBank atof_hits = null;
214194
DataBank ahdc_adc = null;
215195
DataBank ahdc_hits = null;
216196

@@ -223,8 +203,12 @@ public void processEvent(DataEvent event) {
223203
if (event.hasBank("RUN::config")) {
224204
runConfig = event.getBank("RUN::config");
225205
}
226-
if (event.hasBank("ATOF::tdc")) {
227-
atof_tdc = event.getBank("ATOF::tdc");
206+
// if (event.hasBank("ATOF::tdc")) {
207+
// atof_tdc = event.getBank("ATOF::tdc");
208+
// }
209+
210+
if (event.hasBank("ATOF::hits")) {
211+
atof_hits = event.getBank("ATOF::hits");
228212
}
229213

230214
if (event.hasBank("AHDC::adc")) {
@@ -255,8 +239,8 @@ public void processEvent(DataEvent event) {
255239
triggerPID = recBankEB.getInt("pid", 0);
256240
}
257241

258-
if (atof_tdc != null) {
259-
fillATOF(atof_tdc);
242+
if (atof_hits != null) {
243+
fillATOF(atof_hits);
260244
}
261245

262246
if (ahdc_adc != null) {
@@ -273,8 +257,9 @@ public void write() {
273257
TDirectory dirout = new TDirectory();
274258
dirout.mkdir("/ALERT/");
275259
dirout.cd("/ALERT/");
276-
for (int index = 0; index < 720; index++) {
277-
dirout.addDataSet(TDC[index], TDC_minus_start_time[index], TOT[index], TDC_minus_start_time_vs_TOT[index]);//atof histograms
260+
for (int index = 0; index < 660; index++) {
261+
dirout.addDataSet(ATOF_Time[index]);
262+
// dirout.addDataSet(TDC[index], TDC_minus_start_time[index], TOT[index], TDC_minus_start_time_vs_TOT[index]);//atof histograms
278263
}
279264
for (int index = 0; index < 576; index++) {
280265
dirout.addDataSet(ADC[index], AHDC_TIME[index]);
@@ -283,7 +268,7 @@ public void write() {
283268
dirout.addDataSet(AHDC_RESIDUAL[index]);
284269
}
285270

286-
dirout.addDataSet(START_TIME);
271+
// dirout.addDataSet(START_TIME);
287272
dirout.mkdir("/TRIGGER/");
288273
dirout.cd("/TRIGGER/");
289274
dirout.addDataSet(bits);

0 commit comments

Comments
 (0)