CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch12/src/TrackingTools/TrackAssociator/plugins/DetIdAssociatorESProducer.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // Package:    DetIdAssociatorESProducer
00004 // Class:      DetIdAssociatorESProducer
00005 // 
00013 //
00014 // Original Author:  Jean-Roch Vlimant
00015 //         Created:  Thu Oct  4 02:28:48 CEST 2007
00016 // $Id: DetIdAssociatorESProducer.cc,v 1.4 2009/09/06 16:34:57 dmytro Exp $
00017 //
00018 //
00019 
00020 
00021 // system include files
00022 #include <memory>
00023 #include "boost/shared_ptr.hpp"
00024 
00025 // user include files
00026 #include "FWCore/Framework/interface/ModuleFactory.h"
00027 #include "FWCore/Framework/interface/ESProducer.h"
00028 
00029 #include "TrackingTools/TrackAssociator/interface/DetIdAssociator.h"
00030 #include "TrackingTools/TrackAssociator/interface/DetIdAssociatorFactory.h"
00031 
00032 #include "TrackingTools/Records/interface/DetIdAssociatorRecord.h"
00033 
00034 
00035 //
00036 // class decleration
00037 //
00038 
00039 class DetIdAssociatorESProducer : public edm::ESProducer {
00040 public:
00041   DetIdAssociatorESProducer(const edm::ParameterSet&);
00042   ~DetIdAssociatorESProducer();
00043   
00044   typedef boost::shared_ptr<DetIdAssociator> ReturnType;
00045   
00046   ReturnType produce(const DetIdAssociatorRecord&);
00047 private:
00048   std::string cName;
00049   edm::ParameterSet pSet;
00050 };
00051 
00052 //
00053 // constants, enums and typedefs
00054 //
00055 
00056 //
00057 // static data member definitions
00058 //
00059 
00060 //
00061 // constructors and destructor
00062 //
00063 DetIdAssociatorESProducer::DetIdAssociatorESProducer(const edm::ParameterSet& iConfig)
00064 {
00065   cName =iConfig.getParameter<std::string>("ComponentName");
00066   pSet = iConfig;
00067   setWhatProduced(this, cName);
00068 }
00069 
00070 
00071 DetIdAssociatorESProducer::~DetIdAssociatorESProducer()
00072 {
00073 }
00074 
00075 
00076 //
00077 // member functions
00078 //
00079 
00080 // ------------ method called to produce the data  ------------
00081 DetIdAssociatorESProducer::ReturnType
00082 DetIdAssociatorESProducer::produce(const DetIdAssociatorRecord& iRecord)
00083 {
00084    using namespace edm::es;
00085    LogTrace("TrackAssociator") << "Making DetIdAssociatorRecord with label: " << cName;
00086    ReturnType dia(DetIdAssociatorFactory::get()->create(cName, pSet));
00087    dia->setGeometry(iRecord);
00088    dia->setConditions(iRecord);
00089    dia->buildMap();
00090    LogTrace("TrackAssociator") << "Map id built for DetIdAssociatorRecord with label: " << cName;
00091    return dia;
00092 }
00093 
00094 //define this as a plug-in
00095 DEFINE_FWK_EVENTSETUP_MODULE(DetIdAssociatorESProducer);