CMS 3D CMS Logo

CombinedSeedComparitor.cc
Go to the documentation of this file.
5 
6 #include <boost/ptr_container/ptr_vector.hpp>
7 
9  public:
11  ~CombinedSeedComparitor() override ;
12  void init(const edm::Event& ev, const edm::EventSetup& es) override ;
13  bool compatible(const SeedingHitSet &hits) const override ;
15  SeedingHitSet::ConstRecHitPointer hit) const override ;
16  bool compatible(const SeedingHitSet &hits,
17  const GlobalTrajectoryParameters &helixStateAtVertex,
18  const FastHelix &helix) const override ;
19 
20  private:
21  boost::ptr_vector<SeedComparitor> comparitors_;
22  bool isAnd_;
23 };
24 
25 
27 {
29  if (mode == "and") isAnd_ = true;
30  else if (mode == "or") isAnd_ = false;
31  else throw cms::Exception("Configuration", "Parameter 'mode' of CombinedSeedComparitor must be either 'and' or 'or'\n");
32 
33  typedef std::vector<edm::ParameterSet> VPSet;
34  VPSet psets = cfg.getParameter<VPSet>("comparitors");
35  for (VPSet::const_iterator it = psets.begin(), ed = psets.end(); it != ed; ++it) {
36  std::string name = it->getParameter<std::string>("ComponentName");
37  comparitors_.push_back(SeedComparitorFactory::get()->create(name, *it, iC));
38  }
39 }
40 
42 {
43 }
44 
45 void
47  typedef boost::ptr_vector<SeedComparitor>::iterator ITC;
48  for (ITC it = comparitors_.begin(), ed = comparitors_.end(); it != ed; ++it) {
49  it->init(ev, es);
50  }
51 }
52 
53 bool
55 {
56  typedef boost::ptr_vector<SeedComparitor>::const_iterator ITC;
57  for (ITC it = comparitors_.begin(), ed = comparitors_.end(); it != ed; ++it) {
58  bool pass = it->compatible(hits);
59  if (isAnd_ != pass) return pass; // break on failures if doing an AND, and on successes if doing an OR
60  }
61  return isAnd_; // if we arrive here, we have no successes for OR, and no failures for AND
62 }
63 
64 bool
67 {
68  typedef boost::ptr_vector<SeedComparitor>::const_iterator ITC;
69  for (ITC it = comparitors_.begin(), ed = comparitors_.end(); it != ed; ++it) {
70  bool pass = it->compatible(tsos, hit);
71  if (isAnd_ != pass) return pass; // break on failures if doing an AND, and on successes if doing an OR
72  }
73  return isAnd_; // if we arrive here, we have no successes for OR, and no failures for AND
74 }
75 
76 bool
78  const GlobalTrajectoryParameters &helixStateAtVertex,
79  const FastHelix &helix) const
80 {
81  typedef boost::ptr_vector<SeedComparitor>::const_iterator ITC;
82  for (ITC it = comparitors_.begin(), ed = comparitors_.end(); it != ed; ++it) {
83  bool pass = it->compatible(hits, helixStateAtVertex, helix);
84  if (isAnd_ != pass) return pass; // break on failures if doing an AND, and on successes if doing an OR
85  }
86  return isAnd_; // if we arrive here, we have no successes for OR, and no failures for AND
87 }
88 
89 
T getParameter(std::string const &) const
bool compatible(const SeedingHitSet &hits) const override
def create(alignables, pedeDump, additionalData, outputFile, config)
bool ev
BaseTrackerRecHit const * ConstRecHitPointer
Definition: SeedingHitSet.h:11
void init(const edm::Event &ev, const edm::EventSetup &es) override
#define DEFINE_EDM_PLUGIN(factory, type, name)
boost::ptr_vector< SeedComparitor > comparitors_
T get(const Candidate &c)
Definition: component.h:55
CombinedSeedComparitor(const edm::ParameterSet &cfg, edm::ConsumesCollector &iC)