Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:27:39

0001 #include "RecoPPS/Local/interface/CTPPSPixelRecHitProducer.h"
0002 
0003 CTPPSPixelRecHitProducer::CTPPSPixelRecHitProducer(const edm::ParameterSet &conf) : param_(conf), cluster2hit_(conf) {
0004   src_ = conf.getParameter<edm::InputTag>("RPixClusterTag");
0005   verbosity_ = conf.getUntrackedParameter<int>("RPixVerbosity");
0006   tokenCTPPSPixelCluster_ = consumes<edm::DetSetVector<CTPPSPixelCluster> >(src_);
0007   produces<edm::DetSetVector<CTPPSPixelRecHit> >();
0008   pixelTopologyToken_ = esConsumes<PPSPixelTopology, PPSPixelTopologyRcd>();
0009 }
0010 
0011 CTPPSPixelRecHitProducer::~CTPPSPixelRecHitProducer() {}
0012 
0013 void CTPPSPixelRecHitProducer::fillDescriptions(edm::ConfigurationDescriptions &descriptions) {
0014   edm::ParameterSetDescription desc;
0015   desc.addUntracked<int>("RPixVerbosity", 0);
0016   desc.add<edm::InputTag>("RPixClusterTag", edm::InputTag("ctppsPixelClusters"));
0017   descriptions.add("ctppsPixelRecHits", desc);
0018 }
0019 
0020 void CTPPSPixelRecHitProducer::produce(edm::Event &iEvent, const edm::EventSetup &iSetup) {
0021   edm::Handle<edm::DetSetVector<CTPPSPixelCluster> > rpCl;
0022   iEvent.getByToken(tokenCTPPSPixelCluster_, rpCl);
0023 
0024   edm::ESHandle<PPSPixelTopology> thePixelTopology = iSetup.getHandle(pixelTopologyToken_);
0025 
0026   edm::DetSetVector<CTPPSPixelRecHit> output;
0027 
0028   // run reconstruction
0029   if (!rpCl->empty())
0030     run(*rpCl, output, *thePixelTopology);
0031 
0032   iEvent.put(std::make_unique<edm::DetSetVector<CTPPSPixelRecHit> >(output));
0033 }
0034 
0035 void CTPPSPixelRecHitProducer::run(const edm::DetSetVector<CTPPSPixelCluster> &input,
0036                                    edm::DetSetVector<CTPPSPixelRecHit> &output,
0037                                    const PPSPixelTopology &ppt) {
0038   for (const auto &ds_cluster : input) {
0039     edm::DetSet<CTPPSPixelRecHit> &ds_rechit = output.find_or_insert(ds_cluster.id);
0040 
0041     //calculate the cluster parameters and convert it into a rechit
0042     cluster2hit_.buildHits(ds_cluster.id, ds_cluster.data, ds_rechit.data, ppt);
0043   }
0044 }
0045 
0046 DEFINE_FWK_MODULE(CTPPSPixelRecHitProducer);