CondTools
CTPPS
src
WriteCTPPSPixelAnalysisMask.cc
Go to the documentation of this file.
1
/****************************************************************************
2
*
3
* Offline analyzer for writing CTPPS Analysis Mask sqlite file
4
* H. Malbouisson
5
* based on TOTEM code from Jan Kašpar (jan.kaspar@gmail.com)
6
*
7
****************************************************************************/
8
9
#include "
FWCore/Framework/interface/one/EDAnalyzer.h
"
10
#include "
FWCore/Framework/interface/Event.h
"
11
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
12
#include "
FWCore/Framework/interface/EventSetup.h
"
13
#include "
FWCore/Framework/interface/MakerMacros.h
"
14
#include "
FWCore/Framework/interface/ESHandle.h
"
15
#include "
CondCore/CondDB/interface/Time.h
"
16
17
#include "
FWCore/Framework/interface/Frameworkfwd.h
"
18
#include "
FWCore/Framework/interface/EDProducer.h
"
19
20
#include "
FWCore/ServiceRegistry/interface/Service.h
"
21
#include "
CondCore/DBOutputService/interface/PoolDBOutputService.h
"
22
23
#include "
CondFormats/DataRecord/interface/CTPPSPixelDAQMappingRcd.h
"
24
#include "
CondFormats/DataRecord/interface/CTPPSPixelAnalysisMaskRcd.h
"
25
#include "
CondFormats/PPSObjects/interface/CTPPSPixelDAQMapping.h
"
26
#include "
CondFormats/PPSObjects/interface/CTPPSPixelAnalysisMask.h
"
27
28
#include <cstdint>
29
30
//----------------------------------------------------------------------------------------------------
31
35
class
WriteCTPPSPixelAnalysisMask
:
public
edm::one::EDAnalyzer
<> {
36
public
:
37
WriteCTPPSPixelAnalysisMask
(
const
edm::ParameterSet
&ps);
38
~WriteCTPPSPixelAnalysisMask
()
override
{}
39
40
private
:
41
void
analyze
(
const
edm::Event
&
e
,
const
edm::EventSetup
&es)
override
;
42
cond::Time_t
analysismaskiov_
;
43
std::string
record_
;
44
std::string
label_
;
45
46
edm::ESGetToken<CTPPSPixelAnalysisMask, CTPPSPixelAnalysisMaskRcd>
tokenAnalysisMask_
;
47
};
48
49
using namespace
std
;
50
using namespace
edm
;
51
52
//----------------------------------------------------------------------------------------------------
53
54
WriteCTPPSPixelAnalysisMask::WriteCTPPSPixelAnalysisMask
(
const
edm::ParameterSet
&ps)
55
: analysismaskiov_(ps.getParameter<unsigned long long>(
"analysismaskiov"
)),
56
record_(ps.getParameter<
string
>(
"record"
)),
57
label_(ps.getParameter<
string
>(
"label"
)),
58
tokenAnalysisMask_(
esConsumes
<
CTPPSPixelAnalysisMask
,
CTPPSPixelAnalysisMaskRcd
>(
edm
::
ESInputTag
(
""
, label_))) {}
59
60
void
WriteCTPPSPixelAnalysisMask::analyze
(
const
edm::Event
&,
edm::EventSetup
const
&es) {
61
// get analysis mask to mask channels
62
ESHandle<CTPPSPixelAnalysisMask>
hAnalysisMask = es.
getHandle
(
tokenAnalysisMask_
);
63
64
/*// print analysisMask
65
printf("* mask\n");
66
for (const auto &p : analysisMask->analysisMask)
67
cout << " " << p.first
68
<< ": fullMask=" << p.second.fullMask
69
<< ", number of masked channels " << p.second.maskedPixels.size() << endl;
70
*/
71
72
// Write Analysis Mask to sqlite file:
73
const
CTPPSPixelAnalysisMask
*pCTPPSPixelAnalysisMask = hAnalysisMask.
product
();
// Analysis Mask
74
edm::Service<cond::service::PoolDBOutputService>
poolDbService;
75
if
(poolDbService.
isAvailable
()) {
76
poolDbService->
writeOne
(pCTPPSPixelAnalysisMask,
analysismaskiov_
,
/*m_record*/
record_
);
77
}
78
}
79
80
//----------------------------------------------------------------------------------------------------
81
82
DEFINE_FWK_MODULE
(
WriteCTPPSPixelAnalysisMask
);
edm::ESHandle::product
T const * product() const
Definition:
ESHandle.h:86
CTPPSPixelAnalysisMaskRcd.h
EDAnalyzer.h
edm::ESInputTag
Definition:
ESInputTag.h:87
WriteCTPPSPixelAnalysisMask::record_
std::string record_
Definition:
WriteCTPPSPixelAnalysisMask.cc:47
CTPPSPixelDAQMappingRcd.h
EDProducer.h
ESHandle.h
edm
HLT enums.
Definition:
AlignableModifier.h:19
edm::one::EDAnalyzer
Definition:
EDAnalyzer.h:30
edm::Service::isAvailable
bool isAvailable() const
Definition:
Service.h:40
MakerMacros.h
WriteCTPPSPixelAnalysisMask::analyze
void analyze(const edm::Event &e, const edm::EventSetup &es) override
Definition:
WriteCTPPSPixelAnalysisMask.cc:59
CTPPSPixelAnalysisMask
Channel-mask mapping.
Definition:
CTPPSPixelAnalysisMask.h:34
PoolDBOutputService.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition:
MakerMacros.h:16
Service.h
WriteCTPPSPixelAnalysisMask::tokenAnalysisMask_
edm::ESGetToken< CTPPSPixelAnalysisMask, CTPPSPixelAnalysisMaskRcd > tokenAnalysisMask_
Definition:
WriteCTPPSPixelAnalysisMask.cc:50
edm::ESHandle
Definition:
DTSurvey.h:22
CTPPSPixelAnalysisMaskRcd
Definition:
CTPPSPixelAnalysisMaskRcd.h:23
CTPPSPixelAnalysisMask.h
Time.h
edm::ParameterSet
Definition:
ParameterSet.h:47
Event.h
WriteCTPPSPixelAnalysisMask::analysismaskiov_
cond::Time_t analysismaskiov_
Definition:
WriteCTPPSPixelAnalysisMask.cc:46
cond::Time_t
unsigned long long Time_t
Definition:
Time.h:14
edm::Service< cond::service::PoolDBOutputService >
edm::EventSetup::getHandle
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition:
EventSetup.h:155
edm::EventSetup
Definition:
EventSetup.h:58
edm::ESGetToken< CTPPSPixelAnalysisMask, CTPPSPixelAnalysisMaskRcd >
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
WriteCTPPSPixelAnalysisMask::WriteCTPPSPixelAnalysisMask
WriteCTPPSPixelAnalysisMask(const edm::ParameterSet &ps)
Definition:
WriteCTPPSPixelAnalysisMask.cc:53
std
Definition:
JetResolutionObject.h:76
CTPPSPixelDAQMapping.h
WriteCTPPSPixelAnalysisMask::~WriteCTPPSPixelAnalysisMask
~WriteCTPPSPixelAnalysisMask() override
Definition:
WriteCTPPSPixelAnalysisMask.cc:42
Frameworkfwd.h
cond::service::PoolDBOutputService::writeOne
Hash writeOne(const T *payload, Time_t time, const std::string &recordName)
Definition:
PoolDBOutputService.h:63
WriteCTPPSPixelAnalysisMask::label_
std::string label_
Definition:
WriteCTPPSPixelAnalysisMask.cc:48
EventSetup.h
ParameterSet.h
DeDxTools::esConsumes
ESGetTokenH3DDVariant esConsumes(std::string const &Reccord, edm::ConsumesCollector &)
Definition:
DeDxTools.cc:283
edm::Event
Definition:
Event.h:73
WriteCTPPSPixelAnalysisMask
Prints the Analysis Mask loaded by TotemDAQMappingESSourceXML.
Definition:
WriteCTPPSPixelAnalysisMask.cc:34
MillePedeFileConverter_cfg.e
e
Definition:
MillePedeFileConverter_cfg.py:37
Generated for CMSSW Reference Manual by
1.8.16