Skip to content

Commit e13f3c6

Browse files
authored
Merge pull request #102 from SBNSoftware/feature/hlay_crt_clustering_base
CRT Clustering final
2 parents 826feaa + e400730 commit e13f3c6

18 files changed

Lines changed: 712 additions & 58 deletions

sbnobj/Common/CRT/classes_def.xml

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -63,24 +63,13 @@
6363
<class name="std::vector<sbnd::crt::CRTTzero>"/>
6464
<class name="art::Wrapper< std::vector<sbnd::crt::CRTTzero> >"/>
6565

66-
<class name="sbnd::crt::CRTTrack" ClassVersion="10">
67-
<version ClassVersion="10" checksum="2681413750"/>
68-
</class>
69-
<class name="std::vector<sbnd::crt::CRTTrack>"/>
70-
<class name="art::Wrapper< std::vector<sbnd::crt::CRTTrack> >"/>
71-
7266
<!-- associations -->
7367

7468
<class name="art::Assns<sbnd::crt::CRTTzero, sbnd::crt::CRTHit, void>" />
7569
<class name="art::Wrapper< art::Assns<sbnd::crt::CRTTzero, sbnd::crt::CRTHit, void> >" />
7670
<class name="art::Assns<sbnd::crt::CRTHit, sbnd::crt::CRTTzero, void>" />
7771
<class name="art::Wrapper< art::Assns<sbnd::crt::CRTHit, sbnd::crt::CRTTzero, void> >" />
7872

79-
<class name="art::Assns<sbnd::crt::CRTTrack, sbnd::crt::CRTHit, void>" />
80-
<class name="art::Wrapper< art::Assns<sbnd::crt::CRTTrack, sbnd::crt::CRTHit, void> >" />
81-
<class name="art::Assns<sbnd::crt::CRTHit, sbnd::crt::CRTTrack, void>" />
82-
<class name="art::Wrapper< art::Assns<sbnd::crt::CRTHit, sbnd::crt::CRTTrack, void> >" />
83-
8473

8574
<class name="art::Assns<icarus::crt::CRTHit,sim::AuxDetIDE,void>"/>
8675
<class name="art::Assns<sim::AuxDetIDE,icarus::crt::CRTHit,void>"/>

sbnobj/SBND/CRT/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ cet_make(
22
LIBRARIES
33
cetlib_except::cetlib_except
44
lardataobj::Simulation
5+
lardataobj::RecoBase
56
NO_DICTIONARY
67
)
78

sbnobj/SBND/CRT/CRTCluster.cxx

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#ifndef SBND_CRTCLUSTER_CXX
2+
#define SBND_CRTCLUSTER_CXX
3+
4+
#include "sbnobj/SBND/CRT/CRTCluster.hh"
5+
6+
namespace sbnd {
7+
8+
namespace crt {
9+
10+
CRTCluster::CRTCluster()
11+
: fTs0 (0)
12+
, fTs1 (0)
13+
, fUnixS (0)
14+
, fNHits (0)
15+
, fTagger (kUndefinedTagger)
16+
, fComposition (kUndefinedSet)
17+
{}
18+
19+
CRTCluster::CRTCluster(uint32_t _ts0, uint32_t _ts1, uint32_t _unixS, uint16_t _nHits, CRTTagger _tagger,
20+
CoordSet _composition)
21+
: fTs0 (_ts0)
22+
, fTs1 (_ts1)
23+
, fUnixS (_unixS)
24+
, fNHits (_nHits)
25+
, fTagger (_tagger)
26+
, fComposition (_composition)
27+
{}
28+
29+
CRTCluster::~CRTCluster() {}
30+
31+
uint32_t CRTCluster::Ts0() const { return fTs0; }
32+
uint32_t CRTCluster::Ts1() const { return fTs1; }
33+
uint32_t CRTCluster::UnixS() const { return fUnixS; }
34+
uint16_t CRTCluster::NHits() const { return fNHits; }
35+
CRTTagger CRTCluster::Tagger() const { return fTagger; }
36+
CoordSet CRTCluster::Composition() const { return fComposition; }
37+
}
38+
}
39+
40+
#endif

