LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
detinfo::ElecClock Class Reference

Class representing the time measured by an electronics clock. More...

#include "ElecClock.h"

Public Member Functions

 ElecClock ()
 Default constructor. More...
 
 ElecClock (double time, double frame_period, double frequency)
 Constructor: sets all values. More...
 
void SetTime (double time)
 Directly sets the current time on the clock. More...
 
void SetTime (int sample, int frame)
 Sets the current time on the clock from frame and sample number. More...
 
void SetTime (unsigned int sample, unsigned int frame)
 Sets the current time on the clock from frame and sample number. More...
 
void SetTime (int ticks)
 Sets the current time on the clock from tick number. More...
 
void SetTime (unsigned int ticks)
 Sets the current time on the clock from tick number. More...
 
double Time () const
 Current time (as stored) in microseconds. More...
 
double Time (int sample, int frame) const
 Returns the absolute time of the start of the specified sample. More...
 
double Time (double time) const
 Returns the discretized value of the specified time. More...
 
double Time (int ticks) const
 Returns the absolute start time of the specified tick. More...
 
double Frequency () const
 Frequency in MHz. More...
 
double FramePeriod () const
 A single frame period in microseconds. More...
 
int Ticks () const
 Current clock tick (that is, the number of tick Time() falls in). More...
 
int Ticks (double time) const
 Returns the number of tick the specified time falls in. More...
 
int Ticks (int sample, int frame) const
 Returns the number of tick the specified sample falls in. More...
 
int Sample () const
 Returns number of the sample containing the clock current time. More...
 
int Sample (double time) const
 Returns the number of the sample containing the specified time. More...
 
int Sample (int tick) const
 Returns the number of the sample containing the specified tick. More...
 
int Frame () const
 Returns the number of the frame containing the clock current time. More...
 
int Frame (double time) const
 Returns the number of the frame containing the specified time. More...
 
int Frame (int tick) const
 Returns the number of the frame containing the specified tick. More...
 
unsigned int FrameTicks () const
 Number ticks in a frame. More...
 
double TickPeriod () const
 A single tick period in microseconds. More...
 
bool operator< (const ElecClock &rhs) const
 Compares the current time of this clock with the one of rhs. More...
 
bool operator> (const ElecClock &rhs) const
 Compares the current time of this clock with the one of rhs. More...
 
bool operator<= (const ElecClock &rhs) const
 Compares the current time of this clock with the one of rhs. More...
 
bool operator>= (const ElecClock &rhs) const
 Compares the current time of this clock with the one of rhs. More...
 
Operators to modify clock time.
ElecClockoperator++ ()
 Increases the current clock time by a full tick time. More...
 
ElecClock operator++ (int)
 Increases the current clock time by a full tick time. More...
 
ElecClockoperator-- ()
 Decreases the current clock time by a full tick time. More...
 
ElecClock operator-- (int)
 Decreases the current clock time by a full tick time. More...
 
ElecClockoperator+= (const double &rhs)
 Increases the current clock time by the specified time in microseconds. More...
 
ElecClockoperator-= (const double &rhs)
 Decreases the current clock time by the specified time in microseconds. More...
 
ElecClockoperator+= (const float &rhs)
 Increases the current clock time by the specified time in microseconds. More...
 
ElecClockoperator-= (const float &rhs)
 Decreases the current clock time by the specified time in microseconds. More...
 
ElecClockoperator+= (const int &rhs)
 Increases the current clock time by the specified number of ticks. More...
 
ElecClockoperator-= (const int &rhs)
 Decreases the current clock time by the specified number of ticks. More...
 
ElecClockoperator+= (const unsigned int &rhs)
 Increases the current clock time by the specified number of ticks. More...
 
ElecClockoperator-= (const unsigned int &rhs)
 Decreases the current clock time by the specified number of ticks. More...
 
ElecClockoperator+= (const ElecClock &rhs)
 Increases the current clock time by the current time of another clock. More...
 
ElecClockoperator-= (const ElecClock &rhs)
 Decreases the current clock time by the current time of another clock. More...
 
