CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_0/src/TrackingTools/Producers/src/SmartPropagatorESProducer.cc

Go to the documentation of this file.
00001 
00009 #include "TrackingTools/Producers/interface/SmartPropagatorESProducer.h"
00010 
00011 #include "FWCore/Framework/interface/EventSetup.h"
00012 #include "FWCore/Framework/interface/ESHandle.h"
00013 #include "DataFormats/Common/interface/Handle.h"
00014 #include "FWCore/Framework/interface/ModuleFactory.h"
00015 #include "FWCore/Utilities/interface/Exception.h"
00016 
00017 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00018 #include "TrackingTools/Records/interface/TrackingComponentsRecord.h"
00019 
00020 #include "MagneticField/Engine/interface/MagneticField.h"
00021 #include "MagneticField/Records/interface/IdealMagneticFieldRecord.h"
00022 
00023     
00024 using namespace edm;
00025 using namespace std;
00026     
00027 SmartPropagatorESProducer::SmartPropagatorESProducer(const ParameterSet& parameterSet) 
00028 {
00029   string myname = parameterSet.getParameter<string>("ComponentName");
00030 
00031   string propDir = parameterSet.getParameter<string>("PropagationDirection");
00032   
00033   if (propDir == "oppositeToMomentum") thePropagationDirection = oppositeToMomentum;
00034   else if (propDir == "alongMomentum") thePropagationDirection = alongMomentum;
00035   else if (propDir == "anyDirection") thePropagationDirection = anyDirection;
00036   else
00037     throw cms::Exception("SmartPropagatorESProducer") 
00038       << "Wrong fit direction chosen in SmartPropagatorESProducer";
00039 
00040 
00041   theEpsilon = parameterSet.getParameter<double>("Epsilon");
00042   
00043   theTrackerPropagatorName = parameterSet.getParameter<string>("TrackerPropagator");
00044   theMuonPropagatorName = parameterSet.getParameter<string>("MuonPropagator");
00045 
00046   setWhatProduced(this,myname);
00047 }
00048 
00049 SmartPropagatorESProducer::~SmartPropagatorESProducer() {}
00050 
00051 boost::shared_ptr<Propagator> 
00052 SmartPropagatorESProducer::produce(const TrackingComponentsRecord& iRecord){ 
00053 
00054   ESHandle<MagneticField> magField;
00055   iRecord.getRecord<IdealMagneticFieldRecord>().get(magField);
00056   
00057   ESHandle<Propagator> trackerPropagator;
00058   iRecord.get(theTrackerPropagatorName,trackerPropagator);
00059 
00060   ESHandle<Propagator> muonPropagator;
00061   iRecord.get(theMuonPropagatorName,muonPropagator);
00062   
00063   
00064   thePropagator  = boost::shared_ptr<Propagator>(new SmartPropagator(*trackerPropagator, *muonPropagator,
00065                                                                      &*magField,
00066                                                                      thePropagationDirection, 
00067                                                                      theEpsilon));
00068   return thePropagator;
00069 }