Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-04-29 23:11:02

0001 #include "FWCore/Framework/interface/stream/EDProducer.h"
0002 #include "FWCore/Utilities/interface/InputTag.h"
0003 #include "FWCore/Utilities/interface/Exception.h"
0004 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0005 
0006 #include "FWCore/Framework/interface/Event.h"
0007 #include "DataFormats/Common/interface/Handle.h"
0008 #include "FWCore/Framework/interface/ConsumesCollector.h"
0009 
0010 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0011 #include "PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo.h"
0012 
0013 class PhotonConversionTrajectorySeedProducerFromQuadruplets : public edm::stream::EDProducer<> {
0014 public:
0015   PhotonConversionTrajectorySeedProducerFromQuadruplets(const edm::ParameterSet&);
0016   ~PhotonConversionTrajectorySeedProducerFromQuadruplets() override {}
0017   void produce(edm::Event&, const edm::EventSetup&) override;
0018 
0019 private:
0020   std::string _newSeedCandidates;
0021   std::unique_ptr<PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo> _theFinder;
0022 };
0023 
0024 PhotonConversionTrajectorySeedProducerFromQuadruplets::PhotonConversionTrajectorySeedProducerFromQuadruplets(
0025     const edm::ParameterSet& conf)
0026     : _newSeedCandidates(conf.getParameter<std::string>("newSeedCandidates")) {
0027   _theFinder = std::make_unique<PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo>(conf, consumesCollector());
0028   produces<TrajectorySeedCollection>(_newSeedCandidates);
0029 }
0030 
0031 void PhotonConversionTrajectorySeedProducerFromQuadruplets::produce(edm::Event& ev, const edm::EventSetup& es) {
0032   auto result = std::make_unique<TrajectorySeedCollection>();
0033   try {
0034     _theFinder->analyze(ev, es);
0035     if (!_theFinder->getTrajectorySeedCollection()->empty())
0036       result->insert(result->end(),
0037                      _theFinder->getTrajectorySeedCollection()->begin(),
0038                      _theFinder->getTrajectorySeedCollection()->end());
0039   } catch (cms::Exception& er) {
0040     edm::LogError("SeedingConversion") << " Problem in the Single Leg Conversion Seed Producer " << er.what()
0041                                        << std::endl;
0042   } catch (std::exception& er) {
0043     edm::LogError("SeedingConversion") << " Problem in the Single Leg Conversion Seed Producer " << er.what()
0044                                        << std::endl;
0045   }
0046 
0047   edm::LogInfo("debugTrajSeedFromQuadruplets") << " TrajectorySeedCollection size " << result->size();
0048   ev.put(std::move(result), _newSeedCandidates);
0049 }
0050 
0051 #include "FWCore/Framework/interface/MakerMacros.h"
0052 DEFINE_FWK_MODULE(PhotonConversionTrajectorySeedProducerFromQuadruplets);