Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:01:23

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