sbnobj/SBND/CRT/CRTCluster.hh

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/**
2+
* \class CRTCluster
3+
*
4+
* \brief Product to store a cluster of CRTStripHits
5+
*
6+
* \author Henry Lay (h.lay@lancaster.ac.uk)
7+
*
8+
*/
9+
10+
#ifndef SBND_CRTCLUSTER_HH
11+
#define SBND_CRTCLUSTER_HH
12+
13+
#include "sbnobj/SBND/CRT/CRTEnums.hh"
14+
15+
namespace sbnd::crt {
16+
17+
class CRTCluster {
18+
19+
uint32_t fTs0; // T0 counter [ns]
20+
uint32_t fTs1; // T1 counter [ns]
21+
uint32_t fUnixS; // Unixtime of event [s]
22+
uint16_t fNHits; // The number of strip hits forming the cluster
23+
CRTTagger fTagger; // The tagger this cluster exists on
24+
CoordSet fComposition; // What combination of orientations does the cluster make up?
25+
26+
public:
27+
28+
CRTCluster();
29+
30+
CRTCluster(uint32_t _ts0, uint32_t _ts1, uint32_t _unixS, uint16_t _nHits, CRTTagger _tagger,
31+
CoordSet _composition);
32+
33+
virtual ~CRTCluster();
34+
35+
uint32_t Ts0() const;
36+
uint32_t Ts1() const;
37+
uint32_t UnixS() const;
38+
uint16_t NHits() const;
39+
CRTTagger Tagger() const;
40+
CoordSet Composition() const;
41+
};
42+
}
43+
44+
#endif

sbnobj/SBND/CRT/CRTEnums.cxx

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#ifndef SBND_CRTENUMS_CXX
2+
#define SBND_CRTENUMS_CXX
3+
4+
#include "sbnobj/SBND/CRT/CRTEnums.hh"
5+
6+
sbnd::crt::CoordSet operator|(sbnd::crt::CoordSet lhs, sbnd::crt::CoordSet rhs) {
7+
return static_cast<sbnd::crt::CoordSet>(
8+
static_cast<std::underlying_type_t<sbnd::crt::CoordSet>>(lhs) |
9+
static_cast<std::underlying_type_t<sbnd::crt::CoordSet>>(rhs)
10+
);
11+
}
12+
13+
sbnd::crt::CoordSet operator&(sbnd::crt::CoordSet lhs, sbnd::crt::CoordSet rhs) {
14+
return static_cast<sbnd::crt::CoordSet>(
15+
static_cast<std::underlying_type_t<sbnd::crt::CoordSet>>(lhs) &
16+
static_cast<std::underlying_type_t<sbnd::crt::CoordSet>>(rhs)
17+
);
18+
}
19+
20+
#endif

sbnobj/SBND/CRT/CRTEnums.hh

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/**
2+
* \brief Definitions of enums used in CRT objects
3+
*
4+
* \author Henry Lay (h.lay@lancaster.ac.uk)
5+
*/
6+
7+
#ifndef SBND_CRTENUMS_HH
8+
#define SBND_CRTENUMS_HH
9+
10+
#include <stdint.h>
11+
#include <type_traits>
12+
13+
namespace sbnd::crt {
14+
15+
// CRTTagger enum used to quickly refer to one of the seven SBND taggers.
16+
17+
enum CRTTagger {
18+
kUndefinedTagger = -1,
19+
kBottomTagger,
20+
kSouthTagger,
21+
kNorthTagger,
22+
kWestTagger,
23+
kEastTagger,
24+
kTopLowTagger,
25+
kTopHighTagger,
26+
27+
kUpstreamTagger = kSouthTagger,
28+
kDownstreamTagger = kNorthTagger
29+
};
30+
31+
// Often working in 1, 2 or 3 dimensions for CRT things, this enum allows us to define this easily.
32+
// It is defined like a bitset of flags such that the below operations can be defined usefully.
33+
34+
enum CoordSet : uint8_t {
35+
kUndefinedSet = 0,
36+
kX = 1, // 001
37+
kY = 2, // 010
38+
kZ = 4, // 100
39+
kXY = 3, // 011
40+
kXZ = 5, // 101
41+
kYZ = 6, // 110
42+
kXYZ = 7, // 111
43+
44+
kThreeD = kXYZ
45+
46+
};
47+
}
48+
49+
extern sbnd::crt::CoordSet operator|(sbnd::crt::CoordSet lhs, sbnd::crt::CoordSet rhs);
50+
51+
extern sbnd::crt::CoordSet operator&(sbnd::crt::CoordSet lhs, sbnd::crt::CoordSet rhs);
52+
53+
#endif

