Bug #19017

SimChannel TDC should be signed short, not unsigned short

Added by Corey Adams over 2 years ago. Updated about 1 year ago.

Paul Russo
Target version:
Start date:
Due date:
% Done:


Estimated time:
Occurs In:


The TDC stored with simchannel should be stored with a signed value. It's very common for cosmic simulations to have negative time cosmics that come before the start of the readout window. The TDC is computed for these, however it gets wrapped around to an extremely large value (near the maximum of unsigned short).

It is non nonsensical to talk about the TDC value of 64,535 ticks, rather, we should be talking about a TDC of -1000.

I have wasted 2 days tracking down this issue in SBND and I understand this change was proposed years ago. I would like to reopen it now since I think this is a clear bug.

Related issues

Related to LArSoft - Bug #8992: SimChannel::TDCIDEMap index rangeRejected06/01/2015


#1 Updated by Gianluca Petrillo over 2 years ago

  • Related to Bug #8992: SimChannel::TDCIDEMap index range added

#2 Updated by Lynn Garren over 2 years ago

  • Status changed from New to Assigned
  • Assignee set to Gianluca Petrillo

We will have a look. Be aware that this will be a breaking change.

#3 Updated by Katherine Lato about 2 years ago

  • Assignee changed from Gianluca Petrillo to Paul Russo

#4 Updated by Paul Russo about 2 years ago

I have contacted:

Andrzej Szelc <>
Brailsford, Dominic <>
Tom Brooks <>

and explained the changes that need to be made to sbndcode/Utilities/detectorclocks_sbnd.fcl to resolve the issue.

Very briefly the fcl parameter:

sbnd_detectorclocks.G4RefTime: 0

needs to be changed to a negative time offset so that the TDC values will always be positive, this is a design requirement of the system.

More than likely this will also require changes to:

sbnd_detectorclocks.DefaultTrigTime: 0.
sbnd_detectorclocks.DefaultBeamTime: 0.

which should be a positive number large enough to cancel the G4RefTime that is chosen (assuming the experiment wishes simulated beam data to start at time offset 0).

In addition I note that:

sbnd_detectorclocks.TriggerOffsetTPC: 0

may also need to be changed since the current value is suspect (has nothing to do with the issue though).

The relevant document explaining what the values of these parameters should be is:

For reference the SBND settings are:

$ cat ./sbndcode/Utilities/detectorclocks_sbnd.fcl

#include "detectorclocks.fcl" 


sbnd_detectorclocks: @local::standard_detectorclocks

sbnd_detectorclocks.TrigModuleName: "triggersim" 
sbnd_detectorclocks.InheritClockConfig: true
sbnd_detectorclocks.G4RefTime: 0 # G4 time [us] where electronics clock counting start
sbnd_detectorclocks.TriggerOffsetTPC: 0 # Time [us] for TPC readout start w.r.t. trigger time
sbnd_detectorclocks.FramePeriod: 1.25e3 # Frame period [us]
sbnd_detectorclocks.ClockSpeedTPC: 2. # TPC clock speed in MHz
sbnd_detectorclocks.ClockSpeedOptical: 64. # Optical clock speed in MHz
sbnd_detectorclocks.ClockSpeedTrigger: 16. # Trigger clock speed in MHz
sbnd_detectorclocks.DefaultTrigTime: 0. # Default trigger time [us].
sbnd_detectorclocks.DefaultBeamTime: 0. # Default beam time [us].


and the MicroBooNE settings are:

$ cat ./uboonecode/uboone/Utilities/detectorclocks_microboone.fcl

#include "detectorclocks.fcl" 


microboone_detectorclocks: @local::standard_detectorclocks

microboone_detectorclocks.TrigModuleName:     "triggersim" 
microboone_detectorclocks.InheritClockConfig: true
microboone_detectorclocks.G4RefTime:        -4.05e3 # G4 time [us] where electronics clock counting start
microboone_detectorclocks.TriggerOffsetTPC: -1.6e3 # Time [us] for TPC readout start w.r.t. trigger time
microboone_detectorclocks.FramePeriod:       1.6e3 # Frame period [us]
microboone_detectorclocks.ClockSpeedTPC:     2.    # TPC clock speed in MHz
microboone_detectorclocks.ClockSpeedOptical: 64.   # Optical clock speed in MHz
microboone_detectorclocks.ClockSpeedTrigger: 16.   # Trigger clock speed in MHz
microboone_detectorclocks.DefaultTrigTime:   4050. # Default trigger time [us].
microboone_detectorclocks.DefaultBeamTime:   4050. # Default beam time [us].

microboone_detectorclocks_1window: @local::microboone_detectorclocks
microboone_detectorclocks_1window.G4RefTime:       0
microboone_detectorclocks_1window.TriggerOffset:   0
microboone_detectorclocks_1window.DefaultTrigTime: 0
microboone_detectorclocks_1window.DefaultBeamTime: 0


#5 Updated by Katherine Lato over 1 year ago

The original complaint was about getting negative time was due to an incorrect parameter (of zero). The technical leads have been notified that they need to set it a negative number (large enough to cover all times for Monte Carlo.)

This item is being marked resolved.

#6 Updated by Katherine Lato over 1 year ago

  • Status changed from Assigned to Resolved

Note: the workaround does work.

#7 Updated by Paul Russo about 1 year ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF