Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-05-06 00:35:26

0001 #ifndef FWCore_Framework_LuminosityBlockPrincipal_h
0002 #define FWCore_Framework_LuminosityBlockPrincipal_h
0003 
0004 /*----------------------------------------------------------------------
0005 
0006 LuminosityBlockPrincipal: This is the class responsible for management of
0007 per luminosity block EDProducts. It is not seen by reconstruction code;
0008 such code sees the LuminosityBlock class, which is a proxy for LuminosityBlockPrincipal.
0009 
0010 The major internal component of the LuminosityBlockPrincipal
0011 is the DataBlock.
0012 
0013 ----------------------------------------------------------------------*/
0014 
0015 #include "DataFormats/Provenance/interface/LuminosityBlockAuxiliary.h"
0016 #include "DataFormats/Provenance/interface/RunID.h"
0017 #include "FWCore/Utilities/interface/LuminosityBlockIndex.h"
0018 #include "FWCore/Framework/interface/Principal.h"
0019 #include "FWCore/Utilities/interface/propagate_const.h"
0020 
0021 #include <memory>
0022 
0023 #include <vector>
0024 
0025 namespace edm {
0026 
0027   class HistoryAppender;
0028   class ModuleCallingContext;
0029   class RunPrincipal;
0030 
0031   class LuminosityBlockPrincipal : public Principal {
0032   public:
0033     typedef LuminosityBlockAuxiliary Auxiliary;
0034     typedef Principal Base;
0035 
0036     LuminosityBlockPrincipal(std::shared_ptr<ProductRegistry const> reg,
0037                              ProcessConfiguration const& pc,
0038                              HistoryAppender* historyAppender,
0039                              unsigned int index,
0040                              bool isForPrimaryProcess = true);
0041 
0042     ~LuminosityBlockPrincipal() override {}
0043 
0044     void fillLuminosityBlockPrincipal(ProcessHistory const* processHistory, DelayedReader* reader = nullptr);
0045 
0046     RunPrincipal const& runPrincipal() const { return *runPrincipal_; }
0047 
0048     RunPrincipal& runPrincipal() { return *runPrincipal_; }
0049 
0050     void setRunPrincipal(std::shared_ptr<RunPrincipal> rp) { runPrincipal_ = rp; }
0051 
0052     LuminosityBlockIndex index() const { return index_; }
0053 
0054     LuminosityBlockID id() const { return aux().id(); }
0055 
0056     Timestamp const& beginTime() const { return aux().beginTime(); }
0057 
0058     Timestamp const& endTime() const { return aux().endTime(); }
0059 
0060     void setEndTime(Timestamp const& time) { aux_.setEndTime(time); }
0061 
0062     LuminosityBlockNumber_t luminosityBlock() const { return aux().luminosityBlock(); }
0063 
0064     void setAux(LuminosityBlockAuxiliary iAux) { aux_ = std::move(iAux); }
0065     LuminosityBlockAuxiliary const& aux() const { return aux_; }
0066 
0067     RunNumber_t run() const { return aux().run(); }
0068 
0069     void mergeAuxiliary(LuminosityBlockAuxiliary const& aux) { return aux_.mergeAuxiliary(aux); }
0070 
0071     void put(BranchDescription const& bd, std::unique_ptr<WrapperBase> edp) const;
0072 
0073     void put(ProductResolverIndex index, std::unique_ptr<WrapperBase> edp) const;
0074 
0075     enum ShouldWriteLumi { kUninitialized, kNo, kYes };
0076     ShouldWriteLumi shouldWriteLumi() const { return shouldWriteLumi_; }
0077     void setShouldWriteLumi(ShouldWriteLumi value) { shouldWriteLumi_ = value; }
0078 
0079   private:
0080     unsigned int transitionIndex_() const override;
0081 
0082     edm::propagate_const<std::shared_ptr<RunPrincipal>> runPrincipal_;
0083 
0084     LuminosityBlockAuxiliary aux_;
0085 
0086     LuminosityBlockIndex index_;
0087 
0088     ShouldWriteLumi shouldWriteLumi_ = kUninitialized;
0089   };
0090 }  // namespace edm
0091 #endif