CMS 3D CMS Logo

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&);
47  void addAssociation(ThinnedAssociationBranches 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 
60  void requireMatch(ThinnedAssociationBranches const& input) const;
61 
62  void updateFromPrimaryInput(ThinnedAssociationsHelper const&);
63 
64  void updateFromSecondaryInput(ThinnedAssociationsHelper const&,
65  std::vector<BranchID> const& associationsFromSecondary);
66 
67  void updateFromParentProcess(ThinnedAssociationsHelper const& parentThinnedAssociationsHelper,
68  std::map<BranchID, bool> const& keepAssociation,
69  std::map<BranchID::value_type, BranchID::value_type> const& droppedBranchIDToKeptBranchID);
70 
71  void initAssociationsFromSecondary(std::vector<BranchID> const&,
73 
74  private:
75 
76  bool shouldKeepAssociation(BranchID const& association,
77  std::vector<std::pair<BranchID, ThinnedAssociationBranches const*> > const& associationToBranches,
78  std::set<BranchID>& branchesInRecursion,
79  std::set<BranchID> const& keptProductsInEvent,
80  std::map<BranchID, bool>& keepAssociation) const;
81 
82 
83  std::vector<ThinnedAssociationBranches> vThinnedAssociationBranches_;
84  };
85 }
86 #endif
std::vector< ThinnedAssociationBranches > const & data() const
bool operator<(ThinnedAssociationBranches const &rhs) const
static std::string const input
Definition: EdmProvDump.cc:44
#define end
Definition: vmac.h:37
std::vector< ThinnedAssociationBranches > vThinnedAssociationBranches_
#define begin
Definition: vmac.h:30
HLT enums.