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::stream::EDFilter<> edm::stream::EDFilterBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

void beginStream (edm::StreamID) override
 
bool filter (edm::Event &event, const edm::EventSetup &eventSetup) override
 
 SpyEventMatcherModule (const edm::ParameterSet &config)
 
 ~SpyEventMatcherModule () override
 
- Public Member Functions inherited from edm::stream::EDFilter<>
 EDFilter ()=default
 
 EDFilter (const EDFilter &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDFilteroperator= (const EDFilter &)=delete
 
- Public Member Functions inherited from edm::stream::EDFilterBase
 EDFilterBase ()
 
 EDFilterBase (const EDFilterBase &)=delete
 
ModuleDescription const & moduleDescription () const
 
const EDFilterBaseoperator= (const EDFilterBase &)=delete
 
 ~EDFilterBase () 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
 
std::vector< bool > const & recordProvenanceList () 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)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) 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
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
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::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, 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
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &)
 
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
 
void updateFedCabling (const SiStripFedCablingRcd &rcd)
 

Private Attributes

edm::ESWatcher< SiStripFedCablingRcdcablingWatcher_
 
const bool doMerge_
 
const SiStripFedCablingfedCabling_
 
edm::ESGetToken< SiStripFedCabling, SiStripFedCablingRcdfedCablingToken_
 
const bool filterNonMatchingEvents_
 
const edm::InputTag primaryStreamRawDataTag_
 
edm::EDGetTokenT< FEDRawDataCollectionprimaryStreamRawDataToken_
 
std::unique_ptr< SpyEventMatcherspyEventMatcher_
 

Static Private Attributes

static const char *const messageLabel_ = "SiStripSpyDataMergeModule"
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDFilter<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 
- Public Types inherited from edm::stream::EDFilterBase
typedef EDFilterAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
template<typename T >
using BranchAliasSetterT = ProductRegistryHelper::BranchAliasSetterT< T >
 
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::stream::EDFilterBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
template<Transition Tr = Transition::Event>
auto produces (std::string instanceName) noexcept
 declare what type of product will make and with which optional label More...
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
template<Transition Tr = Transition::Event>
auto produces () noexcept
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
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)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Definition at line 31 of file SiStripSpyEventMatcherModule.cc.

Constructor & Destructor Documentation

◆ SpyEventMatcherModule()

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

Definition at line 67 of file SiStripSpyEventMatcherModule.cc.

References doMerge_, primaryStreamRawDataTag_, and primaryStreamRawDataToken_.

68  : filterNonMatchingEvents_(config.getParameter<bool>("FilterNonMatchingEvents")),
69  doMerge_(config.getParameter<bool>("MergeData")),
70  primaryStreamRawDataTag_(config.getParameter<edm::InputTag>("PrimaryEventRawDataTag")),
71  spyEventMatcher_(new SpyEventMatcher(config)),
72  fedCablingToken_(esConsumes<>()),
74  primaryStreamRawDataToken_ = consumes<FEDRawDataCollection>(primaryStreamRawDataTag_);
75  if (doMerge_) {
76  produces<FEDRawDataCollection>("RawSpyData");
77  produces<std::vector<uint32_t> >("SpyTotalEventCount");
78  produces<std::vector<uint32_t> >("SpyL1ACount");
79  produces<std::vector<uint32_t> >("SpyAPVAddress");
80  produces<edm::DetSetVector<SiStripRawDigi> >("SpyScope");
81  produces<edm::DetSetVector<SiStripRawDigi> >("SpyPayload");
82  produces<edm::DetSetVector<SiStripRawDigi> >("SpyReordered");
83  produces<edm::DetSetVector<SiStripRawDigi> >("SpyVirginRaw");
84  }
85  }
Definition: config.py:1
edm::EDGetTokenT< FEDRawDataCollection > primaryStreamRawDataToken_
std::unique_ptr< SpyEventMatcher > spyEventMatcher_
edm::ESWatcher< SiStripFedCablingRcd > cablingWatcher_
void updateFedCabling(const SiStripFedCablingRcd &rcd)
edm::ESGetToken< SiStripFedCabling, SiStripFedCablingRcd > fedCablingToken_

◆ ~SpyEventMatcherModule()

sistrip::SpyEventMatcherModule::~SpyEventMatcherModule ( )
override

Definition at line 87 of file SiStripSpyEventMatcherModule.cc.

87 {}

Member Function Documentation

◆ beginStream()

void sistrip::SpyEventMatcherModule::beginStream ( edm::StreamID  )
overridevirtual

Reimplemented from edm::stream::EDFilterBase.

Definition at line 93 of file SiStripSpyEventMatcherModule.cc.

References spyEventMatcher_.

93 { spyEventMatcher_->initialize(); }
std::unique_ptr< SpyEventMatcher > spyEventMatcher_

◆ copyData()

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 170 of file SiStripSpyEventMatcherModule.cc.

