Skip to content

Commit 6e0f46f

Browse files
authored
Merge pull request #121 from SBNSoftware/feature/lnguyen_decodedTDC_ps
Add ps to decoded TDC, allow 2 different constructors for backward compataibility
2 parents e665b76 + 02515a9 commit 6e0f46f

3 files changed

Lines changed: 56 additions & 6 deletions

File tree

sbnobj/SBND/Timing/DAQTimestamp.cxx

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,46 @@ namespace sbnd::timing {
1010
, fTimestamp(0)
1111
, fOffset(0)
1212
, fName("")
13+
, fTimestampPs(0)
1314
{}
1415

16+
//For decoding with sbndcode <= v10_04_??
1517
DAQTimestamp::DAQTimestamp(uint32_t channel, uint64_t timestamp, uint64_t offset, std::string name)
1618
: fChannel(channel)
1719
, fTimestamp(timestamp)
1820
, fOffset(offset)
1921
, fName(name)
22+
, fTimestampPs(0)
2023
{}
2124

25+
//For decoding with sbndcode <= v10_04_??
2226
DAQTimestamp::DAQTimestamp(uint32_t channel, uint64_t timestamp, uint64_t offset, std::array<char, 8> name)
2327
: fChannel(channel)
2428
, fTimestamp(timestamp)
2529
, fOffset(offset)
2630
, fName("")
31+
, fTimestampPs(0)
32+
{
33+
for(auto const& c : name)
34+
fName.push_back(c);
35+
}
36+
37+
//New addition for sbndcode version > v10_04_??
38+
DAQTimestamp::DAQTimestamp(uint32_t channel, uint64_t timestamp, uint64_t offset, std::string name, uint64_t timestampPs)
39+
: fChannel(channel)
40+
, fTimestamp(timestamp)
41+
, fOffset(offset)
42+
, fName(name)
43+
, fTimestampPs(timestampPs)
44+
{}
45+
46+
//New addition for sbndcode version > v10_04_??
47+
DAQTimestamp::DAQTimestamp(uint32_t channel, uint64_t timestamp, uint64_t offset, std::array<char, 8> name, uint64_t timestampPs)
48+
: fChannel(channel)
49+
, fTimestamp(timestamp)
50+
, fOffset(offset)
51+
, fName("")
52+
, fTimestampPs(timestampPs)
2753
{
2854
for(auto const& c : name)
2955
fName.push_back(c);
@@ -51,6 +77,11 @@ namespace sbnd::timing {
5177
return fName;
5278
}
5379

80+
uint64_t DAQTimestamp::TimestampPs() const
81+
{
82+
return fTimestampPs;
83+
}
84+
5485
void DAQTimestamp::SetChannel(uint32_t channel)
5586
{
5687
fChannel = channel;
@@ -70,6 +101,11 @@ namespace sbnd::timing {
70101
{
71102
fName = name;
72103
}
104+
105+
void DAQTimestamp::SetTimestampPs(uint64_t timestamp)
106+
{
107+
fTimestampPs = timestamp;
108+
}
73109
}
74110

75111
#endif

sbnobj/SBND/Timing/DAQTimestamp.hh

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ namespace sbnd::timing {
2121
uint64_t fTimestamp; ///< Timestamp of signal [ns]
2222
uint64_t fOffset; ///< Channel specific offset [ns]
2323
std::string fName; ///< Name of channel input
24+
25+
//New addition for sbndcode version > v10_04_??
26+
uint64_t fTimestampPs; ///< Timestamp of signal [ps]
2427

2528
public:
2629

@@ -30,24 +33,28 @@ namespace sbnd::timing {
3033
DAQTimestamp();
3134

3235
/**
33-
* Constructor to set all parameters
36+
* Constructor to set 4 parameters but timestamp ps
37+
* For decoding with sbndcode <= v10_04_??
3438
*
3539
* @param channel Hardware channel
36-
* @param timestamp Timestamp of signal [ns]
40+
* @param timestamp Timestamp of signal [ns] in UTC format
3741
* @param offset Channel specific offset [ns]
3842
* @param name Name of channel input
3943
*/
4044
DAQTimestamp(uint32_t channel, uint64_t timestamp, uint64_t offset, std::string name);
45+
DAQTimestamp(uint32_t channel, uint64_t timestamp, uint64_t offset, std::array<char, 8> name);
4146

4247
/**
43-
* Constructor to set all parameters, using array for name
48+
* Constructor to set all parameters
49+
* For decoding with sbndcode > v10_04_??
4450
*
4551
* @param channel Hardware channel
46-
* @param timestamp Timestamp of signal [ns]
52+
* @param timestamp Timestamp of signal [ns] in UTC format
4753
* @param offset Channel specific offset [ns]
4854
* @param name Name of channel input
4955
*/
50-
DAQTimestamp(uint32_t channel, uint64_t timestamp, uint64_t offset, std::array<char, 8> name);
56+
DAQTimestamp(uint32_t channel, uint64_t timestamp, uint64_t offset, std::string name, uint64_t timestampPs);
57+
DAQTimestamp(uint32_t channel, uint64_t timestamp, uint64_t offset, std::array<char, 8> name, uint64_t timestampPs);
5158

5259
/**
5360
* Destructor
@@ -61,6 +68,9 @@ namespace sbnd::timing {
6168
uint64_t Timestamp() const;
6269
uint64_t Offset() const;
6370
std::string Name() const;
71+
72+
//New addition for sbndcode version > v10_04_??
73+
uint64_t TimestampPs() const;
6474

6575
/**
6676
* Setters
@@ -69,6 +79,9 @@ namespace sbnd::timing {
6979
void SetTimestamp(uint64_t timestamp);
7080
void SetOffset(uint64_t offset);
7181
void SetName(std::string name);
82+
83+
//New addition for sbndcode version > v10_04_??
84+
void SetTimestampPs(uint64_t timestamp);
7285
};
7386
}
7487

sbnobj/SBND/Timing/classes_def.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<lcgdict>
2-
<class name="sbnd::timing::DAQTimestamp" ClassVersion="10">
2+
<class name="sbnd::timing::DAQTimestamp" ClassVersion="11">
3+
<version ClassVersion="11" checksum="2804806845"/>
34
<version ClassVersion="10" checksum="810700615"/>
45
</class>
56
<class name="std::vector<sbnd::timing::DAQTimestamp>"/>

0 commit comments

Comments
 (0)