CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Types | Private Attributes
RawDataMapperByLabel Class Reference
Inheritance diagram for RawDataMapperByLabel:
edm::stream::EDProducer<>

Public Member Functions

void produce (edm::Event &e, const edm::EventSetup &c) override
 
 RawDataMapperByLabel (const edm::ParameterSet &pset)
 Constructor. More...
 
 ~RawDataMapperByLabel () override
 Destructor. More...
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () const final
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &)
 

Private Types

typedef std::vector< edm::InputTag >::const_iterator tag_iterator_t
 
typedef std::vector< edm::EDGetTokenT< FEDRawDataCollection > >::const_iterator tok_iterator_t
 

Private Attributes

edm::InputTag filledCollectionName_
 
bool firstEvent_
 
std::vector< edm::InputTaginputTags_
 
std::vector< edm::EDGetTokenT< FEDRawDataCollection > > inputTokens_
 
edm::InputTag mainCollectionTag_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 

Detailed Description

Definition at line 25 of file RawDataMapperByLabel.cc.

Member Typedef Documentation

typedef std::vector<edm::InputTag>::const_iterator RawDataMapperByLabel::tag_iterator_t
private

Definition at line 39 of file RawDataMapperByLabel.cc.

typedef std::vector<edm::EDGetTokenT<FEDRawDataCollection> >::const_iterator RawDataMapperByLabel::tok_iterator_t
private

Definition at line 40 of file RawDataMapperByLabel.cc.

Constructor & Destructor Documentation

RawDataMapperByLabel::RawDataMapperByLabel ( const edm::ParameterSet pset)

Constructor.

Definition at line 53 of file RawDataMapperByLabel.cc.

References HiClusterCompatibility_cfi::inputTag, inputTags_, and inputTokens_.

54  : inputTags_(pset.getParameter<std::vector<edm::InputTag>>("rawCollectionList")),
55  mainCollectionTag_(pset.getParameter<edm::InputTag>("mainCollection")),
57  firstEvent_(true)
58 {
59 
60  inputTokens_.reserve(inputTags_.size());
61  for(auto const& inputTag: inputTags_) {
62  inputTokens_.push_back(consumes<FEDRawDataCollection>(inputTag));
63  }
64 
65  produces<FEDRawDataCollection>();
66 
67 }
T getParameter(std::string const &) const
edm::InputTag filledCollectionName_
std::vector< edm::EDGetTokenT< FEDRawDataCollection > > inputTokens_
edm::InputTag mainCollectionTag_
std::vector< edm::InputTag > inputTags_
RawDataMapperByLabel::~RawDataMapperByLabel ( )
override

Destructor.

Definition at line 70 of file RawDataMapperByLabel.cc.

70  {
71 
72 }

Member Function Documentation

void RawDataMapperByLabel::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 102 of file RawDataMapperByLabel.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), and DEFINE_FWK_MODULE.

102  {
104 
105  desc.add<std::vector<edm::InputTag>>("rawCollectionList", {{"rawDataCollector","","@skipCurrentProcess"}, {"rawDataRepacker"}, {"rawDataReducedFormat"}});
106  desc.add<edm::InputTag>("mainCollection", edm::InputTag("rawDataCollector"));
107 
108  descriptions.add("rawDataMapperByLabel", desc);
109 }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void RawDataMapperByLabel::produce ( edm::Event e,
const edm::EventSetup c 
)
override

Definition at line 75 of file RawDataMapperByLabel.cc.

References Exception, filledCollectionName_, firstEvent_, edm::Event::getByToken(), input, HiClusterCompatibility_cfi::inputTag, inputTags_, inputTokens_, edm::HandleBase::isValid(), mainCollectionTag_, edm::Handle< T >::product(), and edm::Event::put().

Referenced by JSONExport.JsonExport::export(), HTMLExport.HTMLExport::export(), and HTMLExport.HTMLExportStatic::export().

75  {
76 
77  bool alreadyACollectionFilled= false;
79  for(tok_iterator_t inputTok = inputTokens_.begin(); inputTok != inputTokens_.end(); ++inputTok, ++inputTag ) {
81  if(e.getByToken(*inputTok,input)){
82  if(input.isValid()){
83  if(alreadyACollectionFilled) throw cms::Exception("BadInput") << "Two input collections are present." << std::endl
84  << "Please make sure that the input dataset has only one FEDRawDataCollector collection filled";
85 
86  if(firstEvent_){
88  alreadyACollectionFilled = true;
89  firstEvent_= false;
90  }
91 
92 
93  if(!(filledCollectionName_==*inputTag)) throw cms::Exception("BadInput") << "The filled collection has changed!";
94 
95  if(!(mainCollectionTag_==filledCollectionName_)) e.put(std::make_unique<FEDRawDataCollection>(*input.product()));
96 
97  }
98  }
99  }
100 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:137
edm::InputTag filledCollectionName_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:579
std::vector< edm::EDGetTokenT< FEDRawDataCollection > > inputTokens_
static std::string const input
Definition: EdmProvDump.cc:45
std::vector< edm::EDGetTokenT< FEDRawDataCollection > >::const_iterator tok_iterator_t
bool isValid() const
Definition: HandleBase.h:74
std::vector< edm::InputTag >::const_iterator tag_iterator_t
T const * product() const
Definition: Handle.h:81
edm::InputTag mainCollectionTag_
std::vector< edm::InputTag > inputTags_

Member Data Documentation

edm::InputTag RawDataMapperByLabel::filledCollectionName_
private

Definition at line 46 of file RawDataMapperByLabel.cc.

Referenced by produce().

bool RawDataMapperByLabel::firstEvent_
private

Definition at line 47 of file RawDataMapperByLabel.cc.

Referenced by produce().

std::vector<edm::InputTag> RawDataMapperByLabel::inputTags_
private

Definition at line 42 of file RawDataMapperByLabel.cc.

Referenced by produce(), and RawDataMapperByLabel().

std::vector<edm::EDGetTokenT<FEDRawDataCollection> > RawDataMapperByLabel::inputTokens_
private

Definition at line 43 of file RawDataMapperByLabel.cc.

Referenced by produce(), and RawDataMapperByLabel().

edm::InputTag RawDataMapperByLabel::mainCollectionTag_
private

Definition at line 45 of file RawDataMapperByLabel.cc.

Referenced by produce().