CMS 3D CMS Logo

ExcludedFEDListProducer.cc
Go to the documentation of this file.
15 #include <iostream>
16 #include <sstream>
17 #include <iomanip>
18 #include <ext/algorithm>
19 
20 namespace sistrip {
21 
23  : runNumber_(0),
24  cacheId_(0),
25  cabling_(nullptr),
26  token_(consumes<FEDRawDataCollection>(pset.getParameter<edm::InputTag>("ProductLabel"))),
27  cablingToken_(esConsumes<SiStripFedCabling, SiStripFedCablingRcd, edm::Transition::BeginRun>()) {
28  produces<DetIdCollection>();
29  }
30 
32 
34  uint32_t cacheId = es.get<SiStripFedCablingRcd>().cacheIdentifier();
35 
36  if (cacheId_ != cacheId) {
37  cacheId_ = cacheId;
38 
40  cabling_ = c.product();
41  }
42  }
43 
46  desc.add<edm::InputTag>("ProductLabel", edm::InputTag("rawDataCollector"));
47  descriptions.add("siStripExcludedFEDListProducer", desc);
48  }
49 
51  if (runNumber_ != event.run()) {
52  runNumber_ = event.run();
53 
54  DetIdCollection emptyDetIdCollection;
55  detids_.swap(emptyDetIdCollection);
56  // Reserve space in bad module list
57  detids_.reserve(100);
58 
60  event.getByToken(token_, buffers);
61 
62  // Retrieve FED ids from cabling map and iterate through
63  for (auto ifed = cabling_->fedIds().begin(); ifed != cabling_->fedIds().end(); ifed++) {
64  // ignore trigger FED
65  // if ( *ifed == triggerFedId_ ) { continue; }
66 
67  // Retrieve FED raw data for given FED
68  const FEDRawData& input = buffers->FEDData(static_cast<int>(*ifed));
69  // The FEDData contains a vector<unsigned char>. Check the size of this vector:
70 
71  if (input.size() == 0) {
72  // std::cout << "Input size == 0 for FED number " << static_cast<int>(*ifed) << std::endl;
73  // get the cabling connections for this FED
74  auto conns = cabling_->fedConnections(*ifed);
75  // Mark FED modules as bad
76  detids_.reserve(detids_.size() + conns.size());
77  for (auto iconn = conns.begin(); iconn != conns.end(); ++iconn) {
78  if (!iconn->detId() || iconn->detId() == sistrip::invalid32_)
79  continue;
80  detids_.push_back(iconn->detId()); //@@ Possible multiple entries
81  }
82  }
83  }
84  }
85 
86  // for( unsigned int it = 0; it < detids->size(); ++it ) {
87  // std::cout << "detId = " << (*detids)[it]() << std::endl;
88  // }
89 
90  event.put(std::make_unique<DetIdCollection>(detids_));
91  }
92 } // namespace sistrip
ConfigurationDescriptions.h
edm::EDCollection::push_back
void push_back(T const &t)
Definition: EDCollection.h:60
FEDNumbering.h
fed_trailer.h
input
static const std::string input
Definition: EdmProvDump.cc:48
MessageLogger.h
sistrip::invalid32_
static const uint32_t invalid32_
Definition: Constants.h:15
fed_header.h
edm::Run
Definition: Run.h:45
FEDRawDataCollection
Definition: FEDRawDataCollection.h:18
edm
HLT enums.
Definition: AlignableModifier.h:19
SiStripRawDigi.h
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89285
sistrip::ExcludedFEDListProducer::runNumber_
unsigned int runNumber_
Definition: ExcludedFEDListProducer.h:38
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
sistrip::ExcludedFEDListProducer::detids_
DetIdCollection detids_
Definition: ExcludedFEDListProducer.h:44
sistrip::ExcludedFEDListProducer::cacheId_
uint32_t cacheId_
Definition: ExcludedFEDListProducer.h:39
SiStripFedCabling
Contains cabling info at the device level, including DetId, APV pair numbers, hardware addresses,...
Definition: SiStripFedCabling.h:25
sistrip::ExcludedFEDListProducer::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: ExcludedFEDListProducer.cc:44
edm::Handle< FEDRawDataCollection >
FEDRawData
Definition: FEDRawData.h:19
ExcludedFEDListProducer.h
SiStripFedCablingRcd
Definition: SiStripCondDataRecords.h:22
edm::EventSetup::get
T get() const
Definition: EventSetup.h:87
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
sistrip::ExcludedFEDListProducer::token_
const edm::EDGetTokenT< FEDRawDataCollection > token_
Definition: ExcludedFEDListProducer.h:41
SiStripDigi.h
sistrip::ExcludedFEDListProducer::ExcludedFEDListProducer
ExcludedFEDListProducer(const edm::ParameterSet &pset)
constructor
Definition: ExcludedFEDListProducer.cc:22
edm::ESHandle
Definition: DTSurvey.h:22
ParameterSetDescription.h
FEDRawDataCollection::FEDData
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
Definition: FEDRawDataCollection.cc:19
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
SiStripEventSummary.h
SiStripConstants.h
edm::ParameterSet
Definition: ParameterSet.h:47
edm::Transition
Transition
Definition: Transition.h:12
edm::EDCollection::swap
void swap(EDCollection< T > &other)
Definition: EDCollection.h:65
edm::EventSetup::getHandle
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:155
edm::EDCollection::reserve
void reserve(size_type n)
Definition: EDCollection.h:92
edm::EventSetup
Definition: EventSetup.h:58
edm::EDCollection< DetId >
sistrip::ExcludedFEDListProducer::~ExcludedFEDListProducer
~ExcludedFEDListProducer() override
default constructor
Definition: ExcludedFEDListProducer.cc:31
sistrip::ExcludedFEDListProducer::beginRun
void beginRun(const edm::Run &run, const edm::EventSetup &es) override
Definition: ExcludedFEDListProducer.cc:33
TFHeaderDescription.h
sistrip::ExcludedFEDListProducer::cabling_
const SiStripFedCabling * cabling_
Definition: ExcludedFEDListProducer.h:40
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
writedatasetfile.run
run
Definition: writedatasetfile.py:27
edm::EDCollection::size
size_type size() const
Definition: EDCollection.h:82
Exception.h
SiStripFedCabling::fedIds
FedsConstIterRange fedIds() const
Definition: SiStripFedCabling.h:154
DetSet.h
sistrip
sistrip classes
Definition: SiStripQualityHelpers.h:14
sistrip::ExcludedFEDListProducer::cablingToken_
edm::ESGetToken< SiStripFedCabling, SiStripFedCablingRcd > cablingToken_
Definition: ExcludedFEDListProducer.h:42
c
auto & c
Definition: CAHitNtupletGeneratorKernelsImpl.h:46
sistrip::ExcludedFEDListProducer::produce
void produce(edm::Event &event, const edm::EventSetup &es) override
Definition: ExcludedFEDListProducer.cc:50
event
Definition: event.py:1
SiStripFedCabling::fedConnections
ConnsConstIterRange fedConnections(uint16_t fed_id) const
Definition: SiStripFedCabling.cc:160
DeDxTools::esConsumes
ESGetTokenH3DDVariant esConsumes(std::string const &Reccord, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
edm::Event
Definition: Event.h:73
edm::InputTag
Definition: InputTag.h:15
sistrip::runNumber_
static const char runNumber_[]
Definition: ConstantsForDqm.h:33
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27