Project
Loading...
Searching...
No Matches
Trigger.h
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
17
18#ifndef DETECTORS_HMPID_BASE_INCLUDE_HMPIDBASE_TRIGGER_H_
19#define DETECTORS_HMPID_BASE_INCLUDE_HMPIDBASE_TRIGGER_H_
20
21#include <iosfwd>
24
25namespace o2
26{
27namespace hmpid
28{
32{
34
35 public:
36 static inline uint64_t getTriggerID(uint32_t Orbit, uint16_t BC) { return ((Orbit << 12) | (0x0FFF & BC)); };
37
38 public:
39 Trigger() = default;
40 Trigger(InteractionRecord ir, int32_t first, int32_t n) : mIr(ir), mDataRange(first, n) {}
41
42 const InteractionRecord& getIr() const { return mIr; };
43 uint32_t getOrbit() const { return mIr.orbit; };
44 uint16_t getBc() const { return mIr.bc; };
45 uint64_t getTriggerID() const { return ((mIr.orbit << 12) | (0x0FFF & mIr.bc)); };
46 void setDataRange(int firstentry, int nentries) { mDataRange.set(firstentry, nentries); }
47 int getNumberOfObjects() const { return mDataRange.getEntries(); }
48 int getFirstEntry() const { return mDataRange.getFirstEntry(); }
49 int getLastEntry() const { return mDataRange.getFirstEntry() + mDataRange.getEntries() - 1; }
50 void setOrbit(uint32_t orbit)
51 {
52 mIr.orbit = orbit;
53 return;
54 }
55 void setBC(uint16_t bc)
56 {
57 mIr.bc = bc;
58 return;
59 }
60 void setTriggerID(uint64_t trigger)
61 {
62 mIr.orbit = (trigger >> 12);
63 mIr.bc = (trigger & 0x0FFF);
64 return;
65 }
66
67 // Operators definition !
68 friend inline bool operator<(const Trigger& l, const Trigger& r) { return l.getTriggerID() < r.getTriggerID(); };
69 friend inline bool operator==(const Trigger& l, const Trigger& r) { return l.getTriggerID() == r.getTriggerID(); };
70 friend inline bool operator>(const Trigger& l, const Trigger& r) { return r < l; };
71 friend inline bool operator<=(const Trigger& l, const Trigger& r) { return !(l > r); };
72 friend inline bool operator>=(const Trigger& l, const Trigger& r) { return !(l < r); };
73 friend inline bool operator!=(const Trigger& l, const Trigger& r) { return !(l == r); };
74
75 // Digit ASCII format (Orbit,BunchCrossing)[LHC Time nSec]
76 friend std::ostream& operator<<(std::ostream& os, const Trigger& d);
77
78 private:
79 // Members
81 DataRange mDataRange;
82
83 ClassDefNV(Trigger, 2);
84};
85
86} // namespace hmpid
87} // namespace o2
88
89#endif /* DETECTORS_HMPID_BASE_INCLUDE_HMPIDBASE_TRIGGER_H_ */
uint64_t orbit
Definition RawEventData.h:6
uint64_t bc
Definition RawEventData.h:5
Class to refer to the 1st entry and N elements of some group in the continuous container.
HMPID Trigger declaration.
Definition Trigger.h:32
friend std::ostream & operator<<(std::ostream &os, const Trigger &d)
Definition Trigger.cxx:34
uint64_t getTriggerID() const
Definition Trigger.h:45
void setTriggerID(uint64_t trigger)
Definition Trigger.h:60
friend bool operator>(const Trigger &l, const Trigger &r)
Definition Trigger.h:70
void setDataRange(int firstentry, int nentries)
Definition Trigger.h:46
static uint64_t getTriggerID(uint32_t Orbit, uint16_t BC)
Definition Trigger.h:36
Trigger(InteractionRecord ir, int32_t first, int32_t n)
Definition Trigger.h:40
void setBC(uint16_t bc)
Definition Trigger.h:55
friend bool operator!=(const Trigger &l, const Trigger &r)
Definition Trigger.h:73
uint16_t getBc() const
Definition Trigger.h:44
friend bool operator<(const Trigger &l, const Trigger &r)
Definition Trigger.h:68
int getFirstEntry() const
Definition Trigger.h:48
friend bool operator>=(const Trigger &l, const Trigger &r)
Definition Trigger.h:72
uint32_t getOrbit() const
Definition Trigger.h:43
friend bool operator<=(const Trigger &l, const Trigger &r)
Definition Trigger.h:71
const InteractionRecord & getIr() const
Definition Trigger.h:42
int getLastEntry() const
Definition Trigger.h:49
friend bool operator==(const Trigger &l, const Trigger &r)
Definition Trigger.h:69
int getNumberOfObjects() const
Definition Trigger.h:47
void setOrbit(uint32_t orbit)
Definition Trigger.h:50
GLdouble n
Definition glcorearb.h:1982
GLboolean r
Definition glcorearb.h:1233
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
uint32_t orbit
LHC orbit.
uint16_t bc
bunch crossing ID of interaction
o2::InteractionRecord ir(0, 0)