CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_2_9/src/RecoTracker/ConversionSeedGenerators/plugins/PhotonConversionTrajectorySeedProducerFromSingleLeg.cc

Go to the documentation of this file.
00001 #include "FWCore/Framework/interface/EDProducer.h"
00002 #include "FWCore/Utilities/interface/InputTag.h"
00003 #include "FWCore/Utilities/interface/Exception.h"
00004 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00005 
00006 #include "FWCore/Framework/interface/Event.h"
00007 #include "DataFormats/Common/interface/Handle.h"
00008 #include "FWCore/Framework/interface/EventSetup.h"
00009 #include "FWCore/Framework/interface/ESHandle.h"
00010 
00011 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00012 #include "RecoTracker/ConversionSeedGenerators/interface/PhotonConversionTrajectorySeedProducerFromSingleLegAlgo.h"
00013 //#include "UserUtilities/TimingPerformance/interface/TimeReport.h"
00014 
00015 class PhotonConversionTrajectorySeedProducerFromSingleLeg : public edm::EDProducer {
00016 public:
00017   PhotonConversionTrajectorySeedProducerFromSingleLeg(const edm::ParameterSet& );
00018   ~PhotonConversionTrajectorySeedProducerFromSingleLeg(){}
00019   void beginRun(edm::Run &run, const edm::EventSetup& es);
00020   void endRun(edm::Run &run, const edm::EventSetup& es);
00021   void produce(edm::Event& , const edm::EventSetup& );
00022 
00023 private:
00024   edm::ParameterSet _conf;
00025   std::string _newSeedCandidates, _xcheckSeedCandidates;
00026   bool _DoxcheckSeedCandidates;
00027   PhotonConversionTrajectorySeedProducerFromSingleLegAlgo *_theFinder;
00028 };
00029 
00030 
00031 PhotonConversionTrajectorySeedProducerFromSingleLeg::
00032 PhotonConversionTrajectorySeedProducerFromSingleLeg(const edm::ParameterSet& conf)
00033   : _conf(conf),
00034     _newSeedCandidates(conf.getParameter<std::string>( "newSeedCandidates")),
00035     _xcheckSeedCandidates(conf.getParameter<std::string>( "xcheckSeedCandidates") ),
00036     _DoxcheckSeedCandidates( conf.getParameter<bool>( "DoxcheckSeedCandidates") )
00037 {
00038   _theFinder = new PhotonConversionTrajectorySeedProducerFromSingleLegAlgo(conf);
00039   produces<TrajectorySeedCollection>(_newSeedCandidates);
00040   if(_DoxcheckSeedCandidates)
00041     produces<TrajectorySeedCollection>(_xcheckSeedCandidates);
00042 }
00043 
00044 
00045 void PhotonConversionTrajectorySeedProducerFromSingleLeg::
00046 endRun(edm::Run &run, const edm::EventSetup& es) {
00047   _theFinder->clear();
00048 }
00049 
00050 void PhotonConversionTrajectorySeedProducerFromSingleLeg::
00051 beginRun(edm::Run &run, const edm::EventSetup& es)
00052 {
00053   _theFinder->init();
00054 }
00055 
00056 
00057 void PhotonConversionTrajectorySeedProducerFromSingleLeg::produce(edm::Event& ev, const edm::EventSetup& es)
00058 {
00059   //TimeMe myTest("PhotonConversionTrajectorySeedProducerFromSingleLeg::produce");
00060 
00061   //FIXME 
00062   //remove this
00063   //edm::CPUTimer cpu_timer;
00064   //cpu_timer.start();
00065   //--------------------------------------
00066 
00067 
00068   std::auto_ptr<TrajectorySeedCollection> result( new TrajectorySeedCollection() );  
00069   //try{
00070   _theFinder->analyze(ev,es);
00071   if(_theFinder->getTrajectorySeedCollection()->size())
00072     result->insert(result->end(),
00073                    _theFinder->getTrajectorySeedCollection()->begin(),
00074                    _theFinder->getTrajectorySeedCollection()->end());
00075   //}catch(cms::Exception& er){
00076   //  edm::LogError("SeedingConversion") << " Problem in the Single Leg Conversion Seed Producer " <<er.what()<<std::endl;
00077   //}catch(std::exception& er){
00078   //  edm::LogError("SeedingConversion") << " Problem in the Single Leg Conversion Seed Producer " << er.what()<<std::endl;
00079   //}
00080 
00081   
00082   //edm::LogInfo("debugTrajSeedFromSingleLeg") << " TrajectorySeedCollection size " << result->size();
00083   ev.put(result, _newSeedCandidates);  
00084 
00085   //FIXME 
00086   //remove this
00087   //cpu_timer.stop();
00088   //std::cout << "cpu timer " << cpu_timer.realTime() << " " << cpu_timer.cpuTime() << std::endl;
00089   //--------------------------------------
00090 
00091   //FIXME 
00092   //This is a check part that can be removed
00093 
00094   if(!_DoxcheckSeedCandidates)
00095     return;
00096 
00097 
00098 
00099   std::auto_ptr<TrajectorySeedCollection> resultCheck( new TrajectorySeedCollection() );
00100   if(_theFinder->getTrajectorySeedCollectionOfSourceTracks()->size())
00101     resultCheck->insert(resultCheck->end(),
00102                         _theFinder->getTrajectorySeedCollectionOfSourceTracks()->begin(),
00103                         _theFinder->getTrajectorySeedCollectionOfSourceTracks()->end());
00104   ev.put(resultCheck , _xcheckSeedCandidates);
00105 
00106 }
00107 
00108 #include "FWCore/Framework/interface/MakerMacros.h"
00109 DEFINE_FWK_MODULE(PhotonConversionTrajectorySeedProducerFromSingleLeg);