CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes
sistrip::SpyEventMatcherModule Class Reference
Inheritance diagram for sistrip::SpyEventMatcherModule:
edm::EDFilter edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

void beginJob () override
 
bool filter (edm::Event &event, const edm::EventSetup &eventSetup) override
 
 SpyEventMatcherModule (const edm::ParameterSet &config)
 
 ~SpyEventMatcherModule () override
 
- Public Member Functions inherited from edm::EDFilter
 EDFilter ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDFilter () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
 ~ProducerBase () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

void copyData (const uint32_t eventId, const uint8_t apvAddress, const SpyEventMatcher::SpyEventList *matches, edm::Event &event, const SiStripFedCabling &cabling) const
 
void findL1IDandAPVAddress (const edm::Event &event, const SiStripFedCabling &cabling, uint32_t &l1ID, uint8_t &apvAddress) const
 

Private Attributes

const bool doMerge_
 
const bool filterNonMatchingEvents_
 
const edm::InputTag primaryStreamRawDataTag_
 
edm::EDGetTokenT< FEDRawDataCollectionprimaryStreamRawDataToken_
 
std::unique_ptr< SpyEventMatcherspyEventMatcher_
 
std::unique_ptr< SpyUtilitiesutils_
 

Static Private Attributes

static const char * messageLabel_ = "SiStripSpyDataMergeModule"
 

Additional Inherited Members

- Public Types inherited from edm::EDFilter
typedef EDFilter ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDFilter
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 30 of file SiStripSpyEventMatcherModule.cc.

Constructor & Destructor Documentation

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

Definition at line 57 of file SiStripSpyEventMatcherModule.cc.

References doMerge_, primaryStreamRawDataTag_, and primaryStreamRawDataToken_.

58  : filterNonMatchingEvents_( config.getParameter<bool>("FilterNonMatchingEvents") ),
59  doMerge_( config.getParameter<bool>("MergeData") ),
60  primaryStreamRawDataTag_( config.getParameter<edm::InputTag>("PrimaryEventRawDataTag") ),
61  spyEventMatcher_(new SpyEventMatcher(config)),
62  utils_(new SpyUtilities)
63  {
64  primaryStreamRawDataToken_ = consumes<FEDRawDataCollection>(primaryStreamRawDataTag_);
65  if (doMerge_) {
66  produces<FEDRawDataCollection>("RawSpyData");
67  produces< std::vector<uint32_t> >("SpyTotalEventCount");
68  produces< std::vector<uint32_t> >("SpyL1ACount");
69  produces< std::vector<uint32_t> >("SpyAPVAddress");
70  produces< edm::DetSetVector<SiStripRawDigi> >("SpyScope");
71  produces< edm::DetSetVector<SiStripRawDigi> >("SpyPayload");
72  produces< edm::DetSetVector<SiStripRawDigi> >("SpyReordered");
73  produces< edm::DetSetVector<SiStripRawDigi> >("SpyVirginRaw");
74  }
75  }
T getParameter(std::string const &) const
std::unique_ptr< SpyUtilities > utils_
edm::EDGetTokenT< FEDRawDataCollection > primaryStreamRawDataToken_
std::unique_ptr< SpyEventMatcher > spyEventMatcher_
sistrip::SpyEventMatcherModule::~SpyEventMatcherModule ( )
override

Definition at line 77 of file SiStripSpyEventMatcherModule.cc.

78  {
79  }

Member Function Documentation

void sistrip::SpyEventMatcherModule::beginJob ( void  )
overridevirtual

Reimplemented from edm::EDFilter.

Definition at line 81 of file SiStripSpyEventMatcherModule.cc.

References spyEventMatcher_.

82  {
83  spyEventMatcher_->initialize();
84  }
std::unique_ptr< SpyEventMatcher > spyEventMatcher_
void sistrip::SpyEventMatcherModule::copyData ( const uint32_t  eventId,
const uint8_t  apvAddress,
const SpyEventMatcher::SpyEventList matches,
edm::Event event,
const SiStripFedCabling cabling 
) const
private

Definition at line 157 of file SiStripSpyEventMatcherModule.cc.

References sistrip::SpyEventMatcher::SpyDataCollections::apvAddresses, sistrip::SpyEventMatcher::SpyDataCollections::l1aCounters, eostools::move(), sistrip::SpyEventMatcher::SpyDataCollections::payloadDigis, edm::Event::put(), sistrip::SpyEventMatcher::SpyDataCollections::rawData, sistrip::SpyEventMatcher::SpyDataCollections::reorderedDigis, sistrip::SpyEventMatcher::SpyDataCollections::scopeDigis, spyEventMatcher_, sistrip::SpyEventMatcher::SpyDataCollections::totalEventCounters, and sistrip::SpyEventMatcher::SpyDataCollections::virginRawDigis.

