Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:27:14

0001 #include <memory>
0002 /** \file MuonNavigationTest
0003  *
0004  *  \author Chang Liu
0005  */
0006 
0007 #include "FWCore/Framework/interface/Frameworkfwd.h"
0008 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0009 
0010 #include "FWCore/Framework/interface/Event.h"
0011 #include "FWCore/Framework/interface/EventSetup.h"
0012 #include "FWCore/Framework/interface/ESHandle.h"
0013 #include "FWCore/Framework/interface/MakerMacros.h"
0014 
0015 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0016 
0017 #include "RecoMuon/Navigation/interface/MuonNavigationPrinter.h"
0018 #include "RecoMuon/Navigation/interface/MuonNavigationSchool.h"
0019 //#include "RecoMuon/Navigation/interface/MuonTkNavigationSchool.h"
0020 #include "RecoMuon/Records/interface/MuonRecoGeometryRecord.h"
0021 #include "RecoMuon/Navigation/interface/MuonNavigationPrinter.h"
0022 #include "RecoMuon/DetLayers/interface/MuonDetLayerGeometry.h"
0023 //#include "RecoTracker/TkDetLayers/interface/GeometricSearchTracker.h"
0024 //#include "RecoTracker/Record/interface/TrackerRecoGeometryRecord.h"
0025 #include "MagneticField/Records/interface/IdealMagneticFieldRecord.h"
0026 
0027 class MuonNavigationTest : public edm::one::EDAnalyzer<> {
0028 public:
0029   explicit MuonNavigationTest(const edm::ParameterSet&);
0030   ~MuonNavigationTest() override;
0031 
0032   void analyze(const edm::Event&, const edm::EventSetup&) override;
0033 
0034 private:
0035   edm::ESGetToken<MuonDetLayerGeometry, MuonRecoGeometryRecord> geomToken_;
0036 };
0037 
0038 // constructor
0039 
0040 MuonNavigationTest::MuonNavigationTest(const edm::ParameterSet& iConfig) {
0041   geomToken_ = esConsumes();
0042   std::cout << "Muon Navigation Printer Begin:" << std::endl;
0043 }
0044 
0045 MuonNavigationTest::~MuonNavigationTest() { std::cout << "Muon Navigation Printer End. " << std::endl; }
0046 
0047 void MuonNavigationTest::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) {
0048   using namespace edm;
0049 
0050   //choose ONE and ONLY one to be true
0051   bool testMuon = true;
0052   //   bool testMuonTk = true;
0053   //
0054   // get Geometry
0055   //
0056   const MuonDetLayerGeometry& mm = iSetup.getData(geomToken_);
0057 
0058   if (testMuon) {
0059     MuonNavigationSchool school(&mm);
0060     MuonNavigationPrinter* printer = new MuonNavigationPrinter(&mm, school);
0061     delete printer;
0062   }
0063   /*
0064    if ( testMuonTk ) {
0065      edm::ESHandle<GeometricSearchTracker> tracker;
0066      iSetup.get<TrackerRecoGeometryRecord>().get(tracker);
0067 
0068      edm::ESHandle<MagneticField> theMF;
0069      iSetup.get<IdealMagneticFieldRecord>().get(theMF);
0070 
0071      const GeometricSearchTracker * tt(&(*tracker));
0072      const MagneticField * field(&(*theMF));
0073 
0074      MuonTkNavigationSchool school(mm,tt,field);
0075      MuonNavigationPrinter* printer = new MuonNavigationPrinter(mm, tt);
0076      delete printer;
0077   }
0078 */
0079 }
0080 
0081 //define this as a plug-in
0082 DEFINE_FWK_MODULE(MuonNavigationTest);