CondTools
CTPPS
src
CTPPSRPAlignmentInfoAnalyzer.cc
Go to the documentation of this file.
1
/****************************************************************************
2
*
3
* Authors:
4
* Jan Kaspar
5
* Adapted by:
6
* Helena Malbouisson
7
* Clemencia Mora Herrera
8
****************************************************************************/
9
10
#include "
FWCore/Framework/interface/ESHandle.h
"
11
#include "
FWCore/Framework/interface/MakerMacros.h
"
12
#include "
FWCore/Utilities/interface/Exception.h
"
13
#include "
FWCore/Framework/interface/one/EDAnalyzer.h
"
14
#include "
FWCore/Framework/interface/Event.h
"
15
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
16
#include "
FWCore/Framework/interface/EventSetup.h
"
17
#include "
FWCore/Framework/interface/ESWatcher.h
"
18
#include "
CondCore/CondDB/interface/Time.h
"
19
#include "
FWCore/ServiceRegistry/interface/Service.h
"
20
#include "
CondCore/DBOutputService/interface/PoolDBOutputService.h
"
21
22
#include "
CondFormats/AlignmentRecord/interface/CTPPSRPAlignmentCorrectionsDataRcd.h
"
23
#include "
CondFormats/AlignmentRecord/interface/RPRealAlignmentRecord.h
"
24
#include "
CondFormats/AlignmentRecord/interface/RPMisalignedAlignmentRecord.h
"
25
26
#include "
CondFormats/PPSObjects/interface/CTPPSRPAlignmentCorrectionsData.h
"
27
#include <string>
28
29
//----------------------------------------------------------------------------------------------------
30
34
class
CTPPSRPAlignmentInfoAnalyzer
:
public
edm::one::EDAnalyzer
<> {
35
public
:
36
CTPPSRPAlignmentInfoAnalyzer
(
const
edm::ParameterSet
& ps);
37
~CTPPSRPAlignmentInfoAnalyzer
()
override
{}
38
39
private
:
40
void
analyze
(
const
edm::Event
&
e
,
const
edm::EventSetup
& es)
override
;
41
42
void
printInfo
(
const
CTPPSRPAlignmentCorrectionsData
& alignments,
const
edm::Event
&
event
)
const
;
43
edm::ESWatcher<CTPPSRPAlignmentCorrectionsDataRcd>
watcherAlignments_
;
44
45
cond::Time_t
iov_
;
46
std::string
record_
;
47
};
48
49
//----------------------------------------------------------------------------------------------------
50
//----------------------------------------------------------------------------------------------------
51
52
using namespace
std
;
53
using namespace
edm
;
54
55
//----------------------------------------------------------------------------------------------------
56
57
CTPPSRPAlignmentInfoAnalyzer::CTPPSRPAlignmentInfoAnalyzer
(
const
edm::ParameterSet
& iConfig) {
58
record_ = iConfig.
getParameter
<
string
>(
"record"
);
59
iov_ = iConfig.
getParameter
<
unsigned
long
long
>(
"iov"
);
60
}
61
62
//----------------------------------------------------------------------------------------------------
63
64
void
CTPPSRPAlignmentInfoAnalyzer::analyze
(
const
edm::Event
&
iEvent
,
const
edm::EventSetup
& iSetup) {
65
edm::ESHandle<CTPPSRPAlignmentCorrectionsData>
alignments;
66
if
(watcherAlignments_.check(iSetup)) {
67
if
(strcmp(record_.c_str(),
"CTPPSRPAlignmentCorrectionsDataRcd"
) == 0) {
68
iSetup.
get
<
CTPPSRPAlignmentCorrectionsDataRcd
>().
get
(alignments);
69
}
else
if
(strcmp(record_.c_str(),
"RPRealAlignmentRecord"
) == 0) {
70
iSetup.
get
<
RPRealAlignmentRecord
>().
get
(alignments);
71
}
else
{
72
iSetup.
get
<
RPMisalignedAlignmentRecord
>().
get
(alignments);
73
}
74
const
CTPPSRPAlignmentCorrectionsData
* pCTPPSRPAlignmentCorrectionsData = alignments.
product
();
75
edm::Service<cond::service::PoolDBOutputService>
poolDbService;
76
if
(poolDbService.
isAvailable
()) {
77
poolDbService->
writeOne
(pCTPPSRPAlignmentCorrectionsData, iov_, record_);
78
}
79
}
80
return
;
81
}
82
83
//----------------------------------------------------------------------------------------------------
84
85
void
CTPPSRPAlignmentInfoAnalyzer::printInfo
(
const
CTPPSRPAlignmentCorrectionsData
& alignments,
86
const
edm::Event
&
event
)
const
{
87
time_t unixTime =
event
.time().unixTime();
88
char
timeStr[50];
89
strftime(timeStr, 50,
"%F %T"
, localtime(&unixTime));
90
91
edm::LogInfo
(
"CTPPSRPAlignmentInfoAnalyzer"
)
92
<<
"New alignments found in run="
<<
event
.id().run() <<
", event="
<<
event
.id().event()
93
<<
", UNIX timestamp="
<< unixTime <<
" ("
<< timeStr <<
"):\n"
94
<< alignments;
95
}
96
97
//----------------------------------------------------------------------------------------------------
98
99
DEFINE_FWK_MODULE
(
CTPPSRPAlignmentInfoAnalyzer
);
edm::ESHandle::product
T const * product() const
Definition:
ESHandle.h:86
CTPPSRPAlignmentInfoAnalyzer::~CTPPSRPAlignmentInfoAnalyzer
~CTPPSRPAlignmentInfoAnalyzer() override
Definition:
CTPPSRPAlignmentInfoAnalyzer.cc:42
EDAnalyzer.h
edm::ESWatcher< CTPPSRPAlignmentCorrectionsDataRcd >
ESHandle.h
CTPPSRPAlignmentInfoAnalyzer::analyze
void analyze(const edm::Event &e, const edm::EventSetup &es) override
Definition:
CTPPSRPAlignmentInfoAnalyzer.cc:63
edm
HLT enums.
Definition:
AlignableModifier.h:19
edm::LogInfo
Definition:
MessageLogger.h:254
CTPPSRPAlignmentCorrectionsDataRcd
Definition:
CTPPSRPAlignmentCorrectionsDataRcd.h:23
edm::one::EDAnalyzer
Definition:
EDAnalyzer.h:30
RPMisalignedAlignmentRecord
Definition:
RPMisalignedAlignmentRecord.h:6
edm::Service::isAvailable
bool isAvailable() const
Definition:
Service.h:40
RPMisalignedAlignmentRecord.h
CTPPSRPAlignmentInfoAnalyzer
Class to print out information on current geometry.
Definition:
CTPPSRPAlignmentInfoAnalyzer.cc:33
MakerMacros.h
RPRealAlignmentRecord
Definition:
RPRealAlignmentRecord.h:6
PoolDBOutputService.h
edm::EventSetup::get
T get() const
Definition:
EventSetup.h:73
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition:
MakerMacros.h:16
Service.h
CTPPSRPAlignmentInfoAnalyzer::CTPPSRPAlignmentInfoAnalyzer
CTPPSRPAlignmentInfoAnalyzer(const edm::ParameterSet &ps)
Definition:
CTPPSRPAlignmentInfoAnalyzer.cc:56
RPRealAlignmentRecord.h
edm::ESHandle
Definition:
DTSurvey.h:22
CTPPSRPAlignmentInfoAnalyzer::watcherAlignments_
edm::ESWatcher< CTPPSRPAlignmentCorrectionsDataRcd > watcherAlignments_
Definition:
CTPPSRPAlignmentInfoAnalyzer.cc:48
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
CTPPSRPAlignmentInfoAnalyzer::iov_
cond::Time_t iov_
Definition:
CTPPSRPAlignmentInfoAnalyzer.cc:50
Time.h
edm::ParameterSet
Definition:
ParameterSet.h:36
Event.h
CTPPSRPAlignmentInfoAnalyzer::record_
std::string record_
Definition:
CTPPSRPAlignmentInfoAnalyzer.cc:51
cond::Time_t
unsigned long long Time_t
Definition:
Time.h:14
edm::Service< cond::service::PoolDBOutputService >
iEvent
int iEvent
Definition:
GenABIO.cc:224
edm::EventSetup
Definition:
EventSetup.h:57
get
#define get
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
CTPPSRPAlignmentCorrectionsDataRcd.h
std
Definition:
JetResolutionObject.h:76
ESWatcher.h
cond::service::PoolDBOutputService::writeOne
Hash writeOne(const T *payload, Time_t time, const std::string &recordName)
Definition:
PoolDBOutputService.h:57
CTPPSRPAlignmentCorrectionsData
Container for CTPPS RP alignment corrections. The corrections are stored on two levels - RP and senso...
Definition:
CTPPSRPAlignmentCorrectionsData.h:24
EventSetup.h
Exception.h
CTPPSRPAlignmentCorrectionsData.h
CTPPSRPAlignmentInfoAnalyzer::printInfo
void printInfo(const CTPPSRPAlignmentCorrectionsData &alignments, const edm::Event &event) const
Definition:
CTPPSRPAlignmentInfoAnalyzer.cc:84
ParameterSet.h
event
Definition:
event.py:1
edm::Event
Definition:
Event.h:73
MillePedeFileConverter_cfg.e
e
Definition:
MillePedeFileConverter_cfg.py:37
Generated for CMSSW Reference Manual by
1.8.16