CMS 3D CMS Logo

CombinedSeedComparitor.cc
Go to the documentation of this file.
5 
6 #include <vector>
7 #include <memory>
8 
10 public:
12  ~CombinedSeedComparitor() override;
13  void init(const edm::Event &ev, const edm::EventSetup &es) override;
14  bool compatible(const SeedingHitSet &hits) const override;
16  bool compatible(const SeedingHitSet &hits,
17  const GlobalTrajectoryParameters &helixStateAtVertex,
18  const FastHelix &helix) const override;
19 
20 private:
21  std::vector<std::unique_ptr<SeedComparitor>> comparitors_;
22  bool isAnd_;
23 };
24 
26  std::string mode = cfg.getParameter<std::string>("mode");
27  if (mode == "and")
28  isAnd_ = true;
29  else if (mode == "or")
30  isAnd_ = false;
31  else
32  throw cms::Exception("Configuration", "Parameter 'mode' of CombinedSeedComparitor must be either 'and' or 'or'\n");
33 
34  typedef std::vector<edm::ParameterSet> VPSet;
35  VPSet psets = cfg.getParameter<VPSet>("comparitors");
36  for (VPSet::const_iterator it = psets.begin(), ed = psets.end(); it != ed; ++it) {
37  std::string name = it->getParameter<std::string>("ComponentName");
38  comparitors_.emplace_back(SeedComparitorFactory::get()->create(name, *it, iC));
39  }
40 }
41 
43 
45  for (const auto &it : comparitors_) {
46  it->init(ev, es);
47  }
48 }
49 
51  for (const auto &it : comparitors_) {
52  bool pass = it->compatible(hits);
53  if (isAnd_ != pass)
54  return pass; // break on failures if doing an AND, and on successes if doing an OR
55  }
56  return isAnd_; // if we arrive here, we have no successes for OR, and no failures for AND
57 }
58 
61  for (const auto &it : comparitors_) {
62  bool pass = it->compatible(tsos, hit);
63  if (isAnd_ != pass)
64  return pass; // break on failures if doing an AND, and on successes if doing an OR
65  }
66  return isAnd_; // if we arrive here, we have no successes for OR, and no failures for AND
67 }
68 
70  const GlobalTrajectoryParameters &helixStateAtVertex,
71  const FastHelix &helix) const {
72  for (const auto &it : comparitors_) {
73  bool pass = it->compatible(hits, helixStateAtVertex, helix);
74  if (isAnd_ != pass)
75  return pass; // break on failures if doing an AND, and on successes if doing an OR
76  }
77  return isAnd_; // if we arrive here, we have no successes for OR, and no failures for AND
78 }
79 
def create(alignables, pedeDump, additionalData, outputFile, config)
bool compatible(const SeedingHitSet &hits) const override
BaseTrackerRecHit const * ConstRecHitPointer
Definition: SeedingHitSet.h:14
void init(const edm::Event &ev, const edm::EventSetup &es) override
std::vector< std::unique_ptr< SeedComparitor > > comparitors_
#define DEFINE_EDM_PLUGIN(factory, type, name)
#define get
CombinedSeedComparitor(const edm::ParameterSet &cfg, edm::ConsumesCollector &iC)