CMS 3D CMS Logo

List of all members | Classes | Public Types | Public Member Functions | Private Attributes
RooUtil::TTreeX Class Reference

#include <ttreex.h>

Classes

struct  ordering
 

Public Types

enum  kType {
  kInt_t = 1, kBool_t = 2, kFloat_t = 3, kTString = 4,
  kLV = 5, kVecInt_t = 11, kVecUInt_t = 12, kVecBool_t = 13,
  kVecFloat_t = 14, kVecTString = 15, kVecLV = 16
}
 
typedef std::vector< LV >::const_iterator lviter
 

Public Member Functions

void clear ()
 
template<class T >
void createBranch (TString, bool=true)
 
template<class T >
void createBranch (T &)
 
template<>
void createBranch (TString bn, bool writeToTree)
 
template<>
void createBranch (TString bn, bool writeToTree)
 
template<>
void createBranch (TString bn, bool writeToTree)
 
template<>
void createBranch (TString bn, bool writeToTree)
 
template<>
void createBranch (TString bn, bool writeToTree)
 
template<>
void createBranch (TString bn, bool writeToTree)
 
template<>
void createBranch (TString bn, bool writeToTree)
 
template<>
void createBranch (TString bn, bool writeToTree)
 
template<>
void createBranch (TString bn, bool writeToTree)
 
template<>
void createBranch (TString bn, bool writeToTree)
 
template<>
void createBranch (TString bn, bool writeToTree)
 
template<>
void createBranch (TString bn, bool writeToTree)
 
template<>
void createBranch (TString bn, bool writeToTree)
 
template<>
void createBranch (TString bn, bool writeToTree)
 
template<>
void createBranch (TString bn, bool writeToTree)
 
template<>
void createBranch (TString bn, bool writeToTree)
 
void createFlatBranch (std::vector< TString >, std::vector< TString >, std::vector< TString >, std::vector< TString >, int)
 
void fill ()
 
template<class T >
Tget (TString brname, int entry=-1)
 
template<class T >
const TgetBranch (TString, bool=true)
 
template<>
const Int_t & getBranch (TString bn, bool check)
 
template<>
const Bool_t & getBranch (TString bn, bool check)
 
template<>
const Float_t & getBranch (TString bn, bool check)
 
template<>
const TString & getBranch (TString bn, bool check)
 
template<>
const LVgetBranch (TString bn, bool check)
 
template<>
const TBits & getBranch (TString bn, bool check)
 
template<>
const unsigned long long & getBranch (TString bn, bool check)
 
template<>
const unsigned int & getBranch (TString bn, bool check)
 
template<>
const Int_t & getBranch (TString bn, bool check)
 
template<>
const Bool_t & getBranch (TString bn, bool check)
 
template<>
const Float_t & getBranch (TString bn, bool check)
 
template<>
const TString & getBranch (TString bn, bool check)
 
template<>
const LVgetBranch (TString bn, bool check)
 
template<>
const TBits & getBranch (TString bn, bool check)
 
template<>
const unsigned long long & getBranch (TString bn, bool check)
 
template<>
const unsigned int & getBranch (TString bn, bool check)
 
template<class T >
TgetBranchAddress (TString)
 
template<>
Int_t * getBranchAddress (TString bn)
 
template<>
Bool_t * getBranchAddress (TString bn)
 
template<>
Float_t * getBranchAddress (TString bn)
 
template<>
Int_t * getBranchAddress (TString bn)
 
template<>
Bool_t * getBranchAddress (TString bn)
 
template<>
Float_t * getBranchAddress (TString bn)
 
template<class T >
const TgetBranchLazy (TString)
 
template<>
const Int_t & getBranchLazy (TString bn)
 
template<>
const Bool_t & getBranchLazy (TString bn)
 
template<>
const Float_t & getBranchLazy (TString bn)
 
template<>
const TString & getBranchLazy (TString bn)
 
template<>
const LVgetBranchLazy (TString bn)
 
template<>
const TBits & getBranchLazy (TString bn)
 
template<>
const unsigned long long & getBranchLazy (TString bn)
 
template<>
const unsigned int & getBranchLazy (TString bn)
 
template<>
const Int_t & getBranchLazy (TString bn)
 
template<>
const Bool_t & getBranchLazy (TString bn)
 
template<>
const Float_t & getBranchLazy (TString bn)
 
template<>
const TString & getBranchLazy (TString bn)
 
template<>
const LVgetBranchLazy (TString bn)
 
template<>
const TBits & getBranchLazy (TString bn)
 
template<>
const unsigned long long & getBranchLazy (TString bn)
 
template<>
const unsigned int & getBranchLazy (TString bn)
 
TTree * getTree ()
 
void * getValPtr (TString brname)
 
template<class T >
bool hasBranch (TString)
 
template<>
bool hasBranch (TString bn)
 
template<>
bool hasBranch (TString bn)
 
template<>
bool hasBranch (TString bn)
 
template<>
bool hasBranch (TString bn)
 
template<>
bool hasBranch (TString bn)
 
template<>
bool hasBranch (TString bn)
 
template<>
bool hasBranch (TString bn)
 
template<>
bool hasBranch (TString bn)
 
template<>
bool hasBranch (TString bn)
 
template<>
bool hasBranch (TString bn)
 
template<>
bool hasBranch (TString bn)
 
template<>
bool hasBranch (TString bn)
 
template<>
bool hasBranch (TString bn)
 
template<>
bool hasBranch (TString bn)
 
template<>
bool hasBranch (TString bn)
 
template<>
bool hasBranch (TString bn)
 
template<class T >
bool isBranchSet (TString)
 
template<>
bool isBranchSet (TString bn)
 
template<>
bool isBranchSet (TString bn)
 
template<>
bool isBranchSet (TString bn)
 
template<>
bool isBranchSet (TString bn)
 
template<>
bool isBranchSet (TString bn)
 
template<>
bool isBranchSet (TString bn)
 
template<>
bool isBranchSet (TString bn)
 
template<>
bool isBranchSet (TString bn)
 
template<>
bool isBranchSet (TString bn)
 
template<>
bool isBranchSet (TString bn)
 
template<>
bool isBranchSet (TString bn)
 
template<>
bool isBranchSet (TString bn)
 
template<>
bool isBranchSet (TString bn)
 
template<>
bool isBranchSet (TString bn)
 
template<>
bool isBranchSet (TString bn)
 
template<>
bool isBranchSet (TString bn)
 
template<class T >
void pushbackToBranch (TString, T)
 
template<>
void pushbackToBranch (TString bn, Int_t val)
 
template<>
void pushbackToBranch (TString bn, UInt_t val)
 
template<>
void pushbackToBranch (TString bn, Bool_t val)
 
template<>
void pushbackToBranch (TString bn, Float_t val)
 
template<>
void pushbackToBranch (TString bn, TString val)
 
template<>
void pushbackToBranch (TString bn, LV val)
 
template<>
void pushbackToBranch (TString bn, VInt val)
 
template<>
void pushbackToBranch (TString bn, VFloat val)
 
template<>
void pushbackToBranch (TString bn, Int_t val)
 
template<>
void pushbackToBranch (TString bn, UInt_t val)
 
template<>
void pushbackToBranch (TString bn, Bool_t val)
 
template<>
void pushbackToBranch (TString bn, Float_t val)
 
template<>
void pushbackToBranch (TString bn, TString val)
 
template<>
void pushbackToBranch (TString bn, LV val)
 
template<>
void pushbackToBranch (TString bn, VInt val)
 
template<>
void pushbackToBranch (TString bn, VFloat val)
 
void save (TFile *)
 
template<class T >
void setBranch (TString, T, bool=false, bool=false)
 
template<class T >
void setBranch (T &)
 
template<>
void setBranch (TString bn, Int_t val, bool force, bool ignore)
 
template<>
void setBranch (TString bn, Bool_t val, bool force, bool ignore)
 
template<>
void setBranch (TString bn, Float_t val, bool force, bool ignore)
 
template<>
void setBranch (TString bn, Int_t val, bool force, bool ignore)
 
template<>
void setBranch (TString bn, TString val, bool force, bool ignore)
 
template<>
void setBranch (TString bn, LV val, bool force, bool ignore)
 
template<>
void setBranch (TString bn, TBits val, bool force, bool ignore)
 
template<>
void setBranch (TString bn, unsigned long long val, bool force, bool ignore)
 
template<>
void setBranch (TString bn, unsigned int val, bool force, bool ignore)
 
template<>
void setBranch (TString bn, Bool_t val, bool force, bool ignore)
 
template<>
void setBranch (TString bn, Float_t val, bool force, bool ignore)
 
template<>
void setBranch (TString bn, TString val, bool force, bool ignore)
 
template<>
void setBranch (TString bn, LV val, bool force, bool ignore)
 
template<>
void setBranch (TString bn, TBits val, bool force, bool ignore)
 
template<>
void setBranch (TString bn, unsigned long long val, bool force, bool ignore)
 
template<>
void setBranch (TString bn, unsigned int val, bool force, bool ignore)
 
void setFlatBranch (std::vector< TString >, std::vector< TString >, std::vector< TString >, std::vector< TString >, int)
 
