Skip to content

Commit 10cbd4a

Browse files
committed
created perLS PopCon: cloned old one, removed irrelevant code and adjusted the rest
1 parent 190a475 commit 10cbd4a

6 files changed

Lines changed: 728 additions & 1 deletion

File tree

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
#ifndef LHCINFOPOPCONSOURCEHANDLER_H
2+
#define LHCINFOPOPCONSOURCEHANDLER_H
3+
4+
#include <string>
5+
6+
#include "CondCore/PopCon/interface/PopConSourceHandler.h"
7+
#include "CondFormats/RunInfo/interface/LHCInfoPerLS.h"
8+
#include "FWCore/ParameterSet/interface/ParameterSetfwd.h"
9+
#include "CondCore/CondDB/interface/Types.h"
10+
#include "CondTools/RunInfo/interface/OMSAccess.h"
11+
12+
13+
namespace cond {
14+
class OMSService;
15+
}
16+
17+
class LHCInfoPerLSPopConSourceHandler : public popcon::PopConSourceHandler<LHCInfoPerLS> {
18+
public:
19+
LHCInfoPerLSPopConSourceHandler(const edm::ParameterSet& pset);
20+
~LHCInfoPerLSPopConSourceHandler() override;
21+
void getNewObjects() override;
22+
std::string id() const override;
23+
24+
static constexpr unsigned int kLumisectionsQueryLimit = 4000;
25+
26+
private:
27+
void addEmptyPayload(cond::Time_t iov);
28+
29+
bool makeFillPayload(std::unique_ptr<LHCInfoPerLS>& targetPayload,
30+
const cond::OMSServiceResult& queryResult);
31+
32+
33+
size_t getLumiData(const cond::OMSService& service,
34+
unsigned short fillId,
35+
const boost::posix_time::ptime& beginFillTime,
36+
const boost::posix_time::ptime& endFillTime);
37+
bool getCTTPSData(cond::persistency::Session& session,
38+
const boost::posix_time::ptime& beginFillTime,
39+
const boost::posix_time::ptime& endFillTime);
40+
41+
private:
42+
bool m_debug;
43+
// starting date for sampling
44+
boost::posix_time::ptime m_startTime;
45+
boost::posix_time::ptime m_endTime;
46+
// sampling interval in seconds
47+
unsigned int m_samplingInterval;
48+
bool m_endFill = true;
49+
std::string m_name;
50+
//for reading from relational database source
51+
std::string m_connectionString, m_ecalConnectionString;
52+
std::string m_dipSchema, m_authpath;
53+
std::string m_omsBaseUrl;
54+
std::unique_ptr<LHCInfoPerLS> m_fillPayload;
55+
std::shared_ptr<LHCInfoPerLS> m_prevPayload;
56+
cond::Time_t m_startFillTime;
57+
cond::Time_t m_endFillTime;
58+
cond::Time_t m_prevEndFillTime;
59+
std::vector<std::pair<cond::Time_t, std::shared_ptr<LHCInfoPerLS> > > m_tmpBuffer;
60+
bool m_lastPayloadEmpty = false;
61+
};
62+
63+
#endif

CondTools/RunInfo/plugins/BuildFile.xml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,4 +63,8 @@
6363

