Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:26:29

0001 #include "RecoLocalTracker/SiStripRecHitConverter/plugins/SiStripRecHitConverter.h"
0002 #include "FWCore/Framework/interface/ConsumesCollector.h"
0003 #include "FWCore/Framework/interface/Event.h"
0004 #include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
0005 #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
0006 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0007 
0008 SiStripRecHitConverter::SiStripRecHitConverter(edm::ParameterSet const& conf)
0009     : recHitConverterAlgorithm(conf, consumesCollector()),
0010       matchedRecHitsTag(conf.getParameter<std::string>("matchedRecHits")),
0011       rphiRecHitsTag(conf.getParameter<std::string>("rphiRecHits")),
0012       stereoRecHitsTag(conf.getParameter<std::string>("stereoRecHits")),
0013       doMatching(conf.getParameter<bool>("doMatching")) {
0014   clusterProducer =
0015       consumes<edmNew::DetSetVector<SiStripCluster> >(conf.getParameter<edm::InputTag>("ClusterProducer"));
0016 
0017   produces<SiStripRecHit2DCollection>(rphiRecHitsTag);
0018   produces<SiStripRecHit2DCollection>(stereoRecHitsTag);
0019   if (doMatching) {
0020     produces<SiStripMatchedRecHit2DCollection>(matchedRecHitsTag);
0021     produces<SiStripRecHit2DCollection>(rphiRecHitsTag + "Unmatched");
0022     produces<SiStripRecHit2DCollection>(stereoRecHitsTag + "Unmatched");
0023   }
0024 }
0025 
0026 void SiStripRecHitConverter::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
0027   edm::ParameterSetDescription desc;
0028   desc.add<edm::InputTag>("ClusterProducer", edm::InputTag("siStripClusters"));
0029   desc.add<std::string>("rphiRecHits", "rphiRecHit");
0030   desc.add<std::string>("stereoRecHits", "stereoRecHit");
0031   desc.add<std::string>("matchedRecHits", "matchedRecHit");
0032 
0033   SiStripRecHitConverterAlgorithm::fillPSetDescription(desc);
0034 
0035   // unused? could be removed after parameter gets removed from HLT menu?
0036   desc.addOptionalUntracked<int>("VerbosityLevel");
0037 
0038   descriptions.addWithDefaultLabel(desc);
0039 }
0040 
0041 void SiStripRecHitConverter::produce(edm::Event& e, const edm::EventSetup& es) {
0042   edm::Handle<edmNew::DetSetVector<SiStripCluster> > clusters;
0043 
0044   SiStripRecHitConverterAlgorithm::products output;
0045   e.getByToken(clusterProducer, clusters);
0046   recHitConverterAlgorithm.initialize(es);
0047   recHitConverterAlgorithm.run(clusters, output);
0048   output.shrink_to_fit();
0049   LogDebug("SiStripRecHitConverter") << "found\n"
0050                                      << output.rphi->dataSize() << "  clusters in mono detectors\n"
0051                                      << output.stereo->dataSize() << "  clusters in partners stereo detectors\n";
0052 
0053   e.put(std::move(output.rphi), rphiRecHitsTag);
0054   e.put(std::move(output.stereo), stereoRecHitsTag);
0055   if (doMatching) {
0056     e.put(std::move(output.matched), matchedRecHitsTag);
0057     e.put(std::move(output.rphiUnmatched), rphiRecHitsTag + "Unmatched");
0058     e.put(std::move(output.stereoUnmatched), stereoRecHitsTag + "Unmatched");
0059   }
0060 }