CMS 3D CMS Logo

List of all members | Classes | Public Types | Public Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes
sistrip::SpyEventMatcher Class Reference

#include <SiStripSpyEventMatcher.h>

Classes

class  CountersWrapper
 
class  EventKey
 
struct  MatchingOutput
 
class  SpyDataCollections
 

Public Types

typedef edm::EventID EventID
 
typedef std::set< EventIDSpyEventList
 

Public Member Functions

void getCollections (const edm::EventPrincipal &event, const uint32_t eventId, const uint8_t apvAddress, const SiStripFedCabling &cabling, MatchingOutput &matchingOutput)
 
void getMatchedCollections (const uint32_t eventId, const uint8_t apvAddress, const SpyEventList *matchingEvents, const SiStripFedCabling &cabling, SpyDataCollections &collectionsToCreate)
 
void initialize ()
 
const SpyEventListmatchesForEvent (const uint32_t eventId, const uint8_t apvAddress) const
 
 SpyEventMatcher (const edm::ParameterSet &config)
 
virtual ~SpyEventMatcher ()
 

Private Types

typedef std::vector< uint32_t > Counters
 
typedef std::shared_ptr< CountersWrapperCountersPtr
 
typedef edm::VectorInputSource Source
 

Private Member Functions

void addNextEventToMap (const edm::EventPrincipal &nextSpyEvent)
 
std::unique_ptr< SourceconstructSource (const edm::ParameterSet &sourceConfig)
 
void operator() (const edm::EventPrincipal &event)
 

Static Private Member Functions

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 TgetProduct (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)
 

Private Attributes

edm::InputTag apvAddressesTag_
 
uint32_t counterDiffMax_
 
std::map< EventKey, SpyEventListeventMatches_
 
std::unique_ptr< edm::EventPrincipaleventPrincipal_
 
edm::InputTag l1aCountersTag_
 
edm::InputTag payloadDigisTag_
 
std::unique_ptr< edm::ProcessConfigurationprocessConfiguration_
 
std::shared_ptr< edm::ProductRegistryproductRegistry_
 
edm::InputTag rawDataTag_
 
edm::InputTag reorderedDigisTag_
 
edm::InputTag scopeDigisTag_
 
const std::unique_ptr< edm::VectorInputSourcesource_
 
edm::InputTag totalEventCountersTag_
 
edm::InputTag virginRawDigisTag_
 

Static Private Attributes

static const char * mlLabel_ = "SpyEventMatcher"
 

Detailed Description

Definition at line 33 of file SiStripSpyEventMatcher.h.

Member Typedef Documentation

◆ Counters

typedef std::vector<uint32_t> sistrip::SpyEventMatcher::Counters
private

Definition at line 103 of file SiStripSpyEventMatcher.h.

◆ CountersPtr

typedef std::shared_ptr<CountersWrapper> sistrip::SpyEventMatcher::CountersPtr
private

Definition at line 121 of file SiStripSpyEventMatcher.h.

◆ EventID

Definition at line 69 of file SiStripSpyEventMatcher.h.

◆ Source

Definition at line 124 of file SiStripSpyEventMatcher.h.

◆ SpyEventList

Definition at line 70 of file SiStripSpyEventMatcher.h.

Constructor & Destructor Documentation

◆ SpyEventMatcher()

sistrip::SpyEventMatcher::SpyEventMatcher ( const edm::ParameterSet config)

Definition at line 47 of file SiStripSpyEventMatcher.cc.

