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 
27  std::shared_ptr<RunAuxiliary>
29  assert(newRun());
30  assert(runAuxiliary());
31  resetNewRun();
32  return runAuxiliary();
33  }
34 
35  std::shared_ptr<LuminosityBlockAuxiliary>
37  assert(!newRun());
38  assert(newLumi());
39  assert(luminosityBlockAuxiliary());
40  resetNewLumi();
41  return luminosityBlockAuxiliary();
42  }
43 
44  void
46  assert(!newRun());
47  assert(!newLumi());
48  assert(eventCached());
50  read(eventPrincipal);
51  }
52 
53  void
54  RawInputSource::makeEvent(EventPrincipal& eventPrincipal, EventAuxiliary const& eventAuxiliary) {
55  eventPrincipal.fillEventPrincipal(eventAuxiliary, processHistoryRegistry());
56  }
57 
60  if(state() == IsInvalid) {
61  return IsFile;
62  }
63  if(newRun() && runAuxiliary()) {
64  return IsRun;
65  }
67  return IsLumi;
68  }
69  if(eventCached()) {
70  return IsEvent;
71  }
73  // The following two lines are here because after a source
74  // tells the state machine the next ItemType is IsFile,
75  // the source should then always follow that with IsRun
76  // and then IsLumi. These two lines will cause that to happen.
79  }
80  bool another = checkNextEvent();
81  if(!another || (!newLumi() && !eventCached())) {
82  return IsStop;
85  return IsFile;
86  }
87  if(newRun()) {
88  return IsRun;
89  } else if(newLumi()) {
90  return IsLumi;
91  }
92  return IsEvent;
93  }
94 
95  void
98  << "RawInputSource::reset()\n"
99  << "Forking is not implemented for this type of RawInputSource\n"
100  << "Contact a Framework Developer\n";
101  }
102 
103  void
105  reset_();
106  }
107 
108  void
110  // The default value for "inputFileTransitionsEachEvent" gets defined in the derived class
111  // as it depends on the derived class. So, we cannot redefine it here.
112  InputSource::fillDescription(description);
113  }
114 
115  void
119  } else {
120  // Do nothing because we returned a fake input file transition
121  // value from getNextItemType which resulted in this call
122  // to closeFile_.
123 
124  // Reset the flag because the next call to closeFile_ might
125  // be real.
126  fakeInputFileTransition_ = false;
127  }
128  }
129 }
virtual void genuineCloseFile()
ProcessHistoryRegistry const & processHistoryRegistry() const
Accessors for process history registry.
Definition: InputSource.h:168
virtual void readEvent_(EventPrincipal &eventPrincipal) override
virtual std::shared_ptr< LuminosityBlockAuxiliary > readLuminosityBlockAuxiliary_() override
bool newLumi() const
Definition: InputSource.h:371
void resetRunAuxiliary(bool isNewRun=true) const
Definition: InputSource.h:355
void setTimestamp(Timestamp const &theTime)
To set the current time, as seen by the input source.
Definition: InputSource.h:342
RawInputSource(ParameterSet const &pset, InputSourceDescription const &desc)
static Timestamp beginOfTime()
Definition: Timestamp.h:103
virtual bool checkNextEvent()=0
bool inputFileTransitionsEachEvent_
virtual void closeFile_() override final
virtual void read(EventPrincipal &eventPrincipal)=0
bool newRun() const
Definition: InputSource.h:368
virtual std::shared_ptr< RunAuxiliary > readRunAuxiliary_() override
virtual void rewind_() override
virtual ItemType getNextItemType() override
ItemType state() const
Definition: InputSource.h:346
void resetEventCached()
Definition: InputSource.h:377
virtual void reset_()
std::shared_ptr< RunAuxiliary > runAuxiliary() const
Called by the framework to merge or insert run in principal cache.
Definition: InputSource.h:252
void resetLuminosityBlockAuxiliary(bool isNewLumi=true) const
Definition: InputSource.h:359
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:125
std::shared_ptr< LuminosityBlockAuxiliary > luminosityBlockAuxiliary() const
Called by the framework to merge or insert lumi in principal cache.
Definition: InputSource.h:255
static void fillDescription(ParameterSetDescription &description)
bool eventCached() const
Definition: InputSource.h:374