void setTree (TTree *tree)
 
template<class T >
std::vector< TsortFromRef (std::vector< T > const &in, std::vector< std::pair< size_t, lviter >> const &reference)
 
void sortVecBranchesByPt (TString, std::vector< TString >, std::vector< TString >, std::vector< TString >)
 
 TTreeX ()
 
 TTreeX (TString treename, TString title)
 
 TTreeX (TTree *tree)
 
void write ()
 
 ~TTreeX ()
 

Private Attributes

std::map< TString, Bool_t > mapBool_t
 
std::map< TString, Float_t > mapFloat_t
 
std::map< TString, std::function< float()> > mapFloatFunc_t
 
std::map< TString, Int_t > mapInt_t
 
std::map< TString, Bool_t > mapIsBranchSet
 
std::map< TString, LVmapLV
 
std::map< TString, TBits > mapTBits
 
std::map< TString, TString > mapTString
 
std::map< TString, unsigned int > mapUI
 
std::map< TString, unsigned long long > mapULL
 
std::map< TString, std::vector< Bool_t > > mapVecBool_t
 
std::map< TString, std::vector< Float_t > > mapVecFloat_t
 
std::map< TString, std::vector< Int_t > > mapVecInt_t
 
std::map< TString, std::vector< LV > > mapVecLV
 
std::map< TString, std::vector< TString > > mapVecTString
 
std::map< TString, std::vector< UInt_t > > mapVecUInt_t
 
std::map< TString, std::vector< std::vector< Float_t > > > mapVecVFloat
 
std::map< TString, std::vector< std::vector< Int_t > > > mapVecVInt
 
TTree * ttree
 

Detailed Description

Definition at line 72 of file ttreex.h.

Member Typedef Documentation

◆ lviter

typedef std::vector<LV>::const_iterator RooUtil::TTreeX::lviter

Definition at line 87 of file ttreex.h.

Member Enumeration Documentation

◆ kType

Enumerator
kInt_t 
kBool_t 
kFloat_t 
kTString 
kLV 
kVecInt_t 
kVecUInt_t 
kVecBool_t 
kVecFloat_t 
kVecTString 
kVecLV 

Definition at line 74 of file ttreex.h.

Constructor & Destructor Documentation

◆ TTreeX() [1/3]

RooUtil::TTreeX::TTreeX ( )

Definition at line 17 of file ttreex.cc.

17 { ttree = 0; }
TTree * ttree
Definition: ttreex.h:90

◆ TTreeX() [2/3]

RooUtil::TTreeX::TTreeX ( TString  treename,
TString  title 
)

Definition at line 20 of file ttreex.cc.

References runGCPTkAlMap::title, and make_classfiles::treename.

20 { ttree = new TTree(treename.Data(), title.Data()); }
TTree * ttree
Definition: ttreex.h:90

◆ TTreeX() [3/3]

RooUtil::TTreeX::TTreeX ( TTree *  tree)

Definition at line 23 of file ttreex.cc.

References make_classfiles::tree.

23 { ttree = tree; }
TTree * ttree
Definition: ttreex.h:90

◆ ~TTreeX()

RooUtil::TTreeX::~TTreeX ( )

Definition at line 26 of file ttreex.cc.

26 {}

Member Function Documentation

◆ clear()

void RooUtil::TTreeX::clear ( void  )

Definition at line 40 of file ttreex.cc.

Referenced by fillOutputBranches(), and main().

40  {
41  for (auto& pair : mapInt_t)
42  pair.second = -999;
43  for (auto& pair : mapBool_t)
44  pair.second = 0;
45  for (auto& pair : mapFloat_t)
46  pair.second = -999;
47  for (auto& pair : mapTString)
48  pair.second = "";
49  for (auto& pair : mapLV)
50  pair.second.SetXYZT(0, 0, 0, 0);
51  for (auto& pair : mapTBits)
52  pair.second = 0;
53  for (auto& pair : mapULL)
54  pair.second = 0;
55  for (auto& pair : mapUI)
56  pair.second = 0;
57  for (auto& pair : mapVecInt_t)
58  pair.second.clear();
59  for (auto& pair : mapVecUInt_t)
60  pair.second.clear();
61  for (auto& pair : mapVecBool_t)
62  pair.second.clear();
63  for (auto& pair : mapVecFloat_t)
64  pair.second.clear();
65  for (auto& pair : mapVecTString)
66  pair.second.clear();
67  for (auto& pair : mapVecLV)
68  pair.second.clear();
69  for (auto& pair : mapVecVInt)
70  pair.second.clear();
71  for (auto& pair : mapVecVFloat)
72  pair.second.clear();
73  for (auto& pair : mapIsBranchSet)
74  pair.second = false;
75 }
std::map< TString, Bool_t > mapIsBranchSet
Definition: ttreex.h:110
std::map< TString, TBits > mapTBits
Definition: ttreex.h:96
std::map< TString, std::vector< std::vector< Float_t > > > mapVecVFloat
Definition: ttreex.h:106
std::map< TString, std::vector< std::vector< Int_t > > > mapVecVInt
Definition: ttreex.h:105
std::map< TString, std::vector< LV > > mapVecLV
Definition: ttreex.h:104
std::map< TString, Int_t > mapInt_t
Definition: ttreex.h:91
std::map< TString, std::vector< TString > > mapVecTString
Definition: ttreex.h:103
std::map< TString, LV > mapLV
Definition: ttreex.h:95
std::map< TString, unsigned long long > mapULL
Definition: ttreex.h:97
std::map< TString, Float_t > mapFloat_t
Definition: ttreex.h:93
std::map< TString, Bool_t > mapBool_t
Definition: ttreex.h:92
std::map< TString, std::vector< Int_t > > mapVecInt_t
Definition: ttreex.h:99
std::map< TString, std::vector< Bool_t > > mapVecBool_t
Definition: ttreex.h:101
std::map< TString, std::vector< Float_t > > mapVecFloat_t
Definition: ttreex.h:102
std::map< TString, TString > mapTString
Definition: ttreex.h:94
std::map< TString, unsigned int > mapUI
Definition: ttreex.h:98
std::map< TString, std::vector< UInt_t > > mapVecUInt_t
Definition: ttreex.h:100

◆ createBranch() [1/18]

template<class T >
void RooUtil::TTreeX::createBranch ( TString  ,
bool  = true 
)

◆ createBranch() [2/18]

template<class T >
void RooUtil::TTreeX::createBranch ( T )

◆ createBranch() [3/18]

template<>
void RooUtil::TTreeX::createBranch ( TString  bn,
bool  writeToTree 
)

◆ createBranch() [4/18]

template<>
void RooUtil::TTreeX::createBranch ( TString  bn,
bool  writeToTree 
)

◆ createBranch() [5/18]

template<>
void RooUtil::TTreeX::createBranch ( TString  bn,
bool  writeToTree 
)

◆ createBranch() [6/18]

template<>
void RooUtil::TTreeX::createBranch ( TString  bn,
bool  writeToTree 
)

◆ createBranch() [7/18]

template<>
void RooUtil::TTreeX::createBranch ( TString  bn,
bool  writeToTree 
)

◆ createBranch() [8/18]

template<>
void RooUtil::TTreeX::createBranch ( TString  bn,
bool  writeToTree 
)

◆ createBranch() [9/18]

template<>
void RooUtil::TTreeX::createBranch ( TString  bn,
bool  writeToTree 
)

◆ createBranch() [10/18]

template<>
void RooUtil::TTreeX::createBranch ( TString  bn,
bool  writeToTree 
)

◆ createBranch() [11/18]

template<>
void RooUtil::TTreeX::createBranch ( TString  bn,
bool  writeToTree 
)

Definition at line 777 of file ttreex.cc.

References RooUtil::error().

777  {
778  if (mapInt_t.find(bn.Data()) == mapInt_t.end()) {
779  if (writeToTree)
780  ttree->Branch(bn, &(mapInt_t[bn.Data()]));
781  else
782  mapInt_t[bn.Data()];
783  } else {
784  error(TString::Format("branch already exists bn = %s", bn.Data()));
785  }
786 }
std::map< TString, Int_t > mapInt_t
Definition: ttreex.h:91
void error(TString msg, const char *fname="", int is_error=1)
Definition: printutil.cc:44
TTree * ttree
Definition: ttreex.h:90

◆ createBranch() [12/18]

template<>
void RooUtil::TTreeX::createBranch ( TString  bn,
bool  writeToTree 
)

Definition at line 788 of file ttreex.cc.

References RooUtil::error().

788  {
789  if (mapBool_t.find(bn.Data()) == mapBool_t.end()) {
790  if (writeToTree)
791  ttree->Branch(bn, &(mapBool_t[bn.Data()]));
792  else
793  mapBool_t[bn.Data()];
794  } else {
795  error(TString::Format("branch already exists bn = %s", bn.Data()));
796  }
797 }
void error(TString msg, const char *fname="", int is_error=1)
Definition: printutil.cc:44
TTree * ttree
Definition: ttreex.h:90
std::map< TString, Bool_t > mapBool_t
Definition: ttreex.h:92

