ATLAS Offline Software
Loading...
Searching...
No Matches
CTPResult_v1.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
5
6// System include(s):
7#include <iostream>
8#include <stdexcept>
9
10// xAOD include(s):
12
13// Local include(s):
15
16namespace xAOD {
17
18 // get/set the number of the CTP version to be used
19 AUXSTORE_PRIMITIVE_SETTER_AND_GETTER(CTPResult_v1, uint32_t, ctpVersionNumber, setCtpVersionNumber);
20
21 // Get/set the header marker word
23
24 // Get/set the number of header words
26
27 // Get/set the version of header format
28 AUXSTORE_PRIMITIVE_SETTER_AND_GETTER(CTPResult_v1, uint32_t, headerFormatVersion, setHeaderFormatVersion);
29
30 // Get/set the sub detector source ID
32
33 // Get/set the run number
35
36 // Get/set the extended LVL1 ID
38
39 // Get/set the bunch crossing ID
41
42 // Get/set the LVL1 trigger type
44
45 // Get/set the LVL1 event type
47
48 // get/set the vector TIP words for all bunch crossings
49 AUXSTORE_OBJECT_SETTER_AND_GETTER(CTPResult_v1, std::vector<std::vector<uint32_t>>, tipWords, setTIPWords)
50
51 // get/set the vector TBP words for all bunch crossings
52 AUXSTORE_OBJECT_SETTER_AND_GETTER(CTPResult_v1, std::vector<std::vector<uint32_t>>, tbpWords, setTBPWords)
53
54 // get/set the vector TAP words for all bunch crossings
55 AUXSTORE_OBJECT_SETTER_AND_GETTER(CTPResult_v1, std::vector<std::vector<uint32_t>>, tapWords, setTAPWords)
56
57 // get/set the vector TAV words for all bunch crossings
58 AUXSTORE_OBJECT_SETTER_AND_GETTER(CTPResult_v1, std::vector<std::vector<uint32_t>>, tavWords, setTAVWords)
59
60 // get the time stamp in seconds
62
63 // get the time stamp in nanoseconds
65
66 // get/set the raw data words
67 AUXSTORE_OBJECT_SETTER_AND_GETTER(CTPResult_v1, std::vector<uint32_t>, additionalWords, setAdditionalWords)
68
69 // get/set the turn counter
70 AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( CTPResult_v1, uint32_t, turnCounter, setTurnCounter )
71
72 // Get/set the error status word
74
75 // Get/set the info status word
77
78 // Get/set the number of status words
79 AUXSTORE_PRIMITIVE_SETTER_AND_GETTER(CTPResult_v1, uint32_t, numStatusWords, setNumStatusWords);
80
81 // Get/set the number data words
83
84 // Get/set the position of status information in ROD (LVL1 assumes 1)
85 AUXSTORE_PRIMITIVE_SETTER_AND_GETTER(CTPResult_v1, uint32_t, statusPosition, setStatusPosition);
86
87 // get the number of bunches
89
90 // get the L1 Accept Bunch Position
91 AUXSTORE_PRIMITIVE_GETTER(CTPResult_v1, uint32_t, l1AcceptBunchPosition)
92
93 // Get the CTPBunchCrossing object for a specific bunch in the readout window. Returns L1A bunch by default.
95 int idx;
96 if (bunch == -1) {
98 } else {
99 idx = bunch;
100 }
102 bc.tipWords = tipWords()[idx];
103 bc.tbpWords = tbpWords()[idx];
104 bc.tapWords = tapWords()[idx];
105 bc.tavWords = tavWords()[idx];
106 return bc;
107 }
108
109 // set the number of bunches
111 if(nBCs > tipWords().size()) {
112 static const SG::AuxElement::Accessor< uint32_t > accNumOfBunches("numberOfBunches");
113 static const SG::AuxElement::Accessor< std::vector<std::vector<uint32_t> > > accTIPWords("tipWords");
114 static const SG::AuxElement::Accessor< std::vector<std::vector<uint32_t> > > accTBPWords("tbpWords");
115 static const SG::AuxElement::Accessor< std::vector<std::vector<uint32_t> > > accTAPWords("tapWords");
116 static const SG::AuxElement::Accessor< std::vector<std::vector<uint32_t> > > accTAVWords("tavWords");
117 accNumOfBunches( *this ) = nBCs;
118 accTIPWords( *this ).resize(nBCs);
119 accTBPWords( *this ).resize(nBCs);
120 accTAPWords( *this ).resize(nBCs);
121 accTAVWords( *this ).resize(nBCs);
122 }
123 }
124
125 // set the L1 Accept Bunch Position
127 if (numberOfBunches() == 1 && pos > 0) {pos=0;}
128 static const SG::Accessor<uint32_t> acc("l1AcceptBunchPosition");
129 acc(*this) = pos;
130 }
131
132 // Get TIP words for a specific bunch crossing
133 std::vector<uint32_t> CTPResult_v1::getTIPWords(const int bunch) const {
134 return getBC(bunch).tipWords;
135 }
136
137 // Get TBP words for a specific bunch crossing
138 std::vector<uint32_t> CTPResult_v1::getTBPWords(const int bunch) const {
139 return getBC(bunch).tbpWords;
140 }
141
142 // Get TAP words for a specific bunch crossing
143 std::vector<uint32_t> CTPResult_v1::getTAPWords(const int bunch) const {
144 return getBC(bunch).tapWords;
145 }
146
147 // Get TAV words for a specific bunch crossing
148 std::vector<uint32_t> CTPResult_v1::getTAVWords(const int bunch) const {
149 return getBC(bunch).tavWords;
150 }
151
152 // Get a vector of header words
153 const std::vector<uint32_t> CTPResult_v1::header() const {
154 return {
155 headerMarker(),
156 headerSize(),
158 sourceID(),
159 runNumber(),
160 L1ID(),
161 BCID(),
162 triggerType(),
163 eventType()
164 };
165 }
166
167 // Get the header words
168 void CTPResult_v1::setHeader(const uint32_t marker, const uint32_t version, const uint32_t sourceid, const uint32_t l1id, const uint32_t runNum, const uint32_t bcid, const uint32_t trigType, const uint32_t evtType) {
169 setHeaderMarker(marker);
170 setHeaderSize(8);
171 setHeaderFormatVersion(version);
172 setSourceID(sourceid);
173 setRunNumber(runNum);
174 setL1ID(l1id);
175 setBCID(bcid);
176 setTriggerType(trigType);
177 setEventType(evtType);
178 }
179
180 // Get a vector of trailer words
181 const std::vector<uint32_t> CTPResult_v1::trailer() const {
182 return {
183 errorStatus(),
184 infoStatus(),
186 numDataWords(),
188 };
189 }
190
191 // Set the trailer words
192 void CTPResult_v1::setTrailer(const uint32_t numData, const uint32_t errStat, const uint32_t infoStat, const uint32_t numStat, const uint32_t statPos) {
193 setErrorStatus(errStat);
194 setInfoStatus(infoStat);
195 setNumStatusWords(numStat);
196 setNumDataWords(numData);
197 setStatusPosition(statPos);
198 }
199}
#define AUXSTORE_PRIMITIVE_GETTER(CL, TYPE, NAME)
Macro creating the reader function for a primitive auxiliary property.
#define AUXSTORE_PRIMITIVE_SETTER_AND_GETTER(CL, TYPE, NAME, SETTER)
Macro creating the accessors of primitive auxiliary properties.
#define AUXSTORE_OBJECT_SETTER_AND_GETTER(CL, TYPE, NAME, SETTER)
Macro creating the accessors of complex auxiliary properties.
size_t size() const
Number of registered mappings.
Helper class to provide type-safe access to aux data.
This is the trigger result for each item before prescale, after prescale and after veto.
void setHeaderFormatVersion(const uint32_t word)
Set the format version of the header.
uint32_t numDataWords() const
Retrieve the number of data words.
void setEventType(const uint32_t word)
Set the LVL1 event type.
uint32_t L1ID() const
Retrieve the extended LVL1 ID.
const std::vector< std::vector< uint32_t > > & tbpWords() const
Get the TBP words for all bunch crossings.
void setInfoStatus(const uint32_t word)
Set the info status word.
uint32_t numStatusWords() const
Retrieve the number of status words in the trailer.
const std::vector< std::vector< uint32_t > > & tapWords() const
Get the TAP words for all bunch crossings.
std::vector< uint32_t > getTBPWords(const int bunchPosition=-1) const
Get the TBP (Trigger Before Prescale) words.
void setNumberOfBunches(const uint32_t nBCs)
Set the number of bunch crossings.
uint32_t infoStatus() const
Retrieve the info status word.
uint32_t headerSize() const
Retrieve the number of words in the header.
void setHeader(const uint32_t marker, const uint32_t version, const uint32_t sourceid, const uint32_t l1id=0, const uint32_t runNum=0, const uint32_t bcid=0, const uint32_t trigType=0, const uint32_t evtType=0)
Set the header words.
void setHeaderSize(const uint32_t word)
Set the number of words in the header.
std::vector< uint32_t > getTAPWords(const int bunchPosition=-1) const
Get the TAP (Trigger After Prescale) words.
uint32_t triggerType() const
Retrieve the LVL1 trigger type.
uint32_t runNumber() const
Retrieve the run number.
uint32_t statusPosition() const
Retrieve the position of status information in the ROD.
uint32_t BCID() const
Retrieve the bunch crossing ID.
void setNumStatusWords(const uint32_t word)
Set the number of status words in the trailer.
uint32_t headerFormatVersion() const
Retrieve the format version of the header.
void setHeaderMarker(const uint32_t word)
Set the header marker word.
const std::vector< uint32_t > trailer() const
Get the trailer words.
void setRunNumber(const uint32_t word)
Set the run number.
uint32_t errorStatus() const
Retrieve the error status word.
void setTriggerType(const uint32_t word)
Set the LVL1 trigger type.
void setBCID(const uint32_t word)
Set the bunch crossing ID.
const std::vector< std::vector< uint32_t > > & tipWords() const
Get the TIP words for all bunch crossings.
const std::vector< std::vector< uint32_t > > & tavWords() const
Get the TAV words for all bunch crossings.
void setL1ID(const uint32_t word)
Set the extended LVL1 ID.
void setSourceID(const uint32_t word)
Set the sub-detector source ID.
void setStatusPosition(const uint32_t word)
Set the position of status information in the ROD.
void setTrailer(const uint32_t numData, const uint32_t errStat=0, const uint32_t infoStat=0, const uint32_t numStat=2, const uint32_t statPos=1)
Set the trailer words.
uint32_t eventType() const
Retrieve the LVL1 event type.
void setNumDataWords(const uint32_t num)
Set the number of data words.
uint32_t headerMarker() const
Retrieve the header marker word.
const CTPResult_v1::CTPBunchCrossing getBC(const int bunch=-1) const
Get the CTPBunchCrossing object for a specific bunch in the readout window.
std::vector< uint32_t > getTIPWords(const int bunchPosition=-1) const
Get the TIP (Trigger Inputs to the CTP) words (in Run3 512 items).
std::vector< uint32_t > getTAVWords(const int bunchPosition=-1) const
Get the TAV (Trigger After Veto) words.
uint32_t numberOfBunches() const
Get the number of bunch crossings.
const std::vector< uint32_t > header() const
Get the header words.
void setErrorStatus(const uint32_t word)
Set the error status word.
uint32_t sourceID() const
Retrieve the sub-detector source ID.
void setL1AcceptBunchPosition(uint32_t pos)
Set the L1Accept bunch position.
uint32_t l1AcceptBunchPosition() const
Get the L1 accept bunch position.
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
AUXSTORE_PRIMITIVE_SETTER_AND_GETTER(BTagging_v1, float, IP2D_pb, setIP2D_pb) AUXSTORE_PRIMITIVE_SETTER_AND_GETTER(BTagging_v1
setEventNumber setTimeStamp bcid
setEventNumber uint32_t
static const SG::AuxElement::Accessor< ElementLink< IParticleContainer > > acc("originalObjectLink")
Object used for setting/getting the dynamic decoration in question.
This is the trigger result for each item before prescale, after prescale and after veto for a single ...
std::vector< uint32_t > tapWords
std::vector< uint32_t > tbpWords
std::vector< uint32_t > tavWords
std::vector< uint32_t > tipWords