Jpp test-rotations-old-57-g407471f53
the software that should make you happy
Loading...
Searching...
No Matches
JTRIGGER Namespace Reference

Auxiliary classes and methods for triggering. More...

Classes

struct  JAssertBit
 This class will generate a compiler error if trigger bit is out of range. More...
 
struct  JAssertBit< N, true >
 Implementation of a valid trigger bit. More...
 
struct  JAttributes
 Module attributes. More...
 
class  JBinder2nd
 Auxiliary class to convert binary JMatch operator and given hit to unary match operator. More...
 
struct  JBuild
 Auxiliary base class for hit building. More...
 
struct  JBuildHelper
 Auxiliary class to extend hit building functionality to all DAQ data types. More...
 
class  JBuildL0
 Template L0 hit builder. More...
 
class  JBuildL0< JHitL0 >
 Template specialisation of L0 builder for JHitL0 data type. More...
 
class  JBuildL0< JHitR0 >
 Template specialisation of L0 builder for JHitR0 data type. More...
 
class  JBuildL0< JHitR1 >
 Template specialisation of L0 builder for JHitR1 data type. More...
 
class  JBuildL1
 Template L1 hit builder. More...
 
class  JBuildL1< JHitL1 >
 Template specialisation of L1 builder for JHitL1 data type. More...
 
class  JBuildL1< JHitR1 >
 Template specialisation of L1 builder for JHitR1 data type. More...
 
struct  JBuildL1Parameters
 Auxiliary data structure for L1 build parameters. More...
 
class  JBuildL2
 Template L2 builder. More...
 
class  JBuildL2< JHitL2 >
 Template specialisation of L2 builder for JHitL2 data type. More...
 
class  JBuildL2< JHitR2 >
 Template specialisation of L2 builder for JHitR2 data type. More...
 
struct  JChecksum
 Auxiliary class to perform check-sum on raw data. More...
 
class  JCLBRunByRunSimulator
 CLB simulation based on run-by-run information. More...
 
class  JClone
 Clone of a container. More...
 
struct  JDAQHitDefaultSelector
 Default class to select DAQ hits. More...
 
struct  JDAQHitSelector
 Auxiliary class to select DAQ hits. More...
 
struct  JDAQHitToTSelector
 Auxiliary class to select DAQ hits based on time-over-treshold value. More...
 
class  JDOMToPMTMaskMap
 
class  JEvent
 Triggered event. More...
 
class  JEventOverlap
 Match of two events considering overlap in time. More...
 
class  JFrame
 Data frame for calibrated hits of one PMT. More...
 
class  JFrame_t
 Data frame with end marker. More...
 
class  JFrameClone
 Clone of JFrame. More...
 
struct  JGetRiseTime
 Auxiliary class for rise time evaluation. More...
 
class  JHit
 Hit data structure. More...
 
class  JHitL0
 Data structure for L0 hit. More...
 
class  JHitL1
 Data structure for L1 hit. More...
 
class  JHitR0
 Reduced data structure for L0 hit. More...
 
class  JHitR1
 Reduced data structure for L1 hit. More...
 
struct  JHitToolkit
 Template definition of hit toolkit. More...
 
struct  JHitToolkit< JDAQHit, false >
 Template specialisation of hit toolkit for JDAQHit class. More...
 
struct  JHitToolkit< JHit, false >
 Template specialisation of hit toolkit for JHit class. More...
 
struct  JHitToolkit< JHit_t, true >
 Template specialisation of hit toolkit for any primitive data type. More...
 
struct  JHitToolkit< JHitR0, false >
 Template specialisation of hit toolkit for JHitR0 class. More...
 
class  JK40RunByRunSimulator
 K40 simulation based on run-by-run information. More...
 
struct  JL2Parameters
 Data structure for L2 parameters. More...
 
class  JMatch
 Function object interface for hit matching. More...
 
class  JMatch1D
 1D match criterion. More...
 
class  JMatch3B
 3D match criterion with road width. More...
 
class  JMatch3D
 3D match criterion. More...
 
class  JMatch3G
 3G match criterion. More...
 
class  JMatchFixer
 Auxiliary class to fix match. More...
 
class  JMatchHelper
 Auxiliary class to handle pointer to match function. More...
 
class  JMatchL0
 L0 match criterion. More...
 
struct  JModuleCounter
 Auxiliary class for counting unique modules. More...
 
struct  JModuleHeader
 Header for Module. More...
 
struct  JParametersHelper
 Wrapper class to share parameters. More...
 
struct  JPMTHeader
 Header for PMT. More...
 
class  JPMTIdentifier_t
 
class  JPMTMask
 Auxiliary class for PMT mask. More...
 
class  JPMTRunByRunSimulator
 PMT simulation based on run-by-run information. More...
 
struct  JPMTSelector
 Auxiliary data structure for set of PMT identifiers. More...
 
struct  JPreprocessor
 Auxiliary class for specifying the way of pre-processing of hits. More...
 
class  JPrescaler
 Auxiliary class for prescaling. More...
 
class  JSummaryRouter
 Router for fast addressing of summary data in JDAQSummaryslice data structure as a function of the optical module identifier. More...
 
class  JSuperFrame1D
 1-dimensional frame with time calibrated data from one optical module. More...
 
class  JSuperFrame2D
 2-dimensional frame with time calibrated data from one optical module. More...
 
class  JSuperFrameClone1D
 Clone of JSuperFrame1D. More...
 
class  JSuperFrameClone2D
 Clone of JSuperFrame2D. More...
 
class  JTimeslice
 Time slice with calibrated data. More...
 
class  JTimesliceClone
 Clone of JTimeslice. More...
 
class  JTimesliceL1
 Auxiliary class to build JDAQTimeslice for L1 timeslice. More...
 
struct  JTimesliceRouter
 Router for fast addressing of hits in KM3NETDAQ::JDAQTimeslice data structure as a function of the optical module identifier and time. More...
 
struct  JTimesliceRouter_t
 Auxiliary base class for JTimesliceRouter. More...
 
