CMS 3D CMS Logo

SummaryTableOutputBranches.h
Go to the documentation of this file.
1 #ifndef PhysicsTools_NanoAOD_SummaryTableOutputBranches_h
2 #define PhysicsTools_NanoAOD_SummaryTableOutputBranches_h
3 
4 #include <string>
5 #include <vector>
6 #include <TTree.h>
11 
13 public:
15  : m_token(token), m_fills(0) {
16  if (desc->className() != "nanoaod::MergeableCounterTable")
17  throw cms::Exception("Configuration", "NanoAODOutputModule can only write out MergableCounterTable objects");
18  }
19 
20  void fill(const edm::OccurrenceForOutput &iWhatever, TTree &tree);
21 
22 private:
24 
25  struct NamedBranchPtr {
27  TBranch *branch;
28  NamedBranchPtr(const std::string &aname, TBranch *branchptr = nullptr) : name(aname), branch(branchptr) {}
29  };
30  std::vector<NamedBranchPtr> m_intBranches, m_floatBranches, m_floatWithNormBranches;
31 
33  UInt_t count;
34  TBranch *counterBranch;
36  TBranch *counterBranchptr = nullptr,
37  TBranch *valueBranchptr = nullptr)
38  : NamedBranchPtr(aname, valueBranchptr), counterBranch(counterBranchptr) {}
39  };
40  std::vector<NamedVectorBranchPtr> m_vintBranches, m_vfloatBranches, m_vfloatWithNormBranches;
41 
42  unsigned long m_fills;
43 
44  void updateBranches(const nanoaod::MergeableCounterTable &tab, TTree &tree);
45 
46  template <typename T, typename Col>
47  void makeScalarBranches(const std::vector<Col> &tabcols,
48  TTree &tree,
49  const std::string &rootType,
50  std::vector<NamedBranchPtr> &branches);
51  template <typename Col>
52  void makeVectorBranches(const std::vector<Col> &tabcols,
53  TTree &tree,
54  const std::string &rootType,
55  std::vector<NamedVectorBranchPtr> &branches);
56 
57  template <typename Col>
58  void fillScalarBranches(const std::vector<Col> &tabcols, std::vector<NamedBranchPtr> &branches);
59  template <typename Col>
60  void fillVectorBranches(const std::vector<Col> &tabcols, std::vector<NamedVectorBranchPtr> &branches);
61 };
62 
63 #endif
SummaryTableOutputBranches::fill
void fill(const edm::OccurrenceForOutput &iWhatever, TTree &tree)
Definition: SummaryTableOutputBranches.cc:88
SummaryTableOutputBranches::NamedBranchPtr::branch
TBranch * branch
Definition: SummaryTableOutputBranches.h:27
tree
Definition: tree.py:1
SummaryTableOutputBranches::fillVectorBranches
void fillVectorBranches(const std::vector< Col > &tabcols, std::vector< NamedVectorBranchPtr > &branches)
Definition: SummaryTableOutputBranches.cc:59
SummaryTableOutputBranches::makeScalarBranches
void makeScalarBranches(const std::vector< Col > &tabcols, TTree &tree, const std::string &rootType, std::vector< NamedBranchPtr > &branches)
Definition: SummaryTableOutputBranches.cc:4
SummaryTableOutputBranches::m_floatWithNormBranches
std::vector< NamedBranchPtr > m_floatWithNormBranches
Definition: SummaryTableOutputBranches.h:30
SummaryTableOutputBranches::m_vintBranches
std::vector< NamedVectorBranchPtr > m_vintBranches
Definition: SummaryTableOutputBranches.h:40
SummaryTableOutputBranches::m_fills
unsigned long m_fills
Definition: SummaryTableOutputBranches.h:42
edm::OccurrenceForOutput
Definition: OccurrenceForOutput.h:45
SummaryTableOutputBranches::updateBranches
void updateBranches(const nanoaod::MergeableCounterTable &tab, TTree &tree)
Definition: SummaryTableOutputBranches.cc:71
MergeableCounterTable.h
SummaryTableOutputBranches::NamedVectorBranchPtr
Definition: SummaryTableOutputBranches.h:32
nanoaod::MergeableCounterTable
Definition: MergeableCounterTable.h:11
EDGetToken.h
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
SummaryTableOutputBranches::m_token
edm::EDGetToken m_token
Definition: SummaryTableOutputBranches.h:23
SummaryTableOutputBranches::NamedVectorBranchPtr::NamedVectorBranchPtr
NamedVectorBranchPtr(const std::string &aname, TBranch *counterBranchptr=nullptr, TBranch *valueBranchptr=nullptr)
Definition: SummaryTableOutputBranches.h:35
BranchDescription.h
SummaryTableOutputBranches::m_floatBranches
std::vector< NamedBranchPtr > m_floatBranches
Definition: SummaryTableOutputBranches.h:30
SummaryTableOutputBranches::NamedBranchPtr::name
std::string name
Definition: SummaryTableOutputBranches.h:26
edm::EDGetToken
Definition: EDGetToken.h:35
SummaryTableOutputBranches::NamedVectorBranchPtr::counterBranch
TBranch * counterBranch
Definition: SummaryTableOutputBranches.h:34
SummaryTableOutputBranches::fillScalarBranches
void fillScalarBranches(const std::vector< Col > &tabcols, std::vector< NamedBranchPtr > &branches)
Definition: SummaryTableOutputBranches.cc:47
SummaryTableOutputBranches::NamedBranchPtr
Definition: SummaryTableOutputBranches.h:25
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
SummaryTableOutputBranches::m_vfloatBranches
std::vector< NamedVectorBranchPtr > m_vfloatBranches
Definition: SummaryTableOutputBranches.h:40
SummaryTableOutputBranches::SummaryTableOutputBranches
SummaryTableOutputBranches(const edm::BranchDescription *desc, const edm::EDGetToken &token)
Definition: SummaryTableOutputBranches.h:14
SummaryTableOutputBranches::NamedBranchPtr::NamedBranchPtr
NamedBranchPtr(const std::string &aname, TBranch *branchptr=nullptr)
Definition: SummaryTableOutputBranches.h:28
SummaryTableOutputBranches
Definition: SummaryTableOutputBranches.h:12
edm::BranchDescription
Definition: BranchDescription.h:32
cms::Exception
Definition: Exception.h:70
OccurrenceForOutput.h
SummaryTableOutputBranches::NamedVectorBranchPtr::count
UInt_t count
Definition: SummaryTableOutputBranches.h:33
SummaryTableOutputBranches::m_intBranches
std::vector< NamedBranchPtr > m_intBranches
Definition: SummaryTableOutputBranches.h:30
SummaryTableOutputBranches::m_vfloatWithNormBranches
std::vector< NamedVectorBranchPtr > m_vfloatWithNormBranches
Definition: SummaryTableOutputBranches.h:40
SummaryTableOutputBranches::makeVectorBranches
void makeVectorBranches(const std::vector< Col > &tabcols, TTree &tree, const std::string &rootType, std::vector< NamedVectorBranchPtr > &branches)
Definition: SummaryTableOutputBranches.cc:23
unpackBuffers-CaloStage2.token
token
Definition: unpackBuffers-CaloStage2.py:318