CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SiStripSpyEventMatcher.cc
Go to the documentation of this file.
2 #ifdef SiStripMonitorHardware_BuildEventMatchingCode
3 
24 #include "boost/bind.hpp"
25 #include <algorithm>
26 #include <limits>
27 #include <memory>
28 
29 using edm::LogInfo;
30 using edm::LogWarning;
31 using edm::LogError;
32 
33 namespace sistrip {
34 
35  const char* SpyEventMatcher::mlLabel_ = "SpyEventMatcher";
36 
37  SpyEventMatcher::EventKey::EventKey(const uint32_t eventId, const uint8_t apvAddress)
38  : eventId_(eventId), apvAddress_(apvAddress) {}
39 
41  outputRawData_(outputRawData),
42  outputTotalEventCounters_(sistrip::FED_ID_MAX+1),
43  outputL1ACounters_(sistrip::FED_ID_MAX+1),
44  outputAPVAddresses_(sistrip::FED_ID_MAX+1) {}
45 
47 
49  : rawDataTag_(config.getParameter<edm::InputTag>("RawSpyDataTag")),
50  totalEventCountersTag_(config.getParameter<edm::InputTag>("SpyTotalEventCountersTag")),
51  l1aCountersTag_(config.getParameter<edm::InputTag>("SpyL1ACountersTag")),
52  apvAddressesTag_(config.getParameter<edm::InputTag>("SpyAPVAddressesTag")),
53  scopeDigisTag_(config.getParameter<edm::InputTag>("SpyScopeDigisTag")),
54  payloadDigisTag_(config.getParameter<edm::InputTag>("SpyPayloadDigisTag")),
55  reorderedDigisTag_(config.getParameter<edm::InputTag>("SpyReorderedDigisTag")),
56  virginRawDigisTag_(config.getParameter<edm::InputTag>("SpyVirginRawDigisTag")),
57  counterDiffMax_(config.getParameter<uint32_t>("CounterDiffMaxAllowed")),
59  source_(constructSource(config.getParameter<edm::ParameterSet>("SpySource"))),
60  processConfiguration_(new edm::ProcessConfiguration(std::string("@MIXING"), edm::getReleaseVersion(), edm::getPassID())),
62  {
63  // Use the empty parameter set for the parameter set ID of our "@MIXING" process.
65  productRegistry_->setFrozen();
66 
67  eventPrincipal_.reset(new edm::EventPrincipal(source_->productRegistry(),
68  source_->branchIDListHelper(),
69  source_->thinnedAssociationsHelper(),
71  nullptr));
72  }
73 
74  std::unique_ptr<SpyEventMatcher::Source> SpyEventMatcher::constructSource(const edm::ParameterSet& sourceConfig)
75  {
79  std::make_shared<edm::BranchIDListHelper>(),
80  std::make_shared<edm::ThinnedAssociationsHelper>(),
81  std::make_shared<edm::ActivityRegistry>(),
82  -1, -1, -1,
84  return sourceFactory->makeVectorInputSource(sourceConfig, description);
85  }
86 
88  {
89  size_t fileNameHash = 0U;
90  //add spy events to the map until there are none left
91  source_->loopSequential(*eventPrincipal_,fileNameHash,std::numeric_limits<size_t>::max(),boost::bind(&SpyEventMatcher::addNextEventToMap,this,_1));
92  //debug
93  std::ostringstream ss;
94  ss << "Events with possible matches (eventID,apvAddress): ";
95  for (std::map<EventKey,SpyEventList>::const_iterator iSpyEvent = eventMatches_.begin(); iSpyEvent != eventMatches_.end(); ++iSpyEvent) {
96  ss << "(" << iSpyEvent->first.eventId() << "," << uint16_t(iSpyEvent->first.apvAddress()) << ") ";
97  }
98  LogDebug(mlLabel_) << ss.str();
99  }
100 
102  {
103  edm::EventID spyEventId = nextSpyEvent.id();
104 
105  CountersPtr totalEventCounters = getCounters(nextSpyEvent,totalEventCountersTag_);
106  CountersPtr l1aCounters = getCounters(nextSpyEvent,l1aCountersTag_);
107  CountersPtr apvAddresses = getCounters(nextSpyEvent,apvAddressesTag_,false);
108  //loop over all FEDs. Maps should have same content and be in order so, avoid searches by iterating (and checking keys match)
109  //add all possible event keys to the map
110  std::vector<uint32_t>::const_iterator iTotalEventCount = totalEventCounters->begin();
111  std::vector<uint32_t>::const_iterator iL1ACount = l1aCounters->begin();
112  std::vector<uint32_t>::const_iterator iAPVAddress = apvAddresses->begin();
113  //for debug
114  std::map<EventKey,uint16_t> fedCounts;
115  unsigned int fedid = 0;
116  for (;
117  ( (iTotalEventCount != totalEventCounters->end()) && (iL1ACount != l1aCounters->end()) && (iAPVAddress != apvAddresses->end()) );
118  (++iTotalEventCount, ++iL1ACount, ++iAPVAddress, ++fedid)
119  ){
120  if (*iAPVAddress == 0) {
121  continue;
122  }
123 
124  if ( ((*iTotalEventCount) > (*iL1ACount) ) ||
125  ((*iL1ACount)-(*iTotalEventCount) > counterDiffMax_)
126  ) {
127  LogWarning(mlLabel_) << "Spy event " << spyEventId.event()
128  << " error in counter values for FED " << fedid
129  << ", totCount = " << *iTotalEventCount
130  << ", L1Acount = " << *iL1ACount
131  << std::endl;
132 
133  continue;
134  }
135 
136  for (uint32_t eventId = (*iTotalEventCount)+1; eventId <= (*iL1ACount)+1; ++eventId) {
137  EventKey key(eventId,*iAPVAddress);
138  eventMatches_[key].insert(spyEventId);
139  fedCounts[key]++;
140  }
141  }
142 
143  //for debug
144  std::ostringstream ss;
145  ss << "Spy event " << spyEventId.event() << " matches (eventID,apvAddress,nFEDs): ";
146  for (std::map<EventKey,uint16_t>::const_iterator iEventFEDCount = fedCounts.begin(); iEventFEDCount != fedCounts.end(); ++iEventFEDCount) {
147  ss << "(" << iEventFEDCount->first.eventId() << "," << uint16_t(iEventFEDCount->first.apvAddress()) << "," << iEventFEDCount->second << ") ";
148  }
149  LogDebug(mlLabel_) << ss.str();
150  }
151 
152  const SpyEventMatcher::SpyEventList* SpyEventMatcher::matchesForEvent(const uint32_t eventId, const uint8_t apvAddress) const
153  {
154  EventKey eventKey(eventId,apvAddress);
155  std::map<EventKey,SpyEventList>::const_iterator iMatch = eventMatches_.find(eventKey);
156  if (iMatch == eventMatches_.end()) {
157  LogDebug(mlLabel_) << "No match found for event " << eventId << " with APV address " << uint16_t(apvAddress);
158  return NULL;
159  }
160  else {
161  std::ostringstream ss;
162  ss << "Found matches to event " << eventId << " with address " << uint16_t(apvAddress) << " in spy events ";
163  for (SpyEventList::const_iterator iMatchingSpyEvent = iMatch->second.begin(); iMatchingSpyEvent != iMatch->second.end(); ++iMatchingSpyEvent) {
164  ss << iMatchingSpyEvent->event() << " ";
165  }
166  LogInfo(mlLabel_) << ss.str();
167  return &(iMatch->second);
168  }
169  }
170 
171  void SpyEventMatcher::getCollections(const edm::EventPrincipal& event, const uint32_t eventId,
172  const uint8_t apvAddress, const SiStripFedCabling& cabling,
173  MatchingOutput& mo) {
174 
175  //read the input collections from the event
176  const FEDRawDataCollection* inputRawDataPtr = getProduct< FEDRawDataCollection >(event,rawDataTag_);
177  if (!inputRawDataPtr) {
178  throw cms::Exception(mlLabel_) << "Failed to get raw spy data with tag " << rawDataTag_ << " from spy event";
179  }
180  const FEDRawDataCollection& inputRawData = *inputRawDataPtr;
181  CountersPtr inputTotalEventCounters = getCounters(event,totalEventCountersTag_);
182  CountersPtr inputL1ACounters = getCounters(event,l1aCountersTag_);
183  CountersPtr inputAPVAddresses = getCounters(event,apvAddressesTag_,false);
184  const edm::DetSetVector<SiStripRawDigi>* inputScopeDigis = getProduct< edm::DetSetVector<SiStripRawDigi> >(event,scopeDigisTag_);
185  const edm::DetSetVector<SiStripRawDigi>* inputPayloadDigis = getProduct< edm::DetSetVector<SiStripRawDigi> >(event,payloadDigisTag_);
186  const edm::DetSetVector<SiStripRawDigi>* inputReorderedDigis = getProduct< edm::DetSetVector<SiStripRawDigi> >(event,reorderedDigisTag_);
187  const edm::DetSetVector<SiStripRawDigi>* inputVirginRawDigis = getProduct< edm::DetSetVector<SiStripRawDigi> >(event,virginRawDigisTag_);
188  //construct the output vectors if the digis were found and they do not exist
189  if (inputScopeDigis && !mo.outputScopeDigisVector_.get() ) mo.outputScopeDigisVector_.reset(new std::vector< edm::DetSet<SiStripRawDigi> >);
190  if (inputPayloadDigis && !mo.outputPayloadDigisVector_.get() ) mo.outputPayloadDigisVector_.reset(new std::vector< edm::DetSet<SiStripRawDigi> >);
191  if (inputReorderedDigis && !mo.outputReorderedDigisVector_.get() ) mo.outputReorderedDigisVector_.reset(new std::vector< edm::DetSet<SiStripRawDigi> >);
192  if (inputVirginRawDigis && !mo.outputVirginRawDigisVector_.get() ) mo.outputVirginRawDigisVector_.reset(new std::vector< edm::DetSet<SiStripRawDigi> >);
193  //find matching FEDs
194  std::set<uint16_t> matchingFeds;
195  findMatchingFeds(eventId,apvAddress,inputTotalEventCounters,inputL1ACounters,inputAPVAddresses,matchingFeds);
196  LogInfo(mlLabel_) << "Spy event " << event.id() << " has " << matchingFeds.size() << " matching FEDs";
197  std::ostringstream ss;
198  ss << "Matching FEDs for event " << event.id() << ": ";
199  for (std::set<uint16_t>::const_iterator iFedId = matchingFeds.begin(); iFedId != matchingFeds.end(); ++iFedId) {
200  ss << *iFedId << " ";
201  }
202  LogDebug(mlLabel_) << ss.str();
203  //check there are no duplicates
204  std::vector<uint16_t> duplicateFeds( std::min(mo.alreadyMergedFeds_.size(),matchingFeds.size()) );
205  std::vector<uint16_t>::iterator duplicatesBegin = duplicateFeds.begin();
206  std::vector<uint16_t>::iterator duplicatesEnd = std::set_intersection(mo.alreadyMergedFeds_.begin(),mo.alreadyMergedFeds_.end(),
207  matchingFeds.begin(),matchingFeds.end(),
208  duplicatesBegin);
209  if ( (duplicatesEnd-duplicatesBegin) != 0 ) {
210  std::ostringstream ss;
211  ss << "Found a match for FEDs ";
212  for (std::vector<uint16_t>::const_iterator iDup = duplicatesBegin; iDup != duplicatesEnd; ++iDup) {
213  ss << *iDup << " ";
214  }
215  ss << ". Output SetSetVectors will be unusable!";
216  LogError(mlLabel_) << ss.str();
217  }
218  //merge the matching data
219  mergeMatchingData(matchingFeds,inputRawData,inputTotalEventCounters,inputL1ACounters,inputAPVAddresses,
220  inputScopeDigis,inputPayloadDigis,inputReorderedDigis,inputVirginRawDigis,
224  cabling);
225  mo.alreadyMergedFeds_.insert(matchingFeds.begin(),matchingFeds.end());
226  }
227 
228  void SpyEventMatcher::getMatchedCollections(const uint32_t eventId, const uint8_t apvAddress,
229  const SpyEventList* matchingEvents, const SiStripFedCabling& cabling,
230  SpyDataCollections& collectionsToCreate)
231  {
232  if (!matchingEvents) return;
233  size_t fileNameHash = 0U;
234  FEDRawDataCollection outputRawData;
235  MatchingOutput mo(outputRawData);
236  source_->loopSpecified(*eventPrincipal_,fileNameHash,matchingEvents->begin(),matchingEvents->end(),boost::bind(&SpyEventMatcher::getCollections,this,_1,
237  eventId,apvAddress,boost::cref(cabling),boost::ref(mo)));
241  collectionsToCreate = collections;
242  }
243 
244  void SpyEventMatcher::findMatchingFeds(const uint32_t eventId, const uint8_t apvAddress,
245  SpyEventMatcher::CountersPtr totalEventCounters,
246  SpyEventMatcher::CountersPtr l1aCounters,
247  SpyEventMatcher::CountersPtr apvAddresses,
248  std::set<uint16_t>& matchingFeds)
249  {
250  //loop over all FEDs. Maps should have same content and be in order so, avoid searches by iterating (and checking keys match)
251  std::vector<uint32_t>::const_iterator iTotalEventCount = totalEventCounters->begin();
252  std::vector<uint32_t>::const_iterator iL1ACount = l1aCounters->begin();
253  std::vector<uint32_t>::const_iterator iAPVAddress = apvAddresses->begin();
254  for (;
255  ( (iTotalEventCount != totalEventCounters->end()) && (iL1ACount != l1aCounters->end()) && (iAPVAddress != apvAddresses->end()) );
256  (++iTotalEventCount, ++iL1ACount, ++iAPVAddress)
257  ){
258  if (*iAPVAddress == 0) {
259  continue;
260  }
261  if ( (eventId > *iTotalEventCount) && (eventId <= (*iL1ACount)+1) && (*iAPVAddress == apvAddress) ) {
262  matchingFeds.insert(matchingFeds.end(),iTotalEventCount-totalEventCounters->begin());
263  }
264  }
265  }
266 
267  void SpyEventMatcher::mergeMatchingData(const std::set<uint16_t>& matchingFeds,
268  const FEDRawDataCollection& inputRawData,
269  SpyEventMatcher::CountersPtr inputTotalEventCounters,
270  SpyEventMatcher::CountersPtr inputL1ACounters,
271  SpyEventMatcher::CountersPtr inputAPVAddresses,
272  const edm::DetSetVector<SiStripRawDigi>* inputScopeDigis,
273  const edm::DetSetVector<SiStripRawDigi>* inputPayloadDigis,
274  const edm::DetSetVector<SiStripRawDigi>* inputReorderedDigis,
275  const edm::DetSetVector<SiStripRawDigi>* inputVirginRawDigis,
276  FEDRawDataCollection& outputRawData,
277  std::vector<uint32_t>& outputTotalEventCounters,
278  std::vector<uint32_t>& outputL1ACounters,
279  std::vector<uint32_t>& outputAPVAddresses,
280  std::vector< edm::DetSet<SiStripRawDigi> >* outputScopeDigisVector,
281  std::vector< edm::DetSet<SiStripRawDigi> >* outputPayloadDigisVector,
282  std::vector< edm::DetSet<SiStripRawDigi> >* outputReorderedDigisVector,
283  std::vector< edm::DetSet<SiStripRawDigi> >* outputVirginRawDigisVector,
284  const SiStripFedCabling& cabling)
285  {
286  //reserve space in vectors
287  if (inputScopeDigis) {
288  outputScopeDigisVector->reserve(outputScopeDigisVector->size()+matchingFeds.size()*FEDCH_PER_FED); //maximum number of channels on matching FEDs
289  }
290  if (inputPayloadDigis) {
291  outputPayloadDigisVector->reserve(outputPayloadDigisVector->size()+matchingFeds.size()*FEDCH_PER_FED);
292  }
293  if (inputReorderedDigis) {
294  outputReorderedDigisVector->reserve(outputReorderedDigisVector->size()+matchingFeds.size()*FEDCH_PER_FED);
295  }
296  if (inputVirginRawDigis) {
297  outputVirginRawDigisVector->reserve(outputVirginRawDigisVector->size()+matchingFeds.size()*FEDCH_PER_FED/2); //maximum number of dets on matching FEDs
298  }
299  //copy the data into output collections
300  std::set<uint32_t> usedDetIds;
301  for (std::set<uint16_t>::const_iterator iFedId = matchingFeds.begin(); iFedId != matchingFeds.end(); ++iFedId) {
302  const uint32_t fedId = *iFedId;
303  LogDebug(mlLabel_) << "Copying data for FED " << fedId;
304  if (inputRawData.FEDData(fedId).size() && inputRawData.FEDData(fedId).data()) {
305  outputRawData.FEDData(fedId) = inputRawData.FEDData(fedId);
306  }
307  outputTotalEventCounters[fedId] = (*inputTotalEventCounters)[fedId];
308  outputL1ACounters[fedId] = (*inputL1ACounters)[fedId];
309  outputAPVAddresses[fedId] = (*inputAPVAddresses)[fedId];
310  for (uint8_t chan = 0; chan < FEDCH_PER_FED; ++chan) {
311  uint32_t fedIndex = SiStripFedKey::fedIndex(fedId,chan);
312  if (inputScopeDigis) {
313  edm::DetSetVector<SiStripRawDigi>::const_iterator iScopeDigis = inputScopeDigis->find(fedIndex);
314  if (iScopeDigis != inputScopeDigis->end()) {
315  outputScopeDigisVector->push_back(*iScopeDigis);
316  }
317  }
318  if (inputPayloadDigis) {
319  edm::DetSetVector<SiStripRawDigi>::const_iterator iPayloadDigis = inputPayloadDigis->find(fedIndex);
320  if (iPayloadDigis != inputPayloadDigis->end()) {
321  outputPayloadDigisVector->push_back(*iPayloadDigis);
322  }
323  }
324  if (inputReorderedDigis) {
325  edm::DetSetVector<SiStripRawDigi>::const_iterator iReorderedDigis = inputReorderedDigis->find(fedIndex);
326  if (iReorderedDigis != inputReorderedDigis->end()) {
327  outputReorderedDigisVector->push_back(*iReorderedDigis);
328  }
329  }
330  }
331  if (inputVirginRawDigis) {
332  std::set<uint32_t> fedDetIds;
333  auto conns = cabling.fedConnections(fedId);
334  for (auto iConn = conns.begin(); iConn != conns.end(); ++iConn) {
335  if (!iConn->isConnected()) continue;
336  const uint32_t detId = iConn->detId();
337  if (usedDetIds.find(detId) != usedDetIds.end()) {
338  LogError(mlLabel_) << "Duplicate DetID found " << detId << " skipping data for this Det from FED " << fedId;
339  continue;
340  }
341  fedDetIds.insert(iConn->detId());
342  }
343  usedDetIds.insert(fedDetIds.begin(),fedDetIds.end());
344  for (std::set<uint32_t>::const_iterator iDetId = fedDetIds.begin(); iDetId != fedDetIds.end(); ++iDetId) {
345  edm::DetSetVector<SiStripRawDigi>::const_iterator iVirginRawDigis = inputVirginRawDigis->find(*iDetId);
346  if (iVirginRawDigis != inputVirginRawDigis->end()) {
347  outputVirginRawDigisVector->push_back(*iVirginRawDigis);
348  }
349  }
350  }
351  }
352  }
353 
355  {
356  const std::vector<uint32_t>* vectorFromEvent = getProduct< std::vector<uint32_t> >(event,tag);
357  if (vectorFromEvent) {
358  //vector is from event so, will be deleted when the event is destroyed (and not before)
359  return CountersPtr(new CountersWrapper(vectorFromEvent) );
360  } else {
361  const std::map<uint32_t,uint32_t>* mapFromEvent = getProduct< std::map<uint32_t,uint32_t> >(event,tag);
362  if (mapFromEvent) {
363  std::vector<uint32_t>* newVector = new std::vector<uint32_t>(FED_ID_MAX+1,0);
364  if (mapKeyIsByFedID) {
365  for (std::map<uint32_t,uint32_t>::const_iterator iIdValue = mapFromEvent->begin(); iIdValue != mapFromEvent->end(); ++iIdValue) {
366  newVector->at(iIdValue->first) = iIdValue->second;
367  }
368  } else {
369  SpyUtilities::fillFEDMajorities(*mapFromEvent,*newVector);
370  }
371 // std::cout << " -- Map " << tag << std::endl;
372 // for (uint32_t lIt= 0;
373 // lIt < newVector->size();
374 // lIt++) {
375 // std::cout << lIt << " " << newVector->at(lIt) << std::endl;
376 // }
377  //vector was allocated here so, will need to be deleted when finished with
378  CountersPtr newCountersPtr( new CountersWrapper(newVector,true) );
379  return newCountersPtr;
380  } else {
381  throw cms::Exception(mlLabel_) << "Unable to get product " << tag << " from spy event";
382  }
383  }
384  }
385 
387  std::vector<uint32_t>& theTotalEventCounters,
388  std::vector<uint32_t>& theL1ACounters,
389  std::vector<uint32_t>& theAPVAddresses,
390  std::vector< edm::DetSet<SiStripRawDigi> >* theScopeDigisVector,
391  std::vector< edm::DetSet<SiStripRawDigi> >* thePayloadDigisVector,
392  std::vector< edm::DetSet<SiStripRawDigi> >* theReorderedDigisVector,
393  std::vector< edm::DetSet<SiStripRawDigi> >* theVirginRawDigisVector)
394  : rawData(new FEDRawDataCollection),
395  totalEventCounters(new std::vector<uint32_t>),
396  l1aCounters(new std::vector<uint32_t>),
397  apvAddresses(new std::vector<uint32_t>),
398  scopeDigis(theScopeDigisVector ? new edm::DetSetVector<SiStripRawDigi>(*theScopeDigisVector) : NULL),
399  payloadDigis(thePayloadDigisVector ? new edm::DetSetVector<SiStripRawDigi>(*thePayloadDigisVector) : NULL),
400  reorderedDigis(theReorderedDigisVector ? new edm::DetSetVector<SiStripRawDigi>(*theReorderedDigisVector) : NULL),
401  virginRawDigis(theVirginRawDigisVector ? new edm::DetSetVector<SiStripRawDigi>(*theVirginRawDigisVector) : NULL)
402  {
403  rawData->swap(theRawData);
404  totalEventCounters->swap(theTotalEventCounters);
405  l1aCounters->swap(theL1ACounters);
406  apvAddresses->swap(theAPVAddresses);
407  }
408 
410  : rawData(),
411  totalEventCounters(),
412  l1aCounters(),
413  apvAddresses(),
414  scopeDigis(),
415  payloadDigis(),
416  reorderedDigis(),
417  virginRawDigis()
418  {}
419 
421  {
422  rawData = original.rawData;
423  totalEventCounters = original.totalEventCounters;
424  l1aCounters = original.l1aCounters;
425  apvAddresses = original.apvAddresses;
426  scopeDigis = original.scopeDigis;
427  payloadDigis = original.payloadDigis;
428  virginRawDigis = original.virginRawDigis;
429  return *this;
430  }
431 
433  : pConst(theCounters),
434  p(NULL),
435  deleteP(false)
436  {
437  }
438 
439  SpyEventMatcher::CountersWrapper::CountersWrapper(Counters* theCounters, const bool takeOwnership)
440  : pConst(theCounters),
441  p(theCounters),
442  deleteP(takeOwnership)
443  {
444 
445  }
446 
448  {
449  if (deleteP) delete p;
450  }
451 
452 }
453 
454 #endif //SiStripMonitorHardware_BuildEventMatchingCode
#define LogDebug(id)
EventNumber_t event() const
Definition: EventID.h:41
std::string getPassID()
Definition: GetPassID.h:8
static void findMatchingFeds(const uint32_t eventId, const uint8_t apvAddress, CountersPtr totalEventCounters, CountersPtr l1aCounters, CountersPtr apvAddresses, std::set< uint16_t > &matchingFeds)
iterator find(det_id_type id)
Definition: DetSetVector.h:294
std::auto_ptr< std::vector< uint32_t > > apvAddresses
boost::shared_ptr< CountersWrapper > CountersPtr
std::unique_ptr< edm::EventPrincipal > eventPrincipal_
list original
Definition: definitions.py:57
void getCollections(const edm::EventPrincipal &event, const uint32_t eventId, const uint8_t apvAddress, const SiStripFedCabling &cabling, MatchingOutput &matchingOutput)
EventID const & id() const
static CountersPtr getCounters(const edm::EventPrincipal &event, const edm::InputTag &tag, const bool mapKeyIsByFedID=true)
std::unique_ptr< edm::ProcessConfiguration > processConfiguration_
#define NULL
Definition: scimark2.h:8
void getMatchedCollections(const uint32_t eventId, const uint8_t apvAddress, const SpyEventList *matchingEvents, const SiStripFedCabling &cabling, SpyDataCollections &collectionsToCreate)
std::auto_ptr< std::vector< uint32_t > > l1aCounters
std::auto_ptr< std::vector< uint32_t > > totalEventCounters
SpyDataCollections & operator=(SpyDataCollections original)
static uint32_t fedIndex(const uint16_t &fed_id, const uint16_t &fed_ch)
boost::shared_ptr< std::vector< edm::DetSet< SiStripRawDigi > > > outputReorderedDigisVector_
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:47
boost::shared_ptr< std::vector< edm::DetSet< SiStripRawDigi > > > outputScopeDigisVector_
static void fillFEDMajorities(const std::map< uint32_t, uint32_t > &channelValues, std::vector< uint32_t > &fedMajoritiesToFill)
std::unique_ptr< VectorInputSource > makeVectorInputSource(ParameterSet const &, InputSourceDescription const &) const
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
std::unique_ptr< Source > constructSource(const edm::ParameterSet &sourceConfig)
boost::shared_ptr< std::vector< edm::DetSet< SiStripRawDigi > > > outputPayloadDigisVector_
std::set< EventID > SpyEventList
T min(T a, T b)
Definition: MathUtil.h:58
std::auto_ptr< edm::DetSetVector< SiStripRawDigi > > payloadDigis
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
MatchingOutput(FEDRawDataCollection &outputRawData)
std::unique_ptr< edm::VectorInputSource > const source_
iterator end()
Return the off-the-end iterator.
Definition: DetSetVector.h:365
const SpyEventList * matchesForEvent(const uint32_t eventId, const uint8_t apvAddress) const
std::string getReleaseVersion()
tuple description
Definition: idDealer.py:66
EventKey(const uint32_t eventId, const uint8_t apvAddress)
std::auto_ptr< edm::DetSetVector< SiStripRawDigi > > scopeDigis
std::auto_ptr< FEDRawDataCollection > rawData
ConnsConstIterRange fedConnections(uint16_t fed_id) const
Contains cabling info at the device level, including DetId, APV pair numbers, hardware addresses...
boost::shared_ptr< std::vector< edm::DetSet< SiStripRawDigi > > > outputVirginRawDigisVector_
std::auto_ptr< edm::DetSetVector< SiStripRawDigi > > virginRawDigis
void addNextEventToMap(const edm::EventPrincipal &nextSpyEvent)
static const uint16_t FEDCH_PER_FED
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:28
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)
std::unique_ptr< edm::ProductRegistry > productRegistry_
SpyEventMatcher(const edm::ParameterSet &config)
static const uint16_t FED_ID_MAX
volatile std::atomic< bool > shutdown_flag false
collection_type::const_iterator const_iterator
Definition: DetSetVector.h:108
A Digi for the silicon strip detector, containing only adc information, and suitable for storing raw ...
static VectorInputSourceFactory const * get()
static ParameterSetID emptyParameterSetID()
std::map< EventKey, SpyEventList > eventMatches_