ElecClock operator+ (const ElecClock &rhs)
 
ElecClock operator- (const ElecClock &rhs)
 

Protected Attributes

double fTime
 Time in microseconds. More...
 
double fFramePeriod
 Frame period in microseconds. More...
 
double fFrequency
 Clock speed in MHz. More...
 

Detailed Description

Class representing the time measured by an electronics clock.

This class represents the status of a running electronics clock. As such, it has:

  • tick frequency: how many times the clock ticks in one second
  • frame period: the duration of a single frame; clock time is organised into two levels:
    • the time is split into frames
    • each frame is split in samples; the first one of a each frame is sample number 0
  • current time of the clock, with respect to the time (always "0") the clock was started at

Note that this object is actually able to manage any (continuous) value of time, and the concepts of frame and sample are not used to store the clock state, which is instead defined by its current time.

All these quantities are stored in real time units as opposed to clock tick counts. The nominal units for all times and frequencies are microseconds and megahertz, respectively, but ElecClock will give consistent results as long as the units of frame period and time are the same, and reciprocal to the frequency unit.

The clock can update its time directly (SetTime()) or through operators.

The clock started at time 0, with the sample 0 of the frame 0 (that is also tick 0). This implies that all times and ticks returned by the clock implicitly have the same reference as the input time specified by the constructors or by the last call to SetTime().

Some usage examples:

// get a clock with a period of 500 ns (2 MHz) and a frame of 1.6 ms
detinfo::ElecClock clock(0.0, 1600.0, 2.0);
std::cout << "New clock:"
<< "\n current time: " << clock.Time() // 0.0 us
<< "\n samples per frame: " << clock.FrameTicks() // 3200
<< std::endl;
clock.SetTime(1, 20); // sets the time to sample #20 of frame 1
std::cout << "Time set to sample #20 of frame #1:"
<< "\n current time: " << clock.Time() // 1610.0 us
<< "\n current tick: " << clock.Tick() // 3220
<< std::endl;
clock += 3.7; // add 3.7 us to the current time
std::cout << "Added 3.7 microseconds:"
<< "\n current time: " << clock.Time() // 1613.7 us
<< "\n current tick: " << clock.Tick() // 3227
<< "\n discrete time: " << clock.Time(Time()) // 1613.5 us
<< std::endl;
clock += 3; // add 3 more ticks (1.5 us) to the current time
std::cout << "Added 3 ticks:"
<< "\n current time: " << clock.Time() // 1615.2 us
<< "\n current tick: " << clock.Tick() // 3230
<< "\n discrete time: " << clock.Time(Time()) // 1615.0 us
<< std::endl;
Note
Most methods and operators have different behaviour according to whether their argument is of type double, in which case it is interpreted as a time, or int, where it is interpreted as a clock tick. Be especially careful when utilizing data types which are neither int not double, because a conversion to one of them will occur, and you need to be in control of which one.

Definition at line 91 of file ElecClock.h.

Constructor & Destructor Documentation

detinfo::ElecClock::ElecClock ( )
inline

Default constructor.

A default-constructed clock is useless. It is caller's responsibility to set all the information of the default-constructed clock by assignment from another clock.

Better yet, don't use this constructor and instead construct the clock immediately right.

Definition at line 105 of file ElecClock.h.

Referenced by operator+(), and operator-().

105 : ElecClock(0, kTIME_MAX, 1e9) {}
ElecClock()
Default constructor.
Definition: ElecClock.h:105
const double kTIME_MAX
Maximum time in microseconds.
detinfo::ElecClock::ElecClock ( double  time,
double  frame_period,
double  frequency 
)
inline

Constructor: sets all values.

Parameters
timestarting time of the clock [µs]
frame_periodperiod of the clock [µs]
frequencyclock frequency [MHz]

Definition at line 114 of file ElecClock.h.

References fFrequency.

