From faec26de5bc26c8910d134b70ace8a3a4d1c924d Mon Sep 17 00:00:00 2001 From: Ivan Date: Wed, 3 Oct 2018 17:25:24 +0200 Subject: [PATCH 01/19] adding remapper --- .../interface/RawDataMapperByLabel.h | 37 ++++++++ .../src/RawDataMapperByLabel.cc | 95 +++++++++++++++++++ 2 files changed, 132 insertions(+) create mode 100644 EventFilter/RawDataCollector/interface/RawDataMapperByLabel.h create mode 100644 EventFilter/RawDataCollector/src/RawDataMapperByLabel.cc diff --git a/EventFilter/RawDataCollector/interface/RawDataMapperByLabel.h b/EventFilter/RawDataCollector/interface/RawDataMapperByLabel.h new file mode 100644 index 0000000000000..ba67f34eecc2b --- /dev/null +++ b/EventFilter/RawDataCollector/interface/RawDataMapperByLabel.h @@ -0,0 +1,37 @@ +#ifndef RawDataCollectorByLabel_H +#define RawDataCollectorByLabel_H + + +/** \class RawDataCollectorByLabel + * + */ + +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/Framework/interface/stream/EDProducer.h" +#include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h" +#include "DataFormats/Common/interface/Handle.h" +#include "FWCore/Utilities/interface/InputTag.h" + +class RawDataCollectorByLabel: public edm::stream::EDProducer<> { +public: + + ///Constructor + RawDataCollectorByLabel(const edm::ParameterSet& pset); + + ///Destructor + ~RawDataCollectorByLabel() override; + + void produce(edm::Event & e, const edm::EventSetup& c) override; + +private: + + typedef std::vector::const_iterator tag_iterator_t; + typedef std::vector >::const_iterator tok_iterator_t; + + std::vector inputTags_ ; + std::vector > inputTokens_; + int verbose_ ; + +}; + +#endif diff --git a/EventFilter/RawDataCollector/src/RawDataMapperByLabel.cc b/EventFilter/RawDataCollector/src/RawDataMapperByLabel.cc new file mode 100644 index 0000000000000..f8e6856b2d546 --- /dev/null +++ b/EventFilter/RawDataCollector/src/RawDataMapperByLabel.cc @@ -0,0 +1,95 @@ +/** \file + * Implementation of class RawDataCollectorByLabel + * + */ + +#include "EventFilter/RawDataCollector/src/RawDataCollectorByLabel.h" +#include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h" +#include "DataFormats/FEDRawData/interface/FEDRawData.h" +#include "DataFormats/FEDRawData/interface/FEDNumbering.h" + +#include "DataFormats/Common/interface/Handle.h" +#include "FWCore/Framework/interface/Event.h" +#include "DataFormats/Provenance/interface/ProcessHistory.h" +#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/Framework/interface/EventSetup.h" + +#include "FWCore/MessageLogger/interface/MessageLogger.h" + +#include + +using namespace edm; + +RawDataCollectorByLabel::RawDataCollectorByLabel(const edm::ParameterSet& pset) { + + inputTags_ = pset.getParameter >("RawCollectionList"); + verbose_ = pset.getUntrackedParameter("verbose",0); + + inputTokens_.reserve(inputTags_.size()); + for(tag_iterator_t inputTag = inputTags_.begin(); inputTag != inputTags_.end(); ++inputTag ) { + inputTokens_.push_back(consumes(*inputTag)); + } + produces(); +} + +RawDataCollectorByLabel::~RawDataCollectorByLabel(){ + +} + + +void RawDataCollectorByLabel::produce(Event & e, const EventSetup& c){ + + /// Get Data from all FEDs + std::vector< Handle > rawData; + rawData.reserve(inputTokens_.size()); + for(tok_iterator_t inputTok = inputTokens_.begin(); inputTok != inputTokens_.end(); ++inputTok ) { + Handle input; + if (e.getByToken(*inputTok,input)){ + rawData.push_back(input); + } + //else{ //skipping the inputtag requested. but this is a normal operation to bare data & MC. silent warning } + } + + auto producedData = std::make_unique(); + + for (unsigned int i=0; i< rawData.size(); ++i ) { + + const FEDRawDataCollection *rdc=rawData[i].product(); + + if ( verbose_ > 0 ) { + std::cout << "\nRAW collection #" << i+1 << std::endl; + std::cout << "branch name = " << rawData[i].provenance()->branchName() << std::endl; + std::cout << "process index = " << rawData[i].provenance()->productID().processIndex() << std::endl; + } + + for ( int j=0; j< FEDNumbering::MAXFEDID; ++j ) { + const FEDRawData & fedData = rdc->FEDData(j); + size_t size=fedData.size(); + + if ( size > 0 ) { + // this fed has data -- lets copy it + if(verbose_ > 1) std::cout << "Copying data from FED #" << j << std::endl; + FEDRawData & fedDataProd = producedData->FEDData(j); + if ( fedDataProd.size() != 0 ) { + if(verbose_ > 1) { + std::cout << " More than one FEDRawDataCollection with data in FED "; + std::cout << j << " Skipping the 2nd\n"; + } + continue; + } + fedDataProd.resize(size); + unsigned char *dataProd=fedDataProd.data(); + const unsigned char *data=fedData.data(); + for ( unsigned int k=0; k Date: Wed, 3 Oct 2018 18:30:52 +0200 Subject: [PATCH 02/19] mapper first implemetation --- .../python/rawDataMapperByLabel_cfi.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 EventFilter/RawDataCollector/python/rawDataMapperByLabel_cfi.py diff --git a/EventFilter/RawDataCollector/python/rawDataMapperByLabel_cfi.py b/EventFilter/RawDataCollector/python/rawDataMapperByLabel_cfi.py new file mode 100644 index 0000000000000..324fdc42a802c --- /dev/null +++ b/EventFilter/RawDataCollector/python/rawDataMapperByLabel_cfi.py @@ -0,0 +1,13 @@ +import FWCore.ParameterSet.Config as cms + +rawDataCollector = cms.EDProducer("RawDataCollectorByLabel", + verbose = cms.untracked.int32(1), # 0 = quiet, 1 = collection list, 2 = FED list + RawCollectionList = cms.VInputTag( cms.InputTag('SiStripDigiToZSRaw'), + cms.InputTag('rawDataCollector')) +) + +# +# Make changes if using the Stage 1 trigger +# +from Configuration.Eras.Modifier_stage1L1Trigger_cff import stage1L1Trigger +stage1L1Trigger.toModify( rawDataCollector.RawCollectionList, func = lambda list: list.append(cms.InputTag("l1tDigiToRaw")) ) From fd898c98769b04a0cda2e06756ef826ff7423d90 Mon Sep 17 00:00:00 2001 From: Ivan Date: Wed, 3 Oct 2018 18:33:54 +0200 Subject: [PATCH 03/19] mapper first implemetation --- .../interface/RawDataMapperByLabel.h | 13 +++++++------ .../src/RawDataMapperByLabel.cc | 19 +++++++++++++------ 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/EventFilter/RawDataCollector/interface/RawDataMapperByLabel.h b/EventFilter/RawDataCollector/interface/RawDataMapperByLabel.h index ba67f34eecc2b..34b4820c63689 100644 --- a/EventFilter/RawDataCollector/interface/RawDataMapperByLabel.h +++ b/EventFilter/RawDataCollector/interface/RawDataMapperByLabel.h @@ -1,8 +1,8 @@ -#ifndef RawDataCollectorByLabel_H -#define RawDataCollectorByLabel_H +#ifndef RawDataMapperByLabel_H +#define RawDataMapperByLabel_H -/** \class RawDataCollectorByLabel +/** \class RawDataMapperByLabel * */ @@ -12,14 +12,14 @@ #include "DataFormats/Common/interface/Handle.h" #include "FWCore/Utilities/interface/InputTag.h" -class RawDataCollectorByLabel: public edm::stream::EDProducer<> { +class RawDataMapperByLabel: public edm::stream::EDProducer<> { public: ///Constructor - RawDataCollectorByLabel(const edm::ParameterSet& pset); + RawDataMapperByLabel(const edm::ParameterSet& pset); ///Destructor - ~RawDataCollectorByLabel() override; + ~RawDataMapperByLabel() override; void produce(edm::Event & e, const edm::EventSetup& c) override; @@ -29,6 +29,7 @@ class RawDataCollectorByLabel: public edm::stream::EDProducer<> { typedef std::vector >::const_iterator tok_iterator_t; std::vector inputTags_ ; + edm::InputTag mainCollectionTag_ ; std::vector > inputTokens_; int verbose_ ; diff --git a/EventFilter/RawDataCollector/src/RawDataMapperByLabel.cc b/EventFilter/RawDataCollector/src/RawDataMapperByLabel.cc index f8e6856b2d546..4b4379997dc30 100644 --- a/EventFilter/RawDataCollector/src/RawDataMapperByLabel.cc +++ b/EventFilter/RawDataCollector/src/RawDataMapperByLabel.cc @@ -1,9 +1,9 @@ /** \file - * Implementation of class RawDataCollectorByLabel + * Implementation of class RawDataMapperByLabel * */ -#include "EventFilter/RawDataCollector/src/RawDataCollectorByLabel.h" +#include "EventFilter/RawDataCollector/interface/RawDataMapperByLabel.h" #include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h" #include "DataFormats/FEDRawData/interface/FEDRawData.h" #include "DataFormats/FEDRawData/interface/FEDNumbering.h" @@ -20,9 +20,10 @@ using namespace edm; -RawDataCollectorByLabel::RawDataCollectorByLabel(const edm::ParameterSet& pset) { +RawDataMapperByLabel::RawDataMapperByLabel(const edm::ParameterSet& pset) { inputTags_ = pset.getParameter >("RawCollectionList"); + mainCollectionTag_ = pset.getParameter("MainCollection"); verbose_ = pset.getUntrackedParameter("verbose",0); inputTokens_.reserve(inputTags_.size()); @@ -32,12 +33,12 @@ RawDataCollectorByLabel::RawDataCollectorByLabel(const edm::ParameterSet& pset) produces(); } -RawDataCollectorByLabel::~RawDataCollectorByLabel(){ +RawDataMapperByLabel::~RawDataMapperByLabel(){ } -void RawDataCollectorByLabel::produce(Event & e, const EventSetup& c){ +void RawDataMapperByLabel::produce(Event & e, const EventSetup& c){ /// Get Data from all FEDs std::vector< Handle > rawData; @@ -52,6 +53,7 @@ void RawDataCollectorByLabel::produce(Event & e, const EventSetup& c){ auto producedData = std::make_unique(); + bool secondCollectionPresent= false; for (unsigned int i=0; i< rawData.size(); ++i ) { const FEDRawDataCollection *rdc=rawData[i].product(); @@ -61,12 +63,17 @@ void RawDataCollectorByLabel::produce(Event & e, const EventSetup& c){ std::cout << "branch name = " << rawData[i].provenance()->branchName() << std::endl; std::cout << "process index = " << rawData[i].provenance()->productID().processIndex() << std::endl; } - + + if(secondCollectionPresent) throw cms::Exception("Unknown input type") << tagName << " unknown. " + << "Two input collections are present. Please make sure that the input dataset has only one FEDRawDataCollector collection filled"; + + for ( int j=0; j< FEDNumbering::MAXFEDID; ++j ) { const FEDRawData & fedData = rdc->FEDData(j); size_t size=fedData.size(); if ( size > 0 ) { + secondCollectionPresent= true; // this fed has data -- lets copy it if(verbose_ > 1) std::cout << "Copying data from FED #" << j << std::endl; FEDRawData & fedDataProd = producedData->FEDData(j); From 58627101d57abdb90a6bc118969230d2e7b18e90 Mon Sep 17 00:00:00 2001 From: Ivan Date: Thu, 4 Oct 2018 18:53:01 +0200 Subject: [PATCH 04/19] a not compiling version --- .../python/rawDataMapperByLabel_cfi.py | 5 +- .../src/RawDataMapperByLabel.cc | 62 +++++-------------- 2 files changed, 19 insertions(+), 48 deletions(-) diff --git a/EventFilter/RawDataCollector/python/rawDataMapperByLabel_cfi.py b/EventFilter/RawDataCollector/python/rawDataMapperByLabel_cfi.py index 324fdc42a802c..c6bc0ef360a8a 100644 --- a/EventFilter/RawDataCollector/python/rawDataMapperByLabel_cfi.py +++ b/EventFilter/RawDataCollector/python/rawDataMapperByLabel_cfi.py @@ -1,9 +1,10 @@ import FWCore.ParameterSet.Config as cms -rawDataCollector = cms.EDProducer("RawDataCollectorByLabel", +rawDataCollector = cms.EDProducer("RawDataMapperByLabel", verbose = cms.untracked.int32(1), # 0 = quiet, 1 = collection list, 2 = FED list RawCollectionList = cms.VInputTag( cms.InputTag('SiStripDigiToZSRaw'), - cms.InputTag('rawDataCollector')) + cms.InputTag('rawDataCollector')), + MainCollection= cms.InputTag('rawDataCollector') ) # diff --git a/EventFilter/RawDataCollector/src/RawDataMapperByLabel.cc b/EventFilter/RawDataCollector/src/RawDataMapperByLabel.cc index 4b4379997dc30..ddc5af361330d 100644 --- a/EventFilter/RawDataCollector/src/RawDataMapperByLabel.cc +++ b/EventFilter/RawDataCollector/src/RawDataMapperByLabel.cc @@ -40,62 +40,32 @@ RawDataMapperByLabel::~RawDataMapperByLabel(){ void RawDataMapperByLabel::produce(Event & e, const EventSetup& c){ - /// Get Data from all FEDs - std::vector< Handle > rawData; - rawData.reserve(inputTokens_.size()); - for(tok_iterator_t inputTok = inputTokens_.begin(); inputTok != inputTokens_.end(); ++inputTok ) { + + bool AlredyACollectionFilled= false; + tag_iterator_t inputTag = inputTags_.begin(); + //unsigned int i=0; + for(tok_iterator_t inputTok = inputTokens_.begin(); inputTok != inputTokens_.end(); ++inputTok, ++inputTag ) { Handle input; if (e.getByToken(*inputTok,input)){ - rawData.push_back(input); + if(input.isValid()){ + if(AlredyACollectionFilled) throw cms::Exception("Unknown input type") << "Two input collections are present. Please make sure that the input dataset has only one FEDRawDataCollector collection filled"; + //auto producedData = std::make_unique(); + //const FEDRawDataCollection *rdc=input.product(); + e.put(std::move(input.product())); + AlredyACollectionFilled = true; } - //else{ //skipping the inputtag requested. but this is a normal operation to bare data & MC. silent warning } - } - - auto producedData = std::make_unique(); - - bool secondCollectionPresent= false; - for (unsigned int i=0; i< rawData.size(); ++i ) { - - const FEDRawDataCollection *rdc=rawData[i].product(); - - if ( verbose_ > 0 ) { - std::cout << "\nRAW collection #" << i+1 << std::endl; - std::cout << "branch name = " << rawData[i].provenance()->branchName() << std::endl; - std::cout << "process index = " << rawData[i].provenance()->productID().processIndex() << std::endl; + } - if(secondCollectionPresent) throw cms::Exception("Unknown input type") << tagName << " unknown. " - << "Two input collections are present. Please make sure that the input dataset has only one FEDRawDataCollector collection filled"; + + + // if(secondCollectionPresent) - for ( int j=0; j< FEDNumbering::MAXFEDID; ++j ) { - const FEDRawData & fedData = rdc->FEDData(j); - size_t size=fedData.size(); - - if ( size > 0 ) { - secondCollectionPresent= true; - // this fed has data -- lets copy it - if(verbose_ > 1) std::cout << "Copying data from FED #" << j << std::endl; - FEDRawData & fedDataProd = producedData->FEDData(j); - if ( fedDataProd.size() != 0 ) { - if(verbose_ > 1) { - std::cout << " More than one FEDRawDataCollection with data in FED "; - std::cout << j << " Skipping the 2nd\n"; - } - continue; - } - fedDataProd.resize(size); - unsigned char *dataProd=fedDataProd.data(); - const unsigned char *data=fedData.data(); - for ( unsigned int k=0; k Date: Sun, 7 Oct 2018 11:20:55 +0200 Subject: [PATCH 05/19] implementatin with all features --- .../interface/RawDataMapperByLabel.h | 3 +++ .../RawDataCollector/src/RawDataCollectorByLabel.cc | 8 ++++---- .../RawDataCollector/src/RawDataMapperByLabel.cc | 13 ++++++++----- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/EventFilter/RawDataCollector/interface/RawDataMapperByLabel.h b/EventFilter/RawDataCollector/interface/RawDataMapperByLabel.h index 34b4820c63689..f342c4400bfb7 100644 --- a/EventFilter/RawDataCollector/interface/RawDataMapperByLabel.h +++ b/EventFilter/RawDataCollector/interface/RawDataMapperByLabel.h @@ -32,6 +32,9 @@ class RawDataMapperByLabel: public edm::stream::EDProducer<> { edm::InputTag mainCollectionTag_ ; std::vector > inputTokens_; int verbose_ ; + + bool firstEvent_; + edm::InputTag filledCollectionName_; }; diff --git a/EventFilter/RawDataCollector/src/RawDataCollectorByLabel.cc b/EventFilter/RawDataCollector/src/RawDataCollectorByLabel.cc index f8e6856b2d546..8ffd8acad7866 100644 --- a/EventFilter/RawDataCollector/src/RawDataCollectorByLabel.cc +++ b/EventFilter/RawDataCollector/src/RawDataCollectorByLabel.cc @@ -71,10 +71,10 @@ void RawDataCollectorByLabel::produce(Event & e, const EventSetup& c){ if(verbose_ > 1) std::cout << "Copying data from FED #" << j << std::endl; FEDRawData & fedDataProd = producedData->FEDData(j); if ( fedDataProd.size() != 0 ) { - if(verbose_ > 1) { - std::cout << " More than one FEDRawDataCollection with data in FED "; - std::cout << j << " Skipping the 2nd\n"; - } + if(verbose_ > 1) { + std::cout << " More than one FEDRawDataCollection with data in FED "; + std::cout << j << " Skipping the 2nd\n"; + } continue; } fedDataProd.resize(size); diff --git a/EventFilter/RawDataCollector/src/RawDataMapperByLabel.cc b/EventFilter/RawDataCollector/src/RawDataMapperByLabel.cc index ddc5af361330d..f88fc93e0de6c 100644 --- a/EventFilter/RawDataCollector/src/RawDataMapperByLabel.cc +++ b/EventFilter/RawDataCollector/src/RawDataMapperByLabel.cc @@ -31,6 +31,8 @@ RawDataMapperByLabel::RawDataMapperByLabel(const edm::ParameterSet& pset) { inputTokens_.push_back(consumes(*inputTag)); } produces(); + firstEvent_= true; + filledCollectionName_= InputTag(""); } RawDataMapperByLabel::~RawDataMapperByLabel(){ @@ -48,14 +50,15 @@ void RawDataMapperByLabel::produce(Event & e, const EventSetup& c){ Handle input; if (e.getByToken(*inputTok,input)){ if(input.isValid()){ + if(firstEvent_) filledCollectionName_ = *inputTag; if(AlredyACollectionFilled) throw cms::Exception("Unknown input type") << "Two input collections are present. Please make sure that the input dataset has only one FEDRawDataCollector collection filled"; - //auto producedData = std::make_unique(); - //const FEDRawDataCollection *rdc=input.product(); - e.put(std::move(input.product())); - AlredyACollectionFilled = true; + if(!(filledCollectionName_==*inputTag)) throw cms::Exception("Unknown input type") << "The filled collection has changed!"; + e.put(std::move(std::make_unique(*input.product())) ); + AlredyACollectionFilled = true; + firstEvent_= false; } - } +} From 50b75b607897ae2666d067c5c005305c7e660ad2 Mon Sep 17 00:00:00 2001 From: Ivan Date: Sun, 7 Oct 2018 11:44:46 +0200 Subject: [PATCH 06/19] implementatin with all features --- EventFilter/RawDataCollector/interface/RawDataMapperByLabel.h | 2 +- .../RawDataCollector/python/rawDataMapperByLabel_cfi.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/EventFilter/RawDataCollector/interface/RawDataMapperByLabel.h b/EventFilter/RawDataCollector/interface/RawDataMapperByLabel.h index f342c4400bfb7..8303258abd2d2 100644 --- a/EventFilter/RawDataCollector/interface/RawDataMapperByLabel.h +++ b/EventFilter/RawDataCollector/interface/RawDataMapperByLabel.h @@ -29,12 +29,12 @@ class RawDataMapperByLabel: public edm::stream::EDProducer<> { typedef std::vector >::const_iterator tok_iterator_t; std::vector inputTags_ ; - edm::InputTag mainCollectionTag_ ; std::vector > inputTokens_; int verbose_ ; bool firstEvent_; edm::InputTag filledCollectionName_; + edm::InputTag mainCollectionTag_ ; }; diff --git a/EventFilter/RawDataCollector/python/rawDataMapperByLabel_cfi.py b/EventFilter/RawDataCollector/python/rawDataMapperByLabel_cfi.py index c6bc0ef360a8a..6ab8034b0c3bf 100644 --- a/EventFilter/RawDataCollector/python/rawDataMapperByLabel_cfi.py +++ b/EventFilter/RawDataCollector/python/rawDataMapperByLabel_cfi.py @@ -2,7 +2,8 @@ rawDataCollector = cms.EDProducer("RawDataMapperByLabel", verbose = cms.untracked.int32(1), # 0 = quiet, 1 = collection list, 2 = FED list - RawCollectionList = cms.VInputTag( cms.InputTag('SiStripDigiToZSRaw'), + RawCollectionList = cms.VInputTag( cms.InputTag('rawDataReducedFormat'), + cms.InputTag('rawDataRepacker'), cms.InputTag('rawDataCollector')), MainCollection= cms.InputTag('rawDataCollector') ) From 0707979a7486be85fe12a3e72666c212deb5ea3b Mon Sep 17 00:00:00 2001 From: Ivan Date: Sun, 7 Oct 2018 12:15:16 +0200 Subject: [PATCH 07/19] implementatin with all features --- .../RawDataCollector/interface/RawDataMapperByLabel.h | 1 - .../RawDataCollector/python/rawDataMapperByLabel_cfi.py | 6 ------ 2 files changed, 7 deletions(-) diff --git a/EventFilter/RawDataCollector/interface/RawDataMapperByLabel.h b/EventFilter/RawDataCollector/interface/RawDataMapperByLabel.h index 8303258abd2d2..1ec16af6871ed 100644 --- a/EventFilter/RawDataCollector/interface/RawDataMapperByLabel.h +++ b/EventFilter/RawDataCollector/interface/RawDataMapperByLabel.h @@ -30,7 +30,6 @@ class RawDataMapperByLabel: public edm::stream::EDProducer<> { std::vector inputTags_ ; std::vector > inputTokens_; - int verbose_ ; bool firstEvent_; edm::InputTag filledCollectionName_; diff --git a/EventFilter/RawDataCollector/python/rawDataMapperByLabel_cfi.py b/EventFilter/RawDataCollector/python/rawDataMapperByLabel_cfi.py index 6ab8034b0c3bf..ecde15276f88b 100644 --- a/EventFilter/RawDataCollector/python/rawDataMapperByLabel_cfi.py +++ b/EventFilter/RawDataCollector/python/rawDataMapperByLabel_cfi.py @@ -1,15 +1,9 @@ import FWCore.ParameterSet.Config as cms rawDataCollector = cms.EDProducer("RawDataMapperByLabel", - verbose = cms.untracked.int32(1), # 0 = quiet, 1 = collection list, 2 = FED list RawCollectionList = cms.VInputTag( cms.InputTag('rawDataReducedFormat'), cms.InputTag('rawDataRepacker'), cms.InputTag('rawDataCollector')), MainCollection= cms.InputTag('rawDataCollector') ) -# -# Make changes if using the Stage 1 trigger -# -from Configuration.Eras.Modifier_stage1L1Trigger_cff import stage1L1Trigger -stage1L1Trigger.toModify( rawDataCollector.RawCollectionList, func = lambda list: list.append(cms.InputTag("l1tDigiToRaw")) ) From d326168840bb861c2ae508c31718b8ee52d11698 Mon Sep 17 00:00:00 2001 From: Ivan Date: Sun, 7 Oct 2018 23:08:51 +0200 Subject: [PATCH 08/19] implementatin with all features --- .../src/RawDataMapperByLabel.cc | 20 ++++++++----------- 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/EventFilter/RawDataCollector/src/RawDataMapperByLabel.cc b/EventFilter/RawDataCollector/src/RawDataMapperByLabel.cc index f88fc93e0de6c..71f216767f8be 100644 --- a/EventFilter/RawDataCollector/src/RawDataMapperByLabel.cc +++ b/EventFilter/RawDataCollector/src/RawDataMapperByLabel.cc @@ -24,7 +24,7 @@ RawDataMapperByLabel::RawDataMapperByLabel(const edm::ParameterSet& pset) { inputTags_ = pset.getParameter >("RawCollectionList"); mainCollectionTag_ = pset.getParameter("MainCollection"); - verbose_ = pset.getUntrackedParameter("verbose",0); + inputTokens_.reserve(inputTags_.size()); for(tag_iterator_t inputTag = inputTags_.begin(); inputTag != inputTags_.end(); ++inputTag ) { @@ -50,23 +50,19 @@ void RawDataMapperByLabel::produce(Event & e, const EventSetup& c){ Handle input; if (e.getByToken(*inputTok,input)){ if(input.isValid()){ - if(firstEvent_) filledCollectionName_ = *inputTag; + if(firstEvent_){ + if(mainCollectionTag_==*inputTag) continue; + filledCollectionName_ = *inputTag; + } if(AlredyACollectionFilled) throw cms::Exception("Unknown input type") << "Two input collections are present. Please make sure that the input dataset has only one FEDRawDataCollector collection filled"; if(!(filledCollectionName_==*inputTag)) throw cms::Exception("Unknown input type") << "The filled collection has changed!"; e.put(std::move(std::make_unique(*input.product())) ); AlredyACollectionFilled = true; firstEvent_= false; - } + } -} - - - - // if(secondCollectionPresent) - - - - } + } + } // Insert the new product in the event From 3fd4e237790c595debe4027b05211ed41302ff54 Mon Sep 17 00:00:00 2001 From: Ivan Date: Tue, 9 Oct 2018 20:34:49 +0200 Subject: [PATCH 09/19] PR requests --- .../src/RawDataMapperByLabel.cc | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/EventFilter/RawDataCollector/src/RawDataMapperByLabel.cc b/EventFilter/RawDataCollector/src/RawDataMapperByLabel.cc index 71f216767f8be..8f2aab2f121b1 100644 --- a/EventFilter/RawDataCollector/src/RawDataMapperByLabel.cc +++ b/EventFilter/RawDataCollector/src/RawDataMapperByLabel.cc @@ -43,9 +43,8 @@ RawDataMapperByLabel::~RawDataMapperByLabel(){ void RawDataMapperByLabel::produce(Event & e, const EventSetup& c){ - bool AlredyACollectionFilled= false; + bool AlreadyACollectionFilled= false; tag_iterator_t inputTag = inputTags_.begin(); - //unsigned int i=0; for(tok_iterator_t inputTok = inputTokens_.begin(); inputTok != inputTokens_.end(); ++inputTok, ++inputTag ) { Handle input; if (e.getByToken(*inputTok,input)){ @@ -53,19 +52,15 @@ void RawDataMapperByLabel::produce(Event & e, const EventSetup& c){ if(firstEvent_){ if(mainCollectionTag_==*inputTag) continue; filledCollectionName_ = *inputTag; - } - if(AlredyACollectionFilled) throw cms::Exception("Unknown input type") << "Two input collections are present. Please make sure that the input dataset has only one FEDRawDataCollector collection filled"; + } + if(AlreadyACollectionFilled) throw cms::Exception("Unknown input type") << "Two input collections are present. Please make sure that the input dataset has only one FEDRawDataCollector collection filled"; if(!(filledCollectionName_==*inputTag)) throw cms::Exception("Unknown input type") << "The filled collection has changed!"; - e.put(std::move(std::make_unique(*input.product())) ); - AlredyACollectionFilled = true; + e.put(std::make_unique(*input.product())); + AlreadyACollectionFilled = true; firstEvent_= false; - } - - } + } + } } - - // Insert the new product in the event - } From 4904cafd6c59c4cb29ba4f1652721953483ebceb Mon Sep 17 00:00:00 2001 From: Ivan Date: Tue, 9 Oct 2018 20:49:55 +0200 Subject: [PATCH 10/19] PR requests --- EventFilter/RawDataCollector/src/SealModule.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/EventFilter/RawDataCollector/src/SealModule.cc b/EventFilter/RawDataCollector/src/SealModule.cc index bf748bc2d8b75..dffe925f3b30b 100644 --- a/EventFilter/RawDataCollector/src/SealModule.cc +++ b/EventFilter/RawDataCollector/src/SealModule.cc @@ -2,8 +2,10 @@ #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/ServiceRegistry/interface/ServiceMaker.h" #include "EventFilter/RawDataCollector/src/RawDataCollectorByLabel.h" +#include "EventFilter/RawDataCollector/interface/RawDataMapperByLabel.h" using namespace edm::serviceregistry; DEFINE_FWK_MODULE(RawDataCollectorByLabel); +DEFINE_FWK_MODULE(RawDataMapperByLabel); From e1ee65a35c7246b500fa5ef0c8da2f8f9e25df68 Mon Sep 17 00:00:00 2001 From: Ivan Date: Fri, 12 Oct 2018 09:11:18 +0200 Subject: [PATCH 11/19] fillDescription, headers, class definition and some logoc --- .../interface/RawDataMapperByLabel.h | 40 --------- .../python/rawDataMapperByLabel_cfi.py | 6 +- .../src/RawDataCollectorByLabel.cc | 8 +- .../src/RawDataMapperByLabel.cc | 89 ++++++++++++++----- .../RawDataCollector/src/SealModule.cc | 3 +- 5 files changed, 76 insertions(+), 70 deletions(-) delete mode 100644 EventFilter/RawDataCollector/interface/RawDataMapperByLabel.h diff --git a/EventFilter/RawDataCollector/interface/RawDataMapperByLabel.h b/EventFilter/RawDataCollector/interface/RawDataMapperByLabel.h deleted file mode 100644 index 1ec16af6871ed..0000000000000 --- a/EventFilter/RawDataCollector/interface/RawDataMapperByLabel.h +++ /dev/null @@ -1,40 +0,0 @@ -#ifndef RawDataMapperByLabel_H -#define RawDataMapperByLabel_H - - -/** \class RawDataMapperByLabel - * - */ - -#include "FWCore/Framework/interface/MakerMacros.h" -#include "FWCore/Framework/interface/stream/EDProducer.h" -#include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h" -#include "DataFormats/Common/interface/Handle.h" -#include "FWCore/Utilities/interface/InputTag.h" - -class RawDataMapperByLabel: public edm::stream::EDProducer<> { -public: - - ///Constructor - RawDataMapperByLabel(const edm::ParameterSet& pset); - - ///Destructor - ~RawDataMapperByLabel() override; - - void produce(edm::Event & e, const edm::EventSetup& c) override; - -private: - - typedef std::vector::const_iterator tag_iterator_t; - typedef std::vector >::const_iterator tok_iterator_t; - - std::vector inputTags_ ; - std::vector > inputTokens_; - - bool firstEvent_; - edm::InputTag filledCollectionName_; - edm::InputTag mainCollectionTag_ ; - -}; - -#endif diff --git a/EventFilter/RawDataCollector/python/rawDataMapperByLabel_cfi.py b/EventFilter/RawDataCollector/python/rawDataMapperByLabel_cfi.py index ecde15276f88b..1baa71ad4d13f 100644 --- a/EventFilter/RawDataCollector/python/rawDataMapperByLabel_cfi.py +++ b/EventFilter/RawDataCollector/python/rawDataMapperByLabel_cfi.py @@ -1,9 +1,9 @@ import FWCore.ParameterSet.Config as cms rawDataCollector = cms.EDProducer("RawDataMapperByLabel", - RawCollectionList = cms.VInputTag( cms.InputTag('rawDataReducedFormat'), + rawCollectionList = cms.VInputTag( cms.InputTag('rawDataCollector'), cms.InputTag('rawDataRepacker'), - cms.InputTag('rawDataCollector')), - MainCollection= cms.InputTag('rawDataCollector') + cms.InputTag('rawDataReducedFormat')), + mainCollection= cms.InputTag('rawDataCollector') ) diff --git a/EventFilter/RawDataCollector/src/RawDataCollectorByLabel.cc b/EventFilter/RawDataCollector/src/RawDataCollectorByLabel.cc index 8ffd8acad7866..22c6d966e5bd8 100644 --- a/EventFilter/RawDataCollector/src/RawDataCollectorByLabel.cc +++ b/EventFilter/RawDataCollector/src/RawDataCollectorByLabel.cc @@ -71,10 +71,10 @@ void RawDataCollectorByLabel::produce(Event & e, const EventSetup& c){ if(verbose_ > 1) std::cout << "Copying data from FED #" << j << std::endl; FEDRawData & fedDataProd = producedData->FEDData(j); if ( fedDataProd.size() != 0 ) { - if(verbose_ > 1) { - std::cout << " More than one FEDRawDataCollection with data in FED "; - std::cout << j << " Skipping the 2nd\n"; - } + if(verbose_ > 1) { + std::cout << " More than one FEDRawDataCollection with data in FED "; + std::cout << j << " Skipping the 2nd\n"; + } continue; } fedDataProd.resize(size); diff --git a/EventFilter/RawDataCollector/src/RawDataMapperByLabel.cc b/EventFilter/RawDataCollector/src/RawDataMapperByLabel.cc index 8f2aab2f121b1..2905ce25813e7 100644 --- a/EventFilter/RawDataCollector/src/RawDataMapperByLabel.cc +++ b/EventFilter/RawDataCollector/src/RawDataMapperByLabel.cc @@ -3,36 +3,67 @@ * */ -#include "EventFilter/RawDataCollector/interface/RawDataMapperByLabel.h" +#include "DataFormats/Provenance/interface/ProcessHistory.h" +#include "DataFormats/Common/interface/Handle.h" #include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h" -#include "DataFormats/FEDRawData/interface/FEDRawData.h" -#include "DataFormats/FEDRawData/interface/FEDNumbering.h" - #include "DataFormats/Common/interface/Handle.h" + #include "FWCore/Framework/interface/Event.h" -#include "DataFormats/Provenance/interface/ProcessHistory.h" #include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/EventSetup.h" - #include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" +#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/Framework/interface/stream/EDProducer.h" +#include "FWCore/Utilities/interface/InputTag.h" #include using namespace edm; +class RawDataMapperByLabel: public edm::stream::EDProducer<> { +public: + + ///Constructor + RawDataMapperByLabel(const edm::ParameterSet& pset); + + ///Destructor + ~RawDataMapperByLabel() override; + + void produce(edm::Event & e, const edm::EventSetup& c) override; + + static void fillDescriptions(edm::ConfigurationDescriptions &); +private: + + typedef std::vector::const_iterator tag_iterator_t; + typedef std::vector >::const_iterator tok_iterator_t; + + std::vector inputTags_ ; + std::vector > inputTokens_; + + bool firstEvent_; + edm::InputTag filledCollectionName_; + edm::InputTag mainCollectionTag_ ; + + + +}; + + RawDataMapperByLabel::RawDataMapperByLabel(const edm::ParameterSet& pset) { - inputTags_ = pset.getParameter >("RawCollectionList"); - mainCollectionTag_ = pset.getParameter("MainCollection"); - + inputTags_ = pset.getParameter >("rawCollectionList"); + mainCollectionTag_ = pset.getParameter("rainCollection"); + firstEvent_= true; + filledCollectionName_= InputTag(""); inputTokens_.reserve(inputTags_.size()); - for(tag_iterator_t inputTag = inputTags_.begin(); inputTag != inputTags_.end(); ++inputTag ) { - inputTokens_.push_back(consumes(*inputTag)); + for(auto const& inputTag: inputTags_) { + inputTokens_.push_back(consumes(inputTag)); } produces(); - firstEvent_= true; - filledCollectionName_= InputTag(""); + } RawDataMapperByLabel::~RawDataMapperByLabel(){ @@ -41,26 +72,42 @@ RawDataMapperByLabel::~RawDataMapperByLabel(){ void RawDataMapperByLabel::produce(Event & e, const EventSetup& c){ - - bool AlreadyACollectionFilled= false; + bool alreadyACollectionFilled= false; tag_iterator_t inputTag = inputTags_.begin(); for(tok_iterator_t inputTok = inputTokens_.begin(); inputTok != inputTokens_.end(); ++inputTok, ++inputTag ) { Handle input; if (e.getByToken(*inputTok,input)){ if(input.isValid()){ - if(firstEvent_){ - if(mainCollectionTag_==*inputTag) continue; + if(firstEvent_){ filledCollectionName_ = *inputTag; + alreadyACollectionFilled = true; + firstEvent_= false; } - if(AlreadyACollectionFilled) throw cms::Exception("Unknown input type") << "Two input collections are present. Please make sure that the input dataset has only one FEDRawDataCollector collection filled"; + + if(alreadyACollectionFilled) throw cms::Exception("Unknown input type") << "Two input collections are present. Please make sure that the input dataset has only one FEDRawDataCollector collection filled"; if(!(filledCollectionName_==*inputTag)) throw cms::Exception("Unknown input type") << "The filled collection has changed!"; - e.put(std::make_unique(*input.product())); - AlreadyACollectionFilled = true; - firstEvent_= false; + + if(!(mainCollectionTag_==filledCollectionName_)) e.put(std::make_unique(*input.product())); + } } } } +void RawDataMapperByLabel::fillDescriptions(edm::ConfigurationDescriptions & descriptions) { + edm::ParameterSetDescription desc; + + std::vector tmp_itvect; + tmp_itvect.push_back( edm::InputTag("rawDataCollector")); + tmp_itvect.push_back( edm::InputTag("rawDataRepacker")); + tmp_itvect.push_back( edm::InputTag("rawDataReducedFormat")); + + desc.add>("rawCollectionList", tmp_itvect); + desc.add("mainCollection", edm::InputTag("rawDataCollector")); + + descriptions.add("rawDataCollector", desc); +} + +DEFINE_FWK_MODULE(RawDataMapperByLabel); diff --git a/EventFilter/RawDataCollector/src/SealModule.cc b/EventFilter/RawDataCollector/src/SealModule.cc index dffe925f3b30b..cd50257754e14 100644 --- a/EventFilter/RawDataCollector/src/SealModule.cc +++ b/EventFilter/RawDataCollector/src/SealModule.cc @@ -2,10 +2,9 @@ #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/ServiceRegistry/interface/ServiceMaker.h" #include "EventFilter/RawDataCollector/src/RawDataCollectorByLabel.h" -#include "EventFilter/RawDataCollector/interface/RawDataMapperByLabel.h" + using namespace edm::serviceregistry; DEFINE_FWK_MODULE(RawDataCollectorByLabel); -DEFINE_FWK_MODULE(RawDataMapperByLabel); From a3ef0b57ce1d1cc5013bb811e1dfdd046efedfea Mon Sep 17 00:00:00 2001 From: Ivan Date: Sat, 13 Oct 2018 12:23:42 +0200 Subject: [PATCH 12/19] fixing indentation --- .../RawDataCollector/src/RawDataCollectorByLabel.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/EventFilter/RawDataCollector/src/RawDataCollectorByLabel.cc b/EventFilter/RawDataCollector/src/RawDataCollectorByLabel.cc index 22c6d966e5bd8..4d5cc31c45f73 100644 --- a/EventFilter/RawDataCollector/src/RawDataCollectorByLabel.cc +++ b/EventFilter/RawDataCollector/src/RawDataCollectorByLabel.cc @@ -72,16 +72,16 @@ void RawDataCollectorByLabel::produce(Event & e, const EventSetup& c){ FEDRawData & fedDataProd = producedData->FEDData(j); if ( fedDataProd.size() != 0 ) { if(verbose_ > 1) { - std::cout << " More than one FEDRawDataCollection with data in FED "; - std::cout << j << " Skipping the 2nd\n"; + std::cout << " More than one FEDRawDataCollection with data in FED "; + std::cout << j << " Skipping the 2nd\n"; } - continue; + continue; } fedDataProd.resize(size); unsigned char *dataProd=fedDataProd.data(); const unsigned char *data=fedData.data(); for ( unsigned int k=0; k Date: Sat, 13 Oct 2018 12:31:52 +0200 Subject: [PATCH 13/19] fillDescription update, inizializer, hestetics --- .../src/RawDataMapperByLabel.cc | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/EventFilter/RawDataCollector/src/RawDataMapperByLabel.cc b/EventFilter/RawDataCollector/src/RawDataMapperByLabel.cc index 2905ce25813e7..6a23206cc0227 100644 --- a/EventFilter/RawDataCollector/src/RawDataMapperByLabel.cc +++ b/EventFilter/RawDataCollector/src/RawDataMapperByLabel.cc @@ -42,26 +42,26 @@ class RawDataMapperByLabel: public edm::stream::EDProducer<> { std::vector inputTags_ ; std::vector > inputTokens_; - bool firstEvent_; - edm::InputTag filledCollectionName_; edm::InputTag mainCollectionTag_ ; - + edm::InputTag filledCollectionName_; + bool firstEvent_; }; -RawDataMapperByLabel::RawDataMapperByLabel(const edm::ParameterSet& pset) { - - inputTags_ = pset.getParameter >("rawCollectionList"); - mainCollectionTag_ = pset.getParameter("rainCollection"); - firstEvent_= true; - filledCollectionName_= InputTag(""); +RawDataMapperByLabel::RawDataMapperByLabel(const edm::ParameterSet& pset) + : inputTags_(pset.getParameter>("rawCollectionList")), + mainCollectionTag_(pset.getParameter("mainCollection")), + filledCollectionName_(edm::InputTag("")), + firstEvent_(true) +{ inputTokens_.reserve(inputTags_.size()); for(auto const& inputTag: inputTags_) { inputTokens_.push_back(consumes(inputTag)); } + produces(); } @@ -78,15 +78,15 @@ void RawDataMapperByLabel::produce(Event & e, const EventSetup& c){ for(tok_iterator_t inputTok = inputTokens_.begin(); inputTok != inputTokens_.end(); ++inputTok, ++inputTag ) { Handle input; if (e.getByToken(*inputTok,input)){ - if(input.isValid()){ - if(firstEvent_){ - filledCollectionName_ = *inputTag; - alreadyACollectionFilled = true; + if(input.isValid()){ + if(firstEvent_){ + filledCollectionName_ = *inputTag; + alreadyACollectionFilled = true; firstEvent_= false; } - if(alreadyACollectionFilled) throw cms::Exception("Unknown input type") << "Two input collections are present. Please make sure that the input dataset has only one FEDRawDataCollector collection filled"; - if(!(filledCollectionName_==*inputTag)) throw cms::Exception("Unknown input type") << "The filled collection has changed!"; + if(alreadyACollectionFilled) throw cms::Exception("BadInput") << "Two input collections are present." << "Please make sure that the input dataset has only one FEDRawDataCollector collection filled"; + if(!(filledCollectionName_==*inputTag)) throw cms::Exception("BadInput") << "The filled collection has changed!"; if(!(mainCollectionTag_==filledCollectionName_)) e.put(std::make_unique(*input.product())); @@ -99,9 +99,9 @@ void RawDataMapperByLabel::fillDescriptions(edm::ConfigurationDescriptions & des edm::ParameterSetDescription desc; std::vector tmp_itvect; - tmp_itvect.push_back( edm::InputTag("rawDataCollector")); - tmp_itvect.push_back( edm::InputTag("rawDataRepacker")); - tmp_itvect.push_back( edm::InputTag("rawDataReducedFormat")); + //tmp_itvect.push_back( edm::InputTag("rawDataCollector")); + //tmp_itvect.push_back( edm::InputTag("rawDataRepacker")); + //tmp_itvect.push_back( edm::InputTag("rawDataReducedFormat")); desc.add>("rawCollectionList", tmp_itvect); desc.add("mainCollection", edm::InputTag("rawDataCollector")); From 8c5a6f3175f7857a0da27661795285f01868eac6 Mon Sep 17 00:00:00 2001 From: Ivan Date: Sat, 13 Oct 2018 12:42:34 +0200 Subject: [PATCH 14/19] more indentation --- .../src/RawDataMapperByLabel.cc | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/EventFilter/RawDataCollector/src/RawDataMapperByLabel.cc b/EventFilter/RawDataCollector/src/RawDataMapperByLabel.cc index 6a23206cc0227..4045eb38dca31 100644 --- a/EventFilter/RawDataCollector/src/RawDataMapperByLabel.cc +++ b/EventFilter/RawDataCollector/src/RawDataMapperByLabel.cc @@ -63,9 +63,9 @@ RawDataMapperByLabel::RawDataMapperByLabel(const edm::ParameterSet& pset) } produces(); - } + RawDataMapperByLabel::~RawDataMapperByLabel(){ } @@ -77,22 +77,22 @@ void RawDataMapperByLabel::produce(Event & e, const EventSetup& c){ tag_iterator_t inputTag = inputTags_.begin(); for(tok_iterator_t inputTok = inputTokens_.begin(); inputTok != inputTokens_.end(); ++inputTok, ++inputTag ) { Handle input; - if (e.getByToken(*inputTok,input)){ - if(input.isValid()){ - if(firstEvent_){ - filledCollectionName_ = *inputTag; - alreadyACollectionFilled = true; - firstEvent_= false; - } + if(e.getByToken(*inputTok,input)){ + if(input.isValid()){ + if(firstEvent_){ + filledCollectionName_ = *inputTag; + alreadyACollectionFilled = true; + firstEvent_= false; + } - if(alreadyACollectionFilled) throw cms::Exception("BadInput") << "Two input collections are present." << "Please make sure that the input dataset has only one FEDRawDataCollector collection filled"; - if(!(filledCollectionName_==*inputTag)) throw cms::Exception("BadInput") << "The filled collection has changed!"; + if(alreadyACollectionFilled) throw cms::Exception("BadInput") << "Two input collections are present." << "Please make sure that the input dataset has only one FEDRawDataCollector collection filled"; + if(!(filledCollectionName_==*inputTag)) throw cms::Exception("BadInput") << "The filled collection has changed!"; - if(!(mainCollectionTag_==filledCollectionName_)) e.put(std::make_unique(*input.product())); + if(!(mainCollectionTag_==filledCollectionName_)) e.put(std::make_unique(*input.product())); - } - } - } + } + } + } } void RawDataMapperByLabel::fillDescriptions(edm::ConfigurationDescriptions & descriptions) { From 2aefb2f3c17994f01b99284162db842f78c8435a Mon Sep 17 00:00:00 2001 From: Ivan Date: Sat, 13 Oct 2018 20:41:18 +0200 Subject: [PATCH 15/19] fixed exception, renamed module, changed fillDescriprion --- .../python/rawDataMapperByLabel_cfi.py | 2 +- .../RawDataCollector/src/RawDataMapperByLabel.cc | 15 ++++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/EventFilter/RawDataCollector/python/rawDataMapperByLabel_cfi.py b/EventFilter/RawDataCollector/python/rawDataMapperByLabel_cfi.py index 1baa71ad4d13f..630dfde4af50f 100644 --- a/EventFilter/RawDataCollector/python/rawDataMapperByLabel_cfi.py +++ b/EventFilter/RawDataCollector/python/rawDataMapperByLabel_cfi.py @@ -1,6 +1,6 @@ import FWCore.ParameterSet.Config as cms -rawDataCollector = cms.EDProducer("RawDataMapperByLabel", +rawDataMapper = cms.EDProducer("RawDataMapperByLabel", rawCollectionList = cms.VInputTag( cms.InputTag('rawDataCollector'), cms.InputTag('rawDataRepacker'), cms.InputTag('rawDataReducedFormat')), diff --git a/EventFilter/RawDataCollector/src/RawDataMapperByLabel.cc b/EventFilter/RawDataCollector/src/RawDataMapperByLabel.cc index 4045eb38dca31..40cfc24a62d34 100644 --- a/EventFilter/RawDataCollector/src/RawDataMapperByLabel.cc +++ b/EventFilter/RawDataCollector/src/RawDataMapperByLabel.cc @@ -63,6 +63,7 @@ RawDataMapperByLabel::RawDataMapperByLabel(const edm::ParameterSet& pset) } produces(); + } @@ -73,19 +74,23 @@ RawDataMapperByLabel::~RawDataMapperByLabel(){ void RawDataMapperByLabel::produce(Event & e, const EventSetup& c){ + std::cout <<"starting the producer" << std::endl; bool alreadyACollectionFilled= false; tag_iterator_t inputTag = inputTags_.begin(); for(tok_iterator_t inputTok = inputTokens_.begin(); inputTok != inputTokens_.end(); ++inputTok, ++inputTag ) { Handle input; if(e.getByToken(*inputTok,input)){ if(input.isValid()){ + if(alreadyACollectionFilled) throw cms::Exception("BadInput") << "Two input collections are present." << std::endl + << "Please make sure that the input dataset has only one FEDRawDataCollector collection filled"; + if(firstEvent_){ filledCollectionName_ = *inputTag; alreadyACollectionFilled = true; firstEvent_= false; } - if(alreadyACollectionFilled) throw cms::Exception("BadInput") << "Two input collections are present." << "Please make sure that the input dataset has only one FEDRawDataCollector collection filled"; + if(!(filledCollectionName_==*inputTag)) throw cms::Exception("BadInput") << "The filled collection has changed!"; if(!(mainCollectionTag_==filledCollectionName_)) e.put(std::make_unique(*input.product())); @@ -99,14 +104,14 @@ void RawDataMapperByLabel::fillDescriptions(edm::ConfigurationDescriptions & des edm::ParameterSetDescription desc; std::vector tmp_itvect; - //tmp_itvect.push_back( edm::InputTag("rawDataCollector")); - //tmp_itvect.push_back( edm::InputTag("rawDataRepacker")); - //tmp_itvect.push_back( edm::InputTag("rawDataReducedFormat")); + tmp_itvect.push_back( edm::InputTag("rawDataCollector")); + tmp_itvect.push_back( edm::InputTag("rawDataRepacker")); + tmp_itvect.push_back( edm::InputTag("rawDataReducedFormat")); desc.add>("rawCollectionList", tmp_itvect); desc.add("mainCollection", edm::InputTag("rawDataCollector")); - descriptions.add("rawDataCollector", desc); + descriptions.add("rawDataMapper", desc); } DEFINE_FWK_MODULE(RawDataMapperByLabel); From 7d19ee8d001d62fc3b1fa46d325a2d77cee46e5e Mon Sep 17 00:00:00 2001 From: Ivan Date: Sat, 13 Oct 2018 20:55:13 +0200 Subject: [PATCH 16/19] removing debug couts --- EventFilter/RawDataCollector/src/RawDataMapperByLabel.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/EventFilter/RawDataCollector/src/RawDataMapperByLabel.cc b/EventFilter/RawDataCollector/src/RawDataMapperByLabel.cc index 40cfc24a62d34..6dbb2462aa38b 100644 --- a/EventFilter/RawDataCollector/src/RawDataMapperByLabel.cc +++ b/EventFilter/RawDataCollector/src/RawDataMapperByLabel.cc @@ -74,7 +74,6 @@ RawDataMapperByLabel::~RawDataMapperByLabel(){ void RawDataMapperByLabel::produce(Event & e, const EventSetup& c){ - std::cout <<"starting the producer" << std::endl; bool alreadyACollectionFilled= false; tag_iterator_t inputTag = inputTags_.begin(); for(tok_iterator_t inputTok = inputTokens_.begin(); inputTok != inputTokens_.end(); ++inputTok, ++inputTag ) { From 1589c3ed261c3654abf6d9b50a15fb99fb02fb16 Mon Sep 17 00:00:00 2001 From: Ivan Date: Sun, 14 Oct 2018 08:40:35 +0200 Subject: [PATCH 17/19] removed cfi, fixed fillDescritpion --- .../RawDataCollector/python/rawDataMapperByLabel_cfi.py | 9 --------- 1 file changed, 9 deletions(-) delete mode 100644 EventFilter/RawDataCollector/python/rawDataMapperByLabel_cfi.py diff --git a/EventFilter/RawDataCollector/python/rawDataMapperByLabel_cfi.py b/EventFilter/RawDataCollector/python/rawDataMapperByLabel_cfi.py deleted file mode 100644 index 630dfde4af50f..0000000000000 --- a/EventFilter/RawDataCollector/python/rawDataMapperByLabel_cfi.py +++ /dev/null @@ -1,9 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -rawDataMapper = cms.EDProducer("RawDataMapperByLabel", - rawCollectionList = cms.VInputTag( cms.InputTag('rawDataCollector'), - cms.InputTag('rawDataRepacker'), - cms.InputTag('rawDataReducedFormat')), - mainCollection= cms.InputTag('rawDataCollector') -) - From 0b310f9e656be5615b7259dc02a407c2d95dda33 Mon Sep 17 00:00:00 2001 From: Ivan Date: Sun, 14 Oct 2018 08:40:53 +0200 Subject: [PATCH 18/19] removed cfi, fixed fillDescritpion --- .../RawDataCollector/src/RawDataMapperByLabel.cc | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/EventFilter/RawDataCollector/src/RawDataMapperByLabel.cc b/EventFilter/RawDataCollector/src/RawDataMapperByLabel.cc index 6dbb2462aa38b..c247951ca480c 100644 --- a/EventFilter/RawDataCollector/src/RawDataMapperByLabel.cc +++ b/EventFilter/RawDataCollector/src/RawDataMapperByLabel.cc @@ -101,16 +101,11 @@ void RawDataMapperByLabel::produce(Event & e, const EventSetup& c){ void RawDataMapperByLabel::fillDescriptions(edm::ConfigurationDescriptions & descriptions) { edm::ParameterSetDescription desc; - - std::vector tmp_itvect; - tmp_itvect.push_back( edm::InputTag("rawDataCollector")); - tmp_itvect.push_back( edm::InputTag("rawDataRepacker")); - tmp_itvect.push_back( edm::InputTag("rawDataReducedFormat")); - - desc.add>("rawCollectionList", tmp_itvect); + + desc.add>("rawCollectionList", {{"rawDataCollector", "rawDataRepacker", "rawDataReducedFormat"}}); desc.add("mainCollection", edm::InputTag("rawDataCollector")); - descriptions.add("rawDataMapper", desc); + descriptions.add("rawDataMapperByLabel", desc); } DEFINE_FWK_MODULE(RawDataMapperByLabel); From 0c969dfcc2d9816b49262781f4978318bdc33186 Mon Sep 17 00:00:00 2001 From: Ivan Date: Sun, 14 Oct 2018 09:15:00 +0200 Subject: [PATCH 19/19] fixing fillDescription --- EventFilter/RawDataCollector/src/RawDataMapperByLabel.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/EventFilter/RawDataCollector/src/RawDataMapperByLabel.cc b/EventFilter/RawDataCollector/src/RawDataMapperByLabel.cc index c247951ca480c..a08ed044a31a2 100644 --- a/EventFilter/RawDataCollector/src/RawDataMapperByLabel.cc +++ b/EventFilter/RawDataCollector/src/RawDataMapperByLabel.cc @@ -102,7 +102,7 @@ void RawDataMapperByLabel::produce(Event & e, const EventSetup& c){ void RawDataMapperByLabel::fillDescriptions(edm::ConfigurationDescriptions & descriptions) { edm::ParameterSetDescription desc; - desc.add>("rawCollectionList", {{"rawDataCollector", "rawDataRepacker", "rawDataReducedFormat"}}); + desc.add>("rawCollectionList", {{"rawDataCollector"}, {"rawDataRepacker"}, {"rawDataReducedFormat"}}); desc.add("mainCollection", edm::InputTag("rawDataCollector")); descriptions.add("rawDataMapperByLabel", desc);