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 $Id: RawInputSource.cc,v 1.27 2009/09/23 23:33:07 wmtan Exp $
3 ----------------------------------------------------------------------*/
4 
12 
13 namespace edm {
15  InputSourceDescription const& desc) :
16  InputSource(pset, desc),
18  luminosityBlockNumber_(),
19  newRun_(false),
20  newLumi_(false),
21  eventCached_(false) {
23  }
24 
26  }
27 
28  boost::shared_ptr<RunAuxiliary>
30  newRun_ = false;
31  return boost::shared_ptr<RunAuxiliary>(new RunAuxiliary(runNumber_, timestamp(), Timestamp::invalidTimestamp()));
32  }
33 
34  boost::shared_ptr<LuminosityBlockAuxiliary>
36  newLumi_ = false;
37  return boost::shared_ptr<LuminosityBlockAuxiliary>(new LuminosityBlockAuxiliary(
39  }
40 
43  assert(eventCached_);
44  eventCached_ = false;
45  return eventPrincipalCache();
46  }
47 
48  std::auto_ptr<Event>
50  if(!runAuxiliary()) {
51  newRun_ = newLumi_ = true;
55  }
58  newLumi_ = true;
61  }
62  EventSourceSentry sentry(*this);
63  std::auto_ptr<EventAuxiliary> aux(new EventAuxiliary(EventID(run, lumi, event),
66  eventCached_ = true;
67  std::auto_ptr<Event> e(new Event(*eventPrincipalCache(), moduleDescription()));
68  return e;
69  }
70 
71 
74  if (state() == IsInvalid) {
75  return IsFile;
76  }
77  if (newRun_) {
78  return IsRun;
79  }
80  if (newLumi_) {
81  return IsLumi;
82  }
83  if(eventCached_) {
84  return IsEvent;
85  }
86  std::auto_ptr<Event> e(readOneEvent());
87  if (e.get() == 0) {
88  return IsStop;
89  } else {
90  e->commit_();
91  }
92  if (e->run() != runNumber_) {
93  newRun_ = newLumi_ = true;
94  runNumber_ = e->run();
95  luminosityBlockNumber_ = e->luminosityBlock();
96  return IsRun;
97  } else if (e->luminosityBlock() != luminosityBlockNumber_) {
98  luminosityBlockNumber_ = e->luminosityBlock();
99  newLumi_ = true;
100  return IsLumi;
101  }
102  return IsEvent;
103  }
104 
107  throw edm::Exception(errors::LogicError,"RawInputSource::readEvent_(EventID const& eventID)")
108  << "Random access read cannot be used for RawInputSource.\n"
109  << "Contact a Framework developer.\n";
110  }
111 
112  // Not yet implemented
113  void
115  throw edm::Exception(errors::LogicError,"RawInputSource::skip(int offset)")
116  << "Random access skip cannot be used for RawInputSource\n"
117  << "Contact a Framework developer.\n";
118  }
119 
120 }
static const char runNumber_[]
EventPrincipal *const eventPrincipalCache()
Definition: InputSource.cc:156
virtual EventPrincipal * readEvent_()
RunNumber_t runNumber_
void readAndCacheLumi()
Read next luminosity block.
Definition: InputSource.cc:309
void setRunPrematurelyRead()
Definition: InputSource.h:321
unsigned int EventNumber_t
Definition: EventID.h:30
std::auto_ptr< Event > makeEvent(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event, Timestamp const &tstamp)
tuple lumi
Definition: fjr2json.py:41
virtual void skip(int offset)
boost::shared_ptr< LuminosityBlockAuxiliary > luminosityBlockAuxiliary() const
Called by the framework to merge or insert lumi in principal cache.
Definition: InputSource.h:242
void setTimestamp(Timestamp const &theTime)
To set the current time, as seen by the input source.
Definition: InputSource.h:297
RawInputSource(ParameterSet const &pset, InputSourceDescription const &desc)
unsigned int LuminosityBlockNumber_t
Definition: EventID.h:31
boost::shared_ptr< LuminosityBlockPrincipal > const luminosityBlockPrincipal() const
Definition: InputSource.cc:280
std::string const & processGUID() const
Accessor for global process identifier.
Definition: InputSource.h:196
virtual boost::shared_ptr< RunAuxiliary > readRunAuxiliary_()
void setLuminosityBlockAuxiliary(LuminosityBlockAuxiliary *lbp)
Definition: InputSource.h:302
virtual std::auto_ptr< Event > readOneEvent()=0
LuminosityBlockNumber_t luminosityBlockNumber_
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
virtual boost::shared_ptr< LuminosityBlockAuxiliary > readLuminosityBlockAuxiliary_()
virtual EventPrincipal * readIt(EventID const &eventID)
ItemType state() const
Definition: InputSource.h:300
virtual ItemType getNextItemType()
void fillEventPrincipal(std::auto_ptr< EventAuxiliary > aux, boost::shared_ptr< LuminosityBlockPrincipal > lbp, boost::shared_ptr< EventSelectionIDVector > eventSelectionIDs=boost::shared_ptr< EventSelectionIDVector >(new EventSelectionIDVector), boost::shared_ptr< BranchListIndexes > branchListIndexes=boost::shared_ptr< BranchListIndexes >(new BranchListIndexes), boost::shared_ptr< BranchMapper > mapper=boost::shared_ptr< BranchMapper >(new BranchMapper), boost::shared_ptr< DelayedReader > rtrv=boost::shared_ptr< DelayedReader >(new NoDelayedReader))
static Timestamp const & invalidTimestamp()
Definition: Timestamp.cc:83
void setLumiPrematurelyRead()
Definition: InputSource.h:322
Timestamp const & timestamp() const
Accessor for the current time, as seen by the input source.
Definition: InputSource.h:221
boost::shared_ptr< RunAuxiliary > runAuxiliary() const
Called by the framework to merge or insert run in principal cache.
Definition: InputSource.h:239
static Timestamp const & beginOfTime()
Definition: Timestamp.cc:96
void setRunAuxiliary(RunAuxiliary *rp)
Definition: InputSource.h:301
ModuleDescription const & moduleDescription() const
Accessor for &#39;module&#39; description.
Definition: InputSource.h:187
unsigned int RunNumber_t
Definition: EventRange.h:32
void readAndCacheRun()
Read next run.
Definition: InputSource.cc:285