1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
|
#include <iostream>
#include <sstream>
#include "CondCore/BeamSpotPlugins/plugins/BeamSpot_PayloadInspector.cc"
#include "CondCore/BeamSpotPlugins/plugins/BeamSpotOnline_PayloadInspector.cc"
#include "CondCore/BeamSpotPlugins/plugins/SimBeamSpot_PayloadInspector.cc"
#include "CondCore/BeamSpotPlugins/plugins/SimBeamSpotHLLHC_PayloadInspector.cc"
#include "CondCore/Utilities/interface/PayloadInspector.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "FWCore/PluginManager/interface/PluginManager.h"
#include "FWCore/PluginManager/interface/standard.h"
#include "FWCore/PluginManager/interface/SharedLibrary.h"
#include "FWCore/ServiceRegistry/interface/ServiceRegistry.h"
int main(int argc, char** argv) {
Py_Initialize();
edmplugin::PluginManager::Config config;
edmplugin::PluginManager::configure(edmplugin::standard::config());
std::vector<edm::ParameterSet> psets;
edm::ParameterSet pSet;
pSet.addParameter("@service_type", std::string("SiteLocalConfigService"));
psets.push_back(pSet);
edm::ServiceToken servToken(edm::ServiceRegistry::createSet(psets));
edm::ServiceRegistry::Operate operate(servToken);
std::string connectionString("frontier://FrontierProd/CMS_CONDITIONS");
// BeamSpot
std::string tag = "BeamSpotObjects_PCL_byLumi_v0_prompt";
cond::Time_t start = static_cast<unsigned long long>(1406876667347162);
cond::Time_t end = static_cast<unsigned long long>(1488257707672138);
edm::LogPrint("testBeamSpotPayloadInspector") << "## Exercising BeamSpot plots " << std::endl;
BeamSpotParameters histoParameters;
histoParameters.process(connectionString, PI::mk_input(tag, start, start));
edm::LogPrint("testBeamSpotPayloadInspector") << histoParameters.data() << std::endl;
BeamSpotParametersDiffSingleTag histoParametersDiff;
histoParametersDiff.process(connectionString, PI::mk_input(tag, start, end));
edm::LogPrint("testBeamSpotPayloadInspector") << histoParametersDiff.data() << std::endl;
std::string tag1 = "BeamSpotObjects_Realistic25ns_900GeV_2021PilotBeams_v2_mc";
std::string tag2 = "BeamSpotObjects_Realistic25ns_900GeV_2021PilotBeams_v1_mc";
start = static_cast<unsigned long long>(1);
BeamSpotParametersDiffTwoTags histoParametersDiffTwoTags;
histoParametersDiffTwoTags.process(connectionString, PI::mk_input(tag1, start, start, tag2, start, start));
edm::LogPrint("testBeamSpotPayloadInspector") << histoParametersDiffTwoTags.data() << std::endl;
edm::LogPrint("testBeamSpotPayloadInspector") << "## Exercising BeamSpotOnline plots " << std::endl;
// BeamSpotOnline
tag = "BeamSpotOnlineTestLegacy";
start = static_cast<unsigned long long>(1443392479297557);
end = static_cast<unsigned long long>(1470910334763033);
edm::LogPrint("") << "###########################################################################\n"
<< " DISCLAIMER\n"
<< " The following unit test is going to print error messages about\n"
<< " out-of-range indices for the BeamSpotOnlineParameters.\n"
<< " This normal and expected, since the test payload has been written \n"
<< " with an obsolete data layout which doesn't contain few additional \n"
<< " parameters, see https://github.com/cms-sw/cmssw/pull/35338 for details. \n"
<< " This tests the catching of exceptions coming from reading not existing \n"
<< " parameters in the Payload inspector.\n";
BeamSpotOnlineParameters histoOnlineParameters;
histoOnlineParameters.process(connectionString, PI::mk_input(tag, start, start));
edm::LogPrint("testBeamSpotPayloadInspector") << histoOnlineParameters.data() << std::endl;
BeamSpotOnlineParametersDiffSingleTag histoOnlineParametersDiff;
histoOnlineParametersDiff.process(connectionString, PI::mk_input(tag, start, end));
edm::LogPrint("testBeamSpotPayloadInspector") << histoOnlineParametersDiff.data() << std::endl;
tag1 = "BeamSpotOnlineObjects_Ideal_Centered_SLHC_v3_mc";
tag2 = "BeamSpotOnlineObjects_Realistic25ns_13TeVCollisions_RoundOpticsLowSigmaZ_RunBased_v1_mc";
start = static_cast<unsigned long long>(4294967297); /*Run 1 : LS 1 (packed: 4294967297) this needs to be per LS */
BeamSpotOnlineParametersDiffTwoTags histoOnlineParametersDiffTwoTags;
histoOnlineParametersDiffTwoTags.process(connectionString, PI::mk_input(tag1, start, start, tag2, start, start));
edm::LogPrint("testBeamSpotPayloadInspector") << histoOnlineParametersDiffTwoTags.data() << std::endl;
// SimBeamSpot
std::string prepConnectionString("frontier://FrontierPrep/CMS_CONDITIONS");
tag = "SimBeamSpot_Realistic25ns13p6TeVEOY2022CollisionVtxSmearingParameters_v1_mc";
start = static_cast<unsigned long long>(1);
end = static_cast<unsigned long long>(1);
edm::LogPrint("testBeamSpotPayloadInspector") << "## Exercising SimBeamSpot plots " << std::endl;
SimBeamSpotParameters histoSimParameters;
histoSimParameters.process(prepConnectionString, PI::mk_input(tag, start, start));
edm::LogPrint("testBeamSpotPayloadInspector") << histoSimParameters.data() << std::endl;
SimBeamSpotParametersDiffSingleTag histoSimParametersDiff;
histoSimParametersDiff.process(prepConnectionString, PI::mk_input(tag, start, end));
edm::LogPrint("testBeamSpotPayloadInspector") << histoSimParametersDiff.data() << std::endl;
tag1 = "SimBeamSpot_Realistic25ns13p6TeVEOY2022CollisionVtxSmearingParameters_v1_mc";
tag2 = "SimBeamSpot_Realistic25ns13p6TeVEarly2023CollisionVtxSmearingParameters_v1_mc";
start = static_cast<unsigned long long>(1);
SimBeamSpotParametersDiffTwoTags histoSimParametersDiffTwoTags;
histoSimParametersDiffTwoTags.process(prepConnectionString, PI::mk_input(tag1, start, start, tag2, start, start));
edm::LogPrint("testBeamSpotPayloadInspector") << histoSimParametersDiffTwoTags.data() << std::endl;
// SimBeamSpotHLLHC
tag = "SimBeamSpotHLLHC_test_tag_1_v0";
edm::LogPrint("testBeamSpotPayloadInspector") << "## Exercising SimBeamSpotHLLHC plots " << std::endl;
SimBeamSpotHLLHCParameters histoSimHLLHCParameters;
histoSimHLLHCParameters.process(prepConnectionString, PI::mk_input(tag, start, start));
edm::LogPrint("testBeamSpotPayloadInspector") << histoSimHLLHCParameters.data() << std::endl;
SimBeamSpotHLLHCParametersDiffSingleTag histoSimHLLHCParametersDiff;
histoSimHLLHCParametersDiff.process(prepConnectionString, PI::mk_input(tag, start, end));
edm::LogPrint("testBeamSpotPayloadInspector") << histoSimHLLHCParametersDiff.data() << std::endl;
tag1 = "SimBeamSpotHLLHC_test_tag_1_v0";
tag2 = "SimBeamSpotHLLHC_test_tag_2_v0";
SimBeamSpotHLLHCParametersDiffTwoTags histoSimHLLHCParametersDiffTwoTags;
histoSimHLLHCParametersDiffTwoTags.process(prepConnectionString,
PI::mk_input(tag1, start, start, tag2, start, start));
edm::LogPrint("testBeamSpotPayloadInspector") << histoSimHLLHCParametersDiffTwoTags.data() << std::endl;
Py_Finalize();
}
|