◆ createBranch() [13/18]

template<>
void RooUtil::TTreeX::createBranch ( TString  bn,
bool  writeToTree 
)

Definition at line 799 of file ttreex.cc.

References RooUtil::error().

799  {
800  if (mapFloat_t.find(bn.Data()) == mapFloat_t.end()) {
801  if (writeToTree)
802  ttree->Branch(bn, &(mapFloat_t[bn.Data()]));
803  else
804  mapFloat_t[bn.Data()];
805  } else {
806  error(TString::Format("branch already exists bn = %s", bn.Data()));
807  }
808 }
void error(TString msg, const char *fname="", int is_error=1)
Definition: printutil.cc:44
TTree * ttree
Definition: ttreex.h:90
std::map< TString, Float_t > mapFloat_t
Definition: ttreex.h:93

◆ createBranch() [14/18]

template<>
void RooUtil::TTreeX::createBranch ( TString  bn,
bool  writeToTree 
)

Definition at line 810 of file ttreex.cc.

References RooUtil::error().

810  {
811  if (mapTString.find(bn.Data()) == mapTString.end()) {
812  if (writeToTree)
813  ttree->Branch(bn, &(mapTString[bn.Data()]));
814  else
815  mapTString[bn.Data()];
816  } else {
817  error(TString::Format("branch already exists bn = %s", bn.Data()));
818  }
819 }
void error(TString msg, const char *fname="", int is_error=1)
Definition: printutil.cc:44
TTree * ttree
Definition: ttreex.h:90
std::map< TString, TString > mapTString
Definition: ttreex.h:94

◆ createBranch() [15/18]

template<>
void RooUtil::TTreeX::createBranch ( TString  bn,
bool  writeToTree 
)

Definition at line 821 of file ttreex.cc.

References RooUtil::error().

821  {
822  if (mapLV.find(bn.Data()) == mapLV.end()) {
823  if (writeToTree)
824  ttree->Branch(bn, &(mapLV[bn.Data()]));
825  else
826  mapLV[bn.Data()];
827  } else {
828  error(TString::Format("branch already exists bn = %s", bn.Data()));
829  }
830 }
void error(TString msg, const char *fname="", int is_error=1)
Definition: printutil.cc:44
std::map< TString, LV > mapLV
Definition: ttreex.h:95
TTree * ttree
Definition: ttreex.h:90

◆ createBranch() [16/18]

template<>
void RooUtil::TTreeX::createBranch ( TString  bn,
bool  writeToTree 
)

Definition at line 832 of file ttreex.cc.

References RooUtil::error().

832  {
833  if (mapTBits.find(bn.Data()) == mapTBits.end()) {
834  if (writeToTree)
835  ttree->Branch(bn, &(mapTBits[bn.Data()]));
836  else
837  mapTBits[bn.Data()];
838  } else {
839  error(TString::Format("branch already exists bn = %s", bn.Data()));
840  }
841 }
std::map< TString, TBits > mapTBits
Definition: ttreex.h:96
void error(TString msg, const char *fname="", int is_error=1)
Definition: printutil.cc:44
TTree * ttree
Definition: ttreex.h:90

◆ createBranch() [17/18]

template<>
void RooUtil::TTreeX::createBranch ( TString  bn,
bool  writeToTree 
)

Definition at line 843 of file ttreex.cc.

References RooUtil::error().

843  {
844  if (mapULL.find(bn.Data()) == mapULL.end()) {
845  if (writeToTree)
846  ttree->Branch(bn, &(mapULL[bn.Data()]));
847  else
848  mapULL[bn.Data()];
849  } else {
850  error(TString::Format("branch already exists bn = %s", bn.Data()));
851  }
852 }
void error(TString msg, const char *fname="", int is_error=1)
Definition: printutil.cc:44
std::map< TString, unsigned long long > mapULL
Definition: ttreex.h:97
TTree * ttree
Definition: ttreex.h:90

◆ createBranch() [18/18]

template<>
void RooUtil::TTreeX::createBranch ( TString  bn,
bool  writeToTree 
)

Definition at line 854 of file ttreex.cc.

References RooUtil::error().

854  {
855  if (mapUI.find(bn.Data()) == mapUI.end()) {
856  if (writeToTree)
857  ttree->Branch(bn, &(mapUI[bn.Data()]));
858  else
859  mapUI[bn.Data()];
860  } else {
861  error(TString::Format("branch already exists bn = %s", bn.Data()));
862  }
863 }
void error(TString msg, const char *fname="", int is_error=1)
Definition: printutil.cc:44
TTree * ttree
Definition: ttreex.h:90
std::map< TString, unsigned int > mapUI
Definition: ttreex.h:98

◆ createFlatBranch()

void TTreeX::createFlatBranch ( std::vector< TString >  p4_bns,
std::vector< TString >  float_bns,
std::vector< TString >  int_bns,
std::vector< TString >  bool_bns,
int  multiplicity 
)

Definition at line 116 of file ttreex.cc.

References mps_fire::i.

120  {
121  for (auto& p4_bn : p4_bns) {
122  for (int i = 0; i < multiplicity; ++i)
123  createBranch<LV>(TString::Format("%s_%d", p4_bn.Data(), i));
124  }
125  for (auto& float_bn : float_bns) {
126  for (int i = 0; i < multiplicity; ++i)
127  createBranch<float>(TString::Format("%s_%d", float_bn.Data(), i));
128  }
129  for (auto& int_bn : int_bns) {
130  for (int i = 0; i < multiplicity; ++i)
131  createBranch<int>(TString::Format("%s_%d", int_bn.Data(), i));
132  }
133  for (auto& bool_bn : bool_bns) {
134  for (int i = 0; i < multiplicity; ++i)
135  createBranch<bool>(TString::Format("%s_%d", bool_bn.Data(), i));
136  }
137 }

◆ fill()

void RooUtil::TTreeX::fill ( void  )
inline

Definition at line 122 of file ttreex.h.

References ttree.

Referenced by fillOutputBranches().

122 { ttree->Fill(); }
TTree * ttree
Definition: ttreex.h:90

◆ get()

template<class T >
T * RooUtil::TTreeX::get ( TString  brname,
int  entry = -1 
)

◆ getBranch() [1/17]

template<class T >
const T& RooUtil::TTreeX::getBranch ( TString  ,
bool  = true 
)

◆ getBranch() [2/17]

template<>
const Int_t& RooUtil::TTreeX::getBranch ( TString  bn,
bool  check 
)

◆ getBranch() [3/17]

template<>
const Bool_t& RooUtil::TTreeX::getBranch ( TString  bn,
bool  check 
)

◆ getBranch() [4/17]

template<>
const Float_t& RooUtil::TTreeX::getBranch ( TString  bn,
bool  check 
)

◆ getBranch() [5/17]

template<>
const TString& RooUtil::TTreeX::getBranch ( TString  bn,
bool  check 
)

◆ getBranch() [6/17]

template<>
const LV& RooUtil::TTreeX::getBranch ( TString  bn,
bool  check 
)

◆ getBranch() [7/17]

template<>
const TBits& RooUtil::TTreeX::getBranch ( TString  bn,
bool  check 
)

◆ getBranch() [8/17]

template<>
const unsigned long long& RooUtil::TTreeX::getBranch ( TString  bn,
bool  check 
)

◆ getBranch() [9/17]

template<>
const unsigned int& RooUtil::TTreeX::getBranch ( TString  bn,
bool  check 
)

◆ getBranch() [10/17]

template<>
const Int_t& RooUtil::TTreeX::getBranch ( TString  bn,
bool  check 
)

Definition at line 499 of file ttreex.cc.

References RPCNoise_example::check, and RooUtil::error().

499  {
500  if (check)
501  if (!mapIsBranchSet[bn.Data()])
502  error(TString::Format("branch hasn't been set yet bn = %s", bn.Data()));
503  return mapInt_t[bn.Data()];
504 }
std::map< TString, Bool_t > mapIsBranchSet
Definition: ttreex.h:110
std::map< TString, Int_t > mapInt_t
Definition: ttreex.h:91
void error(TString msg, const char *fname="", int is_error=1)
Definition: printutil.cc:44

◆ getBranch() [11/17]

template<>
const Bool_t& RooUtil::TTreeX::getBranch ( TString  bn,
bool  check 
)

Definition at line 506 of file ttreex.cc.

References RPCNoise_example::check, and RooUtil::error().

506  {
507  if (check)
508  if (!mapIsBranchSet[bn.Data()])
509  error(TString::Format("branch hasn't been set yet bn = %s", bn.Data()));
510  return mapBool_t[bn.Data()];
511 }
std::map< TString, Bool_t > mapIsBranchSet
Definition: ttreex.h:110
void error(TString msg, const char *fname="", int is_error=1)
Definition: printutil.cc:44
std::map< TString, Bool_t > mapBool_t
Definition: ttreex.h:92

◆ getBranch() [12/17]

template<>
const Float_t& RooUtil::TTreeX::getBranch ( TString  bn,
bool  check 
)

Definition at line 513 of file ttreex.cc.

