CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_5_3_13_patch3/src/RecoTracker/RoadMapMakerESProducer/src/RoadMapMakerESProducer.cc

Go to the documentation of this file.
00001 //
00002 // Package:         RecoTracker/RoadMapMakerESProducer
00003 // Class:           RoadMapMakerESProducer
00004 // 
00005 // Description:     Uses the RoadMaker object to construct
00006 //                  and provide a Roads object.
00007 //
00008 // Original Author: Oliver Gutsche, gutsche@fnal.gov
00009 // Created:         Thu Jan 12 21:00:00 UTC 2006
00010 //
00011 // $Author: noeding $
00012 // $Date: 2008/02/28 22:12:10 $
00013 // $Revision: 1.12 $
00014 //
00015 
00016 #include "RecoTracker/RoadMapMakerESProducer/interface/RoadMapMakerESProducer.h"
00017 
00018 #include "RecoTracker/RingRecord/interface/Rings.h"
00019 #include "RecoTracker/RingRecord/interface/RingRecord.h"
00020 
00021 RoadMapMakerESProducer::RoadMapMakerESProducer(const edm::ParameterSet& iConfig)
00022 {
00023 
00024   std::string componentName = iConfig.getParameter<std::string>("ComponentName");
00025   setWhatProduced(this, componentName);
00026 
00027   ringsLabel_                = iConfig.getParameter<std::string>("RingsLabel");
00028 
00029   writeOut_                  = iConfig.getUntrackedParameter<bool>("WriteOutRoadMapToAsciiFile",false);
00030   fileName_                  = iConfig.getUntrackedParameter<std::string>("RoadMapAsciiFile","");
00031 
00032   std::string tmp_string         = iConfig.getParameter<std::string>("GeometryStructure");
00033 
00034   if ( tmp_string == "MTCC" ) {
00035     geometryStructure_ = RoadMaker::MTCC;
00036   } else if ( tmp_string == "TIF" ) {
00037     geometryStructure_ = RoadMaker::TIF;
00038   } else if ( tmp_string == "TIFTOB" ) {
00039     geometryStructure_ = RoadMaker::TIFTOB;
00040   } else if ( tmp_string == "TIFTIB" ) {
00041     geometryStructure_ = RoadMaker::TIFTIB;
00042   }else if ( tmp_string == "TIFTIBTOB" ) {
00043     geometryStructure_ = RoadMaker::TIFTIBTOB;
00044   }else if ( tmp_string == "TIFTOBTEC" ) {
00045     geometryStructure_ = RoadMaker::TIFTOBTEC;
00046   } else if ( tmp_string == "P5" ) {
00047     geometryStructure_ = RoadMaker::P5;
00048   } else if ( tmp_string == "FullDetector" ) {
00049     geometryStructure_ = RoadMaker::FullDetector;
00050   } else if ( tmp_string == "FullDetectorII" ) {
00051     geometryStructure_ = RoadMaker::FullDetectorII;
00052   } else {
00053     geometryStructure_ = RoadMaker::FullDetector;
00054   }
00055 
00056   tmp_string         = iConfig.getParameter<std::string>("SeedingType");
00057 
00058   if ( tmp_string == "TwoRingSeeds" ) {
00059     seedingType_ = RoadMaker::TwoRingSeeds;
00060   } else if ( tmp_string == "FourRingSeeds" ) {
00061     seedingType_ = RoadMaker::FourRingSeeds;
00062   } else {
00063     seedingType_ = RoadMaker::FourRingSeeds;
00064   }
00065   
00066   roads_ = 0;
00067 
00068 }
00069 
00070 
00071 RoadMapMakerESProducer::~RoadMapMakerESProducer()
00072 {
00073 }
00074 
00075 
00076 RoadMapMakerESProducer::ReturnType
00077 RoadMapMakerESProducer::produce(const RoadMapRecord& iRecord)
00078 {
00079 
00080   // get rings
00081   edm::ESHandle<Rings> ringHandle;
00082   iRecord.getRecord<RingRecord>().get(ringsLabel_, ringHandle);
00083   const Rings *rings = ringHandle.product();
00084 
00085   RoadMaker maker(rings,
00086                   geometryStructure_,
00087                   seedingType_);
00088 
00089   roads_ = maker.getRoads();
00090   
00091   ReturnType pRoads(roads_) ;
00092 
00093   if ( writeOut_ ) {
00094     roads_->dump(fileName_);
00095   }
00096 
00097   return pRoads ;
00098 }
00099 
00100 //define this as a plug-in
00101 DEFINE_FWK_EVENTSETUP_MODULE(RoadMapMakerESProducer);