CMS 3D CMS Logo

RawDataCollectorByLabel.cc
Go to the documentation of this file.
1 
10 
16 
18 
19 #include <iostream>
20 
21 using namespace edm;
22 
24  inputTags_ = pset.getParameter<std::vector<InputTag> >("RawCollectionList");
25  verbose_ = pset.getUntrackedParameter<int>("verbose", 0);
26 
27  inputTokens_.reserve(inputTags_.size());
28  for (tag_iterator_t inputTag = inputTags_.begin(); inputTag != inputTags_.end(); ++inputTag) {
29  inputTokens_.push_back(consumes<FEDRawDataCollection>(*inputTag));
30  }
31  produces<FEDRawDataCollection>();
32 }
33 
35 
38  std::vector<Handle<FEDRawDataCollection> > rawData;
39  rawData.reserve(inputTokens_.size());
40  for (tok_iterator_t inputTok = inputTokens_.begin(); inputTok != inputTokens_.end(); ++inputTok) {
42  if (e.getByToken(*inputTok, input)) {
43  rawData.push_back(input);
44  }
45  //else{ //skipping the inputtag requested. but this is a normal operation to bare data & MC. silent warning }
46  }
47 
48  auto producedData = std::make_unique<FEDRawDataCollection>();
49 
50  for (unsigned int i = 0; i < rawData.size(); ++i) {
51  const FEDRawDataCollection *rdc = rawData[i].product();
52 
53  if (verbose_ > 0) {
54  std::cout << "\nRAW collection #" << i + 1 << std::endl;
55  std::cout << "branch name = " << rawData[i].provenance()->branchName() << std::endl;
56  std::cout << "process index = " << rawData[i].provenance()->productID().processIndex() << std::endl;
57  }
58 
59  for (int j = 0; j < FEDNumbering::MAXFEDID; ++j) {
60  const FEDRawData &fedData = rdc->FEDData(j);
61  size_t size = fedData.size();
62 
63  if (size > 0) {
64  // this fed has data -- lets copy it
65  if (verbose_ > 1)
66  std::cout << "Copying data from FED #" << j << std::endl;
67  FEDRawData &fedDataProd = producedData->FEDData(j);
68  if (fedDataProd.size() != 0) {
69  if (verbose_ > 1) {
70  std::cout << " More than one FEDRawDataCollection with data in FED ";
71  std::cout << j << " Skipping the 2nd\n";
72  }
73  continue;
74  }
75  fedDataProd.resize(size);
76  unsigned char *dataProd = fedDataProd.data();
77  const unsigned char *data = fedData.data();
78  for (unsigned int k = 0; k < size; ++k) {
79  dataProd[k] = data[k];
80  }
81  }
82  }
83  }
84 
85  // Insert the new product in the event
86  e.put(std::move(producedData));
87 }
FEDNumbering.h
Handle.h
mps_fire.i
i
Definition: mps_fire.py:428
input
static const std::string input
Definition: EdmProvDump.cc:48
MessageLogger.h
RawDataCollectorByLabel::tag_iterator_t
std::vector< edm::InputTag >::const_iterator tag_iterator_t
Definition: RawDataCollectorByLabel.h:25
ESHandle.h
FEDRawDataCollection
Definition: FEDRawDataCollection.h:18
edm
HLT enums.
Definition: AlignableModifier.h:19
gather_cfg.cout
cout
Definition: gather_cfg.py:144
l1tstage2_dqm_sourceclient-live_cfg.rawData
rawData
Definition: l1tstage2_dqm_sourceclient-live_cfg.py:162
FEDRawData.h
edm::Handle
Definition: AssociativeIterator.h:50
FEDRawData::data
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:24
FEDRawData
Definition: FEDRawData.h:19
RawDataCollectorByLabel::~RawDataCollectorByLabel
~RawDataCollectorByLabel() override
Destructor.
Definition: RawDataCollectorByLabel.cc:34
ProcessHistory.h
dqmdumpme.k
k
Definition: dqmdumpme.py:60
RawDataCollectorByLabel::produce
void produce(edm::Event &e, const edm::EventSetup &c) override
Definition: RawDataCollectorByLabel.cc:36
FEDRawDataCollection::FEDData
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
Definition: FEDRawDataCollection.cc:19
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
FEDRawDataCollection.h
edm::EventSetup
Definition: EventSetup.h:57
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
RawDataCollectorByLabel::RawDataCollectorByLabel
RawDataCollectorByLabel(const edm::ParameterSet &pset)
Constructor.
Definition: RawDataCollectorByLabel.cc:23
FEDRawData::size
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:45
eostools.move
def move(src, dest)
Definition: eostools.py:511
FEDRawData::resize
void resize(size_t newsize)
Definition: FEDRawData.cc:28
EventSetup.h
data
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
RawDataCollectorByLabel.h
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
SimL1EmulatorRepack_Full_cff.inputTag
inputTag
Definition: SimL1EmulatorRepack_Full_cff.py:56
edm::Event
Definition: Event.h:73
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
RawDataCollectorByLabel::tok_iterator_t
std::vector< edm::EDGetTokenT< FEDRawDataCollection > >::const_iterator tok_iterator_t
Definition: RawDataCollectorByLabel.h:26
FEDNumbering::MAXFEDID
Definition: FEDNumbering.h:26
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37