DQMOffline
PFTau
plugins
PFDQMEventSelector.cc
Go to the documentation of this file.
1
#include "
DQMOffline/PFTau/plugins/PFDQMEventSelector.h
"
2
3
#include "
DataFormats/Common/interface/Handle.h
"
4
#include "
FWCore/Framework/interface/Event.h
"
5
#include "
FWCore/MessageLogger/interface/MessageLogger.h
"
6
7
#include "
DQMServices/Core/interface/DQMStore.h
"
8
#include "
FWCore/ServiceRegistry/interface/Service.h
"
9
10
#include <iostream>
11
12
//
13
// -- Constructor
14
//
15
PFDQMEventSelector::PFDQMEventSelector
(
const
edm::ParameterSet
&
pset
) {
16
verbose_
=
pset
.getParameter<
bool
>(
"DebugOn"
);
17
inputFileName_
=
pset
.getParameter<
std::string
>(
"InputFileName"
);
18
folderNames_
=
pset
.getParameter<std::vector<std::string>>(
"FolderNames"
);
19
20
nEvents_
= 0;
21
nSelectedEvents_
= 0;
22
fileOpened_
=
false
;
23
}
24
//
25
// -- Destructor
26
//
27
PFDQMEventSelector::~PFDQMEventSelector
() {}
28
29
//
30
// -- BeginJob
31
//
32
void
PFDQMEventSelector::beginJob
() {
33
dqmStore_
=
edm::Service<DQMStore>
().operator->();
34
fileOpened_
=
openInputFile
();
35
}
36
//
37
// -- Event Filtering
38
//
39
bool
PFDQMEventSelector::filter
(
edm::Event
&
iEvent
,
edm::EventSetup
const
&iSetup) {
40
nEvents_
++;
41
if
(!
fileOpened_
)
42
return
false
;
43
44
edm::RunNumber_t
runNb =
iEvent
.id().run();
45
edm::EventNumber_t
evtNb =
iEvent
.id().event();
46
edm::LuminosityBlockNumber_t
lumiNb =
iEvent
.id().luminosityBlock();
47
std::ostringstream eventid_str;
48
eventid_str << runNb <<
"_"
<< evtNb <<
"_"
<< lumiNb;
49
50
for
(std::vector<std::string>::const_iterator ifolder =
folderNames_
.begin(); ifolder !=
folderNames_
.end();
51
ifolder++) {
52
std::string
path
=
"ParticleFlow/"
+ (*ifolder) +
"/BadEvents"
;
53
MonitorElement
*
me
=
dqmStore_
->
get
(
path
+
"/"
+ eventid_str.str());
54
if
(
me
) {
55
nSelectedEvents_
++;
56
if
(
verbose_
)
57
std::cout
<<
" Total Events "
<<
nEvents_
<<
" Selected Events "
<<
nSelectedEvents_
<<
" Run # : "
<< runNb
58
<<
" Event # : "
<< evtNb <<
" Luminosity Block # : "
<< lumiNb << std::endl;
59
return
true
;
60
}
61
}
62
return
false
;
63
}
64
//
65
// -- End Job
66
//
67
void
PFDQMEventSelector::endJob
() {
68
if
(
verbose_
)
69
std::cout
<<
" Total Events "
<<
nEvents_
<<
" Selected Events "
<<
nSelectedEvents_
<< std::endl;
70
}
71
//
72
// -- Open Input File
73
//
74
bool
PFDQMEventSelector::openInputFile
() {
75
if
(
inputFileName_
.empty())
76
return
false
;
77
edm::LogInfo
(
"SiStripOfflineDQM"
) <<
"SiStripOfflineDQM::openInputFile: Accessing root File"
<<
inputFileName_
;
78
dqmStore_
->
open
(
inputFileName_
,
false
,
""
,
""
,
DQMStore::StripRunDirs
);
79
return
true
;
80
}
81
82
#include "
FWCore/Framework/interface/MakerMacros.h
"
83
DEFINE_FWK_MODULE
(
PFDQMEventSelector
);
edm::RunNumber_t
unsigned int RunNumber_t
Definition:
RunLumiEventNumber.h:14
Handle.h
dqm::implementation::DQMStore::StripRunDirs
Definition:
DQMStore.h:542
MessageLogger.h
PFDQMEventSelector.h
PFDQMEventSelector::beginJob
void beginJob() override
Definition:
PFDQMEventSelector.cc:32
gather_cfg.cout
cout
Definition:
gather_cfg.py:144
DQMStore.h
dqm::legacy::MonitorElement
Definition:
MonitorElement.h:462
PFDQMEventSelector
Definition:
PFDQMEventSelector.h:8
edm::LogInfo
Log< level::Info, false > LogInfo
Definition:
MessageLogger.h:125
edm::LuminosityBlockNumber_t
unsigned int LuminosityBlockNumber_t
Definition:
RunLumiEventNumber.h:13
PFDQMEventSelector::nEvents_
uint64_t nEvents_
Definition:
PFDQMEventSelector.h:23
MakerMacros.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition:
MakerMacros.h:16
PFDQMEventSelector::openInputFile
bool openInputFile()
Definition:
PFDQMEventSelector.cc:74
Service.h
PFDQMEventSelector::verbose_
bool verbose_
Definition:
PFDQMEventSelector.h:24
PFDQMEventSelector::fileOpened_
bool fileOpened_
Definition:
PFDQMEventSelector.h:28
edm::EventNumber_t
unsigned long long EventNumber_t
Definition:
RunLumiEventNumber.h:12
PFDQMEventSelector::folderNames_
std::vector< std::string > folderNames_
Definition:
PFDQMEventSelector.h:26
PFDQMEventSelector::filter
bool filter(edm::Event &, edm::EventSetup const &) override
Definition:
PFDQMEventSelector.cc:39
edm::ParameterSet
Definition:
ParameterSet.h:47
PFDQMEventSelector::dqmStore_
DQMStore * dqmStore_
Definition:
PFDQMEventSelector.h:30
Event.h
PFDQMEventSelector::~PFDQMEventSelector
~PFDQMEventSelector() override
Definition:
PFDQMEventSelector.cc:27
PFDQMEventSelector::endJob
void endJob() override
Definition:
PFDQMEventSelector.cc:67
edm::Service
Definition:
Service.h:30
iEvent
int iEvent
Definition:
GenABIO.cc:224
PFDQMEventSelector::inputFileName_
std::string inputFileName_
Definition:
PFDQMEventSelector.h:27
edm::EventSetup
Definition:
EventSetup.h:58
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
PFDQMEventSelector::nSelectedEvents_
uint64_t nSelectedEvents_
Definition:
PFDQMEventSelector.h:23
dqm::implementation::IGetter::get
virtual MonitorElement * get(std::string const &fullpath) const
Definition:
DQMStore.cc:673
dqm::implementation::DQMStore::open
DQM_DEPRECATED bool open(std::string const &filename, bool overwrite=false, std::string const &path="", std::string const &prepend="", OpenRunDirs stripdirs=KeepRunDirs, bool fileMustExist=true)
Definition:
DQMStore.cc:790
PFDQMEventSelector::PFDQMEventSelector
PFDQMEventSelector(const edm::ParameterSet &)
Definition:
PFDQMEventSelector.cc:15
castor_dqm_sourceclient_file_cfg.path
path
Definition:
castor_dqm_sourceclient_file_cfg.py:37
hlt_dqm_clientPB-live_cfg.me
me
Definition:
hlt_dqm_clientPB-live_cfg.py:61
edm::Event
Definition:
Event.h:73
muonDTDigis_cfi.pset
pset
Definition:
muonDTDigis_cfi.py:27
Generated for CMSSW Reference Manual by
1.8.16