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&, bool slimmed);
22 
23  BranchID const& parent() const { return parent_; }
24  BranchID const& association() const { return association_; }
25  BranchID const& thinned() const { return thinned_; }
26  bool isSlimmed() const { return slimmed_; }
27 
28  bool operator<(ThinnedAssociationBranches const& rhs) const { return parent_ < rhs.parent_; }
29 
30  private:
34  bool slimmed_ = false;
35  };
36 
38  public:
40 
41  std::vector<ThinnedAssociationBranches>::const_iterator begin() const;
42  std::vector<ThinnedAssociationBranches>::const_iterator end() const;
43 
44  std::vector<ThinnedAssociationBranches>::const_iterator parentBegin(BranchID const&) const;
45  std::vector<ThinnedAssociationBranches>::const_iterator parentEnd(BranchID const&) const;
46 
47  void addAssociation(BranchID const&, BranchID const&, BranchID const&, bool slimmed);
49 
50  std::vector<std::pair<BranchID, ThinnedAssociationBranches const*> > associationToBranches() const;
51 
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 
65  std::vector<BranchID> const& associationsFromSecondary);
66 
68  ThinnedAssociationsHelper const& parentThinnedAssociationsHelper,
69  std::map<BranchID, bool> const& keepAssociation,
70  std::map<BranchID::value_type, BranchID::value_type> const& droppedBranchIDToKeptBranchID);
71 
72  void initAssociationsFromSecondary(std::vector<BranchID> const&, ThinnedAssociationsHelper const&);
73 
74  private:
76  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  std::vector<ThinnedAssociationBranches>::const_iterator lower_bound(
82  ThinnedAssociationBranches const& branches) const;
83 
84  void ensureSlimmingConstraints() const;
85 
86  std::vector<ThinnedAssociationBranches> vThinnedAssociationBranches_;
87  };
88 } // namespace edm
89 #endif
edm::ThinnedAssociationBranches::thinned_
BranchID thinned_
Definition: ThinnedAssociationsHelper.h:33
edm::ThinnedAssociationBranches::parent
BranchID const & parent() const
Definition: ThinnedAssociationsHelper.h:23
input
static const std::string input
Definition: EdmProvDump.cc:48
edm::ThinnedAssociationBranches::thinned
BranchID const & thinned() const
Definition: ThinnedAssociationsHelper.h:25
edm::ThinnedAssociationBranches::association
BranchID const & association() const
Definition: ThinnedAssociationsHelper.h:24
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::ThinnedAssociationsHelper::clear
void clear()
Definition: ThinnedAssociationsHelper.h:52
BranchID.h
edm::ThinnedAssociationsHelper::shouldKeepAssociation
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
Definition: ThinnedAssociationsHelper.cc:210
edm::ThinnedAssociationsHelper::parentEnd
std::vector< ThinnedAssociationBranches >::const_iterator parentEnd(BranchID const &) const
Definition: ThinnedAssociationsHelper.cc:39
edm::ThinnedAssociationsHelper::data
std::vector< ThinnedAssociationBranches > const & data() const
Definition: ThinnedAssociationsHelper.h:58
edm::BranchID
Definition: BranchID.h:14
edm::ThinnedAssociationBranches::slimmed_
bool slimmed_
Definition: ThinnedAssociationsHelper.h:34
edm::ThinnedAssociationsHelper::updateFromPrimaryInput
void updateFromPrimaryInput(ThinnedAssociationsHelper const &)
Definition: ThinnedAssociationsHelper.cc:278
edm::ThinnedAssociationsHelper::selectAssociationProducts
void selectAssociationProducts(std::vector< BranchDescription const * > const &associationDescriptions, std::set< BranchID > const &keptProductsInEvent, std::map< BranchID, bool > &keepAssociation) const
Definition: ThinnedAssociationsHelper.cc:189
edm::ThinnedAssociationsHelper::ensureSlimmingConstraints
void ensureSlimmingConstraints() const
Definition: ThinnedAssociationsHelper.cc:144
edm::ThinnedAssociationBranches
Definition: ThinnedAssociationsHelper.h:18
edm::ThinnedAssociationBranches::parent_
BranchID parent_
Definition: ThinnedAssociationsHelper.h:31
edm::ThinnedAssociationsHelper::requireMatch
void requireMatch(ThinnedAssociationBranches const &input) const
Definition: ThinnedAssociationsHelper.cc:263
edm::ThinnedAssociationsHelper::vThinnedAssociationBranches_
std::vector< ThinnedAssociationBranches > vThinnedAssociationBranches_
Definition: ThinnedAssociationsHelper.h:86
edm::ThinnedAssociationsHelper
Definition: ThinnedAssociationsHelper.h:37
edm::ThinnedAssociationsHelper::updateFromSecondaryInput
void updateFromSecondaryInput(ThinnedAssociationsHelper const &, std::vector< BranchID > const &associationsFromSecondary)
Definition: ThinnedAssociationsHelper.cc:289
edm::ThinnedAssociationsHelper::addAssociation
void addAssociation(BranchID const &, BranchID const &, BranchID const &, bool slimmed)
Definition: ThinnedAssociationsHelper.cc:61
edm::ThinnedAssociationsHelper::end
std::vector< ThinnedAssociationBranches >::const_iterator end() const
Definition: ThinnedAssociationsHelper.cc:24
edm::ThinnedAssociationBranches::association_
BranchID association_
Definition: ThinnedAssociationsHelper.h:32
edm::ThinnedAssociationsHelper::ThinnedAssociationsHelper
ThinnedAssociationsHelper()
Definition: ThinnedAssociationsHelper.cc:18
trackerHitRTTI::vector
Definition: trackerHitRTTI.h:21
edm::ThinnedAssociationsHelper::updateFromParentProcess
void updateFromParentProcess(ThinnedAssociationsHelper const &parentThinnedAssociationsHelper, std::map< BranchID, bool > const &keepAssociation, std::map< BranchID::value_type, BranchID::value_type > const &droppedBranchIDToKeptBranchID)
Definition: ThinnedAssociationsHelper.cc:314
hgcal::association
std::tuple< layerClusterToCaloParticle, caloParticleToLayerCluster > association
Definition: LayerClusterAssociatorByEnergyScoreImpl.h:44
edm::ThinnedAssociationBranches::isSlimmed
bool isSlimmed() const
Definition: ThinnedAssociationsHelper.h:26
edm::ThinnedAssociationsHelper::parentBegin
std::vector< ThinnedAssociationBranches >::const_iterator parentBegin(BranchID const &) const
Definition: ThinnedAssociationsHelper.cc:28
edm::ThinnedAssociationsHelper::initAssociationsFromSecondary
void initAssociationsFromSecondary(std::vector< BranchID > const &, ThinnedAssociationsHelper const &)
Definition: ThinnedAssociationsHelper.cc:337
edm::ThinnedAssociationsHelper::lower_bound
std::vector< ThinnedAssociationBranches >::const_iterator lower_bound(ThinnedAssociationBranches const &branches) const
Definition: ThinnedAssociationsHelper.cc:50
edm::ThinnedAssociationBranches::operator<
bool operator<(ThinnedAssociationBranches const &rhs) const
Definition: ThinnedAssociationsHelper.h:28
edm::ThinnedAssociationsHelper::associationToBranches
std::vector< std::pair< BranchID, ThinnedAssociationBranches const * > > associationToBranches() const
Definition: ThinnedAssociationsHelper.cc:176
edm::ThinnedAssociationBranches::ThinnedAssociationBranches
ThinnedAssociationBranches()
Definition: ThinnedAssociationsHelper.cc:10
edm::ThinnedAssociationsHelper::begin
std::vector< ThinnedAssociationBranches >::const_iterator begin() const
Definition: ThinnedAssociationsHelper.cc:20