CMS 3D CMS Logo

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

Public Member Functions

 MTDRecHitProducer (const edm::ParameterSet &ps)
 
void produce (edm::Event &evt, const edm::EventSetup &es) override
 
 ~MTDRecHitProducer () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () const final
 

Private Attributes

std::unique_ptr< MTDRecHitAlgoBasebarrel_
 
std::unique_ptr< MTDRecHitAlgoBaseendcap_
 
const std::string ftlbInstance_
 
const edm::EDGetTokenT< FTLUncalibratedRecHitCollectionftlbURecHits_
 
const std::string ftleInstance_
 
const edm::EDGetTokenT< FTLUncalibratedRecHitCollectionftleURecHits_
 
const MTDGeometrygeom_
 

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

Definition at line 22 of file MTDRecHitProducer.cc.

Constructor & Destructor Documentation

MTDRecHitProducer::MTDRecHitProducer ( const edm::ParameterSet ps)
explicit

Definition at line 42 of file MTDRecHitProducer.cc.

References Reference_intrackfit_cff::barrel, barrel_, makeMuonMisalignmentScenario::endcap, endcap_, ftlbInstance_, ftleInstance_, reco::get(), edm::ParameterSet::getParameter(), edm::ParameterSet::getParameterSet(), and AlCaHLTBitMon_QueryRunRegistry::string.

42  :
43  ftlbURecHits_( consumes<FTLUncalibratedRecHitCollection>( ps.getParameter<edm::InputTag>("barrelUncalibratedRecHits") ) ),
44  ftleURecHits_( consumes<FTLUncalibratedRecHitCollection>( ps.getParameter<edm::InputTag>("endcapUncalibratedRecHits") ) ),
45  ftlbInstance_( ps.getParameter<std::string>("BarrelHitsName") ),
46  ftleInstance_( ps.getParameter<std::string>("EndcapHitsName") )
47 {
48 
49  produces< FTLRecHitCollection >(ftlbInstance_);
50  produces< FTLRecHitCollection >(ftleInstance_);
51 
52  auto sumes = consumesCollector();
53 
54  const edm::ParameterSet& barrel = ps.getParameterSet("barrel");
55  const std::string& barrelAlgo = barrel.getParameter<std::string>("algoName");
56  barrel_ = std::unique_ptr<MTDRecHitAlgoBase>{ MTDRecHitAlgoFactory::get()->create(barrelAlgo, barrel, sumes) };
57 
58  const edm::ParameterSet& endcap = ps.getParameterSet("endcap");
59  const std::string& endcapAlgo = endcap.getParameter<std::string>("algoName");
60  endcap_ = std::unique_ptr<MTDRecHitAlgoBase>{ MTDRecHitAlgoFactory::get()->create(endcapAlgo, endcap, sumes) };
61 
62 }
T getParameter(std::string const &) const
std::unique_ptr< MTDRecHitAlgoBase > endcap_
const edm::EDGetTokenT< FTLUncalibratedRecHitCollection > ftleURecHits_
const std::string ftleInstance_
const std::string ftlbInstance_
ParameterSet const & getParameterSet(std::string const &) const
std::unique_ptr< MTDRecHitAlgoBase > barrel_
const edm::EDGetTokenT< FTLUncalibratedRecHitCollection > ftlbURecHits_
T get(const Candidate &c)
Definition: component.h:55
MTDRecHitProducer::~MTDRecHitProducer ( )
override

Definition at line 64 of file MTDRecHitProducer.cc.

64  {
65 }

Member Function Documentation

void MTDRecHitProducer::produce ( edm::Event evt,
const edm::EventSetup es 
)
override

Definition at line 68 of file MTDRecHitProducer.cc.

References barrel_, DEFINE_FWK_MODULE, endcap_, flags, ftlbInstance_, ftlbURecHits_, ftleInstance_, ftleURecHits_, relativeConstraints::geom, geom_, edm::EventSetup::get(), edm::Event::getByToken(), FTLRecHit::kGood, eostools::move(), edm::ESHandle< T >::product(), edm::Event::put(), and edm::SortedCollection< T, SORT >::size().

