CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 () 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
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > 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
 
bool registeredToConsumeMany (TypeID const &, 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::ESRecordsToProxyIndices 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
< SiStripFedCablingRcd
cablingWatcher_
 
const bool doMerge_
 
const SiStripFedCablingfedCabling_
 
edm::ESGetToken
< SiStripFedCabling,
SiStripFedCablingRcd
fedCablingToken_
 
const bool filterNonMatchingEvents_
 
const edm::InputTag primaryStreamRawDataTag_
 
edm::EDGetTokenT
< FEDRawDataCollection
primaryStreamRawDataToken_
 
std::unique_ptr< SpyEventMatcherspyEventMatcher_
 

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 wantsInputProcessBlocks ()
 
static bool wantsProcessBlocks ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::ProducerBase
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< B > consumes (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 ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
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 () noexcept
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
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

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  }
edm::EDGetTokenT< FEDRawDataCollection > primaryStreamRawDataToken_
std::unique_ptr< SpyEventMatcher > spyEventMatcher_
edm::ESWatcher< SiStripFedCablingRcd > cablingWatcher_
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
void updateFedCabling(const SiStripFedCablingRcd &rcd)
edm::ESGetToken< SiStripFedCabling, SiStripFedCablingRcd > fedCablingToken_
sistrip::SpyEventMatcherModule::~SpyEventMatcherModule ( )
override

Definition at line 87 of file SiStripSpyEventMatcherModule.cc.

87 {}

Member Function Documentation

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

Reimplemented from edm::EDFilter.

Definition at line 93 of file SiStripSpyEventMatcherModule.cc.

References spyEventMatcher_.

93 { spyEventMatcher_->initialize(); }
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 170 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().

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  }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
def move
Definition: eostools.py:511
std::unique_ptr< SpyEventMatcher > spyEventMatcher_
bool sistrip::SpyEventMatcherModule::filter ( edm::Event event,
const edm::EventSetup eventSetup 
)
overridevirtual

Implements edm::EDFilter.

Definition at line 95 of file SiStripSpyEventMatcherModule.cc.

References cablingWatcher_, edm::ESWatcher< T >::check(), copyData(), doMerge_, alignCSCRings::e, fedCabling_, filterNonMatchingEvents_, findL1IDandAPVAddress(), messageLabel_, spyEventMatcher_, and cms::Exception::what().

95  {
96  cablingWatcher_.check(eventSetup);
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  }
void copyData(const uint32_t eventId, const uint8_t apvAddress, const SpyEventMatcher::SpyEventList *matches, edm::Event &event, const SiStripFedCabling &cabling) const
Log< level::Error, false > LogError
std::set< EventID > SpyEventList
char const * what() const noexceptoverride
Definition: Exception.cc:103
std::unique_ptr< SpyEventMatcher > spyEventMatcher_
edm::ESWatcher< SiStripFedCablingRcd > cablingWatcher_
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:57
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 116 of file SiStripSpyEventMatcherModule.cc.

References edmScanValgrind::buffer, shell::connections, data, Exception, sistrip::FEDCH_PER_FEUNIT, SiStripFedCabling::fedConnections(), FEDRawDataCollection::FEDData(), SiStripFedCabling::fedIds(), sistrip::FEDFullDebugHeader::feUnitMajorityAddress(), 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  }
list connections
Definition: shell.py:10
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
edm::EDGetTokenT< FEDRawDataCollection > primaryStreamRawDataToken_
FedsConstIterRange fedIds() const
Log< level::Info, false > LogInfo
static const uint16_t FEDCH_PER_FEUNIT
ConnsConstIterRange fedConnections(uint16_t fed_id) const
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
FEDBufferStatusCode preconstructCheckFEDBuffer(const FEDRawData &fedBuffer, bool allowBadBuffer=false)
#define LogDebug(id)
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

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

Definition at line 57 of file SiStripSpyEventMatcherModule.cc.

Referenced by filter().

const bool sistrip::SpyEventMatcherModule::doMerge_
private

Definition at line 51 of file SiStripSpyEventMatcherModule.cc.

Referenced by filter(), and SpyEventMatcherModule().

const SiStripFedCabling* sistrip::SpyEventMatcherModule::fedCabling_
private

Definition at line 56 of file SiStripSpyEventMatcherModule.cc.

Referenced by filter(), and updateFedCabling().

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

Definition at line 55 of file SiStripSpyEventMatcherModule.cc.

Referenced by updateFedCabling().

const bool sistrip::SpyEventMatcherModule::filterNonMatchingEvents_
private

Definition at line 50 of file SiStripSpyEventMatcherModule.cc.

Referenced by filter().

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

Definition at line 49 of file SiStripSpyEventMatcherModule.cc.

Referenced by filter(), and findL1IDandAPVAddress().

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

Definition at line 52 of file SiStripSpyEventMatcherModule.cc.

Referenced by SpyEventMatcherModule().

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

Definition at line 53 of file SiStripSpyEventMatcherModule.cc.

Referenced by findL1IDandAPVAddress(), and SpyEventMatcherModule().

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

Definition at line 54 of file SiStripSpyEventMatcherModule.cc.

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