class  JTrigger3D
 General purpose majority trigger. More...
 
class  JTrigger3DMuon
 Muon trigger. More...
 
struct  JTrigger3DMuon_t
 Muon trigger parameters. More...
 
class  JTrigger3DShower
 Shower trigger. More...
 
struct  JTrigger3DShower_t
 Shower trigger parameters. More...
 
class  JTrigger3N
 General purpose muon trigger. More...
 
struct  JTriggerBit
 This class is used to map trigger class to trigger bit. More...
 
class  JTriggeredEvent
 Auxiliary class to build JDAQEvent for a triggered event. More...
 
class  JTriggeredHit
 Data structure for triggered hit. More...
 
class  JTriggerException
 General exception. More...
 
class  JTriggerInput
 Data structure for input to trigger algorithm. More...
 
class  JTriggerInterface
 Trigger interface. More...
 
class  JTriggerMXShower
 Shower trigger. More...
 
struct  JTriggerMXShower_t
 Shower trigger parameters. More...
 
class  JTriggerNB
 Nano-beacon trigger. More...
 
struct  JTriggerNB_t
 Nano-beacon trigger parameters. More...
 
class  JTriggerOutput
 Set of triggered events. More...
 
class  JTriggerParameters
 Data structure for all trigger parameters. More...
 

Typedefs

typedef JHitL1 JHitL2
 Type definition of L2 hit.
 
typedef JHitR1 JHitR2
 Type definition of R2 hit.
 
typedef unsigned int JPMTMask_t
 Type definition of PMT mask.
 
typedef unsigned int JTriggerbit_t
 Type definition of trigger bit.
 

Functions

template<class JHitIterator_t , class JMatch_t >
JHitIterator_t clusterize (JHitIterator_t __begin, JHitIterator_t __end, const JMatch_t &match, const int Nmin=1)
 Partition data according given binary match operator.
 
template<class JHitIterator_t , class JComparator_t , class JMatch_t >
JHitIterator_t clusterize (JHitIterator_t __begin, JHitIterator_t __end, const JComparator_t &comparator, const JMatch_t &match)
 Select best root hit according given comparator and partition remaining data according given binary match operator and this root hit.
 
template<class JHitIterator_t , class JMatch_t >
JHitIterator_t reverse_clusterize (JHitIterator_t __begin, JHitIterator_t __end, const JMatch_t &match)
 Partition data according given binary match operator.
 
template<class JHitIterator_t , class JMatch_t >
JHitIterator_t clusterizeWeight (JHitIterator_t __begin, JHitIterator_t __end, const JMatch_t &match)
 Partition data according given binary match operator.
 
template<class JHit_t >
bool weightSorter (const JHit_t &first, const JHit_t &second)
 Compare two hits by weight.
 
template<class JHit_t >
bool timeSorter (const JHit_t &first, const JHit_t &second)
 Compare two hits by weight.
 
template<class JHit_t >
JBinder2nd< JHit_t > JBind2nd (const JMatch< JHit_t > &match, const JHit_t &second)
 Auxiliary method to create JBinder2nd object.
 
bool operator< (const JEvent &first, const JEvent &second)
 Less than operator for events.
 
JTimeRange getTimeRange (const JEvent &event)
 Get time range (i.e. earlist and latest hit time) of triggered event.
 
bool operator< (const JHit &first, const JHit &second)
 Less than operator for hits.
 
bool operator< (const JHit &hit, const double t1)
 Less than operator for hits.
 
bool operator== (const JHit &first, const JHit &second)
 Equal operator for hits.
 
template<class T >
int getCount (const T &hit)
 Get hit count.
 
template<class T >
int getCount (T __begin, T __end)
 Get hit count.
 
double getTime (const JDAQHit &hit, const JCalibration &cal)
 Get calibrated time of DAQ hit.
 
double getToT (const JDAQHit &hit, const JCalibration &cal)
 Get calibrated time-over-threshold of DAQ hit.
 
template<class JHit_t >
JMatchHelper< JHit_t > make_match (bool(*match)(const JHit_t &, const JHit_t &))
 Auxiliary method to make JMatch object based on pointer to match function.
 
bool operator== (const JPMTIdentifier_t &first, const JPMTIdentifier_t &second)
 Equal operator for PMT identifiers.
 
bool operator< (const JPMTIdentifier_t &first, const JPMTIdentifier_t &second)
 Less than operator for PMT identifiers.
 
JPMTMask_t getPMTMask (const unsigned int bit)
 Convert PMT bit to PMT mask.
 
 setTriggerBit (JTrigger3DShower, JTRIGGER3DSHOWER)
 
 setTriggerBit (JTriggerMXShower, JTRIGGERMXSHOWER)
 
 setTriggerBit (JTrigger3DMuon, JTRIGGER3DMUON)
 
 setTriggerBit (JTriggerNB, JTRIGGERNB)
 
bool operator< (const JTriggeredHit &first, const JTriggeredHit &second)
 Less than operator for triggered hits.
 
bool operator== (const JTriggeredHit &first, const JTriggeredHit &second)
 Equal operator for triggered hits.
 
template<class JTrigger_t >
JTriggerbit_t getTriggerBit ()
 Get the trigger bit.
 
template<class JTrigger_t >
JTriggerbit_t getTriggerBit (const JTrigger_t &event)
 Get the trigger bit.
 
const char * getTriggerName (JTriggerbit_t bit)
 Get trigger name.
 
void setAttributes (const JModule &first, const JModule &second, JAttributes &attributes)
 Set module attributes.
 
void randomize (JTrigger3DMuon_t::JParameters *p)
 Randomize trigger parameters.
 
void randomize (JTrigger3DShower_t::JParameters *p)
 Randomize trigger parameters.
 
void randomize (JTriggerMXShower_t::JParameters *p)
 Randomize trigger parameters.
 
void randomize (JTriggerNB_t::JParameters *p)
 Randomize trigger parameters.
 
void randomize (JTriggerParameters *p)
 Randomize trigger parameters.
 