References RPCNoise_example::check, and RooUtil::error().

513  {
514  if (check)
515  if (!mapIsBranchSet[bn.Data()])
516  error(TString::Format("branch hasn't been set yet bn = %s", bn.Data()));
517  return mapFloat_t[bn.Data()];
518 }
std::map< TString, Bool_t > mapIsBranchSet
Definition: ttreex.h:110
void error(TString msg, const char *fname="", int is_error=1)
Definition: printutil.cc:44
std::map< TString, Float_t > mapFloat_t
Definition: ttreex.h:93

◆ getBranch() [13/17]

template<>
const TString& RooUtil::TTreeX::getBranch ( TString  bn,
bool  check 
)

Definition at line 520 of file ttreex.cc.

References RPCNoise_example::check, and RooUtil::error().

520  {
521  if (check)
522  if (!mapIsBranchSet[bn.Data()])
523  error(TString::Format("branch hasn't been set yet bn = %s", bn.Data()));
524  return mapTString[bn.Data()];
525 }
std::map< TString, Bool_t > mapIsBranchSet
Definition: ttreex.h:110
void error(TString msg, const char *fname="", int is_error=1)
Definition: printutil.cc:44
std::map< TString, TString > mapTString
Definition: ttreex.h:94

◆ getBranch() [14/17]

template<>
const LV& RooUtil::TTreeX::getBranch ( TString  bn,
bool  check 
)

Definition at line 527 of file ttreex.cc.

References RPCNoise_example::check, and RooUtil::error().

527  {
528  if (check)
529  if (!mapIsBranchSet[bn.Data()])
530  error(TString::Format("branch hasn't been set yet bn = %s", bn.Data()));
531  return mapLV[bn.Data()];
532 }
std::map< TString, Bool_t > mapIsBranchSet
Definition: ttreex.h:110
void error(TString msg, const char *fname="", int is_error=1)
Definition: printutil.cc:44
std::map< TString, LV > mapLV
Definition: ttreex.h:95

◆ getBranch() [15/17]

template<>
const TBits& RooUtil::TTreeX::getBranch ( TString  bn,
bool  check 
)

Definition at line 534 of file ttreex.cc.

References RPCNoise_example::check, and RooUtil::error().

534  {
535  if (check)
536  if (!mapIsBranchSet[bn.Data()])
537  error(TString::Format("branch hasn't been set yet bn = %s", bn.Data()));
538  return mapTBits[bn.Data()];
539 }
std::map< TString, Bool_t > mapIsBranchSet
Definition: ttreex.h:110
std::map< TString, TBits > mapTBits
Definition: ttreex.h:96
void error(TString msg, const char *fname="", int is_error=1)
Definition: printutil.cc:44

◆ getBranch() [16/17]

template<>
const unsigned long long& RooUtil::TTreeX::getBranch ( TString  bn,
bool  check 
)

Definition at line 541 of file ttreex.cc.

References RPCNoise_example::check, and RooUtil::error().

541  {
542  if (check)
543  if (!mapIsBranchSet[bn.Data()])
544  error(TString::Format("branch hasn't been set yet bn = %s", bn.Data()));
545  return mapULL[bn.Data()];
546 }
std::map< TString, Bool_t > mapIsBranchSet
Definition: ttreex.h:110
void error(TString msg, const char *fname="", int is_error=1)
Definition: printutil.cc:44
std::map< TString, unsigned long long > mapULL
Definition: ttreex.h:97

◆ getBranch() [17/17]

template<>
const unsigned int& RooUtil::TTreeX::getBranch ( TString  bn,
bool  check 
)

Definition at line 548 of file ttreex.cc.

References RPCNoise_example::check, and RooUtil::error().

548  {
549  if (check)
550  if (!mapIsBranchSet[bn.Data()])
551  error(TString::Format("branch hasn't been set yet bn = %s", bn.Data()));
552  return mapUI[bn.Data()];
553 }
std::map< TString, Bool_t > mapIsBranchSet
Definition: ttreex.h:110
void error(TString msg, const char *fname="", int is_error=1)
Definition: printutil.cc:44
std::map< TString, unsigned int > mapUI
Definition: ttreex.h:98

◆ getBranchAddress() [1/7]

template<class T >
T* RooUtil::TTreeX::getBranchAddress ( TString  )

◆ getBranchAddress() [2/7]

template<>
Int_t* RooUtil::TTreeX::getBranchAddress ( TString  bn)

◆ getBranchAddress() [3/7]

template<>
Bool_t* RooUtil::TTreeX::getBranchAddress ( TString  bn)

◆ getBranchAddress() [4/7]

template<>
Float_t* RooUtil::TTreeX::getBranchAddress ( TString  bn)

◆ getBranchAddress() [5/7]

template<>
Int_t* RooUtil::TTreeX::getBranchAddress ( TString  bn)

Definition at line 763 of file ttreex.cc.

763  {
764  return &mapInt_t[bn.Data()];
765 }
std::map< TString, Int_t > mapInt_t
Definition: ttreex.h:91

◆ getBranchAddress() [6/7]

template<>
Bool_t* RooUtil::TTreeX::getBranchAddress ( TString  bn)

Definition at line 767 of file ttreex.cc.

767  {
768  return &mapBool_t[bn.Data()];
769 }
std::map< TString, Bool_t > mapBool_t
Definition: ttreex.h:92

◆ getBranchAddress() [7/7]

template<>
Float_t* RooUtil::TTreeX::getBranchAddress ( TString  bn)

Definition at line 771 of file ttreex.cc.

771  {
772  return &mapFloat_t[bn.Data()];
773 }
std::map< TString, Float_t > mapFloat_t
Definition: ttreex.h:93

◆ getBranchLazy() [1/17]

template<class T >
const T& RooUtil::TTreeX::getBranchLazy ( TString  )

◆ getBranchLazy() [2/17]

template<>
const Int_t& RooUtil::TTreeX::getBranchLazy ( TString  bn)

◆ getBranchLazy() [3/17]

template<>
const Bool_t& RooUtil::TTreeX::getBranchLazy ( TString  bn)

◆ getBranchLazy() [4/17]

template<>
const Float_t& RooUtil::TTreeX::getBranchLazy ( TString  bn)

◆ getBranchLazy() [5/17]

template<>
const TString& RooUtil::TTreeX::getBranchLazy ( TString  bn)

◆ getBranchLazy() [6/17]

template<>
const LV& RooUtil::TTreeX::getBranchLazy ( TString  bn)

◆ getBranchLazy() [7/17]

template<>
const TBits& RooUtil::TTreeX::getBranchLazy ( TString  bn)

◆ getBranchLazy() [8/17]

template<>
const unsigned long long& RooUtil::TTreeX::getBranchLazy ( TString  bn)

◆ getBranchLazy() [9/17]

template<>
const unsigned int& RooUtil::TTreeX::getBranchLazy ( TString  bn)

◆ getBranchLazy() [10/17]

template<>
const Int_t& RooUtil::TTreeX::getBranchLazy ( TString  bn)

Definition at line 621 of file ttreex.cc.

621  {
622  return getBranch<Int_t>(bn, false);
623 }

◆ getBranchLazy() [11/17]

template<>
const Bool_t& RooUtil::TTreeX::getBranchLazy ( TString  bn)

Definition at line 625 of file ttreex.cc.

625  {
626  return getBranch<Bool_t>(bn, false);
627 }

◆ getBranchLazy() [12/17]

template<>
const Float_t& RooUtil::TTreeX::getBranchLazy ( TString  bn)

Definition at line 629 of file ttreex.cc.

629  {
630  return getBranch<Float_t>(bn, false);
631 }

◆ getBranchLazy() [13/17]

template<>
const TString& RooUtil::TTreeX::getBranchLazy ( TString  bn)

Definition at line 633 of file ttreex.cc.

633  {
634  return getBranch<TString>(bn, false);
635 }

◆ getBranchLazy() [14/17]

template<>
const LV& RooUtil::TTreeX::getBranchLazy ( TString  bn)

Definition at line 637 of file ttreex.cc.

637  {
638  return getBranch<LV>(bn, false);
639 }

◆ getBranchLazy() [15/17]

template<>
const TBits& RooUtil::TTreeX::getBranchLazy ( TString  bn)

Definition at line 641 of file ttreex.cc.

641  {
642  return getBranch<TBits>(bn, false);
643 }

◆ getBranchLazy() [16/17]

template<>
const unsigned long long& RooUtil::TTreeX::getBranchLazy ( TString  bn)

Definition at line 645 of file ttreex.cc.

645  {
646  return getBranch<unsigned long long>(bn, false);
647 }

◆ getBranchLazy() [17/17]

template<>
const unsigned int& RooUtil::TTreeX::getBranchLazy ( TString  bn)

Definition at line 649 of file ttreex.cc.

649  {
650  return getBranch<unsigned int>(bn, false);
651 }

◆ getTree()

TTree* RooUtil::TTreeX::getTree ( )
inline

Definition at line 117 of file ttreex.h.

References ttree.

117 { return ttree; }
TTree * ttree
Definition: ttreex.h:90

◆ getValPtr()