115  : fTime(time),
116  fFramePeriod(frame_period),
117  fFrequency(frequency)
118  {
119  if( fFrequency <= 0 ) throw detinfo::DetectorClocksException("Negative frequency is prohibited!");
120  }
double fFrequency
Clock speed in MHz.
Definition: ElecClock.h:128
double fTime
Time in microseconds.
Definition: ElecClock.h:126
double fFramePeriod
Frame period in microseconds.
Definition: ElecClock.h:127

Member Function Documentation

int detinfo::ElecClock::Frame ( ) const
inline

Returns the number of the frame containing the clock current time.

See also
Frame(double)

The returned value is the number of the frame which the current clock time falls in.

Definition at line 310 of file ElecClock.h.

References Frame().

Referenced by opdet::ConstructFlash(), opdet::ConstructHit(), Frame(), Sample(), and Time().

310 { return Frame(fTime); }
int Frame() const
Returns the number of the frame containing the clock current time.
Definition: ElecClock.h:310
double fTime
Time in microseconds.
Definition: ElecClock.h:126
int detinfo::ElecClock::Frame ( double  time) const
inline

Returns the number of the frame containing the specified time.

Parameters
timea clock time [µs]
Returns
number of the frame containing the specified time
See also
Sample(double)

The returned value is the number of the frame which the specified time falls in.

The result is not related to the current time of the clock.

Definition at line 323 of file ElecClock.h.

References fFramePeriod.

323 { return (int)(time / fFramePeriod); }
double fFramePeriod
Frame period in microseconds.
Definition: ElecClock.h:127
int detinfo::ElecClock::Frame ( int  tick) const
inline

Returns the number of the frame containing the specified tick.

Parameters
ticka clock tick number
Returns
number of the frame containing the specified tick
See also
Frame(int)

The returned value is the number of the frame the specified tick belongs to.

The result is not related to the current time of the clock.

Definition at line 336 of file ElecClock.h.

References FrameTicks().

336 { return (tick / (int)(FrameTicks())); }
unsigned int FrameTicks() const
Number ticks in a frame.
Definition: ElecClock.h:339
double detinfo::ElecClock::FramePeriod ( ) const
inline

A single frame period in microseconds.

Definition at line 232 of file ElecClock.h.

References fFramePeriod.

Referenced by detinfo::DetectorClocksStandard::ExternalClock(), detinfo::DetectorClocksStandard::OpticalClock(), detinfo::DetectorClocksStandard::TPCClock(), and detinfo::DetectorClocksStandard::TriggerClock().

232 { return fFramePeriod; }
double fFramePeriod
Frame period in microseconds.
Definition: ElecClock.h:127
unsigned int detinfo::ElecClock::FrameTicks ( ) const
inline

Number ticks in a frame.

Definition at line 339 of file ElecClock.h.

References fFrequency.

Referenced by Frame(), Sample(), and Ticks().

339 { return (int)(fFramePeriod * fFrequency);}
double fFrequency
Clock speed in MHz.
Definition: ElecClock.h:128
double fFramePeriod
Frame period in microseconds.
Definition: ElecClock.h:127
ElecClock detinfo::ElecClock::operator+ ( const ElecClock rhs)
inline

Returns a clock like this one, with its current time increased by the current time of rhs.

Definition at line 390 of file ElecClock.h.

References ElecClock(), fFramePeriod, fFrequency, and Time().

391  { return ElecClock(fTime + rhs.Time(),fFramePeriod,fFrequency); }
double fFrequency
Clock speed in MHz.
Definition: ElecClock.h:128
double fTime
Time in microseconds.
Definition: ElecClock.h:126
ElecClock()
Default constructor.
Definition: ElecClock.h:105
double fFramePeriod
Frame period in microseconds.
Definition: ElecClock.h:127
ElecClock& detinfo::ElecClock::operator++ ( )
inline

Increases the current clock time by a full tick time.

Definition at line 351 of file ElecClock.h.

References fFrequency.

351 { fTime += 1./fFrequency; return *this;}
double fFrequency
Clock speed in MHz.
Definition: ElecClock.h:128
double fTime
Time in microseconds.
Definition: ElecClock.h:126
ElecClock detinfo::ElecClock::operator++ ( int  )
inline