JTimeRange getTimeRange (const JTriggerParameters &parameters)
 Get time range of snapshot.
 
JTimeRange getTimeRange (const JTriggerNB_t::JParameters &parameters)
 Get time range of snapshot.
 
bool getDAQStatus (const JDAQFrameStatus &frame, const JStatus &status)
 Test status of DAQ.
 
bool getDAQStatus (const JDAQFrameStatus &frame, const JModule &module, const int pmt)
 Test status of DAQ.
 
bool getPMTStatus (const JStatus &status)
 Test status of PMT.
 
bool getPMTStatus (const JDAQFrameStatus &frame, const JStatus &status, const int pmt)
 Test status of PMT.
 
bool getPMTStatus (const JDAQFrameStatus &frame, const JModule &module, const int pmt)
 Test status of PMT.
 
double getRate (const JDAQSummaryFrame &frame, const int pmt, const double factor=1.0)
 Get corrected rate of PMT.
 

Variables

static int MAXIMAL_FRAME_SIZE = std::numeric_limits<int>::max()
 Maximal frame size.
 
static const JChecksum checksum
 Function object to perform check-sum of raw data.
 
static const JGetRiseTime getRiseTime
 Function object for rise time evaluation.
 
static const JModuleCounter getNumberOfModules
 Function object to count unique modules.
 
static const unsigned int NUMBER_OF_PMT_BITS = 31
 Number of PMT bits.
 

Detailed Description

Auxiliary classes and methods for triggering.

Trigger algorithms, support classes and auxiliary methods.

Author
mdejong
rbruijn
rgruiz

Typedef Documentation

◆ JHitL2

Type definition of L2 hit.

Definition at line 20 of file JHitL2.hh.

◆ JHitR2

Type definition of R2 hit.

Definition at line 20 of file JHitR2.hh.

◆ JPMTMask_t

typedef unsigned int JTRIGGER::JPMTMask_t

Type definition of PMT mask.

Definition at line 29 of file JPMTMask.hh.

◆ JTriggerbit_t

typedef unsigned int JTRIGGER::JTriggerbit_t

Type definition of trigger bit.

Definition at line 29 of file JTriggerInterface.hh.

Function Documentation

◆ clusterize() [1/2]

template<class JHitIterator_t , class JMatch_t >
JHitIterator_t JTRIGGER::clusterize ( JHitIterator_t __begin,
JHitIterator_t __end,
const JMatch_t & match,
const int Nmin = 1 )
inline

Partition data according given binary match operator.

The underlying algorithm is known in literature as 'clique'. The result is (likely to be) the maximal sub-set with all elements matched to each other. The complexity is quadratic, i.e. at most (number of elements x number of elements) operations. The algorithm will sort the data such that all clusterized hits are at the front. The return value points the first non clusterized hit.

The hit iterator refers to a data structure which should conform with the match operator.

Parameters
__beginbegin of data
__endend of data
matchbinary match operator
Nminminimum cluster size
Returns
end of data

Definition at line 38 of file JAlgorithm.hh.

42 {
43 using namespace std;
44
45 const int N = distance(__begin,__end);
46
47 JHitIterator_t buffer = __begin;
48
49 if (N >= Nmin) {
50
51 int i, j;
52 int n = N;
53
54 // Determine number of associated hits for each hit.
55
56 std::vector<int> count(N, 1); // Assume always a match with itself.
57
58 for (i = 0; i != N; ++i) {
59 for (j = i; ++j != N; ) {
60 if (match(buffer[i], buffer[j])) {
61 ++count[i];
62 ++count[j];
63 }
64 }
65 }
66
67 // Remove hit with the smallest number of associated hits.
68 // This procedure stops when:
69 // 1) number of associated hits is equal to the number of (remaining) hits or
70 // 2) maximal number of associated hits is less than the specified minimum.
71
72 for ( ; ; ) {
73
74 int M = (count[0] >= Nmin ? 1 : 0);
75
76 j = 0;
77
78 for (i = 1; i != n; ++i) {
79 if (count[i] < count[j]) {
80 j = i;
81 }
82 if (count[i] >= Nmin) {
83 ++M;
84 }
85 }
86
87 // Ready?
88
89 if (count[j] == n) {
90 return buffer + n;
91 }
92
93 if (M < Nmin) {
94 return buffer;
95 }
96
97 // Reduce effective size.
98
99 --n;
100
101 // Swap the selected hit to end.
102
103 swap(buffer[j], buffer[n]);
104 swap(count [j], count [n]);
105
106 // Decrease number of associated hits for each associated hit.
107
108 for (i = 0; i != n && count[n] != 1; ++i) {
109 if (match(buffer[i], buffer[n])) {
110 --count[i];
111 --count[n];
112 }
113 }
114 }
115 }
116
117 return buffer;
118 }
std::vector< T >::difference_type distance(typename std::vector< T >::const_iterator first, typename PhysicsEvent::const_iterator< T > second)
Specialisation of STL distance.
const int n
Definition JPolint.hh:791
int j
Definition JPolint.hh:801

◆ clusterize() [2/2]

template<class JHitIterator_t , class JComparator_t , class JMatch_t >
JHitIterator_t JTRIGGER::clusterize ( JHitIterator_t __begin,
JHitIterator_t __end,
const JComparator_t & comparator,
const JMatch_t & match )
inline

Select best root hit according given comparator and partition remaining data according given binary match operator and this root hit.

The complexity is linear, i.e. at most number of elements operations. The algorithm will sort the data such that all selected hits are at the front.

Parameters
__beginbegin of data
__endend of data
comparatorcomparator
matchbinary match operator
Returns
end of data

Definition at line 134 of file JAlgorithm.hh.

138 {
139 if (__begin != __end) {
140
141 std::sort(__begin, __end, comparator);
142
143 JHitIterator_t root = __begin;
144
145 return std::partition(++__begin, __end, JBind2nd(match, *root));
146
147 } else {
148
149 return __end;
150 }
151 }
Definition root.py:1