68  {
69 
71  es.get<MTDDigiGeometryRecord>().get(geom);
72  geom_ = geom.product();
73 
74  // tranparently get things from event setup
75  barrel_->getEventSetup(es);
76  endcap_->getEventSetup(es);
77 
78  barrel_->getEvent(evt);
79  endcap_->getEvent(evt);
80 
81  // prepare output
82  auto barrelRechits = std::make_unique<FTLRecHitCollection>();
83  auto endcapRechits = std::make_unique<FTLRecHitCollection>();
84 
86  evt.getByToken( ftlbURecHits_, hBarrel );
87  barrelRechits->reserve(hBarrel->size()/2);
88  for(const auto& uhit : *hBarrel) {
89  uint32_t flags = FTLRecHit::kGood;
90  auto rechit = barrel_->makeRecHit(uhit, flags);
91  if( flags == FTLRecHit::kGood ) barrelRechits->push_back( std::move(rechit) );
92  }
93 
95  evt.getByToken( ftleURecHits_, hEndcap );
96  endcapRechits->reserve(hEndcap->size()/2);
97  for(const auto& uhit : *hEndcap) {
98  uint32_t flags = FTLRecHit::kGood;
99  auto rechit = endcap_->makeRecHit(uhit, flags);
100  if( flags == FTLRecHit::kGood ) endcapRechits->push_back( std::move(rechit) );
101  }
102 
103  // put the collection of recunstructed hits in the event
104  // get the orphan handles so we can make refs for the tracking rechits
105  auto barrelHandle = evt.put(std::move(barrelRechits), ftlbInstance_);
106  auto endcapHandle = evt.put(std::move(endcapRechits), ftleInstance_);
107 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:125
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
std::vector< Variable::Flags > flags
Definition: MVATrainer.cc:135
std::unique_ptr< MTDRecHitAlgoBase > endcap_
const edm::EDGetTokenT< FTLUncalibratedRecHitCollection > ftleURecHits_
const MTDGeometry * geom_
const std::string ftleInstance_
const std::string ftlbInstance_
size_type size() const
T get() const
Definition: EventSetup.h:71
std::unique_ptr< MTDRecHitAlgoBase > barrel_
const edm::EDGetTokenT< FTLUncalibratedRecHitCollection > ftlbURecHits_
T const * product() const
Definition: ESHandle.h:86
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

std::unique_ptr<MTDRecHitAlgoBase> MTDRecHitProducer::barrel_
private

Definition at line 37 of file MTDRecHitProducer.cc.

Referenced by MTDRecHitProducer(), and produce().

std::unique_ptr<MTDRecHitAlgoBase> MTDRecHitProducer::endcap_
private

Definition at line 37 of file MTDRecHitProducer.cc.

Referenced by MTDRecHitProducer(), and produce().

const std::string MTDRecHitProducer::ftlbInstance_
private

Definition at line 34 of file MTDRecHitProducer.cc.

Referenced by MTDRecHitProducer(), and produce().

const edm::EDGetTokenT<FTLUncalibratedRecHitCollection> MTDRecHitProducer::ftlbURecHits_
private

Definition at line 31 of file MTDRecHitProducer.cc.

Referenced by produce().

const std::string MTDRecHitProducer::ftleInstance_
private

Definition at line 35 of file MTDRecHitProducer.cc.

Referenced by MTDRecHitProducer(), and produce().

const edm::EDGetTokenT<FTLUncalibratedRecHitCollection> MTDRecHitProducer::ftleURecHits_
private

Definition at line 32 of file MTDRecHitProducer.cc.

Referenced by produce().

const MTDGeometry* MTDRecHitProducer::geom_
private

Definition at line 39 of file MTDRecHitProducer.cc.

Referenced by produce().