PhysicsTools
NanoAOD
plugins
EventStringOutputBranches.h
Go to the documentation of this file.
1
#ifndef PhysicsTools_NanoAOD_EventStringOutputBranches_h
2
#define PhysicsTools_NanoAOD_EventStringOutputBranches_h
3
4
#include <string>
5
#include <vector>
6
#include <TTree.h>
7
#include "
FWCore/Framework/interface/EventForOutput.h
"
8
#include "
DataFormats/Provenance/interface/BranchDescription.h
"
9
#include "
FWCore/Utilities/interface/EDGetToken.h
"
10
11
class
EventStringOutputBranches
{
12
public
:
13
EventStringOutputBranches
(
const
edm::BranchDescription
*desc,
14
const
edm::EDGetToken
&
token
,
15
bool
update_only_at_new_lumi =
false
)
16
:
m_token
(
token
),
m_lastLumi
(-1),
m_fills
(0),
m_update_only_at_new_lumi
(update_only_at_new_lumi) {
17
if
(desc->
className
() !=
"std::basic_string<char,std::char_traits<char> >"
)
18
throw
cms::Exception
(
"Configuration"
,
19
"NanoAODOutputModule/EventStringOutputBranches can only write out std::string objects"
);
20
}
21
22
void
updateEventStringNames
(TTree &,
const
std::string
&);
23
void
fill
(
const
edm::EventForOutput
&
iEvent
, TTree &
tree
);
24
25
private
:
26
edm::EDGetToken
m_token
;
27
struct
NamedBranchPtr
{
28
std::string
name
,
title
;
29
TBranch *
branch
;
30
bool
buffer
;
31
NamedBranchPtr
(
const
std::string
&aname,
const
std::string
&atitle, TBranch *branchptr =
nullptr
)
32
:
name
(aname),
title
(atitle),
branch
(branchptr),
buffer
(
false
) {}
33
};
34
std::vector<NamedBranchPtr>
m_evStringBranches
;
35
long
m_lastLumi
;
36
unsigned
long
m_fills
;
37
bool
m_update_only_at_new_lumi
;
38
};
39
40
#endif
EventStringOutputBranches::m_evStringBranches
std::vector< NamedBranchPtr > m_evStringBranches
Definition:
EventStringOutputBranches.h:34
funct::false
false
Definition:
Factorize.h:34
EventStringOutputBranches::NamedBranchPtr::branch
TBranch * branch
Definition:
EventStringOutputBranches.h:29
EventStringOutputBranches::updateEventStringNames
void updateEventStringNames(TTree &, const std::string &)
Definition:
EventStringOutputBranches.cc:7
tree
Definition:
tree.py:1
EventStringOutputBranches
Definition:
EventStringOutputBranches.h:11
EventForOutput.h
EventStringOutputBranches::NamedBranchPtr
Definition:
EventStringOutputBranches.h:27
EventStringOutputBranches::NamedBranchPtr::buffer
bool buffer
Definition:
EventStringOutputBranches.h:30
EventStringOutputBranches::m_lastLumi
long m_lastLumi
Definition:
EventStringOutputBranches.h:35
EDGetToken.h
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
BranchDescription.h
EventStringOutputBranches::EventStringOutputBranches
EventStringOutputBranches(const edm::BranchDescription *desc, const edm::EDGetToken &token, bool update_only_at_new_lumi=false)
Definition:
EventStringOutputBranches.h:13
iEvent
int iEvent
Definition:
GenABIO.cc:224
EventStringOutputBranches::NamedBranchPtr::NamedBranchPtr
NamedBranchPtr(const std::string &aname, const std::string &atitle, TBranch *branchptr=nullptr)
Definition:
EventStringOutputBranches.h:31
EventStringOutputBranches::NamedBranchPtr::name
std::string name
Definition:
EventStringOutputBranches.h:28
EventStringOutputBranches::NamedBranchPtr::title
std::string title
Definition:
EventStringOutputBranches.h:28
edm::EDGetToken
Definition:
EDGetToken.h:35
edm::EventForOutput
Definition:
EventForOutput.h:50
EventStringOutputBranches::m_update_only_at_new_lumi
bool m_update_only_at_new_lumi
Definition:
EventStringOutputBranches.h:37
EventStringOutputBranches::fill
void fill(const edm::EventForOutput &iEvent, TTree &tree)
Definition:
EventStringOutputBranches.cc:30
EventStringOutputBranches::m_fills
unsigned long m_fills
Definition:
EventStringOutputBranches.h:36
EventStringOutputBranches::m_token
edm::EDGetToken m_token
Definition:
EventStringOutputBranches.h:26
edm::BranchDescription
Definition:
BranchDescription.h:32
edm::BranchDescription::className
std::string const & className() const
Definition:
BranchDescription.h:79
cms::Exception
Definition:
Exception.h:70
unpackBuffers-CaloStage2.token
token
Definition:
unpackBuffers-CaloStage2.py:316
Generated for CMSSW Reference Manual by
1.8.16