src
CondCore
PopCon
interface
PopCon.h
Go to the documentation of this file.
1
#ifndef POPCON_POPCON_H
2
#define POPCON_POPCON_H
3
//
4
// Author: Vincenzo Innocente
5
// Original Author: Marcin BOGUSZ
6
//
7
8
#include "
CondCore/DBOutputService/interface/PoolDBOutputService.h
"
9
#include "
FWCore/ServiceRegistry/interface/Service.h
"
10
11
#include "
FWCore/MessageLogger/interface/MessageLogger.h
"
12
13
#include "
FWCore/ParameterSet/interface/ParameterSetfwd.h
"
14
15
#include "
CondCore/CondDB/interface/Time.h
"
16
17
#include <algorithm>
18
#include <functional>
19
#include <string>
20
#include <vector>
21
22
#include <iostream>
23
24
namespace
popcon
{
25
26
/* Populator of the Condition DB
27
*
28
*/
29
class
PopCon
{
30
public
:
31
typedef
cond::Time_t
Time_t
;
32
33
PopCon
(
const
edm::ParameterSet
&
pset
);
34
35
virtual
~PopCon
();
36
37
template
<
typename
Source>
38
void
write
(
Source
const
&
source
);
39
40
private
:
41
cond::persistency::Session
initialize
();
42
void
finalize
(
Time_t
lastTill);
43
44
private
:
45
edm::Service<cond::service::PoolDBOutputService>
m_dbService
;
46
47
cond::persistency::Session
m_targetSession
;
48
49
std::string
m_targetConnectionString
;
50
51
std::string
m_authPath
;
52
53
int
m_authSys
;
54
55
std::string
m_record
;
56
57
std::string
m_payload_name
;
58
59
bool
m_LoggingOn
;
60
61
std::string
m_tag
;
62
63
cond::TagInfo_t
m_tagInfo
;
64
65
cond::LogDBEntry_t
m_logDBEntry
;
66
67
bool
m_close
;
68
69
Time_t
m_lastTill
;
70
71
static
constexpr
const
char
*
const
s_version
=
"5.0"
;
72
};
73
74
template
<
typename
Source>
75
void
PopCon::write
(
Source
const
&
source
) {
76
typedef
typename
Source::value_type
value_type
;
77
typedef
typename
Source::Container
Container
;
78
79
std::pair<Container const*, std::string const>
ret
=
source
(
initialize
(),
m_tagInfo
,
m_logDBEntry
);
80
Container
const
& iovs = *
ret
.first;
81
82
if
(
m_LoggingOn
) {
83
std::string
msg
(
"Nothing to transfer;"
);
84
size_t
niovs = iovs.size();
85
if
(niovs) {
86
std::ostringstream
s
;
87
if
(niovs == 1) {
88
s
<<
"Since "
<< (*iovs.begin()).
first
<<
"; "
;
89
}
else
{
90
s
<<
"first payload Since "
<< (*iovs.begin()).
first
<<
", "
91
<<
"last payload Since "
<< (*iovs.rbegin()).
first
<<
"; "
;
92
}
93
msg
=
s
.str();
94
}
95
std::ostringstream
s
;
96
s
<<
"PopCon v"
<<
s_version
<<
"; "
<<
msg
<<
ret
.second;
97
m_dbService
->
setLogHeaderForRecord
(
m_record
,
source
.id(),
s
.str());
98
}
99
for
(
const
auto
&
it
: iovs)
100
edm::LogInfo
(
"PopCon"
) <<
"Since "
<<
it
.first << std::endl;
101
102
m_dbService
->
writeMany
(iovs,
m_record
);
103
104
finalize
(iovs.empty() ?
Time_t
(0) : iovs.rbegin()->first);
105
}
106
107
}
// namespace popcon
108
109
#endif // POPCON_POPCON_H
edm::Service< cond::service::PoolDBOutputService >
popcon::PopCon::m_logDBEntry
cond::LogDBEntry_t m_logDBEntry
Definition:
PopCon.h:65
popcon::PopCon::finalize
void finalize(Time_t lastTill)
Definition:
PopCon.cc:73
MessageLogger.h
CollectionTags_cfi.Source
Source
Definition:
CollectionTags_cfi.py:11
popcon::PopCon::m_lastTill
Time_t m_lastTill
Definition:
PopCon.h:69
runTheMatrix.ret
ret
prodAgent to be discontinued
Definition:
runTheMatrix.py:759
popcon::PopCon::m_close
bool m_close
Definition:
PopCon.h:67
alignCSCRings.s
s
Definition:
alignCSCRings.py:92
popcon::PopCon::Time_t
cond::Time_t Time_t
Definition:
PopCon.h:31
popcon
Definition:
Exception.h:6
muonDTDigis_cfi.pset
pset
Definition:
muonDTDigis_cfi.py:27
popcon::PopCon::m_tag
std::string m_tag
Definition:
PopCon.h:61
popcon::PopCon::m_record
std::string m_record
Definition:
PopCon.h:55
ALPAKA_ACCELERATOR_NAMESPACE::brokenline::constexpr
if constexpr(n > 3)
Definition:
BrokenLine.h:164
popcon::PopCon::write
void write(Source const &source)
Definition:
PopCon.h:75
ParameterSetfwd.h
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
popcon::PopCon::m_targetSession
cond::persistency::Session m_targetSession
Definition:
PopCon.h:47
popcon::PopCon
Definition:
PopCon.h:29
cond::LogDBEntry_t
Definition:
Types.h:86
reco::JetExtendedAssociation::value_type
Container::value_type value_type
Definition:
JetExtendedAssociation.h:30
cond::Time_t
unsigned long long Time_t
Definition:
Time.h:14
PoolDBOutputService.h
Service.h
popcon::PopCon::m_targetConnectionString
std::string m_targetConnectionString
Definition:
PopCon.h:49
popcon::PopCon::m_tagInfo
cond::TagInfo_t m_tagInfo
Definition:
PopCon.h:63
popcon::PopCon::PopCon
PopCon(const edm::ParameterSet &pset)
Definition:
PopCon.cc:12
cond::service::PoolDBOutputService::setLogHeaderForRecord
void setLogHeaderForRecord(const std::string &recordName, const std::string &provenance, const std::string &usertext)
Definition:
PoolDBOutputService.cc:434
cond::TagInfo_t
Definition:
Types.h:69
edm::LogInfo
Log< level::Info, false > LogInfo
Definition:
MessageLogger.h:131
popcon::PopCon::s_version
static constexpr const char *const s_version
Definition:
PopCon.h:71
popcon::PopCon::m_authSys
int m_authSys
Definition:
PopCon.h:53
popcon::PopCon::initialize
cond::persistency::Session initialize()
Definition:
PopCon.cc:35
mps_check.msg
tuple msg
Definition:
mps_check.py:286
popcon::PopCon::m_authPath
std::string m_authPath
Definition:
PopCon.h:51
cond::service::PoolDBOutputService::writeMany
void writeMany(const std::map< Time_t, std::shared_ptr< T > > &iovAndPayloads, const std::string &recordName)
Definition:
PoolDBOutputService.h:107
dqmdumpme.first
first
Definition:
dqmdumpme.py:55
ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it
auto & it
Definition:
splitVertices.h:48
popcon::PopCon::~PopCon
virtual ~PopCon()
Definition:
PopCon.cc:29
cond::persistency::Session
Definition:
Session.h:63
edm::ParameterSet
Definition:
ParameterSet.h:48
reco::JetExtendedAssociation::Container
edm::AssociationVector< reco::JetRefBaseProd, Values > Container
Definition:
JetExtendedAssociation.h:29
Time.h
popcon::PopCon::m_payload_name
std::string m_payload_name
Definition:
PopCon.h:57
source
static std::string const source
Definition:
EdmProvDump.cc:49
popcon::PopCon::m_dbService
edm::Service< cond::service::PoolDBOutputService > m_dbService
Definition:
PopCon.h:45
popcon::PopCon::m_LoggingOn
bool m_LoggingOn
Definition:
PopCon.h:59
Generated for CMSSW Reference Manual by
1.8.14