6464
<library file="LHCInfoPerFillAnalyzer.cc" name="LHCInfoPerFillAnalyzer">
6565
<flags EDM_PLUGIN="1"/>
66-
</library>
66+
</library>
67+
68+
<library file="LHCInfoPerLSPopConAnalyzer.cc" name="CondToolsLHCInfoPerLSPopConAnalyzer">
69+
<flags EDM_PLUGIN="1"/>
70+
</library>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#include "CondCore/PopCon/interface/PopConAnalyzer.h"
2+
#include "CondTools/RunInfo/interface/LHCInfoPerLSPopConSourceHandler.h"
3+
#include "FWCore/Framework/interface/MakerMacros.h"
4+
5+
typedef popcon::PopConAnalyzer<LHCInfoPerLSPopConSourceHandler> LHCInfoPerLSPopConAnalyzer;
6+
//define this as a plug-in
7+
DEFINE_FWK_MODULE(LHCInfoPerLSPopConAnalyzer);
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
import socket
2+
import FWCore.ParameterSet.Config as cms
3+
import FWCore.ParameterSet.VarParsing as VarParsing
4+
process = cms.Process("LHCInfoPerLSPopulator")
5+
from CondCore.CondDB.CondDB_cfi import *
6+
#process.load("CondCore.DBCommon.CondDBCommon_cfi")
7+
#process.CondDBCommon.connect = 'sqlite_file:lhcinfoperls_pop_test.db'
8+
#process.CondDBCommon.DBParameters.authenticationPath = '.'
9+
#process.CondDBCommon.DBParameters.messageLevel=cms.untracked.int32(1)
10+
11+
sourceConnection = 'oracle://cms_omds_adg/CMS_RUNINFO_R'
12+
if socket.getfqdn().find('.cms') != -1:
13+
sourceConnection = 'oracle://cms_omds_lb/CMS_RUNINFO_R'
14+
15+
options = VarParsing.VarParsing()
16+
options.register( 'destinationConnection'
17+
, 'sqlite_file:lhcinfo_pop_test.db' #default value
18+
, VarParsing.VarParsing.multiplicity.singleton
19+
, VarParsing.VarParsing.varType.string
20+
, "Connection string to the DB where payloads will be possibly written."
21+
)
22+
options.register( 'targetConnection'
23+
, '' #default value
24+
, VarParsing.VarParsing.multiplicity.singleton
25+
, VarParsing.VarParsing.varType.string
26+
, """Connection string to the target DB:
27+
if not empty (default), this provides the latest IOV and payloads to compare;
28+
it is the DB where payloads should be finally uploaded."""
29+
)
30+
options.register( 'tag'
31+
, 'LHCInfoPerLS_PopCon_start_test'
32+
, VarParsing.VarParsing.multiplicity.singleton
33+
, VarParsing.VarParsing.varType.string
34+
, "Tag written in destinationConnection and finally appended in targetConnection."
35+
)
36+
options.register( 'messageLevel'
37+
, 0 #default value
38+
, VarParsing.VarParsing.multiplicity.singleton
39+
, VarParsing.VarParsing.varType.int
40+
, "Message level; default to 0"
41+
)
42+
options.parseArguments()
43+
44+
CondDBConnection = CondDB.clone( connect = cms.string( options.destinationConnection ) )
45+
CondDBConnection.DBParameters.messageLevel = cms.untracked.int32( options.messageLevel )
46+
47+
process.MessageLogger = cms.Service("MessageLogger",
48+
cout = cms.untracked.PSet(threshold = cms.untracked.string('INFO')),
49+
destinations = cms.untracked.vstring('cout')
50+
)
51+
52+
process.source = cms.Source("EmptyIOVSource",
53+
lastValue = cms.uint64(1),
54+
timetype = cms.string('runnumber'),
55+
firstValue = cms.uint64(1),
56+
interval = cms.uint64(1)
57+
)
58+
59+
process.PoolDBOutputService = cms.Service("PoolDBOutputService",
60+
CondDBConnection,
61+
timetype = cms.untracked.string('timestamp'),
62+
toPut = cms.VPSet(cms.PSet(record = cms.string('LHCInfoPerLSRcd'),
63+
tag = cms.string( options.tag )
64+
)
65+
)
66+
)
67+
68+
process.Test1 = cms.EDAnalyzer("LHCInfoPerLSPopConAnalyzer",
69+
SinceAppendMode = cms.bool(True),
70+
record = cms.string('LHCInfoPerLSRcd'),
71+
name = cms.untracked.string('LHCInfo'),
72+
Source = cms.PSet(fill = cms.untracked.uint32(6417),
73+
startTime = cms.untracked.string('2021-09-10 03:10:18.000'),
74+
# endTime = cms.untracked.string('2018-04-06 05:00:00.000'),
75+
samplingInterval = cms.untracked.uint32( 600 ),
76+
endFill = cms.untracked.bool(True),
77+
connectionString = cms.untracked.string("oracle://cms_orcon_adg/CMS_RUNTIME_LOGGER"),
78+
ecalConnectionString = cms.untracked.string("oracle://cms_orcon_adg/CMS_DCS_ENV_PVSS_COND"),
79+
DIPSchema = cms.untracked.string("CMS_BEAM_COND"),
80+
omsBaseUrl = cms.untracked.string("http://vocms0184.cern.ch/agg/api/v1"),
81+
#authenticationPath = cms.untracked.string("."),
82+
debug=cms.untracked.bool(False)
83+
),
84+
loggingOn = cms.untracked.bool(True),
85+
IsDestDbCheckedInQueryLog = cms.untracked.bool(False)
86+
)
87+
88+
process.p = cms.Path(process.Test1)
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
import socket
2+
import FWCore.ParameterSet.Config as cms
3+
import FWCore.ParameterSet.VarParsing as VarParsing
4+
process = cms.Process("LHCInfoPerLSPopulator")
5+
from CondCore.CondDB.CondDB_cfi import *
6+
#process.load("CondCore.DBCommon.CondDBCommon_cfi")
7+
#process.CondDBCommon.connect = 'sqlite_file:lhcinfoperls_pop_test.db'
8+
#process.CondDBCommon.DBParameters.authenticationPath = '.'
9+
#process.CondDBCommon.DBParameters.messageLevel=cms.untracked.int32(1)
10+
11+
sourceConnection = 'oracle://cms_omds_adg/CMS_RUNINFO_R'
12+
if socket.getfqdn().find('.cms') != -1:
13+
sourceConnection = 'oracle://cms_omds_lb/CMS_RUNINFO_R'
14+
15+
options = VarParsing.VarParsing()
16+
options.register( 'destinationConnection'
17+
, 'sqlite_file:lhcinfo_pop_test.db' #default value
18+
, VarParsing.VarParsing.multiplicity.singleton
19+
, VarParsing.VarParsing.varType.string
20+
, "Connection string to the DB where payloads will be possibly written."
21+
)
22+
options.register( 'targetConnection'
23+
, '' #default value
24+
, VarParsing.VarParsing.multiplicity.singleton
25+
, VarParsing.VarParsing.varType.string
26+
, """Connection string to the target DB:
27+
if not empty (default), this provides the latest IOV and payloads to compare;
28+
it is the DB where payloads should be finally uploaded."""
29+
)
30+
options.register( 'tag'
31+
, 'LHCInfoPerLS_PopCon_start_test'
32+
, VarParsing.VarParsing.multiplicity.singleton
33+
, VarParsing.VarParsing.varType.string
34+
, "Tag written in destinationConnection and finally appended in targetConnection."
35+
)
36+
options.register( 'messageLevel'
37+
, 0 #default value
38+
, VarParsing.VarParsing.multiplicity.singleton
39+
, VarParsing.VarParsing.varType.int
40+
, "Message level; default to 0"
41+
)
42+
options.parseArguments()
43+
44+
CondDBConnection = CondDB.clone( connect = cms.string( options.destinationConnection ) )
45+
CondDBConnection.DBParameters.messageLevel = cms.untracked.int32( options.messageLevel )
46+
47+
process.MessageLogger = cms.Service("MessageLogger",
48+
cout = cms.untracked.PSet(threshold = cms.untracked.string('INFO')),
49+
destinations = cms.untracked.vstring('cout')
50+
)
51+
52+
process.source = cms.Source("EmptyIOVSource",
53+
lastValue = cms.uint64(1),
54+
timetype = cms.string('runnumber'),
55+
firstValue = cms.uint64(1),
56+
interval = cms.uint64(1)
57+
)
58+
59+
process.PoolDBOutputService = cms.Service("PoolDBOutputService",
60+
CondDBConnection,
61+
timetype = cms.untracked.string('timestamp'),
62+
toPut = cms.VPSet(cms.PSet(record = cms.string('LHCInfoPerLSRcd'),
63+
tag = cms.string( options.tag )
64+
)
65+
)
66+
)
67+
68+
process.Test1 = cms.EDAnalyzer("LHCInfoPerLSPopConAnalyzer",
69+
SinceAppendMode = cms.bool(True),
70+
record = cms.string('LHCInfoPerLSRcd'),
71+
name = cms.untracked.string('LHCInfo'),
72+
Source = cms.PSet(fill = cms.untracked.uint32(6417),
73+
startTime = cms.untracked.string('2021-09-10 03:10:18.000'),
74+
# endTime = cms.untracked.string('2018-04-06 05:00:00.000'),
75+
samplingInterval = cms.untracked.uint32( 600 ),
76+
endFill = cms.untracked.bool(False),
77+
connectionString = cms.untracked.string("oracle://cms_orcon_adg/CMS_RUNTIME_LOGGER"),
78+
ecalConnectionString = cms.untracked.string("oracle://cms_orcon_adg/CMS_DCS_ENV_PVSS_COND"),
79+
DIPSchema = cms.untracked.string("CMS_BEAM_COND"),
80+
omsBaseUrl = cms.untracked.string("http://vocms0184.cern.ch/agg/api/v1"),
81+
#authenticationPath = cms.untracked.string("."),
82+
debug=cms.untracked.bool(False)
83+
),
84+
loggingOn = cms.untracked.bool(True),
85+
IsDestDbCheckedInQueryLog = cms.untracked.bool(False)
86+
)
87+
88+
process.p = cms.Path(process.Test1)

0 commit comments

Comments
 (0)