CMS 3D CMS Logo

EvFFEDExcluder.cc
Go to the documentation of this file.
1 #include <memory>
2 #include <algorithm>
3 
4 #include "EvFFEDExcluder.h"
5 
13 
15  : rawDataToken_(consumes(config.getParameter<edm::InputTag>("src"))),
16  fedIds_([](std::vector<unsigned int> const& fedsToExclude) {
17  // ret = all FED Ids except those to be excluded (i.e. fedsToExclude)
18  std::vector<unsigned int> ret;
19  auto const maxSize = FEDNumbering::lastFEDId() + 1;
20  ret.reserve(maxSize);
21  // loop on all FED IDs: [0, FEDNumbering::lastFEDId]
22  for (auto fedId = 0u; fedId < maxSize; ++fedId) {
23  // keep only fedIds not present in fedsToExclude
24  if (std::find(fedsToExclude.begin(), fedsToExclude.end(), fedId) == fedsToExclude.end())
25  ret.emplace_back(fedId);
26  }
27  ret.shrink_to_fit();
28  return ret;
29  }(config.getParameter<std::vector<unsigned int>>("fedsToExclude"))) {
30  produces<FEDRawDataCollection>();
31 }
32 
35  desc.add<edm::InputTag>("src", edm::InputTag("source"));
36  desc.add<std::vector<unsigned int>>("fedsToExclude", {});
37  descriptions.add("EvFFEDExcluder", desc);
38 }
39 
41  auto out = std::make_unique<FEDRawDataCollection>();
42  auto const rawDataHandle = event.getHandle(rawDataToken_);
43 
44  for (auto const fedId : fedIds_)
45  if (rawDataHandle->FEDData(fedId).size() > 0)
46  out->FEDData(fedId) = rawDataHandle->FEDData(fedId);
47 
48  event.put(std::move(out));
49 }
void produce(edm::StreamID, edm::Event &, edm::EventSetup const &) const final
ret
prodAgent to be discontinued
Definition: config.py:1
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
static void fillDescriptions(edm::ConfigurationDescriptions &)
EvFFEDExcluder(edm::ParameterSet const &)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
HLT enums.
static constexpr int lastFEDId()
Definition: FEDNumbering.h:19
def move(src, dest)
Definition: eostools.py:511
Definition: event.py:1