CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CombinedHitQuadrupletGenerator.cc
Go to the documentation of this file.
2 
8 #include "LayerQuadruplets.h"
12 
13 
14 using namespace std;
15 using namespace ctfseeding;
16 
18  theSeedingLayerToken(iC.consumes<SeedingLayerSetsHits>(cfg.getParameter<edm::InputTag>("SeedingLayers")))
19 {
20  edm::ParameterSet generatorPSet = cfg.getParameter<edm::ParameterSet>("GeneratorPSet");
21  std::string generatorName = generatorPSet.getParameter<std::string>("ComponentName");
22  edm::ParameterSet tripletGeneratorPSet = cfg.getParameter<edm::ParameterSet>("TripletGeneratorPSet");
23  std::string tripletGeneratorName = tripletGeneratorPSet.getParameter<std::string>("ComponentName");
24 
25  std::unique_ptr<HitTripletGeneratorFromPairAndLayers> tripletGenerator(HitTripletGeneratorFromPairAndLayersFactory::get()->create(tripletGeneratorName, tripletGeneratorPSet, iC));
26  // Some CPU wasted here because same pairs are generated multiple times
27  tripletGenerator->init(std::make_unique<HitPairGeneratorFromLayerPair>(0, 1, &theLayerCache), &theLayerCache);
28 
29  theGenerator.reset(HitQuadrupletGeneratorFromTripletAndLayersFactory::get()->create(generatorName, generatorPSet, iC));
30  theGenerator->init(std::move(tripletGenerator), &theLayerCache);
31 }
32 
34 
37  const edm::Event& ev, const edm::EventSetup& es)
38 {
40  ev.getByToken(theSeedingLayerToken, hlayers);
41  const SeedingLayerSetsHits& layers = *hlayers;
42  if(layers.numberOfLayersInSet() != 4)
43  throw cms::Exception("Configuration") << "CombinedHitQuadrupletsGenerator expects SeedingLayerSetsHits::numberOfLayersInSet() to be 4, got " << layers.numberOfLayersInSet();
44 
45  std::vector<LayerQuadruplets::LayerSetAndLayers> quadlayers = LayerQuadruplets::layers(layers);
46  for(const auto& tripletAndLayers: quadlayers) {
47  theGenerator->hitQuadruplets(region, result, ev, es, tripletAndLayers.first, tripletAndLayers.second);
48  }
50 }
T getParameter(std::string const &) const
unsigned short numberOfLayersInSet() const
Get number of layers in each SeedingLayerSets.
tuple cfg
Definition: looper.py:293
std::vector< LayerSetAndLayers > layers(const SeedingLayerSetsHits &sets)
Definition: LayerTriplets.cc:4
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:457
CombinedHitQuadrupletGenerator(const edm::ParameterSet &cfg, edm::ConsumesCollector &iC)
bool ev
tuple result
Definition: mps_fire.py:84
def move
Definition: eostools.py:510
std::unique_ptr< HitQuadrupletGeneratorFromTripletAndLayers > theGenerator
edm::EDGetTokenT< SeedingLayerSetsHits > theSeedingLayerToken
std::vector< LayerSetAndLayers > layers(const SeedingLayerSetsHits &sets)
T get(const Candidate &c)
Definition: component.h:55
virtual void hitQuadruplets(const TrackingRegion &reg, OrderedHitSeeds &triplets, const edm::Event &ev, const edm::EventSetup &es)
from base class