48  : rawDataTag_(config.getParameter<edm::InputTag>("RawSpyDataTag")),
49  totalEventCountersTag_(config.getParameter<edm::InputTag>("SpyTotalEventCountersTag")),
50  l1aCountersTag_(config.getParameter<edm::InputTag>("SpyL1ACountersTag")),
51  apvAddressesTag_(config.getParameter<edm::InputTag>("SpyAPVAddressesTag")),
52  scopeDigisTag_(config.getParameter<edm::InputTag>("SpyScopeDigisTag")),
53  payloadDigisTag_(config.getParameter<edm::InputTag>("SpyPayloadDigisTag")),
54  reorderedDigisTag_(config.getParameter<edm::InputTag>("SpyReorderedDigisTag")),
55  virginRawDigisTag_(config.getParameter<edm::InputTag>("SpyVirginRawDigisTag")),
56  counterDiffMax_(config.getParameter<uint32_t>("CounterDiffMaxAllowed")),
58  source_(constructSource(config.getParameter<edm::ParameterSet>("SpySource"))),
61  eventPrincipal_() {
62  // Use the empty parameter set for the parameter set ID of our "@MIXING" process.
64  productRegistry_->setFrozen();
65 
66  eventPrincipal_.reset(new edm::EventPrincipal(source_->productRegistry(),
67  std::make_shared<edm::BranchIDListHelper>(),
68  std::make_shared<edm::ThinnedAssociationsHelper>(),
70  nullptr));
71  }

References edm::ParameterSet::emptyParameterSetID(), eventPrincipal_, processConfiguration_, productRegistry_, and source_.

◆ ~SpyEventMatcher()

sistrip::SpyEventMatcher::~SpyEventMatcher ( )
virtual

Definition at line 45 of file SiStripSpyEventMatcher.cc.

45 {}

Member Function Documentation

◆ addNextEventToMap()

void sistrip::SpyEventMatcher::addNextEventToMap ( const edm::EventPrincipal nextSpyEvent)
private

Definition at line 104 of file SiStripSpyEventMatcher.cc.

104  {
105  edm::EventID spyEventId = nextSpyEvent.id();
106 
107  CountersPtr totalEventCounters = getCounters(nextSpyEvent, totalEventCountersTag_);
108  CountersPtr l1aCounters = getCounters(nextSpyEvent, l1aCountersTag_);
109  CountersPtr apvAddresses = getCounters(nextSpyEvent, apvAddressesTag_, false);
110  //loop over all FEDs. Maps should have same content and be in order so, avoid searches by iterating (and checking keys match)
111  //add all possible event keys to the map
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();
115  //for debug
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) {
122  continue;
123  }
124 
125  if (((*iTotalEventCount) > (*iL1ACount)) || ((*iL1ACount) - (*iTotalEventCount) > counterDiffMax_)) {
126  LogWarning(mlLabel_) << "Spy event " << spyEventId.event() << " error in counter values for FED " << fedid
127  << ", totCount = " << *iTotalEventCount << ", L1Acount = " << *iL1ACount << std::endl;
128 
129  continue;
130  }
131 
132  for (uint32_t eventId = (*iTotalEventCount) + 1; eventId <= (*iL1ACount) + 1; ++eventId) {
133  EventKey key(eventId, *iAPVAddress);
134  eventMatches_[key].insert(spyEventId);
135  fedCounts[key]++;
136  }
137  }
138 
139  //for debug
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();
144  ++iEventFEDCount) {
145  ss << "(" << iEventFEDCount->first.eventId() << "," << uint16_t(iEventFEDCount->first.apvAddress()) << ","
146  << iEventFEDCount->second << ") ";
147  }
148  LogDebug(mlLabel_) << ss.str();
149  }

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()

std::unique_ptr< SpyEventMatcher::Source > sistrip::SpyEventMatcher::constructSource ( const edm::ParameterSet sourceConfig)
private

◆ findMatchingFeds()

void sistrip::SpyEventMatcher::findMatchingFeds ( const uint32_t  eventId,
const uint8_t  apvAddress,
SpyEventMatcher::CountersPtr  totalEventCounters,
SpyEventMatcher::CountersPtr  l1aCounters,
SpyEventMatcher::CountersPtr  apvAddresses,
std::set< uint16_t > &  matchingFeds 
)
staticprivate

Definition at line 277 of file SiStripSpyEventMatcher.cc.

282  {
283  //loop over all FEDs. Maps should have same content and be in order so, avoid searches by iterating (and checking keys match)
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) {
291  continue;
292  }
293  if ((eventId > *iTotalEventCount) && (eventId <= (*iL1ACount) + 1) && (*iAPVAddress == apvAddress)) {
294  matchingFeds.insert(matchingFeds.end(), iTotalEventCount - totalEventCounters->begin());
295  }
296  }
297  }

