CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PrincipalCache.h
Go to the documentation of this file.
1 #ifndef FWCore_Framework_PrincipalCache_h
2 #define FWCore_Framework_PrincipalCache_h
3 
4 /*
5 Contains a shared pointer to the RunPrincipal,
6 LuminosityBlockPrincipal, and EventPrincipal.
7 Manages merging of run and luminosity block
8 principals when there is more than one principal
9 from the same run or luminosity block and having
10 the same reduced ProcessHistoryID.
11 
12 The EventPrincipal is reused each event and is created
13 by the EventProcessor or SubProcess which contains
14 an object of this type as a data member.
15 
16 The RunPrincipal and LuminosityBlockPrincipal is
17 created by the InputSource each time a different
18 run or luminosity block is encountered.
19 
20 Performs checks that process history IDs or runs and
21 lumis, run numbers, and luminosity numbers are consistent.
22 
23 Original Author: W. David Dagenhart
24 */
25 
29 
30 #include "boost/shared_ptr.hpp"
31 
32 namespace edm {
33 
34  class RunPrincipal;
35  class LuminosityBlockPrincipal;
36  class EventPrincipal;
37  class RunAuxiliary;
38  class LuminosityBlockAuxiliary;
39  class ProductRegistry;
40 
42  public:
43 
46 
48  boost::shared_ptr<RunPrincipal> const& runPrincipalPtr(ProcessHistoryID const& phid, RunNumber_t run) const;
49  RunPrincipal& runPrincipal() const;
50  boost::shared_ptr<RunPrincipal> const& runPrincipalPtr() const;
51  bool hasRunPrincipal() const {return runPrincipal_;}
52 
54  boost::shared_ptr<LuminosityBlockPrincipal> const& lumiPrincipalPtr(ProcessHistoryID const& phid, RunNumber_t run, LuminosityBlockNumber_t lumi) const;
56  boost::shared_ptr<LuminosityBlockPrincipal> const& lumiPrincipalPtr() const;
57  bool hasLumiPrincipal() const {return lumiPrincipal_;}
58 
60 
61  void merge(boost::shared_ptr<RunAuxiliary> aux, boost::shared_ptr<ProductRegistry const> reg);
62  void merge(boost::shared_ptr<LuminosityBlockAuxiliary> aux, boost::shared_ptr<ProductRegistry const> reg);
63 
64  void insert(boost::shared_ptr<RunPrincipal> rp);
65  void insert(boost::shared_ptr<LuminosityBlockPrincipal> lbp);
66  void insert(boost::shared_ptr<EventPrincipal> ep) { eventPrincipal_ = ep; }
67 
68  void deleteRun(ProcessHistoryID const& phid, RunNumber_t run);
70 
71  void adjustEventToNewProductRegistry(boost::shared_ptr<ProductRegistry const> reg);
72 
74 
75  private:
76 
77  void throwRunMissing() const;
78  void throwLumiMissing() const;
79 
80  // These are explicitly cleared when finished with the run,
81  // lumi, or event
82  boost::shared_ptr<RunPrincipal> runPrincipal_;
83  boost::shared_ptr<LuminosityBlockPrincipal> lumiPrincipal_;
84  boost::shared_ptr<EventPrincipal> eventPrincipal_;
85 
86  // These are intentionally not cleared so that when inserting
87  // the next principal the conversion from full ProcessHistoryID_
88  // to reduced ProcessHistoryID_ is still in memory and does
89  // not need to be recalculated if the ID does not change. I
90  // expect that very often these ID's will not change from one
91  // principal to the next and a good amount of CPU can be saved
92  // by not recalculating.
97  };
98 }
99 
100 #endif
void throwRunMissing() const
boost::shared_ptr< RunPrincipal > const & runPrincipalPtr() const
void deleteLumi(ProcessHistoryID const &phid, RunNumber_t run, LuminosityBlockNumber_t lumi)
void merge(boost::shared_ptr< RunAuxiliary > aux, boost::shared_ptr< ProductRegistry const > reg)
tuple lumi
Definition: fjr2json.py:35
void throwLumiMissing() const
bool hasRunPrincipal() const
void insert(boost::shared_ptr< RunPrincipal > rp)
LuminosityBlockNumber_t lumi_
void adjustIndexesAfterProductRegistryAddition()
unsigned int LuminosityBlockNumber_t
Definition: EventID.h:31
void adjustEventToNewProductRegistry(boost::shared_ptr< ProductRegistry const > reg)
RunPrincipal & runPrincipal() const
ProcessHistoryID reducedInputProcessHistoryID_
boost::shared_ptr< LuminosityBlockPrincipal > const & lumiPrincipalPtr() const
boost::shared_ptr< RunPrincipal > runPrincipal_
bool hasLumiPrincipal() const
void deleteRun(ProcessHistoryID const &phid, RunNumber_t run)
ProcessHistoryID inputProcessHistoryID_
void insert(boost::shared_ptr< EventPrincipal > ep)
LuminosityBlockPrincipal & lumiPrincipal() const
EventPrincipal & eventPrincipal() const
unsigned int RunNumber_t
Definition: EventRange.h:32
boost::shared_ptr< LuminosityBlockPrincipal > lumiPrincipal_
boost::shared_ptr< EventPrincipal > eventPrincipal_