sbnobj/SBND/CRT/CRTSpacePoint.cxx

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
#ifndef SBND_CRTSPACEPOINT_CXX
2+
#define SBND_CRTSPACEPOINT_CXX
3+
4+
#include "sbnobj/SBND/CRT/CRTSpacePoint.hh"
5+
6+
namespace sbnd {
7+
8+
namespace crt {
9+
10+
CRTSpacePoint::CRTSpacePoint()
11+
: fPos ({0., 0., 0.})
12+
, fPosErr ({0., 0., 0.})
13+
, fPE (0.)
14+
, fTime (0.)
15+
, fTimeErr (0.)
16+
, fComplete (false)
17+
{}
18+
19+
CRTSpacePoint::CRTSpacePoint(double _x, double _ex, double _y, double _ey, double _z, double _ez,
20+
double _pe, double _time, double _etime, bool _complete)
21+
: fPos ({_x, _y, _z})
22+
, fPosErr ({_ex, _ey, _ez})
23+
, fPE (_pe)
24+
, fTime (_time)
25+
, fTimeErr (_etime)
26+
, fComplete (_complete)
27+
{}
28+
29+
CRTSpacePoint::CRTSpacePoint(geo::Point_t _pos, geo::Point_t _err, double _pe, double _time, double _etime, bool _complete)
30+
: fPos (_pos)
31+
, fPosErr (_err)
32+
, fPE (_pe)
33+
, fTime (_time)
34+
, fTimeErr (_etime)
35+
, fComplete (_complete)
36+
{}
37+
38+
CRTSpacePoint::~CRTSpacePoint() {}
39+
40+
double CRTSpacePoint::X() const { return fPos.X(); }
41+
double CRTSpacePoint::XErr() const { return fPosErr.X(); }
42+
double CRTSpacePoint::Y() const { return fPos.Y(); }
43+
double CRTSpacePoint::YErr() const { return fPosErr.Y(); }
44+
double CRTSpacePoint::Z() const { return fPos.Z(); }
45+
double CRTSpacePoint::ZErr() const { return fPosErr.Z(); }
46+
geo::Point_t CRTSpacePoint::Pos() const { return fPos; }
47+
geo::Point_t CRTSpacePoint::Err() const { return fPosErr; }
48+
double CRTSpacePoint::PE() const { return fPE; }
49+
double CRTSpacePoint::Time() const { return fTime; }
50+
double CRTSpacePoint::TimeErr() const { return fTimeErr; }
51+
bool CRTSpacePoint::Complete() const { return fComplete; }
52+
}
53+
}
54+
55+
#endif