Increases the current clock time by a full tick time.

Definition at line 354 of file ElecClock.h.

References operator++(), and tmp.

Referenced by operator++().

354 {ElecClock tmp(*this); operator++(); return tmp;}
Float_t tmp
Definition: plot.C:37
ElecClock & operator++()
Increases the current clock time by a full tick time.
Definition: ElecClock.h:351
ElecClock()
Default constructor.
Definition: ElecClock.h:105
ElecClock& detinfo::ElecClock::operator+= ( const double &  rhs)
inline

Increases the current clock time by the specified time in microseconds.

Definition at line 363 of file ElecClock.h.

363 { fTime += rhs; return *this;}
double fTime
Time in microseconds.
Definition: ElecClock.h:126
ElecClock& detinfo::ElecClock::operator+= ( const float &  rhs)
inline

Increases the current clock time by the specified time in microseconds.

Definition at line 368 of file ElecClock.h.

368 { fTime += (double)rhs; return *this;}
double fTime
Time in microseconds.
Definition: ElecClock.h:126
ElecClock& detinfo::ElecClock::operator+= ( const int &  rhs)
inline

Increases the current clock time by the specified number of ticks.

Definition at line 373 of file ElecClock.h.

References Time().

373 { fTime += Time(rhs); return *this;}
double fTime
Time in microseconds.
Definition: ElecClock.h:126
double Time() const
Current time (as stored) in microseconds.
Definition: ElecClock.h:191
ElecClock& detinfo::ElecClock::operator+= ( const unsigned int &  rhs)
inline

Increases the current clock time by the specified number of ticks.

Definition at line 378 of file ElecClock.h.

References Time().

378 { fTime += Time((int)rhs); return *this;}
double fTime
Time in microseconds.
Definition: ElecClock.h:126
double Time() const
Current time (as stored) in microseconds.
Definition: ElecClock.h:191
ElecClock& detinfo::ElecClock::operator+= ( const ElecClock rhs)
inline

Increases the current clock time by the current time of another clock.

Definition at line 383 of file ElecClock.h.

References Time().

383 { fTime += rhs.Time(); return *this;}
double fTime
Time in microseconds.
Definition: ElecClock.h:126
ElecClock detinfo::ElecClock::operator- ( const ElecClock rhs)
inline

Returns a clock like this one, with its current time decreased by the current time of rhs.

Definition at line 395 of file ElecClock.h.

References ElecClock(), fFramePeriod, fFrequency, and Time().

396  { return ElecClock(fTime - rhs.Time(),fFramePeriod,fFrequency); }
double fFrequency
Clock speed in MHz.
Definition: ElecClock.h:128
double fTime
Time in microseconds.
Definition: ElecClock.h:126
ElecClock()
Default constructor.
Definition: ElecClock.h:105
double fFramePeriod
Frame period in microseconds.
Definition: ElecClock.h:127
ElecClock& detinfo::ElecClock::operator-- ( )
inline

Decreases the current clock time by a full tick time.

Definition at line 357 of file ElecClock.h.

References fFrequency.

357 { fTime -= 1./fFrequency; return *this;}
double fFrequency
Clock speed in MHz.
Definition: ElecClock.h:128
double fTime
Time in microseconds.
Definition: ElecClock.h:126
ElecClock detinfo::ElecClock::operator-- ( int  )
inline

Decreases the current clock time by a full tick time.

Definition at line 360 of file ElecClock.h.

References operator--(), and tmp.

Referenced by operator--().

360 {ElecClock tmp(*this); operator--(); return tmp;}
Float_t tmp
Definition: plot.C:37
ElecClock & operator--()
Decreases the current clock time by a full tick time.
Definition: ElecClock.h:357
ElecClock()
Default constructor.
Definition: ElecClock.h:105
ElecClock& detinfo::ElecClock::operator-= ( const double &  rhs)
inline

Decreases the current clock time by the specified time in microseconds.

Definition at line 365 of file ElecClock.h.

