22 #define EDM_ML_DEBUG 1
62 std::auto_ptr<PackingSetup>
prov_;
77 o <<
"L1T Block Header " << h.
getID() <<
" with size " << h.
getSize();
83 fwId_(config.getUntrackedParameter<int>(
"FWId", -1)),
84 ctp7_mode_(config.getUntrackedParameter<bool>(
"CTP7",
false))
88 if (config.
exists(
"FedId") and config.
exists(
"FedIds")) {
90 <<
"Cannot have FedId and FedIds as parameter at the same time";
91 }
else if (config.
exists(
"FedId")) {
98 prov_->registerProducts(*
this);
124 std::unique_ptr<UnpackerCollections>
coll =
prov_->getCollections(event);
129 if (!feds.isValid()) {
130 LogError(
"L1T") <<
"Cannot unpack: no collection found";
137 LogDebug(
"L1T") <<
"Found FEDRawDataCollection with ID " <<
fedId <<
" and size " << l1tRcd.
size();
140 LogError(
"L1T") <<
"Cannot unpack: empty/invalid L1T raw data (size = "
141 << l1tRcd.
size() <<
") for ID " <<
fedId <<
". Returning empty collections!";
146 const unsigned char *
data = l1tRcd.
data();
149 if (header.
check()) {
150 LogDebug(
"L1T") <<
"Found SLink header:"
152 <<
" L1 event ID " << header.
lvl1ID()
153 <<
" BX Number " << header.
bxID()
154 <<
" FED source " << header.
sourceID()
155 <<
" FED version " << header.
version();
157 LogWarning(
"L1T") <<
"Did not find a SLink header!";
162 if (trailer.
check()) {
163 LogDebug(
"L1T") <<
"Found SLink trailer:"
164 <<
" Length " << trailer.
lenght()
165 <<
" CRC " << trailer.
crc()
167 <<
" Throttling bits " << trailer.
ttsBits();
169 LogWarning(
"L1T") <<
"Did not find a SLink trailer!";
177 <<
"Could not extract AMC13 Packet.";
182 auto payload64 =
amc.data();
183 const uint32_t *
start = (
const uint32_t*) payload64.get();
184 const uint32_t *
end = start + (
amc.size() * 2);
186 std::auto_ptr<Payload> payload;
188 LogDebug(
"L1T") <<
"Using CTP7 mode";
191 LogDebug(
"L1T") <<
"Using MP7 mode";
194 unsigned fw = payload->getFirmwareId();
200 unsigned board =
amc.header().getBoardID();
201 unsigned amc_no =
amc.header().getAMCNumber();
206 std::auto_ptr<Block>
block;
207 while ((block = payload->getBlock()).
get()) {
209 if (block->header().getID() == 0 and block->header().getSize() == 0)
212 auto unpacker =
unpackers.find(block->header().getID());
214 block->amc(
amc.header());
217 LogDebug(
"L1T") <<
"Cannot find an unpacker for block ID "
218 << block->header().getID() <<
", AMC # " << amc_no
219 <<
", board ID " << board <<
", FED ID " <<
fedId
220 <<
", and FW ID " << fw <<
"!";
222 }
else if (!unpacker->second->unpack(*block,
coll.get())) {
223 LogDebug(
"L1T") <<
"Error unpacking data for block ID "
224 << block->header().getID() <<
", AMC # " << amc_no
225 <<
", board ID " << board <<
", FED ID " <<
fedId
226 <<
", and FW ID " << fw <<
"!";
virtual void produce(edm::Event &, const edm::EventSetup &) override
std::vector< amc::Packet > payload() const
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
tuple start
Check for commandline option errors.
std::auto_ptr< PackingSetup > prov_
#define DEFINE_FWK_MODULE(type)
std::auto_ptr< PackingSetup > make(const std::string &) const
int evtStatus()
Event fragment status information.
bool exists(std::string const ¶meterName) const
checks if a parameter exists
std::ostream & operator<<(std::ostream &out, const ALILine &li)
size_t size() const
Lenght of the data buffer in bytes.
L1TRawToDigi(const edm::ParameterSet &)
void addDefault(ParameterSetDescription const &psetDescription)
std::vector< int > fedIds_
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
int ttsBits()
Current value of the Trigger Throttling System bitsAQ).
unsigned long long uint64_t
int lenght()
The length of the event fragment counted in 64-bit words including header and trailer.
virtual void beginLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &) override
static const PackingSetupFactory * get()
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
char data[epos_bytes_allocation]
edm::EDGetTokenT< FEDRawDataCollection > fedData_
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
bool parse(const uint64_t *, unsigned int)
int crc()
Cyclic Redundancy Code of the event fragment including header and trailer.
virtual void endRun(edm::Run const &, edm::EventSetup const &) override
volatile std::atomic< bool > shutdown_flag false
virtual void endLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &) override
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
virtual void beginRun(edm::Run const &, edm::EventSetup const &) override