Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:28:52

0001 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0002 #include "FWCore/Framework/interface/Event.h"
0003 #include "FWCore/Framework/interface/EventSetup.h"
0004 #include "FWCore/Framework/interface/MakerMacros.h"
0005 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0006 #include "RecoTracker/Record/interface/TkMSParameterizationRecord.h"
0007 #include "RecoTracker/TkNavigation/interface/TkMSParameterization.h"
0008 
0009 class TkMSParameterizationTest final : public edm::one::EDAnalyzer<> {
0010 public:
0011   explicit TkMSParameterizationTest(const edm::ParameterSet&) : tkMsParamToken_(esConsumes()) {}
0012 
0013 private:
0014   const edm::ESGetToken<TkMSParameterization, TkMSParameterizationRecord> tkMsParamToken_;
0015   void analyze(const edm::Event&, const edm::EventSetup&) override;
0016 };
0017 
0018 void TkMSParameterizationTest::analyze(const edm::Event&, const edm::EventSetup& iSetup) {
0019   using namespace tkMSParameterization;
0020   auto const& msParam = iSetup.getData(tkMsParamToken_);
0021 
0022   // test MSParam
0023   {
0024     std::cout << "\n\nProduced MSParam" << std::endl;
0025     unsigned short f, t;
0026     for (auto const& e : msParam()) {
0027       std::tie(f, t) = unpackLID(e.first);
0028       std::cout << "from/to " << f << "->" << t << std::endl;
0029       for (auto const& d : e.second()) {
0030         std::cout << d().size() << ' ';
0031       }
0032       std::cout << std::endl;
0033     }
0034 
0035     int lst[] = {0, 1, 29};
0036     for (auto st : lst)
0037       for (int il = 1; il < 5; ++il) {
0038         int ll = st + il;
0039         if (st == 0 && il == 5)
0040           ll = 29;
0041         std::cout << "from/to " << st << "->" << ll << std::endl;
0042         auto const& d = *msParam.fromTo(st, ll);
0043         int lb = 0;
0044         for (auto const& ld : d()) {
0045           lb++;
0046           if (ld().empty())
0047             continue;
0048           std::cout << lb << ": ";
0049           for (auto const& e : ld())
0050             std::cout << e << ' ';
0051           std::cout << std::endl;
0052         }
0053       }
0054   }
0055 };
0056 
0057 //define this as a plug-in
0058 DEFINE_FWK_MODULE(TkMSParameterizationTest);