References sistrip::SpyEventMatcher::SpyDataCollections::apvAddresses, sistrip::SpyEventMatcher::SpyDataCollections::l1aCounters, oniaPATMuonsWithTrigger_cff::matches, eostools::move(), sistrip::SpyEventMatcher::SpyDataCollections::payloadDigis, 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().

174  {
175  SpyEventMatcher::SpyDataCollections matchedCollections;
176  spyEventMatcher_->getMatchedCollections(eventId, apvAddress, matches, cabling, matchedCollections);
177  if (matchedCollections.rawData.get())
178  event.put(std::move(matchedCollections.rawData), "RawSpyData");
179  if (matchedCollections.totalEventCounters.get())
180  event.put(std::move(matchedCollections.totalEventCounters), "SpyTotalEventCount");
181  if (matchedCollections.l1aCounters.get())
182  event.put(std::move(matchedCollections.l1aCounters), "SpyL1ACount");
183  if (matchedCollections.apvAddresses.get())
184  event.put(std::move(matchedCollections.apvAddresses), "SpyAPVAddress");
185  if (matchedCollections.scopeDigis.get())
186  event.put(std::move(matchedCollections.scopeDigis), "SpyScope");
187  if (matchedCollections.payloadDigis.get())
188  event.put(std::move(matchedCollections.payloadDigis), "SpyPayload");
189  if (matchedCollections.reorderedDigis.get())
190  event.put(std::move(matchedCollections.reorderedDigis), "SpyReordered");
191  if (matchedCollections.virginRawDigis.get())
192  event.put(std::move(matchedCollections.virginRawDigis), "SpyVirginRaw");
193  }
std::unique_ptr< SpyEventMatcher > spyEventMatcher_
def move(src, dest)
Definition: eostools.py:511
Definition: event.py:1

◆ filter()

bool sistrip::SpyEventMatcherModule::filter ( edm::Event event,
const edm::EventSetup eventSetup 
)
overridevirtual

Implements edm::stream::EDFilterBase.

Definition at line 95 of file SiStripSpyEventMatcherModule.cc.

References cablingWatcher_, edm::ESWatcher< T >::check(), copyData(), doMerge_, MillePedeFileConverter_cfg::e, options_cfi::eventSetup, fedCabling_, filterNonMatchingEvents_, findL1IDandAPVAddress(), oniaPATMuonsWithTrigger_cff::matches, messageLabel_, and spyEventMatcher_.

95  {
97  uint8_t apvAddress = 0;
98  uint32_t eventId = 0;
99  try {
100  findL1IDandAPVAddress(event, *fedCabling_, eventId, apvAddress);
101  } catch (const cms::Exception& e) {
102  LogError(messageLabel_) << e.what();
103  return (filterNonMatchingEvents_ ? false : true);
104  }
105  const SpyEventMatcher::SpyEventList* matches = spyEventMatcher_->matchesForEvent(eventId, apvAddress);
106  if (matches) {
107  if (doMerge_) {
108  copyData(eventId, apvAddress, matches, event, *fedCabling_);
109  }
110  return true;
111  } else {
112  return (filterNonMatchingEvents_ ? false : true);
113  }
114  }
Log< level::Error, false > LogError
void findL1IDandAPVAddress(const edm::Event &event, const SiStripFedCabling &cabling, uint32_t &l1ID, uint8_t &apvAddress) const
std::set< EventID > SpyEventList
std::unique_ptr< SpyEventMatcher > spyEventMatcher_
edm::ESWatcher< SiStripFedCablingRcd > cablingWatcher_
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:57
void copyData(const uint32_t eventId, const uint8_t apvAddress, const SpyEventMatcher::SpyEventList *matches, edm::Event &event, const SiStripFedCabling &cabling) const
Definition: event.py:1

◆ findL1IDandAPVAddress()

void sistrip::SpyEventMatcherModule::findL1IDandAPVAddress ( const edm::Event event,
const SiStripFedCabling cabling,
uint32_t &  l1ID,
uint8_t &  apvAddress 
) const
private

Definition at line 116 of file SiStripSpyEventMatcherModule.cc.

References edmScanValgrind::buffer, data, Exception, sistrip::FEDCH_PER_FEUNIT, SiStripFedCabling::fedConnections(), SiStripFedCabling::fedIds(), l1t_dqm_sourceclient-live_cfg::fedRawData, RecoTauValidation_cfi::header, sistrip::HEADER_TYPE_FULL_DEBUG, LogDebug, messageLabel_, sistrip::preconstructCheckFEDBuffer(), primaryStreamRawDataToken_, and sistrip::SUCCESS.

Referenced by filter().

