Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Functions
JetCalibUtils Namespace Reference

Functions

StrV Vectorize (const TString &str, const TString &sep=" ")
 
VecD VectorizeD (const TString &str, const TString &sep=" ")
 
std::unique_ptr< const TH1 > GetHisto (TFile &file, const TString &hname)
 
std::unique_ptr< const TH2 > GetHisto2 (TFile &file, const TString &hname)
 
std::unique_ptr< const TH3 > GetHisto3 (TFile &file, const TString &hname)
 
TTree * setTree (TTree *tree)
 
template<typename VXCONT >
int countNPV (const VXCONT &vxCont)
 
template<class H >
std::unique_ptr< const H > GetHisto_impl (TFile &file, const TString &hname)
 

Function Documentation

◆ countNPV()

template<typename VXCONT >
int JetCalibUtils::countNPV ( const VXCONT &  vxCont)

Definition at line 39 of file JetCalibUtils.h.

39  {
40  int eventNPV = 0;
41  for(const xAOD::Vertex* vtx: vxCont){
42  if ( vtx->vertexType() == xAOD::VxType::PriVtx || vtx->vertexType() == xAOD::VxType::PileUp) ++eventNPV;
43  }
44  return eventNPV;
45  }

◆ GetHisto()

std::unique_ptr< const TH1 > JetCalibUtils::GetHisto ( TFile &  file,
const TString &  hname 
)

Definition at line 50 of file JetCalibUtils.cxx.

50  {
51  return GetHisto_impl<TH1>(file, hname);
52  }

◆ GetHisto2()

std::unique_ptr< const TH2 > JetCalibUtils::GetHisto2 ( TFile &  file,
const TString &  hname 
)

Definition at line 54 of file JetCalibUtils.cxx.

54  {
55  return GetHisto_impl<TH2>(file, hname);
56  }

◆ GetHisto3()

std::unique_ptr< const TH3 > JetCalibUtils::GetHisto3 ( TFile &  file,
const TString &  hname 
)

Definition at line 58 of file JetCalibUtils.cxx.

58  {
59  return GetHisto_impl<TH3>(file, hname);
60  }

◆ GetHisto_impl()

template<class H >
std::unique_ptr<const H> JetCalibUtils::GetHisto_impl ( TFile &  file,
const TString &  hname 
)

Definition at line 38 of file JetCalibUtils.cxx.

38  {
39  std::unique_ptr<H> h(static_cast<H*>(file.Get(hname)));
40  if (h==nullptr) {
41  std::cout << "WARNING: Cannot access histogram " << hname.Data()
42  << " in file " << file.GetName() << std::endl;
43  }
44  else {
45  h->SetDirectory(nullptr); // make histogram memory-resident
46  }
47  return h;
48  }

◆ setTree()

TTree * JetCalibUtils::setTree ( TTree *  tree)

Definition at line 62 of file JetCalibUtils.cxx.

62 { return tree; }

◆ Vectorize()

StrV JetCalibUtils::Vectorize ( const TString &  str,
const TString &  sep = " " 
)

Definition at line 14 of file JetCalibUtils.cxx.

15  {
16  StrV result;
17  TObjArray* tokens = str.Tokenize(sep);
18  TIter istr(tokens);
19  while (TObjString* os=(TObjString*)istr())
20  result.push_back(os->GetString());
21  delete tokens;
22  return result;
23  }

◆ VectorizeD()

VecD JetCalibUtils::VectorizeD ( const TString &  str,
const TString &  sep = " " 
)

Definition at line 25 of file JetCalibUtils.cxx.

26  {
27  std::vector<double> result;
28  std::unique_ptr<TObjArray> tokens(str.Tokenize(sep));
29  std::unique_ptr<TIter> istr(new TIter(tokens.get()));
30  while (TObjString* os = dynamic_cast<TObjString*>(istr->Next())) {
31  result.push_back(atof(os->GetString()));
32  }
33 
34  return result;
35  }
get_generator_info.result
result
Definition: get_generator_info.py:21
dqt_zlumi_pandas.hname
string hname
Definition: dqt_zlumi_pandas.py:279
tree
TChain * tree
Definition: tile_monitor.h:30
beamspotman.tokens
tokens
Definition: beamspotman.py:1284
H
#define H(x, y, z)
Definition: MD5.cxx:114
extractSporadic.h
list h
Definition: extractSporadic.py:97
xAOD::VxType::PriVtx
@ PriVtx
Primary vertex.
Definition: TrackingPrimitives.h:572
file
TFile * file
Definition: tile_monitor.h:29
ReadFromCoolCompare.os
os
Definition: ReadFromCoolCompare.py:231
CxxUtils::atof
double atof(std::string_view str)
Converts a string into a double / float.
Definition: Control/CxxUtils/Root/StringUtils.cxx:91
grepfile.sep
sep
Definition: grepfile.py:38
xAOD::VxType::PileUp
@ PileUp
Pile-up vertex.
Definition: TrackingPrimitives.h:574
StrV
std::vector< TString > StrV
Definition: JetCalibUtils.h:22
h
xAOD::Vertex_v1
Class describing a Vertex.
Definition: Vertex_v1.h:42
str
Definition: BTagTrackIpAccessor.cxx:11