365 { fTime -= rhs; return *this;}
double fTime
Time in microseconds.
Definition: ElecClock.h:126
ElecClock& detinfo::ElecClock::operator-= ( const float &  rhs)
inline

Decreases the current clock time by the specified time in microseconds.

Definition at line 370 of file ElecClock.h.

370 { fTime -= (double)rhs; return *this;}
double fTime
Time in microseconds.
Definition: ElecClock.h:126
ElecClock& detinfo::ElecClock::operator-= ( const int &  rhs)
inline

Decreases the current clock time by the specified number of ticks.

Definition at line 375 of file ElecClock.h.

References Time().

375 { fTime -= Time(rhs); return *this;}
double fTime
Time in microseconds.
Definition: ElecClock.h:126
double Time() const
Current time (as stored) in microseconds.
Definition: ElecClock.h:191
ElecClock& detinfo::ElecClock::operator-= ( const unsigned int &  rhs)
inline

Decreases the current clock time by the specified number of ticks.

Definition at line 380 of file ElecClock.h.

References Time().

380 { fTime -= Time((int)rhs); return *this;}
double fTime
Time in microseconds.
Definition: ElecClock.h:126
double Time() const
Current time (as stored) in microseconds.
Definition: ElecClock.h:191
ElecClock& detinfo::ElecClock::operator-= ( const ElecClock rhs)
inline

Decreases the current clock time by the current time of another clock.

Definition at line 386 of file ElecClock.h.

References Time().

386 { fTime -= rhs.Time(); return *this;}
double fTime
Time in microseconds.
Definition: ElecClock.h:126
bool detinfo::ElecClock::operator< ( const ElecClock rhs) const
inline

Compares the current time of this clock with the one of rhs.

Definition at line 401 of file ElecClock.h.

References Time().

401 { return fTime < rhs.Time(); }
double fTime
Time in microseconds.
Definition: ElecClock.h:126
bool detinfo::ElecClock::operator<= ( const ElecClock rhs) const
inline

Compares the current time of this clock with the one of rhs.

Definition at line 405 of file ElecClock.h.

References Time().

405 { return fTime <= rhs.Time(); }
double fTime
Time in microseconds.
Definition: ElecClock.h:126
bool detinfo::ElecClock::operator> ( const ElecClock rhs) const
inline

Compares the current time of this clock with the one of rhs.

Definition at line 403 of file ElecClock.h.

References Time().

403 { return fTime > rhs.Time(); }
double fTime
Time in microseconds.
Definition: ElecClock.h:126
bool detinfo::ElecClock::operator>= ( const ElecClock rhs) const
inline

Compares the current time of this clock with the one of rhs.

Definition at line 407 of file ElecClock.h.

References Time().

407 { return fTime >= rhs.Time(); }
double fTime
Time in microseconds.
Definition: ElecClock.h:126
int detinfo::ElecClock::Sample ( ) const
inline

Returns number of the sample containing the clock current time.

See also
Sample(double)

The returned value is the number of the sample within a frame, which the current clock time falls in. The number of the frame is not returned. To univocally define the sample, the number of the frame must also be obtained, e.g. via Frame().

Definition at line 271 of file ElecClock.h.

References Sample().

Referenced by Sample(), and Time().

271 { return Sample(fTime); }
double fTime
Time in microseconds.
Definition: ElecClock.h:126
int Sample() const
Returns number of the sample containing the clock current time.
Definition: ElecClock.h:271
int detinfo::ElecClock::Sample ( double  time) const
inline

Returns the number of the sample containing the specified time.

Parameters
timea clock time [µs]
Returns
number of the sample containing the specified time
See also
Frame(double)

The returned value is the number of the sample within a frame, which the specified time falls in. The number of the frame is not returned. To univocally define the sample, the number of the frame must also be obtained, e.g. via Frame(double).

The result is not related to the current time of the clock.

Definition at line 286 of file ElecClock.h.

References fFramePeriod, and Frame().

