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 
23 #include "boost/bind.hpp"
24 #include "boost/shared_ptr.hpp"
25 #include <algorithm>
26 #include <limits>
27 
28 using edm::LogInfo;
29 using edm::LogWarning;
30 using edm::LogError;
31 
32 namespace sistrip {
33 
34  const char* SpyEventMatcher::mlLabel_ = "SpyEventMatcher";
35 
36  SpyEventMatcher::EventKey::EventKey(const uint32_t eventId, const uint8_t apvAddress)
37  : eventId_(eventId), apvAddress_(apvAddress) {}
38 
40  outputRawData_(outputRawData),
41  outputTotalEventCounters_(sistrip::FED_ID_MAX+1),
42  outputL1ACounters_(sistrip::FED_ID_MAX+1),
43  outputAPVAddresses_(sistrip::FED_ID_MAX+1) {}
44 
46 
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"))),
59  processConfiguration_(new edm::ProcessConfiguration(std::string("@MIXING"), edm::getReleaseVersion(), edm::getPassID())),
61  {
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  source_->branchIDListHelper(),
69  nullptr));
70  }
71 
72  std::unique_ptr<SpyEventMatcher::Source> SpyEventMatcher::constructSource(const edm::ParameterSet& sourceConfig)
73  {
77  boost::shared_ptr<edm::BranchIDListHelper>(new edm::BranchIDListHelper),
78  boost::shared_ptr<edm::ActivityRegistry>(new edm::ActivityRegistry),
79  -1, -1,
81  return sourceFactory->makeVectorInputSource(sourceConfig, description);
82  }
83 
85  {
86  //add spy events to the map until there are none left
88  //debug
89  std::ostringstream ss;
90  ss << "Events with possible matches (eventID,apvAddress): ";
91  for (std::map<EventKey,SpyEventList>::const_iterator iSpyEvent = eventMatches_.begin(); iSpyEvent != eventMatches_.end(); ++iSpyEvent) {
92  ss << "(" << iSpyEvent->first.eventId() << "," << uint16_t(iSpyEvent->first.apvAddress()) << ") ";
93  }
94  LogDebug(mlLabel_) << ss.str();
95  }
96 
98  {
99  edm::EventID spyEventId = nextSpyEvent.id();
100 
101  CountersPtr totalEventCounters = getCounters(nextSpyEvent,totalEventCountersTag_);
102  CountersPtr l1aCounters = getCounters(nextSpyEvent,l1aCountersTag_);
103  CountersPtr apvAddresses = getCounters(nextSpyEvent,apvAddressesTag_,false);
104  //loop over all FEDs. Maps should have same content and be in order so, avoid searches by iterating (and checking keys match)
105  //add all possible event keys to the map
106  std::vector<uint32_t>::const_iterator iTotalEventCount = totalEventCounters->begin();
107  std::vector<uint32_t>::const_iterator iL1ACount = l1aCounters->begin();
108  std::vector<uint32_t>::const_iterator iAPVAddress = apvAddresses->begin();
109  //for debug
110  std::map<EventKey,uint16_t> fedCounts;
111  unsigned int fedid = 0;
112  for (;
113  ( (iTotalEventCount != totalEventCounters->end()) && (iL1ACount != l1aCounters->end()) && (iAPVAddress != apvAddresses->end()) );
114  (++iTotalEventCount, ++iL1ACount, ++iAPVAddress, ++fedid)
115  ){
116  if (*iAPVAddress == 0) {
117  continue;
118  }
119 
120  if ( ((*iTotalEventCount) > (*iL1ACount) ) ||
121  ((*iL1ACount)-(*iTotalEventCount) > counterDiffMax_)
122  ) {
123  LogWarning(mlLabel_) << "Spy event " << spyEventId.event()
124  << " error in counter values for FED " << fedid
125  << ", totCount = " << *iTotalEventCount
126  << ", L1Acount = " << *iL1ACount
127  << 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(); iEventFEDCount != fedCounts.end(); ++iEventFEDCount) {
143  ss << "(" << iEventFEDCount->first.eventId() << "," << uint16_t(iEventFEDCount->first.apvAddress()) << "," << iEventFEDCount->second << ") ";
144  }
145  LogDebug(mlLabel_) << ss.str();
146  }
147 
148  const SpyEventMatcher::SpyEventList* SpyEventMatcher::matchesForEvent(const uint32_t eventId, const uint8_t apvAddress) const
149  {
150  EventKey eventKey(eventId,apvAddress);
151  std::map<EventKey,SpyEventList>::const_iterator iMatch = eventMatches_.find(eventKey);
152  if (iMatch == eventMatches_.end()) {
153  LogDebug(mlLabel_) << "No match found for event " << eventId << " with APV address " << uint16_t(apvAddress);
154  return NULL;
155  }
156  else {
157  std::ostringstream ss;
158  ss << "Found matches to event " << eventId << " with address " << uint16_t(apvAddress) << " in spy events ";
159  for (SpyEventList::const_iterator iMatchingSpyEvent = iMatch->second.begin(); iMatchingSpyEvent != iMatch->second.end(); ++iMatchingSpyEvent) {
160  ss << iMatchingSpyEvent->event() << " ";
161  }
162  LogInfo(mlLabel_) << ss.str();
163  return &(iMatch->second);
164  }
165  }
166 
167  void SpyEventMatcher::getCollections(const edm::EventPrincipal& event, const uint32_t eventId,
168  const uint8_t apvAddress, const SiStripFedCabling& cabling,
169  MatchingOutput& mo) {
170 
171  //read the input collections from the event
172  const FEDRawDataCollection* inputRawDataPtr = getProduct< FEDRawDataCollection >(event,rawDataTag_);
173  if (!inputRawDataPtr) {
174  throw cms::Exception(mlLabel_) << "Failed to get raw spy data with tag " << rawDataTag_ << " from spy event";
175  }
176  const FEDRawDataCollection& inputRawData = *inputRawDataPtr;
177  CountersPtr inputTotalEventCounters = getCounters(event,totalEventCountersTag_);
178  CountersPtr inputL1ACounters = getCounters(event,l1aCountersTag_);
179  CountersPtr inputAPVAddresses = getCounters(event,apvAddressesTag_,false);
180  const edm::DetSetVector<SiStripRawDigi>* inputScopeDigis = getProduct< edm::DetSetVector<SiStripRawDigi> >(event,scopeDigisTag_);
181  const edm::DetSetVector<SiStripRawDigi>* inputPayloadDigis = getProduct< edm::DetSetVector<SiStripRawDigi> >(event,payloadDigisTag_);
182  const edm::DetSetVector<SiStripRawDigi>* inputReorderedDigis = getProduct< edm::DetSetVector<SiStripRawDigi> >(event,reorderedDigisTag_);
183  const edm::DetSetVector<SiStripRawDigi>* inputVirginRawDigis = getProduct< edm::DetSetVector<SiStripRawDigi> >(event,virginRawDigisTag_);
184  //construct the output vectors if the digis were found and they do not exist
185  if (inputScopeDigis && !mo.outputScopeDigisVector_.get() ) mo.outputScopeDigisVector_.reset(new std::vector< edm::DetSet<SiStripRawDigi> >);
186  if (inputPayloadDigis && !mo.outputPayloadDigisVector_.get() ) mo.outputPayloadDigisVector_.reset(new std::vector< edm::DetSet<SiStripRawDigi> >);
187  if (inputReorderedDigis && !mo.outputReorderedDigisVector_.get() ) mo.outputReorderedDigisVector_.reset(new std::vector< edm::DetSet<SiStripRawDigi> >);
188  if (inputVirginRawDigis && !mo.outputVirginRawDigisVector_.get() ) mo.outputVirginRawDigisVector_.reset(new std::vector< edm::DetSet<SiStripRawDigi> >);
189  //find matching FEDs
190  std::set<uint16_t> matchingFeds;
191  findMatchingFeds(eventId,apvAddress,inputTotalEventCounters,inputL1ACounters,inputAPVAddresses,matchingFeds);
192  LogInfo(mlLabel_) << "Spy event " << event.id() << " has " << matchingFeds.size() << " matching FEDs";
193  std::ostringstream ss;
194  ss << "Matching FEDs for event " << event.id() << ": ";
195  for (std::set<uint16_t>::const_iterator iFedId = matchingFeds.begin(); iFedId != matchingFeds.end(); ++iFedId) {
196  ss << *iFedId << " ";
197  }
198  LogDebug(mlLabel_) << ss.str();
199  //check there are no duplicates
200  std::vector<uint16_t> duplicateFeds( std::min(mo.alreadyMergedFeds_.size(),matchingFeds.size()) );
201  std::vector<uint16_t>::iterator duplicatesBegin = duplicateFeds.begin();
202  std::vector<uint16_t>::iterator duplicatesEnd = std::set_intersection(mo.alreadyMergedFeds_.begin(),mo.alreadyMergedFeds_.end(),
203  matchingFeds.begin(),matchingFeds.end(),
204  duplicatesBegin);
205  if ( (duplicatesEnd-duplicatesBegin) != 0 ) {
206  std::ostringstream ss;
207  ss << "Found a match for FEDs ";
208  for (std::vector<uint16_t>::const_iterator iDup = duplicatesBegin; iDup != duplicatesEnd; ++iDup) {
209  ss << *iDup << " ";
210  }
211  ss << ". Output SetSetVectors will be unusable!";
212  LogError(mlLabel_) << ss.str();
213  }
214  //merge the matching data
215  mergeMatchingData(matchingFeds,inputRawData,inputTotalEventCounters,inputL1ACounters,inputAPVAddresses,
216  inputScopeDigis,inputPayloadDigis,inputReorderedDigis,inputVirginRawDigis,
220  cabling);
221  mo.alreadyMergedFeds_.insert(matchingFeds.begin(),matchingFeds.end());
222  }
223 
224  void SpyEventMatcher::getMatchedCollections(const uint32_t eventId, const uint8_t apvAddress,
225  const SpyEventList* matchingEvents, const SiStripFedCabling& cabling,
226  SpyDataCollections& collectionsToCreate)
227  {
228  if (!matchingEvents) return;
229  FEDRawDataCollection outputRawData;
230  MatchingOutput mo(outputRawData);
231  source_->loopSpecified(*eventPrincipal_,*matchingEvents,boost::bind(&SpyEventMatcher::getCollections,this,_1,
232  eventId,apvAddress,boost::cref(cabling),boost::ref(mo)));
236  collectionsToCreate = collections;
237  }
238 
239  void SpyEventMatcher::findMatchingFeds(const uint32_t eventId, const uint8_t apvAddress,
240  SpyEventMatcher::CountersPtr totalEventCounters,
241  SpyEventMatcher::CountersPtr l1aCounters,
242  SpyEventMatcher::CountersPtr apvAddresses,
243  std::set<uint16_t>& matchingFeds)
244  {
245  //loop over all FEDs. Maps should have same content and be in order so, avoid searches by iterating (and checking keys match)
246  std::vector<uint32_t>::const_iterator iTotalEventCount = totalEventCounters->begin();
247  std::vector<uint32_t>::const_iterator iL1ACount = l1aCounters->begin();
248  std::vector<uint32_t>::const_iterator iAPVAddress = apvAddresses->begin();
249  for (;
250  ( (iTotalEventCount != totalEventCounters->end()) && (iL1ACount != l1aCounters->end()) && (iAPVAddress != apvAddresses->end()) );
251  (++iTotalEventCount, ++iL1ACount, ++iAPVAddress)
252  ){
253  if (*iAPVAddress == 0) {
254  continue;
255  }
256  if ( (eventId > *iTotalEventCount) && (eventId <= (*iL1ACount)+1) && (*iAPVAddress == apvAddress) ) {
257  matchingFeds.insert(matchingFeds.end(),iTotalEventCount-totalEventCounters->begin());
258  }
259  }
260  }
261 
262  void SpyEventMatcher::mergeMatchingData(const std::set<uint16_t>& matchingFeds,
263  const FEDRawDataCollection& inputRawData,
264  SpyEventMatcher::CountersPtr inputTotalEventCounters,
265  SpyEventMatcher::CountersPtr inputL1ACounters,
266  SpyEventMatcher::CountersPtr inputAPVAddresses,
267  const edm::DetSetVector<SiStripRawDigi>* inputScopeDigis,
268  const edm::DetSetVector<SiStripRawDigi>* inputPayloadDigis,
269  const edm::DetSetVector<SiStripRawDigi>* inputReorderedDigis,
270  const edm::DetSetVector<SiStripRawDigi>* inputVirginRawDigis,
271  FEDRawDataCollection& outputRawData,
272  std::vector<uint32_t>& outputTotalEventCounters,
273  std::vector<uint32_t>& outputL1ACounters,
274  std::vector<uint32_t>& outputAPVAddresses,
275  std::vector< edm::DetSet<SiStripRawDigi> >* outputScopeDigisVector,
276  std::vector< edm::DetSet<SiStripRawDigi> >* outputPayloadDigisVector,
277  std::vector< edm::DetSet<SiStripRawDigi> >* outputReorderedDigisVector,
278  std::vector< edm::DetSet<SiStripRawDigi> >* outputVirginRawDigisVector,
279  const SiStripFedCabling& cabling)
280  {
281  //reserve space in vectors
282  if (inputScopeDigis) {
283  outputScopeDigisVector->reserve(outputScopeDigisVector->size()+matchingFeds.size()*FEDCH_PER_FED); //maximum number of channels on matching FEDs
284  }
285  if (inputPayloadDigis) {
286  outputPayloadDigisVector->reserve(outputPayloadDigisVector->size()+matchingFeds.size()*FEDCH_PER_FED);
287  }
288  if (inputReorderedDigis) {
289  outputReorderedDigisVector->reserve(outputReorderedDigisVector->size()+matchingFeds.size()*FEDCH_PER_FED);
290  }
291  if (inputVirginRawDigis) {
292  outputVirginRawDigisVector->reserve(outputVirginRawDigisVector->size()+matchingFeds.size()*FEDCH_PER_FED/2); //maximum number of dets on matching FEDs
293  }
294  //copy the data into output collections
295  std::set<uint32_t> usedDetIds;
296  for (std::set<uint16_t>::const_iterator iFedId = matchingFeds.begin(); iFedId != matchingFeds.end(); ++iFedId) {
297  const uint32_t fedId = *iFedId;
298  LogDebug(mlLabel_) << "Copying data for FED " << fedId;
299  if (inputRawData.FEDData(fedId).size() && inputRawData.FEDData(fedId).data()) {
300  outputRawData.FEDData(fedId) = inputRawData.FEDData(fedId);
301  }
302  outputTotalEventCounters[fedId] = (*inputTotalEventCounters)[fedId];
303  outputL1ACounters[fedId] = (*inputL1ACounters)[fedId];
304  outputAPVAddresses[fedId] = (*inputAPVAddresses)[fedId];
305  for (uint8_t chan = 0; chan < FEDCH_PER_FED; ++chan) {
306  uint32_t fedIndex = SiStripFedKey::fedIndex(fedId,chan);
307  if (inputScopeDigis) {
308  edm::DetSetVector<SiStripRawDigi>::const_iterator iScopeDigis = inputScopeDigis->find(fedIndex);
309  if (iScopeDigis != inputScopeDigis->end()) {
310  outputScopeDigisVector->push_back(*iScopeDigis);
311  }
312  }
313  if (inputPayloadDigis) {
314  edm::DetSetVector<SiStripRawDigi>::const_iterator iPayloadDigis = inputPayloadDigis->find(fedIndex);
315  if (iPayloadDigis != inputPayloadDigis->end()) {
316  outputPayloadDigisVector->push_back(*iPayloadDigis);
317  }
318  }
319  if (inputReorderedDigis) {
320  edm::DetSetVector<SiStripRawDigi>::const_iterator iReorderedDigis = inputReorderedDigis->find(fedIndex);
321  if (iReorderedDigis != inputReorderedDigis->end()) {
322  outputReorderedDigisVector->push_back(*iReorderedDigis);
323  }
324  }
325  }
326  if (inputVirginRawDigis) {
327  std::set<uint32_t> fedDetIds;
328  auto conns = cabling.fedConnections(fedId);
329  for (auto iConn = conns.begin(); iConn != conns.end(); ++iConn) {
330  if (!iConn->isConnected()) continue;
331  const uint32_t detId = iConn->detId();
332  if (usedDetIds.find(detId) != usedDetIds.end()) {
333  LogError(mlLabel_) << "Duplicate DetID found " << detId << " skipping data for this Det from FED " << fedId;
334  continue;
335  }
336  fedDetIds.insert(iConn->detId());
337  }
338  usedDetIds.insert(fedDetIds.begin(),fedDetIds.end());
339  for (std::set<uint32_t>::const_iterator iDetId = fedDetIds.begin(); iDetId != fedDetIds.end(); ++iDetId) {
340  edm::DetSetVector<SiStripRawDigi>::const_iterator iVirginRawDigis = inputVirginRawDigis->find(*iDetId);
341  if (iVirginRawDigis != inputVirginRawDigis->end()) {
342  outputVirginRawDigisVector->push_back(*iVirginRawDigis);
343  }
344  }
345  }
346  }
347  }
348 
350  {
351  const std::vector<uint32_t>* vectorFromEvent = getProduct< std::vector<uint32_t> >(event,tag);
352  if (vectorFromEvent) {
353  //vector is from event so, will be deleted when the event is destroyed (and not before)
354  return CountersPtr(new CountersWrapper(vectorFromEvent) );
355  } else {
356  const std::map<uint32_t,uint32_t>* mapFromEvent = getProduct< std::map<uint32_t,uint32_t> >(event,tag);
357  if (mapFromEvent) {
358  std::vector<uint32_t>* newVector = new std::vector<uint32_t>(FED_ID_MAX+1,0);
359  if (mapKeyIsByFedID) {
360  for (std::map<uint32_t,uint32_t>::const_iterator iIdValue = mapFromEvent->begin(); iIdValue != mapFromEvent->end(); ++iIdValue) {
361  newVector->at(iIdValue->first) = iIdValue->second;
362  }
363  } else {
364  SpyUtilities::fillFEDMajorities(*mapFromEvent,*newVector);
365  }
366 // std::cout << " -- Map " << tag << std::endl;
367 // for (uint32_t lIt= 0;
368 // lIt < newVector->size();
369 // lIt++) {
370 // std::cout << lIt << " " << newVector->at(lIt) << std::endl;
371 // }
372  //vector was allocated here so, will need to be deleted when finished with
373  CountersPtr newCountersPtr( new CountersWrapper(newVector,true) );
374  return newCountersPtr;
375  } else {
376  throw cms::Exception(mlLabel_) << "Unable to get product " << tag << " from spy event";
377  }
378  }
379  }
380 
382  std::vector<uint32_t>& theTotalEventCounters,
383  std::vector<uint32_t>& theL1ACounters,
384  std::vector<uint32_t>& theAPVAddresses,
385  std::vector< edm::DetSet<SiStripRawDigi> >* theScopeDigisVector,
386  std::vector< edm::DetSet<SiStripRawDigi> >* thePayloadDigisVector,
387  std::vector< edm::DetSet<SiStripRawDigi> >* theReorderedDigisVector,
388  std::vector< edm::DetSet<SiStripRawDigi> >* theVirginRawDigisVector)
389  : rawData(new FEDRawDataCollection),
390  totalEventCounters(new std::vector<uint32_t>),
391  l1aCounters(new std::vector<uint32_t>),
392  apvAddresses(new std::vector<uint32_t>),
393  scopeDigis(theScopeDigisVector ? new edm::DetSetVector<SiStripRawDigi>(*theScopeDigisVector) : NULL),
394  payloadDigis(thePayloadDigisVector ? new edm::DetSetVector<SiStripRawDigi>(*thePayloadDigisVector) : NULL),
395  reorderedDigis(theReorderedDigisVector ? new edm::DetSetVector<SiStripRawDigi>(*theReorderedDigisVector) : NULL),
396  virginRawDigis(theVirginRawDigisVector ? new edm::DetSetVector<SiStripRawDigi>(*theVirginRawDigisVector) : NULL)
397  {
398  rawData->swap(theRawData);
399  totalEventCounters->swap(theTotalEventCounters);
400  l1aCounters->swap(theL1ACounters);
401  apvAddresses->swap(theAPVAddresses);
402  }
403 
405  : rawData(),
406  totalEventCounters(),
407  l1aCounters(),
408  apvAddresses(),
409  scopeDigis(),
410  payloadDigis(),
411  reorderedDigis(),
412  virginRawDigis()
413  {}
414 
416  {
417  rawData = original.rawData;
418  totalEventCounters = original.totalEventCounters;
419  l1aCounters = original.l1aCounters;
420  apvAddresses = original.apvAddresses;
421  scopeDigis = original.scopeDigis;
422  payloadDigis = original.payloadDigis;
423  virginRawDigis = original.virginRawDigis;
424  return *this;
425  }
426 
428  : pConst(theCounters),
429  p(NULL),
430  deleteP(false)
431  {
432  }
433 
434  SpyEventMatcher::CountersWrapper::CountersWrapper(Counters* theCounters, const bool takeOwnership)
435  : pConst(theCounters),
436  p(theCounters),
437  deleteP(takeOwnership)
438  {
439 
440  }
441 
443  {
444  if (deleteP) delete p;
445  }
446 
447 }
448 
449 #endif //SiStripMonitorHardware_BuildEventMatchingCode
#define LogDebug(id)
EventNumber_t event() const
Definition: EventID.h:44
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:292
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:363
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)
list key
Definition: combine.py:13
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:106
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_