Main Page
Namespaces
Classes
Package Documentation
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
L1Trigger
L1THGCalUtilities
plugins
ntuples
HGCalTriggerNtupleManager.cc
Go to the documentation of this file.
1
#include "
FWCore/Framework/interface/Frameworkfwd.h
"
2
#include "
FWCore/Framework/interface/EDAnalyzer.h
"
3
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
4
#include "
FWCore/Framework/interface/Event.h
"
5
#include "
FWCore/Framework/interface/EventSetup.h
"
6
#include "
FWCore/Framework/interface/MakerMacros.h
"
7
#include "
FWCore/ServiceRegistry/interface/Service.h
"
8
#include "
CommonTools/UtilAlgos/interface/TFileService.h
"
9
#include "
L1Trigger/L1THGCalUtilities/interface/HGCalTriggerNtupleBase.h
"
10
11
#include "
FWCore/Framework/interface/ESHandle.h
"
12
13
#include "
MagneticField/Records/interface/IdealMagneticFieldRecord.h
"
14
#include "
SimGeneral/HepPDTRecord/interface/PDTRecord.h
"
15
#include "
Geometry/Records/interface/CaloGeometryRecord.h
"
16
17
class
HGCalTriggerNtupleManager
:
public
edm::EDAnalyzer
{
18
public
:
19
typedef
std::unique_ptr<HGCalTriggerNtupleBase>
ntuple_ptr
;
20
21
public
:
22
explicit
HGCalTriggerNtupleManager
(
const
edm::ParameterSet
& conf);
23
~HGCalTriggerNtupleManager
()
override
{};
24
void
beginRun
(
const
edm::Run
&,
const
edm::EventSetup
&)
override
;
25
void
analyze
(
const
edm::Event
&,
const
edm::EventSetup
&)
override
;
26
27
private
:
28
edm::Service<TFileService>
file_service_
;
29
std::vector<ntuple_ptr>
hgc_ntuples_
;
30
TTree*
tree_
;
31
32
HGCalTriggerNtupleEventSetup
ntuple_es_
;
33
edm::ESGetToken<HepPDT::ParticleDataTable, PDTRecord>
pdtToken_
;
34
edm::ESGetToken<MagneticField, IdealMagneticFieldRecord>
magfieldToken_
;
35
edm::ESGetToken<HGCalTriggerGeometryBase, CaloGeometryRecord>
triggerGeomToken_
;
36
};
37
38
DEFINE_FWK_MODULE
(
HGCalTriggerNtupleManager
);
39
40
HGCalTriggerNtupleManager::HGCalTriggerNtupleManager
(
const
edm::ParameterSet
& conf)
41
: pdtToken_(
esConsumes
<HepPDT::
ParticleDataTable
,
PDTRecord
, edm::
Transition
::BeginRun>()),
42
magfieldToken_(
esConsumes
<
MagneticField
,
IdealMagneticFieldRecord
, edm::
Transition
::BeginRun>()),
43
triggerGeomToken_(
esConsumes
<
HGCalTriggerGeometryBase
,
CaloGeometryRecord
, edm::
Transition
::BeginRun>()) {
44
tree_
=
file_service_
->
make
<TTree>(
"HGCalTriggerNtuple"
,
"HGCalTriggerNtuple"
);
45
const
std::vector<edm::ParameterSet>& ntuple_cfgs = conf.
getParameterSetVector
(
"Ntuples"
);
46
for
(
const
auto
& ntuple_cfg : ntuple_cfgs) {
47
const
std::string
& ntuple_name = ntuple_cfg.getParameter<
std::string
>(
"NtupleName"
);
48
hgc_ntuples_
.emplace_back(
HGCalTriggerNtupleFactory::get
()->
create
(ntuple_name, ntuple_cfg));
49
hgc_ntuples_
.back()->initialize(*
tree_
, ntuple_cfg,
consumesCollector
());
50
}
51
}
52
53
void
HGCalTriggerNtupleManager::beginRun
(
const
edm::Run
&
run
,
const
edm::EventSetup
& es) {
54
ntuple_es_
.
pdt
= es.
getHandle
(
pdtToken_
);
55
ntuple_es_
.
magfield
= es.
getHandle
(
magfieldToken_
);
56
ntuple_es_
.
geometry
= es.
getHandle
(
triggerGeomToken_
);
57
}
58
59
void
HGCalTriggerNtupleManager::analyze
(
const
edm::Event
&
e
,
const
edm::EventSetup
& es) {
60
for
(
auto
& hgc_ntuple :
hgc_ntuples_
) {
61
if
(hgc_ntuple->accessEventSetup()) {
62
hgc_ntuple->fill(e, es);
63
}
else
{
64
hgc_ntuple->fill(e,
ntuple_es_
);
65
}
66
}
67
68
tree_
->Fill();
69
}
HGCalTriggerGeometryBase
Definition:
HGCalTriggerGeometryBase.h:16
HGCalTriggerNtupleManager::triggerGeomToken_
edm::ESGetToken< HGCalTriggerGeometryBase, CaloGeometryRecord > triggerGeomToken_
Definition:
HGCalTriggerNtupleManager.cc:35
HGCalTriggerNtupleEventSetup
Definition:
HGCalTriggerNtupleBase.h:18
HGCalTriggerNtupleManager::ntuple_es_
HGCalTriggerNtupleEventSetup ntuple_es_
Definition:
HGCalTriggerNtupleManager.cc:32
edm::ParameterSet::getParameterSetVector
VParameterSet const & getParameterSetVector(std::string const &name) const
Definition:
ParameterSet.cc:2160
HGCalTriggerNtupleBase.h
edm::Service< TFileService >
HGCalTriggerNtupleManager::magfieldToken_
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magfieldToken_
Definition:
HGCalTriggerNtupleManager.cc:34
HGCalTriggerNtupleManager::tree_
TTree * tree_
Definition:
HGCalTriggerNtupleManager.cc:30
PDTRecord
Definition:
PDTRecord.h:14
HGCalTriggerNtupleEventSetup::magfield
edm::ESHandle< MagneticField > magfield
Definition:
HGCalTriggerNtupleBase.h:20
ParticleDataTable
HepPDT::ParticleDataTable ParticleDataTable
Definition:
ParticleDataTable.h:8
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition:
MakerMacros.h:16
Event.h
HGCalTriggerNtupleManager
Definition:
HGCalTriggerNtupleManager.cc:17
MakerMacros.h
EventSetup.h
IdealMagneticFieldRecord
Definition:
IdealMagneticFieldRecord.h:11
beamerCreator.create
def create
Definition:
beamerCreator.py:44
MagneticField
Definition:
MagneticField.h:19
TFileService::make
T * make(const Args &...args) const
make new ROOT object
Definition:
TFileService.h:64
HGCalTriggerNtupleEventSetup::geometry
edm::ESHandle< HGCalTriggerGeometryBase > geometry
Definition:
HGCalTriggerNtupleBase.h:21
HGCalTriggerNtupleManager::file_service_
edm::Service< TFileService > file_service_
Definition:
HGCalTriggerNtupleManager.cc:28
HGCalTriggerNtupleManager::beginRun
void beginRun(const edm::Run &, const edm::EventSetup &) override
Definition:
HGCalTriggerNtupleManager.cc:53
CaloGeometryRecord
Definition:
CaloGeometryRecord.h:30
Frameworkfwd.h
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
TFileService.h
ParameterSet.h
HGCalTriggerNtupleManager::ntuple_ptr
std::unique_ptr< HGCalTriggerNtupleBase > ntuple_ptr
Definition:
HGCalTriggerNtupleManager.cc:19
edm::ESGetToken< HepPDT::ParticleDataTable, PDTRecord >
HGCalTriggerNtupleManager::pdtToken_
edm::ESGetToken< HepPDT::ParticleDataTable, PDTRecord > pdtToken_
Definition:
HGCalTriggerNtupleManager.cc:33
PDTRecord.h
CaloGeometryRecord.h
HGCalTriggerNtupleManager::analyze
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition:
HGCalTriggerNtupleManager.cc:59
submitPVValidationJobs.run
tuple run
Definition:
submitPVValidationJobs.py:227
edm::EDConsumerBase::consumesCollector
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
Definition:
EDConsumerBase.cc:47
HGCalTriggerNtupleEventSetup::pdt
edm::ESHandle< HepPDT::ParticleDataTable > pdt
Definition:
HGCalTriggerNtupleBase.h:19
ESHandle.h
edm::Transition
Transition
Definition:
Transition.h:12
Service.h
edm::EventSetup
Definition:
EventSetup.h:59
edm::EDAnalyzer
Definition:
EDAnalyzer.h:29
EDAnalyzer.h
HGCalTriggerNtupleManager::HGCalTriggerNtupleManager
HGCalTriggerNtupleManager(const edm::ParameterSet &conf)
Definition:
HGCalTriggerNtupleManager.cc:40
HGCalTriggerNtupleManager::~HGCalTriggerNtupleManager
~HGCalTriggerNtupleManager() override
Definition:
HGCalTriggerNtupleManager.cc:23
alignCSCRings.e
list e
Definition:
alignCSCRings.py:91
edm::ParameterSet
Definition:
ParameterSet.h:47
get
#define get
edm::EventSetup::getHandle
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition:
EventSetup.h:157
edm::Event
Definition:
Event.h:73
DeDxTools::esConsumes
ESGetTokenH3DDVariant esConsumes(std::string const &Reccord, edm::ConsumesCollector &)
Definition:
DeDxTools.cc:283
IdealMagneticFieldRecord.h
HGCalTriggerNtupleManager::hgc_ntuples_
std::vector< ntuple_ptr > hgc_ntuples_
Definition:
HGCalTriggerNtupleManager.cc:29
edm::Run
Definition:
Run.h:45
Generated for CMSSW Reference Manual by
1.8.5