sbnobj/SBND/CRT/CRTSpacePoint.hh

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
/**
2+
* \class CRTSpacePoint
3+
*
4+
* \brief Product to store the characterisation of a cluster
5+
*
6+
* \author Henry Lay (h.lay@lancaster.ac.uk)
7+
*
8+
*/
9+
10+
#ifndef SBND_CRTSPACEPOINT_HH
11+
#define SBND_CRTSPACEPOINT_HH
12+
13+
#include "larcoreobj/SimpleTypesAndConstants/geo_vectors.h"
14+
15+
namespace sbnd::crt {
16+
17+
class CRTSpacePoint {
18+
19+
geo::Point_t fPos; // position [cm]
20+
geo::Point_t fPosErr; // positional error [cm]
21+
double fPE; // total PE
22+
double fTime; // time [ns]
23+
double fTimeErr; // time error [ns]
24+
bool fComplete; // whether or not the cluster was 3D and contained overlaps
25+
26+
public:
27+
28+
CRTSpacePoint();
29+
30+
CRTSpacePoint(double _x, double _ex, double _y, double _ey, double _z, double _ez, double _pe,
31+
double _time, double _etime, bool _complete);
32+
33+
CRTSpacePoint(geo::Point_t _pos, geo::Point_t _err, double _pe, double _time, double _etime, bool _complete);
34+
35+
virtual ~CRTSpacePoint();
36+
37+
double X() const;
38+
double XErr() const;
39+
double Y() const;
40+
double YErr() const;
41+
double Z() const;
42+
double ZErr() const;
43+
geo::Point_t Pos() const;
44+
geo::Point_t Err() const;
45+
double PE() const;
46+
double Time() const;
47+
double TimeErr() const;
48+
bool Complete() const;
49+
50+
CRTSpacePoint& operator= (CRTSpacePoint const&) = default;
51+
};
52+
}
53+
54+
#endif

sbnobj/SBND/CRT/CRTStripHit.cxx

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
#ifndef SBND_CRTSTRIPHIT_CXX
2+
#define SBND_CRTSTRIPHIT_CXX
3+
4+
#include "sbnobj/SBND/CRT/CRTStripHit.hh"
5+
6+
namespace sbnd {
7+
8+
namespace crt {
9+
10+
CRTStripHit::CRTStripHit()
11+
: fChannel (0)
12+
, fTs0 (0)
13+
, fTs1 (0)
14+
, fUnixS (0)
15+
, fPos (0)
16+
, fErr (0)
17+
, fADC1 (0)
18+
, fADC2 (0)
19+
, fSaturated1 (false)
20+
, fSaturated2 (false)
21+
{}
22+
23+
CRTStripHit::CRTStripHit(uint32_t _channel, uint32_t _ts0, uint32_t _ts1, uint32_t _s, double _pos,
24+
double _err, uint16_t _adc1, uint16_t _adc2)
25+
: fChannel (_channel)
26+
, fTs0 (_ts0)
27+
, fTs1 (_ts1)
28+
, fUnixS (_s)
29+
, fPos (_pos)
30+
, fErr (_err)
31+
, fADC1 (_adc1)
32+
, fADC2 (_adc2)
33+
{
34+
fSaturated1 = fADC1 == 4095;
35+
fSaturated2 = fADC2 == 4095;
36+
}
37+
38+
CRTStripHit::CRTStripHit(uint32_t _channel, uint32_t _ts0, uint32_t _ts1, uint32_t _s, double _pos,
39+
double _err, uint16_t _adc1, uint16_t _adc2, bool _saturated1, bool _saturated2)
40+
: fChannel (_channel)
41+
, fTs0 (_ts0)
42+
, fTs1 (_ts1)
43+
, fUnixS (_s)
44+
, fPos (_pos)
45+
, fErr (_err)
46+
, fADC1 (_adc1)
47+
, fADC2 (_adc2)
48+
, fSaturated1 (_saturated1)
49+
, fSaturated2 (_saturated2)
50+
{}
51+
52+
CRTStripHit::~CRTStripHit() {}
53+
54+
uint32_t CRTStripHit::Channel() const { return fChannel; }
55+
uint32_t CRTStripHit::Ts0() const { return fTs0; }
56+
uint32_t CRTStripHit::Ts1() const { return fTs1; }
57+
uint32_t CRTStripHit::UnixS() const { return fUnixS; }
58+
double CRTStripHit::Pos() const { return fPos; }
59+
double CRTStripHit::Error() const { return fErr; }
60+
uint16_t CRTStripHit::ADC1() const { return fADC1; }
61+
uint16_t CRTStripHit::ADC2() const { return fADC2; }
62+
bool CRTStripHit::Saturated1() const { return fSaturated1; }
63+
bool CRTStripHit::Saturated2() const { return fSaturated2; }
64+
}
65+
}
66+
67+
#endif

0 commit comments

Comments
 (0)