Referenced by getCollections().

◆ getCollections()

void sistrip::SpyEventMatcher::getCollections ( const edm::EventPrincipal event,
const uint32_t  eventId,
const uint8_t  apvAddress,
const SiStripFedCabling cabling,
MatchingOutput matchingOutput 
)

Definition at line 171 of file SiStripSpyEventMatcher.cc.

175  {
176  //read the input collections from the event
177  const FEDRawDataCollection* inputRawDataPtr = getProduct<FEDRawDataCollection>(event, rawDataTag_);
178  if (!inputRawDataPtr) {
179  throw cms::Exception(mlLabel_) << "Failed to get raw spy data with tag " << rawDataTag_ << " from spy event";
180  }
181  const FEDRawDataCollection& inputRawData = *inputRawDataPtr;
182  CountersPtr inputTotalEventCounters = getCounters(event, totalEventCountersTag_);
183  CountersPtr inputL1ACounters = getCounters(event, l1aCountersTag_);
184  CountersPtr inputAPVAddresses = getCounters(event, apvAddressesTag_, false);
185  const edm::DetSetVector<SiStripRawDigi>* inputScopeDigis =
186  getProduct<edm::DetSetVector<SiStripRawDigi> >(event, scopeDigisTag_);
187  const edm::DetSetVector<SiStripRawDigi>* inputPayloadDigis =
188  getProduct<edm::DetSetVector<SiStripRawDigi> >(event, payloadDigisTag_);
189  const edm::DetSetVector<SiStripRawDigi>* inputReorderedDigis =
190  getProduct<edm::DetSetVector<SiStripRawDigi> >(event, reorderedDigisTag_);
191  const edm::DetSetVector<SiStripRawDigi>* inputVirginRawDigis =
192  getProduct<edm::DetSetVector<SiStripRawDigi> >(event, virginRawDigisTag_);
193  //construct the output vectors if the digis were found and they do not exist
194  if (inputScopeDigis && !mo.outputScopeDigisVector_.get())
195  mo.outputScopeDigisVector_.reset(new std::vector<edm::DetSet<SiStripRawDigi> >);
196  if (inputPayloadDigis && !mo.outputPayloadDigisVector_.get())
197  mo.outputPayloadDigisVector_.reset(new std::vector<edm::DetSet<SiStripRawDigi> >);
198  if (inputReorderedDigis && !mo.outputReorderedDigisVector_.get())
199  mo.outputReorderedDigisVector_.reset(new std::vector<edm::DetSet<SiStripRawDigi> >);
200  if (inputVirginRawDigis && !mo.outputVirginRawDigisVector_.get())
201  mo.outputVirginRawDigisVector_.reset(new std::vector<edm::DetSet<SiStripRawDigi> >);
202  //find matching FEDs
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 << " ";
210  }
211  LogDebug(mlLabel_) << ss.str();
212  //check there are no duplicates
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(),
218  matchingFeds.end(),
219  duplicatesBegin);
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) {
224  ss << *iDup << " ";
225  }
226  ss << ". Output SetSetVectors will be unusable!";
227  LogError(mlLabel_) << ss.str();
228  }
229  //merge the matching data
230  mergeMatchingData(matchingFeds,
231  inputRawData,
232  inputTotalEventCounters,
233  inputL1ACounters,
234  inputAPVAddresses,
235  inputScopeDigis,
236  inputPayloadDigis,
237  inputReorderedDigis,
238  inputVirginRawDigis,
239  mo.outputRawData_,
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(),
247  cabling);
248  mo.alreadyMergedFeds_.insert(matchingFeds.begin(), matchingFeds.end());
249  }

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()

SpyEventMatcher::CountersPtr sistrip::SpyEventMatcher::getCounters ( const edm::EventPrincipal event,
const edm::InputTag tag,
const bool  mapKeyIsByFedID = true 
)
staticprivate

Definition at line 391 of file SiStripSpyEventMatcher.cc.

