CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_2_9/src/TrackingTools/GsfTracking/plugins/GsfMaterialEffectsESProducer.cc

Go to the documentation of this file.
00001 #include "TrackingTools/GsfTracking/plugins/GsfMaterialEffectsESProducer.h"
00002 
00003 #include "TrackingTools/MaterialEffects/interface/MultipleScatteringUpdator.h"
00004 #include "TrackingTools/MaterialEffects/interface/EnergyLossUpdator.h"
00005 #include "TrackingTools/GsfTracking/interface/GsfMaterialEffectsAdapter.h"
00006 #include "TrackingTools/GsfTracking/interface/GsfMultipleScatteringUpdator.h"
00007 #include "TrackingTools/GsfTracking/interface/GsfBetheHeitlerUpdator.h"
00008 #include "TrackingTools/GsfTracking/interface/GsfCombinedMaterialEffectsUpdator.h"
00009 
00010 #include "FWCore/Framework/interface/EventSetup.h"
00011 #include "FWCore/Framework/interface/ESHandle.h"
00012 #include "FWCore/Framework/interface/ModuleFactory.h"
00013 #include "FWCore/Framework/interface/ESProducer.h"
00014 
00015 #include <string>
00016 #include <memory>
00017 
00018 using namespace edm;
00019 
00020 GsfMaterialEffectsESProducer::GsfMaterialEffectsESProducer(const edm::ParameterSet & p) 
00021 {
00022   std::string myname = p.getParameter<std::string>("ComponentName");
00023   pset_ = p;
00024   setWhatProduced(this,myname);
00025 }
00026 
00027 GsfMaterialEffectsESProducer::~GsfMaterialEffectsESProducer() {}
00028 
00029 boost::shared_ptr<GsfMaterialEffectsUpdator> 
00030 GsfMaterialEffectsESProducer::produce(const TrackingComponentsRecord & iRecord){ 
00031   double mass = pset_.getParameter<double>("Mass");
00032   std::string msName = pset_.getParameter<std::string>("MultipleScatteringUpdator");
00033   std::string elName = pset_.getParameter<std::string>("EnergyLossUpdator");
00034 
00035   GsfMaterialEffectsUpdator* msUpdator;
00036   if ( msName == "GsfMultipleScatteringUpdator" ) {
00037     msUpdator = new GsfMultipleScatteringUpdator(mass);
00038   }
00039   else {
00040     msUpdator = new GsfMaterialEffectsAdapter(MultipleScatteringUpdator(mass));
00041   }
00042   
00043   GsfMaterialEffectsUpdator* elUpdator;
00044   if ( elName == "GsfBetheHeitlerUpdator" ) {
00045     std::string fileName = pset_.getParameter<std::string>("BetheHeitlerParametrization");
00046     int correction = pset_.getParameter<int>("BetheHeitlerCorrection");
00047     elUpdator = new GsfBetheHeitlerUpdator(fileName,correction);
00048   }
00049   else {
00050     elUpdator = new GsfMaterialEffectsAdapter(EnergyLossUpdator(mass));
00051   }
00052 
00053   boost::shared_ptr<GsfMaterialEffectsUpdator> updator =
00054     boost::shared_ptr<GsfMaterialEffectsUpdator>(new GsfCombinedMaterialEffectsUpdator(*msUpdator,
00055                                                                                        *elUpdator));
00056   delete msUpdator;
00057   delete elUpdator;
00058 
00059   return updator;
00060 }
00061 
00062