◆ reverse_clusterize()

template<class JHitIterator_t , class JMatch_t >
JHitIterator_t JTRIGGER::reverse_clusterize ( JHitIterator_t __begin,
JHitIterator_t __end,
const JMatch_t & match )
inline

Partition data according given binary match operator.

The underlying algorithm is known in literature as reverse 'clique'. The result is (likely to be) the maximal sub-set with all elements matched to each other. The complexity is quadratic, i.e. at most (number of elements x number of elements) operations. The algorithm will sort the data such that all clusterized hits are at the front. The return value points the first non clusterized hit.

The hit iterator refers to a data structure which should conform with the match operator.

Parameters
__beginbegin of data
__endend of data
matchbinary match operator
Returns
end of data

Definition at line 171 of file JAlgorithm.hh.

174 {
175 using namespace std;
176
177 const int N = distance(__begin,__end);
178
179 JHitIterator_t buffer = __begin;
180
181 if (N != 0) {
182
183 int i, j;
184
185 // Determine number of associated hits for each hit.
186
187 std::vector<int> count(N, 1); // Assume always a match with itself.
188
189 for (i = 0; i != N; ++i) {
190 for (j = 0; j != i; ++j) {
191 if (match(buffer[i], buffer[j])) {
192 ++count[i];
193 ++count[j];
194 }
195 }
196 }
197
198 // Keep hit with the largest number of associated hits.
199 // This procedure stops when the number of associated hits is equal to one.
200
201 for (int n = 0; ; ++n) {
202
203 j = n;
204
205 for (i = j; ++i != N; ) {
206 if (count[i] > count[j]) {
207 j = i;
208 }
209 }
210
211 // Ready?
212
213 if (count[j] == 1) {
214 return buffer + n;
215 }
216
217 // Swap the selected hit to begin.
218
219 swap(buffer[j], buffer[n]);
220 swap(count [j], count [n]);
221
222 // Decrease number of associated hits for each associated hit.
223
224 for (i = n; ++i != N; ) {
225 if (match(buffer[i], buffer[n])) {
226 --count[i];
227 --count[n];
228 }
229 }
230 }
231 }
232
233 return buffer;
234 }

◆ clusterizeWeight()

template<class JHitIterator_t , class JMatch_t >
JHitIterator_t JTRIGGER::clusterizeWeight ( JHitIterator_t __begin,
JHitIterator_t __end,
const JMatch_t & match )
inline

Partition data according given binary match operator.

The underlying algorithm is known in literature as reverse 'clique'. The result is (likely to be) the maximal sub-set with all elements matched to each other. The complexity is quadratic, i.e. at most (number of elements x number of elements) operations. The algorithm will sort the data such that all clusterized hits are at the front. The return value points the first non clusterized hit. Note that the weight is assumed to be positive definite and the larger the weight the better.

The hit iterator refers to a data structure which should conform with the match operator. In addition, it should have the following member method:

  • double getW(); // [a.u.]
Parameters
__beginbegin of data
__endend of data
matchbinary match operator
Returns
end of data

Definition at line 257 of file JAlgorithm.hh.

260 {
261 using namespace std;
262
263 const int N = distance(__begin,__end);
264
265 JHitIterator_t buffer = __begin;
266
267 if (N != 0) {
268
269 int i, j;
270
271 // Determine weight of each hit.
272
273 std::vector<double> weight(N);
274
275 for (i = 0; i != N; ++i) {
276 weight[i] = buffer[i].getW(); // Assume always a match with itself.
277 }
278
279 for (i = 0; i != N; ++i) {
280 for (j = i; ++j != N; ) {
281 if (match(buffer[i], buffer[j])) {
282 weight[i] += buffer[j].getW();
283 weight[j] += buffer[i].getW();
284 }
285 }
286 }
287
288 // Remove hit with the smallest weight of associated hits.
289 // This procedure stops when the weight of associated hits
290 // is equal to the maximal weight of (remaining) hits.
291
292 int n = N;
293 double W;
294
295 for ( ; ; ) {
296
297 j = 0;
298 W = weight[j];
299
300 for (i = 1; i != n; ++i) {
301 if (weight[i] < weight[j])
302 j = i;
303 else if (weight[i] > W)
304 W = weight[i];
305 }
306
307 // Ready?
308
309 if (weight[j] == W) {
310 return buffer + n;
311 }
312
313 // Reduce effective size.
314
315 --n;
316
317 // Swap the selected hit to end.
318
319 swap(buffer[j], buffer[n]);
320 swap(weight[j], weight[n]);
321
322 // Decrease weight of associated hits for each associated hit.
323
324 for (i = 0; i != n && weight[n] > buffer[n].getW(); ++i) {
325 if (match(buffer[i], buffer[n])) {
326 weight[i] -= buffer[n].getW();
327 weight[n] -= buffer[i].getW();
328 }
329 }
330 }
331 }
332
333 return buffer;
334 }

◆ weightSorter()

template<class JHit_t >
bool JTRIGGER::weightSorter ( const JHit_t & first,
const JHit_t & second )
inline

Compare two hits by weight.

The template argument JHit_t refers to a data structure which should have the following member method:

  • double getW(); // [a.u.]
Parameters
firstfirst hit
secondsecond hit
Returns
true if first hit has larger weight than second; else false

Definition at line 348 of file JAlgorithm.hh.

349 {
350 return first.getW() > second.getW();
351 }

◆ timeSorter()

template<class JHit_t >
bool JTRIGGER::timeSorter ( const JHit_t & first,
const JHit_t & second )
inline

Compare two hits by weight.

The template argument JHit_t refers to a data structure which should have the following member methods:

  • double getT(); // [a.u.]
Parameters
firstfirst hit
secondsecond hit
Returns
true if first hit earlier than second; else false

Definition at line 365 of file JAlgorithm.hh.

366 {
367 return first.getT() < second.getT();
368 }

◆ JBind2nd()

template<class JHit_t >
JBinder2nd< JHit_t > JTRIGGER::JBind2nd ( const JMatch< JHit_t > & match,
const JHit_t & second )
inline