393  {
394  const std::vector<uint32_t>* vectorFromEvent = getProduct<std::vector<uint32_t> >(event, tag);
395  if (vectorFromEvent) {
396  //vector is from event so, will be deleted when the event is destroyed (and not before)
397  return std::make_shared<CountersWrapper>(vectorFromEvent);
398  } else {
399  const std::map<uint32_t, uint32_t>* mapFromEvent = getProduct<std::map<uint32_t, uint32_t> >(event, tag);
400  if (mapFromEvent) {
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();
405  ++iIdValue) {
406  newVector->at(iIdValue->first) = iIdValue->second;
407  }
408  } else {
409  SpyUtilities::fillFEDMajorities(*mapFromEvent, *newVector);
410  }
411  // std::cout << " -- Map " << tag << std::endl;
412  // for (uint32_t lIt= 0;
413  // lIt < newVector->size();
414  // lIt++) {
415  // std::cout << lIt << " " << newVector->at(lIt) << std::endl;
416  // }
417  //vector was allocated here so, will need to be deleted when finished with
418  CountersPtr newCountersPtr(new CountersWrapper(newVector, true));
419  return newCountersPtr;
420  } else {
421  throw cms::Exception(mlLabel_) << "Unable to get product " << tag << " from spy event";
422  }
423  }
424  }

References event(), Exception, sistrip::FED_ID_MAX, sistrip::SpyUtilities::fillFEDMajorities(), mlLabel_, and GlobalPosition_Frontier_DevDB_cff::tag.

Referenced by addNextEventToMap(), and getCollections().

◆ getMatchedCollections()

void sistrip::SpyEventMatcher::getMatchedCollections ( const uint32_t  eventId,
const uint8_t  apvAddress,
const SpyEventList matchingEvents,
const SiStripFedCabling cabling,
SpyDataCollections collectionsToCreate 
)

Definition at line 251 of file SiStripSpyEventMatcher.cc.

255  {
256  if (!matchingEvents)
257  return;
258  size_t fileNameHash = 0U;
259  FEDRawDataCollection outputRawData;
260  MatchingOutput mo(outputRawData);
261  source_->loopSpecified(
263  fileNameHash,
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());
275  }

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()

template<class T >
const T * sistrip::SpyEventMatcher::getProduct ( const edm::EventPrincipal event,
const edm::InputTag tag 
)
staticprivate

Definition at line 178 of file SiStripSpyEventMatcher.h.

178  {
179  LogDebug(mlLabel_) << "Retrieving product " << tag;
180  // Note: The third argument to getProductByTag can be a nullptr
181  // as long as unscheduled execution of an EDProducer cannot occur
182  // as a result of this function call (and with the current implementation
183  // of SpyEventMatcher unscheduled execution never happens).
184  const std::shared_ptr<const edm::Wrapper<T> > productWrapper = edm::getProductByTag<T>(event, tag, nullptr);
185  if (productWrapper) {
186  return productWrapper->product();
187  } else {
188  return nullptr;
189  }
190  }

References LogDebug, mlLabel_, and GlobalPosition_Frontier_DevDB_cff::tag.

◆ initialize()

void sistrip::SpyEventMatcher::initialize ( )

Definition at line 79 of file SiStripSpyEventMatcher.cc.

79  {
80  size_t fileNameHash = 0U;
81  //add spy events to the map until there are none left
82  source_->loopOverEvents(
84  fileNameHash,
86  [this](auto const& iE, auto const&) {
87  this->addNextEventToMap(iE);
88  return true;
89  },
90  nullptr,
91  nullptr,
92  false);
93  //debug
94  std::ostringstream ss;
95  ss << "Events with possible matches (eventID,apvAddress): ";
96  for (std::map<EventKey, SpyEventList>::const_iterator iSpyEvent = eventMatches_.begin();
97  iSpyEvent != eventMatches_.end();
98  ++iSpyEvent) {
99  ss << "(" << iSpyEvent->first.eventId() << "," << uint16_t(iSpyEvent->first.apvAddress()) << ") ";
100  }
101  LogDebug(mlLabel_) << ss.str();
102  }

References addNextEventToMap(), eventMatches_, eventPrincipal_, LogDebug, SiStripPI::max, mlLabel_, source_, contentValuesCheck::ss, and mitigatedMETSequence_cff::U.

