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)) {
21  }
22 
24  }
25 
26  boost::shared_ptr<RunAuxiliary>
28  assert(newRun());
29  assert(runAuxiliary());
30  resetNewRun();
31  return runAuxiliary();
32  }
33 
34  boost::shared_ptr<LuminosityBlockAuxiliary>
36  assert(!newRun());
37  assert(newLumi());
38  assert(luminosityBlockAuxiliary());
39  resetNewLumi();
40  return luminosityBlockAuxiliary();
41  }
42 
45  assert(!newRun());
46  assert(!newLumi());
47  assert(eventCached());
49  return read(eventPrincipal);
50  }
51 
53  RawInputSource::makeEvent(EventPrincipal& eventPrincipal, EventAuxiliary const& eventAuxiliary) {
54  EventSourceSentry sentry(*this);
55  eventPrincipal.fillEventPrincipal(eventAuxiliary);
56  return &eventPrincipal;
57  }
58 
59  void
61  closeFile(nullptr, false);
62  }
63 
66  if(state() == IsInvalid) {
67  return IsFile;
68  }
69  if(newRun() && runAuxiliary()) {
70  return IsRun;
71  }
73  return IsLumi;
74  }
75  if(eventCached()) {
76  return IsEvent;
77  }
81  }
82  bool another = checkNextEvent();
83  if(!another || (!newLumi() && !eventCached())) {
84  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 }
void fillEventPrincipal(EventAuxiliary const &aux, boost::shared_ptr< EventSelectionIDVector > eventSelectionIDs=boost::shared_ptr< EventSelectionIDVector >(), boost::shared_ptr< BranchListIndexes > branchListIndexes=boost::shared_ptr< BranchListIndexes >(), boost::shared_ptr< BranchMapper > mapper=boost::shared_ptr< BranchMapper >(new BranchMapper), DelayedReader *reader=0)
EventPrincipal * makeEvent(EventPrincipal &eventPrincipal, EventAuxiliary const &eventAuxiliary)
bool newLumi() const
Definition: InputSource.h:344
virtual EventPrincipal * read(EventPrincipal &eventPrincipal)=0
void resetRunAuxiliary(bool isNewRun=true) const
Definition: InputSource.h:326
boost::shared_ptr< LuminosityBlockAuxiliary > luminosityBlockAuxiliary() const
Called by the framework to merge or insert lumi in principal cache.
Definition: InputSource.h:247
void setTimestamp(Timestamp const &theTime)
To set the current time, as seen by the input source.
Definition: InputSource.h:314
RawInputSource(ParameterSet const &pset, InputSourceDescription const &desc)
void closeFile(FileBlock *, bool cleaningUpAfterException)
close current file
Definition: InputSource.cc:270
virtual bool checkNextEvent()=0
virtual void preForkReleaseResources() override
bool inputFileTransitionsEachEvent_
bool newRun() const
Definition: InputSource.h:341
virtual void rewind_() override
virtual boost::shared_ptr< RunAuxiliary > readRunAuxiliary_() override
virtual ItemType getNextItemType() override
virtual boost::shared_ptr< LuminosityBlockAuxiliary > readLuminosityBlockAuxiliary_() override
ItemType state() const
Definition: InputSource.h:317
void resetEventCached()
Definition: InputSource.h:350
tuple description
Definition: idDealer.py:66
virtual void reset_()
void resetLuminosityBlockAuxiliary(bool isNewLumi=true) const
Definition: InputSource.h:330
boost::shared_ptr< RunAuxiliary > runAuxiliary() const
Called by the framework to merge or insert run in principal cache.
Definition: InputSource.h:244
virtual EventPrincipal * readEvent_(EventPrincipal &eventPrincipal) override
static Timestamp const & beginOfTime()
Definition: Timestamp.cc:96
static void fillDescription(ParameterSetDescription &desc)
Definition: InputSource.cc:134
static void fillDescription(ParameterSetDescription &description)
bool eventCached() const
Definition: InputSource.h:347