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());
31  resetNewRun();
32  return runAuxiliary();
33  }
34 
35  std::shared_ptr<LuminosityBlockAuxiliary>
37  assert(!newRun());
38  assert(newLumi());
40  resetNewLumi();
41  return luminosityBlockAuxiliary();
42  }
43 
44  void
46  assert(!newRun());
47  assert(!newLumi());
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  }
78  // The following two lines are here because after a source
79  // tells the state machine the next ItemType is IsFile,
80  // the source should then always follow that with IsRun
81  // and then IsLumi. These two lines will cause that to happen.
84  }
85  bool another = checkNextEvent();
86  if(!another || (!newLumi() && !eventCached())) {
87  return IsStop;
90  return IsFile;
91  }
92  if(newRun()) {
93  return IsRun;
94  } else if(newLumi()) {
95  return IsLumi;
96  }
97  return IsEvent;
98  }
99 
100  void
103  << "RawInputSource::reset()\n"
104  << "Forking is not implemented for this type of RawInputSource\n"
105  << "Contact a Framework Developer\n";
106  }
107 
108  void
110  reset_();
111  }
112 
113  void
115  // The default value for "inputFileTransitionsEachEvent" gets defined in the derived class
116  // as it depends on the derived class. So, we cannot redefine it here.
117  InputSource::fillDescription(description);
118  }
119 
120  void
124  } else {
125  // Do nothing because we returned a fake input file transition
126  // value from getNextItemType which resulted in this call
127  // to closeFile_.
128 
129  // Reset the flag because the next call to closeFile_ might
130  // be real.
131  fakeInputFileTransition_ = false;
132  }
133  }
134 }
virtual void genuineCloseFile()
ProcessHistoryRegistry const & processHistoryRegistry() const
Accessors for process history registry.
Definition: InputSource.h:174
virtual void readEvent_(EventPrincipal &eventPrincipal) override
virtual std::shared_ptr< LuminosityBlockAuxiliary > readLuminosityBlockAuxiliary_() override
bool newLumi() const
Definition: InputSource.h:377
assert(m_qm.get())
void resetRunAuxiliary(bool isNewRun=true) const
Definition: InputSource.h:361
void setTimestamp(Timestamp const &theTime)
To set the current time, as seen by the input source.
Definition: InputSource.h:348
RawInputSource(ParameterSet const &pset, InputSourceDescription const &desc)
void closeFile(FileBlock *, bool cleaningUpAfterException)
close current file
Definition: InputSource.cc:275
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:374
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:352
void resetEventCached()
Definition: InputSource.h:383
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:262
void resetLuminosityBlockAuxiliary(bool isNewLumi=true) const
Definition: InputSource.h:365
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:127
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:265
static void fillDescription(ParameterSetDescription &description)
bool eventCached() const
Definition: InputSource.h:380