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 
53  boost::shared_ptr<LuminosityBlockPrincipal> const& lumiPrincipalPtr(ProcessHistoryID const& phid, RunNumber_t run, LuminosityBlockNumber_t lumi) const;
55  boost::shared_ptr<LuminosityBlockPrincipal> const& lumiPrincipalPtr() const;
56 
58 
59  void merge(boost::shared_ptr<RunAuxiliary> aux, boost::shared_ptr<ProductRegistry const> reg);
60  void merge(boost::shared_ptr<LuminosityBlockAuxiliary> aux, boost::shared_ptr<ProductRegistry const> reg);
61 
62  void insert(boost::shared_ptr<RunPrincipal> rp);
63  void insert(boost::shared_ptr<LuminosityBlockPrincipal> lbp);
64  void insert(boost::shared_ptr<EventPrincipal> ep) { eventPrincipal_ = ep; }
65 
66  void deleteRun(ProcessHistoryID const& phid, RunNumber_t run);
68 
69  void adjustEventToNewProductRegistry(boost::shared_ptr<ProductRegistry const> reg);
70 
72 
73  private:
74 
75  void throwRunMissing() const;
76  void throwLumiMissing() const;
77 
78  // These are explicitly cleared when finished with the run,
79  // lumi, or event
80  boost::shared_ptr<RunPrincipal> runPrincipal_;
81  boost::shared_ptr<LuminosityBlockPrincipal> lumiPrincipal_;
82  boost::shared_ptr<EventPrincipal> eventPrincipal_;
83 
84  // These are intentionally not cleared so that when inserting
85  // the next principal the conversion from full ProcessHistoryID_
86  // to reduced ProcessHistoryID_ is still in memory and does
87  // not need to be recalculated if the ID does not change. I
88  // expect that very often these ID's will not change from one
89  // principal to the next and a good amount of CPU can be saved
90  // by not recalculating.
95  };
96 }
97 
98 #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
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_
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_