CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CombinedSeedComparitor.cc
Go to the documentation of this file.
5 
6 #include <boost/ptr_container/ptr_vector.hpp>
7 
9  public:
11  virtual ~CombinedSeedComparitor() ;
12  virtual void init(const edm::Event& ev, const edm::EventSetup& es) override ;
13  virtual bool compatible(const SeedingHitSet &hits, const TrackingRegion & region) const override ;
14  virtual bool compatible(const TrajectorySeed &seed) const override ;
15  virtual bool compatible(const TrajectoryStateOnSurface &,
16  SeedingHitSet::ConstRecHitPointer hit) const override ;
17  virtual bool compatible(const SeedingHitSet &hits,
18  const GlobalTrajectoryParameters &helixStateAtVertex,
19  const FastHelix &helix,
20  const TrackingRegion & region) const override ;
21  virtual bool compatible(const SeedingHitSet &hits,
22  const GlobalTrajectoryParameters &straightLineStateAtVertex,
23  const TrackingRegion & region) const override ;
24 
25  private:
26  boost::ptr_vector<SeedComparitor> comparitors_;
27  bool isAnd_;
28 };
29 
30 
32 {
34  if (mode == "and") isAnd_ = true;
35  else if (mode == "or") isAnd_ = false;
36  else throw cms::Exception("Configuration", "Parameter 'mode' of CombinedSeedComparitor must be either 'and' or 'or'\n");
37 
38  typedef std::vector<edm::ParameterSet> VPSet;
39  VPSet psets = cfg.getParameter<VPSet>("comparitors");
40  for (VPSet::const_iterator it = psets.begin(), ed = psets.end(); it != ed; ++it) {
41  std::string name = it->getParameter<std::string>("ComponentName");
42  comparitors_.push_back(SeedComparitorFactory::get()->create(name, *it, iC));
43  }
44 }
45 
47 {
48 }
49 
50 void
52  typedef boost::ptr_vector<SeedComparitor>::iterator ITC;
53  for (ITC it = comparitors_.begin(), ed = comparitors_.end(); it != ed; ++it) {
54  it->init(ev, es);
55  }
56 }
57 
58 bool
60 {
61  typedef boost::ptr_vector<SeedComparitor>::const_iterator ITC;
62  for (ITC it = comparitors_.begin(), ed = comparitors_.end(); it != ed; ++it) {
63  bool pass = it->compatible(hits, region);
64  if (isAnd_ != pass) 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 
69 bool
71 {
72  typedef boost::ptr_vector<SeedComparitor>::const_iterator ITC;
73  for (ITC it = comparitors_.begin(), ed = comparitors_.end(); it != ed; ++it) {
74  bool pass = it->compatible(seed);
75  if (isAnd_ != pass) 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 
80 bool
83 {
84  typedef boost::ptr_vector<SeedComparitor>::const_iterator ITC;
85  for (ITC it = comparitors_.begin(), ed = comparitors_.end(); it != ed; ++it) {
86  bool pass = it->compatible(tsos, hit);
87  if (isAnd_ != pass) return pass; // break on failures if doing an AND, and on successes if doing an OR
88  }
89  return isAnd_; // if we arrive here, we have no successes for OR, and no failures for AND
90 }
91 
92 bool
94  const GlobalTrajectoryParameters &helixStateAtVertex,
95  const FastHelix &helix,
96  const TrackingRegion & region) const
97 {
98  typedef boost::ptr_vector<SeedComparitor>::const_iterator ITC;
99  for (ITC it = comparitors_.begin(), ed = comparitors_.end(); it != ed; ++it) {
100  bool pass = it->compatible(hits, helixStateAtVertex, helix, region);
101  if (isAnd_ != pass) return pass; // break on failures if doing an AND, and on successes if doing an OR
102  }
103  return isAnd_; // if we arrive here, we have no successes for OR, and no failures for AND
104 }
105 
106 bool
108  const GlobalTrajectoryParameters &straightLineStateAtVertex,
109  const TrackingRegion & region) const
110 {
111  typedef boost::ptr_vector<SeedComparitor>::const_iterator ITC;
112  for (ITC it = comparitors_.begin(), ed = comparitors_.end(); it != ed; ++it) {
113  bool pass = it->compatible(hits, straightLineStateAtVertex, region);
114  if (isAnd_ != pass) return pass; // break on failures if doing an AND, and on successes if doing an OR
115  }
116  return isAnd_; // if we arrive here, we have no successes for OR, and no failures for AND
117 }
118 
119 
T getParameter(std::string const &) const
tuple cfg
Definition: looper.py:259
bool ev
BaseTrackerRecHit const * ConstRecHitPointer
Definition: SeedingHitSet.h:11
virtual void init(const edm::Event &ev, const edm::EventSetup &es) override
#define DEFINE_EDM_PLUGIN(factory, type, name)
virtual bool compatible(const SeedingHitSet &hits, const TrackingRegion &region) const override
boost::ptr_vector< SeedComparitor > comparitors_
SurfaceDeformation * create(int type, const std::vector< double > &params)
T get(const Candidate &c)
Definition: component.h:55
CombinedSeedComparitor(const edm::ParameterSet &cfg, edm::ConsumesCollector &iC)