119  {
120  edm::Handle<FEDRawDataCollection> fedRawDataHandle;
121  event.getByToken(primaryStreamRawDataToken_, fedRawDataHandle);
122  const FEDRawDataCollection& fedRawData = *fedRawDataHandle;
123  for (auto iFedId = cabling.fedIds().begin(); iFedId != cabling.fedIds().end(); ++iFedId) {
124  const FEDRawData& data = fedRawData.FEDData(*iFedId);
125  const auto st_buffer = preconstructCheckFEDBuffer(data);
126  if (FEDBufferStatusCode::SUCCESS != st_buffer) {
127  LogInfo(messageLabel_) << "Failed to build FED buffer for FED ID " << *iFedId
128  << ". Exception was: An exception of category 'FEDBuffer' occurred.\n"
129  << st_buffer << " (see debug output for details)";
130  continue;
131  }
132  FEDBuffer buffer{data};
133  const auto st_chan = buffer.findChannels();
134  if (FEDBufferStatusCode::SUCCESS != st_chan) {
135  LogDebug(messageLabel_) << "Failed to build FED buffer for FED ID " << *iFedId << ". Exception was " << st_chan
136  << " (see above for more details)";
137  continue;
138  }
139  if (!buffer.doChecks(true)) {
140  LogDebug(messageLabel_) << "Buffer check failed for FED ID " << *iFedId;
141  continue;
142  }
143  l1ID = buffer.daqLvl1ID();
144  apvAddress = buffer.trackerSpecialHeader().apveAddress();
145  if (apvAddress != 0) {
146  return;
147  } else {
148  if (buffer.trackerSpecialHeader().headerType() != HEADER_TYPE_FULL_DEBUG) {
149  continue;
150  }
151  const FEDFullDebugHeader* header = dynamic_cast<const FEDFullDebugHeader*>(buffer.feHeader());
152  auto connections = cabling.fedConnections(*iFedId);
153  for (auto iConn = connections.begin(); iConn != connections.end(); ++iConn) {
154  if (!iConn->isConnected()) {
155  continue;
156  }
157  if (!buffer.channelGood(iConn->fedCh(), true)) {
158  continue;
159  } else {
160  apvAddress = header->feUnitMajorityAddress(iConn->fedCh() / FEDCH_PER_FEUNIT);
161  return;
162  }
163  }
164  }
165  }
166  //if we haven't already found an acceptable alternative, throw an exception
167  throw cms::Exception(messageLabel_) << "Failed to get L1ID/APV address from any FED";
168  }
edm::EDGetTokenT< FEDRawDataCollection > primaryStreamRawDataToken_
Log< level::Info, false > LogInfo
static const uint16_t FEDCH_PER_FEUNIT
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:80
FEDBufferStatusCode preconstructCheckFEDBuffer(const FEDRawData &fedBuffer, bool allowBadBuffer=false)
FedsConstIterRange fedIds() const
ConnsConstIterRange fedConnections(uint16_t fed_id) const
#define LogDebug(id)

◆ updateFedCabling()

void sistrip::SpyEventMatcherModule::updateFedCabling ( const SiStripFedCablingRcd rcd)
private

Definition at line 89 of file SiStripSpyEventMatcherModule.cc.

References fedCabling_, fedCablingToken_, and edm::eventsetup::EventSetupRecordImplementation< T >::get().

89  {
91  }
PRODUCT const & get(ESGetToken< PRODUCT, T > const &iToken) const
edm::ESGetToken< SiStripFedCabling, SiStripFedCablingRcd > fedCablingToken_

Member Data Documentation

◆ cablingWatcher_

edm::ESWatcher<SiStripFedCablingRcd> sistrip::SpyEventMatcherModule::cablingWatcher_
private

Definition at line 57 of file SiStripSpyEventMatcherModule.cc.

Referenced by filter().

◆ doMerge_

const bool sistrip::SpyEventMatcherModule::doMerge_
private

Definition at line 51 of file SiStripSpyEventMatcherModule.cc.

Referenced by filter(), and SpyEventMatcherModule().

◆ fedCabling_

const SiStripFedCabling* sistrip::SpyEventMatcherModule::fedCabling_
private

Definition at line 56 of file SiStripSpyEventMatcherModule.cc.

Referenced by filter(), and updateFedCabling().

◆ fedCablingToken_

edm::ESGetToken<SiStripFedCabling, SiStripFedCablingRcd> sistrip::SpyEventMatcherModule::fedCablingToken_
private

Definition at line 55 of file SiStripSpyEventMatcherModule.cc.

Referenced by updateFedCabling().

◆ filterNonMatchingEvents_

const bool sistrip::SpyEventMatcherModule::filterNonMatchingEvents_
private

Definition at line 50 of file SiStripSpyEventMatcherModule.cc.

Referenced by filter().

◆ messageLabel_

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

Definition at line 49 of file SiStripSpyEventMatcherModule.cc.

Referenced by filter(), and findL1IDandAPVAddress().

◆ primaryStreamRawDataTag_

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

Definition at line 52 of file SiStripSpyEventMatcherModule.cc.

Referenced by SpyEventMatcherModule().

◆ primaryStreamRawDataToken_

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

Definition at line 53 of file SiStripSpyEventMatcherModule.cc.

Referenced by findL1IDandAPVAddress(), and SpyEventMatcherModule().

◆ spyEventMatcher_

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

Definition at line 54 of file SiStripSpyEventMatcherModule.cc.

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