Skip to content

Commit 141d1e1

Browse files
authored
Merge pull request #110 from PetrilloAtWork/feature/gp_triggerTicks
sbn::ExtraTriggerInfo: added cryostat trigger information
2 parents 7ad1015 + fa05d0e commit 141d1e1

3 files changed

Lines changed: 42 additions & 34 deletions

File tree

sbnobj/Common/Trigger/ExtraTriggerInfo.cxx

Lines changed: 19 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -205,42 +205,29 @@ std::ostream& sbn::operator<< (std::ostream& out, ExtraTriggerInfo const& info)
205205
if (info.triggerLocationBits != 0) {
206206
out << "\nLocation(s) of trigger:";
207207
for (std::string const& bitName: names(info.triggerLocation()))
208-
out << " " << bitName;
209-
}
210-
out << "\nEast cryostat: "
211-
<< info.cryostats[ExtraTriggerInfo::EastCryostat].triggerCount
212-
<< " triggers";
213-
if (auto const& cryo = info.cryostats[ExtraTriggerInfo::EastCryostat];
214-
cryo.hasAnyActivity()
215-
) {
216-
out << "\n trigger logic: ";
217-
if (cryo.triggerLogicBits) {
218-
for (std::string const& bitName: names(cryo.triggerLogic()))
219-
out << " " << bitName;
220-
}
221-
else out << " none!";
222-
out
223-
<< "\n east wall: "
224-
<< dumpLVDSmask(cryo.LVDSstatus[ExtraTriggerInfo::EastPMTwall])
225-
<< ", sectors: "
226-
<< dumpBits(cryo.sectorStatus[ExtraTriggerInfo::EastPMTwall], 6)
227-
<< "\n west wall: "
228-
<< dumpLVDSmask(cryo.LVDSstatus[ExtraTriggerInfo::WestPMTwall])
229-
<< ", sectors: "
230-
<< dumpBits(cryo.sectorStatus[ExtraTriggerInfo::WestPMTwall], 6)
231-
;
208+
out << " * " << bitName;
232209
}
210+
211+
out << "\nWest cryostat: " << info.cryostats[ExtraTriggerInfo::WestCryostat];
212+
out << "\nEast cryostat: " << info.cryostats[ExtraTriggerInfo::EastCryostat];
213+
214+
return out;
215+
} // sbn::operator<< (ExtraTriggerInfo)
233216

234-
out << "\nWest cryostat: "
235-
<< info.cryostats[ExtraTriggerInfo::WestCryostat].triggerCount
236-
<< " triggers";
237-
if (auto const& cryo = info.cryostats[ExtraTriggerInfo::WestCryostat];
238-
cryo.hasAnyActivity()
239-
) {
217+
218+
219+
// -----------------------------------------------------------------------------
220+
std::ostream& sbn::operator<<
221+
(std::ostream& out, sbn::ExtraTriggerInfo::CryostatInfo const& cryo)
222+
{
223+
out << cryo.triggerCount << " triggers";
224+
if (cryo.hasTrigger())
225+
out << ", the first one " << cryo.beamToTrigger << " ns after gate";
226+
if (cryo.hasAnyActivity()) {
240227
out << "\n trigger logic: ";
241228
if (cryo.triggerLogicBits) {
242229
for (std::string const& bitName: names(cryo.triggerLogic()))
243-
out << " * " << bitName;
230+
out << " * " << bitName;
244231
}
245232
else out << " none!";
246233
out
@@ -254,9 +241,8 @@ std::ostream& sbn::operator<< (std::ostream& out, ExtraTriggerInfo const& info)
254241
<< dumpBits(cryo.sectorStatus[ExtraTriggerInfo::WestPMTwall], 6)
255242
;
256243
}
257-
258244
return out;
259-
} // sbn::operator<< (ExtraTriggerInfo)
245+
} // std::ostream& sbn::operator<< (ExtraTriggerInfo::CryostatInfo)
260246

261247

262248
// -----------------------------------------------------------------------------

sbnobj/Common/Trigger/ExtraTriggerInfo.h

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,11 @@ struct sbn::ExtraTriggerInfo {
190190

191191
/// Trigger data pertaining a single cryostat.
192192
struct CryostatInfo {
193+
194+
/// Special value for no local cryostat trigger.
195+
static constexpr unsigned int NoTrigger
196+
= std::numeric_limits<unsigned int>::max();
197+
193198
/// Count of triggers in this cryostat.
194199
unsigned long int triggerCount { 0 };
195200

@@ -244,6 +249,10 @@ struct sbn::ExtraTriggerInfo {
244249
/// @see sbn::bits::triggerLogicMask
245250
unsigned int triggerLogicBits { 0U };
246251

252+
/// Delay from the beam gate opening to the first cryostat trigger
253+
/// (`NoTrigger` if no trigger is available in the cryostat) [ns]
254+
unsigned int beamToTrigger { NoTrigger };
255+
247256
/**
248257
* @brief Returns the type of logic satisfied by the trigger.
249258
*
@@ -270,6 +279,9 @@ struct sbn::ExtraTriggerInfo {
270279
/// Returns whether there is some recorded activity (LVDS or sector).
271280
constexpr bool hasAnyActivity() const;
272281

282+
/// Returns whether this cryostat has a trigger in the gate.
283+
constexpr bool hasTrigger() const;
284+
273285
}; // CryostatInfo
274286

275287

@@ -346,6 +358,8 @@ struct sbn::ExtraTriggerInfo {
346358

347359
namespace sbn {
348360
std::ostream& operator<< (std::ostream& out, ExtraTriggerInfo const& info);
361+
std::ostream& operator<<
362+
(std::ostream& out, ExtraTriggerInfo::CryostatInfo const& cryo);
349363
}
350364

351365

@@ -375,6 +389,13 @@ inline constexpr bool sbn::ExtraTriggerInfo::CryostatInfo::hasAnyActivity()
375389
} // sbn::ExtraTriggerInfo::CryostatInfo::hasAnyActivity()
376390

377391

392+
// -----------------------------------------------------------------------------
393+
inline constexpr bool sbn::ExtraTriggerInfo::CryostatInfo::hasTrigger() const
394+
{
395+
return beamToTrigger != NoTrigger;
396+
} // sbn::ExtraTriggerInfo::CryostatInfo::hasTrigger()
397+
398+
378399
// -----------------------------------------------------------------------------
379400

380401

sbnobj/Common/Trigger/classes_def.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@
2727
<enum name="sbn::bits::triggerSource" ClassVersion="10" />
2828
<enum name="sbn::bits::triggerLocation" ClassVersion="10" />
2929
<enum name="sbn::bits::triggerType" ClassVersion="10" />
30-
<class name="sbn::ExtraTriggerInfo::CryostatInfo" ClassVersion="13" >
30+
<class name="sbn::ExtraTriggerInfo::CryostatInfo" ClassVersion="14" >
31+
<version ClassVersion="14" checksum="1406793077"/>
3132
<version ClassVersion="13" checksum="2956313925"/>
3233
<version ClassVersion="12" checksum="804951501"/>
3334
<version ClassVersion="11" checksum="3455337645"/>

0 commit comments

Comments
 (0)