Skip to content

Commit 3ee4ddc

Browse files
authored
Merge pull request #95 from SBNSoftware/feature/hlay_lnguyen_spectdc_decoder
SPEC TDC Decoder
2 parents bff8ad0 + 103f6af commit 3ee4ddc

6 files changed

Lines changed: 170 additions & 0 deletions

File tree

sbnobj/SBND/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ add_subdirectory(CRT)
22
add_subdirectory(Commissioning)
33
add_subdirectory(Trigger)
44
add_subdirectory(ToF)
5+
add_subdirectory(Timing)

sbnobj/SBND/Timing/CMakeLists.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
cet_make(
2+
LIBRARIES
3+
cetlib_except::cetlib_except
4+
NO_DICTIONARY
5+
)
6+
7+
art_dictionary(DICTIONARY_LIBRARIES sbnobj_SBND_Timing)
8+
9+
install_headers()
10+
install_source()
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
#ifndef SBND_TIMESTAMP_CXX
2+
#define SBND_TIMESTAMP_CXX
3+
4+
#include "sbnobj/SBND/Timing/DAQTimestamp.hh"
5+
6+
namespace sbnd::timing {
7+
8+
DAQTimestamp::DAQTimestamp()
9+
: fChannel(std::numeric_limits<uint32_t>::max())
10+
, fTimestamp(0)
11+
, fOffset(0)
12+
, fName("")
13+
{}
14+
15+
DAQTimestamp::DAQTimestamp(uint32_t channel, uint64_t timestamp, uint64_t offset, std::string name)
16+
: fChannel(channel)
17+
, fTimestamp(timestamp)
18+
, fOffset(offset)
19+
, fName(name)
20+
{}
21+
22+
DAQTimestamp::DAQTimestamp(uint32_t channel, uint64_t timestamp, uint64_t offset, std::array<char, 8> name)
23+
: fChannel(channel)
24+
, fTimestamp(timestamp)
25+
, fOffset(offset)
26+
, fName("")
27+
{
28+
for(auto const& c : name)
29+
fName.push_back(c);
30+
}
31+
32+
DAQTimestamp::~DAQTimestamp() {}
33+
34+
uint32_t DAQTimestamp::Channel() const
35+
{
36+
return fChannel;
37+
}
38+
39+
uint64_t DAQTimestamp::Timestamp() const
40+
{
41+
return fTimestamp;
42+
}
43+
44+
uint64_t DAQTimestamp::Offset() const
45+
{
46+
return fOffset;
47+
}
48+
49+
std::string DAQTimestamp::Name() const
50+
{
51+
return fName;
52+
}
53+
54+
void DAQTimestamp::SetChannel(uint32_t channel)
55+
{
56+
fChannel = channel;
57+
}
58+
59+
void DAQTimestamp::SetTimestamp(uint64_t timestamp)
60+
{
61+
fTimestamp = timestamp;
62+
}
63+
64+
void DAQTimestamp::SetOffset(uint64_t offset)
65+
{
66+
fOffset = offset;
67+
}
68+
69+
void DAQTimestamp::SetName(std::string name)
70+
{
71+
fName = name;
72+
}
73+
}
74+
75+
#endif

sbnobj/SBND/Timing/DAQTimestamp.hh

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
/**
2+
* \brief Data product to store a timestamp from the DAQ system
3+
*
4+
* \author Henry Lay (h.lay@lancaster.ac.uk)
5+
* \author Vu Chi Lan Nguyen (vclnguyen1@sheffield.ac.uk)
6+
*/
7+
8+
#ifndef SBND_DAQTIMESTAMP_HH
9+
#define SBND_DAQTIMESTAMP_HH
10+
11+
#include <stdint.h>
12+
#include <string>
13+
#include <array>
14+
15+
namespace sbnd::timing {
16+
17+
class DAQTimestamp {
18+
19+
uint32_t fChannel; ///< Hardware channel
20+
uint64_t fTimestamp; ///< Timestamp of signal [ns]
21+
uint64_t fOffset; ///< Channel specific offset [ns]
22+
std::string fName; ///< Name of channel input
23+
24+
public:
25+
26+
/**
27+
* Default constructor.
28+
*/
29+
DAQTimestamp();
30+
31+
/**
32+
* Constructor to set all parameters
33+
*
34+
* @param channel Hardware channel
35+
* @param timestamp Timestamp of signal [ns]
36+
* @param offset Channel specific offset [ns]
37+
* @param name Name of channel input
38+
*/
39+
DAQTimestamp(uint32_t channel, uint64_t timestamp, uint64_t offset, std::string name);
40+
41+
/**
42+
* Constructor to set all parameters, using array for name
43+
*
44+
* @param channel Hardware channel
45+
* @param timestamp Timestamp of signal [ns]
46+
* @param offset Channel specific offset [ns]
47+
* @param name Name of channel input
48+
*/
49+
DAQTimestamp(uint32_t channel, uint64_t timestamp, uint64_t offset, std::array<char, 8> name);
50+
51+
/**
52+
* Destructor
53+
*/
54+
virtual ~DAQTimestamp();
55+
56+
/**
57+
* Getters
58+
*/
59+
uint32_t Channel() const;
60+
uint64_t Timestamp() const;
61+
uint64_t Offset() const;
62+
std::string Name() const;
63+
64+
/**
65+
* Setters
66+
*/
67+
void SetChannel(uint32_t channel);
68+
void SetTimestamp(uint64_t timestamp);
69+
void SetOffset(uint64_t offset);
70+
void SetName(std::string name);
71+
};
72+
}
73+
74+
#endif

sbnobj/SBND/Timing/classes.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#include "canvas/Persistency/Common/Wrapper.h"
2+
#include "canvas/Persistency/Common/Assns.h"
3+
#include "sbnobj/SBND/Timing/DAQTimestamp.hh"

sbnobj/SBND/Timing/classes_def.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<lcgdict>
2+
<class name="sbnd::timing::DAQTimestamp" ClassVersion="10">
3+
<version ClassVersion="10" checksum="810700615"/>
4+
</class>
5+
<class name="std::vector<sbnd::timing::DAQTimestamp>"/>
6+
<class name="art::Wrapper< std::vector<sbnd::timing::DAQTimestamp> >"/>
7+
</lcgdict>

0 commit comments

Comments
 (0)