CMS 3D CMS Logo

ExcludedFEDListProducer.cc
Go to the documentation of this file.
17 #include <iostream>
18 #include <sstream>
19 #include <iomanip>
20 #include <ext/algorithm>
21 
22 namespace sistrip {
23 
25  : runNumber_(0),
26  cacheId_(0),
27  cabling_(nullptr),
28  token_(consumes<FEDRawDataCollection>(pset.getParameter<edm::InputTag>("ProductLabel"))) {
29  produces<DetIdCollection>();
30  }
31 
33 
35  uint32_t cacheId = es.get<SiStripFedCablingRcd>().cacheIdentifier();
36 
37  if (cacheId_ != cacheId) {
38  cacheId_ = cacheId;
39 
42  cabling_ = c.product();
43  }
44  }
45 
48  desc.add<edm::InputTag>("ProductLabel", edm::InputTag("rawDataCollector"));
49  descriptions.add("siStripExcludedFEDListProducer", desc);
50  }
51 
53  if (runNumber_ != event.run()) {
54  runNumber_ = event.run();
55 
56  DetIdCollection emptyDetIdCollection;
57  detids_.swap(emptyDetIdCollection);
58  // Reserve space in bad module list
59  detids_.reserve(100);
60 
62  event.getByToken(token_, buffers);
63 
64  // Retrieve FED ids from cabling map and iterate through
65  for (auto ifed = cabling_->fedIds().begin(); ifed != cabling_->fedIds().end(); ifed++) {
66  // ignore trigger FED
67  // if ( *ifed == triggerFedId_ ) { continue; }
68 
69  // Retrieve FED raw data for given FED
70  const FEDRawData& input = buffers->FEDData(static_cast<int>(*ifed));
71  // The FEDData contains a vector<unsigned char>. Check the size of this vector:
72 
73  if (input.size() == 0) {
74  // std::cout << "Input size == 0 for FED number " << static_cast<int>(*ifed) << std::endl;
75  // get the cabling connections for this FED
76  auto conns = cabling_->fedConnections(*ifed);
77  // Mark FED modules as bad
78  detids_.reserve(detids_.size() + conns.size());
79  for (auto iconn = conns.begin(); iconn != conns.end(); ++iconn) {
80  if (!iconn->detId() || iconn->detId() == sistrip::invalid32_)
81  continue;
82  detids_.push_back(iconn->detId()); //@@ Possible multiple entries
83  }
84  }
85  }
86  }
87 
88  // for( unsigned int it = 0; it < detids->size(); ++it ) {
89  // std::cout << "detId = " << (*detids)[it]() << std::endl;
90  // }
91 
92  event.put(std::make_unique<DetIdCollection>(detids_));
93  }
94 } // namespace sistrip
ConfigurationDescriptions.h
edm::EDCollection::push_back
void push_back(T const &t)
Definition: EDCollection.h:60
FEDNumbering.h
fed_trailer.h
edm::ParameterSetDescription::add
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:95
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
sistrip::ExcludedFEDListProducer::runNumber_
unsigned int runNumber_
Definition: ExcludedFEDListProducer.h:36
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
SiStripFedCabling.h
sistrip::ExcludedFEDListProducer::detids_
DetIdCollection detids_
Definition: ExcludedFEDListProducer.h:41
sistrip::ExcludedFEDListProducer::cacheId_
uint32_t cacheId_
Definition: ExcludedFEDListProducer.h:37
sistrip::ExcludedFEDListProducer::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: ExcludedFEDListProducer.cc:46
edm::Handle
Definition: AssociativeIterator.h:50
FEDRawData
Definition: FEDRawData.h:19
ExcludedFEDListProducer.h
SiStripFedCablingRcd
Definition: SiStripCondDataRecords.h:22
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
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:39
SiStripDigi.h
sistrip::ExcludedFEDListProducer::ExcludedFEDListProducer
ExcludedFEDListProducer(const edm::ParameterSet &pset)
constructor
Definition: ExcludedFEDListProducer.cc:24
edm::ESHandle< SiStripFedCabling >
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
HLT_2018_cff.InputTag
InputTag
Definition: HLT_2018_cff.py:79016
edm::ParameterSet
Definition: ParameterSet.h:36
edm::EDCollection::swap
void swap(EDCollection< T > &other)
Definition: EDCollection.h:65
edm::EDCollection::reserve
void reserve(size_type n)
Definition: EDCollection.h:92
edm::EventSetup
Definition: EventSetup.h:57
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
get
#define get
edm::EDCollection< DetId >
sistrip::ExcludedFEDListProducer::~ExcludedFEDListProducer
~ExcludedFEDListProducer() override
default constructor
Definition: ExcludedFEDListProducer.cc:32
sistrip::ExcludedFEDListProducer::beginRun
void beginRun(const edm::Run &run, const edm::EventSetup &es) override
Definition: ExcludedFEDListProducer.cc:34
TFHeaderDescription.h
sistrip::ExcludedFEDListProducer::cabling_
const SiStripFedCabling * cabling_
Definition: ExcludedFEDListProducer.h:38
writedatasetfile.run
run
Definition: writedatasetfile.py:27
edm::EDCollection::size
size_type size() const
Definition: EDCollection.h:82
Exception.h
SiStripFedCablingRcd.h
SiStripFedCabling::fedIds
FedsConstIterRange fedIds() const
Definition: SiStripFedCabling.h:154
DetSet.h
sistrip
sistrip classes
Definition: SiStripQualityHelpers.h:14
sistrip::ExcludedFEDListProducer::produce
void produce(edm::Event &event, const edm::EventSetup &es) override
Definition: ExcludedFEDListProducer.cc:52
event
Definition: event.py:1
SiStripFedCabling::fedConnections
ConnsConstIterRange fedConnections(uint16_t fed_id) const
Definition: SiStripFedCabling.cc:160
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