CMS 3D CMS Logo

RawInputSource.cc
Go to the documentation of this file.
1 /*----------------------------------------------------------------------
2 ----------------------------------------------------------------------*/
3 
5 
14 
15 namespace edm {
16 
18  : InputSource(pset, desc),
19  // The default value for the following parameter get defined in at least one derived class
20  // where it has a different default value.
21  inputFileTransitionsEachEvent_(pset.getUntrackedParameter<bool>("inputFileTransitionsEachEvent", false)),
22  fakeInputFileTransition_(false) {
24  }
25 
27 
28  std::shared_ptr<RunAuxiliary> RawInputSource::readRunAuxiliary_() {
29  assert(newRun());
31  resetNewRun();
32  return runAuxiliary();
33  }
34 
35  std::shared_ptr<LuminosityBlockAuxiliary> RawInputSource::readLuminosityBlockAuxiliary_() {
36  assert(!newRun());
37  assert(newLumi());
39  resetNewLumi();
40  return luminosityBlockAuxiliary();
41  }
42 
44  assert(!newRun());
45  assert(!newLumi());
48  read(eventPrincipal);
49  }
50 
51  void RawInputSource::makeEvent(EventPrincipal& eventPrincipal, EventAuxiliary const& eventAuxiliary) {
52  auto history = processHistoryRegistry().getMapped(eventAuxiliary.processHistoryID());
53  eventPrincipal.fillEventPrincipal(eventAuxiliary, history);
54  }
55 
57  if (state() == IsInvalid) {
58  return IsFile;
59  }
60  if (newRun() && runAuxiliary()) {
61  return IsRun;
62  }
63  if (newLumi() && luminosityBlockAuxiliary()) {
64  return IsLumi;
65  }
66  if (eventCached()) {
67  return IsEvent;
68  }
70  // The following two lines are here because after a source
71  // tells the state machine the next ItemType is IsFile,
72  // the source should then always follow that with IsRun
73  // and then IsLumi. These two lines will cause that to happen.
76  }
77  Next another = checkNext();
78  if (another == Next::kStop) {
79  return IsStop;
80  } else if (another == Next::kEvent and inputFileTransitionsEachEvent_) {
82  return IsFile;
83  } else if (another == Next::kFile) {
84  setNewRun();
85  setNewLumi();
87  return IsFile;
88  }
89  if (newRun()) {
90  return IsRun;
91  } else if (newLumi()) {
92  return IsLumi;
93  }
94  return IsEvent;
95  }
96 
98  throw Exception(errors::LogicError) << "RawInputSource::reset()\n"
99  << "Forking is not implemented for this type of RawInputSource\n"
100  << "Contact a Framework Developer\n";
101  }
102 
104 
106  // The default value for "inputFileTransitionsEachEvent" gets defined in the derived class
107  // as it depends on the derived class. So, we cannot redefine it here.
109  }
110 
114  }
115  }
116 
117  std::shared_ptr<edm::FileBlock> RawInputSource::readFile_() {
119  genuineReadFile();
120  }
121  fakeInputFileTransition_ = false;
122  return std::make_shared<FileBlock>();
123  }
124 
125 } // namespace edm
edm::InputSource::resetNewRun
void resetNewRun()
Definition: InputSource.h:356
edm::RawInputSource::inputFileTransitionsEachEvent_
bool inputFileTransitionsEachEvent_
Definition: RawInputSource.h:44
edm::InputSource::setNewLumi
void setNewLumi()
Definition: InputSource.h:358
electrons_cff.bool
bool
Definition: electrons_cff.py:366
funct::false
false
Definition: Factorize.h:29
edm::InputSource::resetEventCached
void resetEventCached()
Definition: InputSource.h:363
edm::errors::LogicError
Definition: EDMException.h:37
edm
HLT enums.
Definition: AlignableModifier.h:19
edmLumisInFiles.description
description
Definition: edmLumisInFiles.py:11
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
edm::RawInputSource::readRunAuxiliary_
std::shared_ptr< RunAuxiliary > readRunAuxiliary_() override
Definition: RawInputSource.cc:28
edm::InputSourceDescription
Definition: InputSourceDescription.h:21
cms::cuda::assert
assert(be >=bs)
edm::Timestamp::beginOfTime
static Timestamp beginOfTime()
Definition: Timestamp.h:84
edm::RawInputSource::readFile_
std::shared_ptr< FileBlock > readFile_() final
Definition: RawInputSource.cc:117
ProcessHistoryRegistry.h
edm::RawInputSource::readLuminosityBlockAuxiliary_
std::shared_ptr< LuminosityBlockAuxiliary > readLuminosityBlockAuxiliary_() override
Definition: RawInputSource.cc:35
edm::InputSource::state
ItemType state() const
Definition: InputSource.h:332
edm::InputSource::IsRun
Definition: InputSource.h:54
RawInputSource.h
edm::RawInputSource::RawInputSource
RawInputSource(ParameterSet const &pset, InputSourceDescription const &desc)
Definition: RawInputSource.cc:17
edm::RawInputSource::getNextItemType
ItemType getNextItemType() override
Definition: RawInputSource.cc:56
edm::InputSource::fillDescription
static void fillDescription(ParameterSetDescription &desc)
Definition: InputSource.cc:117
edm::EventPrincipal
Definition: EventPrincipal.h:48
EventPrincipal.h
edm::InputSource::luminosityBlockAuxiliary
std::shared_ptr< LuminosityBlockAuxiliary > luminosityBlockAuxiliary() const
Called by the framework to merge or insert lumi in principal cache.
Definition: InputSource.h:233
edm::InputSource::setTimestamp
void setTimestamp(Timestamp const &theTime)
To set the current time, as seen by the input source.
Definition: InputSource.h:328
edm::EventAuxiliary
Definition: EventAuxiliary.h:14
edm::RawInputSource::reset_
virtual void reset_()
Definition: RawInputSource.cc:97
edm::InputSource::IsFile
Definition: InputSource.h:54
edm::InputSource::runAuxiliary
std::shared_ptr< RunAuxiliary > runAuxiliary() const
Called by the framework to merge or insert run in principal cache.
Definition: InputSource.h:230
LuminosityBlockAuxiliary.h
edm::RawInputSource::Next::kFile
edm::InputSource::processHistoryRegistry
ProcessHistoryRegistry const & processHistoryRegistry() const
Accessors for process history registry.
Definition: InputSource.h:140
edm::ParameterSet
Definition: ParameterSet.h:47
Timestamp.h
edm::InputSource::IsLumi
Definition: InputSource.h:54
edm::InputSource::newLumi
bool newLumi() const
Definition: InputSource.h:357
edm::RawInputSource::Next::kStop
edm::InputSource::newRun
bool newRun() const
Definition: InputSource.h:354
edm::InputSource::IsStop
Definition: InputSource.h:54
edm::InputSource::resetNewLumi
void resetNewLumi()
Definition: InputSource.h:359
edm::RawInputSource::fakeInputFileTransition_
bool fakeInputFileTransition_
Definition: RawInputSource.h:45
FileBlock.h
edm::EventPrincipal::fillEventPrincipal
void fillEventPrincipal(EventAuxiliary const &aux, ProcessHistory const *processHistory, DelayedReader *reader=nullptr)
Definition: EventPrincipal.cc:110
edm::InputSource::ItemType
ItemType
Definition: InputSource.h:54
edm::RawInputSource::Next
Next
Definition: RawInputSource.h:24
edm::RawInputSource::rewind_
void rewind_() override
Definition: RawInputSource.cc:103
edm::InputSource::eventCached
bool eventCached() const
Definition: InputSource.h:360
edm::RawInputSource::readEvent_
void readEvent_(EventPrincipal &eventPrincipal) override
Definition: RawInputSource.cc:43
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
edm::RawInputSource::~RawInputSource
~RawInputSource() override
Definition: RawInputSource.cc:26
edm::RawInputSource::checkNext
virtual Next checkNext()=0
edm::RawInputSource::closeFile_
void closeFile_() final
Definition: RawInputSource.cc:111
edm::RawInputSource::makeEvent
void makeEvent(EventPrincipal &eventPrincipal, EventAuxiliary const &eventAuxiliary)
Definition: RawInputSource.cc:51
edm::EventAuxiliary::processHistoryID
ProcessHistoryID const & processHistoryID() const
Definition: EventAuxiliary.h:61
edm::RawInputSource::genuineCloseFile
virtual void genuineCloseFile()
Definition: RawInputSource.h:41
edm::InputSource::setNewRun
void setNewRun()
Definition: InputSource.h:355
EventAuxiliary.h
Exception
Definition: hltDiff.cc:245
RunAuxiliary.h
edm::ProcessHistoryRegistry::getMapped
bool getMapped(ProcessHistoryID const &key, ProcessHistory &value) const
Definition: ProcessHistoryRegistry.cc:29
edm::InputSource::resetLuminosityBlockAuxiliary
void resetLuminosityBlockAuxiliary(bool isNewLumi=true) const
Definition: InputSource.h:345
edm::InputSource::resetRunAuxiliary
void resetRunAuxiliary(bool isNewRun=true) const
Definition: InputSource.h:341
edm::RawInputSource::fillDescription
static void fillDescription(ParameterSetDescription &description)
Definition: RawInputSource.cc:105
edm::InputSource::IsEvent
Definition: InputSource.h:54
edm::InputSource
Definition: InputSource.h:52
ParameterSet.h
edm::RawInputSource::Next::kEvent
edm::InputSource::IsInvalid
Definition: InputSource.h:54
edm::RawInputSource::read
virtual void read(EventPrincipal &eventPrincipal)=0
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
edm::RawInputSource::genuineReadFile
virtual void genuineReadFile()
Definition: RawInputSource.h:42