Skip to content

Commit

Permalink
Allow ExperimentType to be set
Browse files Browse the repository at this point in the history
  • Loading branch information
wmtan committed Nov 14, 2014
1 parent 5f81461 commit 6fb0a66
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 6 deletions.
4 changes: 3 additions & 1 deletion FWCore/Sources/interface/ProducerSourceBase.h
Expand Up @@ -19,7 +19,7 @@ namespace edm {
class ParameterSetDescription;
class ProducerSourceBase : public InputSource {
public:
explicit ProducerSourceBase(ParameterSet const& pset, InputSourceDescription const& desc, bool realData);
explicit ProducerSourceBase(ParameterSet const& pset, InputSourceDescription const& desc, bool realData, EventAuxiliary::ExperimentType eType = EventAuxiliary::Undefined);
virtual ~ProducerSourceBase();

unsigned int numberEventsInRun() const {return numberEventsInRun_;}
Expand All @@ -38,6 +38,8 @@ namespace edm {

protected:

void setExperimentType(EventAuxiliary::ExperimentType eType);

private:
virtual ItemType getNextItemType() override;
virtual void initialize(EventID& id, TimeValue_t& time, TimeValue_t& interval);
Expand Down
2 changes: 1 addition & 1 deletion FWCore/Sources/interface/ProducerSourceFromFiles.h
Expand Up @@ -16,7 +16,7 @@ namespace edm {

class ProducerSourceFromFiles : public ProducerSourceBase, private FromFiles {
public:
ProducerSourceFromFiles(ParameterSet const& pset, InputSourceDescription const& desc, bool realData);
ProducerSourceFromFiles(ParameterSet const& pset, InputSourceDescription const& desc, bool realData, EventAuxiliary::ExperimentType eType = EventAuxiliary::Undefined);
virtual ~ProducerSourceFromFiles();

using FromFiles::logicalFileNames;
Expand Down
11 changes: 9 additions & 2 deletions FWCore/Sources/src/ProducerSourceBase.cc
Expand Up @@ -17,7 +17,9 @@ namespace edm {
static unsigned long long const kAveEventPerSec = 200ULL;

ProducerSourceBase::ProducerSourceBase(ParameterSet const& pset,
InputSourceDescription const& desc, bool realData) :
InputSourceDescription const& desc,
bool realData,
EventAuxiliary::ExperimentType eType) :
InputSource(pset, desc),
numberEventsInRun_(pset.getUntrackedParameter<unsigned int>("numberEventsInRun", remainingEvents())),
numberEventsInLumi_(pset.getUntrackedParameter<unsigned int>("numberEventsInLuminosityBlock", remainingEvents())),
Expand All @@ -32,7 +34,7 @@ namespace edm {
eventID_(pset.getUntrackedParameter<unsigned int>("firstRun", 1), pset.getUntrackedParameter<unsigned int>("firstLuminosityBlock", 1), zerothEvent_),
origEventID_(eventID_),
isRealData_(realData),
eType_(EventAuxiliary::Undefined) {
eType_(eType) {

setTimestamp(Timestamp(presentTime_));
// We need to map this string to the EventAuxiliary::ExperimentType enumeration
Expand Down Expand Up @@ -88,6 +90,11 @@ namespace edm {
}
}

void
ProducerSourceBase::setExperimentType(EventAuxiliary::ExperimentType eType) {
eType_ = eType;
}

void
ProducerSourceBase::beginJob() {
// initialize cannot be called from the constructor, because it is a virtual function
Expand Down
4 changes: 2 additions & 2 deletions FWCore/Sources/src/ProducerSourceFromFiles.cc
Expand Up @@ -3,8 +3,8 @@
#include "FWCore/ParameterSet/interface/ParameterSetDescription.h"

namespace edm {
ProducerSourceFromFiles::ProducerSourceFromFiles(ParameterSet const& pset, InputSourceDescription const& desc, bool realData) :
ProducerSourceBase(pset, desc, realData),
ProducerSourceFromFiles::ProducerSourceFromFiles(ParameterSet const& pset, InputSourceDescription const& desc, bool realData, EventAuxiliary::ExperimentType eType) :
ProducerSourceBase(pset, desc, realData, eType),
FromFiles(pset) {
}

Expand Down

0 comments on commit 6fb0a66

Please sign in to comment.