@@ -21,12 +21,11 @@ public class ATOFHit {
2121
2222 private int sector , layer , component , order ;
2323 private int tdc , tot ;
24- private float startTime ;
24+ private Float startTime ;
2525 private double time , energy , x , y , z ;
2626 private String type ;
2727 private boolean isInACluster ;
2828 private int associatedClusterIndex ;
29- private double meanTimeAligned ;
3029 int idTDC ;
3130
3231
@@ -82,13 +81,9 @@ public double getTime() {
8281 return time ;
8382 }
8483
85- public double getStartTime () {
84+ public Float getStartTime () {
8685 return this .startTime ;
8786 }
88-
89- public double getMeanTimeAligned (){
90- return this .meanTimeAligned ;
91- }
9287
9388 public void setTime (double time ) {
9489 this .time = time ;
@@ -195,27 +190,18 @@ public final String makeType() {
195190 * unsupported.
196191 */
197192 public final int convertTdcToTime () {
198-
199193 //Converting tdc to ns, event start time correction
200- this .time = Parameters .TDC2TIME *this .tdc - this .startTime ;
194+ this .time = Parameters .TDC2TIME *this .tdc ;
195+ //If the startTime has been defined, remove it
196+ if (this .startTime != null ) this .time -= this .startTime ;
201197
202198 //TODO: When table structure evolves, pay attention to order.
203199 //Key for the current channel
204200 int key = this .sector *10000 + this .layer *1000 + this .component *10 + 0 ;//this.order;
205- //Key for the reference channel over which all the others sharing the same z are aligned
206- int referenceModuleKey = this .component *10 ;
207201
208202 //Time offsets
209203 double [] timeOffsets = CalibrationConstantsLoader .ATOF_TIME_OFFSETS .get (key );
210- double [] timeOffsetsRef = CalibrationConstantsLoader .ATOF_TIME_OFFSETS .get (referenceModuleKey );
211- this .meanTimeAligned = timeOffsetsRef [0 ];
212- //The names below correspond to the CCDB entries
213- //They will most probably evolve
214- //For now let's say t0 is used to store the bar-to-bar and wedge-to-wedge alignments
215204 double t0 = timeOffsets [0 ];
216- double tChannelToChannelPhiAlignment = (t0 - this .meanTimeAligned );
217- if (this .type =="bar up" || this .type =="bar down" ) //bar alignment is done with the sum of the two times
218- tChannelToChannelPhiAlignment =tChannelToChannelPhiAlignment /2. ;
219205
220206 //tud is used to store the bar up - bar down alignment
221207 double tud = timeOffsets [1 ];
@@ -237,8 +223,6 @@ public final int convertTdcToTime() {
237223 double dtw3 = timeWalks[7];
238224 double chi2ndf = timeWalks[8];*/
239225
240- //Veff corrections TO BE IMPLEMENTED
241-
242226 double veff , distance_to_sipm , timeOffset ;
243227 if (null == this .type ) {
244228 LOGGER .finest ("Null hit type, cannot convert tdc to time." );
@@ -249,19 +233,20 @@ public final int convertTdcToTime() {
249233 veff = Parameters .VEFF ;
250234 //Wedge hits are placed at the center of wedges and sipm at their top
251235 distance_to_sipm = Parameters .WEDGE_THICKNESS / 2. ;
252- timeOffset = - tChannelToChannelPhiAlignment ;
236+ timeOffset = - t0 ;
253237 }
254238 case "bar up" -> {
255239 veff = Parameters .VEFF ;
256240 //The distance will be computed at barhit level when z information is available
257241 distance_to_sipm = 0 ;
258- timeOffset = - tud /2. - tChannelToChannelPhiAlignment ;
242+ //t0 for bars is the sum of up+down channels->need 1/2
243+ timeOffset = - tud /2. - t0 /2 ;
259244 }
260245 case "bar down" -> {
261246 veff = Parameters .VEFF ;
262247 //The distance will be computed at barhit level when z information is available
263248 distance_to_sipm = 0 ;
264- timeOffset = + tud /2. - tChannelToChannelPhiAlignment ;
249+ timeOffset = + tud /2. - t0 / 2 ;
265250 }
266251 case "bar" -> {
267252 LOGGER .finest ("Bar hit type, cannot convert tdc to time." );
@@ -418,7 +403,7 @@ public double getPhi() {
418403 * @param atof Detector object representing the atof, used to calculate
419404 * spatial coordinates.
420405 */
421- public ATOFHit (int sector , int layer , int component , int order , int tdc , int tot , float startTime , Detector atof ) {
406+ public ATOFHit (int sector , int layer , int component , int order , int tdc , int tot , Float startTime , Detector atof ) {
422407 this .sector = sector ;
423408 this .layer = layer ;
424409 this .component = component ;
0 commit comments