Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-12-15 05:17:37

0001 #include "FWCore/Framework/interface/EventSetup.h"
0002 #include "FWCore/Framework/interface/Frameworkfwd.h"
0003 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0004 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0005 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0006 #include "MagneticField/Engine/interface/MagneticField.h"
0007 #include "TrackingTools/Records/interface/TransientTrackRecord.h"
0008 #include "TrackingTools/TransientTrack/interface/TransientTrackBuilder.h"
0009 
0010 #include <memory>
0011 #include <iostream>
0012 #include <string>
0013 
0014 using namespace edm;
0015 
0016 class TransientTrackBuilderTest : public edm::one::EDAnalyzer<> {
0017 public:
0018   TransientTrackBuilderTest(const edm::ParameterSet& pset)
0019       : ttkToken_(esConsumes(edm::ESInputTag{"", "TransientTrackBuilder"})) {}
0020 
0021   ~TransientTrackBuilderTest() = default;
0022 
0023   virtual void analyze(const edm::Event& event, const edm::EventSetup& setup) {
0024     using namespace std;
0025 
0026     edm::LogPrint("TrackerTrackBuilderTest")
0027         << " Asking for the TransientTrackBuilder with name TransientTrackBuilder\n";
0028     const TransientTrackBuilder* theB = &setup.getData(ttkToken_);
0029 
0030     edm::LogPrint("TrackerTrackBuilderTest") << " Got a " << typeid(*theB).name() << endl;
0031     edm::LogPrint("TrackerTrackBuilderTest")
0032         << "Field at origin (in Testla): " << (*theB).field()->inTesla(GlobalPoint(0., 0., 0.)) << endl;
0033   }
0034 
0035 private:
0036   const edm::ESGetToken<TransientTrackBuilder, TransientTrackRecord> ttkToken_;
0037 };