OnlineDB
SiStripO2O
plugins
SiStripPopConConfigDbObjHandler.h
Go to the documentation of this file.
1
#ifndef SISTRIPPOPCON_CONFIGDB_HANDLER_H
2
#define SISTRIPPOPCON_CONFIGDB_HANDLER_H
3
4
#include "
FWCore/ParameterSet/interface/ParameterSetfwd.h
"
5
#include "
FWCore/ServiceRegistry/interface/Service.h
"
6
#include "
FWCore/MessageLogger/interface/MessageLogger.h
"
7
#include "
FWCore/ParameterSet/interface/ParameterSetfwd.h
"
8
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
9
10
#include "
CondCore/PopCon/interface/PopConSourceHandler.h
"
11
#include "
CondCore/CondDB/interface/Types.h
"
12
13
#include "
OnlineDB/SiStripESSources/interface/SiStripCondObjBuilderFromDb.h
"
14
#include "
OnlineDB/SiStripConfigDb/interface/SiStripDbParams.h
"
15
#include "
OnlineDB/SiStripConfigDb/interface/SiStripPartition.h
"
16
17
#include <sstream>
18
#include <vector>
19
#include <string>
20
#include <iostream>
21
#include <typeinfo>
22
23
namespace
popcon
{
24
25
template
<
typename
T>
26
class
SiStripPopConConfigDbObjHandler
:
public
popcon::PopConSourceHandler
<T> {
27
public
:
28
//---------------------------------------
29
//
30
SiStripPopConConfigDbObjHandler
(
const
edm::ParameterSet
&
pset
)
31
:
m_name
(
pset
.getUntrackedParameter<
std
::
string
>(
"name"
,
"SiStripPopPopConConfigDbObjHandler"
)),
32
m_since
(
pset
.getUntrackedParameter<uint32_t>(
"since"
, 5)),
33
m_debugMode
(
pset
.getUntrackedParameter<
bool
>(
"debug"
,
false
)){};
34
35
//---------------------------------------
36
//
37
~SiStripPopConConfigDbObjHandler
()
override
{};
38
39
//---------------------------------------
40
//
41
void
getNewObjects
()
override
{
42
edm::LogInfo
(
"SiStripPopPopConConfigDbObjHandler"
) <<
"[getNewObjects] for PopCon application "
<<
m_name
;
43
44
if
(
m_debugMode
) {
45
std::stringstream
ss
;
46
ss
<<
"\n\n------- "
<<
m_name
<<
" - > getNewObjects\n"
;
47
if
(this->
tagInfo
().
size
) {
48
//check whats already inside of database
49
ss <<
"got offlineInfo"
<< this->
tagInfo
().
name
<<
", size "
<< this->
tagInfo
().
size
50
<<
" , last object valid since "
<< this->
tagInfo
().
lastInterval
.
since
<<
" token "
51
<< this->
tagInfo
().
lastInterval
.
payloadId
<<
"\n\n UserText "
<< this->
userTextLog
() <<
"\n LogDBEntry \n"
52
<< this->
logDBEntry
().
logId
<<
"\n"
53
<< this->
logDBEntry
().
destinationDB
<<
"\n"
54
<< this->
logDBEntry
().
provenance
<<
"\n"
55
<< this->
logDBEntry
().
usertext
<<
"\n"
56
<< this->
logDBEntry
().
iovtag
<<
"\n"
57
<< this->
logDBEntry
().
iovtimetype
<<
"\n"
58
<< this->
logDBEntry
().
payloadIdx
<<
"\n"
59
<< this->
logDBEntry
().
payloadClass
<<
"\n"
60
<< this->
logDBEntry
().
payloadToken
<<
"\n"
61
<< this->
logDBEntry
().
exectime
<<
"\n"
62
<< this->
logDBEntry
().
execmessage
<<
"\n"
63
<<
"\n\n-- user text "
64
<< this->
logDBEntry
().
usertext
.substr(this->
logDBEntry
().usertext.find_last_of(
"@"
));
65
}
else
{
66
ss
<<
" First object for this tag "
;
67
}
68
edm::LogInfo
(
"SiStripPopPopConConfigDbObjHandler"
) <<
ss
.str();
69
}
70
if
(
isTransferNeeded
())
71
setForTransfer
();
72
73
edm::LogInfo
(
"SiStripPopPopConConfigDbObjHandler"
)
74
<<
"[getNewObjects] for PopCon application "
<<
m_name
<<
" Done\n--------------\n"
;
75
}
76
77
//---------------------------------------
78
//
79
std::string
id
()
const override
{
return
m_name
; }
80
81
//---------------------------------------
82
//
83
bool
isTransferNeeded
() {
84
edm::LogInfo
(
"SiStripPopPopConConfigDbObjHandler"
)
85
<<
"[isTransferNeeded] checking for transfer: "
<<
typeid
(
T
).
name
() << std::endl;
86
std::stringstream ss_logdb,
ss
;
87
88
//get log information from previous upload
89
if
(!this->
logDBEntry
().
usertext
.empty())
90
ss_logdb << this->
logDBEntry
().
usertext
.substr(this->
logDBEntry
().usertext.find_first_of(
"@"
));
91
else
92
ss_logdb <<
""
;
93
94
std::string
label
=
""
;
95
if
(
typeid
(
T
) ==
typeid
(
SiStripFedCabling
))
96
label
=
"Cabling"
;
97
98
if
(
typeid
(
T
) ==
typeid
(
SiStripApvGain
))
99
label
=
"ApvTiming"
;
100
101
if
(
typeid
(
T
) ==
typeid
(
SiStripLatency
))
102
label
=
"ApvLatency"
;
103
104
if
(!
condObjBuilder
->
checkForCompatibility
(ss_logdb,
ss
,
label
)) {
105
//string are equal, no need to do transfer
106
edm::LogInfo
(
"SiStripPopPopConConfigDbObjHandler"
)
107
<<
"[isTransferNeeded] the selected conditions are already uploaded in the last iov ("
108
<< this->
tagInfo
().
lastInterval
.
since
<<
") open for the object "
<< this->
logDBEntry
().
payloadClass
109
<<
" in the db "
<< this->
logDBEntry
().
destinationDB
<<
" parameters: "
<< ss_logdb.str()
110
<<
"\n NO TRANSFER NEEDED"
;
111
return
false
;
112
}
113
114
this->
m_userTextLog
= ss.str();
115
edm::LogInfo
(
"SiStripPopPopConConfigDbObjHandler"
)
116
<<
"[isTransferNeeded] the selected conditions will be uploaded: "
<<
ss
.str()
117
<<
"\n Going to Upload: "
<<
ss
.str() <<
"\n Last Upload: "
<< ss_logdb.str() <<
"\n Fine"
;
118
119
return
true
;
120
}
121
122
//---------------------------------------
123
//
124
void
setForTransfer
() {
125
edm::LogInfo
(
"SiStripPopPopConConfigDbObjHandler"
)
126
<<
"[setForTransfer] "
<<
m_name
<<
" getting data to be transferred "
<< std::endl;
127
128
T
*
obj
=
nullptr
;
129
condObjBuilder
->
getValue
(
obj
);
130
131
edm::LogInfo
(
"SiStripPopPopConConfigDbObjHandler"
)
132
<<
"[setForTransfer] "
<<
m_name
<<
" got data to be transferred from condObjBuilder "
<< std::endl;
133
134
if
(!this->
tagInfo
().
size
)
135
m_since
= 1;
136
else
if
(
m_debugMode
)
137
m_since
= this->
tagInfo
().
lastInterval
.
since
+ 1;
138
edm::LogInfo
(
"SiStripPopPopConConfigDbObjHandler"
) <<
"[setForTransfer] setting since = "
<<
m_since
<< std::endl;
139
140
if
(
obj
!=
nullptr
) {
141
edm::LogInfo
(
"SiStripPopPopConConfigDbObjHandler"
) <<
"[setForTransfer] filling map m_to_transfer"
<< std::endl;
142
this->
m_to_transfer
.push_back(std::make_pair(
obj
,
m_since
));
143
}
else
{
144
edm::LogError
(
"SiStripPopPopConConfigDbObjHandler"
)
145
<<
"[setForTransfer] "
<<
m_name
<<
" : NULL pointer of obj "
<<
typeid
(
T
).
name
()
146
<<
" reported by SiStripCondObjBuilderFromDb\n Transfer aborted"
<< std::endl;
147
}
148
}
149
150
private
:
151
// data members
152
std::string
m_name
;
153
unsigned
long
long
m_since
;
154
bool
m_debugMode
;
155
edm::Service<SiStripCondObjBuilderFromDb>
condObjBuilder
;
156
};
157
}
// namespace popcon
158
159
#endif //SISTRIPPOPCON_CONFIGDB_HANDLER_H
PopConSourceHandler.h
SiStripPartition.h
electrons_cff.bool
bool
Definition:
electrons_cff.py:366
popcon::SiStripPopConConfigDbObjHandler::getNewObjects
void getNewObjects() override
Definition:
SiStripPopConConfigDbObjHandler.h:41
popcon::SiStripPopConConfigDbObjHandler::isTransferNeeded
bool isTransferNeeded()
Definition:
SiStripPopConConfigDbObjHandler.h:83
popcon::PopConSourceHandler::m_to_transfer
OldContainer m_to_transfer
Definition:
PopConSourceHandler.h:162
MessageLogger.h
funct::false
false
Definition:
Factorize.h:29
SiStripCondObjBuilderFromDb::getValue
void getValue(SiStripFedCabling *&val)
Definition:
SiStripCondObjBuilderFromDb.h:121
SiStripCondObjBuilderFromDb.h
SiStripCondObjBuilderFromDb::checkForCompatibility
bool checkForCompatibility(std::stringstream &input, std::stringstream &output, std::string &label)
Definition:
SiStripCondObjBuilderFromDb.cc:162
edm::LogInfo
Log< level::Info, false > LogInfo
Definition:
MessageLogger.h:125
SiStripDbParams.h
SiStripFedCabling
Contains cabling info at the device level, including DetId, APV pair numbers, hardware addresses,...
Definition:
SiStripFedCabling.h:25
cond::LogDBEntry_t::execmessage
std::string execmessage
Definition:
Types.h:98
popcon::SiStripPopConConfigDbObjHandler
Definition:
SiStripPopConConfigDbObjHandler.h:26
cond::TagInfo_t::name
std::string name
Definition:
Types.h:72
contentValuesCheck.ss
ss
Definition:
contentValuesCheck.py:33
Service.h
cond::LogDBEntry_t::provenance
std::string provenance
Definition:
Types.h:89
popcon::SiStripPopConConfigDbObjHandler::SiStripPopConConfigDbObjHandler
SiStripPopConConfigDbObjHandler(const edm::ParameterSet &pset)
Definition:
SiStripPopConConfigDbObjHandler.h:30
getGTfromDQMFile.obj
obj
Definition:
getGTfromDQMFile.py:32
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
cond::LogDBEntry_t::payloadToken
std::string payloadToken
Definition:
Types.h:96
edm::ParameterSet
Definition:
ParameterSet.h:47
popcon::PopConSourceHandler::tagInfo
cond::TagInfo_t const & tagInfo() const
Definition:
PopConSourceHandler.h:78
cond::Iov_t::payloadId
Hash payloadId
Definition:
Types.h:55
popcon::SiStripPopConConfigDbObjHandler::~SiStripPopConConfigDbObjHandler
~SiStripPopConConfigDbObjHandler() override
Definition:
SiStripPopConConfigDbObjHandler.h:37
cond::LogDBEntry_t::usertext
std::string usertext
Definition:
Types.h:90
cond::Iov_t::since
Time_t since
Definition:
Types.h:53
edm::Service< SiStripCondObjBuilderFromDb >
cond::LogDBEntry_t::iovtag
std::string iovtag
Definition:
Types.h:91
cond::LogDBEntry_t::destinationDB
std::string destinationDB
Definition:
Types.h:88
edm::LogError
Log< level::Error, false > LogError
Definition:
MessageLogger.h:123
popcon::PopConSourceHandler
Definition:
PopConSourceHandler.h:30
popcon::SiStripPopConConfigDbObjHandler::condObjBuilder
edm::Service< SiStripCondObjBuilderFromDb > condObjBuilder
Definition:
SiStripPopConConfigDbObjHandler.h:155
cond::TagInfo_t::lastInterval
Iov_t lastInterval
Definition:
Types.h:73
cond::LogDBEntry_t::iovtimetype
std::string iovtimetype
Definition:
Types.h:92
popcon::SiStripPopConConfigDbObjHandler::id
std::string id() const override
Definition:
SiStripPopConConfigDbObjHandler.h:79
cond::LogDBEntry_t::payloadClass
std::string payloadClass
Definition:
Types.h:95
std
Definition:
JetResolutionObject.h:76
popcon
Definition:
Exception.h:6
T
long double T
Definition:
Basic3DVectorLD.h:48
cond::LogDBEntry_t::logId
unsigned long long logId
Definition:
Types.h:87
ParameterSetfwd.h
Skims_PA_cff.name
name
Definition:
Skims_PA_cff.py:17
popcon::SiStripPopConConfigDbObjHandler::m_debugMode
bool m_debugMode
Definition:
SiStripPopConConfigDbObjHandler.h:154
popcon::SiStripPopConConfigDbObjHandler::m_since
unsigned long long m_since
Definition:
SiStripPopConConfigDbObjHandler.h:153
ParameterSet.h
Types.h
SiStripLatency
Definition:
SiStripLatency.h:59
SiStripApvGain
Definition:
SiStripApvGain.h:25
cond::LogDBEntry_t::payloadIdx
unsigned int payloadIdx
Definition:
Types.h:93
popcon::PopConSourceHandler::m_userTextLog
std::string m_userTextLog
Definition:
PopConSourceHandler.h:168
popcon::SiStripPopConConfigDbObjHandler::setForTransfer
void setForTransfer()
Definition:
SiStripPopConConfigDbObjHandler.h:124
popcon::SiStripPopConConfigDbObjHandler::m_name
std::string m_name
Definition:
SiStripPopConConfigDbObjHandler.h:152
label
const char * label
Definition:
PFTauDecayModeTools.cc:11
popcon::PopConSourceHandler::logDBEntry
cond::LogDBEntry_t const & logDBEntry() const
Definition:
PopConSourceHandler.h:84
popcon::PopConSourceHandler::userTextLog
std::string const & userTextLog() const
Definition:
PopConSourceHandler.h:111
muonDTDigis_cfi.pset
pset
Definition:
muonDTDigis_cfi.py:27
cond::TagInfo_t::size
size_t size
Definition:
Types.h:74
findQualityFiles.size
size
Write out results.
Definition:
findQualityFiles.py:443
cond::LogDBEntry_t::exectime
std::string exectime
Definition:
Types.h:97
Generated for CMSSW Reference Manual by
1.8.16