CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ThinnedAssociationsHelper.h
Go to the documentation of this file.
1 #ifndef DataFormats_Provenance_ThinnedAssociationsHelper_h
2 #define DataFormats_Provenance_ThinnedAssociationsHelper_h
3 
9 
10 #include <map>
11 #include <set>
12 #include <vector>
13 
14 namespace edm {
15 
16  class BranchDescription;
17 
19  public:
21  ThinnedAssociationBranches(BranchID const&, BranchID const&, BranchID const&);
22 
23  BranchID const& parent() const { return parent_; }
24  BranchID const& association() const { return association_; }
25  BranchID const& thinned() const { return thinned_; }
26 
27  bool operator<(ThinnedAssociationBranches const& rhs) const { return parent_ < rhs.parent_; }
28 
29  private:
33  };
34 
36  public:
37 
39 
40  std::vector<ThinnedAssociationBranches>::const_iterator begin() const;
41  std::vector<ThinnedAssociationBranches>::const_iterator end() const;
42 
43  std::vector<ThinnedAssociationBranches>::const_iterator parentBegin(BranchID const&) const;
44  std::vector<ThinnedAssociationBranches>::const_iterator parentEnd(BranchID const&) const;
45 
46  void addAssociation(BranchID const&, BranchID const&, BranchID const&);
48 
49  std::vector<std::pair<BranchID, ThinnedAssociationBranches const*> > associationToBranches() const;
50 
51  void sort();
52  void clear() { vThinnedAssociationBranches_.clear(); }
53 
54  void selectAssociationProducts(std::vector<BranchDescription const*> const& associationDescriptions,
55  std::set<BranchID> const& keptProductsInEvent,
56  std::map<BranchID, bool>& keepAssociation) const;
57 
58  std::vector<ThinnedAssociationBranches> const& data() const { return vThinnedAssociationBranches_; }
59 
61 
63  bool isSecondaryFile,
64  std::vector<BranchID> const& associationsFromSecondary);
65 
66  void updateFromParentProcess(ThinnedAssociationsHelper const& parentThinnedAssociationsHelper,
67  std::map<BranchID, bool> const& keepAssociation,
68  std::map<BranchID::value_type, BranchID::value_type> const& droppedBranchIDToKeptBranchID);
69 
70  void initAssociationsFromSecondary(std::vector<BranchID> const&,
72 
73  private:
74 
75  bool shouldKeepAssociation(BranchID const& association,
76  std::vector<std::pair<BranchID, ThinnedAssociationBranches const*> > const& associationToBranches,
77  std::set<BranchID>& branchesInRecursion,
78  std::set<BranchID> const& keptProductsInEvent,
79  std::map<BranchID, bool>& keepAssociation) const;
80 
81 
82  std::vector<ThinnedAssociationBranches> vThinnedAssociationBranches_;
83  };
84 }
85 #endif
void initAssociationsFromSecondary(std::vector< BranchID > const &, ThinnedAssociationsHelper const &)
std::vector< ThinnedAssociationBranches > const & data() const
void addAssociation(BranchID const &, BranchID const &, BranchID const &)
bool operator<(ThinnedAssociationBranches const &rhs) const
void requireMatch(ThinnedAssociationBranches const &input) const
std::vector< std::pair< BranchID, ThinnedAssociationBranches const * > > associationToBranches() const
void updateFromInput(ThinnedAssociationsHelper const &, bool isSecondaryFile, std::vector< BranchID > const &associationsFromSecondary)
std::vector< ThinnedAssociationBranches >::const_iterator end() const
static std::string const input
Definition: EdmProvDump.cc:44
std::vector< ThinnedAssociationBranches >::const_iterator parentEnd(BranchID const &) const
void selectAssociationProducts(std::vector< BranchDescription const * > const &associationDescriptions, std::set< BranchID > const &keptProductsInEvent, std::map< BranchID, bool > &keepAssociation) const
std::vector< ThinnedAssociationBranches > vThinnedAssociationBranches_
std::vector< ThinnedAssociationBranches >::const_iterator begin() const
std::vector< ThinnedAssociationBranches >::const_iterator parentBegin(BranchID const &) const
void updateFromParentProcess(ThinnedAssociationsHelper const &parentThinnedAssociationsHelper, std::map< BranchID, bool > const &keepAssociation, std::map< BranchID::value_type, BranchID::value_type > const &droppedBranchIDToKeptBranchID)
bool shouldKeepAssociation(BranchID const &association, std::vector< std::pair< BranchID, ThinnedAssociationBranches const * > > const &associationToBranches, std::set< BranchID > &branchesInRecursion, std::set< BranchID > const &keptProductsInEvent, std::map< BranchID, bool > &keepAssociation) const