Run

Macros

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128
#ifndef DataFormats_FWLite_Run_h
#define DataFormats_FWLite_Run_h
// -*- C++ -*-
//
// Package:     FWLite/DataFormats
// Class  :     Run
//
/**\class Run Run.h DataFormats/FWLite/interface/Run.h

   Description: <one line class summary>

   Usage:
   This class is not safe to use across different threads

*/
//
// Original Author:  Eric Vaandering
//         Created:  Wed Jan 13 15:01:20 EDT 2007
//
// system include files
#include <typeinfo>
#include <map>
#include <vector>
#include <memory>
#include <cstring>

#include "Rtypes.h"

// user include files
#include "DataFormats/FWLite/interface/RunBase.h"
#include "DataFormats/FWLite/interface/InternalDataKey.h"
#include "DataFormats/FWLite/interface/EntryFinder.h"
#include "DataFormats/Provenance/interface/ProcessHistoryRegistry.h"
#include "DataFormats/Provenance/interface/RunAuxiliary.h"
#include "DataFormats/Provenance/interface/RunID.h"
#include "DataFormats/Provenance/interface/ProductDescriptionFwd.h"
#include "FWCore/FWLite/interface/BranchMapReader.h"
#include "DataFormats/FWLite/interface/DataGetterHelper.h"
#include "FWCore/Utilities/interface/thread_safety_macros.h"

// forward declarations
namespace edm {
  class WrapperBase;
  class ProductRegistry;
  class EDProductGetter;
  class RunAux;
  class Timestamp;
  class TriggerResults;
  class TriggerNames;
}  // namespace edm

namespace fwlite {
  class Event;
  class Run : public RunBase {
  public:
    // NOTE: Does NOT take ownership so iFile must remain around
    // at least as long as Run
    Run(TFile* iFile);
    Run(std::shared_ptr<BranchMapReader> branchMap);
    Run(const Run&) = delete;                   // stop default
    const Run& operator=(const Run&) = delete;  // stop default

    ~Run() override;

    const Run& operator++() override;

    /// Go to event by Run & Run number
    bool to(edm::RunNumber_t run);

    // Go to the very first Event.
    const Run& toBegin() override;

    // ---------- const member functions ---------------------
    virtual std::string const getBranchNameFor(std::type_info const&, char const*, char const*, char const*) const;

    // This function should only be called by fwlite::Handle<>
    using fwlite::RunBase::getByLabel;
    bool getByLabel(std::type_info const&, char const*, char const*, char const*, void*) const override;
    //void getByBranchName(std::type_info const&, char const*, void*&) const;

    bool isValid() const;
    operator bool() const;
    bool atEnd() const override;

    Long64_t size() const;

    edm::RunAuxiliary const& runAuxiliary() const override;

    std::vector<edm::ProductDescription> const& getProductDescriptions() const {
      return branchMap_->getProductDescriptions();
    }

    //       void setGetter(//Copy from Event if needed

    edm::WrapperBase const* getByProductID(edm::ProductID const&) const;

    // ---------- static member functions --------------------
    static void throwProductNotFoundException(std::type_info const&, char const*, char const*, char const*);

    // ---------- member functions ---------------------------

  private:
    friend class internal::ProductGetter;
    friend class RunHistoryGetter;

    const edm::ProcessHistory& history() const;
    void updateAux(Long_t runIndex) const;

    // ---------- member data --------------------------------
    //This class is not inteded to be used across different threads
    CMS_SA_ALLOW mutable std::shared_ptr<BranchMapReader> branchMap_;

    //takes ownership of the strings used by the DataKey keys in data_
    CMS_SA_ALLOW mutable std::vector<char const*> labels_;
    CMS_SA_ALLOW mutable edm::ProcessHistoryMap historyMap_;
    CMS_SA_ALLOW mutable std::vector<std::string> procHistoryNames_;
    CMS_SA_ALLOW mutable edm::RunAuxiliary aux_;
    CMS_SA_ALLOW mutable EntryFinder entryFinder_;
    edm::RunAuxiliary const* pAux_;
    edm::RunAux const* pOldAux_;
    TBranch* auxBranch_;
    int fileVersion_;

    fwlite::DataGetterHelper dataHelper_;
  };

}  // namespace fwlite
#endif