CMS 3D CMS Logo

RawInputSource.cc
Go to the documentation of this file.
1 /*----------------------------------------------------------------------
2 ----------------------------------------------------------------------*/
3 
5 
12 
13 namespace edm {
14 
16  : InputSource(pset, desc),
17  // The default value for the following parameter get defined in at least one derived class
18  // where it has a different default value.
19  inputFileTransitionsEachEvent_(pset.getUntrackedParameter<bool>("inputFileTransitionsEachEvent", false)),
20  fakeInputFileTransition_(false) {
22  }
23 
25 
26  std::shared_ptr<RunAuxiliary> RawInputSource::readRunAuxiliary_() {
27  assert(newRun());
28  assert(runAuxiliary());
29  resetNewRun();
30  return runAuxiliary();
31  }
32 
33  std::shared_ptr<LuminosityBlockAuxiliary> RawInputSource::readLuminosityBlockAuxiliary_() {
34  assert(!newRun());
35  assert(newLumi());
36  assert(luminosityBlockAuxiliary());
37  resetNewLumi();
38  return luminosityBlockAuxiliary();
39  }
40 
42  assert(!newRun());
43  assert(!newLumi());
44  assert(eventCached());
46  read(eventPrincipal);
47  }
48 
49  void RawInputSource::makeEvent(EventPrincipal& eventPrincipal, EventAuxiliary const& eventAuxiliary) {
50  eventPrincipal.fillEventPrincipal(eventAuxiliary, processHistoryRegistry());
51  }
52 
54  if (state() == IsInvalid) {
55  return IsFile;
56  }
57  if (newRun() && runAuxiliary()) {
58  return IsRun;
59  }
60  if (newLumi() && luminosityBlockAuxiliary()) {
61  return IsLumi;
62  }
63  if (eventCached()) {
64  return IsEvent;
65  }
67  // The following two lines are here because after a source
68  // tells the state machine the next ItemType is IsFile,
69  // the source should then always follow that with IsRun
70  // and then IsLumi. These two lines will cause that to happen.
73  }
74  bool another = checkNextEvent();
75  if (!another || (!newLumi() && !eventCached())) {
76  return IsStop;
77  } else if (inputFileTransitionsEachEvent_) {
79  return IsFile;
80  }
81  if (newRun()) {
82  return IsRun;
83  } else if (newLumi()) {
84  return IsLumi;
85  }
86  return IsEvent;
87  }
88 
90  throw Exception(errors::LogicError) << "RawInputSource::reset()\n"
91  << "Forking is not implemented for this type of RawInputSource\n"
92  << "Contact a Framework Developer\n";
93  }
94 
96 
98  // The default value for "inputFileTransitionsEachEvent" gets defined in the derived class
99  // as it depends on the derived class. So, we cannot redefine it here.
100  InputSource::fillDescription(description);
101  }
102 
106  } else {
107  // Do nothing because we returned a fake input file transition
108  // value from getNextItemType which resulted in this call
109  // to closeFile_.
110 
111  // Reset the flag because the next call to closeFile_ might
112  // be real.
113  fakeInputFileTransition_ = false;
114  }
115  }
116 } // namespace edm
virtual void genuineCloseFile()
ProcessHistoryRegistry const & processHistoryRegistry() const
Accessors for process history registry.
Definition: InputSource.h:155
void readEvent_(EventPrincipal &eventPrincipal) override
std::shared_ptr< LuminosityBlockAuxiliary > readLuminosityBlockAuxiliary_() override
void closeFile_() final
bool newLumi() const
Definition: InputSource.h:353
void resetRunAuxiliary(bool isNewRun=true) const
Definition: InputSource.h:337
void setTimestamp(Timestamp const &theTime)
To set the current time, as seen by the input source.
Definition: InputSource.h:324
RawInputSource(ParameterSet const &pset, InputSourceDescription const &desc)
~RawInputSource() override
static Timestamp beginOfTime()
Definition: Timestamp.h:103
virtual bool checkNextEvent()=0
bool inputFileTransitionsEachEvent_
virtual void read(EventPrincipal &eventPrincipal)=0
bool newRun() const
Definition: InputSource.h:350
std::shared_ptr< RunAuxiliary > readRunAuxiliary_() override
void rewind_() override
ItemType getNextItemType() override
ItemType state() const
Definition: InputSource.h:328
void resetEventCached()
Definition: InputSource.h:359
virtual void reset_()
std::shared_ptr< RunAuxiliary > runAuxiliary() const
Called by the framework to merge or insert run in principal cache.
Definition: InputSource.h:239
void resetLuminosityBlockAuxiliary(bool isNewLumi=true) const
Definition: InputSource.h:341
void fillEventPrincipal(EventAuxiliary const &aux, ProcessHistoryRegistry const &processHistoryRegistry, DelayedReader *reader=0)
HLT enums.
void makeEvent(EventPrincipal &eventPrincipal, EventAuxiliary const &eventAuxiliary)
static void fillDescription(ParameterSetDescription &desc)
Definition: InputSource.cc:115
std::shared_ptr< LuminosityBlockAuxiliary > luminosityBlockAuxiliary() const
Called by the framework to merge or insert lumi in principal cache.
Definition: InputSource.h:242
static void fillDescription(ParameterSetDescription &description)
bool eventCached() const
Definition: InputSource.h:356