◆ matchesForEvent()

const SpyEventMatcher::SpyEventList * sistrip::SpyEventMatcher::matchesForEvent ( const uint32_t  eventId,
const uint8_t  apvAddress 
) const

Definition at line 151 of file SiStripSpyEventMatcher.cc.

152  {
153  EventKey eventKey(eventId, apvAddress);
154  std::map<EventKey, SpyEventList>::const_iterator iMatch = eventMatches_.find(eventKey);
155  if (iMatch == eventMatches_.end()) {
156  LogDebug(mlLabel_) << "No match found for event " << eventId << " with APV address " << uint16_t(apvAddress);
157  return nullptr;
158  } else {
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() << " ";
165  }
166  LogInfo(mlLabel_) << ss.str();
167  return &(iMatch->second);
168  }
169  }

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.

316  {
317  //reserve space in vectors
318  if (inputScopeDigis) {
319  outputScopeDigisVector->reserve(outputScopeDigisVector->size() +
320  matchingFeds.size() *
321  FEDCH_PER_FED); //maximum number of channels on matching FEDs
322  }
323  if (inputPayloadDigis) {
324  outputPayloadDigisVector->reserve(outputPayloadDigisVector->size() + matchingFeds.size() * FEDCH_PER_FED);
325  }
326  if (inputReorderedDigis) {
327  outputReorderedDigisVector->reserve(outputReorderedDigisVector->size() + matchingFeds.size() * FEDCH_PER_FED);
328  }
329  if (inputVirginRawDigis) {
330  outputVirginRawDigisVector->reserve(outputVirginRawDigisVector->size() +
331  matchingFeds.size() * FEDCH_PER_FED /
332  2); //maximum number of dets on matching FEDs
333  }
334  //copy the data into output collections
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;
338  LogDebug(mlLabel_) << "Copying data for FED " << fedId;
339  if (inputRawData.FEDData(fedId).size() && inputRawData.FEDData(fedId).data()) {
340  outputRawData.FEDData(fedId) = inputRawData.FEDData(fedId);
341  }
342  outputTotalEventCounters[fedId] = (*inputTotalEventCounters)[fedId];
343  outputL1ACounters[fedId] = (*inputL1ACounters)[fedId];
344  outputAPVAddresses[fedId] = (*inputAPVAddresses)[fedId];
345  for (uint8_t chan = 0; chan < FEDCH_PER_FED; ++chan) {
346  uint32_t fedIndex = ((fedId & sistrip::invalid_) << 16) | (chan & sistrip::invalid_);
347  ;
348  if (inputScopeDigis) {
349  edm::DetSetVector<SiStripRawDigi>::const_iterator iScopeDigis = inputScopeDigis->find(fedIndex);
350  if (iScopeDigis != inputScopeDigis->end()) {
351  outputScopeDigisVector->push_back(*iScopeDigis);
352  }
353  }
354  if (inputPayloadDigis) {
355  edm::DetSetVector<SiStripRawDigi>::const_iterator iPayloadDigis = inputPayloadDigis->find(fedIndex);
356  if (iPayloadDigis != inputPayloadDigis->end()) {
357  outputPayloadDigisVector->push_back(*iPayloadDigis);
358  }
359  }
360  if (inputReorderedDigis) {
361  edm::DetSetVector<SiStripRawDigi>::const_iterator iReorderedDigis = inputReorderedDigis->find(fedIndex);
362  if (iReorderedDigis != inputReorderedDigis->end()) {
363  outputReorderedDigisVector->push_back(*iReorderedDigis);
364  }
365  }
366  }
367  if (inputVirginRawDigis) {
368  std::set<uint32_t> fedDetIds;
369  auto conns = cabling.fedConnections(fedId);
370  for (auto iConn = conns.begin(); iConn != conns.end(); ++iConn) {
371  if (!iConn->isConnected())
372  continue;
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;
376  continue;
377  }
378  fedDetIds.insert(iConn->detId());
379  }
380  usedDetIds.insert(fedDetIds.begin(), fedDetIds.end());
381  for (std::set<uint32_t>::const_iterator iDetId = fedDetIds.begin(); iDetId != fedDetIds.end(); ++iDetId) {
382  edm::DetSetVector<SiStripRawDigi>::const_iterator iVirginRawDigis = inputVirginRawDigis->find(*iDetId);
383  if (iVirginRawDigis != inputVirginRawDigis->end()) {
384  outputVirginRawDigisVector->push_back(*iVirginRawDigis);
385  }
386  }
387  }
388  }
389  }

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()()

