CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 
58  void
60  closeFile(nullptr, false);
61  }
62 
65  if(state() == IsInvalid) {
66  return IsFile;
67  }
68  if(newRun() && runAuxiliary()) {
69  return IsRun;
70  }
72  return IsLumi;
73  }
74  if(eventCached()) {
75  return IsEvent;
76  }
80  }
81  bool another = checkNextEvent();
82  if(!another || (!newLumi() && !eventCached())) {
83  return IsStop;
86  return IsFile;
87  }
88  if(newRun()) {
89  return IsRun;
90  } else if(newLumi()) {
91  return IsLumi;
92  }
93  return IsEvent;
94  }
95 
96  void
99  << "RawInputSource::reset()\n"
100  << "Forking is not implemented for this type of RawInputSource\n"
101  << "Contact a Framework Developer\n";
102  }
103 
104  void
106  reset_();
107  }
108 
109  void
111  // The default value for "inputFileTransitionsEachEvent" gets defined in the derived class
112  // as it depends on the derived class. So, we cannot redefine it here.
113  InputSource::fillDescription(description);
114  }
115 
116  void
120  } else {
121  // Do nothing because we returned a fake input file transition
122  // value from getNextItemType which resulted in this call
123  // to closeFile_.
124 
125  // Reset the flag because the next call to closeFile_ might
126  // be real.
127  fakeInputFileTransition_ = false;
128  }
129  }
130 }
virtual void genuineCloseFile()
ProcessHistoryRegistry const & processHistoryRegistry() const
Const accessor for process history registry.
Definition: InputSource.h:171
virtual void readEvent_(EventPrincipal &eventPrincipal) override
virtual std::shared_ptr< LuminosityBlockAuxiliary > readLuminosityBlockAuxiliary_() override
bool newLumi() const
Definition: InputSource.h:376
void resetRunAuxiliary(bool isNewRun=true) const
Definition: InputSource.h:358
void setTimestamp(Timestamp const &theTime)
To set the current time, as seen by the input source.
Definition: InputSource.h:345
RawInputSource(ParameterSet const &pset, InputSourceDescription const &desc)
void closeFile(FileBlock *, bool cleaningUpAfterException)
close current file
Definition: InputSource.cc:284
static Timestamp beginOfTime()
Definition: Timestamp.h:103
virtual bool checkNextEvent()=0
virtual void preForkReleaseResources() override
bool inputFileTransitionsEachEvent_
virtual void read(EventPrincipal &eventPrincipal)=0
bool newRun() const
Definition: InputSource.h:373
virtual std::shared_ptr< RunAuxiliary > readRunAuxiliary_() override
virtual void closeFile_() overridefinal
virtual void rewind_() override
virtual ItemType getNextItemType() override
ItemType state() const
Definition: InputSource.h:349
void resetEventCached()
Definition: InputSource.h:382
tuple description
Definition: idDealer.py:66
virtual void reset_()
std::shared_ptr< RunAuxiliary > runAuxiliary() const
Called by the framework to merge or insert run in principal cache.
Definition: InputSource.h:259
void resetLuminosityBlockAuxiliary(bool isNewLumi=true) const
Definition: InputSource.h:362
void fillEventPrincipal(EventAuxiliary const &aux, ProcessHistoryRegistry const &processHistoryRegistry, DelayedReader *reader=0)
void makeEvent(EventPrincipal &eventPrincipal, EventAuxiliary const &eventAuxiliary)
static void fillDescription(ParameterSetDescription &desc)
Definition: InputSource.cc:136
volatile std::atomic< bool > shutdown_flag false
std::shared_ptr< LuminosityBlockAuxiliary > luminosityBlockAuxiliary() const
Called by the framework to merge or insert lumi in principal cache.
Definition: InputSource.h:262
static void fillDescription(ParameterSetDescription &description)
bool eventCached() const
Definition: InputSource.h:379