Skip to content

Commit a2df158

Browse files
N-Plxtongtongcao
authored andcommitted
feat: applying wedge to wedge phi alignment (#929)
1 parent b34d244 commit a2df158

1 file changed

Lines changed: 16 additions & 20 deletions

File tree

  • reconstruction/alert/src/main/java/org/jlab/rec/atof/hit

reconstruction/alert/src/main/java/org/jlab/rec/atof/hit/ATOFHit.java

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
import org.jlab.geom.prim.Point3D;
55
import org.jlab.rec.atof.constants.Parameters;
66
import java.util.logging.Logger;
7-
import org.jlab.detector.calib.utils.DatabaseConstantProvider;
8-
import org.jlab.geom.detector.alert.ATOF.AlertTOFFactory;
97
import org.jlab.rec.constants.CalibrationConstantsLoader;
108

119
/**
@@ -21,14 +19,6 @@ public class ATOFHit {
2119

2220
static final Logger LOGGER = Logger.getLogger(ATOFHit.class.getName());
2321

24-
//For aligning bar together, take module 0, component 10 as the reference
25-
//For now the table is full of things with order = 0 or order = 1 for the bars
26-
//However these offsets are defined uniquely for order 0 and order 1
27-
//Eventually the table will need to be revisited, either by adding another table
28-
//That does not index the order or by indexing things with order 2 (or another number)
29-
private int referenceModuleKey = 0*10000 + 0*1000 + 10*10 + 0;
30-
double[] timeOffsetsRef = CalibrationConstantsLoader.ATOF_TIME_OFFSETS.get(referenceModuleKey);
31-
3222
private int sector, layer, component, order;
3323
private int tdc, tot;
3424
private float startTime;
@@ -198,19 +188,25 @@ public final int convertTdcToTime() {
198188

199189
//Converting tdc to ns, event start time correction
200190
this.time = Parameters.TDC2TIME*this.tdc - this.startTime;
201-
202-
//For now we use order 0 to read everything because the current calib constants
203-
//are not for a specific bar channel
204-
//Eventually this will need to be adjusted
205-
int key = this.sector*10000 + this.layer*1000 + this.component*10 + 0;//this.order;
206191

192+
//TODO: When table structure evolves, pay attention to order.
193+
//Key for the current channel
194+
int key = this.sector*10000 + this.layer*1000 + this.component*10 + 0;//this.order;
195+
//Key for the reference channel over which all the others sharing the same z are aligned
196+
int referenceModuleKey = this.component*10;
197+
207198
//Time offsets
208199
double[] timeOffsets = CalibrationConstantsLoader.ATOF_TIME_OFFSETS.get(key);
200+
double[] timeOffsetsRef = CalibrationConstantsLoader.ATOF_TIME_OFFSETS.get(referenceModuleKey);
201+
209202
//The names below correspond to the CCDB entries
210203
//They will most probably evolve
211-
//For now let's say t0 is used to store the bar-to-bar alignment
204+
//For now let's say t0 is used to store the bar-to-bar and wedge-to-wedge alignments
212205
double t0 = timeOffsets[0];
213-
double tB2B = (t0 - timeOffsetsRef[0])/2;
206+
double tChannelToChannelPhiAlignment = (t0 - timeOffsetsRef[0]);
207+
if(this.type=="bar up" || this.type=="bar down") //bar alignment is done with the sum of the two times
208+
tChannelToChannelPhiAlignment=tChannelToChannelPhiAlignment/2.;
209+
214210
//tud is used to store the bar up - bar down alignment
215211
double tud = timeOffsets[1];
216212
//The rest of the constants are not used for now
@@ -243,19 +239,19 @@ public final int convertTdcToTime() {
243239
veff = Parameters.VEFF;
244240
//Wedge hits are placed at the center of wedges and sipm at their top
245241
distance_to_sipm = Parameters.WEDGE_THICKNESS / 2.;
246-
timeOffset = 0; //To be replaced with w2w time and eventual other offsets
242+
timeOffset = - tChannelToChannelPhiAlignment;
247243
}
248244
case "bar up" -> {
249245
veff = Parameters.VEFF;
250246
//The distance will be computed at barhit level when z information is available
251247
distance_to_sipm = 0;
252-
timeOffset = - tud/2. - tB2B;
248+
timeOffset = - tud/2. - tChannelToChannelPhiAlignment;
253249
}
254250
case "bar down" -> {
255251
veff = Parameters.VEFF;
256252
//The distance will be computed at barhit level when z information is available
257253
distance_to_sipm = 0;
258-
timeOffset = + tud/2. - tB2B;
254+
timeOffset = + tud/2. - tChannelToChannelPhiAlignment;
259255
}
260256
case "bar" -> {
261257
LOGGER.finest("Bar hit type, cannot convert tdc to time.");

0 commit comments

Comments
 (0)