void sistrip::SpyEventMatcher::operator() ( const edm::EventPrincipal event)
private

Member Data Documentation

◆ apvAddressesTag_

edm::InputTag sistrip::SpyEventMatcher::apvAddressesTag_
private

Definition at line 164 of file SiStripSpyEventMatcher.h.

Referenced by addNextEventToMap(), and getCollections().

◆ counterDiffMax_

uint32_t sistrip::SpyEventMatcher::counterDiffMax_
private

Definition at line 169 of file SiStripSpyEventMatcher.h.

Referenced by addNextEventToMap().

◆ eventMatches_

std::map<EventKey, SpyEventList> sistrip::SpyEventMatcher::eventMatches_
private

Definition at line 160 of file SiStripSpyEventMatcher.h.

Referenced by addNextEventToMap(), initialize(), and matchesForEvent().

◆ eventPrincipal_

std::unique_ptr<edm::EventPrincipal> sistrip::SpyEventMatcher::eventPrincipal_
private

Definition at line 173 of file SiStripSpyEventMatcher.h.

Referenced by getMatchedCollections(), initialize(), and SpyEventMatcher().

◆ l1aCountersTag_

edm::InputTag sistrip::SpyEventMatcher::l1aCountersTag_
private

Definition at line 163 of file SiStripSpyEventMatcher.h.

Referenced by addNextEventToMap(), and getCollections().

◆ mlLabel_

const char * sistrip::SpyEventMatcher::mlLabel_ = "SpyEventMatcher"
staticprivate

◆ payloadDigisTag_

edm::InputTag sistrip::SpyEventMatcher::payloadDigisTag_
private

Definition at line 166 of file SiStripSpyEventMatcher.h.

Referenced by getCollections().

◆ processConfiguration_

std::unique_ptr<edm::ProcessConfiguration> sistrip::SpyEventMatcher::processConfiguration_
private

Definition at line 172 of file SiStripSpyEventMatcher.h.

Referenced by SpyEventMatcher().

◆ productRegistry_

std::shared_ptr<edm::ProductRegistry> sistrip::SpyEventMatcher::productRegistry_
private

Definition at line 170 of file SiStripSpyEventMatcher.h.

Referenced by constructSource(), and SpyEventMatcher().

◆ rawDataTag_

edm::InputTag sistrip::SpyEventMatcher::rawDataTag_
private

Definition at line 161 of file SiStripSpyEventMatcher.h.

Referenced by getCollections().

◆ reorderedDigisTag_

edm::InputTag sistrip::SpyEventMatcher::reorderedDigisTag_
private

Definition at line 167 of file SiStripSpyEventMatcher.h.

Referenced by getCollections().

◆ scopeDigisTag_

edm::InputTag sistrip::SpyEventMatcher::scopeDigisTag_
private

Definition at line 165 of file SiStripSpyEventMatcher.h.

Referenced by getCollections().

◆ source_

const std::unique_ptr<edm::VectorInputSource> sistrip::SpyEventMatcher::source_
private

◆ totalEventCountersTag_

edm::InputTag sistrip::SpyEventMatcher::totalEventCountersTag_
private

Definition at line 162 of file SiStripSpyEventMatcher.h.

Referenced by addNextEventToMap(), and getCollections().

◆ virginRawDigisTag_

edm::InputTag sistrip::SpyEventMatcher::virginRawDigisTag_
private

Definition at line 168 of file SiStripSpyEventMatcher.h.

Referenced by getCollections().

