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  bool compatible(const SeedingHitSet &hits,
16  const GlobalTrajectoryParameters &helixStateAtVertex,
17  const FastHelix &helix) const override;
18 
19 private:
20  boost::ptr_vector<SeedComparitor> comparitors_;
21  bool isAnd_;
22 };
23 
26  if (mode == "and")
27  isAnd_ = true;
28  else if (mode == "or")
29  isAnd_ = false;
30  else
31  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 
44  typedef boost::ptr_vector<SeedComparitor>::iterator ITC;
45  for (ITC it = comparitors_.begin(), ed = comparitors_.end(); it != ed; ++it) {
46  it->init(ev, es);
47  }
48 }
49 
51  typedef boost::ptr_vector<SeedComparitor>::const_iterator ITC;
52  for (ITC it = comparitors_.begin(), ed = comparitors_.end(); it != ed; ++it) {
53  bool pass = it->compatible(hits);
54  if (isAnd_ != pass)
55  return pass; // break on failures if doing an AND, and on successes if doing an OR
56  }
57  return isAnd_; // if we arrive here, we have no successes for OR, and no failures for AND
58 }
59 
62  typedef boost::ptr_vector<SeedComparitor>::const_iterator ITC;
63  for (ITC it = comparitors_.begin(), ed = comparitors_.end(); it != ed; ++it) {
64  bool pass = it->compatible(tsos, hit);
65  if (isAnd_ != pass)
66  return pass; // break on failures if doing an AND, and on successes if doing an OR
67  }
68  return isAnd_; // if we arrive here, we have no successes for OR, and no failures for AND
69 }
70 
72  const GlobalTrajectoryParameters &helixStateAtVertex,
73  const FastHelix &helix) const {
74  typedef boost::ptr_vector<SeedComparitor>::const_iterator ITC;
75  for (ITC it = comparitors_.begin(), ed = comparitors_.end(); it != ed; ++it) {
76  bool pass = it->compatible(hits, helixStateAtVertex, helix);
77  if (isAnd_ != pass)
78  return pass; // break on failures if doing an AND, and on successes if doing an OR
79  }
80  return isAnd_; // if we arrive here, we have no successes for OR, and no failures for AND
81 }
82 
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:10
void init(const edm::Event &ev, const edm::EventSetup &es) override
#define DEFINE_EDM_PLUGIN(factory, type, name)
boost::ptr_vector< SeedComparitor > comparitors_
CombinedSeedComparitor(const edm::ParameterSet &cfg, edm::ConsumesCollector &iC)