CMS 3D CMS Logo

MTDRecHitProducer.cc
Go to the documentation of this file.
5 
9 
11 
19 
21 
23 public:
24  explicit MTDRecHitProducer(const edm::ParameterSet& ps);
25  ~MTDRecHitProducer() override;
26  void produce(edm::Event& evt, const edm::EventSetup& es) override;
27 
28 private:
31 
32  const std::string ftlbInstance_; // instance name of barrel hits
33  const std::string ftleInstance_; // instance name of endcap hits
34 
35  std::unique_ptr<MTDRecHitAlgoBase> barrel_, endcap_;
36 
39 };
40 
42  : ftlbURecHits_(
43  consumes<FTLUncalibratedRecHitCollection>(ps.getParameter<edm::InputTag>("barrelUncalibratedRecHits"))),
44  ftleURecHits_(
45  consumes<FTLUncalibratedRecHitCollection>(ps.getParameter<edm::InputTag>("endcapUncalibratedRecHits"))),
46  ftlbInstance_(ps.getParameter<std::string>("BarrelHitsName")),
47  ftleInstance_(ps.getParameter<std::string>("EndcapHitsName")) {
48  produces<FTLRecHitCollection>(ftlbInstance_);
49  produces<FTLRecHitCollection>(ftleInstance_);
50 
51  auto sumes = consumesCollector();
52  mtdgeoToken_ = esConsumes<MTDGeometry, MTDDigiGeometryRecord>();
53 
54  const edm::ParameterSet& barrel = ps.getParameterSet("barrel");
55  const std::string& barrelAlgo = barrel.getParameter<std::string>("algoName");
56  barrel_ = 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_ = MTDRecHitAlgoFactory::get()->create(endcapAlgo, endcap, sumes);
61 }
62 
64 
67  geom_ = geom.product();
68 
69  // tranparently get things from event setup
70  barrel_->getEventSetup(es);
71  endcap_->getEventSetup(es);
72 
73  barrel_->getEvent(evt);
74  endcap_->getEvent(evt);
75 
76  // prepare output
77  auto barrelRechits = std::make_unique<FTLRecHitCollection>();
78  auto endcapRechits = std::make_unique<FTLRecHitCollection>();
79 
81  evt.getByToken(ftlbURecHits_, hBarrel);
82  barrelRechits->reserve(hBarrel->size() / 2);
83  for (const auto& uhit : *hBarrel) {
84  uint32_t flags = FTLRecHit::kGood;
85  auto rechit = barrel_->makeRecHit(uhit, flags);
86  if (flags == FTLRecHit::kGood)
87  barrelRechits->push_back(rechit);
88  }
89 
91  evt.getByToken(ftleURecHits_, hEndcap);
92  endcapRechits->reserve(hEndcap->size() / 2);
93  for (const auto& uhit : *hEndcap) {
94  uint32_t flags = FTLRecHit::kGood;
95  auto rechit = endcap_->makeRecHit(uhit, flags);
96  if (flags == FTLRecHit::kGood)
97  endcapRechits->push_back(rechit);
98  }
99 
100  // put the collection of recunstructed hits in the event
101  // get the orphan handles so we can make refs for the tracking rechits
102  auto barrelHandle = evt.put(std::move(barrelRechits), ftlbInstance_);
103  auto endcapHandle = evt.put(std::move(endcapRechits), ftleInstance_);
104 }
105 
FTLDigiCollections.h
MTDRecHitAlgoBase.h
Handle.h
Reference_intrackfit_cff.barrel
list barrel
Definition: Reference_intrackfit_cff.py:37
MessageLogger.h
MTDRecHitProducer::barrel_
std::unique_ptr< MTDRecHitAlgoBase > barrel_
Definition: MTDRecHitProducer.cc:35
edm::EDGetTokenT
Definition: EDGetToken.h:33
edm
HLT enums.
Definition: AlignableModifier.h:19
MTDRecHitProducer
Definition: MTDRecHitProducer.cc:22
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89285
MTDGeometry.h
MeasurementError.h
MTDDigiGeometryRecord.h
EDProducer.h
edm::SortedCollection
Definition: SortedCollection.h:49
edm::SortedCollection::size
size_type size() const
Definition: SortedCollection.h:215
MTDRecHitProducer::~MTDRecHitProducer
~MTDRecHitProducer() override
Definition: MTDRecHitProducer.cc:63
makeMuonMisalignmentScenario.endcap
endcap
Definition: makeMuonMisalignmentScenario.py:320
edm::Handle
Definition: AssociativeIterator.h:50
MakerMacros.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
relativeConstraints.geom
geom
Definition: relativeConstraints.py:72
MTDRecHitProducer::ftlbInstance_
const std::string ftlbInstance_
Definition: MTDRecHitProducer.cc:32
edm::Event::getByToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:535
MTDRecHitProducer::mtdgeoToken_
edm::ESGetToken< MTDGeometry, MTDDigiGeometryRecord > mtdgeoToken_
Definition: MTDRecHitProducer.cc:38
MTDTrackingRecHit.h
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
MTDRecHitProducer::endcap_
std::unique_ptr< MTDRecHitAlgoBase > endcap_
Definition: MTDRecHitProducer.cc:35
MTDRecHitProducer::ftleURecHits_
const edm::EDGetTokenT< FTLUncalibratedRecHitCollection > ftleURecHits_
Definition: MTDRecHitProducer.cc:30
MTDRecHitProducer::produce
void produce(edm::Event &evt, const edm::EventSetup &es) override
Definition: MTDRecHitProducer.cc:65
edm::Event::put
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
MeasurementPoint.h
edm::stream::EDProducer
Definition: EDProducer.h:38
MTDRecHitProducer::ftlbURecHits_
const edm::EDGetTokenT< FTLUncalibratedRecHitCollection > ftlbURecHits_
Definition: MTDRecHitProducer.cc:29
MTDRecHitProducer::geom_
const MTDGeometry * geom_
Definition: MTDRecHitProducer.cc:37
edm::EventSetup
Definition: EventSetup.h:58
get
#define get
edm::EventSetup::getTransientHandle
ESTransientHandle< T > getTransientHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:166
FTLRecHit::kGood
Definition: FTLRecHit.h:21
edm::ESGetToken< MTDGeometry, MTDDigiGeometryRecord >
FTLRecHitCollections.h
MTDRecHitProducer::ftleInstance_
const std::string ftleInstance_
Definition: MTDRecHitProducer.cc:33
MTDGeometry
Definition: MTDGeometry.h:14
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
ESWatcher.h
EventSetup.h
ParameterSet.h
HLT_FULL_cff.flags
flags
Definition: HLT_FULL_cff.py:13150
edm::Event
Definition: Event.h:73
Topology.h
edm::ParameterSet::getParameterSet
ParameterSet const & getParameterSet(std::string const &) const
Definition: ParameterSet.cc:2128
MTDRecHitProducer::MTDRecHitProducer
MTDRecHitProducer(const edm::ParameterSet &ps)
Definition: MTDRecHitProducer.cc:41