Auxiliary method to create JBinder2nd object.

Parameters
matchmatch operator
secondsecond hit
Returns
JBinder2nd

Definition at line 66 of file JBind2nd.hh.

67 {
68 return JBinder2nd<JHit_t>(match, second);
69 }
Auxiliary class to convert binary JMatch operator and given hit to unary match operator.
Definition JBind2nd.hh:24

◆ operator<() [1/5]

bool JTRIGGER::operator< ( const JEvent & first,
const JEvent & second )
inline

Less than operator for events.

The less than operator is applied to the first hit in the events.

Parameters
firstfirst event
secondsecond event
Returns
true if first event earliear than second; else false

Definition at line 215 of file JTrigger/JEvent.hh.

216 {
217 if (first.empty() || second.empty()) {
218 throw JTriggerException("Comparison with empty event(s).");
219 }
220
221 return first.begin()->getT() < second.begin()->getT();
222 }

◆ getTimeRange() [1/3]

JTimeRange JTRIGGER::getTimeRange ( const JEvent & event)
inline

Get time range (i.e. earlist and latest hit time) of triggered event.

Parameters
eventevent
Returns
time range

Definition at line 26 of file JEventToolkit.hh.

27 {
28 if (!event.empty())
29 return JTimeRange(event.begin()->getT(), event.rbegin()->getT());
30 else
32 }
static JRange< double, std::less< double > > DEFAULT_RANGE()
Definition JRange.hh:555
JTOOLS::JRange< double > JTimeRange
Type definition for time range (unit [s]).

◆ operator<() [2/5]

bool JTRIGGER::operator< ( const JHit & first,
const JHit & second )
inline

Less than operator for hits.

The less than operator is applied to the time of the hits.

Parameters
firstfirst hit
secondsecond hit
Returns
true if first hit earlier; else false

Definition at line 231 of file JTrigger/JHit.hh.

232 {
233 return first.getT() < second.getT();
234 }
double getT() const
Get calibrated time of hit.

◆ operator<() [3/5]

bool JTRIGGER::operator< ( const JHit & hit,
const double t1 )
inline

Less than operator for hits.

The less than operator is applied to the time of the hits.

Parameters
hithit
t1time [ns]
Returns
true if hit earlier than t; else false

Definition at line 246 of file JTrigger/JHit.hh.

247 {
248 return hit.getT() < t1;
249 }

◆ operator==() [1/3]

bool JTRIGGER::operator== ( const JHit & first,
const JHit & second )
inline

Equal operator for hits.

The equal operator is applied to the time of the hits.

Parameters
firsthit
secondhit
Returns
true if first hit time equal to second hit time; else false

Definition at line 261 of file JTrigger/JHit.hh.

262 {
263 return first.getT() == second.getT();
264 }

◆ getCount() [1/2]

template<class T >
int JTRIGGER::getCount ( const T & hit)
inline

Get hit count.

The hit refers to a data structure which should have the following member method:

  • int getN();
Parameters
hithit
Returns
count

Definition at line 277 of file JTrigger/JHit.hh.

278 {
279 return hit.getN();
280 }

◆ getCount() [2/2]

template<class T >
int JTRIGGER::getCount ( T __begin,
T __end )
inline

Get hit count.

The hit iterator refers to a data structure which should have the following member method:

  • int getN();
Parameters
__beginbegin of data
__endend of data
Returns
count

Definition at line 294 of file JTrigger/JHit.hh.

295 {
296 int count = 0;
297
298 for (T hit = __begin; hit !=__end; ++hit) {
299 count += getCount(*hit);
300 }
301
302 return count;
303 }

◆ getTime()

double JTRIGGER::getTime ( const JDAQHit & hit,
const JCalibration & cal )
inline

Get calibrated time of DAQ hit.

Parameters
hitDAQ hit
calcalibration
Returns
time [ns]

Definition at line 34 of file JHitToolkit.hh.

35 {
36 return getTime(hit.getT(), cal);
37 }
JTDC_t getT() const
Get time.
Definition JDAQHit.hh:86
const char * getTime()
Get current local time conform ISO-8601 standard.

◆ getToT()

double JTRIGGER::getToT ( const JDAQHit & hit,
const JCalibration & cal )
inline

Get calibrated time-over-threshold of DAQ hit.

Parameters
hitDAQ hit
calcalibration
Returns
time-over-threshold [ns]

Definition at line 47 of file JHitToolkit.hh.

48 {
49 return getToT(hit.getToT(), cal);
50 }
JTOT_t getToT() const
Get time-over-threshold.
Definition JDAQHit.hh:97
double getToT(const T &tot, const JCalibration &cal)
Get calibrated time-over-threshold of hit.

◆ make_match()

template<class JHit_t >
JMatchHelper< JHit_t > JTRIGGER::make_match ( bool(* match )(const JHit_t &, const JHit_t &))

Auxiliary method to make JMatch object based on pointer to match function.

Parameters
matchpointer to match function
Returns
match object

Definition at line 115 of file JMatch.hh.

116 {
117 return JMatchHelper<JHit_t>(match);
118 }
Auxiliary class to handle pointer to match function.
Definition JMatch.hh:76

◆ operator==() [2/3]

bool JTRIGGER::operator== ( const JPMTIdentifier_t & first,
const JPMTIdentifier_t & second )
inline

Equal operator for PMT identifiers.

Parameters
firstPMT identifier
secondPMT identifier
Returns
true if first PMT equal second PMT; else false

Definition at line 169 of file JPMTIdentifier_t.hh.

170 {
171 return (first.getModuleID() == second.getModuleID() &&
172 first.getPMTAddress() == second.getPMTAddress());
173 }
int getPMTAddress() const
Get PMT address.
int getModuleID() const
Get module identifier.

◆ operator<() [4/5]

bool JTRIGGER::operator< ( const JPMTIdentifier_t & first,
const JPMTIdentifier_t & second )
inline

Less than operator for PMT identifiers.

