Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-03-08 02:25:55

0001 #include <iostream>
0002 #include <sstream>
0003 #include "CondCore/Utilities/interface/PayloadInspector.h"
0004 #include "CondCore/BeamSpotPlugins/plugins/BeamSpot_PayloadInspector.cc"
0005 #include "CondCore/BeamSpotPlugins/plugins/BeamSpotOnline_PayloadInspector.cc"
0006 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0007 #include "FWCore/PluginManager/interface/PluginManager.h"
0008 #include "FWCore/PluginManager/interface/standard.h"
0009 #include "FWCore/PluginManager/interface/SharedLibrary.h"
0010 #include "FWCore/ServiceRegistry/interface/ServiceRegistry.h"
0011 
0012 int main(int argc, char** argv) {
0013   Py_Initialize();
0014 
0015   edmplugin::PluginManager::Config config;
0016   edmplugin::PluginManager::configure(edmplugin::standard::config());
0017 
0018   std::vector<edm::ParameterSet> psets;
0019   edm::ParameterSet pSet;
0020   pSet.addParameter("@service_type", std::string("SiteLocalConfigService"));
0021   psets.push_back(pSet);
0022   edm::ServiceToken servToken(edm::ServiceRegistry::createSet(psets));
0023   edm::ServiceRegistry::Operate operate(servToken);
0024 
0025   std::string connectionString("frontier://FrontierProd/CMS_CONDITIONS");
0026 
0027   // BeamSpot
0028   std::string tag = "BeamSpotObjects_PCL_byLumi_v0_prompt";
0029   cond::Time_t start = static_cast<unsigned long long>(1406876667347162);
0030   cond::Time_t end = static_cast<unsigned long long>(1488257707672138);
0031 
0032   edm::LogPrint("testBeamSpotPayloadInspector") << "## Exercising BeamSpot plots " << std::endl;
0033 
0034   BeamSpotParameters histoParameters;
0035   histoParameters.process(connectionString, PI::mk_input(tag, start, start));
0036   edm::LogPrint("testBeamSpotPayloadInspector") << histoParameters.data() << std::endl;
0037 
0038   BeamSpotParametersDiffSingleTag histoParametersDiff;
0039   histoParametersDiff.process(connectionString, PI::mk_input(tag, start, end));
0040   edm::LogPrint("testBeamSpotPayloadInspector") << histoParametersDiff.data() << std::endl;
0041 
0042   std::string tag1 = "BeamSpotObjects_Realistic25ns_900GeV_2021PilotBeams_v2_mc";
0043   std::string tag2 = "BeamSpotObjects_Realistic25ns_900GeV_2021PilotBeams_v1_mc";
0044   start = static_cast<unsigned long long>(1);
0045 
0046   BeamSpotParametersDiffTwoTags histoParametersDiffTwoTags;
0047   histoParametersDiffTwoTags.process(connectionString, PI::mk_input(tag1, start, start, tag2, start, start));
0048   edm::LogPrint("testBeamSpotPayloadInspector") << histoParametersDiffTwoTags.data() << std::endl;
0049 
0050   edm::LogPrint("testBeamSpotPayloadInspector") << "## Exercising BeamSpotOnline plots " << std::endl;
0051 
0052   tag = "BeamSpotOnlineTestLegacy";
0053   start = static_cast<unsigned long long>(1443392479297557);
0054   end = static_cast<unsigned long long>(1470910334763033);
0055 
0056   edm::LogPrint("") << "###########################################################################\n"
0057                     << "                              DISCLAIMER\n"
0058                     << " The following unit test is going to print error messages about\n"
0059                     << " out-of-range indices for the BeamSpotOnlineParameters.\n"
0060                     << " This normal and expected, since the test payload has been written \n"
0061                     << " with an obsolete data layout which doesn't contain few additional \n"
0062                     << " parameters, see https://github.com/cms-sw/cmssw/pull/35338 for details. \n"
0063                     << " This tests the catching of exceptions coming from reading not existing \n"
0064                     << " parameters in the Payload inspector.\n";
0065 
0066   BeamSpotOnlineParameters histoOnlineParameters;
0067   histoOnlineParameters.process(connectionString, PI::mk_input(tag, start, start));
0068   edm::LogPrint("testBeamSpotPayloadInspector") << histoOnlineParameters.data() << std::endl;
0069 
0070   BeamSpotOnlineParametersDiffSingleTag histoOnlineParametersDiff;
0071   histoOnlineParametersDiff.process(connectionString, PI::mk_input(tag, start, end));
0072   edm::LogPrint("testBeamSpotPayloadInspector") << histoOnlineParametersDiff.data() << std::endl;
0073 
0074   tag1 = "BeamSpotOnlineObjects_Ideal_Centered_SLHC_v3_mc";
0075   tag2 = "BeamSpotOnlineObjects_Realistic25ns_13TeVCollisions_RoundOpticsLowSigmaZ_RunBased_v1_mc";
0076   start = static_cast<unsigned long long>(4294967297); /*Run 1 : LS 1 (packed: 4294967297) this needs to be per LS */
0077 
0078   BeamSpotOnlineParametersDiffTwoTags histoOnlineParametersDiffTwoTags;
0079   histoOnlineParametersDiffTwoTags.process(connectionString, PI::mk_input(tag1, start, start, tag2, start, start));
0080   edm::LogPrint("testBeamSpotPayloadInspector") << histoOnlineParametersDiffTwoTags.data() << std::endl;
0081 
0082   Py_Finalize();
0083 }