CMS 3D CMS Logo

RawDataMapperByLabel.cc
Go to the documentation of this file.
1 
10 
20 
21 #include <iostream>
22 
23 using namespace edm;
24 
26 public:
29 
31  ~RawDataMapperByLabel() override;
32 
33  void produce(edm::Event& e, const edm::EventSetup& c) override;
34 
36 
37 private:
38  typedef std::vector<edm::InputTag>::const_iterator tag_iterator_t;
39  typedef std::vector<edm::EDGetTokenT<FEDRawDataCollection>>::const_iterator tok_iterator_t;
40 
41  std::vector<edm::InputTag> inputTags_;
42  std::vector<edm::EDGetTokenT<FEDRawDataCollection>> inputTokens_;
43 
47 };
48 
50  : inputTags_(pset.getParameter<std::vector<edm::InputTag>>("rawCollectionList")),
51  mainCollectionTag_(pset.getParameter<edm::InputTag>("mainCollection")),
52  filledCollectionName_(edm::InputTag("")),
53  firstEvent_(true) {
54  inputTokens_.reserve(inputTags_.size());
55  for (auto const& inputTag : inputTags_) {
56  inputTokens_.push_back(consumes<FEDRawDataCollection>(inputTag));
57  }
58 
59  produces<FEDRawDataCollection>();
60 }
61 
63 
65  bool alreadyACollectionFilled = false;
67  for (tok_iterator_t inputTok = inputTokens_.begin(); inputTok != inputTokens_.end(); ++inputTok, ++inputTag) {
69  if (e.getByToken(*inputTok, input)) {
70  if (input.isValid()) {
71  if (alreadyACollectionFilled)
72  throw cms::Exception("BadInput")
73  << "Two input collections are present." << std::endl
74  << "Please make sure that the input dataset has only one FEDRawDataCollector collection filled";
75 
76  if (firstEvent_) {
78  alreadyACollectionFilled = true;
79  firstEvent_ = false;
80  }
81 
83  throw cms::Exception("BadInput") << "The filled collection has changed!";
84 
86  e.put(std::make_unique<FEDRawDataCollection>(*input.product()));
87  }
88  }
89  }
90 }
91 
94 
95  desc.add<std::vector<edm::InputTag>>(
96  "rawCollectionList",
97  {{"rawDataCollector", "", "@skipCurrentProcess"}, {"rawDataRepacker"}, {"rawDataReducedFormat"}});
98  desc.add<edm::InputTag>("mainCollection", edm::InputTag("rawDataCollector"));
99 
100  descriptions.add("rawDataMapperByLabel", desc);
101 }
102 
ConfigurationDescriptions.h
Handle.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
RawDataMapperByLabel::inputTokens_
std::vector< edm::EDGetTokenT< FEDRawDataCollection > > inputTokens_
Definition: RawDataMapperByLabel.cc:42
ESHandle.h
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
EDProducer.h
RawDataMapperByLabel::filledCollectionName_
edm::InputTag filledCollectionName_
Definition: RawDataMapperByLabel.cc:45
RawDataMapperByLabel::~RawDataMapperByLabel
~RawDataMapperByLabel() override
Destructor.
Definition: RawDataMapperByLabel.cc:62
RawDataMapperByLabel::produce
void produce(edm::Event &e, const edm::EventSetup &c) override
Definition: RawDataMapperByLabel.cc:64
edm::Handle
Definition: AssociativeIterator.h:50
RawDataMapperByLabel::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &)
Definition: RawDataMapperByLabel.cc:92
MakerMacros.h
RawDataMapperByLabel::RawDataMapperByLabel
RawDataMapperByLabel(const edm::ParameterSet &pset)
Constructor.
Definition: RawDataMapperByLabel.cc:49
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
ProcessHistory.h
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
RawDataMapperByLabel::tok_iterator_t
std::vector< edm::EDGetTokenT< FEDRawDataCollection > >::const_iterator tok_iterator_t
Definition: RawDataMapperByLabel.cc:39
RawDataMapperByLabel::firstEvent_
bool firstEvent_
Definition: RawDataMapperByLabel.cc:46
ParameterSetDescription.h
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
funct::true
true
Definition: Factorize.h:173
HLT_2018_cff.InputTag
InputTag
Definition: HLT_2018_cff.py:79016
edm::ParameterSet
Definition: ParameterSet.h:36
Event.h
RawDataMapperByLabel
Definition: RawDataMapperByLabel.cc:25
FEDRawDataCollection.h
edm::stream::EDProducer
Definition: EDProducer.h:38
edm::EventSetup
Definition: EventSetup.h:57
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
InputTag.h
std
Definition: JetResolutionObject.h:76
RawDataMapperByLabel::mainCollectionTag_
edm::InputTag mainCollectionTag_
Definition: RawDataMapperByLabel.cc:44
RawDataMapperByLabel::tag_iterator_t
std::vector< edm::InputTag >::const_iterator tag_iterator_t
Definition: RawDataMapperByLabel.cc:38
Exception
Definition: hltDiff.cc:246
EventSetup.h
SimL1EmulatorRepack_Full_cff.inputTag
inputTag
Definition: SimL1EmulatorRepack_Full_cff.py:56
edm::Event
Definition: Event.h:73
RawDataMapperByLabel::inputTags_
std::vector< edm::InputTag > inputTags_
Definition: RawDataMapperByLabel.cc:41
edm::InputTag
Definition: InputTag.h:15
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37