L1Trigger
L1TNtuples
plugins
L1uGTTreeProducer.cc
Go to the documentation of this file.
1
// system include files
2
#include <memory>
3
4
// {fmt} headers
5
#include <fmt/printf.h>
6
7
// ROOT
8
#include <TTree.h>
9
10
// framework and data formats
11
#include "
CommonTools/UtilAlgos/interface/TFileService.h
"
12
#include "
CondFormats/DataRecord/interface/L1TUtmTriggerMenuRcd.h
"
13
#include "
CondFormats/L1TObjects/interface/L1TUtmTriggerMenu.h
"
14
#include "
DataFormats/L1TGlobal/interface/GlobalAlgBlk.h
"
15
#include "
FWCore/Framework/interface/EDAnalyzer.h
"
16
#include "
FWCore/Framework/interface/ESHandle.h
"
17
#include "
FWCore/Framework/interface/Event.h
"
18
#include "
FWCore/Framework/interface/EventSetup.h
"
19
#include "
FWCore/Framework/interface/Frameworkfwd.h
"
20
#include "
FWCore/MessageLogger/interface/MessageLogger.h
"
21
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
22
#include "
FWCore/ServiceRegistry/interface/Service.h
"
23
24
//
25
// class declaration
26
//
27
28
class
L1uGTTreeProducer
:
public
edm::EDAnalyzer
{
29
public
:
30
explicit
L1uGTTreeProducer
(
edm::ParameterSet
const
&);
31
~L1uGTTreeProducer
()
override
;
32
33
private
:
34
void
beginJob
()
override
;
35
void
analyze
(
edm::Event
const
&,
edm::EventSetup
const
&)
override
;
36
void
endJob
()
override
;
37
38
private
:
39
// output file
40
edm::Service<TFileService>
fs_
;
41
42
// pointers to the objects that will be stored as branches within the tree
43
GlobalAlgBlk
const
*
results_
;
44
45
// tree
46
TTree *
tree_
;
47
48
// EDM input tokens
49
const
edm::EDGetTokenT<GlobalAlgBlkBxCollection>
ugt_token_
;
50
51
// L1 uGT menu
52
unsigned
long
long
cache_id_
;
53
};
54
55
L1uGTTreeProducer::L1uGTTreeProducer
(
edm::ParameterSet
const
&
config
)
56
: results_(nullptr),
57
tree_(nullptr),
58
ugt_token_(consumes<
GlobalAlgBlkBxCollection
>(
config
.getParameter<
edm
::
InputTag
>(
"ugtToken"
))),
59
cache_id_(0) {
60
// set up the TTree and its branches
61
tree_
=
fs_
->
make
<TTree>(
"L1uGTTree"
,
"L1uGTTree"
);
62
tree_
->Branch(
"L1uGT"
,
"GlobalAlgBlk"
, &
results_
, 32000, 3);
63
}
64
65
L1uGTTreeProducer::~L1uGTTreeProducer
() {
66
//if (tree_) { delete tree_; tree_ = NULL; }
67
//if (results_) { delete results_; results_ = NULL; } // It seems TTree owns this pointer...
68
}
69
70
//
71
// member functions
72
//
73
74
// ------------ method called to for each event ------------
75
void
L1uGTTreeProducer::analyze
(
edm::Event
const
&
event
,
edm::EventSetup
const
&
setup
) {
76
unsigned
long
long
id
=
setup
.get<
L1TUtmTriggerMenuRcd
>().cacheIdentifier();
77
if
(
id
!=
cache_id_
) {
78
cache_id_
=
id
;
79
edm::ESHandle<L1TUtmTriggerMenu>
menu
;
80
setup
.get<
L1TUtmTriggerMenuRcd
>().
get
(
menu
);
81
82
for
(
auto
const
&keyval :
menu
->getAlgorithmMap()) {
83
std::string
const
&
name
= keyval.second.getName();
84
unsigned
int
index
= keyval.second.getIndex();
85
//std::cerr << fmt::sprintf("bit %4d: %s", index, name) << std::endl;
86
tree_
->SetAlias(
name
.c_str(), fmt::sprintf(
"L1uGT.m_algoDecisionInitial[%d]"
,
index
).c_str());
87
}
88
}
89
90
edm::Handle<GlobalAlgBlkBxCollection>
ugt;
91
92
event
.getByToken(
ugt_token_
, ugt);
93
94
if
(ugt.
isValid
()) {
95
results_
= &ugt->
at
(0, 0);
96
}
97
98
tree_
->Fill();
99
}
100
101
// ------------ method called once each job just before starting event loop ------------
102
void
L1uGTTreeProducer::beginJob
(
void
) {}
103
104
// ------------ method called once each job just after ending the event loop ------------
105
void
L1uGTTreeProducer::endJob
() {}
106
107
//define this as a plug-in
108
#include "
FWCore/Framework/interface/MakerMacros.h
"
109
DEFINE_FWK_MODULE
(
L1uGTTreeProducer
);
L1uGTTreeProducer
Definition:
L1uGTTreeProducer.cc:28
MessageLogger.h
ESHandle.h
L1TUtmTriggerMenuRcd
Definition:
L1TUtmTriggerMenuRcd.h:11
edm::EDGetTokenT
Definition:
EDGetToken.h:33
edm
HLT enums.
Definition:
AlignableModifier.h:19
HLT_FULL_cff.InputTag
InputTag
Definition:
HLT_FULL_cff.py:89301
EDAnalyzer.h
edm::Handle
Definition:
AssociativeIterator.h:50
L1uGTTreeProducer::analyze
void analyze(edm::Event const &, edm::EventSetup const &) override
Definition:
L1uGTTreeProducer.cc:75
singleTopDQM_cfi.setup
setup
Definition:
singleTopDQM_cfi.py:37
edm::EDAnalyzer
Definition:
EDAnalyzer.h:28
BXVector
Definition:
BXVector.h:15
config
Definition:
config.py:1
MakerMacros.h
L1uGTTreeProducer::results_
const GlobalAlgBlk * results_
Definition:
L1uGTTreeProducer.cc:43
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition:
MakerMacros.h:16
L1uGTTreeProducer::~L1uGTTreeProducer
~L1uGTTreeProducer() override
Definition:
L1uGTTreeProducer.cc:65
Service.h
edm::ESHandle
Definition:
DTSurvey.h:22
L1uGTTreeProducer::ugt_token_
const edm::EDGetTokenT< GlobalAlgBlkBxCollection > ugt_token_
Definition:
L1uGTTreeProducer.cc:49
TFileService.h
L1uGTTreeProducer::L1uGTTreeProducer
L1uGTTreeProducer(edm::ParameterSet const &)
Definition:
L1uGTTreeProducer.cc:55
L1TUtmTriggerMenu.h
L1TUtmTriggerMenuRcd.h
optionsL1T.menu
menu
Definition:
optionsL1T.py:29
edm::ParameterSet
Definition:
ParameterSet.h:47
Event.h
BXVector::at
const T & at(int bx, unsigned i) const
edm::Service< TFileService >
GlobalAlgBlk.h
edm::EventSetup
Definition:
EventSetup.h:58
get
#define get
TFileService::make
T * make(const Args &...args) const
make new ROOT object
Definition:
TFileService.h:64
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
L1uGTTreeProducer::cache_id_
unsigned long long cache_id_
Definition:
L1uGTTreeProducer.cc:52
L1uGTTreeProducer::beginJob
void beginJob() override
Definition:
L1uGTTreeProducer.cc:102
L1uGTTreeProducer::fs_
edm::Service< TFileService > fs_
Definition:
L1uGTTreeProducer.cc:40
Frameworkfwd.h
triggerObjects_cff.id
id
Definition:
triggerObjects_cff.py:29
Skims_PA_cff.name
name
Definition:
Skims_PA_cff.py:17
EventSetup.h
L1uGTTreeProducer::endJob
void endJob() override
Definition:
L1uGTTreeProducer.cc:105
AlignmentPI::index
index
Definition:
AlignmentPayloadInspectorHelper.h:46
ParameterSet.h
edm::HandleBase::isValid
bool isValid() const
Definition:
HandleBase.h:70
event
Definition:
event.py:1
GlobalAlgBlk
Definition:
GlobalAlgBlk.h:41
edm::Event
Definition:
Event.h:73
L1uGTTreeProducer::tree_
TTree * tree_
Definition:
L1uGTTreeProducer.cc:46
Generated for CMSSW Reference Manual by
1.8.16