CMS 3D CMS Logo

ExcludedFEDListProducer.cc
Go to the documentation of this file.
13 #include <iostream>
14 #include <sstream>
15 #include <iomanip>
16 #include <ext/algorithm>
17 
18 namespace sistrip {
19 
21  : runNumber_(0), token_(consumes(pset.getParameter<edm::InputTag>("ProductLabel"))), cablingToken_(esConsumes()) {
22  produces<DetIdVector>();
23  }
24 
26 
29  desc.add<edm::InputTag>("ProductLabel", edm::InputTag("rawDataCollector"));
30  descriptions.add("siStripExcludedFEDListProducer", desc);
31  }
32 
34  if (runNumber_ != event.run()) {
35  runNumber_ = event.run();
36 
37  auto const& cabling = es.getData(cablingToken_);
38 
41  // Reserve space in bad module list
42  detids_.reserve(100);
43 
45  event.getByToken(token_, buffers);
46 
47  // Retrieve FED ids from cabling map and iterate through
48  for (auto ifed = cabling.fedIds().begin(); ifed != cabling.fedIds().end(); ifed++) {
49  // ignore trigger FED
50  // if ( *ifed == triggerFedId_ ) { continue; }
51 
52  // Retrieve FED raw data for given FED
53  const FEDRawData& input = buffers->FEDData(static_cast<int>(*ifed));
54  // The FEDData contains a vector<unsigned char>. Check the size of this vector:
55 
56  if (input.size() == 0) {
57  // std::cout << "Input size == 0 for FED number " << static_cast<int>(*ifed) << std::endl;
58  // get the cabling connections for this FED
59  auto conns = cabling.fedConnections(*ifed);
60  // Mark FED modules as bad
61  detids_.reserve(detids_.size() + conns.size());
62  for (auto iconn = conns.begin(); iconn != conns.end(); ++iconn) {
63  if (!iconn->detId() || iconn->detId() == sistrip::invalid32_)
64  continue;
65  detids_.push_back(iconn->detId()); //@@ Possible multiple entries
66  }
67  }
68  }
69  }
70 
71  // for( unsigned int it = 0; it < detids->size(); ++it ) {
72  // std::cout << "detId = " << (*detids)[it]() << std::endl;
73  // }
74 
75  event.put(std::make_unique<DetIdVector>(detids_));
76  }
77 } // namespace sistrip
static const char runNumber_[]
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
void produce(edm::Event &event, const edm::EventSetup &es) override
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
static const uint32_t invalid32_
Definition: Constants.h:15
const edm::EDGetTokenT< FEDRawDataCollection > token_
sistrip classes
static std::string const input
Definition: EdmProvDump.cc:50
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
ExcludedFEDListProducer(const edm::ParameterSet &pset)
constructor
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
std::vector< DetId > DetIdVector
Definition: DetIdVector.h:7
void add(std::string const &label, ParameterSetDescription const &psetDescription)
static const std::vector< DetId > emptyDetIdVector
Definition: CaloTopology.cc:27
HLT enums.
edm::ESGetToken< SiStripFedCabling, SiStripFedCablingRcd > cablingToken_
~ExcludedFEDListProducer() override
default constructor
Definition: event.py:1