void * RooUtil::TTreeX::getValPtr ( TString  brname)

Definition at line 29 of file ttreex.cc.

References beamvalidation::br, and RooUtil::error().

Referenced by get().

29  {
30  TBranch* br = ttree->GetBranch(brname);
31  unsigned int nleaves = br->GetListOfLeaves()->GetEntries();
32  if (nleaves != 1)
33  RooUtil::error("# of leaf for this branch=" + brname + " is not equals to 1!", __FUNCTION__);
34  if (!(((TLeaf*)br->GetListOfLeaves()->At(0))->GetValuePointer()))
35  ttree->GetEntry(0);
36  return ((TLeaf*)br->GetListOfLeaves()->At(0))->GetValuePointer();
37 }
void error(TString msg, const char *fname="", int is_error=1)
Definition: printutil.cc:44
TTree * ttree
Definition: ttreex.h:90

◆ hasBranch() [1/17]

template<class T >
bool RooUtil::TTreeX::hasBranch ( TString  )

◆ hasBranch() [2/17]

template<>
bool RooUtil::TTreeX::hasBranch ( TString  bn)

◆ hasBranch() [3/17]

template<>
bool RooUtil::TTreeX::hasBranch ( TString  bn)

◆ hasBranch() [4/17]

template<>
bool RooUtil::TTreeX::hasBranch ( TString  bn)

◆ hasBranch() [5/17]

template<>
bool RooUtil::TTreeX::hasBranch ( TString  bn)

◆ hasBranch() [6/17]

template<>
bool RooUtil::TTreeX::hasBranch ( TString  bn)

◆ hasBranch() [7/17]

template<>
bool RooUtil::TTreeX::hasBranch ( TString  bn)

◆ hasBranch() [8/17]

template<>
bool RooUtil::TTreeX::hasBranch ( TString  bn)

◆ hasBranch() [9/17]

template<>
bool RooUtil::TTreeX::hasBranch ( TString  bn)

◆ hasBranch() [10/17]

template<>
bool RooUtil::TTreeX::hasBranch ( TString  bn)

Definition at line 963 of file ttreex.cc.

963  {
964  if (mapInt_t.find(bn.Data()) == mapInt_t.end())
965  return false;
966  else
967  return true;
968 }
std::map< TString, Int_t > mapInt_t
Definition: ttreex.h:91

◆ hasBranch() [11/17]

template<>
bool RooUtil::TTreeX::hasBranch ( TString  bn)

Definition at line 970 of file ttreex.cc.

970  {
971  if (mapBool_t.find(bn.Data()) == mapBool_t.end())
972  return false;
973  else
974  return true;
975 }
std::map< TString, Bool_t > mapBool_t
Definition: ttreex.h:92

◆ hasBranch() [12/17]

template<>
bool RooUtil::TTreeX::hasBranch ( TString  bn)

Definition at line 977 of file ttreex.cc.

977  {
978  if (mapFloat_t.find(bn.Data()) == mapFloat_t.end())
979  return false;
980  else
981  return true;
982 }
std::map< TString, Float_t > mapFloat_t
Definition: ttreex.h:93

◆ hasBranch() [13/17]

template<>
bool RooUtil::TTreeX::hasBranch ( TString  bn)

Definition at line 984 of file ttreex.cc.

984  {
985  if (mapTString.find(bn.Data()) == mapTString.end())
986  return false;
987  else
988  return true;
989 }
std::map< TString, TString > mapTString
Definition: ttreex.h:94

◆ hasBranch() [14/17]

template<>
bool RooUtil::TTreeX::hasBranch ( TString  bn)

Definition at line 991 of file ttreex.cc.

991  {
992  if (mapLV.find(bn.Data()) == mapLV.end())
993  return false;
994  else
995  return true;
996 }
std::map< TString, LV > mapLV
Definition: ttreex.h:95

◆ hasBranch() [15/17]

template<>
bool RooUtil::TTreeX::hasBranch ( TString  bn)

Definition at line 998 of file ttreex.cc.

998  {
999  if (mapTBits.find(bn.Data()) == mapTBits.end())
1000  return false;
1001  else
1002  return true;
1003 }
std::map< TString, TBits > mapTBits
Definition: ttreex.h:96

◆ hasBranch() [16/17]

template<>
bool RooUtil::TTreeX::hasBranch ( TString  bn)

Definition at line 1005 of file ttreex.cc.

1005  {
1006  if (mapULL.find(bn.Data()) == mapULL.end())
1007  return false;
1008  else
1009  return true;
1010 }
std::map< TString, unsigned long long > mapULL
Definition: ttreex.h:97

◆ hasBranch() [17/17]

template<>
bool RooUtil::TTreeX::hasBranch ( TString  bn)

Definition at line 1012 of file ttreex.cc.

1012  {
1013  if (mapUI.find(bn.Data()) == mapUI.end())
1014  return false;
1015  else
1016  return true;
1017 }
std::map< TString, unsigned int > mapUI
Definition: ttreex.h:98

◆ isBranchSet() [1/17]

template<class T >
bool RooUtil::TTreeX::isBranchSet ( TString  )

◆ isBranchSet() [2/17]

template<>
bool RooUtil::TTreeX::isBranchSet ( TString  bn)

◆ isBranchSet() [3/17]

template<>
bool RooUtil::TTreeX::isBranchSet ( TString  bn)

◆ isBranchSet() [4/17]

template<>
bool RooUtil::TTreeX::isBranchSet ( TString  bn)

◆ isBranchSet() [5/17]

template<>
bool RooUtil::TTreeX::isBranchSet ( TString  bn)

◆ isBranchSet() [6/17]

template<>
bool RooUtil::TTreeX::isBranchSet ( TString  bn)

◆ isBranchSet() [7/17]

template<>
bool RooUtil::TTreeX::isBranchSet ( TString  bn)

◆ isBranchSet() [8/17]

template<>
bool RooUtil::TTreeX::isBranchSet ( TString  bn)

◆ isBranchSet() [9/17]

template<>
bool RooUtil::TTreeX::isBranchSet ( TString  bn)

◆ isBranchSet() [10/17]

template<>
bool RooUtil::TTreeX::isBranchSet ( TString  bn)

Definition at line 692 of file ttreex.cc.

692  {
693  return mapIsBranchSet[bn.Data()];
694 }
std::map< TString, Bool_t > mapIsBranchSet
Definition: ttreex.h:110

◆ isBranchSet() [11/17]

template<>
bool RooUtil::TTreeX::isBranchSet ( TString  bn)

Definition at line 696 of file ttreex.cc.

696  {
697  return mapIsBranchSet[bn.Data()];
698 }
std::map< TString, Bool_t > mapIsBranchSet
Definition: ttreex.h:110

◆ isBranchSet() [12/17]

template<>
bool RooUtil::TTreeX::isBranchSet ( TString  bn)

Definition at line 700 of file ttreex.cc.

700  {
701  return mapIsBranchSet[bn.Data()];
702 }
std::map< TString, Bool_t > mapIsBranchSet
Definition: ttreex.h:110

◆ isBranchSet() [13/17]

template<>
bool RooUtil::TTreeX::isBranchSet ( TString  bn)

Definition at line 704 of file ttreex.cc.

704  {
705  return mapIsBranchSet[bn.Data()];
706 }
std::map< TString, Bool_t > mapIsBranchSet
Definition: ttreex.h:110

◆ isBranchSet() [14/17]

template<>
bool RooUtil::TTreeX::isBranchSet ( TString  bn)

Definition at line 708 of file ttreex.cc.

708  {
709  return mapIsBranchSet[bn.Data()];
710 }
std::map< TString, Bool_t > mapIsBranchSet
Definition: ttreex.h:110

◆ isBranchSet() [15/17]

template<>
bool RooUtil::TTreeX::isBranchSet ( TString  bn)

Definition at line 712 of file ttreex.cc.

712  {
713  return mapIsBranchSet[bn.Data()];
714 }
std::map< TString, Bool_t > mapIsBranchSet
Definition: ttreex.h:110

◆ isBranchSet() [16/17]

template<>
bool RooUtil::TTreeX::isBranchSet ( TString  bn)

Definition at line 716 of file ttreex.cc.

716  {
717  return mapIsBranchSet[bn.Data()];
718 }
std::map< TString, Bool_t > mapIsBranchSet
Definition: ttreex.h:110

◆ isBranchSet() [17/17]

template<>
bool RooUtil::TTreeX::isBranchSet ( TString  bn)

Definition at line 720 of file ttreex.cc.

720  {
721  return mapIsBranchSet[bn.Data()];
722 }
std::map< TString, Bool_t > mapIsBranchSet
Definition: ttreex.h:110

◆ pushbackToBranch() [1/17]

template<class T >
void RooUtil::TTreeX::pushbackToBranch ( TString  ,
T   
)

◆ pushbackToBranch() [2/17]

template<>
void RooUtil::TTreeX::pushbackToBranch ( TString  bn,
Int_t  val 
)

◆ pushbackToBranch() [3/17]

template<>
void RooUtil::TTreeX::pushbackToBranch ( TString  bn,
UInt_t  val 
)

◆ pushbackToBranch() [4/17]