Referenced by filter().

159  {
160  SpyEventMatcher::SpyDataCollections matchedCollections;
161  spyEventMatcher_->getMatchedCollections(eventId,apvAddress,matches,cabling,matchedCollections);
162  if (matchedCollections.rawData.get()) event.put(std::move(matchedCollections.rawData),"RawSpyData");
163  if (matchedCollections.totalEventCounters.get()) event.put(std::move(matchedCollections.totalEventCounters),"SpyTotalEventCount");
164  if (matchedCollections.l1aCounters.get()) event.put(std::move(matchedCollections.l1aCounters),"SpyL1ACount");
165  if (matchedCollections.apvAddresses.get()) event.put(std::move(matchedCollections.apvAddresses),"SpyAPVAddress");
166  if (matchedCollections.scopeDigis.get()) event.put(std::move(matchedCollections.scopeDigis),"SpyScope");
167  if (matchedCollections.payloadDigis.get()) event.put(std::move(matchedCollections.payloadDigis),"SpyPayload");
168  if (matchedCollections.reorderedDigis.get()) event.put(std::move(matchedCollections.reorderedDigis),"SpyReordered");
169  if (matchedCollections.virginRawDigis.get()) event.put(std::move(matchedCollections.virginRawDigis),"SpyVirginRaw");
170  }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:136
std::unique_ptr< SpyEventMatcher > spyEventMatcher_
def move(src, dest)
Definition: eostools.py:510
bool sistrip::SpyEventMatcherModule::filter ( edm::Event event,
const edm::EventSetup eventSetup 
)
override

Definition at line 86 of file SiStripSpyEventMatcherModule.cc.

References copyData(), doMerge_, MillePedeFileConverter_cfg::e, filterNonMatchingEvents_, findL1IDandAPVAddress(), patRefSel_triggerMatching_cfi::matches, messageLabel_, spyEventMatcher_, utils_, and cms::Exception::what().

