Skip to content

Commit c016495

Browse files
authored
Merge pull request #1892 from corrodis/LumiStream
Online work: Lumi stream
2 parents e8de2a4 + 38cc7b5 commit c016495

1 file changed

Lines changed: 17 additions & 5 deletions

File tree

DAQ/src/EventHeaderFromCFOFragment_module.cc

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
// Offline
2323
#include "Offline/DataProducts/inc/EventWindowMarker.hh"
24+
#include "Offline/RecoDataProducts/inc/ProtonBunchTime.hh"
2425

2526
// C++
2627
#include <iostream>
@@ -84,6 +85,7 @@ art::EventHeaderFromCFOFragment::EventHeaderFromCFOFragment(
8485
if(ewm_) {
8586
TLOG(TLVL_DEBUG + 2) << "Producing EventWindowMarker";
8687
produces<mu2e::EventWindowMarker>();
88+
produces<mu2e::ProtonBunchTime>();
8789
}
8890
if(isSim_) TLOG(TLVL_DEBUG + 2) << "Assuming simulation inputs!";
8991
}
@@ -95,6 +97,7 @@ void art::EventHeaderFromCFOFragment::produce(Event& event) {
9597
// Collection of CaloHits for the event
9698
std::unique_ptr<mu2e::EventHeader> evtHdr(new mu2e::EventHeader);
9799
std::unique_ptr<mu2e::EventWindowMarker> ewm((ewm_) ? new mu2e::EventWindowMarker : nullptr);
100+
std::unique_ptr<mu2e::ProtonBunchTime> pbt((ewm_) ? new mu2e::ProtonBunchTime : nullptr);
98101
art::Handle<artdaq::Fragments> cfoFragmentHandle;
99102

100103
// Set values that are useful in simulations
@@ -106,7 +109,10 @@ void art::EventHeaderFromCFOFragment::produce(Event& event) {
106109
// Check for the CFO fragment list
107110
if(!event.getByLabel(cfoFragmentTag_, cfoFragmentHandle)) {
108111
event.put(std::move(evtHdr));
109-
if(ewm_) event.put(std::move(ewm));
112+
if(ewm_) {
113+
event.put(std::move(ewm));
114+
event.put(std::move(pbt));
115+
}
110116
TLOG(TLVL_DEBUG + 1) << "No CFO fragments found";
111117
return;
112118
}
@@ -118,24 +124,30 @@ void art::EventHeaderFromCFOFragment::produce(Event& event) {
118124
const mu2e::CFOEventFragment cfoFrag(frag);
119125
const CFOLib::CFO_Event cfo = cfoFrag.getData();
120126
const CFOLib::CFO_EventRecord& cfoRecord = cfo.GetEventRecord();
121-
evtHdr->mode = 0;//cfo.GetEventMode();
127+
evtHdr->mode = cfoRecord.event_mode; //cfo.GetEventMode();
122128
evtHdr->ewt = static_cast<long unsigned int>(cfo.GetEventWindowTag().GetEventWindowTag().to_ullong());
123129
evtHdr->flags = cfo.GetEventMode().isOnSpillFlagSet();
124130
evtHdr->eventDuration = cfoRecord.event_duration;
125-
TLOG(TLVL_DEBUG + 20) << "mode = " << evtHdr->mode << " ewt = "<< evtHdr->ewt << " flags = " << evtHdr->flags
131+
TLOG(TLVL_DEBUG + 20) << "mode = " << evtHdr->mode << " (" << cfoRecord.event_mode << ")"
132+
<< " ewt = "<< evtHdr->ewt << " flags = " << int(evtHdr->flags)
126133
<< " onspill = " << evtHdr->isOnSpill() << " duration = " << evtHdr->eventDuration;
127134
if(ewm_) {
128135
constexpr double tick = 25.; // clock ticks -> ns
129-
ewm->_spillType = (evtHdr->isOnSpill()) ? mu2e::EventWindowMarker::SpillType::onspill : mu2e::EventWindowMarker::SpillType::offspill;
136+
ewm->_spillType = (cfo.GetEventMode().isOnSpillFlagSet()) ? mu2e::EventWindowMarker::SpillType::onspill : mu2e::EventWindowMarker::SpillType::offspill;
130137
ewm->_eventLength = tick * evtHdr->eventDuration;
138+
pbt->pbtime_ = 0.f; // FIXME
139+
pbt->pbterr_ = 1.f;
131140
}
132141

133142
} else {
134143
TLOG(TLVL_DEBUG + 3) << "No CFO fragments found in the event";
135144
}
136145

137146
event.put(std::move(evtHdr));
138-
if(ewm_) event.put(std::move(ewm));
147+
if(ewm_) {
148+
event.put(std::move(ewm));
149+
event.put(std::move(pbt));
150+
}
139151
} // produce()
140152

141153
// ======================================================================

0 commit comments

Comments
 (0)