Skip to content

Commit

Permalink
using for ProductDescription
Browse files Browse the repository at this point in the history
Utilize a using to rename BranchDescription. This avoids forward
compatibility issues with storage to ROOT files.
  • Loading branch information
Dr15Jones committed Jan 27, 2025
1 parent 73afa2d commit 9fe870c
Show file tree
Hide file tree
Showing 51 changed files with 215 additions and 188 deletions.
2 changes: 1 addition & 1 deletion DataFormats/Common/interface/ProductData.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ is the storage unit of such information.
----------------------------------------------------------------------*/

#include "DataFormats/Provenance/interface/Provenance.h"
#include "DataFormats/Provenance/interface/ProductDescriptionFwd.h"
#include "FWCore/Utilities/interface/thread_safety_macros.h"
#include <memory>

namespace edm {
class ProductDescription;
class MergeableRunProductMetadataBase;
class WrapperBase;

Expand Down
4 changes: 1 addition & 3 deletions DataFormats/Common/interface/setIsMergeable.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,9 @@
// Original Author: W. David Dagenhart
// Created: 21 June 2018
//
#include "DataFormats/Provenance/interface/ProductDescriptionFwd.h"

namespace edm {

class ProductDescription;

void setIsMergeable(ProductDescription&);
} // namespace edm

Expand Down
2 changes: 1 addition & 1 deletion DataFormats/FWLite/interface/ChainEvent.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@
// user include files
#include "DataFormats/FWLite/interface/Event.h"
#include "DataFormats/FWLite/interface/EventBase.h"
#include "DataFormats/Provenance/interface/ProductDescriptionFwd.h"
#include "FWCore/Utilities/interface/propagate_const.h"

// forward declarations
namespace edm {
class WrapperBase;
class ProductRegistry;
class ProcessHistory;
class ProductDescription;
class EDProductGetter;
class EventAux;
class TriggerResults;
Expand Down
2 changes: 1 addition & 1 deletion DataFormats/FWLite/interface/DataGetterHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

// user include files
#include "DataFormats/Common/interface/EDProductGetter.h"
#include "DataFormats/Provenance/interface/ProductDescriptionFwd.h"
#include "DataFormats/FWLite/interface/HistoryGetterBase.h"
#include "DataFormats/FWLite/interface/InternalDataKey.h"
#include "FWCore/FWLite/interface/BranchMapReader.h"
Expand All @@ -41,7 +42,6 @@ class TTreeCache;
class TTree;

namespace edm {
class ProductDescription;
class BranchID;
class ObjectWithDict;
class ProductID;
Expand Down
2 changes: 1 addition & 1 deletion DataFormats/FWLite/interface/Event.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,13 @@
#include "DataFormats/Provenance/interface/EventProcessHistoryID.h"
#include "DataFormats/Provenance/interface/EventAuxiliary.h"
#include "DataFormats/Provenance/interface/EventID.h"
#include "DataFormats/Provenance/interface/ProductDescriptionFwd.h"
#include "FWCore/Utilities/interface/thread_safety_macros.h"

// forward declarations
namespace edm {
class WrapperBase;
class ProductRegistry;
class ProductDescription;
class EDProductGetter;
class EventAux;
class Timestamp;
Expand Down
2 changes: 1 addition & 1 deletion DataFormats/FWLite/interface/LuminosityBlock.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@
#include "DataFormats/FWLite/interface/EntryFinder.h"
#include "DataFormats/Provenance/interface/ProcessHistoryRegistry.h"
#include "DataFormats/Provenance/interface/LuminosityBlockAuxiliary.h"
#include "DataFormats/Provenance/interface/ProductDescriptionFwd.h"
#include "FWCore/Utilities/interface/thread_safety_macros.h"

// forward declarations
namespace edm {
class WrapperBase;
class ProductRegistry;
class ProductDescription;
class EDProductGetter;
class LuminosityBlockAux;
class Timestamp;
Expand Down
2 changes: 1 addition & 1 deletion DataFormats/FWLite/interface/MultiChainEvent.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@
// user include files
#include "DataFormats/FWLite/interface/EventBase.h"
#include "DataFormats/FWLite/interface/ChainEvent.h"
#include "DataFormats/Provenance/interface/ProductDescriptionFwd.h"
#include "FWCore/Utilities/interface/propagate_const.h"

// forward declarations
namespace edm {
class WrapperBase;
class ProductRegistry;
class ProcessHistory;
class ProductDescription;
class EDProductGetter;
class EventAux;
class TriggerResults;
Expand Down
2 changes: 1 addition & 1 deletion DataFormats/FWLite/interface/Run.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#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"
Expand All @@ -41,7 +42,6 @@
namespace edm {
class WrapperBase;
class ProductRegistry;
class ProductDescription;
class EDProductGetter;
class RunAux;
class Timestamp;
Expand Down
4 changes: 2 additions & 2 deletions DataFormats/FWLite/src/DataGetterHelper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -338,8 +338,8 @@ namespace fwlite {
}

bool DataGetterHelper::getByProductDescription(edm::ProductDescription const& bDesc,
Long_t eventEntry,
KeyToDataMap::iterator& itData) const {
Long_t eventEntry,
KeyToDataMap::iterator& itData) const {
if (!bDesc.branchID().isValid()) {
return false;
}
Expand Down
3 changes: 2 additions & 1 deletion DataFormats/FWLite/src/EventBase.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@

static const edm::ProductID s_id;
static edm::ProductDescription const s_branch = edm::ProductDescription(edm::ProductDescription());
static const edm::Provenance s_prov(std::shared_ptr<edm::ProductDescription const>(&s_branch, edm::do_nothing_deleter()),
static const edm::Provenance s_prov(std::shared_ptr<edm::ProductDescription const>(&s_branch,
edm::do_nothing_deleter()),
s_id);

namespace fwlite {
Expand Down
3 changes: 2 additions & 1 deletion DataFormats/FWLite/src/LuminosityBlockBase.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@

static const edm::ProductID s_id;
static edm::ProductDescription const s_branch = edm::ProductDescription(edm::ProductDescription());
static const edm::Provenance s_prov(std::shared_ptr<edm::ProductDescription const>(&s_branch, edm::do_nothing_deleter()),
static const edm::Provenance s_prov(std::shared_ptr<edm::ProductDescription const>(&s_branch,
edm::do_nothing_deleter()),
s_id);

namespace fwlite {
Expand Down
3 changes: 2 additions & 1 deletion DataFormats/FWLite/src/RunBase.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@

static const edm::ProductID s_id;
static edm::ProductDescription const s_branch = edm::ProductDescription(edm::ProductDescription());
static const edm::Provenance s_prov(std::shared_ptr<edm::ProductDescription const>(&s_branch, edm::do_nothing_deleter()),
static const edm::Provenance s_prov(std::shared_ptr<edm::ProductDescription const>(&s_branch,
edm::do_nothing_deleter()),
s_id);

namespace fwlite {
Expand Down
3 changes: 1 addition & 2 deletions DataFormats/Provenance/interface/BranchChildren.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,10 @@ BranchChildren: Dependency information between branches.
#include <map>
#include <set>
#include "DataFormats/Provenance/interface/BranchID.h"
#include "DataFormats/Provenance/interface/ProductDescriptionFwd.h"

namespace edm {

class ProductDescription;

class BranchChildren {
private:
typedef std::set<BranchID> BranchIDSet;
Expand Down
3 changes: 3 additions & 0 deletions DataFormats/Provenance/interface/BranchDescription.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ This description also applies to every product instance on the branch.
#include <set>
#include <string>

#if !defined(DataFormats_Provenance_ProductDescription_h)
#error The name BranchDescription is deprecated, please use ProductDescription instead.
#endif
/*
BranchDescription
Expand Down
3 changes: 2 additions & 1 deletion DataFormats/Provenance/interface/BranchKey.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ is determined entirely from the BranchKey.
#include <iosfwd>
#include <string>

#include "DataFormats/Provenance/interface/ProductDescriptionFwd.h"

namespace edm {
class ProductDescription;

class BranchKey {
public:
Expand Down
9 changes: 9 additions & 0 deletions DataFormats/Provenance/interface/ProductDescription.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#if !defined(DataFormats_Provenance_ProductDescription_h)
#define DataFormats_Provenance_ProductDescription_h
#include "DataFormats/Provenance/interface/BranchDescription.h"

namespace edm {
using ProductDescription = BranchDescription;
}

#endif
9 changes: 9 additions & 0 deletions DataFormats/Provenance/interface/ProductDescriptionFwd.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#if !defined(DataFormats_Provenance_ProductDescriptionFwd_h)
#define DataFormats_Provenance_ProductDescriptionFwd_h

namespace edm {
class BranchDescription;
using ProductDescription = BranchDescription;
} // namespace edm

#endif
4 changes: 3 additions & 1 deletion DataFormats/Provenance/interface/Provenance.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,9 @@ namespace edm {
mergeableRunProductMetadata_ = mrpm;
}

void setProductDescription(std::shared_ptr<ProductDescription const> const& p) { stable().setProductDescription(p); }
void setProductDescription(std::shared_ptr<ProductDescription const> const& p) {
stable().setProductDescription(p);
}

void swap(Provenance&);

Expand Down
4 changes: 1 addition & 3 deletions DataFormats/Provenance/interface/ProvenanceFwd.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,10 @@
#define DataFormats_Provenance_ProvenanceFwd_h

namespace edm {
class ProductDescription;
class BranchIDListHelper;
class Parentage;
class BranchID;
class BranchKey;
class ProductDescription;
class ProductProvenance;
class ProductProvenance;
class EventAuxiliary;
class EventID;
Expand Down Expand Up @@ -41,4 +38,5 @@ namespace cms {
#include "DataFormats/Provenance/interface/ReleaseVersion.h"
#include "DataFormats/Provenance/interface/ProcessHistoryID.h"
#include "DataFormats/Provenance/interface/ProcessConfigurationID.h"
#include "DataFormats/Provenance/interface/ProductDescriptionFwd.h"
#endif
2 changes: 1 addition & 1 deletion DataFormats/Provenance/interface/SelectedProducts.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
#include <vector>

#include "DataFormats/Provenance/interface/BranchType.h"
#include "DataFormats/Provenance/interface/ProductDescriptionFwd.h"
#include "FWCore/Utilities/interface/EDGetToken.h"

namespace edm {
class ProductDescription;
typedef std::vector<std::pair<ProductDescription const *, EDGetToken>> SelectedProducts;
typedef std::array<SelectedProducts, NumBranchTypes> SelectedProductsForBranchType;
} // namespace edm
Expand Down
3 changes: 1 addition & 2 deletions DataFormats/Provenance/interface/ThinnedAssociationsHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,14 @@
*/

#include "DataFormats/Provenance/interface/BranchID.h"
#include "DataFormats/Provenance/interface/ProductDescriptionFwd.h"

#include <map>
#include <set>
#include <vector>

namespace edm {

class ProductDescription;

class ThinnedAssociationBranches {
public:
ThinnedAssociationBranches();
Expand Down
2 changes: 1 addition & 1 deletion DataFormats/Provenance/src/BranchDescription.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "DataFormats/Provenance/interface/BranchDescription.h"
#include "DataFormats/Provenance/interface/ProductDescription.h"

#include "FWCore/Utilities/interface/EDMException.h"
#include "FWCore/Utilities/interface/Exception.h"
Expand Down
2 changes: 1 addition & 1 deletion FWCore/Framework/interface/Event.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ For its usage, see "FWCore/Framework/interface/PrincipalGetAdapter.h"
#include "DataFormats/Provenance/interface/EventSelectionID.h"
#include "DataFormats/Provenance/interface/ProductID.h"
#include "DataFormats/Provenance/interface/RunID.h"
#include "DataFormats/Provenance/interface/ProductDescriptionFwd.h"

#include "FWCore/Common/interface/EventBase.h"
#include "FWCore/Framework/interface/Frameworkfwd.h"
Expand All @@ -55,7 +56,6 @@ class testEvent;

namespace edm {

class ProductDescription;
class ModuleCallingContext;
class TriggerResultsByName;
class TriggerResults;
Expand Down
2 changes: 1 addition & 1 deletion FWCore/Framework/interface/EventForOutput.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "DataFormats/Provenance/interface/EventID.h"
#include "DataFormats/Provenance/interface/EventSelectionID.h"
#include "DataFormats/Provenance/interface/RunID.h"
#include "DataFormats/Provenance/interface/ProductDescriptionFwd.h"

#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/Framework/interface/OccurrenceForOutput.h"
Expand All @@ -42,7 +43,6 @@ namespace edmtest {

namespace edm {

class ProductDescription;
class ModuleCallingContext;
class ProductProvenanceRetriever;
class EDConsumerBase;
Expand Down
2 changes: 1 addition & 1 deletion FWCore/Framework/interface/FileBlock.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ FileBlock: Properties of an input file.

#include "DataFormats/Provenance/interface/FileFormatVersion.h"
#include "DataFormats/Provenance/interface/BranchChildren.h"
#include "DataFormats/Provenance/interface/ProductDescriptionFwd.h"
#include "FWCore/Utilities/interface/BranchType.h"
class TTree;
#include <memory>
Expand All @@ -18,7 +19,6 @@ class TTree;
#include <vector>

namespace edm {
class ProductDescription;
class FileBlock {
public:
// bit mask for reasons fast cloning can be disabled or not applicable
Expand Down
2 changes: 1 addition & 1 deletion FWCore/Framework/interface/OccurrenceForOutput.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "DataFormats/Common/interface/Handle.h"
#include "DataFormats/Common/interface/Wrapper.h"
#include "DataFormats/Provenance/interface/BranchListIndex.h"
#include "DataFormats/Provenance/interface/ProductDescriptionFwd.h"

#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/Framework/interface/PrincipalGetAdapter.h"
Expand All @@ -37,7 +38,6 @@ namespace edmtest {

namespace edm {

class ProductDescription;
class ModuleCallingContext;
class Principal;
class EDConsumerBase;
Expand Down
2 changes: 1 addition & 1 deletion FWCore/Framework/interface/ProducerBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ EDProducts into an Event.
#include "FWCore/Framework/interface/ProductRegistryHelper.h"
#include "FWCore/Framework/interface/ProducesCollector.h"
#include "FWCore/Utilities/interface/ProductResolverIndex.h"
#include "DataFormats/Provenance/interface/ProductDescriptionFwd.h"

#include <functional>
#include <unordered_map>
Expand All @@ -19,7 +20,6 @@ EDProducts into an Event.
#include <array>

namespace edm {
class ProductDescription;
class ModuleDescription;
class ProducesCollector;
class SignallingProductRegistry;
Expand Down
10 changes: 5 additions & 5 deletions FWCore/Framework/interface/ProductSelector.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,14 @@
//////////////////////////////////////////////////////////////////////

#include "DataFormats/Provenance/interface/BranchID.h"
#include "DataFormats/Provenance/interface/ProductDescriptionFwd.h"

#include <iosfwd>
#include <map>
#include <string>
#include <vector>

namespace edm {
class ProductDescription;
class BranchID;
class ProductRegistry;
class ProductSelectorRules;
class ParameterSet;
Expand All @@ -28,7 +27,8 @@ namespace edm {
ProductSelector();

// N.B.: we assume there are not null pointers in the vector allBranches.
void initialize(ProductSelectorRules const& rules, std::vector<ProductDescription const*> const& productDescriptions);
void initialize(ProductSelectorRules const& rules,
std::vector<ProductDescription const*> const& productDescriptions);

bool selected(ProductDescription const& desc) const;

Expand All @@ -37,8 +37,8 @@ namespace edm {

bool initialized() const { return initialized_; }

static void checkForDuplicateKeptBranch(ProductDescription const& desc,
std::map<BranchID, ProductDescription const*>& trueBranchIDToKeptBranchDesc);
static void checkForDuplicateKeptBranch(
ProductDescription const& desc, std::map<BranchID, ProductDescription const*>& trueBranchIDToKeptBranchDesc);

static void fillDroppedToKept(ProductRegistry const& preg,
std::map<BranchID, ProductDescription const*> const& trueBranchIDToKeptBranchDesc,
Expand Down
Loading

0 comments on commit 9fe870c

Please sign in to comment.