File indexing completed on 2025-03-13 02:31:40
0001 #include "DQM/SiStripMonitorHardware/interface/SiStripSpyEventMatcher.h"
0002 #ifdef SiStripMonitorHardware_BuildEventMatchingCode
0003
0004 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0005 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0006 #include "FWCore/Sources/interface/VectorInputSource.h"
0007 #include "FWCore/Sources/interface/VectorInputSourceDescription.h"
0008 #include "FWCore/Sources/interface/VectorInputSourceFactory.h"
0009 #include "DataFormats/Provenance/interface/ProductRegistry.h"
0010 #include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h"
0011 #include "DataFormats/SiStripDigi/interface/SiStripRawDigi.h"
0012 #include "DataFormats/Common/interface/DetSetVector.h"
0013 #include "DataFormats/Provenance/interface/BranchIDListHelper.h"
0014 #include "DataFormats/Provenance/interface/EventID.h"
0015 #include "DataFormats/Provenance/interface/ModuleDescription.h"
0016 #include "DataFormats/Provenance/interface/ThinnedAssociationsHelper.h"
0017 #include "CondFormats/SiStripObjects/interface/SiStripFedCabling.h"
0018 #include "DataFormats/SiStripCommon/interface/SiStripFedKey.h"
0019 #include "FWCore/Framework/interface/ProductResolversFactory.h"
0020 #include "FWCore/ServiceRegistry/interface/ActivityRegistry.h"
0021 #include "FWCore/Utilities/interface/Exception.h"
0022 #include "FWCore/Version/interface/GetReleaseVersion.h"
0023 #include "DQM/SiStripMonitorHardware/interface/SiStripSpyUtilities.h"
0024 #include <algorithm>
0025 #include <limits>
0026 #include <memory>
0027
0028 using edm::LogError;
0029 using edm::LogInfo;
0030 using edm::LogWarning;
0031
0032 namespace sistrip {
0033
0034 const char* const SpyEventMatcher::mlLabel_ = "SpyEventMatcher";
0035
0036 SpyEventMatcher::EventKey::EventKey(const uint32_t eventId, const uint8_t apvAddress)
0037 : eventId_(eventId), apvAddress_(apvAddress) {}
0038
0039 SpyEventMatcher::MatchingOutput::MatchingOutput(FEDRawDataCollection& outputRawData)
0040 : outputRawData_(outputRawData),
0041 outputTotalEventCounters_(sistrip::FED_ID_MAX + 1),
0042 outputL1ACounters_(sistrip::FED_ID_MAX + 1),
0043 outputAPVAddresses_(sistrip::FED_ID_MAX + 1) {}
0044
0045 SpyEventMatcher::~SpyEventMatcher() {}
0046
0047 SpyEventMatcher::SpyEventMatcher(const edm::ParameterSet& config)
0048 : rawDataTag_(config.getParameter<edm::InputTag>("RawSpyDataTag")),
0049 totalEventCountersTag_(config.getParameter<edm::InputTag>("SpyTotalEventCountersTag")),
0050 l1aCountersTag_(config.getParameter<edm::InputTag>("SpyL1ACountersTag")),
0051 apvAddressesTag_(config.getParameter<edm::InputTag>("SpyAPVAddressesTag")),
0052 scopeDigisTag_(config.getParameter<edm::InputTag>("SpyScopeDigisTag")),
0053 payloadDigisTag_(config.getParameter<edm::InputTag>("SpyPayloadDigisTag")),
0054 reorderedDigisTag_(config.getParameter<edm::InputTag>("SpyReorderedDigisTag")),
0055 virginRawDigisTag_(config.getParameter<edm::InputTag>("SpyVirginRawDigisTag")),
0056 counterDiffMax_(config.getParameter<uint32_t>("CounterDiffMaxAllowed")),
0057 productRegistry_(new edm::ProductRegistry),
0058 source_(constructSource(config.getParameter<edm::ParameterSet>("SpySource"))),
0059
0060 processConfiguration_(std::make_unique<edm::ProcessConfiguration>(
0061 "@MIXING", edm::getReleaseVersion(), edm::HardwareResourcesDescription())),
0062 eventPrincipal_() {
0063
0064 processConfiguration_->setParameterSetID(edm::ParameterSet::emptyParameterSetID());
0065 productRegistry_->setFrozen();
0066
0067 eventPrincipal_ = std::make_unique<edm::EventPrincipal>(source_->productRegistry(),
0068 edm::productResolversFactory::makePrimary,
0069 std::make_shared<edm::BranchIDListHelper>(),
0070 std::make_shared<edm::ThinnedAssociationsHelper>(),
0071 *processConfiguration_,
0072 nullptr);
0073 }
0074
0075 std::unique_ptr<SpyEventMatcher::Source> SpyEventMatcher::constructSource(const edm::ParameterSet& sourceConfig) {
0076 const edm::VectorInputSourceFactory* sourceFactory = edm::VectorInputSourceFactory::get();
0077 edm::VectorInputSourceDescription description(productRegistry_, edm::PreallocationConfiguration());
0078 return sourceFactory->makeVectorInputSource(sourceConfig, description);
0079 }
0080
0081 void SpyEventMatcher::initialize() {
0082 size_t fileNameHash = 0U;
0083
0084 source_->loopOverEvents(
0085 *eventPrincipal_,
0086 fileNameHash,
0087 std::numeric_limits<size_t>::max(),
0088 [this](auto const& iE, auto const&) {
0089 this->addNextEventToMap(iE);
0090 return true;
0091 },
0092 nullptr,
0093 nullptr,
0094 false);
0095
0096 std::ostringstream ss;
0097 ss << "Events with possible matches (eventID,apvAddress): ";
0098 for (std::map<EventKey, SpyEventList>::const_iterator iSpyEvent = eventMatches_.begin();
0099 iSpyEvent != eventMatches_.end();
0100 ++iSpyEvent) {
0101 ss << "(" << iSpyEvent->first.eventId() << "," << uint16_t(iSpyEvent->first.apvAddress()) << ") ";
0102 }
0103 LogDebug(mlLabel_) << ss.str();
0104 }
0105
0106 void SpyEventMatcher::addNextEventToMap(const edm::EventPrincipal& nextSpyEvent) {
0107 edm::EventID spyEventId = nextSpyEvent.id();
0108
0109 CountersPtr totalEventCounters = getCounters(nextSpyEvent, totalEventCountersTag_);
0110 CountersPtr l1aCounters = getCounters(nextSpyEvent, l1aCountersTag_);
0111 CountersPtr apvAddresses = getCounters(nextSpyEvent, apvAddressesTag_, false);
0112
0113
0114 std::vector<uint32_t>::const_iterator iTotalEventCount = totalEventCounters->begin();
0115 std::vector<uint32_t>::const_iterator iL1ACount = l1aCounters->begin();
0116 std::vector<uint32_t>::const_iterator iAPVAddress = apvAddresses->begin();
0117
0118 std::map<EventKey, uint16_t> fedCounts;
0119 unsigned int fedid = 0;
0120 for (; ((iTotalEventCount != totalEventCounters->end()) && (iL1ACount != l1aCounters->end()) &&
0121 (iAPVAddress != apvAddresses->end()));
0122 (++iTotalEventCount, ++iL1ACount, ++iAPVAddress, ++fedid)) {
0123 if (*iAPVAddress == 0) {
0124 continue;
0125 }
0126
0127 if (((*iTotalEventCount) > (*iL1ACount)) || ((*iL1ACount) - (*iTotalEventCount) > counterDiffMax_)) {
0128 LogWarning(mlLabel_) << "Spy event " << spyEventId.event() << " error in counter values for FED " << fedid
0129 << ", totCount = " << *iTotalEventCount << ", L1Acount = " << *iL1ACount << std::endl;
0130
0131 continue;
0132 }
0133
0134 for (uint32_t eventId = (*iTotalEventCount) + 1; eventId <= (*iL1ACount) + 1; ++eventId) {
0135 EventKey key(eventId, *iAPVAddress);
0136 eventMatches_[key].insert(spyEventId);
0137 fedCounts[key]++;
0138 }
0139 }
0140
0141
0142 std::ostringstream ss;
0143 ss << "Spy event " << spyEventId.event() << " matches (eventID,apvAddress,nFEDs): ";
0144 for (std::map<EventKey, uint16_t>::const_iterator iEventFEDCount = fedCounts.begin();
0145 iEventFEDCount != fedCounts.end();
0146 ++iEventFEDCount) {
0147 ss << "(" << iEventFEDCount->first.eventId() << "," << uint16_t(iEventFEDCount->first.apvAddress()) << ","
0148 << iEventFEDCount->second << ") ";
0149 }
0150 LogDebug(mlLabel_) << ss.str();
0151 }
0152
0153 const SpyEventMatcher::SpyEventList* SpyEventMatcher::matchesForEvent(const uint32_t eventId,
0154 const uint8_t apvAddress) const {
0155 EventKey eventKey(eventId, apvAddress);
0156 std::map<EventKey, SpyEventList>::const_iterator iMatch = eventMatches_.find(eventKey);
0157 if (iMatch == eventMatches_.end()) {
0158 LogDebug(mlLabel_) << "No match found for event " << eventId << " with APV address " << uint16_t(apvAddress);
0159 return nullptr;
0160 } else {
0161 std::ostringstream ss;
0162 ss << "Found matches to event " << eventId << " with address " << uint16_t(apvAddress) << " in spy events ";
0163 for (SpyEventList::const_iterator iMatchingSpyEvent = iMatch->second.begin();
0164 iMatchingSpyEvent != iMatch->second.end();
0165 ++iMatchingSpyEvent) {
0166 ss << iMatchingSpyEvent->event() << " ";
0167 }
0168 LogInfo(mlLabel_) << ss.str();
0169 return &(iMatch->second);
0170 }
0171 }
0172
0173 void SpyEventMatcher::getCollections(const edm::EventPrincipal& event,
0174 const uint32_t eventId,
0175 const uint8_t apvAddress,
0176 const SiStripFedCabling& cabling,
0177 MatchingOutput& mo) {
0178
0179 const FEDRawDataCollection* inputRawDataPtr = getProduct<FEDRawDataCollection>(event, rawDataTag_);
0180 if (!inputRawDataPtr) {
0181 throw cms::Exception(mlLabel_) << "Failed to get raw spy data with tag " << rawDataTag_ << " from spy event";
0182 }
0183 const FEDRawDataCollection& inputRawData = *inputRawDataPtr;
0184 CountersPtr inputTotalEventCounters = getCounters(event, totalEventCountersTag_);
0185 CountersPtr inputL1ACounters = getCounters(event, l1aCountersTag_);
0186 CountersPtr inputAPVAddresses = getCounters(event, apvAddressesTag_, false);
0187 const edm::DetSetVector<SiStripRawDigi>* inputScopeDigis =
0188 getProduct<edm::DetSetVector<SiStripRawDigi>>(event, scopeDigisTag_);
0189 const edm::DetSetVector<SiStripRawDigi>* inputPayloadDigis =
0190 getProduct<edm::DetSetVector<SiStripRawDigi>>(event, payloadDigisTag_);
0191 const edm::DetSetVector<SiStripRawDigi>* inputReorderedDigis =
0192 getProduct<edm::DetSetVector<SiStripRawDigi>>(event, reorderedDigisTag_);
0193 const edm::DetSetVector<SiStripRawDigi>* inputVirginRawDigis =
0194 getProduct<edm::DetSetVector<SiStripRawDigi>>(event, virginRawDigisTag_);
0195
0196 if (inputScopeDigis && !mo.outputScopeDigisVector_.get())
0197 mo.outputScopeDigisVector_ = std::make_shared<std::vector<edm::DetSet<SiStripRawDigi>>>();
0198 if (inputPayloadDigis && !mo.outputPayloadDigisVector_.get())
0199 mo.outputPayloadDigisVector_ = std::make_shared<std::vector<edm::DetSet<SiStripRawDigi>>>();
0200 if (inputReorderedDigis && !mo.outputReorderedDigisVector_.get())
0201 mo.outputReorderedDigisVector_ = std::make_shared<std::vector<edm::DetSet<SiStripRawDigi>>>();
0202 if (inputVirginRawDigis && !mo.outputVirginRawDigisVector_.get())
0203 mo.outputVirginRawDigisVector_ = std::make_shared<std::vector<edm::DetSet<SiStripRawDigi>>>();
0204
0205 std::set<uint16_t> matchingFeds;
0206 findMatchingFeds(eventId, apvAddress, inputTotalEventCounters, inputL1ACounters, inputAPVAddresses, matchingFeds);
0207 LogInfo(mlLabel_) << "Spy event " << event.id() << " has " << matchingFeds.size() << " matching FEDs";
0208 std::ostringstream ss;
0209 ss << "Matching FEDs for event " << event.id() << ": ";
0210 for (std::set<uint16_t>::const_iterator iFedId = matchingFeds.begin(); iFedId != matchingFeds.end(); ++iFedId) {
0211 ss << *iFedId << " ";
0212 }
0213 LogDebug(mlLabel_) << ss.str();
0214
0215 std::vector<uint16_t> duplicateFeds(std::min(mo.alreadyMergedFeds_.size(), matchingFeds.size()));
0216 std::vector<uint16_t>::iterator duplicatesBegin = duplicateFeds.begin();
0217 std::vector<uint16_t>::iterator duplicatesEnd = std::set_intersection(mo.alreadyMergedFeds_.begin(),
0218 mo.alreadyMergedFeds_.end(),
0219 matchingFeds.begin(),
0220 matchingFeds.end(),
0221 duplicatesBegin);
0222 if ((duplicatesEnd - duplicatesBegin) != 0) {
0223 std::ostringstream ss;
0224 ss << "Found a match for FEDs ";
0225 for (std::vector<uint16_t>::const_iterator iDup = duplicatesBegin; iDup != duplicatesEnd; ++iDup) {
0226 ss << *iDup << " ";
0227 }
0228 ss << ". Output SetSetVectors will be unusable!";
0229 LogError(mlLabel_) << ss.str();
0230 }
0231
0232 mergeMatchingData(matchingFeds,
0233 inputRawData,
0234 inputTotalEventCounters,
0235 inputL1ACounters,
0236 inputAPVAddresses,
0237 inputScopeDigis,
0238 inputPayloadDigis,
0239 inputReorderedDigis,
0240 inputVirginRawDigis,
0241 mo.outputRawData_,
0242 mo.outputTotalEventCounters_,
0243 mo.outputL1ACounters_,
0244 mo.outputAPVAddresses_,
0245 mo.outputScopeDigisVector_.get(),
0246 mo.outputPayloadDigisVector_.get(),
0247 mo.outputReorderedDigisVector_.get(),
0248 mo.outputVirginRawDigisVector_.get(),
0249 cabling);
0250 mo.alreadyMergedFeds_.insert(matchingFeds.begin(), matchingFeds.end());
0251 }
0252
0253 void SpyEventMatcher::getMatchedCollections(const uint32_t eventId,
0254 const uint8_t apvAddress,
0255 const SpyEventList* matchingEvents,
0256 const SiStripFedCabling& cabling,
0257 SpyDataCollections& collectionsToCreate) {
0258 if (!matchingEvents)
0259 return;
0260 size_t fileNameHash = 0U;
0261 FEDRawDataCollection outputRawData;
0262 MatchingOutput mo(outputRawData);
0263 source_->loopSpecified(
0264 *eventPrincipal_,
0265 fileNameHash,
0266 matchingEvents->begin(),
0267 matchingEvents->end(),
0268 [&](auto const& iE, auto const&) { this->getCollections(iE, eventId, apvAddress, cabling, mo); });
0269 collectionsToCreate = SpyDataCollections(mo.outputRawData_,
0270 mo.outputTotalEventCounters_,
0271 mo.outputL1ACounters_,
0272 mo.outputAPVAddresses_,
0273 mo.outputScopeDigisVector_.get(),
0274 mo.outputPayloadDigisVector_.get(),
0275 mo.outputReorderedDigisVector_.get(),
0276 mo.outputVirginRawDigisVector_.get());
0277 }
0278
0279 void SpyEventMatcher::findMatchingFeds(const uint32_t eventId,
0280 const uint8_t apvAddress,
0281 SpyEventMatcher::CountersPtr totalEventCounters,
0282 SpyEventMatcher::CountersPtr l1aCounters,
0283 SpyEventMatcher::CountersPtr apvAddresses,
0284 std::set<uint16_t>& matchingFeds) {
0285
0286 std::vector<uint32_t>::const_iterator iTotalEventCount = totalEventCounters->begin();
0287 std::vector<uint32_t>::const_iterator iL1ACount = l1aCounters->begin();
0288 std::vector<uint32_t>::const_iterator iAPVAddress = apvAddresses->begin();
0289 for (; ((iTotalEventCount != totalEventCounters->end()) && (iL1ACount != l1aCounters->end()) &&
0290 (iAPVAddress != apvAddresses->end()));
0291 (++iTotalEventCount, ++iL1ACount, ++iAPVAddress)) {
0292 if (*iAPVAddress == 0) {
0293 continue;
0294 }
0295 if ((eventId > *iTotalEventCount) && (eventId <= (*iL1ACount) + 1) && (*iAPVAddress == apvAddress)) {
0296 matchingFeds.insert(matchingFeds.end(), iTotalEventCount - totalEventCounters->begin());
0297 }
0298 }
0299 }
0300
0301 void SpyEventMatcher::mergeMatchingData(const std::set<uint16_t>& matchingFeds,
0302 const FEDRawDataCollection& inputRawData,
0303 SpyEventMatcher::CountersPtr inputTotalEventCounters,
0304 SpyEventMatcher::CountersPtr inputL1ACounters,
0305 SpyEventMatcher::CountersPtr inputAPVAddresses,
0306 const edm::DetSetVector<SiStripRawDigi>* inputScopeDigis,
0307 const edm::DetSetVector<SiStripRawDigi>* inputPayloadDigis,
0308 const edm::DetSetVector<SiStripRawDigi>* inputReorderedDigis,
0309 const edm::DetSetVector<SiStripRawDigi>* inputVirginRawDigis,
0310 FEDRawDataCollection& outputRawData,
0311 std::vector<uint32_t>& outputTotalEventCounters,
0312 std::vector<uint32_t>& outputL1ACounters,
0313 std::vector<uint32_t>& outputAPVAddresses,
0314 std::vector<edm::DetSet<SiStripRawDigi>>* outputScopeDigisVector,
0315 std::vector<edm::DetSet<SiStripRawDigi>>* outputPayloadDigisVector,
0316 std::vector<edm::DetSet<SiStripRawDigi>>* outputReorderedDigisVector,
0317 std::vector<edm::DetSet<SiStripRawDigi>>* outputVirginRawDigisVector,
0318 const SiStripFedCabling& cabling) {
0319
0320 if (inputScopeDigis) {
0321 outputScopeDigisVector->reserve(outputScopeDigisVector->size() +
0322 matchingFeds.size() *
0323 FEDCH_PER_FED);
0324 }
0325 if (inputPayloadDigis) {
0326 outputPayloadDigisVector->reserve(outputPayloadDigisVector->size() + matchingFeds.size() * FEDCH_PER_FED);
0327 }
0328 if (inputReorderedDigis) {
0329 outputReorderedDigisVector->reserve(outputReorderedDigisVector->size() + matchingFeds.size() * FEDCH_PER_FED);
0330 }
0331 if (inputVirginRawDigis) {
0332 outputVirginRawDigisVector->reserve(outputVirginRawDigisVector->size() +
0333 matchingFeds.size() * FEDCH_PER_FED /
0334 2);
0335 }
0336
0337 std::set<uint32_t> usedDetIds;
0338 for (std::set<uint16_t>::const_iterator iFedId = matchingFeds.begin(); iFedId != matchingFeds.end(); ++iFedId) {
0339 const uint32_t fedId = *iFedId;
0340 LogDebug(mlLabel_) << "Copying data for FED " << fedId;
0341 if (inputRawData.FEDData(fedId).size() && inputRawData.FEDData(fedId).data()) {
0342 outputRawData.FEDData(fedId) = inputRawData.FEDData(fedId);
0343 }
0344 outputTotalEventCounters[fedId] = (*inputTotalEventCounters)[fedId];
0345 outputL1ACounters[fedId] = (*inputL1ACounters)[fedId];
0346 outputAPVAddresses[fedId] = (*inputAPVAddresses)[fedId];
0347 for (uint8_t chan = 0; chan < FEDCH_PER_FED; ++chan) {
0348 uint32_t fedIndex = ((fedId & sistrip::invalid_) << 16) | (chan & sistrip::invalid_);
0349 ;
0350 if (inputScopeDigis) {
0351 edm::DetSetVector<SiStripRawDigi>::const_iterator iScopeDigis = inputScopeDigis->find(fedIndex);
0352 if (iScopeDigis != inputScopeDigis->end()) {
0353 outputScopeDigisVector->push_back(*iScopeDigis);
0354 }
0355 }
0356 if (inputPayloadDigis) {
0357 edm::DetSetVector<SiStripRawDigi>::const_iterator iPayloadDigis = inputPayloadDigis->find(fedIndex);
0358 if (iPayloadDigis != inputPayloadDigis->end()) {
0359 outputPayloadDigisVector->push_back(*iPayloadDigis);
0360 }
0361 }
0362 if (inputReorderedDigis) {
0363 edm::DetSetVector<SiStripRawDigi>::const_iterator iReorderedDigis = inputReorderedDigis->find(fedIndex);
0364 if (iReorderedDigis != inputReorderedDigis->end()) {
0365 outputReorderedDigisVector->push_back(*iReorderedDigis);
0366 }
0367 }
0368 }
0369 if (inputVirginRawDigis) {
0370 std::set<uint32_t> fedDetIds;
0371 auto conns = cabling.fedConnections(fedId);
0372 for (auto iConn = conns.begin(); iConn != conns.end(); ++iConn) {
0373 if (!iConn->isConnected())
0374 continue;
0375 const uint32_t detId = iConn->detId();
0376 if (usedDetIds.find(detId) != usedDetIds.end()) {
0377 LogError(mlLabel_) << "Duplicate DetID found " << detId << " skipping data for this Det from FED " << fedId;
0378 continue;
0379 }
0380 fedDetIds.insert(iConn->detId());
0381 }
0382 usedDetIds.insert(fedDetIds.begin(), fedDetIds.end());
0383 for (std::set<uint32_t>::const_iterator iDetId = fedDetIds.begin(); iDetId != fedDetIds.end(); ++iDetId) {
0384 edm::DetSetVector<SiStripRawDigi>::const_iterator iVirginRawDigis = inputVirginRawDigis->find(*iDetId);
0385 if (iVirginRawDigis != inputVirginRawDigis->end()) {
0386 outputVirginRawDigisVector->push_back(*iVirginRawDigis);
0387 }
0388 }
0389 }
0390 }
0391 }
0392
0393 SpyEventMatcher::CountersPtr SpyEventMatcher::getCounters(const edm::EventPrincipal& event,
0394 const edm::InputTag& tag,
0395 const bool mapKeyIsByFedID) {
0396 const std::vector<uint32_t>* vectorFromEvent = getProduct<std::vector<uint32_t>>(event, tag);
0397 if (vectorFromEvent) {
0398
0399 return std::make_shared<CountersWrapper>(vectorFromEvent);
0400 } else {
0401 const std::map<uint32_t, uint32_t>* mapFromEvent = getProduct<std::map<uint32_t, uint32_t>>(event, tag);
0402 if (mapFromEvent) {
0403 std::vector<uint32_t>* newVector = new std::vector<uint32_t>(FED_ID_MAX + 1, 0);
0404 if (mapKeyIsByFedID) {
0405 for (std::map<uint32_t, uint32_t>::const_iterator iIdValue = mapFromEvent->begin();
0406 iIdValue != mapFromEvent->end();
0407 ++iIdValue) {
0408 newVector->at(iIdValue->first) = iIdValue->second;
0409 }
0410 } else {
0411 SpyUtilities::fillFEDMajorities(*mapFromEvent, *newVector);
0412 }
0413
0414
0415
0416
0417
0418
0419
0420 CountersPtr newCountersPtr(new CountersWrapper(newVector, true));
0421 return newCountersPtr;
0422 } else {
0423 throw cms::Exception(mlLabel_) << "Unable to get product " << tag << " from spy event";
0424 }
0425 }
0426 }
0427
0428 SpyEventMatcher::SpyDataCollections::SpyDataCollections(
0429 FEDRawDataCollection& theRawData,
0430 std::vector<uint32_t>& theTotalEventCounters,
0431 std::vector<uint32_t>& theL1ACounters,
0432 std::vector<uint32_t>& theAPVAddresses,
0433 std::vector<edm::DetSet<SiStripRawDigi>>* theScopeDigisVector,
0434 std::vector<edm::DetSet<SiStripRawDigi>>* thePayloadDigisVector,
0435 std::vector<edm::DetSet<SiStripRawDigi>>* theReorderedDigisVector,
0436 std::vector<edm::DetSet<SiStripRawDigi>>* theVirginRawDigisVector)
0437 : rawData(new FEDRawDataCollection),
0438 totalEventCounters(new std::vector<uint32_t>),
0439 l1aCounters(new std::vector<uint32_t>),
0440 apvAddresses(new std::vector<uint32_t>),
0441 scopeDigis(theScopeDigisVector ? new edm::DetSetVector<SiStripRawDigi>(*theScopeDigisVector) : nullptr),
0442 payloadDigis(thePayloadDigisVector ? new edm::DetSetVector<SiStripRawDigi>(*thePayloadDigisVector) : nullptr),
0443 reorderedDigis(theReorderedDigisVector ? new edm::DetSetVector<SiStripRawDigi>(*theReorderedDigisVector)
0444 : nullptr),
0445 virginRawDigis(theVirginRawDigisVector ? new edm::DetSetVector<SiStripRawDigi>(*theVirginRawDigisVector)
0446 : nullptr) {
0447 rawData->swap(theRawData);
0448 totalEventCounters->swap(theTotalEventCounters);
0449 l1aCounters->swap(theL1ACounters);
0450 apvAddresses->swap(theAPVAddresses);
0451 }
0452
0453 SpyEventMatcher::SpyDataCollections::SpyDataCollections()
0454 : rawData(),
0455 totalEventCounters(),
0456 l1aCounters(),
0457 apvAddresses(),
0458 scopeDigis(),
0459 payloadDigis(),
0460 reorderedDigis(),
0461 virginRawDigis() {}
0462
0463 SpyEventMatcher::CountersWrapper::CountersWrapper(const Counters* theCounters)
0464 : pConst(theCounters), p(nullptr), deleteP(false) {}
0465
0466 SpyEventMatcher::CountersWrapper::CountersWrapper(Counters* theCounters, const bool takeOwnership)
0467 : pConst(theCounters), p(theCounters), deleteP(takeOwnership) {}
0468
0469 SpyEventMatcher::CountersWrapper::~CountersWrapper() {
0470 if (deleteP)
0471 delete p;
0472 }
0473
0474 }
0475
0476 #endif