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 
25  std::string mode = cfg.getParameter<std::string>("mode");
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 
hfClusterShapes_cfi.hits
hits
Definition: hfClusterShapes_cfi.py:5
SeedingHitSet
Definition: SeedingHitSet.h:6
FastHelix
Definition: FastHelix.h:26
SeedingHitSet::ConstRecHitPointer
BaseTrackerRecHit const * ConstRecHitPointer
Definition: SeedingHitSet.h:10
ALCARECOPromptCalibProdSiPixelAli0T_cff.mode
mode
Definition: ALCARECOPromptCalibProdSiPixelAli0T_cff.py:96
beamerCreator.create
def create(alignables, pedeDump, additionalData, outputFile, config)
Definition: beamerCreator.py:44
CombinedSeedComparitor::~CombinedSeedComparitor
~CombinedSeedComparitor() override
Definition: CombinedSeedComparitor.cc:41
CombinedSeedComparitor::init
void init(const edm::Event &ev, const edm::EventSetup &es) override
Definition: CombinedSeedComparitor.cc:43
TrajectoryStateOnSurface
Definition: TrajectoryStateOnSurface.h:16
CombinedSeedComparitor::CombinedSeedComparitor
CombinedSeedComparitor(const edm::ParameterSet &cfg, edm::ConsumesCollector &iC)
Definition: CombinedSeedComparitor.cc:24
SeedComparitor
Definition: SeedComparitor.h:25
GlobalTrajectoryParameters
Definition: GlobalTrajectoryParameters.h:15
DEFINE_EDM_PLUGIN
#define DEFINE_EDM_PLUGIN(factory, type, name)
Definition: PluginFactory.h:124
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ParameterSet
Definition: ParameterSet.h:36
SeedComparitorFactory.h
edmplugin::PluginFactory
Definition: PluginFactory.h:34
CombinedSeedComparitor::compatible
bool compatible(const SeedingHitSet &hits) const override
Definition: CombinedSeedComparitor.cc:50
CombinedSeedComparitor
Definition: CombinedSeedComparitor.cc:8
edm::EventSetup
Definition: EventSetup.h:57
get
#define get
CombinedSeedComparitor::comparitors_
boost::ptr_vector< SeedComparitor > comparitors_
Definition: CombinedSeedComparitor.cc:20
looper.cfg
cfg
Definition: looper.py:297
CombinedSeedComparitor::isAnd_
bool isAnd_
Definition: CombinedSeedComparitor.cc:21
SeedComparitor.h
HistogramManager_cfi.VPSet
def VPSet(*args)
Definition: HistogramManager_cfi.py:401
ev
bool ev
Definition: Hydjet2Hadronizer.cc:95
Exception
Definition: hltDiff.cc:246
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
Exception.h
ParameterSet.h
edm::Event
Definition: Event.h:73
edm::ConsumesCollector
Definition: ConsumesCollector.h:39
hit
Definition: SiStripHitEffFromCalibTree.cc:88