CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_0/src/RecoTracker/RingMakerESProducer/src/RingMakerESProducer.cc

Go to the documentation of this file.
00001 //
00002 // Package:         RecoTracker/RingMakerESProducer
00003 // Class:           RingMakerESProducer
00004 // 
00005 // Description:     Uses the RingMaker object to construct
00006 //                  and provide a Rings object.
00007 //
00008 // Original Author: Oliver Gutsche, gutsche@fnal.gov
00009 // Created:         Tue Oct  3 23:51:34 UTC 2006
00010 //
00011 // $Author: elmer $
00012 // $Date: 2007/06/07 23:21:02 $
00013 // $Revision: 1.5 $
00014 //
00015 
00016 #include "RecoTracker/RingMakerESProducer/interface/RingMakerESProducer.h"
00017 
00018 #include "RecoTracker/RingMakerESProducer/interface/RingMaker.h"
00019 
00020 #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h"
00021 
00022 #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
00023 
00024 RingMakerESProducer::RingMakerESProducer(const edm::ParameterSet& iConfig)
00025 {
00026   std::string componentName = iConfig.getParameter<std::string>("ComponentName");
00027   setWhatProduced(this, componentName);
00028 
00029   writeOut_                  = iConfig.getUntrackedParameter<bool>("WriteOutRingsToAsciiFile",false);
00030   fileName_                  = iConfig.getUntrackedParameter<std::string>("RingAsciiFileName","");
00031   dumpDetIds_                = iConfig.getUntrackedParameter<bool>("DumpDetIds",false);
00032   detIdsDumpFileName_        = iConfig.getUntrackedParameter<std::string>("DetIdsDumpFileName","");
00033   configuration_             = iConfig.getUntrackedParameter<std::string>("Configuration","FULL");
00034   
00035   rings_ = 0;
00036 
00037 }
00038 
00039 
00040 RingMakerESProducer::~RingMakerESProducer()
00041 {
00042 //   if ( rings_ != 0) {
00043 //     delete rings_;
00044 //   }
00045   
00046 }
00047 
00048 
00049 RingMakerESProducer::ReturnType
00050 RingMakerESProducer::produce(const RingRecord& iRecord)
00051 {
00052 
00053   // get geometry
00054   edm::ESHandle<TrackerGeometry> trackingGeometryHandle;
00055   iRecord.getRecord<TrackerDigiGeometryRecord>().get(trackingGeometryHandle);
00056   const TrackerGeometry *tracker = trackingGeometryHandle.product();
00057 
00058   RingMaker maker(tracker,configuration_);
00059 
00060   if ( dumpDetIds_ ) {
00061     maker.dumpDetIdsIntoFile(detIdsDumpFileName_);
00062   }
00063 
00064   rings_ = maker.getRings();
00065   
00066   ReturnType pRings(rings_) ;
00067 
00068   if ( writeOut_ ) {
00069     rings_->dump(fileName_);
00070   }
00071 
00072   return pRings ;
00073 }
00074 
00075 //define this as a plug-in
00076 DEFINE_FWK_EVENTSETUP_MODULE(RingMakerESProducer);