286 { return (int)((time - Frame(time) * fFramePeriod) * fFrequency); }
double fFrequency
Clock speed in MHz.
Definition: ElecClock.h:128
int Frame() const
Returns the number of the frame containing the clock current time.
Definition: ElecClock.h:310
double fFramePeriod
Frame period in microseconds.
Definition: ElecClock.h:127
int detinfo::ElecClock::Sample ( int  tick) const
inline

Returns the number of the sample containing the specified tick.

Parameters
ticka clock tick number
Returns
number of the sample containing the specified tick
See also
Frame(int)

The returned value is the number of the sample within a frame, of the specified tick. The number of the frame is not returned. To univocally define the sample, the number of the frame must also be obtained, e.g. via Frame(int).

The result is not related to the current time of the clock.

Definition at line 301 of file ElecClock.h.

References FrameTicks().

301 { return (tick % (int)(FrameTicks())); }
unsigned int FrameTicks() const
Number ticks in a frame.
Definition: ElecClock.h:339
void detinfo::ElecClock::SetTime ( double  time)
inline

Directly sets the current time on the clock.

Parameters
timereference time (expected in microseconds)

Definition at line 138 of file ElecClock.h.

Referenced by detinfo::DetectorClocksStandard::ExternalClock(), detinfo::DetectorClocksStandard::OpticalClock(), SetTime(), detinfo::DetectorClocksStandard::SetTriggerTime(), detinfo::DetectorClocksStandard::TPCClock(), and detinfo::DetectorClocksStandard::TriggerClock().

138 { fTime = time; }
double fTime
Time in microseconds.
Definition: ElecClock.h:126
void detinfo::ElecClock::SetTime ( int  sample,
int  frame 
)
inline

Sets the current time on the clock from frame and sample number.

Parameters
samplethe number of the sample within the specified frame
framethe frame containing the time to be sets

The current clock time is set to the instant of the start of the specified sample.

Definition at line 148 of file ElecClock.h.

References Time().

150  { fTime = Time(sample, frame); }
double fTime
Time in microseconds.
Definition: ElecClock.h:126
double Time() const
Current time (as stored) in microseconds.
Definition: ElecClock.h:191
void detinfo::ElecClock::SetTime ( unsigned int  sample,
unsigned int  frame 
)
inline

Sets the current time on the clock from frame and sample number.

Parameters
samplethe number of the sample within the specified frame
framethe frame containing the time to be sets

The current clock time is set to the instant of the start of the specified sample.

Definition at line 160 of file ElecClock.h.

References SetTime().

162  { SetTime(int(sample),int(frame)); }
void SetTime(double time)
Directly sets the current time on the clock.
Definition: ElecClock.h:138
void detinfo::ElecClock::SetTime ( int  ticks)
inline

Sets the current time on the clock from tick number.

Parameters
ticksthe number of tick to set the clock to

The current clock time is set to the instant of the start of the specified tick.

Definition at line 171 of file ElecClock.h.

References Time().

172  { fTime = Time(ticks,0); }
double fTime
Time in microseconds.
Definition: ElecClock.h:126
double Time() const
Current time (as stored) in microseconds.
Definition: ElecClock.h:191
void detinfo::ElecClock::SetTime ( unsigned int  ticks)
inline

Sets the current time on the clock from tick number.

Parameters
ticksthe number of tick to set the clock to

The current clock time is set to the instant of the start of the specified tick.

Definition at line 181 of file ElecClock.h.

References SetTime().

182  { SetTime(int(ticks)); }
void SetTime(double time)
Directly sets the current time on the clock.
Definition: ElecClock.h:138
int detinfo::ElecClock::Ticks ( ) const
inline

Current clock tick (that is, the number of tick Time() falls in).

Definition at line 235 of file ElecClock.h.

References Ticks().

Referenced by larg4::LArVoxelReadout::DriftIonizationElectrons(), detinfo::DetectorClocksStandard::ExternalTick2TDC(), detinfo::DetectorClocksStandard::OpticalTick2TDC(), detsim::SimDriftElectrons::produce(), Ticks(), util::DetectorPropertiesServiceArgoNeuT::TriggerOffset(), and detinfo::DetectorPropertiesStandard::TriggerOffset().