The less than operator is applied first to the module identifer and then to the PMT address.

Parameters
firstPMT identifier
secondPMT identifier
Returns
true if first PMT lower than second PMT; else false

Definition at line 185 of file JPMTIdentifier_t.hh.

186 {
187 if (first.getModuleID() == second.getModuleID())
188 return first.getPMTAddress() < second.getPMTAddress();
189 else
190 return first.getModuleID() < second.getModuleID();
191 }

◆ getPMTMask()

JPMTMask_t JTRIGGER::getPMTMask ( const unsigned int bit)
inline

Convert PMT bit to PMT mask.

Parameters
bitPMT bit
Returns
PMT mask

Definition at line 44 of file JPMTMask.hh.

45 {
46 if (bit < NUMBER_OF_PMT_BITS)
47 return JPMTMask_t(1) << bit;
48 else
49 return 0;
50 }
unsigned int JPMTMask_t
Type definition of PMT mask.
Definition JPMTMask.hh:29

◆ setTriggerBit() [1/4]

JTRIGGER::setTriggerBit ( JTrigger3DShower ,
JTRIGGER3DSHOWER  )

◆ setTriggerBit() [2/4]

JTRIGGER::setTriggerBit ( JTriggerMXShower ,
JTRIGGERMXSHOWER  )

◆ setTriggerBit() [3/4]

JTRIGGER::setTriggerBit ( JTrigger3DMuon ,
JTRIGGER3DMUON  )

◆ setTriggerBit() [4/4]

JTRIGGER::setTriggerBit ( JTriggerNB ,
JTRIGGERNB  )

◆ operator<() [5/5]

bool JTRIGGER::operator< ( const JTriggeredHit & first,
const JTriggeredHit & second )
inline

Less than operator for triggered hits.

The less than operator is applied first to JTRIGGER::JHit and then to the KM3NETDAQ::JDAQPMTIdentifier. Hence, the ordering by JTRIGGER::JHit is maintained. This allows for the use of STL sort() and set_union() algorithms.

Parameters
firstfirst hit
secondsecond hit
Returns
true if first hit earlier or lower PMT identifier if equal; else false

Definition at line 86 of file JTriggeredHit.hh.

87 {
88 if (std::equal_to<JHit>()(first,second))
89 return std::less<JDAQPMTIdentifier>()(first,second);
90 else
91 return std::less<JHit> ()(first,second);
92 }

◆ operator==() [3/3]

bool JTRIGGER::operator== ( const JTriggeredHit & first,
const JTriggeredHit & second )
inline

Equal operator for triggered hits.

The equal operator is applied to JTRIGGER::JHit and to the KM3NETDAQ::JDAQPMTIdentifier.

Parameters
firstfirst hit
secondsecond hit
Returns
true if first hit equal second hit; else false

Definition at line 104 of file JTriggeredHit.hh.

105 {
106 return (std::equal_to<JDAQPMTIdentifier>()(first,second) &&
107 std::equal_to<JHit> ()(first,second));
108 }

◆ getTriggerBit() [1/2]

template<class JTrigger_t >
JTriggerbit_t JTRIGGER::getTriggerBit ( )
inline

Get the trigger bit.

Returns
trigger bit

Definition at line 206 of file JTriggerInterface.hh.

207 {
209 }
This class is used to map trigger class to trigger bit.

◆ getTriggerBit() [2/2]

template<class JTrigger_t >
JTriggerbit_t JTRIGGER::getTriggerBit ( const JTrigger_t & event)
inline

Get the trigger bit.

Parameters
eventtriggered event
Returns
trigger bit

Definition at line 219 of file JTriggerInterface.hh.

220 {
222 }

◆ getTriggerName()

const char * JTRIGGER::getTriggerName ( JTriggerbit_t bit)
inline

Get trigger name.

param bit trigger bit

Returns
trigger name

Definition at line 231 of file JTriggerInterface.hh.

232 {
234 }
static const char * getTriggerName()
Get trigger name.

◆ setAttributes()

void JTRIGGER::setAttributes ( const JModule & first,
const JModule & second,
JAttributes & attributes )
inline

Set module attributes.

Parameters
firstfirst module
secondsecond module
attributesmodule attributes

Definition at line 54 of file JTriggerMXShower.hh.

57 {
58 using namespace JPP;
59
60 typedef JTriggerMXShower_t::JParameters JParameters_t;
61
62 // get trigger parameters
63
64 const JParameters_t& parameters = JParametersHelper<JParameters_t>::getParameters();
65
66 const double d = getDistance(first.getPosition(), second.getPosition());
67
68 double t1 = 0.0;
69
70 if (d <= 0.5 * parameters.DMax_m)
71 t1 = d * getIndexOfRefraction() * getInverseSpeedOfLight() + parameters.TMaxExtra_ns;
72 else if (d <= parameters.DMax_m)
73 t1 = (parameters.DMax_m - d) * getIndexOfRefraction() * getInverseSpeedOfLight() + parameters.TMaxExtra_ns;
74
75 attributes.Tmin_ns = -t1;
76 attributes.Tmax_ns = +t1;
77 }
const JPosition3D & getPosition() const
Get position.
double getDistance(const JFirst_t &first, const JSecond_t &second)
Get distance between objects.
double getIndexOfRefraction()
Get average index of refraction of water corresponding to group velocity.
const double getInverseSpeedOfLight()
Get inverse speed of light.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
double Tmin_ns
minimal time difference [ns]
double Tmax_ns
maximal time difference [ns]
static const JParameters_t & getParameters()
Get latest parameters.

◆ randomize() [1/5]

void JTRIGGER::randomize ( JTrigger3DMuon_t::JParameters * p)
inline

Randomize trigger parameters.

Parameters
ppointer to valid object

Definition at line 26 of file JTriggerTestkit.hh.