Referenced by Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::filter(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::find(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::setDataAccessor(), and Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::switchCenterView().

87  {
88  const SiStripFedCabling& cabling = *(utils_->getCabling(eventSetup));
89  uint8_t apvAddress = 0;
90  uint32_t eventId = 0;
91  try {
92  findL1IDandAPVAddress(event,cabling,eventId,apvAddress);
93  } catch (const cms::Exception& e) {
94  LogError(messageLabel_) << e.what();
95  return ( filterNonMatchingEvents_ ? false : true );
96  }
97  const SpyEventMatcher::SpyEventList* matches = spyEventMatcher_->matchesForEvent(eventId,apvAddress);
98  if (matches) {
99  if (doMerge_) {
100  copyData(eventId,apvAddress,matches,event,cabling);
101  }
102  return true;
103  } else {
104  return ( filterNonMatchingEvents_ ? false : true );
105  }
106  }
void copyData(const uint32_t eventId, const uint8_t apvAddress, const SpyEventMatcher::SpyEventList *matches, edm::Event &event, const SiStripFedCabling &cabling) const
std::unique_ptr< SpyUtilities > utils_
char const * what() const override
Definition: Exception.cc:141
std::set< EventID > SpyEventList
std::unique_ptr< SpyEventMatcher > spyEventMatcher_
Contains cabling info at the device level, including DetId, APV pair numbers, hardware addresses...
void findL1IDandAPVAddress(const edm::Event &event, const SiStripFedCabling &cabling, uint32_t &l1ID, uint8_t &apvAddress) const
void sistrip::SpyEventMatcherModule::findL1IDandAPVAddress ( const edm::Event event,
const SiStripFedCabling cabling,
uint32_t &  l1ID,
uint8_t &  apvAddress 
) const
private

Definition at line 108 of file SiStripSpyEventMatcherModule.cc.

References edmScanValgrind::buffer, FEDRawData::data(), data, MillePedeFileConverter_cfg::e, Exception, sistrip::FEDCH_PER_FEUNIT, SiStripFedCabling::fedConnections(), FEDRawDataCollection::FEDData(), SiStripFedCabling::fedIds(), sistrip::FEDFullDebugHeader::feUnitMajorityAddress(), RecoTauValidation_cfi::header, sistrip::HEADER_TYPE_FULL_DEBUG, LogDebug, messageLabel_, primaryStreamRawDataToken_, FEDRawData::size(), and cms::Exception::what().

Referenced by filter().

109  {
110  edm::Handle<FEDRawDataCollection> fedRawDataHandle;
111  event.getByToken(primaryStreamRawDataToken_,fedRawDataHandle);
112  const FEDRawDataCollection& fedRawData = *fedRawDataHandle;
113  for (auto iFedId = cabling.fedIds().begin(); iFedId != cabling.fedIds().end(); ++iFedId) {
114  const FEDRawData& data = fedRawData.FEDData(*iFedId);
115  if ( (!data.data()) || (!data.size()) ) {
116  LogDebug(messageLabel_) << "Failed to get FED data for FED ID " << *iFedId;
117  continue;
118  }
119  std::unique_ptr<FEDBuffer> buffer;
120  try {
121  buffer.reset(new FEDBuffer(data.data(),data.size()));
122  } catch (const cms::Exception& e) {
123  LogDebug(messageLabel_) << "Failed to build FED buffer for FED ID " << *iFedId << ". Exception was " << e.what();
124  continue;
125  }
126  if (!buffer->doChecks(true)) {
127  LogDebug(messageLabel_) << "Buffer check failed for FED ID " << *iFedId;
128  continue;
129  }
130  l1ID = buffer->daqLvl1ID();
131  apvAddress = buffer->trackerSpecialHeader().apveAddress();
132  if (apvAddress != 0) {
133  return;
134  } else {
135  if (buffer->trackerSpecialHeader().headerType() != HEADER_TYPE_FULL_DEBUG) {
136  continue;
137  }
138  const FEDFullDebugHeader* header = dynamic_cast<const FEDFullDebugHeader*>(buffer->feHeader());
139  auto connections = cabling.fedConnections(*iFedId);
140  for (auto iConn = connections.begin(); iConn != connections.end(); ++iConn) {
141  if (!iConn->isConnected()) {
142  continue;
143  }
144  if ( !buffer->channelGood(iConn->fedCh(), true) ) {
145  continue;
146  } else {
147  apvAddress = header->feUnitMajorityAddress(iConn->fedCh()/FEDCH_PER_FEUNIT);
148  return;
149  }
150  }
151  }
152  }
153  //if we haven't already found an acceptable alternative, throw an exception
154  throw cms::Exception(messageLabel_) << "Failed to get L1ID/APV address from any FED";
155  }
#define LogDebug(id)
char const * what() const override
Definition: Exception.cc:141
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:47
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
edm::EDGetTokenT< FEDRawDataCollection > primaryStreamRawDataToken_
FedsConstIterRange fedIds() const
static const uint16_t FEDCH_PER_FEUNIT
ConnsConstIterRange fedConnections(uint16_t fed_id) const
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:28

Member Data Documentation

const bool sistrip::SpyEventMatcherModule::doMerge_
private

Definition at line 44 of file SiStripSpyEventMatcherModule.cc.

Referenced by filter(), and SpyEventMatcherModule().

const bool sistrip::SpyEventMatcherModule::filterNonMatchingEvents_
private

Definition at line 43 of file SiStripSpyEventMatcherModule.cc.

Referenced by filter().

const char * sistrip::SpyEventMatcherModule::messageLabel_ = "SiStripSpyDataMergeModule"
staticprivate

Definition at line 42 of file SiStripSpyEventMatcherModule.cc.

Referenced by filter(), and findL1IDandAPVAddress().

const edm::InputTag sistrip::SpyEventMatcherModule::primaryStreamRawDataTag_
private

Definition at line 45 of file SiStripSpyEventMatcherModule.cc.

Referenced by SpyEventMatcherModule().

edm::EDGetTokenT<FEDRawDataCollection> sistrip::SpyEventMatcherModule::primaryStreamRawDataToken_
private

Definition at line 46 of file SiStripSpyEventMatcherModule.cc.

Referenced by findL1IDandAPVAddress(), and SpyEventMatcherModule().

std::unique_ptr<SpyEventMatcher> sistrip::SpyEventMatcherModule::spyEventMatcher_
private

Definition at line 47 of file SiStripSpyEventMatcherModule.cc.

Referenced by beginJob(), copyData(), and filter().

std::unique_ptr<SpyUtilities> sistrip::SpyEventMatcherModule::utils_
private

Definition at line 48 of file SiStripSpyEventMatcherModule.cc.

Referenced by filter().