235 { return Ticks(fTime); }
int Ticks() const
Current clock tick (that is, the number of tick Time() falls in).
Definition: ElecClock.h:235
double fTime
Time in microseconds.
Definition: ElecClock.h:126
int detinfo::ElecClock::Ticks ( double  time) const
inline

Returns the number of tick the specified time falls in.

Parameters
timetime to be converted in ticks [µs]
Returns
the number of the tick containing the specified time

The tick number 0 starts at time 0.0 µs.

Note
The returned value (number of tick) can wrap if the real number of the tick is beyond the range of the returned data type (int).

Definition at line 247 of file ElecClock.h.

References fFrequency.

247 { return (int)(time * fFrequency); }
double fFrequency
Clock speed in MHz.
Definition: ElecClock.h:128
int detinfo::ElecClock::Ticks ( int  sample,
int  frame 
) const
inline

Returns the number of tick the specified sample falls in.

Parameters
samplenumber of sample in the specified frame
framenumber of frame the specified sample is in
Returns
the number of the tick containing the specified sample

The sample 0 of frame 0 is the tick number 0.

Note
The returned value (number of tick) can wrap if the real number of the tick is beyond the range of the returned data type (int).

Definition at line 260 of file ElecClock.h.

References FrameTicks().

260 { return sample + frame * FrameTicks(); }
unsigned int FrameTicks() const
Number ticks in a frame.
Definition: ElecClock.h:339
double detinfo::ElecClock::Time ( int  sample,
int  frame 
) const
inline

Returns the absolute time of the start of the specified sample.

Parameters
samplesample number within the specified frame
framenumber of the frame the specified sample is in
Returns
time [us] corresponding to the start of the specified sample

The sample number is not checked to be actually within the specified frame.

The returned time is not related to the current time of the clock.

Definition at line 204 of file ElecClock.h.

204 { return (sample / fFrequency + frame * fFramePeriod); }
double fFrequency
Clock speed in MHz.
Definition: ElecClock.h:128
double fFramePeriod
Frame period in microseconds.
Definition: ElecClock.h:127
double detinfo::ElecClock::Time ( double  time) const
inline

Returns the discretized value of the specified time.

Parameters
timea clock time [µs]
Returns
discretized time [µs] (as a floating point number)

The returned time is the start time of the sample time falls in.

It is not related to the current time of the clock.

Definition at line 215 of file ElecClock.h.

References Frame(), Sample(), and Time().

Referenced by Time().

215 { return Time(Sample(time),Frame(time)); }
int Frame() const
Returns the number of the frame containing the clock current time.
Definition: ElecClock.h:310
double Time() const
Current time (as stored) in microseconds.
Definition: ElecClock.h:191
int Sample() const
Returns number of the sample containing the clock current time.
Definition: ElecClock.h:271
double detinfo::ElecClock::Time ( int  ticks) const
inline

Returns the absolute start time of the specified tick.

Parameters
ticksa clock time [µs]
Returns
discretized time [µs] (as a floating point number)

The returned time is the start time of the tick which time falls in.

It is not related to the current time of the clock.

Definition at line 226 of file ElecClock.h.

References fFrequency.

226 {return ticks/fFrequency; }
double fFrequency
Clock speed in MHz.
Definition: ElecClock.h:128

Member Data Documentation

double detinfo::ElecClock::fFramePeriod
protected

Frame period in microseconds.

Definition at line 127 of file ElecClock.h.

Referenced by Frame(), FramePeriod(), operator+(), operator-(), and Sample().

double detinfo::ElecClock::fFrequency
protected

Clock speed in MHz.

Definition at line 128 of file ElecClock.h.

Referenced by ElecClock(), FrameTicks(), Frequency(), operator+(), operator++(), operator-(), operator--(), TickPeriod(), Ticks(), and Time().

double detinfo::ElecClock::fTime
protected

Time in microseconds.

Definition at line 126 of file ElecClock.h.

Referenced by Time().


The documentation for this class was generated from the following file: