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 
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:42
CombinedSeedComparitor::init
void init(const edm::Event &ev, const edm::EventSetup &es) override
Definition: CombinedSeedComparitor.cc:44
TrajectoryStateOnSurface
Definition: TrajectoryStateOnSurface.h:16
CombinedSeedComparitor::CombinedSeedComparitor
CombinedSeedComparitor(const edm::ParameterSet &cfg, edm::ConsumesCollector &iC)
Definition: CombinedSeedComparitor.cc:25
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:47
SeedComparitorFactory.h
CombinedSeedComparitor::comparitors_
std::vector< std::unique_ptr< SeedComparitor > > comparitors_
Definition: CombinedSeedComparitor.cc:21
edmplugin::PluginFactory
Definition: PluginFactory.h:34
CombinedSeedComparitor::compatible
bool compatible(const SeedingHitSet &hits) const override
Definition: CombinedSeedComparitor.cc:50
CombinedSeedComparitor
Definition: CombinedSeedComparitor.cc:9
edm::EventSetup
Definition: EventSetup.h:57
get
#define get
looper.cfg
cfg
Definition: looper.py:297
CombinedSeedComparitor::isAnd_
bool isAnd_
Definition: CombinedSeedComparitor.cc:22
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:45
hit
Definition: SiStripHitEffFromCalibTree.cc:88