27 {
29 p->numberOfHits = getRandom<int>(1, 10);
31 p->DMax_m = getRandom<double>( 0.0, 999.0, 1.0);
32 p->roadWidth_m = getRandom<double>(50.0, 250.0, 1.0);
33 p->gridAngle_deg = getRandom<double>( 1.0, 10.0, 1.0);
34 p->TMaxExtra_ns = getRandom<double>(10.0, 50.0, 1.0);
35 p->factoryLimit = getRandom<double>(100, 200);
36 }
double TMaxExtra_ns
maximal extra time [ns]
double DMax_m
maximal distance between PMTs [m]
double roadWidth_m
maximal road width [m]
int numberOfModules
minimal number of modules to trigger event
bool enabled
enabled status of trigger
int factoryLimit
maximal number of hits to apply trigger logic (above this limit, always trigger)
int numberOfHits
minimal number of hits to trigger event
T getRandom()
Get random value.

◆ randomize() [2/5]

void JTRIGGER::randomize ( JTrigger3DShower_t::JParameters * p)
inline

Randomize trigger parameters.

Parameters
ppointer to valid object

Definition at line 44 of file JTriggerTestkit.hh.

45 {
47 p->numberOfHits = getRandom<int>(1, 10);
49 p->DMax_m = getRandom<double>( 0.0, 999.0, 1.0);
50 p->TMaxExtra_ns = getRandom<double>(10.0, 50.0, 1.0);
51 p->factoryLimit = getRandom<double>(100, 200);
52 }
int factoryLimit
maximal number of hits to apply trigger logic (above this limit, always trigger
double DMax_m
maximal distance between PMTs [m]
int numberOfModules
minimal number of modules to trigger event
int numberOfHits
minimal number of hits to trigger event

◆ randomize() [3/5]

void JTRIGGER::randomize ( JTriggerMXShower_t::JParameters * p)
inline

Randomize trigger parameters.

Parameters
ppointer to valid object

Definition at line 60 of file JTriggerTestkit.hh.

61 {
63 p->numberOfHits = getRandom<int>(1, 10);
65 p->DMax_m = getRandom<double>( 0.0, 999.0, 1.0);
66 p->TMaxExtra_ns = getRandom<double>(10.0, 50.0, 1.0);
67 p->factoryLimit = getRandom<double>(100, 200);
68 }
double DMax_m
maximal distance between PMTs [m]
int factoryLimit
maximal number of hits to apply trigger logic (above this limit, always trigger)
int numberOfHits
minimal number of hits to trigger event
int numberOfModules
minimal number of modules to trigger event

◆ randomize() [4/5]

void JTRIGGER::randomize ( JTriggerNB_t::JParameters * p)
inline

Randomize trigger parameters.

Parameters
ppointer to valid object

Definition at line 76 of file JTriggerTestkit.hh.

77 {
79
80 p->pmts.clear();
81
82 for (int i = getRandom<int>(1, 10); i != 0; --i) {
83 p->pmts.push_back(JPMTIdentifier_t(getRandom<int>(-1, 100),
84 getRandom<int>(-1, 30)));
85 }
86 }
bool enabled
enabled status of trigger
JPMTSelector pmts
PMT selection.

◆ randomize() [5/5]

void JTRIGGER::randomize ( JTriggerParameters * p)
inline

Randomize trigger parameters.

Parameters
ppointer to valid object

Definition at line 94 of file JTriggerTestkit.hh.

95 {
96 p->highRateVeto_Hz = getRandom<double>(1.0e3, 1.0e4, 1.0);
97 p->L2Min = getRandom<int>(2, 3);
98 p->ctMin = getRandom<double>( -1.0, +1.0, 0.1);
99 p->TMaxLocal_ns = getRandom<double>( 10.0, 20.0, 1.0);
100 p->TMaxEvent_ns = getRandom<double>(100.0, 999.0, 1.0);
101 p->numberOfBins = getRandom<int>(100, 1000);
103
108
114 }
int L2Min
minimal number of L0 hits for L2
int numberOfBins
number of bins for lookup table of timeslice
JPrescaler writeL0
write JDAQTimeslice with L0 data
double TMaxLocal_ns
maximal time difference between L0 hits for L1
JPrescaler writeL1
write JDAQTimeslice with L1 data
JPrescaler writeSummary
write JDAQSummaryslice
JPrescaler writeL2
write JDAQTimeslice with L2 data
JTrigger3DShower_t::JParameters trigger3DShower
JTrigger3DMuon_t::JParameters trigger3DMuon
JPrescaler writeSN
write JDAQTimeslice with SN data
double TMaxEvent_ns
maximal time before and after event for snapshot
double ctMin
this parameter has been deprecated
bool combineL1
combine multiple L1s in many-fold coincidence
JTriggerMXShower_t::JParameters triggerMXShower

◆ getTimeRange() [2/3]

JTimeRange JTRIGGER::getTimeRange ( const JTriggerParameters & parameters)
inline

Get time range of snapshot.

Parameters
parameterstrigger parameters
Returns
time range [ns]

Definition at line 40 of file JTriggerToolkit.hh.

41 {
42 return JTimeRange(-parameters.TMaxEvent_ns,
43 +parameters.TMaxEvent_ns);
44 }

◆ getTimeRange() [3/3]

JTimeRange JTRIGGER::getTimeRange ( const JTriggerNB_t::JParameters & parameters)
inline

Get time range of snapshot.

Parameters
parameterstrigger parameters
Returns
time range [ns]

Definition at line 52 of file JTriggerToolkit.hh.

53 {
54 using namespace JPP;
55
56 return JTimeRange(0.0, parameters.DMax_m * getIndexOfRefraction() * getInverseSpeedOfLight());
57 }
double DMax_m
maximal distance between PMTs [m]

◆ getDAQStatus() [1/2]

bool JTRIGGER::getDAQStatus ( const JDAQFrameStatus & frame,
const JStatus & status )
inline

Test status of DAQ.

The DAQ test passes if the assembly of UDP packets is complete.
The test can be bypassed using the PMT control status.

Parameters
framedata frame status
statusPMT control status
Returns
true if test passes; else false

Definition at line 70 of file JTriggerToolkit.hh.

71 {
72 return ((status.has(UDP_COUNTER_DISABLE) || (frame.getUDPNumberOfReceivedPackets() == frame.getUDPMaximalSequenceNumber() + 1)) &&
73 (status.has(UDP_TRAILER_DISABLE) || (frame.hasUDPTrailer())));
74 }
int getUDPNumberOfReceivedPackets() const
Get number of received UDP packets.
bool hasUDPTrailer() const
Get UDP trailer status.
int getUDPMaximalSequenceNumber() const
Get maximal sequence number of UDP packet.
static const int UDP_COUNTER_DISABLE
Enable (disable) use of UDP packet counter test if this status bit is 0 (1);.
Definition pmt_status.hh:15
static const int UDP_TRAILER_DISABLE
Enable (disable) use of UDP packet trailer test if this status bit is 0 (1);.
Definition pmt_status.hh:16
bool has(const int bit) const
Test PMT status.
Definition JStatus.hh:120

◆ getDAQStatus() [2/2]

bool JTRIGGER::getDAQStatus ( const JDAQFrameStatus & frame,
const JModule & module,
const int pmt )
inline

Test status of DAQ.

The DAQ test passes if the assembly of UDP packets is complete.
The test can be bypassed using the PMT control status.

Parameters
framedata frame status
modulemodule
pmtPMT number
Returns
true if test passes; else false

Definition at line 88 of file JTriggerToolkit.hh.

89 {
90 return getDAQStatus(frame, module.getPMT(pmt));
91 }
const JPMT & getPMT(const int index) const
Get PMT.
Definition JModule.hh:172
bool getDAQStatus(const JDAQFrameStatus &frame, const JStatus &status)
Test status of DAQ.

◆ getPMTStatus() [1/3]

bool JTRIGGER::getPMTStatus ( const JStatus & status)
inline

Test status of PMT.

The PMT test passes if it is not disabled.

Parameters
statusPMT control status
Returns
true if test passes; else false

Definition at line 102 of file JTriggerToolkit.hh.

103 {
104 return !status.has(PMT_DISABLE);
105 }
static const int PMT_DISABLE
KM3NeT Data Definitions v3.6.0 https://git.km3net.de/common/km3net-dataformat.
Definition pmt_status.hh:12

◆ getPMTStatus() [2/3]

bool JTRIGGER::getPMTStatus ( const JDAQFrameStatus & frame,
const JStatus & status,
const int pmt )
inline

Test status of PMT.

The PMT test passes if it is not disabled and no high-rate veto or FIFO (almost) full.
The test can be bypassed using the PMT control status.

Parameters
framedata frame
statusPMT control status
pmtPMT number
Returns
true if test passes; else false

Definition at line 119 of file JTriggerToolkit.hh.

120 {
121 return ((status.has(HIGH_RATE_VETO_DISABLE) || !frame.testHighRateVeto(pmt)) &&
122 (status.has(FIFO_FULL_DISABLE) || !frame.testFIFOStatus (pmt)) &&
123 (getPMTStatus(status)));
124 }
bool testFIFOStatus() const
Test FIFO status.
bool testHighRateVeto() const
Test high-rate veto status.
bool getPMTStatus(const JStatus &status)
Test status of PMT.
static const int FIFO_FULL_DISABLE
Enable (disable) use of FIFO (almost) full test if this status bit is 0 (1);.
Definition pmt_status.hh:14
static const int HIGH_RATE_VETO_DISABLE
Enable (disable) use of high-rate veto test if this status bit is 0 (1);.
Definition pmt_status.hh:13

◆ getPMTStatus() [3/3]

bool JTRIGGER::getPMTStatus ( const JDAQFrameStatus & frame,
const JModule & module,
const int pmt )
inline

Test status of PMT.

The PMT test passes if it is not disabled and no high-rate veto or FIFO (almost) full.
The test can be bypassed using the PMT control status.

Parameters
framedata frame
modulemodule
pmtPMT number
Returns
true if test passes; else false

Definition at line 138 of file JTriggerToolkit.hh.

139 {
140 return getPMTStatus(frame, module.getPMT(pmt), pmt);
141 }

◆ getRate()

double JTRIGGER::getRate ( const JDAQSummaryFrame & frame,
const int pmt,
const double factor = 1.0 )
inline

Get corrected rate of PMT.

The measured rate is corrected for the possible loss of UDP packets.

Parameters
framedata frame
pmtPMT number
factorscaling factor
Returns
rate x scaling factor [Hz]

Definition at line 154 of file JTriggerToolkit.hh.

155 {
156 double rate_Hz = frame.getRate(pmt, factor);
157
158 // correct measured rate for UDP packet loss
159
160 const int n1 = frame.getUDPNumberOfReceivedPackets();
161 const int n2 = frame.getUDPMaximalSequenceNumber ();
162
163 if (n1 < n2 + 1) {
164 rate_Hz *= (double) (n2 + 1) / (double) n1;
165 }
166
167 return rate_Hz;
168 }
double getRate(const int tdc, const double factor=1.0) const
Get count rate.

Variable Documentation

◆ MAXIMAL_FRAME_SIZE

int JTRIGGER::MAXIMAL_FRAME_SIZE = std::numeric_limits<int>::max()
static

Maximal frame size.

Definition at line 35 of file JChecksum.hh.

◆ checksum

const JChecksum JTRIGGER::checksum
static

Function object to perform check-sum of raw data.

Definition at line 200 of file JChecksum.hh.

◆ getRiseTime

const JGetRiseTime JTRIGGER::getRiseTime
static

Function object for rise time evaluation.

Definition at line 313 of file JGetRiseTime.hh.

◆ getNumberOfModules

const JModuleCounter JTRIGGER::getNumberOfModules
static

Function object to count unique modules.

Definition at line 67 of file JModuleCounter.hh.

◆ NUMBER_OF_PMT_BITS

const unsigned int JTRIGGER::NUMBER_OF_PMT_BITS = 31
static

Number of PMT bits.

Definition at line 35 of file JPMTMask.hh.