template<>
void RooUtil::TTreeX::pushbackToBranch ( TString  bn,
Bool_t  val 
)

◆ pushbackToBranch() [5/17]

template<>
void RooUtil::TTreeX::pushbackToBranch ( TString  bn,
Float_t  val 
)

◆ pushbackToBranch() [6/17]

template<>
void RooUtil::TTreeX::pushbackToBranch ( TString  bn,
TString  val 
)

◆ pushbackToBranch() [7/17]

template<>
void RooUtil::TTreeX::pushbackToBranch ( TString  bn,
LV  val 
)

◆ pushbackToBranch() [8/17]

template<>
void RooUtil::TTreeX::pushbackToBranch ( TString  bn,
VInt  val 
)

◆ pushbackToBranch() [9/17]

template<>
void RooUtil::TTreeX::pushbackToBranch ( TString  bn,
VFloat  val 
)

◆ pushbackToBranch() [10/17]

template<>
void RooUtil::TTreeX::pushbackToBranch ( TString  bn,
Int_t  val 
)

Definition at line 409 of file ttreex.cc.

References RooUtil::error(), and heppy_batch::val.

409  {
410  if (mapVecInt_t.find(bn.Data()) != mapVecInt_t.end()) {
411  mapVecInt_t[bn.Data()].push_back(val);
412  mapIsBranchSet[bn.Data()] = true;
413  } else {
414  error(TString::Format("branch doesn't exist bn = %s", bn.Data()));
415  }
416 }
std::map< TString, Bool_t > mapIsBranchSet
Definition: ttreex.h:110
void error(TString msg, const char *fname="", int is_error=1)
Definition: printutil.cc:44
std::map< TString, std::vector< Int_t > > mapVecInt_t
Definition: ttreex.h:99

◆ pushbackToBranch() [11/17]

template<>
void RooUtil::TTreeX::pushbackToBranch ( TString  bn,
UInt_t  val 
)

Definition at line 418 of file ttreex.cc.

References RooUtil::error(), and heppy_batch::val.

418  {
419  if (mapVecUInt_t.find(bn.Data()) != mapVecUInt_t.end()) {
420  mapVecUInt_t[bn.Data()].push_back(val);
421  mapIsBranchSet[bn.Data()] = true;
422  } else {
423  error(TString::Format("branch doesn't exist bn = %s", bn.Data()));
424  }
425 }
std::map< TString, Bool_t > mapIsBranchSet
Definition: ttreex.h:110
void error(TString msg, const char *fname="", int is_error=1)
Definition: printutil.cc:44
std::map< TString, std::vector< UInt_t > > mapVecUInt_t
Definition: ttreex.h:100

◆ pushbackToBranch() [12/17]

template<>
void RooUtil::TTreeX::pushbackToBranch ( TString  bn,
Bool_t  val 
)

Definition at line 427 of file ttreex.cc.

References RooUtil::error(), and heppy_batch::val.

427  {
428  if (mapVecBool_t.find(bn.Data()) != mapVecBool_t.end()) {
429  mapVecBool_t[bn.Data()].push_back(val);
430  mapIsBranchSet[bn.Data()] = true;
431  } else {
432  error(TString::Format("branch doesn't exist bn = %s", bn.Data()));
433  }
434 }
std::map< TString, Bool_t > mapIsBranchSet
Definition: ttreex.h:110
void error(TString msg, const char *fname="", int is_error=1)
Definition: printutil.cc:44
std::map< TString, std::vector< Bool_t > > mapVecBool_t
Definition: ttreex.h:101

◆ pushbackToBranch() [13/17]

template<>
void RooUtil::TTreeX::pushbackToBranch ( TString  bn,
Float_t  val 
)

Definition at line 436 of file ttreex.cc.

References RooUtil::error(), and heppy_batch::val.

436  {
437  if (mapVecFloat_t.find(bn.Data()) != mapVecFloat_t.end()) {
438  mapVecFloat_t[bn.Data()].push_back(val);
439  mapIsBranchSet[bn.Data()] = true;
440  } else {
441  error(TString::Format("branch doesn't exist bn = %s", bn.Data()));
442  }
443 }
std::map< TString, Bool_t > mapIsBranchSet
Definition: ttreex.h:110
void error(TString msg, const char *fname="", int is_error=1)
Definition: printutil.cc:44
std::map< TString, std::vector< Float_t > > mapVecFloat_t
Definition: ttreex.h:102

◆ pushbackToBranch() [14/17]

template<>
void RooUtil::TTreeX::pushbackToBranch ( TString  bn,
TString  val 
)

Definition at line 445 of file ttreex.cc.

References RooUtil::error(), and heppy_batch::val.

445  {
446  if (mapVecTString.find(bn.Data()) != mapVecTString.end()) {
447  mapVecTString[bn.Data()].push_back(val);
448  mapIsBranchSet[bn.Data()] = true;
449  } else {
450  error(TString::Format("branch doesn't exist bn = %s", bn.Data()));
451  }
452 }
std::map< TString, Bool_t > mapIsBranchSet
Definition: ttreex.h:110
std::map< TString, std::vector< TString > > mapVecTString
Definition: ttreex.h:103
void error(TString msg, const char *fname="", int is_error=1)
Definition: printutil.cc:44

◆ pushbackToBranch() [15/17]

template<>
void RooUtil::TTreeX::pushbackToBranch ( TString  bn,
LV  val 
)

Definition at line 454 of file ttreex.cc.

References RooUtil::error(), and heppy_batch::val.

454  {
455  if (mapVecLV.find(bn.Data()) != mapVecLV.end()) {
456  mapVecLV[bn.Data()].push_back(val);
457  mapIsBranchSet[bn.Data()] = true;
458  } else {
459  error(TString::Format("branch doesn't exist bn = %s", bn.Data()));
460  }
461 }
std::map< TString, Bool_t > mapIsBranchSet
Definition: ttreex.h:110
std::map< TString, std::vector< LV > > mapVecLV
Definition: ttreex.h:104
void error(TString msg, const char *fname="", int is_error=1)
Definition: printutil.cc:44

◆ pushbackToBranch() [16/17]

template<>
void RooUtil::TTreeX::pushbackToBranch ( TString  bn,
VInt  val 
)

Definition at line 463 of file ttreex.cc.

References RooUtil::error(), and heppy_batch::val.

463  {
464  if (mapVecVInt.find(bn.Data()) != mapVecVInt.end()) {
465  mapVecVInt[bn.Data()].push_back(val);
466  mapIsBranchSet[bn.Data()] = true;
467  } else {
468  error(TString::Format("branch doesn't exist bn = %s", bn.Data()));
469  }
470 }
std::map< TString, Bool_t > mapIsBranchSet
Definition: ttreex.h:110
std::map< TString, std::vector< std::vector< Int_t > > > mapVecVInt
Definition: ttreex.h:105
void error(TString msg, const char *fname="", int is_error=1)
Definition: printutil.cc:44

◆ pushbackToBranch() [17/17]

template<>
void RooUtil::TTreeX::pushbackToBranch ( TString  bn,
VFloat  val 
)

Definition at line 472 of file ttreex.cc.

References RooUtil::error(), and heppy_batch::val.

472  {
473  if (mapVecVFloat.find(bn.Data()) != mapVecVFloat.end()) {
474  mapVecVFloat[bn.Data()].push_back(val);
475  mapIsBranchSet[bn.Data()] = true;
476  } else {
477  error(TString::Format("branch doesn't exist bn = %s", bn.Data()));
478  }
479 }
std::map< TString, Bool_t > mapIsBranchSet
Definition: ttreex.h:110
std::map< TString, std::vector< std::vector< Float_t > > > mapVecVFloat
Definition: ttreex.h:106
void error(TString msg, const char *fname="", int is_error=1)
Definition: printutil.cc:44

◆ save()

void RooUtil::TTreeX::save ( TFile *  ofile)

Definition at line 78 of file ttreex.cc.

References RooUtil::print().

78  {
79  RooUtil::print(Form("TTreeX::save() saving tree to %s", ofile->GetName()));
80  ofile->cd();
81  this->ttree->Write();
82 }
void print(TString msg="", const char *fname="", int flush_before=0, int flush_after=0)
Definition: printutil.cc:23
TTree * ttree
Definition: ttreex.h:90

◆ setBranch() [1/18]

template<class T >
void RooUtil::TTreeX::setBranch ( TString  ,
T  ,
bool  = false,
bool  = false 
)

◆ setBranch() [2/18]

template<class T >
void RooUtil::TTreeX::setBranch ( T )

◆ setBranch() [3/18]

template<>
void RooUtil::TTreeX::setBranch ( TString  bn,
Int_t  val,
bool  force,
bool  ignore 
)

◆ setBranch() [4/18]

template<>
void RooUtil::TTreeX::setBranch ( TString  bn,
Bool_t  val,
bool  force,
bool  ignore 
)

◆ setBranch() [5/18]

template<>
void RooUtil::TTreeX::setBranch ( TString  bn,
Float_t  val,
bool  force,
bool  ignore 
)

◆ setBranch() [6/18]

