CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Attributes
CAHitNtupletEDProducerT< T_Generator > Class Template Reference
Inheritance diagram for CAHitNtupletEDProducerT< T_Generator >:
edm::stream::EDProducer<>

Public Member Functions

 CAHitNtupletEDProducerT (const edm::ParameterSet &iConfig)
 
void produce (edm::Event &iEvent, const edm::EventSetup &iSetup) override
 
 ~CAHitNtupletEDProducerT () override=default
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () const final
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Attributes

edm::EDGetTokenT< IntermediateHitDoubletsdoubletToken_
 
T_Generator generator_
 
edm::RunningAverage localRA_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 

Detailed Description

template<typename T_Generator>
class CAHitNtupletEDProducerT< T_Generator >

Definition at line 25 of file CAHitNtupletEDProducerT.cc.

Constructor & Destructor Documentation

template<typename T_Generator >
CAHitNtupletEDProducerT< T_Generator >::CAHitNtupletEDProducerT ( const edm::ParameterSet iConfig)

Definition at line 43 of file CAHitNtupletEDProducerT.cc.

43  :
44  doubletToken_(consumes<IntermediateHitDoublets>(iConfig.getParameter<edm::InputTag>("doublets"))),
45  generator_(iConfig, consumesCollector())
46 {
47  produces<RegionsSeedingHitSets>();
48 }
T getParameter(std::string const &) const
edm::EDGetTokenT< IntermediateHitDoublets > doubletToken_
template<typename T_Generator >
CAHitNtupletEDProducerT< T_Generator >::~CAHitNtupletEDProducerT ( )
overridedefault

Member Function Documentation

template<typename T_Generator >
void CAHitNtupletEDProducerT< T_Generator >::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 51 of file CAHitNtupletEDProducerT.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), fillDescriptions(), diffTwoXMLs::label, and AlCaHLTBitMon_QueryRunRegistry::string.

51  {
53 
54  desc.add<edm::InputTag>("doublets", edm::InputTag("hitPairEDProducer"));
56 
57  auto label = T_Generator::fillDescriptionsLabel() + std::string("EDProducer");
58  descriptions.add(label, desc);
59 }
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
template<typename T_Generator >
void CAHitNtupletEDProducerT< T_Generator >::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
override

Definition at line 62 of file CAHitNtupletEDProducerT.cc.

References CAHitNtupletEDProducerT< T_Generator >::doubletToken_, Exception, CAHitNtupletEDProducerT< T_Generator >::generator_, edm::Event::getByToken(), CAHitNtupletEDProducerT< T_Generator >::localRA_, LogDebug, dt1dClusters_cfi::minLayers, eostools::move(), SeedingLayerSetsHits::numberOfLayersInSet(), edm::Event::put(), HiRegitMuonDetachedTripletStep_cff::seedingHitSets, edm::RunningAverage::update(), and edm::RunningAverage::upper().

62  {
64  iEvent.getByToken(doubletToken_, hdoublets);
65  const auto& regionDoublets = *hdoublets;
66 
67  const SeedingLayerSetsHits& seedingLayerHits = regionDoublets.seedingLayerHits();
68  if(seedingLayerHits.numberOfLayersInSet() < T_Generator::minLayers) {
69  throw cms::Exception("LogicError") << "CAHitNtupletEDProducer expects SeedingLayerSetsHits::numberOfLayersInSet() to be >= " << T_Generator::minLayers << ", got " << seedingLayerHits.numberOfLayersInSet() << ". This is likely caused by a configuration error of this module, HitPairEDProducer, or SeedingLayersEDProducer.";
70  }
71 
72  auto seedingHitSets = std::make_unique<RegionsSeedingHitSets>();
73  if(regionDoublets.empty()) {
74  iEvent.put(std::move(seedingHitSets));
75  return;
76  }
77  seedingHitSets->reserve(regionDoublets.regionSize(), localRA_.upper());
78  generator_.initEvent(iEvent, iSetup);
79 
80  LogDebug("CAHitNtupletEDProducer") << "Creating ntuplets for " << regionDoublets.regionSize() << " regions, and " << regionDoublets.layerPairsSize() << " layer pairs";
81  std::vector<OrderedHitSeeds> ntuplets;
82  ntuplets.resize(regionDoublets.regionSize());
83  for(auto& ntuplet : ntuplets) ntuplet.reserve(localRA_.upper());
84 
85  generator_.hitNtuplets(regionDoublets, ntuplets, iSetup, seedingLayerHits);
86  int index = 0;
87  for(const auto& regionLayerPairs: regionDoublets) {
88  const TrackingRegion& region = regionLayerPairs.region();
89  auto seedingHitSetsFiller = seedingHitSets->beginRegion(&region);
90 
91  fillNtuplets(seedingHitSetsFiller, ntuplets[index]);
92  ntuplets[index].clear();
93  index++;
94  }
96 
97  iEvent.put(std::move(seedingHitSets));
98 }
#define LogDebug(id)
unsigned short numberOfLayersInSet() const
Get number of layers in each SeedingLayerSets.
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:137
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:579
int upper() const
edm::EDGetTokenT< IntermediateHitDoublets > doubletToken_
def move(src, dest)
Definition: eostools.py:510
void update(unsigned int q)

Member Data Documentation

template<typename T_Generator >
edm::EDGetTokenT<IntermediateHitDoublets> CAHitNtupletEDProducerT< T_Generator >::doubletToken_
private
template<typename T_Generator >
T_Generator CAHitNtupletEDProducerT< T_Generator >::generator_
private
template<typename T_Generator >
edm::RunningAverage CAHitNtupletEDProducerT< T_Generator >::localRA_
private