CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_2_9_HLT1_bphpatch4/src/RecoTracker/RoadMapESSource/src/RoadMapESSource.cc

Go to the documentation of this file.
00001 //
00002 // Package:         RecoTracker/RoadMapESSource
00003 // Class:           RoadMapESSource
00004 // 
00005 // Description:     Reads in ASCII dump of Roads object
00006 //                  and provides it to the event.
00007 //
00008 // Original Author: Oliver Gutsche, gutsche@fnal.gov
00009 // Created:         Thu Jan 12 21:00:00 UTC 2006
00010 //
00011 // $Author: gutsche $
00012 // $Date: 2007/03/30 02:49:38 $
00013 // $Revision: 1.7 $
00014 //
00015 
00016 #include "RecoTracker/RoadMapESSource/interface/RoadMapESSource.h"
00017 #include "FWCore/ParameterSet/interface/FileInPath.h"
00018 
00019 #include "RecoTracker/RingRecord/interface/RingRecord.h"
00020 #include "RecoTracker/RingRecord/interface/Rings.h"
00021 
00022 //
00023 // constructors and destructor
00024 //
00025 RoadMapESSource::RoadMapESSource(const edm::ParameterSet& iConfig) : 
00026   fileName_((iConfig.getParameter<edm::FileInPath>("InputFileName")).fullPath())
00027 {
00028 
00029   std::string componentName = iConfig.getParameter<std::string>("ComponentName");
00030   setWhatProduced(this, componentName);
00031 
00032   ringsLabel_ = iConfig.getParameter<std::string>("RingsLabel");
00033 
00034   findingRecord<RoadMapRecord>();
00035   
00036   roads_ = 0;
00037 }
00038 
00039 
00040 RoadMapESSource::~RoadMapESSource()
00041 {
00042 }
00043 
00044 RoadMapESSource::ReturnType
00045 RoadMapESSource::produce(const RoadMapRecord& iRecord)
00046 {
00047 
00048   // get rings
00049   edm::ESHandle<Rings> ringHandle;
00050   iRecord.getRecord<RingRecord>().get(ringsLabel_, ringHandle);
00051   const Rings *rings = ringHandle.product();
00052 
00053   roads_ = new Roads(fileName_,rings);
00054   
00055   std::auto_ptr<Roads> roads(roads_);
00056 
00057   return roads ;
00058 }
00059 
00060 void RoadMapESSource::setIntervalFor(const edm::eventsetup::EventSetupRecordKey &, const edm::IOVSyncValue &, edm::ValidityInterval &oValidity) {
00061   oValidity = edm::ValidityInterval(edm::IOVSyncValue::beginOfTime(),edm::IOVSyncValue::endOfTime());
00062 }
00063 
00064 //define this as a plug-in
00065 DEFINE_FWK_EVENTSETUP_SOURCE(RoadMapESSource);
00066