template<>
void RooUtil::TTreeX::setBranch ( TString  bn,
Int_t  val,
bool  force,
bool  ignore 
)

Definition at line 169 of file ttreex.cc.

References RooUtil::error(), cmsStageWithFailover::force, SequenceTypes::ignore(), and heppy_batch::val.

169  {
170  if (force) {
171  mapInt_t[bn.Data()] = val;
172  mapIsBranchSet[bn.Data()] = true;
173  return;
174  }
175  if (mapInt_t.find(bn.Data()) != mapInt_t.end()) {
176  mapInt_t[bn.Data()] = val;
177  mapIsBranchSet[bn.Data()] = true;
178  } else {
179  if (!ignore)
180  error(TString::Format("branch doesn't exist bn = %s", bn.Data()));
181  }
182 }
std::map< TString, Bool_t > mapIsBranchSet
Definition: ttreex.h:110
std::map< TString, Int_t > mapInt_t
Definition: ttreex.h:91
void error(TString msg, const char *fname="", int is_error=1)
Definition: printutil.cc:44
def ignore(seq)

◆ setBranch() [7/18]

template<>
void RooUtil::TTreeX::setBranch ( TString  bn,
TString  val,
bool  force,
bool  ignore 
)

◆ setBranch() [8/18]

template<>
void RooUtil::TTreeX::setBranch ( TString  bn,
LV  val,
bool  force,
bool  ignore 
)

◆ setBranch() [9/18]

template<>
void RooUtil::TTreeX::setBranch ( TString  bn,
TBits  val,
bool  force,
bool  ignore 
)

◆ setBranch() [10/18]

template<>
void RooUtil::TTreeX::setBranch ( TString  bn,
unsigned long long  val,
bool  force,
bool  ignore 
)

◆ setBranch() [11/18]

template<>
void RooUtil::TTreeX::setBranch ( TString  bn,
unsigned int  val,
bool  force,
bool  ignore 
)

◆ setBranch() [12/18]

template<>
void RooUtil::TTreeX::setBranch ( TString  bn,
Bool_t  val,
bool  force,
bool  ignore 
)

Definition at line 184 of file ttreex.cc.

References RooUtil::error(), cmsStageWithFailover::force, SequenceTypes::ignore(), and heppy_batch::val.

184  {
185  if (force) {
186  mapBool_t[bn.Data()] = val;
187  mapIsBranchSet[bn.Data()] = true;
188  return;
189  }
190  if (mapBool_t.find(bn.Data()) != mapBool_t.end()) {
191  mapBool_t[bn.Data()] = val;
192  mapIsBranchSet[bn.Data()] = true;
193  } else {
194  if (!ignore)
195  error(TString::Format("branch doesn't exist bn = %s", bn.Data()));
196  }
197 }
std::map< TString, Bool_t > mapIsBranchSet
Definition: ttreex.h:110
void error(TString msg, const char *fname="", int is_error=1)
Definition: printutil.cc:44
def ignore(seq)
std::map< TString, Bool_t > mapBool_t
Definition: ttreex.h:92

◆ setBranch() [13/18]

template<>
void RooUtil::TTreeX::setBranch ( TString  bn,
Float_t  val,
bool  force,
bool  ignore 
)

Definition at line 199 of file ttreex.cc.

References RooUtil::error(), cmsStageWithFailover::force, SequenceTypes::ignore(), and heppy_batch::val.

199  {
200  if (force) {
201  mapFloat_t[bn.Data()] = val;
202  mapIsBranchSet[bn.Data()] = true;
203  return;
204  }
205  if (mapFloat_t.find(bn.Data()) != mapFloat_t.end()) {
206  mapFloat_t[bn.Data()] = val;
207  mapIsBranchSet[bn.Data()] = true;
208  } else {
209  if (!ignore)
210  error(TString::Format("branch doesn't exist bn = %s", bn.Data()));
211  }
212 }
std::map< TString, Bool_t > mapIsBranchSet
Definition: ttreex.h:110
void error(TString msg, const char *fname="", int is_error=1)
Definition: printutil.cc:44
def ignore(seq)
std::map< TString, Float_t > mapFloat_t
Definition: ttreex.h:93

◆ setBranch() [14/18]

template<>
void RooUtil::TTreeX::setBranch ( TString  bn,
TString  val,
bool  force,
bool  ignore 
)

Definition at line 214 of file ttreex.cc.

References RooUtil::error(), cmsStageWithFailover::force, SequenceTypes::ignore(), and heppy_batch::val.

214  {
215  if (force) {
216  mapTString[bn.Data()] = val;
217  mapIsBranchSet[bn.Data()] = true;
218  return;
219  }
220  if (mapTString.find(bn.Data()) != mapTString.end()) {
221  mapTString[bn.Data()] = val;
222  mapIsBranchSet[bn.Data()] = true;
223  } else {
224  if (!ignore)
225  error(TString::Format("branch doesn't exist bn = %s", bn.Data()));
226  }
227 }
std::map< TString, Bool_t > mapIsBranchSet
Definition: ttreex.h:110
void error(TString msg, const char *fname="", int is_error=1)
Definition: printutil.cc:44
def ignore(seq)
std::map< TString, TString > mapTString
Definition: ttreex.h:94

◆ setBranch() [15/18]

template<>
void RooUtil::TTreeX::setBranch ( TString  bn,
LV  val,
bool  force,
bool  ignore 
)

Definition at line 229 of file ttreex.cc.

References RooUtil::error(), cmsStageWithFailover::force, SequenceTypes::ignore(), and heppy_batch::val.

229  {
230  if (force) {
231  mapLV[bn.Data()] = val;
232  mapIsBranchSet[bn.Data()] = true;
233  return;
234  }
235  if (mapLV.find(bn.Data()) != mapLV.end()) {
236  mapLV[bn.Data()] = val;
237  mapIsBranchSet[bn.Data()] = true;
238  } else {
239  if (!ignore)
240  error(TString::Format("branch doesn't exist bn = %s", bn.Data()));
241  }
242 }
std::map< TString, Bool_t > mapIsBranchSet
Definition: ttreex.h:110
void error(TString msg, const char *fname="", int is_error=1)
Definition: printutil.cc:44
std::map< TString, LV > mapLV
Definition: ttreex.h:95
def ignore(seq)

◆ setBranch() [16/18]

template<>
void RooUtil::TTreeX::setBranch ( TString  bn,
TBits  val,
bool  force,
bool  ignore 
)

Definition at line 244 of file ttreex.cc.

References RooUtil::error(), cmsStageWithFailover::force, SequenceTypes::ignore(), and heppy_batch::val.

244  {
245  if (force) {
246  mapTBits[bn.Data()] = val;
247  mapIsBranchSet[bn.Data()] = true;
248  return;
249  }
250  if (mapTBits.find(bn.Data()) != mapTBits.end()) {
251  mapTBits[bn.Data()] = val;
252  mapIsBranchSet[bn.Data()] = true;
253  } else {
254  if (!ignore)
255  error(TString::Format("branch doesn't exist bn = %s", bn.Data()));
256  }
257 }
std::map< TString, Bool_t > mapIsBranchSet
Definition: ttreex.h:110
std::map< TString, TBits > mapTBits
Definition: ttreex.h:96
void error(TString msg, const char *fname="", int is_error=1)
Definition: printutil.cc:44
def ignore(seq)

◆ setBranch() [17/18]

template<>
void RooUtil::TTreeX::setBranch ( TString  bn,
unsigned long long  val,
bool  force,
bool  ignore 
)

Definition at line 259 of file ttreex.cc.

References RooUtil::error(), cmsStageWithFailover::force, SequenceTypes::ignore(), and heppy_batch::val.

259  {
260  if (force) {
261  mapULL[bn.Data()] = val;
262  mapIsBranchSet[bn.Data()] = true;
263  return;
264  }
265  if (mapULL.find(bn.Data()) != mapULL.end()) {
266  mapULL[bn.Data()] = val;
267  mapIsBranchSet[bn.Data()] = true;
268  } else {
269  if (!ignore)
270  error(TString::Format("branch doesn't exist bn = %s", bn.Data()));
271  }
272 }
std::map< TString, Bool_t > mapIsBranchSet
Definition: ttreex.h:110
void error(TString msg, const char *fname="", int is_error=1)
Definition: printutil.cc:44
std::map< TString, unsigned long long > mapULL
Definition: ttreex.h:97
def ignore(seq)

◆ setBranch() [18/18]

template<>
void RooUtil::TTreeX::setBranch ( TString  bn,
unsigned int  val,
bool  force,
bool  ignore 
)

Definition at line 274 of file ttreex.cc.

References RooUtil::error(), cmsStageWithFailover::force, SequenceTypes::ignore(), and heppy_batch::val.

274  {
275  if (force) {
276  mapUI[bn.Data()] = val;
277  mapIsBranchSet[bn.Data()] = true;
278  return;
279  }
280  if (mapUI.find(bn.Data()) != mapUI.end()) {
281  mapUI[bn.Data()] = val;
282  mapIsBranchSet[bn.Data()] = true;
283  } else {
284  if (!ignore)
285  error(TString::Format("branch doesn't exist bn = %s", bn.Data()));
286  }
287 }
std::map< TString, Bool_t > mapIsBranchSet
Definition: ttreex.h:110
void error(TString msg, const char *fname="", int is_error=1)
Definition: printutil.cc:44
def ignore(seq)
std::map< TString, unsigned int > mapUI
Definition: ttreex.h:98