edm::DetSetVector< SiStripRawDigi >
sistrip::SpyEventMatcher::payloadDigisTag_
edm::InputTag payloadDigisTag_
Definition: SiStripSpyEventMatcher.h:166
sistrip::SpyEventMatcher::counterDiffMax_
uint32_t counterDiffMax_
Definition: SiStripSpyEventMatcher.h:169
edm::DetSetVector::end
iterator end()
Return the off-the-end iterator.
Definition: DetSetVector.h:325
edm::DetSet
Definition: DetSet.h:23
sistrip::SpyEventMatcher::getCounters
static CountersPtr getCounters(const edm::EventPrincipal &event, const edm::InputTag &tag, const bool mapKeyIsByFedID=true)
Definition: SiStripSpyEventMatcher.cc:391
min
T min(T a, T b)
Definition: MathUtil.h:58
sistrip::SpyEventMatcher::virginRawDigisTag_
edm::InputTag virginRawDigisTag_
Definition: SiStripSpyEventMatcher.h:168
FEDRawDataCollection
Definition: FEDRawDataCollection.h:18
edmLumisInFiles.description
description
Definition: edmLumisInFiles.py:11
edm::LogInfo
Definition: MessageLogger.h:254
edm::VectorInputSourceDescription
Definition: VectorInputSourceDescription.h:18
sistrip::SpyEventMatcher::l1aCountersTag_
edm::InputTag l1aCountersTag_
Definition: SiStripSpyEventMatcher.h:163
edm::ParameterSet::emptyParameterSetID
static ParameterSetID emptyParameterSetID()
Definition: ParameterSet.cc:87
sistrip::SpyEventMatcher::constructSource
std::unique_ptr< Source > constructSource(const edm::ParameterSet &sourceConfig)
Definition: SiStripSpyEventMatcher.cc:73
edm::getPassID
std::string getPassID()
Definition: GetPassID.h:7
edm::EventPrincipal::id
EventID const & id() const
Definition: EventPrincipal.h:92
FEDRawData::data
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:24
sistrip::SpyEventMatcher::mergeMatchingData
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)
Definition: SiStripSpyEventMatcher.cc:299
contentValuesCheck.ss
ss
Definition: contentValuesCheck.py:33
config
Definition: config.py:1
edm::VectorInputSourceFactory::makeVectorInputSource
std::unique_ptr< VectorInputSource > makeVectorInputSource(ParameterSet const &, VectorInputSourceDescription const &) const
Definition: VectorInputSourceFactory.cc:28
sistrip::SpyUtilities::fillFEDMajorities
static void fillFEDMajorities(const std::map< uint32_t, uint32_t > &channelValues, std::vector< uint32_t > &fedMajoritiesToFill)
Definition: SiStripSpyUtilities.cc:439
edm::EventPrincipal
Definition: EventPrincipal.h:46
sistrip::SpyEventMatcher::scopeDigisTag_
edm::InputTag scopeDigisTag_
Definition: SiStripSpyEventMatcher.h:165
GlobalPosition_Frontier_DevDB_cff.tag
tag
Definition: GlobalPosition_Frontier_DevDB_cff.py:11
sistrip::SpyEventMatcher::getCollections
void getCollections(const edm::EventPrincipal &event, const uint32_t eventId, const uint8_t apvAddress, const SiStripFedCabling &cabling, MatchingOutput &matchingOutput)
Definition: SiStripSpyEventMatcher.cc:171
sistrip::SpyEventMatcher::processConfiguration_
std::unique_ptr< edm::ProcessConfiguration > processConfiguration_
Definition: SiStripSpyEventMatcher.h:172
sistrip::SpyEventMatcher::productRegistry_
std::shared_ptr< edm::ProductRegistry > productRegistry_
Definition: SiStripSpyEventMatcher.h:170
FEDRawDataCollection::FEDData
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
Definition: FEDRawDataCollection.cc:19
mitigatedMETSequence_cff.U
U
Definition: mitigatedMETSequence_cff.py:36
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
sistrip::SpyEventMatcher::totalEventCountersTag_
edm::InputTag totalEventCountersTag_
Definition: SiStripSpyEventMatcher.h:162
sistrip::SpyEventMatcher::eventMatches_
std::map< EventKey, SpyEventList > eventMatches_
Definition: SiStripSpyEventMatcher.h:160
edm::LogWarning
Definition: MessageLogger.h:141
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:670
edm::ParameterSet
Definition: ParameterSet.h:36
edm::LogError
Definition: MessageLogger.h:183
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
edm::DetSetVector::const_iterator
collection_type::const_iterator const_iterator
Definition: DetSetVector.h:102
sistrip::SpyEventMatcher::findMatchingFeds
static void findMatchingFeds(const uint32_t eventId, const uint8_t apvAddress, CountersPtr totalEventCounters, CountersPtr l1aCounters, CountersPtr apvAddresses, std::set< uint16_t > &matchingFeds)
Definition: SiStripSpyEventMatcher.cc:277
sistrip::SpyEventMatcher::rawDataTag_
edm::InputTag rawDataTag_
Definition: SiStripSpyEventMatcher.h:161
edm::DetSetVector::find
iterator find(det_id_type id)
Definition: DetSetVector.h:264
edm::EventID::event
EventNumber_t event() const
Definition: EventID.h:40
sistrip::SpyEventMatcher::mlLabel_
static const char * mlLabel_
Definition: SiStripSpyEventMatcher.h:174
sistrip::SpyEventMatcher::apvAddressesTag_
edm::InputTag apvAddressesTag_
Definition: SiStripSpyEventMatcher.h:164
edm::VectorInputSourceFactory
Definition: VectorInputSourceFactory.h:17
sistrip::invalid_
static const uint16_t invalid_
Definition: Constants.h:16
l1tstage2_dqm_sourceclient-live_cfg.fedId
fedId
Definition: l1tstage2_dqm_sourceclient-live_cfg.py:82
PixelSLinkDataInputSource_cfi.fedid
fedid
Definition: PixelSLinkDataInputSource_cfi.py:6
FEDRawData::size
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:45
sistrip::FED_ID_MAX
static const uint16_t FED_ID_MAX
Definition: ConstantsForHardwareSystems.h:22
sistrip::SpyEventMatcher::addNextEventToMap
void addNextEventToMap(const edm::EventPrincipal &nextSpyEvent)
Definition: SiStripSpyEventMatcher.cc:104
edm::PreallocationConfiguration
Definition: PreallocationConfiguration.h:27
officialStyle.chan
chan
lumi = TPaveText(lowX+0.38, lowY+0.061, lowX+0.45, lowY+0.161, "NDC") lumi.SetBorderSize( 0 ) lumi....
Definition: officialStyle.py:106
edm::getReleaseVersion
std::string getReleaseVersion()
Definition: GetReleaseVersion.cc:7
Exception
Definition: hltDiff.cc:246
sistrip::SpyEventMatcher::eventPrincipal_
std::unique_ptr< edm::EventPrincipal > eventPrincipal_
Definition: SiStripSpyEventMatcher.h:173
sistrip::SpyEventMatcher::CountersPtr
std::shared_ptr< CountersWrapper > CountersPtr
Definition: SiStripSpyEventMatcher.h:121
sistrip::FEDCH_PER_FED
static const uint16_t FEDCH_PER_FED
Definition: ConstantsForHardwareSystems.h:30
sistrip::SpyEventMatcher::source_
const std::unique_ptr< edm::VectorInputSource > source_
Definition: SiStripSpyEventMatcher.h:171
event
Definition: event.py:1
edm::EventID
Definition: EventID.h:31
SiStripFedCabling::fedConnections
ConnsConstIterRange fedConnections(uint16_t fed_id) const
Definition: SiStripFedCabling.cc:160
sistrip::SpyEventMatcher::reorderedDigisTag_
edm::InputTag reorderedDigisTag_
Definition: SiStripSpyEventMatcher.h:167
crabWrapper.key
key
Definition: crabWrapper.py:19
event
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
edm::VectorInputSourceFactory::get
static VectorInputSourceFactory const * get()
Definition: VectorInputSourceFactory.cc:20
edm::InputTag
Definition: InputTag.h:15
edm::ProcessConfiguration
Definition: ProcessConfiguration.h:14
edm::SignallingProductRegistry
Definition: SignallingProductRegistry.h:32