Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:22:33

0001 /** \file
0002  *
0003  *  \author Massimiliano Chiorboli, updated NA 03/08
0004  */
0005 
0006 #include "MagneticField/ParametrizedEngine/plugins/ParametrizedMagneticFieldProducer.h"
0007 #include "MagneticField/ParametrizedEngine/interface/ParametrizedMagneticFieldFactory.h"
0008 
0009 #include "MagneticField/Records/interface/IdealMagneticFieldRecord.h"
0010 
0011 #include "FWCore/Framework/interface/ESHandle.h"
0012 #include "FWCore/Framework/interface/EventSetup.h"
0013 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0014 
0015 #include <string>
0016 #include <iostream>
0017 
0018 using namespace std;
0019 using namespace edm;
0020 using namespace magneticfield;
0021 
0022 ParametrizedMagneticFieldProducer::ParametrizedMagneticFieldProducer(const edm::ParameterSet& iConfig) : pset(iConfig) {
0023   setWhatProduced(this, pset.getUntrackedParameter<std::string>("label", ""));
0024 }
0025 
0026 ParametrizedMagneticFieldProducer::~ParametrizedMagneticFieldProducer() {}
0027 
0028 std::unique_ptr<MagneticField> ParametrizedMagneticFieldProducer::produce(const IdealMagneticFieldRecord& iRecord) {
0029   string version = pset.getParameter<string>("version");
0030   ParameterSet parameters = pset.getParameter<ParameterSet>("parameters");
0031 
0032   return ParametrizedMagneticFieldFactory::get(version, parameters);
0033 }
0034 
0035 #include "FWCore/Framework/interface/ModuleFactory.h"
0036 DEFINE_FWK_EVENTSETUP_MODULE(ParametrizedMagneticFieldProducer);