◆ setFlatBranch()

void TTreeX::setFlatBranch ( std::vector< TString >  p4_bns,
std::vector< TString >  float_bns,
std::vector< TString >  int_bns,
std::vector< TString >  bool_bns,
int  multiplicity 
)

Definition at line 140 of file ttreex.cc.

References mps_fire::i, and createfilelist::int.

144  {
145  for (auto& p4_bn : p4_bns) {
146  const std::vector<LV>& vec = getBranch<std::vector<LV>>(p4_bn, false);
147  for (int i = 0; i < multiplicity && i < (int)vec.size(); ++i)
148  setBranch<LV>(TString::Format("%s_%d", p4_bn.Data(), i), vec[i]);
149  }
150  for (auto& float_bn : float_bns) {
151  const std::vector<float>& vec = getBranch<std::vector<float>>(float_bn, false);
152  for (int i = 0; i < multiplicity && i < (int)vec.size(); ++i)
153  setBranch<float>(TString::Format("%s_%d", float_bn.Data(), i), vec[i]);
154  }
155  for (auto& int_bn : int_bns) {
156  const std::vector<int>& vec = getBranch<std::vector<int>>(int_bn, false);
157  for (int i = 0; i < multiplicity && i < (int)vec.size(); ++i)
158  setBranch<int>(TString::Format("%s_%d", int_bn.Data(), i), vec[i]);
159  }
160  for (auto& bool_bn : bool_bns) {
161  const std::vector<bool>& vec = getBranch<std::vector<bool>>(bool_bn, false);
162  for (int i = 0; i < multiplicity && i < (int)vec.size(); ++i)
163  setBranch<bool>(TString::Format("%s_%d", bool_bn.Data(), i), vec[i]);
164  }
165 }

◆ setTree()

void RooUtil::TTreeX::setTree ( TTree *  tree)
inline

Definition at line 118 of file ttreex.h.

References make_classfiles::tree, and ttree.

118 { ttree = tree; }
TTree * ttree
Definition: ttreex.h:90

◆ sortFromRef()

template<class T >
std::vector< T > RooUtil::TTreeX::sortFromRef ( std::vector< T > const &  in,
std::vector< std::pair< size_t, lviter >> const &  reference 
)

Definition at line 417 of file ttreex.h.

References dqmdumpme::first, mps_fire::i, recoMuon::in, dtT0AbsoluteReferenceCorrection_cfg::reference, and runTheMatrix::ret.

418  {
419  std::vector<T> ret(in.size());
420 
421  size_t const size = in.size();
422  for (size_t i = 0; i < size; ++i)
423  ret[i] = in[reference[i].first];
424 
425  return ret;
426  }
size
Write out results.
ret
prodAgent to be discontinued

◆ sortVecBranchesByPt()

void TTreeX::sortVecBranchesByPt ( TString  p4_bn,
std::vector< TString >  aux_float_bns,
std::vector< TString >  aux_int_bns,
std::vector< TString >  aux_bool_bns 
)

Definition at line 85 of file ttreex.cc.

References ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, mapVecBool_t, mapVecFloat_t, mapVecInt_t, mapVecLV, create_idmaps::n, eventshapeDQM_cfi::order, config::ordering, and jetUpdater_cfi::sort.

88  {
89  // https://stackoverflow.com/questions/236172/how-do-i-sort-a-stdvector-by-the-values-of-a-different-stdvector
90  // The first argument is the p4 branches
91  // The rest of the argument holds the list of auxilary branches that needs to be sorted together.
92 
93  // Creating a "ordered" index list
94  std::vector<std::pair<size_t, lviter>> order(mapVecLV[p4_bn.Data()].size());
95 
96  size_t n = 0;
97  for (lviter it = mapVecLV[p4_bn.Data()].begin(); it != mapVecLV[p4_bn.Data()].end(); ++it, ++n)
98  order[n] = make_pair(n, it);
99 
100  sort(order.begin(), order.end(), ordering());
101 
102  // Sort!
103  mapVecLV[p4_bn.Data()] = sortFromRef<LV>(mapVecLV[p4_bn.Data()], order);
104 
105  for (auto& aux_float_bn : aux_float_bns)
106  mapVecFloat_t[aux_float_bn.Data()] = sortFromRef<Float_t>(mapVecFloat_t[aux_float_bn.Data()], order);
107 
108  for (auto& aux_int_bn : aux_int_bns)
109  mapVecInt_t[aux_int_bn.Data()] = sortFromRef<Int_t>(mapVecInt_t[aux_int_bn.Data()], order);
110 
111  for (auto& aux_bool_bn : aux_bool_bns)
112  mapVecBool_t[aux_bool_bn.Data()] = sortFromRef<Bool_t>(mapVecBool_t[aux_bool_bn.Data()], order);
113 }
std::map< TString, std::vector< LV > > mapVecLV
Definition: ttreex.h:104
std::vector< LV >::const_iterator lviter
Definition: ttreex.h:87
std::map< TString, std::vector< Int_t > > mapVecInt_t
Definition: ttreex.h:99
std::map< TString, std::vector< Bool_t > > mapVecBool_t
Definition: ttreex.h:101
std::map< TString, std::vector< Float_t > > mapVecFloat_t
Definition: ttreex.h:102
ordering
Definition: config.py:7

◆ write()

void RooUtil::TTreeX::write ( )
inline

Definition at line 123 of file ttreex.h.

References ttree.

123 { ttree->Write(); }
TTree * ttree
Definition: ttreex.h:90

Member Data Documentation

◆ mapBool_t

std::map< TString , Bool_t> RooUtil::TTreeX::mapBool_t
private

Definition at line 92 of file ttreex.h.

◆ mapFloat_t

std::map< TString , Float_t> RooUtil::TTreeX::mapFloat_t
private

Definition at line 93 of file ttreex.h.

◆ mapFloatFunc_t

std::map< TString , std::function<float()> > RooUtil::TTreeX::mapFloatFunc_t
private

Definition at line 108 of file ttreex.h.

◆ mapInt_t

std::map< TString , Int_t> RooUtil::TTreeX::mapInt_t
private

Definition at line 91 of file ttreex.h.

◆ mapIsBranchSet

std::map< TString , Bool_t> RooUtil::TTreeX::mapIsBranchSet
private

Definition at line 110 of file ttreex.h.

◆ mapLV

std::map< TString , LV> RooUtil::TTreeX::mapLV
private

Definition at line 95 of file ttreex.h.

◆ mapTBits

std::map< TString , TBits> RooUtil::TTreeX::mapTBits
private

Definition at line 96 of file ttreex.h.

◆ mapTString

std::map< TString , TString> RooUtil::TTreeX::mapTString
private

Definition at line 94 of file ttreex.h.

◆ mapUI

std::map< TString , unsigned int> RooUtil::TTreeX::mapUI
private

Definition at line 98 of file ttreex.h.

◆ mapULL

std::map< TString , unsigned long long> RooUtil::TTreeX::mapULL
private

Definition at line 97 of file ttreex.h.

◆ mapVecBool_t

std::map< TString , std::vector<Bool_t> > RooUtil::TTreeX::mapVecBool_t
private

Definition at line 101 of file ttreex.h.

Referenced by sortVecBranchesByPt().

◆ mapVecFloat_t

std::map< TString , std::vector<Float_t> > RooUtil::TTreeX::mapVecFloat_t
private

Definition at line 102 of file ttreex.h.

Referenced by sortVecBranchesByPt().

◆ mapVecInt_t

std::map< TString , std::vector<Int_t> > RooUtil::TTreeX::mapVecInt_t
private

Definition at line 99 of file ttreex.h.

Referenced by sortVecBranchesByPt().

◆ mapVecLV

std::map< TString , std::vector<LV> > RooUtil::TTreeX::mapVecLV
private

Definition at line 104 of file ttreex.h.

Referenced by sortVecBranchesByPt().

◆ mapVecTString

std::map< TString , std::vector<TString> > RooUtil::TTreeX::mapVecTString
private

Definition at line 103 of file ttreex.h.

◆ mapVecUInt_t

std::map< TString , std::vector<UInt_t> > RooUtil::TTreeX::mapVecUInt_t
private

Definition at line 100 of file ttreex.h.

◆ mapVecVFloat

std::map< TString , std::vector<std::vector<Float_t> > > RooUtil::TTreeX::mapVecVFloat
private

Definition at line 106 of file ttreex.h.

◆ mapVecVInt

std::map< TString , std::vector<std::vector<Int_t> > > RooUtil::TTreeX::mapVecVInt
private

Definition at line 105 of file ttreex.h.

◆ ttree

TTree* RooUtil::TTreeX::ttree
private

Definition at line 90 of file ttreex.h.

Referenced by fill(), get(), getTree(), setTree(), and write().