00001 00007 #include "TrackingTools/Producers/interface/BeamHaloPropagatorESProducer.h" 00008 00009 #include "FWCore/Framework/interface/EventSetup.h" 00010 #include "FWCore/Framework/interface/ESHandle.h" 00011 #include "DataFormats/Common/interface/Handle.h" 00012 #include "FWCore/Framework/interface/ModuleFactory.h" 00013 #include "FWCore/Utilities/interface/Exception.h" 00014 00015 #include "FWCore/ParameterSet/interface/ParameterSet.h" 00016 #include "TrackingTools/Records/interface/TrackingComponentsRecord.h" 00017 00018 #include "MagneticField/Engine/interface/MagneticField.h" 00019 #include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" 00020 00021 #include "FWCore/MessageLogger/interface/MessageLogger.h" 00022 00023 using namespace edm; 00024 using namespace std; 00025 00026 BeamHaloPropagatorESProducer::BeamHaloPropagatorESProducer(const ParameterSet& parameterSet) 00027 { 00028 myname = parameterSet.getParameter<string>("ComponentName"); 00029 00030 string propDir = parameterSet.getParameter<string>("PropagationDirection"); 00031 00032 if (propDir == "oppositeToMomentum") thePropagationDirection = oppositeToMomentum; 00033 else if (propDir == "alongMomentum") thePropagationDirection = alongMomentum; 00034 else if (propDir == "anyDirection") thePropagationDirection = anyDirection; 00035 else 00036 throw cms::Exception("BeamHaloPropagatorESProducer") 00037 << "Wrong fit direction ("<< propDir <<")chosen in BeamHaloPropagatorESProducer"; 00038 00039 theEndCapTrackerPropagatorName = parameterSet.getParameter<string>("EndCapTrackerPropagator"); 00040 theCrossingTrackerPropagatorName = parameterSet.getParameter<string>("CrossingTrackerPropagator"); 00041 00042 setWhatProduced(this,myname); 00043 } 00044 00045 BeamHaloPropagatorESProducer::~BeamHaloPropagatorESProducer() {} 00046 00047 boost::shared_ptr<Propagator> 00048 BeamHaloPropagatorESProducer::produce(const TrackingComponentsRecord& iRecord){ 00049 00050 ESHandle<MagneticField> magField; 00051 iRecord.getRecord<IdealMagneticFieldRecord>().get(magField); 00052 00053 ESHandle<Propagator> endcapPropagator; 00054 iRecord.get(theEndCapTrackerPropagatorName,endcapPropagator); 00055 00056 ESHandle<Propagator> crossPropagator; 00057 iRecord.get(theCrossingTrackerPropagatorName,crossPropagator); 00058 00059 LogDebug("BeamHaloPropagator")<<"Creating a BeamHaloPropagator: "<<myname 00060 <<"\n with EndCap Propagator: "<<theEndCapTrackerPropagatorName 00061 <<"\n with Crossing Propagator: "<<theCrossingTrackerPropagatorName; 00062 00063 thePropagator = boost::shared_ptr<Propagator>(new BeamHaloPropagator(*endcapPropagator,*crossPropagator, 00064 &*magField, 00065 thePropagationDirection)); 00066 return thePropagator; 00067 }