|
|
#include <SiStripSpyEventMatcher.h>
|
static void | findMatchingFeds (const uint32_t eventId, const uint8_t apvAddress, CountersPtr totalEventCounters, CountersPtr l1aCounters, CountersPtr apvAddresses, std::set< uint16_t > &matchingFeds) |
|
static CountersPtr | getCounters (const edm::EventPrincipal &event, const edm::InputTag &tag, const bool mapKeyIsByFedID=true) |
|
template<class T > |
static const T * | getProduct (const edm::EventPrincipal &event, const edm::InputTag &tag) |
|
static void | mergeMatchingData (const std::set< uint16_t > &matchingFeds, const FEDRawDataCollection &inputRawData, CountersPtr inputTotalEventCounters, CountersPtr inputL1ACounters, CountersPtr inputAPVAddresses, const edm::DetSetVector< SiStripRawDigi > *inputScopeDigis, const edm::DetSetVector< SiStripRawDigi > *inputPayloadDigis, const edm::DetSetVector< SiStripRawDigi > *inputReorderedDigis, const edm::DetSetVector< SiStripRawDigi > *inputVirginRawDigis, FEDRawDataCollection &outputRawData, std::vector< uint32_t > &outputTotalEventCounters, std::vector< uint32_t > &outputL1ACounters, std::vector< uint32_t > &outputAPVAddresses, std::vector< edm::DetSet< SiStripRawDigi > > *outputScopeDigisVector, std::vector< edm::DetSet< SiStripRawDigi > > *outputPayloadDigisVector, std::vector< edm::DetSet< SiStripRawDigi > > *outputReorderedDigisVector, std::vector< edm::DetSet< SiStripRawDigi > > *outputVirginRawDigisVector, const SiStripFedCabling &cabling) |
|
|
static const char * | mlLabel_ = "SpyEventMatcher" |
|
Definition at line 33 of file SiStripSpyEventMatcher.h.
◆ Counters
◆ CountersPtr
◆ EventID
◆ Source
◆ SpyEventList
◆ SpyEventMatcher()
◆ ~SpyEventMatcher()
sistrip::SpyEventMatcher::~SpyEventMatcher |
( |
| ) |
|
|
virtual |
◆ addNextEventToMap()
Definition at line 104 of file SiStripSpyEventMatcher.cc.
112 std::vector<uint32_t>::const_iterator iTotalEventCount = totalEventCounters->begin();
113 std::vector<uint32_t>::const_iterator iL1ACount = l1aCounters->begin();
114 std::vector<uint32_t>::const_iterator iAPVAddress = apvAddresses->begin();
116 std::map<EventKey, uint16_t> fedCounts;
117 unsigned int fedid = 0;
118 for (; ((iTotalEventCount != totalEventCounters->end()) && (iL1ACount != l1aCounters->end()) &&
119 (iAPVAddress != apvAddresses->end()));
120 (++iTotalEventCount, ++iL1ACount, ++iAPVAddress, ++
fedid)) {
121 if (*iAPVAddress == 0) {
125 if (((*iTotalEventCount) > (*iL1ACount)) || ((*iL1ACount) - (*iTotalEventCount) >
counterDiffMax_)) {
127 <<
", totCount = " << *iTotalEventCount <<
", L1Acount = " << *iL1ACount << std::endl;
132 for (uint32_t eventId = (*iTotalEventCount) + 1; eventId <= (*iL1ACount) + 1; ++eventId) {
133 EventKey
key(eventId, *iAPVAddress);
140 std::ostringstream
ss;
141 ss <<
"Spy event " << spyEventId.
event() <<
" matches (eventID,apvAddress,nFEDs): ";
142 for (std::map<EventKey, uint16_t>::const_iterator iEventFEDCount = fedCounts.begin();
143 iEventFEDCount != fedCounts.end();
145 ss <<
"(" << iEventFEDCount->first.eventId() <<
"," << uint16_t(iEventFEDCount->first.apvAddress()) <<
","
146 << iEventFEDCount->second <<
") ";
References apvAddressesTag_, counterDiffMax_, edm::EventID::event(), eventMatches_, PixelSLinkDataInputSource_cfi::fedid, getCounters(), edm::EventPrincipal::id(), crabWrapper::key, l1aCountersTag_, LogDebug, mlLabel_, contentValuesCheck::ss, and totalEventCountersTag_.
Referenced by initialize().
◆ constructSource()
◆ findMatchingFeds()
Definition at line 277 of file SiStripSpyEventMatcher.cc.
284 std::vector<uint32_t>::const_iterator iTotalEventCount = totalEventCounters->begin();
285 std::vector<uint32_t>::const_iterator iL1ACount = l1aCounters->begin();
286 std::vector<uint32_t>::const_iterator iAPVAddress = apvAddresses->begin();
287 for (; ((iTotalEventCount != totalEventCounters->end()) && (iL1ACount != l1aCounters->end()) &&
288 (iAPVAddress != apvAddresses->end()));
289 (++iTotalEventCount, ++iL1ACount, ++iAPVAddress)) {
290 if (*iAPVAddress == 0) {
293 if ((eventId > *iTotalEventCount) && (eventId <= (*iL1ACount) + 1) && (*iAPVAddress == apvAddress)) {
294 matchingFeds.insert(matchingFeds.end(), iTotalEventCount - totalEventCounters->begin());
Referenced by getCollections().
◆ getCollections()
Definition at line 171 of file SiStripSpyEventMatcher.cc.
178 if (!inputRawDataPtr) {
194 if (inputScopeDigis && !mo.outputScopeDigisVector_.get())
196 if (inputPayloadDigis && !mo.outputPayloadDigisVector_.get())
198 if (inputReorderedDigis && !mo.outputReorderedDigisVector_.get())
200 if (inputVirginRawDigis && !mo.outputVirginRawDigisVector_.get())
203 std::set<uint16_t> matchingFeds;
204 findMatchingFeds(eventId, apvAddress, inputTotalEventCounters, inputL1ACounters, inputAPVAddresses, matchingFeds);
205 LogInfo(
mlLabel_) <<
"Spy event " <<
event.id() <<
" has " << matchingFeds.size() <<
" matching FEDs";
206 std::ostringstream
ss;
207 ss <<
"Matching FEDs for event " <<
event.id() <<
": ";
208 for (std::set<uint16_t>::const_iterator iFedId = matchingFeds.begin(); iFedId != matchingFeds.end(); ++iFedId) {
209 ss << *iFedId <<
" ";
213 std::vector<uint16_t> duplicateFeds(
std::min(mo.alreadyMergedFeds_.size(), matchingFeds.size()));
214 std::vector<uint16_t>::iterator duplicatesBegin = duplicateFeds.begin();
215 std::vector<uint16_t>::iterator duplicatesEnd = std::set_intersection(mo.alreadyMergedFeds_.begin(),
216 mo.alreadyMergedFeds_.end(),
217 matchingFeds.begin(),
220 if ((duplicatesEnd - duplicatesBegin) != 0) {
221 std::ostringstream
ss;
222 ss <<
"Found a match for FEDs ";
223 for (std::vector<uint16_t>::const_iterator iDup = duplicatesBegin; iDup != duplicatesEnd; ++iDup) {
226 ss <<
". Output SetSetVectors will be unusable!";
232 inputTotalEventCounters,
240 mo.outputTotalEventCounters_,
241 mo.outputL1ACounters_,
242 mo.outputAPVAddresses_,
243 mo.outputScopeDigisVector_.get(),
244 mo.outputPayloadDigisVector_.get(),
245 mo.outputReorderedDigisVector_.get(),
246 mo.outputVirginRawDigisVector_.get(),
248 mo.alreadyMergedFeds_.insert(matchingFeds.begin(), matchingFeds.end());
References sistrip::SpyEventMatcher::MatchingOutput::alreadyMergedFeds_, apvAddressesTag_, event(), Exception, findMatchingFeds(), getCounters(), l1aCountersTag_, LogDebug, mergeMatchingData(), min(), mlLabel_, sistrip::SpyEventMatcher::MatchingOutput::outputAPVAddresses_, sistrip::SpyEventMatcher::MatchingOutput::outputL1ACounters_, sistrip::SpyEventMatcher::MatchingOutput::outputPayloadDigisVector_, sistrip::SpyEventMatcher::MatchingOutput::outputRawData_, sistrip::SpyEventMatcher::MatchingOutput::outputReorderedDigisVector_, sistrip::SpyEventMatcher::MatchingOutput::outputScopeDigisVector_, sistrip::SpyEventMatcher::MatchingOutput::outputTotalEventCounters_, sistrip::SpyEventMatcher::MatchingOutput::outputVirginRawDigisVector_, payloadDigisTag_, rawDataTag_, reorderedDigisTag_, scopeDigisTag_, contentValuesCheck::ss, totalEventCountersTag_, and virginRawDigisTag_.
Referenced by getMatchedCollections().
◆ getCounters()
Definition at line 391 of file SiStripSpyEventMatcher.cc.
394 const std::vector<uint32_t>* vectorFromEvent = getProduct<std::vector<uint32_t> >(
event,
tag);
395 if (vectorFromEvent) {
397 return std::make_shared<CountersWrapper>(vectorFromEvent);
399 const std::map<uint32_t, uint32_t>* mapFromEvent = getProduct<std::map<uint32_t, uint32_t> >(
event,
tag);
401 std::vector<uint32_t>* newVector =
new std::vector<uint32_t>(
FED_ID_MAX + 1, 0);
402 if (mapKeyIsByFedID) {
403 for (std::map<uint32_t, uint32_t>::const_iterator iIdValue = mapFromEvent->begin();
404 iIdValue != mapFromEvent->end();
406 newVector->at(iIdValue->first) = iIdValue->second;
418 CountersPtr newCountersPtr(
new CountersWrapper(newVector,
true));
419 return newCountersPtr;
References event(), Exception, sistrip::FED_ID_MAX, sistrip::SpyUtilities::fillFEDMajorities(), mlLabel_, and GlobalPosition_Frontier_DevDB_cff::tag.
Referenced by addNextEventToMap(), and getCollections().
◆ getMatchedCollections()
Definition at line 251 of file SiStripSpyEventMatcher.cc.
258 size_t fileNameHash = 0
U;
260 MatchingOutput mo(outputRawData);
264 matchingEvents->begin(),
265 matchingEvents->end(),
266 [&](
auto const& iE,
auto const&) { this->
getCollections(iE, eventId, apvAddress, cabling, mo); });
267 collectionsToCreate = SpyDataCollections(mo.outputRawData_,
268 mo.outputTotalEventCounters_,
269 mo.outputL1ACounters_,
270 mo.outputAPVAddresses_,
271 mo.outputScopeDigisVector_.get(),
272 mo.outputPayloadDigisVector_.get(),
273 mo.outputReorderedDigisVector_.get(),
274 mo.outputVirginRawDigisVector_.get());
References eventPrincipal_, getCollections(), sistrip::SpyEventMatcher::MatchingOutput::outputAPVAddresses_, sistrip::SpyEventMatcher::MatchingOutput::outputL1ACounters_, sistrip::SpyEventMatcher::MatchingOutput::outputPayloadDigisVector_, sistrip::SpyEventMatcher::MatchingOutput::outputRawData_, sistrip::SpyEventMatcher::MatchingOutput::outputReorderedDigisVector_, sistrip::SpyEventMatcher::MatchingOutput::outputScopeDigisVector_, sistrip::SpyEventMatcher::MatchingOutput::outputTotalEventCounters_, sistrip::SpyEventMatcher::MatchingOutput::outputVirginRawDigisVector_, source_, and mitigatedMETSequence_cff::U.
◆ getProduct()
◆ initialize()
void sistrip::SpyEventMatcher::initialize |
( |
| ) |
|
Definition at line 79 of file SiStripSpyEventMatcher.cc.
80 size_t fileNameHash = 0
U;
86 [
this](
auto const& iE,
auto const&) {
94 std::ostringstream
ss;
95 ss <<
"Events with possible matches (eventID,apvAddress): ";
96 for (std::map<EventKey, SpyEventList>::const_iterator iSpyEvent =
eventMatches_.begin();
99 ss <<
"(" << iSpyEvent->first.eventId() <<
"," << uint16_t(iSpyEvent->first.apvAddress()) <<
") ";
References addNextEventToMap(), eventMatches_, eventPrincipal_, LogDebug, SiStripPI::max, mlLabel_, source_, contentValuesCheck::ss, and mitigatedMETSequence_cff::U.
◆ matchesForEvent()
Definition at line 151 of file SiStripSpyEventMatcher.cc.
153 EventKey eventKey(eventId, apvAddress);
154 std::map<EventKey, SpyEventList>::const_iterator iMatch =
eventMatches_.find(eventKey);
156 LogDebug(
mlLabel_) <<
"No match found for event " << eventId <<
" with APV address " << uint16_t(apvAddress);
159 std::ostringstream
ss;
160 ss <<
"Found matches to event " << eventId <<
" with address " << uint16_t(apvAddress) <<
" in spy events ";
161 for (SpyEventList::const_iterator iMatchingSpyEvent = iMatch->second.begin();
162 iMatchingSpyEvent != iMatch->second.end();
163 ++iMatchingSpyEvent) {
164 ss << iMatchingSpyEvent->event() <<
" ";
167 return &(iMatch->second);
References eventMatches_, LogDebug, mlLabel_, and contentValuesCheck::ss.
◆ mergeMatchingData()
void sistrip::SpyEventMatcher::mergeMatchingData |
( |
const std::set< uint16_t > & |
matchingFeds, |
|
|
const FEDRawDataCollection & |
inputRawData, |
|
|
SpyEventMatcher::CountersPtr |
inputTotalEventCounters, |
|
|
SpyEventMatcher::CountersPtr |
inputL1ACounters, |
|
|
SpyEventMatcher::CountersPtr |
inputAPVAddresses, |
|
|
const edm::DetSetVector< SiStripRawDigi > * |
inputScopeDigis, |
|
|
const edm::DetSetVector< SiStripRawDigi > * |
inputPayloadDigis, |
|
|
const edm::DetSetVector< SiStripRawDigi > * |
inputReorderedDigis, |
|
|
const edm::DetSetVector< SiStripRawDigi > * |
inputVirginRawDigis, |
|
|
FEDRawDataCollection & |
outputRawData, |
|
|
std::vector< uint32_t > & |
outputTotalEventCounters, |
|
|
std::vector< uint32_t > & |
outputL1ACounters, |
|
|
std::vector< uint32_t > & |
outputAPVAddresses, |
|
|
std::vector< edm::DetSet< SiStripRawDigi > > * |
outputScopeDigisVector, |
|
|
std::vector< edm::DetSet< SiStripRawDigi > > * |
outputPayloadDigisVector, |
|
|
std::vector< edm::DetSet< SiStripRawDigi > > * |
outputReorderedDigisVector, |
|
|
std::vector< edm::DetSet< SiStripRawDigi > > * |
outputVirginRawDigisVector, |
|
|
const SiStripFedCabling & |
cabling |
|
) |
| |
|
staticprivate |
Definition at line 299 of file SiStripSpyEventMatcher.cc.
318 if (inputScopeDigis) {
319 outputScopeDigisVector->reserve(outputScopeDigisVector->size() +
320 matchingFeds.size() *
323 if (inputPayloadDigis) {
324 outputPayloadDigisVector->reserve(outputPayloadDigisVector->size() + matchingFeds.size() *
FEDCH_PER_FED);
326 if (inputReorderedDigis) {
327 outputReorderedDigisVector->reserve(outputReorderedDigisVector->size() + matchingFeds.size() *
FEDCH_PER_FED);
329 if (inputVirginRawDigis) {
330 outputVirginRawDigisVector->reserve(outputVirginRawDigisVector->size() +
335 std::set<uint32_t> usedDetIds;
336 for (std::set<uint16_t>::const_iterator iFedId = matchingFeds.begin(); iFedId != matchingFeds.end(); ++iFedId) {
337 const uint32_t
fedId = *iFedId;
342 outputTotalEventCounters[
fedId] = (*inputTotalEventCounters)[
fedId];
343 outputL1ACounters[
fedId] = (*inputL1ACounters)[
fedId];
344 outputAPVAddresses[
fedId] = (*inputAPVAddresses)[
fedId];
348 if (inputScopeDigis) {
350 if (iScopeDigis != inputScopeDigis->
end()) {
351 outputScopeDigisVector->push_back(*iScopeDigis);
354 if (inputPayloadDigis) {
356 if (iPayloadDigis != inputPayloadDigis->
end()) {
357 outputPayloadDigisVector->push_back(*iPayloadDigis);
360 if (inputReorderedDigis) {
362 if (iReorderedDigis != inputReorderedDigis->
end()) {
363 outputReorderedDigisVector->push_back(*iReorderedDigis);
367 if (inputVirginRawDigis) {
368 std::set<uint32_t> fedDetIds;
370 for (
auto iConn = conns.begin(); iConn != conns.end(); ++iConn) {
371 if (!iConn->isConnected())
373 const uint32_t detId = iConn->detId();
374 if (usedDetIds.find(detId) != usedDetIds.end()) {
375 LogError(
mlLabel_) <<
"Duplicate DetID found " << detId <<
" skipping data for this Det from FED " <<
fedId;
378 fedDetIds.insert(iConn->detId());
380 usedDetIds.insert(fedDetIds.begin(), fedDetIds.end());
381 for (std::set<uint32_t>::const_iterator iDetId = fedDetIds.begin(); iDetId != fedDetIds.end(); ++iDetId) {
383 if (iVirginRawDigis != inputVirginRawDigis->
end()) {
384 outputVirginRawDigisVector->push_back(*iVirginRawDigis);
References officialStyle::chan, FEDRawData::data(), edm::DetSetVector< T >::end(), sistrip::FEDCH_PER_FED, SiStripFedCabling::fedConnections(), FEDRawDataCollection::FEDData(), l1tstage2_dqm_sourceclient-live_cfg::fedId, edm::DetSetVector< T >::find(), sistrip::invalid_, LogDebug, mlLabel_, and FEDRawData::size().
Referenced by getCollections().
◆ operator()()
◆ apvAddressesTag_
◆ counterDiffMax_
uint32_t sistrip::SpyEventMatcher::counterDiffMax_ |
|
private |
◆ eventMatches_
◆ eventPrincipal_
◆ l1aCountersTag_
◆ mlLabel_
const char * sistrip::SpyEventMatcher::mlLabel_ = "SpyEventMatcher" |
|
staticprivate |
◆ payloadDigisTag_
◆ processConfiguration_
◆ productRegistry_
◆ rawDataTag_
◆ reorderedDigisTag_
◆ scopeDigisTag_
◆ source_
◆ totalEventCountersTag_
◆ virginRawDigisTag_
edm::InputTag payloadDigisTag_
iterator end()
Return the off-the-end iterator.
static CountersPtr getCounters(const edm::EventPrincipal &event, const edm::InputTag &tag, const bool mapKeyIsByFedID=true)
edm::InputTag virginRawDigisTag_
edm::InputTag l1aCountersTag_
static ParameterSetID emptyParameterSetID()
std::unique_ptr< Source > constructSource(const edm::ParameterSet &sourceConfig)
EventID const & id() const
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
static void mergeMatchingData(const std::set< uint16_t > &matchingFeds, const FEDRawDataCollection &inputRawData, CountersPtr inputTotalEventCounters, CountersPtr inputL1ACounters, CountersPtr inputAPVAddresses, const edm::DetSetVector< SiStripRawDigi > *inputScopeDigis, const edm::DetSetVector< SiStripRawDigi > *inputPayloadDigis, const edm::DetSetVector< SiStripRawDigi > *inputReorderedDigis, const edm::DetSetVector< SiStripRawDigi > *inputVirginRawDigis, FEDRawDataCollection &outputRawData, std::vector< uint32_t > &outputTotalEventCounters, std::vector< uint32_t > &outputL1ACounters, std::vector< uint32_t > &outputAPVAddresses, std::vector< edm::DetSet< SiStripRawDigi > > *outputScopeDigisVector, std::vector< edm::DetSet< SiStripRawDigi > > *outputPayloadDigisVector, std::vector< edm::DetSet< SiStripRawDigi > > *outputReorderedDigisVector, std::vector< edm::DetSet< SiStripRawDigi > > *outputVirginRawDigisVector, const SiStripFedCabling &cabling)
static void fillFEDMajorities(const std::map< uint32_t, uint32_t > &channelValues, std::vector< uint32_t > &fedMajoritiesToFill)
edm::InputTag scopeDigisTag_
void getCollections(const edm::EventPrincipal &event, const uint32_t eventId, const uint8_t apvAddress, const SiStripFedCabling &cabling, MatchingOutput &matchingOutput)
std::unique_ptr< edm::ProcessConfiguration > processConfiguration_
std::shared_ptr< edm::ProductRegistry > productRegistry_
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
edm::InputTag totalEventCountersTag_
std::map< EventKey, SpyEventList > eventMatches_
collection_type::const_iterator const_iterator
static void findMatchingFeds(const uint32_t eventId, const uint8_t apvAddress, CountersPtr totalEventCounters, CountersPtr l1aCounters, CountersPtr apvAddresses, std::set< uint16_t > &matchingFeds)
edm::InputTag rawDataTag_
iterator find(det_id_type id)
EventNumber_t event() const
static const char * mlLabel_
edm::InputTag apvAddressesTag_
static const uint16_t invalid_
size_t size() const
Lenght of the data buffer in bytes.
static const uint16_t FED_ID_MAX
void addNextEventToMap(const edm::EventPrincipal &nextSpyEvent)
chan
lumi = TPaveText(lowX+0.38, lowY+0.061, lowX+0.45, lowY+0.161, "NDC") lumi.SetBorderSize( 0 ) lumi....
std::string getReleaseVersion()
std::unique_ptr< edm::EventPrincipal > eventPrincipal_
std::shared_ptr< CountersWrapper > CountersPtr
static const uint16_t FEDCH_PER_FED
const std::unique_ptr< edm::VectorInputSource > source_
ConnsConstIterRange fedConnections(uint16_t fed_id) const
edm::InputTag reorderedDigisTag_
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