CMS 3D CMS Logo

FTLUncalibratedRecHitProducer.cc
Go to the documentation of this file.
5 
9 
11 
13 
15 
16  public:
19  void produce(edm::Event& evt, const edm::EventSetup& es) override;
20 
21  private:
22 
23  const edm::EDGetTokenT<FTLDigiCollection> ftlbDigis_; // collection of HGCEE digis
24  const edm::EDGetTokenT<FTLDigiCollection> ftleDigis_; // collection of HGCHEF digis
25 
26  const std::string ftlbInstance_; // instance name of barrel hits
27  const std::string ftleInstance_; // instance name of endcap hits
28 
29  std::unique_ptr<FTLUncalibratedRecHitAlgoBase> barrel_,endcap_;
30 };
31 
33  ftlbDigis_( consumes<FTLDigiCollection>( ps.getParameter<edm::InputTag>("barrelDigis") ) ),
34  ftleDigis_( consumes<FTLDigiCollection>( ps.getParameter<edm::InputTag>("endcapDigis") ) ),
35  ftlbInstance_( ps.getParameter<std::string>("BarrelHitsName") ),
36  ftleInstance_( ps.getParameter<std::string>("EndcapHitsName") ) {
37 
38  produces< FTLUncalibratedRecHitCollection >(ftlbInstance_);
39  produces< FTLUncalibratedRecHitCollection >(ftleInstance_);
40 
41  auto sumes = consumesCollector();
42 
43  const edm::ParameterSet& barrel = ps.getParameterSet("barrel");
44  const std::string& barrelAlgo = barrel.getParameter<std::string>("algoName");
45  barrel_.reset( FTLUncalibratedRecHitAlgoFactory::get()->create(barrelAlgo, barrel, sumes) );
46 
47  const edm::ParameterSet& endcap = ps.getParameterSet("endcap");
48  const std::string& endcapAlgo = endcap.getParameter<std::string>("algoName");
49  endcap_.reset( FTLUncalibratedRecHitAlgoFactory::get()->create(endcapAlgo, endcap, sumes) );
50 }
51 
53 }
54 
55 void
57 
58 
59  // tranparently get things from event setup
60  barrel_->getEventSetup(es);
61  endcap_->getEventSetup(es);
62 
63  barrel_->getEvent(evt);
64  endcap_->getEvent(evt);
65 
66  // prepare output
67  auto barrelRechits = std::make_unique<FTLUncalibratedRecHitCollection>();
68  auto endcapRechits = std::make_unique<FTLUncalibratedRecHitCollection>();
69 
71  evt.getByToken( ftlbDigis_, hBarrel );
72  barrelRechits->reserve(hBarrel->size()/2);
73  for(const auto& digi : *hBarrel) {
74  barrelRechits->push_back( std::move(barrel_->makeRecHit(digi)) );
75  }
76 
78  evt.getByToken( ftleDigis_, hEndcap );
79  endcapRechits->reserve(hEndcap->size()/2);
80  for(const auto& digi : *hEndcap) {
81  endcapRechits->push_back( std::move(endcap_->makeRecHit(digi)) );
82  }
83 
84  // put the collection of recunstructed hits in the event
85  evt.put(std::move(barrelRechits), ftlbInstance_);
86  evt.put(std::move(endcapRechits), ftleInstance_);
87 }
88 
T getParameter(std::string const &) const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:136
def create(alignables, pedeDump, additionalData, outputFile, config)
std::unique_ptr< FTLUncalibratedRecHitAlgoBase > endcap_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:519
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
FTLUncalibratedRecHitProducer(const edm::ParameterSet &ps)
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
const edm::EDGetTokenT< FTLDigiCollection > ftlbDigis_
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
const edm::EDGetTokenT< FTLDigiCollection > ftleDigis_
std::unique_ptr< FTLUncalibratedRecHitAlgoBase > barrel_
ParameterSet const & getParameterSet(std::string const &) const
HLT enums.
size_type size() const
void produce(edm::Event &evt, const edm::EventSetup &es) override
def move(src, dest)
Definition: eostools.py:510
T get(const Candidate &c)
Definition: component.h:55