CalibPPS
ESProducers
plugins
CTPPSAlignmentInfo.cc
Go to the documentation of this file.
1
/****************************************************************************
2
*
3
* Authors:
4
* Jan Kašpar (jan.kaspar@gmail.com)
5
*
6
****************************************************************************/
7
8
#include "
FWCore/Framework/interface/ESHandle.h
"
9
#include "
FWCore/Framework/interface/MakerMacros.h
"
10
#include "
FWCore/Utilities/interface/Exception.h
"
11
#include "
FWCore/Framework/interface/one/EDAnalyzer.h
"
12
#include "
FWCore/Framework/interface/Event.h
"
13
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
14
#include "
FWCore/Framework/interface/EventSetup.h
"
15
#include "
FWCore/Framework/interface/ESWatcher.h
"
16
17
#include "
CondFormats/AlignmentRecord/interface/RPRealAlignmentRecord.h
"
18
#include "
CondFormats/AlignmentRecord/interface/RPMisalignedAlignmentRecord.h
"
19
20
#include "
CondFormats/PPSObjects/interface/CTPPSRPAlignmentCorrectionsData.h
"
21
22
//----------------------------------------------------------------------------------------------------
23
27
class
CTPPSAlignmentInfo
:
public
edm::one::EDAnalyzer
<> {
28
public
:
29
explicit
CTPPSAlignmentInfo
(
const
edm::ParameterSet
&);
30
31
private
:
32
std::string
alignmentType_
;
33
34
edm::ESWatcher<RPRealAlignmentRecord>
watcherRealAlignments_
;
35
edm::ESWatcher<RPMisalignedAlignmentRecord>
watcherMisalignedAlignments_
;
36
37
void
analyze
(
const
edm::Event
&,
const
edm::EventSetup
&)
override
;
38
39
void
printInfo
(
const
CTPPSRPAlignmentCorrectionsData
& alignments,
const
edm::Event
&
event
)
const
;
40
};
41
42
//----------------------------------------------------------------------------------------------------
43
//----------------------------------------------------------------------------------------------------
44
45
using namespace
std
;
46
using namespace
edm
;
47
48
//----------------------------------------------------------------------------------------------------
49
50
CTPPSAlignmentInfo::CTPPSAlignmentInfo
(
const
edm::ParameterSet
& iConfig)
51
: alignmentType_(iConfig.getUntrackedParameter<
std
::
string
>(
"alignmentType"
,
"real"
)) {}
52
53
//----------------------------------------------------------------------------------------------------
54
55
void
CTPPSAlignmentInfo::analyze
(
const
edm::Event
&
iEvent
,
const
edm::EventSetup
& iSetup) {
56
edm::ESHandle<CTPPSRPAlignmentCorrectionsData>
alignments;
57
58
if
(
alignmentType_
==
"real"
) {
59
if
(
watcherRealAlignments_
.
check
(iSetup)) {
60
iSetup.
get
<
RPRealAlignmentRecord
>().
get
(alignments);
61
printInfo
(*alignments,
iEvent
);
62
}
63
return
;
64
}
65
66
else
if
(
alignmentType_
==
"misaligned"
) {
67
if
(
watcherMisalignedAlignments_
.
check
(iSetup)) {
68
iSetup.
get
<
RPMisalignedAlignmentRecord
>().
get
(alignments);
69
printInfo
(*alignments,
iEvent
);
70
}
71
return
;
72
}
73
74
throw
cms::Exception
(
"CTPPSAlignmentInfo"
) <<
"Unknown geometry type: `"
<<
alignmentType_
<<
"'."
;
75
}
76
77
//----------------------------------------------------------------------------------------------------
78
79
void
CTPPSAlignmentInfo::printInfo
(
const
CTPPSRPAlignmentCorrectionsData
& alignments,
const
edm::Event
&
event
)
const
{
80
time_t unixTime =
event
.time().unixTime();
81
char
timeStr[50];
82
strftime(timeStr, 50,
"%F %T"
, localtime(&unixTime));
83
84
edm::LogInfo
(
"CTPPSAlignmentInfo"
) <<
"New "
<<
alignmentType_
<<
" alignments found in run="
<<
event
.id().run()
85
<<
", event="
<<
event
.id().event() <<
", UNIX timestamp="
<< unixTime <<
" ("
86
<< timeStr <<
"):\n"
87
<< alignments;
88
}
89
90
//----------------------------------------------------------------------------------------------------
91
92
DEFINE_FWK_MODULE
(
CTPPSAlignmentInfo
);
edm::ESWatcher::check
bool check(const edm::EventSetup &iSetup)
Definition:
ESWatcher.h:52
EDAnalyzer.h
edm::ESWatcher< RPRealAlignmentRecord >
ESHandle.h
edm
HLT enums.
Definition:
AlignableModifier.h:19
edm::LogInfo
Definition:
MessageLogger.h:254
CTPPSAlignmentInfo::alignmentType_
std::string alignmentType_
Definition:
CTPPSAlignmentInfo.cc:36
edm::one::EDAnalyzer
Definition:
EDAnalyzer.h:30
RPMisalignedAlignmentRecord
Definition:
RPMisalignedAlignmentRecord.h:6
CTPPSAlignmentInfo::analyze
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition:
CTPPSAlignmentInfo.cc:55
RPMisalignedAlignmentRecord.h
MakerMacros.h
RPRealAlignmentRecord
Definition:
RPRealAlignmentRecord.h:6
edm::EventSetup::get
T get() const
Definition:
EventSetup.h:73
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition:
MakerMacros.h:16
RPRealAlignmentRecord.h
edm::ESHandle
Definition:
DTSurvey.h:22
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ParameterSet
Definition:
ParameterSet.h:36
Event.h
CTPPSAlignmentInfo
Class to print out information on current geometry.
Definition:
CTPPSAlignmentInfo.cc:27
iEvent
int iEvent
Definition:
GenABIO.cc:224
edm::EventSetup
Definition:
EventSetup.h:57
get
#define get
std
Definition:
JetResolutionObject.h:76
CTPPSAlignmentInfo::CTPPSAlignmentInfo
CTPPSAlignmentInfo(const edm::ParameterSet &)
Definition:
CTPPSAlignmentInfo.cc:50
ESWatcher.h
Exception
Definition:
hltDiff.cc:246
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
CTPPSAlignmentInfo::watcherMisalignedAlignments_
edm::ESWatcher< RPMisalignedAlignmentRecord > watcherMisalignedAlignments_
Definition:
CTPPSAlignmentInfo.cc:39
ParameterSet.h
event
Definition:
event.py:1
edm::Event
Definition:
Event.h:73
CTPPSAlignmentInfo::printInfo
void printInfo(const CTPPSRPAlignmentCorrectionsData &alignments, const edm::Event &event) const
Definition:
CTPPSAlignmentInfo.cc:79
CTPPSAlignmentInfo::watcherRealAlignments_
edm::ESWatcher< RPRealAlignmentRecord > watcherRealAlignments_
Definition:
CTPPSAlignmentInfo.cc:38
Generated for CMSSW Reference Manual by
1.8.16